diff --git a/include/objectManager.php b/include/objectManager.php
index fd5a24e..c94b805 100644
--- a/include/objectManager.php
+++ b/include/objectManager.php
@@ -168,6 +168,64 @@ class ObjectManager
exit;
}
+ public function drawTable($hResult)
+ {
+ /* output the header */
+ echo '
';
+
+ /* 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 = ' [ objectGetId()).
+ '">delete ]';
+ }
+
+ $oTableCell = new TableCell('[ objectGetId()).'">'.$sEditLinkLabel.' ]'.$shDeleteLink);
+ $this->oTableRow->AddCell($oTableCell);
+ }
+
+ echo $this->oTableRow->GetString();
+ }
+
+ echo "
";
+ }
+
/* displays the list of entries */
public function display_table($aClean)
{
@@ -267,60 +325,14 @@ class ObjectManager
echo '';
}
- /* output the header */
- echo '';
+ $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 = ' [ objectGetId()).
- '">delete ]';
- }
-
- $oTableCell = new TableCell('[ objectGetId()).'">'.$sEditLinkLabel.' ]'.$shDeleteLink);
- $this->oTableRow->AddCell($oTableCell);
- }
-
- echo $this->oTableRow->GetString();
- }
-
- echo "
";
+ /* 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))
diff --git a/include/screenshot.php b/include/screenshot.php
index bf2000a..46cf1e9 100644
--- a/include/screenshot.php
+++ b/include/screenshot.php
@@ -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 "\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 "| \n";
+ echo $shImg;
+ echo " ". substr($oRow->description,0,20). "\n";
+
+ echo " [".$oApp->objectMakeLink()."]";
+
+ echo " [".$oVersion->objectMakeLink()."]";
+
+ echo " | \n";
+ // end row if counter of 3
+ if($i % 3 == 0)
+ echo "
\n";
+ }
+
+ echo "
\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");
diff --git a/include/sidebar.php b/include/sidebar.php
index 4d43a0f..ac060ec 100644
--- a/include/sidebar.php
+++ b/include/sidebar.php
@@ -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");
diff --git a/viewScreenshots.php b/viewScreenshots.php
deleted file mode 100644
index 474cc78..0000000
--- a/viewScreenshots.php
+++ /dev/null
@@ -1,95 +0,0 @@
-\n";
-
-/* display a range of 10 pages */
-$pageRange = 10;
-
-$ItemsPerPage = isset($aClean['iItemsPerPage']) ? $aClean['iItemsPerPage'] : 6;
-$currentPage = isset($aClean['iPage']) ? $aClean['iPage'] : 1;
-
-$ItemsPerPage = min($ItemsPerPage,100);
-$totalPages = ceil(appData::objectGetEntriesCount("false", false,
- "screenshot")/$ItemsPerPage);
-$currentPage = min($currentPage,$totalPages);
-$offset = (($currentPage-1) * $ItemsPerPage);
-
-
-/* display page selection links */
-echo "";
-echo "Page $currentPage of $totalPages
";
-display_page_range($currentPage, $pageRange, $totalPages,
- $_SERVER['PHP_SELF']."?iItemsPerPage=".$ItemsPerPage);
-echo "
";
-echo "
";
-
-/* display the option to choose how many screenshots per-page to display */
-echo '";
-
-echo "";
-
-/* query for all of the Screenshots in assending order */
-$Ids = appData::objectGetEntries(false, false, $ItemsPerPage, $offset, "screenshot");
-$c = 1;
-echo "\n";
-while ($oRow = query_fetch_object($Ids))
-{
- // display thumbnail
- $oVersion = new version($oRow->versionId);
- $oApp = new Application($oVersion->iAppId);
- $oScreenshot = new Screenshot($oRow->id);
- $img = $oScreenshot->get_thumbnail_img();
- echo "| \n";
- echo $img;
- echo " ". substr($oRow->description,0,20). "\n";
-
- echo " [".$oApp->objectMakeLink()."]";
-
- echo " [".$oVersion->objectMakeLink()."]";
-
- echo " | \n";
- // end row if counter of 3
- if ($c % 3 == 0) echo "
\n";
- $c++;
-
-}
-echo "
\n";
-
-/* display page selection links */
-echo "";
-display_page_range($currentPage, $pageRange, $totalPages,
- $_SERVER['PHP_SELF']."?iItemsPerPage=".$ItemsPerPage);
-echo "";
-
-echo "\n";
-
-apidb_footer();
-
-?>