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_COMMONS_LIST = "commons_list";
58 private static final String MARK_CURRENT_COMMONS = "current_commons";
59
60
61
62
63 @Override
64 public String getDashboardData( AdminUser user, HttpServletRequest request )
65 {
66 Map<String, Object> model = new HashMap<>( );
67 List<AutoInclude> listAutoIncludes = FreeMarkerTemplateService.getInstance( ).getAutoIncludesList( );
68 model.put( MARK_AUTOINCLUDE_LIST, listAutoIncludes );
69 model.put( MARK_COMMONS_LIST, CommonsService.getCommonsIncludeList( ) );
70 model.put( MARK_CURRENT_COMMONS, CommonsService.getCurrentCommonsKey( ) );
71
72 HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_MANAGE_AUTOINCLUDES, user.getLocale( ), model );
73 return template.getHtml( );
74 }
75
76 }