Merge branch 'navupdate' of github.com:webnotes/erpnext into navupdate

Conflicts:
	version.num
This commit is contained in:
Anand Doshi 2012-02-27 18:32:38 +05:30
commit f9f73bfa55
19 changed files with 310 additions and 88 deletions

View File

@ -186,6 +186,9 @@ div.std-footer-item {
padding: 15px;
background-color: #FFF;
min-height: 450px;
-moz-box-shadow: 7px 0px 6px -2px #ddd;
-webkit-box-shadow: 7px 0px 6px -2px #ddd;
box-shadow: 7px 0px 6px -2px #ddd;
}
.layout-side-section {

View File

@ -186,6 +186,9 @@ div.std-footer-item {
padding: 15px;
background-color: #FFF;
min-height: 450px;
-moz-box-shadow: 7px 0px 6px -2px #ddd;
-webkit-box-shadow: 7px 0px 6px -2px #ddd;
box-shadow: 7px 0px 6px -2px #ddd;
}
.layout-side-section {

View File

@ -58,7 +58,7 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
"makes a new Feed record"
#msgprint(subject)
from webnotes.model.doc import Document
from webnotes.utils import get_full_name
from webnotes.utils import get_fullname
if feedtype in ('Login', 'Comment', 'Assignment'):
# delete old login, comment feed
@ -77,7 +77,7 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
f.doc_name = name
f.subject = subject
f.color = color
f.full_name = get_full_name(owner)
f.full_name = get_fullname(owner)
f.save()
def update_feed(doc, method=None):

View File

@ -29,7 +29,7 @@ pscript['onload_Event Updates'] = function() {
// ==================================
pscript.home_make_body = function() {
var wrapper = page_body.pages['Event Updates'];
var wrapper = wn.pages['Event Updates'];
// body
$(wrapper).addClass('layout-wrapper').addClass('layout-wrapper-background')
@ -47,7 +47,7 @@ pscript.home_make_body = function() {
// ==================================
pscript.home_set_banner = function(wrapper) {
var wrapper = page_body.pages['Event Updates'];
var wrapper = wn.pages['Event Updates'];
var cp = wn.control_panel;
// banner
@ -61,7 +61,7 @@ pscript.home_set_banner = function(wrapper) {
// ==================================
pscript.home_make_widgets = function() {
var wrapper = page_body.pages['Event Updates'];
var wrapper = wn.pages['Event Updates'];
var cell = wrapper.side_section;
// sidebar
@ -595,7 +595,7 @@ FeedItem.prototype.render_references = function(div, det) {
}
pscript.home_make_status = function() {
var wrapper = page_body.pages['Event Updates'];
var wrapper = wn.pages['Event Updates'];
// get values
$c_page('home', 'event_updates', 'get_status_details', user,
@ -625,7 +625,7 @@ SetupWizard = function(status) {
$.extend(this, {
make: function(status) {
me.status = status;
me.wrapper = page_body.pages['Event Updates'].setup_wizard_area;
me.wrapper = wn.pages['Event Updates'].setup_wizard_area;
$ds(me.wrapper);
me.make_percent(status.percent);
me.make_suggestion(status.ret);

View File

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript['onload_My Company'] = function() {
var wrapper = page_body.pages['My Company'];
var wrapper = wn.pages['My Company'];
// body
wrapper.className = 'layout_wrapper';
@ -112,7 +112,7 @@ pscript.myc_add_user = function() {
}
pscript.myc_refresh = function() {
page_body.pages['My Company'].member_list.lst.run();
wn.pages['My Company'].member_list.lst.run();
}
pscript.myc_make_list= function(wrapper) {
@ -121,7 +121,7 @@ pscript.myc_make_list= function(wrapper) {
pscript.get_fullname=function(uid) {
if(uid=='Administrator') return uid;
return page_body.pages['My Company'].member_list.member_items[uid].fullname;
return wn.pages['My Company'].member_list.member_items[uid].fullname;
}
@ -740,7 +740,7 @@ MemberCoversationComment = function(cell, det, conv) {
this.user = $a(this.comment, 'span', 'link_type', {fontWeight:'bold'}, pscript.get_fullname(det.owner));
this.user.onclick = function() {
page_body.pages['My Company'].member_list.show_profile(me.det.owner);
wn.pages['My Company'].member_list.show_profile(me.det.owner);
}
var st = (!det.docstatus ? {fontWeight: 'bold'} : null);

View File

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript['onload_profile-settings'] = function() {
var wrapper = page_body.pages['profile-settings'];
var wrapper = wn.pages['profile-settings'];
wrapper.className = 'layout_wrapper';
pscript.myprofile = new MyProfile(wrapper)
}

View File

@ -28,7 +28,7 @@ pscript['refresh_question-view'] = function() {
}
pscript.question_view = function(qid, qtext) {
var w = page_body.pages['question-view'];
var w = wn.pages['question-view'];
new KBQuestionView(w, qid, qtext);
}

View File

@ -95,7 +95,6 @@ def get_letter_heads():
where ifnull(disabled,0)=0""")
return dict(ret)
def login_as(login_manager):
"""
Login as functionality -- allows signin from signin.erpnext.com

View File

@ -16,8 +16,6 @@
var current_module;
var is_system_manager = 0;
var module_content_dict = {};
var user_full_nm = {};
wn.provide('erpnext.startup');

View File

@ -22,13 +22,10 @@ erpnext.toolbar.setup = function() {
erpnext.toolbar.add_modules();
// profile
$('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>');
$('#toolbar-user').append('<li><a href="#My Company">Team / Messages</a></li>');
$('#toolbar-user').append('<li><a href="#!profile-settings">Profile Settings</a></li>');
$('.navbar .pull-right').append('\
<li><a href="#!My%20Company" title="Unread Messages"><span class="navbar-new-comments"></span></a></li>');
<li><a href="#!messages" title="Unread Messages"><span class="navbar-new-comments"></span></a></li>');
// help
$('.navbar .pull-right').prepend('<li class="dropdown">\

View File

@ -0,0 +1,35 @@
#message-post-text {
height: 3em;
}
#message-list {
margin: 0px 40px;
}
.message {
border-radius: 5px;
max-width: 60%;
min-width: 40%;
padding: 7px;
margin-bottom: 7px;
}
.message .help {
margin-bottom: 0px;
padding-bottom: 0px;
color: #888;
font-size: 11px;
}
.message-other {
background-color: #EBFF9C;
border: 1px solid #C3CF78;
float: right;
text-align: right;
}
.message-self {
background-color: #eee;
border: 1px solid #ccc;
float: left;
}

View File

@ -0,0 +1,28 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="layout-main-section">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Messages</h1>
<div class="well">
<textarea id="message-post-text"></textarea>
<button disabled="disabled" id="message-post" class="btn btn-small"><i class="icon-play"></i> Post</button>
</div>
<div id="message-list">
</div>
</div>
<div class="layout-side-section">
<div class="psidebar">
<div class="section">
<div class="section-head">
Messages By
</div>
<div class="section-body">
<div class="section-item">
<a href="#!messages"><b>All messages</b></a>
</div>
</div>
</div>
</div>
</div>
<div style="clear: both;">
</div>
</div>

View File

@ -0,0 +1,118 @@
wn.provide('erpnext.messages');
wn.pages.messages.onload = function(wrapper) {
erpnext.messages.show_active_users();
erpnext.messages.make_list();
// post message
$('#message-post').click(function() {
var txt = $('#message-post-text').val();
if(txt) {
wn.call({
module:'utilities',
page:'messages',
method:'post',
args: {
txt: txt,
contact: erpnext.messages.contact
},
callback:function(r,rt) {
$('#message-post-text').val('')
erpnext.messages.list.run();
},
btn: this
});
}
});
// enable, disable button
$('#message-post-text').keyup(function() {
if($(this).val()) {
$('#message-post').attr('disabled', false);
} else {
$('#message-post').attr('disabled', true);
}
})
}
wn.pages.messages.onshow = function(wrapper) {
erpnext.messages.show();
setTimeout(erpnext.messages.refresh, 5000);
}
erpnext.messages = {
show: function() {
var contact = erpnext.messages.get_contact();
// can't send message to self
$(wn.pages.messages).find('.well').toggle(contact==user ? false : true);
$(wn.pages.messages).find('h1:first').html('Messages: '
+ (user==contact ? 'From everyone' : wn.boot.user_fullnames[contact]))
erpnext.messages.contact = contact;
erpnext.messages.list.opts.args.contact = contact;
erpnext.messages.list.run();
},
// check for updates every 5 seconds if page is active
refresh: function() {
setTimeout(erpnext.messages.refresh, 10000);
if(page_body.cur_page_label != 'messages') return;
erpnext.messages.show();
},
get_contact: function() {
var route = location.hash;
if(route.indexOf('/')!=-1) {
var name = decodeURIComponent(route.split('/')[1]);
if(name.indexOf('__at__')!=-1) {
name = name.replace('__at__', '@');
}
return name;
}
return user;
},
make_list: function() {
erpnext.messages.list = new wn.widgets.Listing({
parent: $('#message-list').get(0),
method: 'utilities.page.messages.messages.get_list',
args: {
contact: null
},
render_row: function(wrapper, data) {
data.creation = dateutil.comment_when(data.creation);
data.comment_by_fullname = wn.boot.user_fullnames[data.owner];
if(data.owner==user) {
data.cls = 'message-self';
data.comment_by_fullname = 'You';
} else {
data.cls = 'message-other'
}
wrapper.innerHTML = repl('<div class="message %(cls)s"><b>%(comment)s</b>\
<div class="help">by %(comment_by_fullname)s, %(creation)s</div></div>\
<div style="clear: both;"></div>', data);
}
});
},
show_active_users: function() {
wn.call({
module:'utilities',
page:'messages',
method:'get_active_users',
callback: function(r,rt) {
var $body = $(wn.pages.messages).find('.section-body');
for(var i in r.message) {
var p = r.message[i];
p.fullname = wn.boot.user_fullnames[p.name];
p.name = p.name.replace('@', '__at__');
$body.append(repl('<div class="section-item">\
<a href="#!messages/%(name)s">%(fullname)s</a></div>', p))
}
}
});
}
}

View File

@ -0,0 +1,50 @@
import webnotes
@webnotes.whitelist()
def get_list(arg=None):
"""get list of messages"""
webnotes.form_dict['limit_start'] = int(webnotes.form_dict['limit_start'])
webnotes.form_dict['limit_page_length'] = int(webnotes.form_dict['limit_page_length'])
webnotes.form_dict['user'] = webnotes.session['user']
if webnotes.form_dict['contact'] == webnotes.session['user']:
# set all messages as read
webnotes.conn.sql("""UPDATE `tabComment Widget Record`
set docstatus = 1 where comment_doctype in ('My Company', 'Message')
and comment_docname = %s
""", webnotes.user.name)
# return messages
return webnotes.conn.sql("""select * from `tabComment Widget Record`
where (owner=%(contact)s or comment_docname=%(user)s)
and comment_doctype in ('My Company', 'Message')
order by creation desc
limit %(limit_start)s, %(limit_page_length)s""", webnotes.form_dict, as_dict=1)
else:
return webnotes.conn.sql("""select * from `tabComment Widget Record`
where (owner=%(contact)s and comment_docname=%(user)s)
or (owner=%(user)s and comment_docname=%(contact)s)
and comment_doctype in ('My Company', 'Message')
order by creation desc
limit %(limit_start)s, %(limit_page_length)s""", webnotes.form_dict, as_dict=1)
@webnotes.whitelist()
def get_active_users(arg=None):
return webnotes.conn.sql("""select name from tabProfile
where enabled=1 and
name not in ('Administrator', 'Guest')
order by first_name""", as_dict=1)
@webnotes.whitelist()
def post(arg=None):
"""post message"""
import json
arg = json.loads(arg)
from webnotes.model.doc import Document
d = Document('Comment Widget Record')
d.comment = arg['txt']
d.comment_docname = arg['contact']
d.comment_doctype = 'Message'
d.save()

View File

@ -126,7 +126,7 @@ erpnext.todo.save = function(btn) {
});
}
pscript.onload_todo = function() {
wn.pages.todo.onload = function() {
// load todos
erpnext.todo.refresh();
}

View File

@ -39,10 +39,10 @@ class DocType():
from jinja2 import Template
import markdown2
import os
from webnotes.utils import global_date_format, get_full_name
from webnotes.utils import global_date_format, get_fullname
self.doc.content_html = markdown2.markdown(self.doc.content or '')
self.doc.full_name = get_full_name(self.doc.owner)
self.doc.full_name = get_fullname(self.doc.owner)
self.doc.updated = global_date_format(self.doc.modified)
with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:

View File

@ -530,13 +530,13 @@ Field.prototype.set_style_mandatory=function(add){if(add){$(this.txt?this.txt:th
Field.prototype.refresh_mandatory=function(){if(this.in_filter)return;if(this.df.reqd){if(this.label_area)this.label_area.style.color="#d22";this.set_style_mandatory(1);}else{if(this.label_area)this.label_area.style.color="#222";this.set_style_mandatory(0);}
this.refresh_label_icon()
this.set_reqd=this.df.reqd;}
Field.prototype.refresh_display=function(){if(!this.set_status||this.set_status!=this.disp_status){if(this.disp_status=='Write'){if(this.make_input&&(!this.input)){this.make_input();if(this.onmake_input)this.onmake_input();}
Field.prototype.refresh_display=function(){if(!this.current_status||this.current_status!=this.disp_status){if(this.disp_status=='Write'){if(this.make_input&&(!this.input)){this.make_input();if(this.onmake_input)this.onmake_input();}
if(this.show)this.show()
else{$ds(this.wrapper);}
if(this.input){$ds(this.input_area);$dh(this.disp_area);if(this.input.refresh)this.input.refresh();}else{$dh(this.input_area);$ds(this.disp_area);}}else if(this.disp_status=='Read'){if(this.show)this.show()
else{$ds(this.wrapper);}
$dh(this.input_area);$ds(this.disp_area);}else{if(this.hide)this.hide();else $dh(this.wrapper);}
this.set_status=this.disp_status;}}
this.current_status=this.disp_status;}}
Field.prototype.refresh=function(){this.disp_status=this.get_status();if(this.in_grid&&this.table_refresh&&this.disp_status=='Write')
{this.table_refresh();return;}
this.set_label();this.refresh_display();if(this.onrefresh)
@ -852,7 +852,8 @@ Listing.prototype.std_cell=function(cell,ri,ci,d){var has_headrow=this.colnames?
/*
* lib/js/wn/ui/listing.js
*/
wn.widgets.Listing=function(opts){this.opts=opts;this.page_length=20;this.btns={};this.start=0;var me=this;this.make=function(opts){this.wrapper=$a(this.opts.parent,'div');this.filters_area=$a(this.wrapper,'div','listing-filters');this.toolbar_area=$a(this.wrapper,'div','listing-toolbar');this.results_area=$a(this.wrapper,'div','listing-results');this.more_button_area=$a(this.wrapper,'div','listing-more');this.no_results_area=$a(this.wrapper,'div','help_box',{display:'none'},(this.opts.no_result_message?this.opts.no_result_message:'No results'));if(opts)this.opts=opts;this.page_length=this.opts.page_length?this.opts.page_length:this.page_length;this.make_toolbar();this.make_filters();this.make_more_button();}
wn.widgets.Listing=function(opts){this.opts=opts;this.page_length=20;this.btns={};this.start=0;var me=this;this.make=function(opts){if(this.opts.parent.jquery)
this.opts.parent=this.opts.parent.get(0);this.wrapper=$a(this.opts.parent,'div');this.filters_area=$a(this.wrapper,'div','listing-filters');this.toolbar_area=$a(this.wrapper,'div','listing-toolbar');this.results_area=$a(this.wrapper,'div','listing-results');this.more_button_area=$a(this.wrapper,'div','listing-more');this.no_results_area=$a(this.wrapper,'div','help_box',{display:'none'},(this.opts.no_result_message?this.opts.no_result_message:'No results'));if(opts)this.opts=opts;this.page_length=this.opts.page_length?this.opts.page_length:this.page_length;this.make_toolbar();this.make_filters();this.make_more_button();}
this.make_filters=function(){if(this.opts.filters){$ds(this.filters_area);this.filters=new wn.widgets.FieldGroup(this.filters_area,this.opts.fields);}}
this.make_toolbar=function(){if(!(this.opts.hide_refresh||this.opts.no_refresh)){if(this.opts.title){$a(this.toolbar_area,'h3','',{display:'inline-block',marginRight:'15px'},this.opts.title);}
this.ref_img=$a(this.toolbar_area,'span','link_type',{color:'#888'},'[refresh]');this.ref_img.onclick=function(){me.run();}
@ -861,7 +862,7 @@ if(this.opts.new_doctype){this.new_btn=$btn(this.toolbar_area,'New '+get_doctype
this.make_more_button=function(){this.more_btn=$btn(this.more_button_area,'More...',function(){me.more_btn.set_working();me.run(function(){me.more_btn.done_working();},1);},'',0,1);$y(this.more_btn.loading_img,{marginBottom:'0px'});}
this.clear=function(){this.results_area.innerHTML='';this.table=null;$ds(this.results_area);$dh(this.no_results_area);}
this.make_results=function(r,rt){if(this.start==0)this.clear();$dh(this.more_button_area);if(this.loading_img)$dh(this.loading_img)
if(r.values&&r.values.length){this.values=r.values;var m=Math.min(r.values.length,this.page_length);for(var i=0;i<m;i++){var row=this.add_row();this.opts.render_row(row,r.values[i],this,i);}
if(r.message)r.values=r.message;if(r.values&&r.values.length){this.values=r.values;var m=Math.min(r.values.length,this.page_length);for(var i=0;i<m;i++){var row=this.add_row();this.opts.render_row(row,r.values[i],this,i);}
this.start+=m;if(r.values.length>this.page_length)$ds(this.more_button_area);}else{if(this.start==0){$dh(this.results_area);$ds(this.no_results_area);}}
if(this.onrun)this.onrun();if(this.opts.onrun)this.opts.onrun();}
this.add_row=function(){return $a(this.results_area,'div','',(opts.cell_style?opts.cell_style:{padding:'3px 0px'}));}
@ -1104,7 +1105,7 @@ var load_doc=loaddoc;function loaddoc(doctype,name,onload,menuitem,from_archive)
if(doctype=='DocType'&&frms[name]){msgprint("Cannot open DocType \""+name+"\" when its instance is open.");return;}
var show_form=function(f){if(!_f.frm_con){_f.frm_con=new _f.FrmContainer();}
if(!frms[doctype]){_f.add_frm(doctype,show_doc,name,from_archive);}else if(LocalDB.is_doc_loaded(doctype,name)){show_doc();}else{$c('webnotes.widgets.form.load.getdoc',{'name':name,'doctype':doctype,'user':user,'from_archive':(from_archive?1:0)},show_doc,null,null);}}
var show_doc=function(r,rt){if(locals[doctype]&&locals[doctype][name]){page_body.set_status('Done');var frm=frms[doctype];frm.refresh(name);if(!frm.in_dialog)
var show_doc=function(r,rt){if(locals[doctype]&&locals[doctype][name]){var frm=frms[doctype];frm.refresh(name);if(!frm.in_dialog)
nav_obj.open_notify('Form',doctype,name);if(onload)onload();}else{if(r.exc){msgprint('There were errors while loading '+doctype+' '+name);}
loadpage('_home');}}
show_form();}
@ -1118,11 +1119,11 @@ _f.add_frm(doctype,show_doc);else
show_doc(frms[doctype]);}
show_form();}
var newdoc=new_doc;var pscript={};var cur_page;function loadpage(page_name,call_back,no_history){if(!page_name)return;if(page_name=='_home')
page_name=home_page;var fn=function(r,rt){page_body.set_status('Done');if(page_body.pages[page_name]){var p=page_body.pages[page_name]
page_name=home_page;var fn=function(r,rt){if(wn.pages[page_name]){var p=wn.pages[page_name]
page_body.change_to(page_name);}else{var p=render_page(page_name);if(!p)return;}
cur_page=page_name;if(call_back)call_back();scroll(0,0);pscript.update_page_history(page_name,no_history)
try{if(pscript['refresh_'+page_name])pscript['refresh_'+page_name]();}catch(e){console.log(e);}}
if(get_local('Page',page_name)||page_body.pages[page_name])
if(get_local('Page',page_name)||wn.pages[page_name])
fn();else{args=get_url_dict();args.name=page_name;$c('webnotes.widgets.page.getpage',args,fn);}}
pscript.update_page_history=function(page_name,no_history){var arg=null;var t=null;if(window.location.hash){var t=nav_obj.get_page(window.location.hash)}else if(get_url_arg('page')){var t=nav_obj.get_page(get_url_arg('page'))}
if(t&&t[1]==page_name)arg=t[2];nav_obj.open_notify('Page',page_name,arg,no_history);}
@ -1141,14 +1142,13 @@ function upload_callback(id,fid){uploaders[id].callback(fid);}
/*
* lib/js/legacy/webpage/page.js
*/
var pages=[];var stylesheets=[];function Page(page_name,content){var me=this;this.name=page_name;this.trigger=function(event){try{if(pscript[event+'_'+this.name])
pscript[event+'_'+this.name](this.wrapper);}catch(e){console.log(e);}}
this.onshow=function(){set_title(me.doc.title?me.doc.title:me.name);if(!me.onload_complete){me.trigger('onload');me.onload_complete=true;}
var stylesheets=[];function Page(page_name,content){var me=this;this.name=page_name;this.trigger=function(event){try{if(pscript[event+'_'+this.name])
pscript[event+'_'+this.name](me.wrapper);if(me.wrapper[event]){me.wrapper[event](me.wrapper);}}catch(e){console.log(e);}}
this.page_show=function(){set_title(me.doc.title?me.doc.title:me.name);if(!me.onload_complete){me.trigger('onload');me.onload_complete=true;}
me.trigger('onshow');cur_frm=null;}
this.wrapper=page_body.add_page(page_name,this.onshow);this.cont=this.wrapper
this.wrapper=page_body.add_page(page_name,this.page_show);this.cont=this.wrapper
if(content)
this.wrapper.innerHTML=content;if(page_name==home_page)
pages['_home']=this;return this;}
this.wrapper.innerHTML=content;return this;}
function render_page(page_name,menuitem){if(!page_name)return;if((!locals['Page'])||(!locals['Page'][page_name])){loadpage('_home');return;}
var pdoc=locals['Page'][page_name];if(pdoc.style)set_style(pdoc.style)
if(pdoc.stylesheet){set_style(locals.Stylesheet[pdoc.stylesheet].stylesheet);stylesheets.push(pdoc.stylesheet);}
@ -1274,8 +1274,7 @@ return obj;}
function save_doclist(dt,dn,save_action,onsave,onerr){var doc=locals[dt][dn];var doctype=locals['DocType'][dt];var tmplist=[];var doclist=make_doclist(dt,dn,1);var all_clear=true;if(save_action!='Cancel'){for(var n in doclist){var tmp=check_required(doclist[n].doctype,doclist[n].name,doclist[0].doctype);if(doclist[n].docstatus+''!='2'&&all_clear)
all_clear=tmp;}}
var f=frms[dt];if(f&&!all_clear){if(f)f.savingflag=false;return'Error';}
var _save=function(){page_body.set_status('Saving...')
$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));}
if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}}
function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=fields_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].reqd&&is_null(v)&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.set_section(f.parent_section.sec_id);cur_frm.error_in_section=1;}}}
@ -1365,22 +1364,20 @@ return false;}
/*
* lib/js/legacy/webpage/body.js
*/
function Body(){this.left_sidebar=null;this.right_sidebar=null;this.status_area=null;var me=this;page_body=this;this.ready=function(){$dh('startup_div');$ds('body_div');}
wn.provide('wn.pages');function Body(){this.left_sidebar=null;this.right_sidebar=null;this.status_area=null;var me=this;page_body=this;this.ready=function(){$dh('startup_div');$ds('body_div');}
this.setup_page_areas=function(){this.center=this.body;this.center.header=$a(this.center,'div');this.center.body=$a(this.center,'div');this.center.loading=$a(this.center,'div','',{margin:'200px 0px',fontSize:'14px',color:'#999',textAlign:'center'});this.center.loading.innerHTML='Loading...'}
this.run_startup_code=function(){$(document).trigger('startup');try{if(this.cp.custom_startup_code)
eval(this.cp.custom_startup_code);}catch(e){errprint(e);}}
this.setup=function(){this.cp=wn.control_panel;this.wrapper=$a($i('body_div'),'div');this.body=$a(this.wrapper,'div');this.setup_page_areas();if(user=='Guest')user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){this.wntoolbar=new wn.ui.toolbar.Toolbar();}
if(this.cp.page_width)
$y(this.wrapper,{width:cint(this.cp.page_width)+'px'});}
this.pages={};this.cur_page=null;this.add_page=function(label,onshow,onhide){var c=$a(this.center.body,'div');if(onshow)
c.onshow=onshow;if(onhide)
c.onhide=onhide;this.pages[label]=c;$dh(c);return c;}
this.change_to=function(label){$dh(this.center.loading);if(me.cur_page&&me.pages[label]!=me.cur_page){if(me.cur_page.onhide)
me.cur_page.onhide();$dh(me.cur_page);}
me.cur_page=me.pages[label];me.cur_page_label=label;$(me.cur_page).fadeIn();if(me.cur_page.onshow)
me.cur_page.onshow(me.cur_page);}
this.set_status=function(txt){if(this.status_area)
this.status_area.innerHTML=txt;}
this.cur_page=null;this.add_page=function(label,onshow,onhide){var c=$a(this.center.body,'div');if(onshow)
c.page_show=onshow;if(onhide)
c.page_hide=onhide;wn.pages[label]=c;$dh(c);return c;}
this.change_to=function(label){$dh(this.center.loading);if(me.cur_page&&wn.pages[label]!=me.cur_page){if(me.cur_page.page_hide)
me.cur_page.page_hide();$dh(me.cur_page);}
me.cur_page=wn.pages[label];me.cur_page_label=label;$(me.cur_page).fadeIn();if(me.cur_page.page_show)
me.cur_page.page_show(me.cur_page);}
this.set_session_changed=function(){if(this.session_message_set)return;var div=$a($i('body_div').parentNode,'div','',{textAlign:'center',fontSize:'14px',margin:'150px auto'});$dh('body_div');div.innerHTML='This session has been changed. Please <span class="link_type" onclick="window.location.reload()">refresh</span> to continue';this.session_message_set=1;}
this.setup();}
/*
@ -1412,13 +1409,13 @@ Field.prototype.set_style_mandatory=function(add){if(add){$(this.txt?this.txt:th
Field.prototype.refresh_mandatory=function(){if(this.in_filter)return;if(this.df.reqd){if(this.label_area)this.label_area.style.color="#d22";this.set_style_mandatory(1);}else{if(this.label_area)this.label_area.style.color="#222";this.set_style_mandatory(0);}
this.refresh_label_icon()
this.set_reqd=this.df.reqd;}
Field.prototype.refresh_display=function(){if(!this.set_status||this.set_status!=this.disp_status){if(this.disp_status=='Write'){if(this.make_input&&(!this.input)){this.make_input();if(this.onmake_input)this.onmake_input();}
Field.prototype.refresh_display=function(){if(!this.current_status||this.current_status!=this.disp_status){if(this.disp_status=='Write'){if(this.make_input&&(!this.input)){this.make_input();if(this.onmake_input)this.onmake_input();}
if(this.show)this.show()
else{$ds(this.wrapper);}
if(this.input){$ds(this.input_area);$dh(this.disp_area);if(this.input.refresh)this.input.refresh();}else{$dh(this.input_area);$ds(this.disp_area);}}else if(this.disp_status=='Read'){if(this.show)this.show()
else{$ds(this.wrapper);}
$dh(this.input_area);$ds(this.disp_area);}else{if(this.hide)this.hide();else $dh(this.wrapper);}
this.set_status=this.disp_status;}}
this.current_status=this.disp_status;}}
Field.prototype.refresh=function(){this.disp_status=this.get_status();if(this.in_grid&&this.table_refresh&&this.disp_status=='Write')
{this.table_refresh();return;}
this.set_label();this.refresh_display();if(this.onrefresh)
@ -1603,8 +1600,7 @@ _f.cur_grid.refresh_row(_f.cur_grid_ridx,me.dn);if(page_body.cur_page_label='For
this.dialog=d;}
_f.add_frm=function(doctype,onload,opt_name,from_archive){if(frms['DocType']&&frms['DocType'].opendocs[doctype]){msgprint("error:Cannot create an instance of \""+doctype+"\" when the DocType is open.");return;}
if(frms[doctype]){return frms[doctype];}
var callback=function(r,rt){page_body.set_status('Done')
if(!locals['DocType'][doctype]){if(r.exc){msgprint("Did not load "+doctype,1);}
var callback=function(r,rt){if(!locals['DocType'][doctype]){if(r.exc){msgprint("Did not load "+doctype,1);}
loadpage('_home');return;}
if(r.print_access){if(!_f.temp_access[doctype])
_f.temp_access[doctype]={};_f.temp_access[doctype][opt_name]=1;}
@ -1772,9 +1768,7 @@ newdoc.file_list=null;var dl=make_doclist(this.doctype,dn);var tf_dict={};for(va
if(d1.parent==dn&&cint(tf_dict[d1.parentfield].no_copy)!=1){var ch=LocalDB.copy(d1.doctype,d1.name,from_amend);ch.parent=newdoc.name;ch.docstatus=0;ch.owner=user;ch.creation='';ch.modified_by=user;ch.modified='';}}
newdoc.__islocal=1;newdoc.docstatus=0;newdoc.owner=user;newdoc.creation='';newdoc.modified_by=user;newdoc.modified='';if(onload)onload(newdoc);loaddoc(newdoc.doctype,newdoc.name);}
_f.Frm.prototype.reload_doc=function(){var me=this;if(frms['DocType']&&frms['DocType'].opendocs[me.doctype]){msgprint("error:Cannot refresh an instance of \""+me.doctype+"\" when the DocType is open.");return;}
var ret_fn=function(r,rtxt){page_body.set_status('Done')
me.runclientscript('setup',me.doctype,me.docname);me.refresh();}
page_body.set_status('Reloading...')
var ret_fn=function(r,rtxt){me.runclientscript('setup',me.doctype,me.docname);me.refresh();}
if(me.doc.__islocal){$c('webnotes.widgets.form.load.getdoctype',{'doctype':me.doctype},ret_fn,null,null,'Refreshing '+me.doctype+'...');}else{var gl=me.grids;for(var i=0;i<gl.length;i++){var dt=gl[i].df.options;for(var dn in locals[dt]){if(locals[dt][dn].__islocal&&locals[dt][dn].parent==me.docname){var d=locals[dt][dn];d.parent='';d.docstatus=2;d.__deleted=1;}}}
$c('webnotes.widgets.form.load.getdoc',{'name':me.docname,'doctype':me.doctype,'getdoctype':1,'user':user},ret_fn,null,null,'Refreshing '+me.docname+'...');}}
_f.Frm.prototype.savedoc=function(save_action,onsave,onerr){this.error_in_section=0;save_doclist(this.doctype,this.docname,save_action,onsave,onerr);}
@ -2158,7 +2152,7 @@ me.dialog.clear();me.dialog.show();}});
/*
* lib/js/legacy/app.js
*/
var popup_cont;var session={};var start_sid=null;if(!wn)var wn={};function startup(){start_sid=get_cookie('sid');popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=profile.first_name+(r.profile.last_name?(' '+r.profile.last_name):'');user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={}
var popup_cont;var session={};var start_sid=null;if(!wn)var wn={};function startup(){start_sid=get_cookie('sid');popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=wn.boot.user_fullnames?wn.boot.user_fullnames[user]:'Guest';user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={}
if(r.dt_labels){for(key in r.dt_labels)session.rev_dt_labels[r.dt_labels[key]]=key;}
wn.control_panel=r.control_panel;}
var setup_history=function(r){rename_observers.push(nav_obj);}
@ -2197,7 +2191,7 @@ wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',f
/*
* erpnext/startup/startup.js
*/
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)
var current_module;var is_system_manager=0;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(wn.boot.custom_css){set_style(wn.boot.custom_css);}
if(user=='Guest'){if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();$('footer').html('<div class="web-footer erpnext-footer">\
@ -2227,8 +2221,8 @@ erpnext.module_page.make_list=function(module,wrapper){wrapper.list=new wn.widge
/*
* erpnext/startup/toolbar.js
*/
wn.provide('erpnext.toolbar');erpnext.toolbar.setup=function(){erpnext.toolbar.add_modules();$('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>');$('#toolbar-user').append('<li><a href="#My Company">Team / Messages</a></li>');$('.navbar .pull-right').append('\
<li><a href="#!My%20Company" title="Unread Messages"><span class="navbar-new-comments"></span></a></li>');$('.navbar .pull-right').prepend('<li class="dropdown">\
wn.provide('erpnext.toolbar');erpnext.toolbar.setup=function(){erpnext.toolbar.add_modules();$('#toolbar-user').append('<li><a href="#!profile-settings">Profile Settings</a></li>');$('.navbar .pull-right').append('\
<li><a href="#!messages" title="Unread Messages"><span class="navbar-new-comments"></span></a></li>');$('.navbar .pull-right').prepend('<li class="dropdown">\
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
onclick="return false;">Help<b class="caret"></b></a>\
<ul class="dropdown-menu" id="toolbar-help">\

View File

@ -439,13 +439,13 @@ Field.prototype.set_style_mandatory=function(add){if(add){$(this.txt?this.txt:th
Field.prototype.refresh_mandatory=function(){if(this.in_filter)return;if(this.df.reqd){if(this.label_area)this.label_area.style.color="#d22";this.set_style_mandatory(1);}else{if(this.label_area)this.label_area.style.color="#222";this.set_style_mandatory(0);}
this.refresh_label_icon()
this.set_reqd=this.df.reqd;}
Field.prototype.refresh_display=function(){if(!this.set_status||this.set_status!=this.disp_status){if(this.disp_status=='Write'){if(this.make_input&&(!this.input)){this.make_input();if(this.onmake_input)this.onmake_input();}
Field.prototype.refresh_display=function(){if(!this.current_status||this.current_status!=this.disp_status){if(this.disp_status=='Write'){if(this.make_input&&(!this.input)){this.make_input();if(this.onmake_input)this.onmake_input();}
if(this.show)this.show()
else{$ds(this.wrapper);}
if(this.input){$ds(this.input_area);$dh(this.disp_area);if(this.input.refresh)this.input.refresh();}else{$dh(this.input_area);$ds(this.disp_area);}}else if(this.disp_status=='Read'){if(this.show)this.show()
else{$ds(this.wrapper);}
$dh(this.input_area);$ds(this.disp_area);}else{if(this.hide)this.hide();else $dh(this.wrapper);}
this.set_status=this.disp_status;}}
this.current_status=this.disp_status;}}
Field.prototype.refresh=function(){this.disp_status=this.get_status();if(this.in_grid&&this.table_refresh&&this.disp_status=='Write')
{this.table_refresh();return;}
this.set_label();this.refresh_display();if(this.onrefresh)
@ -667,7 +667,8 @@ this.widgets[d[1]]=b;}}
/*
* lib/js/wn/ui/listing.js
*/
wn.widgets.Listing=function(opts){this.opts=opts;this.page_length=20;this.btns={};this.start=0;var me=this;this.make=function(opts){this.wrapper=$a(this.opts.parent,'div');this.filters_area=$a(this.wrapper,'div','listing-filters');this.toolbar_area=$a(this.wrapper,'div','listing-toolbar');this.results_area=$a(this.wrapper,'div','listing-results');this.more_button_area=$a(this.wrapper,'div','listing-more');this.no_results_area=$a(this.wrapper,'div','help_box',{display:'none'},(this.opts.no_result_message?this.opts.no_result_message:'No results'));if(opts)this.opts=opts;this.page_length=this.opts.page_length?this.opts.page_length:this.page_length;this.make_toolbar();this.make_filters();this.make_more_button();}
wn.widgets.Listing=function(opts){this.opts=opts;this.page_length=20;this.btns={};this.start=0;var me=this;this.make=function(opts){if(this.opts.parent.jquery)
this.opts.parent=this.opts.parent.get(0);this.wrapper=$a(this.opts.parent,'div');this.filters_area=$a(this.wrapper,'div','listing-filters');this.toolbar_area=$a(this.wrapper,'div','listing-toolbar');this.results_area=$a(this.wrapper,'div','listing-results');this.more_button_area=$a(this.wrapper,'div','listing-more');this.no_results_area=$a(this.wrapper,'div','help_box',{display:'none'},(this.opts.no_result_message?this.opts.no_result_message:'No results'));if(opts)this.opts=opts;this.page_length=this.opts.page_length?this.opts.page_length:this.page_length;this.make_toolbar();this.make_filters();this.make_more_button();}
this.make_filters=function(){if(this.opts.filters){$ds(this.filters_area);this.filters=new wn.widgets.FieldGroup(this.filters_area,this.opts.fields);}}
this.make_toolbar=function(){if(!(this.opts.hide_refresh||this.opts.no_refresh)){if(this.opts.title){$a(this.toolbar_area,'h3','',{display:'inline-block',marginRight:'15px'},this.opts.title);}
this.ref_img=$a(this.toolbar_area,'span','link_type',{color:'#888'},'[refresh]');this.ref_img.onclick=function(){me.run();}
@ -676,7 +677,7 @@ if(this.opts.new_doctype){this.new_btn=$btn(this.toolbar_area,'New '+get_doctype
this.make_more_button=function(){this.more_btn=$btn(this.more_button_area,'More...',function(){me.more_btn.set_working();me.run(function(){me.more_btn.done_working();},1);},'',0,1);$y(this.more_btn.loading_img,{marginBottom:'0px'});}
this.clear=function(){this.results_area.innerHTML='';this.table=null;$ds(this.results_area);$dh(this.no_results_area);}
this.make_results=function(r,rt){if(this.start==0)this.clear();$dh(this.more_button_area);if(this.loading_img)$dh(this.loading_img)
if(r.values&&r.values.length){this.values=r.values;var m=Math.min(r.values.length,this.page_length);for(var i=0;i<m;i++){var row=this.add_row();this.opts.render_row(row,r.values[i],this,i);}
if(r.message)r.values=r.message;if(r.values&&r.values.length){this.values=r.values;var m=Math.min(r.values.length,this.page_length);for(var i=0;i<m;i++){var row=this.add_row();this.opts.render_row(row,r.values[i],this,i);}
this.start+=m;if(r.values.length>this.page_length)$ds(this.more_button_area);}else{if(this.start==0){$dh(this.results_area);$ds(this.no_results_area);}}
if(this.onrun)this.onrun();if(this.opts.onrun)this.opts.onrun();}
this.add_row=function(){return $a(this.results_area,'div','',(opts.cell_style?opts.cell_style:{padding:'3px 0px'}));}
@ -827,7 +828,7 @@ var load_doc=loaddoc;function loaddoc(doctype,name,onload,menuitem,from_archive)
if(doctype=='DocType'&&frms[name]){msgprint("Cannot open DocType \""+name+"\" when its instance is open.");return;}
var show_form=function(f){if(!_f.frm_con){_f.frm_con=new _f.FrmContainer();}
if(!frms[doctype]){_f.add_frm(doctype,show_doc,name,from_archive);}else if(LocalDB.is_doc_loaded(doctype,name)){show_doc();}else{$c('webnotes.widgets.form.load.getdoc',{'name':name,'doctype':doctype,'user':user,'from_archive':(from_archive?1:0)},show_doc,null,null);}}
var show_doc=function(r,rt){if(locals[doctype]&&locals[doctype][name]){page_body.set_status('Done');var frm=frms[doctype];frm.refresh(name);if(!frm.in_dialog)
var show_doc=function(r,rt){if(locals[doctype]&&locals[doctype][name]){var frm=frms[doctype];frm.refresh(name);if(!frm.in_dialog)
nav_obj.open_notify('Form',doctype,name);if(onload)onload();}else{if(r.exc){msgprint('There were errors while loading '+doctype+' '+name);}
loadpage('_home');}}
show_form();}
@ -841,11 +842,11 @@ _f.add_frm(doctype,show_doc);else
show_doc(frms[doctype]);}
show_form();}
var newdoc=new_doc;var pscript={};var cur_page;function loadpage(page_name,call_back,no_history){if(!page_name)return;if(page_name=='_home')
page_name=home_page;var fn=function(r,rt){page_body.set_status('Done');if(page_body.pages[page_name]){var p=page_body.pages[page_name]
page_name=home_page;var fn=function(r,rt){if(wn.pages[page_name]){var p=wn.pages[page_name]
page_body.change_to(page_name);}else{var p=render_page(page_name);if(!p)return;}
cur_page=page_name;if(call_back)call_back();scroll(0,0);pscript.update_page_history(page_name,no_history)
try{if(pscript['refresh_'+page_name])pscript['refresh_'+page_name]();}catch(e){console.log(e);}}
if(get_local('Page',page_name)||page_body.pages[page_name])
if(get_local('Page',page_name)||wn.pages[page_name])
fn();else{args=get_url_dict();args.name=page_name;$c('webnotes.widgets.page.getpage',args,fn);}}
pscript.update_page_history=function(page_name,no_history){var arg=null;var t=null;if(window.location.hash){var t=nav_obj.get_page(window.location.hash)}else if(get_url_arg('page')){var t=nav_obj.get_page(get_url_arg('page'))}
if(t&&t[1]==page_name)arg=t[2];nav_obj.open_notify('Page',page_name,arg,no_history);}
@ -864,14 +865,13 @@ function upload_callback(id,fid){uploaders[id].callback(fid);}
/*
* lib/js/legacy/webpage/page.js
*/
var pages=[];var stylesheets=[];function Page(page_name,content){var me=this;this.name=page_name;this.trigger=function(event){try{if(pscript[event+'_'+this.name])
pscript[event+'_'+this.name](this.wrapper);}catch(e){console.log(e);}}
this.onshow=function(){set_title(me.doc.title?me.doc.title:me.name);if(!me.onload_complete){me.trigger('onload');me.onload_complete=true;}
var stylesheets=[];function Page(page_name,content){var me=this;this.name=page_name;this.trigger=function(event){try{if(pscript[event+'_'+this.name])
pscript[event+'_'+this.name](me.wrapper);if(me.wrapper[event]){me.wrapper[event](me.wrapper);}}catch(e){console.log(e);}}
this.page_show=function(){set_title(me.doc.title?me.doc.title:me.name);if(!me.onload_complete){me.trigger('onload');me.onload_complete=true;}
me.trigger('onshow');cur_frm=null;}
this.wrapper=page_body.add_page(page_name,this.onshow);this.cont=this.wrapper
this.wrapper=page_body.add_page(page_name,this.page_show);this.cont=this.wrapper
if(content)
this.wrapper.innerHTML=content;if(page_name==home_page)
pages['_home']=this;return this;}
this.wrapper.innerHTML=content;return this;}
function render_page(page_name,menuitem){if(!page_name)return;if((!locals['Page'])||(!locals['Page'][page_name])){loadpage('_home');return;}
var pdoc=locals['Page'][page_name];if(pdoc.style)set_style(pdoc.style)
if(pdoc.stylesheet){set_style(locals.Stylesheet[pdoc.stylesheet].stylesheet);stylesheets.push(pdoc.stylesheet);}
@ -971,8 +971,7 @@ return obj;}
function save_doclist(dt,dn,save_action,onsave,onerr){var doc=locals[dt][dn];var doctype=locals['DocType'][dt];var tmplist=[];var doclist=make_doclist(dt,dn,1);var all_clear=true;if(save_action!='Cancel'){for(var n in doclist){var tmp=check_required(doclist[n].doctype,doclist[n].name,doclist[0].doctype);if(doclist[n].docstatus+''!='2'&&all_clear)
all_clear=tmp;}}
var f=frms[dt];if(f&&!all_clear){if(f)f.savingflag=false;return'Error';}
var _save=function(){page_body.set_status('Saving...')
$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));}
if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}}
function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=fields_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].reqd&&is_null(v)&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.set_section(f.parent_section.sec_id);cur_frm.error_in_section=1;}}}
@ -982,28 +981,26 @@ if(errfld.length)msgprint('<b>Mandatory fields required in '+
/*
* lib/js/legacy/webpage/body.js
*/
function Body(){this.left_sidebar=null;this.right_sidebar=null;this.status_area=null;var me=this;page_body=this;this.ready=function(){$dh('startup_div');$ds('body_div');}
wn.provide('wn.pages');function Body(){this.left_sidebar=null;this.right_sidebar=null;this.status_area=null;var me=this;page_body=this;this.ready=function(){$dh('startup_div');$ds('body_div');}
this.setup_page_areas=function(){this.center=this.body;this.center.header=$a(this.center,'div');this.center.body=$a(this.center,'div');this.center.loading=$a(this.center,'div','',{margin:'200px 0px',fontSize:'14px',color:'#999',textAlign:'center'});this.center.loading.innerHTML='Loading...'}
this.run_startup_code=function(){$(document).trigger('startup');try{if(this.cp.custom_startup_code)
eval(this.cp.custom_startup_code);}catch(e){errprint(e);}}
this.setup=function(){this.cp=wn.control_panel;this.wrapper=$a($i('body_div'),'div');this.body=$a(this.wrapper,'div');this.setup_page_areas();if(user=='Guest')user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){this.wntoolbar=new wn.ui.toolbar.Toolbar();}
if(this.cp.page_width)
$y(this.wrapper,{width:cint(this.cp.page_width)+'px'});}
this.pages={};this.cur_page=null;this.add_page=function(label,onshow,onhide){var c=$a(this.center.body,'div');if(onshow)
c.onshow=onshow;if(onhide)
c.onhide=onhide;this.pages[label]=c;$dh(c);return c;}
this.change_to=function(label){$dh(this.center.loading);if(me.cur_page&&me.pages[label]!=me.cur_page){if(me.cur_page.onhide)
me.cur_page.onhide();$dh(me.cur_page);}
me.cur_page=me.pages[label];me.cur_page_label=label;$(me.cur_page).fadeIn();if(me.cur_page.onshow)
me.cur_page.onshow(me.cur_page);}
this.set_status=function(txt){if(this.status_area)
this.status_area.innerHTML=txt;}
this.cur_page=null;this.add_page=function(label,onshow,onhide){var c=$a(this.center.body,'div');if(onshow)
c.page_show=onshow;if(onhide)
c.page_hide=onhide;wn.pages[label]=c;$dh(c);return c;}
this.change_to=function(label){$dh(this.center.loading);if(me.cur_page&&wn.pages[label]!=me.cur_page){if(me.cur_page.page_hide)
me.cur_page.page_hide();$dh(me.cur_page);}
me.cur_page=wn.pages[label];me.cur_page_label=label;$(me.cur_page).fadeIn();if(me.cur_page.page_show)
me.cur_page.page_show(me.cur_page);}
this.set_session_changed=function(){if(this.session_message_set)return;var div=$a($i('body_div').parentNode,'div','',{textAlign:'center',fontSize:'14px',margin:'150px auto'});$dh('body_div');div.innerHTML='This session has been changed. Please <span class="link_type" onclick="window.location.reload()">refresh</span> to continue';this.session_message_set=1;}
this.setup();}
/*
* lib/js/legacy/app.js
*/
var popup_cont;var session={};var start_sid=null;if(!wn)var wn={};function startup(){start_sid=get_cookie('sid');popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=profile.first_name+(r.profile.last_name?(' '+r.profile.last_name):'');user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={}
var popup_cont;var session={};var start_sid=null;if(!wn)var wn={};function startup(){start_sid=get_cookie('sid');popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=wn.boot.user_fullnames?wn.boot.user_fullnames[user]:'Guest';user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={}
if(r.dt_labels){for(key in r.dt_labels)session.rev_dt_labels[r.dt_labels[key]]=key;}
wn.control_panel=r.control_panel;}
var setup_history=function(r){rename_observers.push(nav_obj);}
@ -1042,7 +1039,7 @@ wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',f
/*
* erpnext/startup/startup.js
*/
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)
var current_module;var is_system_manager=0;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(wn.boot.custom_css){set_style(wn.boot.custom_css);}
if(user=='Guest'){if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();$('footer').html('<div class="web-footer erpnext-footer">\

View File

@ -1 +1 @@
740
741