O2Identity.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. o2.widget = o2.widget || {};
  2. o2.require("o2.widget.Common", null, false);
  3. o2.require("o2.xDesktop.Common", null, false);
  4. o2.require("o2.xDesktop.Actions.RestActions", null, false);
  5. o2.widget.O2Identity = new Class({
  6. Implements: [Options, Events],
  7. Extends: o2.widget.Common,
  8. options: {
  9. "style": "default",
  10. "canRemove": false,
  11. "lazy": false,
  12. "disableInfor" : false
  13. },
  14. initialize: function(data, container, options){
  15. debugger;
  16. this.setOptions(options);
  17. this.loadedInfor = false;
  18. this.path = o2.session.path+"/widget/$O2Identity/";
  19. this.cssPath = o2.session.path+"/widget/$O2Identity/"+this.options.style+"/css.wcss";
  20. this._loadCss();
  21. this.container = $(container);
  22. this.data = data;
  23. this.style = this.css;
  24. this.action = new o2.xDesktop.Actions.RestActions("", "x_organization_assemble_control", "x_component_Org");
  25. // this.explorer = explorer;
  26. // this.removeAction = removeAction;
  27. this.load();
  28. //o2.widget.O2Identity.iditems.push(this);
  29. },
  30. setText: function(){
  31. var disply;
  32. if( this.data.displayName ){
  33. disply = this.data.displayName;
  34. }else{
  35. var name = this.data.name || o2.name.cn(this.data.distinguishedName);
  36. var unit;
  37. if(this.data.unitName){
  38. unit = this.data.unitName;
  39. }else if( this.data.unitLevelName ){
  40. var list = this.data.unitLevelName.split("/");
  41. unit = list[ list.length - 1 ];
  42. }
  43. disply = name + (unit ? "("+unit+")" : "")
  44. }
  45. this.node.set("text", this.data.displayName || disply );
  46. },
  47. load: function(){
  48. var style = ( layout.mobile && this.style.identityNode_mobile ) ?
  49. this.style.identityNode_mobile : this.style.identityNode;
  50. if (!this.options.lazy && !this.options.disableInfor) this.getPersonData();
  51. this.node = new Element("div", {"styles": style }).inject(this.container);
  52. this.setText();
  53. if (this.options.canRemove){
  54. this.removeNode = new Element("div", {"styles": this.style.identityRemoveNode}).inject(this.node);
  55. this.removeNode.addEvent("click", function(e){
  56. this.fireEvent("remove", [this, e]);
  57. e.stopPropagation();
  58. }.bind(this));
  59. }
  60. if( !this.options.disableInfor && !layout.mobile){
  61. if (!this.options.lazy ){
  62. this.createInforNode(function(){
  63. this.fireEvent("loadedInfor", [this]);
  64. }.bind(this));
  65. }else{
  66. this.node.addEvents({
  67. "mouseover": function(){
  68. if (!this.loadedInfor){
  69. this.getPersonData();
  70. this.createInforNode(function(){
  71. this.fireEvent("loadedInfor", [this]);
  72. }.bind(this));
  73. }
  74. }.bind(this)
  75. });
  76. }
  77. }
  78. this.setEvent();
  79. this.node.addEvents({
  80. "mouseover": function(){
  81. var style_over = ( layout.mobile && this.style.identityNode_over_mobile ) ?
  82. this.style.identityNode_over_mobile : this.style.identityNode_over;
  83. this.node.setStyles( style_over );
  84. }.bind(this),
  85. "mouseout": function(){
  86. var style = ( layout.mobile && this.style.identityNode_mobile ) ?
  87. this.style.identityNode_mobile : this.style.identityNode;
  88. this.node.setStyles(style);
  89. }.bind(this)
  90. });
  91. },
  92. setEvent: function(){
  93. if( this.open ){
  94. this.node.addEvents({
  95. "click": function(ev){
  96. this.open(ev);
  97. ev.stopPropagation();
  98. }.bind(this)
  99. });
  100. }
  101. },
  102. getPersonData: function(){
  103. if (!this.data.dutys){
  104. var action = o2.Actions.get("x_organization_assemble_control");
  105. var id = this.data.distinguishedName || this.data.id || this.data.unique;
  106. if (id) action.listUnitdutyByIdentity(id, function(json){
  107. this.data.dutys = json.data;
  108. }.bind(this), null, false);
  109. }
  110. if (!this.data.woPerson){
  111. // var uri = "/jaxrs/person/{flag}";
  112. // //uri = uri.replace("{flag}", this.data.person);
  113. // var uriIdentity = "/jaxrs/identity/{id}";
  114. this.action.actions = {
  115. "getPerson": {"uri": "/jaxrs/person/{flag}"},
  116. "getIdentity": {"uri": "/jaxrs/identity/{id}"}
  117. };
  118. var woPerson;
  119. if (this.data.person){
  120. this.action.invoke({"name": "getPerson", "async": false, "parameter": {"flag": this.data.person}, "success": function(json){
  121. this.data.woPerson = woPerson;
  122. woPerson = json.data;
  123. }.bind(this)});
  124. }else{
  125. this.action.invoke({"name": "getIdentity", "async": false, "parameter": {"id": this.data.id || this.data.name}, "success": function(json){
  126. this.data = json.data;
  127. woPerson = json.data.woPerson;
  128. }.bind(this)});
  129. }
  130. return woPerson;
  131. }else{
  132. return this.data.woPerson;
  133. }
  134. //listDutyNameWithIdentity
  135. },
  136. createInforNode: function(callback){
  137. var person = this.getPersonData();
  138. if (person){
  139. this.inforNode = new Element("div", {
  140. "styles": this.style.identityInforNode
  141. });
  142. var nameNode = new Element("div", {
  143. "styles": this.style.identityInforNameNode
  144. }).inject(this.inforNode);
  145. var uri = "/jaxrs/person/{flag}/icon";
  146. uri = uri.replace("{flag}", person.id);
  147. this.action.getAddress();
  148. uri = this.action.address+uri;
  149. uri = o2.filterUrl(uri);
  150. img = "<img width='50' height='50' border='0' src='"+uri+"' style='border-radius:25px'/>";
  151. var picNode = new Element("div", {
  152. "styles": this.style.identityInforPicNode,
  153. "html": img
  154. }).inject(nameNode);
  155. var rightNode = new Element("div", {
  156. "styles": this.style.identityInforRightTextNode
  157. }).inject(nameNode);
  158. var nameTextNode = new Element("div", {
  159. "styles": this.style.identityInforNameTextNode,
  160. "text": person.name
  161. }).inject(rightNode);
  162. var employeeTextNode = new Element("div", {
  163. "styles": this.style.identityInforEmployeeTextNode,
  164. "text": person.employee || ""
  165. }).inject(rightNode);
  166. // var phoneNode = new Element("div", {
  167. // "styles": this.style.identityInforPhoneNode,
  168. // "html": "<div style='width:30px; float:left'>"+o2.LP.desktop.person.personMobile+": </div><div style='width:90px; float:left; margin-left:10px'>"+(person.mobile || "")+"</div>"
  169. // }).inject(this.inforNode);
  170. // var mailNode = new Element("div", {
  171. // "styles": this.style.identityInforPhoneNode,
  172. // "html": "<div style='width:30px; float:left'>"+o2.LP.desktop.person.personMail+": </div><div style='width:90px; float:left; margin-left:10px'>"+(person.mail || "")+"</div>"
  173. // }).inject(this.inforNode);
  174. var dutys = [];
  175. if (this.data.dutys && this.data.dutys.length){
  176. this.data.dutys.each(function(d){
  177. var n = d.name+"("+d.woUnit.levelName+")";
  178. dutys.push(n);
  179. });
  180. }
  181. var dutyNode = new Element("div", {
  182. "styles": this.style.identityInforPhoneNode,
  183. "html": "<div style='width:30px; float:left'>"+o2.LP.desktop.person.duty+": </div><div style='width:160px; float:left; margin-left:10px'>"+(dutys.join(","))+"</div>"
  184. }).inject(this.inforNode);
  185. this.loadedInfor = true;
  186. this.tooltip = new mBox.Tooltip({
  187. content: this.inforNode,
  188. setStyles: {content: {padding: 15, lineHeight: 20}},
  189. attach: this.node,
  190. transition: 'flyin'
  191. });
  192. }
  193. if (callback) callback();
  194. },
  195. destroy: function(){
  196. if (this.tooltip) this.tooltip.destroy();
  197. this.node.destroy();
  198. o2.release(this);
  199. }
  200. });
  201. // o2.widget.Person = new Class({
  202. // Implements: [Options, Events],
  203. // Extends: o2.widget.Identity,
  204. // getPerson: function(callback){
  205. // if (this.data.name && this.data.id){
  206. // if (callback) callback({"data": this.data});
  207. // }else{
  208. // var key = this.data.name;
  209. // this.explorer.actions["getPerson"](function(json){
  210. // if (callback) callback(json);
  211. // }, null, key);
  212. // }
  213. // }
  214. // });
  215. o2.widget.O2Person = new Class({
  216. Extends: o2.widget.O2Identity,
  217. getPersonData: function(){
  218. if (!this.data.distinguishedName){
  219. this.action.actions = {"getPerson": {"uri": "/jaxrs/person/{id}"}};
  220. this.action.invoke({"name": "getPerson", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  221. this.data = json.data;
  222. }.bind(this)});
  223. }
  224. return this.data;
  225. },
  226. setText: function(){
  227. this.node.set("text", this.data.displayName || this.data.name);
  228. }
  229. });
  230. o2.widget.O2Unit = new Class({
  231. Extends: o2.widget.O2Identity,
  232. getPersonData: function(){
  233. if (!this.data.distinguishedName || !this.data.levelName){
  234. this.action.actions = {"getUnit": {"uri": "/jaxrs/unit/{id}"}};
  235. this.action.invoke({"name": "getUnit", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  236. this.data = json.data;
  237. }.bind(this)});
  238. }
  239. },
  240. createInforNode: function(){
  241. this.inforNode = new Element("div", {
  242. "styles": this.style.identityInforNode
  243. });
  244. var nameNode = new Element("div", {
  245. "styles": this.style.identityInforNameNode,
  246. "text": this.data.levelName
  247. }).inject(this.inforNode);
  248. this.tooltip = new mBox.Tooltip({
  249. content: this.inforNode,
  250. setStyles: {content: {padding: 15, lineHeight: 20}},
  251. attach: this.node,
  252. transition: 'flyin'
  253. });
  254. },
  255. setText: function(){
  256. this.node.set("text", this.data.displayName || this.data.name);
  257. }
  258. });
  259. o2.widget.O2Duty = new Class({
  260. Extends: o2.widget.O2Identity,
  261. getPersonData: function(){
  262. if (!this.data.woUnit){
  263. this.action.actions = {"getUnitduty": {"uri": "/jaxrs/unitduty/{id}"}};
  264. this.action.invoke({"name": "getUnitduty", "async": false, "parameter": {"id": (this.data.Id || this.data.name)}, "success": function(json){
  265. this.data = json.data;
  266. }.bind(this)});
  267. }
  268. },
  269. createInforNode: function(){
  270. this.inforNode = new Element("div", {
  271. "styles": this.style.identityInforNode
  272. });
  273. var nameNode = new Element("div", {
  274. "styles": this.style.identityInforNameNode,
  275. "text": this.data.woUnit.levelName
  276. }).inject(this.inforNode);
  277. this.tooltip = new mBox.Tooltip({
  278. content: this.inforNode,
  279. setStyles: {content: {padding: 15, lineHeight: 20}},
  280. attach: this.node,
  281. transition: 'flyin'
  282. });
  283. },
  284. setText: function(){
  285. this.node.set("text", this.data.displayName || this.data.name);
  286. }
  287. });
  288. o2.widget.O2Group = new Class({
  289. Extends: o2.widget.O2Unit,
  290. getPersonData: function(){
  291. if (!this.data.distinguishedName){
  292. this.action.actions = {"getGroup": {"uri": "/jaxrs/group/{id}"}};
  293. this.action.invoke({"name": "getGroup", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  294. this.data = json.data;
  295. }.bind(this)});
  296. }
  297. },
  298. setText: function(){
  299. this.node.set("text", this.data.displayName || this.data.name);
  300. },
  301. createInforNode: function(){
  302. return false;
  303. }
  304. });
  305. o2.widget.O2Application = new Class({
  306. Extends: o2.widget.O2Group,
  307. getPersonData: function(){
  308. if (!this.data.name){
  309. this.action = new o2.xDesktop.Actions.RestActions("", "x_processplatform_assemble_surface", "");
  310. this.action.actions = {"getApplication": {"uri": "/jaxrs/application/{id}"}};
  311. this.action.invoke({"name": "getApplication", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  312. this.data = json.data;
  313. }.bind(this)});
  314. }
  315. }
  316. });
  317. o2.widget.O2CMSApplication = new Class({
  318. Extends: o2.widget.O2Group,
  319. getPersonData: function(){
  320. if (!this.data.name){
  321. o2.Actions.get("x_cms_assemble_control").getApplication((this.data.id || this.data.name), function(json){
  322. this.data = json.data;
  323. }.bind(this), null, false);
  324. // this.action = new o2.xDesktop.Actions.RestActions("", "x_cms_assemble_control", "");
  325. // this.action.actions = {"getApplication": {"uri": "/jaxrs/application/{id}"}};
  326. // this.action.invoke({"name": "getApplication", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  327. // this.data = json.data;
  328. // }.bind(this)});
  329. }
  330. }
  331. });
  332. o2.widget.O2Process = new Class({
  333. Extends: o2.widget.O2Group,
  334. getPersonData: function(){
  335. if (!this.data.name){
  336. this.action = new o2.xDesktop.Actions.RestActions("", "x_processplatform_assemble_surface", "");
  337. this.action.actions = {"getProces": {"uri": "/jaxrs/process/{id}/complex"}};
  338. this.action.invoke({"name": "getProces", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  339. this.data = json.data;
  340. }.bind(this)});
  341. }
  342. },
  343. createInforNode: function(){
  344. this.inforNode = new Element("div", {
  345. "styles": this.style.identityInforNode
  346. });
  347. var nameNode = new Element("div", {
  348. "styles": this.style.identityInforNameNode,
  349. "text": this.data.name || this.data.applicationName || this.data.appName
  350. }).inject(this.inforNode);
  351. this.tooltip = new mBox.Tooltip({
  352. content: this.inforNode,
  353. setStyles: {content: {padding: 15, lineHeight: 20}},
  354. attach: this.node,
  355. transition: 'flyin'
  356. });
  357. }
  358. });
  359. o2.widget.O2CMSCategory = new Class({
  360. Extends: o2.widget.O2Group,
  361. getPersonData: function(){
  362. if (!this.data.name){
  363. o2.Actions.get("x_cms_assemble_control").getCategory((this.data.id || this.data.name), function(json){
  364. this.data = json.data;
  365. }.bind(this), null, false);
  366. }
  367. },
  368. createInforNode: function(){
  369. this.inforNode = new Element("div", {
  370. "styles": this.style.identityInforNode
  371. });
  372. var nameNode = new Element("div", {
  373. "styles": this.style.identityInforNameNode,
  374. "text": this.data.applicationName || this.data.appName
  375. }).inject(this.inforNode);
  376. this.tooltip = new mBox.Tooltip({
  377. content: this.inforNode,
  378. setStyles: {content: {padding: 15, lineHeight: 20}},
  379. attach: this.node,
  380. transition: 'flyin'
  381. });
  382. }
  383. });
  384. o2.widget.O2View = new Class({
  385. Extends: o2.widget.O2Group,
  386. getPersonData: function(){
  387. if (!this.data.query){
  388. var data = null;
  389. o2.Actions.get("x_query_assemble_surface").getStatById(this.data.id, function(json){
  390. data = json.data
  391. }, null, false);
  392. this.data = data;
  393. return data;
  394. }else{
  395. return this.data;
  396. }
  397. },
  398. createInforNode: function(){
  399. this.inforNode = new Element("div", {
  400. "styles": this.style.identityInforNode
  401. });
  402. var nameNode = new Element("div", {
  403. "styles": this.style.identityInforNameNode,
  404. "text": this.data.applicationName || this.data.appName || this.data.name
  405. }).inject(this.inforNode);
  406. this.tooltip = new mBox.Tooltip({
  407. content: this.inforNode,
  408. setStyles: {content: {padding: 15, lineHeight: 20}},
  409. attach: this.node,
  410. transition: 'flyin'
  411. });
  412. }
  413. });
  414. o2.widget.O2CMSView = new Class({
  415. Extends: o2.widget.O2View
  416. });
  417. o2.widget.O2QueryView = new Class({
  418. Extends: o2.widget.O2View,
  419. getPersonData: function(){
  420. if (!this.data.query){
  421. var data = null;
  422. o2.Actions.get("x_query_assemble_surface").getViewById(this.data.id, function(json){
  423. data = json.data
  424. }, null, false);
  425. this.data = data;
  426. return data;
  427. }else{
  428. return this.data;
  429. }
  430. },
  431. open : function (e) {
  432. if( this.data.id && this.data.query ){
  433. var appId = "query.ViewDesigner" + this.data.id;
  434. if (layout.desktop.apps[appId]){
  435. layout.desktop.apps[appId].setCurrent();
  436. }else {
  437. var options = {"id": this.data.id, "application": this.data.query, "appId": appId};
  438. layout.desktop.openApplication(e, "query.ViewDesigner", options);
  439. }
  440. }
  441. }
  442. });
  443. o2.widget.O2QueryStat = new Class({
  444. Extends: o2.widget.O2View,
  445. getPersonData: function(){
  446. if (!this.data.query){
  447. var data = null;
  448. o2.Actions.get("x_query_assemble_surface").getStatById(this.data.id, function(json){
  449. data = json.data
  450. }, null, false);
  451. this.data = data;
  452. return data;
  453. }else{
  454. return this.data;
  455. }
  456. },
  457. open : function (e) {
  458. if( this.data.id && this.data.query){
  459. var appId = "query.StatDesigner" + this.data.id;
  460. if (layout.desktop.apps[appId]){
  461. layout.desktop.apps[appId].setCurrent();
  462. }else {
  463. var options = {"id": this.data.id,"application": this.data.query, "appId": appId};
  464. layout.desktop.openApplication(e, "query.StatDesigner", options);
  465. }
  466. }
  467. }
  468. });
  469. o2.widget.O2QueryTable = new Class({
  470. Extends: o2.widget.O2View,
  471. getPersonData: function(){
  472. if (!this.data.query){
  473. var data = null;
  474. o2.Actions.get("x_query_assemble_surface").getTableById(this.data.id, function(json){
  475. data = json.data
  476. }, null, false);
  477. this.data = data;
  478. return data;
  479. }else{
  480. return this.data;
  481. }
  482. },
  483. open : function (e) {
  484. if( this.data.id && this.data.query){
  485. var appId = "query.TableDesigner" + this.data.id;
  486. if (layout.desktop.apps[appId]){
  487. layout.desktop.apps[appId].setCurrent();
  488. }else {
  489. var options = {"id": this.data.id,"application": this.data.query, "appId": appId};
  490. layout.desktop.openApplication(e, "query.TableDesigner", options);
  491. }
  492. }
  493. }
  494. });
  495. o2.widget.O2FormField = new Class({
  496. Extends: o2.widget.O2Group,
  497. getPersonData: function(){
  498. return this.data;
  499. }
  500. });
  501. o2.widget.O2Role = new Class({
  502. Extends: o2.widget.O2Group,
  503. getPersonData: function(){
  504. if (!this.data.distinguishedName){
  505. this.action.actions = {"getRole": {"uri": "/jaxrs/role/{id}"}};
  506. this.action.invoke({"name": "getRole", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  507. this.data = json.data;
  508. }.bind(this)});
  509. }
  510. }
  511. });
  512. o2.widget.O2File = new Class({
  513. Extends: o2.widget.O2Group,
  514. createInforNode: function(){
  515. this.inforNode = new Element("div", {
  516. "styles": this.style.identityInforNode
  517. });
  518. var extName = this.data.fileName.substring(this.data.fileName.lastIndexOf(".")+1, this.data.fileName.length).toLowerCase();
  519. if (["png","jpg","bmp","gif","jpeg","jpe"].indexOf(extName)!==-1){
  520. var url = (this.data.portal) ? MWF.xDesktop.getPortalFileUr(this.data.id, this.data.portal) : MWF.xDesktop.getProcessFileUr(this.data.id, this.data.application);
  521. var img = new Element("img", {"src": url, "styles": {"max-width": "280px", "max-height": "140px"}}).inject(this.inforNode);
  522. }else{
  523. var nameNode = new Element("div", {
  524. "styles": this.style.identityInforNameNode,
  525. "text": this.data.applicationName || this.data.appName || this.data.name
  526. }).inject(this.inforNode);
  527. }
  528. this.tooltip = new mBox.Tooltip({
  529. content: this.inforNode,
  530. setStyles: {content: {padding: 15, lineHeight: 20}},
  531. attach: this.node,
  532. transition: 'flyin'
  533. });
  534. },
  535. getPersonData: function(){
  536. return this.data;
  537. }
  538. });
  539. o2.widget.O2Script = new Class({
  540. Extends: o2.widget.O2Group,
  541. getPersonData: function(){
  542. return this.data;
  543. },
  544. createInforNode: function(){
  545. if( !this.data.appType )return false;
  546. this.inforNode = new Element("div", {
  547. "styles": this.style.identityInforNode
  548. });
  549. var nameNode = new Element("div", {
  550. "text": o2.LP[this.data.appType+"Name"]
  551. }).inject(this.inforNode);
  552. var nameTextNode = new Element("div", {
  553. "text": this.data.applicationName || this.data.appName
  554. }).inject(this.inforNode);
  555. this.tooltip = new mBox.Tooltip({
  556. content: this.inforNode,
  557. setStyles: {content: {padding: 15, lineHeight: 20}},
  558. attach: this.node,
  559. transition: 'flyin'
  560. });
  561. },
  562. open : function (e) {
  563. if( this.data.id && this.data.appId && this.data.appType){
  564. var appName;
  565. if( this.data.appType === "cms" ){
  566. appName = "cms.ScriptDesigner";
  567. }else if( this.data.appType === "portal" ){
  568. appName = "portal.ScriptDesigner";
  569. }else if( this.data.appType === "process" ) {
  570. appName = "process.ScriptDesigner";
  571. }
  572. var appId = appName + this.data.id;
  573. if (layout.desktop.apps[appId]){
  574. layout.desktop.apps[appId].setCurrent();
  575. }else {
  576. var options = {"id": this.data.id, "appId": appId, "application":this.data.appId};
  577. layout.desktop.openApplication(e, appName, options);
  578. }
  579. }
  580. }
  581. });
  582. o2.widget.O2FormStyle = new Class({
  583. Extends: o2.widget.O2Group,
  584. getPersonData: function(){
  585. return this.data;
  586. },
  587. open : function (e) {
  588. if( typeOf(this.data)==="object" && this.data.id && this.data.appId && this.data.type === "script"){
  589. var appName;
  590. if( this.data.appType === "cms" ){
  591. appName = "cms.ScriptDesigner";
  592. }else{
  593. appName = "process.ScriptDesigner";
  594. }
  595. var appId = appName + this.data.id;
  596. if (layout.desktop.apps[appId]){
  597. layout.desktop.apps[appId].setCurrent();
  598. }else {
  599. var options = {"id": this.data.id, "appId": appId, "application":this.data.appId};
  600. layout.desktop.openApplication(e, appName, options);
  601. }
  602. }
  603. }
  604. });
  605. o2.widget.O2Dictionary = new Class({
  606. Extends: o2.widget.O2Group,
  607. getPersonData: function(){
  608. return this.data;
  609. },
  610. createInforNode: function(){
  611. if( !this.data.appType )return false;
  612. this.inforNode = new Element("div", {
  613. "styles": this.style.identityInforNode
  614. });
  615. var nameNode = new Element("div", {
  616. "text": o2.LP[this.data.appType+"Name"]
  617. }).inject(this.inforNode);
  618. var nameTextNode = new Element("div", {
  619. "text": this.data.applicationName || this.data.appName
  620. }).inject(this.inforNode);
  621. this.tooltip = new mBox.Tooltip({
  622. content: this.inforNode,
  623. setStyles: {content: {padding: 15, lineHeight: 20}},
  624. attach: this.node,
  625. transition: 'flyin'
  626. });
  627. },
  628. open : function (e) {
  629. if( this.data.id && this.data.appId && this.data.appType){
  630. var appName;
  631. if( this.data.appType === "cms" ){
  632. appName = "cms.DictionaryDesigner";
  633. }else if( this.data.appType === "process" ) {
  634. appName = "process.DictionaryDesigner";
  635. }
  636. var appId = appName + this.data.id;
  637. if (layout.desktop.apps[appId]){
  638. layout.desktop.apps[appId].setCurrent();
  639. }else {
  640. var options = {"id": this.data.id, "appId": appId, "application":this.data.appId};
  641. layout.desktop.openApplication(e, appName, options);
  642. }
  643. }
  644. }
  645. });
  646. o2.widget.O2Other = new Class({
  647. Extends: o2.widget.O2Group,
  648. getPersonData: function(){
  649. return this.data;
  650. }
  651. });
  652. /**
  653. * @return {null}
  654. */
  655. o2.widget.O2Org = function(value, container, options){
  656. var v = (o2.typeOf(value)==="string") ? {"name": value} : value.distinguishedName;
  657. var t = v.distinguishedName || v.name || "";
  658. if (t) {
  659. var flag = t.substr(t.length - 1, 1);
  660. switch (flag.toLowerCase()) {
  661. case "i":
  662. return new o2.widget.O2Identity(v, container, options);
  663. case "p":
  664. return new o2.widget.O2Person(v, container, options);
  665. case "u":
  666. return new o2.widget.O2Unit(v, container, options);
  667. case "g":
  668. return new o2.widget.O2Group(v, container, options);
  669. case "r":
  670. return new o2.widget.O2Role(v, container, options);
  671. case "d":
  672. return new o2.widget.O2Duty(v, container, options);
  673. default:
  674. return new o2.widget.O2Other(v, container, options);
  675. }
  676. }
  677. return null;
  678. };
  679. // o2.widget.O2Identity.iditems = o2.widget.O2Identity.iditems || [];
  680. // o2.widget.O2Identity.intervalId = window.setInterval(function(){
  681. // if (o2.widget.O2Identity.iditems && o2.widget.O2Identity.iditems.length){
  682. // o2.widget.O2Identity.iditems.each(function(item){
  683. // if (item.tooltip){
  684. // debugger;
  685. // if (item.tooltip.options.attach){
  686. //
  687. // }
  688. // }
  689. // });
  690. // }
  691. // }, 10000);