Environment.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. MWF.xScript = MWF.xScript || {};
  2. MWF.xScript.Environment = function(ev){
  3. var _data = ev.data;
  4. var _form = ev.form;
  5. var _forms = ev.forms;
  6. this.library = COMMON;
  7. this.library.version = "4.0";
  8. //data
  9. var getJSONData = function(jData){
  10. return new MWF.xScript.JSONData(jData, function(data, key, _self){
  11. var p = {"getKey": function(){return key;}, "getParent": function(){return _self;}};
  12. while (p && !_forms[p.getKey()]) p = p.getParent();
  13. if (p) if (p.getKey()) if (_forms[p.getKey()]) _forms[p.getKey()].resetData();
  14. });
  15. };
  16. this.setData = function(data){
  17. this.data = getJSONData(data);
  18. this.data.save = function(callback){
  19. form.workAction.saveData(function(json){if (callback) callback();}.bind(this), null, work.id, jData);
  20. }
  21. };
  22. this.setData(_data);
  23. //task
  24. //this.task = ev.task;
  25. //this.task.process = function(routeName, opinion, callback){
  26. // _form.submitWork(routeName, opinion, callback);
  27. //};
  28. //inquiredRouteList
  29. //this.inquiredRouteList = null;
  30. //workContext
  31. this.workContext = {
  32. "getTask": function(){return ev.task;},
  33. "getWork": function(){return ev.work || ev.workCompleted;},
  34. "getActivity": function(){return ev.activity;},
  35. "getTaskList": function(){return ev.taskList;},
  36. "getControl": function(){return ev.control;},
  37. "getWorkLogList": function(){return ev.workLogList;},
  38. "getAttachmentList": function(){return ev.attachmentList;},
  39. "getRouteList": function(){return (ev.task) ? ev.task.routeNameList: null;},
  40. "getInquiredRouteList": function(){return null;},
  41. "setTitle": function(title){
  42. if (!this.workAction){
  43. MWF.require("MWF.xScript.Actions.WorkActions", null, false);
  44. this.workAction = new MWF.xScript.Actions.WorkActions();
  45. }
  46. this.workAction.setTitle(ev.work.id, {"title": title});
  47. }
  48. };
  49. //dict
  50. this.Dict = MWF.xScript.createDict(_form.json.application);
  51. //org
  52. var orgActions = null;
  53. var getOrgActions = function(){
  54. if (!orgActions){
  55. MWF.require("MWF.xScript.Actions.OrgActions", null, false);
  56. orgActions = new MWF.xScript.Actions.OrgActions();
  57. }
  58. };
  59. this.org = {
  60. //options = {
  61. // "name": "职务名称",
  62. // "departmentName": "部门名称",
  63. // "identityName": "身份名称",
  64. // "level": "1",
  65. //
  66. //}
  67. //获取部门指定职务
  68. "getDepartmentDuty": function(options){
  69. getOrgActions();
  70. var v;
  71. orgActions.getDepartmentDutyBydepartmentName(options.name, options.departmentName, function(json){
  72. if (json.data) v = json.data.identityList;
  73. }, null, false);
  74. return v;
  75. },
  76. //"getPersonInfo": function(options){
  77. // getOrgActions();
  78. // var v,p;
  79. // orgActions.getPersonInfo(options.name, function(json){
  80. // if (json.data){
  81. // v = json.data;
  82. // p = v[options.attribute];
  83. // }
  84. // }, null, false);
  85. // return p;
  86. //},
  87. //获取个人基本信息
  88. "getPersonInfo": function(options){
  89. getOrgActions();
  90. var v,p;
  91. orgActions.getPersonInfo(options.name, function(json){
  92. if (json.data){
  93. v = json.data;
  94. p = v[options.attribute];
  95. }
  96. }, null, false);
  97. return p;
  98. },
  99. //获取个人属性
  100. "getPersonAttribute": function(options){
  101. getOrgActions();
  102. var v;
  103. orgActions.getPersonAttribute(options.name, options.personName, function(json){
  104. if (json.data) v = json.data.attributeList;
  105. }, null, false);
  106. return v;
  107. },
  108. //根据个人身份获取部门
  109. "getDepartmentByIdentity": function(options){
  110. getOrgActions();
  111. var v;
  112. orgActions.getDepartmentByIdentity(options.personIdentity, function(json){
  113. v = json.data.name;
  114. }, null, false);
  115. return v;
  116. },
  117. //修改当前人的属性
  118. "updatePersonAttribute": function(options){
  119. getOrgActions();
  120. var attributeList = {"attributeList":options.attributeList};
  121. orgActions.updatePersonAttribute(options.name, attributeList, function(json){
  122. if (success) success(json.data);
  123. }, function(xhr, text, error){
  124. if (failure) failure(xhr, text, error);
  125. }, false);
  126. },
  127. //修改他人属性
  128. "setPersonAttribute": function(options){
  129. getOrgActions();
  130. var attributeList = {"attributeList":options.attributeList};
  131. orgActions.setPersonAttribute(options.name, options.personName, attributeList, function(json){
  132. if (success) success(json.data);
  133. }, function(xhr, text, error){
  134. if (failure) failure(xhr, text, error);
  135. }, false);
  136. },
  137. //获取指定部门的所有上级部门
  138. "listSupDepartmentNested": function(options){
  139. getOrgActions();
  140. var v;
  141. orgActions.listSupDepartmentNested(options.departmentName, function(json){
  142. v = json.data;
  143. }, null, false);
  144. return v;
  145. },
  146. //获取个人所有属性(返回json对象数组)
  147. "listPersonAttribute": function(options){
  148. getOrgActions();
  149. var v;
  150. orgActions.listPersonAttribute(options.personName, function(json){
  151. v = json.data;
  152. }, null, false);
  153. return v;
  154. },
  155. //获取公司(多个)根据人名,返回列表
  156. "listCompanyByPerson": function(options){
  157. getOrgActions();
  158. var v;
  159. orgActions.listCompanyByPerson(options.personName, function(json){
  160. debugger;
  161. v = json.data;
  162. }, null, false);
  163. return v;
  164. },
  165. //获取公司根据身份
  166. "getCompanyByIdentity": function(options){
  167. getOrgActions();
  168. var v;
  169. orgActions.getCompanyByIdentity(options.personIdentity, function(json){
  170. v = json.data.name;
  171. }, null, false);
  172. return v;
  173. },
  174. //列出公司所有属性
  175. "listCompanyAttribute": function(options){
  176. getOrgActions();
  177. var v;
  178. orgActions.listCompanyAttribute(options.compName, function(json){
  179. v = json.data;
  180. }, null, false);
  181. return v;
  182. },
  183. //获取公司指定属性
  184. "getCompanyAttribute": function(options){
  185. getOrgActions();
  186. var v;
  187. orgActions.getCompanyAttribute(options.name, options.compName, function(json){
  188. if (json.data) v = json.data.attributeList;
  189. }, null, false);
  190. return v;
  191. },
  192. //列出公司所有职务
  193. "listCompanyDuty": function(options){
  194. getOrgActions();
  195. var v;
  196. orgActions.listCompanyDuty(options.compName, function(json){
  197. v = json.data;
  198. }, null, false);
  199. return v;
  200. },
  201. //获取公司指定职务
  202. "getCompanyDuty": function(options){
  203. getOrgActions();
  204. var v;
  205. orgActions.getCompanyDuty(options.name, options.compName, function(json){
  206. if (json.data) v = json.data.identityList;
  207. }, null, false);
  208. return v;
  209. },
  210. //列出部门所有属性
  211. "listDepartmentAttribute": function(options){
  212. getOrgActions();
  213. var v;
  214. orgActions.listDepartmentAttribute(options.deptName, function(json){
  215. v = json.data;
  216. }, null, false);
  217. return v;
  218. },
  219. //获取部门指定属性
  220. "getDepartmentAttribute": function(options){
  221. getOrgActions();
  222. var v;
  223. orgActions.getDepartmentAttribute(options.name, options.deptName, function(json){
  224. if (json.data) v = json.data.attributeList;
  225. }, null, false);
  226. return v;
  227. },
  228. //列出部门所有职务
  229. "listDepartmentDuty": function(options){
  230. getOrgActions();
  231. var v;
  232. orgActions.listDepartmentDuty(options.deptName, function(json){
  233. v = json.data;
  234. }, null, false);
  235. return v;
  236. },
  237. //获取部门指定职务
  238. //"getDepartmentDuty": function(options){
  239. // getOrgActions();
  240. // var v;
  241. // orgActions.getDepartmentDuty(options.name, options.deptName, function(json){
  242. // if (json.data) v = json.data.identityList;
  243. // }, null, false);
  244. // return v;
  245. //},
  246. //列出指定部门下的所有身份(直接成员)
  247. "listIdentity": function(options){
  248. getOrgActions();
  249. var v;
  250. orgActions.listIdentity(options.deptName, function(json){
  251. v = json.data;
  252. }, null, false);
  253. return v;
  254. },
  255. //列出指定部门下的所有身份(包括所有下级部门成员)
  256. "listIdentityNested": function(options){
  257. getOrgActions();
  258. var v;
  259. orgActions.listIdentityNested(options.deptName, function(json){
  260. v = json.data;
  261. }, null, false);
  262. return v;
  263. },
  264. //获取指定部门的上级部门
  265. "getSupDepartmentDirect": function(options){
  266. getOrgActions();
  267. var v;
  268. orgActions.getSupDepartmentDirect(options.deptName, function(json){
  269. if (json.data) v = json.data.name;
  270. }, null, false);
  271. return v;
  272. },
  273. //获取指定人员所在的部门
  274. "listDepartmentByPerson": function(options){
  275. getOrgActions();
  276. var v;
  277. orgActions.listDepartmentByPerson(options.personName, function(json){
  278. v = json.data;
  279. }, null, false);
  280. return v;
  281. }
  282. };
  283. this.service = {
  284. "jaxwsClient": {},
  285. "jaxrsClient":{}
  286. };
  287. var lookupAction = null
  288. var getLookupAction = function(callback){
  289. if (!lookupAction){
  290. MWF.require("MWF.xDesktop.Actions.RestActions", function(){
  291. lookupAction = new MWF.xDesktop.Actions.RestActions("", "x_processplatform_assemble_surface", "");
  292. lookupAction.getActions = function(actionCallback){
  293. this.actions = {
  294. //"lookup": {"uri": "/jaxrs/view/flag/{view}/application/flag/{application}"},
  295. //"getView": {"uri": "/jaxrs/view/{id}/design"}
  296. "lookup": {"uri": "/jaxrs/queryview/flag/{view}/application/flag/{application}/execute", "method":"PUT"},
  297. "getView": {"uri": "/jaxrs/queryview/flag/{view}/application/flag/{application}"}
  298. };
  299. if (actionCallback) actionCallback();
  300. }
  301. if (callback) callback();
  302. });
  303. }else{
  304. if (callback) callback();
  305. }
  306. };
  307. this.view = {
  308. "lookup": function(view, callback){
  309. getLookupAction(function(){
  310. lookupAction.invoke({"name": "lookup","async": true, "parameter": {"view": view.view, "application": view.applcation},"success": function(json){
  311. var data = {
  312. "grid": json.data.grid,
  313. "groupGrid": json.data.groupGrid
  314. };
  315. if (callback) callback(data);
  316. }.bind(this)});
  317. }.bind(this));
  318. },
  319. "select": function(view, callback, options){
  320. if (view.view){
  321. var viewJson = {
  322. "application": view.application || "",
  323. "viewName": view.view || "",
  324. "isTitle": view.isTitle || "yes",
  325. "select": view.select || "multi"
  326. };
  327. if (!options) options = {};
  328. var width = options.width || "700";
  329. var height = options.height || "400";
  330. if (layout.mobile){
  331. var size = document.body.getSize();
  332. width = size.x;
  333. height = size.y;
  334. options.style = "viewmobile";
  335. }
  336. width = width.toInt();
  337. height = height.toInt();
  338. var size = _form.app.content.getSize();
  339. var x = (size.x-width)/2;
  340. var y = (size.y-height)/2;
  341. if (x<0) x = 0;
  342. if (y<0) y = 0;
  343. if (layout.mobile){
  344. x = 20;
  345. y = 0;
  346. }
  347. var _self = this;
  348. MWF.require("MWF.xDesktop.Dialog", function(){
  349. var dlg = new MWF.xDesktop.Dialog({
  350. "title": options.title || "select view",
  351. "style": options.style || "view",
  352. "top": y,
  353. "left": x-20,
  354. "fromTop":y,
  355. "fromLeft": x-20,
  356. "width": width,
  357. "height": height,
  358. "html": "<div></div>",
  359. "maskNode": _form.app.content,
  360. "container": _form.app.content,
  361. "buttonList": [
  362. {
  363. "text": MWF.LP.process.button.ok,
  364. "action": function(){
  365. //if (callback) callback(_self.view.selectedItems);
  366. if (callback) callback(_self.view.getData());
  367. this.close();
  368. }
  369. },
  370. {
  371. "text": MWF.LP.process.button.cancel,
  372. "action": function(){this.close();}
  373. }
  374. ]
  375. });
  376. dlg.show();
  377. if (layout.mobile){
  378. var backAction = dlg.node.getElement(".MWF_dialod_Action_back");
  379. var okAction = dlg.node.getElement(".MWF_dialod_Action_ok");
  380. if (backAction) backAction.addEvent("click", function(e){
  381. dlg.close();
  382. }.bind(this));
  383. if (okAction) okAction.addEvent("click", function(e){
  384. //if (callback) callback(this.view.selectedItems);
  385. if (callback) callback(this.view.getData());
  386. dlg.close();
  387. }.bind(this));
  388. }
  389. MWF.xDesktop.requireApp("process.Xform", "widget.View", function(){
  390. this.view = new MWF.xApplication.process.Xform.widget.View(dlg.content.getFirst(), viewJson, {"style": "select"});
  391. }.bind(this));
  392. }.bind(this));
  393. }
  394. }
  395. };
  396. //include 引用脚本
  397. var includedScripts = [];
  398. this.include = function(name, callback){
  399. if (includedScripts.indexOf(name)==-1){
  400. if (!this.scriptAction){
  401. MWF.require("MWF.xScript.Actions.ScriptActions", null, false);
  402. this.scriptAction = new MWF.xScript.Actions.ScriptActions();
  403. }
  404. this.scriptAction.getScriptByName(_form.json.application, name, includedScripts, function(json){
  405. if (json.data){
  406. includedScripts = includedScripts.concat(json.data.importedList);
  407. MWF.Macro.exec(json.data.text, this);
  408. if (callback) callback.apply(this);
  409. }else{
  410. if (callback) callback.apply(this);
  411. }
  412. }.bind(this), null, false);
  413. }else{
  414. if (callback) callback.apply(this);
  415. }
  416. }.bind(this);
  417. this.define = function(name, fun, overwrite){
  418. var over = true;
  419. if (overwrite===false) over = false;
  420. var o = {};
  421. o[name] = {"value": fun, "configurable": over};
  422. MWF.defineProperties(this, o);
  423. }.bind(this);
  424. //仅前台对象-----------------------------------------
  425. //form
  426. this.form = {
  427. "readonly": _form.options.readonly,
  428. "get": function(name){return _form.all[name];},
  429. "getField": function(name){return _forms[name];},
  430. "getAction": function(){return _form.workAction},
  431. "getDesktop": function(){return _form.app.desktop},
  432. "getData": function(){return new MWF.xScript.JSONData(_form.getData());},
  433. "save": function(callback){_form.saveWork(callback);},
  434. "close": function(){_form.closeWork();},
  435. "process": function(option){
  436. if (option){
  437. _form.submitWork(option.routeName, option.opinion, option.callback);
  438. }else{
  439. _form.processWork();
  440. }
  441. },
  442. "reset": function(option){
  443. if (!option){
  444. if (_form.businessData.control["allowReset"]) _form.resetWork();
  445. }else{
  446. _form.resetWorkToPeson(option.names, option.opinion, opinion.success, opinion.failure);
  447. }
  448. },
  449. "retract": function(option){
  450. if (!option){
  451. if (_form.businessData.control["allowRetract"]) _form.retractWork();
  452. }else{
  453. _form.doRetractWork(opinion.success, opinion.failure);
  454. }
  455. },
  456. "print": function(application, form){
  457. _form.printWork(application, form);
  458. },
  459. "deleteWork": function(option){
  460. if (!option){
  461. if (_form.businessData.control["allowDeleteWork"]) _form.deleteWork();
  462. }else{
  463. _form.doDeleteWork(opinion.success, opinion.failure);
  464. }
  465. },
  466. "confirm": function(type, e, title, text, width, height, ok, cancel, callback){
  467. _form.confirm(type, e, title, text, width, height, ok, cancel, callback);
  468. },
  469. "notice": function(content, type, target, where){
  470. _form.notice(content, type, target, where);
  471. },
  472. "addEvent": function(e, f){_form.addEvent(e, f);}
  473. };
  474. this.form.currentRouteName = _form.json.currentRouteName;
  475. this.form.opinion = _form.json.opinion;
  476. this.target = ev.target;
  477. this.event = ev.event;
  478. this.status = ev.status;
  479. this.session = layout.desktop.session;
  480. };
  481. MWF.xScript.JSONData = function(data, callback, key, parent){
  482. var getter = function(data, callback, k, _self){
  483. return function(){return (["array","object"].indexOf(typeOf(data[k]))==-1) ? data[k] : new MWF.xScript.JSONData(data[k], callback, k, _self);};
  484. }
  485. var setter = function(data, callback, k, _self){
  486. return function(v){
  487. data[k] = v;
  488. if (callback) callback(data, k, _self);
  489. }
  490. }
  491. var define = function(){
  492. var o = {};
  493. for (var k in data) o[k] = {"configurable": true, "enumerable": true, "get": getter.apply(this, [data, callback, k, this]),"set": setter.apply(this, [data, callback, k, this])};
  494. o["length"] = {"get": function(){return Object.keys(data).length;}};
  495. MWF.defineProperties(this, o);
  496. var methods = {
  497. "getKey": {"value": function(){ return key; }},
  498. "getParent": {"value": function(){ return parent; }},
  499. "toString": {"value": function() { return data.toString();}},
  500. "add": {"value": function(newKey, newValue, overwrite){
  501. var flag = true;
  502. var type = typeOf(data);
  503. if (type=="array"){
  504. if (arguments.length<2){
  505. data.push(newKey);
  506. newValue = newKey;
  507. newKey = data.length-1;
  508. }else{
  509. debugger;
  510. if (!newKey && newKey!=0){
  511. data.push(newValue);
  512. newKey = data.length-1;
  513. }else{
  514. flag = false;
  515. }
  516. }
  517. if (flag){
  518. var o = {};
  519. o[newKey] = {"configurable": true, "enumerable": true, "get": getter.apply(this, [data, callback, newKey, this]),"set": setter.apply(this, [data, callback, newKey, this])};
  520. MWF.defineProperties(this, o);
  521. }
  522. this[newKey] = newValue;
  523. }else if (type=="object"){
  524. if (!this.hasOwnProperty(newKey)){
  525. data[newKey] = newValue;
  526. if (flag){
  527. var o = {};
  528. o[newKey] = {"configurable": true, "enumerable": true, "get": getter.apply(this, [data, callback, newKey, this]),"set": setter.apply(this, [data, callback, newKey, this])};
  529. MWF.defineProperties(this, o);
  530. }
  531. this[newKey] = newValue;
  532. }else{
  533. if (overwrite) this[newKey] = newValue;
  534. }
  535. }
  536. return this[newKey];
  537. }},
  538. "del": {"value": function(delKey){
  539. if (!this.hasOwnProperty(delKey)) return null;
  540. delete data[newKey];
  541. delete this[newKey];
  542. return this;
  543. }}
  544. }
  545. MWF.defineProperties(this, methods);
  546. //this.getKey = function(){ return key; };
  547. //this.getParent = function(){ return parent; };
  548. //this.toString = function() { return data.toString();};
  549. //this.add = function(newKey, newValue, overwrite){
  550. // var flag = true;
  551. // var type = typeOf(data);
  552. // if (!this.hasOwnProperty(newKey)){
  553. // if (type=="array"){
  554. // if (arguments.length<2){
  555. // data.push(newKey);
  556. // newValue = newKey;
  557. // newKey = data.length-1;
  558. // }else{
  559. // debugger;
  560. // if (!newKey && newKey!=0){
  561. // data.push(newValue);
  562. // newKey = data.length-1;
  563. // }else{
  564. // flag == false;
  565. // }
  566. // }
  567. // }else{
  568. // data[newKey] = newValue;
  569. // }
  570. // //var valueType = typeOf(newValue);
  571. // //var newValueData = newValue;
  572. // //if (valueType=="object" || valueType=="array") newValueData = new MWF.xScript.JSONData(newValue, callback, newKey, this);
  573. // //if (valueType=="null") newValueData = new MWF.xScript.JSONData({}, callback, newKey, this);
  574. // if (flag){
  575. // var o = {};
  576. // o[newKey] = {"configurable": true, "enumerable": true, "get": getter.apply(this, [data, callback, newKey, this]),"set": setter.apply(this, [data, callback, newKey, this])};
  577. // MWF.defineProperties(this, o);
  578. // }
  579. // this[newKey] = newValue;
  580. // }else{
  581. // if (overwrite) this[newKey] = newValue;
  582. // }
  583. //
  584. // //var valueType = typeOf(newValue);
  585. // //var newValueData = newValue;
  586. // //if (valueType=="object" || valueType=="array") newValueData = new MWF.xScript.JSONData(newValue, callback, newKey, this);
  587. // //if (valueType=="null") newValueData = new MWF.xScript.JSONData({}, callback, newKey, this);
  588. // //
  589. // //this[newKey] = newValueData;
  590. //
  591. // return this[newKey];
  592. //};
  593. //this.del = function(delKey){
  594. // if (!this.hasOwnProperty(delKey)) return null;
  595. // delete data[newKey];
  596. // delete this[newKey];
  597. // return this;
  598. //};
  599. }
  600. var type = typeOf(data);
  601. if (type=="object" || type=="array") define.apply(this);
  602. };
  603. MWF.xScript.createDict = function(application){
  604. return function(name){
  605. var applicationId = application;
  606. this.name = name;
  607. MWF.require("MWF.xScript.Actions.DictActions", null, false);
  608. var action = new MWF.xScript.Actions.DictActions();
  609. this.get = function(path, success, failure){
  610. var p = path.replace(/\./g, "/");
  611. var value = null;
  612. action.getDict(applicationId, encodeURIComponent(this.name), p, function(json){
  613. value = json.data;
  614. if (success) success(json.data);
  615. }, function(xhr, text, error){
  616. if (failure) failure(xhr, text, error);
  617. }, false);
  618. return value;
  619. };
  620. this.set = function(path, value, success, failure){
  621. var p = path.replace(/\./g, "/");
  622. action.setDict(applicationId, encodeURIComponent(this.name), p, value, function(json){
  623. if (success) success(json.data);
  624. }, function(xhr, text, error){
  625. if (failure) failure(xhr, text, error);
  626. });
  627. };
  628. this.add = function(path, value, success, failure){
  629. var p = path.replace(/\./g, "/");
  630. action.addDict(applicationId, encodeURIComponent(this.name), p, value, function(json){
  631. if (success) success(json.data);
  632. }, function(xhr, text, error){
  633. if (failure) failure(xhr, text, error);
  634. });
  635. };
  636. this.delete = function(path, success, failure){
  637. var p = path.replace(/\./g, "/");
  638. action.deleteDict(applicationId, encodeURIComponent(this.name), p, function(json){
  639. if (success) success(json.data);
  640. }, function(xhr, text, error){
  641. if (failure) failure(xhr, text, error);
  642. });
  643. };
  644. }
  645. };