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

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sat Jun 21 14:50:11 EDT 2008


Author: jondaley
Date: 2008-06-21 14:50:10 -0400 (Sat, 21 Jun 2008)
New Revision: 6624

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminaddcustomfieldaction.class.php
   plog/branches/lifetype-1.2/class/action/admin/adminupdatecustomfieldaction.class.php
Log:
always validate fieldValues if fieldType is CUSTOM.  don't set fieldType until it is validated

Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddcustomfieldaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddcustomfieldaction.class.php	2008-06-21 18:44:04 UTC (rev 6623)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddcustomfieldaction.class.php	2008-06-21 18:50:10 UTC (rev 6624)
@@ -34,7 +34,10 @@
 			$this->registerFieldValidator( "fieldType", new IntegerValidator());
 			$this->registerFieldValidator( "fieldSearchable", new IntegerValidator(), true );
 			$this->registerFieldValidator( "fieldHidden", new IntegerValidator(), true );
-			$this->registerFieldValidator( "fieldValues", new ArrayValidator( new StringValidator() ), true );
+            if( $this->_request->getValue( "fieldType" ) == CUSTOM_FIELD_LIST )
+            {
+                $this->registerFieldValidator( "fieldValues", new ArrayValidator( new StringValidator() ));
+            }
 			$view = new AdminTemplatedView( $this->_blogInfo, "newcustomfield" );
 			$view->setErrorMessage( $this->_locale->tr("error_adding_custom_field"));
 			$this->setValidationErrorView( $view );

Modified: plog/branches/lifetype-1.2/class/action/admin/adminupdatecustomfieldaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminupdatecustomfieldaction.class.php	2008-06-21 18:44:04 UTC (rev 6623)
+++ plog/branches/lifetype-1.2/class/action/admin/adminupdatecustomfieldaction.class.php	2008-06-21 18:50:10 UTC (rev 6624)
@@ -35,11 +35,10 @@
 			$this->registerFieldValidator( "fieldId", new IntegerValidator());
             $this->registerFieldValidator( "fieldSearchable", new IntegerValidator(), true );
 			$this->registerFieldValidator( "fieldHidden", new IntegerValidator(), true );
-			$this->_fieldType = $this->_request->getValue( "fieldType" );
-			if( $this->_fieldType == CUSTOM_FIELD_LIST )
-			{
-				$this->registerFieldValidator( "fieldValues", new ArrayValidator( new StringValidator() ), true );
-			}
+            if( $this->_request->getValue( "fieldType" ) == CUSTOM_FIELD_LIST )
+            {
+                $this->registerFieldValidator( "fieldValues", new ArrayValidator( new StringValidator() ));
+            }
 
 			$view = new AdminTemplatedView( $this->_blogInfo, "editcustomfield" );
 			$view->setErrorMessage( $this->_locale->tr("error_updating_custom_field" ));
@@ -59,6 +58,7 @@
 			$this->_fieldDescription = Textfilter::filterAllHTML($this->_request->getValue( "fieldDescription" )); 
 			$this->_fieldSearchable = ( $this->_request->getValue( "fieldSearchable" ) != "" );
 			$this->_fieldHidden = ( $this->_request->getValue( "fieldHidden" ) != "" );
+			$this->_fieldType = $this->_request->getValue( "fieldType" );
 			
 			// get and pre-process the field values
 			if( $this->_fieldType == CUSTOM_FIELD_LIST ) {



More information about the pLog-svn mailing list