提交 7dd0c670 编写于 作者: U unknown

增加视图的上下文

上级 22d25dda
......@@ -165,5 +165,49 @@ MWF.Macro.PageContext = new Class({
}
});
MWF.Macro.ViewContext = new Class({
macroFunction: null,
environment: {},
initialize: function(view){
this.form = view;
var environment = {
"view": view,
"viewInfor": view.viewInfor,
"target": null,
"event": null
};
MWF.require("MWF.xScript.ViewEnvironment", null, false);
this.environment = new MWF.xScript.ViewEnvironment(environment);
},
setTarget: function(target){
if (target){
this.environment.target = target;
}else{
this.environment.target = null;
}
},
setEvent: function(event){
if (event){
this.environment.event = event;
}else{
this.environment.event = null;
}
},
exec: function(code, target){
this.setTarget(target);
var returnValue = MWF.Macro.exec(code, this.environment);
//this.form.businessData.data = Object.merge(this.form.businessData.data, this.environment.data);
return returnValue;
//this.environment.data
},
fire: function(code, target, event){
this.setTarget(target);
this.setEvent(event);
return MWF.Macro.exec(code, this.environment);
}
});
JSONObject = function(o){
};
此差异已折叠。
......@@ -74,12 +74,14 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
}
},
load: function(){
this._loadModuleEvents();
if (this.fireEvent("queryLoad")){
this._loadUserInterface();
//this._loadStyles();
this._loadDomEvents();
}
this.loadMacro( function () {
this._loadModuleEvents();
if (this.fireEvent("queryLoad")){
this._loadUserInterface();
//this._loadStyles();
this._loadDomEvents();
}
})
},
_loadUserInterface : function(){
this.loadLayout();
......@@ -102,6 +104,16 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
this.viewPageNode = new Element("div", {"styles": this.css.viewPageNode}).inject(this.node);
this.viewPageAreaNode = new Element("div", {"styles": this.css.viewPageAreaNode}).inject(this.viewPageNode);
},
loadMacro: function (callback) {
if( !this.Macro ){ //有可能是page\cms\process传入的macro
MWF.require("MWF.xScript.Macro", function () {
this.Macro = new MWF.Macro.ViewContext(this);
if (callback) callback();
}.bind(this));
}else{
if (callback) callback();
}
},
createExportNode: function(){
if (this.options.export){
MWF.require("MWF.widget.Toolbar", function(){
......@@ -958,7 +970,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
if (e.code){
if (this.options.moduleEvents.indexOf(key)!==-1){
this.addEvent(key, function(event){
return this.form.Macro.fire(e.code, this, event);
return this.Macro.fire(e.code, this, event);
}.bind(this));
}
}
......@@ -969,7 +981,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
if (e.code){
if (this.options.moduleEvents.indexOf(key)===-1){
this.node.addEvent(key, function(event){
return this.form.Macro.fire(e.code, this, event);
return this.Macro.fire(e.code, this, event);
}.bind(this));
}
}
......@@ -1436,8 +1448,6 @@ MWF.xApplication.query.Query.Viewer.Filter = new Class({
}
});
MWF.xApplication.query.Query.Viewer.Actionbar = new Class({
Implements: [Events],
options: {
......
{
"name": "",
"id": "",
"application": "",
"alias": "",
"description": "",
"display": true,
"data": {
"exportGrid": true,
"exportGoupGrid": true,
"scopeType": "work",
"selectEntryList": [],
"restrictWhereEntry": {
"applicationList": [],
"processList": [],
"companyList": [],
"departmentList": [],
"personList": [],
"identityList": []
},
"restrictFilterEntryList": [],
"restrictDateRangeEntry": {
"dateRangeType": "none",
"dateEffectType": "start",
"year": "",
"month": "",
"date": "",
"season": 0,
"week": 0,
"adjust": 0
},
"orderEntryList": [],
"groupEntry": {},
"calculate": {}
},
"availableIdentityList": [],
"availableDepartmentList": [],
"availableCompanyList": []
}
\ No newline at end of file
......@@ -171,7 +171,7 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
json.data.groupGrid.each(function(line, idx){
var groupTr = new Element("tr", {"styles": this.css.viewContentTrNode}).inject(this.viewContentTableNode);
var colSpan = this.items.length + 1 ;
var colSpan = this.items.length ;
var td = new Element("td", {"styles": this.css.viewContentGroupTdNode, "colSpan": colSpan}).inject(groupTr);
var groupAreaNode = new Element("div", {"styles": this.css.viewContentTdGroupNode}).inject(td);
var groupIconNode = new Element("div", {"styles": this.css.viewContentTdGroupIconNode}).inject(groupAreaNode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册