[pLog-svn] r5219 - in plog/branches/lifetype-1.2: js/ui locale/admin templates/admin

mark at devel.lifetype.net mark at devel.lifetype.net
Thu Mar 29 07:51:40 EDT 2007


Author: mark
Date: 2007-03-29 07:51:40 -0400 (Thu, 29 Mar 2007)
New Revision: 5219

Modified:
   plog/branches/lifetype-1.2/js/ui/default.js
   plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php
   plog/branches/lifetype-1.2/locale/admin/locale_zh_CN.php
   plog/branches/lifetype-1.2/locale/admin/locale_zh_TW.php
   plog/branches/lifetype-1.2/templates/admin/addbloguser.template
   plog/branches/lifetype-1.2/templates/admin/editbloguser.template
Log:
Add a quick permission selection for user to easily configure thier blog user permissions.

Modified: plog/branches/lifetype-1.2/js/ui/default.js
===================================================================
--- plog/branches/lifetype-1.2/js/ui/default.js	2007-03-29 09:02:58 UTC (rev 5218)
+++ plog/branches/lifetype-1.2/js/ui/default.js	2007-03-29 11:51:40 UTC (rev 5219)
@@ -97,6 +97,52 @@
     }
 }
 
+// In LifeType 1.2 imeplemtation, we don't have the Role object.
+// So, I just defined two kind of permission group here, it can help user configure thier blog user permission easily.
+var permissionSets = new Array();
+permissionSets["basic_blog_permission"] = new Array( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 36, 37 );
+permissionSets["full_blog_permission"] = new Array( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38 );
+
+function togglePermissionSets(formName, permissionSet)
+{
+	if(permissionSet == "")
+		return;
+
+    f = document.getElementById(formName);
+	i = 0;
+    while (e = f.elements[i])
+    {
+        if (e.type == "checkbox")
+        {
+            if( permissionSets[permissionSet].inArray(e.value) )
+            	e.checked = 1;
+            else
+            	e.checked = 0;
+        }
+        i++;
+    }
+}
+
+// Returns true if the passed value is found in the
+// array. Returns false if it is not.
+Array.prototype.inArray = function (value, caseSensitive)
+{
+	var i;
+	for (i=0; i < this.length; i++) {
+		// use === to check for Matches. ie., identical (===),
+		if(caseSensitive){ //performs match even the string is case sensitive
+			if (this[i].toLowerCase() == value.toLowerCase()) {
+				return true;
+			}
+		}else{
+			if (this[i] == value) {
+				return true;
+			}
+		}
+	}
+	return false;
+};
+
 function confirmDlg(l, msg)
 {
     if (confirm(msg))

Modified: plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php	2007-03-29 09:02:58 UTC (rev 5218)
+++ plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php	2007-03-29 11:51:40 UTC (rev 5219)
@@ -1162,4 +1162,8 @@
 $messages['help_resources_naming_rule'] = 'The file naming rules for uploaded resources. \'Original File Name\' use original file for uploaded resources. \'Encoded File Name\' use the encoded file name for uploaded resources, the naming rule is [BlogId]-[ResourceId].[Ext]. Please use \'Encoded File Name\' if you install LifeType under Multi-Byte Microsoft Windows environment. <strong>And please don\'t change this option after users start uploading the files into LifeType. It will make uploaded files can\'t be accessed anymore.</strong> [Default = Original File Name]';
 $messages['original_file_name'] = 'Original File Name';
 $messages['encoded_file_name'] = 'Encoded File Name';
+
+$messages['quick_permission_selection'] = 'Quick permission selection';
+$messages['basic_blog_permission'] = 'Allow blog user add, update and delete posts, links and resources';
+$messages['full_blog_permission'] = 'Allow blog user access all blog functions as blog owner';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_zh_CN.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_zh_CN.php	2007-03-29 09:02:58 UTC (rev 5218)
+++ plog/branches/lifetype-1.2/locale/admin/locale_zh_CN.php	2007-03-29 11:51:40 UTC (rev 5219)
@@ -1162,4 +1162,8 @@
 $messages['help_resources_naming_rule'] = '选择档案上传后在主机的储存方式。“原始档案名称”使用原来的档案名称来储存上传的档案。“编码档案名称”使用编码过的档案名称 [BlogId]-[ResourceId].[Ext] 来储存上传的档案。在 Windows 多字元下安装 LifeType 请使用“编码档案名称”。<strong>另外,当使用者开始上传档案后,请勿修改此选项,这会造成以上传的档案无法再被读取。</strong> [预设 = 原始档案名称]';
 $messages['original_file_name'] = '原始档案名称';
 $messages['encoded_file_name'] = '编码档案名称';
+
+$messages['quick_permission_selection'] = '快速权限设定选单';
+$messages['basic_blog_permission'] = '博客作者可以新增、编修与删除文章、链接与文件';
+$messages['full_blog_permission'] = '博客作者可以跟博客拥有者一样,操作所有功能';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_zh_TW.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_zh_TW.php	2007-03-29 09:02:58 UTC (rev 5218)
+++ plog/branches/lifetype-1.2/locale/admin/locale_zh_TW.php	2007-03-29 11:51:40 UTC (rev 5219)
@@ -1162,4 +1162,8 @@
 $messages['help_resources_naming_rule'] = '選擇檔案上傳後在主機的儲存方式。「原始檔案名稱」使用原來的檔案名稱來儲存上傳的檔案。「編碼檔案名稱」使用編碼過的檔案名稱 [BlogId]-[ResourceId].[Ext] 來儲存上傳的檔案。在 Windows 多字元下安裝 LifeType 請使用「編碼檔案名稱」。<strong>另外,當使用者開始上傳檔案後,請勿修改此選項,這會造成以上傳的檔案無法再被讀取。</strong> [預設 = 原始檔案名稱]';
 $messages['original_file_name'] = '原始檔案名稱';
 $messages['encoded_file_name'] = '編碼檔案名稱';
+
+$messages['quick_permission_selection'] = '快速權限設定選單';
+$messages['basic_blog_permission'] = '網誌作者可以新增、編修與刪除文章、連結與檔案';
+$messages['full_blog_permission'] = '網誌作者可以跟網誌擁有者一樣,操作所有功能';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/templates/admin/addbloguser.template
===================================================================
--- plog/branches/lifetype-1.2/templates/admin/addbloguser.template	2007-03-29 09:02:58 UTC (rev 5218)
+++ plog/branches/lifetype-1.2/templates/admin/addbloguser.template	2007-03-29 11:51:40 UTC (rev 5219)
@@ -1,7 +1,7 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=newBlogUser title=$locale->tr("newBlogUser")}
 
- <form name="addBlogUser" action="admin.php" method="post">
+ <form name="addBlogUser" id="addBlogUser" action="admin.php" method="post">
    <fieldset class="inputField">
   
      <legend>{$locale->tr("newBlogUser")}</legend>
@@ -32,6 +32,13 @@
      <div class="field">
       <label for="perm">{$locale->tr("permissions")}</label>
       <div class="formHelp">{$locale->tr("blog_user_permissions_help")}</div>     
+        {$locale->tr("quick_permission_selection")}
+        </br>
+        <select name="preselection" onChange="togglePermissionSets('addBlogUser', this.value);">
+          <option value=""/>{$locale->tr("select")}</option>
+          <option value="basic_blog_permission"/>{$locale->tr("basic_blog_permission")}</option>
+          <option value="full_blog_permission"/>{$locale->tr("full_blog_permission")}</option>
+        </select><br/>
      	{foreach from=$perms item=permission}
      	 {if !$permission->isAdminOnlyPermission()}
   		   {assign var=permId value=$permission->getId()}

Modified: plog/branches/lifetype-1.2/templates/admin/editbloguser.template
===================================================================
--- plog/branches/lifetype-1.2/templates/admin/editbloguser.template	2007-03-29 09:02:58 UTC (rev 5218)
+++ plog/branches/lifetype-1.2/templates/admin/editbloguser.template	2007-03-29 11:51:40 UTC (rev 5219)
@@ -1,7 +1,7 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=showBlogUsers title=$locale->tr("editBlogUser")}
 
- <form name="editBlogUser" action="admin.php" method="post">
+ <form name="editBlogUser" id="editBlogUser" action="admin.php" method="post">
    <fieldset class="inputField">
   
      <legend>{$locale->tr("newBlogUser")}</legend>
@@ -16,7 +16,14 @@
      <div class="field">
       <label for="perm">{$locale->tr("permissions")}</label>
       <span class="required"></span>
-      <div class="formHelp">{$locale->tr("blog_user_permissions_help")}</div>     
+      <div class="formHelp">{$locale->tr("blog_user_permissions_help")}</div>
+        {$locale->tr("quick_permission_selection")}
+        </br>
+        <select name="preselection" onChange="togglePermissionSets('editBlogUser', this.value);">
+          <option value=""/>{$locale->tr("select")}</option>
+          <option value="basic_blog_permission"/>{$locale->tr("basic_blog_permission")}</option>
+          <option value="full_blog_permission"/>{$locale->tr("full_blog_permission")}</option>
+        </select><br/>     
      	{foreach from=$perms item=perm}
      	 {if !$perm->isAdminOnlyPermission()}
      	 <input type="checkbox" class="checkbox" name="perm[]" value="{$perm->getId()}" {if $edituser->hasPermissionByName($perm->getName(),$blog->getId())}checked="checked"{/if}/>



More information about the pLog-svn mailing list