diff options
-rw-r--r-- | squid-controller.lua | 32 | ||||
-rw-r--r-- | squid-digest-html.lsp | 15 | ||||
-rw-r--r-- | squid-listfiles-html.lsp | 27 | ||||
-rw-r--r-- | squid-model.lua | 49 | ||||
-rw-r--r-- | squid-saccess-html.lsp | 46 |
5 files changed, 21 insertions, 148 deletions
diff --git a/squid-controller.lua b/squid-controller.lua index 774ac2f..69ff36a 100644 --- a/squid-controller.lua +++ b/squid-controller.lua @@ -27,38 +27,6 @@ end mymodule.expert = function( self ) return self.handle_form(self, self.model.get_configfile, self.model.update_configfile, self.clientdata, "Save", "Edit Config", "Configuration Set") end ---[[ -mymodule.saccess = function( self ) - - local service = { message="", status="", config="" } - - if self.clientdata.cmd then - if self.clientdata.cmd == "save" then - local config = {} - config.s_ip = self.clientdata.s_ip - config.s_browser = self.clientdata.s_browser - config.s_domain = self.clientdata.s_domain - service.message = self.model.update_saccess( config ) - end - end - - service.config = self.model.get_saccess() - - return ( cfe ({ service = service }) ) -end - -mymodule.listacls = function( self ) - return self.model.read_acls() -end - -mymodule.editacl = function( self ) - return self.handle_form(self, function() return self.model.read_acl(self.clientdata.linenum) end, self.model.update_acl, self.clientdata, "Save", "Edit ACL", "ACL Saved") -end - -mymodule.deleteacl = function( self ) - return self:redirect_to_referrer(self.model.delete_acl(self.clientdata.linenum)) -end ---]] function mymodule.listfiles(self) return self.model.listfiles(self) diff --git a/squid-digest-html.lsp b/squid-digest-html.lsp index fd6f3a2..9416679 100644 --- a/squid-digest-html.lsp +++ b/squid-digest-html.lsp @@ -4,16 +4,13 @@ <% htmlviewfunctions.displaycommandresults({"enabledigestlist"}, session) %> -<h1>Digest User List Status</h1> <% - htmlviewfunctions.displayitem(form.value.status) - if form.value.status.errtxt then %> -<div class='item'><p class='left'></p> -<div class='right'> -<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/enabledigestlist") %>"> -<input class="submit" type="submit" name="submit" value="Enable"></form> -</div></div><!-- end .item --> -<% end +local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Digest User List Status"}), page_info) +htmlviewfunctions.displayitem(form.value.status) +if form.value.status.errtxt then + htmlviewfunctions.displayitem(cfe({type="form", value={}, label="", option="Enable", action="enabledigestlist" }), page_info, 0) +end +htmlviewfunctions.displaysectionend(header_level) %> <% diff --git a/squid-listfiles-html.lsp b/squid-listfiles-html.lsp index 0aea8bf..91a30d7 100644 --- a/squid-listfiles-html.lsp +++ b/squid-listfiles-html.lsp @@ -28,32 +28,35 @@ html = require("acf.html") viewlibrary.dispatch_component("status") end %> -<h1>Files</h1> +<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> <table id="list" class="tablesorter"><thead> <tr> <th>Action</th> <th>File</th> </tr> </thead><tbody> +<% local filename = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,file in ipairs(view.value) do %> <tr> <td> - <% if viewlibrary.check_permission("editfile") then %> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editfile?filename="..file.."&redir="..page_info.orig_action, label="Edit "} %> - <% end %> - <% if viewlibrary.check_permission("deletefile") then %> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletefile?submit=true&filename="..file, label="Delete "} %> - <% end %> + <% + filename.value = file + if viewlibrary.check_permission("editfile") then + htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="editfile"}), page_info, -1) + end + if viewlibrary.check_permission("deletefile") then + htmlviewfunctions.displayitem(cfe({type="form", value={filename=filename}, label="", option="Delete", action="deletefile" }), page_info, -1) + end + %> </td> <td><%= html.html_escape(file) %></td> </tr> <% end %> </tbody></table> +<% htmlviewfunctions.displaysectionend(header_level) %> <% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createfile") then - local createform = viewlibrary.dispatch_component("createfile", nil, true) %> -<h2><%= html.html_escape(createform.label) %></h2> -<% - createform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createfile" - htmlviewfunctions.displayform(createform) + local createform = viewlibrary.dispatch_component("createfile", nil, true) + htmlviewfunctions.displayitem(createform, page_info) end %> diff --git a/squid-model.lua b/squid-model.lua index 1574966..5d8f181 100644 --- a/squid-model.lua +++ b/squid-model.lua @@ -125,55 +125,6 @@ mymodule.enable_digest_userlist = function(self, endigest) return endigest end ---[[ -mymodule.get_saccess = function() - - local config = {} - - config.s_ip = mymodule.get_file_contents( "/etc/squid/anoniplist" ) - config.s_browser = mymodule.get_file_contents( "/etc/squid/anonbrowserlist" ) - config.s_domain = mymodule.get_file_contents( "/etc/squid/anondomainlist" ) - - return config -end - -mymodule.update_saccess = function( config ) - - mymodule.write_file_contents( "/etc/squid/anoniplist", config.s_ip ) - mymodule.write_file_contents( "/etc/squid/anonbrowserlist", config.s_browser ) - mymodule.write_file_contents( "/etc/squid/anondomainlist", config.s_domain ) - - return -end - -mymodule.write_file_contents = function( name, contents ) - - local ptr = io.open( name, "wb+" ) - if ptr ~= nil then - ptr:write( format.dostounix( contents ) ) - ptr:close() - end - - return -end - -mymodule.get_file_contents = function( name ) - - local retval = "" - - local ptr = io.open( name ) - if ptr ~= nil then - retval = ptr:read( "*a" ) - ptr:close() - if retval == nil then - retval = "" - end - end - - return retval -end ---]] - mymodule.read_config = function() local retval = { httpports = { type="list", value={}, label="HTTP Ports", descr="List of port, IP:port, or hostname:port entries that Squid will listen on", seq=0 }, diff --git a/squid-saccess-html.lsp b/squid-saccess-html.lsp deleted file mode 100644 index 1fb6d35..0000000 --- a/squid-saccess-html.lsp +++ /dev/null @@ -1,46 +0,0 @@ -<% -html = require("acf.html") - local form = ... - local service = form.service -%> -<h1>Web Proxy - Special Access</h1> -<h2>General Information</h2> -<p> - The squid web proxy server is normally configured to require authenticated access. In some cases, such - as anti-virus update programs, the process cannot authenticate itself to the proxy server. For these - <i>special</i> cases, it is possible to have squid allow anonymous access to the Internet.</p> -<p>You may choose to specify the special cases by specific ip address, browser identification or destination - domain. -</p> - -<form action="" method="post"> -<h2>Special IP Addresses</h2> -<p> -If you wish to specify hosts that may access the Internet by IP address, -enter the address(es) in the box below, one per line. -</p> -<textarea name="s_ip"><%= html.html_escape( service.config.s_ip ) %></textarea> - -<h2>Browser Identification</h2> -<p> -If you have a browser that identifies itself in a special way, you may -specify it here. Note that any client identifying itself as this type -of browser will be allowed anonymous access. Enter the browser identification(s) -in the box below, one per line. Regular expressions are allowed. -</p> -<textarea name="s_browser"><%= html.html_escape( service.config.s_browser ) %></textarea> - -<h2>Special Domains</h2> -<p> -If you have a specail domain that needs to be accessed in a special way, you -may specify if here. This will allow anonymous access to the domains listed. -Enter the domain url below. Regular expressions are allowed. -</p> -<textarea name="s_domain"><%= html.html_escape( service.config.s_domain ) %></textarea> - -<h3>Save Changes</h3> -<div class='item'><p class='left'>Save changes of the above boxes</p> -<div class='right'> -<input class="submit" type="submit" name="submit" value="save"> -</div></div><!-- end .item --> -</form> |