appdb/ include/downloadurl.php unit_test/test_ ...

WineHQ wineowner at wine.codeweavers.com
Wed May 30 21:40:02 CDT 2007


ChangeSet ID:	31150
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/05/30 21:40:02

Modified files:
	include        : downloadurl.php 
	unit_test      : test_om_objects.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	downloadurl: Add more objectManager functions. Allow us to unqueue queued downloadurls that are
	currently stuck in limbo.

Patch: http://cvs.winehq.org/patch.py?id=31150

Old revision  New revision  Changes     Path
 1.15          1.16          +72 -1      appdb/include/downloadurl.php
 1.12          1.13          +5 -0       appdb/unit_test/test_om_objects.php

Index: appdb/include/downloadurl.php
diff -u -p appdb/include/downloadurl.php:1.15 appdb/include/downloadurl.php:1.16
--- appdb/include/downloadurl.php:1.15	31 May 2007  2:40: 2 -0000
+++ appdb/include/downloadurl.php	31 May 2007  2:40: 2 -0000
@@ -57,8 +57,21 @@ class downloadurl
     }
 
     /* Output an editor for Download URL fields */
-    function outputEditor($oVersion, $sFormAction)
+    function outputEditor($oVersion = null, $sFormAction = null)
     {
+        /* If we do not get any parameters we try to behave like a proper objectManager
+           object, by only showing an editor for one entry instead of several.  This
+           code is sort of hacky, and should be fixed once the rest of the downloadurl
+           code is fully adapted to the objectManager */
+        if(!$oVersion && !$sFormAction)
+        {
+            global $aClean;
+            echo downloadurl::outputEditorSingle($this->iVersionId);
+        }
+
+        if(!$oVersion || !$sFormAction)
+            return FALSE;
+
         /* Check for correct permissions */
         if(!downloadurl::canEdit($oVersion->iVersionId))
             return FALSE;
@@ -356,6 +369,64 @@ class downloadurl
 
         return TRUE;
     }
+
+    function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
+    {
+        return appData::objectGetEntries($bQueued, $bRejected, $iRows, $iStart,
+                                         "downloadurl");
+    }
+
+    function objectGetHeader()
+    {
+        return appData::objectGetHeader("downloadurl");
+    }
+
+    /* arg1 = OM object, arg2 = CSS style, arg3 = text for edit link */
+    function objectOutputTableRow($oObject, $sClass, $sEditLinkLabel)
+    {
+        $oAppData = new AppData();
+        $oAppData->objectOutputTableRow($oObject, $sClass, $sEditLinkLabel);
+    }
+
+    function objectGetInstanceFromRow($oRow)
+    {
+        return new appData($oRow->id, $oRow);
+    }
+
+    function getOutputEditorValues($aClean)
+    {
+        $this->sUrl = $aClean['sDownloadUrlUrl'];
+        $this->sDescription = $aClean['sDownloadUrlDescription'];
+    }
+
+    function mustBeQueued()
+    {
+        if($this)
+        {
+            $oAppData = new appData();
+            $oAppData->iVersionId = $this->iVersionId;
+            $oAppData->iAppId = NULL;
+            return $oAppData->mustBeQueued();
+        } else
+            return appData::mustBeQueued();
+    }
+
+    function allowAnonymousSubmissions()
+    {
+        return FALSE;
+    }
+
+    function objectMakeLink()
+    {
+        /* FIXME: not implemented */
+        return TRUE;
+    }
+
+    function objectMakeUrl()
+    {
+        /* FIXME: not implemented */
+        return TRUE;
+    }
 }
 
 ?>
Index: appdb/unit_test/test_om_objects.php
diff -u -p appdb/unit_test/test_om_objects.php:1.12 appdb/unit_test/test_om_objects.php:1.13
--- appdb/unit_test/test_om_objects.php:1.12	31 May 2007  2:40: 2 -0000
+++ appdb/unit_test/test_om_objects.php	31 May 2007  2:40: 2 -0000
@@ -49,6 +49,10 @@ function test_class($sClassName, $aTestM
                         $oTestObject->sName = "Silly test distribution";
                         $oTestObject->sUrl = "http://appdb.winehq.org/";
                     break;
+                    case "downloadurl":
+                        $oTestObject->sUrl = "http://appdb.winehq.org/";
+                        $oTestObject->sDescription = "DANGER";
+                        $oTestObject->iVersionId = 65000; // Just needs to be != 0 
                     case "maintainer":
                         $iAppId = 65555;
                         $oApp = new application();
@@ -139,6 +143,7 @@ function test_object_methods()
     $aTestClasses = array("application",
                           "application_queue",
                           "distribution",
+                          "downloadurl",
                           "maintainer",
                           "screenshot",
                           "testData",



More information about the wine-cvs mailing list