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

mark at devel.lifetype.net mark at devel.lifetype.net
Fri Mar 14 03:44:18 EDT 2008


Author: mark
Date: 2008-03-14 03:44:18 -0400 (Fri, 14 Mar 2008)
New Revision: 6230

Added:
   plog/trunk/js/ui/pages/globalarticlecategories.js
   plog/trunk/templates/admin/editglobalarticlecategory_form.template
   plog/trunk/templates/admin/globalarticlecategories_table.template
   plog/trunk/templates/admin/newglobalarticlecategory_form.template
Modified:
   plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/admindeleteglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php
   plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/adminnewglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/adminupdatefriendaction.class.php
   plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php
   plog/trunk/class/view/admin/adminglobalarticlecategorieslistview.class.php
   plog/trunk/templates/admin/editglobalarticlecategory.template
   plog/trunk/templates/admin/globalarticlecategories.template
   plog/trunk/templates/admin/newglobalarticlecategory.template
Log:
Ajaxlize editGlobalArticleCategories admin panel.

Modified: plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php	2008-03-14 07:44:18 UTC (rev 6230)
@@ -32,8 +32,8 @@
         	$this->AdminAction( $actionInfo, $request );
 			
 			// register two validators
-			$this->registerFieldValidator( "categoryName", new StringValidator());
-			$this->registerFieldValidator( "categoryDescription", new StringValidator());
+			$this->registerFieldValidator( "categoryName", new StringValidator(), false, $this->_locale->tr("error_empty_name") );
+			$this->registerFieldValidator( "categoryDescription", new StringValidator(), false, $this->_locale->tr("error_empty_description") );
 			// and the view we should show in case there is a validation error
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "newglobalarticlecategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_adding_global_article_category" ));			
@@ -42,10 +42,7 @@
 			$this->requireAdminPermission( "add_global_category" );				
         }
 
-        /**
-         * Carries out the specified action
-         */
-        function perform()
+        function addGlobalArticleCategory()
         {
 			// fetch the data, we already know it's valid and that we can trust it!
         	$this->_categoryName     = $this->_request->getValue( "categoryName" );
@@ -53,41 +50,68 @@
 		
 			// create the object...
             $categories = new GlobalArticleCategories();
-            $category   = new GlobalArticleCategory( $this->_categoryName,
-                                              	     $this->_categoryDescription );
+            $this->_category   = new GlobalArticleCategory( $this->_categoryName,
+                                              	            $this->_categoryDescription );
 											   
 			// fire the pre event...
-			$this->notifyEvent( EVENT_PRE_ADD_GLOBAL_CATEGORY, Array( "category" => &$category ));
+			$this->notifyEvent( EVENT_PRE_ADD_GLOBAL_CATEGORY, Array( "category" => &$this->_category ));
 
             // once we have built the object, we can add it to the database!
-             if( $categories->addGlobalArticleCategory( $category )) {
-				// if everything went fine, transfer the execution flow to the action that
-				// lists all the article categories... without forgetting that we should let the
-				// next class know that we actually added a category alongside a message
-				// and the category that we just added!
-				if( $this->userHasPermission( "view_global_categories", ADMIN_PERMISSION ))
-					$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
-				else
-					$this->_view = new AdminTemplatedView( $this->_blogInfo, "newglobalarticlecategory" );
-				$this->_view->setSuccess( true );
-				$this->_view->setSuccessMessage( $this->_locale->pr("global_category_added_ok", $category->getName()));
+            $result = $categories->addGlobalArticleCategory( $this->_category );
+            
+            if( $result) {
+				$this->_message = $this->_locale->pr("global_category_added_ok", $this->_category->getName());
 				
 				// fire the post event
-				$this->notifyEvent( EVENT_POST_ADD_GLOBAL_CATEGORY, Array( "category" => &$category ));
-				
-				$this->setCommonData();				
+				$this->notifyEvent( EVENT_POST_ADD_GLOBAL_CATEGORY, Array( "category" => &$this->_category ));
             }
             else {
-				// if there was an error, we should say so... as well as not changing the view since
-				// we're going back to the original view where we can add the category
+				$this->_message = $this->_locale->tr("error_adding_global_article_category" );
+            }
+
+            // better to return true if everything fine
+            return $result;
+        }
+
+        /**
+         * Carries out the specified action
+         */
+        function perform()
+        {
+			// the view is the same for both conditions
+			if( $this->userHasPermission( "view_global_categories", ADMIN_PERMISSION ))
+				$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
+			else
 				$this->_view = new AdminTemplatedView( $this->_blogInfo, "newglobalarticlecategory" );
-				$this->_view->setError( true );
-				$this->_view->setErrorMessage( $this->_locale->tr("error_adding_global_article_category" ));
-				$this->setCommonData( true );
+				
+			$result = $this->addGlobalArticleCategory();
+													
+            if( !$result ) {
+				// set an error message
+                $this->_view->setErrorMessage( $this->_message );
             }
+			else {
+				// or success
+				$this->_view->setSuccessMessage( $this->_message );	
+			}			
+			
+            $this->setCommonData();
 
-            // better to return true if everything fine
             return true;
         }
+
+		function performAjax()
+		{
+			$result = $this->addGlobalArticleCategory();
+			
+			
+			$this->_view = new AdminAjaxView( $this->_blogInfo );
+			
+			$this->_view->setSuccess( $result );
+			$this->_view->setMessage( $this->_message );
+			$this->_view->setResult( $this->_category );
+			
+			return( true );
+		}
     }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/admindeleteglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeleteglobalarticlecategoryaction.class.php	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/class/action/admin/admindeleteglobalarticlecategoryaction.class.php	2008-03-14 07:44:18 UTC (rev 6230)
@@ -42,6 +42,15 @@
 		 */
 		function _deleteGlobalArticleCategories()
 		{
+			// prepare the parameters.. If there's only one category id, then add it to
+			// an array.
+			if( $this->_mode == "deleteGlobalArticleCategory" ) {
+				$this->_categoryIds = Array();
+				$this->_categoryIds[] = $this->_request->getValue( "categoryId" );
+			}
+			else
+				$this->_categoryIds = $this->_request->getValue( "categoryIds" );
+
             $categories = new GlobalArticleCategories();
 			
 			$errorMessage = "";
@@ -82,19 +91,11 @@
 				}
         	}
         				
-			// prepare the view and all the information it needs to know
-			$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
-			if( $errorMessage != "" ) 
-				$this->_view->setErrorMessage( $errorMessage );
-			if( $successMessage != "" ) {
-				// and clear the cache to avoid outdated information
-				CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );			
-				$this->_view->setSuccessMessage( $successMessage );
-			}
-				
-			$this->setCommonData();
+			// and clear the cache to avoid outdated information
+			CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );			
 			
-			return true;
+            // better to return true if everything fine
+            return( Array( "errorMessage" => $errorMessage, "successMessage" => $successMessage ));
 		}
 
         /**
@@ -102,16 +103,29 @@
          */
         function perform()
         {
-			// prepare the parameters.. If there's only one category id, then add it to
-			// an array.
-			if( $this->_mode == "deleteGlobalArticleCategory" ) {
-				$this->_categoryIds = Array();
-				$this->_categoryIds[] = $this->_request->getValue( "categoryId" );
-			}
-			else
-				$this->_categoryIds = $this->_request->getValue( "categoryIds" );
+			$results = $this->_deleteGlobalArticleCategories();
+
+            $this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
+            if( $results["errorMessage"] != "" ) $this->_view->setErrorMessage( $results["errorMessage"] );
+			if( $results["successMessage"] != "" ) $this->_view->setSuccessMessage( $results["successMessage"] );
+            $this->setCommonData();
 			
-            return $this->_deleteGlobalArticleCategories();
+            return true;
         }
+
+		/**
+		 * Ajax-specific behaviour
+		 */
+		function performAjax()
+		{
+			$results = $this->_deleteGlobalArticleCategories();
+
+            $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/admineditglobalarticlecategoriesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php	2008-03-14 07:44:18 UTC (rev 6230)
@@ -41,5 +41,10 @@
             // better to return true if everything fine
             return true;
         }
+        
+        function performAjax()
+        {
+        	return( $this->perform() );
+        }
     }
 ?>

Modified: plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php	2008-03-14 07:44:18 UTC (rev 6230)
@@ -54,7 +54,10 @@
             $category   = $categories->getGlobalArticleCategory( $this->_categoryId);
             // show an error if we couldn't fetch the category
             if( !$category ) {
-            	$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
+				if( $this->_request->isXHR())
+		            $this->_view = new AdminErrorDialogView( $this->_blogInfo );
+				else
+                	$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
                 $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_category") );
 				$this->_view->setError( true );
                 $this->setCommonData();
@@ -63,7 +66,10 @@
 			
 			$this->notifyEvent( EVENT_CATEGORY_LOADED, Array( "category" => &$category ));			
             // otherwise show the form to edit its fields
-        	$this->_view = new AdminTemplatedView( $this->_blogInfo, "editglobalarticlecategory" );
+			if( Request::isXHR())
+        		$this->_view = new AdminTemplatedView( $this->_blogInfo, "editglobalarticlecategory_form" );
+			else
+				$this->_view = new AdminTemplatedView( $this->_blogInfo, "editglobalarticlecategory" );
             $this->_view->setValue( "category", $category );
 			$this->_view->setValue( "categoryName", $category->getName());
 			$this->_view->setValue( "categoryDescription", $category->getDescription());
@@ -73,5 +79,10 @@
             // better to return true if everything fine
            return true;
         }
+
+		function performAjax()
+		{
+			return( $this->perform());
+		}
     }
 ?>

Modified: plog/trunk/class/action/admin/adminnewglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewglobalarticlecategoryaction.class.php	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/class/action/admin/adminnewglobalarticlecategoryaction.class.php	2008-03-14 07:44:18 UTC (rev 6230)
@@ -35,7 +35,10 @@
         function perform()
         {
         	// initialize the view
-          $this->_view = new AdminTemplatedView( $this->_blogInfo, "newglobalarticlecategory" );
+			if( $this->_request->isXHR())
+        		$this->_view = new AdminTemplatedView( $this->_blogInfo, "newglobalarticlecategory_form" );
+			else
+        		$this->_view = new AdminTemplatedView( $this->_blogInfo, "newglobalarticlecategory" );
           $this->setCommonData();
         }
 

Modified: plog/trunk/class/action/admin/adminupdatefriendaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatefriendaction.class.php	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/class/action/admin/adminupdatefriendaction.class.php	2008-03-14 07:44:18 UTC (rev 6230)
@@ -25,8 +25,8 @@
 			
 			// register two validators
 			$this->registerFieldValidator( "friendId", new IntegerValidator());
-			$this->registerFieldValidator( "friendName", new StringValidator(), $this->_locale->tr( "error_empty_name" ));
-			$this->registerFieldValidator( "friendGroupId", new IntegerValidator(), $this->_locale->tr( "error_group_id" ));
+			$this->registerFieldValidator( "friendName", new StringValidator(), false, $this->_locale->tr( "error_empty_name" ));
+			$this->registerFieldValidator( "friendGroupId", new IntegerValidator(), false, $this->_locale->tr( "error_group_id" ));
 			$this->registerField( "friendDescription" );
 			$this->registerField( "userAuthorizationStatus" );
 			// and the view we should show in case there is a validation error

Modified: plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php	2008-03-14 07:44:18 UTC (rev 6230)
@@ -37,9 +37,9 @@
         	$this->AdminAction( $actionInfo, $request );
 			
 			// data validation settings
-			$this->registerFieldValidator( "categoryName", new StringValidator());
+			$this->registerFieldValidator( "categoryName", new StringValidator(), false, $this->_locale->tr( "error_empty_name" ));
 			$this->registerFieldValidator( "categoryId", new IntegerValidator());
-			$this->registerFieldValidator( "categoryDescription", new StringValidator());
+			$this->registerFieldValidator( "categoryDescription", new StringValidator(), false, $this->_locale->tr( "error_empty_description" ));
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "editglobalarticlecategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_updating_article_category" ));
 			$this->setValidationErrorView( $errorView );
@@ -47,10 +47,7 @@
 			$this->requireAdminPermission( "update_global_category" );
         }
 
-        /**
-         * Carries out the specified action
-         */
-        function perform()
+        function updateGlobalArticleCategory()
         {
 			// get the data from the form
         	$this->_categoryName = $this->_request->getValue( "categoryName" );
@@ -62,10 +59,7 @@
             $categories = new GlobalArticleCategories();
             $category   = $categories->getGlobalArticleCategory( $this->_categoryId );
             if( !$category ) {
-            	$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
-                $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_category"));
-                $this->setCommonData();
-
+            	$this->_message = $this->_locale->tr("error_fetching_category");
                 return false;
             }
 			
@@ -78,15 +72,13 @@
 			$category->setProperties( $this->_properties );
 			$category->setDescription( $this->_categoryDescription );
 			
-			// this is view we're going to use to show our messages
-			$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );			
-			
             if( !$categories->updateGlobalArticleCategory( $category )) {
-                $this->_view->setErrorMessage( $this->_locale->tr("error_updating_article_category"));
+                $this->_message = $this->_locale->tr("error_updating_article_category");
+                return false;
             }
 			else {
 				// if everything fine, load the list of categories
-				$this->_view->setSuccessMessage( $this->_locale->pr("article_category_updated_ok", $category->getName()));
+				$this->_messag = $this->_locale->pr("article_category_updated_ok", $category->getName());
 				
 				// fire the post-event
 				$this->notifyEvent( EVENT_POST_UPDATE_GLOBAL_CATEGORY, Array( "category" => &$category ));			
@@ -95,10 +87,46 @@
 				CacheControl::resetBlogCache( $this->_blogInfo->getId());			
 			}
 			
-			$this->setCommonData();			
-			
             // better to return true if everything fine
+            return $category;
+        }
+
+        /**
+         * Carries out the specified action
+         */
+        function perform()
+        {	
+			if(( $category = $this->updateGlobalArticleCategory())) {
+				$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_message );
+                $this->setCommonData();				
+			}
+			else {
+				// and go back to the view with the list of links
+				$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
+	            $this->_view->setSuccessMessage( $this->_message );
+	            $this->setCommonData();				
+			}
+
+            // better to return true if everything fine
             return true;
         }
+
+
+		function performAjax()
+		{
+			
+			$this->_view = new AdminAjaxView( $this->_blogInfo );
+			if(( $category = $this->updateGlobalArticleCategory())) {
+				$this->_view->setSuccess( true );
+				$this->_view->setResult( $category );
+			}
+			else {
+				$this->_view->setSuccess( false );
+			}
+			$this->_view->setMessage( $this->_message );
+
+			return( true );
+		}
     }
 ?>

Modified: plog/trunk/class/view/admin/adminglobalarticlecategorieslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminglobalarticlecategorieslistview.class.php	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/class/view/admin/adminglobalarticlecategorieslistview.class.php	2008-03-14 07:44:18 UTC (rev 6230)
@@ -26,7 +26,10 @@
          */
         function AdminGlobalArticleCategoriesListView( $blogInfo, $params = Array())
         {
-        	$this->AdminTemplatedView( $blogInfo, "globalarticlecategories" );
+			if( Request::isXHR())
+				$this->AdminTemplatedView( $blogInfo, "globalarticlecategories_table" );
+			else
+        		$this->AdminTemplatedView( $blogInfo, "globalarticlecategories" );
 			
 			if( isset( $params['searchTerms'] ))
 				$this->_searchTerms = $params['searchTerms'];
@@ -64,7 +67,10 @@
 			                    $this->_page,
 								$totalCategories,
 								DEFAULT_ITEMS_PER_PAGE );
-								$this->setValue( "pager", $pager );								
+								$this->setValue( "pager", $pager );	
+			$this->setValue( "pager", $pager );	
+			$this->setValue( "searchTerms", $this->_searchTerms );				
+
 			parent::render();			
         }
     }

Added: plog/trunk/js/ui/pages/globalarticlecategories.js
===================================================================
--- plog/trunk/js/ui/pages/globalarticlecategories.js	                        (rev 0)
+++ plog/trunk/js/ui/pages/globalarticlecategories.js	2008-03-14 07:44:18 UTC (rev 6230)
@@ -0,0 +1,21 @@
+Lifetype.UI.Pages.GlobalArticleCategories = function() {}
+
+Lifetype.UI.Pages.GlobalArticleCategories.addSubmitHook = function( form )
+{
+	Lifetype.Forms.AjaxFormProcessor( form.id,'?output=json', {resetAfterSuccess:true} );
+}
+
+Lifetype.UI.Pages.GlobalArticleCategories.updateSubmitHook = function( form )
+{
+	Lifetype.Forms.AjaxFormProcessor( form.id,'?output=json' );
+}
+
+YAHOO.util.Event.addListener( window, "load", function() {
+	var t = new Lifetype.Effects.Table( "list" );
+	t.stripe();
+	t.highlightRows();
+
+	// reload the list when successfully deleting an item and processing one of the forms
+	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/templates/admin/editglobalarticlecategory.template
===================================================================
--- plog/trunk/templates/admin/editglobalarticlecategory.template	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/templates/admin/editglobalarticlecategory.template	2008-03-14 07:44:18 UTC (rev 6230)
@@ -1,37 +1,7 @@
 {include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=editGlobalArticleCategories title=$locale->tr("editGlobalArticleCategories")}
+{include file="$admintemplatepath/navigation.template" showOpt=editGlobalArticleCategories title=$locale->tr("editGlobalArticleCategory")}
 
- <form name="editGlobalArticleCategory" action="admin.php" method="post">
+{include file="$admintemplatepath/editglobalarticlecategory_form.template"}
 
-  <fieldset class="inputField">
-   <legend>{$locale->tr("editGlobalArticleCategories")}</legend>
-   {include file="$admintemplatepath/formvalidate.template"}
-
-   <div class="field">
-    <label for="categoryName">{$locale->tr("name")}</label>
-    <span class="required">*</span>
-    <div class="formHelp">{$locale->tr("category_name_help")}</div>
-    <input type="text" id="categoryName" name="categoryName" value="{$categoryName|escape:"html"}"/>
-    {include file="$admintemplatepath/validate.template" field=categoryName message=$locale->tr("error_empty_name")}
-   </div>
-
-   <div class="field">
-    <label for="categoryDescription">{$locale->tr("description")}</label>
-    <span class="required">*</span>
-    <div class="formHelp">{$locale->tr("category_description_help")}</div>
-    <textarea name="categoryDescription" id="categoryDescription" cols="60" rows="5">{$categoryDescription}</textarea>
-    {include file="$admintemplatepath/validate.template" field=categoryDescription message=$locale->tr("error_empty_description")}
-  </div>
-
-  </fieldset>
-  <div class="buttons">
-    <input type="hidden" name="categoryUrl" value="" />
-    <input type="reset" name="resetButton" value="{$locale->tr("reset")}" />
-    <input type="submit" name="Update" value="{$locale->tr("update")}" />
-    <input type="hidden" name="op" value="updateGlobalArticleCategory" />
-    <input type="hidden" name="categoryId" value="{$categoryId}" />
-  </div>
-</form>
-
 {include file="$admintemplatepath/footernavigation.template"}
 {include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Added: plog/trunk/templates/admin/editglobalarticlecategory_form.template
===================================================================
--- plog/trunk/templates/admin/editglobalarticlecategory_form.template	                        (rev 0)
+++ plog/trunk/templates/admin/editglobalarticlecategory_form.template	2008-03-14 07:44:18 UTC (rev 6230)
@@ -0,0 +1,31 @@
+ <form id="editGlobalArticleCategory" action="admin.php" method="post" onSubmit="Lifetype.UI.Pages.GlobalArticleCategories.updateSubmitHook(this);return(false);">
+
+  <fieldset class="inputField">
+   <legend>{$locale->tr("editGlobalArticleCategory")}</legend>
+   {include file="$admintemplatepath/formvalidateajax.template"}
+
+   <div class="field">
+    <label for="categoryName">{$locale->tr("name")}</label>
+    <span class="required">*</span>
+    <div class="formHelp">{$locale->tr("category_name_help")}</div>
+    <input type="text" id="categoryName" name="categoryName" value="{$categoryName|escape:"html"}"/>
+    {include file="$admintemplatepath/validateajax.template" field=categoryName}
+   </div>
+
+   <div class="field">
+    <label for="categoryDescription">{$locale->tr("description")}</label>
+    <span class="required">*</span>
+    <div class="formHelp">{$locale->tr("category_description_help")}</div>
+    <textarea name="categoryDescription" id="categoryDescription" cols="60" rows="5">{$categoryDescription}</textarea>
+    {include file="$admintemplatepath/validateajax.template" field=categoryDescription}
+  </div>
+
+  </fieldset>
+  <div class="buttons">
+    <input type="hidden" name="categoryUrl" value="" />
+    <input type="reset" name="resetButton" value="{$locale->tr("reset")}" />
+    <input type="submit" name="Update" value="{$locale->tr("update")}" />
+    <input type="hidden" name="op" value="updateGlobalArticleCategory" />
+    <input type="hidden" name="categoryId" value="{$categoryId}" />
+  </div>
+</form>
\ No newline at end of file

Modified: plog/trunk/templates/admin/globalarticlecategories.template
===================================================================
--- plog/trunk/templates/admin/globalarticlecategories.template	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/templates/admin/globalarticlecategories.template	2008-03-14 07:44:18 UTC (rev 6230)
@@ -1,5 +1,8 @@
 {include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=editGlobalArticleCategories title=$locale->tr("editArticleCategories")}
+{include file="$admintemplatepath/navigation.template" showOpt=editGlobalArticleCategories title=$locale->tr("editGlobalArticleCategories")}
+{js src="js/ui/plogui.js"}
+{js src="js/ui/pages/global.js"}
+{js src="js/ui/pages/globalarticlecategories.js"}
 
 <div id="list_nav_bar">
 <div id="list_nav_select">
@@ -38,47 +41,12 @@
 </div>
 <br style="clear:both" />
 {/check_perms}
- <form id="deleteCategories" action="admin.php" method="post">
+ <form id="editGlobalArticleCategories" action="admin.php" method="post" onSubmit="Lifetype.Forms.performRequest(this);return(false);">
+ {include file="$admintemplatepath/viewvalidateajax.template"}
  <div id="list">
-  {include file="$admintemplatepath/successmessage.template"}
-  {include file="$admintemplatepath/errormessage.template"}
- <table id="list" class="info" summary="{$locale->tr("editArticleCategories")}">
-  <thead>
-   <tr>
-    <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('deleteCategories');" /></th>
-    <th style="width:90%;">{$locale->tr("category")}</th>  
-    <th style="width:10%;">{$locale->tr("actions")}</th>
-   </tr>
-  </thead>
-  <tbody> 
-  {foreach from=$categories item=category}
-  <tr class="{cycle values="odd, even"}">
-   <td>
-      <input class="checkbox" type="checkbox" name="categoryIds[{counter}]" id="checks_{$category->getId()}" value="{$category->getId()}" />
-   </td>  
-   <td class="col_highlighted">
-    {check_perms adminperm=update_global_category}<a href="admin.php?op=editGlobalArticleCategory&amp;categoryId={$category->getId()}">{/check_perms}{$category->getName()}{check_perms adminperm=update_global_category}</a>{/check_perms}
-   </td>   
-  
-   <td>
-     <div class="list_action_button">
-      {check_perms adminperm=update_global_category}	
-       <a href="?op=editGlobalArticleCategory&amp;categoryId={$category->getId()}" title="{$locale->tr("edit")}">
-	     <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
-	   </a>
-       <a href="?op=deleteGlobalArticleCategory&amp;categoryId={$category->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>
+  {include file="$admintemplatepath/globalarticlecategories_table.template"}
  </div>
  <div id="list_action_bar">
-  {adminpager style=list}
   {check_perms adminperm=update_global_category}
   <input type="hidden" name="op" value="deleteGlobalArticleCategories"/>
   <input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>

Added: plog/trunk/templates/admin/globalarticlecategories_table.template
===================================================================
--- plog/trunk/templates/admin/globalarticlecategories_table.template	                        (rev 0)
+++ plog/trunk/templates/admin/globalarticlecategories_table.template	2008-03-14 07:44:18 UTC (rev 6230)
@@ -0,0 +1,35 @@
+ <table id="categories" class="info" summary="{$locale->tr("editArticleCategories")}">
+  <thead>
+   <tr>
+    <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('editGlobalArticleCategories');" /></th>
+    <th style="width:90%;">{$locale->tr("category")}</th>  
+    <th style="width:10%;">{$locale->tr("actions")}</th>
+   </tr>
+  </thead>
+  <tbody> 
+  {foreach from=$categories item=category}
+  <tr class="{cycle values="odd, even"}">
+   <td>
+      <input class="checkbox" type="checkbox" name="categoryIds[{counter}]" id="checks_{$category->getId()}" value="{$category->getId()}" />
+   </td>  
+   <td class="col_highlighted">
+    {check_perms adminperm=update_global_category}<a href="admin.php?op=editGlobalArticleCategory&amp;categoryId={$category->getId()}" rel="overlay">{/check_perms}{$category->getName()}{check_perms adminperm=update_global_category}</a>{/check_perms}
+   </td>   
+  
+   <td>
+     <div class="list_action_button">
+      {check_perms adminperm=update_global_category}	
+       <a rel="overlay" href="?op=editGlobalArticleCategory&amp;categoryId={$category->getId()}" title="{$locale->tr("edit")}">
+	     <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
+	   </a>
+       <a href="?op=deleteGlobalArticleCategory&amp;categoryId={$category->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/newglobalarticlecategory.template
===================================================================
--- plog/trunk/templates/admin/newglobalarticlecategory.template	2008-03-13 20:00:18 UTC (rev 6229)
+++ plog/trunk/templates/admin/newglobalarticlecategory.template	2008-03-14 07:44:18 UTC (rev 6230)
@@ -1,29 +1,7 @@
- <form name="addGlobalCategory" method="post" action="admin.php">
-  <fieldset class="inputField">
-   <legend>{$locale->tr("newGlobalArticleCategory")}</legend>
-   {include file="$admintemplatepath/formvalidate.template"}   
-   
-   <div class="field">
-    <label for="categoryName">{$locale->tr("name")}</label>
-    <span class="required">*</span><br/>
-    <div class="formHelp">{$locale->tr("global_category_name_help")}</div>     
-     <input type="text" value="{$categoryName}" id="categoryName" name="categoryName" />
-    {include file="$admintemplatepath/validate.template" field=categoryName message=$locale->tr("error_empty_name")}
-   </div>
-   
-   <div class="field">
-    <label for="categoryDescription">{$locale->tr("description")}</label>
-    <span class="required">*</span>
-    <div class="formHelp">{$locale->tr("global_category_description_help")}</div> 
-    <textarea name="categoryDescription" cols="60" id="categoryDescription" rows="5">{$categoryDescription}</textarea>
-    {include file="$admintemplatepath/validate.template" field=categoryDescription message=$locale->tr("error_empty_description")}  
-   </div>  
-   
-  </fieldset>
-  <div class="buttons">
-   <input type="hidden" value="" name="categoryUrl" />
-   <input type="hidden" name="op" value="addGlobalArticleCategory" />
-   <input type="reset" name="resetButton" value="{$locale->tr("reset")}" />
-   <input type="submit" name="Add" value="{$locale->tr("add")}" />
-  </div> 
- </form>
\ No newline at end of file
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=editGlobalArticleCategories title=$locale->tr("newGlobalArticleCategory")}
+
+{include file="$admintemplatepath/newglobalarticlecategory_form.template"}
+
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Added: plog/trunk/templates/admin/newglobalarticlecategory_form.template
===================================================================
--- plog/trunk/templates/admin/newglobalarticlecategory_form.template	                        (rev 0)
+++ plog/trunk/templates/admin/newglobalarticlecategory_form.template	2008-03-14 07:44:18 UTC (rev 6230)
@@ -0,0 +1,30 @@
+ <form id="newGlobalArticleCategory" method="post" action="admin.php" onSubmit="Lifetype.UI.Pages.GlobalArticleCategories.addSubmitHook(this);return(false);">
+  <fieldset class="inputField">
+   <legend>{$locale->tr("newGlobalArticleCategory")}</legend>
+   {include file="$admintemplatepath/formvalidateajax.template"}
+   
+   <div class="field">
+    <label for="categoryName">{$locale->tr("name")}</label>
+    <span class="required">*</span><br/>
+    <div class="formHelp">{$locale->tr("global_category_name_help")}</div>     
+     <input type="text" value="{$categoryName}" id="categoryName" name="categoryName" />
+     {include file="$admintemplatepath/validateajax.template" field=categoryName}
+    
+   </div>
+   
+   <div class="field">
+    <label for="categoryDescription">{$locale->tr("description")}</label>
+    <span class="required">*</span>
+    <div class="formHelp">{$locale->tr("global_category_description_help")}</div> 
+    <textarea name="categoryDescription" cols="60" id="categoryDescription" rows="5">{$categoryDescription}</textarea>
+    {include file="$admintemplatepath/validateajax.template" field=categoryDescription}
+   </div>  
+   
+  </fieldset>
+  <div class="buttons">
+   <input type="hidden" value="" name="categoryUrl" />
+   <input type="hidden" name="op" value="addGlobalArticleCategory" />
+   <input type="reset" name="resetButton" value="{$locale->tr("reset")}" />
+   <input type="submit" name="Add" value="{$locale->tr("add")}" />
+  </div> 
+ </form>
\ No newline at end of file



More information about the pLog-svn mailing list