Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
b6cd4788e4
@ -18,7 +18,7 @@ erpnext.ActivityFeed = Class.extend({
|
|||||||
this.scrub_data(data);
|
this.scrub_data(data);
|
||||||
this.add_date_separator(row, data);
|
this.add_date_separator(row, data);
|
||||||
$(row).append(sprintf('<div style="margin: 0px">\
|
$(row).append(sprintf('<div style="margin: 0px">\
|
||||||
<span class="avatar-small"><img src="%(imgsrc)s" /></span> \
|
<span class="avatar avatar-small"><img src="%(imgsrc)s" /></span> \
|
||||||
<span %(onclick)s class="label %(add_class)s">%(feed_type)s</span>\
|
<span %(onclick)s class="label %(add_class)s">%(feed_type)s</span>\
|
||||||
%(link)s %(subject)s <span class="user-info">%(by)s</span></div>', data));
|
%(link)s %(subject)s <span class="user-info">%(by)s</span></div>', data));
|
||||||
},
|
},
|
||||||
|
2402
public/js/all-app.js
2402
public/js/all-app.js
File diff suppressed because one or more lines are too long
@ -93,6 +93,8 @@ erpnext.toolbar.add_modules = function() {
|
|||||||
|
|
||||||
erpnext.toolbar.set_new_comments = function(new_comments) {
|
erpnext.toolbar.set_new_comments = function(new_comments) {
|
||||||
var navbar_nc = $('.navbar-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) {
|
if(new_comments && new_comments.length>0) {
|
||||||
navbar_nc.text(new_comments.length);
|
navbar_nc.text(new_comments.length);
|
||||||
navbar_nc.addClass('navbar-new-comments-true')
|
navbar_nc.addClass('navbar-new-comments-true')
|
||||||
@ -102,7 +104,7 @@ erpnext.toolbar.set_new_comments = function(new_comments) {
|
|||||||
if(!$('#' + id)[0]) {
|
if(!$('#' + id)[0]) {
|
||||||
show_alert(msg).attr("id", id);
|
show_alert(msg).attr("id", id);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
navbar_nc.removeClass('navbar-new-comments-true');
|
navbar_nc.removeClass('navbar-new-comments-true');
|
||||||
navbar_nc.text(0);
|
navbar_nc.text(0);
|
||||||
|
@ -6,9 +6,17 @@
|
|||||||
|
|
||||||
.message {
|
.message {
|
||||||
padding: 7px;
|
padding: 7px;
|
||||||
|
padding-left: 17px;
|
||||||
border-bottom: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.message-mark {
|
||||||
|
margin-left: -17px;
|
||||||
|
width: 9px;
|
||||||
|
position: absolute;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
.message .help {
|
.message .help {
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
|
@ -22,11 +22,11 @@ wn.pages.messages.onload = function(wrapper) {
|
|||||||
title: "Messages"
|
title: "Messages"
|
||||||
});
|
});
|
||||||
|
|
||||||
$('<h3 id="message-title">Everyone</h3>\
|
$('<div><div class="avatar avatar-large">\
|
||||||
<div id="show-everyone" style="display: none;">\
|
<img id="avatar-image" src="lib/images/ui/avatar.png"></div>\
|
||||||
<a href="#messages/'+user+'" style="font-size: 80%;">\
|
<h3 style="display: inline-block" id="message-title">Everyone</h3>\
|
||||||
Show messages from everyone</a></div><hr>\
|
</div><hr>\
|
||||||
<div id="post-message" style="display: none">\
|
<div id="post-message">\
|
||||||
<textarea style="width: 100%; height: 24px;"></textarea>\
|
<textarea style="width: 100%; height: 24px;"></textarea>\
|
||||||
<div><button class="btn btn-small">Post</button></div><hr>\
|
<div><button class="btn btn-small">Post</button></div><hr>\
|
||||||
</div>\
|
</div>\
|
||||||
@ -40,7 +40,7 @@ $(wn.pages.messages).bind('show', function() {
|
|||||||
$('#alert-container .alert').remove();
|
$('#alert-container .alert').remove();
|
||||||
|
|
||||||
erpnext.messages.show();
|
erpnext.messages.show();
|
||||||
setTimeout("erpnext.messages.refresh()", 7000);
|
setTimeout("erpnext.messages.refresh()", 17000);
|
||||||
})
|
})
|
||||||
|
|
||||||
erpnext.Messages = Class.extend({
|
erpnext.Messages = Class.extend({
|
||||||
@ -83,14 +83,15 @@ erpnext.Messages = Class.extend({
|
|||||||
show: function() {
|
show: function() {
|
||||||
var contact = this.get_contact() || this.contact || user;
|
var contact = this.get_contact() || this.contact || user;
|
||||||
|
|
||||||
$('#message-title').text(contact==user ? "Everyone" :
|
$('#message-title').html(contact==user ? "Everyone" :
|
||||||
wn.boot.user_info[contact].fullname)
|
wn.user_info(contact).fullname)
|
||||||
|
|
||||||
|
$('#avatar-image').attr("src", wn.user_info(contact).image);
|
||||||
|
|
||||||
$("#show-everyone").toggle(contact!=user);
|
$("#show-everyone").toggle(contact!=user);
|
||||||
|
|
||||||
// can't send message to self
|
$("#post-message button").text(contact==user ? "Post Publicly" : "Post to user")
|
||||||
$('#post-message').toggle(contact!=user);
|
|
||||||
|
|
||||||
this.contact = contact;
|
this.contact = contact;
|
||||||
this.list.opts.args.contact = contact;
|
this.list.opts.args.contact = contact;
|
||||||
this.list.run();
|
this.list.run();
|
||||||
@ -98,7 +99,7 @@ erpnext.Messages = Class.extend({
|
|||||||
},
|
},
|
||||||
// check for updates every 5 seconds if page is active
|
// check for updates every 5 seconds if page is active
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
setTimeout("erpnext.messages.refresh()", 7000);
|
setTimeout("erpnext.messages.refresh()", 17000);
|
||||||
if(wn.container.page.label != 'Messages') return;
|
if(wn.container.page.label != 'Messages') return;
|
||||||
this.show();
|
this.show();
|
||||||
},
|
},
|
||||||
@ -126,6 +127,8 @@ erpnext.Messages = Class.extend({
|
|||||||
|
|
||||||
data.creation = dateutil.comment_when(data.creation);
|
data.creation = dateutil.comment_when(data.creation);
|
||||||
data.comment_by_fullname = wn.user_info(data.owner).fullname;
|
data.comment_by_fullname = wn.user_info(data.owner).fullname;
|
||||||
|
data.image = wn.user_info(data.owner).image;
|
||||||
|
data.mark_html = "";
|
||||||
|
|
||||||
data.reply_html = '';
|
data.reply_html = '';
|
||||||
if(data.owner==user) {
|
if(data.owner==user) {
|
||||||
@ -133,10 +136,6 @@ erpnext.Messages = Class.extend({
|
|||||||
data.comment_by_fullname = 'You';
|
data.comment_by_fullname = 'You';
|
||||||
} else {
|
} else {
|
||||||
data.cls = 'message-other';
|
data.cls = 'message-other';
|
||||||
if(this.contact==user) {
|
|
||||||
data.reply_html = repl('<a href="#!messages/%(owner)s">\
|
|
||||||
<i class="icon-share-alt"></i> Reply</a>', data)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete
|
// delete
|
||||||
@ -146,11 +145,17 @@ erpnext.Messages = Class.extend({
|
|||||||
onclick="erpnext.messages.delete(this)"\
|
onclick="erpnext.messages.delete(this)"\
|
||||||
data-name="%(name)s">×</a>', data);
|
data-name="%(name)s">×</a>', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(data.owner==data.comment_docname) {
|
||||||
|
data.mark_html = "<div class='message-mark' title='Public'\
|
||||||
|
style='background-color: green'></div>"
|
||||||
|
}
|
||||||
|
|
||||||
wrapper.innerHTML = repl('<div class="message %(cls)s">%(delete_html)s\
|
wrapper.innerHTML = repl('<div class="message %(cls)s">%(mark_html)s\
|
||||||
<b>%(comment)s</b>\
|
<span class="avatar avatar-small"><img src="%(image)s"></span><b>%(comment)s</b>\
|
||||||
|
%(delete_html)s\
|
||||||
<div class="help">by %(comment_by_fullname)s, %(creation)s</div>\
|
<div class="help">by %(comment_by_fullname)s, %(creation)s</div>\
|
||||||
%(reply_html)s</div>\
|
</div>\
|
||||||
<div style="clear: both;"></div>', data);
|
<div style="clear: both;"></div>', data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -173,15 +178,24 @@ erpnext.Messages = Class.extend({
|
|||||||
method:'get_active_users',
|
method:'get_active_users',
|
||||||
callback: function(r,rt) {
|
callback: function(r,rt) {
|
||||||
var $body = $(me.wrapper).find('.layout-side-section');
|
var $body = $(me.wrapper).find('.layout-side-section');
|
||||||
$("<h4>Users</h4><hr>").appendTo($body);
|
$('<h4>Users</h4><hr>\
|
||||||
|
<div id="show-everyone">\
|
||||||
|
<a href="#messages/'+user+'" class="btn btn-small">\
|
||||||
|
Show messages from everyone</a><hr></div>\
|
||||||
|
').appendTo($body);
|
||||||
|
r.message.sort(function(a, b) { return b.has_session - a.has_session; });
|
||||||
for(var i in r.message) {
|
for(var i in r.message) {
|
||||||
var p = r.message[i];
|
var p = r.message[i];
|
||||||
if(p.name != user) {
|
if(p.name != user) {
|
||||||
p.fullname = wn.user_info(p.name).fullname;
|
p.fullname = wn.user_info(p.name).fullname;
|
||||||
|
p.image = wn.user_info(p.name).image;
|
||||||
p.name = p.name.replace('@', '__at__');
|
p.name = p.name.replace('@', '__at__');
|
||||||
p.label_status = p.has_session ? "label-success" : "";
|
p.status_color = p.has_session ? "green" : "#ddd";
|
||||||
p.status = p.has_session ? "Online" : "Offline";
|
p.status = p.has_session ? "Online" : "Offline";
|
||||||
$(repl('<p><span class="label %(label_status)s">%(status)s</span>\
|
$(repl('<p>\
|
||||||
|
<span class="avatar avatar-small" \
|
||||||
|
style="border: 3px solid %(status_color)s" \
|
||||||
|
title="%(status)s"><img src="%(image)s"></span>\
|
||||||
<a href="#!messages/%(name)s">%(fullname)s</a>\
|
<a href="#!messages/%(name)s">%(fullname)s</a>\
|
||||||
</p>', p))
|
</p>', p))
|
||||||
.appendTo($body);
|
.appendTo($body);
|
||||||
|
@ -33,15 +33,18 @@ def get_list(arg=None):
|
|||||||
|
|
||||||
# return messages
|
# return messages
|
||||||
return webnotes.conn.sql("""select * from `tabComment`
|
return webnotes.conn.sql("""select * from `tabComment`
|
||||||
where (owner=%(contact)s or comment_docname=%(user)s)
|
where (owner=%(contact)s
|
||||||
and comment_doctype in ('My Company', 'Message')
|
or comment_docname=%(user)s
|
||||||
|
or (owner=comment_docname and ifnull(parenttype, "")!="Assignment"))
|
||||||
|
and comment_doctype ='Message'
|
||||||
order by creation desc
|
order by creation desc
|
||||||
limit %(limit_start)s, %(limit_page_length)s""", webnotes.form_dict, as_dict=1)
|
limit %(limit_start)s, %(limit_page_length)s""", webnotes.form_dict, as_dict=1)
|
||||||
else:
|
else:
|
||||||
return webnotes.conn.sql("""select * from `tabComment`
|
return webnotes.conn.sql("""select * from `tabComment`
|
||||||
where (owner=%(contact)s and comment_docname=%(user)s)
|
where (owner=%(contact)s and comment_docname=%(user)s)
|
||||||
or (owner=%(user)s and comment_docname=%(contact)s)
|
or (owner=%(user)s and comment_docname=%(contact)s)
|
||||||
and comment_doctype in ('My Company', 'Message')
|
or (owner=%(contact)s and comment_docname=%(contact)s)
|
||||||
|
and comment_doctype ='Message'
|
||||||
order by creation desc
|
order by creation desc
|
||||||
limit %(limit_start)s, %(limit_page_length)s""", webnotes.form_dict, as_dict=1)
|
limit %(limit_start)s, %(limit_page_length)s""", webnotes.form_dict, as_dict=1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user