summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-12-31 21:15:25 +0000
committerTed Trask <ttrask01@yahoo.com>2008-12-31 21:15:25 +0000
commitba47f1e7c2d7494bbc9c424c4d40e100addf3005 (patch)
tree4797b867f9ff25e31f1c9b2ee4e8667e62afd36d
downloadacf-dovecot-ba47f1e7c2d7494bbc9c424c4d40e100addf3005.tar.bz2
acf-dovecot-ba47f1e7c2d7494bbc9c424c4d40e100addf3005.tar.xz
Added dovecot controller with basic functionality.
git-svn-id: svn://svn.alpinelinux.org/acf/dovecot/trunk@1658 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--Makefile44
-rw-r--r--README1
-rw-r--r--config.mk10
-rw-r--r--dovecot-controller.lua22
-rw-r--r--dovecot-details-html.lsp17
l---------dovecot-expert-html.lsp1
-rw-r--r--dovecot-logfile-html.lsp7
-rw-r--r--dovecot-model.lua39
l---------dovecot-startstop-html.lsp1
l---------dovecot-status-html.lsp1
-rw-r--r--dovecot.menu4
-rw-r--r--dovecot.roles3
12 files changed, 150 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..286a1c8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+APP_NAME=dovecot
+PACKAGE=acf-$(APP_NAME)
+VERSION=0.1.0
+
+APP_DIST=\
+ dovecot* \
+
+
+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
diff --git a/README b/README
new file mode 100644
index 0000000..dc8c5e7
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+ACF for dovecot
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/dovecot-controller.lua b/dovecot-controller.lua
new file mode 100644
index 0000000..859055f
--- /dev/null
+++ b/dovecot-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 Dovecot Config", "Configuration Set")
+end
diff --git a/dovecot-details-html.lsp b/dovecot-details-html.lsp
new file mode 100644
index 0000000..f60bb13
--- /dev/null
+++ b/dovecot-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/dovecot-expert-html.lsp b/dovecot-expert-html.lsp
new file mode 120000
index 0000000..207f324
--- /dev/null
+++ b/dovecot-expert-html.lsp
@@ -0,0 +1 @@
+../expert-html.lsp \ No newline at end of file
diff --git a/dovecot-logfile-html.lsp b/dovecot-logfile-html.lsp
new file mode 100644
index 0000000..8924317
--- /dev/null
+++ b/dovecot-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="dovecot"})
+end %>
diff --git a/dovecot-model.lua b/dovecot-model.lua
new file mode 100644
index 0000000..06dc180
--- /dev/null
+++ b/dovecot-model.lua
@@ -0,0 +1,39 @@
+module(..., package.seeall)
+
+-- Load libraries
+require("modelfunctions")
+require("fs")
+require("format")
+
+-- Set variables
+local configfile = "/etc/dovecot/dovecot.conf"
+local processname = "dovecot"
+local packagename = "dovecot"
+
+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, "Dovecot Status")
+end
+
+function getstatusdetails()
+ return cfe({ type="longtext", value="", label="Dovecot Status Details" })
+end
+
+function get_filedetails()
+ return modelfunctions.getfiledetails(configfile)
+end
+
+function update_filedetails(filedetails)
+ return modelfunctions.setfiledetails(filedetails, {configfile})
+end
diff --git a/dovecot-startstop-html.lsp b/dovecot-startstop-html.lsp
new file mode 120000
index 0000000..0ea2627
--- /dev/null
+++ b/dovecot-startstop-html.lsp
@@ -0,0 +1 @@
+../startstop-html.lsp \ No newline at end of file
diff --git a/dovecot-status-html.lsp b/dovecot-status-html.lsp
new file mode 120000
index 0000000..b2f8480
--- /dev/null
+++ b/dovecot-status-html.lsp
@@ -0,0 +1 @@
+../status-html.lsp \ No newline at end of file
diff --git a/dovecot.menu b/dovecot.menu
new file mode 100644
index 0000000..0d59f3e
--- /dev/null
+++ b/dovecot.menu
@@ -0,0 +1,4 @@
+#CAT GROUP/DESC TAB ACTION
+Networking 28Dovecot Status details
+Networking 28Dovecot Expert expert
+Networking 28Dovecot Logfile logfile
diff --git a/dovecot.roles b/dovecot.roles
new file mode 100644
index 0000000..0db2acd
--- /dev/null
+++ b/dovecot.roles
@@ -0,0 +1,3 @@
+USER=dovecot:status,dovecot:logfile,dovecot:details,dovecot:startstop
+EXPERT=dovecot:expert
+ADMIN=dovecot:status,dovecot:logfile,dovecot:details,dovecot:startstop,dovecot:expert