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

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sat Jun 21 15:55:01 EDT 2008


Author: jondaley
Date: 2008-06-21 15:55:01 -0400 (Sat, 21 Jun 2008)
New Revision: 6636

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminupdateglobalsettingsaction.class.php
Log:
set an error view since we now validate stuff (barely)

Modified: plog/branches/lifetype-1.2/class/action/admin/adminupdateglobalsettingsaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminupdateglobalsettingsaction.class.php	2008-06-21 19:40:17 UTC (rev 6635)
+++ plog/branches/lifetype-1.2/class/action/admin/adminupdateglobalsettingsaction.class.php	2008-06-21 19:55:01 UTC (rev 6636)
@@ -28,14 +28,34 @@
                 // TODO: how do we validate the data inside the array?
 			$this->registerFieldValidator( "config", new ArrayValidator() );
 
-                // TODO: need an error view here
+            $view = new AdminGlobalSettingsListView( $this->_blogInfo,  "");
+            $view->setErrorMessage( $this->_locale->tr("error_saving_site_config"));
+            $this->setValidationErrorView( $view );
         }
 
         function validate()
         {
-            if(!parent::validate())
+            $valid = parent::validate();
+
+            if($this->_form->isFieldValid("show")){
+                    // 'show' has now been validated,
+                    // so we can set our error view to a better page
+                $view = new AdminGlobalSettingsListView( $this->_blogInfo,
+                                                         $this->_request->getValue("show"));
+                $view->setErrorMessage( $this->_locale->tr("error_saving_site_config"));
+                $this->setValidationErrorView( $view );
+            }
+
+            if(!$valid){
+                    // since we switched the view, we need to run the error setting again
+                $this->validationErrorProcessing();
                 return false;
-            
+            }
+
+            $view = new AdminGlobalSettingsListView( $this->_blogInfo, "" );
+            $view->setErrorMessage( $this->_locale->tr("error_saving_site_config"));
+        	$this->setValidationErrorView( $view );
+
 	    	// all the seettings come from a very nice array from the html form
             $this->_newConfigOpts = Array();
             $this->_newConfigOpts = $this->_request->getValue( "config" );
@@ -89,9 +109,9 @@
 
         function perform()
         {
-        	// get the global setting section
-        	$show = $this->_request->getValue( "show" );
-        	
+                // get the global setting section
+            $show = $this->_request->getValue( "show" );
+            
         	// we can proceed to update the config
             foreach( $this->_newConfigOpts as $key => $value ) {
             	$this->_config->setValue( $key, $value );



More information about the pLog-svn mailing list