[vhffs-dev] [385] Fixed bug #183, Show/hide is now permanent between pages |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 385
Author: beuss
Date: 2006-12-22 23:50:27 +0000 (Fri, 22 Dec 2006)
Log Message:
-----------
Fixed bug #183, Show/hide is now permanent between pages
Modified Paths:
--------------
branches/vhffs_4.1/vhffs-panel/functions.js
branches/vhffs_4.1/vhffs-panel/templates/admin/main/main.tmpl
branches/vhffs_4.1/vhffs-panel/templates/group/menu.tmpl
branches/vhffs_4.1/vhffs-panel/templates/menu/group.tmpl
Modified: branches/vhffs_4.1/vhffs-panel/functions.js
===================================================================
--- branches/vhffs_4.1/vhffs-panel/functions.js 2006-12-22 09:20:23 UTC (rev 384)
+++ branches/vhffs_4.1/vhffs-panel/functions.js 2006-12-22 23:50:27 UTC (rev 385)
@@ -8,3 +8,38 @@
}
}
+function ToggleMenuItem( id ) {
+ var item = document.getElementById( id );
+ if(item.style.display == 'none') {
+ document.cookie = id + '=1;path=/';
+ item.style.display = '';
+ } else {
+ document.cookie = id + '=0;path=/';
+ item.style.display = 'none';
+ }
+}
+
+function InitMenu() {
+ var menus = [ 'adminMenu', 'projectMenu', 'projectConfigurationMenu' ];
+ for(var i = 0 ; i < menus.length ; ++i) {
+ var menu = menus[i];
+ var el = document.getElementById(menu);
+ if(el && ReadCookie(menu) === "0") {
+ el.style.display = 'none';
+ }
+ }
+}
+
+function ReadCookie(name) {
+ var start,end;
+ start = document.cookie.indexOf(name + "=")
+ if(start >= 0) {
+ start += name.length + 1
+ end = document.cookie.indexOf(";",start)
+ if (end < 0) end = document.cookie.length
+ return unescape(document.cookie.substring(start,end))
+ }
+ return ""
+}
+
+window.onload = InitMenu;
Modified: branches/vhffs_4.1/vhffs-panel/templates/admin/main/main.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/admin/main/main.tmpl 2006-12-22 09:20:23 UTC (rev 384)
+++ branches/vhffs_4.1/vhffs-panel/templates/admin/main/main.tmpl 2006-12-22 23:50:27 UTC (rev 385)
@@ -1,5 +1,5 @@
<p class="title">
-<tmpl_var name="MENU_TITLE"> (<a href="javascript:ShowHideId('adminMenu')" class="smalllink"><tmpl_var name="SHOW_HIDE"></a>)
+<tmpl_var name="MENU_TITLE"> (<a href="javascript:ToggleMenuItem('adminMenu')" class="smalllink"><tmpl_var name="SHOW_HIDE"></a>)
</p>
<ul id="adminMenu">
<tmpl_var name="ADMIN_GENERAL">
Modified: branches/vhffs_4.1/vhffs-panel/templates/group/menu.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/group/menu.tmpl 2006-12-22 09:20:23 UTC (rev 384)
+++ branches/vhffs_4.1/vhffs-panel/templates/group/menu.tmpl 2006-12-22 23:50:27 UTC (rev 385)
@@ -1,6 +1,6 @@
<li id="project">
<tmpl_var name="TEXT_MYPROJECTS">
- <a href="javascript:ShowHideId('projectMenu')" class="smalllink">(<tmpl_var name="SHOW_HIDE">)</a>
+ <a href="javascript:ToggleMenuItem('projectMenu')" class="smalllink">(<tmpl_var name="SHOW_HIDE">)</a>
<ul id="projectMenu">
<tmpl_var name="SUB_GROUP">
<li id="projectCreate">
Modified: branches/vhffs_4.1/vhffs-panel/templates/menu/group.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/menu/group.tmpl 2006-12-22 09:20:23 UTC (rev 384)
+++ branches/vhffs_4.1/vhffs-panel/templates/menu/group.tmpl 2006-12-22 23:50:27 UTC (rev 385)
@@ -1,5 +1,5 @@
<p class="title"><tmpl_var name="TEXT_PROJECT"><tmpl_var name="PROJECTNAME">
- (<a href="javascript:ShowHideId('projectConfigurationMenu')" class="smalllink"><tmpl_var name="SHOW_HIDE"></a>)
+ (<a href="javascript:ToggleMenuItem('projectConfigurationMenu')" class="smalllink"><tmpl_var name="SHOW_HIDE"></a>)
</p>