1 package net.sourceforge.blogentis.plugins.impl;
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 java.util.Arrays;
26 import java.util.List;
27
28 import net.sourceforge.blogentis.om.Blog;
29 import net.sourceforge.blogentis.plugins.IPlugin;
30 import net.sourceforge.blogentis.plugins.base.AbstractNavigationExtension;
31 import net.sourceforge.blogentis.turbine.BlogRunData;
32
33 /***
34 * This extension adds the basic navigations
35 *
36 * @author abas
37 */
38 public class BasicNavigationExtension
39 extends AbstractNavigationExtension {
40 public BasicNavigationExtension(IPlugin plugin, Blog blog) {
41 super(plugin, blog);
42 }
43
44 private static final LinkToTemplate[] adminPages = new LinkToTemplate[] {
45 new LinkToTemplate("BlogUsers", "Users", BlogAdminAuthenticator),
46 new LinkToTemplate("BlogSections", "Sections",
47 BlogAdminAuthenticator),
48 new LinkToTemplate("BlogPlugins", "Plugins", BlogAdminAuthenticator),
49 new LinkToTemplate("BlogProperties", "Settings",
50 BlogAdminAuthenticator)};
51
52 private static final LinkToTemplate[] blogSettingsPages = new LinkToSplitPage[] {
53 new LinkToSplitPage("BlogProperties", "Appearance", "0",
54 BlogAdminAuthenticator),
55 new LinkToSplitPage("BlogSideboxes", "Sideboxes", "0",
56 BlogAdminAuthenticator),
57 new LinkToSplitPage("BlogComments", "Comments", "0",
58 BlogAdminAuthenticator)};
59
60 private static final LinkToTemplate[] appearancePages = new LinkToSplitPage[] {
61 new LinkToSplitPage("BlogProperties", "Blog Name", "0",
62 BlogAdminAuthenticator),
63 new LinkToSplitPage("BlogProperties", "Main Page", "1",
64 BlogAdminAuthenticator),
65 new LinkToSplitPage("BlogProperties", "Section Appearance", "2",
66 BlogAdminAuthenticator),
67 new LinkToSplitPage("BlogProperties", "Post View", "3",
68 BlogAdminAuthenticator)};
69
70 private static final LinkToTemplate[] sideboxPages = new LinkToSplitPage[] {
71 new LinkToSplitPage("BlogSideboxes", "Recent Comments", "0",
72 BlogAdminAuthenticator),
73 new LinkToSplitPage("BlogSideboxes", "Recent Posts", "1",
74 BlogAdminAuthenticator)};
75
76 private static final List adminList = Arrays.asList(adminPages),
77 blogSettingsList = Arrays.asList(blogSettingsPages),
78 appearanceList = Arrays.asList(appearancePages),
79 sideboxList = Arrays.asList(sideboxPages);
80
81 public void addNavigations(BlogRunData data, String navName, List links) {
82 if (!BlogAdminAuthenticator.isVisible(data))
83 return;
84 if (ADMIN_LIST_NAME.equals(navName)) {
85 links.addAll(adminList);
86 } else if (BLOG_SETTINGS_NAME.equals(navName)) {
87 links.addAll(blogSettingsList);
88 } else if (APPEARANCE_LIST_NAME.equals(navName)) {
89 links.addAll(appearanceList);
90 } else if (SIDEBOX_LIST_NAME.equals(navName)) {
91 links.addAll(sideboxList);
92 }
93 }
94
95 public String getName() {
96 return "Basic Navigation Support";
97 }
98 }