CMSEnvironment.js 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720
  1. MWF.xScript = MWF.xScript || {};
  2. MWF.xScript.CMSEnvironment = 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.CMSJSONData(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.documentAction.saveData(function(json){if (callback) callback();}.bind(this), null, ev.document.id, data);
  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.documentContext = {
  32. "getDocument": function(){return ev.document },
  33. "getControl": function(){return ev.control;},
  34. "getAttachmentList": function(){return ev.attachmentList;}
  35. //"setTitle": function(title){
  36. // if (!this.workAction){
  37. // MWF.require("MWF.xScript.Actions.WorkActions", null, false);
  38. // this.workAction = new MWF.xScript.Actions.WorkActions();
  39. // }
  40. // this.workAction.setTitle(ev.work.id, {"title": title});
  41. //}
  42. };
  43. //dict
  44. this.Dict = MWF.xScript.createCMSDict(_form.json.application);
  45. //org
  46. var orgActions = null;
  47. var getOrgActions = function(){
  48. // if (!orgActions){
  49. // MWF.xDesktop.requireApp("Org", "Actions.RestActions", null, false);
  50. // orgActions = new MWF.xApplication.Org.Actions.RestActions ();
  51. // }
  52. if (!orgActions){
  53. MWF.require("MWF.xScript.Actions.UnitActions", null, false);
  54. orgActions = new MWF.xScript.Actions.UnitActions();
  55. }
  56. };
  57. var getNameFlag = function(name){
  58. var t = typeOf(name);
  59. if (t==="array"){
  60. var v = [];
  61. name.each(function(id){
  62. v.push((typeOf(id)==="object") ? (id.distinguishedName || id.id || id.unique || id.name) : id);
  63. });
  64. return v;
  65. }else{
  66. return [(t==="object") ? (name.distinguishedName || name.id || name.unique || name.name) : name];
  67. }
  68. };
  69. this.org = {
  70. //群组***************
  71. //获取群组--返回群组的对象数组
  72. getGroup: function(name){
  73. getOrgActions();
  74. var data = {"groupList": getNameFlag(name)};
  75. var v = null;
  76. orgActions.listGroup(data, function(json){v = json.data;}, null, false);
  77. return (v && v.length===1) ? v[0] : v;
  78. },
  79. //查询下级群组--返回群组的对象数组
  80. //nested 布尔 true嵌套下级;false直接下级;默认false;
  81. listSubGroup: function(name, nested){
  82. getOrgActions();
  83. var data = {"groupList": getNameFlag(name)};
  84. var v = null;
  85. if (nested){
  86. orgActions.listSubGroupNested(data, function(json){v = json.data;}, null, false);
  87. }else{
  88. orgActions.listSubGroupDirect(data, function(json){v = json.data;}, null, false);
  89. }
  90. return v;
  91. },
  92. //查询上级群组--返回群组的对象数组
  93. //nested 布尔 true嵌套上级;false直接上级;默认false;
  94. listSupGroup:function(name, nested){
  95. getOrgActions();
  96. var data = {"groupList": getNameFlag(name)};
  97. var v = null;
  98. if (nested){
  99. orgActions.listSupGroupNested(data, function(json){v = json.data;}, null, false);
  100. }else{
  101. orgActions.listSupGroupDirect(data, function(json){v = json.data;}, null, false);
  102. }
  103. return v;
  104. },
  105. //人员所在群组(嵌套)--返回群组的对象数组
  106. listGroupWithPerson:function(name){
  107. getOrgActions();
  108. var data = {"personList": getNameFlag(name)};
  109. var v = null;
  110. orgActions.listGroupWithPerson(data, function(json){v = json.data;}, null, false);
  111. return v;
  112. },
  113. //群组是否拥有角色--返回true, false
  114. groupHasRole: function(name, role){
  115. getOrgActions();
  116. nameFlag = (typeOf(name)==="object") ? (name.distinguishedName || name.id || name.unique || name.name) : name;
  117. var data = {"group":nameFlag,"roleList":getNameFlag(role)};
  118. var v = false;
  119. orgActions.groupHasRole(data, function(json){v = json.data.value;}, null, false);
  120. return v;
  121. },
  122. //角色***************
  123. //获取角色--返回角色的对象数组
  124. getRole: function(name){
  125. getOrgActions();
  126. var data = {"roleList": getNameFlag(name)};
  127. var v = null;
  128. orgActions.listRole(data, function(json){v = json.data;}, null, false);
  129. return (v && v.length===1) ? v[0] : v;
  130. },
  131. //人员所有角色(嵌套)--返回角色的对象数组
  132. listRoleWithPerson:function(name){
  133. getOrgActions();
  134. var data = {"personList": getNameFlag(name)};
  135. var v = null;
  136. orgActions.listRoleWithPerson(data, function(json){v = json.data;}, null, false);
  137. return v;
  138. },
  139. //人员***************
  140. //人员是否拥有角色--返回true, false
  141. personHasRole: function(name, role){
  142. getOrgActions();
  143. nameFlag = (typeOf(name)==="object") ? (name.distinguishedName || name.id || name.unique || name.name) : name;
  144. var data = {"person":nameFlag,"roleList":getNameFlag(role)};
  145. var v = false;
  146. orgActions.personHasRole(data, function(json){v = json.data.value;}, null, false);
  147. return v;
  148. },
  149. //获取人员--返回人员的对象数组
  150. getPerson: function(name){
  151. getOrgActions();
  152. var data = {"personList": getNameFlag(name)};
  153. var v = null;
  154. orgActions.listPerson(data, function(json){v = json.data;}, null, false);
  155. return (v && v.length===1) ? v[0] : v;;
  156. },
  157. //查询下级人员--返回人员的对象数组
  158. //nested 布尔 true嵌套下级;false直接下级;默认false;
  159. listSubPerson: function(name, nested){
  160. getOrgActions();
  161. var data = {"personList": getNameFlag(name)};
  162. var v = null;
  163. if (nested){
  164. orgActions.listPersonSubNested(data, function(json){v = json.data;}, null, false);
  165. }else{
  166. orgActions.listPersonSubDirect(data, function(json){v = json.data;}, null, false);
  167. }
  168. return v;
  169. },
  170. //查询上级人员--返回人员的对象数组
  171. //nested 布尔 true嵌套上级;false直接上级;默认false;
  172. listSupPerson: function(name, nested){
  173. getOrgActions();
  174. var data = {"personList": getNameFlag(name)};
  175. var v = null;
  176. if (nested){
  177. orgActions.listPersonSupNested(data, function(json){v = json.data;}, null, false);
  178. }else{
  179. orgActions.listPersonSupDirect(data, function(json){v = json.data;}, null, false);
  180. }
  181. return v;
  182. },
  183. //获取群组的所有人员--返回人员的对象数组
  184. listPersonWithGroup: function(name){
  185. getOrgActions();
  186. var data = {"groupList": getNameFlag(name)};
  187. var v = null;
  188. orgActions.listPersonWithGroup(data, function(json){v = json.data;}, null, false);
  189. return v;
  190. },
  191. //获取角色的所有人员--返回人员的对象数组
  192. listPersonWithRole: function(name){
  193. getOrgActions();
  194. var data = {"roleList": getNameFlag(name)};
  195. var v = null;
  196. orgActions.listPersonWithRole(data, function(json){v = json.data;}, null, false);
  197. return v;
  198. },
  199. //获取身份的所有人员--返回人员的对象数组
  200. listPersonWithIdentity: function(name){
  201. getOrgActions();
  202. var data = {"identityList": getNameFlag(name)};
  203. var v = null;
  204. orgActions.listPersonWithIdentity(data, function(json){v = json.data;}, null, false);
  205. return v;
  206. },
  207. //获取身份的所有人员--返回人员的对象数组或人员对象
  208. getPersonWithIdentity: function(name){
  209. getOrgActions();
  210. var data = {"identityList": getNameFlag(name)};
  211. var v = null;
  212. orgActions.listPersonWithIdentity(data, function(json){v = json.data;}, null, false);
  213. return (v && v.length===1) ? v[0] : v;
  214. },
  215. //查询组织成员的人员--返回人员的对象数组
  216. //nested 布尔 true嵌套的所有成员;false直接成员;默认false;
  217. listPersonWithUnit: function(name, nested){
  218. getOrgActions();
  219. var data = {"unitList": getNameFlag(name)};
  220. var v = null;
  221. if (nested){
  222. orgActions.listPersonWithUnitNested(data, function(json){v = json.data;}, null, false);
  223. }else{
  224. orgActions.listPersonWithUnitDirect(data, function(json){v = json.data;}, null, false);
  225. }
  226. return v;
  227. },
  228. //根据属性查询人员--返回人员的对象数组
  229. //name string 属性名
  230. //value string 属性值
  231. listPersonWithAttribute: function(name, value){
  232. getOrgActions();
  233. var data = {"name": name, "attribute": value};
  234. var v = null;
  235. orgActions.listPersonWithAttribute(data, function(json){v = json.data;}, null, false);
  236. return v;
  237. },
  238. //根据属性查询人员--返回人员的全称数组
  239. //name string 属性名
  240. //value string 属性值
  241. listPersonNameWithAttribute: function(name, value){
  242. getOrgActions();
  243. var data = {"name": name, "attribute": value};
  244. var v = null;
  245. orgActions.listPersonWithAttributeValue(data, function(json){v = json.data.personList;}, null, false);
  246. return v;
  247. },
  248. //人员属性************
  249. //添加人员属性值(在属性中添加values值,如果没有此属性,则创建一个)
  250. appendPersonAttribute: function(person, attr, values, success, failure){
  251. getOrgActions();
  252. var personFlag = (typeOf(person)==="object") ? (person.distinguishedName || person.id || person.unique || person.name) : person;
  253. var data = {"attributeList":values,"name":attr,"person":personFlag};
  254. orgActions.appendPersonAttribute(data, function(json){
  255. if (json.data.value){
  256. if (success) success();
  257. }else{
  258. if (failure) failure(null, "", "append values failed");
  259. }
  260. }, function(xhr, text, error){
  261. if (failure) failure(xhr, text, error);
  262. }, false);
  263. },
  264. //设置人员属性值(将属性值修改为values,如果没有此属性,则创建一个)
  265. setPersonAttribute: function(person, attr, values, success, failure){
  266. getOrgActions();
  267. var personFlag = (typeOf(person)==="object") ? (person.distinguishedName || person.id || person.unique || person.name) : person;
  268. var data = {"attributeList":values,"name":attr,"person":personFlag};
  269. orgActions.setPersonAttribute(data, function(json){
  270. if (json.data.value){
  271. if (success) success();
  272. }else{
  273. if (failure) failure(null, "", "append values failed");
  274. }
  275. }, function(xhr, text, error){
  276. if (failure) failure(xhr, text, error);
  277. }, false);
  278. },
  279. //获取人员属性值
  280. getPersonAttribute: function(person, attr){
  281. getOrgActions();
  282. var personFlag = (typeOf(person)==="object") ? (person.distinguishedName || person.id || person.unique || person.name) : person;
  283. var data = {"name":attr,"person":personFlag};
  284. var v = null;
  285. orgActions.getPersonAttribute(data, function(json){v = json.data.attributeList;}, null, false);
  286. return v;
  287. },
  288. //列出人员所有属性的名称
  289. listPersonAttributeName: function(name){
  290. getOrgActions();
  291. var data = {"personList":getNameFlag(name)};
  292. var v = null;
  293. orgActions.listPersonAttributeName(data, function(json){v = json.data.nameList;}, null, false);
  294. return v;
  295. },
  296. //列出人员的所有属性
  297. listPersonAllAttribute: function(name){
  298. getOrgActions();
  299. var data = {"personList":getNameFlag(name)};
  300. var v = null;
  301. orgActions.listPersonAllAttribute(data, function(json){v = json.data;}, null, false);
  302. return v;
  303. },
  304. //身份**********
  305. //获取身份
  306. getIdentity: function(name){
  307. getOrgActions();
  308. var data = {"identityList":getNameFlag(name)};
  309. var v = null;
  310. orgActions.listIdentity(data, function(json){v = json.data;}, null, false);
  311. return (v && v.length===1) ? v[0] : v;
  312. },
  313. //列出人员的身份
  314. listIdentityWithPerson: function(name){
  315. getOrgActions();
  316. var data = {"personList":getNameFlag(name)};
  317. var v = null;
  318. orgActions.listIdentityWithPerson(data, function(json){v = json.data;}, null, false);
  319. return v;
  320. },
  321. //查询组织成员身份--返回身份的对象数组
  322. //nested 布尔 true嵌套的所有成员;false直接成员;默认false;
  323. listIdentityWithUnit: function(name, nested){
  324. getOrgActions();
  325. var data = {"unitList": getNameFlag(name)};
  326. var v = null;
  327. if (nested){
  328. orgActions.listIdentityWithUnitNested(data, function(json){v = json.data;}, null, false);
  329. }else{
  330. orgActions.listIdentityWithUnitDirect(data, function(json){v = json.data;}, null, false);
  331. }
  332. return v;
  333. },
  334. //组织**********
  335. //获取组织
  336. getUnit: function(name){
  337. getOrgActions();
  338. var data = {"unitList":getNameFlag(name)};
  339. var v = null;
  340. orgActions.listUnit(data, function(json){v = json.data;}, null, false);
  341. return (v && v.length===1) ? v[0] : v;
  342. },
  343. //查询组织的下级--返回组织的对象数组
  344. //nested 布尔 true嵌套下级;false直接下级;默认false;
  345. listSubUnit: function(name, nested){
  346. getOrgActions();
  347. var data = {"unitList": getNameFlag(name)};
  348. var v = null;
  349. if (nested){
  350. orgActions.listUnitSubNested(data, function(json){v = json.data;}, null, false);
  351. }else{
  352. orgActions.listUnitSubDirect(data, function(json){v = json.data;}, null, false);
  353. }
  354. return v;
  355. },
  356. //查询组织的上级--返回组织的对象数组
  357. //nested 布尔 true嵌套上级;false直接上级;默认false;
  358. listSupUnit: function(name, nested){
  359. getOrgActions();
  360. var data = {"unitList": getNameFlag(name)};
  361. var v = null;
  362. if (nested){
  363. orgActions.listUnitSupNested(data, function(json){v = json.data;}, null, false);
  364. }else{
  365. orgActions.listUnitSupDirect(data, function(json){v = json.data;}, null, false);
  366. }
  367. return v;
  368. },
  369. //根据个人身份获取组织
  370. //flag 数字 表示获取第几层的组织
  371. // 字符串 表示获取指定类型的组织
  372. // 空 表示获取直接所在的组织
  373. getUnitByIdentity: function(name, flag){
  374. getOrgActions();
  375. var getUnitMethod = "current";
  376. var v;
  377. if (flag){
  378. if (typeOf(flag)==="string") getUnitMethod = "type";
  379. if (typeOf(flag)==="number") getUnitMethod = "level";
  380. }
  381. switch (getUnitMethod){
  382. case "current":
  383. var data = {"identityList":getNameFlag(name)};
  384. orgActions.listUnitWithIdentity(data, function(json){ v = json.data; v=(v&&v.length===1) ? v[0] : v }, null, false);
  385. break;
  386. case "type":
  387. var data = {"identity":(typeOf(name)==="object") ? (name.distinguishedName || name.id || name.unique || name.name) : name,"type":flag};
  388. orgActions.getUnitWithIdentityAndType(data, function(json){ v = json.data; }, null, false);
  389. break;
  390. case "level":
  391. var data = {"identity":(typeOf(name)==="object") ? (name.distinguishedName || name.id || name.unique || name.name) : name,"level":flag};
  392. orgActions.getUnitWithIdentityAndLevel(data, function(json){ v = json.data; }, null, false);
  393. break;
  394. }
  395. return v;
  396. },
  397. //列出身份所在组织的所有上级组织
  398. listAllSupUnitWithIdentity: function(name){
  399. getOrgActions();
  400. var data = {"identityList":getNameFlag(name)};
  401. var v = null;
  402. orgActions.listUnitSupNestedWithIdentity(data, function(json){v = json.data;}, null, false);
  403. return v;
  404. },
  405. //获取人员所在的所有组织
  406. listUnitWithPerson: function(name){
  407. getOrgActions();
  408. var data = {"personList":getNameFlag(name)};
  409. var v = null;
  410. orgActions.listUnitWithPerson(data, function(json){v = json.data;}, null, false);
  411. return v;
  412. },
  413. //列出身份所在组织的所有上级组织
  414. listAllSupUnitWithPerson: function(name){
  415. getOrgActions();
  416. var data = {"personList":getNameFlag(name)};
  417. var v = null;
  418. orgActions.listUnitSupNestedWithPerson(data, function(json){v = json.data;}, null, false);
  419. return v;
  420. },
  421. //根据组织属性,获取所有符合的组织
  422. listUnitWithAttribute: function(name, attribute){
  423. getOrgActions();
  424. var data = {"name":name,"attribute":attribute};
  425. var v = null;
  426. orgActions.listUnitWithAttribute(data, function(json){v = json.data;}, null, false);
  427. return v;
  428. },
  429. //根据组织职务,获取所有符合的组织
  430. listUnitWithDuty: function(name, id){
  431. getOrgActions();
  432. var data = {"name":"","identity":(typeOf(id)==="object") ? (id.distinguishedName || id.id || id.unique || id.name) : id};
  433. var v = null;
  434. orgActions.listUnitWithDuty(data, function(json){v = json.data;}, null, false);
  435. return v;
  436. },
  437. //列出顶层组织
  438. listTopUnit: function(){
  439. var action = MWF.Actions.get("x_organization_assemble_control");
  440. var v = null;
  441. action.listTopUnit(function(json){
  442. v = json.data;
  443. }, null, false);
  444. return v;
  445. },
  446. //组织职务***********
  447. //获取指定的组织职务的身份
  448. getDuty: function(duty, id){
  449. getOrgActions();
  450. var data = {"name":duty,"unit":(typeOf(id)==="object") ? (id.distinguishedName || id.id || id.unique || id.name) : id};
  451. var v = null;
  452. orgActions.getDuty(data, function(json){v = json.data;}, null, false);
  453. return v;
  454. },
  455. //获取身份的所有职务名称
  456. listDutyNameWithIdentity: function(name){
  457. getOrgActions();
  458. var data = {"identityList":getNameFlag(name)};
  459. var v = null;
  460. orgActions.listDutyNameWithIdentity(data, function(json){v = json.data.nameList;}, null, false);
  461. return v;
  462. },
  463. //获取组织的所有职务名称
  464. listDutyNameWithUnit: function(name){
  465. getOrgActions();
  466. var data = {"unitList":getNameFlag(name)};
  467. var v = null;
  468. orgActions.listDutyNameWithUnit(data, function(json){v = json.data.nameList;}, null, false);
  469. return v;
  470. },
  471. //获取组织的所有职务
  472. listUnitAllDuty: function(name){
  473. getOrgActions();
  474. var data = {"unitList":getNameFlag(name)};
  475. var v = null;
  476. orgActions.listUnitAllDuty(data, function(json){v = json.data;}, null, false);
  477. return v;
  478. },
  479. //组织属性**************
  480. //添加组织属性值(在属性中添加values值,如果没有此属性,则创建一个)
  481. appendUnitAttribute: function(unit, attr, values, success, failure){
  482. getOrgActions();
  483. var unitFlag = (typeOf(unit)==="object") ? (unit.distinguishedName || unit.id || unit.unique || unit.name) : unit;
  484. var data = {"attributeList":values,"name":attr,"unit":unitFlag};
  485. orgActions.appendUnitAttribute(data, function(json){
  486. if (json.data.value){
  487. if (success) success();
  488. }else{
  489. if (failure) failure(null, "", "append values failed");
  490. }
  491. }, function(xhr, text, error){
  492. if (failure) failure(xhr, text, error);
  493. }, false);
  494. },
  495. //设置组织属性值(将属性值修改为values,如果没有此属性,则创建一个)
  496. setUnitAttribute: function(unit, attr, values, success, failure){
  497. getOrgActions();
  498. var unitFlag = (typeOf(unit)==="object") ? (unit.distinguishedName || unit.id || unit.unique || unit.name) : unit;
  499. var data = {"attributeList":values,"name":attr,"unit":unitFlag};
  500. orgActions.setUnitAttribute(data, function(json){
  501. if (json.data.value){
  502. if (success) success();
  503. }else{
  504. if (failure) failure(null, "", "append values failed");
  505. }
  506. }, function(xhr, text, error){
  507. if (failure) failure(xhr, text, error);
  508. }, false);
  509. },
  510. //获取组织属性值
  511. getUnitAttribute: function(unit, attr){
  512. getOrgActions();
  513. var unitFlag = (typeOf(unit)==="object") ? (unit.distinguishedName || unit.id || unit.unique || unit.name) : unit;
  514. var data = {"name":attr,"unit":unitFlag};
  515. var v = null;
  516. orgActions.getUnitAttribute(data, function(json){v = json.data.attributeList;}, null, false);
  517. return v;
  518. },
  519. //列出组织所有属性的名称
  520. listUnitAttributeName: function(name){
  521. getOrgActions();
  522. var data = {"unitList":getNameFlag(name)};
  523. var v = null;
  524. orgActions.listUnitAttributeName(data, function(json){v = json.data.nameList;}, null, false);
  525. return v;
  526. },
  527. //列出组织的所有属性
  528. listUnitAllAttribute: function(name){
  529. getOrgActions();
  530. var data = {"unitList":getNameFlag(name)};
  531. var v = null;
  532. orgActions.listUnitAllAttribute(data, function(json){v = json.data;}, null, false);
  533. return v;
  534. }
  535. };
  536. this.Action = (function(){
  537. var actions = [];
  538. return function(root, json){
  539. var action = actions[root] || (actions[root] = new MWF.xDesktop.Actions.RestActions("", root, ""));
  540. action.getActions = function(callback){
  541. if (!this.actions) this.actions = {};
  542. Object.merge(this.actions, json);
  543. if (callback) callback();
  544. };
  545. this.invoke = function(option){
  546. action.invoke(option)
  547. }
  548. }
  549. })();
  550. this.service = {
  551. "jaxwsClient": {},
  552. "jaxrsClient":{}
  553. };
  554. var lookupAction = null;
  555. var getLookupAction = function(callback){
  556. if (!lookupAction){
  557. MWF.require("MWF.xDesktop.Actions.RestActions", function(){
  558. lookupAction = new MWF.xDesktop.Actions.RestActions("", "x_cms_assemble_control", "");
  559. lookupAction.getActions = function(actionCallback){
  560. this.actions = {
  561. "lookup": {"uri": "/jaxrs/queryview/flag/{view}/application/flag/{application}/execute", "method":"PUT"},
  562. "getView": {"uri": "/jaxrs/queryview/flag/{view}/application/flag/{application}"}
  563. };
  564. if (actionCallback) actionCallback();
  565. }
  566. if (callback) callback();
  567. }.bind(this));
  568. }else{
  569. if (callback) callback();
  570. }
  571. };
  572. this.view = {
  573. "lookup": function(view, callback, async){
  574. var filterList = {"filterList": (view.filter || null)};
  575. MWF.Actions.get("x_query_assemble_surface").loadView(view.view, view.application, filterList, function(json){
  576. var data = {
  577. "grid": json.data.grid || json.data.groupGrid,
  578. "groupGrid": json.data.groupGrid
  579. };
  580. if (callback) callback(data);
  581. }, null, async);
  582. },
  583. "lookupV1": function(view, callback){
  584. getLookupAction(function(){
  585. lookupAction.invoke({"name": "lookup","async": true, "parameter": {"view": view.view, "application": view.application},"success": function(json){
  586. var data = {
  587. "grid": json.data.grid,
  588. "groupGrid": json.data.groupGrid
  589. };
  590. if (callback) callback(data);
  591. }.bind(this)});
  592. }.bind(this));
  593. },
  594. "select": function(view, callback, options){
  595. if (view.view){
  596. var viewJson = {
  597. "application": view.application || _form.json.application,
  598. "viewName": view.view || "",
  599. "isTitle": (view.isTitle===false) ? "no" : "yes",
  600. "select": (view.isMulti===false) ? "single" : "multi",
  601. "filter": view.filter
  602. };
  603. if (!options) options = {};
  604. options.width = view.width;
  605. options.height = view.height;
  606. options.title = view.caption;
  607. var width = options.width || "700";
  608. var height = options.height || "400";
  609. if (layout.mobile){
  610. var size = document.body.getSize();
  611. width = size.x;
  612. height = size.y;
  613. options.style = "viewmobile";
  614. }
  615. width = width.toInt();
  616. height = height.toInt();
  617. var size = _form.app.content.getSize();
  618. var x = (size.x-width)/2;
  619. var y = (size.y-height)/2;
  620. if (x<0) x = 0;
  621. if (y<0) y = 0;
  622. if (layout.mobile){
  623. x = 20;
  624. y = 0;
  625. }
  626. var _self = this;
  627. MWF.require("MWF.xDesktop.Dialog", function(){
  628. var dlg = new MWF.xDesktop.Dialog({
  629. "title": options.title || "select view",
  630. "style": options.style || "view",
  631. "top": y,
  632. "left": x-20,
  633. "fromTop":y,
  634. "fromLeft": x-20,
  635. "width": width,
  636. "height": height,
  637. "html": "<div style='height: 100%;'></div>",
  638. "maskNode": _form.app.content,
  639. "container": _form.app.content,
  640. "buttonList": [
  641. {
  642. "text": MWF.LP.process.button.ok,
  643. "action": function(){
  644. //if (callback) callback(_self.view.selectedItems);
  645. if (callback) callback(_self.view.getData());
  646. this.close();
  647. }
  648. },
  649. {
  650. "text": MWF.LP.process.button.cancel,
  651. "action": function(){this.close();}
  652. }
  653. ]
  654. });
  655. dlg.show();
  656. if (layout.mobile){
  657. var backAction = dlg.node.getElement(".MWF_dialod_Action_back");
  658. var okAction = dlg.node.getElement(".MWF_dialod_Action_ok");
  659. if (backAction) backAction.addEvent("click", function(e){
  660. dlg.close();
  661. }.bind(this));
  662. if (okAction) okAction.addEvent("click", function(e){
  663. //if (callback) callback(this.view.selectedItems);
  664. if (callback) callback(this.view.getData());
  665. dlg.close();
  666. }.bind(this));
  667. }
  668. MWF.xDesktop.requireApp("query.Query", "Viewer", function(){
  669. this.view = new MWF.xApplication.query.Query.Viewer(dlg.content.getFirst(), viewJson, {"style": "select"}, _form.app, _form.Macro);
  670. }.bind(this));
  671. }.bind(this));
  672. }
  673. }
  674. };
  675. //var lookupAction = null;
  676. //var getLookupAction = function(callback){
  677. // if (!lookupAction){
  678. // MWF.require("MWF.xDesktop.Actions.RestActions", function(){
  679. // lookupAction = new MWF.xDesktop.Actions.RestActions("", "x_cms_assemble_control", "");
  680. // lookupAction.getActions = function(actionCallback){
  681. // this.actions = {
  682. // "lookup": {"uri": "/jaxrs/queryview/flag/{view}/application/flag/{application}/execute", "method":"PUT"},
  683. // "getView": {"uri": "/jaxrs/queryview/flag/{view}/application/flag/{application}"}
  684. // };
  685. // if (actionCallback) actionCallback();
  686. // }
  687. // if (callback) callback();
  688. // }.bind(this));
  689. // }else{
  690. // if (callback) callback();
  691. // }
  692. //};
  693. //
  694. //this.view = {
  695. // "lookup": function(view, callback){
  696. // getLookupAction(function(){
  697. // lookupAction.invoke({"name": "lookup","async": true, "parameter": {"view": view.view, "application": view.application},"success": function(json){
  698. // var data = {
  699. // "grid": json.data.grid,
  700. // "groupGrid": json.data.groupGrid
  701. // };
  702. // if (callback) callback(data);
  703. // }.bind(this)});
  704. // }.bind(this));
  705. // },
  706. // "select": function(view, callback, options){
  707. // if (view.view){
  708. // var viewJson = {
  709. // "application": view.application || "",
  710. // "viewName": view.view || "",
  711. // "isTitle": view.isTitle || "yes",
  712. // "select": view.select || "multi",
  713. // "title": view.title || "Select View"
  714. // };
  715. // if (!options) options = {};
  716. // var width = options.width || "700";
  717. // var height = options.height || "400";
  718. //
  719. // if (layout.mobile){
  720. // var size = document.body.getSize();
  721. // width = size.x;
  722. // height = size.y;
  723. // options.style = "viewmobile";
  724. // }
  725. // width = width.toInt();
  726. // height = height.toInt();
  727. //
  728. // var size = _form.app.content.getSize();
  729. // var x = (size.x-width)/2;
  730. // var y = (size.y-height)/2;
  731. // if (x<0) x = 0;
  732. // if (y<0) y = 0;
  733. // if (layout.mobile){
  734. // x = 20;
  735. // y = 0;
  736. // }
  737. //
  738. // var _self = this;
  739. // MWF.require("MWF.xDesktop.Dialog", function(){
  740. // var dlg = new MWF.xDesktop.Dialog({
  741. // "title": options.title || "select View",
  742. // "style": options.style || "view",
  743. // "top": y,
  744. // "left": x-20,
  745. // "fromTop":y,
  746. // "fromLeft": x-20,
  747. // "width": width,
  748. // "height": height,
  749. // "html": "<div style='height: 100%;'></div>",
  750. // "maskNode": _form.app.content,
  751. // "container": _form.app.content,
  752. // "buttonList": [
  753. // {
  754. // "text": MWF.LP.process.button.ok,
  755. // "action": function(){
  756. // //if (callback) callback(_self.view.selectedItems);
  757. // if (callback) callback(_self.view.getData());
  758. // this.close();
  759. // }
  760. // },
  761. // {
  762. // "text": MWF.LP.process.button.cancel,
  763. // "action": function(){this.close();}
  764. // }
  765. // ]
  766. // });
  767. // dlg.show();
  768. // if (layout.mobile){
  769. // var backAction = dlg.node.getElement(".MWF_dialod_Action_back");
  770. // var okAction = dlg.node.getElement(".MWF_dialod_Action_ok");
  771. // if (backAction) backAction.addEvent("click", function(e){
  772. // dlg.close();
  773. // }.bind(this));
  774. // if (okAction) okAction.addEvent("click", function(e){
  775. // //if (callback) callback(this.view.selectedItems);
  776. // if (callback) callback(this.view.getData());
  777. // dlg.close();
  778. // }.bind(this));
  779. // }
  780. //
  781. // // MWF.xDesktop.requireApp("cms.Xform", "widget.View", function(){
  782. // // this.view = new MWF.xApplication.cms.Xform.widget.View(dlg.content.getFirst(), viewJson, {"style": "select"});
  783. // // }.bind(this));
  784. // MWF.xDesktop.requireApp("query.Query", "Viewer", function(){
  785. // this.view = new MWF.xApplication.query.Query.Viewer(dlg.content.getFirst(), viewJson, {"style": "select"});
  786. // }.bind(this));
  787. // }.bind(this));
  788. // }
  789. // }
  790. //};
  791. //include 引用脚本
  792. //optionsOrName : {
  793. // type : "", 默认为cms, 可以为 portal process cms
  794. // application : "", 门户/流程/CMS的名称/别名/id, 默认为当前应用
  795. // name : "" // 脚本名称/别名/id
  796. //}
  797. //或者name: "" // 脚本名称/别名/id
  798. // if( !window.includedScripts ){
  799. // var includedScripts = window.includedScripts = [];
  800. // }else{
  801. // var includedScripts = window.includedScripts;
  802. // }
  803. var includedScripts = [];
  804. this.include = function( optionsOrName , callback ){
  805. var options = optionsOrName;
  806. if( typeOf( options ) == "string" ){
  807. options = { name : options };
  808. }
  809. var name = options.name;
  810. var type = ( options.type && options.application ) ? options.type : "cms";
  811. var application = options.application || _form.json.application;
  812. var key = type +"-" + application + "-" + name;
  813. if (includedScripts.indexOf( key )> -1){
  814. if (callback) callback.apply(this);
  815. return;
  816. }
  817. //if (includedScripts.indexOf( name )> -1){
  818. // if (callback) callback.apply(this);
  819. // return;
  820. //}
  821. var scriptAction;
  822. switch ( type ){
  823. case "portal" :
  824. if( this.scriptActionPortal ){
  825. scriptAction = this.scriptActionPortal;
  826. }else{
  827. MWF.require("MWF.xScript.Actions.PortalScriptActions", null, false);
  828. scriptAction = this.scriptActionPortal = new MWF.xScript.Actions.PortalScriptActions();
  829. }
  830. break;
  831. case "process" :
  832. if( this.scriptActionProcess ){
  833. scriptAction = this.scriptActionProcess;
  834. }else{
  835. MWF.require("MWF.xScript.Actions.ScriptActions", null, false);
  836. scriptAction = this.scriptActionProcess = new MWF.xScript.Actions.ScriptActions();
  837. }
  838. break;
  839. case "cms" :
  840. if( this.scriptActionCMS ){
  841. scriptAction = this.scriptActionCMS;
  842. }else{
  843. MWF.require("MWF.xScript.Actions.CMSScriptActions", null, false);
  844. scriptAction = this.scriptActionCMS = new MWF.xScript.Actions.CMSScriptActions();
  845. }
  846. break;
  847. }
  848. scriptAction.getScriptByName( application, name, includedScripts, function(json){
  849. if (json.data){
  850. includedScripts.push( key );
  851. includedScripts = includedScripts.concat(json.data.importedList);
  852. MWF.CMSMacro.exec(json.data.text, this);
  853. if (callback) callback.apply(this);
  854. }else{
  855. if (callback) callback.apply(this);
  856. }
  857. }.bind(this), null, false);
  858. };
  859. //var includedScripts = [];
  860. //this.include = function(name, callback){
  861. // if (includedScripts.indexOf(name)==-1){
  862. // if (!this.scriptAction){
  863. // MWF.require("MWF.xScript.Actions.CMSScriptActions", null, false);
  864. // this.scriptAction = new MWF.xScript.Actions.CMSScriptActions();
  865. // }
  866. // this.scriptAction.getScriptByName(_form.json.application, name, includedScripts, function(json){
  867. // includedScripts = includedScripts.concat(json.data.importedList);
  868. // MWF.CMSMacro.exec(json.data.text, this);
  869. // if (callback) callback.apply(this);
  870. // }.bind(this), null, false);
  871. // }else{
  872. // if (callback) callback.apply(this);
  873. // }
  874. //}.bind(this);
  875. this.define = function(name, fun, overwrite){
  876. var over = true;
  877. if (overwrite===false) over = false;
  878. var o = {};
  879. o[name] = {"value": fun, "configurable": over};
  880. MWF.defineProperties(this, o);
  881. }.bind(this);
  882. //如果前端事件有异步调用,想要在异步调用结束后继续运行页面加载,
  883. //可在调用前执行 var resolve = this.wait();
  884. //在异步调用结束后 执行 resolve.cb();
  885. //目前只有表单的queryload事件支持此方法。
  886. this.wait = function(){
  887. resolve = {};
  888. var setResolve = function(callback){
  889. resolve.cb = callback;
  890. }.bind(this);
  891. this.target.event_resolve = setResolve;
  892. return resolve;
  893. };
  894. //和this.wait配合使用,
  895. //如果没有异步,则resolve.cb方法不存在,
  896. //所以在回调中中使用this.goon();使表单继续加载
  897. this.goon = function(){
  898. this.target.event_resolve = null;
  899. };
  900. //仅前台对象-----------------------------------------
  901. //form
  902. this.form = {
  903. "getInfor": function(){return ev.formInfor;},
  904. "infor": ev.formInfor,
  905. "getApp": function(){return _form.app;},
  906. "app": _form.app,
  907. "node": function(){return _form.node;},
  908. "readonly": _form.options.readonly,
  909. "get": function(name){return (_form.all) ? _form.all[name] : null;},
  910. "getField": function(name){return _forms[name];},
  911. "getAction": function(){return _form.documentAction},
  912. "getData": function(){return new MWF.xScript.CMSJSONData(_form.getData());},
  913. "save": function(callback){
  914. _form.saveDocument(callback);
  915. },
  916. "close": function(){_form.closeDocument();},
  917. "publish": function(option){
  918. _form.publishDocument()
  919. },
  920. //"archive": function(option){
  921. // _form.archiveDocument()
  922. //},
  923. //"redraft": function(option){
  924. // _form.redraftDocument()
  925. //},
  926. "confirm": function(type, title, text, width, height, ok, cancel, callback, mask, style){
  927. // var p = MWF.getCenter({"x": width, "y": height});
  928. // e = {"event": {"clientX": p.x,"x": p.x,"clientY": p.y,"y": p.y}};
  929. // _form.confirm(type, e, title, text, width, height, ok, cancel, callback, mask, style);
  930. if ((arguments.length<=1) || o2.typeOf(arguments[1])==="string"){
  931. var p = MWF.getCenter({"x": width, "y": height});
  932. e = {"event": {"clientX": p.x,"x": p.x,"clientY": p.y,"y": p.y}};
  933. _form.confirm(type, e, title, text, width, height, ok, cancel, callback, mask, style);
  934. }else{
  935. e = (arguments.length>1) ? arguments[1] : null;
  936. title = (arguments.length>2) ? arguments[2] : null;
  937. text = (arguments.length>3) ? arguments[3] : null;
  938. width = (arguments.length>4) ? arguments[4] : null;
  939. height = (arguments.length>5) ? arguments[5] : null;
  940. ok = (arguments.length>6) ? arguments[6] : null;
  941. cancel = (arguments.length>7) ? arguments[7] : null;
  942. callback = (arguments.length>8) ? arguments[8] : null;
  943. mask = (arguments.length>9) ? arguments[9] : null;
  944. style = (arguments.length>10) ? arguments[10] : null;
  945. _form.confirm(type, e, title, text, width, height, ok, cancel, callback, mask, style);
  946. }
  947. },
  948. //"confirm": function(type, e, title, text, width, height, ok, cancel, callback){
  949. // _form.confirm(type, e, title, text, width, height, ok, cancel, callback);
  950. //},
  951. "notice": function(content, type, target, where, offset, option){
  952. _form.notice(content, type, target, where, offset, option);
  953. },
  954. "addEvent": function(e, f){_form.addEvent(e, f);},
  955. "openWork": function(id, completedId, title, options){
  956. var op = options || {};
  957. op.workId = id;
  958. op.workCompletedId = completedId;
  959. op.docTitle = title;
  960. op.appId = "process.Work"+(op.workId || op.workCompletedId);
  961. return layout.desktop.openApplication(this.event, "process.Work", op);
  962. },
  963. "openJob": function(id, choice, options){
  964. var workData = null;
  965. o2.Actions.get("x_processplatform_assemble_surface").listWorkByJob(id, function(json){
  966. if (json.data) workData = json.data;
  967. }.bind(this), null, false);
  968. if (workData){
  969. var len = workData.workList.length + workData.workCompletedList.length;
  970. if (len){
  971. if (len>1 && choice){
  972. var node = new Element("div", {"styles": {"padding": "20px", "width": "500px"}}).inject(_form.node);
  973. workData.workList.each(function(work){
  974. var workNode = new Element("div", {
  975. "styles": {
  976. "background": "#ffffff",
  977. "border-radius": "10px",
  978. "clear": "both",
  979. "margin-bottom": "10px",
  980. "height": "40px",
  981. "padding": "10px 10px"
  982. }
  983. }).inject(node);
  984. var html = "<div style='height: 40px; width: 40px; float: left; background: url(../x_component_process_Xform/$Form/default/icon/work.png) no-repeat center center'></div>" +
  985. "<div style='height: 40px; width: 40px; float: right'><div class='MWFAction' style='height: 20px; width: 40px; margin-top: 10px; border: 1px solid #999999; border-radius: 5px;text-align: center; cursor: pointer'>"+o2.LP.widget.open+"</div></div>"+
  986. "<div style='height: 20px; line-height: 20px; margin: 0px 40px'>"+work.title+"</div>" +
  987. "<div style='margin: 0px 40px'><div style='color:#999999; float: left; margin-right: 10px'>"+work.activityName+"</div>" +
  988. "<div style='color:#999999; float: left; margin-right: 10px'>"+work.activityArrivedTime+"</div>" +
  989. "<div style='color:#999999; float: left; margin-right: 10px'>"+(work.manualTaskIdentityText || "")+"</div></div>";
  990. workNode.set("html", html);
  991. var action = workNode.getElement(".MWFAction");
  992. action.store("work", work);
  993. action.addEvent("click", function(e){
  994. var work = e.target.retrieve("work");
  995. if (work) this.openWork(work.id, null, work.title, options);
  996. dlg.close();
  997. }.bind(this));
  998. }.bind(this));
  999. workData.workCompletedList.each(function(work){
  1000. var workNode = new Element("div", {
  1001. "styles": {
  1002. "background": "#ffffff",
  1003. "border-radius": "10px",
  1004. "clear": "both",
  1005. "margin-bottom": "10px",
  1006. "height": "40px",
  1007. "padding": "10px 10px"
  1008. }
  1009. }).inject(node);
  1010. var html = "<div style='height: 40px; width: 40px; float: left; background: url(../x_component_process_Xform/$Form/default/icon/work.png) no-repeat center center'></div>" +
  1011. "<div style='height: 40px; width: 40px; float: right'><div class='MWFAction' style='height: 20px; width: 40px; margin-top: 10px; border: 1px solid #999999; border-radius: 5px;text-align: center; cursor: pointer'>"+o2.LP.widget.open+"</div></div>"+
  1012. "<div style='height: 20px; line-height: 20px; margin: 0px 40px'>"+work.title+"</div>" +
  1013. "<div style='margin: 0px 40px'><div style='color:#999999; float: left; margin-right: 10px'>"+o2.LP.widget.workcompleted+"</div>" +
  1014. "<div style='color:#999999; float: left; margin-right: 10px'>"+work.completedTime+"</div>";
  1015. workNode.set("html", html);
  1016. var action = workNode.getElement(".MWFAction");
  1017. action.store("work", work);
  1018. action.addEvent("click", function(e){
  1019. var work = e.target.retrieve("work");
  1020. if (work) this.openWork(null, work.id, work.title, options);
  1021. dlg.close();
  1022. }.bind(this));
  1023. }.bind(this));
  1024. var height = node.getSize().y+20;
  1025. if (height>600) height = 600;
  1026. var dlg = o2.DL.open({
  1027. "title": o2.LP.widget.choiceWork,
  1028. "style" : "user",
  1029. "isResize": false,
  1030. "content": node,
  1031. "buttonList": [
  1032. {
  1033. "type" : "cancel",
  1034. "text": o2.LP.widget.close,
  1035. "action": function(){dlg.close();}
  1036. }
  1037. ]
  1038. });
  1039. }else{
  1040. if (workData.workList.length){
  1041. var work = workData.workList[0];
  1042. return this.openWork(work.id, null, work.title, options);
  1043. }else{
  1044. var work = workData.workCompletedList[0];
  1045. return this.openWork(null, work.id, work.title, options);
  1046. }
  1047. }
  1048. }
  1049. }
  1050. },
  1051. "openDocument": function(id, title, options){
  1052. var op = options || {};
  1053. op.documentId = id;
  1054. op.docTitle = title;
  1055. layout.desktop.openApplication(this.event, "cms.Document", op);
  1056. },
  1057. "openPortal": function(name, page, par){
  1058. var action = MWF.Actions.get("x_portal_assemble_surface");
  1059. action.getApplication(name, function(json){
  1060. if (json.data){
  1061. if (page){
  1062. action.getPageByName(page, json.data.id, function(pageJson){
  1063. layout.desktop.openApplication(null, "portal.Portal", {
  1064. "portalId": json.data.id,
  1065. "pageId": (pageJson.data) ? pageJson.data.id : "",
  1066. "parameters": par,
  1067. "appId": "portal.Portal"+json.data.id
  1068. })
  1069. });
  1070. }else{
  1071. layout.desktop.openApplication(null, "portal.Portal", {
  1072. "portalId": json.data.id,
  1073. "parameters": par,
  1074. "appId": "portal.Portal"+json.data.id
  1075. })
  1076. }
  1077. }
  1078. });
  1079. },
  1080. "openCMS": function(name){
  1081. var action = MWF.Actions.get("x_cms_assemble_control");
  1082. action.getColumn(name, function(json){
  1083. if (json.data){
  1084. layout.desktop.openApplication(null, "cms.Module", {
  1085. "columnId": json.data.id,
  1086. "appId": "cms.Module"+json.data.id
  1087. });
  1088. }
  1089. });
  1090. },
  1091. "openProcess": function(name){
  1092. var action = MWF.Actions.get("x_processplatform_assemble_surface");
  1093. action.getApplication(name, function(json){
  1094. if (json.data){
  1095. layout.desktop.openApplication(null, "process.Application", {
  1096. "id": json.data.id,
  1097. "appId": "process.Application"+json.data.id
  1098. });
  1099. }
  1100. });
  1101. },
  1102. "openApplication":function(name, options){
  1103. layout.desktop.openApplication(null, name, options);
  1104. },
  1105. "createDocument": function (columnOrOptions, category, data, identity, callback, target, latest, selectColumnEnable, ignoreTitle) {
  1106. var column = columnOrOptions;
  1107. var onAfterPublish, onPostPublish;
  1108. if (typeOf(columnOrOptions) == "object") {
  1109. column = columnOrOptions.column;
  1110. category = columnOrOptions.category;
  1111. data = columnOrOptions.data;
  1112. identity = columnOrOptions.identity;
  1113. callback = columnOrOptions.callback;
  1114. target = columnOrOptions.target;
  1115. latest = columnOrOptions.latest;
  1116. selectColumnEnable = columnOrOptions.selectColumnEnable;
  1117. ignoreTitle = columnOrOptions.ignoreTitle;
  1118. onAfterPublish = columnOrOptions.onAfterPublish;
  1119. onPostPublish = columnOrOptions.onPostPublish;
  1120. }
  1121. if (target) {
  1122. if (layout.app && layout.app.inBrowser) {
  1123. layout.app.content.empty();
  1124. layout.app = null;
  1125. }
  1126. }
  1127. MWF.xDesktop.requireApp("cms.Index", "Newer", function () {
  1128. var starter = new MWF.xApplication.cms.Index.Newer(null, null, _form.app, null, {
  1129. "documentData": data,
  1130. "identity": identity,
  1131. "ignoreTitle": ignoreTitle === true,
  1132. "ignoreDrafted": latest === false,
  1133. "selectColumnEnable": !category || selectColumnEnable === true,
  1134. "restrictToColumn": !!category && selectColumnEnable !== true,
  1135. "categoryFlag": category, //category id or name
  1136. "columnFlag": column, //column id or name,
  1137. "onStarted": function (documentId, data) {
  1138. if (callback) callback();
  1139. },
  1140. "onPostPublish": function () {
  1141. if(onPostPublish)onPostPublish();
  1142. },
  1143. "onAfterPublish": function () {
  1144. if(onAfterPublish)onAfterPublish();
  1145. }
  1146. });
  1147. starter.load();
  1148. })
  1149. },
  1150. "startProcess": function(app, process, data, identity, callback, target, latest){
  1151. if (arguments.length>2){
  1152. for (var i=2; i<arguments.length; i++){
  1153. if (typeOf(arguments[i])=="boolean"){
  1154. target = arguments[i];
  1155. break;
  1156. }
  1157. }
  1158. }
  1159. if (target){
  1160. if (layout.app && layout.app.inBrowser){
  1161. //layout.app.content.empty();
  1162. layout.app.$openWithSelf = true;
  1163. }
  1164. }
  1165. var action = MWF.Actions.get("x_processplatform_assemble_surface").getProcessByName(process, app, function(json){
  1166. if (json.data){
  1167. MWF.xDesktop.requireApp("process.TaskCenter", "ProcessStarter", function(){
  1168. var starter = new MWF.xApplication.process.TaskCenter.ProcessStarter(json.data, _form.app, {
  1169. "workData": data,
  1170. "identity": identity,
  1171. "latest": latest,
  1172. "onStarted": function(data, title, processName){
  1173. var currentTask = [];
  1174. data.each(function(work){
  1175. if (work.currentTaskIndex != -1) currentTask.push(work.taskList[work.currentTaskIndex].work);
  1176. }.bind(this));
  1177. if (currentTask.length==1){
  1178. var options = {"workId": currentTask[0], "appId": currentTask[0]};
  1179. layout.desktop.openApplication(null, "process.Work", options);
  1180. }else{}
  1181. if (callback) callback(data);
  1182. }.bind(this)
  1183. });
  1184. starter.load();
  1185. }.bind(this));
  1186. }
  1187. });
  1188. }
  1189. };
  1190. this.target = ev.target;
  1191. this.event = ev.event;
  1192. this.status = ev.status;
  1193. this.session = layout.desktop.session;
  1194. this.Actions = o2.Actions;
  1195. this.query = function(option){
  1196. // options = {
  1197. // "name": "statementName",
  1198. // "data": "json data",
  1199. // "firstResult": 1,
  1200. // "maxResults": 100,
  1201. // "success": function(){},
  1202. // "error": function(){},
  1203. // "async": true or false, default is true
  1204. // }
  1205. if (option){
  1206. var json = (option.data) || {};
  1207. if (option.firstResult) json.firstResult = option.firstResult.toInt();
  1208. if (option.maxResults) json.maxResults = option.maxResults.toInt();
  1209. o2.Actions.get("x_query_assemble_surface").executeStatement(option.name, json, success, error, options.async);
  1210. }
  1211. };
  1212. this.Table = MWF.xScript.createTable();
  1213. };
  1214. MWF.xScript.createTable = function(){
  1215. return function(name){
  1216. this.name = name;
  1217. this.action = o2.Actions.get("x_query_assemble_surface");
  1218. this.listRowNext = function(id, count, success, error, async){
  1219. this.action.listRowNext(this.name, id, count, success, error, async);
  1220. };
  1221. this.listRowPrev = function(id, count, success, error, async){
  1222. this.action.listRowPrev(this.name, id, count, success, error, async);
  1223. };
  1224. this.listRowPrev = function(id, count, success, error, async){
  1225. this.action.listRowPrev(this.name, id, count, success, error, async);
  1226. };
  1227. this.listRowSelectWhere = function(where, success, error, async){
  1228. this.action.listRowSelectWhere(this.name, where, success, error, async);
  1229. };
  1230. this.listRowCountWhere = function(where, success, error, async){
  1231. this.action.listRowCountWhere(this.name, where, success, error, async);
  1232. };
  1233. this.deleteRow = function(id, success, error, async){
  1234. this.action.deleteRow(this.name, id, success, error, async);
  1235. };
  1236. this.deleteAllRow = function(success, error, async){
  1237. this.action.deleteAllRow(this.name, success, error, async);
  1238. };
  1239. this.getRow = function(id, success, error, async){
  1240. this.action.getRow(this.name, id, success, error, async);
  1241. };
  1242. this.insertRow = function(data, success, error, async){
  1243. this.action.insertRow(this.name, data, success, error, async);
  1244. };
  1245. this.updateRow = function(id, data, success, error, async){
  1246. this.action.updateRow(this.name, id, data, success, error, async);
  1247. };
  1248. }
  1249. };
  1250. MWF.xScript.CMSJSONData = function(data, callback, key, parent){
  1251. var getter = function(data, callback, k, _self){
  1252. return function(){return (["array","object"].indexOf(typeOf(data[k]))===-1) ? data[k] : new MWF.xScript.CMSJSONData(data[k], callback, k, _self);};
  1253. };
  1254. var setter = function(data, callback, k, _self){
  1255. return function(v){
  1256. data[k] = v;
  1257. //debugger;
  1258. //this.add(k, v, true);
  1259. if (callback) callback(data, k, _self);
  1260. }
  1261. };
  1262. var define = function(){
  1263. var o = {};
  1264. 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])};
  1265. o["length"] = {"get": function(){return Object.keys(data).length;}};
  1266. MWF.defineProperties(this, o);
  1267. var methods = {
  1268. "getKey": {"value": function(){ return key; }},
  1269. "getParent": {"value": function(){ return parent; }},
  1270. "toString": {"value": function() { return data.toString();}},
  1271. "add": {"value": function(newKey, newValue, overwrite){
  1272. var flag = true;
  1273. var type = typeOf(data);
  1274. if (type==="array"){
  1275. if (arguments.length<2){
  1276. data.push(newKey);
  1277. newValue = newKey;
  1278. newKey = data.length-1;
  1279. }else{
  1280. if (!newKey && newKey!==0){
  1281. data.push(newValue);
  1282. newKey = data.length-1;
  1283. }else{
  1284. flag = false;
  1285. }
  1286. }
  1287. if (flag){
  1288. var o = {};
  1289. o[newKey] = {"configurable": true, "enumerable": true, "get": getter.apply(this, [data, callback, newKey, this]),"set": setter.apply(this, [data, callback, newKey, this])};
  1290. MWF.defineProperties(this, o);
  1291. }
  1292. this[newKey] = newValue;
  1293. }else if (type==="object"){
  1294. if (!this.hasOwnProperty(newKey)){
  1295. data[newKey] = newValue;
  1296. if (flag){
  1297. var o = {};
  1298. o[newKey] = {"configurable": true, "enumerable": true, "get": getter.apply(this, [data, callback, newKey, this]),"set": setter.apply(this, [data, callback, newKey, this])};
  1299. MWF.defineProperties(this, o);
  1300. }
  1301. this[newKey] = newValue;
  1302. }else{
  1303. if (overwrite) this[newKey] = newValue;
  1304. }
  1305. }
  1306. return this[newKey];
  1307. }},
  1308. "del": {"value": function(delKey){
  1309. if (!this.hasOwnProperty(delKey)) return null;
  1310. delete data[delKey];
  1311. delete this[delKey];
  1312. return this;
  1313. }}
  1314. };
  1315. MWF.defineProperties(this, methods);
  1316. //this.getKey = function(){ return key; };
  1317. //this.getParent = function(){ return parent; };
  1318. //this.toString = function() { return data.toString();};
  1319. //this.add = function(newKey, newValue, overwrite){
  1320. // var flag = true;
  1321. // var type = typeOf(data);
  1322. // if (!this.hasOwnProperty(newKey)){
  1323. // if (type=="array"){
  1324. // if (arguments.length<2){
  1325. // data.push(newKey);
  1326. // newValue = newKey;
  1327. // newKey = data.length-1;
  1328. // }else{
  1329. // debugger;
  1330. // if (!newKey && newKey!=0){
  1331. // data.push(newValue);
  1332. // newKey = data.length-1;
  1333. // }else{
  1334. // flag == false;
  1335. // }
  1336. // }
  1337. // }else{
  1338. // data[newKey] = newValue;
  1339. // }
  1340. // //var valueType = typeOf(newValue);
  1341. // //var newValueData = newValue;
  1342. // //if (valueType=="object" || valueType=="array") newValueData = new MWF.xScript.JSONData(newValue, callback, newKey, this);
  1343. // //if (valueType=="null") newValueData = new MWF.xScript.JSONData({}, callback, newKey, this);
  1344. // if (flag){
  1345. // var o = {};
  1346. // o[newKey] = {"configurable": true, "enumerable": true, "get": getter.apply(this, [data, callback, newKey, this]),"set": setter.apply(this, [data, callback, newKey, this])};
  1347. // MWF.defineProperties(this, o);
  1348. // }
  1349. // this[newKey] = newValue;
  1350. // }else{
  1351. // if (overwrite) this[newKey] = newValue;
  1352. // }
  1353. //
  1354. // //var valueType = typeOf(newValue);
  1355. // //var newValueData = newValue;
  1356. // //if (valueType=="object" || valueType=="array") newValueData = new MWF.xScript.JSONData(newValue, callback, newKey, this);
  1357. // //if (valueType=="null") newValueData = new MWF.xScript.JSONData({}, callback, newKey, this);
  1358. // //
  1359. // //this[newKey] = newValueData;
  1360. //
  1361. // return this[newKey];
  1362. //};
  1363. //this.del = function(delKey){
  1364. // if (!this.hasOwnProperty(delKey)) return null;
  1365. // delete data[newKey];
  1366. // delete this[newKey];
  1367. // return this;
  1368. //};
  1369. };
  1370. var type = typeOf(data);
  1371. if (type==="object" || type==="array") define.apply(this);
  1372. };
  1373. //MWF.xScript.CMSJSONData = function(data, callback, key, parent){
  1374. // var getter = function(data, callback, k, _self){
  1375. // return function(){return (["array","object"].indexOf(typeOf(data[k]))==-1) ? data[k] : new MWF.xScript.CMSJSONData(data[k], callback, k, _self);};
  1376. // }
  1377. // var setter = function(data, callback, k, _self){
  1378. // return function(v){
  1379. // data[k] = v;
  1380. // if (callback) callback(data, k, _self);
  1381. // }
  1382. // }
  1383. // var define = function(){
  1384. // var o = {};
  1385. // for (var k in data) o[k] = {
  1386. // "configurable": true,
  1387. // "get": getter.apply(this, [data, callback, k, this]),
  1388. // "set": setter.apply(this, [data, callback, k, this])
  1389. // };
  1390. // o["length"] = {"get": function(){return Object.keys(data).length;}};
  1391. // MWF.defineProperties(this, o);
  1392. // this.getKey = function(){ return key; };
  1393. // this.getParent = function(){ return parent; };
  1394. // this.toString = function() { return data.toString();};
  1395. // this.add = function(newKey, newValue){
  1396. // var type = typeOf(data);
  1397. // if (!this.hasOwnProperty(newKey)){
  1398. // if (type=="array"){
  1399. // data.push(newValue || {});
  1400. // newKey = data.length-1;
  1401. // }else{
  1402. // data[newKey] = newValue || {};
  1403. // }
  1404. // var o = {};
  1405. // o[newKey] = {"configurable": true, "get": getter.apply(this, [data, callback, newKey, this]),"set": setter.apply(this, [data, callback, newKey, this])};
  1406. // MWF.defineProperties(this, o);
  1407. // }
  1408. // this[newKey] = newValue;
  1409. // return this;
  1410. // };
  1411. // this.del = function(delKey){
  1412. // if (!this.hasOwnProperty(delKey)) return null;
  1413. // delete data[newKey];
  1414. // delete this[newKey];
  1415. // return this;
  1416. // };
  1417. // }
  1418. // var type = typeOf(data);
  1419. // if (type=="object" || type=="array") define.apply(this);
  1420. //};
  1421. //MWF.xScript.createCMSDict = function(application){
  1422. // return function(name){
  1423. // var applicationId = application;
  1424. // this.name = name;
  1425. // MWF.require("MWF.xScript.Actions.CMSDictActions", null, false);
  1426. // var action = new MWF.xScript.Actions.CMSDictActions();
  1427. //
  1428. // this.get = function(path, success, failure){
  1429. // var value = null;
  1430. // if( path ){
  1431. // var arr = path.split(/\./g);
  1432. // var ar = arr.map(function(v){
  1433. // return encodeURIComponent(v);
  1434. // });
  1435. // //var p = path.replace(/\./g, "/");
  1436. // var p = ar.join("/");
  1437. // action.getDict(applicationId, encodeURIComponent(this.name), p, function(json){
  1438. // value = json.data;
  1439. // if (success) success(json.data);
  1440. // }, function(xhr, text, error){
  1441. // if (failure) failure(xhr, text, error);
  1442. // }, false);
  1443. // }else{
  1444. // action.getDictWhole(applicationId, encodeURIComponent(this.name), function(json){
  1445. // value = json.data;
  1446. // if (success) success(json.data);
  1447. // }, function(xhr, text, error){
  1448. // if (failure) failure(xhr, text, error);
  1449. // }, false);
  1450. // }
  1451. // return value;
  1452. // };
  1453. //
  1454. // this.set = function(path, value, success, failure){
  1455. // var p = path.replace(/\./g, "/");
  1456. // action.setDict(applicationId, encodeURIComponent(this.name), p, value, function(json){
  1457. // if (success) success(json.data);
  1458. // }, function(xhr, text, error){
  1459. // if (failure) failure(xhr, text, error);
  1460. // });
  1461. // };
  1462. // this.add = function(path, value, success, failure){
  1463. // var p = path.replace(/\./g, "/");
  1464. // action.addDict(applicationId, encodeURIComponent(this.name), p, value, function(json){
  1465. // if (success) success(json.data);
  1466. // }, function(xhr, text, error){
  1467. // if (failure) failure(xhr, text, error);
  1468. // });
  1469. // };
  1470. // this["delete"] = function(path, success, failure){
  1471. // var p = path.replace(/\./g, "/");
  1472. // action.deleteDict(applicationId, encodeURIComponent(this.name), p, function(json){
  1473. // if (success) success(json.data);
  1474. // }, function(xhr, text, error){
  1475. // if (failure) failure(xhr, text, error);
  1476. // });
  1477. // };
  1478. // this.destory = this["delete"];
  1479. // }
  1480. //};
  1481. var dictLoaded = {};
  1482. MWF.xScript.createDict = function(application){
  1483. //optionsOrName : {
  1484. // type : "", //默认为process, 可以为 process cms
  1485. // application : "", //流程/CMS的名称/别名/id, 默认为当前应用
  1486. // name : "", // 数据字典名称/别名/id
  1487. // enableAnonymous : false //允许在未登录的情况下读取CMS的数据字典
  1488. //}
  1489. //或者name: "" // 数据字典名称/别名/id
  1490. return function(optionsOrName){
  1491. var options = optionsOrName;
  1492. if( typeOf( options ) == "string" ){
  1493. options = { name : options };
  1494. }
  1495. var name = this.name = options.name;
  1496. var type = ( options.type && options.application ) ? options.type : "process";
  1497. var applicationId = options.application || application;
  1498. var enableAnonymous = options.enableAnonymous || false;
  1499. var key = name+type+applicationId+enableAnonymous
  1500. if (!dictLoaded[key]) dictLoaded[key] = {};
  1501. this.dictData = dictLoaded[key];
  1502. //MWF.require("MWF.xScript.Actions.DictActions", null, false);
  1503. if( type == "cms" ){
  1504. var action = MWF.Actions.get("x_cms_assemble_control");
  1505. }else{
  1506. var action = MWF.Actions.get("x_processplatform_assemble_surface");
  1507. }
  1508. var encodePath = function( path ){
  1509. var arr = path.split(/\./g);
  1510. var ar = arr.map(function(v){
  1511. return encodeURIComponent(v);
  1512. });
  1513. return ar.join("/");
  1514. };
  1515. this.get = function(path, success, failure, async){
  1516. var value = null;
  1517. if (path){
  1518. if (this.dictData[path]){
  1519. if (success) success(this.dictData[path]);
  1520. return this.dictData[path];
  1521. }
  1522. var p = encodePath( path );
  1523. //var p = path.replace(/\./g, "/");
  1524. action[ ( (enableAnonymous && type == "cms") ? "getDictDataAnonymous" : "getDictData" ) ](encodeURIComponent(this.name), applicationId, p, function(json){
  1525. value = json.data;
  1526. this.dictData[path] = value;
  1527. if (success) success(json.data);
  1528. }.bind(this), function(xhr, text, error){
  1529. if (failure) failure(xhr, text, error);
  1530. }, !!async, false);
  1531. }else{
  1532. if (this.dictData["root"]){
  1533. if (success) success(this.dictData["root"]);
  1534. return this.dictData["root"];
  1535. }
  1536. action[ ( (enableAnonymous && type == "cms") ? "getDictRootAnonymous" : "getDictRoot" ) ](this.name, applicationId, function(json){
  1537. value = json.data;
  1538. this.dictData["root"] = value;
  1539. if (success) success(json.data);
  1540. }.bind(this), function(xhr, text, error){
  1541. if (failure) failure(xhr, text, error);
  1542. }, !!async);
  1543. }
  1544. return value;
  1545. };
  1546. this.set = function(path, value, success, failure){
  1547. var p = encodePath( path );
  1548. //var p = path.replace(/\./g, "/");
  1549. action.setDictData(encodeURIComponent(this.name), applicationId, p, value, function(json){
  1550. if (success) success(json.data);
  1551. }, function(xhr, text, error){
  1552. if (failure) failure(xhr, text, error);
  1553. }, false, false);
  1554. };
  1555. this.add = function(path, value, success, failure){
  1556. var p = encodePath( path );
  1557. //var p = path.replace(/\./g, "/");
  1558. action.addDictData(encodeURIComponent(this.name), applicationId, p, value, function(json){
  1559. if (success) success(json.data);
  1560. }, function(xhr, text, error){
  1561. if (failure) failure(xhr, text, error);
  1562. }, false, false);
  1563. };
  1564. this["delete"] = function(path, success, failure){
  1565. var p = encodePath( path );
  1566. //var p = path.replace(/\./g, "/");
  1567. action.deleteDictData(encodeURIComponent(this.name), applicationId, p, function(json){
  1568. if (success) success(json.data);
  1569. }, function(xhr, text, error){
  1570. if (failure) failure(xhr, text, error);
  1571. }, false, false);
  1572. };
  1573. this.destory = this["delete"];
  1574. }
  1575. };
  1576. // MWF.xScript.createCMSDict = function(application){
  1577. // //optionsOrName : {
  1578. // // type : "", //默认为cms, 可以为 process cms
  1579. // // application : "", //流程/CMS的名称/别名/id, 默认为当前应用
  1580. // // name : "", // 数据字典名称/别名/id
  1581. // // enableAnonymous : false //允许在未登录的情况下读取CMS的数据字典
  1582. // //}
  1583. // //或者name: "" // 数据字典名称/别名/id
  1584. // return function(optionsOrName){
  1585. // var options = optionsOrName;
  1586. // if( typeOf( options ) == "string" ){
  1587. // options = { name : options };
  1588. // }
  1589. // var name = this.name = options.name;
  1590. // var type = ( options.type && options.application ) ? options.type : "cms";
  1591. // var applicationId = options.application || application;
  1592. // var enableAnonymous = options.enableAnonymous || false;
  1593. //
  1594. // //MWF.require("MWF.xScript.Actions.DictActions", null, false);
  1595. // if( type == "cms" ){
  1596. // var action = MWF.Actions.get("x_cms_assemble_control");
  1597. // }else{
  1598. // var action = MWF.Actions.get("x_processplatform_assemble_surface");
  1599. // }
  1600. //
  1601. // var encodePath = function( path ){
  1602. // var arr = path.split(/\./g);
  1603. // var ar = arr.map(function(v){
  1604. // return encodeURIComponent(v);
  1605. // });
  1606. // return ar.join("/");
  1607. // };
  1608. //
  1609. // this.get = function(path, success, failure){
  1610. // var value = null;
  1611. // if (path){
  1612. // var p = encodePath( path );
  1613. // //var p = path.replace(/\./g, "/");
  1614. // action[ ( (enableAnonymous && type == "cms") ? "getDictDataAnonymous" : "getDictData" ) ](encodeURIComponent(this.name), applicationId, p, function(json){
  1615. // value = json.data;
  1616. // if (success) success(json.data);
  1617. // }, function(xhr, text, error){
  1618. // if (failure) failure(xhr, text, error);
  1619. // }, false, false);
  1620. // }else{
  1621. // action[ ( (enableAnonymous && type == "cms") ? "getDictRootAnonymous" : "getDictRoot" ) ](encodeURIComponent(this.name), applicationId, function(json){
  1622. // value = json.data;
  1623. // if (success) success(json.data);
  1624. // }, function(xhr, text, error){
  1625. // if (failure) failure(xhr, text, error);
  1626. // }, false);
  1627. // }
  1628. //
  1629. // return value;
  1630. // };
  1631. //
  1632. // this.set = function(path, value, success, failure){
  1633. // var p = encodePath( path );
  1634. // //var p = path.replace(/\./g, "/");
  1635. // action.setDictData(encodeURIComponent(this.name), applicationId, p, value, function(json){
  1636. // if (success) success(json.data);
  1637. // }, function(xhr, text, error){
  1638. // if (failure) failure(xhr, text, error);
  1639. // }, false, false);
  1640. // };
  1641. // this.add = function(path, value, success, failure){
  1642. // var p = encodePath( path );
  1643. // //var p = path.replace(/\./g, "/");
  1644. // action.addDictData(encodeURIComponent(this.name), applicationId, p, value, function(json){
  1645. // if (success) success(json.data);
  1646. // }, function(xhr, text, error){
  1647. // if (failure) failure(xhr, text, error);
  1648. // }, false, false);
  1649. // };
  1650. // this["delete"] = function(path, success, failure){
  1651. // var p = encodePath( path );
  1652. // //var p = path.replace(/\./g, "/");
  1653. // action.deleteDictData(encodeURIComponent(this.name), applicationId, p, function(json){
  1654. // if (success) success(json.data);
  1655. // }, function(xhr, text, error){
  1656. // if (failure) failure(xhr, text, error);
  1657. // }, false, false);
  1658. // };
  1659. // this.destory = this["delete"];
  1660. // }
  1661. // };