Programmatic table support. Enhances several tables with highlightable and clickable rows and

cleans up the existing table row highlight and click code.
This commit is contained in:
Chris Morgan
2007-07-23 19:56:43 +00:00
committed by WineHQ
parent 8c2959494d
commit 2652e68d01
21 changed files with 1369 additions and 461 deletions

View File

@@ -45,36 +45,57 @@ if($subs)
echo html_frame_end(); echo html_frame_end();
echo html_frame_start("","98%","",0); echo html_frame_start("","98%","",0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
echo "<tr class=color4>\n"; $oTable = new Table();
echo " <td>Sub Category</td>\n"; $oTable->SetWidth("100%");
echo " <td>Description</td>\n"; $oTable->SetBorder(0);
echo " <td>No. Apps</td>\n"; $oTable->SetCellPadding(3);
echo "</tr>\n\n"; $oTable->SetCellSpacing(1);
$oTableRow = new TableRow();
$oTableRow->SetClass("color4");
$oTableRow->AddTextCell("Sub Category");
$oTableRow->AddTextCell("Description");
$oTableRow->AddTextCell("No. Apps");
$oTable->SetHeader($oTableRow);
while(list($i,$iSubcatId) = each($subs)) while(list($i,$iSubcatId) = each($subs))
{ {
$oSubCat= new Category($iSubcatId); $oSubCat= new Category($iSubcatId);
//set row color //set row color
$bgcolor = ($i % 2) ? "color0" : "color1"; $sColor = ($i % 2) ? "color0" : "color1";
$oTableRowHighlight = GetStandardRowHighlight($i);
$sUrl = "appbrowse.php?iCatId=$iSubcatId";
$oTableRowClick = new TableRowClick($sUrl);
$oTableRowClick->SetHighlight($oTableRowHighlight);
//get number of apps in this sub-category //get number of apps in this sub-category
$appcount = $oSubCat->getApplicationCount(); $iAppcount = $oSubCat->getApplicationCount();
//format desc //format desc
$desc = substr(stripslashes($oSubCat->sDescription),0,70); $sDesc = substr(stripslashes($oSubCat->sDescription),0,70);
//display row //display row
echo "<tr class=$bgcolor>\n"; $oTableRow = new TableRow();
echo " <td><a href='appbrowse.php?iCatId=$iSubcatId'>".$oSubCat->sName."</a></td>\n"; $oTableRow->SetClass($sColor);
echo " <td>$desc &nbsp;</td>\n"; $oTableRow->SetRowClick($oTableRowClick);
echo " <td>$appcount &nbsp;</td>\n";
echo "</tr>\n\n"; $oTableCell = new TableCell($oSubCat->sName);
$oTableCell->SetCellLink($sUrl);
$oTableRow->AddCell($oTableCell);
$oTableRow->AddTextCell("$sDesc &nbsp;");
$oTableRow->AddTextCell("$iAppcount &nbsp;");
$oTable->AddRow($oTableRow);
} }
echo "</table>\n\n"; // output the table
echo $oTable->GetString();
echo html_frame_end("$c categories"); echo html_frame_end("$c categories");
} }
@@ -89,33 +110,52 @@ if($apps)
echo html_frame_end(); echo html_frame_end();
echo html_frame_start("","98%","",0); echo html_frame_start("","98%","",0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
echo "<tr class=color4>\n"; $oTable = new Table();
echo " <td>Application Name</td>\n"; $oTable->SetWidth("100%");
echo " <td>Description</td>\n"; $oTable->SetBorder(0);
echo " <td>No. Versions</td>\n"; $oTable->SetCellPadding(3);
echo "</tr>\n\n"; $oTable->SetCellSpacing(1);
$oTableRow = new TableRow();
$oTableRow->SetClass("color4");
$oTableRow->AddTextCell("Application name");
$oTableRow->AddTextCell("Description");
$oTableRow->AddTextCell("No. Versions");
$oTable->SetHeader($oTableRow);
while(list($i, $iAppId) = each($apps)) while(list($i, $iAppId) = each($apps))
{ {
$oApp = new Application($iAppId); $oApp = new Application($iAppId);
//set row color //set row color
$bgcolor = ($i % 2) ? "color0" : "color1"; $sColor = ($i % 2) ? "color0" : "color1";
$oTableRowHighlight = GetStandardRowHighlight($i);
$sUrl = $oApp->objectMakeUrl();
$oTableRowClick = new TableRowClick($sUrl);
$oTableRowClick->SetHighlight($oTableRowHighlight);
//format desc //format desc
$desc = util_trim_description($oApp->sDescription); $sDesc = util_trim_description($oApp->sDescription);
//display row //display row
echo "<tr class=$bgcolor>\n"; $oTableRow = new TableRow();
echo " <td>".$oApp->objectMakeLink()."</td>\n"; $oTableRow->SetRowClick($oTableRowClick);
echo " <td>$desc &nbsp;</td>\n"; $oTableRow->SetClass($sColor);
echo " <td>".sizeof($oApp->aVersionsIds)."</td>\n"; $oTableRow->AddTextCell($oApp->objectMakeLink());
echo "</tr>\n\n"; $oTableRow->AddTextCell("$sDesc &nbsp;");
$oTableRow->AddTextCell(sizeof($oApp->aVersionsIds));
$oTable->AddRow($oTableRow);
} }
echo "</table>\n\n"; // output table
echo $oTable->GetString();
echo html_frame_end("$c applications in this category"); echo html_frame_end("$c applications in this category");
} }

View File

@@ -22,38 +22,75 @@ if (empty($aClean['sRating']))
echo "<b>Rating: $sPathtrail</b>"; echo "<b>Rating: $sPathtrail</b>";
echo html_frame_end(); echo html_frame_end();
echo html_frame_start("", '98%', '', 2); echo html_frame_start("", '98%', '', 2);
echo "<table width=100% border=0 cellspacing=1 cellpadding=3\n";
echo " <tr class=color4>\n"; // create the table
echo " <td><b>Rating</b></td>\n"; $oTable = new Table();
echo " <td><b>Description</b></td>\n"; $oTable->SetCellSpacing(1);
echo " <td><b>No. Apps</b></td>\n"; $oTable->SetCellPadding(3);
echo " </tr>\n"; $oTable->SetBorder(0);
html_tr_highlight_clickable("browse_by_rating.php?sRating=".PLATINUM_RATING, "platinum", "platinum", "platinum"); $oTable->SetWidth("100%");
echo " <td><a href=\"browse_by_rating.php?sRating=".PLATINUM_RATING."\">Platinum</a></td>";
echo " <td>Applications that install and run out of the box</td>\n"; // create the header row
echo " <td>".Application::countWithRating(PLATINUM_RATING)."</td>\n"; $aHeaderCells = array();
echo " </tr>\n"; $oTableCell = new TableCell("Rating");
html_tr_highlight_clickable("browse_by_rating.php?sRating=".GOLD_RATING, "gold", "gold", "gold"); $oTableCell->SetBold(true);
echo " <td><a href=\"browse_by_rating.php?sRating=".GOLD_RATING."\">Gold</a></td>"; $aHeaderCells[] = $oTableCell;
echo " <td>Applications that work flawlessly with some DLL overrides or other settings, crack etc.</td>\n";
echo " <td>".Application::countWithRating(GOLD_RATING)."</td>\n"; $oTableCell = new TableCell("Description");
echo " </tr>\n"; $oTableCell->SetBold(true);
html_tr_highlight_clickable("browse_by_rating.php?sRating=".SILVER_RATING, "silver", "silver", "silver"); $aHeaderCells[] = $oTableCell;
echo " <td><a href=\"browse_by_rating.php?sRating=".SILVER_RATING."\">Silver</a></td>";
echo " <td>Applications that work excellently for 'normal use'</td>\n"; $oTableCell = new TableCell("No. Apps");
echo " <td>".Application::countWithRating(SILVER_RATING)."</td>\n"; $oTableCell->SetBold(true);
echo " </tr>\n"; $aHeaderCells[] = $oTableCell;
html_tr_highlight_clickable("browse_by_rating.php?sRating=".BRONZE_RATING, "bronze", "bronze", "bronze");
echo " <td><a href=\"browse_by_rating.php?sRating=".BRONZE_RATING."\">Bronze</a></td>"; $oTableRowHeader = new TableRow();
echo " <td>Applications that work but have some issues, even for 'normal use'</td>\n"; $oTableRowHeader->AddCells($aHeaderCells);
echo " <td>".Application::countWithRating(BRONZE_RATING)."</td>\n"; $oTableRowHeader->SetClass("color4");
echo " </tr>\n";
html_tr_highlight_clickable("browse_by_rating.php?sRating=".GARBAGE_RATING, "garbage", "garbage", "garbage"); $oTable->SetHeader($oTableRowHeader);
echo " <td><a href=\"browse_by_rating.php?sRating=".GARBAGE_RATING."\">Garbage</a></td>";
echo " <td>Applications that don't work as intended, there should be at least one bug report if an app gets this rating</td>\n"; // setup arrays for processing in the below loop
echo " <td>".Application::countWithRating(GARBAGE_RATING)."</td>\n"; $aColorName = array("Platinum", "Gold", "Silver", "Bronze", "Garbage");
echo " </tr>\n"; $aRating = array(PLATINUM_RATING, GOLD_RATING, SILVER_RATING,
echo "</table>\n"; BRONZE_RATING, GARBAGE_RATING);
$aRatingText = array("Applications that install and run out of the box",
"Applications that work flawlessly with some DLL overrides or other settings, crack etc.",
"Applications that work excellently for 'normal use'",
"Applications that work but have some issues, even for 'normal use'",
"Applications that don't work as intended, there should be at least one bug report if an app gets this rating");
$iIndex = 0;
foreach($aColorName as $sColor)
{
$oTableRow = new TableRow();
$oTableRow->SetClass($aRating[$iIndex]);
$sUrl = "browse_by_rating.php?sRating=".$aRating[$iIndex];
$oTableCell = new TableCell($aColorName[$iIndex]);
$oTableCell->SetCellLink($sUrl);
$oTableRow->AddCell($oTableCell);
$oTableRow->AddTextCell($aRatingText[$iIndex]);
$oTableRow->AddTextCell(Application::countWithRating($aRating[$iIndex]));
// click entry for the row
$oInactiveColor = new color();
$oInactiveColor->SetColorByName($aColorName[$iIndex]);
$oHighlightColor = GetHighlightColorFromInactiveColor($oInactiveColor);
$oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
$oTableRowClick = new TableRowClick($sUrl);
$oTableRowClick->SetHighlight($oTableRowHighlight);
// set the clickable row
$oTableRow->SetRowClick($oTableRowClick);
$oTable->AddRow($oTableRow);
$iIndex++;
}
echo $oTable->GetString();
echo html_frame_end(); echo html_frame_end();
} else } else
@@ -142,33 +179,60 @@ if (empty($aClean['sRating']))
echo "</center>"; echo "</center>";
echo html_frame_start("","98%","",0); echo html_frame_start("","98%","",0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
echo "<tr class=color4>\n"; $oTable = new Table();
echo " <td><b>Application Name</b></td>\n"; $oTable->SetWidth("100%");
echo " <td><b>Description</b></td>\n"; $oTable->SetBorder(0);
echo " <td><b>No. Versions</b></td>\n"; $oTable->SetCellPadding(3);
echo "</tr>\n\n"; $oTable->SetCellSpacing(1);
while(list($i, $iAppId) = each($apps)) $oTableRow = new TableRow();
$oTableRow->SetClass("color4");
$oTableCell = new TableCell("Application Name");
$oTableCell->SetBold(true);
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell("Description");
$oTableCell->SetBold(true);
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell("No. Versions");
$oTableCell->SetBold(true);
$oTableRow->AddCell($oTableCell);
$oTable->AddRow($oTableRow);
while(list($iIndex, $iAppId) = each($apps))
{ {
$oApp = new Application($iAppId); $oApp = new Application($iAppId);
//set row color $oTableRowHighlight = GetStandardRowHighlight($iIndex);
$bgcolor = ($i % 2) ? "color0" : "color1";
$sUrl = $oApp->objectMakeUrl();
$sColor = ($iIndex % 2) ? "color0" : "color1";
$oTableRowClick = new TableRowClick($sUrl);
$oTableRowClick->SetHighlight($oTableRowHighlight);
//format desc //format desc
$desc = util_trim_description($oApp->sDescription); $sDesc = util_trim_description($oApp->sDescription);
//display row //display row
echo "<tr class=$bgcolor>\n"; $oTableRow = new TableRow();
echo " <td>".$oApp->objectMakeLink()."</td>\n"; $oTableRow->SetRowClick($oTableRowClick);
echo " <td>$desc &nbsp;</td>\n"; $oTableRow->SetClass($sColor);
echo " <td>".sizeof($oApp->aVersionsIds)."</td>\n";
echo "</tr>\n\n"; $oTableRow->AddTextCell($oApp->objectMakeLink());
$oTableRow->AddTextCell("$sDesc &nbsp;");
$oTableRow->AddTextCell(sizeof($oApp->aVersionsIds));
$oTable->AddRow($oTableRow);
} }
echo "</table>\n\n"; // output the table
echo $oTable->GetString();
echo html_frame_end(); echo html_frame_end();
echo "<center>"; echo "<center>";

View File

@@ -108,29 +108,53 @@ if(!$sLicense)
if($hResult && mysql_num_rows($hResult)) if($hResult && mysql_num_rows($hResult))
{ {
echo html_frame_start("", "90%"); echo html_frame_start("", "90%");
echo html_table_begin("width=\"100%\" align=\"center\"");
echo html_tr(array(
"<b>Name</b>",
"<b>Description</b>"),
"color4");
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++) $oTable = new Table();
$oTable->SetWidth("100%");
$oTable->SetAlign("center");
$oTableRow = new TableRow();
$oTableCell = new TableCell("Name");
$oTableCell->SetBold(true);
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell("Description");
$oTableCell->SetBold(true);
$oTableRow->AddCell($oTableCell);
$oTableRow->SetClass("color4");
$oTable->AddRow($oTableRow);
for($iIndex = 1; $oRow = mysql_fetch_object($hResult); $iIndex++)
{ {
$oVersion = new version($oRow->versionId); $oVersion = new version($oRow->versionId);
echo html_tr_highlight_clickable(
$oVersion->objectMakeUrl(), $oTableRow = new TableRow();
($i % 2) ? "color1" : "color0", if($iIndex % 2)
($i % 2) ? "color1" : "color0", $sColor = "color1";
($i % 2) ? "color1" : "color0"); else
echo "<td>".version::fullNameLink($oVersion->iVersionId)."</td>\n"; $sColor = "color0";
echo "<td>$oRow->description</td>\n";
echo "</tr>\n"; $oTableRow->SetClass($sColor);
$oTableRowHighlight = GetStandardRowHighlight($iIndex);
$oTableRowClick = new TableRowClick($oVersion->objectMakeUrl());
$oTableRowClick->SetHighlight($oTableRowHighlight);
$oTableRow->SetRowClick($oTableRowClick);
$oTableRow->AddCell(new TableCell(version::fullNameLink($oVersion->iVersionId)));
$oTableRow->AddCell(new TableCell($oRow->description));
$oTable->AddRow($oTableRow);
} }
echo html_table_end(); echo $oTable->GetString();
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");
} }
echo "</div>\n"; echo "</div>\n";
apidb_footer();
?> ?>

View File

@@ -46,25 +46,40 @@ if(!$aClean['sSubmit'])
} }
echo "<p>E-mail $oRecipient->sRealname.</p>"; echo "<p>E-mail $oRecipient->sRealname.</p>";
echo html_table_begin("width\"100%\" border=\"0\" cellpadding=\"2\"".
"cellspacing=\"2\""); $oTable = new Table();
echo html_tr(array( $oTable->SetWidth("100%");
array("Subject", ""), $oTable->SetBorder(0);
"<input type=\"text\" name=\"sSubject\" size=\"71\" />"), $oTable->SetCellPadding(2);
"color4"); $oTable->SetCellSpacing(2);
echo html_tr(array(
array("Message", "valign=\"top\""), $oTableRow = new TableRow();
"<textarea name=\"sMessage\" rows=\"15\" cols=\"60\"></textarea>"), $oTableRow->SetClass("color4");
"color4"); $oTableRow->AddTextCell("Subject");
echo html_tr(array( $oTableCell = new TableCell("<input type=\"text\" name=\"sSubject\" size=\"71\" />");
"", $oTableRow->AddCell($oTableCell);
"<input type=\"submit\" value=\"Submit\" name=\"sSubmit\" />") $oTable->AddRow($oTableRow);
);
$oTableRow = new TableRow();
$oTableRow->SetClass("color4");
$oTableCell = new TableCell("Message");
$oTableCell->SetValign("top");
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell("<textarea name=\"sMessage\" rows=\"15\" cols=\"60\"></textarea>");
$oTableRow->AddCell($oTableCell);
$oTable->AddRow($oTableRow);
$oTableRow = new TableRow();
$oTableRow->AddTextCell("");
$oTableRow->AddTextCell("<input type=\"submit\" value=\"Submit\" name=\"sSubmit\" />");
$oTable->AddRow($oTableRow);
// output the table
echo $oTable->GetString();
echo "<input type=\"hidden\" name=\"iRecipientId\" ". echo "<input type=\"hidden\" name=\"iRecipientId\" ".
"value=\"$oRecipient->iUserId\" />"; "value=\"$oRecipient->iUserId\" />";
echo html_table_end();
echo "</form>\n"; echo "</form>\n";
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");

View File

@@ -524,7 +524,7 @@ class Application {
// app Category // app Category
$w = new TableVE("view"); $w = new TableVE("view");
echo '<tr valign=top><td class="color0"><b>Category</b></td><td>',"\n"; echo '<tr valign=top><td class="color0"><b>Category</b></td><td>',"\n";
$w->make_option_list("iAppCatId", $this->iCatId,"appCategory","catId","catName"); echo $w->make_option_list("iAppCatId", $this->iCatId,"appCategory","catId","catName");
echo '</td></tr>',"\n"; echo '</td></tr>',"\n";
// vendor name // vendor name
@@ -534,7 +534,7 @@ class Application {
// alt vendor // alt vendor
$x = new TableVE("view"); $x = new TableVE("view");
echo '<tr valign=top><td class="color0">&nbsp;</td><td>',"\n"; echo '<tr valign=top><td class="color0">&nbsp;</td><td>',"\n";
$x->make_option_list("iAppVendorId", echo $x->make_option_list("iAppVendorId",
$this->iVendorId,"vendor","vendorId","vendorName", $this->iVendorId,"vendor","vendorId","vendorName",
array("vendor.queued", "false")); array("vendor.queued", "false"));
echo '</td></tr>',"\n"; echo '</td></tr>',"\n";
@@ -772,29 +772,35 @@ class Application {
if(!$hResult || !mysql_num_rows($hResult)) if(!$hResult || !mysql_num_rows($hResult))
return false; return false;
$sResult = html_table_begin("width=\"100%\" align=\"center\""); $oTable = new Table();
$sResult .= html_tr(array( $oTable->SetWidth("100%");
"Application", $oTable->SetAlign("center");
"Description",
"Vendor", $oTableRow = new TableRow();
"Submission Date"), $oTableRow->AddTextCell("Application");
"color4"); $oTableRow->AddTextCell("Description");
$oTableRow->AddTextCell("Vendor");
$oTableRow->AddTextCell("Submission Date");
$oTableRow->SetClass("color4");
$oTable->SetHeader($oTableRow);
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++) for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
{ {
$oVendor = new vendor($oRow->vendorId); $oVendor = new vendor($oRow->vendorId);
$oApp = new application($oRow->appId); $oApp = new application($oRow->appId);
$sResult .= html_tr(array(
$oApp->objectMakeLink(), $oTableRow = new TableRow();
$oRow->description, $oTableRow->AddTextCell($oApp->objectMakeLink());
$oVendor->objectMakeLink(), $oTableRow->AddTextCell($oRow->description);
print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))), $oTableRow->AddTextCell($oVendor->objectMakeLink());
($i % 2) ? "color0" : "color1"); $oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime)));
$oTableRow->SetClass(($i % 2) ? "color0" : "color1");
$oTable->AddRow($oTableRow);
} }
$sResult .= html_table_end(); return $oTable->GetString();
return $sResult;
} }
function objectMakeUrl() function objectMakeUrl()
@@ -858,14 +864,14 @@ class Application {
else else
$sVendor = $oVendor->objectMakeLink(); $sVendor = $oVendor->objectMakeLink();
$aCells = array( $oTableRow = new TableRow();
print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)), $oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)));
$oUser->objectMakeLink(), $oTableRow->AddTextCell($oUser->objectMakeLink());
$sVendor, $oTableRow->AddTextCell($sVendor);
$this->sName); $oTableRow->AddTextCell($this->sName);
$oTableRow = new TableRow($aCells); $oOMTableRow = new OMTableRow($oTableRow);
return $oTableRow; return $oOMTableRow;
} }
function canEdit() function canEdit()
@@ -942,6 +948,7 @@ class Application {
echo " messages in its forums or become a maintainer to help others trying to run the application.</p>"; echo " messages in its forums or become a maintainer to help others trying to run the application.</p>";
} }
} }
function objectGetEntriesCount($bQueued, $bRejected) function objectGetEntriesCount($bQueued, $bRejected)
{ {
$sQueued = objectManager::getQueueString($bQueued, $bRejected); $sQueued = objectManager::getQueueString($bQueued, $bRejected);

View File

@@ -68,15 +68,21 @@ class browse_newest_apps
function objectGetTableRow() function objectGetTableRow()
{ {
$oApp = new application($this->iAppId); $oApp = new application($this->iAppId);
$aCells = array(
array(print_short_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime)),
"width=\"20%\""),
$oApp->objectMakeLink(),
util_trim_description($oApp->sDescription));
$oTableRow = new TableRow();
$oTableRow = new TableRow($aCells); $oTableCell = new TableCell(print_short_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime)));
return $oTableRow; $oTableCell->SetWidth("20%");
$oTableRow->AddCell($oTableCell);
$oTableRow->AddTextCell($oApp->objectMakeLink());
$oTableRow->AddTextCell(util_trim_description($oApp->sDescription));
// make the row clickable
$oTableRowClick = new TableRowClick($oApp->objectMakeUrl());
$oTableRow->SetRowClick($oTableRowClick);
$oOMTableRow = new OMTableRow($oTableRow);
return $oOMTableRow;
} }
function objectGetItemsPerPage($bQueued = false) function objectGetItemsPerPage($bQueued = false)

View File

@@ -455,17 +455,24 @@ class distribution {
function objectGetTableRow() function objectGetTableRow()
{ {
$aCells = array( $oTableRow = new TableRow();
$this->objectMakeLink(),
"<a href=\"$this->sUrl\">$this->sUrl</a>", $oTableRow->AddTextCell($this->objectMakeLink());
array(sizeof($this->aTestingIds), "align=\"right\""));
$oTableCell = new TableCell("$this->sUrl");
$oTableCell->SetCellLink($this->sUrl);
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell(sizeof($this->aTestingIds));
$oTableCell->SetAlign("right");
$oTableRow->AddCell($oTableCell);
// enable the 'delete' action if this distribution has no testing results // enable the 'delete' action if this distribution has no testing results
$bDeleteLink = sizeof($this->aTestingIds) ? FALSE : TRUE; $bDeleteLink = sizeof($this->aTestingIds) ? FALSE : TRUE;
$oTableRow = new TableRow($aCells); $oOMTableRow = new OMTableRow($oTableRow);
$oTableRow->SetRowHasDeleteLink($bDeleteLink); $oOMTableRow->SetRowHasDeleteLink($bDeleteLink);
return $oTableRow; return $oOMTableRow;
} }
// Whether the user has permission to edit distributions // Whether the user has permission to edit distributions

View File

@@ -4,27 +4,39 @@ require_once(BASE."include/util.php");
/*********************/ /*********************/
/* Edit Account Form */ /* Edit Account Form */
/*********************/ /*********************/
// returns an array of TableRow instances
function GetEditAccountFormRows($sUserEmail)
{
$aTableRows = array();
$oTableRow = new TableRow();
$oTableRow->AddTextCell("&nbsp; Email Address");
$oTableRow->AddTextCell('<input type="text" name="sUserEmail" '.
'value="'.$sUserEmail.'">');
$aTableRows[] = $oTableRow;
$oTableRow = new TableRow();
$oTableRow->AddTextCell("&nbsp; Password");
$oTableRow->AddTextCell('<input type="password" name="sUserPassword">');
$aTableRows[] = $oTableRow;
$oTableRow = new TableRow();
$oTableRow->AddTextCell("&nbsp; Password (again)");
$oTableRow->AddTextCell('<input type="password" name="sUserPassword2">');
$aTableRows[] = $oTableRow;
$oTableRow = new TableRow();
$oTableRow->AddTextCell("&nbsp; Real Name");
$oTableRow->AddTextCell('<input type="text" name="sUserRealname" value="'.$sUserRealname.'">');
$aTableRows[] = $oTableRow;
$oTableRow = new TableRow();
$oTableRow->AddTextCell("&nbsp;");
$oTableRow->AddTextCell("&nbsp;");
$aTableRows[] = $oTableRow;
return $aTableRows;
}
?> ?>
<!-- start of edit account form -->
<tr>
<td> &nbsp; Email Address </td>
<td> <input type="text" name="sUserEmail" value="<?php echo $sUserEmail; ?>"> </td>
</tr>
<tr>
<td> &nbsp; Password </td>
<td> <input type="password" name="sUserPassword"> </td>
</tr>
<tr>
<td> &nbsp; Password (again) </td>
<td> <input type="password" name="sUserPassword2"> </td>
</tr>
<tr>
<td> &nbsp; Real Name </td>
<td> <input type="text" name="sUserRealname" value="<?php echo $sUserRealname; ?>"> </td>
</tr>
<tr>
<td colspan=2>&nbsp;</td>
</tr>
<!-- end of edit account form -->

View File

@@ -69,16 +69,6 @@ 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($sUrl, $sClass, $sHighlightColor, $sInactiveColor,
$sTextDecorationHighlight = "none",
$sTextDecorationInactive = "none")
{
echo '<tr class='.$sClass.' '.
'onmouseover="ChangeTr(this, true, \''.$sHighlightColor.'\', \''.$sInactiveColor.'\', \''.$sTextDecorationHighlight.'\', \''.$sTextDecorationInactive.'\');"'.
'onmouseout="ChangeTr(this, false, \''.$sHighlightColor.'\', \''.$sInactiveColor.'\', \''.$sTextDecorationHighlight.'\', \''.$sTextDecorationInactive.'\');"'.
'onclick="DoNav(\''.$sUrl.'\');">';
}
// HTML TABLE // HTML TABLE
function html_table_begin($extra = "") function html_table_begin($extra = "")
{ {

View File

@@ -13,6 +13,7 @@ require(BASE."include/menu.php");
require(BASE."include/html.php"); require(BASE."include/html.php");
require(BASE."include/error_log.php"); require(BASE."include/error_log.php");
require(BASE."include/query.php"); require(BASE."include/query.php");
require(BASE."include/table.php");
require_once(BASE."include/objectManager.php"); require_once(BASE."include/objectManager.php");
/* if magic quotes are enabled make sure the user disables them */ /* if magic quotes are enabled make sure the user disables them */

View File

@@ -630,15 +630,16 @@ class maintainer
$oApp = new Application($this->iAppId); $oApp = new Application($this->iAppId);
$oVersion = new Version($this->iVersionId); $oVersion = new Version($this->iVersionId);
$aCells = array( $oTableRow = new TableRow();
print_date(mysqldatetime_to_unixtimestamp($this->aSubmitTime)),
$oApp->objectMakeLink(),
($this->bSuperMaintainer) ? "N/A" : $oVersion->objectMakeLink(),
($this->bSuperMaintainer) ? "Yes" : "No",
$oUser->objectMakeLink());
$oTableRow = new TableRow($aCells); $oTableRow->AddTextCell(print_date(mysqldatetime_to_unixtimestamp($this->aSubmitTime)));
return $oTableRow; $oTableRow->AddTextCell($oApp->objectMakeLink());
$oTableRow->AddTextCell(($this->bSuperMaintainer) ? "N/A" : $oVersion->objectMakeLink());
$oTableRow->AddTextCell(($this->bSuperMaintainer) ? "Yes" : "No");
$oTableRow->AddTextCell($oUser->objectMakeLink());
$oOMTableRow = new OMTableRow($oTableRow);
return $oOMTableRow;
} }
function ObjectDisplayQueueProcessingHelp() function ObjectDisplayQueueProcessingHelp()

View File

@@ -39,19 +39,32 @@ class htmlmenu {
/* add a table row */ /* add a table row */
function add($sName, $shUrl = null, $sAlign = "left") function add($sName, $shUrl = null, $sAlign = "left")
{ {
$oTableRow = new TableRow();
if($shUrl) if($shUrl)
{ {
// we have a valid url, make the entire table row clickable and provide $oTableCell = new TableCell("<span class=MenuItem>&nbsp;<u>".
// some highlighting for visual feedback "<a href=\"$shUrl\">$sName</a></u></span>");
html_tr_highlight_clickable($shUrl, "sideMenu", "#e0e6ff", "#ffffff");
echo "<td width='100%' align=$sAlign><span class=MenuItem>&nbsp;<u>". $oHighlightColor = new Color(0xe0, 0xe6, 0xff);
"<a href=\"$shUrl\">$sName</a></u></span></td>"; $oInactiveColor = new Color(0xff, 0xff, 0xff);
echo "</tr>\n"; $oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
$oTableRowClick = new TableRowClick($shUrl);
$oTableRowClick->SetHighlight($oTableRowHighlight);
$oTableRow->SetRowClick($oTableRowClick);
} else } else
{ {
echo " <tr class=sideMenu><td width='100%' align=$sAlign><span ". $oTableCell = new TableCell("<span class=menuItem>&nbsp;$sName</span></td></tr>");
"class=menuItem>&nbsp;$sName</span></td></tr>\n";
} }
$oTableCell->SetAlign($sAlign);
$oTableCell->SetWidth("100%");
$oTableRow->SetClass("sidemenu");
$oTableRow->AddCell($oTableCell);
echo $oTableRow->GetString();
} }
function addmisc($sStuff, $sAlign = "left") function addmisc($sStuff, $sAlign = "left")

View File

@@ -23,7 +23,7 @@ class ObjectManager
$this->sTitle = $sTitle; $this->sTitle = $sTitle;
$this->iId = $iId; $this->iId = $iId;
$this->oMultiPage = new MultiPage(FALSE); $this->oMultiPage = new MultiPage(FALSE);
$this->oTableRow = new TableRow(null); $this->oTableRow = new OMTableRow(null);
// initialize the common responses array // initialize the common responses array
$this->aCommonResponses = array(); $this->aCommonResponses = array();
@@ -104,10 +104,14 @@ class ObjectManager
/* if we are requesting a list of its queued objects or */ /* if we are requesting a list of its queued objects or */
/* all of its objects */ /* all of its objects */
if($this->oMultiPage->bEnabled) if($this->oMultiPage->bEnabled)
{
$hResult = $oObject->objectGetEntries($this->bIsQueue, $this->bIsRejected, $hResult = $oObject->objectGetEntries($this->bIsQueue, $this->bIsRejected,
$this->oMultiPage->iItemsPerPage, $this->oMultiPage->iLowerLimit); $this->oMultiPage->iItemsPerPage,
else $this->oMultiPage->iLowerLimit);
} else
{
$hResult = $oObject->objectGetEntries($this->bIsQueue, $this->bIsRejected); $hResult = $oObject->objectGetEntries($this->bIsQueue, $this->bIsRejected);
}
/* did we get any entries? */ /* did we get any entries? */
if(!$hResult || mysql_num_rows($hResult) == 0) if(!$hResult || mysql_num_rows($hResult) == 0)
@@ -144,8 +148,21 @@ class ObjectManager
$this->oTableRow = $oObject->objectGetTableRow(); $this->oTableRow = $oObject->objectGetTableRow();
if(!$this->oTableRow->sStyle) $sColor = ($iCount % 2) ? "color0" : "color1";
$this->oTableRow->sStyle = ($iCount % 2) ? "color0" : "color1";
//TODO: we shouldn't access this method directly, should make an accessor for it
if(!$this->oTableRow->oTableRow->sClass)
{
$this->oTableRow->oTableRow->sClass = $sColor;
}
// if this row is clickable, make it highlight appropirately
$oTableRowClick = $this->oTableRow->oTableRow->oTableRowClick;
if($oTableRowClick)
{
$oTableRowHighlight = GetStandardRowHighlight($iCount);
$oTableRowClick->SetHighlight($oTableRowHighlight);
}
$sEditLinkLabel = $this->bIsQueue ? "process" : "edit"; $sEditLinkLabel = $this->bIsQueue ? "process" : "edit";
@@ -159,11 +176,12 @@ class ObjectManager
'">delete</a> ]'; '">delete</a> ]';
} }
$this->oTableRow->aCells[] = '[ <a href="'.$this->makeUrl("edit", $oTableCell = new TableCell('[ <a href="'.$this->makeUrl("edit",
$oObject->objectGetId()).'">'.$sEditLinkLabel.'</a> ]'.$shDeleteLink; $oObject->objectGetId()).'">'.$sEditLinkLabel.'</a> ]'.$shDeleteLink);
$this->oTableRow->AddCell($oTableCell);
} }
echo html_tr($this->oTableRow->aCells, $this->oTableRow->sStyle); echo $this->oTableRow->GetString();
} }
echo "</table>"; echo "</table>";
@@ -770,41 +788,4 @@ class MultiPage
} }
} }
class TableRow
{
var $aCells; // array that contains the columns for a table row
var $sStyle; // CSS style to be used
var $bHasDeleteLink;
var $aRowClickable; //FIXME: we should describe the entries required here by creating a class for a clickable row entry or something
var $bCanEdit;
function TableRow($aCells)
{
if(!$aCells)
return;
$this->aCells = $aCells;
// initialize the rest of the variables
$this->sStyle = null;
$this->bHasDeleteLink = false;
$this->aRowClickable = null;
}
function SetStyle($sStyle)
{
$this->sStyle = $sStyle;
}
function SetRowHasDeleteLink($bHasDeleteLink)
{
$this->bHasDeleteLink = $bHasDeleteLink;
}
function SetRowClickable($aRowClickableInfo)
{
$this->aRowClickable = $aRowClickableInfo;
}
}
?> ?>

456
include/table.php Normal file
View File

@@ -0,0 +1,456 @@
<?php
// classes for managing tables and data related to tables
// class for managing the highlighting/inactive state of a row
class TableRowHighlight
{
//TODO: php5, make these private
var $oHighlightColor;
var $oInactiveColor;
// properties to apply to text when highlighted or inactive
// TODO: php5, make these private
var $sTextDecorationHighlight;
var $sTextDecorationInactive;
//TODO: php5, type hint to color class
function TableRowHighlight($oHighlightColor, $oInactiveColor,
$sTextDecorationHighlight = "",
$sTextDecorationInactive = "")
{
$this->oHighlightColor = $oHighlightColor;
$this->oInactiveColor = $oInactiveColor;
$this->sTextDecorationHighlight = $sTextDecorationHighlight;
$this->sTextDecorationInactive = $sTextDecorationInactive;
}
}
class TableRowClick
{
var $oTableRowHighlight;
var $bHasHighlight;
var $shUrl;
function TableRowClick($shUrl)
{
$this->shUrl = $shUrl;
$this->bHasHighlight = false;
$this->oTableRowHighlight = null;
}
//TODO: php5, type hint to TableRowHighlight class
function SetHighlight($oTableRowHighlight)
{
$this->oTableRowHighlight = $oTableRowHighlight;
}
function GetString()
{
$sStr = "";
// if we have highlighting output the attributes necessary to enable the javascript tht we use
// to perform the highlighting actions
if($this->oTableRowHighlight)
{
$sStr.= 'onmouseover="ChangeTr(this, true,'.
'\''.$this->oTableRowHighlight->oHighlightColor->GetHexString().'\','.
'\''.$this->oTableRowHighlight->oInactiveColor->GetHexString().'\','.
'\''.$this->oTableRowHighlight->sTextDecorationHighlight.'\','.
'\''.$this->oTableRowHighlight->sTextDecorationInactive.'\');"';
$sStr.= ' onmouseout="ChangeTr(this, false,'.
'\''.$this->oTableRowHighlight->oHighlightColor->GetHexString().'\','.
'\''.$this->oTableRowHighlight->oInactiveColor->GetHexString().'\','.
'\''.$this->oTableRowHighlight->sTextDecorationHighlight.'\','.
'\''.$this->oTableRowHighlight->sTextDecorationInactive.'\');"';
}
$sStr.= ' onclick="DoNav(\''.$this->shUrl.'\');"';
return $sStr;
}
}
class TableCell
{
//TODO: make these private when we move to php5
var $sCell;
var $sStyle;
var $sClass;
var $sAlign; // align="$sAlign" will be output if this is not null
var $sValign; // valign="$sValign" will be output if this is not null
var $sWidth; // width="$sWidth"
var $sUrl; // wraps the cell contents in an anchor tag if $sUrl is not null
var $bBold; // if true will output the cell contents as bold
// NOTE: We specifically have limited the parameters to the constructor
// to only the contents of the cell. Additional parameters, while
// appearing convienent, make the parameters confusing
// Use accessors to set additional parameters.
function TableCell($sCellContents)
{
$this->sCellContents = $sCellContents;
$this->sStyle = null;
$this->sClass = null;
$this->sAlign = null;
$this->sValign = null;
$this->sWidth = null;
$this->bBold = false;
}
function SetCellContents($sCellContents)
{
$this->sCellContents = $sCellContents;
}
function SetStyle($sStyle)
{
$this->sStyle = $sStyle;
}
function SetClass($sClass)
{
$this->sClass = $sClass;
}
function SetAlign($sAlign)
{
$this->sAlign = $sAlign;
}
function SetValign($sValign)
{
$this->sValign = $sValign;
}
function SetWidth($sWidth)
{
$this->sWidth = $sWidth;
}
function SetCellLink($sUrl)
{
$this->sUrl = $sUrl;
}
//php5 make sure this type is boolean
function SetBold($bBold)
{
$this->bBold = $bBold;
}
function GetString()
{
$sStr = "<td";
if($this->sClass)
$sStr.=" class=\"".$this->sClass."\";";
if($this->sStyle)
$sStr.=" style=\"".$this->sStyle."\";";
if($this->sAlign)
$sStr.=" align=\"".$this->sAlign."\";";
if($this->sValign)
$sStr.=" valign=\"".$this->sValign."\";";
if($this->sWidth)
$sStr.=" width=\"".$this->sWidth."\";";
$sStr.=">";
// if we have a url, output the start of the anchor tag
if($this->sUrl)
$sStr.='<a href="'.$this->sUrl.'">';
if($this->bBold)
$sStr.='<b>';
// output the contents of the cell
$sStr.=$this->sCellContents;
if($this->bBold)
$sStr.='</b>';
// if we have a url, close the anchor tag
if($this->sUrl)
$sStr.='</a>';
$sStr.="</td>";
return $sStr;
}
}
class TableRow
{
//TODO: make these private when we get php5
var $aTableCells; // array that contains the cells for the table row
var $sStyle; // CSS style to be used
var $sClass; // CSS class to be used
var $sExtra; // extra things to put into the table row
var $oTableRowClick; // information about whether the table row is clickable etc
function TableRow()
{
$this->aTableCells = array();
$this->sStyle = null;
$this->sClass = null;
$this->oTableRowClick = null;
}
// TODO: php5 need to add type hinting here to make sure this is a TableCell instance
function AddCell($oTableCell)
{
$this->aTableCells[] = $oTableCell;
}
function AddCells($aTableCells)
{
foreach($aTableCells as $oTableCell)
{
$this->AddCell($oTableCell);
}
}
// TODO: php5 type hint as text
function AddTextCell($sCellText)
{
$this->AddCell(new TableCell($sCellText));
}
function SetStyle($sStyle)
{
$this->sStyle = $sStyle;
}
function SetClass($sClass)
{
$this->sClass = $sClass;
}
function SetRowClick($oTableRowClick)
{
$this->oTableRowClick = $oTableRowClick;
}
// get a string that contains the html representation
// of this table row
function GetString()
{
// generate the opening of the tr element
$sStr = "<tr";
if($this->sClass)
$sStr.= " class=\"$this->sClass\"";
if($this->sStyle)
$sStr.= " style=\"$this->sStyle\"";
if($this->sExtra)
$sStr.= " $this->sExtra";
if($this->oTableRowClick)
$sStr.= " ".$this->oTableRowClick->GetString();
$sStr.= ">"; // close the opening tr
// process the td elements
foreach($this->aTableCells as $oTableCell)
{
$sStr.=$oTableCell->GetString();
}
// close the table row
$sStr.= "</tr>";
return $sStr;
}
}
// object manager table row, has additional parameters used by the object manager
// when outputting a table row
//TODO: php5 consider inheriting from HtmlTableRow since this class is really an
// extension of that class
class OMTableRow
{
var $oTableRow;
var $bHasDeleteLink;
var $bCanEdit;
function OMTableRow($oTableRow)
{
$this->oTableRow = $oTableRow;
$this->bHasDeleteLink = false;
$this->bCanEdit = false;
}
// php5 hint that type is bool
function SetRowHasDeleteLink($bHasDeleteLink)
{
$this->bHasDeleteLink = $bHasDeleteLink;
}
// php5 hint type here
function SetRowClickable($oTableRowClick)
{
$this->oTableRowClick = $oTableRowClick;
}
function SetStyle($sStyle)
{
$this->oTableRow->SetStyle($sStyle);
}
// add a TableCell to an existing row
function AddCell($oTableCell)
{
$this->oTableRow->AddCell($oTableCell);
}
function GetString()
{
return $this->oTableRow->GetString();
}
}
class Table
{
//TODO: make private when we have php5
var $oTableRowHeader;
var $aTableRows;
var $sClass;
var $sWidth;
var $iBorder;
var $sAlign; // align="$sAlign" - deprecated in html standards
var $iCellSpacing; // cellspacing="$iCellSpacing"
var $iCellPadding; // cellpadding="$iCellPadding"
function Table()
{
$this->oTableRowHeader = null;
$this->aTableRows = array();
$this->sClass = null;
$this->sWidth = null;
$this->iBorder = null;
$this->sAlign = null;
$this->iCellSpacing = null;
$this->iCellPadding = null;
}
function AddRow($oTableRow)
{
$this->aTableRows[] = $oTableRow;
}
// TODO: php5 force type to HtmlTableRow
function SetHeader($oTableRowHeader)
{
$this->oTableRowHeader = $oTableRowHeader;
}
function SetClass($sClass)
{
$this->sClass = $sClass;
}
function SetWidth($sWidth)
{
$this->sWidth = $sWidth;
}
function SetBorder($iBorder)
{
$this->iBorder = $iBorder;
}
function SetAlign($sAlign)
{
$this->sAlign = $sAlign;
}
function SetCellSpacing($iCellSpacing)
{
$this->iCellSpacing = $iCellSpacing;
}
function SetCellPadding($iCellPadding)
{
$this->iCellPadding = $iCellPadding;
}
function GetString()
{
$sStr = "<table";
if($this->sClass)
$sStr.= ' class="'.$this->sClass.'"';
if($this->sWidth)
$sStr.= ' width="'.$this->sWidth.'"';
if($this->iBorder)
$sStr.= ' border="'.$this->iBorder.'"';
if($this->sAlign)
$sStr.= ' align="'.$this->sAlign.'"';
if($this->iCellSpacing)
$sStr.= ' cellspacing="'.$this->iCellSpacing.'"';
if($this->iCellPadding)
$sStr.= ' cellpadding="'.$this->iCellPadding.'"';
$sStr.= ">"; // close the open table element
if($this->oTableRowHeader)
{
$sStr.="<thead>";
$sStr.= $this->oTableRowHeader->GetString();
$sStr.="</thead>";
}
foreach($this->aTableRows as $oTableRow)
{
$sStr.= $oTableRow->GetString();
}
$sStr.= "</table>";
return $sStr;
}
}
// input is the row index, we alternate colors based on odd or even index rows
// returns a TableRowHighlight instance
function GetStandardRowHighlight($iRowIndex)
{
//set row color
$sColor = ($iRowIndex % 2) ? "color0" : "color1";
$oInactiveColor = new color();
$oInactiveColor->SetColorByName($sColor);
$oHighlightColor = GetHighlightColorFromInactiveColor($oInactiveColor);
$oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
return $oTableRowHighlight;
}
// TODO: php5 type hint this to color class
// returns a color class instance
function GetHighlightColorFromInactiveColor($oInactiveColor)
{
$oHighlightColor = new color($oInactiveColor->iRed,
$oInactiveColor->iGreen,
$oInactiveColor->iBlue);
$oHighlightColor->Add(50);
return $oHighlightColor;
}
?>

View File

@@ -171,8 +171,11 @@ class TableVE {
echo html_frame_end(); echo html_frame_end();
} }
// returns a string that contains the option list
function make_option_list($sVarname, $sCvalue, $sTable, $sIdField, $sNameField, $aWhere = null) function make_option_list($sVarname, $sCvalue, $sTable, $sIdField, $sNameField, $aWhere = null)
{ {
$sStr = "";
/* We do not allow direct insertion into of SQL code, so the WHERE clause is /* We do not allow direct insertion into of SQL code, so the WHERE clause is
is accepted in an array form, where the first element is the variable is accepted in an array form, where the first element is the variable
and the second is the value it must be equal to */ and the second is the value it must be equal to */
@@ -182,20 +185,22 @@ class TableVE {
$hResult = query_parameters("SELECT ?, ? FROM ? $sWhere ORDER BY '?'", $hResult = query_parameters("SELECT ?, ? FROM ? $sWhere ORDER BY '?'",
$sIdField, $sNameField, $sTable, $sNameField); $sIdField, $sNameField, $sTable, $sNameField);
if(!$hResult) if(!$hResult)
return; // Oops return $sStr; // Oops
echo "<select name='$sVarname'>\n"; $sStr.= "<select name='$sVarname'>\n";
echo "<option value=0>Choose ...</option>\n"; $sStr.= "<option value=0>Choose ...</option>\n";
while(list($iId, $sName) = mysql_fetch_row($hResult)) while(list($iId, $sName) = mysql_fetch_row($hResult))
{ {
if ($sName == "NONAME") if ($sName == "NONAME")
continue; continue;
if($iId == $sCvalue) if($iId == $sCvalue)
echo "<option value=$iId selected>$sName\n"; $sStr.= "<option value=$iId selected>$sName\n";
else else
echo "<option value=$iId>$sName\n"; $sStr.= "<option value=$iId>$sName\n";
} }
echo "</select>\n"; $sStr.= "</select>\n";
return $sStr;
} }
@@ -212,25 +217,25 @@ class TableVE {
if($field->name == "appId" && $field->table != "appFamily") if($field->name == "appId" && $field->table != "appFamily")
{ {
$this->make_option_list($varname, $value, "appFamily", "appId", "appName"); echo $this->make_option_list($varname, $value, "appFamily", "appId", "appName");
return; return;
} }
if($field->name == "vendorId" && $field->table != "vendor") if($field->name == "vendorId" && $field->table != "vendor")
{ {
$this->make_option_list($varname, $value, "vendor", "vendorId", "vendorName"); echo $this->make_option_list($varname, $value, "vendor", "vendorId", "vendorName");
return; return;
} }
if($field->name == "catId" && $field->table != "appCategory") if($field->name == "catId" && $field->table != "appCategory")
{ {
$this->make_option_list($varname, $value, "appCategory", "catId", "catName"); echo $this->make_option_list($varname, $value, "appCategory", "catId", "catName");
return; return;
} }
if($field->name == "catParent") if($field->name == "catParent")
{ {
$this->make_option_list($varname, $value, "appCategory", "catId", "catName"); echo $this->make_option_list($varname, $value, "appCategory", "catId", "catName");
return; return;
} }

View File

@@ -436,7 +436,7 @@ class testData{
} }
// Show the Test results for a application version // Show the Test results for a application version
function ShowVersionsTestingTable($link, $iDisplayLimit) function ShowVersionsTestingTable($sLink, $iDisplayLimit)
{ {
global $aClean; global $aClean;
@@ -467,18 +467,27 @@ class testData{
echo '<div class="info_container">',"\n"; echo '<div class="info_container">',"\n";
echo '<div class="title_class">Test Results</div>',"\n"; echo '<div class="title_class">Test Results</div>',"\n";
echo '<div class="info_contents">',"\n"; echo '<div class="info_contents">',"\n";
echo '<table width="100%" border="1" class="historyTable">',"\n";
echo '<thead class="historyHeader">',"\n"; // create the table
echo '<tr>',"\n"; $oTable = new Table();
echo '<td></td>',"\n"; $oTable->SetClass("historyTable");
echo '<td>Distribution</td>',"\n"; $oTable->SetBorder(1);
echo '<td>Test date</td>',"\n"; $oTable->SetWidth("100%");
echo '<td>Wine version</td>',"\n";
echo '<td>Installs?</td>',"\n"; // setup the table header
echo '<td>Runs?</td>',"\n"; $oTableRowHeader = new TableRow();
echo '<td>Rating</td>',"\n"; $oTableRowHeader->SetClass("historyHeader");
echo '<td>Submitter</td>',"\n"; $oTableRowHeader->AddTextCell("");
echo '</tr></thead>',"\n"; $oTableRowHeader->AddTextCell("Distribution");
$oTableRowHeader->AddTextCell("Test date");
$oTableRowHeader->AddTextCell("Wine version");
$oTableRowHeader->AddTextCell("Installs?");
$oTableRowHeader->AddTextCell("Runs?");
$oTableRowHeader->AddTextCell("Rating");
$oTableRowHeader->AddTextCell("Submitter");
$oTable->SetHeader($oTableRowHeader);
$iIndex = 0;
while($oRow = mysql_fetch_object($hResult)) while($oRow = mysql_fetch_object($hResult))
{ {
$oTest = new testData($oRow->testingId); $oTest = new testData($oRow->testingId);
@@ -488,46 +497,73 @@ class testData{
$oDistribution = new distribution($oTest->iDistributionId); $oDistribution = new distribution($oTest->iDistributionId);
$bgcolor = $oTest->sTestedRating; $bgcolor = $oTest->sTestedRating;
// initialize the array ech time we loop
$oTableRowClick = null;
$oTableRow = new TableRow();
/* 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"; $sTRClass = $bgcolor;
echo ' <td align="center"><b>Current</b></td>',"\n";
$oTableCell = new TableCell("<b>Current</b>");
$oTableCell->SetAlign("center");
} else /* make all non-current rows clickable so clicking on them selects the test as current */ } else /* make all non-current rows clickable so clicking on them selects the test as current */
{ {
html_tr_highlight_clickable($link.$oTest->iTestingId, $bgcolor, "", "color2", "underline"); $sTRClass = $bgcolor;
echo ' <td align="center">[<a href="'.$link.$oTest->iTestingId;
if(is_string($sShowAll)) $oInactiveColor = new color();
echo '&sShowAll='.$sShowAll.'">Show</a>]</td>',"\n"; $oInactiveColor->SetColorByName($oTest->sTestedRating);
else
echo '">Show</a>]</td>',"\n"; $oHighlightColor = GetHighlightColorFromInactiveColor($oInactiveColor);
$oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
$sUrl = $sLink.$oTest->iTestingId;
$oTableRowClick = new TableRowClick($sUrl);
$oTableRowClick->SetHighlight($oTableRowHighlight);
// add the table element indicating that the user can show the row by clicking on it
$oTableCell = new TableCell("Show");
$oTableCell->SetCellLink($sUrl);
$oTableCell->SetAlign("center");
} }
echo ' <td>',"\n"; $oTableRow->AddCell($oTableCell);
echo $oDistribution->objectMakeLink()."\n"; $oTableRow->SetClass($sTRClass);
echo ' </td>',"\n";
echo ' <td>'.date("M d Y", mysqldatetime_to_unixtimestamp($oTest->sTestedDate)).'</td>',"\n"; $oTableRow->AddTextCell($oDistribution->objectMakeLink());
echo ' <td>'.$oTest->sTestedRelease.'&nbsp</td>',"\n"; $oTableRow->AddTextCell(date("M d Y", mysqldatetime_to_unixtimestamp($oTest->sTestedDate)));
echo ' <td>'.$oTest->sInstalls.'&nbsp</td>',"\n"; $oTableRow->AddTextCell($oTest->sTestedRelease.'&nbsp');
echo ' <td>'.$oTest->sRuns.'&nbsp</td>',"\n"; $oTableRow->AddTextCell($oTest->sInstalls.'&nbsp');
echo ' <td>'.$oTest->sTestedRating.'&nbsp</td>',"\n"; $oTableRow->AddTextCell($oTest->sRuns.'&nbsp');
echo ' <td>'.$oSubmitter->objectMakeLink().'&nbsp</td>',"\n"; $oTableRow->AddTextCell($oTest->sTestedRating.'&nbsp');
$oTableRow->AddTextCell($oSubmitter->objectMakeLink().'&nbsp');
if ($_SESSION['current']->hasAppVersionModifyPermission($oVersion)) if ($_SESSION['current']->hasAppVersionModifyPermission($oVersion))
{ {
$oObject = new objectManager("testData"); $oObject = new objectManager("testData");
echo '<td><a href="'.$oObject->makeUrl("edit", $oTest->iTestingId, $oTableRow->AddTextCell('<a href="'.$oObject->makeUrl("edit", $oTest->iTestingId,
"Edit Test Results").'">',"\n"; "Edit Test Results").'">'.
echo 'Edit</a> &nbsp; ',"\n"; 'Edit</a> &nbsp; ',"\n".
echo '<a href="objectManager.php?sClass=testData&bIsQueue=false&sAction='. '<a href="objectManager.php?sClass=testData&bIsQueue=false&sAction='.
'delete&iId='.$oTest->iTestingId.'&sTitle=Delete+Test+Results'. 'delete&iId='.$oTest->iTestingId.'&sTitle=Delete+Test+Results'.
'">Delete</a></td>',"\n"; '">Delete</a></td>',"\n");
}
echo '</tr>',"\n";
} }
echo '</table>',"\n"; // if this is a clickable row, set the appropriate property
if($oTableRowClick)
$oTableRow->SetRowClick($oTableRowClick);
// add the row to the table
$oTable->AddRow($oTableRow);
$iIndex++;
}
echo $oTable->GetString();
echo '<br />',"\n"; // put a space after the test results table and the button echo '<br />',"\n"; // put a space after the test results table and the button
@@ -973,20 +1009,21 @@ class testData{
$hMaintainers = maintainer::getMaintainersForAppIdVersionId(null, $this->iVersionId); $hMaintainers = maintainer::getMaintainersForAppIdVersionId(null, $this->iVersionId);
$bHasMaintainer = (mysql_num_rows($hMaintainers) == 0) ? false : true; $bHasMaintainer = (mysql_num_rows($hMaintainers) == 0) ? false : true;
$aCells = array( $oTableRow = new TableRow();
print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)), $oTableRow->AddCell(new TableCell(print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime))));
$oUser->objectMakeLink(), $oTableRow->AddCell(new TableCell($oUser->objectMakeLink()));
$oApp->objectMakeLink(), $oTableRow->AddCell(new TableCell($oApp->objectMakeLink()));
$oVersion->objectMakeLink(), $oTableRow->AddCell(new TableCell($oVersion->objectMakeLink()));
$this->sTestedRelease, $oTableRow->AddCell(new TableCell($this->sTestedRelease));
($bHasMaintainer ? "YES" : "no"), $oTableRow->AddCell(new TableCell($bHasMaintainer ? "YES" : "no"));
$this->sTestedRating); $oTableRow->AddCell(new TableCell($this->sTestedRating));
$oTableRow = new TableRow($aCells);
$oTableRow->SetStyle($this->sTestedRating); $oTableRow->SetStyle($this->sTestedRating);
$oTableRow->SetRowHasDeleteLink(true);
return $oTableRow; $oOMTableRow = new OMTableRow($oTableRow);
$oOMTableRow->SetRowHasDeleteLink(true);
return $oOMTableRow;
} }
function canEdit() function canEdit()

View File

@@ -157,8 +157,11 @@ function get_xml_tag ($file, $mode = null)
// $sVarname - name of the selection array that this function will output // $sVarname - name of the selection array that this function will output
// this is the name to use to retrieve the selection on the form postback // this is the name to use to retrieve the selection on the form postback
// $sSelectedValue - the currently selected entry // $sSelectedValue - the currently selected entry
// returns a string that contains the version list output
function make_bugzilla_version_list($sVarname, $sSelectedValue) function make_bugzilla_version_list($sVarname, $sSelectedValue)
{ {
$sStr = "";
$sTable = BUGZILLA_DB.".versions"; $sTable = BUGZILLA_DB.".versions";
$sWhere = "WHERE product_id=".BUGZILLA_PRODUCT_ID; $sWhere = "WHERE product_id=".BUGZILLA_PRODUCT_ID;
$sQuery = "SELECT value FROM $sTable $sWhere"; $sQuery = "SELECT value FROM $sTable $sWhere";
@@ -198,18 +201,18 @@ function make_bugzilla_version_list($sVarname, $sSelectedValue)
// build the selection array // build the selection array
echo "<select name='$sVarname'>\n"; $sStr.= "<select name='$sVarname'>\n";
echo "<option value=\"\">Choose ...</option>\n"; $sStr.= "<option value=\"\">Choose ...</option>\n";
$bFoundSelectedValue = false; $bFoundSelectedValue = false;
foreach($aVersions as $sKey => $sValue) foreach($aVersions as $sKey => $sValue)
{ {
if($sValue == $sSelectedValue) if($sValue == $sSelectedValue)
{ {
echo "<option value=$sValue selected>$sValue\n"; $sStr.= "<option value=$sValue selected>$sValue\n";
$bFoundSelectedValue = true; $bFoundSelectedValue = true;
} else } else
{ {
echo "<option value=$sValue>$sValue\n"; $sStr.= "<option value=$sValue>$sValue\n";
} }
} }
@@ -218,10 +221,12 @@ function make_bugzilla_version_list($sVarname, $sSelectedValue)
// the version that is to be selected // the version that is to be selected
if(!$bFoundSelectedValue && $sSelectedValue) if(!$bFoundSelectedValue && $sSelectedValue)
{ {
echo "<option value=$sSelectedValue selected>$sSelectedValue\n"; $sStr.= "<option value=$sSelectedValue selected>$sSelectedValue\n";
} }
echo "</select>\n"; $sStr.= "</select>\n";
return $sStr;
} }
function make_maintainer_rating_list($varname, $cvalue) function make_maintainer_rating_list($varname, $cvalue)
@@ -280,12 +285,36 @@ 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($oVersion->objectMakeUrl(), "white", "#f0f6ff", "white");
echo ' // create the table row
<td class="app_name">'.version::fullNameLink($oVersion->iVersionId).'</td> $oTableRow = new TableRow();
<td>'.util_trim_description($oApp->sDescription).'</td> $oTableRow->SetClass("white");
<td><center>'.$img.'</center></td>
</tr>'; // create the cells that represent the row
$oTableCell = new TableCell(version::fullNameLink($oVersion->iVersionId));
$oTableCell->SetClass("app_name");
$oTableRow->AddCell($oTableCell);
$oTableRow->AddTextCell(util_trim_description($oApp->sDescription));
$oTableCell = new TableCell($img);
$oTableCell->SetStyle("text-align:center;");
$oTableRow->AddCell($oTableCell);
// create a new TableRowHighlight instance
$oHighlightColor = new color(0xf0, 0xf6, 0xff);
$oInactiveColor = new color();
$oInactiveColor->SetColorByName("White");
$oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
// create a new TableRowclick
$oTableRowClick = new TableRowClick($oVersion->objectMakeUrl());
$oTableRowClick->SetHighlight($oTableRowHighlight);
// set the click property of the html table row
$oTableRow->SetRowClick($oTableRowClick);
// output the entire table row
echo $oTableRow->GetString();
echo "\n";
} }
/* Output the rows for the Top-X tables on the main page */ /* Output the rows for the Top-X tables on the main page */
@@ -950,49 +979,64 @@ class color
$this->iBlue = $iBlue; $this->iBlue = $iBlue;
} }
function setColorByName($sColorName) function SetColorByName($sColorName)
{ {
switch($sColorName) switch(strtolower($sColorName))
{ {
case "Platinum": case "platinum":
$this->iRed = 0xEC; $this->iRed = 0xEC;
$this->iGreen = 0xEC; $this->iGreen = 0xEC;
$this->iBlue = 0xEC; $this->iBlue = 0xEC;
break; break;
case "Gold": case "gold":
$this->iRed = 0xFF; $this->iRed = 0xFF;
$this->iGreen = 0xF6; $this->iGreen = 0xF6;
$this->iBlue = 0x00; $this->iBlue = 0x00;
break; break;
case "Silver": case "silver":
$this->iRed = 0xC0; $this->iRed = 0xC0;
$this->iGreen = 0xC0; $this->iGreen = 0xC0;
$this->iBlue = 0xC0; $this->iBlue = 0xC0;
break; break;
case "Bronze": case "bronze":
$this->iRed = 0xFC; $this->iRed = 0xFC;
$this->iGreen = 0xBA; $this->iGreen = 0xBA;
$this->iBlue = 0x0A; $this->iBlue = 0x0A;
break; break;
case "Garbage": case "garbage":
$this->iRed = 0x99; $this->iRed = 0x99;
$this->iGreen = 0x96; $this->iGreen = 0x96;
$this->iBlue = 0x66; $this->iBlue = 0x66;
break; break;
case "white":
$this->iRed = 0xff;
$this->iGreen = 0xff;
$this->iBlue = 0xff;
break;
case "color0":
$this->iRed = 0xe0;
$this->iGreen = 0xe0;
$this->iBlue = 0xe0;
break;
case "color1":
$this->iRed = 0xc0;
$this->iGreen = 0xc0;
$this->iBlue = 0xc0;
break;
default: default:
break; break;
} }
} }
// convert the color value into a html rgb hex string // convert the color value into a html rgb hex string
function getHexString() function GetHexString()
{ {
return sprintf("#%02X%02X%02X", $this->iRed, $this->iGreen, $this->iBlue); return sprintf("#%02X%02X%02X", $this->iRed, $this->iGreen, $this->iBlue);
} }
// add $iAmount to each color value, maxing out at 0xFF, the largest // add $iAmount to each color value, maxing out at 0xFF, the largest
// color value allowed // color value allowed
function add($iAmount) function Add($iAmount)
{ {
if($this->iRed + $iAmount > 0xFF) if($this->iRed + $iAmount > 0xFF)
$this->iRed = 0xFF; $this->iRed = 0xFF;
@@ -1009,6 +1053,6 @@ class color
else else
$this->iBlue += $iAmount; $this->iBlue += $iAmount;
} }
}; }
?> ?>

View File

@@ -171,22 +171,45 @@ class Vendor {
function outputEditor() function outputEditor()
{ {
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n"; $oTable = new Table();
$oTable->SetWidth("100%");
$oTable->SetBorder(0);
$oTable->SetCellPadding(2);
$oTable->SetCellSpacing(0);
// name
$oTableRow = new TableRow();
$oTableCell = new TableCell("Vendor Name:");
$oTableCell->SetAlign("right");
$oTableCell->SetClass("color0");
$oTableCell->SetBold(true);
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell('<input type=text name="sVendorName" value="'.$this->sName.'" size="60">');
$oTableCell->SetClass("color0");
$oTableRow->AddCell($oTableCell);
$oTable->AddRow($oTableRow);
// Name
echo html_tr(array(
array("<b>Vendor Name:</b>", 'align=right class="color0"'),
array('<input type=text name="sVendorName" value="'.$this->sName.'" size="60">', 'class="color0"')
));
// Url // Url
echo html_tr(array( $oTableRow = new TableRow();
array("<b>Vendor URL:</b>", 'align=right class="color0"'),
array('<input type=text name="sVendorWebpage" value="'.$this->sWebpage.'" size="60">', 'class="color0"') $oTableCell = new TableCell("Vendor URL:");
)); $oTableCell->SetAlign("right");
$oTableCell->SetClass("color0");
$oTableCell->SetBold(true);
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell('<input type=text name="sVendorWebpage" value="'.$this->sWebpage.'" size="60">');
$oTableCell->SetClass("color0");
$oTableRow->AddCell($oTableCell);
$oTable->AddRow($oTableRow);
echo $oTable->GetString();
echo '<input type="hidden" name="iVendorId" value="'.$this->iVendorId.'">',"\n"; echo '<input type="hidden" name="iVendorId" value="'.$this->iVendorId.'">',"\n";
echo "</table>\n";
} }
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0) function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
@@ -222,19 +245,28 @@ class Vendor {
return $aCells; return $aCells;
} }
// returns an OMTableRow instance
function objectGetTableRow() function objectGetTableRow()
{ {
$aCells = array(
$this->objectMakeLink(),
"<a href=\"$this->sWebpage\">$this->sWebpage</a>",
array(sizeof($this->aApplicationsIds), "align=\"right\""));
$bDeleteLink = sizeof($this->aApplicationsIds) ? FALSE : TRUE; $bDeleteLink = sizeof($this->aApplicationsIds) ? FALSE : TRUE;
$oTableRow = new TableRow($aCells); // create the html table row
$oTableRow->SetRowHasDeleteLink($bDeleteLink); $oTableRow = new TableRow();
$oTableRow->AddTextCell($this->objectMakeLink());
return $oTableRow; $oTableCell = new TableCell($this->sWebpage);
$oTableCell->SetCellLink($this->sWebpage);
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell(sizeof($this->aApplicationsIds));
$oTableCell->SetAlign("right");
$oTableRow->AddCell($oTableCell);
// create the object manager specific row
$oOMTableRow = new OMTableRow($oTableRow);
$oOMTableRow->SetRowHasDeleteLink($bDeleteLink);
return $oOMTableRow;
} }
function canEdit() function canEdit()
@@ -270,8 +302,10 @@ class Vendor {
echo '<br />',"\n"; echo '<br />',"\n";
if ($this->sWebpage) if ($this->sWebpage)
{
echo 'Vendor URL: <a href="'.$this->sWebpage.'">'. echo 'Vendor URL: <a href="'.$this->sWebpage.'">'.
$this->sWebpage.'</a> <br />',"\n"; $this->sWebpage.'</a> <br />',"\n";
}
if($this->aApplicationsIds) if($this->aApplicationsIds)

View File

@@ -481,7 +481,6 @@ class version {
} }
} }
function SendNotificationMail($sAction="add",$sMsg=null) function SendNotificationMail($sAction="add",$sMsg=null)
{ {
global $aClean; global $aClean;
@@ -586,10 +585,16 @@ class version {
{ {
HtmlAreaLoaderScript(array("version_editor")); HtmlAreaLoaderScript(array("version_editor"));
echo html_frame_start("Version Form", "90%", "", 0); echo html_frame_start("Version Form", "90%", "", 0);
echo "<table class='color0' width='100%' border=0 cellpadding=2 cellspacing=0>\n";
echo '<input type="hidden" name="iVersionId" value="'.$this->iVersionId.'" />'; echo '<input type="hidden" name="iVersionId" value="'.$this->iVersionId.'" />';
$oTable = new Table();
$oTable->SetClass("color0");
$oTable->SetWidth("100%");
$oTable->SetBorder(0);
$oTable->SetCellPadding(2);
$oTable->SetCellSpacing(0);
/* Fill in appId value */ /* Fill in appId value */
global $aClean; global $aClean;
if(!$this->iAppId) if(!$this->iAppId)
@@ -599,45 +604,103 @@ class version {
{ {
// app parent // app parent
$x = new TableVE("view"); $x = new TableVE("view");
echo '<tr valign=top><td class=color0><b>Application</b></td>', "\n"; $oTableRow = new TableRow();
echo '<td>',"\n"; $oTableRow->SetValign("top");
$x->make_option_list("iAppId",$this->iAppId,"appFamily","appId","appName");
echo '</td></tr>',"\n"; $sOptionList = $x->make_option_list("iAppId", $this->iAppId,
"appFamily", "appId", "appName");
$oTableCell = new TableCell("Application".$sOptionList);
$oTableCell->SetBold(true);
$oTableCell->SetClass("color0");
$oTableRow->AddCell($oTableCell);
$oTable->AddRow($oTableRow);
} else } else
{ {
echo '<input type="hidden" name="iAppId" value="'.$this->iAppId.'" />'; echo '<input type="hidden" name="iAppId" value="'.$this->iAppId.'" />';
} }
// version name // version name
echo '<tr valign=top><td class="color0"><b>Version name</b></td>',"\n"; $oTableRow = new TableRow();
echo '<td><input size="20" type="text" name="sVersionName" value="'.$this->sName.'"></td></tr>',"\n"; $oTableRow->SetValign("top");
$oTableCell = new TableCell("Version Name");
$oTableCell->SetBold(true);
$oTableCell->SetClass("color0");
$oTableRow->AddCell($oTableCell);
$oTableRow->AddTextCell('<input size="20" type="text" name="sVersionName" value="'.$this->sName.'">');
$oTable->AddRow($oTableRow);
// version license // version license
echo html_tr(array( $oTableCell = new TableCell("License");
array("<b>License</b>", "class=\"color0\""), $oTableCell->SetBold(true);
$this->makeLicenseList())); $oTableCell->SetClass("color0");
$oTableRow->AddCell($oTableCell);
$oTableRow->AddTextCell($this->makeLicenseList());
$oTable->AddRow($oTableRow);
// version description // version description
echo '<tr valign=top><td class=color0><b>Version description</b></td>',"\n"; $oTableRow = new TableRow();
echo '<td><p><textarea cols="80" rows="20" id="version_editor" name="shVersionDescription">',"\n"; $oTableRow->SetValign("top");
echo $this->sDescription.'</textarea></p></td></tr>',"\n"; $oTableCell = new TableCell("Version description");
$oTableCell->SetBold(true);
$oTableCell->SetClass("color0");
$oTableRow->AddCell($oTableCell);
echo '</table>',"\n"; $oTableRow->AddTextCell('<p><textarea cols="80" rows="20" id="version_editor" name="shVersionDescription">'.
$this->sDescription.'</textarea></p>');
$oTable->AddRow($oTableRow);
// output the table
echo $oTable->GetString();
echo html_frame_end(); echo html_frame_end();
if($this->sQueued == "false" && $this->iVersionId) if($this->sQueued == "false" && $this->iVersionId)
{ {
echo html_frame_start("Info", "90%", "", 0); echo html_frame_start("Info", "90%", "", 0);
echo "<table border=0 cellpadding=2 cellspacing=0>\n";
echo '<tr><td class="color4">Rating</td><td class="color0">',"\n"; $oTable = new Table();
make_maintainer_rating_list("sMaintainerRating", $this->sTestedRating); $oTable->SetBorder(0);
echo '</td></tr>',"\n"; $oTable->SetCellPadding(2);
echo '<tr><td class=color1>Release</td><td class=color0>',"\n"; $oTable->SetCellSpacing(0);
make_bugzilla_version_list("sMaintainerRelease", $this->sTestedRelease);
echo '</td></tr>',"\n"; $oTableRow = new TableRow();
echo html_table_end();
$oTableCell = new TableCell("Rating");
$oTableCell->SetClass("color4");
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell(make_maintainer_rating_list("sMaintainerRating",
$this->sTestedRating));
$oTableCell->SetClass("color0");
$oTableRow->AddCell($oTableCell);
$oTableRow = new TableRow();
$oTableCell = new TableCell("Release");
$oTableCell->SetClass("color1");
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell(make_bugzilla_version_list("sMaintainerRelease", $this->sTestedRelease));
$oTableCell->SetClass("color0");
$oTableRow->AddCell($oTableCell);
$oTable->AddRow($oTableRow);
// output the table
echo $oTable->GetString();
echo html_frame_end(); echo html_frame_end();
} else } else
{ {
@@ -1003,16 +1066,39 @@ class version {
if ($aVersionsIds) if ($aVersionsIds)
{ {
echo html_frame_start("","98%","",0); echo html_frame_start("","98%","",0);
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\">\n\n";
echo "<tr class=color4>\n"; $oTable = new Table();
echo " <td width=\"80\">Version</td>\n"; $oTable->SetWidth("100%");
echo " <td>Description</td>\n"; $oTable->SetBorder(0);
echo " <td width=\"80\">Rating</td>\n"; $oTable->SetCellPadding(3);
echo " <td width=\"80\">Wine version</td>\n"; $oTable->SetCellSpacing(1);
echo " <td width=\"80\">Test results</td>\n";
echo " <td width=\"40\">Comments</td>\n"; $oTableRow = new TableRow();
echo "</tr>\n\n"; $oTableRow->SetClass("color4");
$oTableCell = new TableCell("Version");
$oTableCell->SetWidth("80");
$oTableRow->AddCell($oTableCell);
$oTableRow->AddTextCell("Description");
$oTableCell = new TableCell("Rating");
$oTableCell->SetWidth("80");
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell("Wine version");
$oTableCell->SetWidth("80");
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell("Test results");
$oTableCell->SetWidth("80");
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell("Comments");
$oTableCell->SetWidth("40");
$oTableRow->AddCell($oTableCell);
$oTable->SetHeader($oTableRow);
$c = 0; $c = 0;
foreach($aVersionsIds as $iVersionId) foreach($aVersionsIds as $iVersionId)
@@ -1023,54 +1109,60 @@ class version {
// set row color // set row color
$bgcolor = ($c % 2 == 0) ? "color0" : "color1"; $bgcolor = ($c % 2 == 0) ? "color0" : "color1";
$oTableRowHighlight = null;
// if we have a valid tested rating // if we have a valid tested rating
if($oVersion->sTestedRating && $oVersion->sTestedRating != "/") if($oVersion->sTestedRating && $oVersion->sTestedRating != "/")
{ {
$sRatingColor = "class=\"$oVersion->sTestedRating\""; $sRatingColor = "class=\"$oVersion->sTestedRating\"";
$sClass = $oVersion->sTestedRating; $sClass = $oVersion->sTestedRating;
$oColor = new Color(); $oInactiveColor = new Color();
$oColor->setColorByName($oVersion->sTestedRating); $oInactiveColor->setColorByName($oVersion->sTestedRating);
$sInactiveColor = $oColor->getHexString();
// increase the brightness of the color to create the $oHighlightColor = GetHighlightColorFromInactiveColor($oInactiveColor);
// value used for the highlight color
$oColor->add(50); $oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
$sHighlightColor = $oColor->getHexString();
} else } else
{ {
$sRatingColor = "class=\"$bgcolor\""; $sRatingColor = "class=\"$bgcolor\"";
$sClass = $bgcolor; $sClass = $bgcolor;
// convert color values to hex values for the row highlighting $oTableRowHighlight = GetStandardRowHighlight($c);
if($bgcolor == "color0")
{
$sHighlightColor = "#E0E0E0";
$sInactiveColor = $sHighlightColor;
} else
{
$sHighlightColor = "#C0C0C0";
$sInactiveColor = $sHighlightColor;
}
} }
//display row //display row
html_tr_highlight_clickable($oVersion->objectMakeUrl(), $oTableRowClick = new TableRowClick($oVersion->objectMakeUrl());
$sClass, // class $oTableRowClick->SetHighlight($oTableRowHighlight);
$sHighlightColor, // highlight color
$sInactiveColor);// inactive color $oTableRow = new TableRow();
echo " <td>".$oVersion->objectMakeLink()."</td>\n"; $oTableRow->SetRowClick($oTableRowClick); // make the row clickable
echo " <td>".util_trim_description($oVersion->sDescription)."</td>\n"; $oTableRow->AddTextCell($oVersion->objectMakeLink());
echo " <td align=center>".$oVersion->sTestedRating."</td>\n"; $oTableRow->SetClass($sClass);
echo " <td align=center>".$oVersion->sTestedRelease."</td>\n"; $oTableRow->AddTextCell(util_trim_description($oVersion->sDescription));
echo " <td align=center>".testData::get_testdata_count_for_versionid($oVersion->iVersionId)."</td>\n";
echo " <td align=center>".Comment::get_comment_count_for_versionid($oVersion->iVersionId)."</td>\n"; $oTableCell = new TableCell($oVersion->sTestedRating);
echo "</tr>\n\n"; $oTableCell->SetAlign("center");
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell(testData::get_testdata_count_for_versionid($oVersion->iVersionId));
$oTableCell->SetAlign("center");
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell(Comment::get_comment_count_for_versionid($oVersion->iVersionId));
$oTableCell->SetAlign("center");
$oTableRow->AddCell($oTableCell);
// add the row to the table
$oTable->AddRow($oTableRow);
$c++; $c++;
} }
} }
echo "</table>\n";
// output the table
echo $oTable->GetString();
echo html_frame_end("Click the Version Name to view the details of that Version"); echo html_frame_end("Click the Version Name to view the details of that Version");
} }
} }
@@ -1103,25 +1195,33 @@ class version {
if(!$hResult || !mysql_num_rows($hResult)) if(!$hResult || !mysql_num_rows($hResult))
return false; return false;
$sResult = html_table_begin("width=\"100%\" align=\"center\""); $oTable = new Table();
$sResult .= html_tr(array( $oTable->SetWidth("100%");
"Name", $oTable->SetAlign("center");
"Description",
"Submission Date"), // setup the table header
"color4"); $oTableRow = new TableRow();
$oTableRow->AddTextCell("Name");
$oTableRow->AddTextCell("Description");
$oTableRow->AddTextCell("Submission Date");
$oTableRow->SetClass("color4");
$oTable->SetHeader($oTableRow);
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++) for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
$sResult .= html_tr(array( {
version::fullNameLink($oRow->versionId), $oTableRow = new TableRow();
$oRow->description, $oTableRow->AddTextCell(version::fullNameLink($oRow->versionId));
print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))), $oTableRow->AddTextCell($oRow->description);
($i % 2) ? "color0" : "color1"); $oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime)));
$oTableRow->SetClass(($i % 2) ? "color0" : "color1");
$sResult .= html_table_end(); $oTable->AddRow($oTableRow);
return $sResult;
} }
return $oTable->GetString();
}
// returns a string containing the html for a selection list
function makeLicenseList($sLicense = NULL) function makeLicenseList($sLicense = NULL)
{ {
if(!$sLicense) if(!$sLicense)
@@ -1374,15 +1474,16 @@ class version {
$oUser = new user($this->iSubmitterId); $oUser = new user($this->iSubmitterId);
$oApp = new application($this->iAppId); $oApp = new application($this->iAppId);
$oVendor = new vendor($oApp->iVendorId); $oVendor = new vendor($oApp->iVendorId);
$aCells = array(
print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)),
$oUser->objectMakeLink(),
$oVendor->objectMakeLink(),
$oApp->objectMakeLink(),
$this->sName);
$oTableRow = new TableRow($aCells); $oTableRow = new TableRow();
return $oTableRow; $oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)));
$oTableRow->AddTextCell($oUser->objectMakeLink());
$oTableRow->AddTextCell($oVendor->objectMakeLink());
$oTableRow->AddTextCell($oApp->objectMakeLink());
$oTableRow->AddTextCell($this->sName);
$oOMTableRow = new OMTableRow($oTableRow);
return $oOMTableRow;
} }
function objectDisplayQueueProcessingHelp() function objectDisplayQueueProcessingHelp()

View File

@@ -23,9 +23,14 @@
// application environment // application environment
require("path.php"); require("path.php");
require(BASE."include/incl.php"); require(BASE."include/incl.php");
require(BASE."include/form_edit.php");
// returns an array of TableRow instances
function build_prefs_list($oUser) function build_prefs_list($oUser)
{ {
$aTableRows = array();
$hResult = query_parameters("SELECT * FROM prefs_list ORDER BY id"); $hResult = query_parameters("SELECT * FROM prefs_list ORDER BY id");
while($hResult && $r = mysql_fetch_object($hResult)) while($hResult && $r = mysql_fetch_object($hResult))
{ {
@@ -48,35 +53,53 @@ function build_prefs_list($oUser)
$input = html_select("pref_$r->name", explode('|', $r->value_list), $input = html_select("pref_$r->name", explode('|', $r->value_list),
$oUser->getpref($r->name, $r->def_value)); $oUser->getpref($r->name, $r->def_value));
echo html_tr(array("&nbsp; $r->description", $input));
$oTableRow = new TableRow();
$oTableCell = new TableCell("&nbsp; $r->description");
$oTableRow->AddCell($oTableCell);
$oTableCell = new TableCell($input);
$oTableRow->AddCell($oTableCell);
$aTableRows[] = $oTableRow;
} }
return $aTableRows;
} }
// returns an array of TableRow instances
function show_user_fields($oUser) function show_user_fields($oUser)
{ {
$sUserRealname = $oUser->sRealname; $aTableRows = array();
$sUserEmail = $oUser->sEmail;
$sWineRelease = $oUser->sWineRelease; $sWineRelease = $oUser->sWineRelease;
if($oUser->hasPriv("admin")) if($oUser->hasPriv("admin"))
$sAdminChecked = 'checked="true"'; $sAdminChecked = 'checked="true"';
else else
$sAdminChecked = ""; $sAdminChecked = "";
include(BASE."include/form_edit.php");
// Edit admin privilege // Edit admin privilege
if($_SESSION['current']->hasPriv("admin")) if($_SESSION['current']->hasPriv("admin"))
{ {
echo html_tr(array( $oTableRow = new TableRow();
"&nbsp; Administrator", $oTableRow->AddTextCell("&nbsp; Administrator");
"<input type=\"checkbox\" name=\"bIsAdmin\" value=\"true\" ". $oTableRow->AddTextCell("<input type=\"checkbox\"".
"$sAdminChecked />" " name=\"bIsAdmin\" value=\"true\" ".
)); "$sAdminChecked />");
$aTableRows[] = $oTableRow;
} }
echo "<tr><td>&nbsp; Wine version </td><td>";
make_bugzilla_version_list("sWineRelease", $sWineRelease); $oTableRow = new TableRow();
echo "</td></tr>"; $oTableRow->AddTextCell("&nbsp; Wine version");
$sBugzillaVersionList = make_bugzilla_version_list("sWineRelease",
$sWineRelease);
$oTableRow->AddCell(new TableCell($sBugzillaVersionList));
$aTableRows[] = $oTableRow;
// return the table rows
return $aTableRows;
} }
@@ -168,14 +191,35 @@ if($oUser->iUserId == $aClean['iUserId'])
} }
echo html_frame_start("Preferences for ".$oUser->sRealname, "80%"); echo html_frame_start("Preferences for ".$oUser->sRealname, "80%");
echo html_table_begin("width='100%' border=0 align=left cellspacing=0 class='box-body'");
show_user_fields($oUser); // build a table
$oTable = new Table();
$oTable->SetWidth("100%");
$oTable->SetAlign("left");
$oTable->SetCellSpacing(0);
$oTable->SetClass("box-body");
// retrieve the form editing rows
$aTableRows = GetEditAccountFormRows($oUser->sEmail);
foreach($aTableRows as $oTableRow)
$oTable->AddRow($oTableRow);
// retrieve the user fields
$aTableRows = show_user_fields($oUser);
foreach($aTableRows as $oTableRow)
$oTable->AddRow($oTableRow);
// if we don't manage another user // if we don't manage another user
if($oUser->iUserId != $aClean['iUserId']) build_prefs_list($oUser); if($oUser->iUserId != $aClean['iUserId'])
{
$aTableRows = build_prefs_list($oUser);
foreach($aTableRows as $oTableRow)
{
$oTable->AddRow($oTableRow);
}
}
echo $oTable->GetString();
echo html_table_end();
echo html_frame_end(); echo html_frame_end();
echo "<br /> <div align=center> <input type=\"submit\" name='sSubmit' value=\"Update\" /> </div> <br />\n"; echo "<br /> <div align=center> <input type=\"submit\" name='sSubmit' value=\"Update\" /> </div> <br />\n";
echo "</form>\n"; echo "</form>\n";

View File

@@ -162,21 +162,47 @@ if(empty($aClean['iCategoryId']))
if($hResult) if($hResult)
{ {
echo html_frame_start("", "90%", '', 0); echo html_frame_start("", "90%", '', 0);
echo html_table_begin("width='100%' align=center");
echo "<tr class=color4><td><font color=white>Application Name</font></td>\n"; $oTable = new Table();
echo "<td><font color=white>Votes</font></td></tr>\n"; $oTable->SetWidth("100%");
$oTable->SetAlign("center");
$oTableRow = new TableRow();
$oTableRow->SetClass("color4");
$oTableRow->AddTextCell("<font color=white>Application Name</font>");
$oTableRow->AddTextCell("<font color=white>Votes</font>");
$oTable->AddRow($oTableRow);
$c = 1; $c = 1;
while($row = mysql_fetch_object($hResult)) while($oRow = mysql_fetch_object($hResult))
{ {
$bgcolor = ($c % 2) ? "color0" : "color1"; $sColor = ($c % 2) ? "color0" : "color1";
$link = version::fullNameLink($row->versionId);
echo "<tr class=$bgcolor><td width='90%'>$c. $link </td> <td> $row->count ". $oTableRowHighlight = GetStandardRowHighlight($c);
"</td></tr>\n";
$shLink = version::fullNameLink($oRow->versionId);
$oVersion = new Version($oRow->versionId);
$oTableRowClick = new TableRowClick($oVersion->objectMakeUrl());
$oTableRowClick->SetHighlight($oTableRowHighlight);
$oTableRow = new TableRow();
$oTableRow->SetRowClick($oTableRowClick);
$oTableRow->SetClass($sColor);
$oTableCell = new TableCell("$c.".$shLink);
$oTableCell->SetWidth("90%");
$oTableRow->AddCell($oTableCell);
$oTableRow->AddTextCell($oRow->count);
$oTable->AddRow($oTableRow);
$c++; $c++;
} }
echo html_table_end(); // output the table
echo $oTable->GetString();
echo html_frame_end(); echo html_frame_end();
/* Make sure we tell the user here are no apps, otherwise they might */ /* Make sure we tell the user here are no apps, otherwise they might */