[pLog-svn] r6254 - plog/branches/lifetype-1.2/class/action/admin

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri Mar 21 14:46:50 EDT 2008


Author: jondaley
Date: 2008-03-21 14:46:50 -0400 (Fri, 21 Mar 2008)
New Revision: 6254

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php
Log:
show message properly when regenerating, and stay on page during errors, so you can try again, or something

Modified: plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php	2008-03-21 18:45:08 UTC (rev 6253)
+++ plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php	2008-03-21 18:46:50 UTC (rev 6254)
@@ -25,7 +25,16 @@
         $view->setErrorMessage( $this->_locale->tr("error_loading_resource"));
         $this->setValidationErrorView( $view );
     }
-        
+
+    function setCommonData($resource=null){
+        if($resource){
+            $this->_view->setValue( "resourceDescription", $resource->getDescription());
+            $this->_view->setValue( "albumId", $resource->getAlbumId());
+            $this->_view->setValue( "resource", $resource );
+        }
+        parent::setCommonData();
+    }
+    
 	function perform(){
             // first of all, fetch the resource
         $this->_resourceId = $this->_request->getValue( "resourceId" );
@@ -43,18 +52,18 @@
             // if so, continue... first by checking if the resource is an image or not
             // because if not, then there is no point in generating a thumbnail of it!
         if( !$resource->isImage()) {
-            $this->_view = new AdminResourcesListView( $this->_blogInfo );
+            $this->_view = new AdminEditResourceView( $this->_blogInfo );
             $this->_view->setErrorMessage( $this->_locale->tr("error_resource_is_not_an_image" ));
-            $this->setCommonData();
+            $this->setCommonData($resource);
             return false;
         }
 
             // Get a helper to read the metadata
         $reader = $resource->getMetadataReader();
         if(!$reader){
-            $this->_view = new AdminResourcesListView( $this->_blogInfo );
+            $this->_view = new AdminEditResourceView( $this->_blogInfo );
             $this->_view->setErrorMessage( $this->_locale->tr("error_updating_resource" ));
-            $this->setCommonData();
+            $this->setCommonData($resource);
             return false;
         }
 
@@ -78,9 +87,9 @@
             GalleryResourceStorage::getUserFolder($resource->getOwnerId()).$resource->getFileName(),
             $resource->getId(), $resource->getOwnerId(), $thumbHeight, $thumbWidth );
         if( !$result ) {
-            $this->_view = new AdminResourcesListView( $this->_blogInfo );
-            $this->_view->setErrorMessage( $this->_locale->tr("error_updatin_resource" ));
-            $this->setCommonData();
+            $this->_view = new AdminEditResourceView( $this->_blogInfo );
+            $this->_view->setErrorMessage( $this->_locale->tr("error_updating_resource" ));
+            $this->setCommonData($resource);
             return false;
         }
 
@@ -96,17 +105,14 @@
             $resource->getId(), $resource->getOwnerId(), $thumbHeight, $thumbWidth );
         
         if( !$result ) {
-            $this->_view = new AdminResourcesListView( $this->_blogInfo );
+            $this->_view = new AdminEditResourceView( $this->_blogInfo );
             $this->_view->setErrorMessage( $this->_locale->tr("error_updating_resource" ));
         }
         else {
             $this->_view = new AdminEditResourceView( $this->_blogInfo );
             $this->_view->setSuccessMessage( $message = $this->_locale->tr("resource_preview_generated_ok" ));
-            $this->_view->setValue( "resourceDescription", $resource->getDescription());
-            $this->_view->setValue( "albumId", $resource->getAlbumId());
-            $this->_view->setValue( "resource", $resource );
         }
-        $this->setCommonData();
+        $this->setCommonData($resource);
             
         return true;
     }



More information about the pLog-svn mailing list