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

Jon Daley plogworld at jon.limedaley.com
Mon Jun 9 12:33:09 EDT 2008


Thanks.

On Tue, 10 Jun 2008, Mark Wu wrote:

> Maybe you can try to move them to constructor and see what happened.
>
>> -----Original Message-----
>> From: plog-svn-bounces at devel.lifetype.net
>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Jon Daley
>> Sent: Tuesday, June 10, 2008 12:14 AM
>> To: LifeType Developer List
>> Subject: Re: [pLog-svn] r6531 -
>> plog/branches/lifetype-1.2/class/action/admin
>>
>>  	Why can't the other two checks be moved to the constructor?
>>
>> On Mon, 9 Jun 2008, mark at devel.lifetype.net wrote:
>>
>>> Author: mark
>>> Date: 2008-06-09 12:10:09 -0400 (Mon, 09 Jun 2008) New
>> Revision: 6531
>>>
>>> Modified:
>>>
>>>
>> plog/branches/lifetype-1.2/class/action/admin/adminsendtrackbacksactio
>>> n.class.php
>>> Log:
>>> 1. Only the postId can move the constructor and use the
>> registerFieldValidator.
>>>
>>> 2. We should use httpurlvalidator as array emelement
>> validator to validate the postLinks and TrackbackLinks.
>>>
>>> Modified:
>>>
>> plog/branches/lifetype-1.2/class/action/admin/adminsendtrackbacksactio
>>> n.class.php
>>> ===================================================================
>>> ---
>> plog/branches/lifetype-1.2/class/action/admin/adminsendtrackba
>> cksaction.class.php	2008-06-09 15:23:20 UTC (rev 6530)
>>> +++
>> plog/branches/lifetype-1.2/class/action/admin/adminsendtrackba
>> cksaction.class.php	2008-06-09 16:10:09 UTC (rev 6531)
>>> @@ -5,6 +5,7 @@
>>>     lt_include(
>> PLOG_CLASS_PATH."class/view/admin/adminnewpostview.class.php" );
>>>     lt_include(
>> PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
>>>     lt_include(
>>> PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
>>> +    lt_include(
>>> +
>> PLOG_CLASS_PATH."class/data/validator/httpurlvalidator.class.php" );
>>>     lt_include(
>> PLOG_CLASS_PATH."class/dao/trackbackclient.class.php" );
>>>     lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
>>>
>>> @@ -30,29 +31,28 @@
>>>         {
>>>         	$this->AdminAction( $actionInfo, $request );
>>>
>>> +        	$this->registerFieldValidator( "postId", new
>>> + IntegerValidator(), false );
>>> +
>>> +			$view = new AdminPostsListView(
>> $this->_blogInfo );
>>> +			$view->setErrorMessage(
>> $this->_locale->tr("error_incorrect_article_id" ));
>>> +			$this->setValidationErrorView( $view );
>>> +
>>> 			$this->requirePermission( "add_post" );
>>>         }
>>>
>>> -            // TODO: using old methods - should be changed
>> to new, right?
>>> 		function validate()
>>> 		{
>>> +			if( !parent::validate())
>>> +				return( false );
>>> +
>>> 			// fetch the validated data
>>> +			$this->_postId =
>> $this->_request->getValue( "postId" );
>>> 			$this->_postLinks =
>> $this->_request->getValue( "postLink" );
>>> 			$this->_trackbackLinks =
>> $this->_request->getValue( "trackbackLink" );
>>> -			$this->_postId =
>> $this->_request->getValue( "postId" );
>>>
>>> -			$intval = new IntegerValidator();
>>> -			if( !$intval->validate( $this->_postId ) ) {
>>> +			$val = new ArrayValidator( new
>> HttpUrlValidator() );
>>> +			if( !$val->validate( $this->_postLinks
>> ) && !$val->validate(
>>> +$this->_trackbackLinks ) ) {
>>>                 $this->_view = new AdminPostsListView(
>> $this->_blogInfo );
>>> -                $this->_view->setErrorMessage(
>> $this->_locale->tr("error_incorrect_article_id"));
>>> -                $this->setCommonData();
>>> -
>>> -                return false;
>>> -			}
>>> -
>>> -			$arrryval = new ArrayValidator();
>>> -			if( !$arrryval->validate(
>> $this->_postLinks ) && !$arrryval->validate(
>> $this->_trackbackLinks ) ) {
>>> -                $this->_view = new AdminPostsListView(
>> $this->_blogInfo );
>>>                 $this->_view->setErrorMessage(
>> $this->_locale->tr("error_no_trackback_links_sent"));
>>>                 $this->setCommonData();
>>>
>>>
>>> _______________________________________________
>>> pLog-svn mailing list
>>> pLog-svn at devel.lifetype.net
>>> http://limedaley.com/mailman/listinfo/plog-svn
>>>
>>
>> --
>> Jon Daley
>> http://jon.limedaley.com
>> ~~
>> Subtlety is the art of saying what you think and getting out
>> of range before it is understood.
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://limedaley.com/mailman/listinfo/plog-svn
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>

-- 
Jon Daley
http://jon.limedaley.com
~~
I refuse to join any club that would have me as a member.
-- Groucho Marx


More information about the pLog-svn mailing list