[pLog-svn] r5705 - in plog/trunk/class: action/admin view/admin view/renderer
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Sat Jul 21 06:30:20 EDT 2007
Author: oscar
Date: 2007-07-21 06:30:20 -0400 (Sat, 21 Jul 2007)
New Revision: 5705
Modified:
plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php
plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php
plog/trunk/class/action/admin/adminaddlinkaction.class.php
plog/trunk/class/action/admin/adminaddlinkcategoryaction.class.php
plog/trunk/class/action/admin/adminaddlocationajaxaction.class.php
plog/trunk/class/action/admin/adminaddpostaction.class.php
plog/trunk/class/action/admin/adminaddresourcealbumaction.class.php
plog/trunk/class/action/admin/adminblogsettingsaction.class.php
plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php
plog/trunk/class/action/admin/admineditbloguseraction.class.php
plog/trunk/class/action/admin/admineditcommentaction.class.php
plog/trunk/class/action/admin/admineditcustomfieldaction.class.php
plog/trunk/class/action/admin/admineditlinkaction.class.php
plog/trunk/class/action/admin/admineditlinkcategoriesaction.class.php
plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php
plog/trunk/class/action/admin/admineditlinksaction.class.php
plog/trunk/class/action/admin/admineditpostsaction.class.php
plog/trunk/class/action/admin/adminresourceinfoaction.class.php
plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php
plog/trunk/class/action/admin/adminupdatebloguseraction.class.php
plog/trunk/class/action/admin/adminupdatecommentaction.class.php
plog/trunk/class/action/admin/adminupdatelinkaction.class.php
plog/trunk/class/action/admin/adminupdatelinkcategoryaction.class.php
plog/trunk/class/action/admin/adminupdatelocationajaxaction.class.php
plog/trunk/class/action/admin/adminupdateusersettingsaction.class.php
plog/trunk/class/action/admin/adminusersettingsaction.class.php
plog/trunk/class/view/admin/adminlinkslistview.class.php
plog/trunk/class/view/renderer/ajaxviewrenderer.class.php
Log:
If the output of an operation via json is in the "result" field rather than in a different place for different operations, we can always refer to it via "result" and it makes it easier for programatically checking certain data.
Modified: plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -124,7 +124,7 @@
if( $category = $this->addArticleCategory()) {
$this->_view->setSuccess( true );
$this->_view->setSuccessMessage( $this->_message );
- $this->_view->setValue( "category", $category );
+ $this->_view->setResult( $category );
}
else {
$this->_view->setSuccess( true );
Modified: plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -120,8 +120,10 @@
$this->_view = new AdminAjaxView( $this->_blogInfo );
if( !$customField )
$this->_view->setErrorMessage( $this->_locale->tr("error_adding_custom_field" ));
- else
+ else {
$this->_view->setSuccessMessage( $this->_locale->pr( "custom_field_added_ok", $customField->getName()));
+ $this->_view->setResult( $customField );
+ }
return( true );
}
Modified: plog/trunk/class/action/admin/adminaddlinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddlinkaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminaddlinkaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -119,7 +119,7 @@
$this->_view = new AdminAjaxView( $this->_blogInfo );
if( $myLink = $this->addLink()) {
- $this->_view->setValue( "link", $myLink );
+ $this->_view->setResult( $myLink );
$this->_view->setSuccess( true );
}
else {
Modified: plog/trunk/class/action/admin/adminaddlinkcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddlinkcategoryaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminaddlinkcategoryaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -97,7 +97,7 @@
$this->_view->setSuccess( $result );
$this->_view->setMessage( $this->_message );
- $this->_view->setValue( "linkcategory", $this->_mylinksCategory );
+ $this->_view->setResult( $this->_mylinksCategory );
return( true );
}
Modified: plog/trunk/class/action/admin/adminaddlocationajaxaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddlocationajaxaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminaddlocationajaxaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -57,7 +57,7 @@
// everything went fine, we can send the confirmation
$this->_view->setSuccessMessage( "message", $this->_locale->tr("location_added_ok" ));
- $this->_view->setValue( "location", $loc );
+ $this->_view->setResult( $loc );
return true;
}
Modified: plog/trunk/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpostaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminaddpostaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -276,7 +276,7 @@
$message = $this->_locale->tr( "post_added_not_published" );
}
$this->_view->setSuccessMessage( $message );
- $this->_view->setValue( "article", $article );
+ $this->_view->setResult( $article );
}
else {
$this->_view->setErrorMessage( $this->_locale->tr("error_adding_post" ));
Modified: plog/trunk/class/action/admin/adminaddresourcealbumaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddresourcealbumaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminaddresourcealbumaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -106,7 +106,7 @@
$album = $this->addAlbum();
if( $album ) {
$this->_view->setSuccessMessage($this->_locale->pr( "album_added_ok", $album->getName()));
- $this->_view->setValue( "album", $album );
+ $this->_view->setResult( $album );
}
else {
$this->_view->setErrorMessage( $this->_locale->tr("error_adding_album" ));
Modified: plog/trunk/class/action/admin/adminblogsettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminblogsettingsaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminblogsettingsaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -43,7 +43,7 @@
lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
$this->_view = new AdminAjaxView( $this->_blogInfo );
$this->_view->setSuccess( true );
- $this->_view->setValue( "bloginfo", $this->_blogInfo );
+ $this->_view->setResult( $this->_blogInfo );
return( true );
}
Modified: plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -87,7 +87,7 @@
$category = $this->loadData();
if( $category ) {
$this->_view->setSuccess( true );
- $this->_view->setValue( "category", $category );
+ $this->_view->setResult( $category );
}
else {
$this->_view->setSuccess( false );
Modified: plog/trunk/class/action/admin/admineditbloguseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditbloguseraction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/admineditbloguseraction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -76,9 +76,7 @@
return( false );
}
- $this->_view->setValue( "bloguser", $userInfo );
- $this->_view->setValue( "blog", $this->_blogInfo );
- $this->_view->setValue( "permissions", $userInfo->getPermissions( $this->_blogInfo->getId()));
+ $this->_view->setResult( Array( "bloguser" => $userInfo, "blog" => $this->_blogInfo, "permissions" => $userInfo->getPermissions( $this->_blogInfo->getId())));
// include also the permission that this user has in this blog
return( true );
Modified: plog/trunk/class/action/admin/admineditcommentaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditcommentaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/admineditcommentaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -73,7 +73,7 @@
$this->_view = new AdminAjaxView( $this->_blogInfo );
if(( $comment = $this->getComment())) {
$this->_view->setSuccess( true );
- $this->_view->setValue( "comment", $comment );
+ $this->_view->setResult( $comment );
}
else {
$this->_view->setSuccess( false );
Modified: plog/trunk/class/action/admin/admineditcustomfieldaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditcustomfieldaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/admineditcustomfieldaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -78,7 +78,7 @@
$this->_view->setErrorMessage($this->_locale->tr("error_fetching_custom_field"));
else {
$this->_view->setSuccess( true );
- $this->_view->setValue( "customfield", $field );
+ $this->_view->setResult( $field );
}
return( false );
Modified: plog/trunk/class/action/admin/admineditlinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditlinkaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/admineditlinkaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -88,7 +88,7 @@
$this->_view = new AdminAjaxView( $this->_blogInfo );
if( $link ) {
$this->_view->setSuccess( true );
- $this->_view->setValue( "link", $link );
+ $this->_view->setResult( $link );
}
else {
$this->_view->setSucess( false );
Modified: plog/trunk/class/action/admin/admineditlinkcategoriesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditlinkcategoriesaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/admineditlinkcategoriesaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -53,13 +53,14 @@
lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
$this->_view = new AdminAjaxView( $this->_blogInfo );
$this->_view->setSuccess( true );
- $this->_view->setValue( "linkcategories", $blogLinkCategories );
+ $this->_view->setResult( $blogLinkCategories );
}
else {
lt_include( PLOG_CLASS_PATH."class/view/renderer/ajaxviewrenderer.class.php" );
$searchTerms = $this->_request->getValue( "searchTerms" );
$this->_view = new AjaxViewRenderer( new AdminLinkCategoriesListView( $this->_blogInfo, Array( "searchTerms" => $searchTerms )));
$this->_view->setSuccess( true );
+ $this->_view->setResultObject( "linkcategories" );
}
return( true );
Modified: plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -85,7 +85,7 @@
// otherwise show the form to edit its fields
lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
$this->_view = new AdminAjaxView( $this->_blogInfo );
- $this->_view->setValue( "linkcategory", $category );
+ $this->_view->setResult( $category );
// better to return true if everything fine
return true;
Modified: plog/trunk/class/action/admin/admineditlinksaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditlinksaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/admineditlinksaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -67,6 +67,7 @@
$linksListView->loadData();
lt_include( PLOG_CLASS_PATH."class/view/renderer/ajaxviewrenderer.class.php" );
$this->_view = new AjaxViewRenderer( $linksListView );
+ $this->_view->setResultObject( "links" );
}
}
}
Modified: plog/trunk/class/action/admin/admineditpostsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditpostsaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/admineditpostsaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -91,7 +91,8 @@
$articlesListView->loadArticles();
// and finally attempt to convert it, it should work :)
$this->_view = new AjaxViewRenderer( $articlesListView );
- $this->_view->setSuccess( true );
+ $this->_view->setSuccess( true );
+ $this->_view->setResultObject( "posts" );
return( true );
}
}
Modified: plog/trunk/class/action/admin/adminresourceinfoaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminresourceinfoaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminresourceinfoaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -81,7 +81,7 @@
$this->_view->setErrorMessage( $this->_locale->tr("error_fetching_resource"));
}
else {
- $this->_view->setValue( "resource", $resource );
+ $this->_view->setResult( $resource );
$this->_view->setSuccess( true );
}
Modified: plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -137,9 +137,8 @@
$this->_view = new AdminAjaxView( $this->_blogInfo );
$this->_view->setSuccess( $result );
if( $result ) {
-
$this->_view->setMessage( $this->_locale->pr("article_category_updated_ok", $this->_category->getName()));
- $this->_view->setValue( "category", $this->_category );
+ $this->_view->setResult( $this->_category );
}
else {
$this->_view->setMessage( $this->_locale->tr("error_updating_article_category" ));
Modified: plog/trunk/class/action/admin/adminupdatebloguseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatebloguseraction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminupdatebloguseraction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -92,7 +92,7 @@
if( !$this->updateUser())
$this->_view->setErrorMessage( $this->_message );
else {
- $this->_view->setValue( "user", $this->_user );
+ $this->_view->setResult( $this->_user );
$this->_view->setSuccessMessage( $this->_message );
}
Modified: plog/trunk/class/action/admin/adminupdatecommentaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatecommentaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminupdatecommentaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -155,7 +155,7 @@
$this->_view = new AdminAjaxView( $this->_blogInfo );
if(( $comment = $this->updateComment())) {
$this->_view->setSuccessMessage( $this->_locale->tr( "comment_updated_ok" ));
- $this->_view->setValue( "comment", $comment );
+ $this->_view->setResult( $comment );
}
else{
$this->_view->setErrorMessage( $this->_locale->tr( "error_updating_comment"));
Modified: plog/trunk/class/action/admin/adminupdatelinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatelinkaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminupdatelinkaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -116,6 +116,7 @@
if(( $link = $this->updateLink())) {
$this->_view->setSuccess( true );
$this->_view->setMessage($this->_locale->pr("link_updated_ok", $link->getName()));
+ $this->_view->setResult( $link );
}
else {
$this->_view->setSuccess( false );
Modified: plog/trunk/class/action/admin/adminupdatelinkcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatelinkcategoryaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminupdatelinkcategoryaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -98,7 +98,7 @@
$this->_view = new AdminAjaxView( $this->_blogInfo );
$this->_view->setSuccess( $this->updateLinkCategory());
$this->_view->setMessage( $this->_message );
- $this->_view->setValue( "linkcategory", $this->_linkCategory );
+ $this->_view->setResult( $this->_linkCategory );
return true;
}
}
Modified: plog/trunk/class/action/admin/adminupdatelocationajaxaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatelocationajaxaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminupdatelocationajaxaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -63,7 +63,7 @@
$this->_view = new AdminAjaxView( $this->_blogInfo, "updateLocationAjax" );
if( $res ) {
$this->_view->setSuccessMessage( $this->_locale->tr("location_updated_ok" ));
- $this->_view->setValue( "location", $loc );
+ $this->_view->setResult( $loc );
}
else {
$this->setErrorMessage( $this->_locale->tr("error_updating_location" ));
Modified: plog/trunk/class/action/admin/adminupdateusersettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateusersettingsaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminupdateusersettingsaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -124,8 +124,10 @@
$this->_view = new AdminAjaxView( $this->_blogInfo );
if( !$this->updateUser())
$this->_view->setErrorMessage( $this->_locale->tr("error_updating_user_settings"));
- else
+ else {
$this->_view->setSuccessMessage( $this->_locale->pr("user_settings_updated_ok", $this->_userInfo->getUsername()));
+ $this->_view->setResult( $this->_userInfo );
+ }
return( true );
}
Modified: plog/trunk/class/action/admin/adminusersettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminusersettingsaction.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/action/admin/adminusersettingsaction.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -37,7 +37,7 @@
{
lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
$this->_view = new AdminAjaxView( $this->_blogInfo );
- $this->_view->setValue( "user", $this->_userInfo );
+ $this->_view->setResult( $this->_userInfo );
$this->_view->setSuccess( true );
}
}
Modified: plog/trunk/class/view/admin/adminlinkslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminlinkslistview.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/view/admin/adminlinkslistview.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -20,8 +20,11 @@
* class, BlogAction with the same parameters
*/
function AdminLinksListview( $blogInfo, $params = Array())
- {
- $this->AdminTemplatedView( $blogInfo, "editlinks" );
+ {
+ if( isset( $_REQUEST["format"] ) && $_REQUEST["format"] == "table" )
+ $this->AdminTemplatedView( $blogInfo, "editlinks_table" );
+ else
+ $this->AdminTemplatedView( $blogInfo, "editlinks" );
// save the parameters and put them in a nicer place after checking them
if( !isset( $params["showOrder"] ) ) $params["showOrder"] = MYLINKS_CATEGORIES_NO_ORDER;
Modified: plog/trunk/class/view/renderer/ajaxviewrenderer.class.php
===================================================================
--- plog/trunk/class/view/renderer/ajaxviewrenderer.class.php 2007-07-21 06:39:03 UTC (rev 5704)
+++ plog/trunk/class/view/renderer/ajaxviewrenderer.class.php 2007-07-21 10:30:20 UTC (rev 5705)
@@ -5,13 +5,22 @@
class AjaxViewRenderer extends AjaxView
{
+ private $_resultObject;
+
function AjaxViewRenderer( $view )
{
$this->AjaxView();
$this->_view = $view;
+
+ $this->_resultObject = null;
}
+ function setResultObject( $resultObject )
+ {
+ $this->_resultObject = $resultObject;
+ }
+
function render()
{
// simply serialize the array with the parameters as json stream and send it to the client
@@ -69,6 +78,13 @@
foreach( $dontSerialize as $var ) {
if( isset( $data[$var] )) unset( $data[$var] );
}
+
+ if( $this->_resultObject ) {
+ if( isset( $data[$this->_resultObject] )) {
+ $this->setResult( $data[$this->_resultObject] );
+ unset( $data[$this->_resultObject] );
+ }
+ }
$this->_params->setValues( $data );
More information about the pLog-svn
mailing list