Merge branch 'dev' of github.com:webnotes/wnframework into dev
This commit is contained in:
commit
1b5a63dd0f
6 changed files with 49 additions and 18 deletions
|
|
@ -39,8 +39,11 @@ div.notice {
|
|||
|
||||
.help_box, .help-box {
|
||||
background-color: #ffe;
|
||||
color: #874;
|
||||
padding: 9px 9px 9px 9px;
|
||||
border: 1px dashed #fc7;
|
||||
margin: 11px 0px;
|
||||
}
|
||||
|
||||
.help-box, .help-box p, .help-box h1, .help-box h2, .help-box h3, .help-box h4 {
|
||||
color: #643;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,8 +133,19 @@ function check_required(dt, dn, parent_dt) {
|
|||
for(var i=0;i<fl.length;i++) {
|
||||
var key = fl[i].fieldname;
|
||||
var v = doc[key];
|
||||
|
||||
if(fl[i].fieldtype=='Table') {
|
||||
var no_value = true;
|
||||
$.each(locals[fl[i].options], function(k,d) {
|
||||
if(d.parent==doc.name && d.parenttype==doc.doctype && d.parentfield==fl[i].fieldname) {
|
||||
no_value = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var no_value = is_null(v);
|
||||
}
|
||||
|
||||
if(fl[i].reqd && is_null(v) && fl[i].fieldname) {
|
||||
if(fl[i].reqd && no_value && fl[i].fieldname) {
|
||||
errfld[errfld.length] = fl[i].label;
|
||||
|
||||
// Bring to front "Section"
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ function msgprint(msg, title) {
|
|||
.appendTo(msg_dialog.body);
|
||||
}
|
||||
|
||||
if(msg.search(/<br>|<p>/)==-1)
|
||||
if(msg.search(/<br>|<p>|<li>/)==-1)
|
||||
msg = replace_newlines(msg);
|
||||
|
||||
msg_dialog.set_title(title || 'Message')
|
||||
|
|
|
|||
|
|
@ -324,9 +324,23 @@ _f.Frm.prototype.set_intro = function(txt) {
|
|||
this.intro_area.remove();
|
||||
this.intro_area = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_f.Frm.prototype.set_footnote = function(txt) {
|
||||
if(!this.footnote_area) {
|
||||
this.footnote_area = $('<div class="help-box form-intro-area">')
|
||||
.insertAfter(this.page_layout.body.lastChild);
|
||||
}
|
||||
if(txt) {
|
||||
if(txt.search(/<p>/)==-1) txt = '<p>' + txt + '</p>';
|
||||
this.footnote_area.html(txt);
|
||||
} else {
|
||||
this.footnote_area.remove();
|
||||
this.footnote_area = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_f.Frm.prototype.setup_fields_std = function() {
|
||||
var fl = wn.meta.docfield_list[this.doctype];
|
||||
|
||||
|
|
@ -834,19 +848,8 @@ _f.Frm.prototype.save = function(save_action, call_back) {
|
|||
|
||||
|
||||
var ret_fn = function(r) {
|
||||
me.savingflag = false;
|
||||
if(user=='Guest' && !r.exc) {
|
||||
// if user is guest, show a message after succesful saving
|
||||
$dh(me.page_layout.wrapper);
|
||||
$ds(me.saved_wrapper);
|
||||
me.saved_wrapper.innerHTML =
|
||||
'<div style="padding: 150px 16px; text-align: center; font-size: 14px;">'
|
||||
+ (cur_frm.message_after_save ? cur_frm.message_after_save : 'Your information has been sent. Thank you!')
|
||||
+ '</div>';
|
||||
return; // no refresh
|
||||
}
|
||||
|
||||
if(!me.meta.istable) {
|
||||
me.savingflag = false;
|
||||
if(!me.meta.istable && r) {
|
||||
me.refresh(r.docname);
|
||||
}
|
||||
|
||||
|
|
@ -1163,4 +1166,9 @@ _f.Frm.prototype.enable_fields = function(fields, enable) {
|
|||
|
||||
_f.Frm.prototype.call_server = function(method, args, callback) {
|
||||
$c_obj(cur_frm.get_doclist(), method, args, callback);
|
||||
}
|
||||
|
||||
_f.Frm.prototype.set_value = function(field, value) {
|
||||
cur_frm.get_doc()[field] = value;
|
||||
cur_frm.fields_dict[field].refresh();
|
||||
}
|
||||
|
|
@ -81,6 +81,12 @@ _f.FrmHeader = Class.extend({
|
|||
},
|
||||
refresh_toolbar: function() {
|
||||
// clear
|
||||
|
||||
if(cur_frm.meta.hide_toolbar) {
|
||||
$('.appframe-toolbar').toggle(false);
|
||||
return;
|
||||
}
|
||||
|
||||
this.appframe.clear_buttons();
|
||||
var p = cur_frm.get_doc_perms();
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,10 @@ wn.widgets.form.sidebar = { Sidebar: function(form) {
|
|||
icon: 'icon-remove-sign',
|
||||
onclick: function() { me.form.savetrash() }
|
||||
}
|
||||
]
|
||||
],
|
||||
display: function() {
|
||||
return me.form.meta.hide_toolbar ? false : true;
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue