Make table rows clickable using javascript. Use this functionality in the top X lists and in the test results table

This commit is contained in:
Chris Morgan
2006-07-21 04:34:58 +00:00
committed by WineHQ
parent f73d9c0283
commit c726511204
5 changed files with 33 additions and 5 deletions

View File

@@ -62,6 +62,14 @@ function html_tr($arr, $class = "", $extra = "")
return do_html_tr("td", $arr, $class, $extra); 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 // HTML TABLE
function html_table_begin($extra = "") function html_table_begin($extra = "")
{ {

View File

@@ -409,15 +409,16 @@ class testData{
$oSubmitter = new User($oTest->iSubmitterId); $oSubmitter = new User($oTest->iSubmitterId);
$oDistribution = new distribution($oTest->iDistributionId); $oDistribution = new distribution($oTest->iDistributionId);
$bgcolor = $oTest->sTestedRating; $bgcolor = $oTest->sTestedRating;
echo '<tr class='.$bgcolor.'>',"\n";
/* if the test we are displaying is this test then */ /* if the test we are displaying is this test then */
/* mark it as the current test */ /* mark it as the current test */
if ($oTest->iTestingId == $this->iTestingId) if ($oTest->iTestingId == $this->iTestingId)
{ {
echo '<tr class='.$bgcolor.'>',"\n";
echo ' <td align="center" class="color2"><b>Current</b></td>',"\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; echo ' <td align="center" class="color2">[<a href="'.$link.$oTest->iTestingId;
if(is_string($showAll)) if(is_string($showAll))

View File

@@ -280,9 +280,10 @@ function outputTopXRow($oRow)
$oVersion = new Version($oRow->versionId); $oVersion = new Version($oRow->versionId);
$oApp = new Application($oVersion->iAppId); $oApp = new Application($oVersion->iAppId);
$img = Screenshot::get_random_screenshot_img(null, $oRow->versionId, false); // image, disable extra formatting $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 ' echo '
<tr class="white"> <td class="app_name">
<td class="app_name"><a href="appview.php?iVersionId='.$oRow->versionId.'">'.$oApp->sName.' '.$oVersion->sName.'</a></td> <a href="appview.php?iVersionId='.$oRow->versionId.'">'.$oApp->sName.' '.$oVersion->sName.'</a></td>
<td>'.util_trim_description($oApp->sDescription).'</td> <td>'.util_trim_description($oApp->sDescription).'</td>
<td><center>'.$img.'</center></td> <td><center>'.$img.'</center></td>
</tr>'; </tr>';

View File

@@ -13,7 +13,6 @@ require(BASE."include/incl.php");
apidb_header("Wine Application Database"); apidb_header("Wine Application Database");
?> ?>
<img src="images/appdb_montage.jpg" width=391 height=266 align=right alt="Wine AppDB"> <img src="images/appdb_montage.jpg" width=391 height=266 align=right alt="Wine AppDB">
<h1>Welcome</h1> <h1>Welcome</h1>

View File

@@ -18,3 +18,22 @@ function deleteURL(text, url) {
self.location = 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;
}