2012-02-23 07:05:32 +00:00
|
|
|
// ERPNext - web based ERP (http://erpnext.com)
|
|
|
|
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2012-01-20 08:17:16 +00:00
|
|
|
/* toolbar settings */
|
|
|
|
wn.provide('erpnext.toolbar');
|
|
|
|
|
|
|
|
erpnext.toolbar.setup = function() {
|
2012-02-21 11:56:50 +00:00
|
|
|
// modules
|
|
|
|
erpnext.toolbar.add_modules();
|
|
|
|
|
2012-01-20 08:17:16 +00:00
|
|
|
// profile
|
2012-02-20 11:01:55 +00:00
|
|
|
$('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>');
|
|
|
|
|
|
|
|
$('#toolbar-user').append('<li><a href="#My Company">Team / Messages</a></li>');
|
|
|
|
|
2012-02-21 11:56:50 +00:00
|
|
|
|
2012-02-21 05:49:24 +00:00
|
|
|
$('.navbar .pull-right').prepend('\
|
2012-02-20 11:01:55 +00:00
|
|
|
<li><a href="#" id="toolbar-new-comments"></a></li>');
|
2012-01-20 08:17:16 +00:00
|
|
|
|
|
|
|
// help
|
2012-02-21 05:49:24 +00:00
|
|
|
$('.navbar .pull-right').append('<li class="dropdown">\
|
|
|
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
|
|
|
|
onclick="return false;">Help<b class="caret"></b></a>\
|
2012-01-20 08:17:16 +00:00
|
|
|
<ul class="dropdown-menu" id="toolbar-help">\
|
|
|
|
</ul></li>')
|
|
|
|
|
|
|
|
$('#toolbar-help').append('<li><a href="http://erpnext.blogspot.com/2011/03/erpnext-help.html" target="_blank">\
|
|
|
|
Documentation</a></li>')
|
|
|
|
|
|
|
|
$('#toolbar-help').append('<li><a href="http://groups.google.com/group/erpnext-user-forum" target="_blank">\
|
|
|
|
Forum</a></li>')
|
|
|
|
|
|
|
|
$('#toolbar-help').append('<li><a href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">\
|
|
|
|
Live Chat (Office Hours)</a></li>')
|
|
|
|
|
|
|
|
// billing
|
|
|
|
if(pscript.is_erpnext_saas && is_system_manager) {
|
|
|
|
$('#toolbar-user').append('<li><a href="#billing">Billing</a></li>')
|
|
|
|
}
|
2012-02-20 11:01:55 +00:00
|
|
|
|
|
|
|
$.extend(page_body.wntoolbar, {
|
|
|
|
set_new_comments: function(new_comments) {
|
2012-02-21 05:49:24 +00:00
|
|
|
var navbar_nc = $('#toolbar-new-comments');
|
2012-02-20 11:01:55 +00:00
|
|
|
if(new_comments && new_comments.length>0) {
|
2012-02-21 05:49:24 +00:00
|
|
|
navbar_nc.html('<span class="navbar-new-comments">' + new_comments.length + '</span>');
|
|
|
|
navbar_nc.click(function() { loadpage('My Company'); });
|
2012-02-20 11:01:55 +00:00
|
|
|
$.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 {
|
2012-02-21 05:49:24 +00:00
|
|
|
navbar_nc.html('');
|
|
|
|
navbar_nc.click(function() { return false; });
|
2012-02-20 11:01:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
page_body.wntoolbar.set_new_comments();
|
|
|
|
}
|
|
|
|
|
2012-02-21 11:56:50 +00:00
|
|
|
erpnext.toolbar.add_modules = function() {
|
|
|
|
$('<li class="dropdown">\
|
|
|
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#"\
|
|
|
|
onclick="return false;">Modules<b class="caret"></b></a>\
|
|
|
|
<ul class="dropdown-menu">\
|
|
|
|
<li><a href="#!accounts-home" data-module="Accounts">Accounts</a></li>\
|
|
|
|
<li><a href="#!selling-home" data-module="Selling">Selling</a></li>\
|
|
|
|
<li><a href="#!stock-home" data-module="Stock">Stock</a></li>\
|
|
|
|
<li><a href="#!buying-home" data-module="Buying">Buying</a></li>\
|
|
|
|
<li><a href="#!support-home" data-module="Support">Support</a></li>\
|
|
|
|
<li><a href="#!hr-home" data-module="HR">Human Resources</a></li>\
|
|
|
|
<li><a href="#!projects-home" data-module="Projects">Projects</a></li>\
|
|
|
|
<li><a href="#!production-home" data-module="Production">Production</a></li>\
|
|
|
|
<li><a href="#!website-home" data-module="Website">Website</a></li>\
|
|
|
|
<li class="divider"></li>\
|
|
|
|
<li><a href="#!Setup" data-module="Setup">Setup</a></li>\
|
|
|
|
</ul>\
|
|
|
|
</li>').insertAfter('li[data-name="navbar-home"]');
|
|
|
|
$('.navbar .nav:first')
|
|
|
|
}
|
|
|
|
|