| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
- //MWF.xDesktop.requireApp("process.Xform", "widget.View", null, false);
- MWF.xApplication.process.Xform.View = MWF.APPView = new Class({
- Extends: MWF.APP$Module,
- options: {
- "moduleEvents": ["load", "loadView", "queryLoad", "postLoad", "select", "openDocument"]
- },
- _loadUserInterface: function(){
- MWF.xDesktop.requireApp("query.Query", "Viewer", null, false);
- this.node.empty();
- },
- _afterLoaded: function(){
- if (this.json.queryView){
- this.loadView();
- }else{
- if (this.json.selectViewType==="cms"){
- this.loadCMSView();
- }else if (this.json.selectViewType==="process"){
- this.loadPrcessView();
- }else{
- this.loadView();
- }
- }
- },
- reload: function(){
- if (this.view){
- if (this.view.loadViewRes) if (this.view.loadViewRes.isRunning()) this.view.loadViewRes.cancel();
- if (this.view.getViewRes) if (this.view.getViewRes.isRunning()) this.view.getViewRes.cancel();
- }
- this.node.empty();
- this.loadView();
- },
- active: function(){
- if (this.view){
- if (!this.view.loadingAreaNode) this.view.loadView();
- }else{
- this.loadView();
- }
- },
- loadView: function(){
- if (!this.json.queryView || !this.json.queryView.name || !this.json.queryView.appName) return "";
- var filter = null;
- if (this.json.filterList && this.json.filterList.length){
- filter = [];
- this.json.filterList.each(function(entry){
- entry.value = this.form.Macro.exec(entry.code.code, this);
- //delete entry.code;
- filter.push(entry);
- }.bind(this));
- }
- //var data = JSON.parse(this.json.data);
- var viewJson = {
- "application": (this.json.queryView) ? this.json.queryView.appName : this.json.application,
- "viewName": (this.json.queryView) ? this.json.queryView.name : this.json.viewName,
- "isTitle": this.json.isTitle || "yes",
- "select": this.json.select || "none",
- "titleStyles": this.json.titleStyles,
- "itemStyles": this.json.itemStyles,
- "isExpand": this.json.isExpand || "no",
- "showActionbar" : this.json.actionbar === "show",
- "filter": filter,
- "defaultSelectedScript" : this.json.defaultSelectedScript ? this.json.defaultSelectedScript.code : null,
- "selectedAbleScript" : this.json.selectedAbleScript ? this.json.selectedAbleScript.code : null
- };
- //MWF.xDesktop.requireApp("query.Query", "Viewer", function(){
- this.view = new MWF.xApplication.query.Query.Viewer(this.node, viewJson, {
- "isload": (this.json.loadView!=="no"),
- "resizeNode": (this.node.getStyle("height").toString().toLowerCase()!=="auto" && this.node.getStyle("height").toInt()>0),
- "onLoadView": function(){
- this.fireEvent("loadView");
- }.bind(this),
- "onSelect": function(){
- this.fireEvent("select");
- }.bind(this),
- "onOpenDocument": function(options, item){
- this.openOptions = {
- "options": options,
- "item": item
- };
- this.fireEvent("openDocument");
- this.openOptions = null;
- }.bind(this)
- }, this.form.app, this.form.Macro);
- //}.bind(this));
- },
- loadPrcessView: function(){
- var filter = null;
- if (this.json.filterList && this.json.filterList.length){
- filter = [];
- this.json.filterList.each(function(entry){
- entry.value = this.form.Macro.exec(entry.code.code, this);
- //delete entry.code;
- filter.push(entry);
- }.bind(this));
- }
- var viewJson = {
- "application": this.json.processView.application,
- "viewName": this.json.processView.name,
- "isTitle": this.json.isTitle || "yes",
- "select": this.json.select || "none",
- "titleStyles": this.json.titleStyles,
- "itemStyles": this.json.itemStyles,
- "isExpand": this.json.isExpand || "no",
- "showActionbar" : this.json.actionbar === "show",
- "filter": filter
- };
- MWF.xDesktop.requireApp("process.Application", "Viewer", function(){
- this.view = new MWF.xApplication.process.Application.Viewer(this.node, viewJson, {
- "resizeNode": (this.node.getStyle("height").toString().toLowerCase()!=="auto" && this.node.getStyle("height").toInt()>0),
- "onSelect": function(){
- this.fireEvent("select");
- }.bind(this)
- });
- }.bind(this));
- },
- loadCMSView: function(){
- var filter = null;
- if (this.json.filterList && this.json.filterList.length){
- filter = [];
- this.json.filterList.each(function(entry){
- entry.value = this.form.Macro.exec(entry.code.code, this);
- //delete entry.code;
- filter.push(entry);
- }.bind(this));
- }
- var viewJson = {
- "application": this.json.cmsView.appId,
- "viewName": this.json.cmsView.name,
- "isTitle": this.json.isTitle || "yes",
- "select": this.json.select || "none",
- "titleStyles": this.json.titleStyles,
- "itemStyles": this.json.itemStyles,
- "isExpand": this.json.isExpand || "no",
- "showActionbar" : this.json.actionbar === "show",
- "filter": filter
- };
- MWF.xDesktop.requireApp("process.Application", "Viewer", function(){
- this.view = new MWF.xApplication.process.Application.Viewer(this.node, viewJson, {
- "actions": {
- "lookup": {"uri": "/jaxrs/queryview/flag/{view}/application/flag/{application}/execute", "method":"PUT"},
- "getView": {"uri": "/jaxrs/queryview/flag/{view}/application/flag/{application}"}
- },
- "actionRoot": "x_cms_assemble_control",
- "resizeNode": (this.node.getStyle("height").toString().toLowerCase()!=="auto" && this.node.getStyle("height").toInt()>0),
- "onSelect": function(){
- this.fireEvent("select");
- }.bind(this)
- });
- }.bind(this));
- },
- getData: function(){
- if (this.view.selectedItems.length){
- var arr = [];
- this.view.selectedItems.each(function(item){
- arr.push(item.data);
- });
- return arr;
- }else{
- return [];
- }
- }
- });
|