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

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Mon Jun 9 13:55:49 EDT 2008


Author: jondaley
Date: 2008-06-09 13:55:49 -0400 (Mon, 09 Jun 2008)
New Revision: 6539

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminupdateresourceaction.class.php
Log:
added stringvalidator include.  fixed another logic bug in the validator 'where there's one bug, there's bound to be two'

Modified: plog/branches/lifetype-1.2/class/action/admin/adminupdateresourceaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminupdateresourceaction.class.php	2008-06-09 17:20:12 UTC (rev 6538)
+++ plog/branches/lifetype-1.2/class/action/admin/adminupdateresourceaction.class.php	2008-06-09 17:55:49 UTC (rev 6539)
@@ -6,6 +6,7 @@
     lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
     lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
 
     /**
      * \ingroup Action
@@ -41,19 +42,21 @@
 		
 		function validate()
 		{
-            if(!parent::validate())
-                return false;
+            if(parent::validate())
+                return true;
             
-            $resources = new GalleryResources();
-            $resource = $resources->getResource( $this->_request->getValue("resourceId"), $this->_blogInfo->getId());
-            if( !$resource ) {	
-                $this->setValidationErrorView( new AdminResourcesListView( $this->_blogInfo ));
-                $this->setCommonData();
-                return false;
+                // If it didn't validate, customize the view returned
+            if($this->_form->isFieldValid("resourceId")){
+                $resources = new GalleryResources();
+                $resource = $resources->getResource( $this->_request->getValue("resourceId"), $this->_blogInfo->getId());
+                if( !$resource ) {	
+                    $this->setValidationErrorView( new AdminResourcesListView( $this->_blogInfo ));
+                    $this->setCommonData();
+                    return false;
+                }
             }
             $this->_view->setValue( "resource", $resource );
-			
-			return true;
+            return false;
 		}
 
         /**



More information about the pLog-svn mailing list