Let objectManager output table headers. A class returns an array of header cells and then
the objectManager adds an edit column if appropriate.
This commit is contained in:
committed by
WineHQ
parent
80e30b65a8
commit
ed7026be6e
@@ -199,7 +199,7 @@ class appData
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectOutputHeader($sClass, $sType)
|
function objectGetHeader($sType)
|
||||||
{
|
{
|
||||||
$aCells = array(
|
$aCells = array(
|
||||||
"Submission Date",
|
"Submission Date",
|
||||||
@@ -207,10 +207,7 @@ class appData
|
|||||||
"Application",
|
"Application",
|
||||||
"Version");
|
"Version");
|
||||||
|
|
||||||
if(appData::canEdit($sType))
|
return $aCells;
|
||||||
$aCells[] = "Action";
|
|
||||||
|
|
||||||
echo html_tr($aCells, $sClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $iRows = 0, $iStart = 0, $sType)
|
function objectGetEntries($bQueued, $iRows = 0, $iStart = 0, $sType)
|
||||||
|
|||||||
@@ -400,17 +400,14 @@ class distribution {
|
|||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectOutputHeader($sClass = "")
|
function objectGetHeader()
|
||||||
{
|
{
|
||||||
$aCells = array(
|
$aCells = array(
|
||||||
"Distribution name",
|
"Distribution name",
|
||||||
"Distribution url",
|
"Distribution url",
|
||||||
array("Linked Tests", "align=\"right\""));
|
array("Linked Tests", "align=\"right\""));
|
||||||
|
|
||||||
if(distribution::canEdit())
|
return $aCells;
|
||||||
$aCells[3] = array("Action", "align=\"center\"");
|
|
||||||
|
|
||||||
echo html_tr($aCells, $sClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $iRows = 0, $iStart = 0)
|
function objectGetEntries($bQueued, $iRows = 0, $iStart = 0)
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ class maintainer
|
|||||||
return $aUserIds;
|
return $aUserIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ObjectOutputHeader($sClass)
|
function ObjectGetHeader()
|
||||||
{
|
{
|
||||||
$aCells = array(
|
$aCells = array(
|
||||||
"Submission Date",
|
"Submission Date",
|
||||||
@@ -418,10 +418,7 @@ class maintainer
|
|||||||
"Super maintainer?",
|
"Super maintainer?",
|
||||||
"Submitter");
|
"Submitter");
|
||||||
|
|
||||||
if(maintainer::canEdit())
|
return $aCells;
|
||||||
$aCells[sizeof($aCells)] = "Action";
|
|
||||||
|
|
||||||
echo html_tr($aCells, $sClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* arg1 = OM object, arg2 = CSS style, arg3 = text for edit link */
|
/* arg1 = OM object, arg2 = CSS style, arg3 = text for edit link */
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class ObjectManager
|
|||||||
/* displays the list of entries */
|
/* displays the list of entries */
|
||||||
function display_table()
|
function display_table()
|
||||||
{
|
{
|
||||||
$this->checkMethods(array("ObjectGetEntries", "ObjectOutputHeader",
|
$this->checkMethods(array("ObjectGetEntries", "ObjectGetHeader",
|
||||||
"ObjectGetInstanceFromRow", "ObjectOutputTableRow", "canEdit"));
|
"ObjectGetInstanceFromRow", "ObjectOutputTableRow", "canEdit"));
|
||||||
|
|
||||||
|
|
||||||
@@ -85,9 +85,8 @@ class ObjectManager
|
|||||||
/* output the header */
|
/* output the header */
|
||||||
echo '<table width="100%" border="0" cellpadding="3" cellspacing="0">';
|
echo '<table width="100%" border="0" cellpadding="3" cellspacing="0">';
|
||||||
|
|
||||||
call_user_func(array($this->sClass,
|
/* Output header cells */
|
||||||
"objectOutputHeader"), "color4");
|
$this->outputHeader("color4");
|
||||||
|
|
||||||
|
|
||||||
/* output each entry */
|
/* output each entry */
|
||||||
for($iCount = 0; $oRow = mysql_fetch_object($hResult); $iCount++)
|
for($iCount = 0; $oRow = mysql_fetch_object($hResult); $iCount++)
|
||||||
@@ -324,6 +323,20 @@ class ObjectManager
|
|||||||
$sId = "i".ucfirst($this->sClass)."Id";
|
$sId = "i".ucfirst($this->sClass)."Id";
|
||||||
return $aClean[$sId];
|
return $aClean[$sId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Output headers for a table */
|
||||||
|
function outputHeader($sClass)
|
||||||
|
{
|
||||||
|
$oObject = new $this->sClass();
|
||||||
|
$aCells = $oObject->objectGetHeader();
|
||||||
|
|
||||||
|
/* Add an action column if the user can edit this class, or if it is a queue.
|
||||||
|
Even though a user annot process items, he can edit his queued submissions */
|
||||||
|
if($oObject->canEdit() || $this->bIsQueue)
|
||||||
|
$aCells[] = "Action";
|
||||||
|
|
||||||
|
echo html_tr($aCells, $sClass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -518,9 +518,9 @@ class Screenshot {
|
|||||||
return appData::objectGetEntries($bQueued, $iRows, $iStart, "screenshot");
|
return appData::objectGetEntries($bQueued, $iRows, $iStart, "screenshot");
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectOutputHeader($sClass)
|
function objectGetHeader()
|
||||||
{
|
{
|
||||||
return appData::objectOutputHeader($sClass, "screenshot");
|
return appData::objectGetHeader("screenshot");
|
||||||
}
|
}
|
||||||
|
|
||||||
function canEdit()
|
function canEdit()
|
||||||
|
|||||||
@@ -167,17 +167,14 @@ class Vendor {
|
|||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectOutputHeader($sClass = "")
|
function objectGetHeader()
|
||||||
{
|
{
|
||||||
$sCells = array(
|
$aCells = array(
|
||||||
"Name",
|
"Name",
|
||||||
"Website",
|
"Website",
|
||||||
array("Linked apps", "align=\"right\""));
|
array("Linked apps", "align=\"right\""));
|
||||||
|
|
||||||
if(vendor::canEdit())
|
return $aCells;
|
||||||
$sCells[sizeof($sCells)] = "Action";
|
|
||||||
|
|
||||||
echo html_tr($sCells, $sClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetInstanceFromRow($oRow)
|
function objectGetInstanceFromRow($oRow)
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ function test_object_methods()
|
|||||||
echo "PASSED:\t\t".$sClassName."\n";
|
echo "PASSED:\t\t".$sClassName."\n";
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$aTestMethods = array("objectOutputHeader", "objectOutputTableRow",
|
$aTestMethods = array("objectGetHeader", "objectOutputTableRow",
|
||||||
"objectGetEntries", "display",
|
"objectGetEntries", "display",
|
||||||
"objectGetInstanceFromRow", "outputEditor", "canEdit",
|
"objectGetInstanceFromRow", "outputEditor", "canEdit",
|
||||||
"getOutputEditorValues", "objectMakeUrl", "objectMakeLink");
|
"getOutputEditorValues", "objectMakeUrl", "objectMakeLink");
|
||||||
|
|||||||
Reference in New Issue
Block a user