Notifications: Difference between revisions
From LimeSurvey Manual
Line 61: | Line 61: | ||
* title, title of message (shown in dropdown and overview) | * title, title of message (shown in dropdown and overview) | ||
* message, the actual message | * message, the actual message | ||
* | * modal_class, success, danger, default | ||
* type, important, information, trace? | |||
* status, new, read, acknowledged, cleared | * status, new, read, acknowledged, cleared | ||
* created, datetime | * created, datetime | ||
* read, datetime | * read, datetime |
Revision as of 10:28, 3 August 2016
Have an icon in top menu about notifications to user. Can be bound to user, user group or survey.
Also need an 'irritating' message type that will be 'new' until a certain condition is fulfilled (like survey must be activated).
GUI
- Bell icon
- List of last 5 messages in menu where you can can see which messages are new
- History view of all messages? Grid view.
- Delete messages? Soft delete.
Usage
Should be possible for the developer to invoke new notification both from PHP and JS.
PHP:
$not = new Notification();
$not->type = 'danger';
$not->message = gT('New info!');
$not->save();
JS:
$.ajax(
url: 'notification.php',
data: {
message: translatedMessageString
}
).done(function(result) {
updateNotifications(result);
});
For JS: When to fire new message? At reload or immediate? Set option.
Localization
Support localization for messages dynamically created by admin?
Flash
Merge system with flash message, so that programmer will call addNotification
instead of setFlash
.
Pro:
- Store log of all notifications
Database
New database table required to make notifications persist between login/logout.
Fields:
- id
- entity, like survey, user, ...
- entity_id, survey id, user id, ...
- title, title of message (shown in dropdown and overview)
- message, the actual message
- modal_class, success, danger, default
- type, important, information, trace?
- status, new, read, acknowledged, cleared
- created, datetime
- read, datetime