Skip to content

Commit

Permalink
Merge branch 'horde_5_2'
Browse files Browse the repository at this point in the history
This fixes some "missing" commits due to incorrect FETCH_HEAD on simon.

Conflicts:
	framework/Core/js/hordecore.js
  • Loading branch information
mrubinsk committed Dec 17, 2013
2 parents 7a3bcb4 + d7d0647 commit 753efc6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
41 changes: 33 additions & 8 deletions framework/Core/js/hordecore.js
Expand Up @@ -345,10 +345,12 @@ var HordeCore = {
this.alarms.push(alarm.id);
message = alarm.title.escapeHTML();
if (alarm.params && alarm.params.desktop) {
if (alarm.params.desktop.subtitle) {
if (alarm.params.desktop.subtitle === undefined) {
subtitle = '';
} else {
subtitle = alarm.params.desktop.subtitle;
}
this.desktopNotify({ title: message, text: subtitle, icon: alarm.params.desktop.icon });
this.desktopNotify({ title: message, text: subtitle, icon: alarm.params.desktop.icon, id: alarm.id, url: alarm.params.desktop.url });
}
if (alarm.params && alarm.params.notify) {
if (alarm.params.notify.url) {
Expand Down Expand Up @@ -439,14 +441,37 @@ var HordeCore = {

desktopNotify: function(msg)
{
var f;
if (window.Notification && window.Notification.permission != 'granted') {
window.Notification.requestPermission(function(){
if (window.Notification.permission == 'granted') {
new window.Notification(msg.title, {body: msg.text, icon: msg.icon });
}
});
f = function() {
window.Notification.requestPermission(
function() {
if (window.Notification.permission == 'granted') {
new window.Notification(msg.title, {body: msg.text, icon: msg.icon });
}
}
);
}.delay(1);
} else if (window.Notification) {
new window.Notification(msg.title, {body: msg.text, icon: msg.icon });
f = function() {
var n = new window.Notification(msg.title, { body: msg.text, icon: msg.icon });
n.onclick = function(e) {
var ajax_params = $H({
alarm: msg.id,
snooze: -1
});
this.addRequestParams(ajax_params);
new Ajax.Request(this.conf.URI_SNOOZE, {
parameters: ajax_params,
onSuccess: function(r) {
var n = new window.Notification(msg.title, { body: HordeCore.text['dismised'], icon: msg.icon });
if (msg.url) {
window.open(msg.url, '__blank');
}
}
});
}.bind(this);
}.bind(this).delay(1);
}
},

Expand Down
5 changes: 3 additions & 2 deletions framework/Core/lib/Horde/Core/Alarm/Handler/Desktop.php
Expand Up @@ -66,16 +66,17 @@ public function __construct(array $params = null)
public function notify(array $alarm)
{
global $notification;

if ($GLOBALS['registry']->getView() == Horde_Registry::VIEW_DYNAMIC) {
$alarm['params']['desktop']['icon'] = $this->_icon;
$notification->push($alarm['title'], 'horde.alarm', array(
'alarm' => $alarm
));
} else {
} else {
$js = sprintf('if(window.Notification){if (window.Notification.permission != "granted") {window.Notification.requestPermission(function(){if (window.Notification.permission == "granted") { new window.Notification("%s", {body: "%s", icon: "%s" }); } }) } else { new window.Notification("%s", {body: "%s", icon: "%s" }); } };',
$alarm['title'], $alarm['params']['desktop']['subtitle'], $this->_icon, $alarm['title'], $alarm['params']['desktop']['subtitle'], $this->_icon);
call_user_func($this->_jsNotify, $js);
}
}
}

/**
Expand Down
3 changes: 2 additions & 1 deletion framework/Core/lib/Horde/PageOutput.php
Expand Up @@ -757,7 +757,8 @@ public function header(array $opts = array())
'60' => Horde_Core_Translation::t("1 hour"),
'360' => Horde_Core_Translation::t("6 hours"),
'1440' => Horde_Core_Translation::t("1 day")
)
),
'dismissed' => Horde_Core_Translation::t("The alarm was dismissed.")
);

if ($this->topbar) {
Expand Down

0 comments on commit 753efc6

Please sign in to comment.