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:
@@ -45,36 +45,57 @@ if($subs)
|
||||
echo html_frame_end();
|
||||
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
|
||||
|
||||
echo "<tr class=color4>\n";
|
||||
echo " <td>Sub Category</td>\n";
|
||||
echo " <td>Description</td>\n";
|
||||
echo " <td>No. Apps</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$oTable = new Table();
|
||||
$oTable->SetWidth("100%");
|
||||
$oTable->SetBorder(0);
|
||||
$oTable->SetCellPadding(3);
|
||||
$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))
|
||||
{
|
||||
$oSubCat= new Category($iSubcatId);
|
||||
|
||||
//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
|
||||
$appcount = $oSubCat->getApplicationCount();
|
||||
$iAppcount = $oSubCat->getApplicationCount();
|
||||
|
||||
//format desc
|
||||
$desc = substr(stripslashes($oSubCat->sDescription),0,70);
|
||||
$sDesc = substr(stripslashes($oSubCat->sDescription),0,70);
|
||||
|
||||
//display row
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td><a href='appbrowse.php?iCatId=$iSubcatId'>".$oSubCat->sName."</a></td>\n";
|
||||
echo " <td>$desc </td>\n";
|
||||
echo " <td>$appcount </td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->SetClass($sColor);
|
||||
$oTableRow->SetRowClick($oTableRowClick);
|
||||
|
||||
$oTableCell = new TableCell($oSubCat->sName);
|
||||
$oTableCell->SetCellLink($sUrl);
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
$oTableRow->AddTextCell("$sDesc ");
|
||||
$oTableRow->AddTextCell("$iAppcount ");
|
||||
|
||||
$oTable->AddRow($oTableRow);
|
||||
}
|
||||
|
||||
echo "</table>\n\n";
|
||||
// output the table
|
||||
echo $oTable->GetString();
|
||||
|
||||
echo html_frame_end("$c categories");
|
||||
}
|
||||
|
||||
@@ -89,33 +110,52 @@ if($apps)
|
||||
echo html_frame_end();
|
||||
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
|
||||
|
||||
echo "<tr class=color4>\n";
|
||||
echo " <td>Application Name</td>\n";
|
||||
echo " <td>Description</td>\n";
|
||||
echo " <td>No. Versions</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$oTable = new Table();
|
||||
$oTable->SetWidth("100%");
|
||||
$oTable->SetBorder(0);
|
||||
$oTable->SetCellPadding(3);
|
||||
$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))
|
||||
{
|
||||
$oApp = new Application($iAppId);
|
||||
|
||||
//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
|
||||
$desc = util_trim_description($oApp->sDescription);
|
||||
$sDesc = util_trim_description($oApp->sDescription);
|
||||
|
||||
//display row
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td>".$oApp->objectMakeLink()."</td>\n";
|
||||
echo " <td>$desc </td>\n";
|
||||
echo " <td>".sizeof($oApp->aVersionsIds)."</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->SetRowClick($oTableRowClick);
|
||||
$oTableRow->SetClass($sColor);
|
||||
$oTableRow->AddTextCell($oApp->objectMakeLink());
|
||||
$oTableRow->AddTextCell("$sDesc ");
|
||||
$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");
|
||||
}
|
||||
|
||||
|
||||
@@ -22,38 +22,75 @@ if (empty($aClean['sRating']))
|
||||
echo "<b>Rating: $sPathtrail</b>";
|
||||
echo html_frame_end();
|
||||
echo html_frame_start("", '98%', '', 2);
|
||||
echo "<table width=100% border=0 cellspacing=1 cellpadding=3\n";
|
||||
echo " <tr class=color4>\n";
|
||||
echo " <td><b>Rating</b></td>\n";
|
||||
echo " <td><b>Description</b></td>\n";
|
||||
echo " <td><b>No. Apps</b></td>\n";
|
||||
echo " </tr>\n";
|
||||
html_tr_highlight_clickable("browse_by_rating.php?sRating=".PLATINUM_RATING, "platinum", "platinum", "platinum");
|
||||
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";
|
||||
echo " <td>".Application::countWithRating(PLATINUM_RATING)."</td>\n";
|
||||
echo " </tr>\n";
|
||||
html_tr_highlight_clickable("browse_by_rating.php?sRating=".GOLD_RATING, "gold", "gold", "gold");
|
||||
echo " <td><a href=\"browse_by_rating.php?sRating=".GOLD_RATING."\">Gold</a></td>";
|
||||
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";
|
||||
echo " </tr>\n";
|
||||
html_tr_highlight_clickable("browse_by_rating.php?sRating=".SILVER_RATING, "silver", "silver", "silver");
|
||||
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";
|
||||
echo " <td>".Application::countWithRating(SILVER_RATING)."</td>\n";
|
||||
echo " </tr>\n";
|
||||
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>";
|
||||
echo " <td>Applications that work but have some issues, even for 'normal use'</td>\n";
|
||||
echo " <td>".Application::countWithRating(BRONZE_RATING)."</td>\n";
|
||||
echo " </tr>\n";
|
||||
html_tr_highlight_clickable("browse_by_rating.php?sRating=".GARBAGE_RATING, "garbage", "garbage", "garbage");
|
||||
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";
|
||||
echo " <td>".Application::countWithRating(GARBAGE_RATING)."</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
// create the table
|
||||
$oTable = new Table();
|
||||
$oTable->SetCellSpacing(1);
|
||||
$oTable->SetCellPadding(3);
|
||||
$oTable->SetBorder(0);
|
||||
$oTable->SetWidth("100%");
|
||||
|
||||
// create the header row
|
||||
$aHeaderCells = array();
|
||||
$oTableCell = new TableCell("Rating");
|
||||
$oTableCell->SetBold(true);
|
||||
$aHeaderCells[] = $oTableCell;
|
||||
|
||||
$oTableCell = new TableCell("Description");
|
||||
$oTableCell->SetBold(true);
|
||||
$aHeaderCells[] = $oTableCell;
|
||||
|
||||
$oTableCell = new TableCell("No. Apps");
|
||||
$oTableCell->SetBold(true);
|
||||
$aHeaderCells[] = $oTableCell;
|
||||
|
||||
$oTableRowHeader = new TableRow();
|
||||
$oTableRowHeader->AddCells($aHeaderCells);
|
||||
$oTableRowHeader->SetClass("color4");
|
||||
|
||||
$oTable->SetHeader($oTableRowHeader);
|
||||
|
||||
// setup arrays for processing in the below loop
|
||||
$aColorName = array("Platinum", "Gold", "Silver", "Bronze", "Garbage");
|
||||
$aRating = array(PLATINUM_RATING, GOLD_RATING, SILVER_RATING,
|
||||
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();
|
||||
} else
|
||||
@@ -142,33 +179,60 @@ if (empty($aClean['sRating']))
|
||||
echo "</center>";
|
||||
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
|
||||
|
||||
echo "<tr class=color4>\n";
|
||||
echo " <td><b>Application Name</b></td>\n";
|
||||
echo " <td><b>Description</b></td>\n";
|
||||
echo " <td><b>No. Versions</b></td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$oTable = new Table();
|
||||
$oTable->SetWidth("100%");
|
||||
$oTable->SetBorder(0);
|
||||
$oTable->SetCellPadding(3);
|
||||
$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);
|
||||
|
||||
//set row color
|
||||
$bgcolor = ($i % 2) ? "color0" : "color1";
|
||||
$oTableRowHighlight = GetStandardRowHighlight($iIndex);
|
||||
|
||||
$sUrl = $oApp->objectMakeUrl();
|
||||
|
||||
$sColor = ($iIndex % 2) ? "color0" : "color1";
|
||||
|
||||
$oTableRowClick = new TableRowClick($sUrl);
|
||||
$oTableRowClick->SetHighlight($oTableRowHighlight);
|
||||
|
||||
//format desc
|
||||
$desc = util_trim_description($oApp->sDescription);
|
||||
$sDesc = util_trim_description($oApp->sDescription);
|
||||
|
||||
//display row
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td>".$oApp->objectMakeLink()."</td>\n";
|
||||
echo " <td>$desc </td>\n";
|
||||
echo " <td>".sizeof($oApp->aVersionsIds)."</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->SetRowClick($oTableRowClick);
|
||||
$oTableRow->SetClass($sColor);
|
||||
|
||||
$oTableRow->AddTextCell($oApp->objectMakeLink());
|
||||
$oTableRow->AddTextCell("$sDesc ");
|
||||
$oTableRow->AddTextCell(sizeof($oApp->aVersionsIds));
|
||||
|
||||
$oTable->AddRow($oTableRow);
|
||||
}
|
||||
|
||||
echo "</table>\n\n";
|
||||
// output the table
|
||||
echo $oTable->GetString();
|
||||
|
||||
echo html_frame_end();
|
||||
echo "<center>";
|
||||
|
||||
@@ -108,29 +108,53 @@ if(!$sLicense)
|
||||
if($hResult && mysql_num_rows($hResult))
|
||||
{
|
||||
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);
|
||||
echo html_tr_highlight_clickable(
|
||||
$oVersion->objectMakeUrl(),
|
||||
($i % 2) ? "color1" : "color0",
|
||||
($i % 2) ? "color1" : "color0",
|
||||
($i % 2) ? "color1" : "color0");
|
||||
echo "<td>".version::fullNameLink($oVersion->iVersionId)."</td>\n";
|
||||
echo "<td>$oRow->description</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
if($iIndex % 2)
|
||||
$sColor = "color1";
|
||||
else
|
||||
$sColor = "color0";
|
||||
|
||||
$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(" ");
|
||||
}
|
||||
|
||||
echo "</div>\n";
|
||||
|
||||
apidb_footer();
|
||||
|
||||
?>
|
||||
|
||||
45
contact.php
45
contact.php
@@ -46,25 +46,40 @@ if(!$aClean['sSubmit'])
|
||||
}
|
||||
|
||||
echo "<p>E-mail $oRecipient->sRealname.</p>";
|
||||
echo html_table_begin("width\"100%\" border=\"0\" cellpadding=\"2\"".
|
||||
"cellspacing=\"2\"");
|
||||
echo html_tr(array(
|
||||
array("Subject", ""),
|
||||
"<input type=\"text\" name=\"sSubject\" size=\"71\" />"),
|
||||
"color4");
|
||||
echo html_tr(array(
|
||||
array("Message", "valign=\"top\""),
|
||||
"<textarea name=\"sMessage\" rows=\"15\" cols=\"60\"></textarea>"),
|
||||
"color4");
|
||||
echo html_tr(array(
|
||||
"",
|
||||
"<input type=\"submit\" value=\"Submit\" name=\"sSubmit\" />")
|
||||
);
|
||||
|
||||
$oTable = new Table();
|
||||
$oTable->SetWidth("100%");
|
||||
$oTable->SetBorder(0);
|
||||
$oTable->SetCellPadding(2);
|
||||
$oTable->SetCellSpacing(2);
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->SetClass("color4");
|
||||
$oTableRow->AddTextCell("Subject");
|
||||
$oTableCell = new TableCell("<input type=\"text\" name=\"sSubject\" size=\"71\" />");
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
$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\" ".
|
||||
"value=\"$oRecipient->iUserId\" />";
|
||||
|
||||
echo html_table_end();
|
||||
echo "</form>\n";
|
||||
|
||||
echo html_frame_end(" ");
|
||||
|
||||
@@ -524,7 +524,7 @@ class Application {
|
||||
// app Category
|
||||
$w = new TableVE("view");
|
||||
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";
|
||||
|
||||
// vendor name
|
||||
@@ -534,7 +534,7 @@ class Application {
|
||||
// alt vendor
|
||||
$x = new TableVE("view");
|
||||
echo '<tr valign=top><td class="color0"> </td><td>',"\n";
|
||||
$x->make_option_list("iAppVendorId",
|
||||
echo $x->make_option_list("iAppVendorId",
|
||||
$this->iVendorId,"vendor","vendorId","vendorName",
|
||||
array("vendor.queued", "false"));
|
||||
echo '</td></tr>',"\n";
|
||||
@@ -772,29 +772,35 @@ class Application {
|
||||
if(!$hResult || !mysql_num_rows($hResult))
|
||||
return false;
|
||||
|
||||
$sResult = html_table_begin("width=\"100%\" align=\"center\"");
|
||||
$sResult .= html_tr(array(
|
||||
"Application",
|
||||
"Description",
|
||||
"Vendor",
|
||||
"Submission Date"),
|
||||
"color4");
|
||||
$oTable = new Table();
|
||||
$oTable->SetWidth("100%");
|
||||
$oTable->SetAlign("center");
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell("Application");
|
||||
$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++)
|
||||
{
|
||||
|
||||
$oVendor = new vendor($oRow->vendorId);
|
||||
$oApp = new application($oRow->appId);
|
||||
$sResult .= html_tr(array(
|
||||
$oApp->objectMakeLink(),
|
||||
$oRow->description,
|
||||
$oVendor->objectMakeLink(),
|
||||
print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))),
|
||||
($i % 2) ? "color0" : "color1");
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell($oApp->objectMakeLink());
|
||||
$oTableRow->AddTextCell($oRow->description);
|
||||
$oTableRow->AddTextCell($oVendor->objectMakeLink());
|
||||
$oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime)));
|
||||
$oTableRow->SetClass(($i % 2) ? "color0" : "color1");
|
||||
|
||||
$oTable->AddRow($oTableRow);
|
||||
}
|
||||
|
||||
$sResult .= html_table_end();
|
||||
|
||||
return $sResult;
|
||||
return $oTable->GetString();
|
||||
}
|
||||
|
||||
function objectMakeUrl()
|
||||
@@ -858,14 +864,14 @@ class Application {
|
||||
else
|
||||
$sVendor = $oVendor->objectMakeLink();
|
||||
|
||||
$aCells = array(
|
||||
print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)),
|
||||
$oUser->objectMakeLink(),
|
||||
$sVendor,
|
||||
$this->sName);
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)));
|
||||
$oTableRow->AddTextCell($oUser->objectMakeLink());
|
||||
$oTableRow->AddTextCell($sVendor);
|
||||
$oTableRow->AddTextCell($this->sName);
|
||||
|
||||
$oTableRow = new TableRow($aCells);
|
||||
return $oTableRow;
|
||||
$oOMTableRow = new OMTableRow($oTableRow);
|
||||
return $oOMTableRow;
|
||||
}
|
||||
|
||||
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>";
|
||||
}
|
||||
}
|
||||
|
||||
function objectGetEntriesCount($bQueued, $bRejected)
|
||||
{
|
||||
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
||||
|
||||
@@ -68,15 +68,21 @@ class browse_newest_apps
|
||||
function objectGetTableRow()
|
||||
{
|
||||
$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);
|
||||
return $oTableRow;
|
||||
$oTableCell = new TableCell(print_short_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime)));
|
||||
$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)
|
||||
|
||||
@@ -455,17 +455,24 @@ class distribution {
|
||||
|
||||
function objectGetTableRow()
|
||||
{
|
||||
$aCells = array(
|
||||
$this->objectMakeLink(),
|
||||
"<a href=\"$this->sUrl\">$this->sUrl</a>",
|
||||
array(sizeof($this->aTestingIds), "align=\"right\""));
|
||||
$oTableRow = new TableRow();
|
||||
|
||||
$oTableRow->AddTextCell($this->objectMakeLink());
|
||||
|
||||
$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
|
||||
$bDeleteLink = sizeof($this->aTestingIds) ? FALSE : TRUE;
|
||||
|
||||
$oTableRow = new TableRow($aCells);
|
||||
$oTableRow->SetRowHasDeleteLink($bDeleteLink);
|
||||
return $oTableRow;
|
||||
$oOMTableRow = new OMTableRow($oTableRow);
|
||||
$oOMTableRow->SetRowHasDeleteLink($bDeleteLink);
|
||||
return $oOMTableRow;
|
||||
}
|
||||
|
||||
// Whether the user has permission to edit distributions
|
||||
|
||||
@@ -4,27 +4,39 @@ require_once(BASE."include/util.php");
|
||||
/*********************/
|
||||
/* Edit Account Form */
|
||||
/*********************/
|
||||
|
||||
// returns an array of TableRow instances
|
||||
function GetEditAccountFormRows($sUserEmail)
|
||||
{
|
||||
$aTableRows = array();
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell(" Email Address");
|
||||
$oTableRow->AddTextCell('<input type="text" name="sUserEmail" '.
|
||||
'value="'.$sUserEmail.'">');
|
||||
$aTableRows[] = $oTableRow;
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell(" Password");
|
||||
$oTableRow->AddTextCell('<input type="password" name="sUserPassword">');
|
||||
$aTableRows[] = $oTableRow;
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell(" Password (again)");
|
||||
$oTableRow->AddTextCell('<input type="password" name="sUserPassword2">');
|
||||
$aTableRows[] = $oTableRow;
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell(" Real Name");
|
||||
$oTableRow->AddTextCell('<input type="text" name="sUserRealname" value="'.$sUserRealname.'">');
|
||||
$aTableRows[] = $oTableRow;
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell(" ");
|
||||
$oTableRow->AddTextCell(" ");
|
||||
$aTableRows[] = $oTableRow;
|
||||
|
||||
return $aTableRows;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- start of edit account form -->
|
||||
<tr>
|
||||
<td> Email Address </td>
|
||||
<td> <input type="text" name="sUserEmail" value="<?php echo $sUserEmail; ?>"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> Password </td>
|
||||
<td> <input type="password" name="sUserPassword"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> Password (again) </td>
|
||||
<td> <input type="password" name="sUserPassword2"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> Real Name </td>
|
||||
<td> <input type="text" name="sUserRealname" value="<?php echo $sUserRealname; ?>"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2> </td>
|
||||
</tr>
|
||||
|
||||
<!-- end of edit account form -->
|
||||
|
||||
@@ -69,16 +69,6 @@ function html_tr($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
|
||||
function html_table_begin($extra = "")
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ require(BASE."include/menu.php");
|
||||
require(BASE."include/html.php");
|
||||
require(BASE."include/error_log.php");
|
||||
require(BASE."include/query.php");
|
||||
require(BASE."include/table.php");
|
||||
require_once(BASE."include/objectManager.php");
|
||||
|
||||
/* if magic quotes are enabled make sure the user disables them */
|
||||
|
||||
@@ -630,15 +630,16 @@ class maintainer
|
||||
$oApp = new Application($this->iAppId);
|
||||
$oVersion = new Version($this->iVersionId);
|
||||
|
||||
$aCells = array(
|
||||
print_date(mysqldatetime_to_unixtimestamp($this->aSubmitTime)),
|
||||
$oApp->objectMakeLink(),
|
||||
($this->bSuperMaintainer) ? "N/A" : $oVersion->objectMakeLink(),
|
||||
($this->bSuperMaintainer) ? "Yes" : "No",
|
||||
$oUser->objectMakeLink());
|
||||
$oTableRow = new TableRow();
|
||||
|
||||
$oTableRow = new TableRow($aCells);
|
||||
return $oTableRow;
|
||||
$oTableRow->AddTextCell(print_date(mysqldatetime_to_unixtimestamp($this->aSubmitTime)));
|
||||
$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()
|
||||
|
||||
@@ -39,19 +39,32 @@ class htmlmenu {
|
||||
/* add a table row */
|
||||
function add($sName, $shUrl = null, $sAlign = "left")
|
||||
{
|
||||
$oTableRow = new TableRow();
|
||||
|
||||
if($shUrl)
|
||||
{
|
||||
// we have a valid url, make the entire table row clickable and provide
|
||||
// some highlighting for visual feedback
|
||||
html_tr_highlight_clickable($shUrl, "sideMenu", "#e0e6ff", "#ffffff");
|
||||
echo "<td width='100%' align=$sAlign><span class=MenuItem> <u>".
|
||||
"<a href=\"$shUrl\">$sName</a></u></span></td>";
|
||||
echo "</tr>\n";
|
||||
$oTableCell = new TableCell("<span class=MenuItem> <u>".
|
||||
"<a href=\"$shUrl\">$sName</a></u></span>");
|
||||
|
||||
$oHighlightColor = new Color(0xe0, 0xe6, 0xff);
|
||||
$oInactiveColor = new Color(0xff, 0xff, 0xff);
|
||||
$oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
|
||||
|
||||
$oTableRowClick = new TableRowClick($shUrl);
|
||||
$oTableRowClick->SetHighlight($oTableRowHighlight);
|
||||
|
||||
$oTableRow->SetRowClick($oTableRowClick);
|
||||
} else
|
||||
{
|
||||
echo " <tr class=sideMenu><td width='100%' align=$sAlign><span ".
|
||||
"class=menuItem> $sName</span></td></tr>\n";
|
||||
$oTableCell = new TableCell("<span class=menuItem> $sName</span></td></tr>");
|
||||
}
|
||||
$oTableCell->SetAlign($sAlign);
|
||||
$oTableCell->SetWidth("100%");
|
||||
|
||||
$oTableRow->SetClass("sidemenu");
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
|
||||
echo $oTableRow->GetString();
|
||||
}
|
||||
|
||||
function addmisc($sStuff, $sAlign = "left")
|
||||
|
||||
@@ -23,7 +23,7 @@ class ObjectManager
|
||||
$this->sTitle = $sTitle;
|
||||
$this->iId = $iId;
|
||||
$this->oMultiPage = new MultiPage(FALSE);
|
||||
$this->oTableRow = new TableRow(null);
|
||||
$this->oTableRow = new OMTableRow(null);
|
||||
|
||||
// initialize the common responses array
|
||||
$this->aCommonResponses = array();
|
||||
@@ -104,10 +104,14 @@ class ObjectManager
|
||||
/* if we are requesting a list of its queued objects or */
|
||||
/* all of its objects */
|
||||
if($this->oMultiPage->bEnabled)
|
||||
{
|
||||
$hResult = $oObject->objectGetEntries($this->bIsQueue, $this->bIsRejected,
|
||||
$this->oMultiPage->iItemsPerPage, $this->oMultiPage->iLowerLimit);
|
||||
else
|
||||
$this->oMultiPage->iItemsPerPage,
|
||||
$this->oMultiPage->iLowerLimit);
|
||||
} else
|
||||
{
|
||||
$hResult = $oObject->objectGetEntries($this->bIsQueue, $this->bIsRejected);
|
||||
}
|
||||
|
||||
/* did we get any entries? */
|
||||
if(!$hResult || mysql_num_rows($hResult) == 0)
|
||||
@@ -144,8 +148,21 @@ class ObjectManager
|
||||
|
||||
$this->oTableRow = $oObject->objectGetTableRow();
|
||||
|
||||
if(!$this->oTableRow->sStyle)
|
||||
$this->oTableRow->sStyle = ($iCount % 2) ? "color0" : "color1";
|
||||
$sColor = ($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";
|
||||
|
||||
@@ -159,11 +176,12 @@ class ObjectManager
|
||||
'">delete</a> ]';
|
||||
}
|
||||
|
||||
$this->oTableRow->aCells[] = '[ <a href="'.$this->makeUrl("edit",
|
||||
$oObject->objectGetId()).'">'.$sEditLinkLabel.'</a> ]'.$shDeleteLink;
|
||||
$oTableCell = new TableCell('[ <a href="'.$this->makeUrl("edit",
|
||||
$oObject->objectGetId()).'">'.$sEditLinkLabel.'</a> ]'.$shDeleteLink);
|
||||
$this->oTableRow->AddCell($oTableCell);
|
||||
}
|
||||
|
||||
echo html_tr($this->oTableRow->aCells, $this->oTableRow->sStyle);
|
||||
echo $this->oTableRow->GetString();
|
||||
}
|
||||
|
||||
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
456
include/table.php
Normal 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;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -171,8 +171,11 @@ class TableVE {
|
||||
echo html_frame_end();
|
||||
}
|
||||
|
||||
// returns a string that contains the option list
|
||||
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
|
||||
is accepted in an array form, where the first element is the variable
|
||||
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 '?'",
|
||||
$sIdField, $sNameField, $sTable, $sNameField);
|
||||
if(!$hResult)
|
||||
return; // Oops
|
||||
return $sStr; // Oops
|
||||
|
||||
echo "<select name='$sVarname'>\n";
|
||||
echo "<option value=0>Choose ...</option>\n";
|
||||
$sStr.= "<select name='$sVarname'>\n";
|
||||
$sStr.= "<option value=0>Choose ...</option>\n";
|
||||
while(list($iId, $sName) = mysql_fetch_row($hResult))
|
||||
{
|
||||
if ($sName == "NONAME")
|
||||
continue;
|
||||
if($iId == $sCvalue)
|
||||
echo "<option value=$iId selected>$sName\n";
|
||||
$sStr.= "<option value=$iId selected>$sName\n";
|
||||
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")
|
||||
{
|
||||
$this->make_option_list($varname, $value, "appFamily", "appId", "appName");
|
||||
echo $this->make_option_list($varname, $value, "appFamily", "appId", "appName");
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if($field->name == "catParent")
|
||||
{
|
||||
$this->make_option_list($varname, $value, "appCategory", "catId", "catName");
|
||||
echo $this->make_option_list($varname, $value, "appCategory", "catId", "catName");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -436,7 +436,7 @@ class testData{
|
||||
}
|
||||
|
||||
// Show the Test results for a application version
|
||||
function ShowVersionsTestingTable($link, $iDisplayLimit)
|
||||
function ShowVersionsTestingTable($sLink, $iDisplayLimit)
|
||||
{
|
||||
global $aClean;
|
||||
|
||||
@@ -467,18 +467,27 @@ class testData{
|
||||
echo '<div class="info_container">',"\n";
|
||||
echo '<div class="title_class">Test Results</div>',"\n";
|
||||
echo '<div class="info_contents">',"\n";
|
||||
echo '<table width="100%" border="1" class="historyTable">',"\n";
|
||||
echo '<thead class="historyHeader">',"\n";
|
||||
echo '<tr>',"\n";
|
||||
echo '<td></td>',"\n";
|
||||
echo '<td>Distribution</td>',"\n";
|
||||
echo '<td>Test date</td>',"\n";
|
||||
echo '<td>Wine version</td>',"\n";
|
||||
echo '<td>Installs?</td>',"\n";
|
||||
echo '<td>Runs?</td>',"\n";
|
||||
echo '<td>Rating</td>',"\n";
|
||||
echo '<td>Submitter</td>',"\n";
|
||||
echo '</tr></thead>',"\n";
|
||||
|
||||
// create the table
|
||||
$oTable = new Table();
|
||||
$oTable->SetClass("historyTable");
|
||||
$oTable->SetBorder(1);
|
||||
$oTable->SetWidth("100%");
|
||||
|
||||
// setup the table header
|
||||
$oTableRowHeader = new TableRow();
|
||||
$oTableRowHeader->SetClass("historyHeader");
|
||||
$oTableRowHeader->AddTextCell("");
|
||||
$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))
|
||||
{
|
||||
$oTest = new testData($oRow->testingId);
|
||||
@@ -488,46 +497,73 @@ class testData{
|
||||
$oDistribution = new distribution($oTest->iDistributionId);
|
||||
$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 */
|
||||
/* mark it as the current test */
|
||||
if ($oTest->iTestingId == $this->iTestingId)
|
||||
{
|
||||
echo '<tr class='.$bgcolor.'>',"\n";
|
||||
echo ' <td align="center"><b>Current</b></td>',"\n";
|
||||
$sTRClass = $bgcolor;
|
||||
|
||||
$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 */
|
||||
{
|
||||
html_tr_highlight_clickable($link.$oTest->iTestingId, $bgcolor, "", "color2", "underline");
|
||||
echo ' <td align="center">[<a href="'.$link.$oTest->iTestingId;
|
||||
$sTRClass = $bgcolor;
|
||||
|
||||
if(is_string($sShowAll))
|
||||
echo '&sShowAll='.$sShowAll.'">Show</a>]</td>',"\n";
|
||||
else
|
||||
echo '">Show</a>]</td>',"\n";
|
||||
$oInactiveColor = new color();
|
||||
$oInactiveColor->SetColorByName($oTest->sTestedRating);
|
||||
|
||||
$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";
|
||||
echo $oDistribution->objectMakeLink()."\n";
|
||||
echo ' </td>',"\n";
|
||||
echo ' <td>'.date("M d Y", mysqldatetime_to_unixtimestamp($oTest->sTestedDate)).'</td>',"\n";
|
||||
echo ' <td>'.$oTest->sTestedRelease.' </td>',"\n";
|
||||
echo ' <td>'.$oTest->sInstalls.' </td>',"\n";
|
||||
echo ' <td>'.$oTest->sRuns.' </td>',"\n";
|
||||
echo ' <td>'.$oTest->sTestedRating.' </td>',"\n";
|
||||
echo ' <td>'.$oSubmitter->objectMakeLink().' </td>',"\n";
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
$oTableRow->SetClass($sTRClass);
|
||||
|
||||
$oTableRow->AddTextCell($oDistribution->objectMakeLink());
|
||||
$oTableRow->AddTextCell(date("M d Y", mysqldatetime_to_unixtimestamp($oTest->sTestedDate)));
|
||||
$oTableRow->AddTextCell($oTest->sTestedRelease.' ');
|
||||
$oTableRow->AddTextCell($oTest->sInstalls.' ');
|
||||
$oTableRow->AddTextCell($oTest->sRuns.' ');
|
||||
$oTableRow->AddTextCell($oTest->sTestedRating.' ');
|
||||
$oTableRow->AddTextCell($oSubmitter->objectMakeLink().' ');
|
||||
if ($_SESSION['current']->hasAppVersionModifyPermission($oVersion))
|
||||
{
|
||||
$oObject = new objectManager("testData");
|
||||
echo '<td><a href="'.$oObject->makeUrl("edit", $oTest->iTestingId,
|
||||
"Edit Test Results").'">',"\n";
|
||||
echo 'Edit</a> ',"\n";
|
||||
echo '<a href="objectManager.php?sClass=testData&bIsQueue=false&sAction='.
|
||||
$oTableRow->AddTextCell('<a href="'.$oObject->makeUrl("edit", $oTest->iTestingId,
|
||||
"Edit Test Results").'">'.
|
||||
'Edit</a> ',"\n".
|
||||
'<a href="objectManager.php?sClass=testData&bIsQueue=false&sAction='.
|
||||
'delete&iId='.$oTest->iTestingId.'&sTitle=Delete+Test+Results'.
|
||||
'">Delete</a></td>',"\n";
|
||||
}
|
||||
echo '</tr>',"\n";
|
||||
'">Delete</a></td>',"\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
|
||||
|
||||
@@ -973,20 +1009,21 @@ class testData{
|
||||
$hMaintainers = maintainer::getMaintainersForAppIdVersionId(null, $this->iVersionId);
|
||||
$bHasMaintainer = (mysql_num_rows($hMaintainers) == 0) ? false : true;
|
||||
|
||||
$aCells = array(
|
||||
print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)),
|
||||
$oUser->objectMakeLink(),
|
||||
$oApp->objectMakeLink(),
|
||||
$oVersion->objectMakeLink(),
|
||||
$this->sTestedRelease,
|
||||
($bHasMaintainer ? "YES" : "no"),
|
||||
$this->sTestedRating);
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddCell(new TableCell(print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime))));
|
||||
$oTableRow->AddCell(new TableCell($oUser->objectMakeLink()));
|
||||
$oTableRow->AddCell(new TableCell($oApp->objectMakeLink()));
|
||||
$oTableRow->AddCell(new TableCell($oVersion->objectMakeLink()));
|
||||
$oTableRow->AddCell(new TableCell($this->sTestedRelease));
|
||||
$oTableRow->AddCell(new TableCell($bHasMaintainer ? "YES" : "no"));
|
||||
$oTableRow->AddCell(new TableCell($this->sTestedRating));
|
||||
|
||||
$oTableRow = new TableRow($aCells);
|
||||
$oTableRow->SetStyle($this->sTestedRating);
|
||||
$oTableRow->SetRowHasDeleteLink(true);
|
||||
|
||||
return $oTableRow;
|
||||
$oOMTableRow = new OMTableRow($oTableRow);
|
||||
$oOMTableRow->SetRowHasDeleteLink(true);
|
||||
|
||||
return $oOMTableRow;
|
||||
}
|
||||
|
||||
function canEdit()
|
||||
|
||||
@@ -157,8 +157,11 @@ function get_xml_tag ($file, $mode = null)
|
||||
// $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
|
||||
// $sSelectedValue - the currently selected entry
|
||||
// returns a string that contains the version list output
|
||||
function make_bugzilla_version_list($sVarname, $sSelectedValue)
|
||||
{
|
||||
$sStr = "";
|
||||
|
||||
$sTable = BUGZILLA_DB.".versions";
|
||||
$sWhere = "WHERE product_id=".BUGZILLA_PRODUCT_ID;
|
||||
$sQuery = "SELECT value FROM $sTable $sWhere";
|
||||
@@ -198,18 +201,18 @@ function make_bugzilla_version_list($sVarname, $sSelectedValue)
|
||||
|
||||
|
||||
// build the selection array
|
||||
echo "<select name='$sVarname'>\n";
|
||||
echo "<option value=\"\">Choose ...</option>\n";
|
||||
$sStr.= "<select name='$sVarname'>\n";
|
||||
$sStr.= "<option value=\"\">Choose ...</option>\n";
|
||||
$bFoundSelectedValue = false;
|
||||
foreach($aVersions as $sKey => $sValue)
|
||||
{
|
||||
if($sValue == $sSelectedValue)
|
||||
{
|
||||
echo "<option value=$sValue selected>$sValue\n";
|
||||
$sStr.= "<option value=$sValue selected>$sValue\n";
|
||||
$bFoundSelectedValue = true;
|
||||
} 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
|
||||
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)
|
||||
@@ -280,12 +285,36 @@ 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($oVersion->objectMakeUrl(), "white", "#f0f6ff", "white");
|
||||
echo '
|
||||
<td class="app_name">'.version::fullNameLink($oVersion->iVersionId).'</td>
|
||||
<td>'.util_trim_description($oApp->sDescription).'</td>
|
||||
<td><center>'.$img.'</center></td>
|
||||
</tr>';
|
||||
|
||||
// create the table row
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->SetClass("white");
|
||||
|
||||
// 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 */
|
||||
@@ -950,49 +979,64 @@ class color
|
||||
$this->iBlue = $iBlue;
|
||||
}
|
||||
|
||||
function setColorByName($sColorName)
|
||||
function SetColorByName($sColorName)
|
||||
{
|
||||
switch($sColorName)
|
||||
switch(strtolower($sColorName))
|
||||
{
|
||||
case "Platinum":
|
||||
case "platinum":
|
||||
$this->iRed = 0xEC;
|
||||
$this->iGreen = 0xEC;
|
||||
$this->iBlue = 0xEC;
|
||||
break;
|
||||
case "Gold":
|
||||
case "gold":
|
||||
$this->iRed = 0xFF;
|
||||
$this->iGreen = 0xF6;
|
||||
$this->iBlue = 0x00;
|
||||
break;
|
||||
case "Silver":
|
||||
case "silver":
|
||||
$this->iRed = 0xC0;
|
||||
$this->iGreen = 0xC0;
|
||||
$this->iBlue = 0xC0;
|
||||
break;
|
||||
case "Bronze":
|
||||
case "bronze":
|
||||
$this->iRed = 0xFC;
|
||||
$this->iGreen = 0xBA;
|
||||
$this->iBlue = 0x0A;
|
||||
break;
|
||||
case "Garbage":
|
||||
case "garbage":
|
||||
$this->iRed = 0x99;
|
||||
$this->iGreen = 0x96;
|
||||
$this->iBlue = 0x66;
|
||||
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:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
// add $iAmount to each color value, maxing out at 0xFF, the largest
|
||||
// color value allowed
|
||||
function add($iAmount)
|
||||
function Add($iAmount)
|
||||
{
|
||||
if($this->iRed + $iAmount > 0xFF)
|
||||
$this->iRed = 0xFF;
|
||||
@@ -1009,6 +1053,6 @@ class color
|
||||
else
|
||||
$this->iBlue += $iAmount;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -171,22 +171,45 @@ class Vendor {
|
||||
|
||||
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
|
||||
echo html_tr(array(
|
||||
array("<b>Vendor URL:</b>", 'align=right class="color0"'),
|
||||
array('<input type=text name="sVendorWebpage" value="'.$this->sWebpage.'" size="60">', 'class="color0"')
|
||||
));
|
||||
$oTableRow = new TableRow();
|
||||
|
||||
$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 "</table>\n";
|
||||
}
|
||||
|
||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
||||
@@ -222,19 +245,28 @@ class Vendor {
|
||||
return $aCells;
|
||||
}
|
||||
|
||||
// returns an OMTableRow instance
|
||||
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;
|
||||
|
||||
$oTableRow = new TableRow($aCells);
|
||||
$oTableRow->SetRowHasDeleteLink($bDeleteLink);
|
||||
// create the html table row
|
||||
$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()
|
||||
@@ -270,8 +302,10 @@ class Vendor {
|
||||
|
||||
echo '<br />',"\n";
|
||||
if ($this->sWebpage)
|
||||
{
|
||||
echo 'Vendor URL: <a href="'.$this->sWebpage.'">'.
|
||||
$this->sWebpage.'</a> <br />',"\n";
|
||||
}
|
||||
|
||||
|
||||
if($this->aApplicationsIds)
|
||||
|
||||
@@ -481,7 +481,6 @@ class version {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function SendNotificationMail($sAction="add",$sMsg=null)
|
||||
{
|
||||
global $aClean;
|
||||
@@ -586,10 +585,16 @@ class version {
|
||||
{
|
||||
HtmlAreaLoaderScript(array("version_editor"));
|
||||
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.'" />';
|
||||
|
||||
$oTable = new Table();
|
||||
$oTable->SetClass("color0");
|
||||
$oTable->SetWidth("100%");
|
||||
$oTable->SetBorder(0);
|
||||
$oTable->SetCellPadding(2);
|
||||
$oTable->SetCellSpacing(0);
|
||||
|
||||
/* Fill in appId value */
|
||||
global $aClean;
|
||||
if(!$this->iAppId)
|
||||
@@ -599,45 +604,103 @@ class version {
|
||||
{
|
||||
// app parent
|
||||
$x = new TableVE("view");
|
||||
echo '<tr valign=top><td class=color0><b>Application</b></td>', "\n";
|
||||
echo '<td>',"\n";
|
||||
$x->make_option_list("iAppId",$this->iAppId,"appFamily","appId","appName");
|
||||
echo '</td></tr>',"\n";
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->SetValign("top");
|
||||
|
||||
$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
|
||||
{
|
||||
echo '<input type="hidden" name="iAppId" value="'.$this->iAppId.'" />';
|
||||
}
|
||||
|
||||
// version name
|
||||
echo '<tr valign=top><td class="color0"><b>Version name</b></td>',"\n";
|
||||
echo '<td><input size="20" type="text" name="sVersionName" value="'.$this->sName.'"></td></tr>',"\n";
|
||||
$oTableRow = new TableRow();
|
||||
$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
|
||||
echo html_tr(array(
|
||||
array("<b>License</b>", "class=\"color0\""),
|
||||
$this->makeLicenseList()));
|
||||
$oTableCell = new TableCell("License");
|
||||
$oTableCell->SetBold(true);
|
||||
$oTableCell->SetClass("color0");
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
|
||||
$oTableRow->AddTextCell($this->makeLicenseList());
|
||||
|
||||
$oTable->AddRow($oTableRow);
|
||||
|
||||
// version description
|
||||
echo '<tr valign=top><td class=color0><b>Version description</b></td>',"\n";
|
||||
echo '<td><p><textarea cols="80" rows="20" id="version_editor" name="shVersionDescription">',"\n";
|
||||
$oTableRow = new TableRow();
|
||||
$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();
|
||||
|
||||
if($this->sQueued == "false" && $this->iVersionId)
|
||||
{
|
||||
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";
|
||||
make_maintainer_rating_list("sMaintainerRating", $this->sTestedRating);
|
||||
echo '</td></tr>',"\n";
|
||||
echo '<tr><td class=color1>Release</td><td class=color0>',"\n";
|
||||
make_bugzilla_version_list("sMaintainerRelease", $this->sTestedRelease);
|
||||
echo '</td></tr>',"\n";
|
||||
echo html_table_end();
|
||||
|
||||
$oTable = new Table();
|
||||
$oTable->SetBorder(0);
|
||||
$oTable->SetCellPadding(2);
|
||||
$oTable->SetCellSpacing(0);
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
|
||||
$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();
|
||||
} else
|
||||
{
|
||||
@@ -1003,16 +1066,39 @@ class version {
|
||||
if ($aVersionsIds)
|
||||
{
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\">\n\n";
|
||||
|
||||
echo "<tr class=color4>\n";
|
||||
echo " <td width=\"80\">Version</td>\n";
|
||||
echo " <td>Description</td>\n";
|
||||
echo " <td width=\"80\">Rating</td>\n";
|
||||
echo " <td width=\"80\">Wine version</td>\n";
|
||||
echo " <td width=\"80\">Test results</td>\n";
|
||||
echo " <td width=\"40\">Comments</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$oTable = new Table();
|
||||
$oTable->SetWidth("100%");
|
||||
$oTable->SetBorder(0);
|
||||
$oTable->SetCellPadding(3);
|
||||
$oTable->SetCellSpacing(1);
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$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;
|
||||
foreach($aVersionsIds as $iVersionId)
|
||||
@@ -1023,54 +1109,60 @@ class version {
|
||||
// set row color
|
||||
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
|
||||
|
||||
$oTableRowHighlight = null;
|
||||
|
||||
// if we have a valid tested rating
|
||||
if($oVersion->sTestedRating && $oVersion->sTestedRating != "/")
|
||||
{
|
||||
$sRatingColor = "class=\"$oVersion->sTestedRating\"";
|
||||
$sClass = $oVersion->sTestedRating;
|
||||
|
||||
$oColor = new Color();
|
||||
$oColor->setColorByName($oVersion->sTestedRating);
|
||||
$sInactiveColor = $oColor->getHexString();
|
||||
$oInactiveColor = new Color();
|
||||
$oInactiveColor->setColorByName($oVersion->sTestedRating);
|
||||
|
||||
// increase the brightness of the color to create the
|
||||
// value used for the highlight color
|
||||
$oColor->add(50);
|
||||
$sHighlightColor = $oColor->getHexString();
|
||||
$oHighlightColor = GetHighlightColorFromInactiveColor($oInactiveColor);
|
||||
|
||||
$oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
|
||||
} else
|
||||
{
|
||||
$sRatingColor = "class=\"$bgcolor\"";
|
||||
$sClass = $bgcolor;
|
||||
|
||||
// convert color values to hex values for the row highlighting
|
||||
if($bgcolor == "color0")
|
||||
{
|
||||
$sHighlightColor = "#E0E0E0";
|
||||
$sInactiveColor = $sHighlightColor;
|
||||
} else
|
||||
{
|
||||
$sHighlightColor = "#C0C0C0";
|
||||
$sInactiveColor = $sHighlightColor;
|
||||
}
|
||||
$oTableRowHighlight = GetStandardRowHighlight($c);
|
||||
}
|
||||
|
||||
//display row
|
||||
html_tr_highlight_clickable($oVersion->objectMakeUrl(),
|
||||
$sClass, // class
|
||||
$sHighlightColor, // highlight color
|
||||
$sInactiveColor);// inactive color
|
||||
echo " <td>".$oVersion->objectMakeLink()."</td>\n";
|
||||
echo " <td>".util_trim_description($oVersion->sDescription)."</td>\n";
|
||||
echo " <td align=center>".$oVersion->sTestedRating."</td>\n";
|
||||
echo " <td align=center>".$oVersion->sTestedRelease."</td>\n";
|
||||
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";
|
||||
echo "</tr>\n\n";
|
||||
$oTableRowClick = new TableRowClick($oVersion->objectMakeUrl());
|
||||
$oTableRowClick->SetHighlight($oTableRowHighlight);
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->SetRowClick($oTableRowClick); // make the row clickable
|
||||
$oTableRow->AddTextCell($oVersion->objectMakeLink());
|
||||
$oTableRow->SetClass($sClass);
|
||||
$oTableRow->AddTextCell(util_trim_description($oVersion->sDescription));
|
||||
|
||||
$oTableCell = new TableCell($oVersion->sTestedRating);
|
||||
$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++;
|
||||
}
|
||||
}
|
||||
echo "</table>\n";
|
||||
|
||||
// output the table
|
||||
echo $oTable->GetString();
|
||||
|
||||
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))
|
||||
return false;
|
||||
|
||||
$sResult = html_table_begin("width=\"100%\" align=\"center\"");
|
||||
$sResult .= html_tr(array(
|
||||
"Name",
|
||||
"Description",
|
||||
"Submission Date"),
|
||||
"color4");
|
||||
$oTable = new Table();
|
||||
$oTable->SetWidth("100%");
|
||||
$oTable->SetAlign("center");
|
||||
|
||||
// setup the table header
|
||||
$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++)
|
||||
$sResult .= html_tr(array(
|
||||
version::fullNameLink($oRow->versionId),
|
||||
$oRow->description,
|
||||
print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))),
|
||||
($i % 2) ? "color0" : "color1");
|
||||
{
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell(version::fullNameLink($oRow->versionId));
|
||||
$oTableRow->AddTextCell($oRow->description);
|
||||
$oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime)));
|
||||
$oTableRow->SetClass(($i % 2) ? "color0" : "color1");
|
||||
|
||||
$sResult .= html_table_end();
|
||||
|
||||
return $sResult;
|
||||
$oTable->AddRow($oTableRow);
|
||||
}
|
||||
|
||||
return $oTable->GetString();
|
||||
}
|
||||
|
||||
// returns a string containing the html for a selection list
|
||||
function makeLicenseList($sLicense = NULL)
|
||||
{
|
||||
if(!$sLicense)
|
||||
@@ -1374,15 +1474,16 @@ class version {
|
||||
$oUser = new user($this->iSubmitterId);
|
||||
$oApp = new application($this->iAppId);
|
||||
$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);
|
||||
return $oTableRow;
|
||||
$oTableRow = new TableRow();
|
||||
$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()
|
||||
|
||||
@@ -23,9 +23,14 @@
|
||||
// application environment
|
||||
require("path.php");
|
||||
require(BASE."include/incl.php");
|
||||
require(BASE."include/form_edit.php");
|
||||
|
||||
|
||||
// returns an array of TableRow instances
|
||||
function build_prefs_list($oUser)
|
||||
{
|
||||
$aTableRows = array();
|
||||
|
||||
$hResult = query_parameters("SELECT * FROM prefs_list ORDER BY id");
|
||||
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),
|
||||
$oUser->getpref($r->name, $r->def_value));
|
||||
echo html_tr(array(" $r->description", $input));
|
||||
}
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableCell = new TableCell(" $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)
|
||||
{
|
||||
$sUserRealname = $oUser->sRealname;
|
||||
$sUserEmail = $oUser->sEmail;
|
||||
$aTableRows = array();
|
||||
|
||||
$sWineRelease = $oUser->sWineRelease;
|
||||
if($oUser->hasPriv("admin"))
|
||||
$sAdminChecked = 'checked="true"';
|
||||
else
|
||||
$sAdminChecked = "";
|
||||
|
||||
include(BASE."include/form_edit.php");
|
||||
|
||||
// Edit admin privilege
|
||||
if($_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
echo html_tr(array(
|
||||
" Administrator",
|
||||
"<input type=\"checkbox\" name=\"bIsAdmin\" value=\"true\" ".
|
||||
"$sAdminChecked />"
|
||||
));
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell(" Administrator");
|
||||
$oTableRow->AddTextCell("<input type=\"checkbox\"".
|
||||
" name=\"bIsAdmin\" value=\"true\" ".
|
||||
"$sAdminChecked />");
|
||||
|
||||
$aTableRows[] = $oTableRow;
|
||||
}
|
||||
|
||||
echo "<tr><td> Wine version </td><td>";
|
||||
make_bugzilla_version_list("sWineRelease", $sWineRelease);
|
||||
echo "</td></tr>";
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell(" 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_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($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 "<br /> <div align=center> <input type=\"submit\" name='sSubmit' value=\"Update\" /> </div> <br />\n";
|
||||
echo "</form>\n";
|
||||
|
||||
@@ -162,21 +162,47 @@ if(empty($aClean['iCategoryId']))
|
||||
if($hResult)
|
||||
{
|
||||
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";
|
||||
echo "<td><font color=white>Votes</font></td></tr>\n";
|
||||
|
||||
$oTable = new Table();
|
||||
$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;
|
||||
while($row = mysql_fetch_object($hResult))
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
$bgcolor = ($c % 2) ? "color0" : "color1";
|
||||
$link = version::fullNameLink($row->versionId);
|
||||
echo "<tr class=$bgcolor><td width='90%'>$c. $link </td> <td> $row->count ".
|
||||
"</td></tr>\n";
|
||||
$sColor = ($c % 2) ? "color0" : "color1";
|
||||
|
||||
$oTableRowHighlight = GetStandardRowHighlight($c);
|
||||
|
||||
$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++;
|
||||
}
|
||||
|
||||
echo html_table_end();
|
||||
// output the table
|
||||
echo $oTable->GetString();
|
||||
|
||||
echo html_frame_end();
|
||||
|
||||
/* Make sure we tell the user here are no apps, otherwise they might */
|
||||
|
||||
Reference in New Issue
Block a user