提交 4fb0d60c 编写于 作者: U unknown

内容管理表单预加载样式

上级 a26784fd
......@@ -171,13 +171,24 @@ MWF.xApplication.cms.Document.Main = new Class({
},
loadForm : function( formId, flag ){
var success = function(json){
if( layout.mobile ){
this.form = (json.data.mobileData) ? JSON.decode(MWF.decodeJsonString(json.data.mobileData)): null;
if( !this.form ){
if (json.form){
this.form = (json.form.data) ? JSON.decode(MWF.decodeJsonString(json.form.data)): null;
this.relatedFormMap = json.relatedFormMap;
this.relatedScriptMap = json.relatedScriptMap;
if( json.form.data )delete json.form.data;
this.formInfor = json.form;
}else{
if( layout.mobile ){
this.form = (json.data.mobileData) ? JSON.decode(MWF.decodeJsonString(json.data.mobileData)): null;
if( !this.form ){
this.form = (json.data.data) ? JSON.decode(MWF.decodeJsonString(json.data.data)): null;
}
}else{
this.form = (json.data.data) ? JSON.decode(MWF.decodeJsonString(json.data.data)): null;
}
}else{
this.form = (json.data.data) ? JSON.decode(MWF.decodeJsonString(json.data.data)): null;
if( json.data.data )delete json.data.data;
if( json.data.mobileData )delete json.data.mobileData;
this.formInfor = json.form;
}
//this.listAttachment();
this.openDocument();
......
......@@ -214,6 +214,8 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
this.node = this.container.getFirst();
this._loadEvents();
this.loadRelatedScript();
if (this.fireEvent("queryLoad")) {
MWF.xDesktop.requireApp("cms.Xform", "lp." + MWF.language, null, false);
......@@ -225,6 +227,20 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
this.loadContent(callback)
}
},
loadRelatedScript: function () {
if (this.json.includeScripts && this.json.includeScripts.length) {
var includeScriptText = "";
var includedIds = [];
this.json.includeScripts.each(function (s) {
if (this.app.relatedScriptMap && this.app.relatedScriptMap[s.id]) {
includeScriptText += "\n" + this.app.relatedScriptMap[s.id].text;
includedIds.push(s.id);
}
}.bind(this));
if (includeScriptText) this.Macro.exec(includeScriptText, this);
}
},
loadContent: function (callback) {
this.subformCount = 0;
this.subformLoadedCount = 0;
......
......@@ -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();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册