1 package net.sourceforge.blogentis.modules.screens;
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.turbine.BlogParameterParser;
26 import net.sourceforge.blogentis.turbine.SecureBlogScreen;
27 import net.sourceforge.blogentis.utils.BlogConstants;
28 import net.sourceforge.blogentis.utils.MappedConfiguration;
29
30 import org.apache.commons.configuration.SubsetConfiguration;
31 import org.apache.turbine.util.RunData;
32 import org.apache.velocity.context.Context;
33
34 /***
35 * @author abas
36 */
37 public class BlogSideboxes
38 extends SecureBlogScreen {
39 protected void doBuildTemplate(RunData data, Context context)
40 throws Exception {
41 BlogParameterParser pp = (BlogParameterParser)data.getParameters();
42 int state = pp.getInt("s", 0);
43 context.put("s", pp.getIntObject("s", new Integer(state)));
44 super.doBuildTemplate(data, context);
45 MappedConfiguration conf = pp.getBlog().getConfiguration();
46 switch (state) {
47 case 0:
48 context.put("conf", new SubsetConfiguration(conf, "RecentComments",
49 "."));
50 break;
51 case 1:
52 context.put("conf", new SubsetConfiguration(conf, "RecentPosts",
53 "."));
54 break;
55 default:
56 break;
57 }
58 }
59
60 protected String[] getPermissions() {
61 return new String[] {BlogConstants.PERM_ADMIN_BLOG};
62 }
63 }