diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-10-13 14:57:17 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-10-13 14:57:17 +0000 |
commit | 303266d5fc5c1463a2aeecb2b4cc801b81ddfb06 (patch) | |
tree | 0d12b6360ddf38501b125388d4a0a29729449d2a | |
parent | ea59dcbdbed15ca5bd60f50cd8107451e74928dd (diff) | |
download | acf-alpine-baselayout-303266d5fc5c1463a2aeecb2b4cc801b81ddfb06.tar.bz2 acf-alpine-baselayout-303266d5fc5c1463a2aeecb2b4cc801b81ddfb06.tar.xz |
Added Restart Networking function to interfaces. Redirect to read after update.
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@1553 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | alpine-baselayout.roles | 2 | ||||
-rw-r--r-- | interfaces-controller.lua | 6 | ||||
-rw-r--r-- | interfaces-model.lua | 5 | ||||
-rw-r--r-- | interfaces-read-html.lsp | 16 |
4 files changed, 18 insertions, 11 deletions
diff --git a/alpine-baselayout.roles b/alpine-baselayout.roles index 24d0207..0c25ac9 100644 --- a/alpine-baselayout.roles +++ b/alpine-baselayout.roles @@ -1,5 +1,5 @@ CREATE=interfaces:create,interfaces:editintfile READ=health:storage,health:proc,health:network,health:modules,health:networkstats,interfaces:status,interfaces:read,logfiles:status,logfiles:view,logfiles:download,logfiles:tail,syslog:status,syslog:loginfo,rc:status -UPDATE=interfaces:update,interfaces:ifup,interfaces:ifdown,skins:update,skins:read,syslog:startstop,syslog:config,syslog:expert,rc:edit +UPDATE=interfaces:update,interfaces:ifup,interfaces:ifdown,interfaces:restart,skins:update,skins:read,syslog:startstop,syslog:config,syslog:expert,rc:edit DELETE=interfaces:delete,logfiles:delete ALL=health:system,hostname:read diff --git a/interfaces-controller.lua b/interfaces-controller.lua index cc3de23..03c072f 100644 --- a/interfaces-controller.lua +++ b/interfaces-controller.lua @@ -14,7 +14,7 @@ read = function (self) end update = function(self) - return controllerfunctions.handle_form(self, function() return self.model.get_iface_by_name(self.clientdata.name or "") end, self.model.update_iface, self.clientdata, "Save", "Update Interface", "Interface updated") + return controllerfunctions.handle_form(self, function() return self.model.get_iface_by_name(self.clientdata.name or "") end, self.model.update_iface, self.clientdata, "Save", "Update Interface", "Interface updated", "read") end delete = function(self) @@ -36,3 +36,7 @@ end editintfile = function(self) return controllerfunctions.handle_form(self, self.model.get_file, self.model.write_file, self.clientdata, "Save", "Edit Interfaces file", "File saved") end + +restart = function(self) + return self:redirect_to_referrer(self.model.restartnetworking()) +end diff --git a/interfaces-model.lua b/interfaces-model.lua index 2617eee..8d4a32b 100644 --- a/interfaces-model.lua +++ b/interfaces-model.lua @@ -2,6 +2,7 @@ -- Copyright(c) 2007 N. Angelacos - Licensed under terms of GPL2 module (..., package.seeall) +require("modelfunctions") require("fs") -- iface is a local (private) table with private methods for managing @@ -491,3 +492,7 @@ get_addresses = function() end return cfe({ type="structure", value=retval, label="Interface IP Addresses" }) end + +restartnetworking = function() + return modelfunctions.startstop_service("networking", "restart") +end diff --git a/interfaces-read-html.lsp b/interfaces-read-html.lsp index ac910a9..f3279a2 100644 --- a/interfaces-read-html.lsp +++ b/interfaces-read-html.lsp @@ -1,4 +1,4 @@ -<% local view, viewlibrary, pageinfo, session = ... +<% local view, viewlibrary, page_info, session = ... require("viewfunctions") %> <% @@ -19,7 +19,7 @@ io.write("</span>") <% end %> <% end %> -<% displaycommandresults({"delete", "ifup", "ifdown"}, session) %> +<% displaycommandresults({"delete", "ifup", "ifdown", "restart"}, session) %> <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("status") @@ -59,10 +59,8 @@ end %> </DD> </DL> -<% ---[[ DEBUG INFORMATION -io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") -io.write(html.cfe_unpack(form)) -io.write("</span>") ---]] -%> +<H1>Restart Networking</H1> +<DL> +<DT>Restart Networking</DT> +<DD><form action="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/restart" %>"><input class="submit" type="submit" value="Restart"></form></DD> +</DL> |