Author: jfthomps
Date: Fri Oct 28 13:53:48 2011
New Revision: 1190328

URL: http://svn.apache.org/viewvc?rev=1190328&view=rev
Log:
VCL-376
mark imagerevisions deleted when user deletes image

modified submitDeleteImage - set imagerevision entries to deleted; if 
undeleting, set the production revision as undeleted and any other revision 
having the same delete time as the production revision

Modified:
    incubator/vcl/trunk/web/.ht-inc/images.php

Modified: incubator/vcl/trunk/web/.ht-inc/images.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/images.php?rev=1190328&r1=1190327&r2=1190328&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/images.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/images.php Fri Oct 28 13:53:48 2011
@@ -2655,12 +2655,27 @@ function submitDeleteImage() {
                                 . "SET deleted = 0 "
                                 . "WHERE id = $imageid";
                $qh = doQuery($query, 210);
+               $query = "UPDATE imagerevision i1, "
+                      .        "imagerevision i2 "
+                      . "SET i1.deleted = 0, "
+                      .     "i1.datedeleted = NULL "
+                      . "WHERE i1.imageid = $imageid AND "
+                      .       "i2.imageid = $imageid AND "
+                      .       "i2.production = 1 AND "
+                      .       "i1.datedeleted = i2.datedeleted";
+               $qh = doQuery($query);
        }
        else {
                $query = "UPDATE image "
                                 . "SET deleted = 1 "
                                 . "WHERE id = $imageid";
                $qh = doQuery($query, 211);
+               $query = "UPDATE imagerevision "
+                                . "SET deleted = 1, "
+                                .     "datedeleted = NOW() "
+                                . "WHERE imageid = $imageid AND "
+                                .       "deleted = 0";
+               $qh = doQuery($query);
                $query = "UPDATE computer "
                                 . "SET nextimageid = 0 "
                                 . "WHERE nextimageid = $imageid";


Reply via email to