From 31569e1a2c3929808a277fce49a2686bbd0a76c7 Mon Sep 17 00:00:00 2001 From: Andreas Brodmann Date: Mon, 18 Feb 2008 12:53:40 +0000 Subject: git-svn-id: svn://svn.alpinelinux.org/acf/dansguardian/trunk@730 ab2d0c66-481e-0410-8bed-d214d4d58bed --- Makefile | 1 + dansguardian-category-html.lsp | 23 ++++++++++++++++++----- dansguardian-controller.lua | 2 +- dansguardian-model.lua | 17 +++++++++++++++++ 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.

Categories

-

Delete Category

+

Add Category

+

+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.) +

+
Category name
+
Category files
weighted banned exception
+
Action
+

+

Delete Category

+

+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. +

- +
Categories available
(please check the ones you want to delete)
\n" ) + io.write( "
" .. v .. "
\n" ) end ?> - -
" .. v .. "
+
Action
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 + -- cgit v1.2.3