forms: bug fixes in dependencies

This commit is contained in:
Rushabh Mehta 2012-08-07 16:37:19 +05:30
parent 2d814aeae9
commit 47071fb1ee
2 changed files with 11 additions and 23 deletions

View file

@ -356,7 +356,7 @@ _f.Frm.prototype.setup_fields_std = function() {
if(f.fieldtype=='Section Break') {
sec = fld;
this.sections.push(fld);
this.sections.push(fld);
}
// default col-break after sec-break
@ -692,17 +692,12 @@ _f.Frm.prototype.refresh_dependency = function() {
var doc = locals[this.doctype][this.docname];
// build dependants' dictionary
var dep_dict = {};
var has_dep = false;
for(fkey in me.fields) {
var f = me.fields[fkey];
f.dependencies_clear = true;
var guardian = f.df.depends_on;
if(guardian) {
if(!dep_dict[guardian])
dep_dict[guardian] = [];
dep_dict[guardian][dep_dict[guardian].length] = f;
if(f.df.depends_on) {
has_dep = true;
}
}
@ -714,7 +709,6 @@ _f.Frm.prototype.refresh_dependency = function() {
var f = me.fields[i];
f.guardian_has_value = true;
if(f.df.depends_on) {
// evaluate guardian
var v = doc[f.df.depends_on];
if(f.df.depends_on.substr(0,5)=='eval:') {
@ -731,9 +725,11 @@ _f.Frm.prototype.refresh_dependency = function() {
// show / hide
if(f.guardian_has_value) {
if(f.grid)f.grid.show(); else $ds(f.wrapper);
f.df.hidden = false;
f.refresh()
} else {
if(f.grid)f.grid.hide(); else $dh(f.wrapper);
f.df.hidden = true;
f.refresh()
}
}
}

View file

@ -29,8 +29,7 @@ _f.ColumnBreak = function() {
}
_f.ColumnBreak.prototype.make_body = function() {
if((!this.perm[this.df.permlevel]) || (!this.perm[this.df.permlevel][READ]) ||
this.df.hidden) {
if((!this.perm[this.df.permlevel]) || (!this.perm[this.df.permlevel][READ])) {
// no display
return;
}
@ -72,7 +71,7 @@ _f.SectionBreak = function() {
_f.SectionBreak.prototype.make_body = function() {
var me = this;
if((!this.perm[this.df.permlevel]) || (!this.perm[this.df.permlevel][READ]) || this.df.hidden) {
if((!this.perm[this.df.permlevel]) || (!this.perm[this.df.permlevel][READ])) {
// no display
return;
}
@ -149,14 +148,7 @@ _f.SectionBreak.prototype.refresh = function(from_form) {
if(this.df.hidden) {
if(this.row)this.row.hide();
} else {
if(this.collapsible) {
//this.section_expand(from_form);
//if(this.df.reqd || this.has_data()) {
// this.section_expand(from_form);
//} else {
// this.section_collapse();
//}
}
if(this.row)this.row.show();
}
}
@ -319,7 +311,7 @@ _f.CodeField.prototype.make_input = function() {
// General options
theme : "advanced",
plugins : "style,inlinepopups,table",
plugins : "style,inlinepopups,table,advimage",
extended_valid_elements: "div[id|dir|class|align|style]",
// w/h
@ -327,7 +319,7 @@ _f.CodeField.prototype.make_input = function() {
height: '360px',
// buttons
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,hr,|,justifyleft,justifycenter,justifyright,|,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,hr,|,justifyleft,justifycenter,justifyright,|,formatselect,fontselect,fontsizeselect,|,image",
theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,code,|,forecolor,backcolor,|,tablecontrols",
theme_advanced_buttons3 : "",