appdb/ ./index.php ./scripts.js include/html.p ...

WineHQ wineowner at wine.codeweavers.com
Thu Jul 20 23:34:58 CDT 2006


ChangeSet ID:	26699
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2006/07/20 23:34:58

Modified files:
	.              : index.php scripts.js 
	include        : html.php testData.php util.php 

Log message:
	Chris Morgan <cmorgan at alum.wpi.edu>
	Make table rows clickable using javascript.  Use this functionality in the top X lists and in the test results table

Patch: http://cvs.winehq.org/patch.py?id=26699

Old revision  New revision  Changes     Path
 1.37          1.38          +0 -1       appdb/index.php
 1.3           1.4           +19 -0      appdb/scripts.js
 1.8           1.9           +8 -0       appdb/include/html.php
 1.5           1.6           +3 -2       appdb/include/testData.php
 1.72          1.73          +3 -2       appdb/include/util.php

Index: appdb/index.php
diff -u -p appdb/index.php:1.37 appdb/index.php:1.38
--- appdb/index.php:1.37	21 Jul 2006  4:34:58 -0000
+++ appdb/index.php	21 Jul 2006  4:34:58 -0000
@@ -13,7 +13,6 @@ require(BASE."include/incl.php");
 
 apidb_header("Wine Application Database");
 ?>
-
     <img src="images/appdb_montage.jpg" width=391 height=266 align=right alt="Wine AppDB">
     
 <h1>Welcome</h1>
Index: appdb/scripts.js
diff -u -p appdb/scripts.js:1.3 appdb/scripts.js:1.4
--- appdb/scripts.js:1.3	21 Jul 2006  4:34:58 -0000
+++ appdb/scripts.js	21 Jul 2006  4:34:58 -0000
@@ -18,3 +18,22 @@ function deleteURL(text, url) {
 	   self.location = url;
 	}
 }
+
+function ChangeTrColor(tableRow, bHighLight, sHighlightColor, sInactiveColor)
+{
+    if (bHighLight)
+    {
+        tableRow.style.backgroundColor = sHighlightColor;
+        tableRow.style.cursor = "hand";
+    }
+    else
+    {
+        tableRow.style.backgroundColor = sInactiveColor;
+        tableRow.style.cursor = "pointer";
+    }
+}
+
+function DoNav(sUrl)
+{
+    document.location.href = sUrl;
+}
Index: appdb/include/html.php
diff -u -p appdb/include/html.php:1.8 appdb/include/html.php:1.9
--- appdb/include/html.php:1.8	21 Jul 2006  4:34:58 -0000
+++ appdb/include/html.php	21 Jul 2006  4:34:58 -0000
@@ -62,6 +62,14 @@ function html_tr($arr, $class = "", $ext
 	return do_html_tr("td", $arr, $class, $extra);
 }
 
+function html_tr_highlight_clickable($sClass, $sHighlightColor, $sInactiveColor, $sUrl)
+{
+    echo '<tr class='.$sClass.' '.
+        'onmouseover="ChangeTrColor(this, true, \''.$sHighlightColor.'\', \''.$sInactiveColor.'\');"'.
+        'onmouseout="ChangeTrColor(this, false, \''.$sHighlightColor.'\', \''.$sInactiveColor.'\');"'.
+        'onclick="DoNav(\''.$sUrl.'\');">';
+}
+
 // HTML TABLE
 function html_table_begin($extra = "")
 {
Index: appdb/include/testData.php
diff -u -p appdb/include/testData.php:1.5 appdb/include/testData.php:1.6
--- appdb/include/testData.php:1.5	21 Jul 2006  4:34:58 -0000
+++ appdb/include/testData.php	21 Jul 2006  4:34:58 -0000
@@ -409,15 +409,16 @@ class testData{
             $oSubmitter = new User($oTest->iSubmitterId);
             $oDistribution = new distribution($oTest->iDistributionId);
             $bgcolor = $oTest->sTestedRating;
-            echo '<tr class='.$bgcolor.'>',"\n";
 
             /* if the test we are displaying is this test then */
             /* mark it as the current test */
             if ($oTest->iTestingId == $this->iTestingId)
             {
+                echo '<tr class='.$bgcolor.'>',"\n";
                 echo '    <td align="center" class="color2"><b>Current</b></td>',"\n";
-            } else
+            } else /* make all non-current rows clickable so clicking on them selects the test as current */
             {
+                html_tr_highlight_clickable($bgcolor, "", "color2", $link.$oTest->iTestingId); 
                 echo '    <td align="center" class="color2">[<a href="'.$link.$oTest->iTestingId;
 
                 if(is_string($showAll))
Index: appdb/include/util.php
diff -u -p appdb/include/util.php:1.72 appdb/include/util.php:1.73
--- appdb/include/util.php:1.72	21 Jul 2006  4:34:58 -0000
+++ appdb/include/util.php	21 Jul 2006  4:34:58 -0000
@@ -280,9 +280,10 @@ function outputTopXRow($oRow)
     $oVersion = new Version($oRow->versionId);
     $oApp = new Application($oVersion->iAppId);
     $img = Screenshot::get_random_screenshot_img(null, $oRow->versionId, false); // image, disable extra formatting
+    html_tr_highlight_clickable("white", "white", "white", 'appview.php?iVersionId='.$oRow->versionId);
     echo '
-    <tr class="white">
-      <td class="app_name"><a href="appview.php?iVersionId='.$oRow->versionId.'">'.$oApp->sName.' '.$oVersion->sName.'</a></td>
+      <td class="app_name">
+            <a href="appview.php?iVersionId='.$oRow->versionId.'">'.$oApp->sName.' '.$oVersion->sName.'</a></td>
       <td>'.util_trim_description($oApp->sDescription).'</td>
       <td><center>'.$img.'</center></td>
     </tr>';



More information about the wine-cvs mailing list