messages, popups disabled

This commit is contained in:
Rushabh Mehta 2012-11-13 10:59:11 +05:30
parent ab55e6b252
commit ec40686cc3
4 changed files with 7 additions and 12 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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"""

View File

@ -33,12 +33,14 @@ wn.pages.messages.onload = function(wrapper) {
<div class="all-messages"></div>').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);
})