Common.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. o2.xDesktop = o2.xDesktop || {};
  2. o2.xd = o2.xDesktop;
  3. o2.xDesktop.requireApp = function(module, clazz, callback, async){
  4. o2.requireApp(module, clazz, callback, async)
  5. };
  6. o2.xApplication = o2.xApplication || {};
  7. MWF.xDesktop.loadConfig = function(callback){
  8. o2.JSON.get("res/config/config.json", function(config) {
  9. if (config.proxyCenterEnable){
  10. if (o2.typeOf(config.center)==="array"){
  11. config.center.forEach(function(c){
  12. c.port = window.location.port;
  13. });
  14. }else{
  15. config.port = window.location.port;
  16. }
  17. }
  18. layout.config = config;
  19. if (layout.config.app_protocol === "auto") {
  20. layout.config.app_protocol = window.location.protocol;
  21. }
  22. layout.config.systemName = layout.config.systemName || layout.config.footer;
  23. layout.config.systemTitle = layout.config.systemTitle || layout.config.title;
  24. if (callback) callback();
  25. });
  26. };
  27. MWF.xDesktop.getService = function(callback) {
  28. MWF.xDesktop.getServiceAddress(layout.config, function(service, center){
  29. layout.serviceAddressList = service;
  30. layout.centerServer = center;
  31. if (callback) callback();
  32. });
  33. };
  34. MWF.xDesktop.loadService = function(callback){
  35. MWF.xDesktop.loadConfig(function(){
  36. MWF.xDesktop.getService(callback);
  37. });
  38. };
  39. MWF.xDesktop.checkLogin = function(loginFun){
  40. layout.authentication = new MWF.xDesktop.Authentication({
  41. "onLogin": loginFun
  42. });
  43. layout.authentication.isAuthenticated(function(json){
  44. layout.session.user = json.data;
  45. if (loginFun) loginFun();
  46. }.bind(this), function(){
  47. layout.authentication.loadLogin(this.node);
  48. });
  49. };
  50. MWF.xDesktop.getDefaultLayout = function(callback){
  51. MWF.UD.getPublicData("defaultLayout", function(json) {
  52. if (json) layout.defaultLayout = json;
  53. if (callback) callback();
  54. }.bind(this));
  55. },
  56. MWF.xDesktop.getUserLayout = function(callback){
  57. MWF.UD.getPublicData("forceLayout", function(json) {
  58. var forceStatus = null;
  59. if (json) forceStatus = json;
  60. debugger;
  61. MWF.UD.getDataJson("layout", function(json) {
  62. if (json) {
  63. layout.userLayout = json;
  64. if( !layout.userLayout.flatStyle )layout.userLayout.flatStyle = layout.config.defaultSkin;
  65. if( !layout.userLayout.apps )layout.userLayout.apps = {};
  66. if (forceStatus) layout.userLayout.apps = Object.merge(layout.userLayout.apps, forceStatus.apps);
  67. if (callback) callback();
  68. }else{
  69. MWF.UD.getPublicData("defaultLayout", function(json) {
  70. layout.userLayout = json || {};
  71. // if( !layout.userLayout.flatStyle )
  72. layout.userLayout.flatStyle = layout.config.defaultSkin || 'blue';
  73. if( !layout.userLayout.apps )layout.userLayout.apps = {};
  74. if (forceStatus) layout.userLayout.apps = Object.merge(layout.userLayout.apps, forceStatus.apps);
  75. if (callback) callback();
  76. }.bind(this));
  77. }
  78. }.bind(this));
  79. }.bind(this));
  80. },
  81. MWF.xDesktop.notice = function(type, where, content, target, offset, option){
  82. if (!where) where = { "x": "right", "y": "top" };
  83. if (!type) type = "ok";
  84. var noticeTarget = target || layout.desktop.desktopNode || document.body;
  85. var off = offset;
  86. if (!off){
  87. off = {
  88. x: 10,
  89. y: where.y.toString().toLowerCase()=="bottom" ? 10 : 10
  90. };
  91. }
  92. var options = {
  93. type: type,
  94. position: where,
  95. move: false,
  96. target: noticeTarget,
  97. offset: off,
  98. content: content
  99. };
  100. if( option && typeOf(option) === "object" ){
  101. options = Object.merge( options, option );
  102. }
  103. new mBox.Notice(options);
  104. };
  105. MWF.xDesktop.loadPortal = function(portalId, parameters, isLoginPage){
  106. layout.openApplication(null, "portal.Portal", {
  107. "portalId": portalId,
  108. "parameters": parameters,
  109. "isLoginPage": isLoginPage,
  110. "onAfterModulesLoad": function(){
  111. var layoutNode = $("layout");
  112. if (layoutNode) layoutNode.setStyles({
  113. "position": "absolute",
  114. "width": "100%",
  115. "z-index": 100,
  116. "top": "0px",
  117. "left": "0px"
  118. }).fade("out");
  119. var appContentNode = $("appContent");
  120. if (appContentNode) appContentNode.setStyles({
  121. "position": "absolute",
  122. "width": "100%",
  123. "top": "0px",
  124. "opacity": 0,
  125. "left": "0px"
  126. }).fade("in");
  127. }
  128. }, null, true);
  129. };
  130. MWF.name = {
  131. "cns": function(names){
  132. if( typeOf(names) !== "array" )return [];
  133. var n = [];
  134. names.each(function(v){
  135. n.push(this.cn(v));
  136. }.bind(this));
  137. return n;
  138. },
  139. "cn": function(name){
  140. if (!name) return "";
  141. var idx = name.indexOf("@");
  142. return (idx!==-1) ? name.substring(0, idx) : name;
  143. },
  144. "ou": function(name){
  145. if (!name) return "";
  146. var idx = name.indexOf("@");
  147. var lastIdx = name.lastIndexOf("@");
  148. if (idx===-1){
  149. return name;
  150. }else if (lastIdx===idx){
  151. return "";
  152. }else{
  153. return name.substring(idx+1, lastIdx);
  154. }
  155. },
  156. "flag": function(name){
  157. if (!name) return "";
  158. var lastIdx = name.lastIndexOf("@");
  159. if (lastIdx===-1){
  160. return "";
  161. }else{
  162. return name.substring(lastIdx+1, name.length);
  163. }
  164. },
  165. "type": function(name){
  166. if (!name) return "";
  167. var lastIdx = name.lastIndexOf("@");
  168. if (lastIdx===-1){
  169. return "";
  170. }else{
  171. return name.substring(lastIdx+1, name.length);
  172. }
  173. }
  174. };
  175. MWF.xDesktop.confirm = function(type, e, title, text, width, height, ok, cancel, callback, mask, style){
  176. MWF.require("MWF.xDesktop.Dialog", function(){
  177. var container = layout.desktop.node || $(document.body);
  178. var size = container.getSize();
  179. var x = 0;
  180. var y = 0;
  181. if (typeOf(e)=="element"){
  182. var position = e.getPosition(container);
  183. x = position.x;
  184. y = position.y;
  185. }else{
  186. if (Browser.name=="firefox"){
  187. x = parseFloat(e.event.clientX);
  188. y = parseFloat(e.event.clientY);
  189. }else{
  190. x = parseFloat(e.x || e.event.x);
  191. y = parseFloat(e.y || e.event.y);
  192. }
  193. if (e.target){
  194. var position = e.target.getPosition(container);
  195. x = position.x;
  196. y = position.y;
  197. }
  198. // }
  199. }
  200. if (x+parseFloat(width)>size.x){
  201. x = x-parseFloat(width);
  202. }
  203. if (x<0) x = 0;
  204. if (y+parseFloat(height)>size.y){
  205. y = y-parseFloat(height);
  206. }
  207. if (y<0) y = 0;
  208. var ctext = "";
  209. var chtml = "";
  210. if (typeOf(text).toLowerCase()=="object"){
  211. ctext = text.text;
  212. chtml = text.html;
  213. }else{
  214. ctext = text;
  215. }
  216. var dlg = new MWF.xDesktop.Dialog({
  217. "title": title,
  218. "style": style || "o2",
  219. "top": y,
  220. "left": x-20,
  221. "fromTop":y,
  222. "fromLeft": x-20,
  223. "width": width,
  224. "height": height,
  225. "text": ctext,
  226. "html": chtml,
  227. "container": MWF.xDesktop.node,
  228. "maskNode": mask,
  229. "buttonList": [
  230. {
  231. "type": "ok",
  232. "text": MWF.LP.process.button.ok,
  233. "action": ok
  234. },
  235. {
  236. "type": "cancel",
  237. "text": MWF.LP.process.button.cancel,
  238. "action": cancel
  239. }
  240. ]
  241. });
  242. switch (type.toLowerCase()){
  243. case "success":
  244. dlg.content.setStyle("background-image", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAYAAAAe2bNZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAB1hJREFUeNqsWGtsVEUUPnMf+y6rLcW2tDxUKARaikqgiWh8BlH8IwYkaozhh4nhB1FMTKkxQtQYQzRGE2JEfMRHYhQSVChgFYIGqLSUtoKUQmlp2b53u233de94zuzcZbfdbhdwkpPZmbl3zjffnHPuOcue/WgxZNnc3OT3cQ4rGIMlwNg8BjATGEwDDgHOeZdpQis3eKMR5Sd62kaO/PHp5QDub2ba9OtNTYnf2lQIcOO5igpr8eeT3kL9XneuCi6vAvYcFWxOBqrO6BlvZIx7w8PGwlG/uWZkwADNzo4//e7CfQMdYz/88t6F8/i+icB4Jl0sEzPIxEbsXiwotVd6C3TwTFezZRGCfQb4r0bhSnPo78io8dWP1ed24nRkPFNTMoMnnYNsbGYK2zR/pYsRGxJc1mDcuQqKHbwF2t3/Hh29a+3bC8oHOkM7UPk5UpGOpQQzFsINHyxahDaxdeYix/r8223AFLjpxpGL3rYIXDw5um+gc+ydwx9fqsPpKC0lP6eWr54hfjT+2gPP7Fg0R1HgreIyx/rpc2zxjfjNCzXXrSo4PMr8sWFecEuRo6mjMdBPdpQMJuWa6GoKF9jX55bo13UlE5jg8szobshyotG+RtT1OJrBAA43o/hRYhOYKVuVvxFtZPusCie7GUbQvcnmIBbh4noEoqR15zQV/N1GeXFZzvD5Y4P1ydclwJD7om1sn3uPs0S3x1++ESHlJgJB74FiXgkD4XZQLGr4NQtBh2DDvWa+3aOd7D4b7CGDFjcjr2dt3mxbpQNjB53sRsTA7YiN0IgBRWYlrJz2suhpTPO0bj1LegpKH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miExI+CTVNVROjI2YPGPeggrrLh2AXUeqBCvU09jk15f7kJ6+S6P7244PUT0VkDYTz/QoGf+ntr9h/srcIs2mLFVY5oyua7AVfIF2qGvbn5rFZSHESn9HaG/Nhxc/wxmylUErDxbMyBomQnVNcDC2Lyq9a1LB051o3T/hWzOV0L6D3eHalsN936K+PgkkYiWkyVWR+dsnl85RXRP0R3+OxbioEP4vof2GfOHac0f6v7h4cqhZghlNLldS6iZCiA/6qK7RnapLtSvlwCm43ES1QFdjco6s722q6d2NFcFp1NMjbSWWsdbGypIshj7POatfu+MlT55tnd2lljHOso1l18yIYYIeNFrIWGt3tv8o2SAZJu8h80iutRPMWE0aNFEXobqGygk0ar+iM5eqswIrqE0w3ASAeD8WjDX1d4ztIfet3+v7XRprL/0nQIxYtba8kan/hUDUikx8PJTFl96fdx/lrJQqUoZGiRHlI5QG0NeXPnr0raEQf7a2r04GtICU4FT/QmTDPJOGTqAcMnl2yrFNJkZWMIhJ7yAZk5E1JMfm+EI/naLraQRKlQBUKUoSGFNWh4YEZowv7jO1/wQYAIxJoZGb/Cz/AAAAAElFTkSuQmCC)");
  245. break;
  246. case "error":
  247. dlg.content.setStyle("background-image", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAYAAAAe2bNZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABsVJREFUeNqkWFtsFGUU/nZn2r21IqX3llp6AQmkWDVGAgIlGI0EeMAHffAFa998MCQaE8JDxZCgSHzQKIm3qPHFGC7GW0xqkIgIKhhEwFJaKSDQUtplu73s7vidmX/q32F2uw2TnOzMv2fO+f5z/8fci7yvWAZYRXo4CCwLAM1cq+HvXRYwQrrM/7rTwB+TwC/dwKG3uU75mVxCO7T7wExgKHiBATzJ2411wMoy3pSQ5gg6UiFpgpQgDZNukK6TLgBHuf7lAPD5q8DfXMpQl5U3mA4P4ztAO3+2tADLCQSV+VsR/5L+If0G/EqgH78EvKtwT1lq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S0xaYHSEql3jCBRLSC5k3faV1XZZnwySWABmUqJKCo8oUOaNTZbL9SlzE4Niwh8lURLf/TyoQzAZFgdcmvDklhjKsKXKAqsF5rZEztAboOAz+KA4xHmeo0+tNFqky7VMkKfJ+nAnuV2rtn1pS0td32n16B67kpRjZuqQrs6pB5mW37s5OswoLNaOTUdRfQRjPWGhrqOF80aYVSTwXWgfQQSL8URiqa6wGkV+B+ZuAlTwUWF/VxyPoUeD/uTH5x4xhjiNapoHXWhj3l+ubhw0hTkbtz3SXdBNJHIJgFn+Vx0Tlg37eOi+RAkTTk+MDueY1WWc64qQ5oZpSXhpSiedrOz1HBBVWZZ8Pn0phzcjj9DfBBvz1r4aYkrz3PvEhZq9lIyfgY3RXwzrY3lKKytWtxhgp6fHaaL5+AoU8stulPvgB+UFZJuPOMPaF/D5wgoGq6q9XMosianER3FiD58iWcDNr/GvCegwtDbjeywShAGQ5Y3aYzZC00PELsDkxFmOGokosv6cy/XV8DHyr3XFfL1rSBnL/WNqKUcw3rQWWhD6A7oaSTPV1dwEecX07CmX1v6W3Re4iz5IAl5xqCiTIMW0zJ5DsAkXKOLxbHy/1iEQ3IiHdYmAbGdZccsBhDXXKcoMAyWqjCynJwywVCqjgbz2kJVokR5RoXyKRkctYTpQ5Iepica+Q4QesMU0GUoCozPjGS0QZ5t9uzJ51ioO6T9FVZc1XFiLgm5X6ROJjvJ5EOZ4iXwaeIs2Elz1WreExtlVFRJjQZjGQekTFAuq80PRazbp6JTtOyxy87FX9EkYCY8H6v6fDMNzNdagayQYXVZ5mIei7UmrHrnQlFSZXJY9qnECuXIjMPMJZ2lHIPj6aaGg0FNOD5CJHWjtl5f0n5T4ABAFHaXG6UVjGNAAAAAElFTkSuQmCC)");
  248. break;
  249. case "info":
  250. dlg.content.setStyle("background-image", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAYAAAAe2bNZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccll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hPCA6uUfRijIfEO0l1TWKJ3gWnXoG61w/U1zRnFPC/VVjlvFRM9REH4aM7yYunfhy7PzRn4WzThC9pOFsrZ0PpuSvEOhDkiA+QWLxS5u2byPOSlSRGBoRI+IjRAMo+1LSo1xDIZ4iqwhocSGJcr9COCGITJw6AuUVpY1P9N2CGDFhHkOcDk2E+KQIaNS3Ck24uKIHaQRKFgBkIVIeGFJoCjHE1XI6+b8CDABnZtjY0mkIGQAAAABJRU5ErkJggg==)");
  251. break;
  252. case "warn":
  253. dlg.content.setStyle("background-image", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAYAAAAe2bNZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABgtJREFUeNqsWG2IlFUUft6vmdlZd539GFdTY5VMomy1oBJUSPLXkmQt5I8gCIMK+iH0K4ooEvtTRP7JX9JKWCC1mUUkIkQKSoaZH60t2pboOK37Mc6Ozsw779t57t5xx5ndnTvhC4d373nnnnPuOeee85y1Jr+G6dNcCrBB6AnbQo9tY4UFLLYstIYhMsK/IjRULOF0voATx87jp60fICPygzmFbpn+26pnzK0ilrk2+kTp5kgC6+w4YDfJxpiQJ+QAYUmoKHQLCG4K5YDsCI7fzOPgcBr7172BP0VUILrC/22MnHSbvF6KLcRap1WMmGfsRQRZ2Z8BJv7BybEs9t6/DbuFXaj2VKUx7ize6BZvbHcdvB67D5bdrD/ocwUiruiLZPFGSbziiHci4iVPpEn41MM9pPZWPBofwiOX9uDh05fwkSgf5Dln8lKNZwo+HnRsvBVbjK1eJ39RdWIxJCfhGB0HxjNTBtGQhHiuPQHEY9MG3X5EbXEESA3i4KmL2Ln5Xfwi3CINmjVM9IjnYGeTGOJ2zOx+SU5cE8Hp/DMIopvgxFejlDsFO38IC6ID6JIDRCMz7/WvA1cG8d2PJ/H2y5/gLA2a9ndVmBia2CIxpL3yJ1XG5MUzTh8S3e/B9Zo09x74xSeRS7vyfT+i3sx7KXfRCv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h6f7TqgblBq1umgPCRwwOJcc3EEe3NsOXN4yYRUkRQ5vw5j4P19+FQbkha6Ud04aiZK8Y6lS2ALxwmi+GQcqxyGKDT3RCBSSkKpLM4xWXWOjGi6UXeirDKI1yXOcYIonuC5s1lQoTbKKlPZCdYUBZpSGZxhHeH11bdmVOdIrnLWNv4vhPzQ1sBnHlE8wTMxK6EiERqBEfEIYQC7L5seew1LPCurLmgZTdl6/4UwaWmWzq2IRvHNGrNGNLmYdpCvb0dBl/hJXdAKJrOF1eClsHX4XP12NM+qGFJKmnz9NgYV/wkwAMYATK0QLuhAAAAAAElFTkSuQmCC)");
  254. break;
  255. default:
  256. //dlg.content.setStyle("background-image", "");
  257. }
  258. dlg.show();
  259. if (callback) callback(dlg);
  260. }.bind(this));
  261. };
  262. MWF.xDesktop.getImageSrc = function( id ){
  263. if (layout.config.app_protocol=="auto"){
  264. layout.config.app_protocol = window.location.protocol;
  265. }
  266. var addressObj = layout.serviceAddressList["x_file_assemble_control"];
  267. var defaultPort = layout.config.app_protocol==='https' ? "443" : "80";
  268. if (addressObj){
  269. var appPort = addressObj.port || window.location.port;
  270. var address = layout.config.app_protocol+"//"+(addressObj.host || window.location.hostname)+((!appPort || appPort.toString()===defaultPort) ? "" : ":"+appPort)+addressObj.context;
  271. }else{
  272. var host = layout.config.center.host || window.location.hostname;
  273. var port = layout.config.center.port || window.location.port;
  274. var address = layout.config.app_protocol+"//"+host+((!port || port.toString()===defaultPort) ? "" : ":"+port)+"/x_file_assemble_control";
  275. }
  276. var url = "/jaxrs/file/"+id+"/download/stream";
  277. return o2.filterUrl(address+url);
  278. };
  279. MWF.xDesktop.setImageSrc = function(){
  280. if( !event )return;
  281. var obj = event.srcElement ? event.srcElement : event.target;
  282. if( !obj )return;
  283. obj.onerror = null;
  284. var id = obj.get("data-id");
  285. if( id )obj.set("src" , MWF.xDesktop.getImageSrc(id) );
  286. };
  287. MWF.xDesktop.uploadImage = function( reference, referencetype, formData, file, success, failure ){
  288. this.action = new MWF.xDesktop.Actions.RestActions("/xDesktop/Actions/action.json", "x_file_assemble_control");
  289. this.action.invoke({
  290. "name": "uploadImage",
  291. "parameter": {"reference" : reference, "referencetype": referencetype},
  292. "data": formData,
  293. "file": file,
  294. "success": success,
  295. "failure": failure
  296. });
  297. };
  298. MWF.xDesktop.uploadImageByScale = function( reference, referencetype, scale, formData, file, success, failure ){
  299. this.action = new MWF.xDesktop.Actions.RestActions("/xDesktop/Actions/action.json", "x_file_assemble_control");
  300. this.action.invoke({
  301. "name": "uploadImageByScale",
  302. "parameter": {"reference" : reference, "referencetype": referencetype, "scale" : scale || 0},
  303. "data": formData,
  304. "file": file,
  305. "success": success,
  306. "failure": failure
  307. });
  308. };
  309. MWF.xDesktop.copyImage = function( reference, referencetype, attachmentId, scale, success, failure ){
  310. this.action = new MWF.xDesktop.Actions.RestActions("/xDesktop/Actions/action.json", "x_file_assemble_control");
  311. this.action.invoke({
  312. "name": "copyImage",
  313. "parameter": {"reference" : reference, "referencetype": referencetype, "attachmentId" : attachmentId, "scale":scale || 0 },
  314. "success": success,
  315. "failure": failure
  316. });
  317. };
  318. MWF.xDesktop.getPortalFileUr = function(id, app){
  319. var root = "x_portal_assemble_surface";
  320. var url = MWF.Actions.getHost(root)+"/"+root+MWF.Actions.get(root).action.actions.readFile.uri;
  321. url = url.replace("{flag}", id);
  322. url = url.replace("{applicationFlag}", app);
  323. return url
  324. };
  325. MWF.xDesktop.getProcessFileUr = function(id, app){
  326. var root = "x_processplatform_assemble_surface";
  327. var url = MWF.Actions.getHost(root)+"/"+root+MWF.Actions.get(root).action.actions.readFile.uri;
  328. url = url.replace("{flag}", id);
  329. url = url.replace("{applicationFlag}", app);
  330. return url
  331. };
  332. MWF.xDesktop.getCMSFileUr = function(id, app){
  333. var root = "x_cms_assemble_control";
  334. var url = MWF.Actions.getHost(root)+"/"+root+MWF.Actions.get(root).action.actions.readFile.uri;
  335. url = url.replace("{flag}", id);
  336. url = url.replace("{applicationFlag}", app);
  337. return url
  338. };
  339. MWF.xDesktop.getServiceAddress = function(config, callback){
  340. var error = function(){
  341. //MWF.xDesktop.notice("error", {"x": "right", "y": "top"}, "")
  342. var loadingNode = $("browser_loadding");
  343. var contentNode = $("appContent");
  344. ((loadingNode) ? loadingNode.getFirst() : contentNode).empty();
  345. var html= "<div style='width: 800px; color: #ffffff; margin: 30px auto'>" +
  346. "<div style='height: 40px;'>" +
  347. " <div style='height: 40px; width: 40px; float: left; background: url(../x_desktop/img/error.png)'></div>" +
  348. " <div style='margin-left: 50px; font-size: 20px; line-height: 40px;'>"+MWF.LP.desktop.notice.errorConnectCenter1+"</div>" +
  349. "</div><div style='margin-left: 0px;'>";
  350. if (typeOf(config.center)==="array"){
  351. config.center.each(function(center){
  352. var h = (center.host) ? center.host : window.location.hostname;
  353. var p = (center.port) ? ":"+center.port : "";
  354. var url = "http://"+h+p+"/x_program_center/jaxrs/echo";
  355. html+="<br><a style='margin-left: 50px; color: #e0e8d1; line-height: 30px;' href='"+url+"' target='_blank'>"+url+"</a>"
  356. });
  357. }else{
  358. var h = (config.center.host) ? config.center.host : window.location.hostname;
  359. var p = (config.center.port) ? ":"+config.center.port : "";
  360. var url = "http://"+h+p+"/x_program_center/jaxrs/echo";
  361. html+="<br><a style='margin-left: 50px; color: #e0e8d1; line-height: 30px;'href='"+url+"' target='_blank'>"+url+"</a>"
  362. }
  363. html+="</div><br><div style='margin-left: 50px; font-size: 20px'>"+MWF.LP.desktop.notice.errorConnectCenter2+"</div></div>";
  364. ((loadingNode) ? loadingNode.getFirst() : contentNode).set("html", html);
  365. if (!loadingNode && contentNode){
  366. contentNode.setStyle("background-color", "#666666");
  367. }
  368. };
  369. if (config.center){
  370. if (typeOf(config.center)==="object"){
  371. MWF.xDesktop.getServiceAddressConfigObject(config.center, callback, error);
  372. }else if (typeOf(config.center)==="array"){
  373. MWF.xDesktop.getServiceAddressConfigArray(config, callback, error);
  374. }
  375. }else{
  376. MWF.xDesktop.getServiceAddressConfigObject( {
  377. "host": window.location.hostname,
  378. "port": window.location.port || 80
  379. }, callback, error);
  380. }
  381. };
  382. MWF.xDesktop.getServiceAddressConfigArray = function(config, callback, error) {
  383. var requests = [];
  384. var centers = {};
  385. config.center.each(function(center){
  386. if (!centers[center.host+center.port]) {
  387. centers[center.host + center.port] = true;
  388. requests.push(
  389. MWF.xDesktop.getServiceAddressConfigObject(center, function(serviceAddressList, center){
  390. requests.each(function(res){
  391. if (res && res.res) if (res.res.isRunning()){res.res.cancel();}
  392. if (res && res.actionWorker) res.actionWorker.terminate();
  393. });
  394. if (callback) callback(serviceAddressList, center);
  395. }.bind(this), function(){
  396. if (requests.length){
  397. for (var i=0; i<requests.length; i++){
  398. if (requests[i].res) if (requests[i].res.isRunning()) return "";
  399. if (requests[i].actionWorker && requests[i].actionWorker.terminate) return "";
  400. }
  401. }
  402. if (error) error();
  403. }.bind(this))
  404. );
  405. }
  406. }.bind(this));
  407. };
  408. MWF.xDesktop.getServiceAddressConfigObject = function(center, callback, error){
  409. var centerConfig = center;
  410. if (!centerConfig) centerConfig = layout.config.center;
  411. var host = centerConfig.host || window.location.hostname;
  412. var port = centerConfig.port;
  413. var uri = "";
  414. if (layout.config.app_protocol=="auto"){
  415. layout.config.app_protocol = window.location.protocol;
  416. }
  417. if (!port || port=="80"){
  418. uri = layout.config.app_protocol+"//"+host+"/x_program_center/jaxrs/distribute/assemble/source/{source}";
  419. }else{
  420. uri = layout.config.app_protocol+"//"+host+":"+port+"/x_program_center/jaxrs/distribute/assemble/source/{source}";
  421. }
  422. var currenthost = (layout.config.applicationServer && layout.config.applicationServer.host) ? layout.config.applicationServer.host : window.location.hostname;
  423. //var currenthost = window.location.hostname;
  424. uri = uri.replace(/{source}/g, currenthost);
  425. //var uri = "http://"+layout.config.center+"/x_program_center/jaxrs/distribute/assemble";
  426. try{
  427. return MWF.restful("get", uri, null, {
  428. "onSuccess": function(json){
  429. //this.serviceAddressList = json.data;
  430. //this.centerServer = center;
  431. var serviceAddressList = json.data;
  432. if (layout.config.proxyApplicationEnable || !layout.config.center){
  433. Object.keys(serviceAddressList).forEach(function(k){
  434. if (k!=="x_message_assemble_communicate" || !layout.config.center) serviceAddressList[k].port = window.location.port;
  435. })
  436. }
  437. if (callback) callback(serviceAddressList, center);
  438. }.bind(this),
  439. "onRequestFailure": function(xhr){
  440. if (error) error(xhr);
  441. }.bind(this),
  442. "onError": function(xhr){
  443. if (error) error(xhr);
  444. }.bind(this)
  445. });
  446. }catch(e){
  447. if (error) error();
  448. return null;
  449. }
  450. };
  451. MWF.xDesktop.$globalEvents = {};
  452. MWF.xDesktop.addEvent = function(name, type, fn){
  453. if (!MWF.xDesktop.$globalEvents[name]) MWF.xDesktop.$globalEvents[name] = {};
  454. if (!MWF.xDesktop.$globalEvents[name][type]) MWF.xDesktop.$globalEvents[name][type] = [];
  455. MWF.xDesktop.$globalEvents[name][type].push(fn);
  456. };
  457. MWF.xDesktop.addEvents = function(name, o){
  458. if (!MWF.xDesktop.$globalEvents[name]) MWF.xDesktop.$globalEvents[name] = {};
  459. Object.each(o, function(fn, type){
  460. MWF.xDesktop.addEvent(name, type, fn);
  461. }.bind(this));
  462. };
  463. MWF.xDesktop.removeEvent = function(name, type, fn){
  464. if (!MWF.xDesktop.$globalEvents[name]) return true;
  465. if (!MWF.xDesktop.$globalEvents[name][type]) return true;
  466. MWF.xDesktop.$globalEvents[name][type].erase(fn);
  467. };
  468. MWF.xDesktop.removeEvents = function(name, type){
  469. if (!MWF.xDesktop.$globalEvents[name]) return true;
  470. if (!MWF.xDesktop.$globalEvents[name][type]) return true;
  471. MWF.xDesktop.$globalEvents[name][type] = [];
  472. };
  473. MWF.org = {
  474. parseOrgData: function(data, flat, simple){
  475. if (data.distinguishedName){
  476. var flag = data.distinguishedName.substr(data.distinguishedName.length-2, 2);
  477. switch (flag.toLowerCase()){
  478. case "@i":
  479. return this.parseIdentityData(data, flat, simple);
  480. break;
  481. case "@p":
  482. return this.parsePersonData(data, simple);
  483. break;
  484. case "@u":
  485. return this.parseUnitData(data, simple);
  486. break;
  487. case "@g":
  488. return this.parseGroupData(data, simple);
  489. break;
  490. case "@r":
  491. return this.parseRoleData(data, simple);
  492. break;
  493. case "@a":
  494. return this.parseAttributeData(data, simple);
  495. break;
  496. default:
  497. return data;
  498. }
  499. }else{
  500. return data;
  501. }
  502. },
  503. parseIdentityData: function(data, flat, simple){
  504. if( simple ){
  505. var ndata = {
  506. "id": data.id,
  507. "name": data.name,
  508. "distinguishedName": data.distinguishedName,
  509. "unitLevelName" : data.unitLevelName,
  510. "person": data.person,
  511. "unit": data.unit,
  512. "unitName": data.unitName,
  513. };
  514. if( data.ignoreEmpower )ndata.ignoreEmpower = true;
  515. if( data.ignoredEmpower )ndata.ignoredEmpower = true;
  516. return ndata;
  517. }
  518. var rData = {
  519. "id": data.id,
  520. "name": data.name,
  521. "unique": data.unique,
  522. "distinguishedName": data.distinguishedName,
  523. // "dn": data.distinguishedName,
  524. "person": data.person,
  525. "unit": data.unit,
  526. "unitName": data.unitName,
  527. // "unitLevel": data.unitLevel,
  528. "unitLevelName": data.unitLevelName
  529. };
  530. if( data.personName )rData.personName = data.personName;
  531. if( data.personEmployee )rData.personEmployee = data.personEmployee;
  532. if( data.personUnique )rData.personUnique = data.personUnique;
  533. if( data.personDn )rData.personDn = data.personDn;
  534. if( data.ignoreEmpower )rData.ignoreEmpower = true;
  535. if( data.ignoredEmpower )rData.ignoredEmpower = true;
  536. if( !flat || !data.personDn || !data.personEmployee || !data.personUnique ){
  537. var woPerson = data.woPerson;
  538. if (!data.woPerson){
  539. //MWF.require("MWF.xDesktop.Actions.RestActions", null, false);
  540. //this.action = new MWF.xDesktop.Actions.RestActions("", "x_organization_assemble_control");
  541. //var uri = "/jaxrs/person/{flag}";
  542. //uri = uri.replace("{flag}", data.person);
  543. //this.action.invoke({"uri": uri, "success": function(json){
  544. // woPerson = json.data;
  545. //}.bind(this), "async":false});
  546. MWF.Actions.get("x_organization_assemble_control").getPerson(data.person, function(json){
  547. woPerson = json.data
  548. }, null, false);
  549. }
  550. rData.personName = woPerson.name;
  551. rData.personEmployee = woPerson.employee;
  552. rData.personUnique = woPerson.unique;
  553. rData.personDn = woPerson.distinguishedName;
  554. if (!flat){
  555. rData.woPerson = {
  556. "id": woPerson.id,
  557. "genderType": woPerson.genderType,
  558. "name": woPerson.name,
  559. "employee": woPerson.employee,
  560. "unique": woPerson.unique,
  561. "distinguishedName": woPerson.distinguishedName,
  562. "dn": woPerson.distinguishedName,
  563. "mail": woPerson.mail,
  564. "weixin": woPerson.weixin,
  565. "qq": woPerson.qq,
  566. "mobile": woPerson.mobile,
  567. "officePhone": woPerson.officePhone
  568. };
  569. }
  570. }
  571. return rData;
  572. },
  573. parsePersonData: function(data, simple){
  574. if( simple ){
  575. return {
  576. "id": data.id,
  577. "name": data.name,
  578. "employee": data.employee,
  579. "distinguishedName": data.distinguishedName,
  580. }
  581. }else{
  582. return {
  583. "id": data.id,
  584. "genderType": data.genderType,
  585. "name": data.name,
  586. "employee": data.employee,
  587. "unique": data.unique,
  588. "distinguishedName": data.distinguishedName,
  589. "dn": data.distinguishedName,
  590. "mail": data.mail,
  591. "weixin": data.weixin,
  592. "qq": data.qq,
  593. "mobile": data.mobile,
  594. "officePhone": data.officePhone
  595. }
  596. }
  597. },
  598. parseUnitData: function(data, simple){
  599. if( simple ){
  600. return {
  601. "id": data.id,
  602. "name": data.name,
  603. "distinguishedName": data.distinguishedName,
  604. "levelName": data.levelName
  605. }
  606. }else{
  607. return {
  608. "id": data.id,
  609. "name": data.name,
  610. "unique": data.unique,
  611. "distinguishedName": data.distinguishedName,
  612. "dn": data.distinguishedName,
  613. "typeList":data.typeList,
  614. "shortName": data.shortName,
  615. "level": data.level,
  616. "levelName": data.levelName
  617. }
  618. }
  619. },
  620. parseGroupData: function(data, simple){
  621. if( simple ){
  622. return {
  623. "id": data.id,
  624. "name": data.name,
  625. "distinguishedName": data.distinguishedName
  626. }
  627. }else{
  628. return {
  629. "id": data.id,
  630. "name": data.name,
  631. "unique": data.unique,
  632. "distinguishedName": data.distinguishedName,
  633. "dn": data.distinguishedName
  634. }
  635. }
  636. },
  637. parseRoleData: function(data, simple){
  638. if( simple ){
  639. return {
  640. "id": data.id,
  641. "name": data.name,
  642. "distinguishedName": data.distinguishedName
  643. }
  644. }else{
  645. return {
  646. "id": data.id,
  647. "name": data.name,
  648. "unique": data.unique,
  649. "distinguishedName": data.distinguishedName,
  650. "dn": data.distinguishedName
  651. }
  652. }
  653. },
  654. parseAttributeData: function(data, simple){
  655. if(simple){
  656. return {
  657. "id": data.id,
  658. "name": data.name,
  659. "distinguishedName": data.distinguishedName,
  660. "person": data.person,
  661. "attributeList": Array.clone(data.attributeList)
  662. }
  663. }else{
  664. return {
  665. "id": data.id,
  666. "description": data.description,
  667. "name": data.name,
  668. "unique": data.unique,
  669. "distinguishedName": data.distinguishedName,
  670. "dn": data.distinguishedName,
  671. "person": data.person,
  672. "attributeList": Array.clone(data.attributeList)
  673. }
  674. }
  675. }
  676. };
  677. //var lp = o2.session.path + "/lp/" + o2.language + ".js";
  678. // var lp = "../x_desktop/js/base_lp_" + o2.language +((o2.session.isDebugger) ? "" : ".min")+ ".js";
  679. // if (!o2.LP){
  680. // new Request({
  681. // "url": lp,
  682. // "method": "get"
  683. // }).send();
  684. // }
  685. o2.openWindow = function(url){
  686. var a = new Element("a", {
  687. "target": "_blank",
  688. "href": url
  689. });
  690. a.click();
  691. a.destroy();
  692. }