[commit] unified notifications

This commit is contained in:
Rushabh Mehta
2013-06-18 15:46:32 +05:30
parent dd790a57ba
commit 4736c35662
5 changed files with 38 additions and 168 deletions

View File

@@ -35,9 +35,6 @@ erpnext.startup.start = function() {
// setup toolbar
erpnext.toolbar.setup();
// set interval for updates
erpnext.startup.set_periodic_updates();
// complete registration
if(in_list(user_roles,'System Manager') && (wn.boot.setup_complete=='No')) {
wn.require("app/js/complete_setup.js");
@@ -67,67 +64,6 @@ erpnext.startup.start = function() {
}
}
// ========== Update Messages ============
erpnext.update_messages = function(reset) {
// Updates Team Messages
if(inList(['Guest'], user) || !wn.session_alive) { return; }
if(!reset) {
var set_messages = function(r) {
if(!r.exc) {
// This function is defined in toolbar.js
erpnext.toolbar.set_new_comments(r.message.unread_messages);
var show_in_circle = function(parent_id, msg) {
var parent = $('#'+parent_id);
if(parent) {
if(msg) {
parent.find('span:first').text(msg);
parent.toggle(true);
} else {
parent.toggle(false);
}
}
}
show_in_circle('unread_messages', r.message.unread_messages);
show_in_circle('open_support_tickets', r.message.open_support_tickets);
show_in_circle('things_todo', r.message.things_todo);
show_in_circle('todays_events', r.message.todays_events);
show_in_circle('open_tasks', r.message.open_tasks);
show_in_circle('unanswered_questions', r.message.unanswered_questions);
show_in_circle('open_leads', r.message.open_leads);
} else {
clearInterval(wn.updates.id);
}
}
wn.call({
method: 'startup.startup.get_global_status_messages',
type:"GET",
callback: set_messages
});
} else {
erpnext.toolbar.set_new_comments(0);
$('#unread_messages').toggle(false);
}
}
erpnext.startup.set_periodic_updates = function() {
// Set interval for periodic updates of team messages
wn.updates = {};
if(wn.updates.id) {
clearInterval(wn.updates.id);
}
wn.updates.id = setInterval(erpnext.update_messages, 60000);
}
erpnext.hide_naming_series = function() {
if(cur_frm.fields_dict.naming_series) {
cur_frm.toggle_display("naming_series", cur_frm.doc.__islocal?true:false);