diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-01-02 21:17:49 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-01-02 21:17:49 +0000 |
commit | 27408fa54e736cbcc741c3e41171d8f65b2848db (patch) | |
tree | 9cfa089e975880a50b12f6de029236c239792308 | |
download | acf-gross-27408fa54e736cbcc741c3e41171d8f65b2848db.tar.bz2 acf-gross-27408fa54e736cbcc741c3e41171d8f65b2848db.tar.xz |
Added gross controller with basic functionality.
git-svn-id: svn://svn.alpinelinux.org/acf/gross/trunk@1662 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | Makefile | 44 | ||||
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | config.mk | 10 | ||||
-rw-r--r-- | gross-controller.lua | 22 | ||||
-rw-r--r-- | gross-details-html.lsp | 17 | ||||
l--------- | gross-expert-html.lsp | 1 | ||||
-rw-r--r-- | gross-logfile-html.lsp | 7 | ||||
-rw-r--r-- | gross-model.lua | 39 | ||||
l--------- | gross-startstop-html.lsp | 1 | ||||
l--------- | gross-status-html.lsp | 1 | ||||
-rw-r--r-- | gross.menu | 4 | ||||
-rw-r--r-- | gross.roles | 3 |
12 files changed, 150 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e3c7d2d --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +APP_NAME=gross +PACKAGE=acf-$(APP_NAME) +VERSION=0.1.0 + +APP_DIST=\ + gross* \ + + +EXTRA_DIST=README Makefile config.mk + +DISTFILES=$(APP_DIST) $(EXTRA_DIST) + +TAR=tar + +P=$(PACKAGE)-$(VERSION) +tarball=$(P).tar.bz2 +install_dir=$(DESTDIR)/$(appdir)/$(APP_NAME) + +all: +clean: + rm -rf $(tarball) $(P) + +dist: $(tarball) + +install: + mkdir -p "$(install_dir)" + cp -a $(APP_DIST) "$(install_dir)" + +$(tarball): $(DISTFILES) + rm -rf $(P) + mkdir -p $(P) + cp -a $(DISTFILES) $(P) + $(TAR) -jcf $@ $(P) + rm -rf $(P) + +# target that creates a tar package, unpacks is and install from package +dist-install: $(tarball) + $(TAR) -jxf $(tarball) + $(MAKE) -C $(P) install DESTDIR=$(DESTDIR) + rm -rf $(P) + +include config.mk + +.PHONY: all clean dist install dist-install @@ -0,0 +1 @@ +ACF for gross diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..45f4d21 --- /dev/null +++ b/config.mk @@ -0,0 +1,10 @@ +prefix=/usr +datadir=${prefix}/share +sysconfdir=${prefix}/etc +localstatedir=${prefix}/var +acfdir=${datadir}/acf +wwwdir=${acfdir}/www +cgibindir=${acfdir}/cgi-bin +appdir=${acfdir}/app +acflibdir=${acfdir}/lib +sessionsdir=${localstatedir}/lib/acf/sessions diff --git a/gross-controller.lua b/gross-controller.lua new file mode 100644 index 0000000..b453f59 --- /dev/null +++ b/gross-controller.lua @@ -0,0 +1,22 @@ +module(..., package.seeall) + +-- Load libraries +require("controllerfunctions") + +default_action = "status" + +function status(self) + return self.model.getstatus() +end + +function startstop(self) + return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata) +end + +function details(self) + return self.model.getstatusdetails() +end + +function expert(self) + return controllerfunctions.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Gross Config", "Configuration Set") +end diff --git a/gross-details-html.lsp b/gross-details-html.lsp new file mode 100644 index 0000000..f60bb13 --- /dev/null +++ b/gross-details-html.lsp @@ -0,0 +1,17 @@ +<% local data, viewlibrary = ... +require("viewfunctions") +--[[ DEBUG INFORMATION +io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") +io.write(html.cfe_unpack(data)) +io.write("</span>") +--]] +%> + +<% viewlibrary.dispatch_component("status") %> + +<H2><%= data.label %></H2> +<DL> +<% +displayitem(data) +%> +</DL> diff --git a/gross-expert-html.lsp b/gross-expert-html.lsp new file mode 120000 index 0000000..207f324 --- /dev/null +++ b/gross-expert-html.lsp @@ -0,0 +1 @@ +../expert-html.lsp
\ No newline at end of file diff --git a/gross-logfile-html.lsp b/gross-logfile-html.lsp new file mode 100644 index 0000000..7287262 --- /dev/null +++ b/gross-logfile-html.lsp @@ -0,0 +1,7 @@ +<% local data, viewlibrary = ... +require("viewfunctions") +%> + +<% if viewlibrary and viewlibrary.dispatch_component then + viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {name="/var/log/messages", grep="gross"}) +end %> diff --git a/gross-model.lua b/gross-model.lua new file mode 100644 index 0000000..c18fdcd --- /dev/null +++ b/gross-model.lua @@ -0,0 +1,39 @@ +module(..., package.seeall) + +-- Load libraries +require("modelfunctions") +require("fs") +require("format") + +-- Set variables +local configfile = "/etc/grossd.conf" +local processname = "grossd" +local packagename = "gross" + +local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin " + +-- ################################################################################ +-- LOCAL FUNCTIONS + +-- ################################################################################ +-- PUBLIC FUNCTIONS + +function startstop_service(action) + return modelfunctions.startstop_service(processname, action) +end + +function getstatus() + return modelfunctions.getstatus(processname, packagename, "Gross Status") +end + +function getstatusdetails() + return cfe({ type="longtext", value="", label="Gross Status Details" }) +end + +function get_filedetails() + return modelfunctions.getfiledetails(configfile) +end + +function update_filedetails(filedetails) + return modelfunctions.setfiledetails(filedetails, {configfile}) +end diff --git a/gross-startstop-html.lsp b/gross-startstop-html.lsp new file mode 120000 index 0000000..0ea2627 --- /dev/null +++ b/gross-startstop-html.lsp @@ -0,0 +1 @@ +../startstop-html.lsp
\ No newline at end of file diff --git a/gross-status-html.lsp b/gross-status-html.lsp new file mode 120000 index 0000000..b2f8480 --- /dev/null +++ b/gross-status-html.lsp @@ -0,0 +1 @@ +../status-html.lsp
\ No newline at end of file diff --git a/gross.menu b/gross.menu new file mode 100644 index 0000000..33e7896 --- /dev/null +++ b/gross.menu @@ -0,0 +1,4 @@ +#CAT GROUP/DESC TAB ACTION +Networking 32Gross Status details +Networking 32Gross Expert expert +Networking 32Gross Logfile logfile diff --git a/gross.roles b/gross.roles new file mode 100644 index 0000000..10b0f98 --- /dev/null +++ b/gross.roles @@ -0,0 +1,3 @@ +USER=gross:status,gross:logfile,gross:details,gross:startstop +EXPERT=gross:expert +ADMIN=gross:status,gross:logfile,gross:details,gross:startstop,gross:expert |