diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-10-01 15:44:47 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-10-01 15:44:47 +0000 |
commit | 320c57df707590303f2baeab8d0737fd121b4fae (patch) | |
tree | 6b0bab2b54114b78419bd2e7a6aecebde364b9f3 | |
parent | 04ead45947e1059d154628838cb17377f4949d57 (diff) | |
download | acf-kamailio-320c57df707590303f2baeab8d0737fd121b4fae.tar.bz2 acf-kamailio-320c57df707590303f2baeab8d0737fd121b4fae.tar.xz |
Replace temporary session workaround for viewtable action with redir with GET parm in HTML view
-rw-r--r-- | kamailio-model.lua | 16 | ||||
-rw-r--r-- | kamailio-viewtable-html.lsp | 7 |
2 files changed, 5 insertions, 18 deletions
diff --git a/kamailio-model.lua b/kamailio-model.lua index 4d31093..37e6737 100644 --- a/kamailio-model.lua +++ b/kamailio-model.lua @@ -368,15 +368,7 @@ function mymodule.list_table_entries(self, clientdata) retval.fields = cfe({ type="list", value={}, label="List of Table Fields" }) retval.entries = cfe({ type="structure", value={}, label="List of Database Entries" }) - -- This is a temporary workaround due to redirect_to_referrer not including clientdata - if self.sessiondata and self.sessiondata.keydata and self.sessiondata.keydata[self.conf.prefix..self.conf.controller.."/"..self.conf.action] then - keydata = self.sessiondata.keydata[self.conf.prefix..self.conf.controller.."/"..self.conf.action] - if retval.table.value == "" and keydata.table then - retval.table.value = keydata.table - end - end - - local errtxt + local errtxt local res, err = pcall(function() local db = databasecreate() local connected = db.databaseconnect() @@ -397,12 +389,6 @@ function mymodule.list_table_entries(self, clientdata) errtxt = err end - -- This is a temporary workaround due to redirect_to_referrer not including clientdata - if retval.table.value ~= "" and not errtxt and self.sessiondata then - self.sessiondata.keydata = self.sessiondata.keydata or {} - self.sessiondata.keydata[self.conf.prefix..self.conf.controller.."/"..self.conf.action] = {table=retval.table.value} - end - return cfe({ type="group", value=retval, label="Database Table Entries", errtxt=errtxt }) end diff --git a/kamailio-viewtable-html.lsp b/kamailio-viewtable-html.lsp index 0d08ec5..47e5aa4 100644 --- a/kamailio-viewtable-html.lsp +++ b/kamailio-viewtable-html.lsp @@ -21,6 +21,8 @@ }); </script> +<% local redir = cfe({ type="hidden", value=page_info.orig_action.."?table="..html.url_encode(form.value.table.value) }) %> + <% htmlviewfunctions.displaycommandresults({"deletetableentry", "updatetableentry"}, session) %> <% htmlviewfunctions.displaycommandresults({"createtableentry"}, session, true) %> @@ -36,7 +38,6 @@ <% end %> </tr> </thead><tbody> -<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% local table = cfe({ type="hidden", value=form.value.table.value }) %> <% local id = cfe({ type="hidden" }) %> <% for i,tableentry in ipairs(form.value.entries.value) do %> @@ -48,7 +49,7 @@ <% htmlviewfunctions.displayitem(cfe({type="link", value={table=table, id=id, redir=redir}, label="", option="Update", action="updatetableentry"}), page_info, -1) %> <% end %> <% if viewlibrary.check_permission("deletetableentry") then %> - <% htmlviewfunctions.displayitem(cfe({type="form", value={table=table, id=id}, label="", option="Delete", action="deletetableentry", class="deletetableentry"}), page_info, -1) %> + <% htmlviewfunctions.displayitem(cfe({type="form", value={table=table, id=id, redir=redir}, label="", option="Delete", action="deletetableentry", class="deletetableentry"}), page_info, -1) %> <% end %> </td> <% end %> @@ -65,5 +66,5 @@ <% htmlviewfunctions.displaysectionend(header_level) %> <% if page_info.action == "viewtable" and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createtableentry") then - viewlibrary.dispatch_component("createtableentry", {table=form.value.table.value}) + viewlibrary.dispatch_component("createtableentry", {table=form.value.table.value, redir=redir.value}) end %> |