diff options
-rwxr-xr-x | tinydns-config-html.lsp | 4 | ||||
-rw-r--r-- | tinydns-controller.lua | 15 | ||||
-rw-r--r-- | tinydns-edit-html.lsp | 12 | ||||
-rw-r--r-- | tinydns-html.lsp | 4 | ||||
-rw-r--r-- | tinydns-listfiles-html.lsp | 8 | ||||
-rw-r--r-- | tinydns-listpermissions-html.lsp | 4 | ||||
-rw-r--r-- | tinydns-model.lua | 14 | ||||
l--------- | tinydns-startstop-html.lsp | 1 | ||||
-rw-r--r-- | tinydns-status-html.lsp | 16 | ||||
-rw-r--r-- | tinydns-view-html.lsp | 1 |
10 files changed, 40 insertions, 39 deletions
diff --git a/tinydns-config-html.lsp b/tinydns-config-html.lsp index bcbe58a..8fce9e5 100755 --- a/tinydns-config-html.lsp +++ b/tinydns-config-html.lsp @@ -1,5 +1,5 @@ <% local form, viewlibrary, page_info, session = ... -require("viewfunctions") +require("htmlviewfunctions") %> <% if viewlibrary and viewlibrary.dispatch_component then @@ -9,5 +9,5 @@ end %> <h1><%= html.html_escape(form.label) %></h1> <% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action - displayform(form) + htmlviewfunctions.displayform(form) %> diff --git a/tinydns-controller.lua b/tinydns-controller.lua index 64a224c..25a0c12 100644 --- a/tinydns-controller.lua +++ b/tinydns-controller.lua @@ -1,6 +1,5 @@ module(..., package.seeall) -require("controllerfunctions") -require("validator") +validator = require("acf.validator") mvc = {} mvc.on_load = function(self, parent) @@ -18,15 +17,15 @@ function view(self) end function startstop(self) - return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.clientdata) + return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata) end function config(self) - return controllerfunctions.handle_form(self, self.model.getconfig, function(value) return self.model.setconfig(self, value) end, self.clientdata, "Save", "Edit Configuration", "Configuration Saved") + return self.handle_form(self, self.model.getconfig, function(value) return self.model.setconfig(self, value) end, self.clientdata, "Save", "Edit Configuration", "Configuration Saved") end function newfile(self) - return controllerfunctions.handle_form(self, self.model.getnewconfigfile, function(value) + return self.handle_form(self, self.model.getnewconfigfile, function(value) return self.model.createconfigfile(self, value, sessiondata.userinfo.userid) end, self.clientdata, "Create", "Create New Config File", "Config File Created") end @@ -47,7 +46,7 @@ function edit(self) end function editfile(self) - config = controllerfunctions.handle_form(self, function() + config = self.handle_form(self, function() return self.model.get_filedetails(self, self.clientdata.filename, sessiondata.userinfo.userid) end, function(value) return self.model.set_filedetails(self, value, sessiondata.userinfo.userid) @@ -68,7 +67,7 @@ function listpermissions(self) end function edituserpermissions(self) - return controllerfunctions.handle_form(self, function() + return self.handle_form(self, function() return self.model:getuserpermissions(self.clientdata.userid) end, function(value) return self.model:setuserpermissions(value) @@ -76,7 +75,7 @@ function edituserpermissions(self) end function editrolepermissions(self) - return controllerfunctions.handle_form(self, function() + return self.handle_form(self, function() return self.model:getrolepermissions(self.clientdata.role) end, function(value) return self.model:setrolepermissions(value) diff --git a/tinydns-edit-html.lsp b/tinydns-edit-html.lsp index 6d83da6..41f0cfe 100644 --- a/tinydns-edit-html.lsp +++ b/tinydns-edit-html.lsp @@ -1,5 +1,5 @@ <% local form, viewlibrary, page_info = ... %> -<% require("viewfunctions") %> +<% require("htmlviewfunctions") %> <% local domain = string.gsub(form.value.filename.value, "^.*/", "") %> <script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script> @@ -191,9 +191,9 @@ <H3>File Details</H3> <DL> <% -displayitem(form.value.filename) -displayitem(form.value.filesize) -displayitem(form.value.mtime) +htmlviewfunctions.displayitem(form.value.filename) +htmlviewfunctions.displayitem(form.value.filesize) +htmlviewfunctions.displayitem(form.value.mtime) %> </DL> @@ -210,8 +210,8 @@ displayitem(form.value.mtime) <% if form.value.filecontent.errtxt then %><P CLASS='error'><%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "<BR>") %></P><% end %> <% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %> -<% displayformstart(form) %> +<% htmlviewfunctions.displayformstart(form) %> <input type="hidden" name="filename" value="<%= html.html_escape(form.value.filename.value) %>"> <input type="hidden" name="filecontent" value="<%= html.html_escape(form.value.filecontent.value) %>"> <H2>Save and Apply Above Settings</H2> -<% displayformend(form) %> +<% htmlviewfunctions.displayformend(form) %> diff --git a/tinydns-html.lsp b/tinydns-html.lsp index a135d3b..b900ea4 100644 --- a/tinydns-html.lsp +++ b/tinydns-html.lsp @@ -1,5 +1,5 @@ <% local form, viewlibrary, page_info = ... -require("viewfunctions") +require("htmlviewfunctions") %> <H1><%= html.html_escape(form.label) %></H1> @@ -8,5 +8,5 @@ require("viewfunctions") if form.value.userid then form.value.userid.readonly = true end if form.value.role then form.value.role.readonly = true end local order = { "userid", "role" } - displayform(form, order) + htmlviewfunctions.displayform(form, order) %> diff --git a/tinydns-listfiles-html.lsp b/tinydns-listfiles-html.lsp index a2ce083..47a1695 100644 --- a/tinydns-listfiles-html.lsp +++ b/tinydns-listfiles-html.lsp @@ -1,9 +1,9 @@ <% local form, viewlibrary, page_info, session = ... -require("viewfunctions") +require("htmlviewfunctions") %> -<% displaycommandresults({"delete", "edit", "editfile"}, session) %> -<% displaycommandresults({"newfile", "startstop"}, session, true) %> +<% htmlviewfunctions.displaycommandresults({"delete", "edit", "editfile"}, session) %> +<% htmlviewfunctions.displaycommandresults({"newfile", "startstop"}, session, true) %> <h1>Configuration</h1> <h2>Edit/View existing Domains</h2> @@ -40,7 +40,7 @@ require("viewfunctions") <h2>Create new Domain</h2> <% newfileform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/newfile" - displayform(newfileform) + htmlviewfunctions.displayform(newfileform) end %> <% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("startstop") then diff --git a/tinydns-listpermissions-html.lsp b/tinydns-listpermissions-html.lsp index 8c621b2..9674426 100644 --- a/tinydns-listpermissions-html.lsp +++ b/tinydns-listpermissions-html.lsp @@ -1,7 +1,7 @@ <% local view, viewlibrary, page_info, session = ... %> -<% require("viewfunctions") %> +<% require("htmlviewfunctions") %> -<% displaycommandresults({"edituserpermissions", "editrolepermissions"}, session) %> +<% htmlviewfunctions.displaycommandresults({"edituserpermissions", "editrolepermissions"}, session) %> <H1><%= html.html_escape(view.label) %></H1> diff --git a/tinydns-model.lua b/tinydns-model.lua index a9d27a1..3df68a3 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -2,9 +2,9 @@ module(..., package.seeall) -- Load libraries require("modelfunctions") -require("fs") -require("format") -require("validator") +fs = require("acf.fs") +format = require("acf.format") +validator = require("acf.validator") require("authenticator") require("roles") require("posix") @@ -157,8 +157,12 @@ end -- ################################################################################ -- PUBLIC FUNCTIONS -function startstop_service(action) - return modelfunctions.startstop_service(processname, action) +function get_startstop(clientdata) + return modelfunctions.get_startstop(processname) +end + +function startstop_service(startstop, action) + return modelfunctions.startstop_service(startstop, action) end -- Present some general status diff --git a/tinydns-startstop-html.lsp b/tinydns-startstop-html.lsp deleted file mode 120000 index 0ea2627..0000000 --- a/tinydns-startstop-html.lsp +++ /dev/null @@ -1 +0,0 @@ -../startstop-html.lsp
\ No newline at end of file diff --git a/tinydns-status-html.lsp b/tinydns-status-html.lsp index 8dae281..6add2fb 100644 --- a/tinydns-status-html.lsp +++ b/tinydns-status-html.lsp @@ -1,16 +1,16 @@ <% local data, viewlibrary, page_info, session = ... -require("viewfunctions") +require("htmlviewfunctions") %> -<% displaycommandresults({"install","edit"}, session) %> -<% displaycommandresults({"startstop"}, session) %> +<% htmlviewfunctions.displaycommandresults({"install","edit"}, session) %> +<% htmlviewfunctions.displaycommandresults({"startstop"}, session) %> <H1>System Info</H1> <DL> <% -displayitem(data.value.status) +htmlviewfunctions.displayitem(data.value.status) -displayitem(data.value.version) +htmlviewfunctions.displayitem(data.value.version) if data.value.version and data.value.version.errtxt and viewlibrary.check_permission("apk-tools/apk/install") then %> <DT>Install package</DT> @@ -20,7 +20,7 @@ if data.value.version and data.value.version.errtxt and viewlibrary.check_permis <% end -displayitem(data.value.autostart) +htmlviewfunctions.displayitem(data.value.autostart) if not (data.value.version and data.value.version.errtxt) and data.value.autostart and data.value.autostart.errtxt and viewlibrary.check_permission("alpine-baselayout/rc/edit") then %> <DT>Enable autostart</DT> @@ -31,8 +31,8 @@ if not (data.value.version and data.value.version.errtxt) and data.value.autosta <% end -displayitem(data.value.configdir) -displayitem(data.value.listen) +htmlviewfunctions.displayitem(data.value.configdir) +htmlviewfunctions.displayitem(data.value.listen) %> </DL> diff --git a/tinydns-view-html.lsp b/tinydns-view-html.lsp index b0cce74..fdde443 100644 --- a/tinydns-view-html.lsp +++ b/tinydns-view-html.lsp @@ -1,5 +1,4 @@ <% local view, viewlibrary, page_info = ... -require("viewfunctions") %> <script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script> |