[pLog-svn] r5291 - in plog/branches/lifetype-1.2:class/action/admin js/ui

Oscar Renalias oscar at renalias.net
Mon Apr 9 00:18:46 EDT 2007


The beginnings of this Ajax stuff are already in place in LT 1.3. I  
don't see any reason to backport it to 1.2, since we have no plans to  
include any more stuff via Ajax. Have a look at it in the trunk, I've  
also moved all communication to JSON , btw.

On 8 Apr 2007, at 22:24, Mark Wu wrote:

> Hi Oscar:
>
> After implement "check name" and "add article category" way, I  
> think we may
> need a new kind of action/view to take care of ajax stuff.
>
> And we also need some helper function in template to help deal with  
> those
> ajax call.
>
> For action, I think no big chage, only need to adapt the new user  
> permission
> framework.
>
> For view, we may consider return XML or JSON message. And, the ajax  
> view
> will take care all key/values, we don't need to worry about how to  
> organize
> them in xmlview.
>
> Any ideas?
>
> Mark
>
>> -----Original Message-----
>> From: plog-svn-bounces at devel.lifetype.net
>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of
>> mark at devel.lifetype.net
>> Sent: Monday, April 09, 2007 3:16 AM
>> To: plog-svn at devel.lifetype.net
>> Subject: [pLog-svn] r5291 - in
>> plog/branches/lifetype-1.2:class/action/admin js/ui
>>
>> Author: mark
>> Date: 2007-04-08 15:16:23 -0400 (Sun, 08 Apr 2007) New Revision: 5291
>>
>> Modified:
>>
>> plog/branches/lifetype-1.2/class/action/admin/adminaddarticlec
>> ategoryajaxaction.class.php
>>    plog/branches/lifetype-1.2/js/ui/plogui.js
>> Log:
>> Fix bug list  here:http://bugs.lifetype.net/view.php?id=1269
>>
>> The addArticleCategoryAjax does not follow the user permission.
>>
>> Modified:
>> plog/branches/lifetype-1.2/class/action/admin/adminaddarticlec
>> ategoryajaxaction.class.php
>> ===================================================================
>> ---
>> plog/branches/lifetype-1.2/class/action/admin/adminaddarticlec
>> ategoryajaxaction.class.php	2007-04-08 19:10:40 UTC (rev 5290)
>> +++
>> plog/branches/lifetype-1.2/class/action/admin/adminaddarticlec
>> ategoryajaxaction.class.php	2007-04-08 19:16:23 UTC (rev 5291)
>> @@ -27,23 +27,33 @@
>>          {
>>          	$this->AdminAction( $actionInfo, $request );
>>          }
>> +
>>          function validate()
>>          {
>> -			// fetch the data, we already know it's
>> valid and that we can trust it!
>> +			// check if the user has the
>> add_category permission
>> +            if( !$this->userHasPermission( "add_category" ) ) {
>> +	            $this->_view = new AdminXmlView(
>> $this->_blogInfo, "response" );				
>> +	            $this->_view->setValue( "method",
>> "addCategoryAjax" );
>> +            	$this->_view->setValue( "success", "0" );
>> +            	$this->_view->setValue( "message",
>> $this->_locale->tr("error_permission_required") );    	
>>
>> +                return false;
>> +            }
>> +
>> +            // check if category name is empty
>>          	$this->_categoryName     =
>> Textfilter::filterAllHTML($this->_request->getValue(
>> "categoryName" ));
>>              $this->_categoryUrl      = "";
>>              $this->_categoryInMainPage = 1;
>>  			$this->_categoryDescription =
>> $this->_categoryName;
>> -			$this->_properties = "";	
>> +			$this->_properties = "";	
>>
>> -            // check if there's any file to upload
>>              if( empty($this->_categoryName) ||
>> $this->_categoryName == "" ) {
>>  	            $this->_view = new AdminXmlView(
>> $this->_blogInfo, "response" );				
>>  	            $this->_view->setValue( "method",
>> "addCategoryAjax" );
>>              	$this->_view->setValue( "success", "0" );
>>              	$this->_view->setValue( "message",
>> $this->_locale->tr("error_adding_article_category") );    	
>>
>>                  return false;
>> -            }
>> +            }
>> +
>>              return true;
>>          }
>>
>>
>> Modified: plog/branches/lifetype-1.2/js/ui/plogui.js
>> ===================================================================
>> --- plog/branches/lifetype-1.2/js/ui/plogui.js	
>> 2007-04-08 19:10:40 UTC (rev 5290)
>> +++ plog/branches/lifetype-1.2/js/ui/plogui.js	
>> 2007-04-08 19:16:23 UTC (rev 5291)
>> @@ -82,8 +82,10 @@
>>  	var xmldoc = originalRequest.responseXML;
>>  	var success =
>> xmldoc.getElementsByTagName('success')[0].firstChild.nodeValue;
>>  	var message =
>> xmldoc.getElementsByTagName('message')[0].firstChild.nodeValue;
>> -	if (!success) {
>> +	if (success=='0') {
>>  		window.alert(message);
>> +		$( 'newArticleCategory' ).value = '';
>> +		$( 'addArticleCategory' ).disabled = 0;
>>  	}
>>  	else
>>  	{
>>
>> _______________________________________________
>> 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
>



More information about the pLog-svn mailing list