Commit 31569e1a authored by Andreas Brodmann's avatar Andreas Brodmann

git-svn-id: svn://svn.alpinelinux.org/acf/dansguardian/trunk@730 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent 1c08ebad
......@@ -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 \
......
......@@ -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>
......@@ -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()
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment