Thread: [Netpass-devel] NetPass/www/htdocs/OSSTemplate/js common.js,1.1,1.2 debug.js,1.4,1.5 netgroups.js,1.
Brought to you by:
jeffmurphy
|
From: jeff m. <jef...@us...> - 2005-05-04 20:22:27
|
Update of /cvsroot/netpass/NetPass/www/htdocs/OSSTemplate/js In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6469/www/htdocs/OSSTemplate/js Modified Files: common.js debug.js netgroups.js userform.js Log Message: netgroup editor UI Index: netgroups.js =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/OSSTemplate/js/netgroups.js,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- netgroups.js 4 May 2005 03:09:45 -0000 1.1 +++ netgroups.js 4 May 2005 20:22:18 -0000 1.2 @@ -1,10 +1,73 @@ function netgroup_onchange_netgroups() { + var RN = "netgroup_onchange_netgroups"; + var o = document.getElementById("netgroups"); if (!o) return; if (o.options[0].selected == true) { //IE o.options[0].selected == false; return; } + + var ngn = o.options[o.selectedIndex].value; + var nw = document.getElementById("networks"); + unHighLightList("networks"); + + dbg(1, RN + ": populate networks.."); + for (var i = 1 ; i < nw.options.length ; i++) { + dbg (1, RN + ": (" + nw.options[i].value + ") " + netgroup_Map[nw.options[i].value][0] + " =? " + ngn); + if (netgroup_Map[nw.options[i].value][0] == ngn) { + nw.options[i].selected = true; + } else { + nw.options[i].selected = false; + } + } document.forms[0].submit(); } +function netgroup_onchange_networks() { + var RN = "netgroup_onchange_networks"; +} + + +function netgroup_onfocus_addNetgroup(o) { + var RN = "netgroup_onfocus_addNetgroup"; + dbg(1, RN); + if (o && o.value == "Add Netgroup...") o.value = ""; +} + +function netgroup_onblur_addNetgroup(o) { + var RN = "netgroup_onblur_addNetgroup"; + dbg(1, RN); + + var ng = document.getElementById("netgroups"); + var nw = document.getElementById("networks"); + + if (ng && nw && o.value != "") { + if (netgroup_reservedGroups[o.value] == undefined) { + var exists = 0; + for(var i = 1 ; i < ng.options.length ; i++) { + if (ng.options[i].value == o.value) { + exists = 1; + } + } + // you can't name a netgroup the same as a network. + for(var i = 1 ; i < nw.options.length ; i++) { + if (nw.options[i].value == o.value) { + exists = 1; + } + } + if (!exists) { + var no = new Option(o.value, o.value, false, false); + ng.options[ng.options.length] = no; + unHighLightList("netgroups"); + ng.options[ng.options.length-1].selected = true; + sortList("netgroups"); + } else { + dbg (1, RN + ": group already exists: " + o.value); + } + } else { + dbg (1, RN + ": group name is reserved: " + o.value); + } + } + o.value = "Add Netgroup..."; +} Index: debug.js =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/OSSTemplate/js/debug.js,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- debug.js 20 Apr 2005 20:57:20 -0000 1.4 +++ debug.js 4 May 2005 20:22:18 -0000 1.5 @@ -16,7 +16,6 @@ if (DBGLEVEL) dbgwin = window.open("about:blank", "DEBUGOUTPUT", "resizable,width=400,height=400,scrollbars"); - } function dbg(l, msg) { Index: userform.js =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/OSSTemplate/js/userform.js,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- userform.js 4 May 2005 03:09:45 -0000 1.9 +++ userform.js 4 May 2005 20:22:18 -0000 1.10 @@ -12,9 +12,9 @@ var selectedUser = undefined; - userform_unHighLight("AvailableGroupList"); - userform_unHighLight("AccessControlList"); - userform_disableList("AccessControlList"); + unHighLightList("AvailableGroupList"); + unHighLightList("AccessControlList"); + disableList("AccessControlList"); // IE doesnt support <option disabled> //http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/disabled_3.asp @@ -58,7 +58,7 @@ dbg(1, RN + ": unhighlight ACL"); - userform_unHighLight("AccessControlList"); + unHighLightList("AccessControlList"); // populate the grouplist with the currently // selected user's groups, removing them from the @@ -238,77 +238,10 @@ return undefined; } -function userform_unHighLight(oname, item) { - var RN = "userform_unHighLightACL"; - if (oname == undefined) oname = "AccessControlList"; - - var acl = document.getElementById(oname); - if (acl) { - for(var i = 0 ; i < acl.options.length ; i++) { - if (i && item) { - if (item == acl.options[i].value) - acl.options[i].selected = false; - } else { - acl.options[i].selected = false; - } - } - } else { - dbg (1, RN + ": error cant find " + oname + " object"); - } -} - -function userform_highLight(oname, item) { - var RN = "userform_highLightACL"; - if (oname == undefined) oname = "AccessControlList"; - var acl = document.getElementById(oname); - if (acl) { - for(var i = 1 ; i < acl.options.length ; i++) { - //dbg (1, RN + ": " + acl.options[i].value + " == " + item + "?"); - if (item) { - if (acl.options[i].value == item) - acl.options[i].selected = true; - } - else { - acl.options[i].selected = true; - } - } - } else { - dbg (1, RN + ": error cant find " + oname + " object"); - } -} - - -function userform_disableList(oname) { - var RN = "userform_disableList"; - - var l = document.getElementById(oname); - if (l) { - for(var i = 1 ; i < l.options.length ; i++) { - l.options[i].selected = false; - l.options[i].disabled = true; - } - } else { - dbg (1, RN + ": error cant find " + oname + " object"); - } -} - -function userform_enableList(oname) { - var RN = "userform_enableList"; - - var l = document.getElementById(oname); - if (l) { - for(var i = 1 ; i < l.options.length ; i++) { - l.options[i].disabled = false; - } - } else { - dbg (1, RN + ": error cant find " + oname + " object"); - } -} - function userform_onchange_availableGroups() { - userform_unHighLight("GroupList"); - userform_unHighLight("AccessControlList"); - userform_disableList("AccessControlList"); + unHighLightList("GroupList"); + unHighLightList("AccessControlList"); + disableList("AccessControlList"); } function userform_enableModAll() { @@ -347,9 +280,9 @@ var RN = "userform_showACLforGroup"; var su = userform_lookupSelectedUser(); - userform_unHighLight("AccessControlList"); - userform_unHighLight("AvailableGroupList"); - userform_enableList("AccessControlList"); + unHighLightList("AccessControlList"); + unHighLightList("AvailableGroupList"); + enableList("AccessControlList"); var o = document.getElementById("GroupList"); @@ -360,7 +293,7 @@ if (o.options[0].selected) { o.options[0].selected = false; //IE - userform_unHighLight("GroupList"); + unHighLightList("GroupList"); return; } @@ -382,14 +315,14 @@ if (selected > 1) { // clear the ACL and enable the modify all // buttons - userform_unHighLight("AccessControlList"); + unHighLightList("AccessControlList"); userform_enableModAll(); } else { for(var acl in userhash[su][o.value]) { userform_disableModAll(); dbg(1, RN + ": acl/"+su+"/"+o.value+"="+acl); - userform_highLight("AccessControlList", acl); + highLightList("AccessControlList", acl); } } } @@ -407,8 +340,8 @@ var agl = document.getElementById('AvailableGroupList'); var gl = document.getElementById('GroupList'); if (agl && gl) { - userform_unHighLight("GroupList"); - userform_unHighLight("AccessControlList"); + unHighLightList("GroupList"); + unHighLightList("AccessControlList"); for (var i = agl.options.length-1 ; i > 0 ; i--) { dbg (1, RN + ": move agl/" + i + " to gl"); if (agl.options[i].selected) { @@ -418,7 +351,7 @@ userhash[su][opt.value] = new Object; } } - userform_enableList("AccessControlList"); + enableList("AccessControlList"); DBG_objDump(userhash, "userhash"); userform_setAclHash(); sortList("GroupList"); @@ -444,8 +377,8 @@ delete userhash[su][opt.value]; } } - userform_unHighLight("AccessControlList"); - userform_disableList("AccessControlList"); + unHighLightList("AccessControlList"); + disableList("AccessControlList"); DBG_objDump(userhash, "userhash"); userform_setAclHash(); sortList("GroupList"); @@ -493,7 +426,7 @@ var no = new Option(o.value, o.value, false, false); ul.options[ul.options.length] = no; - userform_unHighLight("UserList"); + unHighLightList("UserList"); ul.options[ul.options.length-1].selected = true; if(o) o.value = "Add user..."; Index: common.js =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/OSSTemplate/js/common.js,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- common.js 4 May 2005 03:09:45 -0000 1.1 +++ common.js 4 May 2005 20:22:18 -0000 1.2 @@ -61,3 +61,69 @@ } } } + +function unHighLightList(oname, item) { + var RN = "unHighLightList"; + + var acl = document.getElementById(oname); + if (acl) { + for(var i = 0 ; i < acl.options.length ; i++) { + if (i && item) { + if (item == acl.options[i].value) + acl.options[i].selected = false; + } else { + acl.options[i].selected = false; + } + } + } else { + dbg (1, RN + ": error cant find " + oname + " object"); + } +} + + +function highLightList(oname, item) { + var RN = "highLightList"; + + var acl = document.getElementById(oname); + if (acl) { + for(var i = 1 ; i < acl.options.length ; i++) { + if (item) { + if (acl.options[i].value == item) + acl.options[i].selected = true; + } + else { + acl.options[i].selected = true; + } + } + } else { + dbg (1, RN + ": error cant find " + oname + " object"); + } +} + + +function disableList(oname) { + var RN = "disableList"; + + var l = document.getElementById(oname); + if (l) { + for(var i = 1 ; i < l.options.length ; i++) { + l.options[i].selected = false; + l.options[i].disabled = true; + } + } else { + dbg (1, RN + ": error cant find " + oname + " object"); + } +} + +function enableList(oname) { + var RN = "enableList"; + + var l = document.getElementById(oname); + if (l) { + for(var i = 1 ; i < l.options.length ; i++) { + l.options[i].disabled = false; + } + } else { + dbg (1, RN + ": error cant find " + oname + " object"); + } +} |