Property.js 98 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351
  1. MWF.require("MWF.widget.Common", null, false);
  2. MWF.require("MWF.widget.JsonTemplate", null, false);
  3. MWF.xApplication.process.FormDesigner.Property = MWF.FCProperty = new Class({
  4. Extends: MWF.widget.Common,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "path": "../x_component_process_FormDesigner/property/property.html"
  9. },
  10. initialize: function(module, propertyNode, designer, options){
  11. this.setOptions(options);
  12. this.module = module;
  13. this.form = module.form;
  14. this.data = module.json;
  15. this.data.pid = this.form.options.mode+this.form.json.id+this.data.id;
  16. this.htmlPath = this.options.path;
  17. this.designer = designer;
  18. this.maplists = {};
  19. this.propertyNode = propertyNode;
  20. },
  21. load: function(){
  22. if (this.fireEvent("queryLoad")){
  23. MWF.getRequestText(this.htmlPath, function(responseText, responseXML){
  24. this.htmlString = responseText;
  25. this.fireEvent("postLoad");
  26. }.bind(this));
  27. }
  28. this.propertyNode.addEvent("keydown", function(e){e.stopPropagation();});
  29. },
  30. editProperty: function(td){
  31. },
  32. getHtmlString: function(callback){
  33. if (!this.htmlString){
  34. MWF.getRequestText(this.htmlPath, function(responseText, responseXML){
  35. this.htmlString = responseText;
  36. if (callback) callback();
  37. }.bind(this));
  38. }else{
  39. if (callback) callback();
  40. }
  41. },
  42. show: function(){
  43. if (!this.propertyContent){
  44. this.getHtmlString(function(){
  45. if (this.htmlString){
  46. this.JsonTemplate = new MWF.widget.JsonTemplate(this.data, this.htmlString);
  47. this.propertyContent = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.propertyNode);
  48. this.propertyContent.set("html", this.JsonTemplate.load());
  49. this.setEditNodeEvent();
  50. this.setEditNodeStyles(this.propertyContent);
  51. this.loadPropertyTab();
  52. this.loadMaplist();
  53. this.loadStylesList();
  54. this.loadDivTemplateType();
  55. this.loadPersonInput();
  56. this.loadFormFieldInput();
  57. this.loadScriptArea();
  58. this.loadCssArea();
  59. this.loadHtmlEditorArea();
  60. this.loadTreeData();
  61. this.loadArrayList();
  62. this.loadEventsEditor();
  63. this.loadActionArea();
  64. this.loadActionStylesArea();
  65. this.loadHTMLArea();
  66. this.loadJSONArea();
  67. this.loadFormSelect();
  68. this.loadSubformSelect();
  69. //this.loadPageSelect();
  70. this.loadWidgetSelect();
  71. this.loadANNModelSelect();
  72. //this.loadViewSelect();
  73. this.loadValidation();
  74. this.loadIconSelect();
  75. this.loadLabelFlagSelect();
  76. this.loadImageClipper();
  77. this.loadImageFileSelect();
  78. this.loadParameterEditor();
  79. this.loadContextRoot();
  80. this.loadUnitTypeSelector();
  81. this.loadSourceTestRestful();
  82. this.loadSidebarPosition();
  83. this.loadViewFilter();
  84. this.loadStatementFilter();
  85. this.loadDocumentTempleteSelect();
  86. // this.loadScriptIncluder();
  87. // this.loadDictionaryIncluder();
  88. //this.testRestful();
  89. // this.loadScriptInput();
  90. //MWF.process.widget.EventsEditor
  91. }
  92. }.bind(this));
  93. }else{
  94. this.propertyContent.setStyle("display", "block");
  95. }
  96. (new Fx.Scroll(layout.desktop.node)).toTop();
  97. },
  98. hide: function(){
  99. //this.JsonTemplate = null;
  100. //this.propertyNode.set("html", "");
  101. if (this.propertyContent) this.propertyContent.setStyle("display", "none");
  102. },
  103. destroy: function(){
  104. if (this.propertyContent){
  105. this.propertyContent.destroy();
  106. }
  107. MWF.release(this);
  108. },
  109. loadTreeData: function(){
  110. var arrays = this.propertyContent.getElements(".MWFTreeData");
  111. arrays.each(function(node){
  112. var title = node.get("title");
  113. var name = node.get("name");
  114. var json = this.data[name];
  115. if (!json) json = [];
  116. MWF.require("MWF.widget.TreeEditor", function(){
  117. var treeEditor = new MWF.widget.TreeEditor(node, {
  118. "title": title,
  119. "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  120. "onChange": function(){
  121. this.data[name] = treeEditor.toJson();
  122. this.module.json[name] = this.data[name];
  123. this.module._refreshTree();
  124. }.bind(this)
  125. });
  126. treeEditor.load(json);
  127. }.bind(this));
  128. node.addEvent("keydown", function(e){e.stopPropagation();});
  129. }.bind(this));
  130. },
  131. loadJSONArea: function(){
  132. var jsonNode = this.propertyContent.getElement(".MWFJSONArea");
  133. if (jsonNode){
  134. this.propertyTab.pages.each(function(page){
  135. if (page.contentNode === jsonNode.parentElement){
  136. page.setOptions({
  137. "onShow": function(){
  138. jsonNode.empty();
  139. MWF.require("MWF.widget.JsonParse", function(){
  140. this.json = new MWF.widget.JsonParse(this.module.json, jsonNode, null);
  141. this.json.load();
  142. }.bind(this));
  143. }.bind(this)
  144. });
  145. }
  146. }.bind(this));
  147. }
  148. },
  149. loadHTMLArea: function(){
  150. var htmlNode = this.propertyContent.getElement(".MWFHTMLArea");
  151. if (htmlNode){
  152. var copy = this.module.node.clone(true, true);
  153. copy.clearStyles(true);
  154. htmlNode.set("text", copy.outerHTML);
  155. copy.destroy();
  156. this.propertyTab.pages.each(function(page){
  157. if (page.contentNode == htmlNode.parentElement){
  158. page.setOptions({
  159. "onShow": function(){
  160. var copy = this.module.node.clone(true, true);
  161. copy.clearStyles(true);
  162. //MWF.require("MWF.widget.HtmlEditor", function(){
  163. // debugger;
  164. // var editor = new MWF.widget.HtmlEditor(htmlNode);
  165. // editor.load(function(){
  166. // editor.editor.setValue(copy.outerHTML)
  167. // }.bind(this));
  168. //}.bind(this));
  169. o2.load("JSBeautifier_html", function(){
  170. htmlNode.set("text", html_beautify(copy.outerHTML, {"indent_size":1}));
  171. }.bind(this));
  172. o2.require("o2.widget.ace", function(){
  173. MWF.widget.ace.load(function(){
  174. COMMON.AjaxModule.loadDom("../o2_lib/ace/src-min-noconflict/ext-static_highlight.js", function(){
  175. var highlight = ace.require("ace/ext/static_highlight");
  176. highlight(htmlNode, {mode: "ace/mode/html", theme: "ace/theme/eclipse", "fontSize": 16});
  177. }.bind(this));
  178. }.bind(this));
  179. }.bind(this));
  180. copy.destroy();
  181. }.bind(this)
  182. });
  183. }
  184. }.bind(this));
  185. }
  186. },
  187. loadSidebarPosition: function(){
  188. var nodes = this.propertyContent.getElements(".MWFSidebarReposition");
  189. if (nodes.length){
  190. nodes.each(function(node){
  191. node.addEvent("click", function(){
  192. this.module.json.styles.top = "";
  193. this.module.loadPosition();
  194. }.bind(this));
  195. }.bind(this));
  196. }
  197. },
  198. loadANNModelSelect: function(){
  199. var nodes = this.propertyContent.getElements(".MWFANNModelSelect");
  200. if (nodes.length){
  201. this.getModelList(function(){
  202. nodes.each(function(node){
  203. var select = new Element("select").inject(node);
  204. select.addEvent("change", function(e){
  205. this.setValue(e.target.getParent("div").get("name"), e.target.options[e.target.selectedIndex].value, select);
  206. }.bind(this));
  207. this.setModelSelectOptions(node, select);
  208. var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(node);
  209. refreshNode.addEvent("click", function(e){
  210. this.getModelList(function(){
  211. this.setModelSelectOptions(node, select);
  212. }.bind(this), true);
  213. }.bind(this));
  214. }.bind(this));
  215. }.bind(this));
  216. }
  217. },
  218. getModelList: function(callback, refresh){
  219. if (!this.models || refresh){
  220. var action = o2.Actions.get("x_query_assemble_designer");
  221. if (action.listModel) action.listModel(function(json){
  222. this.models = json.data;
  223. if (callback) callback();
  224. }.bind(this));
  225. }else{
  226. if (callback) callback();
  227. }
  228. },
  229. setModelSelectOptions: function(node, select){
  230. var name = node.get("name");
  231. select.empty();
  232. var option = new Element("option", {"text": "none"}).inject(select);
  233. this.models.each(function(model){
  234. var option = new Element("option", {
  235. "text": model.name,
  236. "value": model.id,
  237. "selected": (this.data[name]==model.id)
  238. }).inject(select);
  239. }.bind(this));
  240. },
  241. loadFormSelect: function(){
  242. var formNodes = this.propertyContent.getElements(".MWFFormSelect");
  243. if (formNodes.length){
  244. this.getFormList(function(){
  245. formNodes.each(function(node){
  246. var select = new Element("select").inject(node);
  247. select.addEvent("change", function(e){
  248. var value = e.target.options[e.target.selectedIndex].value;
  249. this.setValue(e.target.getParent("div").get("name"), value, select);
  250. }.bind(this));
  251. this.setFormSelectOptions(node, select);
  252. var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(node);
  253. refreshNode.addEvent("click", function(e){
  254. this.getFormList(function(){
  255. this.setFormSelectOptions(node, select);
  256. }.bind(this), true);
  257. }.bind(this));
  258. //select.addEvent("click", function(e){
  259. // this.setFormSelectOptions(node, select);
  260. //}.bind(this));
  261. }.bind(this));
  262. }.bind(this));
  263. }
  264. },
  265. setFormSelectOptions: function(node, select){
  266. var name = node.get("name");
  267. select.empty();
  268. var option = new Element("option", {"text": "none"}).inject(select);
  269. this.forms.each(function(form){
  270. if( this.form.json.id !== form.id ){
  271. var option = new Element("option", {
  272. "text": form.name,
  273. "value": form.id,
  274. "selected": (this.data[name]==form.id)
  275. }).inject(select);
  276. }
  277. }.bind(this));
  278. },
  279. getFormList: function(callback, refresh){
  280. if (!this.forms || refresh){
  281. this.form.designer.actions.listForm(this.form.designer.application.id, function(json){
  282. this.forms = json.data;
  283. if (callback) callback();
  284. }.bind(this));
  285. }else{
  286. if (callback) callback();
  287. }
  288. },
  289. loadSubformSelect: function(){
  290. var subformContainers = this.propertyContent.getElements(".MWFSubFormSelectContainer");
  291. if (subformContainers.length){
  292. subformContainers.each( function( container ){
  293. var appSelectNode = container.getElement(".MWFSubformAppSelect");
  294. var formSelectNode = container.getElement(".MWFSubformSelect");
  295. var formSelect;
  296. var appNodeName = appSelectNode.get("name");
  297. var formNodeName = formSelectNode.get("name");
  298. this.loadProcessApplictionSelect( appSelectNode, appNodeName, function( apps ){
  299. var oldValue = this.data[appNodeName] || "";
  300. this.data[appNodeName] = !apps.length ? "" : apps[0].data.id;
  301. if( oldValue !== this.data[appNodeName] ){
  302. this.getSubFormList(function(){
  303. this.setSubformSelectOptions(formSelectNode, formSelect);
  304. formSelect.fireEvent("change");
  305. }.bind(this), true, appNodeName);
  306. }
  307. }.bind(this));
  308. formSelect = this._loadSubformSelect( formSelectNode, formNodeName, appNodeName ) ;
  309. }.bind(this))
  310. }
  311. },
  312. loadProcessApplictionSelect : function( node, appNodeName, callback ){
  313. var application = appNodeName ? this.data[appNodeName] : "";
  314. MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.PersonSelector", function() {
  315. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  316. "title" : this.form.designer.lp.selectApplication,
  317. "type": "application",
  318. "count" : 1,
  319. "names": application ? [ {id : application} ] : [],
  320. "onChange": function (apps) {
  321. callback(apps)
  322. }.bind(this)
  323. });
  324. }.bind(this))
  325. },
  326. _loadSubformSelect : function( node, formNodeName, appNodeName ){
  327. var select;
  328. this.getSubFormList(function(){
  329. select = new Element("select").inject(node);
  330. select.addEvent("change", function(e){
  331. var value = select.options[select.selectedIndex].value;
  332. this.setValue(formNodeName, value, select);
  333. }.bind(this));
  334. this.setSubformSelectOptions(node, select);
  335. var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(node);
  336. refreshNode.addEvent("click", function(e){
  337. this.getSubFormList(function(){
  338. this.setSubformSelectOptions(node, select);
  339. }.bind(this), true, appNodeName);
  340. }.bind(this));
  341. }.bind(this), false, appNodeName );
  342. return select;
  343. },
  344. setSubformSelectOptions: function(node, select){
  345. var name = node.get("name");
  346. select.empty();
  347. var option = new Element("option", {"text": "none"}).inject(select);
  348. this.subforms.each(function(subforms){
  349. if( this.form.json.id !== subforms.id ){
  350. var option = new Element("option", {
  351. "text": subforms.name,
  352. "value": subforms.id,
  353. "selected": (this.data[name]==subforms.id)
  354. }).inject(select);
  355. }
  356. }.bind(this));
  357. },
  358. getSubFormList: function(callback, refresh, appNodeName){
  359. var application = appNodeName ? this.data[appNodeName] : "";
  360. if (!this.subforms || refresh){
  361. this.form.designer.actions.listForm( application || this.form.designer.application.id, function(json){
  362. this.subforms = json.data;
  363. if (callback) callback();
  364. }.bind(this), null, false);
  365. }else{
  366. if (callback) callback();
  367. }
  368. },
  369. loadPageSelect: function(){
  370. var pageNodes = this.propertyContent.getElements(".MWFPageSelect");
  371. if (pageNodes.length){
  372. this.getPageList(function(){
  373. pageNodes.each(function(node){
  374. var select = new Element("select").inject(node);
  375. select.addEvent("change", function(e){
  376. var value = e.target.options[e.target.selectedIndex].value;
  377. this.setValue(e.target.getParent("div").get("name"), value, select);
  378. }.bind(this));
  379. this.setPageSelectOptions(node, select);
  380. var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(node);
  381. refreshNode.addEvent("click", function(e){
  382. this.getPageList(function(){
  383. this.setPageSelectOptions(node, select);
  384. }.bind(this), true);
  385. }.bind(this));
  386. }.bind(this));
  387. }.bind(this));
  388. }
  389. },
  390. setPageSelectOptions: function(node, select){
  391. var name = node.get("name");
  392. select.empty();
  393. var option = new Element("option", {"text": "none"}).inject(select);
  394. this.pages.each(function(page){
  395. if( this.form.json.id !== page.id ){
  396. var option = new Element("option", {
  397. "text": page.name,
  398. "value": page.id,
  399. "selected": (this.data[name]==page.id)
  400. }).inject(select);
  401. }
  402. }.bind(this));
  403. },
  404. getPageList: function(callback, refresh){
  405. if (!this.pages || refresh){
  406. this.form.designer.actions.listPage(this.form.designer.application.id, function(json){
  407. this.pages = json.data;
  408. if (callback) callback();
  409. }.bind(this));
  410. }else{
  411. if (callback) callback();
  412. }
  413. },
  414. loadWidgetSelect: function(){
  415. var widgetNodes = this.propertyContent.getElements(".MWFWidgetSelect");
  416. if (widgetNodes.length){
  417. this.getWidgetList(function(){
  418. widgetNodes.each(function(node){
  419. var select = new Element("select").inject(node);
  420. select.addEvent("change", function(e){
  421. var value = e.target.options[e.target.selectedIndex].value;
  422. this.setValue(e.target.getParent("div").get("name"), value, select);
  423. }.bind(this));
  424. this.setWidgetSelectOptions(node, select);
  425. var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(node);
  426. refreshNode.addEvent("click", function(e){
  427. this.getWidgetList(function(){
  428. this.setWidgetSelectOptions(node, select);
  429. }.bind(this), true);
  430. }.bind(this));
  431. }.bind(this));
  432. }.bind(this));
  433. }
  434. },
  435. setWidgetSelectOptions: function(node, select){
  436. var name = node.get("name");
  437. select.empty();
  438. var option = new Element("option", {"text": "none"}).inject(select);
  439. this.widgets.each(function(widget){
  440. if( this.form.json.id !== widget.id ){
  441. var option = new Element("option", {
  442. "text": widget.name,
  443. "value": widget.id,
  444. "selected": (this.data[name]==widget.id)
  445. }).inject(select);
  446. }
  447. }.bind(this));
  448. },
  449. getWidgetList: function(callback, refresh){
  450. if (!this.widgets || refresh){
  451. this.form.designer.actions.listWidget(this.form.designer.application.id, function(json){
  452. this.widgets = json.data;
  453. if (callback) callback();
  454. }.bind(this));
  455. }else{
  456. if (callback) callback();
  457. }
  458. },
  459. // clearStyles: function(node){
  460. // node.removeProperty("style");
  461. // var subNode = node.getFirst();
  462. // while (subNode){
  463. // this.clearStyles(subNode);
  464. // subNode = subNode.getNext();
  465. // }
  466. // },
  467. loadDocumentTempleteSelect: function(){
  468. var nodes = this.propertyContent.getElements(".MWFDocumentTempleteSelect");
  469. if (nodes.length){
  470. o2.getJSON("../x_component_process_FormDesigner/Module/Documenteditor/templete/templete.json", function(json){
  471. nodes.each(function(node){
  472. var name = node.get("name");
  473. Object.each(json, function(o, k){
  474. new Element("option", {
  475. "text": o.name,
  476. "value": k,
  477. "selected": (this.data[name]==k)
  478. }).inject(node);
  479. }.bind(this));
  480. node.addEvent("change", function(e){
  481. var oldValue = this.data[name];
  482. var value = e.target.options[e.target.selectedIndex].value;
  483. var name = e.target.options[e.target.selectedIndex].get("text");
  484. this.changeJsonDate([name], value);
  485. this.changeData(name, node, oldValue);
  486. }.bind(this));
  487. }.bind(this));
  488. }.bind(this));
  489. }
  490. },
  491. loadStatementFilter: function(){
  492. debugger;
  493. var nodes = this.propertyContent.getElements(".MWFStatementFilter");
  494. var filtrData = this.data.filterList;
  495. nodes.each(function(node){
  496. MWF.xDesktop.requireApp("query.StatementDesigner", "widget.ViewFilter", function(){
  497. var _slef = this;
  498. new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.form.designer, {"filtrData": filtrData, "customData": null}, {
  499. "statementId" : this.data.queryStatement ? this.data.queryStatement.id : "",
  500. "withForm" : true,
  501. "onChange": function(ids){
  502. var data = this.getData();
  503. _slef.changeJsonDate(["filterList"], data.data);
  504. //_slef.changeJsonDate(["data", "customFilterEntryList"], data.customData);
  505. }
  506. });
  507. }.bind(this));
  508. }.bind(this));
  509. },
  510. loadViewFilter: function(){
  511. var nodes = this.propertyContent.getElements(".MWFViewFilter");
  512. var filtrData = this.data.filterList;
  513. nodes.each(function(node){
  514. MWF.xDesktop.requireApp("query.ViewDesigner", "widget.ViewFilter", function(){
  515. var _slef = this;
  516. new MWF.xApplication.query.ViewDesigner.widget.ViewFilter(node, this.form.designer, {"filtrData": filtrData, "customData": null}, {
  517. "onChange": function(ids){
  518. var data = this.getData();
  519. _slef.changeJsonDate(["filterList"], data.data);
  520. //_slef.changeJsonDate(["data", "customFilterEntryList"], data.customData);
  521. }
  522. });
  523. }.bind(this));
  524. }.bind(this));
  525. },
  526. loadViewSelect: function(){
  527. var viewNodes = this.propertyContent.getElements(".MWFViewSelect");
  528. if (viewNodes.length){
  529. this.getViewList(function(){
  530. viewNodes.each(function(node){
  531. var select = new Element("select").inject(node);
  532. select.addEvent("change", function(e){
  533. var viewId = e.target.options[e.target.selectedIndex].value;
  534. var viewName = e.target.options[e.target.selectedIndex].get("text");
  535. this.setValue(e.target.getParent("div").get("name"), viewId);
  536. this.setValue(e.target.getParent("div").get("name")+"Name", viewName);
  537. }.bind(this));
  538. this.setViewSelectOptions(node, select);
  539. var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(node);
  540. refreshNode.addEvent("click", function(e){
  541. this.getViewList(function(){
  542. this.setViewSelectOptions(node, select);
  543. }.bind(this), true);
  544. }.bind(this));
  545. //select.addEvent("click", function(e){
  546. // this.setFormSelectOptions(node, select);
  547. //}.bind(this));
  548. }.bind(this));
  549. }.bind(this));
  550. }
  551. },
  552. setViewSelectOptions: function(node, select){
  553. var name = node.get("name");
  554. select.empty();
  555. var option = new Element("option", {"text": "none"}).inject(select);
  556. this.views.each(function(view){
  557. var option = new Element("option", {
  558. "text": view.name,
  559. "value": view.id,
  560. "selected": (this.data[name]==view.id)
  561. }).inject(select);
  562. }.bind(this));
  563. },
  564. getViewList: function(callback, refresh){
  565. if (!this.views || refresh){
  566. this.form.designer.actions.listView(this.form.designer.application.id, function(json){
  567. this.views = json.data;
  568. if (callback) callback();
  569. }.bind(this));
  570. }else{
  571. if (callback) callback();
  572. }
  573. },
  574. loadValidation: function(){
  575. var nodes = this.propertyContent.getElements(".MWFValidation");
  576. if (nodes.length){
  577. nodes.each(function(node){
  578. var name = node.get("name");
  579. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ValidationEditor", function(){
  580. var validationEditor = new MWF.xApplication.process.FormDesigner.widget.ValidationEditor(node, this.designer, {
  581. "onChange": function(){
  582. var data = validationEditor.getValidationData();
  583. this.data[name] = data;
  584. }.bind(this)
  585. });
  586. validationEditor.load(this.data[name])
  587. }.bind(this));
  588. //new MWF.xApplication.process.FormDesigner.widget.ValidationEditor(node, this.designer);
  589. }.bind(this));
  590. }
  591. },
  592. loadIconSelect: function(){
  593. var nodes = this.propertyContent.getElements(".MWFIcon");
  594. if (nodes.length){
  595. nodes.each(function(node){
  596. var id = node.get("name");
  597. var icon = this.data[id];
  598. var iconNode = new Element("div", {"styles": this.form.css.processIconNode}).inject(node);
  599. if (icon) iconNode.setStyles({"background": "url("+icon+") center center no-repeat"});
  600. var selectNode = new Element("div", {"styles": this.form.css.processIconSelectNode, "text": this.form.designer.lp.selectIcon}).inject(node);
  601. selectNode.addEvent("click", function(){
  602. this.selectIcon(node);
  603. }.bind(this));
  604. }.bind(this));
  605. }
  606. },
  607. selectIcon: function(node){
  608. if (!node.iconMenu){
  609. var iconSelectMenu = new MWF.widget.Menu(node, {"event": "click", "style": "processIcon"});
  610. iconSelectMenu.load();
  611. node.iconMenu = iconSelectMenu;
  612. var _self = this;
  613. for (var i=0; i<=48; i++){
  614. var icon = "../x_component_process_ProcessManager/$Explorer/default/processIcon/process_icon_"+i+".png";
  615. var item = iconSelectMenu.addMenuItem("", "click", function(){
  616. var id = node.get("name");
  617. var src = this.item.getElement("img").get("src");
  618. _self.data[id] = src;
  619. node.getFirst("div").setStyle("background-image", "url("+src+")");
  620. }, icon);
  621. item.iconName = icon;
  622. }
  623. }
  624. },
  625. loadLabelFlagSelect: function(){
  626. var nodes = this.propertyContent.getElements(".MWFLabelFlag");
  627. if (nodes.length){
  628. nodes.each(function(node){
  629. var id = node.get("name");
  630. var icon = this.data[id];
  631. var iconNode = new Element("div", {"styles": this.form.css.labelFlagNode}).inject(node);
  632. if (icon) iconNode.setStyles({"background": "url("+icon+") center center no-repeat"});
  633. var selectNode = new Element("div", {"styles": this.form.css.processIconSelectNode, "text": this.form.designer.lp.empty}).inject(node);
  634. selectNode.addEvent("click", function(e){
  635. var id = node.get("name");
  636. this.data[id] = "";
  637. node.getFirst("div").setStyle("background-image", "");
  638. this.changeData(id);
  639. e.stopPropagation();
  640. }.bind(this));
  641. var selectNode = new Element("div", {"styles": this.form.css.processIconSelectNode, "text": this.form.designer.lp.select}).inject(node);
  642. selectNode.addEvent("click", function(){
  643. this.selectLabelFlag(node);
  644. }.bind(this));
  645. }.bind(this));
  646. }
  647. },
  648. selectLabelFlag: function(node){
  649. if (!node.iconMenu){
  650. var iconSelectMenu = new MWF.widget.Menu(node, {"event": "click", "style": "labelFlag"});
  651. iconSelectMenu.load();
  652. node.iconMenu = iconSelectMenu;
  653. var _self = this;
  654. for (var i=1; i<=21; i++){
  655. var icon = "../x_component_process_FormDesigner/Module/Label/default/icon/flag/"+i+".png";
  656. var item = iconSelectMenu.addMenuItem("", "click", function(){
  657. var id = node.get("name");
  658. var src = this.item.getElement("img").get("src");
  659. _self.data[id] = src;
  660. node.getFirst("div").setStyle("background-image", "url("+src+")");
  661. _self.changeData(id);
  662. }, icon);
  663. item.iconName = icon;
  664. }
  665. }
  666. },
  667. loadImageFileSelect: function(){
  668. // var nodes = this.propertyContent.getElements(".MWFImageFileSelect");
  669. // if (nodes.length){
  670. //
  671. //
  672. //
  673. //
  674. // this.getFileList(function(){
  675. // nodes.each(function(node){
  676. // var select = new Element("select").inject(node);
  677. // select.addEvent("change", function(e){
  678. // this.setValue(e.target.getParent("div").get("name"), e.target.options[e.target.selectedIndex].value, select);
  679. //
  680. // }.bind(this));
  681. // this.setFileSelectOptions(node, select);
  682. //
  683. // var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(node);
  684. // refreshNode.addEvent("click", function(e){
  685. // this.getFileList(function(){
  686. // this.setFileSelectOptions(node, select);
  687. // }.bind(this), true);
  688. // }.bind(this));
  689. // }.bind(this));
  690. // }.bind(this));
  691. // }
  692. },
  693. setFileSelectOptions: function(node, select){
  694. var name = node.get("name");
  695. select.empty();
  696. var option = new Element("option", {"text": "none"}).inject(select);
  697. this.files.each(function(file){
  698. var option = new Element("option", {
  699. "text": file.name,
  700. "value": file.id,
  701. "selected": (this.data[name]==file.id)
  702. }).inject(select);
  703. }.bind(this));
  704. },
  705. getFileList: function(callback, refresh){
  706. if (!this.files || refresh){
  707. this.form.designer.actions.listFile(this.form.designer.application.id, function(json){
  708. this.files = json.data;
  709. if (callback) callback();
  710. }.bind(this));
  711. }else{
  712. if (callback) callback();
  713. }
  714. },
  715. loadImageClipper: function(){
  716. var nodes = this.propertyContent.getElements(".MWFImageClipper");
  717. if (nodes.length){
  718. nodes.each(function(node){
  719. var id = node.get("name");
  720. var selectNode = new Element("div", {"styles": this.form.css.processIconSelectNode, "text": this.form.designer.lp.selectImage}).inject(node);
  721. selectNode.addEvent("click", function(){
  722. this.selectImage(node, id);
  723. }.bind(this));
  724. }.bind(this));
  725. }
  726. },
  727. createUploadFileAreaNode: function(node, name){
  728. this.uploadFileAreaNode = new Element("div");
  729. var html = "<input name=\"file\" multiple type=\"file\" accept=\"images/*\" />";
  730. this.uploadFileAreaNode.set("html", html);
  731. this.fileUploadNode = this.uploadFileAreaNode.getFirst();
  732. this.fileUploadNode.addEvent("change", function(){
  733. //var fileId = attachment.data.id;
  734. var files = this.fileUploadNode.files;
  735. if (files.length){
  736. var count = files.length;
  737. for (var i = 0; i < files.length; i++) {
  738. var file = files.item(i);
  739. var formData = new FormData();
  740. formData.append('file', file);
  741. MWF.xDesktop.uploadImage(
  742. this.form.json.id,
  743. (this.module.form.moduleType=="page") ? "portalPage" : "processPlatformForm",
  744. formData,
  745. file,
  746. function(json){
  747. var id = json.id;
  748. var src = MWF.xDesktop.getImageSrc(id);
  749. var data = {"imageSrc": src, "imageId": id};
  750. this.changeJsonDate(name, data);
  751. this.changeData(name, node, null);
  752. }.bind(this)
  753. );
  754. }
  755. }
  756. }.bind(this));
  757. },
  758. selectImage: function(node, name){
  759. if (!this.uploadFileAreaNode){
  760. this.createUploadFileAreaNode(node, name);
  761. }
  762. //this.fileUploadNode.set("accept", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
  763. this.fileUploadNode.set("multiple", false);
  764. var fileNode = this.uploadFileAreaNode.getFirst();
  765. fileNode.set("accept", ".png,.jpg,.bmp,.gif,.jpeg,.jpe");
  766. fileNode.click();
  767. //MWF.xDesktop.requireApp("process.FormDesigner", "widget.ImageClipper", function(){
  768. // var size = this.module.node.getSize();
  769. // var image = new MWF.xApplication.process.FormDesigner.widget.ImageClipper(this.designer, {
  770. // "title": this.form.designer.lp.selectImage,
  771. // "width": (this.data.styles.width) ? size.x : 0,
  772. // "height": (this.data.styles.height) ? size.y : 0,
  773. // "imageUrl" : this.data.imageSrc,
  774. // "reference" : this.form.json.id,
  775. // "referenceType": (this.module.form.moduleType=="page") ? "portalPage" : "processPlatformForm",
  776. // "onChange": function(){
  777. // var data = {"imageSrc": image.imageSrc, "imageId": image.imageId};
  778. // this.changeJsonDate(name, data);
  779. // this.changeData(name, node, null);
  780. // }.bind(this)
  781. // });
  782. // image.load(this.data[name])
  783. //}.bind(this));
  784. },
  785. loadEventsEditor: function(){
  786. var events = this.propertyContent.getElement(".MWFEventsArea");
  787. if (events){
  788. var name = events.get("name");
  789. var eventsObj = this.data[name];
  790. MWF.xDesktop.requireApp("process.FormDesigner", "widget.EventsEditor", function(){
  791. var eventsEditor = new MWF.xApplication.process.FormDesigner.widget.EventsEditor(events, this.designer, {
  792. //"maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  793. "maxObj": this.designer.formContentNode || this.designer.pageContentNode
  794. });
  795. eventsEditor.load(eventsObj, this.data, name);
  796. }.bind(this));
  797. }
  798. },
  799. testRestful: function(){
  800. var node = this.propertyContent.getElements(".MWFTestRestful");
  801. if (node){
  802. var resultNode = node.getLast();
  803. node.getFirst().addEvent("click", function(){
  804. }.bind(this));
  805. }
  806. },
  807. loadContextRoot: function(){
  808. var nodes = this.propertyContent.getElements(".MWFContextRoot");
  809. if (nodes){
  810. nodes.each(function(node){
  811. var name = node.get("name");
  812. var selects = node.getElements("select");
  813. var rootSelect = selects[0];
  814. var actionSelect = selects[1];
  815. var methodSelect = selects[2];
  816. var pathInput = node.getElement("input");
  817. //var select = new Element("select").inject(node);
  818. //var methodSelect = new Element("select").inject(node);
  819. debugger;
  820. var getValue = function(){
  821. var v;
  822. try {
  823. v = JSON.parse(this.data[name]);
  824. }catch(e){
  825. v = {"root": this.data[name], "action":"", "method": "", "uri": ""};
  826. }
  827. return v
  828. }.bind(this);
  829. var value = getValue();
  830. var resetRootSelects = function(){
  831. var root = rootSelect.options[rootSelect.selectedIndex].value;
  832. var action = o2.Actions.load(root);
  833. actionSelect.empty();
  834. methodSelect.empty();
  835. pathInput.set("value", "");
  836. var value = getValue();
  837. Object.each(action, function(o, key){
  838. var option = new Element("option", {"value": key, "text": key, "selected": (value.action==key)}).inject(actionSelect);
  839. });
  840. return JSON.stringify({"root": root, "action":"", "method": "", "uri": ""});
  841. };
  842. var resetActionSelects = function(){
  843. var root = rootSelect.options[rootSelect.selectedIndex].value;
  844. var actionName = actionSelect.options[actionSelect.selectedIndex].value;
  845. var action = o2.Actions.load(root);
  846. methodSelect.empty();
  847. pathInput.set("value", "");
  848. var value = getValue();
  849. Object.each(action[actionName].action.actions, function(o, key){
  850. var option = new Element("option", {"value": key, "text": key, "selected": (value.method==key)}).inject(methodSelect);
  851. });
  852. return JSON.stringify({"root": root, "action":actionName, "method": "", "uri": ""});
  853. };
  854. var resetMethodSelects = function(){
  855. var root = rootSelect.options[rootSelect.selectedIndex].value;
  856. var actionName = actionSelect.options[actionSelect.selectedIndex].value;
  857. var methodName = methodSelect.options[methodSelect.selectedIndex].value;
  858. var action = o2.Actions.load(root);
  859. var uri = action[actionName].action.actions[methodName].uri;
  860. pathInput.set("value", uri);
  861. return JSON.stringify({"root": root, "action":actionName, "method": methodName, "uri": uri});
  862. };
  863. Object.each(layout.serviceAddressList, function(v, key){
  864. var option = new Element("option", {"value": key, "text": v.name, "selected": (value.root==key)}).inject(rootSelect);
  865. }.bind(this));
  866. resetRootSelects()
  867. resetActionSelects();
  868. resetMethodSelects();
  869. rootSelect.addEvent("change", function(){
  870. resetRootSelects();
  871. resetActionSelects();
  872. var data = resetMethodSelects();
  873. this.changeJsonDate(name, data);
  874. this.changeData(name, node, value);
  875. }.bind(this));
  876. actionSelect.addEvent("change", function(){
  877. resetActionSelects();
  878. var data = resetMethodSelects();
  879. this.changeJsonDate(name, data);
  880. this.changeData(name, node, value);
  881. }.bind(this));
  882. methodSelect.addEvent("change", function(){
  883. var data = resetMethodSelects();
  884. this.changeJsonDate(name, data);
  885. this.changeData(name, node, value);
  886. }.bind(this));
  887. }.bind(this));
  888. }
  889. },
  890. loadSourceTestRestful: function(){
  891. var nodes = this.propertyContent.getElements(".MWFSourceTestRestful");
  892. if (nodes.length){
  893. nodes.each(function(node){
  894. var button = node.getFirst();
  895. var content = node.getLast();
  896. //var button = new Element("input", {"type": "button", "value": "Test"}).inject(node);
  897. button.addEvent("click", function(e){
  898. this.testSourceRestful(content);
  899. }.bind(this));
  900. }.bind(this));
  901. }
  902. },
  903. testSourceRestful: function(content){
  904. var service;
  905. try {
  906. service = JSON.parse(this.module.json.contextRoot);
  907. }catch(e){
  908. service = {"root": this.module.json.contextRoot, "action":"", "method": "", "url": ""};
  909. }
  910. var address = this._getO2Address(service.root);
  911. var uri = this._getO2Uri(this.module, address);
  912. this._invoke(this.module, uri, function(json){
  913. content.empty();
  914. MWF.require("MWF.widget.JsonParse", function(){
  915. var jsonParse = new MWF.widget.JsonParse(json, content, null);
  916. jsonParse.load();
  917. }.bind(this));
  918. }.bind(this));
  919. },
  920. _getO2Address: function(contextRoot){
  921. var addressObj = layout.serviceAddressList[contextRoot];
  922. var address = "";
  923. if (addressObj){
  924. address = layout.config.app_protocol+"//"+addressObj.host+(addressObj.port==80 ? "" : ":"+addressObj.port)+addressObj.context;
  925. }else{
  926. var host = layout.desktop.centerServer.host || window.location.hostname;
  927. var port = layout.desktop.centerServer.port;
  928. address = layout.config.app_protocol+"//"+host+(port=="80" ? "" : ":"+port)+"/x_program_center";
  929. }
  930. return address;
  931. },
  932. _getO2Uri: function(module, address){
  933. //var uri = module.json.path || module.json.selectPath;
  934. var uri = module.json.path;
  935. var pars = {};
  936. MWF.require("MWF.xScript.Macro", null, false);
  937. var macro = new MWF.Macro["PageContext"]({"businessData": {}, "json": {}, "options": {}});
  938. if (module.json.parameters){
  939. Object.each(module.json.parameters, function(v, key){
  940. if (uri.indexOf("{"+key+"}")!==-1){
  941. var reg = new RegExp("{"+key+"}", "g");
  942. uri = uri.replace(reg, encodeURIComponent((v && v.code) ? (macro.exec(v.code, this) || "") : v));
  943. }else{
  944. pars[key] = v;
  945. }
  946. }.bind(this));
  947. }
  948. var data = null;
  949. if (module.json.requestBody){
  950. if (module.json.requestBody.code){
  951. data = macro.exec(module.json.requestBody.code, this)
  952. }
  953. }
  954. if (module.json.httpMethod==="GET" || module.json.httpMethod==="OPTIONS" || module.json.httpMethod==="HEAD" || module.json.httpMethod==="DELETE"){
  955. var tag = "?";
  956. if (uri.indexOf("?")!==-1) tag = "&";
  957. Object.each(pars, function(v, k){
  958. var value = (v && v.code) ? (macro.exec(v.code, this) || "") : v;
  959. uri = uri+tag+k+"="+value;
  960. }.bind(this));
  961. }else{
  962. Object.each(pars, function(v, k){
  963. if (!data) data = {};
  964. var value = (v && v.code) ? (macro.exec(v.code, this) || "") : v;
  965. data[k] = value;
  966. }.bind(this));
  967. }
  968. this.body = data;
  969. return {"uri": address+uri, "body": data};
  970. },
  971. _invoke: function(module, uri, callback){
  972. MWF.restful(module.json.httpMethod, uri.uri, JSON.encode(uri.body), function(json){
  973. //this.data = json;
  974. if (callback) callback(json);
  975. }.bind(this), true, true);
  976. },
  977. loadUnitTypeSelector: function(){
  978. var nodes = this.propertyContent.getElements(".MWFFormUnitTypeSelector");
  979. if (nodes.length){
  980. this.getUnitTypeList(function(){
  981. nodes.each(function(node){
  982. var select = new Element("select").inject(node);
  983. select.addEvent("change", function(e){
  984. this.setValue(e.target.getParent("div").get("name"), e.target.options[e.target.selectedIndex].value);
  985. }.bind(this));
  986. this.setUnitTypeSelectOptions(node, select);
  987. this.setValue(select.getParent("div").get("name"), select.options[select.selectedIndex].value);
  988. // var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(node);
  989. // refreshNode.addEvent("click", function(e){
  990. // this.getUnitTypeList(function(){
  991. // this.setUnitTypeSelectOptions(node, select);
  992. // }.bind(this), true);
  993. // }.bind(this));
  994. }.bind(this));
  995. }.bind(this));
  996. }
  997. },
  998. setUnitTypeSelectOptions: function(node, select){
  999. var name = node.get("name");
  1000. select.empty();
  1001. var option = new Element("option", {"value":"all", "text": this.form.designer.lp.all, "selected": (!this.data[name] || this.data[name]==="all")}).inject(select);
  1002. this.unitTypeList.each(function(unitType){
  1003. var option = new Element("option", {
  1004. "text": unitType,
  1005. "value": unitType,
  1006. "selected": (this.data[name]===unitType)
  1007. }).inject(select);
  1008. }.bind(this));
  1009. },
  1010. getUnitTypeList: function(callback, refresh){
  1011. if (!this.unitTypeList || refresh){
  1012. //MWF.xDesktop.requireApp("Org", "Actions.RestActions", function(){
  1013. // var action = new MWF.xApplication.Org.Actions.RestActions();
  1014. var action = MWF.Actions.get("x_organization_assemble_control");
  1015. action.listUnitType(function(json){
  1016. this.unitTypeList = json.data.valueList;
  1017. if (callback) callback();
  1018. }.bind(this));
  1019. //}.bind(this));
  1020. }else{
  1021. if (callback) callback();
  1022. }
  1023. },
  1024. loadParameterEditor: function(){
  1025. var pars = this.propertyContent.getElements(".MWFParameterArea");
  1026. if (pars){
  1027. pars.each(function(par){
  1028. var name = par.get("name");
  1029. if (!this.data[name]) this.data[name] = {};
  1030. var parObj = this.data[name];
  1031. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ParameterEditor", function(){
  1032. var parameterEditor = new MWF.xApplication.process.FormDesigner.widget.ParameterEditor(par, this.designer, {
  1033. //"maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  1034. "maxObj": this.designer.formContentNode
  1035. });
  1036. parameterEditor.load(parObj, this.data, name);
  1037. }.bind(this));
  1038. }.bind(this));
  1039. }
  1040. },
  1041. loadArrayList: function(){
  1042. var arrays = this.propertyContent.getElements(".MWFArraylist");
  1043. arrays.each(function(node){
  1044. var title = node.get("title");
  1045. var name = node.get("name");
  1046. var arr = this.data[name];
  1047. if (!arr) arr = [];
  1048. MWF.require("MWF.widget.Arraylist", function(){
  1049. var arraylist = new MWF.widget.Arraylist(node, {
  1050. "title": title,
  1051. "onChange": function(){
  1052. this.data[name] = arraylist.toArray();
  1053. }.bind(this)
  1054. });
  1055. arraylist.load(arr);
  1056. }.bind(this));
  1057. node.addEvent("keydown", function(e){e.stopPropagation();});
  1058. }.bind(this));
  1059. },
  1060. loadHtmlEditorArea: function(){
  1061. var htmlAreas = this.propertyContent.getElements(".MWFHtmlEditorArea");
  1062. htmlAreas.each(function(node){
  1063. var title = node.get("title");
  1064. var name = node.get("name");
  1065. var scriptContent = this.data[name];
  1066. MWF.require("MWF.widget.HtmlEditorArea", function(){
  1067. var htmlArea = new MWF.widget.HtmlEditorArea(node, {
  1068. "title": title,
  1069. //"maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  1070. "maxObj": this.designer.formContentNode,
  1071. "onChange": function(){
  1072. this.data[name] = htmlArea.getValue();
  1073. this.changeData(name);
  1074. htmlArea.isChanged = true;
  1075. }.bind(this),
  1076. // "onBlur": function(){
  1077. // if (htmlArea.isChanged){
  1078. // this.changeData(name, node, "");
  1079. // htmlArea.isChanged = false;
  1080. // }
  1081. // }.bind(this),
  1082. "onSave": function(){
  1083. this.designer.saveForm();
  1084. }.bind(this)
  1085. });
  1086. htmlArea.load({"code": scriptContent});
  1087. }.bind(this));
  1088. }.bind(this));
  1089. },
  1090. loadStylesList: function(){
  1091. var _self = this;
  1092. var styleSelNodes = this.propertyContent.getElements(".MWFFormStyle");
  1093. styleSelNodes.each(function(node){
  1094. if (this.module.form.stylesList){
  1095. if (!this.data.formStyleType) this.data.formStyleType = "default";
  1096. var mode = ( this.form.options.mode || "" ).toLowerCase() === "mobile" ? "mobile" : "pc";
  1097. Object.each(this.module.form.stylesList, function(s, key){
  1098. if( s.mode.contains( mode ) ){
  1099. new Element("option", {
  1100. "text": s.name,
  1101. "value": key,
  1102. "selected": ((!this.data.formStyleType && key=="default") || (this.data.formStyleType==key))
  1103. }).inject(node)
  1104. }
  1105. }.bind(this));
  1106. }else{
  1107. node.getParent("tr").setStyle("display", "none");
  1108. }
  1109. var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(node, "after");
  1110. refreshNode.addEvent("click", function(e){
  1111. _self.changeData(this.get("name"), this );
  1112. }.bind(node));
  1113. }.bind(this));
  1114. },
  1115. // loadStylesList: function(){
  1116. // var _self = this;
  1117. // var styleSelNodes = this.propertyContent.getElements(".MWFFormStyle");
  1118. // styleSelNodes.each(function(node){
  1119. // if (this.module.form.stylesList){
  1120. // if (!this.data.formStyleType) this.data.formStyleType = "default";
  1121. // var mode = ( this.form.options.mode || "" ).toLowerCase() === "mobile" ? "mobile" : "pc";
  1122. // Object.each(this.module.form.stylesList, function(s, key){
  1123. // if( s.mode.contains( mode ) ){
  1124. // new Element("option", {
  1125. // "text": s.name,
  1126. // "value": key,
  1127. // "selected": ((!this.data.formStyleType && key=="default") || (this.data.formStyleType==key))
  1128. // }).inject(node)
  1129. // }
  1130. // }.bind(this));
  1131. // }else{
  1132. // node.getParent("tr").setStyle("display", "none");
  1133. // }
  1134. //
  1135. // var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(node, "after");
  1136. // refreshNode.addEvent("click", function(e){
  1137. // _self.changeData(this.get("name"), this );
  1138. // }.bind(node));
  1139. // }.bind(this));
  1140. // },
  1141. loadDivTemplateType: function(){
  1142. var nodes = this.propertyContent.getElements(".MWFDivTemplate");
  1143. if (nodes.length){
  1144. var keys = [];
  1145. //if (this.module.form.stylesList) {
  1146. // if (this.module.form.stylesList[this.module.form.json.formStyleType]){
  1147. // var styles = this.module.form.stylesList[this.module.form.json.formStyleType][this.module.moduleName];
  1148. // if (styles) {
  1149. // Object.each(styles, function (v, k) {
  1150. // keys.push(k);
  1151. // }.bind(this));
  1152. // }
  1153. // }
  1154. //}
  1155. if (this.module.form.templateStyles && this.module.form.templateStyles[this.module.moduleName]) {
  1156. var styles = this.module.form.templateStyles[this.module.moduleName];
  1157. if (styles) {
  1158. Object.each(styles, function (v, k) {
  1159. keys.push(k);
  1160. }.bind(this));
  1161. }
  1162. }
  1163. nodes.each(function(node){
  1164. node.empty();
  1165. new Element("option", {
  1166. "text": "default",
  1167. "value": "default",
  1168. "selected": (!this.data.templateType || this.data.templateType=="default")
  1169. }).inject(node);
  1170. if (keys.length){
  1171. keys.each(function(k){
  1172. new Element("option", {
  1173. "text": styles[k].name,
  1174. "value": k,
  1175. "selected": (this.data.templateType==k)
  1176. }).inject(node)
  1177. }.bind(this));
  1178. }else{
  1179. node.getParent("tr").setStyle("display", "none");
  1180. }
  1181. }.bind(this));
  1182. }
  1183. },
  1184. loadPersonInput: function(){
  1185. var personIdentityNodes = this.propertyContent.getElements(".MWFPersonIdentity");
  1186. var personUnitNodes = this.propertyContent.getElements(".MWFPersonUnit");
  1187. var dutyNodes = this.propertyContent.getElements(".MWFDutySelector");
  1188. var dutyNameNodes = this.propertyContent.getElements(".MWFPersonDuty");
  1189. var viewNodes = this.propertyContent.getElements(".MWFViewSelect");
  1190. var cmsviewNodes = this.propertyContent.getElements(".MWFCMSViewSelect");
  1191. var queryviewNodes = this.propertyContent.getElements(".MWFQueryViewSelect");
  1192. var queryStatementNodes = this.propertyContent.getElements(".MWFQueryStatementSelect");
  1193. var querystatNodes = this.propertyContent.getElements(".MWFQueryStatSelect");
  1194. var fileNodes = this.propertyContent.getElements(".MWFImageFileSelect");
  1195. var processFileNodes = this.propertyContent.getElements(".MWFProcessImageFileSelect");
  1196. var scriptNodes = this.propertyContent.getElements(".MWFScriptSelect");
  1197. var formStyleNodes = this.propertyContent.getElements(".MWFFormStyleSelect");
  1198. var dictionaryNodes = this.propertyContent.getElements(".MWFDictionarySelect");
  1199. MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.PersonSelector", function(){
  1200. personIdentityNodes.each(function(node){
  1201. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1202. "type": "identity",
  1203. "names": this.data[node.get("name")],
  1204. "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
  1205. });
  1206. }.bind(this));
  1207. personUnitNodes.each(function(node){
  1208. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1209. "type": "unit",
  1210. "names": this.data[node.get("name")],
  1211. "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
  1212. });
  1213. }.bind(this));
  1214. dutyNodes.each(function(node){
  1215. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1216. "type": "duty",
  1217. "names": this.data[node.get("name")],
  1218. "onChange": function(ids){this.addDutyItem(node, ids);}.bind(this),
  1219. "onRemoveDuty": function(item){this.removeDutyItem(node, item);}.bind(this)
  1220. });
  1221. }.bind(this));
  1222. dutyNameNodes.each(function(node){
  1223. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1224. "type": "dutyName",
  1225. "names": this.data[node.get("name")],
  1226. "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
  1227. });
  1228. }.bind(this));
  1229. viewNodes.each(function(node){
  1230. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1231. "type": "View",
  1232. "count": 1,
  1233. "names": [this.data[node.get("name")]],
  1234. "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
  1235. });
  1236. }.bind(this));
  1237. cmsviewNodes.each(function(node){
  1238. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1239. "type": "CMSView",
  1240. "count": 1,
  1241. "names": [this.data[node.get("name")]],
  1242. "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
  1243. });
  1244. }.bind(this));
  1245. queryviewNodes.each(function(node){
  1246. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1247. "type": "QueryView",
  1248. "count": 1,
  1249. "names": [this.data[node.get("name")]],
  1250. "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
  1251. });
  1252. }.bind(this));
  1253. queryStatementNodes.each(function(node){
  1254. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1255. "type": "QueryStatement",
  1256. "count": 1,
  1257. "names": [this.data[node.get("name")]],
  1258. "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
  1259. });
  1260. }.bind(this));
  1261. querystatNodes.each(function(node){
  1262. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1263. "type": "QueryStat",
  1264. "count": 1,
  1265. "names": [this.data[node.get("name")]],
  1266. "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
  1267. });
  1268. }.bind(this));
  1269. scriptNodes.each(function(node){
  1270. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1271. "type": "Script",
  1272. "count": node.dataset["count"] || 1,
  1273. "names": (!node.dataset["count"] || node.dataset["count"].toInt()==1) ? [this.data[node.get("name")]] : this.data[node.get("name")],
  1274. "onChange": function(ids){
  1275. this.saveScriptSelectItem(node, ids);
  1276. }.bind(this)
  1277. });
  1278. }.bind(this));
  1279. var _self = this;
  1280. formStyleNodes.each(function(node){
  1281. debugger;
  1282. var data = this.data[node.get("name")];
  1283. if( typeOf( data ) === "string" ){
  1284. for( var key in this.module.form.stylesList ){
  1285. var s = this.module.form.stylesList[key];
  1286. if( ((!data && key=="default") || (data==key)) ){
  1287. data = {
  1288. name : s.name,
  1289. id : key
  1290. };
  1291. break;
  1292. }
  1293. }
  1294. }
  1295. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1296. "type": "FormStyle",
  1297. "count": 1,
  1298. "names": [data],
  1299. "selectorOptions" : {
  1300. "mode" : ( this.form.options.mode || "" ).toLowerCase() === "mobile" ? "mobile" : "pc"
  1301. },
  1302. "validFun" : function (ids) {
  1303. var flag = true;
  1304. if( ids.length === 0 ){
  1305. this.designer.notice(MWF.APPFD.LP.mustSelectFormStyle, "error");
  1306. flag = false;
  1307. }else if( ids[0].data.type === "script" ){
  1308. this.designer.actions.getScriptByName( ids[0].data.name, ids[0].data.application, function( json ) {
  1309. debugger;
  1310. try{
  1311. var f = eval("(function(){\n return "+json.data.text+"\n})");
  1312. var j = f();
  1313. if( typeOf(j) !== "object" ){
  1314. this.designer.notice( MWF.APPFD.LP.notValidJson, "error" );
  1315. flag = false;
  1316. }
  1317. }catch (e) {
  1318. this.designer.notice( MWF.APPFD.LP.notValidJson +":"+ e.message, "error" );
  1319. flag = false;
  1320. }
  1321. }.bind(this), function () {
  1322. flag = false;
  1323. }, false);
  1324. }
  1325. return flag;
  1326. }.bind(this),
  1327. "onChange": function(ids){
  1328. var d = ids[0].data;
  1329. var data;
  1330. if( d.type === "script" ){
  1331. data = {
  1332. "type" : "script",
  1333. "name": d.name,
  1334. "alias": d.alias,
  1335. "id": d.id,
  1336. "appName" : d.appName || d.applicationName,
  1337. "appId": d.appId,
  1338. "application": d.application
  1339. };
  1340. }else{
  1341. data = d.id;
  1342. }
  1343. var name = node.get("name");
  1344. var oldValue = this.data[name];
  1345. this.data[name] = data;
  1346. this.changeData(name, node, oldValue);
  1347. }.bind(this)
  1348. });
  1349. var next = node.getNext();
  1350. if( next && next.get("class") === "MWFScriptSelectRefresh" ){
  1351. var refreshNode = new Element("div", {"styles": this.form.css.propertyRefreshFormNode}).inject(next);
  1352. refreshNode.addEvent("click", function(e){
  1353. _self.changeData(this.get("name"), this );
  1354. }.bind(node));
  1355. }
  1356. }.bind(this));
  1357. dictionaryNodes.each(function(node){
  1358. var data = this.data[node.get("name")];
  1359. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1360. "type": "Dictionary",
  1361. "count": 0,
  1362. "names": typeOf(data)==="array" ? data : [data],
  1363. "onChange": function(ids){
  1364. var data = [];
  1365. var name = node.get("name");
  1366. if( ids.length > 0 ){
  1367. // var d = ids[0].data;
  1368. ids.each( function (id) {
  1369. debugger;
  1370. var d = id.data;
  1371. data.push({
  1372. "type" : "dictionary",
  1373. "name": d.name,
  1374. "alias": d.alias,
  1375. "id": d.id,
  1376. "appName" : d.appName || d.applicationName,
  1377. "appAlias" : d.appAlias || d.applicationAlias,
  1378. "appId": d.appId,
  1379. "application": d.application,
  1380. "appType" : d.appType
  1381. })
  1382. });
  1383. }
  1384. var oldValue = this.data[name];
  1385. this.data[name] = data;
  1386. this.changeData(name, node, oldValue);
  1387. }.bind(this)
  1388. });
  1389. }.bind(this));
  1390. fileNodes.each(function(node){
  1391. var d = this.data[node.get("name")];
  1392. var data = d || {};
  1393. //this.form
  1394. if (d && typeOf(d)==="string"){
  1395. if (this.form.page){
  1396. data = {"id": d, "portal": this.form.application}
  1397. }else{
  1398. data = {"id": d, "application": this.form.application}
  1399. }
  1400. }
  1401. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1402. "type": "PortalFile",
  1403. "count": 1,
  1404. "isImage": true,
  1405. "values": (data.id) ? [data.id] : [],
  1406. "onChange": function(ids){this.saveFileItem(node, ids);}.bind(this)
  1407. });
  1408. }.bind(this));
  1409. processFileNodes.each(function(node){
  1410. var d = this.data[node.get("name")];
  1411. var data = d || {};
  1412. //this.form
  1413. if (d && typeOf(d)==="string"){
  1414. if (this.form.page){
  1415. data = {"id": d, "portal": this.form.application}
  1416. }else{
  1417. data = {"id": d, "application": this.form.application}
  1418. }
  1419. }
  1420. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1421. "type": "ProcessFile",
  1422. "count": 1,
  1423. "isImage": true,
  1424. "values": (data.id) ? [data.id] : [],
  1425. "onChange": function(ids){this.saveFileItem(node, ids);}.bind(this)
  1426. });
  1427. }.bind(this));
  1428. }.bind(this));
  1429. },
  1430. loadDictionaryIncluder : function(){
  1431. var nodes = this.propertyContent.getElements(".MWFDictionaryIncluder");
  1432. if (nodes.length){
  1433. nodes.each(function(node){
  1434. var name = node.get("name");
  1435. MWF.xDesktop.requireApp("process.FormDesigner", "widget.DictionaryIncluder", function(){
  1436. var dictionaryIncluder = new MWF.xApplication.process.FormDesigner.widget.DictionaryIncluder(node, this.designer, {
  1437. "onChange": function(){
  1438. var data = dictionaryIncluder.getData();
  1439. this.data[name] = data;
  1440. }.bind(this)
  1441. });
  1442. dictionaryIncluder.load(this.data[name])
  1443. }.bind(this));
  1444. }.bind(this));
  1445. }
  1446. },
  1447. loadScriptIncluder : function(){
  1448. var nodes = this.propertyContent.getElements(".MWFScriptIncluder");
  1449. if (nodes.length){
  1450. nodes.each(function(node){
  1451. var name = node.get("name");
  1452. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ScriptIncluder", function(){
  1453. var scriptIncluder = new MWF.xApplication.process.FormDesigner.widget.ScriptIncluder(node, this.designer, {
  1454. "onChange": function(){
  1455. var data = scriptIncluder.getData();
  1456. this.data[name] = data;
  1457. }.bind(this)
  1458. });
  1459. scriptIncluder.load(this.data[name])
  1460. }.bind(this));
  1461. }.bind(this));
  1462. }
  1463. },
  1464. saveFileItem: function(node, ids){
  1465. if (ids[0]){
  1466. var file = ids[0].data;
  1467. this.data[node.get("name")] = file;
  1468. }else{
  1469. this.data[node.get("name")] = null;
  1470. }
  1471. this.changeData(node.get("name"));
  1472. },
  1473. saveViewItem: function(node, ids){
  1474. if (ids[0]){
  1475. var view = ids[0].data;
  1476. var data = {
  1477. "name": view.name,
  1478. "alias": view.alias,
  1479. "id": view.id,
  1480. "appName" : view.appName || view.applicationName || view.query,
  1481. "appId": view.appId,
  1482. "application": view.application || view.query
  1483. };
  1484. this.data[node.get("name")] = data;
  1485. }else{
  1486. this.data[node.get("name")] = null;
  1487. }
  1488. if (this.module._checkView) this.module._checkView();
  1489. },
  1490. removeViewItem: function(node, item){
  1491. },
  1492. saveScriptSelectItem: function(node, ids){
  1493. var count = (node.dataset["count"] || 1).toInt();
  1494. if (count==1){
  1495. if (ids[0]){
  1496. var script = ids[0].data;
  1497. var data = {
  1498. "appType": script.appType,
  1499. "type" : "script",
  1500. "name": script.name,
  1501. "alias": script.alias,
  1502. "id": script.id,
  1503. "appName" : script.appName || script.applicationName,
  1504. "appId": script.appId,
  1505. "application": script.application
  1506. };
  1507. var name = node.get("name");
  1508. var oldValue = this.data[name];
  1509. this.data[name] = data;
  1510. // this.changeJsonDate(name, data );
  1511. this.changeData(name, node, oldValue);
  1512. }else{
  1513. // this.data[node.get("name")] = null;
  1514. }
  1515. }else{
  1516. var scriptValues = [];
  1517. ids.each(function(s){
  1518. var scriptValue = {
  1519. "appType": s.data.appType,
  1520. "type" : "script",
  1521. "name": s.data.name,
  1522. "alias": s.data.alias,
  1523. "id": s.data.id,
  1524. "appName" : s.data.appName || s.data.applicationName,
  1525. "appId": s.data.appId,
  1526. "application": s.data.application
  1527. }
  1528. scriptValues.push(scriptValue);
  1529. }.bind(this));
  1530. var name = node.get("name");
  1531. var oldValue = this.data[name];
  1532. this.data[name] = scriptValues;
  1533. this.changeData(name, node, oldValue);
  1534. }
  1535. },
  1536. removeDutyItem: function(node, item){
  1537. if (item.data.id){
  1538. var values = JSON.decode(this.data[node.get("name")] || []);
  1539. var value = values.filter(function(v){
  1540. return v.id == item.data.id;
  1541. });
  1542. value.each(function(v) {
  1543. values = values.erase(v);
  1544. });
  1545. this.data[node.get("name")] = JSON.encode(values);
  1546. }
  1547. item.node.destroy();
  1548. MWF.release(item);
  1549. delete item;
  1550. },
  1551. addDutyItem: function(node, ids){
  1552. var value = this.data[node.get("name")] || "";
  1553. if (!value) value = "[]";
  1554. var values = JSON.decode(value);
  1555. ids.each(function(id){
  1556. if (id.data.dutyId){
  1557. for (var i=0; i<values.length; i++){
  1558. if (values[i].dutyId===id.data.dutyId){
  1559. values[i].name = id.data.name;
  1560. values[i].code = id.data.code;
  1561. break;
  1562. }
  1563. }
  1564. }else{
  1565. id.data.dutyId = new MWF.widget.UUID().toString();
  1566. values.push({"name": id.data.name, "id": id.data.id, "dutyId": id.data.dutyId, "code": id.data.code});
  1567. }
  1568. }.bind(this));
  1569. this.data[node.get("name")] = JSON.encode(values);
  1570. },
  1571. loadFormFieldInput: function(){
  1572. var fieldNodes = this.propertyContent.getElements(".MWFFormFieldPerson");
  1573. MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.PersonSelector", function(){
  1574. fieldNodes.each(function(node){
  1575. new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  1576. "type": "formField",
  1577. "application": this.form.json.application,
  1578. "fieldType": "person",
  1579. "names": this.data[node.get("name")],
  1580. "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
  1581. });
  1582. }.bind(this));
  1583. }.bind(this));
  1584. },
  1585. savePersonItem: function(node, ids){
  1586. var values = [];
  1587. ids.each(function(id){
  1588. values.push(MWF.org.parseOrgData(id.data));
  1589. }.bind(this));
  1590. this.data[node.get("name")] = values;
  1591. },
  1592. loadScriptArea: function(){
  1593. var scriptAreas = this.propertyContent.getElements(".MWFScriptArea");
  1594. var formulaAreas = this.propertyContent.getElements(".MWFFormulaArea");
  1595. this.loadScriptEditor(scriptAreas);
  1596. this.loadScriptEditor(formulaAreas, "formula");
  1597. },
  1598. loadScriptEditor: function(scriptAreas, style){
  1599. scriptAreas.each(function(node){
  1600. var title = node.get("title");
  1601. var name = node.get("name");
  1602. if (!this.data[name]) this.data[name] = {"code": "", "html": ""};
  1603. var scriptContent = this.data[name];
  1604. MWF.require("MWF.widget.ScriptArea", function(){
  1605. var scriptArea = new MWF.widget.ScriptArea(node, {
  1606. "title": title,
  1607. //"maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  1608. "maxObj": this.designer.formContentNode || this.designer.pageContentNode,
  1609. "onChange": function(){
  1610. //this.data[name] = scriptArea.toJson();
  1611. if (!this.data[name]){
  1612. this.data[name] = {"code": "", "html": ""};
  1613. if (this.module.form.scriptDesigner) this.module.form.scriptDesigner.addScriptItem(this.data[name], "code", this.data, name);
  1614. }
  1615. var json = scriptArea.toJson();
  1616. this.data[name].code = json.code;
  1617. //this.data[name].html = json.html;
  1618. }.bind(this),
  1619. "onSave": function(){
  1620. this.designer.saveForm();
  1621. }.bind(this),
  1622. "style": style || "default",
  1623. "runtime": "web"
  1624. });
  1625. scriptArea.load(scriptContent);
  1626. }.bind(this));
  1627. }.bind(this));
  1628. },
  1629. loadCssArea: function(style){
  1630. var cssAreas = this.propertyContent.getElements(".MWFCssArea");
  1631. cssAreas.each(function(node){
  1632. var title = node.get("title");
  1633. var name = node.get("name");
  1634. if (!this.data[name]) this.data[name] = {"code": "", "html": ""};
  1635. var cssContent = this.data[name];
  1636. o2.require("o2.widget.CssArea", function(){
  1637. var cssArea = new o2.widget.CssArea(node, {
  1638. "title": title,
  1639. "maxObj": this.designer.formContentNode || this.designer.pageContentNode,
  1640. "onChange": function(){
  1641. //this.data[name] = scriptArea.toJson();
  1642. if (!this.data[name]){
  1643. this.data[name] = {"code": "", "html": ""};
  1644. if (this.module.form.scriptDesigner) this.module.form.scriptDesigner.addScriptItem(this.data[name], "code", this.data, name);
  1645. }
  1646. var json = cssArea.toJson();
  1647. this.data[name].code = json.code;
  1648. cssArea.isChanged = true;
  1649. //this.data[name].html = json.html;
  1650. }.bind(this),
  1651. "onBlur": function(){
  1652. if (cssArea.isChanged){
  1653. this.changeData(name, node, "");
  1654. cssArea.isChanged = false;
  1655. }
  1656. }.bind(this),
  1657. "onSave": function(){
  1658. this.designer.saveForm();
  1659. }.bind(this),
  1660. "style": style || "default"
  1661. });
  1662. cssArea.load(cssContent);
  1663. }.bind(this));
  1664. }.bind(this));
  1665. },
  1666. loadActionStylesArea: function(){
  1667. var _self = this;
  1668. var actionAreas = this.propertyContent.getElements(".MWFActionStylesArea");
  1669. actionAreas.each(function(node){
  1670. var name = node.get("name");
  1671. var actionStyles = this.data[name];
  1672. MWF.require("MWF.widget.Maplist", function(){
  1673. var maps = [];
  1674. Object.each(actionStyles, function(v, k){
  1675. var mapNode = new Element("div").inject(node);
  1676. mapNode.empty();
  1677. var maplist = new MWF.widget.Maplist(mapNode, {
  1678. "title": k,
  1679. "collapse": true,
  1680. "onChange": function(){
  1681. var oldData = _self.data[name];
  1682. maps.each(function(o){
  1683. _self.data[name][o.key] = o.map.toJson();
  1684. }.bind(this));
  1685. _self.changeData(name, node, oldData);
  1686. }
  1687. });
  1688. maps.push({"key": k, "map": maplist});
  1689. maplist.load(v);
  1690. }.bind(this));
  1691. }.bind(this));
  1692. }.bind(this));
  1693. },
  1694. loadActionArea: function(){
  1695. var actionAreas = this.propertyContent.getElements(".MWFActionArea");
  1696. actionAreas.each(function(node){
  1697. var name = node.get("name");
  1698. var actionContent = this.data[name];
  1699. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function(){
  1700. // debugger;
  1701. // var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, {
  1702. // "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  1703. // "noCreate": true,
  1704. // "noDelete": true,
  1705. // "noCode": true,
  1706. // "onChange": function(){
  1707. // this.data[name] = actionEditor.data;
  1708. // }.bind(this)
  1709. // });
  1710. // actionEditor.load(this.module.defaultToolBarsData);
  1711. var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
  1712. "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  1713. "onChange": function(){
  1714. this.data[name] = actionEditor.data;
  1715. this.changeData(name);
  1716. }.bind(this)
  1717. });
  1718. actionEditor.load(actionContent);
  1719. }.bind(this));
  1720. }.bind(this));
  1721. var actionAreas = this.propertyContent.getElements(".MWFDefaultActionArea");
  1722. actionAreas.each(function(node){
  1723. var name = node.get("name");
  1724. var actionContent = this.data[name] || this.module.defaultToolBarsData;
  1725. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function(){
  1726. var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
  1727. "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  1728. "isSystemTool" : true,
  1729. "noCreate": true,
  1730. "noDelete": false,
  1731. "noCode": true,
  1732. "noReadShow": true,
  1733. "target" : node.get("data-target"),
  1734. "noEditShow": true,
  1735. "onChange": function(){
  1736. this.data[name] = actionEditor.data;
  1737. this.changeData(name);
  1738. }.bind(this)
  1739. });
  1740. actionEditor.load(actionContent);
  1741. // var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, {
  1742. // "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  1743. // "onChange": function(){
  1744. // this.data[name] = actionEditor.data;
  1745. // }.bind(this)
  1746. // });
  1747. // actionEditor.load(actionContent);
  1748. }.bind(this));
  1749. }.bind(this));
  1750. },
  1751. loadMaplist: function(){
  1752. var maplists = this.propertyContent.getElements(".MWFMaplist");
  1753. debugger;
  1754. maplists.each(function(node){
  1755. var title = node.get("title");
  1756. var name = node.get("name");
  1757. var collapse = node.get("collapse");
  1758. var mapObj = this.data[name];
  1759. if (!mapObj) mapObj = {};
  1760. MWF.require("MWF.widget.Maplist", function(){
  1761. node.empty();
  1762. var maplist = new MWF.widget.Maplist(node, {
  1763. "title": title,
  1764. "collapse": (collapse) ? true : false,
  1765. "onChange": function(){
  1766. //this.data[name] = maplist.toJson();
  1767. //
  1768. var oldData = this.data[name];
  1769. this.changeJsonDate(name, maplist.toJson());
  1770. this.changeStyle(name, oldData);
  1771. this.changeData(name);
  1772. }.bind(this),
  1773. "onDelete": function(key){
  1774. debugger;
  1775. this.module.deletePropertiesOrStyles(name, key);
  1776. }.bind(this)
  1777. });
  1778. maplist.load(mapObj);
  1779. this.maplists[name] = maplist;
  1780. }.bind(this));
  1781. }.bind(this));
  1782. },
  1783. //loadPropertyTab: function(){
  1784. // var tabNodes = this.propertyContent.getElements(".MWFTab");
  1785. // if (tabNodes.length){
  1786. // var tmpNode = this.propertyContent.getFirst();
  1787. // var tabAreaNode = new Element("div", {
  1788. // "styles": this.form.css.propertyTabNode
  1789. // }).inject(tmpNode, "before");
  1790. //
  1791. // MWF.require("MWF.widget.Tab", function(){
  1792. // var tab = new MWF.widget.Tab(tabAreaNode, {"style": "formPropertyList"});
  1793. // tab.load();
  1794. // var tabPages = [];
  1795. // tabNodes.each(function(node){
  1796. // if (node.getStyle("display")!="none"){
  1797. // var page = tab.addTab(node, node.get("title"), false);
  1798. // tabPages.push(page);
  1799. // page.contentScrollNode = new Element("div", {"styles": {"height": "100%", "overflow": "hidden"}}).inject(page.contentNodeArea);
  1800. // node.inject(page.contentScrollNode);
  1801. // this.setScrollBar(page.contentScrollNode, "small", null, null);
  1802. // }
  1803. // }.bind(this));
  1804. // tabPages[0].showTab();
  1805. //
  1806. // this.propertyTab = tab;
  1807. //
  1808. // this.designer.resizeNode();
  1809. // }.bind(this), false);
  1810. // }
  1811. //},
  1812. loadPropertyTab: function(){
  1813. var tabNodes = this.propertyContent.getElements(".MWFTab");
  1814. var groupObject = {}; //data-group 属性可以表示不同的分组
  1815. if (tabNodes.length){
  1816. tabNodes.each( function(node){
  1817. var group = node.get("data-group") || "default";
  1818. groupObject[group] = groupObject[group] || [];
  1819. groupObject[group].push( node );
  1820. }.bind(this))
  1821. }
  1822. for( var group in groupObject ){
  1823. if( group === "default" ){
  1824. var tmpNode = this.propertyContent.getFirst();
  1825. var tabAreaNode = new Element("div", {
  1826. "styles": this.form.css.propertyTabNode
  1827. }).inject(tmpNode, "before");
  1828. MWF.require("MWF.widget.Tab", function(){
  1829. var tab = new MWF.widget.Tab(tabAreaNode, {"style": "formPropertyList"});
  1830. tab.load();
  1831. var tabPages = [];
  1832. groupObject["default"].each(function(node){
  1833. if (node.getStyle("display")!="none"){
  1834. var page = tab.addTab(node, node.get("title"), false);
  1835. tabPages.push(page);
  1836. page.contentScrollNode = new Element("div", {"styles": {"height": "100%", "overflow": "hidden"}}).inject(page.contentNodeArea);
  1837. node.inject(page.contentScrollNode);
  1838. this.setScrollBar(page.contentScrollNode, "small", null, null);
  1839. }
  1840. }.bind(this));
  1841. tabPages[0].showTab();
  1842. this.propertyTab = tab;
  1843. this.designer.resizeNode();
  1844. }.bind(this), false);
  1845. }else{
  1846. var tmpNode = groupObject[group][0];
  1847. var tabAreaNode = new Element("div", {
  1848. "styles": this.form.css.propertyTabNode
  1849. }).inject(tmpNode, "before");
  1850. MWF.require("MWF.widget.Tab", function(){
  1851. var tab = new MWF.widget.Tab(tabAreaNode, {"style": tmpNode.get("data-style") || "formPropertyList"});
  1852. tab.load();
  1853. var tabPages = [];
  1854. groupObject[group].each(function(node) {
  1855. var page = tab.addTab(node, node.get("title"), false);
  1856. tabPages.push(page);
  1857. node.store("tab", page);
  1858. if (node.getStyle("display") === "none"){
  1859. page.disableTab( true );
  1860. node.show();
  1861. }
  1862. }.bind(this));
  1863. for( var i=0; i<tabPages.length; i++ ){
  1864. if( !tabPages[i].disabled ){
  1865. tabPages[i].showTab();
  1866. break
  1867. }
  1868. }
  1869. }.bind(this), false);
  1870. }
  1871. }
  1872. },
  1873. setEditNodeEvent: function(){
  1874. var property = this;
  1875. // var inputs = this.process.propertyListNode.getElements(".editTableInput");
  1876. var inputs = this.propertyContent.getElements("input");
  1877. inputs.each(function(input){
  1878. var jsondata = input.get("name");
  1879. if (this.module){
  1880. var id = this.data.pid;
  1881. //var id = this.form.json.id;
  1882. // input.set("name", this.form.options.mode+id+jsondata);
  1883. input.set("name", id+jsondata);
  1884. }
  1885. if (jsondata){
  1886. var inputType = input.get("type").toLowerCase();
  1887. switch (inputType){
  1888. case "radio":
  1889. input.addEvent("change", function(e){
  1890. property.setRadioValue(jsondata, this);
  1891. });
  1892. input.addEvent("blur", function(e){
  1893. property.setRadioValue(jsondata, this);
  1894. });
  1895. input.addEvent("keydown", function(e){
  1896. e.stopPropagation();
  1897. });
  1898. property.setRadioValue(jsondata, input);
  1899. break;
  1900. case "checkbox":
  1901. input.addEvent("change", function(e){
  1902. property.setCheckboxValue(jsondata, this);
  1903. });
  1904. input.addEvent("click", function(e){
  1905. property.setCheckboxValue(jsondata, this);
  1906. });
  1907. input.addEvent("keydown", function(e){
  1908. e.stopPropagation();
  1909. });
  1910. break;
  1911. default:
  1912. input.addEvent("change", function(e){
  1913. property.setValue(jsondata, this.value, this);
  1914. });
  1915. input.addEvent("blur", function(e){
  1916. property.setValue(jsondata, this.value, this);
  1917. });
  1918. input.addEvent("keydown", function(e){
  1919. if (e.code==13){
  1920. property.setValue(jsondata, this.value, this);
  1921. }
  1922. e.stopPropagation();
  1923. });
  1924. }
  1925. }
  1926. }.bind(this));
  1927. var selects = this.propertyContent.getElements("select");
  1928. selects.each(function(select){
  1929. var jsondata = select.get("name");
  1930. if (jsondata){
  1931. select.addEvent("change", function(e){
  1932. property.setSelectValue(jsondata, this);
  1933. });
  1934. //property.setSelectValue(jsondata, select);
  1935. }
  1936. });
  1937. var textareas = this.propertyContent.getElements("textarea");
  1938. textareas.each(function(input){
  1939. var jsondata = input.get("name");
  1940. if (jsondata){
  1941. input.addEvent("change", function(e){
  1942. property.setValue(jsondata, this.value);
  1943. });
  1944. input.addEvent("blur", function(e){
  1945. property.setValue(jsondata, this.value);
  1946. });
  1947. input.addEvent("keydown", function(e){
  1948. e.stopPropagation();
  1949. });
  1950. }
  1951. }.bind(this));
  1952. },
  1953. changeStyle: function(name, oldData){
  1954. this.module.setPropertiesOrStyles(name, oldData);
  1955. },
  1956. changeData: function(name, input, oldValue){
  1957. this.module._setEditStyle(name, input, oldValue);
  1958. },
  1959. changeJsonDate: function(key, value){
  1960. if (typeOf(key)!=="array") key = [key];
  1961. var o = this.data;
  1962. var len = key.length-1;
  1963. key.each(function(n, i){
  1964. if (!o[n]) o[n] = {};
  1965. if (i<len) o = o[n];
  1966. }.bind(this));
  1967. o[key[len]] = value;
  1968. //this.data[key] = value;
  1969. },
  1970. setRadioValue: function(name, input){
  1971. if (input.checked){
  1972. var i = name.indexOf("*");
  1973. var names = (i==-1) ? name.split(".") : name.substr(i+1, name.length).split(".");
  1974. var value = input.value;
  1975. if (value=="false") value = false;
  1976. if (value=="true") value = true;
  1977. var oldValue = this.data;
  1978. for (var idx = 0; idx<names.length; idx++){
  1979. if (!oldValue[names[idx]]){
  1980. oldValue = null;
  1981. break;
  1982. }else{
  1983. oldValue = oldValue[names[idx]];
  1984. }
  1985. }
  1986. // var value = input.value;
  1987. // if (value==="false") value = false;
  1988. // if (value==="true") value = true;
  1989. //var oldValue = this.data[name];
  1990. this.changeJsonDate(names, value);
  1991. this.changeData(name, input, oldValue);
  1992. }
  1993. },
  1994. setCheckboxValue: function(name, input){
  1995. //var id = this.module.json.id;
  1996. //var id = this.form.json.id;
  1997. var id = this.data.pid;
  1998. // var checkboxList = $$("input[name='"+this.form.options.mode+id+name+"']");
  1999. var checkboxList = $$("input[name='"+id+name+"']");
  2000. var values = [];
  2001. checkboxList.each(function(checkbox){
  2002. if (checkbox.get("checked")){
  2003. values.push(checkbox.value);
  2004. }
  2005. });
  2006. var oldValue = this.data[name];
  2007. //this.data[name] = values;
  2008. this.changeJsonDate(name, values);
  2009. this.changeData(name, input, oldValue);
  2010. },
  2011. setSelectValue: function(name, select){
  2012. var idx = select.selectedIndex;
  2013. var options = select.getElements("option");
  2014. var value = "";
  2015. if (options[idx]){
  2016. value = options[idx].get("value");
  2017. }
  2018. var oldValue = this.data[name];
  2019. //this.data[name] = value;
  2020. this.changeJsonDate(name, value);
  2021. this.changeData(name, select, oldValue);
  2022. },
  2023. setValue: function(name, value, obj){
  2024. if (name==="id"){
  2025. if (value!==this.module.json.id) {
  2026. if (!value) {
  2027. this.designer.notice(MWF.APPFD.LP.notNullId, "error", this.module.form.designer.propertyContentArea, {
  2028. x: "right",
  2029. y: "bottom"
  2030. });
  2031. obj.focus();
  2032. return false;
  2033. } else {
  2034. var check = this.module.form.checkModuleId(value, this.module.json.type);
  2035. if (check.elementConflict) {
  2036. this.designer.notice(MWF.APPFD.LP.repetitionsId, "error", this.module.form.designer.propertyContentArea, {
  2037. x: "right",
  2038. y: "bottom"
  2039. });
  2040. obj.focus();
  2041. return false;
  2042. } else {
  2043. var json = this.module.form.json.moduleList[this.module.json.id];
  2044. this.module.form.json.moduleList[value] = json;
  2045. delete this.module.form.json.moduleList[this.module.json.id];
  2046. }
  2047. }
  2048. // if (this.module.form.json.moduleList[value]){
  2049. // this.designer.notice(MWF.APPFD.LP.repetitionsId, "error", this.module.form.designer.propertyContentArea, {x:"right", y:"bottom"});
  2050. // obj.focus();
  2051. // return false;
  2052. // }else{
  2053. // var flag = false;
  2054. // if (this.module.form.subformList){
  2055. // Object.each(this.module.form.subformList, function(o, k){
  2056. // if (o.subformData.moduleList[value] && o.subformData.moduleList[value] ) flag = true;
  2057. // });
  2058. // }
  2059. // if (flag){
  2060. // this.designer.notice(MWF.APPFD.LP.repetitionsId, "error", this.module.form.designer.propertyContentArea, {x:"right", y:"bottom"});
  2061. // obj.focus();
  2062. // return false;
  2063. // }else{
  2064. // var json = this.module.form.json.moduleList[this.module.json.id];
  2065. // this.module.form.json.moduleList[value]=json;
  2066. // delete this.module.form.json.moduleList[this.module.json.id];
  2067. // }
  2068. // }
  2069. }
  2070. }
  2071. //var oldValue = this.data[name];
  2072. var names = name.split(".");
  2073. var oldValue = this.data;
  2074. for (var idx = 0; idx<names.length; idx++){
  2075. if (!oldValue[names[idx]]){
  2076. oldValue = null;
  2077. break;
  2078. }else{
  2079. oldValue = oldValue[names[idx]];
  2080. }
  2081. }
  2082. //this.data[name] = value;
  2083. this.changeJsonDate(names, value);
  2084. this.changeData(name, obj, oldValue);
  2085. },
  2086. setEditNodeStyles: function(node){
  2087. var nodes = node.getChildren();
  2088. if (nodes.length){
  2089. nodes.each(function(el){
  2090. var cName = el.get("class");
  2091. if (cName){
  2092. if (this.form.css[cName]) el.setStyles(this.form.css[cName]);
  2093. }
  2094. this.setEditNodeStyles(el);
  2095. }.bind(this));
  2096. }
  2097. },
  2098. loadScriptInput: function(){
  2099. var scriptNodes = this.propertyContent.getElements(".MWFScript");
  2100. scriptNodes.each(function(node){
  2101. MWF.require("MWF.widget.ScriptEditor", function(){
  2102. var script = new MWF.widget.ScriptEditor(node, {
  2103. "onPostSave": function(script){
  2104. this.saveScriptItem(node, script);
  2105. }.bind(this),
  2106. "onQueryDelete": function(script){
  2107. this.deleteScriptItem(node, script);
  2108. }.bind(this)
  2109. });
  2110. this.setScriptItems(script, node);
  2111. }.bind(this));
  2112. }.bind(this));
  2113. },
  2114. deleteScriptItem: function(node, script){
  2115. var jsondata = node.get("name");
  2116. this.data[jsondata].erase(script.data.id);
  2117. this.process.scripts[script.data.id] = null;
  2118. delete this.process.scripts[script.data.id];
  2119. this.process.process.scriptList.erase(script.data);
  2120. },
  2121. saveScriptItem: function(node, script){
  2122. var jsondata = node.get("name");
  2123. var scriptList = this.data[jsondata];
  2124. var data = script.data;
  2125. var scriptData = this.process.scripts[script.data.id];
  2126. if (!scriptData){
  2127. this.process.process.scriptList.push(data);
  2128. this.process.scripts[script.data.id] = data;
  2129. }
  2130. if (scriptList.indexOf(data.id) == -1){
  2131. this.data[jsondata].push(data.id);
  2132. }
  2133. },
  2134. setScriptItems: function(script, node){
  2135. var jsondata = node.get("name");
  2136. var scriptList = this.data[jsondata];
  2137. scriptList.each(function(id){
  2138. if (id){
  2139. var data = this.process.scripts[id];
  2140. if (data) script.setScriptItem(data);
  2141. }
  2142. }.bind(this));
  2143. }
  2144. });
  2145. MWF.xApplication.process.FormDesigner.PropertyMulti = new Class({
  2146. Extends: MWF.xApplication.process.FormDesigner.Property,
  2147. Implements: [Options, Events],
  2148. initialize: function(form, modules, propertyNode, designer, options){
  2149. this.setOptions(options);
  2150. this.modules = modules;
  2151. this.form = form;
  2152. // this.data = module.json;
  2153. this.data = {};
  2154. this.htmlPath = this.options.path;
  2155. this.designer = designer;
  2156. this.maplists = {};
  2157. this.propertyNode = propertyNode;
  2158. },
  2159. load: function(){
  2160. if (this.fireEvent("queryLoad")){
  2161. MWF.getRequestText(this.htmlPath, function(responseText, responseXML){
  2162. this.htmlString = responseText;
  2163. MWF.require("MWF.widget.JsonTemplate", function(){
  2164. this.fireEvent("postLoad");
  2165. }.bind(this));
  2166. }.bind(this));
  2167. }
  2168. },
  2169. show: function(){
  2170. if (!this.propertyContent){
  2171. if (this.htmlString){
  2172. this.JsonTemplate = new MWF.widget.JsonTemplate({}, this.htmlString);
  2173. this.propertyContent = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.propertyNode);
  2174. this.propertyContent.set("html", this.JsonTemplate.load());
  2175. this.setEditNodeEvent();
  2176. this.setEditNodeStyles(this.propertyContent);
  2177. this.loadPropertyTab();
  2178. this.loadMaplist();
  2179. this.loadScriptArea();
  2180. this.loadTreeData();
  2181. this.loadArrayList();
  2182. //this.loadEventsEditor();
  2183. //this.loadHTMLArea();
  2184. //this.loadJSONArea();
  2185. // this.loadScriptInput();
  2186. //MWF.process.widget.EventsEditor
  2187. }
  2188. }else{
  2189. this.propertyContent.setStyle("display", "block");
  2190. }
  2191. },
  2192. hide: function(){
  2193. if (this.propertyContent) this.propertyContent.destroy();
  2194. },
  2195. changeStyle: function(name){
  2196. this.modules.each(function(module){
  2197. module.setPropertiesOrStyles(name);
  2198. }.bind(this));
  2199. },
  2200. changeData: function(name, input, oldValue){
  2201. this.modules.each(function(module){
  2202. module._setEditStyle(name, input, oldValue);
  2203. }.bind(this));
  2204. },
  2205. changeJsonDate: function(key, value){
  2206. //alert(key+": "+value );
  2207. this.modules.each(function(module){
  2208. module.json[key] = value;
  2209. }.bind(this));
  2210. },
  2211. });