[pLog-svn] r6577 - plog/branches/lifetype-1.2/class/action/admin
mark at devel.lifetype.net
mark at devel.lifetype.net
Thu Jun 19 01:54:17 EDT 2008
Author: mark
Date: 2008-06-19 01:54:17 -0400 (Thu, 19 Jun 2008)
New Revision: 6577
Modified:
plog/branches/lifetype-1.2/class/action/admin/admineditpostsaction.class.php
Log:
We can use this way, too.
Modified: plog/branches/lifetype-1.2/class/action/admin/admineditpostsaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/admineditpostsaction.class.php 2008-06-19 05:34:35 UTC (rev 6576)
+++ plog/branches/lifetype-1.2/class/action/admin/admineditpostsaction.class.php 2008-06-19 05:54:17 UTC (rev 6577)
@@ -2,7 +2,8 @@
lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
lt_include( PLOG_CLASS_PATH."class/view/admin/adminpostslistview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );
/**
@@ -20,36 +21,24 @@
function AdminEditPostsAction( $actionInfo, $request )
{
$this->AdminAction( $actionInfo, $request );
-
+
+ // field validation
+ $this->registerFieldValidator( "showCategory", new IntegerValidator( true ), true );
+ $this->registerFieldValidator( "showStatus", new IntegerValidator( true ), true );
+ $this->registerFieldValidator( "showUser", new IntegerValidator(), true );
+ $this->registerFieldValidator( "showMonth", new IntegerValidator( true ), true );
+ $this->registerFieldValidator( "searchTerms", new StringValidator(), true );
+ $this->setValidationErrorView( new AdminPostsListView( $this->_blogInfo,
+ Array( "showCategory" => -1,
+ "showStatus" => -1,
+ "showUser" => 0,
+ "showMonth" => -1,
+ "searchTerms" => "" )
+ ) );
+
$this->requirePermission( "view_posts" );
}
- /**
- * We're going to do some manual validation here because we want to capture the
- * validation problem but instead of showing an error, we're just going to fix
- * here (by resetting the value) and continue with the show as if nothing
- * had happened.
- */
- function validate()
- {
- $intVal = new IntegerValidator( true );
- $uIntVal = new IntegerValidator();
-
- if( !$intVal->validate( $this->_request->getValue( "showCategory" )))
- $this->_request->setValue( "showCategory", -1 );
-
- if( !$intVal->validate( $this->_request->getValue( "showStatus" )))
- $this->_request->setValue( "showStatus", -1 );
-
- if( !$uIntVal->validate( $this->_request->getValue( "showUser" )))
- $this->_request->setValue( "showUser", 0 );
-
- if( !$intVal->validate( $this->_request->getValue( "showMonth" )))
- $this->_request->setValue( "showMonth", -1 );
-
- return( true );
- }
-
/**
* Carries out the specified action
*/
More information about the pLog-svn
mailing list