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

mark at devel.lifetype.net mark at devel.lifetype.net
Sat Jun 7 22:37:11 EDT 2008


Author: mark
Date: 2008-06-07 22:37:10 -0400 (Sat, 07 Jun 2008)
New Revision: 6508

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminupdateusersettingsaction.class.php
Log:
Before fix the validator in actions:

1. We need to compare the input variables with templates input filed. For example, we don't need to validate properties here, because it never exit in templates

2. We need to make sure the input is optional or not. If the input is optional, then we should set onlyIfAvailable = true in registerFiledValidator, or it will break our current user experience. Take userSettingsPassword for example, if we don's set onlyIfAvailable to true, then user have to input password when he just only want to update the user full name.


Modified: plog/branches/lifetype-1.2/class/action/admin/adminupdateusersettingsaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminupdateusersettingsaction.class.php	2008-06-07 15:03:45 UTC (rev 6507)
+++ plog/branches/lifetype-1.2/class/action/admin/adminupdateusersettingsaction.class.php	2008-06-08 02:37:10 UTC (rev 6508)
@@ -28,13 +28,11 @@
         	$this->AdminAction( $actionInfo, $request );
 			
             $this->registerField( "confirmPassword" );
-			$this->registerFieldValidator( "userFullName" new StringValidator() );
+			$this->registerFieldValidator( "userFullName" new StringValidator(), true );
 			$this->registerFieldValidator( "userEmail", new EmailValidator());
 			$this->registerFieldValidator( "userPictureId", new IntegerValidator());
-			$this->registerField( "userAbout", new StringValidator() );
-                // TODO: what validator can be used for properties?
-			$this->registerField( "properties" );
-			$this->registerField( "userSettingsPassword" );
+			$this->registerFieldValidator( "userAbout", new StringValidator(), true );
+			$this->registerFieldValidator( "userSettingsPassword", new StringValidator(), true );
 			$view = new AdminUserProfileView( $this->_blogInfo, $this->_userInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_updating_user_settings"));
 			$this->setValidationErrorView( $view );
@@ -63,7 +61,7 @@
             	}
             	if( $this->_userPassword != $this->_userConfirmPassword ) {
 					$this->_form->setFieldValidationStatus( "confirmPassword", false );
-					$this->_view = $this->_validationErrorView;					
+					$this->_view = $this->_validationErrorView;
                 	$this->setCommonData( true );
                 	return false;
             	}
@@ -84,7 +82,6 @@
             $this->_userInfo->setAboutMyself( Textfilter::filterAllHTML($this->_request->getValue( "userAbout" )));
             $this->_userInfo->setFullName( Textfilter::filterAllHTML($this->_request->getValue( "userFullName" )));
 			$this->_userInfo->setPictureId( $this->_request->getValue( "userPictureId" ));
-			$this->_userInfo->setProperties( $this->_request->getValue( "properties" ));
 			$this->notifyEvent( EVENT_PRE_USER_UPDATE, Array( "user" => &$this->_userInfo ));			
             $this->_session->setValue( "userInfo", $this->_userInfo );
             $this->saveSession();



More information about the pLog-svn mailing list