MWF.xApplication = MWF.xApplication || {}; MWF.xApplication.query = MWF.xApplication.query || {}; MWF.xApplication.query.TableDesigner = MWF.xApplication.query.TableDesigner || {}; MWF.APPDTBD = MWF.xApplication.query.TableDesigner; MWF.xDesktop.requireApp("query.TableDesigner", "lp."+MWF.language, null, false); MWF.xDesktop.requireApp("query.ViewDesigner", "View", null, false); MWF.xDesktop.requireApp("query.ViewDesigner", "Property", null, false); MWF.xApplication.query.TableDesigner.Table = new Class({ Extends: MWF.xApplication.query.ViewDesigner.View, Implements: [Options, Events], options: { "style": "default", "isView": false, "showTab": true, "propertyPath": "/x_component_query_TableDesigner/$Table/table.html" }, initialize: function(designer, data, options){ this.setOptions(options); this.path = "/x_component_query_TableDesigner/$Table/"; this.cssPath = "/x_component_query_TableDesigner/$Table/"+this.options.style+"/css.wcss"; this._loadCss(); this.designer = designer; this.data = data; if (!this.data.data) this.data.data = {}; this.parseData(); this.node = this.designer.designNode; this.areaNode = new Element("div", {"styles": {"height": "100%", "overflow": "auto"}}); this.propertyListNode = this.designer.propertyDomArea; if(this.designer.application) this.data.applicationName = this.designer.application.name; if(this.designer.application) this.data.application = this.designer.application.id; this.isNewTable = (this.data.id) ? false : true; this.items = []; this.view = this; this.queryView = null; this.autoSave(); this.designer.addEvent("queryClose", function(){ if (this.autoSaveTimerID) window.clearInterval(this.autoSaveTimerID); }.bind(this)); }, load : function(){ this.setAreaNodeSize(); this.designer.addEvent("resize", this.setAreaNodeSize.bind(this)); this.areaNode.inject(this.node); this.designer.viewListAreaNode.getChildren().each(function(node){ var table = node.retrieve("table"); if (table.id==this.data.id){ if (this.designer.currentListViewItem){ this.designer.currentListViewItem.setStyles(this.designer.css.listViewItem); } node.setStyles(this.designer.css.listViewItem_current); this.designer.currentListViewItem = node; this.lisNode = node; } }.bind(this)); this.domListNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.designer.propertyDomArea); this.createColmunEditTable(); this.loadView(); this.selected(); this.setEvent(); this.setViewWidth(); this.designer.addEvent("resize", this.setViewWidth.bind(this)); }, createColmunEditTable: function(){ this.colmunListTable = new Element("table", {"styles": this.css.colmunListTable}).inject(this.domListNode); var tr = this.colmunListTable.insertRow(-1); var td = tr.insertCell(); }, changeViewSelected: function(){ if (this.json.view){ if (!this.queryView){ this.designer.actions.getView(this.json.view, function(view){ this.queryView = JSON.decode(view.data.data); this.items.each(function(item){ item.changeViewSelected(this.queryView); }.bind(this)); this.checkIsGroupRadioDisplay(); }.bind(this)); }else{ this.items.each(function(item){ item.changeViewSelected(this.queryView); }.bind(this)); this.checkIsGroupRadioDisplay(); } }else{ //item.changeViewSelected(); } }, checkIsGroupRadioDisplay: function(){ if (this.property){ var groupNode = this.property.propertyContent.getElement(".MWFIsGroupArea"); if (groupNode){ if (this.queryView.group.column){ groupNode.setStyle("display", "block"); }else{ this.json.data.calculate.isGroup = false; var radios = groupNode.getElements("input"); for (var i=0; i