123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- MWF.xDesktop.requireApp("process.Xform", "Subform", null, false);
- MWF.xApplication.cms.Xform.Subform = MWF.CMSSubform = new Class({
- Extends: MWF.APPSubform,
- getSubform: function(callback){
- if (this.json.subformType==="script"){
- if (this.json.subformScript && this.json.subformScript.code){
- var data = this.form.Macro.exec(this.json.subformScript.code, this);
- if (data){
- var formName, app;
- if( typeOf( data ) === "string" ){
- formName = data;
- }else{
- if( data.application )app = data.application;
- if( data.subform )formName = data.subform;
- }
- if( formName ){
- if( !app )app = this.form.businessData.document.appId || this.form.businessData.document.application;
- MWF.Actions.get("x_cms_assemble_control").getFormWithColumn(formName, app, function(json){
- this.getSubformData(json.data);
- if (callback) callback();
- }.bind(this));
- }else{
- if (callback) callback();
- }
- }else{
- if (callback) callback();
- }
- }
- }else{
- if (this.json.subformSelected && this.json.subformSelected!=="none"){
- var subformData = (this.form.app.relatedFormMap) ? this.form.app.relatedFormMap[this.json.subformSelected] : null;
- if (subformData) {
- this.getSubformData({"data": subformData.data});
- if (callback) callback();
- } 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();
- }
- }
- //if (this.json.subformType==="script"){
- // if (this.json.subformScript.code){
- // var formNome = this.form.Macro.exec(this.json.subformScript.code, this);
- // if (formNome){
- // MWF.Actions.get("x_cms_assemble_control").getForm(formNome, function(json){
- // this.getSubformData(json.data);
- // if (callback) callback();
- // }.bind(this));
- // }
- // }
- //}else{
- // if (this.json.subformSelected && this.json.subformSelected!=="none"){
- // MWF.Actions.get("x_cms_assemble_control").getForm(this.json.subformSelected, function(json){
- // this.getSubformData(json.data);
- // if (callback) callback();
- // }.bind(this));
- // }else{
- // if (callback) callback();
- // }
- //}
- },
- getSubformData: function (data) {
- if (!data || typeOf(data) !== "object") return;
- var subformDataStr = null;
- if ( this.form.json.mode !== "Mobile" && !layout.mobile){
- subformDataStr = data.data;
- }else{
- subformDataStr = data.mobileData;
- }
- this.subformData = null;
- if (subformDataStr) {
- if( this.form.isParseLanguage ) {
- var jsonStr = o2.bindJson(MWF.decodeJsonString(subformDataStr), {"lp": MWF.xApplication.process.Xform.LP.form});
- this.subformData = JSON.decode(jsonStr);
- }else{
- this.subformData = JSON.decode(MWF.decodeJsonString(subformDataStr));
- }
- this.subformData.updateTime = data.updateTime;
- }
- }
- });
|