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

oscar at devel.lifetype.net oscar at devel.lifetype.net
Thu Jul 26 16:22:45 EDT 2007


Author: oscar
Date: 2007-07-26 16:22:45 -0400 (Thu, 26 Jul 2007)
New Revision: 5732

Added:
   plog/trunk/templates/admin/jslocale.template
Modified:
   plog/trunk/js/ui/core.js
   plog/trunk/js/ui/pages/comments.js
   plog/trunk/js/ui/pages/global.js
   plog/trunk/js/ui/pages/posts.js
   plog/trunk/js/ui/pages/resources.js
   plog/trunk/js/ui/plogui.js
   plog/trunk/templates/admin/editcomments.template
   plog/trunk/templates/admin/editlinks.template
   plog/trunk/templates/admin/editposts.template
   plog/trunk/templates/admin/header.template
   plog/trunk/templates/admin/resources.template
   plog/trunk/templates/admin/siteblogs.template
   plog/trunk/templates/admin/siteusers.template
Log:
Proper localization for our Javascript code. Global variables used to hold strings are forbidden from now on.


Modified: plog/trunk/js/ui/core.js
===================================================================
--- plog/trunk/js/ui/core.js	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/js/ui/core.js	2007-07-26 20:22:45 UTC (rev 5732)
@@ -163,7 +163,7 @@
  */
 Lifetype.Locale.add = function( key, value )
 {
-	return( this.setValue( key, value ));
+	return( Lifetype.Locale.setValue( key, value ));
 }
 
 /**
@@ -171,5 +171,10 @@
  */
 Lifetype.Locale.tr = function( key )
 {
-	return( this.getValue( key ));
+	return( Lifetype.Locale.getValue( key ));
 }
+
+/**
+ * Shorthand for Lifetype.Locale.tr
+ */
+var tr = Lifetype.Locale.tr;
\ No newline at end of file

Modified: plog/trunk/js/ui/pages/comments.js
===================================================================
--- plog/trunk/js/ui/pages/comments.js	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/js/ui/pages/comments.js	2007-07-26 20:22:45 UTC (rev 5732)
@@ -3,7 +3,7 @@
 Lifetype.UI.Pages.Comments.submitCommentsList = function(op)
 {
 	if ( document.getElementById("postCommentsList").commentStatus.value == -1 )
-    	window.alert(errorCommentStatusMsg);
+    	window.alert(tr('error_comment_status'));
 	else {
 		// save the old value of the "op" parameter
 		var oldOp = document.getElementById("postCommentsList").op.value;

Modified: plog/trunk/js/ui/pages/global.js
===================================================================
--- plog/trunk/js/ui/pages/global.js	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/js/ui/pages/global.js	2007-07-26 20:22:45 UTC (rev 5732)
@@ -9,14 +9,14 @@
 	if ( Lifetype.Dom.$('massiveChangeOption').style.display == 'none' )
 	{
 		Lifetype.Dom.show( 'massiveChangeOption' );
-		Lifetype.Dom.$('optionIconLink').innerHTML = hideMassiveChangeOption;
-		Lifetype.Dom.$('optionIconLink').title = hideMassiveChangeOption;
+		Lifetype.Dom.$('optionIconLink').innerHTML = tr('hide_massive_change_option');
+		Lifetype.Dom.$('optionIconLink').title = tr('hide_massive_change_option');
 	}
 	else
 	{
 		Lifetype.Dom.hide( 'massiveChangeOption' );
-		Lifetype.Dom.$('optionIconLink').innerHTML = showMassiveChangeOption;
-		Lifetype.Dom.$('optionIconLink').title = showMassiveChangeOption;
+		Lifetype.Dom.$('optionIconLink').innerHTML = tr('show_massive_change_option');
+		Lifetype.Dom.$('optionIconLink').title = tr('show_massive_change_option');
 	}
 }
 

Modified: plog/trunk/js/ui/pages/posts.js
===================================================================
--- plog/trunk/js/ui/pages/posts.js	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/js/ui/pages/posts.js	2007-07-26 20:22:45 UTC (rev 5732)
@@ -12,7 +12,7 @@
 	
 	if ( op == 'changePostsStatus' ) {
 		if ( document.getElementById("postsList").postStatus.value == -1 )
-	    	window.alert(errorPostStatusMsg);
+	    	window.alert(tr('error_post_status'));
 		else {
 			document.getElementById("postsList").op.value = op;
 
@@ -25,7 +25,7 @@
 	}
 	else if( op == 'changePostsLocation' ) {
 		if ( document.getElementById("postsList").postLocation.value == -1 ) {
-	    	window.alert(errorPostLocationMsg);
+	    	window.alert(tr('error_post_location'));
 		}
 		else {
 			document.getElementById("postsList").op.value = op;
@@ -37,7 +37,7 @@
 	else if( op == 'changePostsCategory' ) {
 		//if ( document.getElementById("postsList").postLocation.value == -1 ) {
         if( !Lifetype.Forms.List.atLeastOneSelected( "postCategories" )) {
-	    	window.alert(errorPostCategoryMsg);
+	    	window.alert(tr('error_no_category_selected'));
 		}
 		else {
 			document.getElementById("postsList").op.value = op;

Modified: plog/trunk/js/ui/pages/resources.js
===================================================================
--- plog/trunk/js/ui/pages/resources.js	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/js/ui/pages/resources.js	2007-07-26 20:22:45 UTC (rev 5732)
@@ -89,7 +89,7 @@
 {
 	if( op == 'changeResourceLocation' ) {
 		if ( document.getElementById("Resources").resourceLocation.value == -1 ) {
-    		window.alert(errorLocationMsg);
+    		window.alert(tr('error_post_location'));
 		}
 	}
 

Modified: plog/trunk/js/ui/plogui.js
===================================================================
--- plog/trunk/js/ui/plogui.js	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/js/ui/plogui.js	2007-07-26 20:22:45 UTC (rev 5732)
@@ -1,7 +1,7 @@
 function submitBlogsList(op)
 {
 	if ( document.getElementById("blogStatus").value == -1 )
-		window.alert(errorStatusMsg);
+		window.alert(tr('error_select_status'));
 	else {
 		document.getElementById("editBlogs").op.value = op;
 		document.getElementById("editBlogs").submit();
@@ -11,7 +11,7 @@
 function submitUsersList(op)
 {
 	if ( document.getElementById("userStatus").value == -1 )
-		window.alert(errorStatusMsg);
+		window.alert(tr('error_select_status'));
 	else {
 		document.getElementById("siteUsers").op.value = op;
 		document.getElementById("siteUsers").submit();

Modified: plog/trunk/templates/admin/editcomments.template
===================================================================
--- plog/trunk/templates/admin/editcomments.template	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/templates/admin/editcomments.template	2007-07-26 20:22:45 UTC (rev 5732)
@@ -2,11 +2,6 @@
 {include file="$admintemplatepath/navigation.template" showOpt=editComments title=$locale->tr("editComments")}
 {js src="js/ui/pages/global.js"}
 {js src="js/ui/pages/comments.js"}
-<script type="text/javascript">
-		var errorCommentStatusMsg = '{$locale->tr("error_comment_status")}';
-		var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
-		var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
-</script>
         <div id="list_nav_bar">
             <div id="list_nav_select">		
 
@@ -92,4 +87,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/editlinks.template
===================================================================
--- plog/trunk/templates/admin/editlinks.template	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/templates/admin/editlinks.template	2007-07-26 20:22:45 UTC (rev 5732)
@@ -3,15 +3,6 @@
  <script type="text/javascript" src="js/ui/plogui.js"></script>
 {js src="js/ui/pages/global.js"}
 {js src="js/ui/pages/links.js"}
-  <script type="text/javascript">
-    var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
-    var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
-  </script>
-<script type="text/javascript">
-{literal}
-
-{/literal}
-</script>
 <div id="list_nav_bar">
 <div id="list_nav_select">
 <form id="viewLinks" action="admin.php" method="post">

Modified: plog/trunk/templates/admin/editposts.template
===================================================================
--- plog/trunk/templates/admin/editposts.template	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/templates/admin/editposts.template	2007-07-26 20:22:45 UTC (rev 5732)
@@ -2,14 +2,7 @@
 {include file="$admintemplatepath/navigation.template" showOpt=editPosts title=$locale->tr("editPosts")}
 {js src="js/ui/pages/global.js"}
 {js src="js/ui/pages/posts.js"}
-	<script type="text/javascript" src="js/ui/plogui.js"></script>
-	<script type="text/javascript">
-		var errorPostStatusMsg = '{$locale->tr("error_post_status")}';
-		var errorPostLocationMsg = '{$locale->tr("error_post_location")}';
-        var errorPostCategoryMsg = '{$locale->tr("error_no_category_selected")}';
-		var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
-		var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
-	</script>
+
 		  <div id="list_nav_bar">
             <div id="list_nav_select">
                 <form id="showBy" action="admin.php" method="post">

Modified: plog/trunk/templates/admin/header.template
===================================================================
--- plog/trunk/templates/admin/header.template	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/templates/admin/header.template	2007-07-26 20:22:45 UTC (rev 5732)
@@ -55,6 +55,7 @@
   <link rel="stylesheet" href="js/JSCookMenu/ThemeOffice/theme.css" type="text/css" />
   {js src="js/JSCookMenu/ThemeOffice/theme.js"}
 {/if}
+{include file="$admintemplatepath/jslocale.template"}
 </head>
 <body>
 

Added: plog/trunk/templates/admin/jslocale.template
===================================================================
--- plog/trunk/templates/admin/jslocale.template	                        (rev 0)
+++ plog/trunk/templates/admin/jslocale.template	2007-07-26 20:22:45 UTC (rev 5732)
@@ -0,0 +1,21 @@
+<script type="text/javascript">
+
+// bulk edit
+Lifetype.Locale.add( "show_massive_change_option", '{$locale->tr("show_massive_change_option")}' );
+Lifetype.Locale.add( 'hide_massive_change_option', '{$locale->tr("hide_massive_change_option")}');
+
+// editposts.template
+Lifetype.Locale.add( 'error_post_status', '{$locale->tr("error_post_status")}' );
+Lifetype.Locale.add( 'error_post_location', '{$locale->tr("error_post_location")}' );
+Lifetype.Locale.add( 'error_no_category_selected', '{$locale->tr("error_no_category_selected")}' );
+
+// editcomments.template
+Lifetype.Locale.add( 'error_comment_status', '{$locale->tr("error_comment_status")}' );
+
+// resources.template
+Lifetype.Locale.add( 'error_post_location', '{$locale->tr("error_post_location")}' );
+
+// siteblogs.template
+Lifetype.Locale.add( 'error_select_status', '{$locale->tr("error_select_status")}' );
+
+</script>
\ No newline at end of file

Modified: plog/trunk/templates/admin/resources.template
===================================================================
--- plog/trunk/templates/admin/resources.template	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/templates/admin/resources.template	2007-07-26 20:22:45 UTC (rev 5732)
@@ -3,12 +3,6 @@
 {js src="js/ui/pages/global.js"}
 {js src="js/ui/pages/resources.js"}
 {js src="js/ui/pages/newresourcealbum.js"}
-<script type="text/javascript" src="js/ui/plogui.js"></script>
-  <script type="text/javascript">
-    var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
-    var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
-	var errorLocationMsg = '{$locale->tr("error_post_location")}';
-  </script>
 <div id="list_nav_bar">
 <div id="list_nav_select">
 <form id="viewResources" action="admin.php" method="post">

Modified: plog/trunk/templates/admin/siteblogs.template
===================================================================
--- plog/trunk/templates/admin/siteblogs.template	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/templates/admin/siteblogs.template	2007-07-26 20:22:45 UTC (rev 5732)
@@ -1,12 +1,6 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=editSiteBlogs title=$locale->tr("editSiteBlogs")}
 {js src="js/ui/pages/global.js"}
-<script type="text/javascript" src="js/ui/plogui.js"></script>
-<script type="text/javascript">
-	var errorStatusMsg = '{$locale->tr("error_select_status")}';
-	var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
-	var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
-</script>
         <div id="list_nav_bar">
             <div id="list_nav_select">
             

Modified: plog/trunk/templates/admin/siteusers.template
===================================================================
--- plog/trunk/templates/admin/siteusers.template	2007-07-26 04:26:25 UTC (rev 5731)
+++ plog/trunk/templates/admin/siteusers.template	2007-07-26 20:22:45 UTC (rev 5732)
@@ -3,11 +3,6 @@
 <script type="text/javascript" src="js/ui/plogui.js"></script>
 {js src="js/ui/pages/global.js"}
 <script type="text/javascript">
-	var errorStatusMsg = '{$locale->tr("error_select_status")}';
-	var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
-	var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
-</script>
-<script type="text/javascript">
 {literal}
 YAHOO.util.Event.addListener( window, "load", function() {
 		var t = new Lifetype.UI.TableEffects( "list" );
@@ -17,8 +12,7 @@
 {/literal}
 </script>
         <div id="list_nav_bar">
-            <div id="list_nav_select">
-            
+            <div id="list_nav_select">            
 <form id="viewUsers" action="admin.php" method="post">
  <fieldset>
   <legend>{$locale->tr("show_by")}</legend>



More information about the pLog-svn mailing list