summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Brodmann <andreas.brodmann@gmail.com>2008-02-18 12:53:40 +0000
committerAndreas Brodmann <andreas.brodmann@gmail.com>2008-02-18 12:53:40 +0000
commit31569e1a2c3929808a277fce49a2686bbd0a76c7 (patch)
tree3f89078ba10bca979633679fe3127649bd079840
parent1c08ebad2d6e3b2f7c58fe67d7b39fc54407e47e (diff)
downloadacf-dansguardian-31569e1a2c3929808a277fce49a2686bbd0a76c7.tar.bz2
acf-dansguardian-31569e1a2c3929808a277fce49a2686bbd0a76c7.tar.xz
git-svn-id: svn://svn.alpinelinux.org/acf/dansguardian/trunk@730 ab2d0c66-481e-0410-8bed-d214d4d58bedv0.1
-rw-r--r--Makefile1
-rw-r--r--dansguardian-category-html.lsp23
-rw-r--r--dansguardian-controller.lua2
-rw-r--r--dansguardian-model.lua17
4 files changed, 37 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index b74e146..83e0b10 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,7 @@ VERSION=0.1
APP_DIST=dansguardian-controller.lua \
dansguardian-model.lua \
dansguardian-general-html.lsp \
+ dansguardian-category-html.lsp \
dansguardian-advanced-html.lsp \
dansguardian-edit-html.lsp \
dansguardian-plain-html.lsp \
diff --git a/dansguardian-category-html.lsp b/dansguardian-category-html.lsp
index 32ef877..bbe1a20 100644
--- a/dansguardian-category-html.lsp
+++ b/dansguardian-category-html.lsp
@@ -44,16 +44,29 @@ until you restart the service.</p>
<h1>Categories</h1>
<p><pre class=error><? io.write( service.cfgerr ) ?></pre></p>
-<h2>Delete Category</h2>
+<h2>Add Category</h2>
+<p>
+To add a category, or to add a file to an existing category, please fill in the corresponding information below.
+(Due to a limitation with DansGuardian, all categories must be lowercase.)
+</p>
+<dl><dt>Category name</dt><dd><input type="text" name="newcat" value=""></dd></dl>
+<dl><dt>Category files</dt><dd><input type="checkbox" name="cattype" value="w">weighted <input type="checkbox" name="cattype" value="b">banned <input type="checkbox" name="cattype" value="e">exception</dd></dl>
+<dl><dt>Action</dt><dd><input class="submit" type="submit" name="cmd" value="add"></dd></dl>
+<p></p>
+<h2>Delete Category</h2>
+<p>
+Select the categories you wish to delete. Please note that this deletes the category, but does not
+delete the link in the corresponding phraselist above. You will also need to edit the phraselist file
+above if you delete a category.
+</p>
<form action="" method="POST">
-<table>
+<dl><dt>Categories available</dt><dd>(please check the ones you want to delete)</dd></dl>
<?
for k,v in ipairs( config ) do
- io.write( "<tr><td><input type=\"checkbox\" name=\"cats\" value=\"" .. v .. "\"> " .. v .. "</td></tr>\n" )
+ io.write( "<dl><dt></dt><dd><input type=\"checkbox\" name=\"cats\" value=\"" .. v .. "\"> " .. v .. "</dd></dl>\n" )
end
?>
-<tr><td><input class="submit" type="submit" name="cmd" value="delete"></td></tr>
-</table>
+<dl><dt>Action</dt><dd><input class="submit" type="submit" name="cmd" value="delete"></dd></dl>
</form>
diff --git a/dansguardian-controller.lua b/dansguardian-controller.lua
index 0d6c7e8..8160131 100644
--- a/dansguardian-controller.lua
+++ b/dansguardian-controller.lua
@@ -169,7 +169,7 @@ category = function( self )
extra = ""
}
- local service = { message="", status="", config="" }
+ local service = { message="", status="", config="", cfgerr="" }
service.config = self.model.get_categories()
diff --git a/dansguardian-model.lua b/dansguardian-model.lua
index 1abec68..63694e2 100644
--- a/dansguardian-model.lua
+++ b/dansguardian-model.lua
@@ -352,3 +352,20 @@ is_valid_configfile = function( name )
return retval
end
+get_categories = function()
+
+ local retval = {}
+ local entries = posix.dir( "/etc/dansguardian/phraselists" )
+ local k = ""
+ local v = ""
+
+ for k,v in ipairs( entries ) do
+ local attrs = posix.stat( "/etc/dansguardian/phraselists/" .. v )
+ if attrs.type == "directory" and v ~= "." and v ~= ".." then
+ table.insert( retval, v )
+ end
+ end
+
+ return retval
+end
+