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.BlogPropertyCache;
29
30 import org.apache.turbine.util.RunData;
31 import org.apache.velocity.context.Context;
32
33 /***
34 * @author abas
35 */
36 public class BlogProperties extends SecureBlogScreen {
37 protected void doBuildTemplate(RunData data, Context context)
38 throws Exception {
39 BlogParameterParser pp = (BlogParameterParser)data.getParameters();
40 int state = pp.getInt("s", 0);
41 context.put("s", pp.getIntObject("s", new Integer(state)));
42 super.doBuildTemplate(data, context);
43 BlogPropertyCache bpc = BlogPropertyCache.getInstance();
44 switch (state) {
45 case 0:
46 case 1:
47 context.put("props", bpc.getBlogProperties(pp.getBlog()));
48 break;
49 case 2:
50 context.put("props", bpc.getSectionProperties(pp.getBlog()));
51 break;
52 case 3:
53 context.put("props", bpc.getPostProperties(pp.getBlog()));
54 break;
55 default:
56 break;
57 }
58 }
59
60 protected String[] getPermissions() {
61 return new String[]{BlogConstants.PERM_ADMIN_BLOG};
62 }
63 }