1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
18 """Contains the system messages used to notify the user about various
19 critical situations that can occur.
20
21 Customize by overriding the static L{Application.getSystemMessages()} and
22 returning L{CustomizedSystemMessages}.
23
24 The defaults defined in this class are:
25
26 - B{sessionExpiredURL} = None
27 - B{sessionExpiredNotificationEnabled} = True
28 - B{sessionExpiredCaption} = ""
29 - B{sessionExpiredMessage} = "Take note of any unsaved data, and <u>click here</u> to continue."
30 - B{communicationErrorURL} = None
31 - B{communicationErrorNotificationEnabled} = True
32 - B{communicationErrorCaption} = "Communication problem"
33 - B{communicationErrorMessage} = "Take note of any unsaved data, and <u>click here</u> to continue."
34 - B{internalErrorURL} = None
35 - B{internalErrorNotificationEnabled} = True
36 - B{internalErrorCaption} = "Internal error"
37 - B{internalErrorMessage} = "Please notify the administrator.<br/>Take note of any unsaved data, and <u>click here</u> to continue."
38 - B{outOfSyncURL} = None
39 - B{outOfSyncNotificationEnabled} = True
40 - B{outOfSyncCaption} = "Out of sync"
41 - B{outOfSyncMessage} = "Something has caused us to be out of sync with the server.<br/>Take note of any unsaved data, and <u>click here</u> to re-sync."
42 - B{cookiesDisabledURL} = None
43 - B{cookiesDisabledNotificationEnabled} = True
44 - B{cookiesDisabledCaption} = "Cookies disabled"
45 - B{cookiesDisabledMessage} = "This application requires cookies to function.<br/>Please enable cookies in your browser and <u>click here</u> to try again."
46
47 """
48
50 """Use L{CustomizedSystemMessages} to customize"""
51
52 self.sessionExpiredURL = None
53 self.sessionExpiredNotificationEnabled = True
54 self.sessionExpiredCaption = 'Session Expired'
55 self.sessionExpiredMessage = 'Take note of any unsaved data, and <u>click here</u> to continue.'
56 self.communicationErrorURL = None
57 self.communicationErrorNotificationEnabled = True
58 self.communicationErrorCaption = 'Communication problem'
59 self.communicationErrorMessage = 'Take note of any unsaved data, and <u>click here</u> to continue.'
60 self.authenticationErrorURL = None
61 self.authenticationErrorNotificationEnabled = True
62 self.authenticationErrorCaption = 'Authentication problem'
63 self.authenticationErrorMessage = 'Take note of any unsaved data, and <u>click here</u> to continue.'
64 self.internalErrorURL = None
65 self.internalErrorNotificationEnabled = True
66 self.internalErrorCaption = 'Internal error'
67 self.internalErrorMessage = 'Please notify the administrator.<br/>Take note of any unsaved data, and <u>click here</u> to continue.'
68 self.outOfSyncURL = None
69 self.outOfSyncNotificationEnabled = True
70 self.outOfSyncCaption = 'Out of sync'
71 self.outOfSyncMessage = 'Something has caused us to be out of sync with the server.<br/>Take note of any unsaved data, and <u>click here</u> to re-sync.'
72 self.cookiesDisabledURL = None
73 self.cookiesDisabledNotificationEnabled = True
74 self.cookiesDisabledCaption = 'Cookies disabled'
75 self.cookiesDisabledMessage = 'This application requires cookies to function.<br/>Please enable cookies in your browser and <u>click here</u> to try again.'
76
77
79 """@return: null to indicate that the application will be restarted after
80 session expired message has been shown.
81 """
82 return self.sessionExpiredURL
83
84
86 """@return: true to show session expiration message."""
87 return self.sessionExpiredNotificationEnabled
88
89
91 """@return: "" to show no caption."""
92 return self.sessionExpiredCaption if self.sessionExpiredNotificationEnabled else None
93
94
96 """@return: "Take note of any unsaved data, and <u>click here</u> to continue."
97 """
98 return self.sessionExpiredMessage if self.sessionExpiredNotificationEnabled else None
99
100
102 """@return: null to reload the application after communication error
103 message.
104 """
105 return self.communicationErrorURL
106
107
109 """@return: true to show the communication error message."""
110 return self.communicationErrorNotificationEnabled
111
112
114 """@return: "Communication problem\""""
115 return self.communicationErrorCaption if self.communicationErrorNotificationEnabled else None
116
117
119 """@return: "Take note of any unsaved data, and <u>click here</u> to continue."
120 """
121 return self.communicationErrorMessage if self.communicationErrorNotificationEnabled else None
122
123
125 """@return: null to reload the application after authentication error
126 message.
127 """
128 return self.authenticationErrorURL
129
130
132 """@return: true to show the authentication error message."""
133 return self.authenticationErrorNotificationEnabled
134
135
137 """@return: "Authentication problem\""""
138 return self.authenticationErrorCaption if self.authenticationErrorNotificationEnabled else None
139
140
142 """@return:
143 "Take note of any unsaved data, and <u>click here</u> to continue."
144 """
145 return self.authenticationErrorMessage if self.authenticationErrorNotificationEnabled else None
146
147
149 """@return: null to reload the current URL after internal error message
150 has been shown.
151 """
152 return self.internalErrorURL
153
154
156 """@return: true to enable showing of internal error message."""
157 return self.internalErrorNotificationEnabled
158
159
161 """@return: "Internal error\""""
162 return self.internalErrorCaption if self.internalErrorNotificationEnabled else None
163
164
166 """@return: "Please notify the administrator.<br/>
167 Take note of any unsaved data, and <u>click here</u> to
168 continue."
169 """
170 return self.internalErrorMessage if self.internalErrorNotificationEnabled else None
171
172
174 """@return: null to reload the application after out of sync message."""
175 return self.outOfSyncURL
176
177
179 """@return: true to enable showing out of sync message"""
180 return self.outOfSyncNotificationEnabled
181
182
184 """@return: "Out of sync\""""
185 return self.outOfSyncCaption if self.outOfSyncNotificationEnabled else None
186
187
189 """@return: "Something has caused us to be out of sync with the server.<br/>
190 Take note of any unsaved data, and <u>click here</u> to
191 re-sync."
192 """
193 return self.outOfSyncMessage if self.outOfSyncNotificationEnabled else None
194
195
197 """Returns the URL the user should be redirected to after dismissing the
198 "you have to enable your cookies" message. Typically null.
199
200 @return: A URL the user should be redirected to after dismissing the
201 message or null to reload the current URL.
202 """
203 return self.cookiesDisabledURL
204
205
207 """Determines if "cookies disabled" messages should be shown to the end
208 user or not. If the notification is disabled the user will be
209 immediately redirected to the URL returned by L{getCookiesDisabledURL}.
210
211 @return: true to show "cookies disabled" messages to the end user,
212 false to redirect to the given URL directly
213 """
214 return self.cookiesDisabledNotificationEnabled
215
216
218 """Returns the caption of the message shown to the user when cookies are
219 disabled in the browser.
220
221 @return: The caption of the "cookies disabled" message
222 """
223 return self.cookiesDisabledCaption if self.cookiesDisabledNotificationEnabled else None
224
225
227 """Returns the message shown to the user when cookies are disabled in
228 the browser.
229
230 @return: The "cookies disabled" message
231 """
232 return self.cookiesDisabledMessage if self.cookiesDisabledNotificationEnabled else None
233
234
236 """Contains the system messages used to notify the user about various
237 critical situations that can occur.
238
239 Muntjac gets the SystemMessages from your application by calling a static
240 getSystemMessages() method. By default the
241 Application.getSystemMessages() is used. You can customize this by
242 defining a static MyApplication.getSystemMessages() and returning
243 CustomizedSystemMessages. Note that getSystemMessages() is static -
244 changing the system messages will by default change the message for all
245 users of the application.
246
247 The default behavior is to show a notification, and restart the
248 application the the user clicks the message.
249
250 Instead of restarting the application, you can set a specific URL that
251 the user is taken to.
252
253 Setting both caption and message to null will restart the application (or
254 go to the specified URL) without displaying a notification.
255 set*NotificationEnabled(false) will achieve the same thing.
256
257 The situations are:
258 - Session expired: the user session has expired, usually due to
259 inactivity.
260 - Communication error: the client failed to contact the server, or the
261 server returned and invalid response.
262 - Internal error: unhandled critical server error (e.g out of memory,
263 database crash)
264 - Out of sync: the client is not in sync with the server. E.g the user
265 opens two windows showing the same application, but the application does
266 not support this and uses the same Window instance. When the user makes
267 changes in one of the windows - the other window is no longer in sync,
268 and (for instance) pressing a button that is no longer present in the UI
269 will cause a out-of-sync -situation.
270 """
271
273 """Sets the URL to go to when the session has expired.
274
275 @param sessionExpiredURL:
276 the URL to go to, or null to reload current
277 """
278 self.sessionExpiredURL = sessionExpiredURL
279
280
282 """Enables or disables the notification. If disabled, the set URL (or
283 current) is loaded directly when next transaction between server and
284 client happens.
285
286 @param sessionExpiredNotificationEnabled:
287 true = enabled, false = disabled
288 """
289 self.sessionExpiredNotificationEnabled = sessionExpiredNotificationEnabled
290
291
293 """Sets the caption of the notification. Set to null for no caption. If
294 both caption and message are null, client automatically forwards to
295 sessionExpiredUrl after timeout timer expires. Timer uses value read
296 from HTTPSession.getMaxInactiveInterval()
297
298 @param sessionExpiredCaption: the caption
299 """
300 self.sessionExpiredCaption = sessionExpiredCaption
301
302
304 """Sets the message of the notification. Set to null for no message. If
305 both caption and message are null, client automatically forwards to
306 sessionExpiredUrl after timeout timer expires. Timer uses value read
307 from HTTPSession.getMaxInactiveInterval()
308
309 @param sessionExpiredMessage: the message
310 """
311 self.sessionExpiredMessage = sessionExpiredMessage
312
313
315 """Sets the URL to go to when there is a authentication error.
316
317 @param authenticationErrorURL:
318 the URL to go to, or null to reload current
319 """
320 self.authenticationErrorURL = authenticationErrorURL
321
322
324 """Enables or disables the notification. If disabled, the set URL (or
325 current) is loaded directly.
326
327 @param authenticationErrorNotificationEnabled:
328 true = enabled, false = disabled
329 """
330 self.authenticationErrorNotificationEnabled = authenticationErrorNotificationEnabled
331
332
334 """Sets the caption of the notification. Set to null for no caption. If
335 both caption and message is null, the notification is disabled;
336
337 @param authenticationErrorCaption:
338 the caption
339 """
340 self.authenticationErrorCaption = authenticationErrorCaption
341
342
344 """Sets the message of the notification. Set to null for no message. If
345 both caption and message is null, the notification is disabled;
346
347 @param authenticationErrorMessage:
348 the message
349 """
350 self.authenticationErrorMessage = authenticationErrorMessage
351
352
354 """Sets the URL to go to when there is a communication error.
355
356 @param communicationErrorURL:
357 the URL to go to, or null to reload current
358 """
359 self.communicationErrorURL = communicationErrorURL
360
361
363 """Enables or disables the notification. If disabled, the set URL (or
364 current) is loaded directly.
365
366 @param communicationErrorNotificationEnabled:
367 true = enabled, false = disabled
368 """
369 self.communicationErrorNotificationEnabled = communicationErrorNotificationEnabled
370
371
373 """Sets the caption of the notification. Set to null for no caption. If
374 both caption and message is null, the notification is disabled;
375
376 @param communicationErrorCaption:
377 the caption
378 """
379 self.communicationErrorCaption = communicationErrorCaption
380
381
383 """Sets the message of the notification. Set to null for no message. If
384 both caption and message is null, the notification is disabled;
385
386 @param communicationErrorMessage:
387 the message
388 """
389 self.communicationErrorMessage = communicationErrorMessage
390
391
393 """Sets the URL to go to when an internal error occurs.
394
395 @param internalErrorURL:
396 the URL to go to, or null to reload current
397 """
398 self.internalErrorURL = internalErrorURL
399
400
402 """Enables or disables the notification. If disabled, the set URL (or
403 current) is loaded directly.
404
405 @param internalErrorNotificationEnabled:
406 true = enabled, false = disabled
407 """
408 self.internalErrorNotificationEnabled = internalErrorNotificationEnabled
409
410
412 """Sets the caption of the notification. Set to null for no caption. If
413 both caption and message is null, the notification is disabled;
414
415 @param internalErrorCaption:
416 the caption
417 """
418 self.internalErrorCaption = internalErrorCaption
419
420
422 """Sets the message of the notification. Set to null for no message. If
423 both caption and message is null, the notification is disabled;
424
425 @param internalErrorMessage:
426 the message
427 """
428 self.internalErrorMessage = internalErrorMessage
429
430
432 """Sets the URL to go to when the client is out-of-sync.
433
434 @param outOfSyncURL:
435 the URL to go to, or null to reload current
436 """
437 self.outOfSyncURL = outOfSyncURL
438
439
441 """Enables or disables the notification. If disabled, the set URL (or
442 current) is loaded directly.
443
444 @param outOfSyncNotificationEnabled:
445 true = enabled, false = disabled
446 """
447 self.outOfSyncNotificationEnabled = outOfSyncNotificationEnabled
448
449
451 """Sets the caption of the notification. Set to null for no caption. If
452 both caption and message is null, the notification is disabled;
453
454 @param outOfSyncCaption:
455 the caption
456 """
457 self.outOfSyncCaption = outOfSyncCaption
458
459
461 """Sets the message of the notification. Set to null for no message. If
462 both caption and message is null, the notification is disabled;
463
464 @param outOfSyncMessage:
465 the message
466 """
467 self.outOfSyncMessage = outOfSyncMessage
468
469
471 """Sets the URL to redirect to when the browser has cookies disabled.
472
473 @param cookiesDisabledURL:
474 the URL to redirect to, or null to reload the current URL
475 """
476 self.cookiesDisabledURL = cookiesDisabledURL
477
478
480 """Enables or disables the notification for "cookies disabled" messages.
481 If disabled, the URL returned by L{getCookiesDisabledURL} is
482 loaded directly.
483
484 @param cookiesDisabledNotificationEnabled:
485 true to enable "cookies disabled" messages, false
486 otherwise
487 """
488 self.cookiesDisabledNotificationEnabled = cookiesDisabledNotificationEnabled
489
490
492 """Sets the caption of the "cookies disabled" notification. Set to null
493 for no caption. If both caption and message is null, the notification
494 is disabled.
495
496 @param cookiesDisabledCaption:
497 the caption for the "cookies disabled" notification
498 """
499 self.cookiesDisabledCaption = cookiesDisabledCaption
500
501
503 """Sets the message of the "cookies disabled" notification. Set to null
504 for no message. If both caption and message is null, the notification
505 is disabled.
506
507 @param cookiesDisabledMessage:
508 the message for the "cookies disabled" notification
509 """
510 self.cookiesDisabledMessage = cookiesDisabledMessage
511