Use objectManager to display main screenshot gallery
This commit is contained in:
committed by
Chris Morgan
parent
6d9aa68e0e
commit
e52f270498
@@ -168,6 +168,64 @@ class ObjectManager
|
||||
exit;
|
||||
}
|
||||
|
||||
public function drawTable($hResult)
|
||||
{
|
||||
/* output the header */
|
||||
echo '<table width="100%" border="0" cellpadding="3" cellspacing="0">';
|
||||
|
||||
/* Output header cells */
|
||||
$this->outputHeader("color4");
|
||||
|
||||
/* Preserve the page title */
|
||||
$this->setReturnToTitle($this->sTitle);
|
||||
|
||||
/* output each entry */
|
||||
for($iCount = 0; $oRow = query_fetch_object($hResult); $iCount++)
|
||||
{
|
||||
$oObject = new $this->sClass(null, $oRow);
|
||||
|
||||
$this->oTableRow = $oObject->objectGetTableRow();
|
||||
|
||||
$sColor = ($iCount % 2) ? "color0" : "color1";
|
||||
|
||||
// if there is no class set for a given row use the
|
||||
// default one in $sColor
|
||||
if(!$this->oTableRow->GetTableRow()->GetClass())
|
||||
{
|
||||
$this->oTableRow->GetTableRow()->SetClass($sColor);
|
||||
}
|
||||
|
||||
// if this row is clickable, make it highlight appropirately
|
||||
$oTableRowClick = $this->oTableRow->GetTableRow()->GetTableRowClick();
|
||||
if($oTableRowClick)
|
||||
{
|
||||
$oTableRowHighlight = GetStandardRowHighlight($iCount);
|
||||
$oTableRowClick->SetHighlight($oTableRowHighlight);
|
||||
}
|
||||
|
||||
$sEditLinkLabel = $this->bIsQueue ? "process" : "edit";
|
||||
|
||||
/* We add some action links */
|
||||
if($oObject->canEdit())
|
||||
{
|
||||
$shDeleteLink = "";
|
||||
if($this->oTableRow->GetHasDeleteLink())
|
||||
{
|
||||
$shDeleteLink = ' [ <a href="'.$this->makeUrl("delete", $oObject->objectGetId()).
|
||||
'">delete</a> ]';
|
||||
}
|
||||
|
||||
$oTableCell = new TableCell('[ <a href="'.$this->makeUrl("edit",
|
||||
$oObject->objectGetId()).'">'.$sEditLinkLabel.'</a> ]'.$shDeleteLink);
|
||||
$this->oTableRow->AddCell($oTableCell);
|
||||
}
|
||||
|
||||
echo $this->oTableRow->GetString();
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
/* displays the list of entries */
|
||||
public function display_table($aClean)
|
||||
{
|
||||
@@ -267,60 +325,14 @@ class ObjectManager
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/* output the header */
|
||||
echo '<table width="100%" border="0" cellpadding="3" cellspacing="0">';
|
||||
$sQueued = $this->getQueueString($this->bIsQueue, $this->bIsRejected);
|
||||
|
||||
/* Output header cells */
|
||||
$this->outputHeader("color4");
|
||||
|
||||
/* Preserve the page title */
|
||||
$this->setReturnToTitle($this->sTitle);
|
||||
|
||||
/* output each entry */
|
||||
for($iCount = 0; $oRow = query_fetch_object($hResult); $iCount++)
|
||||
{
|
||||
$oObject = new $this->sClass(null, $oRow);
|
||||
|
||||
$this->oTableRow = $oObject->objectGetTableRow();
|
||||
|
||||
$sColor = ($iCount % 2) ? "color0" : "color1";
|
||||
|
||||
// if there is no class set for a given row use the
|
||||
// default one in $sColor
|
||||
if(!$this->oTableRow->GetTableRow()->GetClass())
|
||||
{
|
||||
$this->oTableRow->GetTableRow()->SetClass($sColor);
|
||||
}
|
||||
|
||||
// if this row is clickable, make it highlight appropirately
|
||||
$oTableRowClick = $this->oTableRow->GetTableRow()->GetTableRowClick();
|
||||
if($oTableRowClick)
|
||||
{
|
||||
$oTableRowHighlight = GetStandardRowHighlight($iCount);
|
||||
$oTableRowClick->SetHighlight($oTableRowHighlight);
|
||||
}
|
||||
|
||||
$sEditLinkLabel = $this->bIsQueue ? "process" : "edit";
|
||||
|
||||
/* We add some action links */
|
||||
if($oObject->canEdit())
|
||||
{
|
||||
$shDeleteLink = "";
|
||||
if($this->oTableRow->GetHasDeleteLink())
|
||||
{
|
||||
$shDeleteLink = ' [ <a href="'.$this->makeUrl("delete", $oObject->objectGetId()).
|
||||
'">delete</a> ]';
|
||||
}
|
||||
|
||||
$oTableCell = new TableCell('[ <a href="'.$this->makeUrl("edit",
|
||||
$oObject->objectGetId()).'">'.$sEditLinkLabel.'</a> ]'.$shDeleteLink);
|
||||
$this->oTableRow->AddCell($oTableCell);
|
||||
}
|
||||
|
||||
echo $this->oTableRow->GetString();
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
/* Should we let the class draw its own custom table? */
|
||||
if(method_exists($this->sClass, 'objectWantCustomDraw') &&
|
||||
$oObject->objectWantCustomDraw('table', $sQueued))
|
||||
$oObject->objectDrawCustomTable($hResult, $sQueued);
|
||||
else
|
||||
$this->drawTable($hResult);
|
||||
|
||||
$oObject = new $this->sClass();
|
||||
if($oObject->canEdit() && $this->GetOptionalSetting("objectShowAddEntry", FALSE))
|
||||
|
||||
@@ -591,12 +591,72 @@ class screenshot
|
||||
return $shImg;
|
||||
}
|
||||
|
||||
public static function objectGetItemsPerPage($bQueued = false)
|
||||
{
|
||||
if($bQueued)
|
||||
{
|
||||
$aItemsPerPage = array(25, 50, 100, 200);
|
||||
$iDefaultPerPage = 25;
|
||||
} else
|
||||
{
|
||||
$aItemsPerPage = array(6, 9, 12, 15, 18, 21, 24);
|
||||
$iDefaultPerPage = 6;
|
||||
}
|
||||
return array($aItemsPerPage, $iDefaultPerPage);
|
||||
}
|
||||
|
||||
function objectWantCustomDraw($sWhat, $sQueued)
|
||||
{
|
||||
switch($sWhat)
|
||||
{
|
||||
case 'table':
|
||||
if($sQueued == 'false')
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function objectDrawCustomTable($hResult, $sQueued)
|
||||
{
|
||||
echo "<div align=center><table><tr>\n";
|
||||
for($i = 1; $oRow = query_fetch_object($hResult); $i++)
|
||||
{
|
||||
// display thumbnail
|
||||
$oVersion = new version($oRow->versionId);
|
||||
$oApp = new Application($oVersion->iAppId);
|
||||
$oScreenshot = new Screenshot($oRow->id);
|
||||
$shImg = $oScreenshot->get_thumbnail_img();
|
||||
echo "<td align=center>\n";
|
||||
echo $shImg;
|
||||
echo "<div align=center>". substr($oRow->description,0,20). "\n";
|
||||
|
||||
echo "<br />[".$oApp->objectMakeLink()."]";
|
||||
|
||||
echo "<br />[".$oVersion->objectMakeLink()."]";
|
||||
|
||||
echo "</div></td>\n";
|
||||
// end row if counter of 3
|
||||
if($i % 3 == 0)
|
||||
echo "</tr><tr>\n";
|
||||
}
|
||||
|
||||
echo "</tr></table></div><br />\n";
|
||||
}
|
||||
|
||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
||||
{
|
||||
return appData::objectGetEntries($bQueued, $bRejected, $iRows, $iStart,
|
||||
"screenshot");
|
||||
}
|
||||
|
||||
function objectGetEntriesCount($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
||||
{
|
||||
return appData::objectGetEntriesCount($bQueued, $bRejected,
|
||||
'screenshot');
|
||||
}
|
||||
|
||||
function objectGetHeader()
|
||||
{
|
||||
return appData::objectGetHeader("screenshot");
|
||||
|
||||
@@ -18,7 +18,7 @@ function global_sidebar_menu()
|
||||
$g->done();
|
||||
|
||||
$g = new htmlmenu("AppDB");
|
||||
$g->add("Screenshots", BASE."viewScreenshots.php");
|
||||
$g->add("Screenshots", BASE."objectManager.php?sClass=screenshot&sTitle=View+Screenshots");
|
||||
$g->add("Browse Apps", BASE."appbrowse.php");
|
||||
$g->add("Browse Newest Apps", BASE."objectManager.php?sClass=application&".
|
||||
"bIsQueue=false&sTitle=Newest%20apps&sOrderBy=appId&bAscending=false");
|
||||
|
||||
Reference in New Issue
Block a user