notifications of todo items

This commit is contained in:
Anand Doshi 2012-02-20 16:31:55 +05:30
parent 90aee34b10
commit c3023be794
14 changed files with 310 additions and 127 deletions

View File

@ -2253,3 +2253,15 @@ body {
.module-icons-setup{ background-position: 0 -594px; }
.module-icons-stock{ background-position: 0 -660px; }
.module-icons-support{ background-position: 0 -726px; }
.topbar-new-comments {
margin: -3px 0px;
padding: 2px;
font-size: 14px;
color: #fff;
background-color: #B00D07;
min-width: 20px;
text-align: center;
display: inline-block;
border-radius: 2px;
}

View File

@ -1036,6 +1036,19 @@ body {
.module-icons-setup{ background-position: 0 -594px; }
.module-icons-stock{ background-position: 0 -660px; }
.module-icons-support{ background-position: 0 -726px; }
.topbar-new-comments {
margin: -3px 0px;
padding: 2px;
font-size: 14px;
color: #fff;
background-color: #B00D07;
min-width: 20px;
text-align: center;
display: inline-block;
border-radius: 2px;
}
/*
* erpnext/website/css/website.css
*/#body_div {

View File

@ -197,10 +197,11 @@ class DocType:
return count
def get_todo_list(self):
return sql("""select name, description, date,
res = sql("""select name, description, `date`,
priority, checked, reference_type, reference_name from `tabToDo Item`
where owner=%s order by field(priority,'High','Medium','Low') asc, date asc""", \
session['user'], as_dict=1)
return res
def add_todo_item(self,args):
args = json.loads(args)
@ -213,11 +214,27 @@ class DocType:
d.owner = session['user']
d.save(not args.get('name') and 1 or 0)
if args.get('name') and d.checked:
self.notify_assignment(d)
return d.name
def remove_todo_item(self,nm):
d = Document('ToDo Item', nm or None)
if d and d.name:
self.notify_assignment(d)
sql("delete from `tabToDo Item` where name = %s",nm)
def notify_assignment(self, d):
doc_type = d.fields.get('reference_type')
doc_name = d.fields.get('reference_name')
assigned_by = d.fields.get('assigned_by')
if doc_type and doc_name and assigned_by:
from webnotes.widgets.form import assign_to
assign_to.notify_assignment(assigned_by, d.owner, doc_type, doc_name)
# -------------------------------------------------------------------------------------------------------
def dismiss_message(self, arg=''):

View File

@ -95,6 +95,7 @@ OnlineUsers = function(wrapper) {
if(online_users.length) {
var max = online_users.length; max = (max > 10 ? 10 : max)
me.wrapper.innerHTML = "";
for(var i=0; i<max; i++) {
new OneOnlineUser(me.wrapper, online_users[i]);
}
@ -577,34 +578,13 @@ FeedItem.prototype.render_references = function(div, det) {
(strip(det.full_name) ? det.full_name : det.modified_by);
}
HomeStatusBar = function() {
var me = this;
var parent = page_body.pages['Event Updates'];
this.wrapper = $a($td(parent.main_tab, 0, 1), 'div', 'home-status', {}, 'Loading...');
$br(this.wrapper, '3px');
this.render = function(r) {
this.wrapper.innerHTML = '';
this.span = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'});
this.span.onclick = function() { loadpage('My Company') }
if(r.unread_messages) {
this.span.innerHTML = '<span class="home-status-unread">' + r.unread_messages + '</span> unread';
} else {
this.span.innerHTML = 'Team / Messages';
}
}
}
pscript.home_make_status = function() {
var home_status_bar = new HomeStatusBar()
var wrapper = page_body.pages['Event Updates'];
// get values
$c_page('home', 'event_updates', 'get_status_details', user,
function(r,rt) {
home_status_bar.render(r.message);
page_body.wntoolbar.set_new_comments(r.message.unread_messages);
// render online users
pscript.online_users_obj.render(r.message.online_users);

View File

@ -10,13 +10,16 @@ def get_online_users(arg=None):
and t1.user not in ('Guest','Administrator')
and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or []
@webnotes.whitelist()
def get_unread_messages(arg=None):
"returns unread (docstatus-0 messages for a user)"
return cint(webnotes.conn.sql("""SELECT COUNT(*) FROM `tabComment Widget Record`
WHERE comment_doctype='My Company'
AND comment_docname = %s
AND ifnull(docstatus,0)=0
""", webnotes.user.name)[0][0])
return webnotes.conn.sql("""\
SELECT name, comment
FROM `tabComment Widget Record`
WHERE comment_doctype='My Company'
AND comment_docname = %s
AND ifnull(docstatus,0)=0
""", webnotes.user.name, as_list=1)
@webnotes.whitelist()
def get_status_details(arg=None):
@ -30,8 +33,6 @@ def get_status_details(arg=None):
'user_count': len(online) or 0,
'unread_messages': get_unread_messages(),
'online_users': online or [],
'is_trial': webnotes.conn.get_global('is_trial'),
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0'),
'setup_status': get_setup_status(),
'registration_complete': cint(get_defaults('registration_complete')) and 'Yes' or 'No',
'profile': webnotes.conn.sql("""\

View File

@ -119,7 +119,7 @@ def post_comment(arg):
d.comment = arg['comment']
d.save(1)
if cint(arg['notify']):
if cint(arg.get('notify')):
fn = webnotes.conn.sql('select first_name, last_name from tabProfile where name=%s', webnotes.user.name)[0]
if fn[0] or f[1]:
fn = cstr(fn[0]) + (fn[0] and ' ' or '') + cstr(fn[1])

View File

@ -3,6 +3,9 @@ import patches.jan_mar_2012.website.feed
import patches.jan_mar_2012.website.website
import patches.jan_mar_2012.website.cleanups
import patches.jan_mar_2012.website.domain_list
import patches.jan_mar_2012.website.file_data_rename
import patches.jan_mar_2012.website.analytics
def execute():
patches.jan_mar_2012.website.login.execute()
@ -11,3 +14,4 @@ def execute():
patches.jan_mar_2012.website.cleanups.execute()
patches.jan_mar_2012.website.domain_list.execute()
patches.jan_mar_2012.website.file_data_rename.execute()
patches.jan_mar_2012.website.analytics.execute()

View File

@ -44,3 +44,15 @@ body {
.module-icons-setup{ background-position: 0 -594px; }
.module-icons-stock{ background-position: 0 -660px; }
.module-icons-support{ background-position: 0 -726px; }
.topbar-new-comments {
margin: -3px 0px;
padding: 2px;
font-size: 14px;
color: #fff;
background-color: #B00D07;
min-width: 20px;
text-align: center;
display: inline-block;
border-radius: 2px;
}

View File

@ -30,6 +30,9 @@ erpnext.startup.start = function() {
// setup toolbar
erpnext.toolbar.setup();
// set interval for updates
erpnext.startup.set_periodic_updates();
// border to the body
// ------------------
$('footer').html('<div class="erpnext-footer">\
@ -77,6 +80,35 @@ ModulePage = function(parent, module_name, module_label, help_page, callback) {
if(callback) this.callback = function(){ callback(); }
}
// ========== Update Messages ============
var update_messages = function() {
// Updates Team Messages
if(inList(['Guest', 'Administrator'], user)) { return; }
$c_page('home', 'event_updates', 'get_unread_messages', null,
function(r,rt) {
if(!r.exc) {
// This function is defined in toolbar.js
page_body.wntoolbar.set_new_comments(r.message);
}
}
);
}
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(update_messages, 180000);
}
// =======================================
// start
$(document).bind('startup', function() {
erpnext.startup.start();

View File

@ -3,7 +3,12 @@ wn.provide('erpnext.toolbar');
erpnext.toolbar.setup = function() {
// profile
$('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>')
$('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>');
$('#toolbar-user').append('<li><a href="#My Company">Team / Messages</a></li>');
$('.topbar .secondary-nav').prepend('\
<li><a href="#" id="toolbar-new-comments"></a></li>');
// help
$('.topbar .secondary-nav').append('<li class="dropdown">\
@ -24,4 +29,25 @@ erpnext.toolbar.setup = function() {
if(pscript.is_erpnext_saas && is_system_manager) {
$('#toolbar-user').append('<li><a href="#billing">Billing</a></li>')
}
$.extend(page_body.wntoolbar, {
set_new_comments: function(new_comments) {
var topbar_nc = $('#toolbar-new-comments');
if(new_comments && new_comments.length>0) {
topbar_nc.html('<span class="topbar-new-comments">' + new_comments.length + '</span>');
topbar_nc.click(function() { loadpage('My Company'); });
$.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, id); }
})
} else {
topbar_nc.html('');
topbar_nc.click(function() { return false; });
}
}
});
page_body.wntoolbar.set_new_comments();
}

View File

@ -3,140 +3,211 @@
# These values are common in all dictionaries
{
'creation': '2009-05-12 11:19:11',
'creation': '2009-05-12 16:43:58',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
'modified': '2012-02-17 15:48:54',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'autoname': 'TDI.########',
'colour': 'White:FFF',
'allow_attach': 0,
'allow_copy': 0,
'allow_email': 0,
'allow_print': 0,
'allow_rename': 0,
'allow_trash': 0,
'autoname': u'TDI.########',
'colour': u'White:FFF',
'doctype': 'DocType',
'hide_heading': 0,
'hide_toolbar': 0,
'in_create': 1,
'module': 'Utilities',
'in_dialog': 0,
'is_transaction_doc': 0,
'issingle': 0,
'max_attachments': 0,
'module': u'Utilities',
'name': '__common__',
'read_only': 1,
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0
'read_only_onload': 0,
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'use_template': 0,
'version': 5
},
# These values are common for all DocField
{
'doctype': 'DocField',
'doctype': u'DocField',
'name': '__common__',
'parent': 'ToDo Item',
'parentfield': 'fields',
'parenttype': 'DocType',
'parent': u'ToDo Item',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'doctype': u'DocPerm',
'name': '__common__',
'parent': 'ToDo Item',
'parentfield': 'permissions',
'parenttype': 'DocType',
'parent': u'ToDo Item',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1,
'role': 'All'
'role': u'All',
'write': 1
},
# DocType, ToDo Item
{
'doctype': 'DocType',
'name': 'ToDo Item'
'name': u'ToDo Item'
},
# DocPerm
{
'doctype': 'DocPerm'
'doctype': u'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Text',
'idx': 1,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Text',
'width': '300px'
'allow_on_submit': 0,
'doctype': u'DocField',
'fieldname': u'description',
'fieldtype': u'Text',
'hidden': 0,
'in_filter': 0,
'label': u'Description',
'no_copy': 0,
'oldfieldname': u'description',
'oldfieldtype': u'Text',
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0,
'width': u'300px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'date',
'fieldtype': 'Date',
'idx': 2,
'label': 'Date',
'oldfieldname': 'date',
'oldfieldtype': 'Date',
'reqd': 1
'allow_on_submit': 0,
'doctype': u'DocField',
'fieldname': u'date',
'fieldtype': u'Date',
'hidden': 0,
'in_filter': 0,
'label': u'Date',
'no_copy': 0,
'oldfieldname': u'date',
'oldfieldtype': u'Date',
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'priority',
'fieldtype': 'Data',
'idx': 3,
'label': 'Priority',
'oldfieldname': 'priority',
'oldfieldtype': 'Data',
'reqd': 1
'allow_on_submit': 0,
'doctype': u'DocField',
'fieldname': u'priority',
'fieldtype': u'Data',
'hidden': 0,
'in_filter': 0,
'label': u'Priority',
'no_copy': 0,
'oldfieldname': u'priority',
'oldfieldtype': u'Data',
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'reference_type',
'fieldtype': 'Data',
'idx': 4,
'label': 'Reference Type',
'oldfieldname': 'reference_type',
'oldfieldtype': 'Data'
'allow_on_submit': 0,
'doctype': u'DocField',
'fieldname': u'reference_type',
'fieldtype': u'Data',
'hidden': 0,
'in_filter': 0,
'label': u'Reference Type',
'no_copy': 0,
'oldfieldname': u'reference_type',
'oldfieldtype': u'Data',
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'reference_name',
'fieldtype': 'Data',
'idx': 5,
'label': 'Reference Name',
'oldfieldname': 'reference_name',
'oldfieldtype': 'Data'
'allow_on_submit': 0,
'doctype': u'DocField',
'fieldname': u'reference_name',
'fieldtype': u'Data',
'hidden': 0,
'in_filter': 0,
'label': u'Reference Name',
'no_copy': 0,
'oldfieldname': u'reference_name',
'oldfieldtype': u'Data',
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'checked',
'fieldtype': 'Check',
'idx': 6,
'label': 'Checked',
'oldfieldname': 'checked',
'oldfieldtype': 'Check'
'allow_on_submit': 0,
'doctype': u'DocField',
'fieldname': u'checked',
'fieldtype': u'Check',
'hidden': 0,
'in_filter': 0,
'label': u'Checked',
'no_copy': 0,
'oldfieldname': u'checked',
'oldfieldtype': u'Check',
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'role',
'fieldtype': 'Link',
'idx': 7,
'label': 'Role',
'oldfieldname': 'role',
'oldfieldtype': 'Link',
'options': 'Role'
'allow_on_submit': 0,
'doctype': u'DocField',
'fieldname': u'role',
'fieldtype': u'Link',
'hidden': 0,
'in_filter': 0,
'label': u'Role',
'no_copy': 0,
'oldfieldname': u'role',
'oldfieldtype': u'Link',
'options': u'Role',
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'assigned_by',
'fieldtype': u'Link',
'label': u'Assigned By',
'options': u'Profile'
}
]

View File

@ -480,8 +480,9 @@ var t=make_table(msg_dialog.rows['Msg'],1,2,'100%',['20px','250px'],{padding:'2p
if(!msg_dialog.display)msg_dialog.show();var has_msg=msg_dialog.msg_area.innerHTML?1:0;var m=$a(msg_dialog.msg_area,'div','');if(has_msg)$y(m,{marginTop:'4px'});$dh(msg_dialog.msg_icon);if(msg.substr(0,6).toLowerCase()=='error:'){msg_dialog.msg_icon.src='lib/images/icons/error.gif';$di(msg_dialog.msg_icon);msg=msg.substr(6);}else if(msg.substr(0,8).toLowerCase()=='message:'){msg_dialog.msg_icon.src='lib/images/icons/application.gif';$di(msg_dialog.msg_icon);msg=msg.substr(8);}else if(msg.substr(0,3).toLowerCase()=='ok:'){msg_dialog.msg_icon.src='lib/images/icons/accept.gif';$di(msg_dialog.msg_icon);msg=msg.substr(3);}
m.innerHTML=replace_newlines(msg);if(m.offsetHeight>200){$y(m,{height:'200px',width:'400px',overflow:'auto'})}
msg_dialog.custom_onhide=callback;}
var growl_area;function show_alert(txt){if(!growl_area){growl_area=$a(popup_cont,'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'div','wn-icon ic-round_delete',{cssFloat:'right'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);$(wrapper).hide().fadeIn(1000);}
var growl_area;function show_alert(txt,id){if(!growl_area){growl_area=$a(popup_cont,'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'div','wn-icon ic-round_delete',{cssFloat:'right'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);}
$(wrapper).hide().fadeIn(1000);}
/*
* lib/js/legacy/utils/shortcut.js
*/
@ -1378,7 +1379,7 @@ if(rd[1]){var dt=rd[0];var dn=rd[1];this.add(dt,dn,0);}}}});
/*
* lib/js/wn/ui/toolbar/toolbar.js
*/
wn.ui.toolbar.Toolbar=Class.extend({init:function(){this.make();this.make_home();this.make_new();this.make_search();this.make_report();wn.ui.toolbar.recent=new wn.ui.toolbar.RecentDocs();if(in_list(user_roles,'Administrator'))
wn.ui.toolbar.Toolbar=Class.extend({init:function(){this.make();this.make_home();this.make_document();wn.ui.toolbar.recent=new wn.ui.toolbar.RecentDocs();if(in_list(user_roles,'Administrator'))
this.make_options();this.make_tools();this.set_user_name();this.make_logout();$('.topbar').dropdown();$(document).trigger('toolbar_setup');},make:function(){$('header').append('<div class="topbar">\
<div class="topbar-inner">\
<div class="container">\
@ -1395,10 +1396,14 @@ this.make_options();this.make_tools();this.set_user_name();this.make_logout();$(
</ul>\
</div>\
</div>\
</div>');},make_home:function(){$('.topbar .nav:first').append('<li><a href="#'+home_page+'">Home</a></li>')},make_new:function(){wn.ui.toolbar.new_dialog=new wn.ui.toolbar.NewDialog();$('.topbar .nav:first').append('<li><a href="#" \
onclick="return wn.ui.toolbar.new_dialog.show();">New</a></li>');},make_search:function(){wn.ui.toolbar.search=new wn.ui.toolbar.Search();$('.topbar .nav:first').append('<li><a href="#" \
onclick="return wn.ui.toolbar.search.show();">Search</a></li>');},make_report:function(){wn.ui.toolbar.report=new wn.ui.toolbar.Report();$('.topbar .nav:first').append('<li><a href="#" \
onclick="return wn.ui.toolbar.report.show();">Report</a></li>');},make_tools:function(){$('.topbar .nav:first').append('<li class="dropdown">\
</div>');},make_home:function(){$('.topbar .nav:first').append('<li><a href="#'+home_page+'">Home</a></li>')},make_document:function(){wn.ui.toolbar.new_dialog=new wn.ui.toolbar.NewDialog();wn.ui.toolbar.search=new wn.ui.toolbar.Search();wn.ui.toolbar.report=new wn.ui.toolbar.Report();$('.topbar .nav:first').append('<li class="dropdown">\
<a class="dropdown-toggle" href="#" onclick="return false;">Document</a>\
<ul class="dropdown-menu" id="toolbar-document">\
<li><a href="#" onclick="return wn.ui.toolbar.new_dialog.show();">New</a></li>\
<li><a href="#" onclick="return wn.ui.toolbar.search.show();">Search</a></li>\
<li><a href="#" onclick="return wn.ui.toolbar.report.show();">Report</a></li>\
</ul>\
</li>');},make_tools:function(){$('.topbar .nav:first').append('<li class="dropdown">\
<a class="dropdown-toggle" href="#" onclick="return false;">Tools</a>\
<ul class="dropdown-menu" id="toolbar-tools">\
<li><a href="#" onclick="return err_console.show();">Error Console</a></li>\
@ -2208,7 +2213,7 @@ wn.widgets.form.sidebar.AssignTo=Class.extend({init:function(parent,sidebar,doct
this.refresh();},refresh:function(){var me=this;$c('webnotes.widgets.form.assign_to.get',{doctype:me.doctype,name:me.name},function(r,rt){me.render(r.message)})},render:function(d){var me=this;$(this.body).empty();if(this.dialog){this.dialog.hide();}
for(var i=0;i<d.length;i++){$(this.body).append(repl('<div>%(owner)s \
<a class="close" href="#" data-owner="%(owner)s">&#215</a></div>',d[i]))}
$(this.body).find('a.close').click(function(){$c('webnotes.widgets.form.assign_to.remove',{doctype:me.doctype,name:me.name,assign_to:$(this).attr('data-owner')},function(r,rt){me.render(r.message);});return false;});},add:function(){var me=this;if(!me.dialog){me.dialog=new wn.widgets.Dialog({title:'Add to To Do',width:350,fields:[{fieldtype:'Link',fieldname:'assign_to',options:'Profile',label:'Assign To',description:'Add to To Do List of',reqd:true},{fieldtype:'Data',fieldname:'description',label:'Comment','default':'Assigned by '+user},{fieldtype:'Date',fieldname:'date',label:'Complete By'},{fieldtype:'Select',fieldname:'priority',label:'Priority',options:'Low\nMedium\nHigh','default':'Medium'},{fieldtype:'Button',label:'Add',fieldname:'add_btn'}]});me.dialog.fields_dict.add_btn.input.onclick=function(){var assign_to=me.dialog.fields_dict.assign_to.get_value();if(assign_to){$c('webnotes.widgets.form.assign_to.add',{doctype:me.doctype,name:me.name,assign_to:assign_to,description:me.dialog.fields_dict.description.get_value(),priority:me.dialog.fields_dict.priority.get_value(),date:me.dialog.fields_dict.date.get_value()},function(r,rt){me.render(r.message);});}}}
$(this.body).find('a.close').click(function(){$c('webnotes.widgets.form.assign_to.remove',{doctype:me.doctype,name:me.name,assign_to:$(this).attr('data-owner')},function(r,rt){me.render(r.message);});return false;});},add:function(){var me=this;if(!me.dialog){me.dialog=new wn.widgets.Dialog({title:'Add to To Do',width:350,fields:[{fieldtype:'Link',fieldname:'assign_to',options:'Profile',label:'Assign To',description:'Add to To Do List of',reqd:true},{fieldtype:'Data',fieldname:'description',label:'Comment','default':'Assigned by '+user},{fieldtype:'Date',fieldname:'date',label:'Complete By'},{fieldtype:'Select',fieldname:'priority',label:'Priority',options:'Low\nMedium\nHigh','default':'Medium'},{fieldtype:'Check',fieldname:'notify',label:'Notify By Email'},{fieldtype:'Button',label:'Add',fieldname:'add_btn'}]});me.dialog.fields_dict.add_btn.input.onclick=function(){var assign_to=me.dialog.fields_dict.assign_to.get_value();if(assign_to){$c('webnotes.widgets.form.assign_to.add',{doctype:me.doctype,name:me.name,assign_to:assign_to,description:me.dialog.fields_dict.description.get_value(),priority:me.dialog.fields_dict.priority.get_value(),date:me.dialog.fields_dict.date.get_value(),notify:me.dialog.fields_dict.notify.get_value()},function(r,rt){me.render(r.message);});}}}
me.dialog.clear();me.dialog.show();}});
/*
* lib/js/legacy/app.js
@ -2257,7 +2262,7 @@ wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',f
var current_module;var is_system_manager=0;var module_content_dict={};var user_full_nm={};wn.provide('erpnext.startup');erpnext.startup.set_globals=function(){pscript.is_erpnext_saas=cint(wn.control_panel.sync_with_gateway)
if(inList(user_roles,'System Manager'))is_system_manager=1;}
erpnext.startup.start=function(){$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(user=='Guest'){$dh(page_body.left_sidebar);if(wn.boot.custom_css){set_style(wn.boot.custom_css);}
if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{pscript.startup_make_sidebar();erpnext.toolbar.setup();$('footer').html('<div class="erpnext-footer">\
if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{pscript.startup_make_sidebar();erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();$('footer').html('<div class="erpnext-footer">\
Powered by <a href="https://erpnext.com">ERPNext</a></div>');}
$('#startup_div').toggle(false);}
show_chart_browser=function(nm,chart_type){var call_back=function(){if(nm=='Sales Browser'){var sb_obj=new SalesBrowser();sb_obj.set_val(chart_type);}
@ -2267,6 +2272,10 @@ loadpage(nm,call_back);}
ModulePage=function(parent,module_name,module_label,help_page,callback){this.parent=parent;page_body.cur_page.module_page=this;this.wrapper=$a(parent,'div');this.module_name=module_name;this.transactions=[];this.page_head=new PageHeader(this.wrapper,module_label);if(help_page){var btn=this.page_head.add_button('Help',function(){loadpage(this.help_page)},1,'ui-icon-help')
btn.help_page=help_page;}
if(callback)this.callback=function(){callback();}}
var update_messages=function(){if(inList(['Guest','Administrator'],user)){return;}
$c_page('home','event_updates','get_unread_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message);}});}
erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);}
wn.updates.id=setInterval(update_messages,180000);}
$(document).bind('startup',function(){erpnext.startup.start();});
/*
* erpnext/startup/modules.js
@ -2313,8 +2322,8 @@ si.show_section(me.det.doc_type);}}
/*
* erpnext/startup/toolbar.js
*/
wn.provide('erpnext.toolbar');erpnext.toolbar.setup=function(){$('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>')
$('.topbar .secondary-nav').append('<li class="dropdown">\
wn.provide('erpnext.toolbar');erpnext.toolbar.setup=function(){$('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>');$('#toolbar-user').append('<li><a href="#My Company">Team / Messages</a></li>');$('.topbar .secondary-nav').prepend('\
<li><a href="#" id="toolbar-new-comments"></a></li>');$('.topbar .secondary-nav').append('<li class="dropdown">\
<a class="dropdown-toggle" href="#" onclick="return false;">Help</a>\
<ul class="dropdown-menu" id="toolbar-help">\
</ul></li>')
@ -2324,7 +2333,8 @@ $('#toolbar-help').append('<li><a href="http://groups.google.com/group/erpnext-u
Forum</a></li>')
$('#toolbar-help').append('<li><a href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">\
Live Chat (Office Hours)</a></li>')
if(pscript.is_erpnext_saas&&is_system_manager){$('#toolbar-user').append('<li><a href="#billing">Billing</a></li>')}}
if(pscript.is_erpnext_saas&&is_system_manager){$('#toolbar-user').append('<li><a href="#billing">Billing</a></li>')}
$.extend(page_body.wntoolbar,{set_new_comments:function(new_comments){var topbar_nc=$('#toolbar-new-comments');if(new_comments&&new_comments.length>0){topbar_nc.html('<span class="topbar-new-comments">'+new_comments.length+'</span>');topbar_nc.click(function(){loadpage('My Company');});$.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,id);}})}else{topbar_nc.html('');topbar_nc.click(function(){return false;});}}});page_body.wntoolbar.set_new_comments();}
/*
* erpnext/startup/feature_setup.js
*/

View File

@ -406,8 +406,9 @@ var t=make_table(msg_dialog.rows['Msg'],1,2,'100%',['20px','250px'],{padding:'2p
if(!msg_dialog.display)msg_dialog.show();var has_msg=msg_dialog.msg_area.innerHTML?1:0;var m=$a(msg_dialog.msg_area,'div','');if(has_msg)$y(m,{marginTop:'4px'});$dh(msg_dialog.msg_icon);if(msg.substr(0,6).toLowerCase()=='error:'){msg_dialog.msg_icon.src='lib/images/icons/error.gif';$di(msg_dialog.msg_icon);msg=msg.substr(6);}else if(msg.substr(0,8).toLowerCase()=='message:'){msg_dialog.msg_icon.src='lib/images/icons/application.gif';$di(msg_dialog.msg_icon);msg=msg.substr(8);}else if(msg.substr(0,3).toLowerCase()=='ok:'){msg_dialog.msg_icon.src='lib/images/icons/accept.gif';$di(msg_dialog.msg_icon);msg=msg.substr(3);}
m.innerHTML=replace_newlines(msg);if(m.offsetHeight>200){$y(m,{height:'200px',width:'400px',overflow:'auto'})}
msg_dialog.custom_onhide=callback;}
var growl_area;function show_alert(txt){if(!growl_area){growl_area=$a(popup_cont,'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'div','wn-icon ic-round_delete',{cssFloat:'right'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);$(wrapper).hide().fadeIn(1000);}
var growl_area;function show_alert(txt,id){if(!growl_area){growl_area=$a(popup_cont,'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'div','wn-icon ic-round_delete',{cssFloat:'right'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);}
$(wrapper).hide().fadeIn(1000);}
/*
* lib/js/legacy/utils/shortcut.js
*/
@ -1110,7 +1111,7 @@ wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',f
var current_module;var is_system_manager=0;var module_content_dict={};var user_full_nm={};wn.provide('erpnext.startup');erpnext.startup.set_globals=function(){pscript.is_erpnext_saas=cint(wn.control_panel.sync_with_gateway)
if(inList(user_roles,'System Manager'))is_system_manager=1;}
erpnext.startup.start=function(){$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(user=='Guest'){$dh(page_body.left_sidebar);if(wn.boot.custom_css){set_style(wn.boot.custom_css);}
if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{pscript.startup_make_sidebar();erpnext.toolbar.setup();$('footer').html('<div class="erpnext-footer">\
if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{pscript.startup_make_sidebar();erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();$('footer').html('<div class="erpnext-footer">\
Powered by <a href="https://erpnext.com">ERPNext</a></div>');}
$('#startup_div').toggle(false);}
show_chart_browser=function(nm,chart_type){var call_back=function(){if(nm=='Sales Browser'){var sb_obj=new SalesBrowser();sb_obj.set_val(chart_type);}
@ -1120,6 +1121,10 @@ loadpage(nm,call_back);}
ModulePage=function(parent,module_name,module_label,help_page,callback){this.parent=parent;page_body.cur_page.module_page=this;this.wrapper=$a(parent,'div');this.module_name=module_name;this.transactions=[];this.page_head=new PageHeader(this.wrapper,module_label);if(help_page){var btn=this.page_head.add_button('Help',function(){loadpage(this.help_page)},1,'ui-icon-help')
btn.help_page=help_page;}
if(callback)this.callback=function(){callback();}}
var update_messages=function(){if(inList(['Guest','Administrator'],user)){return;}
$c_page('home','event_updates','get_unread_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message);}});}
erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);}
wn.updates.id=setInterval(update_messages,180000);}
$(document).bind('startup',function(){erpnext.startup.start();});
/*
* erpnext/website/js/topbar.js

View File

@ -1 +1 @@
464
571