MWF.xApplication.query.Query.options.multitask = true; MWF.xApplication.query.Query.Main = new Class({ Extends: MWF.xApplication.Common.Main, Implements: [Options, Events], options: { "style": "default", "name": "query.Query", "icon": "icon.png", "width": "1200", "height": "700", "title": MWF.xApplication.query.Query.LP.title, "isControl": false, "taskObject": null, "parameters": "", "readonly": false }, onQueryLoad: function(){ this.lp = MWF.xApplication.query.Query.LP; if (this.status){ this.options.id = this.status.id; this.options.viewId = this.status.viewId; this.options.statId = this.status.statId; this.options.statementId = this.status.statementId; this.options.importerId = this.status.importerId; } }, loadApplication: function(callback){ this.content.setStyle("background-color", "#F0F0F0"); this.node = new Element("div", {"styles": this.css.content}).inject(this.content); this.formNode = new Element("div", {"styles": {"min-height": "100%", "font-size": "14px"}}).inject(this.node); this.action = MWF.Actions.get("x_query_assemble_surface"); // if (!this.options.isRefresh){ // this.maxSize(function(){ // this.loadQuery(this.options.parameters); // }.bind(this)); // }else{ this.loadQuery(this.options.parameters); // } if (callback) callback(); }, loadQuery: function(par){ this.action.getQuery(this.options.id, function(json){ this.query = json.data; this.setTitle(this.query.name); if (this.query.icon){ if (this.taskitem){ this.taskitem.iconNode.setStyles({ "background-image": "url(data:image/png;base64,"+this.query.icon+")", "background-size": "24px 24px" }); } } var lp = this.lp; var iData = this.query.data ? JSON.parse(this.query.data) : ""; this.interfaceData = Object.merge({ viewShow: "true", viewNumber: 1, viewName: lp.view, viewIcon: "../x_component_query_Query/$Main/"+this.options.style+"/icon/view_new.png", statShow: "true", statNumber: 2, statName: lp.stat, statIcon: "../x_component_query_Query/$Main/"+this.options.style+"/icon/stat_new.png", statementShow: "true", statementNumber: 3, statementName: lp.statement, statementIcon: "../x_component_query_Query/$Main/"+this.options.style+"/icon/statement_new.png", importerShow: "true", importerNumber: 4, importerName: lp.importer, importerIcon: "../x_component_query_Query/$Main/"+this.options.style+"/icon/importer_new.png", }, iData || {} ); this.createLayout(); this.createNavi(); this.addEvent("resize", function(){ if (this.currentItem){ if (this.currentItem.viewer && this.currentItem.viewer.setContentHeight){ this.currentItem.viewer.setContentHeight(); } } }.bind(this)); }.bind(this)); }, createLayout: function(){ if (!layout.mobile){ this.createLayoutPC(); }else{ this.createLayoutMobile(); } }, createLayoutPC: function(){ this.naviNode = new Element("div", {"styles": this.css.naviNode}).inject(this.content); this.contentNode = new Element("div", {"styles": this.css.contentNode}).inject(this.content); this.naviTitleNode = new Element("div", {"styles": this.css.naviTitleNode}).inject(this.naviNode); this.naviContentNode = new Element("div", {"styles": this.css.naviContentNode}).inject(this.naviNode); var lp = this.lp; var data = this.interfaceData; var object = []; this.naviArray = object; if( data.viewShow !== "false" && data.viewShow !== false ) { this.naviViewTitleNode = new Element("div", {"styles": this.css.naviCategoryNode }); // this.naviViewTitleNode = new Element("div", {"styles": this.css.naviViewTitleNode, "text": data.viewName}); this.naviViewContentNode = new Element("div", {"styles": this.css.naviViewContentNode}); object.push({ "type": "view", "index": data.viewNumber, "titleNode": this.naviViewTitleNode, "contentNode": this.naviViewContentNode }); } if( data.statShow !== "false" && data.statShow !== false ) { this.naviStatTitleNode = new Element("div", {"styles": this.css.naviCategoryNode }); // this.naviStatTitleNode = new Element("div", {"styles": this.css.naviStatTitleNode, "text": data.statName}); this.naviStatContentNode = new Element("div", {"styles": this.css.naviStatContentNode}); object.push({ "type": "stat", "index": data.statNumber, "titleNode": this.naviStatTitleNode, "contentNode": this.naviStatContentNode }); } if( data.statementShow !== "false" && data.statementShow !== false ) { this.naviStatementTitleNode = new Element("div", {"styles": this.css.naviCategoryNode }); // this.naviStatementTitleNode = new Element("div", {"styles": this.css.naviStatementTitleNode, "text": data.statementName}); this.naviStatementContentNode = new Element("div", {"styles": this.css.naviStatementContentNode}); object.push({ "type": "statement", "index": data.statementNumber, "titleNode": this.naviStatementTitleNode, "contentNode": this.naviStatementContentNode }); } if( data.importerShow !== "false" && data.importerShow !== false ) { this.naviImporterTitleNode = new Element("div", {"styles": this.css.naviCategoryNode }); // this.naviImporterTitleNode = new Element("div", { // "styles": this.css.naviImporterTitleNode, // "text": data.importerName // }); this.naviImporterContentNode = new Element("div", {"styles": this.css.naviImporterContentNode}); object.push({ "type": "importer", "index": data.importerNumber, "titleNode": this.naviImporterTitleNode, "contentNode": this.naviImporterContentNode }); } object.sort(function(a, b){ return a.index - b.index }); object.each(function(a){ a.titleNode.inject(this.naviContentNode); var actionNode = new Element("div", {"styles": this.css.naviExpandNode }).inject(a.titleNode); var textNode = new Element("div", {"styles": this.css.naviTitleTextNode, "text": data[a.type+"Name"] }).inject(a.titleNode); textNode.setStyle("background-image", "url('"+ data[a.type+"Icon"] +"')"); a.titleNode.addEvents({ "mouseover": function () { a.titleNode.setStyles(this.css.naviCategoryNode_over) }.bind(this), "mouseout": function () { a.titleNode.setStyles(this.css.naviCategoryNode) }.bind(this), "click": function () { if( actionNode.retrieve("collapse") ){ actionNode.setStyles(this.css.naviExpandNode); actionNode.store("collapse",false); a.contentNode.show(); }else{ actionNode.setStyles(this.css.naviCollapseNode); actionNode.store("collapse",true); a.contentNode.hide(); } }.bind(this) }); a.contentNode.inject(this.naviContentNode); }.bind(this)) this.setContentHeightFun = this.setContentHeight.bind(this); this.addEvent("resize", this.setContentHeightFun); this.setContentHeightFun(); this.naviIconTitleNode = new Element("div", {"styles": this.css.naviIconTitleNode}).inject(this.naviTitleNode); if (this.query.icon){ this.naviIconTitleNode.setStyles({ "background-image": "url(data:image/png;base64,"+this.query.icon+")", }); } this.naviRightTitleNode = new Element("div", {"styles": this.css.naviRightTitleNode}).inject(this.naviTitleNode); this.naviTextTitleNode = new Element("div", {"styles": this.css.naviTextTitleNode, "text": this.query.name}).inject(this.naviRightTitleNode); this.naviDescriptionTitleNode = new Element("div", {"styles": this.css.naviDescriptionTitleNode, "text": this.query.description || this.lp.noDescription}).inject(this.naviRightTitleNode); }, createLayoutMobile: function(){}, setContentHeight: function(){ var size = this.content.getSize(); var titleSize = this.naviTitleNode.getSize(); var y = size.y-titleSize.y; this.naviContentNode.setStyle("height", ""+y+"px"); }, createNavi: function(){ debugger; var viewLoaded,statLoaded, statementLoaded,importerLoaded; var callback = function () { if( this.viewItemSelected || this.statItemSelected || this.statementItemSelected || this.importerItemSelected )return; if(viewLoaded && statLoaded && statementLoaded && importerLoaded){ for( var i=0; i