[AppDB] Part 1 of 2 Allow mantainers/administrators to reject an application submition instead of just deleting it.

Tony Lambregts tony.lambregts at gmail.com
Sun Aug 14 20:43:16 CDT 2005


Before this patch can be applied you will need to run the following SQL..

[cut here]
use apidb
ALTER TABLE appFamily CHANGE queued queued  enum('true','false','rejected') NOT NULL default 'false';
ALTER TABLE appFamily CHANGE queued queued  enum('true','false','rejected') NOT NULL default 'false';
[cut here]


Change Log: Allow mantainers/administrators to reject an application submition instead of just deleting it.

Files Changed: include/user.php include/version.php include/application.php include/sidebar_login.php admin/adminAppQueue.php 
tables/appdb_tables.sql












-------------- next part --------------
Index: include/user.php
===================================================================
RCS file: /home/wine/appdb/include/user.php,v
retrieving revision 1.47
diff -u -r1.47 user.php
--- include/user.php	15 Aug 2005 00:17:54 -0000	1.47
+++ include/user.php	15 Aug 2005 01:26:13 -0000
@@ -533,6 +533,60 @@
          return query_appdb($sQuery);
      }
 
+     function getAppRejectQueueQuery($queryAppFamily)
+     {
+         if($this->hasPriv("admin"))
+         {
+             if($queryAppFamily)
+             {
+                 $sQuery = "SELECT appFamily.appId FROM appFamily WHERE queued = 'rejected'";
+             } else
+             {
+                 $sQuery = "SELECT appVersion.versionId FROM appVersion, appFamily
+                            WHERE appFamily.appId = appVersion.appId 
+                            AND appFamily.queued = 'false' AND appVersion.queued = 'rejected'";
+             }
+         } else
+         {
+             if($queryAppFamily)
+             {
+                 $sQuery = "SELECT appFamily.appId FROM appFamily
+                            WHERE queued = 'rejected'
+                            AND appFamily.submitterId = '".$this->iUserId."';";
+             } else
+             {
+                 $sQuery = "SELECT appVersion.versionId FROM appVersion, appFamily
+                            WHERE appFamily.appId = appVersion.appId 
+                            AND appFamily.queued = 'false' AND appVersion.queued = 'rejected'
+                            AND appVersion.submitterId = '".$this->iUserId."';";
+             }
+         }
+
+         return query_appdb($sQuery);
+     }
+
+     function getAllRejectedApps()
+     {
+         $result = query_appdb("SELECT appVersion.versionId, appFamily.appId 
+                               FROM appVersion, appFamily
+                               WHERE appFamily.appId = appVersion.appId 
+                               AND (appFamily.queued = 'rejected' OR appVersion.queued = 'rejected')
+                               AND appVersion.submitterId = '".$this->iUserId."';");
+
+         if(!$result || mysql_num_rows($result) == 0)
+             return;
+
+         $retval = array();
+         $c = 0;
+         while($row = mysql_fetch_object($result))
+         {
+             $retval[$c] = array($row->appId, $row->versionId);
+             $c++;
+         }
+
+         return $retval;
+     }
+
      /**
       * Does the user have permission to modify on this version?
       */
@@ -553,6 +607,30 @@
          else
              return false;
      }
+
+     function isAppSubmitter($iAppId)
+     {
+         $sQuery = "SELECT appId FROM appFamily
+                    WHERE submitterId = '".$this->iUserId."'
+                    AND appId = '".$iAppId."';";
+         $hResult = query_appdb($sQuery);
+         if(mysql_num_rows($hResult))
+             return true;
+         else
+             return false;
+    }
+     function isVersionSubmitter($iVersionId)
+     {
+         $sQuery = "SELECT appVersion.versionId FROM appVersion, appFamily
+                    WHERE appFamily.appId = appVersion.appId 
+                    AND appVersion.submitterId = '".$this->iUserId."'
+                    AND appVersion.versionId = '".$iVersionId."';";
+         $hResult = query_appdb($sQuery);
+         if(mysql_num_rows($hResult))
+             return true;
+         else
+             return false;
+    }
 }
 
 
Index: include/version.php
===================================================================
RCS file: /home/wine/appdb/include/version.php,v
retrieving revision 1.28
diff -u -r1.28 version.php
--- include/version.php	5 Aug 2005 22:07:41 -0000	1.28
+++ include/version.php	15 Aug 2005 01:26:14 -0000
@@ -22,6 +22,7 @@
     var $sSubmitTime;
     var $iSubmitterId;
     var $sDate;
+    var $sQueued;
     var $aNotesIds;           // an array that contains the noteId of every note linked to this version
     var $aCommentsIds;        // an array that contains the commentId of every comment linked to this version
     var $aScreenshotsIds;     // an array that contains the screenshotId of every screenshot linked to this version
@@ -59,7 +60,7 @@
                     $this->sTestedRelease = $oRow->maintainer_release;
                     $this->sTestedRating = $oRow->maintainer_rating;
                     $this->sWebpage = $oRow->webPage;
-                    $this->bQueued = ($oRow->queued=="true")?true:false;
+                    $this->sQueued = $oRow->queued;
                 }
             }
 
@@ -140,9 +141,9 @@
     {
         // Security, if we are not an administrator or an appmaintainer the version must be queued.
         if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isSupermaintainer($iAppId)))
-            $this->bQueued = true;
+            $this->sQueued = 'true';
         else
-            $this->bQueued = false;
+            $this->sQueued = 'false';
 
         $aInsert = compile_insert_string(array( 'versionName'       => $sName,
                                                 'description'       => $sDescription,
@@ -150,7 +151,7 @@
                                                 'maintainer_rating' => $sTestedRating,
                                                 'appId'             => $iAppId,
                                                 'submitterId'       => $_SESSION['current']->iUserId,
-                                                'queued'            => $this->bQueued?"true":"false" ));
+                                                'queued'            => $this->sQueued ));
         $sFields = "({$aInsert['FIELDS']})";
         $sValues = "({$aInsert['VALUES']})";
 
@@ -249,7 +250,9 @@
     function delete($bSilent=false)
     {
         /* is the current user allowed to delete this version? */
-        if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($iVersionId))
+        if(!$_SESSION['current']->hasPriv("admin") && 
+           !$_SESSION['current']->hasAppVersionModifyPermission($iVersionId) &&
+           !(($_SESSION['current']->iUserId == $this->iSubmitterId) && ($this->sQueued == 'rejected')))
         {
             return;
         }
@@ -300,7 +303,7 @@
         if(!$bSilent)
             $this->mailMaintainers("delete");
 
-        $this->mailSubmitter(true);
+        $this->mailSubmitter("delete");
     }
 
 
@@ -316,15 +319,15 @@
         }
 
         // If we are not in the queue, we can't move the version out of the queue.
-        if(!$this->bQueued)
+        if(!$this->sQueued == 'true')
             return false;
 
         $sUpdate = compile_update_string(array('queued'    => "false"));
         if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
         {
-            $this->bQueued = false;
+            $this->sQueued = 'false';
             // we send an e-mail to intersted people
-            $this->mailSubmitter();
+            $this->mailSubmitter("unQueue");
             $this->mailMaintainers();
 
             // the version has been unqueued
@@ -332,25 +335,91 @@
         }
     }
 
+    function Reject($bSilent=false)
+    {
+        /* is the current user allowed to delete this version? */
+        if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($iVersionId))
+        {
+            return;
+        }
+
+        // If we are not in the queue, we can't move the version out of the queue.
+        if(!$this->sQueued == 'true')
+            return false;
+
+        $sUpdate = compile_update_string(array('queued'    => "rejected"));
+        if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
+        {
+            $this->sQueued = 'rejected';
+            // we send an e-mail to intersted people
+            if(!$bSilent)
+            {
+                $this->mailSubmitter("reject");
+                $this->mailMaintainers("reject");
+            }
+            // the version has been unqueued
+            addmsg("The version has been rejected.", "green");
+        }
+    }
 
-    function mailSubmitter($bRejected=false)
+    function ReQueue()
+    {
+        /* is the current user allowed to delete this version? */
+        if(!$_SESSION['current']->hasPriv("admin") &&
+           !$_SESSION['current']->hasAppVersionModifyPermission($iVersionId) &&
+           !$_SESSION['current']->iUserId == $this->iSubmitterId)
+        {
+            return;
+        }
+
+        $sUpdate = compile_update_string(array('queued'    => "true"));
+        if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
+        {
+            $this->sQueued = 'true';
+            // we send an e-mail to intersted people
+            $this->mailMaintainers();
+
+            // the version has been unqueued
+            addmsg("The version has been re-submitted", "green");
+        }
+    }
+
+    function mailSubmitter($sAction="add")
     {
         if($this->iSubmitterId)
         {
             $oApp = new Application($this->appId);
             $oSubmitter = new User($this->iSubmitterId);
-            if(!$bRejected)
+            switch($sAction)
             {
-                $sSubject =  "Submitted version accepted";
-                $sMsg  = "The version you submitted (".$oApp->sName." ".$this->sName.") has been accepted.";
-            } else
-            {
-                 $sSubject =  "Submitted version rejected";
-                 $sMsg  = "The version you submitted (".$oApp->sName." ".$this->sName.") has been rejected.";
+            case "add":
+               {
+                   $sSubject =  "Submitted version accepted";
+                   $sMsg  = "The version you submitted (".$oApp->sName." ".$this->sName.") has been accepted.";
+               }
+            break;
+            case "reject":
+                {
+                    $sSubject =  "Submitted version rejected";
+                    $sMsg  = "The version you submitted (".$oApp->sName." ".$this->sName.") has been rejected.";
+                    $sMsg .= APPDB_ROOT."admin/rejected.php?sub=view&versionId=".$this->iVersionId."\n";
+                    $sMsg .= "Reason given:\n";
+                    $sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
+                }
+
+            break;
+            case "delete":
+                {
+                    $sSubject =  "Submitted version deleted";
+                    $sMsg  = "The version you submitted (".$oApp->sName." ".$this->sName.") has been deleted.";
+                    $sMsg .= "Reason given:\n";
+                    $sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
+                }
+            break;
             }
             $sMsg .= $_REQUEST['replyText']."\n";
             $sMsg .= "We appreciate your help in making the Version Database better for all users.";
-                
+        
             mail_appdb($oSubmitter->sEmail, $sSubject ,$sMsg);
         }
     }
@@ -362,7 +431,7 @@
         switch($sAction)
         {
             case "add":
-                if(!$this->bQueued)
+                if($this->sQueued == "false")
                 {
                     $sSubject = "Version ".$this->sName." of ".$oApp->sName." added by ".$_SESSION['current']->sRealname;
                     $sMsg  = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
@@ -380,7 +449,7 @@
                     $sSubject = "Version '".$this->sName."' of '".$oApp->sName."' submitted by ".$_SESSION['current']->sRealname;
                     $sMsg .= "This version has been queued.";
                     $sMsg .= "\n";
-                    addmsg("The version you submitted will be added to the database database after being reviewed.", "green");
+                    addmsg("The version you submitted will be added to the database after being reviewed.", "green");
                 }
             break;
             case "edit":
@@ -399,6 +468,20 @@
                 }
 
                 addmsg("Version deleted.", "green");
+            break;
+            case "reject":
+                $sSubject = "Version '".$this->sName."' of '".$oApp->sName."' has been rejected by ".$_SESSION['current']->sRealname;
+
+                 /* if replyText is set we should report the reason the application was rejected */
+                if($_REQUEST['replyText'])
+                {
+                    $sMsg  = APPDB_ROOT."admin/rejected.php?versionId=".$this->iVersionId."\n";
+
+                    $sMsg .= "Reason given:\n";
+                    $sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
+                }
+
+                addmsg("Version rejected.", "green");
             break;
         }
         $sEmail = get_notify_email_address_list(null, $this->iVersionId);
Index: include/application.php
===================================================================
RCS file: /home/wine/appdb/include/application.php,v
retrieving revision 1.29
diff -u -r1.29 application.php
--- include/application.php	5 Aug 2005 22:07:41 -0000	1.29
+++ include/application.php	15 Aug 2005 01:26:14 -0000
@@ -19,7 +19,7 @@
     var $sKeywords;
     var $sDescription;
     var $sWebpage;
-    var $bQueued;
+    var $sQueued;
     var $sSubmitTime;
     var $iSubmitterId;
     var $aVersionsIds;  // an array that contains the versionId of every version linked to this app.
@@ -58,7 +58,7 @@
                         $this->sKeywords = $oRow->keywords;
                         $this->sDescription = $oRow->description;
                         $this->sWebpage = $oRow->webPage;
-                        $this->bQueued = ($oRow->queued=="true")?true:false;
+                        $this->sQueued = $oRow->queued;
                     }
                     $this->aVersionsIds[] = $oRow->versionId;
                 }
@@ -86,7 +86,7 @@
                     $this->sKeywords = $oRow->keywords;
                     $this->sDescription = $oRow->description;
                     $this->sWebpage = $oRow->webPage;
-                    $this->bQueued = ($oRow->queued=="true")?true:false;
+                    $this->sQueued = $oRow->queued;
                 }
             }
 
@@ -117,9 +117,9 @@
     {
         // Security, if we are not an administrator the application must be queued.
         if(!($_SESSION['current']->hasPriv("admin")))
-            $this->bQueued = true;
+            $this->sQueued = 'true';
         else
-            $this->bQueued = false;
+            $this->sQueued = 'false';
 
         $aInsert = compile_insert_string(array( 'appName'    => $sName,
                                                 'description'=> $sDescription,
@@ -128,7 +128,7 @@
                                                 'vendorId'   => $iVendorId,
                                                 'catId'      => $iCatId,
                                                 'submitterId'=> $_SESSION['current']->iUserId,
-                                                'queued'     => $this->bQueued?"true":"false" ));
+                                                'queued'     => $this->sQueued));
         $sFields = "({$aInsert['FIELDS']})";
         $sValues = "({$aInsert['VALUES']})";
 
@@ -262,14 +262,14 @@
     function unQueue()
     {
         // If we are not in the queue, we can't move the application out of the queue.
-        if(!$this->bQueued)
+        if(!$this->sQueued == 'true')
             return false;
 
         $sUpdate = compile_update_string(array('queued'  => "false",
                                                'keywords'=> str_replace(" *** ","",$this->sKeywords) ));
         if(query_appdb("UPDATE appFamily SET ".$sUpdate." WHERE appId = ".$this->iAppId))
         {
-            $this->bQueued = false;
+            $this->sQueued = 'false';
             // we send an e-mail to intersted people
             $this->mailSubmitter();
             $this->mailSupermaintainers();
@@ -279,24 +279,77 @@
         }
     }
 
+    function Reject()
+    {
+        // If we are not in the queue, we can't move the application out of the queue.
+        if(!$this->sQueued == 'true')
+            return false;
+
+        $sUpdate = compile_update_string(array('queued'    => "rejected"));
+        if(query_appdb("UPDATE appFamily SET ".$sUpdate." WHERE appId = ".$this->iAppId))
+        {
+            $this->sQueued = 'rejected';
+            // we send an e-mail to intersted people
+            $this->mailSubmitter("reject");
+            $this->mailSupermaintainers("reject");
 
-    function mailSubmitter($bRejected=false)
+            // the application has been rejectedd
+            addmsg("The application has been rejected.", "green");
+        }
+    }
+    function ReQueue()
+    {
+        // If we are not in the rejected, we can't move the application into the queue.
+        if(!$this->sQueued == 'rejected')
+            return false;
+
+        $sUpdate = compile_update_string(array('queued'    => "true"));
+        if(query_appdb("UPDATE appFamily SET ".$sUpdate." WHERE appId = ".$this->iAppId))
+        {
+            $this->sQueued = 'true';
+            // we send an e-mail to intersted people
+            $this->mailSupermaintainers();
+
+            // the application has been re-queued
+            addmsg("The application has been re-queued.", "green");
+        }
+    }
+
+    function mailSubmitter($sAction="add")
     {
         if($this->iSubmitterId)
         {
             $oSubmitter = new User($this->iSubmitterId);
-            if(!$bRejected)
-            {
-                $sSubject =  "Submitted application accepted";
-                $sMsg  = "The application you submitted (".$this->sName.") has been accepted.";
-            } else
+            switch($sAction)
             {
-                 $sSubject =  "Submitted application rejected";
-                 $sMsg  = "The application you submitted (".$this->sName.") has been rejected.";
-            }
+            case "add":
+               {
+                   $sSubject =  "Submitted application accepted";
+                   $sMsg  = "The application you submitted (".$oApp->sName." ".$this->sName.") has been accepted.";
+               }
+            break;
+            case "reject":
+                {
+                    $sSubject =  "Submitted application rejected";
+                    $sMsg  = "The application you submitted (".$oApp->sName." ".$this->sName.") has been rejected.";
+                    $sMsg .= APPDB_ROOT."admin/rejected.php?sub=view&appId=".$this->iAppId."\n";
+
+                    $sMsg .= "Reason given:\n";
+                    $sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
+                }
+            break;
+            case "delete":
+                {
+                    $sSubject =  "Submitted application deleted";
+                    $sMsg  = "The application you submitted (".$oApp->sName." ".$this->sName.") has been deleted.";
+                    $sMsg .= "Reason given:\n";
+                    $sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
+                }
+            break;
+
             $sMsg .= $_REQUEST['replyText']."\n";
             $sMsg .= "We appreciate your help in making the Application Database better for all users.";
-                
+            }
             mail_appdb($oSubmitter->sEmail, $sSubject ,$sMsg);
         }
     }
@@ -307,7 +360,7 @@
         switch($sAction)
         {
             case "add":
-                if(!$this->bQueued)
+                if(!$this->sQueued == 'true')
                 {
                     $sSubject = $this->sName." has been added by ".$_SESSION['current']->sRealname;
                     $sMsg  = APPDB_ROOT."appview.php?appId=".$this->iAppId."\n";
@@ -323,7 +376,7 @@
                     $sSubject = $this->sName." has been submitted by ".$_SESSION['current']->sRealname;
                     $sMsg .= "This application has been queued.";
                     $sMsg .= "\n";
-                    addmsg("The application you submitted will be added to the database database after being reviewed.", "green");
+                    addmsg("The application you submitted will be added to the database after being reviewed.", "green");
                 }
             break;
             case "edit":
@@ -342,6 +395,18 @@
                 }
 
                 addmsg("Application deleted.", "green");
+            break;
+            case "reject":
+                $sSubject = $this->sName." has been rejected by ".$_SESSION['current']->sRealname;
+
+                /* if replyText is set we should report the reason the application was rejected */
+                if($_REQUEST['replyText'])
+                {
+                    $sMsg .= "Reason given:\n";
+                    $sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
+                }
+
+                addmsg("Application rejected.", "green");
             break;
         }
         $sEmail = get_notify_email_address_list($this->iAppId);
Index: include/sidebar_login.php
===================================================================
RCS file: /home/wine/appdb/include/sidebar_login.php,v
retrieving revision 1.11
diff -u -r1.11 sidebar_login.php
--- include/sidebar_login.php	7 Feb 2005 23:55:42 -0000	1.11
+++ include/sidebar_login.php	15 Aug 2005 01:26:14 -0000
@@ -5,7 +5,7 @@
 
 require_once(BASE."include/maintainer.php");
 require_once(BASE."include/application.php");
-
+require_once(BASE."include/user.php");
 
 function global_sidebar_login() {
   
@@ -32,6 +32,10 @@
                     $g->addmisc("<a href='".BASE."appview.php?versionId=$versionId'>".lookup_app_name($appId)." ".lookup_version_name($versionId)."</a>", "center");
             }
         }
+        $appsRejected = $_SESSION['current']->getAllRejectedApps();
+        if($appsRejected)
+            $g->addmisc("<a href='".BASE."admin/rejected.php?'>Review Rejected Apps</a>", "center");
+
     }
     else
     {
Index: admin/adminAppQueue.php
===================================================================
RCS file: /home/wine/appdb/admin/adminAppQueue.php,v
retrieving revision 1.41
diff -u -r1.41 adminAppQueue.php
--- admin/adminAppQueue.php	14 Aug 2005 15:34:58 -0000	1.41
+++ admin/adminAppQueue.php	15 Aug 2005 01:26:14 -0000
@@ -168,7 +168,7 @@
             echo '<td><input type=text name="versionName" value="'.$oVersion->sName.'" size="20"></td></tr>',"\n";
 
             echo '<tr valign=top><td class=color0><b>Description</b></td>',"\n";
-            echo '<td><p style="width:700px"><textarea  cols="80" rows="20" id="editor" name="versionDescription">'.$oVersion->sDescription.'</textarea></p></td></tr>',"\n";
+            echo '<td><p style="width:700px"><textarea  cols="80" rows="20" id="editor" name="versionDescription">'.stripslashes($oVersion->sDescription).'</textarea></p></td></tr>',"\n";
         
             echo '<tr valign=top><td class="color0"><b>email Text</b></td>',"\n";
             echo '<td><textarea name="replyText" rows="10" cols="35"></textarea></td></tr>',"\n";
@@ -177,7 +177,8 @@
             echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
             echo '<input type="hidden" name="versionId" value="'.$oVersion->iVersionId.'" />';
             echo '<input type="submit" value=" Submit Version Into Database " class="button">&nbsp',"\n";
-            echo '<input name="sub" type=submit value="Delete" class="button"></td></tr>',"\n";
+            echo '<input name="sub" type=submit value="Delete" class="button">',"\n";
+            echo '<input name="sub" type=submit value="Reject" class="button"></td></tr>',"\n";
             echo '</table></form>',"\n";
         } else // application
         { 
@@ -273,7 +274,7 @@
       
             // application desc
             echo '<tr valign=top><td class=color0><b>Application Description</b></td>',"\n";
-            echo '<td><p style="width:700px"><textarea  cols="80" rows="20" id="editor" name="applicationDescription">'.$oApp->sDescription.'</textarea></p></td></tr>',"\n";
+            echo '<td><p style="width:700px"><textarea  cols="80" rows="20" name="applicationDescription">'.stripslashes($oApp->sDescription).'</textarea></p></td></tr>',"\n";
 
             // version name
             echo '<tr valign=top><td class="color0"><b>Version name</b></td>',"\n";
@@ -281,7 +282,7 @@
 
             // version description
             echo '<tr valign=top><td class=color0><b>Version Description</b></td>',"\n";
-            echo '<td><p style="width:700px"><textarea  cols="80" rows="20" id="editor2" name="versionDescription">'.$oVersion->sDescription.'</textarea></p></td></tr>',"\n";
+            echo '<td><p style="width:700px"><textarea  cols="80" rows="20" id="editor" name="versionDescription">'.stripslashes($oVersion->sDescription).'</textarea></p></td></tr>',"\n";
         
         
             echo '<tr valign=top><td class="color0"><b>email Text</b></td>',"\n";
@@ -291,6 +292,7 @@
             echo '<input type="hidden" name="appId" value="'.$oApp->iAppId.'" />';
             echo '<input type=submit value=" Submit App Into Database " class=button>&nbsp',"\n";
             echo '<input name="sub" type="submit" value="Delete" class="button" />',"\n";
+            echo '<input name="sub" type="submit" value="Reject" class="button" />',"\n";
             echo '</td></tr>',"\n";
             echo '</table></form>',"\n";
         }
@@ -359,6 +361,34 @@
         {
             $oVersion = new Version($_REQUEST['versionId']);
             $oVersion->delete();
+        }
+        
+        redirect(apidb_fullurl("admin/adminAppQueue.php"));
+    }
+    else if ($_REQUEST['sub'] == 'Reject')
+    {
+        if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application
+        {
+            // get the queued versions that refers to the application entry we just removed
+            // and delete them as we implicitly added a version entry when adding a new application
+            $sQuery = "SELECT versionId FROM appVersion WHERE appVersion.appId = '".$_REQUEST['appId']."' AND appVersion.queued = 'true';";
+            $hResult = query_appdb($sQuery);
+            if($hResult)
+            {
+                while($oRow = mysql_fetch_object($hResult))
+                {
+                    $oVersion = new Version($oRow->versionId);
+                    $oVersion->reject(true);
+                }
+            }
+
+            // delete the application entry
+            $oApp = new Application($_REQUEST['appId']);
+            $oApp->reject();
+        } else if(is_numeric($_REQUEST['versionId']))  // version
+        {
+            $oVersion = new Version($_REQUEST['versionId']);
+            $oVersion->reject();
         }
         
         redirect(apidb_fullurl("admin/adminAppQueue.php"));
Index: tables/appdb_tables.sql
===================================================================
RCS file: /home/wine/appdb/tables/appdb_tables.sql,v
retrieving revision 1.22
diff -u -r1.22 appdb_tables.sql
--- tables/appdb_tables.sql	7 May 2005 03:19:55 -0000	1.22
+++ tables/appdb_tables.sql	15 Aug 2005 01:26:14 -0000
@@ -41,7 +41,7 @@
 	catId		int,
 	submitTime	timestamp(14) NOT NULL,
 	submitterId	int(11) NOT NULL default '0',
-	queued		enum('true','false') NOT NULL default 'false',
+	queued		enum('true','false','rejected') NOT NULL default 'false',
 	key(appId)
 );
 
@@ -58,7 +58,7 @@
 	maintainer_release text,
 	submitTime	timestamp(14) NOT NULL,
 	submitterId	int(11) NOT NULL default '0',
-	queued		enum('true','false') NOT NULL default 'false',
+	queued		enum('true','false','rejected') NOT NULL default 'false',
 	key(versionId)
 );
 


More information about the wine-patches mailing list