diff options
Diffstat (limited to 'provisioning-editdeviceparams-html.lsp')
-rw-r--r-- | provisioning-editdeviceparams-html.lsp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/provisioning-editdeviceparams-html.lsp b/provisioning-editdeviceparams-html.lsp index 08137c6..0a48834 100644 --- a/provisioning-editdeviceparams-html.lsp +++ b/provisioning-editdeviceparams-html.lsp @@ -16,6 +16,12 @@ function markoverride(c) else c.class = "groupdefaultoverride" end + elseif c.default and c.value ~= c.default then + if c.class then + c.class = c.class .." defaultoverride" + else + c.class = "defaultoverride" + end end end %> @@ -36,9 +42,57 @@ end end %> + function showsection() { + $("#"+$(this).attr("class")).toggle(); + if ($(this).next().next("a").length == 1) { + $(this).next().next().toggle(); + } + $(this).remove(); + } + + function hideunuseddivs() { + var previoussection = ""; + var previousnumber = 0; + $("div").filter(function(){ + var id = $(this).attr("id"); + // We're looking for an id that starts with section_ + if ((id != null) && (id.indexOf("section_") === 0)) { + return true; + } + return false; + }).each(function(i){ + var id = $(this).attr("id"); + var currentnumber = id.match(/\d+$/); + var currentsection + if (currentnumber != null) { + var len = id.length; + var numlen = currentnumber[0].length; + currentsection = id.substr(8, id.length-8-currentnumber[0].length); + currentnumber = currentnumber[0].toString(); + } else { + currentsection = id.substr(8); + currentnumber = 0; + } + + if ((currentsection == previoussection) && (currentnumber != previousnumber) && (0 == $(this).find(".defaultoverride").length) && (0 == $(this).find(".groupdefaultoverride").length)) { + $(this).toggle(); + $('<a href="javascript:;" class="'+id+'">Show</a>').insertAfter($(this)).click(showsection); + if ($(this).prev("a").length == 1) { + // If the previous sibling is also a Show link, hide this one + $(this).next().toggle(); + } + } + + previoussection = currentsection; + previousnumber = currentnumber; + }); + + } + $(document).ready(function() { $(".deletedevice").click(function(){ return confirm("Are you sure you want to delete this device?")}); $(".groupdefaultoverride").siblings().select("contains('Default:')").addClass("error"); + hideunuseddivs(); }); </script> |