[pLog-svn] r6053 - in plog/trunk: class/action/admin class/view/admin templates/admin

mark at devel.lifetype.net mark at devel.lifetype.net
Sun Nov 18 23:40:53 EST 2007


Author: mark
Date: 2007-11-18 23:40:53 -0500 (Sun, 18 Nov 2007)
New Revision: 6053

Modified:
   plog/trunk/class/action/admin/adminaddbloguseraction.class.php
   plog/trunk/class/action/admin/admineditfriendgroupsaction.class.php
   plog/trunk/class/action/admin/adminnewbloguseraction.class.php
   plog/trunk/class/action/admin/adminshowblogusersaction.class.php
   plog/trunk/class/view/admin/adminbloguserslistview.class.php
   plog/trunk/templates/admin/blogusers.template
   plog/trunk/templates/admin/blogusers_table.template
Log:
Fixed the ajax view of showBlogUsersList

Modified: plog/trunk/class/action/admin/adminaddbloguseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddbloguseraction.class.php	2007-11-17 16:32:06 UTC (rev 6052)
+++ plog/trunk/class/action/admin/adminaddbloguseraction.class.php	2007-11-19 04:40:53 UTC (rev 6053)
@@ -1,21 +1,11 @@
 <?php
-
-	
-    
-    
-    
-    
-    
-    
-    
-
     /**
      * \ingroup Action
      * @private
      *
      * Adds a user to the blog
      */
-    class AdminAddBlogUserAction extends AdminAction 
+    class AdminAddBlogUserAction extends AdminAction
 	{
 
     	var $_sendNotification;
@@ -25,16 +15,16 @@
     	function AdminAddBlogUserAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
-			
+
 			// data validation
-			$this->registerFieldValidator( "userName", new StringValidator(), false, $this->_locale->tr("error_invalid_user"));			
-			$this->_sendNotification = ($this->_request->getValue( "sendNotification" ) != "" );			
+			$this->registerFieldValidator( "userName", new StringValidator(), false, $this->_locale->tr("error_invalid_user"));
+			$this->_sendNotification = ($this->_request->getValue( "sendNotification" ) != "" );
 			$this->registerField( "sendNotification" );
 			$this->registerField( "perm" );
 			$view = new AdminNewBlogUserView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_adding_user"));
 			$this->setValidationErrorView( $view );
-			
+
 			$this->requirePermission( "add_blog_user" );
         }
 
@@ -60,8 +50,8 @@
 		function addBlogUser()
 		{
         	$this->_newUsername = $this->_request->getFilteredValue( "userName", new HtmlFilter());
-			$this->_perms = $this->_request->getValue( "perm" );			
-			
+			$this->_perms = $this->_request->getValue( "perm" );
+
         	// see if the user exists
             $users = new Users();
             $userInfo = $users->getUserInfoFromUsername( $this->_newUsername );
@@ -70,8 +60,8 @@
 				$this->_form->setFieldValidationStatus( "userName", false );
                 return false;
             }
-			$this->notifyEvent( EVENT_USER_LOADED, Array( "user" => &$userInfo ));			
-			
+			$this->notifyEvent( EVENT_USER_LOADED, Array( "user" => &$userInfo ));
+
             // get the permissions that this user will be granted
 			$this->notifyEvent( EVENT_PRE_USER_UPDATE, Array( "user" => &$userInfo ));
             $userPerms = new UserPermissions();
@@ -81,12 +71,12 @@
 	                $res = $userPerms->grantPermission( $perm );
 				}
 			}
-			
+
 			if( !$res ) {
 				$this->_message = $this->_locale->pr("error_adding_user", $userInfo->getUsername());
 				return( false );
 			}
-			$this->notifyEvent( EVENT_POST_USER_UPDATE, Array( "user" => &$userInfo ));			
+			$this->notifyEvent( EVENT_POST_USER_UPDATE, Array( "user" => &$userInfo ));
 
             // send a notification if enabled
             if( $this->_sendNotification ) {
@@ -114,7 +104,7 @@
 			else {
 				$this->_view = new AdminNewBlogUserView( $this->_blogInfo );
 			}
-				
+
             $this->_view->setSuccessMessage( $this->_message );
             $this->setCommonData();
 

Modified: plog/trunk/class/action/admin/admineditfriendgroupsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditfriendgroupsaction.class.php	2007-11-17 16:32:06 UTC (rev 6052)
+++ plog/trunk/class/action/admin/admineditfriendgroupsaction.class.php	2007-11-19 04:40:53 UTC (rev 6053)
@@ -44,13 +44,13 @@
 		            $friendGroups = new FriendGroups();
 		            $myFriendGroups = $friendGroups->getFriendGroups( $this->_userInfo->getId() );
 					// pass it to the view
-					
+
 					$this->_view = new AdminAjaxView( $this->_blogInfo );
 					$this->_view->setSuccess( true );
-					$this->_view->setResult( $myFriendGroups );															
+					$this->_view->setResult( $myFriendGroups );
 				}
 				else {
-					$searchTerms = $this->_request->getValue( "searchTerms" );				
+					$searchTerms = $this->_request->getValue( "searchTerms" );
 					$this->_view = new AjaxViewRenderer( new AdminFriendGroupsListView( $this->_blogInfo, Array( "searchTerms" => $searchTerms )));
 					$this->_view->setSuccess( true );
 					$this->_view->setResultObject( "friendgroups" );
@@ -59,7 +59,7 @@
 			else {
 				return( $this->perform());
 			}
-			
+
 			return( true );
 		}
     }

Modified: plog/trunk/class/action/admin/adminnewbloguseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewbloguseraction.class.php	2007-11-17 16:32:06 UTC (rev 6052)
+++ plog/trunk/class/action/admin/adminnewbloguseraction.class.php	2007-11-19 04:40:53 UTC (rev 6053)
@@ -1,15 +1,11 @@
 <?php
-
-	
-    
-
     /**
      * \ingroup Action
      * @private
      *
      * Shows a form to add a user to the blog
      */
-    class AdminNewBlogUserAction extends AdminAction 
+    class AdminNewBlogUserAction extends AdminAction
     {
 
     	function AdminNewBlogUserAction( $actionInfo, $request )
@@ -26,5 +22,10 @@
 
             return true;
         }
+
+        function performAjax()
+        {
+        	return( $this->perform() );
+        }
     }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/adminshowblogusersaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminshowblogusersaction.class.php	2007-11-17 16:32:06 UTC (rev 6052)
+++ plog/trunk/class/action/admin/adminshowblogusersaction.class.php	2007-11-19 04:40:53 UTC (rev 6053)
@@ -1,15 +1,15 @@
 <?php
 
-	
-	
 
+
+
     /**
      * \ingroup Action
      * @private
      *
      * Shows the list of users that belong to this blog
      */
-    class AdminShowBlogUsersAction extends AdminAction 
+    class AdminShowBlogUsersAction extends AdminAction
 	{
 
     	function AdminShowBlogUsersAction( $actionInfo, $request )
@@ -29,15 +29,26 @@
         }
 
 		function performAjax()
-		{			
-			
-			
-			$view = new AdminBlogUsersListView( $this->_blogInfo );
-			$view->loadData();
-			$this->_view = new AjaxViewRenderer( $view );
-			
-			$this->_view->setSuccess( true );
-			$this->_view->setResultObject( "blogusers" );						
+		{
+			if( $this->_request->getOutput() == Request::REQUEST_OUTPUT_JSON ) {
+				if( $this->_request->loadAllData()) {
+		            $users = new Users();
+                    $blogUsers = $users->getBlogUsers( $this->_blogInfo->getId(), false );
+					$this->_view = new AdminAjaxView( $this->_blogInfo );
+					$this->_view->setSuccess( true );
+					$this->_view->setResult( $blogUsers );
+				}
+				else {
+                    $view = new AdminBlogUsersListView( $this->_blogInfo );
+                    $view->loadData();
+					$this->_view = new AjaxViewRenderer( $view );
+					$this->_view->setSuccess( true );
+					$this->_view->setResultObject( "blogusers" );
+				}
+			}
+			else {
+				return( $this->perform());
+			}
 		}
     }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/view/admin/adminbloguserslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminbloguserslistview.class.php	2007-11-17 16:32:06 UTC (rev 6052)
+++ plog/trunk/class/view/admin/adminbloguserslistview.class.php	2007-11-19 04:40:53 UTC (rev 6053)
@@ -1,33 +1,33 @@
 <?php
 
-	
-    
-	
+
+
+
     /**
      * \ingroup View
      * @private
-     *	
+     *
 	 * shows a list with the users in the blog
 	 */
 	class AdminBlogUsersListView extends AdminTemplatedView
 	{
-	
+
 		function AdminBlogUsersListView( $blogInfo )
 		{
-			if( Request::isXHR())			
+			if( Request::isXHR())
 				$this->AdminTemplatedView( $blogInfo, "blogusers_table" );
 			else
-				$this->AdminTemplatedView( $blogInfo, "blogusers" );			
+				$this->AdminTemplatedView( $blogInfo, "blogusers" );
 		}
-		
+
 		function loadData()
 		{
         	// get the users of the blog
             $users = new Users();
             $blogUsers = $users->getBlogUsers( $this->_blogInfo->getId(), false );
-            $this->setValue( "blogusers", $blogUsers );			
+            $this->setValue( "blogusers", $blogUsers );
 		}
-		
+
 		function render()
 		{
 			$this->loadData();
@@ -35,5 +35,5 @@
 			parent::render();
 		}
 	}
-	
+
 ?>
\ No newline at end of file

Modified: plog/trunk/templates/admin/blogusers.template
===================================================================
--- plog/trunk/templates/admin/blogusers.template	2007-11-17 16:32:06 UTC (rev 6052)
+++ plog/trunk/templates/admin/blogusers.template	2007-11-19 04:40:53 UTC (rev 6053)
@@ -2,22 +2,22 @@
 {include file="$admintemplatepath/navigation.template" showOpt=showBlogUsers title=$locale->tr("showBlogUsers")}
 {js src="js/ui/pages/blogusers.js"}
 <div class="extraFunctions">
-<div class="left">		
+<div class="left">
   <a id="newBlogUsersButton" href="?op=newBlogUser" rel="overlay">{$locale->tr("newBlogUser")}</a>
 </div>
 <br style="clear:both" />
 </div>
 <form id="blogUsers" action="admin.php" method="post" onSubmit="Lifetype.Forms.performRequest(this);return(false);">
-{include file="$admintemplatepath/viewvalidateajax.template"}	
+{include file="$admintemplatepath/viewvalidateajax.template"}
 <div id="list">
   {include file="$admintemplatepath/blogusers_table.template"}
-        </div>
-        <div id="list_action_bar">
-			{check_perms perm=update_blog_users}
-            <input type="submit" name="delete" value="{$locale->tr("revoke_permissions")}" class="submit" />
-            <input type="hidden" name="op" value="deleteBlogUsersPermissions" />
-			{/check_perms}
-        </div>
+</div>
+<div id="list_action_bar">
+  {check_perms perm=update_blog_users}
+    <input type="submit" name="delete" value="{$locale->tr("revoke_permissions")}" class="submit" />
+    <input type="hidden" name="op" value="deleteBlogUsersPermissions" />
+  {/check_perms}
+</div>
 	</form>
 {include file="$admintemplatepath/footernavigation.template"}
 {include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Modified: plog/trunk/templates/admin/blogusers_table.template
===================================================================
--- plog/trunk/templates/admin/blogusers_table.template	2007-11-17 16:32:06 UTC (rev 6052)
+++ plog/trunk/templates/admin/blogusers_table.template	2007-11-19 04:40:53 UTC (rev 6053)
@@ -3,7 +3,7 @@
         <tr>
             <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('blogUsers');" /></th>
             <th style="width:20%;">{$locale->tr("username")}</th>
-            <th style="width:40%;">{$locale->tr("full_name")}</th>                        
+            <th style="width:40%;">{$locale->tr("full_name")}</th>
             <th style="width:30%;">{$locale->tr("email")}</th>
             <th style="width:10%;">{$locale->tr("actions")}</th>
         </tr>
@@ -21,7 +21,7 @@
             </td>
             <td>
                 {$bloguser->getFullName()}
-            </td>                        
+            </td>
             <td>
                 <a href="mailto:{$bloguser->getEmail()}">
                 {$bloguser->getEmail()}



More information about the pLog-svn mailing list