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.portal.web.template;
35
36 import fr.paris.lutece.portal.business.template.AutoInclude;
37 import fr.paris.lutece.portal.business.user.AdminUser;
38 import fr.paris.lutece.portal.service.dashboard.admin.AdminDashboardComponent;
39 import fr.paris.lutece.portal.service.template.AppTemplateService;
40 import fr.paris.lutece.portal.service.template.CommonsService;
41 import fr.paris.lutece.portal.service.template.FreeMarkerTemplateService;
42 import fr.paris.lutece.util.html.HtmlTemplate;
43 import java.util.HashMap;
44 import java.util.List;
45 import java.util.Map;
46 import javax.servlet.http.HttpServletRequest;
47
48
49
50
51 public class AutoIncludeAdminDashboardComponent extends AdminDashboardComponent
52 {
53
54 private static final String TEMPLATE_MANAGE_AUTOINCLUDES = "/admin/dashboard/admin/autoincludes_dashboard.html";
55
56 private static final String MARK_AUTOINCLUDE_LIST = "autoinclude_list";
57 private static final String MARK_AUTOIMPORT_MAP = "autoimport_map";
58 private static final String MARK_COMMONS_LIST = "commons_list";
59 private static final String MARK_CURRENT_COMMONS = "current_commons";
60
61
62
63
64 @Override
65 public String getDashboardData( AdminUser user, HttpServletRequest request )
66 {
67 Map<String, Object> model = new HashMap<>( );
68 FreeMarkerTemplateService fmtService = FreeMarkerTemplateService.getInstance( );
69 model.put( MARK_AUTOINCLUDE_LIST, fmtService.getAutoIncludesList( ) );
70 model.put( MARK_AUTOIMPORT_MAP, fmtService.getAutoImportsMap( ) );
71 model.put( MARK_COMMONS_LIST, CommonsService.getCommonsList( ) );
72 model.put( MARK_CURRENT_COMMONS, CommonsService.getCurrentCommonsKey( ) );
73
74 HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_MANAGE_AUTOINCLUDES, user.getLocale( ), model );
75 return template.getHtml( );
76 }
77
78 }