diff options
Diffstat (limited to 'provisioning-editdevice-html.lsp')
-rw-r--r-- | provisioning-editdevice-html.lsp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/provisioning-editdevice-html.lsp b/provisioning-editdevice-html.lsp index dd39948..a9f4f95 100644 --- a/provisioning-editdevice-html.lsp +++ b/provisioning-editdevice-html.lsp @@ -1,9 +1,27 @@ -<% local form, viewlibrary, page_info = ... +<% local form, viewlibrary, page_info, session = ... require("viewfunctions") %> <script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script> <script type="text/javascript"> + +<% -- Since we want to redirect to edit a new device's parameters, we create an automatic redirect + if page_info.action == "createdevice" and form.descr and not form.errtxt then + -- Use JavaScript to redirect to the edit page +%> + window.location.assign("<%= html.html_escape(page_info.script..page_info.prefix..page_info.controller) %>/<% if viewlibrary.check_permission("overridedeviceparams") then io.write("overridedeviceparams") elseif viewlibrary.check_permission("editdeviceparams") then io.write("editdeviceparams") else io.write("editdevice") end %>?device_id=<%= form.value.device_id.value %>&redir=<%= html.html_escape(page_info.orig_action) %>"); +<% + end +%> +<% -- Since we're including deletedevice as a component, we break the automatic redirect + if session.deletedeviceresult and not session.deletedeviceresult.errtxt and viewlibrary.check_permission("listdevices") then + -- Use JavaScript to redirect to the listdevices page +%> + window.location.assign("<%= html.html_escape(page_info.script..page_info.prefix..page_info.controller) %>/listdevices"); +<% + end +%> + $(document).ready(function() { $(".deletedevice").click(function(){ return confirm("Are you sure you want to delete this device?")}); }); |