Stop using deprecated methods, get notifications working again.

This commit is contained in:
Nathan Gray 2013-09-04 22:52:43 +00:00
parent eef2235f2e
commit 96a1c07e9e
2 changed files with 16 additions and 16 deletions

View File

@ -269,20 +269,20 @@ class notifications_ajax {
$message = 'data:text/html;charset=' . translation::charset() .';base64,'.base64_encode($message); $message = 'data:text/html;charset=' . translation::charset() .';base64,'.base64_encode($message);
} }
$this->response->addScriptCall('app.notifications.append',$notification['notify_id'],$notification['notify_message'],$message); $this->response->apply('app.notifications.append',array($notification['notify_id'],$notification['notify_message'],$message));
} }
switch($this->preferences[self::_appname]['egwpopup_verbosity']) { switch($this->preferences[self::_appname]['egwpopup_verbosity']) {
case 'low': case 'low':
$this->response->addScriptCall('app.notifications.bell', 'active'); $this->response->apply('app.notifications.bell', array('active'));
break; break;
case 'high': case 'high':
$this->response->addAlert(lang('EGroupware has notifications for you')); $this->response->alert(lang('EGroupware has notifications for you'));
$this->response->addScriptCall('app.notifications.display'); $this->response->apply('app.notifications.display');
break; break;
case 'medium': case 'medium':
default: default:
$this->response->addScriptCall('app.notifications.display'); $this->response->apply('app.notifications.display');
break; break;
} }
} }

View File

@ -37,13 +37,11 @@
notifications.prototype.setTimeout = function(_i) { notifications.prototype.setTimeout = function(_i) {
var self = this; var self = this;
window.setTimeout(function(){ window.setTimeout(function(){
var request = xajax_doXMLHTTP("notifications.notifications_ajax.get_notifications", self.check_browser_notify()); var request = egw.json(
request.request.error = function(_xmlhttp,_err){ "notifications.notifications_ajax.get_notifications",
if(console) { self.check_browser_notify()
console.log(request); );
console.log(_err); request.sendRequest();
}
};
self.setTimeout(_i); self.setTimeout(_i);
}, _i*1000); }, _i*1000);
}; };
@ -126,7 +124,8 @@
egwpopup_message.scrollTop = 0; egwpopup_message.scrollTop = 0;
for(var confirmed in notifymessages) break; for(var confirmed in notifymessages) break;
xajax_doXMLHTTP("notifications.notifications_ajax.confirm_message", confirmed); var request = egw.json("notifications.notifications_ajax.confirm_message", confirmed);
request.sendRequest();
delete notifymessages[confirmed]; delete notifymessages[confirmed];
for(var id in notifymessages) break; for(var id in notifymessages) break;
@ -147,8 +146,8 @@
for(var id in notifymessages) { for(var id in notifymessages) {
ids.push(id); ids.push(id);
} }
xajax_doXMLHTTP("notifications.notifications_ajax.confirm_message", ids); var request = egw.json("notifications.notifications_ajax.confirm_message", ids);
request.sendRequest();
notifymessages = {}; notifymessages = {};
var egwpopup = document.getElementById("egwpopup"); var egwpopup = document.getElementById("egwpopup");
var egwpopup_message = document.getElementById("egwpopup_message"); var egwpopup_message = document.getElementById("egwpopup_message");
@ -208,7 +207,8 @@
// Confirm when user gets to see it - no close needed // Confirm when user gets to see it - no close needed
// Wait a bit to let it load first, or it might not be there when requested. // Wait a bit to let it load first, or it might not be there when requested.
window.setTimeout( function() { window.setTimeout( function() {
xajax_doXMLHTTP("notifications.notifications_ajax.confirm_message", _id); var request = egw.json("notifications.notifications_ajax.confirm_message", _id);
request.sendRequest();
}, 2000); }, 2000);
}; };
notice.show(); notice.show();