From 31569e1a2c3929808a277fce49a2686bbd0a76c7 Mon Sep 17 00:00:00 2001
From: Andreas Brodmann
io.write( service.cfgerr ) ?>-
+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.) +
++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. +
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