date: new Date(),
tasktype: 'incomplete',
growls: 0,
+ alarms: [],
doActionOpts: {
onException: function(r, e) { KronolithCore.debug('onException', e); },
this.logout(Kronolith.conf.timeout_url);
return true;
+ case 'horde.alarm':
+ // Only show one instance of an alarm growl.
+ if (this.alarms.indexOf(m.alarm.id) != -1) {
+ break;
+ }
+ message = m.alarm.title.escapeHTML();
+ if (!Object.isUndefined(m.alarm.url)) {
+ message = new Element('a', { 'href': m.alarm.url })
+ .insert(message);
+ }
+ var select = new Element('select');
+ $H(Kronolith.conf.snooze).each(function(snooze) {
+ select.insert(new Element('option', { 'value': snooze.key }).insert(snooze.value));
+ });
+ message = new Element('div')
+ .insert(message)
+ .insert(' ')
+ .insert(select);
+ var growl = this.Growler.growl(message, {
+ className: 'horde-alarm',
+ life: 8,
+ log: false,
+ sticky: true,
+ created: function() {
+ if (m.type == 'horde.alarm') {
+ this.alarms.push(m.alarm.id);
+ }
+ }.bind(this),
+ destroyed: function() {
+ if (m.type == 'horde.alarm') {
+ this.alarms = this.alarms.without(m.alarm.id);
+ }
+ }.bind(this)
+ });
+ select.observe('change', function() {
+ if (select.getValue()) {
+ new Ajax.Request(
+ Kronolith.conf.URI_SNOOZE,
+ { 'parameters': { 'alarm': m.alarm.id,
+ 'snooze': select.getValue() },
+ 'onSuccess': function() {
+ this.Growler.ungrowl(growl);
+ }.bind(this)});
+ }
+ }.bind(this));
+ break;
+
case 'horde.error':
case 'horde.warning':
- //case 'horde.alarm':
case 'horde.message':
case 'horde.success':
- this.Growler.growl(m.message, {
+ this.Growler.growl(m.message.escapeHTML(), {
className: m.type.replace('.', '-'),
life: 8,
log: true,
}
notify.update(Kronolith.text.alerts.interpolate({ 'count': ++this.growls }));
notify.up().show();
+ break;
}
}, this);
},
$code['conf'] = array(
'URI_AJAX' => Horde::url($kronolith_webroot . '/ajax.php', true, -1),
'URI_IMG' => $registry->getImageDir() . '/',
- //'URI_VIEW' => Horde_Util::addParameter(Horde::url($imp_webroot . '/view.php', true, -1), array('actionID' => 'view_source', 'id' => 0), null, false),
+ 'URI_SNOOZE' => Horde::url($registry->get('webroot', 'horde') . '/services/snooze.php', true, -1),
'SESSION_ID' => defined('SID') ? SID : '',
'prefs_url' => str_replace('&', '&', Horde::getServiceLink('options', 'kronolith')),
'name' => $registry->get('name'),
Horde_Date_Recurrence::RECUR_YEARLY_DATE => 'Yearly',
Horde_Date_Recurrence::RECUR_YEARLY_DAY => 'Yearly',
Horde_Date_Recurrence::RECUR_YEARLY_WEEKDAY => 'Yearly'),
- // Turn debugging on?
- 'debug' => !empty($conf['js']['debug']),
+ 'snooze' => array('' => _("Snooze..."),
+ '-1' => _("Dismiss"),
+ '5' => _("5 minutes"),
+ '15' => _("15 minutes"),
+ '60' => _("1 hour"),
+ '360' => _("6 hours"),
+ '1440' => _("1 day")),
);
// Calendars