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.editor;
35
36 import javax.servlet.http.HttpServletRequest;
37
38 import fr.paris.lutece.portal.service.admin.AccessDeniedException;
39 import fr.paris.lutece.portal.service.editor.RichTextEditorService;
40 import fr.paris.lutece.portal.service.security.SecurityTokenService;
41 import fr.paris.lutece.portal.web.admin.PluginAdminPageJspBean;
42
43
44
45
46 public class EditorChoiceLutecePanelJspBean extends PluginAdminPageJspBean
47 {
48 public static final String RIGHT_EDITORS_MANAGEMENT = "CORE_EDITORS_MANAGEMENT";
49 private static final String ANCHOR_ADMIN_DASHBOARDS = "editors";
50
51
52
53
54 private static final long serialVersionUID = -3558930087612105420L;
55 private static final String PARAM_EDITOR_BACK_OFFICE = "editor_back_office";
56 private static final String PARAM_EDITOR_FRONT_OFFICE = "editor_front_office";
57 private static final String TEMPLATE_EDITOR_CHOICE_PANEL = "admin/dashboard/admin/editor_dashboard.html";
58
59
60
61
62
63
64
65
66
67
68 public String doUpdateBackOfficeEditor( HttpServletRequest request ) throws AccessDeniedException
69 {
70 if ( !SecurityTokenService.getInstance( ).validate( request, TEMPLATE_EDITOR_CHOICE_PANEL ) )
71 {
72 throw new AccessDeniedException( ERROR_INVALID_TOKEN );
73 }
74 String strEditorName = request.getParameter( PARAM_EDITOR_BACK_OFFICE );
75 RichTextEditorService.updateBackOfficeDefaultEditor( strEditorName );
76
77 return getAdminDashboardsUrl( request, ANCHOR_ADMIN_DASHBOARDS );
78 }
79
80
81
82
83
84
85
86
87
88
89 public String doUpdateFrontOfficeEditor( HttpServletRequest request ) throws AccessDeniedException
90 {
91 if ( !SecurityTokenService.getInstance( ).validate( request, TEMPLATE_EDITOR_CHOICE_PANEL ) )
92 {
93 throw new AccessDeniedException( ERROR_INVALID_TOKEN );
94 }
95 String strEditorName = request.getParameter( PARAM_EDITOR_FRONT_OFFICE );
96 RichTextEditorService.updateFrontOfficeDefaultEditor( strEditorName );
97
98 return getAdminDashboardsUrl( request, ANCHOR_ADMIN_DASHBOARDS );
99 }
100 }