|
|
@@ -4,7 +4,7 @@ MWF.xApplication.cms.Xform.Subform = MWF.CMSSubform = new Class({
|
|
|
|
|
|
getSubform: function(callback){
|
|
|
if (this.json.subformType==="script"){
|
|
|
- if (this.json.subformScript.code){
|
|
|
+ if (this.json.subformScript && this.json.subformScript.code){
|
|
|
var data = this.form.Macro.exec(this.json.subformScript.code, this);
|
|
|
if (data){
|
|
|
var formName, app;
|
|
|
@@ -29,16 +29,22 @@ MWF.xApplication.cms.Xform.Subform = MWF.CMSSubform = new Class({
|
|
|
}
|
|
|
}else{
|
|
|
if (this.json.subformSelected && this.json.subformSelected!=="none"){
|
|
|
- var app;
|
|
|
- if( this.json.subformAppSelected ){
|
|
|
- app = this.json.subformAppSelected;
|
|
|
- }else{
|
|
|
- app = this.form.businessData.document.appId || this.form.businessData.document.application;
|
|
|
- }
|
|
|
- MWF.Actions.get("x_cms_assemble_control").getFormWithColumn(this.json.subformSelected, app, function(json){
|
|
|
- this.getSubformData(json.data);
|
|
|
+ var subformData = (this.form.app.relatedFormMap) ? this.form.app.relatedFormMap[this.json.subformSelected] : null;
|
|
|
+ if (subformData) {
|
|
|
+ this.getSubformData({"data": subformData.data});
|
|
|
if (callback) callback();
|
|
|
- }.bind(this));
|
|
|
+ } else {
|
|
|
+ var app;
|
|
|
+ if( this.json.subformAppSelected ){
|
|
|
+ app = this.json.subformAppSelected;
|
|
|
+ }else{
|
|
|
+ app = this.form.businessData.document.appId || this.form.businessData.document.application;
|
|
|
+ }
|
|
|
+ MWF.Actions.get("x_cms_assemble_control").getFormWithColumn(this.json.subformSelected, app, function(json){
|
|
|
+ this.getSubformData(json.data);
|
|
|
+ if (callback) callback();
|
|
|
+ }.bind(this));
|
|
|
+ }
|
|
|
}else{
|
|
|
if (callback) callback();
|
|
|
}
|