summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Brodmann <andreas.brodmann@gmail.com>2008-01-16 13:31:59 +0000
committerAndreas Brodmann <andreas.brodmann@gmail.com>2008-01-16 13:31:59 +0000
commita6120a0548246e75dbc247e15326821a7043df34 (patch)
treec2dfcbabd347a680fa1617381006176a4f52fc7d
parent2e98280f07da84950af2fa5c2cdadfedf3590c05 (diff)
downloadacf-squid-a6120a0548246e75dbc247e15326821a7043df34.tar.bz2
acf-squid-a6120a0548246e75dbc247e15326821a7043df34.tar.xz
updates to the squid/dansguardian gui, e.g. get_version stuff, unified the apps to look the same as the others
git-svn-id: svn://svn.alpinelinux.org/acf/squid/trunk@589 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--dansguardian-controller.lua5
-rw-r--r--dansguardian-general-html.lsp19
-rw-r--r--dansguardian-model.lua15
-rw-r--r--squid-basic-html.lsp6
-rw-r--r--squid-controller.lua5
-rw-r--r--squid-model.lua14
6 files changed, 49 insertions, 15 deletions
diff --git a/dansguardian-controller.lua b/dansguardian-controller.lua
index 73813e1..d907f00 100644
--- a/dansguardian-controller.lua
+++ b/dansguardian-controller.lua
@@ -31,6 +31,8 @@ end
general = function( self )
+ local info = { status = { value = "stopped" }, version = { value = self.model.get_dansguardian_version() }, srvctrl = { value = srvctrl} };
+
local option = { script = ENV["SCRIPT_NAME"],
prefix = self.conf.prefix,
controller = self.conf.controller,
@@ -61,9 +63,10 @@ general = function( self )
end
service.status = self.model.get_status()
+ info.status.value = service.status
service.config, service.cfgerr = self.model.get_general_config()
- return ( cfe ({ option = option, service = service }) )
+ return ( cfe ({ option = option, service = service, info = info }) )
end
advanced = function( self )
diff --git a/dansguardian-general-html.lsp b/dansguardian-general-html.lsp
index 2dc3dcd..6379a8d 100644
--- a/dansguardian-general-html.lsp
+++ b/dansguardian-general-html.lsp
@@ -6,7 +6,7 @@
local srv1fill = ""
local srv2fill = "disabled"
- if service.status == "running" then
+ if form.info.status.value == "running" then
srv1fill = "disabled"
srv2fill = ""
end
@@ -27,12 +27,17 @@ identify harmful content. This means that updated "blacklists" are
generally not necessary. DansGuardian must be used in combination with a
"smart proxy", such as squid.
</p><p>
-<b>This page defines the basic network configuration settings for DansGuardian.</b>
+This page defines the basic network configuration settings for DansGuardian.
</p>
<h2>Status</h2>
+<dt>Program version</dt><dd><? io.write( form.info.version.value ) ?></dd>
+<dt>Process status</dt><dd><? io.write( form.info.status.value ) ?></dd>
+<dt>Process information</dt><dd>This process runs as a service. When you make
+and save changes, the configuration files for the service are changed.
+However, the changes will not be applied until you restart the service.</dd>
<form action="" method="POST">
-<dt>dansguardian is: <? io.write( service.status ) ?> </dt>
+<dt>Daemon control</dt>
<dd><input class="submit" type="submit" name="srvcmd" value="start" <? io.write( srv1fill ) ?> style="width:100px">
<input class="submit" type="submit" name="srvcmd" value="stop" <? io.write( srv2fill ) ?> style="width:100px">
<input class="submit" type="submit" name="srvcmd" value="restart" <? io.write( srv2fill ) ?> style="width:100px"></dd>
@@ -42,15 +47,9 @@ generally not necessary. DansGuardian must be used in combination with a
<pre style="color: #ff2020;"><? io.write( service.message ) ?></pre>
</p>
-<p>
-This process runs as a service. When you make and save changes, the configuration
-files for the service are changed. However, the changes will not be <i>applied</i>
-until you restart the service.
-</p>
-
<form action="" method="POST">
<h2>Configuration</h2>
-<pre style="color: #ff2020;"><? io.write( service.cfgerr ) ?></pre><br>
+<pre style="color: #ff2020;"><? io.write( service.cfgerr ) ?></pre>
<p>
These parameters define the interface and port that Dansguardian uses to accept connections.
</p>
diff --git a/dansguardian-model.lua b/dansguardian-model.lua
index 3660b37..b9ade6b 100644
--- a/dansguardian-model.lua
+++ b/dansguardian-model.lua
@@ -43,6 +43,21 @@ service_control = function( control )
return retval
end
+get_dansguardian_version = function()
+
+ local retval = ""
+
+ local ptr = io.popen( "/usr/sbin/dansguardian -v" )
+ if ptr ~= nil then
+ retval = ptr:read( "*l" )
+ ptr:close()
+ else
+ retval = "Error - Failed to program version"
+ end
+
+ return retval
+end
+
get_general_config = function()
local retval = {}
diff --git a/squid-basic-html.lsp b/squid-basic-html.lsp
index f4676dd..2d5fbac 100644
--- a/squid-basic-html.lsp
+++ b/squid-basic-html.lsp
@@ -6,7 +6,7 @@
local srv1fill = ""
local srv2fill = "disabled"
- if service.status == "running" then
+ if form.info.status.value == "running" then
srv1fill = "disabled"
srv2fill = ""
end
@@ -31,8 +31,8 @@ such as DansGuardian.</p>
<h2>Status</h2>
<form action="" method="POST">
-<dt>Program version</dt><DD>?</DD>
-<dt>Process status</dt><DD><? io.write( service.status ) ?></DD>
+<dt>Program version</dt><DD><? io.write( form.info.version.value ) ?></DD>
+<dt>Process status</dt><DD><? io.write( form.info.status.value ) ?></DD>
<DT>Process information</DT><DD>This process runs as a service. When you make and save changes, the configuration
files for the service are changed. However, the changes will not be <i>applied</i>
until you restart the service.</DD>
diff --git a/squid-controller.lua b/squid-controller.lua
index b09acab..f6a90f2 100644
--- a/squid-controller.lua
+++ b/squid-controller.lua
@@ -51,6 +51,8 @@ end
basic = function( self )
+ local info = { status = { value = "stopped" }, version = { value = self.model.get_squid_version() }, srvctrl = { value = srvctrl} };
+
local option = { script = ENV["SCRIPT_NAME"],
prefix = self.conf.prefix,
controller = self.conf.controller,
@@ -92,9 +94,10 @@ basic = function( self )
end
service.status = self.model.get_status()
+ info.status.value = service.status;
service.config, service.error = self.model.get_basic_config()
- return ( cfe ({ option = option, service = service }) )
+ return ( cfe ({ option = option, service = service, info = info }) )
end
authentication = function( self )
diff --git a/squid-model.lua b/squid-model.lua
index 0a080a2..3b55d60 100644
--- a/squid-model.lua
+++ b/squid-model.lua
@@ -65,6 +65,20 @@ get_status = function()
return retval
end
+get_squid_version = function()
+
+ local retval = ""
+
+ local ptr = io.popen( "/usr/sbin/squid -v" )
+ retval = ptr:read( "*l" )
+ ptr:close()
+ if retval == nil then
+ retval = "Error - can't retrieve squid version"
+ end
+
+ return retval
+end
+
get_status_winbindd = function()
local retval = "stopped"