O2Identity.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  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);
  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. if (!this.data.woUnit){
  262. this.action.actions = {"getUnitduty": {"uri": "/jaxrs/unitduty/{id}"}};
  263. this.action.invoke({"name": "getUnitduty", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  264. this.data = json.data;
  265. }.bind(this)});
  266. }
  267. },
  268. createInforNode: function(){
  269. this.inforNode = new Element("div", {
  270. "styles": this.style.identityInforNode
  271. });
  272. var nameNode = new Element("div", {
  273. "styles": this.style.identityInforNameNode,
  274. "text": this.data.woUnit.levelName
  275. }).inject(this.inforNode);
  276. this.tooltip = new mBox.Tooltip({
  277. content: this.inforNode,
  278. setStyles: {content: {padding: 15, lineHeight: 20}},
  279. attach: this.node,
  280. transition: 'flyin'
  281. });
  282. },
  283. setText: function(){
  284. this.node.set("text", this.data.displayName || this.data.name);
  285. }
  286. });
  287. o2.widget.O2Group = new Class({
  288. Extends: o2.widget.O2Unit,
  289. getPersonData: function(){
  290. if (!this.data.distinguishedName){
  291. this.action.actions = {"getGroup": {"uri": "/jaxrs/group/{id}"}};
  292. this.action.invoke({"name": "getGroup", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  293. this.data = json.data;
  294. }.bind(this)});
  295. }
  296. },
  297. setText: function(){
  298. this.node.set("text", this.data.displayName || this.data.name);
  299. },
  300. createInforNode: function(){
  301. return false;
  302. }
  303. });
  304. o2.widget.O2Application = new Class({
  305. Extends: o2.widget.O2Group,
  306. getPersonData: function(){
  307. if (!this.data.name){
  308. this.action = new o2.xDesktop.Actions.RestActions("", "x_processplatform_assemble_surface", "");
  309. this.action.actions = {"getApplication": {"uri": "/jaxrs/application/{id}"}};
  310. this.action.invoke({"name": "getApplication", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  311. this.data = json.data;
  312. }.bind(this)});
  313. }
  314. }
  315. });
  316. o2.widget.O2CMSApplication = new Class({
  317. Extends: o2.widget.O2Group,
  318. getPersonData: function(){
  319. if (!this.data.name){
  320. o2.Actions.get("x_cms_assemble_control").getApplication((this.data.id || this.data.name), function(json){
  321. this.data = json.data;
  322. }.bind(this), null, false);
  323. // this.action = new o2.xDesktop.Actions.RestActions("", "x_cms_assemble_control", "");
  324. // this.action.actions = {"getApplication": {"uri": "/jaxrs/application/{id}"}};
  325. // this.action.invoke({"name": "getApplication", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  326. // this.data = json.data;
  327. // }.bind(this)});
  328. }
  329. }
  330. });
  331. o2.widget.O2Process = new Class({
  332. Extends: o2.widget.O2Group,
  333. getPersonData: function(){
  334. if (!this.data.name){
  335. this.action = new o2.xDesktop.Actions.RestActions("", "x_processplatform_assemble_surface", "");
  336. this.action.actions = {"getProces": {"uri": "/jaxrs/process/{id}/complex"}};
  337. this.action.invoke({"name": "getProces", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  338. this.data = json.data;
  339. }.bind(this)});
  340. }
  341. },
  342. createInforNode: function(){
  343. this.inforNode = new Element("div", {
  344. "styles": this.style.identityInforNode
  345. });
  346. var nameNode = new Element("div", {
  347. "styles": this.style.identityInforNameNode,
  348. "text": this.data.name || this.data.applicationName || this.data.appName
  349. }).inject(this.inforNode);
  350. this.tooltip = new mBox.Tooltip({
  351. content: this.inforNode,
  352. setStyles: {content: {padding: 15, lineHeight: 20}},
  353. attach: this.node,
  354. transition: 'flyin'
  355. });
  356. }
  357. });
  358. o2.widget.O2CMSCategory = new Class({
  359. Extends: o2.widget.O2Group,
  360. getPersonData: function(){
  361. if (!this.data.name){
  362. o2.Actions.get("x_cms_assemble_control").getCategory((this.data.id || this.data.name), function(json){
  363. this.data = json.data;
  364. }.bind(this), null, false);
  365. }
  366. },
  367. createInforNode: function(){
  368. this.inforNode = new Element("div", {
  369. "styles": this.style.identityInforNode
  370. });
  371. var nameNode = new Element("div", {
  372. "styles": this.style.identityInforNameNode,
  373. "text": this.data.applicationName || this.data.appName
  374. }).inject(this.inforNode);
  375. this.tooltip = new mBox.Tooltip({
  376. content: this.inforNode,
  377. setStyles: {content: {padding: 15, lineHeight: 20}},
  378. attach: this.node,
  379. transition: 'flyin'
  380. });
  381. }
  382. });
  383. o2.widget.O2View = new Class({
  384. Extends: o2.widget.O2Group,
  385. getPersonData: function(){
  386. if (!this.data.query){
  387. var data = null;
  388. o2.Actions.get("x_query_assemble_surface").getStatById(this.data.id, function(json){
  389. data = json.data
  390. }, null, false);
  391. this.data = data;
  392. return data;
  393. }else{
  394. return this.data;
  395. }
  396. },
  397. createInforNode: function(){
  398. this.inforNode = new Element("div", {
  399. "styles": this.style.identityInforNode
  400. });
  401. var nameNode = new Element("div", {
  402. "styles": this.style.identityInforNameNode,
  403. "text": this.data.applicationName || this.data.appName || this.data.name
  404. }).inject(this.inforNode);
  405. this.tooltip = new mBox.Tooltip({
  406. content: this.inforNode,
  407. setStyles: {content: {padding: 15, lineHeight: 20}},
  408. attach: this.node,
  409. transition: 'flyin'
  410. });
  411. }
  412. });
  413. o2.widget.O2CMSView = new Class({
  414. Extends: o2.widget.O2View
  415. });
  416. o2.widget.O2QueryView = new Class({
  417. Extends: o2.widget.O2View,
  418. getPersonData: function(){
  419. if (!this.data.query){
  420. var data = null;
  421. o2.Actions.get("x_query_assemble_surface").getViewById(this.data.id, function(json){
  422. data = json.data
  423. }, null, false);
  424. this.data = data;
  425. return data;
  426. }else{
  427. return this.data;
  428. }
  429. },
  430. open : function (e) {
  431. if( this.data.id && this.data.query ){
  432. var appId = "query.ViewDesigner" + this.data.id;
  433. if (layout.desktop.apps[appId]){
  434. layout.desktop.apps[appId].setCurrent();
  435. }else {
  436. var options = {"id": this.data.id, "application": this.data.query, "appId": appId};
  437. layout.desktop.openApplication(e, "query.ViewDesigner", options);
  438. }
  439. }
  440. }
  441. });
  442. o2.widget.O2QueryStatement = new Class({
  443. Extends: o2.widget.O2View,
  444. getPersonData: function(){
  445. if (!this.data.query){
  446. var data = null;
  447. o2.Actions.load("x_query_assemble_designer").StatementAction.get(this.data.id, function(json){
  448. data = json.data
  449. }, null, false);
  450. this.data = data;
  451. return data;
  452. }else{
  453. return this.data;
  454. }
  455. },
  456. open : function (e) {
  457. if( this.data.id && this.data.query ){
  458. var appId = "query.StatementDesigner" + this.data.id;
  459. if (layout.desktop.apps[appId]){
  460. layout.desktop.apps[appId].setCurrent();
  461. }else {
  462. var options = {"id": this.data.id, "application": this.data.query, "appId": appId};
  463. layout.desktop.openApplication(e, "query.StatementDesigner", options);
  464. }
  465. }
  466. }
  467. });
  468. o2.widget.O2QueryStat = new Class({
  469. Extends: o2.widget.O2View,
  470. getPersonData: function(){
  471. if (!this.data.query){
  472. var data = null;
  473. o2.Actions.get("x_query_assemble_surface").getStatById(this.data.id, function(json){
  474. data = json.data
  475. }, null, false);
  476. this.data = data;
  477. return data;
  478. }else{
  479. return this.data;
  480. }
  481. },
  482. open : function (e) {
  483. if( this.data.id && this.data.query){
  484. var appId = "query.StatDesigner" + this.data.id;
  485. if (layout.desktop.apps[appId]){
  486. layout.desktop.apps[appId].setCurrent();
  487. }else {
  488. var options = {"id": this.data.id,"application": this.data.query, "appId": appId};
  489. layout.desktop.openApplication(e, "query.StatDesigner", options);
  490. }
  491. }
  492. }
  493. });
  494. o2.widget.O2QueryTable = new Class({
  495. Extends: o2.widget.O2View,
  496. getPersonData: function(){
  497. if (!this.data.query){
  498. var data = null;
  499. o2.Actions.get("x_query_assemble_surface").getTableById(this.data.id, function(json){
  500. data = json.data
  501. }, null, false);
  502. this.data = data;
  503. return data;
  504. }else{
  505. return this.data;
  506. }
  507. },
  508. open : function (e) {
  509. if( this.data.id && this.data.query){
  510. var appId = "query.TableDesigner" + this.data.id;
  511. if (layout.desktop.apps[appId]){
  512. layout.desktop.apps[appId].setCurrent();
  513. }else {
  514. var options = {"id": this.data.id,"application": this.data.query, "appId": appId};
  515. layout.desktop.openApplication(e, "query.TableDesigner", options);
  516. }
  517. }
  518. }
  519. });
  520. o2.widget.O2FormField = new Class({
  521. Extends: o2.widget.O2Group,
  522. getPersonData: function(){
  523. return this.data;
  524. }
  525. });
  526. o2.widget.O2Role = new Class({
  527. Extends: o2.widget.O2Group,
  528. getPersonData: function(){
  529. if (!this.data.distinguishedName){
  530. this.action.actions = {"getRole": {"uri": "/jaxrs/role/{id}"}};
  531. this.action.invoke({"name": "getRole", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
  532. this.data = json.data;
  533. }.bind(this)});
  534. }
  535. }
  536. });
  537. o2.widget.O2File = new Class({
  538. Extends: o2.widget.O2Group,
  539. createInforNode: function(){
  540. this.inforNode = new Element("div", {
  541. "styles": this.style.identityInforNode
  542. });
  543. var extName = this.data.fileName.substring(this.data.fileName.lastIndexOf(".")+1, this.data.fileName.length).toLowerCase();
  544. if (["png","jpg","bmp","gif","jpeg","jpe"].indexOf(extName)!==-1){
  545. var url = (this.data.portal) ? MWF.xDesktop.getPortalFileUr(this.data.id, this.data.portal) : MWF.xDesktop.getProcessFileUr(this.data.id, this.data.application);
  546. var img = new Element("img", {"src": url, "styles": {"max-width": "280px", "max-height": "140px"}}).inject(this.inforNode);
  547. }else{
  548. var nameNode = new Element("div", {
  549. "styles": this.style.identityInforNameNode,
  550. "text": this.data.applicationName || this.data.appName || this.data.name
  551. }).inject(this.inforNode);
  552. }
  553. this.tooltip = new mBox.Tooltip({
  554. content: this.inforNode,
  555. setStyles: {content: {padding: 15, lineHeight: 20}},
  556. attach: this.node,
  557. transition: 'flyin'
  558. });
  559. },
  560. getPersonData: function(){
  561. return this.data;
  562. }
  563. });
  564. o2.widget.O2Script = new Class({
  565. Extends: o2.widget.O2Group,
  566. getPersonData: function(){
  567. return this.data;
  568. },
  569. createInforNode: function(){
  570. if( !this.data.appType )return false;
  571. this.inforNode = new Element("div", {
  572. "styles": this.style.identityInforNode
  573. });
  574. var nameNode = new Element("div", {
  575. "text": o2.LP[this.data.appType+"Name"]
  576. }).inject(this.inforNode);
  577. var nameTextNode = new Element("div", {
  578. "text": this.data.applicationName || this.data.appName
  579. }).inject(this.inforNode);
  580. this.tooltip = new mBox.Tooltip({
  581. content: this.inforNode,
  582. setStyles: {content: {padding: 15, lineHeight: 20}},
  583. attach: this.node,
  584. transition: 'flyin'
  585. });
  586. },
  587. open : function (e) {
  588. if( this.data.id && this.data.appId && this.data.appType){
  589. var appName;
  590. if( this.data.appType === "cms" ){
  591. appName = "cms.ScriptDesigner";
  592. }else if( this.data.appType === "portal" ){
  593. appName = "portal.ScriptDesigner";
  594. }else if( this.data.appType === "process" ) {
  595. appName = "process.ScriptDesigner";
  596. }
  597. var appId = appName + this.data.id;
  598. if (layout.desktop.apps[appId]){
  599. layout.desktop.apps[appId].setCurrent();
  600. }else {
  601. var options = {"id": this.data.id, "appId": appId, "application":this.data.appId};
  602. layout.desktop.openApplication(e, appName, options);
  603. }
  604. }
  605. }
  606. });
  607. o2.widget.O2FormStyle = new Class({
  608. Extends: o2.widget.O2Group,
  609. getPersonData: function(){
  610. return this.data;
  611. },
  612. open : function (e) {
  613. if( typeOf(this.data)==="object" && this.data.id && this.data.appId && this.data.type === "script"){
  614. var appName;
  615. if( this.data.appType === "cms" ){
  616. appName = "cms.ScriptDesigner";
  617. }else{
  618. appName = "process.ScriptDesigner";
  619. }
  620. var appId = appName + this.data.id;
  621. if (layout.desktop.apps[appId]){
  622. layout.desktop.apps[appId].setCurrent();
  623. }else {
  624. var options = {"id": this.data.id, "appId": appId, "application":this.data.appId};
  625. layout.desktop.openApplication(e, appName, options);
  626. }
  627. }
  628. }
  629. });
  630. o2.widget.O2Dictionary = new Class({
  631. Extends: o2.widget.O2Group,
  632. getPersonData: function(){
  633. return this.data;
  634. },
  635. createInforNode: function(){
  636. if( !this.data.appType )return false;
  637. this.inforNode = new Element("div", {
  638. "styles": this.style.identityInforNode
  639. });
  640. var nameNode = new Element("div", {
  641. "text": o2.LP[this.data.appType+"Name"]
  642. }).inject(this.inforNode);
  643. var nameTextNode = new Element("div", {
  644. "text": this.data.applicationName || this.data.appName
  645. }).inject(this.inforNode);
  646. this.tooltip = new mBox.Tooltip({
  647. content: this.inforNode,
  648. setStyles: {content: {padding: 15, lineHeight: 20}},
  649. attach: this.node,
  650. transition: 'flyin'
  651. });
  652. },
  653. open : function (e) {
  654. if( this.data.id && this.data.appId && this.data.appType){
  655. var appName;
  656. if( this.data.appType === "cms" ){
  657. appName = "cms.DictionaryDesigner";
  658. }else if( this.data.appType === "process" ) {
  659. appName = "process.DictionaryDesigner";
  660. }
  661. var appId = appName + this.data.id;
  662. if (layout.desktop.apps[appId]){
  663. layout.desktop.apps[appId].setCurrent();
  664. }else {
  665. var options = {"id": this.data.id, "appId": appId, "application":this.data.appId};
  666. layout.desktop.openApplication(e, appName, options);
  667. }
  668. }
  669. }
  670. });
  671. o2.widget.O2Other = new Class({
  672. Extends: o2.widget.O2Group,
  673. getPersonData: function(){
  674. return this.data;
  675. }
  676. });
  677. /**
  678. * @return {null}
  679. */
  680. o2.widget.O2Org = function(value, container, options){
  681. var v = (o2.typeOf(value)==="string") ? {"name": value} : value.distinguishedName;
  682. var t = v.distinguishedName || v.name || "";
  683. if (t) {
  684. var flag = t.substr(t.length - 1, 1);
  685. switch (flag.toLowerCase()) {
  686. case "i":
  687. return new o2.widget.O2Identity(v, container, options);
  688. case "p":
  689. return new o2.widget.O2Person(v, container, options);
  690. case "u":
  691. return new o2.widget.O2Unit(v, container, options);
  692. case "g":
  693. return new o2.widget.O2Group(v, container, options);
  694. case "r":
  695. return new o2.widget.O2Role(v, container, options);
  696. case "d":
  697. return new o2.widget.O2Duty(v, container, options);
  698. default:
  699. return new o2.widget.O2Other(v, container, options);
  700. }
  701. }
  702. return null;
  703. };
  704. // o2.widget.O2Identity.iditems = o2.widget.O2Identity.iditems || [];
  705. // o2.widget.O2Identity.intervalId = window.setInterval(function(){
  706. // if (o2.widget.O2Identity.iditems && o2.widget.O2Identity.iditems.length){
  707. // o2.widget.O2Identity.iditems.each(function(item){
  708. // if (item.tooltip){
  709. // debugger;
  710. // if (item.tooltip.options.attach){
  711. //
  712. // }
  713. // }
  714. // });
  715. // }
  716. // }, 10000);