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.appointment.web;
35
36 import java.util.Map;
37 import javax.servlet.http.HttpServletRequest;
38 import fr.paris.lutece.plugins.appointment.business.comment.CommentNotificationConfig;
39 import fr.paris.lutece.plugins.appointment.business.comment.CommentNotificationHome;
40 import fr.paris.lutece.portal.service.admin.AccessDeniedException;
41 import fr.paris.lutece.portal.util.mvc.admin.MVCAdminJspBean;
42 import fr.paris.lutece.portal.util.mvc.admin.annotations.Controller;
43 import fr.paris.lutece.portal.util.mvc.commons.annotations.Action;
44 import fr.paris.lutece.portal.util.mvc.commons.annotations.View;
45
46
47
48
49
50
51
52 @Controller( controllerJsp = CommentNotificationJspBean.CONTROLLER_JSP, controllerPath = CommentNotificationJspBean.CONTROLLER_PATH, right = CommentJspBean.RIGHT_MANAGECOMMENTTFORM )
53 public class CommentNotificationJspBean extends MVCAdminJspBean
54 {
55 private static final long serialVersionUID = 1995349998868975731L;
56
57
58
59
60 public static final String CONTROLLER_PATH = "jsp/admin/plugins/appointment/";
61
62
63
64 public static final String CONTROLLER_JSP = "NotificationCommentConfig.jsp";
65
66
67
68 public static final String JSP_URL_MANAGE_CALENDAR_TEMPLATE = CONTROLLER_PATH + CONTROLLER_JSP;
69
70 private static final String TEMPLATE_NOTIFICATION_CONFIG = "/admin/plugins/appointment/notification/task_notification_config.html";
71 private static final String TEMPLATE_MANAGE_NOTIFICATION_CONFIG = "/admin/plugins/appointment/notification/manage_notification_config.html";
72
73
74 private static final String MARK_CONFIG = "config";
75 private static final String MARK_LIST_CONFIG = "list_config";
76
77
78 private static final String PARAMETER_TYPE = "type";
79
80
81 private static final String INFO_COMMENT_UPDATED = "appointment.info.comment.updated";
82
83 private static final String PROPERTY_PAGE_TITLE_MANAGE_COMMENTS = "task_notify_appointment_comment_config.title";
84
85 private static final String VIEW_NOTIFIACTION_CONFIG = "notificationConfig";
86 private static final String VIEW_MODIFY_NOTIFIACTION_CONFIG = "modifyNotificationCommentConfig";
87
88 private static final String ACTION_DO_UPDATE_NOTIFICATION_CONFIG = "updateNotificationCommentConfig";
89
90 private CommentNotificationConfig _commentNotificationConfig;
91
92
93
94
95
96
97
98
99
100 @View( value = VIEW_NOTIFIACTION_CONFIG, defaultView = true )
101 public String getNotificationCommentConfig( HttpServletRequest request )
102 {
103 _commentNotificationConfig = null;
104 Map<String, Object> model = getModel( );
105 model.put( MARK_LIST_CONFIG, CommentNotificationHome.loadCommentNotificationConfig( ) );
106 return getPage( PROPERTY_PAGE_TITLE_MANAGE_COMMENTS, TEMPLATE_MANAGE_NOTIFICATION_CONFIG, model );
107
108 }
109
110
111
112
113
114
115
116
117
118 @View( value = VIEW_MODIFY_NOTIFIACTION_CONFIG )
119 public String getModifyNotificationCommentConfig( HttpServletRequest request )
120 {
121 String type = request.getParameter( PARAMETER_TYPE );
122 _commentNotificationConfig = CommentNotificationHome.loadCommentNotificationConfigByType( type );
123 Map<String, Object> model = getModel( );
124 model.put( MARK_CONFIG, _commentNotificationConfig );
125 return getPage( PROPERTY_PAGE_TITLE_MANAGE_COMMENTS, TEMPLATE_NOTIFICATION_CONFIG, model );
126
127 }
128
129
130
131
132
133
134
135
136
137 @Action( ACTION_DO_UPDATE_NOTIFICATION_CONFIG )
138 public String doUpdateNotificationCommentConfig( HttpServletRequest request )
139 {
140 populate( _commentNotificationConfig, request );
141 CommentNotificationHome.update( _commentNotificationConfig );
142 addInfo( INFO_COMMENT_UPDATED, getLocale( ) );
143 return redirectView( request, VIEW_NOTIFIACTION_CONFIG );
144 }
145
146 }