ChangeSet ID: 30950 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2007/03/10 17:31:47
Modified files: admin : adminAppDataQueue.php adminScreenshots.php include : screenshot.php util.php
Log message: Alexander Nicolaysen Sørnes alex@thehandofagony.com Rename appData type 'image' to 'screenshot'
Patch: http://cvs.winehq.org/patch.py?id=30950
Old revision New revision Changes Path 1.31 1.32 +4 -4 appdb/admin/adminAppDataQueue.php 1.17 1.18 +3 -3 appdb/admin/adminScreenshots.php 1.54 1.55 +7 -7 appdb/include/screenshot.php 1.81 1.82 +0 -8 appdb/include/util.php
Index: appdb/admin/adminAppDataQueue.php diff -u -p appdb/admin/adminAppDataQueue.php:1.31 appdb/admin/adminAppDataQueue.php:1.32 --- appdb/admin/adminAppDataQueue.php:1.31 10 Mar 2007 23:31:47 -0000 +++ appdb/admin/adminAppDataQueue.php 10 Mar 2007 23:31:47 -0000 @@ -106,10 +106,10 @@ if (!$aClean['iId']) echo '<td><textarea name="sDescription" rows=10 cols=35>'.stripslashes($obj_row->description).'</textarea></td></tr>',"\n";
//data - if($obj_row->type == "image") + if($obj_row->type == "screenshot") { $oScreenshot = new Screenshot($obj_row->id); - echo '<tr valign=top><td class=color0><b>Submited image</b></td>',"\n"; + echo '<tr valign=top><td class=color0><b>Submited screenshot</b></td>',"\n"; echo '<td>'; $imgSRC = '<img width="'.$oScreenshot->get_thumbnail_width().'" height="'.$oScreenshot->get_thumbnail_height().'" src="../appimage.php?bQueued=true&iId='.$obj_row->id.'" />'; // generate random tag for popup window @@ -152,7 +152,7 @@ if (!$aClean['iId']) $statusMessage = ""; $goodtogo = 0;
- if($obj_row->type == "image") + if($obj_row->type == "screenshot") { $oScreenshot = new Screenshot($obj_row->id); $oScreenshot->unQueue(); @@ -186,7 +186,7 @@ if (!$aClean['iId']) util_redirect_and_exit(apidb_fullurl("admin/adminAppDataQueue.php")); } elseif ($aClean['sReject']) { - if($obj_row->type == "image") + if($obj_row->type == "screenshot") { $oScreenshot = new Screenshot($obj_row->id); $oScreenshot->delete(); Index: appdb/admin/adminScreenshots.php diff -u -p appdb/admin/adminScreenshots.php:1.17 appdb/admin/adminScreenshots.php:1.18 --- appdb/admin/adminScreenshots.php:1.17 10 Mar 2007 23:31:47 -0000 +++ appdb/admin/adminScreenshots.php 10 Mar 2007 23:31:47 -0000 @@ -35,7 +35,7 @@ apidb_header("Screenshots"); // regenerate all screenshots if($aClean['sRegenerate']) { - $sQuery = "SELECT id FROM appData WHERE type = 'image'"; + $sQuery = "SELECT id FROM appData WHERE type = 'screenshot'"; $hResult = query_parameters($sQuery); while($oRow = mysql_fetch_object($hResult)) { @@ -64,7 +64,7 @@ if($aClean['iPage']) $currentPage = $aClean['iPage'];
$ItemsPerPage = min($ItemsPerPage,100); -$totalPages = ceil(getNumberOfImages()/$ItemsPerPage); +$totalPages = ceil(appData::objectGetEntriesCount("all", "screenshot")/$ItemsPerPage); $currentPage = min($currentPage,$totalPages); $offset = (($currentPage-1) * $ItemsPerPage);
@@ -100,7 +100,7 @@ echo "</center>";
/* query for all of the Screenshots in assending order */ $Ids = query_parameters("SELECT * from appData - WHERE type = 'image' + WHERE type = 'screenshot' ORDER BY id ASC LIMIT ?, ?", $offset, $ItemsPerPage); $c = 1; echo "<div align=center><table><tr>\n"; Index: appdb/include/screenshot.php diff -u -p appdb/include/screenshot.php:1.54 appdb/include/screenshot.php:1.55 --- appdb/include/screenshot.php:1.54 10 Mar 2007 23:31:47 -0000 +++ appdb/include/screenshot.php 10 Mar 2007 23:31:47 -0000 @@ -36,7 +36,7 @@ class Screenshot { FROM appData, appVersion WHERE appData.versionId = appVersion.versionId AND id = '?' - AND type = 'image'", $iScreenshotId); + AND type = 'screenshot'", $iScreenshotId); if($hResult) { $oRow = mysql_fetch_object($hResult); @@ -73,7 +73,7 @@ class Screenshot {
$hResult = query_parameters("INSERT INTO appData (versionId, type, description, queued, submitterId) ". "VALUES('?', '?', '?', '?', '?')", - $iVersionId, "image", $sDescription, $this->bQueued?"true":"false", + $iVersionId, "screenshot", $sDescription, $this->bQueued?"true":"false", $_SESSION['current']->iUserId); if($hResult) { @@ -190,7 +190,7 @@ class Screenshot { */ function setDescription($sDescription) { - if($hResult = query_parameters("UPDATE id SET description = '?' WHERE id = '?' AND type = 'image'", + if($hResult = query_parameters("UPDATE id SET description = '?' WHERE id = '?' AND type = 'screenshot'", $sDescription, $this->iScreenshotId)) $this->sDescription = $sDescription; } @@ -392,7 +392,7 @@ class Screenshot { FROM appData, appVersion WHERE appData.versionId = appVersion.versionId AND appVersion.appId = '?' - AND type = 'image' + AND type = 'screenshot' AND appData.queued = 'false' ORDER BY rand", $iAppId); } else if ($iVersionId) // we want a random screenshot for this version @@ -400,7 +400,7 @@ class Screenshot { $hResult = query_parameters("SELECT id, description, RAND() AS rand FROM appData WHERE versionId = '?' - AND type = 'image' + AND type = 'screenshot' AND queued = 'false' ORDER BY rand", $iVersionId); } @@ -457,7 +457,7 @@ class Screenshot { $hResult = query_parameters("SELECT appData.*, appVersion.appId as appId FROM appData, appVersion WHERE appVersion.versionId = appData.versionId - AND type = 'image' + AND type = 'screenshot' AND appVersion.appId = '?' AND appData.queued = '?'", $iAppId, $bQueued); } @@ -469,7 +469,7 @@ class Screenshot { $hResult = query_parameters("SELECT appData.*, appVersion.appId as appId FROM appData, appVersion WHERE appVersion.versionId = appData.versionId - AND type = 'image' + AND type = 'screenshot' AND appData.versionId = '?' AND appData.queued = '?'", $iVersionId, $bQueued); } else Index: appdb/include/util.php diff -u -p appdb/include/util.php:1.81 appdb/include/util.php:1.82 --- appdb/include/util.php:1.81 10 Mar 2007 23:31:47 -0000 +++ appdb/include/util.php 10 Mar 2007 23:31:47 -0000 @@ -221,14 +221,6 @@ function getNumberOfAppFamilies() return $oRow->num_appfamilies; }
-/* Get the number of images in the database */ -function getNumberOfImages() -{ - $hResult = query_parameters("SELECT count(*) as num_images FROM appData WHERE type='image';"); - $oRow = mysql_fetch_object($hResult); - return $oRow->num_images; -} - /* Get the number of queued bug links in the database */ function getNumberOfQueuedBugLinks() {