[pLog-svn] r5935 - in plog/trunk: js/ui/pages templates/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sat Sep 15 07:59:20 EDT 2007


Author: oscar
Date: 2007-09-15 07:59:20 -0400 (Sat, 15 Sep 2007)
New Revision: 5935

Modified:
   plog/trunk/js/ui/pages/templateeditor.js
   plog/trunk/templates/admin/blogtemplates.template
   plog/trunk/templates/admin/blogtemplates_table.template
   plog/trunk/templates/admin/header.template
   plog/trunk/templates/admin/jslocale.template
Log:
Added a button to show/hide the global templates in the "blog templates" page.


Modified: plog/trunk/js/ui/pages/templateeditor.js
===================================================================
--- plog/trunk/js/ui/pages/templateeditor.js	2007-09-15 11:45:13 UTC (rev 5934)
+++ plog/trunk/js/ui/pages/templateeditor.js	2007-09-15 11:59:20 UTC (rev 5935)
@@ -110,6 +110,26 @@
 	var v = Lifetype.UI.Prompt.OkCancelPrompt.show( tr('enter_new_template_name'), { handleOk:Lifetype.UI.Pages.TemplateEditor.handleCopyTemplateOk });	
 }
 
+/**
+ * Callback used for the 'copy template set' prompt, but on the blog side (which is slightly different from the one above)
+ */
+Lifetype.UI.Pages.TemplateEditor.handleCopyBlogTemplateOk = function( value )
+{
+	if( value != "" ) {
+		var url = '?op=copyBlogTemplateSet&templateId=' + Lifetype.UI.Pages.TemplateEditor.copySourceTemplate + 
+		          '&destTemplate=' + value;
+		Lifetype.Forms.performUrl( url );
+	}	
+	
+	Lifetype.UI.Pages.TemplateEditor.copySourceTemplate	 = null;	
+}
+
+Lifetype.UI.Pages.TemplateEditor.showCopyBlogTemplatePrompt = function( sourceTemplate )
+{
+	Lifetype.UI.Pages.TemplateEditor.copySourceTemplate	= sourceTemplate;
+	var v = Lifetype.UI.Prompt.OkCancelPrompt.show( tr('enter_new_template_name'), { handleOk:Lifetype.UI.Pages.TemplateEditor.handleCopyBlogTemplateOk });	
+}
+
 Lifetype.UI.Pages.TemplateEditor.templateFileUploadHandler = function( form )
 {
 	var pathField = document.createElement( 'input' );
@@ -129,6 +149,29 @@
 	return( true );
 }
 
+/**
+ * Shows/hides the global templates in the blog templates page
+ */
+Lifetype.UI.Pages.TemplateEditor.toggleGlobalTemplates = function()
+{
+	if( Lifetype.UISettings.getValue( 'showGlobalTemplates' ) == null || Lifetype.UISettings.getValue( 'showGlobalTemplates') == 1 ) {
+		// hide them
+		var globalTemplates = YAHOO.util.Dom.getElementsByClassName( 'global-template', 'div', 'list', function( e ) {
+			e.style.display = 'none';
+		});
+		Lifetype.UISettings.setValue( 'showGlobalTemplates', 0 );
+		Lifetype.Dom.$( 'toggleGlobalTemplates' ).firstChild.nodeValue = tr( 'show_global_templates' );		
+	}
+	else {
+		// show them
+		var globalTemplates = YAHOO.util.Dom.getElementsByClassName( 'global-template', 'div', 'list', function( e ) {
+			e.style.display = 'block';
+		});
+		Lifetype.UISettings.setValue( 'showGlobalTemplates', 1 );
+		Lifetype.Dom.$( 'toggleGlobalTemplates' ).firstChild.nodeValue = tr( 'hide_global_templates' );
+	}	
+}
+
 YAHOO.util.Event.addListener( window, "load", function() {
 	var t = new Lifetype.Effects.Table( "templateFiles" );
 	t.stripe();

Modified: plog/trunk/templates/admin/blogtemplates.template
===================================================================
--- plog/trunk/templates/admin/blogtemplates.template	2007-09-15 11:45:13 UTC (rev 5934)
+++ plog/trunk/templates/admin/blogtemplates.template	2007-09-15 11:59:20 UTC (rev 5935)
@@ -4,6 +4,7 @@
 {check_perms perm=add_blog_template}
 <div class="extraFunctions">
 <div class="left">		
+  <a id="toggleGlobalTemplates" href="#" onClick="Lifetype.UI.Pages.TemplateEditor.toggleGlobalTemplates();return(false);">{$locale->tr("hide_global_templates")}</a> |
   <a id="newBlogTemplate" href="?op=newBlogTemplate" rel="overlay">{$locale->tr("newBlogTemplate")}</a>
 </div>
 {/check_perms}
@@ -21,4 +22,4 @@
  </div -->
  </form>
 {include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Modified: plog/trunk/templates/admin/blogtemplates_table.template
===================================================================
--- plog/trunk/templates/admin/blogtemplates_table.template	2007-09-15 11:45:13 UTC (rev 5934)
+++ plog/trunk/templates/admin/blogtemplates_table.template	2007-09-15 11:59:20 UTC (rev 5935)
@@ -1,5 +1,5 @@
 {foreach from=$templates item=blogtemplate}
- <div class="template-screenshot">
+ <div class="template-screenshot{if $blogtemplate->isGlobal()} global-template{/if}">
 	<input style="display:none" type="checkbox" name="templateIds[{counter}]" value="{$blogtemplate->getName()}" />
 	<span style="font-weight:bold;font-size:1.1em">{$blogtemplate->getName()}</span>
 	{if $blogtemplate->hasScreenshot()}
@@ -9,9 +9,9 @@
 	{/if}
 	<br/>
     {check_perms perm=update_blog_template}		
-  	  <a href="?op=editBlogTemplate&templateId={$blogtemplate->getName()}">{$locale->tr("edit")}</a> |
-	  <a href="#" onClick="Lifetype.UI.Pages.TemplateEditor.showCopyBlogTemplatePrompt('{$blogtemplate->getName()}');return(false);">{$locale->tr("copy")}</a> | 
-	  <a href="?op=deleteBlogTemplate&amp;templateId={$blogtemplate->getName()}" onClick="Lifetype.Forms.performRequest(this);return(false);">{$locale->tr("delete")}</a>
+  	  {if $blogtemplate->isBlogSpecific()}<a href="?op=editBlogTemplate&templateId={$blogtemplate->getName()}">{$locale->tr("edit")}</a> |{/if}
+	  <a href="#" onClick="Lifetype.UI.Pages.TemplateEditor.showCopyBlogTemplatePrompt('{$blogtemplate->getName()}');return(false);">{$locale->tr("copy")}</a> 
+	  {if $blogtemplate->isBlogSpecific()}| <a href="?op=deleteBlogTemplate&amp;templateId={$blogtemplate->getName()}" onClick="Lifetype.Forms.performRequest(this);return(false);">{$locale->tr("delete")}</a>{/if}
 	{/check_perms}
  </div>
 {/foreach}
\ No newline at end of file

Modified: plog/trunk/templates/admin/header.template
===================================================================
--- plog/trunk/templates/admin/header.template	2007-09-15 11:45:13 UTC (rev 5934)
+++ plog/trunk/templates/admin/header.template	2007-09-15 11:59:20 UTC (rev 5935)
@@ -35,6 +35,7 @@
 {js src="js/ui/contentoverlay.js"}
 {js src="js/ui/menu.js"}
 {js src="js/cookie/cookie.js"}
+{js src="js/ui/uisettings.js"}
 {if $location_data_enabled}
 {js src="js/location/selector.js"}
 {/if}

Modified: plog/trunk/templates/admin/jslocale.template
===================================================================
--- plog/trunk/templates/admin/jslocale.template	2007-09-15 11:45:13 UTC (rev 5934)
+++ plog/trunk/templates/admin/jslocale.template	2007-09-15 11:59:20 UTC (rev 5935)
@@ -35,4 +35,6 @@
 Lifetype.Locale.add( 'cancel', '{$locale->tr("cancel")}');
 Lifetype.Locale.add( 'enter_template_folder_name', '{$locale->tr("enter_template_folder_name")}');
 Lifetype.Locale.add( 'enter_new_template_file_name', '{$locale->tr("enter_new_template_file_name")}');
+Lifetype.Locale.add( 'hide_global_templates', '{$locale->tr("hide_global_templates")}');
+Lifetype.Locale.add( 'show_global_templates', '{$locale->tr("show_global_templates")}');
 </script>
\ No newline at end of file



More information about the pLog-svn mailing list