1 package net.sourceforge.blogentis.modules.actions;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import net.sourceforge.blogentis.om.Blog;
26 import net.sourceforge.blogentis.turbine.BlogParameterParser;
27 import net.sourceforge.blogentis.turbine.SecureBlogAction;
28 import net.sourceforge.blogentis.utils.BlogConstants;
29 import net.sourceforge.blogentis.utils.MappedConfiguration;
30
31 import org.apache.commons.configuration.SubsetConfiguration;
32 import org.apache.turbine.util.RunData;
33 import org.apache.velocity.context.Context;
34
35 public class BlogCommentMod
36 extends SecureBlogAction {
37 protected String[] getPermissions() {
38 return new String[] {BlogConstants.PERM_ADMIN_BLOG};
39 }
40
41 public void doPerform(RunData data, Context context)
42 throws Exception {
43
44
45
46
47
48 BlogParameterParser pp = (BlogParameterParser)data.getParameters();
49 Blog blog = pp.getBlog();
50
51 MappedConfiguration master = blog.getConfiguration();
52 SubsetConfiguration conf = new SubsetConfiguration(master, "blog", ".");
53
54 conf.setProperty("allowComments", pp
55 .getBooleanObject("allowComments", new Boolean(true)));
56 conf.setProperty("commentTimeLimit", pp
57 .getBooleanObject("commentTimeLimit", new Boolean(false)));
58 conf.setProperty("commentTimeLimitValue", pp
59 .getIntObject("commentTimeLimitValue", new Integer(30)));
60 master.save();
61 }
62 }