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.globalmanagement;
35
36 import fr.paris.lutece.portal.service.admin.AdminUserService;
37 import fr.paris.lutece.portal.service.globalmanagement.RichTextEditorService;
38 import fr.paris.lutece.portal.service.i18n.I18nService;
39 import fr.paris.lutece.portal.service.template.AppTemplateService;
40 import fr.paris.lutece.portal.service.util.AppPathService;
41 import fr.paris.lutece.util.html.HtmlTemplate;
42
43 import java.util.HashMap;
44 import java.util.Map;
45
46 import javax.servlet.http.HttpServletRequest;
47
48
49
50
51
52 public class EditorChoiceLutecePanelJspBean extends AbstractGMLutecePanel
53 {
54
55
56
57 private static final long serialVersionUID = -3558930087612105420L;
58 private static final String LABEL_TITLE_EDITOR_CHOICE = "portal.globalmanagement.editorChoice.labelEditorChoice";
59 private static final String PARAM_EDITOR_BACK_OFFICE = "editor_back_office";
60 private static final String PARAM_EDITOR_FRONT_OFFICE = "editor_front_office";
61 private static final String MARK_LIST_EDITORS_BACK_OFFICE = "listEditorsBackOffice";
62 private static final String MARK_LIST_EDITORS_FRONT_OFFICE = "listEditorsFrontOffice";
63 private static final String MARK_CURRENT_EDITOR_BACK_OFFICE = "current_editor_back_office";
64 private static final String MARK_CURRENT_EDITOR_FRONT_OFFICE = "current_editor_front_office";
65 private static final String TEMPLATE_EDITOR_CHOICE_PANEL = "admin/globalmanagement/panel/editor_choice_panel.html";
66
67
68
69
70 @Override
71 public String getPanelContent( )
72 {
73 Map<String, Object> model = new HashMap<String, Object>( );
74 model.put( MARK_LIST_EDITORS_BACK_OFFICE,
75 RichTextEditorService.getListEditorsForBackOffice( AdminUserService.getLocale( getRequest( ) ) ) );
76 model.put( MARK_CURRENT_EDITOR_BACK_OFFICE, RichTextEditorService.getBackOfficeDefaultEditor( ) );
77
78 model.put( MARK_LIST_EDITORS_FRONT_OFFICE,
79 RichTextEditorService.getListEditorsForFrontOffice( AdminUserService.getLocale( getRequest( ) ) ) );
80 model.put( MARK_CURRENT_EDITOR_FRONT_OFFICE, RichTextEditorService.getFrontOfficeDefaultEditor( ) );
81
82 HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_EDITOR_CHOICE_PANEL, getLocale( ), model );
83
84 return template.getHtml( );
85 }
86
87
88
89
90 @Override
91 public String getPanelKey( )
92 {
93 return LABEL_TITLE_EDITOR_CHOICE;
94 }
95
96
97
98
99
100 @Override
101 public int getPanelOrder( )
102 {
103 return 1;
104 }
105
106
107
108
109 @Override
110 public String getPanelTitle( )
111 {
112 return I18nService.getLocalizedString( LABEL_TITLE_EDITOR_CHOICE, AdminUserService.getLocale( getRequest( ) ) );
113 }
114
115
116
117
118
119
120
121 public String doUpdateBackOfficeEditor( HttpServletRequest request )
122 {
123 String strEditorName = request.getParameter( PARAM_EDITOR_BACK_OFFICE );
124 RichTextEditorService.updateBackOfficeDefaultEditor( strEditorName );
125
126 return AppPathService.getBaseUrl( request ) + GlobalManagementJspBean.JSP_URL_GLOBAL_MANAGEMENT;
127 }
128
129
130
131
132
133
134
135 public String doUpdateFrontOfficeEditor( HttpServletRequest request )
136 {
137 String strEditorName = request.getParameter( PARAM_EDITOR_FRONT_OFFICE );
138 RichTextEditorService.updateFrontOfficeDefaultEditor( strEditorName );
139
140 return AppPathService.getBaseUrl( request ) + GlobalManagementJspBean.JSP_URL_GLOBAL_MANAGEMENT;
141 }
142 }