Property.js 100 KB

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