[pLog-svn] r5788 - in plog/trunk: class/action/admin class/view/admin js/ui js/ui/pages templates/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sat Aug 4 16:26:30 EDT 2007


Author: oscar
Date: 2007-08-04 16:26:30 -0400 (Sat, 04 Aug 2007)
New Revision: 5788

Added:
   plog/trunk/js/ui/pages/users.js
   plog/trunk/templates/admin/siteusers_table.template
Modified:
   plog/trunk/class/action/admin/adminadduseraction.class.php
   plog/trunk/class/action/admin/adminchangeuserstatusaction.class.php
   plog/trunk/class/action/admin/admindeleteusersaction.class.php
   plog/trunk/class/action/admin/adminupdateuserprofileaction.class.php
   plog/trunk/class/view/admin/adminsiteuserslistview.class.php
   plog/trunk/js/ui/plogui.js
   plog/trunk/templates/admin/createuser.template
   plog/trunk/templates/admin/siteusers.template
   plog/trunk/templates/admin/userprofile.template
Log:
Totally ajaxified the "Users" page.


Modified: plog/trunk/class/action/admin/adminadduseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminadduseraction.class.php	2007-08-04 13:32:56 UTC (rev 5787)
+++ plog/trunk/class/action/admin/adminadduseraction.class.php	2007-08-04 20:26:30 UTC (rev 5788)
@@ -13,6 +13,7 @@
 	lt_include( PLOG_CLASS_PATH."class/dao/privatemessageboxes.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/view/admin/adminadduserview.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/view/admin/adminsiteuserslistview.class.php" );	
+	lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );		
 
     /**
      * \ingroup Action
@@ -37,12 +38,12 @@
         	$this->AdminAction( $actionInfo, $request );
         	
         	// for data validation purposes
-        	$this->registerFieldValidator( "userName", new UsernameValidator());
-        	$this->registerFieldValidator( "newUserPassword", new PasswordValidator());
-        	$this->registerFieldValidator( "userEmail", new EmailValidator());
-			$this->registerFieldValidator( "userStatus", new IntegerValidator());
+        	$this->registerFieldValidator( "userName", new UsernameValidator(), false, $this->_locale->tr("error_incorrect_username"));
+        	$this->registerFieldValidator( "newUserPassword", new PasswordValidator(), false, $this->_locale->tr("error_invalid_password"));
+        	$this->registerFieldValidator( "userEmail", new EmailValidator(), false, $this->_locale->tr("error_incorrect_email_address"));
+			$this->registerFieldValidator( "userStatus", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value" ));
         	$this->registerField( "userFullName" );
-        	$this->registerFieldValidator( "blogId", new IntegerValidator(), true );
+        	$this->registerFieldValidator( "blogId", new IntegerValidator(), true, $this->_locale->tr("error_incorrect_blog_id"));
 			$this->registerField( "blogName" );
 			$this->registerField( "userPermissions" );
         	$view = new AdminAddUserView( $this->_blogInfo );
@@ -52,25 +53,25 @@
 			$this->requireAdminPermission( "add_user" );
         }
 
-        function perform()
-        {
+		private function addUser()
+		{
 	        // fetch the validated data
-        	$this->_userName = Textfilter::filterAllHTML($this->_request->getValue( "userName" ));
+        	$this->_userName = $this->_request->getFilteredValue( "userName", new HtmlFilter());
             $this->_userPassword = $this->_request->getValue( "newUserPassword" );
-            $this->_userEmail = Textfilter::filterAllHTML($this->_request->getValue( "userEmail" ));
-            $this->_userFullName = Textfilter::filterAllHTML($this->_request->getValue( "userFullName" ));
+            $this->_userEmail = $this->_request->getFilteredValue( "userEmail", new HtmlFilter());
+            $this->_userFullName = $this->_request->getFilteredValue( "userFullName", new HtmlFilter());
 			$this->_userStatus = $this->_request->getValue( "userStatus" );
 			$this->_userBlog = $this->_request->getValue( "blogId" );
 			$this->_permissions = $this->_request->getValue( "userPermissions" );
 	        
         	// now that we have validated the data, we can proceed to create the user, making
-            // sure that it doesn't already exists
+            // sure that it doesn't already exist
             $users = new Users();
             $userInfo = $users->getUserInfoFromUsername( $this->_userName );
             if( $userInfo ) {
-                $this->_form->setFieldValidationStatus( "userName", false );            	
-                $this->_view = new AdminAddUserView( $this->_blogInfo );
-                $this->setCommonData( true );
+                $this->_form->setFieldValidationStatus( "userName", false );
+                //$this->_view = new AdminAddUserView( $this->_blogInfo );
+                //$this->setCommonData( true );
                 return false;
             }
 
@@ -87,9 +88,9 @@
 			$newUserId = $users->addUser( $user );
 			
             if( !$newUserId ) {
-                $this->_view = new AdminAddUserView( $this->_blogInfo );
+                /*$this->_view = new AdminAddUserView( $this->_blogInfo );
                 $this->_form->setFieldValidationStatus( "userName", false );
-                $this->setCommonData( true );
+                $this->setCommonData( true );*/
                 return false;
             }
 
@@ -126,17 +127,43 @@
 				$result = $userPerms->grantPermission( $perm );
 			}
 			
-			$this->notifyEvent( EVENT_POST_USER_ADD, Array( "user" => &$user ));
+			$this->notifyEvent( EVENT_POST_USER_ADD, Array( "user" => &$user ));			
+			
+			return( $user );
+		}
 
+        function perform()
+        {
 			if( !$this->userHasPermission( "view_users", 0 ))
             	$this->_view = new AdminAddUserView( $this->_blogInfo );
 			else
-				$this->_view = new AdminSiteUsersListView( $this->_blogInfo );
-
-            $this->_view->setSuccessMessage( $this->_locale->pr("user_added_ok", $user->getUsername()));
+				$this->_view = new AdminSiteUsersListView( $this->_blogInfo );	
+	
+			$result = $this->addUser();
+			if( $result )
+            	$this->_view->setSuccessMessage( $this->_locale->pr("user_added_ok", $user->getUsername()));
+			else
+				$this->_view->setErrorMessage( $this->_locale->tr("error_adding_user" ));
+			
             $this->setCommonData();
 
             return true;
         }
+
+		function performAjax()
+		{
+			lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
+			$result = $this->addUser();
+			
+			$this->_view = new AdminAjaxView( $this->_blogInfo );
+			if( $result ) {
+            	$this->_view->setSuccessMessage( $this->_locale->pr("user_added_ok", $result->getUsername()));
+				$this->_view->setResult( $result );
+			}
+			else
+				$this->_view->setErrorMessage( $this->_locale->tr("error_adding_user" ));
+				
+			return( true );
+		}
     }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/adminchangeuserstatusaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminchangeuserstatusaction.class.php	2007-08-04 13:32:56 UTC (rev 5787)
+++ plog/trunk/class/action/admin/adminchangeuserstatusaction.class.php	2007-08-04 20:26:30 UTC (rev 5788)
@@ -46,6 +46,9 @@
 			$successMessage = "";
 			$totalOk = 0;
 			
+			$this->_userIds = $this->_request->getValue( "userIds" );
+			$this->_userStatus = $this->_request->getValue( "userStatus" );			
+			
             foreach( $this->_userIds as $userId ) {
             	// get the post
                 $user = $users->getUserInfoFromId( $userId );
@@ -76,25 +79,33 @@
 				}
             }
 			
-			$this->_view = new AdminSiteUsersListView( $this->_blogInfo );
-			if( $errorMessage != "" ) 
-				$this->_view->setErrorMessage( $errorMessage );
-			if( $successMessage != "" )
-				$this->_view->setSuccessMessage( $successMessage );
-				
-			$this->setCommonData();
-			
-            return true;
+			return( Array( "errorMessage" => $errorMessage, "successMessage" => $successMessage ));
         }
 		
 		function perform()
-		{
-			// prepare the parameters.. If there's only one category id, then add it to
-			// an array.
-			$this->_userIds = $this->_request->getValue( "userIds" );
-			$this->_userStatus = $this->_request->getValue( "userStatus" );
+		{				
+			$results = $this->_changeUserStatus();
+			
+			$this->_view = new AdminSiteUsersListView( $this->_blogInfo );
+            if( $results["errorMessage"] != "" ) $this->_view->setErrorMessage( $results["errorMessage"] );
+			if( $results["successMessage"] != "" ) $this->_view->setSuccessMessage( $results["successMessage"] );
+			
+			$this->setCommonData();
 				
-			$this->_changeUserStatus();
+			return( true );			
 		}
+		
+		function performAjax()
+		{
+			$results = $this->_changeUserStatus();
+			
+			lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
+            $this->_view = new AdminAjaxView( $this->_blogInfo );
+			$this->_view->setMessage( $results );
+			$this->_view->setSuccess( true );
+
+            // better to return true if everything fine
+            return true;			
+		}
     }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/admindeleteusersaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeleteusersaction.class.php	2007-08-04 13:32:56 UTC (rev 5787)
+++ plog/trunk/class/action/admin/admindeleteusersaction.class.php	2007-08-04 20:26:30 UTC (rev 5788)
@@ -37,16 +37,15 @@
 
         function perform()
         {
-        	if( $this->_op == "deleteUser" ) {
-        		$userId = $this->_request->getValue( "userId" );
-        		$this->_userIds = Array();
-        		$this->_userIds[] = $userId;
-        	}
-        	else {
-        		$this->_userIds = $this->_request->getValue( "userIds" );
-			}
+        	$results = $this->_disableUsers();
 
-        	$this->_disableUsers();
+			// prepare the view
+            $this->_view = new AdminSiteUsersListView( $this->_blogInfo );
+            if( $results["errorMessage"] != "" ) $this->_view->setErrorMessage( $results["errorMessage"] );
+			if( $results["successMessage"] != "" ) $this->_view->setSuccessMessage( $results["successMessage"] );
+            $this->setCommonData();
+
+			return( true );
         }
 
 		/**
@@ -58,6 +57,15 @@
             $successMessage = "";
             $totalOk = 0;
 
+        	if( $this->_op == "deleteUser" ) {
+        		$userId = $this->_request->getValue( "userId" );
+        		$this->_userIds = Array();
+        		$this->_userIds[] = $userId;
+        	}
+        	else {
+        		$this->_userIds = $this->_request->getValue( "userIds" );
+			}
+
             $users = new Users();
             // go user by user to remove them
             foreach( $this->_userIds as $userId ) {
@@ -84,14 +92,22 @@
                 }
             }
 
-			// prepare the view
-            $this->_view = new AdminSiteUsersListView( $this->_blogInfo );
-            if( $errorMessage != "" ) $this->_view->setErrorMessage( $errorMessage );
-            if( $successMessage != "" ) $this->_view->setSuccessMessage( $successMessage );
-            $this->setCommonData();
+			return( Array( "errorMessage" => $errorMessage, "successMessage" => $successMessage ));
 
             return false;
         }
 
+		function performAjax()
+		{
+			$results = $this->_disableUsers();
+			
+			lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
+            $this->_view = new AdminAjaxView( $this->_blogInfo );
+			$this->_view->setMessage( $results );
+			$this->_view->setSuccess( true );
+
+            // better to return true if everything fine
+            return true;			
+		}
     }
 ?>

Modified: plog/trunk/class/action/admin/adminupdateuserprofileaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateuserprofileaction.class.php	2007-08-04 13:32:56 UTC (rev 5787)
+++ plog/trunk/class/action/admin/adminupdateuserprofileaction.class.php	2007-08-04 20:26:30 UTC (rev 5788)
@@ -7,6 +7,7 @@
     lt_include( PLOG_CLASS_PATH."class/view/admin/adminsiteuserslistview.class.php" );
     lt_include( PLOG_CLASS_PATH."class/data/validator/passwordvalidator.class.php" );
     lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );	
+    lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );	
     lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
     lt_include( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
 
@@ -32,16 +33,15 @@
         	$this->AdminAction( $actionInfo, $request );
 			
 			// data validation
-			$this->registerField( "userFullName" );
-			$this->registerFieldValidator( "userEmail", new EmailValidator());
-			$this->registerFieldValidator( "userPictureId", new IntegerValidator());
+        	$this->registerFieldValidator( "userEmail", new EmailValidator(), false, $this->_locale->tr("error_incorrect_email_address"));
+			$this->registerFieldValidator( "userPictureId", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value" ));
 			$this->registerField( "userAbout" );
 			$this->registerField( "properties" );
 			$this->registerField( "userIsSiteAdmin" );
 			$this->registerField( "userName" );
 			$this->registerField( "userPermissions" );
-			$this->registerFieldValidator( "userProfilePassword", new PasswordValidator(), true );
-			$this->registerFieldValidator( "userStatus", new IntegerValidator());
+        	$this->registerFieldValidator( "userProfilePassword", new PasswordValidator(), true, $this->_locale->tr("error_invalid_password"));			
+			$this->registerFieldValidator( "userStatus", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value" ));			
 			$view = new AdminEditSiteUserView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_updating_user"));
 			$this->setValidationErrorView( $view );
@@ -49,14 +49,14 @@
 			$this->requireAdminPermission( "update_user" );			
         }
 		
-        function perform()
+        private function updateUser()
         {
 			// get the data
         	$this->_userId = $this->_request->getValue( "userId" );
-            $this->_userPassword = trim(Textfilter::filterAllHTML($this->_request->getValue( "userProfilePassword" )));
-            $this->_userEmail = Textfilter::filterAllHTML($this->_request->getValue( "userEmail" ));
-            $this->_userAbout = Textfilter::filterAllHTML($this->_request->getValue( "userAbout" ));
-            $this->_userFullName = Textfilter::filterAllHTML($this->_request->getValue( "userFullName" ));
+            $this->_userPassword = $this->_request->getFilteredValue( "userProfilePassword", new HtmlFilter());
+            $this->_userEmail = $this->_request->getValue( "userEmail", new HtmlFilter());
+            $this->_userAbout = $this->_request->getValue( "userAbout", new HtmlFilter());
+            $this->_userFullName = $this->_request->getValue( "userFullName", new HtmlFilter());
             $this->_adminPrivs = $this->_request->getValue( "userIsSiteAdmin" );
 			$this->_userProperties = $this->_request->getValue( "properties" );
 			$this->_userStatus = $this->_request->getValue( "userStatus" );
@@ -68,9 +68,9 @@
 
             // if no info could be fetched, shown an error and quit
             if( !$user ) {
-            	$this->_view = new AdminSiteUsersListView( $this->_blogInfo );
-                $this->_view->setErrorMessage( $this->_locale->tr("error_invalid_user") );
-                $this->setCommonData();
+            	//$this->_view = new AdminSiteUsersListView( $this->_blogInfo );
+                //$this->_view->setErrorMessage( $this->_locale->tr("error_invalid_user") );
+                //$this->setCommonData();
                 return false;
             }
 			
@@ -101,20 +101,42 @@
 
             // and now update them
             if( !$users->updateUser( $user )) {
-            	$this->_view =  new AdminSiteUsersListView( $this->_blogInfo );
-                $this->_view->setErrorMessage( $this->_locale->tr("error_updating_user") );
-                $this->setCommonData();
                 return false;
             }
 			
 			// the post-update event... if needed
-			$this->notifyEvent( EVENT_POST_USER_UPDATE, Array( "user" => &$user ));			
+			$this->notifyEvent( EVENT_POST_USER_UPDATE, Array( "user" => &$user ));
+			
+            return( $user );
+        }
 
-            $this->_view = new AdminSiteUsersListView( $this->_blogInfo );
-            $this->_view->setSuccessMessage( $this->_locale->pr("user_updated_ok", $user->getUsername()));
-            $this->setCommonData();
+		function perform()
+		{
+		    $this->_view = new AdminSiteUsersListView( $this->_blogInfo );
+		
+			$user = $this->updateUser();
+			if( $user ) 
+            	$this->_view->setSuccessMessage( $this->_locale->pr("user_updated_ok", $user->getUsername()));
+			else
+            	$this->_view->setErrorMessage( $this->_locale->pr("error_updating_user", $user->getUsername()));
 
-            return true;
-        }
+            $this->setCommonData();				
+
+			return( true );
+		}
+
+		function performAjax()
+		{
+			lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
+		    $this->_view = new AdminAjaxView( $this->_blogInfo );
+		
+			$user = $this->updateUser();
+			if( $user ) 
+            	$this->_view->setSuccessMessage( $this->_locale->pr("user_updated_ok", $user->getUsername()));
+			else
+            	$this->_view->setErrorMessage( $this->_locale->pr("error_updating_user", $user->getUsername()));
+
+			return( true );			
+		}
     }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/view/admin/adminsiteuserslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminsiteuserslistview.class.php	2007-08-04 13:32:56 UTC (rev 5787)
+++ plog/trunk/class/view/admin/adminsiteuserslistview.class.php	2007-08-04 20:26:30 UTC (rev 5788)
@@ -24,8 +24,13 @@
 		 */
 		function AdminSiteUsersListView( $blogInfo )
 		{
-			if( $this->_templateName == "" )
-				$this->_templateName = "siteusers";	
+			if( $this->_templateName == "" ) {
+				$r =& Request::getRequest();
+				if( $r->isTableOnly())
+					$this->_templateName = "siteusers_table";
+				else
+					$this->_templateName = "siteusers";
+			}
 				
 			$this->AdminTemplatedView( $blogInfo, $this->_templateName );
 			

Added: plog/trunk/js/ui/pages/users.js
===================================================================
--- plog/trunk/js/ui/pages/users.js	                        (rev 0)
+++ plog/trunk/js/ui/pages/users.js	2007-08-04 20:26:30 UTC (rev 5788)
@@ -0,0 +1,34 @@
+Lifetype.UI.Pages.Users = function() {}
+
+Lifetype.UI.Pages.Users.addSubmitHook = function( form )
+{
+	Lifetype.Forms.AjaxFormProcessor( form.id,'?output=json', {resetAfterSuccess:true} );	
+}
+
+Lifetype.UI.Pages.Users.updateSubmitHook = function( form )
+{
+	Lifetype.Forms.AjaxFormProcessor( form.id,'?output=json' );	
+}
+
+Lifetype.UI.Pages.Users.submitUsersList = function (op)
+{
+	if ( document.getElementById("userStatus").value == -1 )
+		window.alert(tr('error_select_status'));
+	else {
+		var oldOp = Lifetype.Dom.$( "siteUsers" ).op.value;	
+		Lifetype.Dom.$( "siteUsers" ).op.value = op;	
+	    Lifetype.Forms.performRequest( Lifetype.Dom.$( 'siteUsers' ));	
+
+		Lifetype.Dom.$( "siteUsers" ).op.value = oldOp;
+	}
+}
+
+YAHOO.util.Event.addListener( window, "load", function() {
+	
+	var t = new Lifetype.Effects.Table( "list" );
+	t.stripe();
+	t.highlightRows();
+
+	Lifetype.Forms.Events.performRequestSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );	
+	Lifetype.Forms.Events.formProcessorSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );
+});
\ No newline at end of file

Modified: plog/trunk/js/ui/plogui.js
===================================================================
--- plog/trunk/js/ui/plogui.js	2007-08-04 13:32:56 UTC (rev 5787)
+++ plog/trunk/js/ui/plogui.js	2007-08-04 20:26:30 UTC (rev 5788)
@@ -8,16 +8,6 @@
 	}
 }
 
-function submitUsersList(op)
-{
-	if ( document.getElementById("userStatus").value == -1 )
-		window.alert(tr('error_select_status'));
-	else {
-		document.getElementById("siteUsers").op.value = op;
-		document.getElementById("siteUsers").submit();
-	}
-}
-
 function showProgressBar( elementToHide )
 {
    button = document.getElementById( elementToHide );

Modified: plog/trunk/templates/admin/createuser.template
===================================================================
--- plog/trunk/templates/admin/createuser.template	2007-08-04 13:32:56 UTC (rev 5787)
+++ plog/trunk/templates/admin/createuser.template	2007-08-04 20:26:30 UTC (rev 5788)
@@ -1,13 +1,14 @@
- <form name="addUser" action="admin.php" method="post" onSubmit="Lifetype.UI.Pages.Users.addSubmitHook(this);return(false);">
+<form id="addUser" name="addUser" action="admin.php" method="post" onSubmit="Lifetype.UI.Pages.Users.addSubmitHook(this);return(false);">
   <fieldset class="inputField">
     <legend>{$locale->tr("createUser")}</legend>
-    {include file="$admintemplatepath/formvalidate.template"}
+   {include file="$admintemplatepath/formvalidateajax.template"}
+	<div style="float:left;width:50%">
     <div class="field">
       <label for="userName">{$locale->tr("username")}</label>
       <span class="required">*</span>
       <div class="formHelp">{$locale->tr("username_help")}</div>
       <input type="text" name="userName" value="{$userName}" id="userName" />
-      {include file="$admintemplatepath/validate.template" field=userName message=$locale->tr("error_incorrect_username")}      
+      {include file="$admintemplatepath/validateajax.template" field=userName}
     </div>
     <div class="field">
       <label for="userFullName">{$locale->tr("full_name")}</label>
@@ -19,14 +20,14 @@
       <span class="required">*</span>
       <div class="formHelp">{$locale->tr("password_help")}</div>
       <input type="password" name="newUserPassword" value="{$newUserPassword}" id="newUserPassword" />
-      {include file="$admintemplatepath/validate.template" field=newUserPassword message=$locale->tr("error_invalid_password")}
+      {include file="$admintemplatepath/validateajax.template" field=newUserPassword}
     </div>
     <div class="field">
       <label for="userEmail">{$locale->tr("email")}</label>
       <span class="required">*</span>
       <div class="formHelp">{$locale->tr("email_help")}</div>
       <input type="text" name="userEmail" value="{$userEmail}" id="userEmail" />
-      {include file="$admintemplatepath/validate.template" field=userEmail message=$locale->tr("error_incorrect_email_address")}
+      {include file="$admintemplatepath/validateajax.template" field=userEmail}
     </div>
 	<div class="field">
 	  <label for="userStatus">{$locale->tr("status")}</label>
@@ -38,6 +39,8 @@
 	   {/foreach}
 	  </select>
 	</div>
+	</div>
+	<div style="float:right;width:50%">
     <div class="field">
       <label for="userBlog">{$locale->tr("blog")}</label>
       <div class="formHelp">{$locale->tr("user_blog_help")}</div>
@@ -46,11 +49,12 @@
 	  <a href="#" onclick="window.open('?op=siteBlogsChooser','BlogChooser','scrollbars=yes,resizable=yes,toolbar=no,height=450,width=600');">
 	   {$locale->tr("select")}
 	  </a> 
-      {include file="$admintemplatepath/validate.template" field=blogId message=$locale->tr("error_incorrect_blog_id")}
-    </div>
+      {include file="$admintemplatepath/validateajax.template" field=blogId}
+    </div>		
 	<div class="field">
 		<label for="userPermissions">{$locale->tr("permissions")}</label>
 		<div class="formHelp">{$locale->tr("admin_user_permissions_help")}</div>
+		<div id="permissions" style="overflow:auto;height:300px;">
 		{foreach from=$permissions item=perm}
 			{if $perm->isAdminOnlyPermission()}
 			  {assign var=permId value=$perm->getId()}
@@ -59,7 +63,9 @@
 			  {$locale->tr($permDesc)}<br/>
 			{/if}
 		{/foreach}
+		</div>
     </div>
+    </div>
   </fieldset>
   <div class="buttons">
     <input type="reset" name="resetButton" value="{$locale->tr("reset")}"/>

Modified: plog/trunk/templates/admin/siteusers.template
===================================================================
--- plog/trunk/templates/admin/siteusers.template	2007-08-04 13:32:56 UTC (rev 5787)
+++ plog/trunk/templates/admin/siteusers.template	2007-08-04 20:26:30 UTC (rev 5788)
@@ -1,11 +1,12 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=editSiteUsers title=$locale->tr("editSiteUsers")} 
-<script type="text/javascript" src="js/ui/plogui.js"></script>
+{js src="js/ui/plogui.js"}
 {js src="js/ui/pages/global.js"}
+{js src="js/ui/pages/users.js"}
 <script type="text/javascript">
 {literal}
 YAHOO.util.Event.addListener( window, "load", function() {
-		var t = new Lifetype.Effects.Table( "list" );
+		var t = new Lifetype.Effects.Table( "siteUsersTable" );
 		t.stripe();
 		t.highlightRows();
 	});
@@ -54,71 +55,13 @@
 		<a id="optionIconLink" href="#bulkEdit" title="{$locale->tr("show_massive_change_option")}" onclick="Lifetype.UI.Pages.Global.switchMassiveOption()">{$locale->tr("show_massive_change_option")}</a>
 	</div>
 {/check_perms}
-<br style="clear:both" />
-<form id="siteUsers" action="admin.php" method="post">		
-<div id="list">
-  {include file="$admintemplatepath/successmessage.template"}
-  {include file="$admintemplatepath/errormessage.template"}
-            <table id="list" class="info" summary="{$locale->tr("editSiteUsers")}">
-                <thead>
-                    <tr>
-                        <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('siteUsers');" /></th>
-                        <th style="width:5%;">UID</th>
-                        <th style="width:20%;">{$locale->tr("username")}</th>
-                        <th style="width:30%;">{$locale->tr("full_name")}</th>                        
-                        <th style="width:25%;">{$locale->tr("email")}</th>
-                        <th style="width:10%;">{$locale->tr("status")}</th>
-                        <th style="width:10%;">{$locale->tr("actions")}</th>
-                    </tr>
-                </thead>
-                <tbody>
-                   {foreach from=$siteusers item=siteuser}
-                    <tr>
-                        <td>
-                            <input class="checkbox" type="checkbox" name="userIds[{$siteuser->getId()}]" id="checks_{$siteuser->getId()}" value="{$siteuser->getId()}" />
-                        </td>
-                        <td class="col_highlighted">
-                            {$siteuser->getId()}
-                        </td>
-                        <td class="col_highlighted">
-                            <a href="?op=editSiteUser&amp;userId={$siteuser->getId()}">{$siteuser->getUsername()|truncate:20:"..."}</a>
-                        </td>
-                        <td>
-                            {$siteuser->getFullName()|truncate:70:"..."}
-                        </td>                        
-                        <td>
-                            <a href="mailto:{$siteuser->getEmail()}">
-                            {$siteuser->getEmail()}
-                            </a>
-                        </td>
-                        <td>
-                          {foreach from=$userstatus key=name item=status}
-                           {if $siteuser->getStatus() == $status}
-                            {if $status == 2}<span style="color:red">{$locale->tr($name)}</span>
-							{else}{$locale->tr($name)}{/if}
-						   {/if}
-                          {/foreach}                           
-                        </td>
-                        <td>
-                            <div class="list_action_button">
-							{check_perms adminperm=update_user}
-                            <a href="?op=editSiteUser&amp;userId={$siteuser->getId()}" title="{$locale->tr("edit")}">
-	                           <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
-	                        </a>
-                            <a href="?op=deleteUser&amp;userId={$siteuser->getId()}" title="{$locale->tr("delete")}">
-	                           <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
-	                        </a>
-							{/check_perms}
-                            </div>
-                        </td>
-                    </tr>
-                    {/foreach}
-                </tbody>
-            </table>
-        </div>        
-		<a name="bulkEdit"></a>
+<form id="siteUsers" action="admin.php" method="post" onSubmit="Lifetype.Forms.performRequest(this);return(false);">
+{include file="$admintemplatepath/viewvalidateajax.template"}
+<div id="list">	
+{include file="$admintemplatepath/siteusers_table.template"}
+</div>        
         <div id="list_action_bar">
-        {adminpager style=list}
+		<a name="bulkEdit"></a>	
 		{check_perms adminperm=update_user}
              <input type="submit" name="delete" value="{$locale->tr("delete")}" class="submit" />
              <input type="hidden" name="op" value="deleteUsers" />
@@ -134,7 +77,7 @@
 			      		{if $status != -1}<option value="{$status}">{$locale->tr($name)}</option>{/if}
 			    	{/foreach}	
 	            </select>
-	            <input type="button" name="changeUserStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitUsersList('changeUserStatus');" /> 
+	            <input type="button" name="changeUserStatus" value="{$locale->tr("change_status")}" class="submit" onClick="Lifetype.UI.Pages.Users.submitUsersList('changeUserStatus');" /> 
 	        </fieldset>
 		</div>
 		{/check_perms}

Added: plog/trunk/templates/admin/siteusers_table.template
===================================================================
--- plog/trunk/templates/admin/siteusers_table.template	                        (rev 0)
+++ plog/trunk/templates/admin/siteusers_table.template	2007-08-04 20:26:30 UTC (rev 5788)
@@ -0,0 +1,57 @@
+<table id="siteUsersTable" class="info">
+    <thead>
+        <tr>
+            <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('siteUsers');" /></th>
+            <th style="width:5%;">UID</th>
+            <th style="width:20%;">{$locale->tr("username")}</th>
+            <th style="width:30%;">{$locale->tr("full_name")}</th>                        
+            <th style="width:25%;">{$locale->tr("email")}</th>
+            <th style="width:10%;">{$locale->tr("status")}</th>
+            <th style="width:10%;">{$locale->tr("actions")}</th>
+        </tr>
+    </thead>
+    <tbody>
+       {foreach from=$siteusers item=siteuser}
+        <tr>
+            <td>
+                <input class="checkbox" type="checkbox" name="userIds[{$siteuser->getId()}]" id="checks_{$siteuser->getId()}" value="{$siteuser->getId()}" />
+            </td>
+            <td class="col_highlighted">
+                {$siteuser->getId()}
+            </td>
+            <td class="col_highlighted">
+                <a href="?op=editSiteUser&amp;userId={$siteuser->getId()}">{$siteuser->getUsername()|truncate:20:"..."}</a>
+            </td>
+            <td>
+                {$siteuser->getFullName()|truncate:70:"..."}
+            </td>                        
+            <td>
+                <a href="mailto:{$siteuser->getEmail()}">
+                {$siteuser->getEmail()}
+                </a>
+            </td>
+            <td>
+              {foreach from=$userstatus key=name item=status}
+               {if $siteuser->getStatus() == $status}
+                {if $status == 2}<span style="color:red">{$locale->tr($name)}</span>
+				{else}{$locale->tr($name)}{/if}
+			   {/if}
+              {/foreach}                           
+            </td>
+            <td>
+                <div class="list_action_button">
+				{check_perms adminperm=update_user}
+                <a href="?op=editSiteUser&amp;userId={$siteuser->getId()}" title="{$locale->tr("edit")}" rel="overlay">
+                   <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
+                </a>
+                <a href="?op=deleteUser&amp;userId={$siteuser->getId()}" title="{$locale->tr("delete")}" onClick="Lifetype.Forms.performRequest(this);return(false);">
+                   <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
+                </a>
+				{/check_perms}
+                </div>
+            </td>
+        </tr>
+        {/foreach}
+    </tbody>
+</table>
+{adminpagerajax style=list}
\ No newline at end of file

Modified: plog/trunk/templates/admin/userprofile.template
===================================================================
--- plog/trunk/templates/admin/userprofile.template	2007-08-04 13:32:56 UTC (rev 5787)
+++ plog/trunk/templates/admin/userprofile.template	2007-08-04 20:26:30 UTC (rev 5788)
@@ -1,11 +1,8 @@
-{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=editSiteUsers title=$locale->tr("editSiteUsers")}
-
-  <form name="editUserProfile" action="admin.php" method="post">
+<form id="editUserProfile" name="editUserProfile" action="admin.php" method="post" onSubmit="Lifetype.UI.Pages.Users.updateSubmitHook(this);return(false);">
    <fieldset class="inputField">
     <legend>{$locale->tr("editUser")}</legend>
-    {include file="$admintemplatepath/formvalidate.template"}
-
+   {include file="$admintemplatepath/formvalidateajax.template"}
+    <div style="float:left;width:50%">
     <div class="field">
       <label for="userName">{$locale->tr("username")}</label>
       <div class="formHelp">{$locale->tr("username_help")}</div>
@@ -21,14 +18,14 @@
       <label for="userProfilePassword">{$locale->tr("password")}</label>
       <div class="formHelp">{$locale->tr("password_help")}</div>
       <input type="password" name="userProfilePassword" id="userProfilePassword" value="{$userProfilePassword}" />
-      {include file="$admintemplatepath/validate.template" field=userProfilePassword message=$locale->tr("error_invalid_password")}
+      {include file="$admintemplatepath/validateajax.template" field=userProfilePassword}
     </div>
     <div class="field">
       <label for="userEmail">{$locale->tr("email")}</label>
       <span class="required">*</span>
       <div class="formHelp">{$locale->tr("email_help")}</div>
       <input type="text" name="userEmail" id="userEmail" value="{$userEmail}"/>
-      {include file="$admintemplatepath/validate.template" field=userEmail message=$locale->tr("error_incorrect_email_address")}
+      {include file="$admintemplatepath/validateajax.template" field=userEmail}
     </div>
     <div class="field">
 	  <label for="userStatus">{$locale->tr("status")}</label>
@@ -44,10 +41,14 @@
       <label for="userBlog">{$locale->tr("blogs")}</label>
       <span class="required"></span>
       <div class="formHelp">{$locale->tr("user_blogs_help")}</div>
+	  <div style="height:50px;overflow:auto">
       {foreach from=$edituserblogs item=userblog}
         <a id="userBlog" href="admin.php?op=editBlog&amp;blogId={$userblog->getId()}">{$userblog->getBlog()}</a><br/>
       {/foreach}
+      </div>
     </div>
+    </div>
+    <div style="float:right;width:50%">
     <div class="field">
       <label for="userIsSiteAdmin">{$locale->tr("site_admin")}</label>
       <span class="required"></span>
@@ -60,6 +61,7 @@
 		<label for="userPermissions">{$locale->tr("permissions")}</label>
 		<span class="required"></span>
 		<div class="formHelp">{$locale->tr("admin_user_permissions_help")}</div>
+		<div style="height:320px;overflow:auto">
 		{foreach from=$permissions item=perm}
 			{if $perm->isAdminOnlyPermission()}
 			  {assign var=permId value=$perm->getId()}
@@ -68,8 +70,10 @@
 			  {$locale->tr($permDesc)}<br/>
 			{/if}
 		{/foreach}
+		</div>
     <input type="hidden" name="userPictureId" value="{$edituser->getPictureId()}" />
    </div>
+   </div>
   </fieldset>  
   <div class="buttons">
    <input type="reset" name="resetButton" value="{$locale->tr("reset")}" />
@@ -77,6 +81,4 @@
    <input type="hidden" name="userId" value="{$edituser->getId()}"/>
    <input type="hidden" name="op" value="updateUserProfile" />
   </div>
- </form>
-{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
+ </form>
\ No newline at end of file



More information about the pLog-svn mailing list