Commit 27408fa5 authored by Ted Trask's avatar Ted Trask

Added gross controller with basic functionality.

git-svn-id: svn://svn.alpinelinux.org/acf/gross/trunk@1662 ab2d0c66-481e-0410-8bed-d214d4d58bed
parents
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
ACF for gross
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
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
<% 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>
../expert-html.lsp
\ No newline at end of file
<% 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 %>
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
../startstop-html.lsp
\ No newline at end of file
../status-html.lsp
\ No newline at end of file
#CAT GROUP/DESC TAB ACTION
Networking 32Gross Status details
Networking 32Gross Expert expert
Networking 32Gross Logfile logfile
USER=gross:status,gross:logfile,gross:details,gross:startstop
EXPERT=gross:expert
ADMIN=gross:status,gross:logfile,gross:details,gross:startstop,gross:expert
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment