MWF.xApplication.process.FormDesigner.widget = MWF.xApplication.process.FormDesigner.widget || {}; MWF.require("MWF.widget.UUID", null, false); MWF.require("MWF.widget.O2Identity", null, false); MWF.xApplication.process.FormDesigner.widget.DictionaryIncluder = new Class({ Implements: [Options, Events], Extends: MWF.widget.Common, options: { "style": "default", "maxObj": document.body }, initialize: function(node, designer, options){ this.setOptions(options); this.node = $(node); this.designer = designer; this.path = "../x_component_process_FormDesigner/widget/$DictionaryIncluder/"; this.cssPath = "../x_component_process_FormDesigner/widget/$DictionaryIncluder/"+this.options.style+"/css.wcss"; this._loadCss(); this.lp = this.designer.lp.dictionaryIncluder; this.items = []; }, load: function(data){ this.editorNode = new Element("div", {"styles": this.css.editorNode}).inject(this.node); this.actionNode = new Element("div", {"styles": this.css.actionNode}).inject(this.node); this.listNode = new Element("div", {"styles": this.css.listNode}).inject(this.node); this.loadEditorNode(); this.loadActionNode(); this.loadListNode(data); }, loadEditorNode: function(){ debugger; var html = "" + "" + ""+ "
"+this.lp.selectDictionary+"
"+this.lp.path+"
"; this.editorNode.set("html", html); var tds = this.editorNode.getElements("td").setStyles(this.css.editTableTdValue); this.dictionarySelectorArea = this.editorNode.getElement(".dictionarySelectorArea"); this.pathField = this.editorNode.getElement("input[type='text']"); this.loadDictionarySelector(); }, loadDictionarySelector: function( data ){ MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.PersonSelector", function(){ var _self = this; if( !data )data = []; this.dictionarySelector = new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(this.dictionarySelectorArea, this.designer, { "type": "Dictionary", "count": 1, "names": data, "onChange": function(ids){ var json; if( ids.length ){ var d = ids[0].data; json = { "type" : "dictionary", "name": d.name, "alias": d.alias, "id": d.id, "appName" : d.appName || d.applicationName, "appId": d.appId || d.application, "appAilas": d.appAilas || d.applicationAilas, "appType" : d.appType }; } this.currentSelectDictionary = json; }.bind(this) }); }.bind(this)); }, loadActionNode: function(){ this.actionAreaNode = new Element("div", {"styles": this.css.actionAreaNode}).inject(this.actionNode); this.addAction = new Element("div", {"styles": this.css.addAction, "text": this.designer.lp.validation.add}).inject(this.actionAreaNode); this.modifyAction = new Element("div", {"styles": this.css.modifyAction_disabled, "text": this.designer.lp.validation.modify}).inject(this.actionAreaNode); this.addAction.addEvent("click", function(){ this.add(); }.bind(this)); this.modifyAction.addEvent("click", function(){ this.modify(); }.bind(this)); }, getCurrentData: function(){ return { "path": this.pathField.get("value"), "dictionary": this.currentSelectDictionary || null }; }, add: function(){ debugger; this.hideErrorNode(); var data = this.getCurrentData(); if ( !data.dictionary ){ this.showErrorNode(this.lp.selectDictionaryNotice); return false; } for( var i=0; i