From ec40686cc3d84567f430e76d33d9d6c00ec437e3 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 13 Nov 2012 10:59:11 +0530 Subject: [PATCH] messages, popups disabled --- public/js/startup.js | 2 +- public/js/toolbar.js | 11 ++--------- startup/startup.py | 4 ++-- utilities/page/messages/messages.js | 2 ++ 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/public/js/startup.js b/public/js/startup.js index c845ab2a65..4efc2a3504 100644 --- a/public/js/startup.js +++ b/public/js/startup.js @@ -108,7 +108,7 @@ erpnext.update_messages = function(reset) { } } - show_in_circle('unread_messages', r.message.unread_messages.length); + 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); diff --git a/public/js/toolbar.js b/public/js/toolbar.js index a04c2250cf..6b2ef9a53a 100644 --- a/public/js/toolbar.js +++ b/public/js/toolbar.js @@ -89,16 +89,9 @@ erpnext.toolbar.set_new_comments = function(new_comments) { var navbar_nc = $('.navbar-new-comments'); if(wn.container.page && wn.container.page.page_name=="messages") return; - if(new_comments && new_comments.length>0) { - navbar_nc.text(new_comments.length); + if(new_comments) { + navbar_nc.text(new_comments); navbar_nc.addClass('navbar-new-comments-true') - $.each(new_comments, function(i, v) { - var msg = 'New Message: ' + (v[1].length<=100 ? v[1] : (v[1].substr(0, 100) + "...")); - var id = v[0].replace('/', '-'); - if(!$('#' + id)[0]) { - show_alert(msg).attr("id", id); - } - }); } else { navbar_nc.removeClass('navbar-new-comments-true'); navbar_nc.text(0); diff --git a/startup/startup.py b/startup/startup.py index b761225deb..828239ee15 100644 --- a/startup/startup.py +++ b/startup/startup.py @@ -20,12 +20,12 @@ import webnotes def get_unread_messages(): "returns unread (docstatus-0 messages for a user)" return webnotes.conn.sql("""\ - SELECT name, comment + SELECT count(*) FROM `tabComment` WHERE comment_doctype IN ('My Company', 'Message') AND comment_docname = %s AND ifnull(docstatus,0)=0 - """, webnotes.user.name, as_list=1) + """, webnotes.user.name)[0][0] def get_open_support_tickets(): """Returns a count of open support tickets""" diff --git a/utilities/page/messages/messages.js b/utilities/page/messages/messages.js index 6d13155e94..625fe5b535 100644 --- a/utilities/page/messages/messages.js +++ b/utilities/page/messages/messages.js @@ -33,12 +33,14 @@ wn.pages.messages.onload = function(wrapper) {
').appendTo($(wrapper).find('.layout-main-section')); erpnext.messages = new erpnext.Messages(wrapper); + erpnext.toolbar.set_new_comments(0); } $(wn.pages.messages).bind('show', function() { // remove alerts $('#alert-container .alert').remove(); + erpnext.toolbar.set_new_comments(0); erpnext.messages.show(); setTimeout("erpnext.messages.refresh()", 17000); })