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 fr.paris.lutece.plugins.whatsnew.web;
35
36 import fr.paris.lutece.plugins.whatsnew.business.ElementOrderEnum;
37 import fr.paris.lutece.plugins.whatsnew.business.WhatsNew;
38 import fr.paris.lutece.plugins.whatsnew.service.WhatsNewPlugin;
39 import fr.paris.lutece.plugins.whatsnew.service.WhatsNewResourceIdService;
40 import fr.paris.lutece.plugins.whatsnew.service.WhatsNewService;
41 import fr.paris.lutece.plugins.whatsnew.service.parameter.WhatsNewParameterService;
42 import fr.paris.lutece.plugins.whatsnew.utils.constants.WhatsNewConstants;
43 import fr.paris.lutece.portal.business.rbac.RBAC;
44 import fr.paris.lutece.portal.business.user.AdminUser;
45 import fr.paris.lutece.portal.service.dashboard.admin.AdminDashboardComponent;
46 import fr.paris.lutece.portal.service.plugin.Plugin;
47 import fr.paris.lutece.portal.service.plugin.PluginService;
48 import fr.paris.lutece.portal.service.rbac.RBACService;
49 import fr.paris.lutece.portal.service.template.AppTemplateService;
50 import fr.paris.lutece.util.html.HtmlTemplate;
51
52 import org.apache.commons.lang.StringUtils;
53
54 import java.util.HashMap;
55 import java.util.Map;
56
57 import javax.servlet.http.HttpServletRequest;
58
59
60
61
62
63
64
65 public class WhatsNewAdminDashboardComponent extends AdminDashboardComponent
66 {
67
68 private static final String TEMPLATE_ADMIN_DASHBOARD = "admin/plugins/whatsnew/whatsnew_admindashboard.html";
69
70
71
72
73 @Override
74 public String getDashboardData( AdminUser user, HttpServletRequest request )
75 {
76 String strHtml = StringUtils.EMPTY;
77
78 if ( RBACService.isAuthorized( WhatsNew.RESOURCE_TYPE, RBAC.WILDCARD_RESOURCES_ID,
79 WhatsNewResourceIdService.PERMISSION_MANAGE_ADVANCED_PARAMETERS, user ) )
80 {
81 Plugin plugin = PluginService.getPlugin( WhatsNewPlugin.PLUGIN_NAME );
82 Map<String, Object> model = new HashMap<String, Object>( );
83 model.put( WhatsNewConstants.MARK_COMBO_PERIOD, WhatsNewService.getInstance( ).getComboDays( ) );
84 model.put( WhatsNewConstants.MARK_LIST_PARAM_DEFAULT_VALUES,
85 WhatsNewParameterService.getInstance( ).getParamDefaultValues( plugin ) );
86 model.put( WhatsNewConstants.MARK_DISPLAY_ORDER_DATE, ElementOrderEnum.DATE.getId( ) );
87 model.put( WhatsNewConstants.MARK_DISPLAY_ORDER_ALPHA, ElementOrderEnum.ALPHA.getId( ) );
88 model.put( WhatsNewConstants.MARK_DISPLAY_ORDER_ASC, WhatsNewConstants.DISPLAY_ASC );
89 model.put( WhatsNewConstants.MARK_DISPLAY_ORDER_DESC, WhatsNewConstants.DISPLAY_DESC );
90
91 HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_ADMIN_DASHBOARD, user.getLocale( ), model );
92
93 strHtml = template.getHtml( );
94 }
95
96 return strHtml;
97 }
98 }