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

mark at devel.lifetype.net mark at devel.lifetype.net
Fri Jun 20 14:22:58 EDT 2008


Author: mark
Date: 2008-06-20 14:22:57 -0400 (Fri, 20 Jun 2008)
New Revision: 6601

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminaddpermissionaction.class.php
Log:
Add integer validator for corePermission and adminOnlyPermission.

Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddpermissionaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddpermissionaction.class.php	2008-06-20 18:19:01 UTC (rev 6600)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddpermissionaction.class.php	2008-06-20 18:22:57 UTC (rev 6601)
@@ -3,7 +3,8 @@
 	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/view/admin/adminpermissionslistview.class.php" );	
-	lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );	
+	lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );		
 	lt_include( PLOG_CLASS_PATH."class/dao/permissions.class.php" );	
 
     /**
@@ -21,8 +22,8 @@
 			// register two validators
 			$this->registerFieldValidator( "permissionName", new StringValidator());
 			$this->registerFieldValidator( "permissionDescription", new StringValidator());
-			$this->registerField( "corePermission" );
-			$this->registerField( "adminOnlyPermission" );			
+			$this->registerFieldValidator( "corePermission", new IntegerValidator(), true );
+			$this->registerFieldValidator( "adminOnlyPermission", new IntegerValidator(), true );			
 			// and the view we should show in case there is a validation error
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "newpermission" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_adding_permission" ));			
@@ -41,7 +42,7 @@
 			if( $this->_request->getValue( "corePermission" ) == 1 )
 				$perm->setCorePermission( true );
 			if( $this->_request->getValue( "adminOnlyPermission" ) == 1 )
-					$perm->setAdminOnlyPermission( true );
+				$perm->setAdminOnlyPermission( true );
 			
 			$perms = new Permissions();
 			$this->notifyEvent( EVENT_PRE_PERMISSION_ADD, Array( "permission" => &$perm ));			



More information about the pLog-svn mailing list