mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 20:05:09 +00:00
Merge branch 'navupdate' of github.com:webnotes/erpnext into navupdate
Conflicts: version.num
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
var current_module;
|
||||
var is_system_manager = 0;
|
||||
var module_content_dict = {};
|
||||
var user_full_nm = {};
|
||||
|
||||
wn.provide('erpnext.startup');
|
||||
|
||||
|
||||
@@ -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">\
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="layout-main-section">
|
||||
<a class="close" onclick="window.history.back();">×</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>
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -126,7 +126,7 @@ erpnext.todo.save = function(btn) {
|
||||
});
|
||||
}
|
||||
|
||||
pscript.onload_todo = function() {
|
||||
wn.pages.todo.onload = function() {
|
||||
// load todos
|
||||
erpnext.todo.refresh();
|
||||
}
|
||||
@@ -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:
|
||||
|
||||
@@ -530,13 +530,13 @@ Field.prototype.set_style_mandatory=function(add){if(add){$(this.txt?this.txt:th
|
||||
ret='None';if(cint(this.df.hidden))
|
||||
ret='None';if(ret=='Write'&&cint(cur_frm.doc.docstatus)>0)ret='Read';var a_o_s=cint(this.df.allow_on_submit);if(a_o_s&&(this.in_grid||(this.frm&&this.frm.not_in_container))){a_o_s=null;if(this.in_grid)a_o_s=this.grid.field.df.allow_on_submit;if(this.frm&&this.frm.not_in_container){a_o_s=cur_grid.field.df.allow_on_submit;}}
|
||||
if(cur_frm.editable&&a_o_s&&cint(cur_frm.doc.docstatus)>0&&!this.df.hidden){tmp_perm=get_perm(cur_frm.doctype,cur_frm.docname,1);if(tmp_perm[this.df.permlevel]&&tmp_perm[this.df.permlevel][WRITE])ret='Write';}
|
||||
return ret;}
|
||||
return ret;}
|
||||
Field.prototype.set_style_mandatory=function(add){if(add){$(this.txt?this.txt:this.input).addClass('input-mandatory');if(this.disp_area)$(this.disp_area).addClass('input-mandatory');}else{$(this.txt?this.txt:this.input).removeClass('input-mandatory');if(this.disp_area)$(this.disp_area).removeClass('input-mandatory');}}
|
||||
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.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()
|
||||
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);}
|
||||
@@ -852,7 +852,8 @@ Listing.prototype.std_cell=function(cell,ri,ci,d){var has_headrow=this.colnames?
|
||||
Listing.prototype.refresh_more_button=function(nr,n_values){var me=this;if(this.more_btn){$dh(this.more_btn);}
|
||||
if((this.start+nr)==this.max_len||(!this.max_len&&nr<this.page_len)){}else if(nr){if(!this.more_btn){$y(this.bottom_div,{margin:'8px 0px 16px 0px',textAlign:'center'});this.more_btn=$btn(this.bottom_div,'Show more results...',function(){me.start=me.start+me.page_len;me.more_btn.set_working();me.run(function(){me.more_btn.done_working();});},{fontSize:'14px'},0,1);$y(this.more_btn.loading_img,{marginBottom:'0px'});}
|
||||
$di(this.more_btn);}}
|
||||
Listing.prototype.make_headings=function(t,nr,nc){for(var ci=0;ci<nc;ci++){var tmp=make_table($td(t,0,ci),1,2,'100%',['','0px'],this.opts.head_style);$y(tmp,{tableLayout:'fixed',borderCollapse:'collapse'});$y($td(t,0,ci),this.opts.head_main_style);$td(t,0,ci).sort_cell=$td(tmp,0,1);$td(t,0,ci).label_cell=$td(tmp,0,0);$td(tmp,0,1).style.padding='0px';$td(tmp,0,0).innerHTML=this.colnames[ci]?this.colnames[ci]:' ';if(this.sort_list[ci])this.set_sort($td(t,0,ci),ci,this.sort_list[ci]);var div=$a($td(t,0,ci),'div');$td(t,0,ci).style.borderBottom='1px solid #CCC';if(this.coltypes&&this.coltypes[ci]&&in_list(['Currency','Float','Int'],this.coltypes[ci]))$y($td(t,0,ci).label_cell,{textAlign:'right'})}}
|
||||
Listing.prototype.make_headings=function(t,nr,nc){for(var ci=0;ci<nc;ci++){var tmp=make_table($td(t,0,ci),1,2,'100%',['','0px'],this.opts.head_style);$y(tmp,{tableLayout:'fixed',borderCollapse:'collapse'});$y($td(t,0,ci),this.opts.head_main_style);$td(t,0,ci).sort_cell=$td(tmp,0,1);$td(t,0,ci).label_cell=$td(tmp,0,0);$td(tmp,0,1).style.padding='0px';$td(tmp,0,0).innerHTML=this.colnames[ci]?this.colnames[ci]:' ';if(this.sort_list[ci])this.set_sort($td(t,0,ci),ci,this.sort_list[ci]);var div=$a($td(t,0,ci),'div');$td(t,0,ci).style.borderBottom='1px solid #CCC';if(this.coltypes&&this.coltypes[ci]&&in_list(['Currency','Float','Int'],this.coltypes[ci]))$y($td(t,0,ci).label_cell,{textAlign:'right'})}}
|
||||
Listing.prototype.std_cell=function(cell,ri,ci,d){var has_headrow=this.colnames?1:0;cell.div=$a(cell,'div');$s(cell.div,d[ri][ci],this.coltypes?this.coltypes[ci+(this.no_index?0:1)]:null,this.coloptions?this.coloptions[ci+(this.no_index?0:1)]:null);}
|
||||
/*
|
||||
* lib/js/wn/ui/listing.js
|
||||
*/
|
||||
@@ -861,7 +862,7 @@ if(this.opts.new_doctype){this.new_btn=$btn(this.toolbar_area,'New '+get_doctype
|
||||
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();}
|
||||
this.loading_img=$a(this.toolbar_area,'img','lib/images/ui/button-load.gif',{display:'none',marginLeft:'3px',marginBottom:'-2px'});}
|
||||
this.loading_img=$a(this.toolbar_area,'img','lib/images/ui/button-load.gif',{display:'none',marginLeft:'3px',marginBottom:'-2px'});}
|
||||
if(this.opts.new_doctype){this.new_btn=$btn(this.toolbar_area,'New '+get_doctype_label(this.opts.new_doctype),function(){newdoc(me.opts.new_doctype,me.opts.new_doc_onload,me.opts.new_doc_indialog,me.opts.new_doc_onsave);},{marginLeft:'7px'});}}
|
||||
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);}
|
||||
@@ -1104,7 +1105,7 @@ var load_doc=loaddoc;function loaddoc(doctype,name,onload,menuitem,from_archive)
|
||||
onload(rb);if((rb.dt)&&(!rb.dt.has_data()||rb.current_loaded!=t))
|
||||
rb.dt.run();}else{if(reset_report){rb.reset_report();}}
|
||||
if(!rb.forbidden){page_body.change_to('Report Builder');nav_obj.open_notify('Report',dt,rep_name);}});}
|
||||
show_report_builder();}
|
||||
show_report_builder();}
|
||||
var load_doc=loaddoc;function loaddoc(doctype,name,onload,menuitem,from_archive){doctype=get_label_doctype(doctype);if(frms['DocType']&&frms['DocType'].opendocs[doctype]){msgprint("Cannot open an instance of \""+doctype+"\" when the DocType is open.");return;}
|
||||
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();}
|
||||
@@ -1118,11 +1119,11 @@ _f.add_frm(doctype,show_doc);else
|
||||
var dn=LocalDB.create(doctype);if(onload)onload(dn);if(frm.in_dialog){var fd=_f.frm_dialog;fd.cdt=cdt;fd.cdn=cdn;fd.cnic=cnic;fd.on_save_callback=on_save_callback;}else{nav_obj.open_notify('Form',doctype,dn);}
|
||||
frm.refresh(dn);}else{msgprint('error:Not Allowed To Create '+doctype+'\nContact your Admin for help');}}
|
||||
var show_form=function(){if(!_f.frm_con){_f.frm_con=new _f.FrmContainer();}
|
||||
if(!frms[doctype])
|
||||
if(!frms[doctype])
|
||||
_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')
|
||||
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){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)
|
||||
@@ -1141,14 +1142,13 @@ function upload_callback(id,fid){uploaders[id].callback(fid);}
|
||||
var uploaders={};var upload_frame_count=0;Uploader=function(parent,args,callback){var id='frame'+upload_frame_count;upload_frame_count++;this.callback=callback;var div=$a(parent,'div');div.innerHTML='<iframe id="'+id+'" name="'+id+'" src="blank.html" \
|
||||
style="width:0px; height:0px; border:0px"></iframe>';var div=$a(parent,'div');div.innerHTML='<form method="POST" enctype="multipart/form-data" action="'+outUrl+'" target="'+id+'"></form>';var ul_form=div.childNodes[0];var f_list=[];var inp_fdata=$a_input($a(ul_form,'span'),'file',{name:'filedata'},{marginLeft:'7px'});if(!('cmd'in args)){var inp=$a_input($a(ul_form,'span'),'hidden',{name:'cmd'});inp.value='uploadfile';}
|
||||
var inp=$a_input($a(ul_form,'span'),'hidden',{name:'uploader_id'});inp.value=id;var inp=$a_input($a(ul_form,'span'),'submit',null,{marginLeft:'7px'});inp.value='Upload';$y(inp,{width:'80px'});for(var key in args){var inp=$a_input($a(ul_form,'span'),'hidden',{name:key});inp.value=args[key];}
|
||||
uploaders[id]=this;}
|
||||
function upload_callback(id,fid){uploaders[id].callback(fid);}
|
||||
/*
|
||||
uploaders[id]=this;}
|
||||
function upload_callback(id,fid){uploaders[id].callback(fid);}
|
||||
/*
|
||||
* lib/js/legacy/webpage/page.js
|
||||
*/
|
||||
*/
|
||||
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;}
|
||||
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.page_show);this.cont=this.wrapper
|
||||
@@ -1274,8 +1274,7 @@ return obj;}
|
||||
return JSON.stringify({'_vl':vl,'_kl':kl});}
|
||||
function expand_doclist(docs){var l=[];for(var i=0;i<docs._vl.length;i++)
|
||||
l[l.length]=zip(docs._kl[docs._vl[i][0]],docs._vl[i]);return l;}
|
||||
function zip(k,v){var obj={};for(var i=0;i<k.length;i++){obj[k[i]]=v[i];}
|
||||
return obj;}
|
||||
function zip(k,v){var obj={};for(var i=0;i<k.length;i++){obj[k[i]]=v[i];}
|
||||
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;}}
|
||||
@@ -1365,22 +1364,20 @@ return false;}
|
||||
onclick="return wn.ui.toolbar.download_backup();">\
|
||||
Download Backup</a></li>');}},set_user_name:function(){var fn=user_fullname;if(fn.length>15)fn=fn.substr(0,12)+'...';$('#toolbar-user-link').html(fn+'<b class="caret"></b>');},make_logout:function(){$('#toolbar-user').append('<li><a href="#" onclick="return logout();">Logout</a></li>');}});wn.ui.toolbar.clear_cache=function(){localStorage&&localStorage.clear();$c('webnotes.session_cache.clear',{},function(r,rt){show_alert(r.message);});return false;}
|
||||
wn.ui.toolbar.download_backup=function(){$c('webnotes.utils.backups.get_backup',{},function(r,rt){});return false;}
|
||||
wn.ui.toolbar.show_about=function(){try{wn.require('lib/js/wn/misc/about.js');wn.ui.misc.about();}catch(e){console.log(e);}
|
||||
wn.ui.toolbar.show_about=function(){try{wn.require('lib/js/wn/misc/about.js');wn.ui.misc.about();}catch(e){console.log(e);}
|
||||
return false;}
|
||||
/*
|
||||
* lib/js/legacy/webpage/body.js
|
||||
*/
|
||||
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)
|
||||
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.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);}
|
||||
@@ -1412,13 +1409,13 @@ Field.prototype.set_style_mandatory=function(add){if(add){$(this.txt?this.txt:th
|
||||
ret='None';if(cint(this.df.hidden))
|
||||
ret='None';if(ret=='Write'&&cint(cur_frm.doc.docstatus)>0)ret='Read';var a_o_s=cint(this.df.allow_on_submit);if(a_o_s&&(this.in_grid||(this.frm&&this.frm.not_in_container))){a_o_s=null;if(this.in_grid)a_o_s=this.grid.field.df.allow_on_submit;if(this.frm&&this.frm.not_in_container){a_o_s=cur_grid.field.df.allow_on_submit;}}
|
||||
if(cur_frm.editable&&a_o_s&&cint(cur_frm.doc.docstatus)>0&&!this.df.hidden){tmp_perm=get_perm(cur_frm.doctype,cur_frm.docname,1);if(tmp_perm[this.df.permlevel]&&tmp_perm[this.df.permlevel][WRITE])ret='Write';}
|
||||
return ret;}
|
||||
return ret;}
|
||||
Field.prototype.set_style_mandatory=function(add){if(add){$(this.txt?this.txt:this.input).addClass('input-mandatory');if(this.disp_area)$(this.disp_area).addClass('input-mandatory');}else{$(this.txt?this.txt:this.input).removeClass('input-mandatory');if(this.disp_area)$(this.disp_area).removeClass('input-mandatory');}}
|
||||
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.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()
|
||||
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);}
|
||||
@@ -1603,8 +1600,7 @@ _f.cur_grid.refresh_row(_f.cur_grid_ridx,me.dn);if(page_body.cur_page_label='For
|
||||
me.on_save_callback(dn);}
|
||||
cur_frm.save('Save',callback);}}
|
||||
d.onshow=function(){d.done_btn_area.innerHTML='';d.done_btn=$btn(d.done_btn_area,'Save',null,null,'green');d.done_btn.onclick=function(){me.on_complete()};if(me.table_form){d.set_title("Editing Row #"+(_f.cur_grid_ridx+1));d.done_btn.innerHTML='Done Editing';}else{d.set_title(cur_frm.doctype==cur_frm.doctype?(cur_frm.doctype):(cur_frm.doctype+': '+cur_frm.docname));d.done_btn.innerHTML='Save';}}
|
||||
d.onhide=function(){if(_f.cur_grid)
|
||||
_f.cur_grid.refresh_row(_f.cur_grid_ridx,me.dn);if(page_body.cur_page_label='Forms'){cur_frm=_f.frm_con.cur_frm;}}
|
||||
d.onhide=function(){if(_f.cur_grid)
|
||||
_f.cur_grid.refresh_row(_f.cur_grid_ridx,me.dn);if(page_body.cur_page_label='Forms'){cur_frm=_f.frm_con.cur_frm;}}
|
||||
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;}
|
||||
@@ -1772,9 +1768,7 @@ newdoc.file_list=null;var dl=make_doclist(this.doctype,dn);var tf_dict={};for(va
|
||||
if(doctype.client_string){this.cstring={};var elist=doctype.client_string.split('---');for(var i=1;i<elist.length;i=i+2){this.cstring[strip(elist[i])]=elist[i+1];}}}
|
||||
return ret;}
|
||||
_f.Frm.prototype.copy_doc=function(onload,from_amend){if(!this.perm[0][CREATE]){msgprint('You are not allowed to create '+this.meta.name);return;}
|
||||
var dn=this.docname;var newdoc=LocalDB.copy(this.doctype,dn,from_amend);if(this.meta.allow_attach&&newdoc.file_list)
|
||||
newdoc.file_list=null;var dl=make_doclist(this.doctype,dn);var tf_dict={};for(var d in dl){d1=dl[d];if(!tf_dict[d1.parentfield]){tf_dict[d1.parentfield]=get_field(d1.parenttype,d1.parentfield);}
|
||||
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='';}}
|
||||
var dn=this.docname;var newdoc=LocalDB.copy(this.doctype,dn,from_amend);if(this.meta.allow_attach&&newdoc.file_list)
|
||||
newdoc.file_list=null;var dl=make_doclist(this.doctype,dn);var tf_dict={};for(var d in dl){d1=dl[d];if(!tf_dict[d1.parentfield]){tf_dict[d1.parentfield]=get_field(d1.parenttype,d1.parentfield);}
|
||||
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);}
|
||||
@@ -2158,7 +2152,7 @@ me.dialog.clear();me.dialog.show();}});
|
||||
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">×</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:'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);});}}}
|
||||
$(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
|
||||
@@ -2197,7 +2191,7 @@ wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',f
|
||||
/*
|
||||
* js/app.js
|
||||
*/
|
||||
wn.app={name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'© Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number}
|
||||
wn.app={name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'© Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number}
|
||||
wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',function(){startup();});$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next <i class="icon-home icon-white navbar-icon-home" ></i>');})
|
||||
/*
|
||||
* erpnext/startup/startup.js
|
||||
@@ -2227,8 +2221,8 @@ erpnext.module_page.make_list=function(module,wrapper){wrapper.list=new wn.widge
|
||||
wn.provide('erpnext.module_page');erpnext.module_page.setup_page=function(module,wrapper){erpnext.module_page.hide_links(wrapper);erpnext.module_page.make_list(module,wrapper);$(wrapper).find("a[title]").tooltip({delay:{show:500,hide:100}});}
|
||||
erpnext.module_page.hide_links=function(wrapper){$(wrapper).find('[href*="List/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.can_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[data-doctype]').each(function(){var dt=$(this).attr('data-doctype');if(wn.boot.profile.can_read.indexOf(dt)==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[href*="Form/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.can_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});}
|
||||
erpnext.module_page.make_list=function(module,wrapper){wrapper.list=new wn.widgets.Listing({parent:$(wrapper).find('.reports-list').get(0),method:'utilities.get_report_list',render_row:function(row,data){if(!data.parent_doc_type)data.parent_doc_type=data.doc_type;$(row).html(repl('<a href="#!Report/%(doc_type)s/%(criteria_name)s" \
|
||||
data-doctype="%(parent_doc_type)s">\
|
||||
%(criteria_name)s</a>',data))},args:{module:module},no_refresh:true});wrapper.list.run();}
|
||||
data-doctype="%(parent_doc_type)s">\
|
||||
%(criteria_name)s</a>',data))},args:{module:module},no_refresh:true});wrapper.list.run();}
|
||||
/*
|
||||
* erpnext/startup/toolbar.js
|
||||
*/
|
||||
|
||||
@@ -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">\
|
||||
|
||||
@@ -1 +1 @@
|
||||
740
|
||||
741
|
||||
|
||||
Reference in New Issue
Block a user