1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package info.magnolia.module.admininterface.pages;
35
36 import info.magnolia.cms.core.Content;
37 import info.magnolia.cms.i18n.Messages;
38 import info.magnolia.cms.i18n.MessagesManager;
39 import info.magnolia.cms.license.LicenseFileExtractor;
40 import info.magnolia.cms.security.ExternalUser;
41 import info.magnolia.cms.security.MgnlUser;
42 import info.magnolia.cms.security.User;
43 import info.magnolia.cms.util.AlertUtil;
44 import info.magnolia.context.MgnlContext;
45 import info.magnolia.module.admininterface.Navigation;
46 import info.magnolia.module.admininterface.TemplatedMVCHandler;
47
48 import javax.servlet.http.HttpServletRequest;
49 import javax.servlet.http.HttpServletResponse;
50
51
52
53
54
55
56 public class AdminCentralPage extends TemplatedMVCHandler {
57
58
59
60
61
62
63
64 public AdminCentralPage(String name, HttpServletRequest request, HttpServletResponse response) {
65 super(name, request, response);
66 }
67
68 public Navigation getNavigation() {
69 Navigation navigation = new Navigation("/modules/adminInterface/config/menu", "mgnlNavigation");
70 return navigation;
71 }
72
73 public String getVersionString() {
74 return "("
75 + LicenseFileExtractor.getInstance().get(LicenseFileExtractor.EDITION)
76 + ", "
77 + LicenseFileExtractor.getInstance().get(LicenseFileExtractor.VERSION_NUMBER)
78 + ")";
79 }
80
81 public User getUser() {
82 return MgnlContext.getUser();
83 }
84
85 public Content getUserNode() {
86 if (getUser() instanceof MgnlUser) {
87 return ((MgnlUser) getUser()).getUserNode();
88 } else {
89 return null;
90 }
91 }
92
93 public Messages getMessages() {
94 return MessagesManager.getMessages();
95 }
96
97 public String getMessage(){
98 if(AlertUtil.isMessageSet(MgnlContext.getSystemContext())){
99 String msg = AlertUtil.getMessage(MgnlContext.getSystemContext());
100 return "<b>" + MessagesManager.getWithDefault(msg, msg) + "</b>";
101 }
102 return null;
103 }
104
105 public String getMessageCSSClass(){
106 if(AlertUtil.isExceptionSet()){
107 return "messageBoxError";
108 }
109 else{
110 return "messageBoxWarn";
111 }
112 }
113
114 }