From: Sebastien D. <sde...@us...> - 2005-01-11 10:13:55
|
Update of /cvsroot/tslogparser/tslogparser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19991 Modified Files: HISTORY database.inc.php run-browse.php session.inc.php Log Message: Update browser interface Index: run-browse.php =================================================================== RCS file: /cvsroot/tslogparser/tslogparser/run-browse.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- run-browse.php 3 Jan 2005 16:27:49 -0000 1.4 +++ run-browse.php 11 Jan 2005 10:13:43 -0000 1.5 @@ -33,6 +33,72 @@ require($root."header.inc.php"); +echo "<p>Go to <a href=\"".$root."admin/\">Administration Interface</a></p>\n"; + +if (isset($_GET["deselect_module"])) + unset($_SESSION["module"]); + +/* Count runs by modules in the database */ +$sql = " SELECT DISTINCT ver_module, ver_id, res_run" + ." FROM opts_versions, opts_version_descriptions, opts_run_results" + ." WHERE ver_id=descr_version" + ." AND res_testcase=descr_id"; +$runs = db_execute_select($sql); + +$infos=array(); +foreach ($runs as $row) + if (isset($infos[$row["ver_module"]])) + $infos[$row["ver_module"]]++; + else + $infos[$row["ver_module"]]=1; + +if (isset($_GET["module"])) + if (isset($infos[$_GET["module"]])) + $_SESSION["module"]=$_GET["module"]; + +/* If we found no showable results */ +if (count($infos)==0) +{ + echo "<p>There is no displayable result in the database yet.\n"; + echo "You may add some from the Administration Interface.</p>"; + db_fini(); + require($root."footer.inc.php"); + die(); +} + +/* If we have only 1 module, we don't need to ask the user */ +if (count($infos)==1) + $_SESSION["module"]=$runs[0]["ver_module"]; + +/* Otherwise, the user need to choose a module */ +if (count($infos)>1) +{ + if (!isset($_SESSION["module"])) + { + /* Show modules list and let the user choose one */ + echo "<p>Please choose a module from the list:</p>\n"; + echo "<ul>\n"; + foreach ($infos as $module => $cnt) + { + echo "<li><a href=\"".$_SERVER["PHP_SELF"]."?module=$module\">"; + echo "<b>$module</b></a> ($cnt logfiles)</li>\n"; + } + echo "</ul>\n"; + db_fini(); + require($root."footer.inc.php"); + die(); + } + else + { + /* Show selected module and let the user cancel its selection */ + echo "<p>You're viewing the <i>".$_SESSION["module"]."</i> results currently.\n"; + echo "<a href=\"".$_SERVER["PHP_SELF"]."?deselect_module=1\">"; + echo "Click here</a> to change.</p>\n"; + } +} + + +/* Now, proceed to the display */ /* @@ -47,18 +113,20 @@ ." WHERE " ." ver_id=descr_version"; */ - $sql= " SELECT DISTINCT ver_name, ver_comment, ver_id " ." FROM opts_versions, opts_version_descriptions" ." WHERE ver_id = descr_version " + ." AND ver_module = ".stringToDB($_SESSION["module"]) ." ORDER BY ver_id DESC"; $release_table = db_execute_select($sql); + $sql= " SELECT DISTINCT run_name, run_comments, ver_name, run_id " ." FROM opts_run, opts_run_results, opts_version_descriptions, opts_versions " ." WHERE run_id=res_run" ." AND res_testcase=descr_id" ." AND descr_version=ver_id" + ." AND ver_module = ".stringToDB($_SESSION["module"]) ." ORDER BY ver_name"; $run_table = db_execute_select($sql); @@ -82,11 +150,11 @@ /* Ok, now we'll display the result on the html page */ ?> - <h3>Available results in database</h3> + <h3>Available results for the <?php echo $_SESSION["module"]; ?> module</h3> <table border="1"> <tr> - <td valign='top' align='center'><b>TestSuite Release</b> (<a href="admin/parse-opts-release.php">add</a>)</td> + <td valign='top' align='center'><b>TestSuite Release</b></td> <td valign='top' align='center' colspan="2"><b>Run Designation</b></td> <td valign='top' align='center'><b>Action</b></td> <td valign='top'><b>Comments</b></td> @@ -94,6 +162,7 @@ <?php if (!$infos) { + /* This should never happen */ ?> <tr> <td colspan=5><i>Sorry, no data was found.</i></td> @@ -105,7 +174,7 @@ foreach($infos as $release => $data) { echo " <tr>\n"; - echo " <td"; + echo " <td valign=\"top\""; if (count($data["runs"])>1) echo " rowspan=\"".(count($data["runs"])+2)."\""; elseif (count($data["runs"])==1) @@ -113,16 +182,7 @@ echo ">\n"; echo " <font color='orange'>".stringFromDB($release)."</font>\n"; echo " </td>\n"; - echo " <td colspan='2' align=center>\n"; - echo " <i><font color='orange'>(testsuite)</font></i>\n"; - echo " </td>\n"; - echo " <td>\n"; - echo " <form method='POST' action='admin/enter-new-run.php'>\n"; - echo " <input type='hidden' name='opts_release' value=\"".$data["id"]."\">\n"; - echo " <input type='submit' name='Add' value='Add a new run'>\n"; - echo " </form>\n"; - echo " </td>\n"; - echo " <td>\n"; + echo " <td colspan='4' align=left>\n"; echo " <i><font color='orange'>".stringFromDB($data["comment"])."</font></i>\n"; echo " </td>\n"; echo " </tr>\n"; Index: database.inc.php =================================================================== RCS file: /cvsroot/tslogparser/tslogparser/database.inc.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- database.inc.php 10 Jan 2005 18:09:51 -0000 1.4 +++ database.inc.php 11 Jan 2005 10:13:43 -0000 1.5 @@ -46,7 +46,7 @@ /* Initialize link to the db and grep configuration */ function db_init() { - global $db_server,$db_user,$db_pw, $db, $db_link, $CONFIG; + global $db_server,$db_user,$db_pw, $db, $db_link, $CONFIG, $root; $db_link = mysql_connect($db_server,$db_user,$db_pw) or die("Failed to connect to MySQL: ".mysql_error()."\n"); Index: HISTORY =================================================================== RCS file: /cvsroot/tslogparser/tslogparser/HISTORY,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- HISTORY 10 Jan 2005 18:09:49 -0000 1.11 +++ HISTORY 11 Jan 2005 10:13:43 -0000 1.12 @@ -1,3 +1,6 @@ +2005-01-11: +- Update run browser to support modules and new administration interface. + 2005-01-10: - Added database installation and update procedure. - Added checking for database version on each use. Index: session.inc.php =================================================================== RCS file: /cvsroot/tslogparser/tslogparser/session.inc.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- session.inc.php 6 Jan 2005 17:29:49 -0000 1.2 +++ session.inc.php 11 Jan 2005 10:13:43 -0000 1.3 @@ -34,7 +34,7 @@ */ $authorized_session_vars=array( - "current_module"=>array("run-browse.php") + "module"=>array("run-browse.php"), ); |