O2Identity.js 28 KB

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