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

mark at devel.lifetype.net mark at devel.lifetype.net
Thu Mar 13 07:35:57 EDT 2008


Author: mark
Date: 2008-03-13 07:35:57 -0400 (Thu, 13 Mar 2008)
New Revision: 6216

Added:
   plog/trunk/js/ui/pages/blogcategories.js
   plog/trunk/templates/admin/blogcategories_table.template
   plog/trunk/templates/admin/editblogcategory_form.template
   plog/trunk/templates/admin/newblogcategory_form.template
Modified:
   plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php
   plog/trunk/class/action/admin/adminblogcategoriesaction.class.php
   plog/trunk/class/action/admin/admineditblogcategoryaction.class.php
   plog/trunk/class/action/admin/adminnewblogcategoryaction.class.php
   plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php
   plog/trunk/class/view/admin/adminblogcategorieslistview.class.php
   plog/trunk/templates/admin/blogcategories.template
   plog/trunk/templates/admin/editblogcategory.template
   plog/trunk/templates/admin/editlinks_table.template
   plog/trunk/templates/admin/newblogcategory.template
Log:
Ajaxlize blogcategories admin panel.

Modified: plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php	2008-03-13 09:56:48 UTC (rev 6215)
+++ plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php	2008-03-13 11:35:57 UTC (rev 6216)
@@ -26,8 +26,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, "newblogcategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_adding_blog_category" ));			
@@ -39,7 +39,7 @@
         /**
          * Carries out the specified action
          */
-        function perform()
+        function addBlogCategory()
         {
 			// fetch the data, we already know it's valid and that we can trust it!
         	$this->_categoryName     = $this->_request->getValue( "categoryName" );
@@ -47,39 +47,71 @@
 		
 			// create the object...
             $categories = new BlogCategories();
-            $category   = new BlogCategory( $this->_categoryName, $this->_categoryDescription );
+            $this->_category   = new BlogCategory( $this->_categoryName, $this->_categoryDescription );
 											   
 			// fire the pre event...
-			$this->notifyEvent( EVENT_PRE_ADD_BLOG_CATEGORY, Array( "category" => &$category ));
+			$this->notifyEvent( EVENT_PRE_ADD_BLOG_CATEGORY, Array( "category" => &$this->_category ));
 
             // once we have built the object, we can add it to the database!
-            if( $categories->addBlogCategory( $category )) {
-				if( $this->userHasPermission( "view_blog_categories", ADMIN_PERMISSION )) 
-					$this->_view = new AdminBlogCategoriesListView( $this->_blogInfo );
-				else
-					$this->_view = new AdminTemplatedView( $this->_blogInfo, "newblogcategory" );
-				
-				$this->_view->setSuccess( true );
-				$this->_view->setSuccessMessage( $this->_locale->pr("blog_category_added_ok", $category->getName()));
-				
-				// fire the post event
-				$this->notifyEvent( EVENT_POST_ADD_BLOG_CATEGORY, Array( "category" => &$category ));
-				
-				// clear the cache if everything went fine
-				CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );														
-				
-				$this->setCommonData();
+            $result = $categories->addBlogCategory( $this->_category );
+
+			if( $result ) {
+				// notify event
+				$this->notifyEvent( EVENT_POST_ADD_BLOG_CATEGORY, Array( "category" => &$this->_category ));
+				// clear the cache				
+				CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );
+				// and set a message
+				$this->_message = $this->_locale->pr( "blog_category_added_ok", $this->_category->getName() );
+			}
+			else {
+				$this->_message = $this->_locale->tr( "error_adding_category" );
+			}
+
+			return( $result );
+        }
+
+        /**
+         * Carries out the specified action
+         */
+        function perform()
+        {
+			// if the user has no permission to view the links, the we have to find another view
+			if( $this->userHasPermission( "view_blog_categories" ))
+	            $this->_view = new AdminBlogCategoriesListView( $this->_blogInfo );
+			else
+                $this->_view = new AdminTemplatedView( $this->_blogInfo, "newblogcategory" );
+
+			$result = $this->addBlogCategory();
+													
+            if( !$result ) {
+				// set an error message
+                $this->_view->setErrorMessage( $this->_message);
             }
-            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->_view->setError( true );
-				$this->_view->setErrorMessage( $this->_locale->tr("error_adding_category" ));
-				$this->setCommonData( true );
-            }
+			else {
+				// or success
+				$this->_view->setSuccessMessage( $this->_message );	
+			}	
 
-            // better to return true if everything fine
+            $this->setCommonData();
+
             return true;
         }
+
+
+        /**
+         * Carries out the specified action
+         */
+		function performAjax()
+		{
+			$result = $this->addBlogCategory();
+			
+			$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/adminblogcategoriesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminblogcategoriesaction.class.php	2008-03-13 09:56:48 UTC (rev 6215)
+++ plog/trunk/class/action/admin/adminblogcategoriesaction.class.php	2008-03-13 11:35:57 UTC (rev 6216)
@@ -19,5 +19,13 @@
 			$this->_view = new AdminBlogCategoriesListView( $this->_blogInfo, Array( "searchTerms" => $searchTerms ));
 			$this->setCommonData();
 		}
+
+		/**
+		 * Ajax-specific behaviour
+		 */
+		function performAjax()
+		{
+			return( $this->perform());
+		}
 	}
 ?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/admineditblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditblogcategoryaction.class.php	2008-03-13 09:56:48 UTC (rev 6215)
+++ plog/trunk/class/action/admin/admineditblogcategoryaction.class.php	2008-03-13 11:35:57 UTC (rev 6216)
@@ -46,17 +46,23 @@
             $categories = new BlogCategories();
             $category   = $categories->getBlogCategory( $this->_categoryId);
             // show an error if we couldn't fetch the category
-            if( !$category ) {
-            	$this->_view = new AdminBlogCategoriesListView( $this->_blogInfo );
-                $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_category") );
-				$this->_view->setError( true );
+			if( !$category ) {
+				if( Request::isXHR())
+					$this->_view = new AdminErrorDialogView( $this->_blogInfo );
+				else
+					$this->_view = new AdminBlogCategoriesListView( $this->_blogInfo );
+
+                $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_category"));
                 $this->setCommonData();
-                return false;
-            }
+				return( false );
+			}
 			
 			$this->notifyEvent( EVENT_BLOG_CATEGORY_LOADED, Array( "category" => &$category ));			
             // otherwise show the form to edit its fields
-        	$this->_view = new AdminTemplatedView( $this->_blogInfo, "editblogcategory" );
+			if( Request::isXHR())
+        		$this->_view = new AdminTemplatedView( $this->_blogInfo, "editblogcategory_form" );
+			else
+				$this->_view = new AdminTemplatedView( $this->_blogInfo, "editblogcategory" );
             $this->_view->setValue( "category", $category );
 			$this->_view->setValue( "categoryName", $category->getName());
 			$this->_view->setValue( "categoryDescription", $category->getDescription());
@@ -66,5 +72,10 @@
             // better to return true if everything fine
            return true;
         }
+        
+        function performAjax()
+        {
+        	return( $this->perform());
+        }
     }
 ?>

Modified: plog/trunk/class/action/admin/adminnewblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewblogcategoryaction.class.php	2008-03-13 09:56:48 UTC (rev 6215)
+++ plog/trunk/class/action/admin/adminnewblogcategoryaction.class.php	2008-03-13 11:35:57 UTC (rev 6216)
@@ -29,7 +29,11 @@
         function perform()
         {
         	// initialize the view
-        	$this->_view = new AdminTemplatedView( $this->_blogInfo, "newblogcategory" );
+        	if( Request::isXHR() )
+        		$this->_view = new AdminTemplatedView( $this->_blogInfo, "newblogcategory_form" );
+        	else
+        		$this->_view = new AdminTemplatedView( $this->_blogInfo, "newblogcategory" );
+
             $this->setCommonData();
             return true;
         }

Modified: plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php	2008-03-13 09:56:48 UTC (rev 6215)
+++ plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php	2008-03-13 11:35:57 UTC (rev 6216)
@@ -46,7 +46,7 @@
         /**
          * Carries out the specified action
          */
-        function perform()
+        function updateBlogCategory()
         {
 			// get the data from the form
         	$this->_categoryName = $this->_request->getValue( "categoryName" );
@@ -56,44 +56,73 @@
 		
         	// fetch the category we're trying to update
             $categories = new BlogCategories();
-            $category   = $categories->getBlogCategory( $this->_categoryId );
-            if( !$category ) {
-            	$this->_view = new AdminBlogCategoriesListView( $this->_blogInfo );
-                $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_category"));
-                $this->setCommonData();
-
+            $this->_category   = $categories->getBlogCategory( $this->_categoryId );
+            if( !$this->_category ) {
+                $this->_message = $this->_locale->tr("error_fetching_category");
                 return false;
             }
 			
 			// fire the pre-event
-			$this->notifyEvent( EVENT_PRE_UPDATE_BLOG_CATEGORY, Array( "category" => &$category ));			
+			$this->notifyEvent( EVENT_PRE_UPDATE_BLOG_CATEGORY, Array( "category" => &$this->_category ));			
 
             // update the fields
-            $category->setName( $this->_categoryName );
-			$category->setProperties( $this->_properties );
-			$category->setDescription( $this->_categoryDescription );
+            $this->_category->setName( $this->_categoryName );
+			$this->_category->setProperties( $this->_properties );
+			$this->_category->setDescription( $this->_categoryDescription );
 			
-			// this is view we're going to use to show our messages
-			$this->_view = new AdminBlogCategoriesListView( $this->_blogInfo );			
-			
-            if( !$categories->updateBlogCategory( $category )) {
-                $this->_view->setErrorMessage( $this->_locale->tr("error_updating_article_category"));
+            if( !$categories->updateBlogCategory( $this->_category )) {
+                $this->_message = $this->_locale->tr("error_updating_article_category");
             }
 			else {
 				// if everything fine, load the list of categories
-				$this->_view->setSuccessMessage( $this->_locale->pr("article_category_updated_ok", $category->getName()));
+				$this->_message = $this->_locale->pr("blog_category_updated_ok", $this->_category->getName());
 				
 				// fire the post-event
-				$this->notifyEvent( EVENT_POST_UPDATE_BLOG_CATEGORY, Array( "category" => &$category ));			
+				$this->notifyEvent( EVENT_POST_UPDATE_BLOG_CATEGORY, Array( "category" => &$this->_category ));			
 				
 				// clear the cache
 				CacheControl::resetBlogCache( $this->_blogInfo->getId());			
 			}
 			
-			$this->setCommonData();			
-			
-            // better to return true if everything fine
             return true;
         }
+
+        /**
+         * Carries out the specified action
+         */
+        function perform()
+        {
+            $this->_view = new AdminBlogCategoriesListView( $this->_blogInfo );
+			$result = $this->updateBlogCategory();
+													
+            if( !$result ) {
+				// set an error message
+                $this->_view->setErrorMessage( $this->_message);
+            }
+			else {
+				// or success
+				$this->_view->setSuccessMessage( $this->_message );	
+			}	
+
+            $this->setCommonData();
+            return true;
+        }
+
+        /**
+         * Carries out the specified action
+         */
+		function performAjax()
+		{
+			$result = $this->updateBlogCategory();
+			
+			$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/view/admin/adminblogcategorieslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminblogcategorieslistview.class.php	2008-03-13 09:56:48 UTC (rev 6215)
+++ plog/trunk/class/view/admin/adminblogcategorieslistview.class.php	2008-03-13 11:35:57 UTC (rev 6216)
@@ -20,7 +20,12 @@
          */
         function AdminBlogCategoriesListView( $blogInfo, $params = Array())
         {
-        	$this->AdminTemplatedView( $blogInfo, "blogcategories" );
+			if( Request::isXHR())
+				$template = "blogcategories_table";
+			else
+        		$template = "blogcategories";
+
+        	$this->AdminTemplatedView( $blogInfo, $template );
 			
 			if( isset( $params['searchTerms']  )) 
 				$this->_searchTerms = $params['searchTerms'];

Added: plog/trunk/js/ui/pages/blogcategories.js
===================================================================
--- plog/trunk/js/ui/pages/blogcategories.js	                        (rev 0)
+++ plog/trunk/js/ui/pages/blogcategories.js	2008-03-13 11:35:57 UTC (rev 6216)
@@ -0,0 +1,21 @@
+Lifetype.UI.Pages.BlogCategories = function() {}
+
+Lifetype.UI.Pages.BlogCategories.addSubmitHook = function( form )
+{
+	Lifetype.Forms.AjaxFormProcessor( form.id,'?output=json', {resetAfterSuccess:true} );
+}
+
+Lifetype.UI.Pages.BlogCategories.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/blogcategories.template
===================================================================
--- plog/trunk/templates/admin/blogcategories.template	2008-03-13 09:56:48 UTC (rev 6215)
+++ plog/trunk/templates/admin/blogcategories.template	2008-03-13 11:35:57 UTC (rev 6216)
@@ -1,9 +1,10 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=editBlogCategories title=$locale->tr("editBlogCategories")}
-
-        <div id="list_nav_bar">
-            <div id="list_nav_select">
-			
+{js src="js/ui/plogui.js"}
+{js src="js/ui/pages/global.js"}
+{js src="js/ui/pages/blogcategories.js"}
+<div id="list_nav_bar">
+<div id="list_nav_select">
 <form id="viewLinkCategories" action="admin.php" method="post">
  <fieldset>
   <legend>{$locale->tr("show_by")}</legend>
@@ -39,50 +40,12 @@
 </div>
 <br style="clear:both" />
 {/check_perms} 			
- <form id="deleteBlogCategories" action="admin.php" method="post">
+ <form id="editBlogCategories" 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("editBlogCategories")}">
-  <thead>
-   <tr>
-    <th style="width:10px;"><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('deleteCategories');" /></th>
-    <th style="width:75%;">{$locale->tr("category")}</th>
-    <th style="width:15%;">{$locale->tr("blogs")}</th>
-    <th style="width:10%;">{$locale->tr("actions")}</th>
-   </tr>
-  </thead>
-  <tbody> 
-  {foreach from=$blogcategories item=blogcategory}
-  <tr class="{cycle values="odd, even"}">
-   <td>
-      <input class="checkbox" type="checkbox" name="categoryIds[{counter}]" id="checks_{$blogcategory->getId()}" value="{$blogcategory->getId()}" />
-   </td>  
-   <td class="col_highlighted">
-    {check_perms adminperm=update_blog_category}<a href="admin.php?op=editBlogCategory&amp;categoryId={$blogcategory->getId()}">{/check_perms}{$blogcategory->getName()}{check_perms adminperm=update_blog_category}{/check_perms}</a>
-   </td>
-   <td>
-    {$blogcategory->getNumBlogs()}
-   </td>	
-   <td>
-     <div class="list_action_button">
-	  {check_perms adminperm=update_blog_category}	
-       <a href="?op=editBlogCategory&amp;categoryId={$blogcategory->getId()}" title="{$locale->tr("edit")}">
-	     <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
-	   </a>
-       <a href="?op=deleteBlogCategory&amp;categoryId={$blogcategory->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/blogcategories_table.template"}
  </div>
  <div id="list_action_bar">
-  {adminpager style=list}
   {check_perms adminperm=update_blog_category}
   <input type="hidden" name="op" value="deleteBlogCategories"/>
   <input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>

Added: plog/trunk/templates/admin/blogcategories_table.template
===================================================================
--- plog/trunk/templates/admin/blogcategories_table.template	                        (rev 0)
+++ plog/trunk/templates/admin/blogcategories_table.template	2008-03-13 11:35:57 UTC (rev 6216)
@@ -0,0 +1,38 @@
+ <table id="categories" class="info" summary="{$locale->tr("editBlogCategories")}">
+  <thead>
+   <tr>
+    <th style="width:10px;"><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('editCategories');" /></th>
+    <th style="width:75%;">{$locale->tr("category")}</th>
+    <th style="width:15%;">{$locale->tr("blogs")}</th>
+    <th style="width:10%;">{$locale->tr("actions")}</th>
+   </tr>
+  </thead>
+  <tbody> 
+  {foreach from=$blogcategories item=blogcategory}
+  <tr class="{cycle values="odd, even"}">
+   <td>
+      <input class="checkbox" type="checkbox" name="categoryIds[{counter}]" id="checks_{$blogcategory->getId()}" value="{$blogcategory->getId()}" />
+   </td>  
+   <td class="col_highlighted">
+    {check_perms adminperm=update_blog_category}<a href="admin.php?op=editBlogCategory&amp;categoryId={$blogcategory->getId()}" rel="overlay">{/check_perms}{$blogcategory->getName()}{check_perms adminperm=update_blog_category}{/check_perms}</a>
+   </td>
+   <td>
+    {$blogcategory->getNumBlogs()}
+   </td>	
+   <td>
+     <div class="list_action_button">
+	  {check_perms adminperm=update_blog_category}	
+       <a rel="overlay" href="?op=editBlogCategory&amp;categoryId={$blogcategory->getId()}" title="{$locale->tr("edit")}">
+	     <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
+	   </a>
+       <a href="?op=deleteBlogCategory&amp;categoryId={$blogcategory->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/editblogcategory.template
===================================================================
--- plog/trunk/templates/admin/editblogcategory.template	2008-03-13 09:56:48 UTC (rev 6215)
+++ plog/trunk/templates/admin/editblogcategory.template	2008-03-13 11:35:57 UTC (rev 6216)
@@ -1,36 +1,7 @@
 {include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=editBlogCategories title=$locale->tr("editBlogCategories")}
+{include file="$admintemplatepath/navigation.template" showOpt=editBlogCategories title=$locale->tr("editBlogCategory")}
 
- <form name="editBlogCategory" action="admin.php" method="post">
+{include file="$admintemplatepath/editblogcategory_form.template"}
 
-  <fieldset class="inputField">
-   <legend>{$locale->tr("editBlogCategories")}</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="reset" name="resetButton" value="{$locale->tr("reset")}" />
-    <input type="submit" name="Update" value="{$locale->tr("update")}" />
-    <input type="hidden" name="op" value="updateBlogCategory" />
-    <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/editblogcategory_form.template
===================================================================
--- plog/trunk/templates/admin/editblogcategory_form.template	                        (rev 0)
+++ plog/trunk/templates/admin/editblogcategory_form.template	2008-03-13 11:35:57 UTC (rev 6216)
@@ -0,0 +1,30 @@
+ <form id="editBlogCategory" action="admin.php" method="post" onSubmit="Lifetype.UI.Pages.BlogCategories.updateSubmitHook(this);return(false);">
+
+  <fieldset class="inputField">
+   <legend>{$locale->tr("editBlogCategories")}</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="reset" name="resetButton" value="{$locale->tr("reset")}" />
+    <input type="submit" name="Update" value="{$locale->tr("update")}" />
+    <input type="hidden" name="op" value="updateBlogCategory" />
+    <input type="hidden" name="categoryId" value="{$categoryId}" />
+  </div>
+</form>
\ No newline at end of file

Modified: plog/trunk/templates/admin/editlinks_table.template
===================================================================
--- plog/trunk/templates/admin/editlinks_table.template	2008-03-13 09:56:48 UTC (rev 6215)
+++ plog/trunk/templates/admin/editlinks_table.template	2008-03-13 11:35:57 UTC (rev 6216)
@@ -37,8 +37,7 @@
        </a>
 	  {/check_perms}
 	  {check_perms perm="update_link"}
-        <a href="?op=deleteLink&amp;linkId={$link->getId()}"
- title="{$locale->tr("delete")}" onClick="Lifetype.Forms.performRequest(this);return(false)">
+        <a href="?op=deleteLink&amp;linkId={$link->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}

Modified: plog/trunk/templates/admin/newblogcategory.template
===================================================================
--- plog/trunk/templates/admin/newblogcategory.template	2008-03-13 09:56:48 UTC (rev 6215)
+++ plog/trunk/templates/admin/newblogcategory.template	2008-03-13 11:35:57 UTC (rev 6216)
@@ -1,28 +1,7 @@
- <form name="addBlogCategory" method="post" action="admin.php">
-  <fieldset class="inputField">
-   <legend>{$locale->tr("newBlogCategory")}</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" 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("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" name="op" value="addBlogCategory" />
-   <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=editBlogCategories title=$locale->tr("newBlogCategory")}
+
+{include file="$admintemplatepath/newblogcategory_form.template"}
+
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Added: plog/trunk/templates/admin/newblogcategory_form.template
===================================================================
--- plog/trunk/templates/admin/newblogcategory_form.template	                        (rev 0)
+++ plog/trunk/templates/admin/newblogcategory_form.template	2008-03-13 11:35:57 UTC (rev 6216)
@@ -0,0 +1,28 @@
+ <form id="addBlogCategory" method="post" action="admin.php" onSubmit="Lifetype.UI.Pages.BlogCategories.addSubmitHook(this);return(false);">
+  <fieldset class="inputField">
+   <legend>{$locale->tr("newBlogCategory")}</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" 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("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" name="op" value="addBlogCategory" />
+   <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