diff options
Diffstat (limited to 'provisioning-editdeviceparams-html.lsp')
-rw-r--r-- | provisioning-editdeviceparams-html.lsp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/provisioning-editdeviceparams-html.lsp b/provisioning-editdeviceparams-html.lsp index c0d1de8..bd54c1f 100644 --- a/provisioning-editdeviceparams-html.lsp +++ b/provisioning-editdeviceparams-html.lsp @@ -74,15 +74,23 @@ end currentnumber = 0; } - if ((currentsection == previoussection) && (currentnumber != previousnumber) && (0 == $(this).find(".defaultoverride").length) && (0 == $(this).find(".groupdefaultoverride").length) && ($(this).children().first().text().match(currentnumber))) { - $(this).toggle(); - <% if page_info.action ~= "viewdeviceparams" then %> - $('<a href="javascript:;" class="'+id+'"><img src="<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>tango/16x16/actions/list-add.png"> Add '+$(this).children().first().text()+'</a>').insertAfter($(this)).click(showsection); - if ($(this).prev("a").length == 1) { - // If the previous sibling is also an Add link, hide this one - $(this).next().toggle(); - } + if ((currentsection == previoussection) && (currentnumber != previousnumber) && ($(this).children().first().text().match(currentnumber))) { + // Found a section + <% if page_info.action ~= "viewdeviceparams" and viewlibrary.check_permission("deletedeviceparamgroup") then %> + // Add a delete button to previous section + $("<a href='<%= page_info.script..page_info.prefix..page_info.controller.."/deletedeviceparamgroup?device_id="..html.html_escape(form.value.device_id.value) %>&group="+previoussection+previousnumber+"&redir=<%= page_info.script..page_info.prefix..page_info.controller.."/"..page_info.action..html.url_encode("?device_id="..form.value.device_id.value)%>&submit=true' class='deletedeviceparamgroup'> Delete</a>").insertAfter($(this).prevAll("div").first().children().first()); <% end %> + if ((0 == $(this).find(".defaultoverride").length) && (0 == $(this).find(".groupdefaultoverride").length)) { + // Hide this section + $(this).toggle(); + <% if page_info.action ~= "viewdeviceparams" then %> + $('<a href="javascript:;" class="'+id+'"><img src="<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>tango/16x16/actions/list-add.png"> '+$(this).children().first().text()+'</a>').insertAfter($(this)).click(showsection); + if ($(this).prev("a").length == 1) { + // If the previous sibling is also an Add link, hide this one + $(this).next().toggle(); + } + <% end %> + } } previoussection = currentsection; @@ -95,9 +103,12 @@ end $(".deletedevice").click(function(){ return confirm("Are you sure you want to delete this device?")}); $(".groupdefaultoverride").siblings().select("contains('Default:')").addClass("error"); hideunuseddivs(); + $(".deletedeviceparamgroup").click(function(){ return confirm("Are you sure you want to delete this parameter group?")}); }); </script> +<% htmlviewfunctions.displaycommandresults({"deletedeviceparamgroup"}, session) %> + <% if form and form.value and form.value.device_id and form.value.device_id.value ~= "" then %> <% if viewlibrary.check_permission("editdevice") then %> <a href='<%= page_info.script..page_info.prefix..page_info.controller.."/editdevice?device_id="..html.html_escape(form.value.device_id.value) %>'><img src='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/categories/applications-system.png' title="Edit Class of Service"></img> <big>Edit Class of Service </big></a> |