PersonExplorer.js 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032
  1. // MWF.xDesktop.requireApp("Organization", "GroupExplorer", null, false);
  2. // MWF.xDesktop.requireApp("Organization", "OrgExplorer", null, false);
  3. MWF.xDesktop.requireApp("Org", "$Explorer", null, false);
  4. MWF.require("MWF.widget.O2Identity", null, false);
  5. MWF.xApplication.Org.PersonExplorer = new Class({
  6. Extends: MWF.xApplication.Org.$Explorer,
  7. Implements: [Options, Events],
  8. options: {
  9. "style": "default"
  10. },
  11. _isActionManager: function(){
  12. return (MWF.AC.isOrganizationManager() || MWF.AC.isPersonManager() || MWF.AC.isUnitManager());
  13. },
  14. _listElementNext: function(lastid, count, callback){
  15. this.actions.listPersonNext(lastid||"(0)", count, function(json){
  16. if (callback) {
  17. callback.apply(this, [json]);
  18. }
  19. }.bind(this));
  20. },
  21. _newElement: function(data, explorer, i){
  22. return new MWF.xApplication.Org.PersonExplorer.Person(data, explorer, this.isEditor, i);
  23. },
  24. _listElementByKey: function(callback, failure, key){
  25. //this.actions.listPersonByPinyin(function(json){
  26. this.actions.listPersonByKey(function(json){
  27. if (callback) {
  28. callback.apply(this, [json]);
  29. }
  30. }.bind(this), failure, key);
  31. },
  32. _getAddElementData: function(){
  33. return {
  34. "genderType": "m",
  35. "signature": "",
  36. "description": "",
  37. "unique": "",
  38. "orderNumber": "",
  39. "superior": "",
  40. "officePhone": "",
  41. "boardDate": "",
  42. "birthday": "",
  43. "employee": "",
  44. "password": "",
  45. "display": "",
  46. "qq": "",
  47. "mail": "",
  48. "weixin": "",
  49. "weibo": "",
  50. "mobile": "",
  51. "name": "",
  52. "ipAddress" : "",
  53. "controllerList": [],
  54. "woPersonAttributeList":[],
  55. "woIdentityList": [],
  56. "control": {
  57. "allowEdit": true,
  58. "allowDelete": true
  59. }
  60. };
  61. }
  62. });
  63. MWF.xApplication.Org.PersonExplorer.Person = new Class({
  64. Extends: MWF.xApplication.Org.$Explorer.Item,
  65. showItemProperty: function(){
  66. this.content = new MWF.xApplication.Org.PersonExplorer.PersonContent(this);
  67. },
  68. _loadTextNode: function(){
  69. var html = "<div style='float:left; height:50px; overflow:hidden'>"+this.data.name+"</div>";
  70. html += "<div style='float: right; overflow:hidden; font-size: 12px; color: #aaaaaa;'>"+(this.data.mobile || "")+"</div>";
  71. this.textNode.set({"html": html});
  72. },
  73. "delete": function(success, failure){
  74. this.explorer.actions.deletePerson(this.data.id, function(){
  75. this.destroy();
  76. if (success) success();
  77. }.bind(this), function(xhr, text, error){
  78. var errorText = error;
  79. if (xhr) errorText = xhr.responseText;
  80. MWF.xDesktop.notice("error", {x: "right", y:"top"}, "request json error: "+errorText);
  81. if (failure) failure();
  82. });
  83. },
  84. _getIcon: function(nocache){
  85. var url = (this.data.id) ? this.explorer.actions.getPersonIcon(this.data.id) : "../x_component_Org/$Explorer/default/icon/man.png";
  86. return (nocache) ? url+"?"+(new Date().getTime()) : url;
  87. //return (this.data.id) ? this.explorer.actions.getPersonIcon(this.data.id) : "../x_component_Org/$Explorer/default/icon/man.png";
  88. // var src = "data:image/png;base64,"+this.data.icon;
  89. // if (!this.data.icon){
  90. // if (this.data.genderType==="f"){
  91. // src = "../x_component_Org/$Explorer/default/icon/female24.png"
  92. // }else{
  93. // src = "../x_component_Org/$Explorer/default/icon/man24.png"
  94. // }
  95. // }
  96. // return src;
  97. }
  98. });
  99. MWF.xApplication.Org.PersonExplorer.PersonContent = new Class({
  100. Extends: MWF.xApplication.Org.$Explorer.ItemContent,
  101. _getData: function(callback){
  102. if (this.item.data.id){
  103. this.explorer.actions.getPerson(function(json){
  104. this.data = json.data;
  105. this.item.data = json.data;
  106. if (callback) callback();
  107. }.bind(this), null, this.item.data.id);
  108. }else{
  109. this.data = this.item.data;
  110. if (callback) callback();
  111. }
  112. },
  113. edit: function(){
  114. if (this.baseInfor) this.baseInfor.edit();
  115. },
  116. _showItemPropertyTitle: function(){
  117. this.titleInfor = new MWF.xApplication.Org.PersonExplorer.PersonContent.TitleInfor(this);
  118. //this.baseInfor = new MWF.xApplication.Org.BaseInfor(this);
  119. },
  120. _showItemPropertyBottom: function(){
  121. this.bottomInfor = new MWF.xApplication.Org.PersonExplorer.PersonContent.BottomInfor(this);
  122. },
  123. loadItemPropertyTab: function(callback){
  124. this.propertyTabContainerNode = new Element("div", {"styles": this.item.style.tabTitleNode}).inject(this.propertyContentNode, "top");
  125. MWF.require("MWF.widget.Tab", function(){
  126. this.propertyTab = new MWF.widget.Tab(this.propertyContentNode, {"style": "unit"});
  127. this.propertyTab.load();
  128. this.propertyTab.tabNodeContainer.inject(this.propertyTabContainerNode);
  129. this.propertyTab.tabNodeContainer.setStyle("width","480px");
  130. if (callback) callback();
  131. }.bind(this));
  132. },
  133. _loadTabs: function(){
  134. this.baseContentNode = new Element("div", {"styles": this.item.style.tabContentNode});
  135. this.basePage = this.propertyTab.addTab(this.baseContentNode, this.explorer.app.lp.personBaseText);
  136. this.attributeContentNode = new Element("div", {"styles": this.item.style.tabContentNode});
  137. this.attributePage = this.propertyTab.addTab(this.attributeContentNode, this.explorer.app.lp.personAttributeText);
  138. this.identityContentNode = new Element("div", {"styles": this.item.style.tabContentNode});
  139. this.identityPage = this.propertyTab.addTab(this.identityContentNode, this.explorer.app.lp.personIdentityText);
  140. this.roleContentNode = new Element("div", {"styles": this.item.style.tabContentNode});
  141. this.rolePage = this.propertyTab.addTab(this.roleContentNode, this.explorer.app.lp.personRoleText);
  142. // this.managerContentNode = new Element("div", {"styles": this.item.style.tabContentNode});
  143. // this.managerPage = this.propertyTab.addTab(this.managerContentNode, this.explorer.app.lp.controllerListText);
  144. },
  145. _loadContent: function(){
  146. this._listBaseInfor();
  147. if( this.data && this.data.id ){
  148. this._listAttribute();
  149. this._listIdentity();
  150. this._listRole();
  151. this.loadListCount();
  152. }
  153. //
  154. // this.showAttribute();
  155. },
  156. loadList : function(){
  157. this._listAttribute();
  158. this._listIdentity();
  159. this._listRole();
  160. this.loadListCount();
  161. },
  162. loadListCount: function(){
  163. if (this.data.woIdentityList){
  164. var identityCount = this.data.woIdentityList.length;
  165. if (identityCount){
  166. if (!this.identityCountNode){
  167. this.identityCountNode = new Element("div", {"styles": this.item.style.tabCountNode, "text": identityCount}).inject(this.identityPage.tabNode);
  168. }else{
  169. this.identityCountNode.set("text", identityCount);
  170. }
  171. }else{
  172. if (this.identityCountNode) this.identityCountNode.destroy();
  173. }
  174. }
  175. if (this.data.woPersonAttributeList){
  176. var attributeCount = this.data.woPersonAttributeList.length;
  177. if (attributeCount){
  178. if (!this.attributeCountNode){
  179. this.attributeCountNode = new Element("div", {"styles": this.item.style.tabCountNode, "text": attributeCount}).inject(this.attributePage.tabNode);
  180. }else{
  181. this.attributeCountNode.set("text", attributeCount);
  182. }
  183. }else{
  184. if (this.attributeCountNode) this.attributeCountNode.destroy();
  185. }
  186. }
  187. if( this.roleDataList ){
  188. var roleCount = this.roleDataList.length;
  189. if (roleCount){
  190. if (!this.roleCountNode){
  191. this.roleCountNode = new Element("div", {"styles": this.item.style.tabCountNode, "text": roleCount}).inject(this.rolePage.tabNode);
  192. }else{
  193. this.roleCountNode.set("text", roleCount);
  194. }
  195. }else{
  196. if (this.roleCountNode) this.roleCountNode.destroy();
  197. }
  198. }
  199. // var groupCount = this.data.groupList.length;
  200. // if (groupCount){
  201. // this.groupCountNode = new Element("div", {"styles": this.item.style.tabCountNode, "text": groupCount}).inject(this.groupMemberPage.tabNode);
  202. // }
  203. },
  204. _listBaseInfor: function(){
  205. this.baseInfor = new MWF.xApplication.Org.PersonExplorer.PersonContent.BaseInfor(this);
  206. },
  207. _listAttribute: function(){
  208. this.attributeList = new MWF.xApplication.Org.List(this.attributeContentNode, this, {
  209. "action": this.data.control.allowEdit,
  210. "data": {
  211. "person": this.data.id,
  212. "name": "",
  213. "unique": "",
  214. "orderNumber": "",
  215. "attributeList": [],
  216. "description":""
  217. },
  218. "attr": ["name", {
  219. "get": function(){return this.attributeList.join(",")},
  220. "set": function(value){ this.attributeList = value.split(/,\s*/g)}
  221. }, "description"],
  222. "onPostSave": function(item, id){
  223. if (!item.data.id){
  224. item.data.id = id;
  225. this.data.woPersonAttributeList.push(item.data);
  226. }
  227. this.loadListCount();
  228. // if (!item.data.id){
  229. // if (this.attributeCountNode){
  230. // var count = this.attributeCountNode.get("text").toInt()+1;
  231. // this.attributeCountNode.set("text", count);
  232. // }
  233. // }
  234. }.bind(this),
  235. "onPostDelete": function(delCount){
  236. if (this.attributeCountNode){
  237. var count = this.attributeCountNode.get("text").toInt()-delCount;
  238. this.attributeCountNode.set("text", count);
  239. }
  240. }.bind(this)
  241. });
  242. this.attributeList.load([
  243. {"style": "width: 20%", "text": this.explorer.app.lp.attributeName},
  244. {"style": "", "text": this.explorer.app.lp.attributeValue},
  245. {"style": "", "text": this.explorer.app.lp.description}
  246. ]);
  247. this.data.woPersonAttributeList.each(function(item){
  248. this.attributeList.push(item);
  249. }.bind(this));
  250. // if (this.data.id){
  251. // this.explorer.actions.listPersonAttribute(function(json){
  252. //
  253. // var attributeCount = json.data.length;
  254. // if (attributeCount){
  255. // this.attributeCountNode = new Element("div", {"styles": this.item.style.tabCountNode, "text": attributeCount}).inject(this.attributePage.tabNode);
  256. // }
  257. //
  258. // json.data.each(function(item){
  259. // //this.attributes.push(new MWF.xApplication.Org.PersonExplorer.PersonAttribute(this.attributeTabContentNode.getElement("table").getFirst(), item, this, this.explorer.css.list));
  260. // this.attributeList.push(item);
  261. // }.bind(this));
  262. // }.bind(this), null, this.data.id);
  263. // }
  264. },
  265. _listIdentity: function(){
  266. var _self = this;
  267. this.identityList = new MWF.xApplication.Org.List(this.identityContentNode, this, {
  268. "action": false,
  269. "canEdit": false,
  270. "saveAction": "saveIdentity",
  271. "data": {
  272. "person": this.data.id,
  273. "name": "",
  274. "attributeList": []
  275. },
  276. "attr": ["name", {
  277. "get": function(){ return ""; },
  278. "events": {
  279. "init": function(){
  280. var contentNode = this.td;
  281. new MWF.widget.O2Unit(this.data.woUnit, contentNode, {"style": "xform"});
  282. }
  283. }
  284. }, {
  285. "get": function(){ return this.distinguishedName; },
  286. "set": function(value){ this.distinguishedName = value; }
  287. }, {
  288. "get": function(){ return ""; },
  289. "events": {
  290. "init": function(){
  291. var contentNode = this.td;
  292. if (this.data.woUnitDutyList){
  293. this.data.woUnitDutyList.each(function(duty){
  294. new MWF.widget.O2Duty(duty, contentNode, {"style": "xform"});
  295. }.bind(this));
  296. }
  297. }
  298. }
  299. }, {
  300. "getHtml": function(){
  301. if (this.major){
  302. return "<div style='width:24px; height:24px; background:url(../x_component_Org/$Explorer/"+
  303. _self.explorer.app.options.style+"/icon/mainid.png) center center no-repeat'></div>";
  304. }else{
  305. return "<div title='"+_self.explorer.app.lp.setIdentityMain+"' style='width:24px; height:24px; cursor: pointer; background:url(../x_component_Org/$Explorer/"+
  306. _self.explorer.app.options.style+"/icon/select.png) center center no-repeat'></div>";
  307. }
  308. },
  309. "events": {
  310. "click": function(){
  311. if (!this.data.major){
  312. if (_self.data.control.allowEdit){_self.setMainIdentity(this.data, this.td, this.item);}
  313. }
  314. }
  315. }
  316. },{
  317. "getHtml": function(){
  318. if (_self.data.control.allowEdit){
  319. return "<div style='width:24px; height:24px; cursor: pointer; background:url(../x_component_Org/$Explorer/"+
  320. _self.explorer.app.options.style+"/icon/edit.png) center center no-repeat'></div>";
  321. }
  322. return "";
  323. },
  324. "events": {
  325. "click": function(){
  326. debugger;
  327. if (_self.data.control.allowEdit){_self.editIdentity(this.data, this.td, this.item);}
  328. }
  329. }
  330. }]
  331. });
  332. this.identityList.load([
  333. {"style": "width: 12%", "text": this.explorer.app.lp.IdentityName},
  334. {"style": "width: 12%", "text": this.explorer.app.lp.IdentityInUnit},
  335. {"style": "width: 44%", "text": this.explorer.app.lp.personUnique},
  336. {"style": "width: 20%", "text": this.explorer.app.lp.IdentityDuty},
  337. {"style": "width: 10%", "text": this.explorer.app.lp.IdentityMain},
  338. {"style": "width: 30px", "text": ""}
  339. ]);
  340. this.data.woIdentityList.each(function(item){
  341. this.identityList.push(item);
  342. }.bind(this));
  343. },
  344. setMainIdentity: function(data, node, item){
  345. data.major = true;
  346. this.explorer.actions.saveIdentity(data, function(json){
  347. this.explorer.actions.getPerson(function(iJson){
  348. // data = iJson.data;
  349. // item.reload(iJson.data);
  350. this.data.woIdentityList = iJson.data.woIdentityList;
  351. this.identityList.clear();
  352. this.data.woIdentityList.each(function(item){
  353. this.identityList.push(item);
  354. }.bind(this));
  355. }.bind(this), null, this.data.id);
  356. }.bind(this));
  357. },
  358. editIdentity: function(data, node, item){
  359. var _self = this;
  360. var position = node.getPosition(this.explorer.app.content);
  361. var width = 700;
  362. var height = 170;
  363. var size = this.explorer.app.content.getSize();
  364. var x = (size.x-width)/2;
  365. var y = (size.y-height)/2;
  366. if (x<0) x = 0;
  367. if (y<20) y = 20;
  368. MWF.require("MWF.xDesktop.Dialog", function() {
  369. var dlg = new MWF.xDesktop.Dialog({
  370. "title": this.explorer.app.lp.modifyIdentity,
  371. "style": "org",
  372. "top": y - 20,
  373. "left": x,
  374. "fromTop": position.y - 20,
  375. "fromLeft": position.x,
  376. "width": width,
  377. "height": height,
  378. "html": "<div></div>",
  379. "maskNode": this.explorer.app.content,
  380. "container": this.explorer.app.content,
  381. "buttonList": [
  382. {
  383. "text": MWF.LP.process.button.ok,
  384. "action": function () {
  385. _self.saveIdentity(dlg, data, item);
  386. this.close();
  387. }
  388. },
  389. {
  390. "text": MWF.LP.process.button.cancel,
  391. "action": function () {
  392. this.close();
  393. }
  394. }
  395. ]
  396. });
  397. dlg.show();
  398. var node = dlg.content.getFirst();
  399. var html = "<table width='90%' cellpadding='0px' cellspacing='5px' align='center' style='margin-top:10px'>" +
  400. "<tr><th width='30%'>"+this.explorer.app.lp.IdentityName+"</th><th>"+this.explorer.app.lp.personUnique+"</th><th>"+this.explorer.app.lp.IdentityMain+"</th></tr>" +
  401. "<tr><td style='text-align: center'><input value='' type='type' style='padding: 0px 3px; width: 95%; border: 1px solid #cccccc; height: 24px; border-radius: 3px; line-height: 24px;'/></td>" +
  402. "<td style='text-align: center'><input value='' type='type' style='padding: 0px 3px; width: 95%; border: 1px solid #cccccc; height: 24px; border-radius: 3px; line-height: 24px;'/></td>" +
  403. "<td style='text-align: center'><input value='yes' type='checkbox' "+((data.major) ? "checked" : "")+"/></td></tr></table>";
  404. node.set("html", html);
  405. var inputs = node.getElements("input");
  406. if (inputs[0]) inputs[0].set("value", data.name);
  407. if (inputs[1]) inputs[1].set("value", data.unique);
  408. //if (inputs[2]) inputs[2].set("value", data.major)
  409. }.bind(this));
  410. },
  411. saveIdentity: function(dlg, data, item){
  412. var node = dlg.content.getFirst();
  413. var inputs = node.getElements("input");
  414. var name = inputs[0].get("value");
  415. var unique = inputs[1].get("value");
  416. var major = (inputs[2].checked);
  417. if (data.name!==name || data.unique!==unique){
  418. if (name) data.name = name;
  419. data.unique=unique;
  420. data.major = major;
  421. this.explorer.actions.saveIdentity(data, function(json){
  422. this.explorer.actions.getPerson(function(iJson){
  423. // data = iJson.data;
  424. // item.reload(iJson.data);
  425. this.data.woIdentityList = iJson.data.woIdentityList;
  426. this.identityList.clear();
  427. this.data.woIdentityList.each(function(item){
  428. this.identityList.push(item);
  429. }.bind(this));
  430. }.bind(this), null, this.data.id);
  431. }.bind(this));
  432. }
  433. },
  434. _listRole: function(){
  435. var _self = this;
  436. this.roleList = new MWF.xApplication.Org.List(this.roleContentNode, this, {
  437. "action": false,
  438. "canEdit": false,
  439. "data": {
  440. // "person": this.data.id,
  441. // "name": "",
  442. // "unique": "",
  443. // "orderNumber": "",
  444. // "attributeList": [],
  445. // "description":""
  446. },
  447. "attr": ["name",
  448. "distinguishedName",
  449. "description",{
  450. "getHtml": function(){
  451. if (_self.data.control.allowEdit){
  452. return "<div style='width:24px; height:24px; cursor: pointer; background:url(../x_component_Org/$Explorer/"+
  453. _self.explorer.app.options.style+"/icon/open.png) center center no-repeat'></div>";
  454. }
  455. return "";
  456. },
  457. "events": {
  458. "click": function(){
  459. debugger;
  460. _self.explorer.openRole(this.data, this.td);
  461. }
  462. }
  463. }]
  464. });
  465. this.roleList.load([
  466. {"style": "width: 15%", "text": this.explorer.app.lp.roleName},
  467. {"style": "width: 30%", "text": this.explorer.app.lp.roleFullName},
  468. {"style": "", "text": this.explorer.app.lp.description},
  469. {"style": "width: 30px", "text": ""}
  470. ]);
  471. if( this.data.id ){
  472. o2.Actions.load("x_organization_assemble_control").RoleAction.listWithPerson(this.data.id, function (json) {
  473. this.roleDataList = json.data;
  474. json.data.each( function ( item ) {
  475. this.roleList.push(item);
  476. }.bind(this))
  477. }.bind(this), null, false);
  478. }
  479. // this.data.woPersonAttributeList.each(function(item){
  480. // this.roleList.push(item);
  481. // }.bind(this));
  482. }
  483. });
  484. MWF.xApplication.Org.PersonExplorer.PersonContent.TitleInfor = new Class({
  485. Extends: MWF.xApplication.Org.$Explorer.ItemContent.TitleInfor,
  486. loadAction: function(){
  487. //this.explorer.app.lp.edit
  488. this.nameNode.setStyle("margin-right", "80px");
  489. if (MWF.AC.isOrganizationManager() || MWF.AC.isPersonManager()){
  490. this.resetPasswordAction = new Element("div", {"styles": this.style.titleInforResetPasswordNode, "text": this.item.explorer.app.lp.resetPassword}).inject(this.nameNode, "before");
  491. this.resetPasswordAction.addEvent("click", function(e){this.resetPassword(e);}.bind(this));
  492. }
  493. if (this.data.control.allowEdit){
  494. this.iconNode.setStyle("cursor", "pointer");
  495. this.iconNode.addEvent("click", function(){this.changePersonIcon();}.bind(this));
  496. }
  497. },
  498. resetPassword: function(e){
  499. var _self = this;
  500. var text = this.item.explorer.app.lp.resetPasswordText;
  501. text = text.replace("{name}", this.data.name);
  502. this.item.explorer.app.confirm("info", e, this.item.explorer.app.lp.resetPasswordTitle, text, "360", "120", function(){
  503. _self.doResetPassword();
  504. this.close();
  505. }, function(){
  506. this.close();
  507. });
  508. },
  509. doResetPassword: function(){
  510. var action = MWF.Actions.get("x_organization_assemble_control");
  511. action.resetPassword(this.data.id, function(){
  512. var text = this.item.explorer.app.lp.resetPasswordSuccess;
  513. text = text.replace("{name}", this.data.name);
  514. this.item.explorer.app.notice(text, "success");
  515. }.bind(this));
  516. },
  517. changePersonIcon: function(){
  518. var options = {};
  519. var width = "668";
  520. var height = "510";
  521. width = width.toInt();
  522. height = height.toInt();
  523. var size = this.explorer.app.content.getSize();
  524. var x = (size.x-width)/2;
  525. var y = (size.y-height)/2;
  526. if (x<0) x = 0;
  527. if (y<0) y = 0;
  528. if (layout.mobile){
  529. x = 20;
  530. y = 0;
  531. }
  532. var _self = this;
  533. MWF.require("MWF.xDesktop.Dialog", function() {
  534. MWF.require("MWF.widget.ImageClipper", function(){
  535. var dlg = new MWF.xDesktop.Dialog({
  536. "title": this.explorer.app.lp.changePersonIcon,
  537. "style": "image",
  538. "top": y,
  539. "left": x - 20,
  540. "fromTop": y,
  541. "fromLeft": x - 20,
  542. "width": width,
  543. "height": height,
  544. "html": "<div></div>",
  545. "maskNode": this.explorer.app.content,
  546. "container": this.explorer.app.content,
  547. "buttonList": [
  548. {
  549. "text": MWF.LP.process.button.ok,
  550. "action": function () {
  551. _self.uploadPersonIcon();
  552. this.close();
  553. }
  554. },
  555. {
  556. "text": MWF.LP.process.button.cancel,
  557. "action": function () {
  558. _self.image = null;
  559. this.close();
  560. }
  561. }
  562. ]
  563. });
  564. dlg.show();
  565. this.image = new MWF.widget.ImageClipper(dlg.content.getFirst(), {
  566. "aspectRatio": 1,
  567. "description" : "",
  568. "imageUrl" : this._getIcon(true),
  569. "resetEnable" : false
  570. });
  571. this.image.load();
  572. }.bind(this));
  573. }.bind(this))
  574. },
  575. uploadPersonIcon: function(){
  576. if (this.image){
  577. if( this.image.getResizedImage() ){
  578. this.explorer.actions.changePersonIcon(this.data.id, this.image.getFormData(), this.image.getResizedImage(), function(){
  579. this.iconNode.set("src", "");
  580. if (this.item.iconNode) this.item.iconNode.getElement("img").set("src", "");
  581. window.setTimeout(function(){
  582. this.iconNode.set("src", this._getIcon(true));
  583. if (this.item.iconNode) this.item.iconNode.getElement("img").set("src", this.item._getIcon(true));
  584. }.bind(this), 100);
  585. }.bind(this), null);
  586. }
  587. }
  588. }
  589. });
  590. MWF.xApplication.Org.PersonExplorer.PersonContent.BottomInfor = new Class({
  591. Extends: MWF.xApplication.Org.$Explorer.ItemContent.BottomInfor,
  592. addInforList: function(){
  593. var text = this.explorer.app.lp.personReadDn.replace(/{dn}/g, (this.data.distinguishedName || " "));
  594. this.addInfor(text);
  595. text = this.explorer.app.lp.personReadCreate.replace(/{date}/g, (this.data.createTime || " "));
  596. text = text.replace(/{date2}/g, (this.data.updateTime || " "));
  597. this.addInfor(text);
  598. text = this.explorer.app.lp.personReadLogin.replace(/{date}/g, (this.data.lastLoginTime || " "));
  599. text = text.replace(/{ip}/g, (this.data.lastLoginAddress || " "));
  600. text = text.replace(/{client}/g, (this.data.lastLoginClient || " "));
  601. this.addInfor(text);
  602. text = this.explorer.app.lp.personReadPassword.replace(/{date}/g, (this.data.passwordExpiredTime || " "));
  603. text = text.replace(/{date2}/g, (this.data.changePasswordTime || " "));
  604. this.addInfor(text);
  605. }
  606. });
  607. MWF.xApplication.Org.PersonExplorer.PersonContent.BaseInfor = new Class({
  608. initialize: function(content){
  609. this.content = content;
  610. this.item = content.item;
  611. this.data = this.content.data;
  612. this.explorer = this.item.explorer;
  613. this.contentNode = this.content.baseContentNode;
  614. this.style = this.item.style.person;
  615. this.attributes = [];
  616. this.mode = "read";
  617. this.load();
  618. },
  619. load: function(){
  620. this.node = new Element("div", {"styles": this.style.baseContentNode}).inject(this.contentNode);
  621. this.editContentNode = new Element("div", {"styles": this.style.baseEditNode}).inject(this.node);
  622. this.editContentNode.set("html", this.getContentHtml());
  623. var n = this.editContentNode.getElement(".infor_name");
  624. if (n) n.set("text", this.data.name || "");
  625. var n = this.editContentNode.getElement(".infor_employee");
  626. if (n) n.set("text", this.data.employee || "");
  627. var n = this.editContentNode.getElement(".infor_mobile");
  628. if (n) n.set("text", this.data.mobile || "");
  629. var n = this.editContentNode.getElement(".infor_unique");
  630. if (n) n.set("text", this.data.unique || "");
  631. var n = this.editContentNode.getElement(".infor_gender");
  632. if (n) n.set("text", this.getGenderType());
  633. var n = this.editContentNode.getElement(".infor_mail");
  634. if (n) n.set("text", this.data.mail || "");
  635. var n = this.editContentNode.getElement(".infor_weixin");
  636. if (n) n.set("text", this.data.weixin || "");
  637. var n = this.editContentNode.getElement(".infor_qq");
  638. if (n) n.set("text", this.data.qq || "");
  639. var n = this.editContentNode.getElement(".infor_officePhone");
  640. if (n) n.set("text", this.data.officePhone || "");
  641. var n = this.editContentNode.getElement(".infor_boardDate");
  642. if (n) n.set("text", this.data.boardDate || "");
  643. var n = this.editContentNode.getElement(".infor_birthday");
  644. if (n) n.set("text", this.data.birthday || "");
  645. var n = this.editContentNode.getElement(".infor_ipAddress");
  646. if (n) n.set("text", this.data.ipAddress || "");
  647. var n = this.editContentNode.getElement(".infor_description");
  648. if (n) n.set("text", this.data.description || "");
  649. this.editContentNode.getElements("td.inforTitle").setStyles(this.style.baseInforTitleNode);
  650. this.editContentNode.getElements("td.inforContent").setStyles(this.style.baseInforContentNode);
  651. this.editContentNode.getElements("td.inforAction").setStyles(this.style.baseInforActionNode);
  652. var tdContents = this.editContentNode.getElements("td.inforContent");
  653. if (this.data.superior) new MWF.widget.O2Person({"name": this.data.superior}, tdContents[5], {"style": "xform"});
  654. this.loadAction();
  655. },
  656. getContentHtml: function(){
  657. var html = "<table width='100%' cellpadding='3px' cellspacing='5px'>";
  658. html += "<tr><td class='inforTitle'>"+this.explorer.app.lp.personName+":</td><td class='inforContent infor_name'>"+(this.data.name || "")+"</td>" +
  659. "<td class='inforTitle'>"+this.explorer.app.lp.personEmployee+":</td><td class='inforContent infor_employee'>"+(this.data.employee || "")+"</td></tr>";
  660. html += "<tr><td class='inforTitle'>"+this.explorer.app.lp.personMobile+":</td><td class='inforContent infor_mobile'>"+(this.data.mobile || "")+"</td>" +
  661. "<td class='inforTitle'>"+this.explorer.app.lp.personUnique+":</td><td class='inforContent infor_unique'>"+(this.data.unique || "")+"</td></tr>";
  662. html += "<tr><td class='inforTitle'>"+this.explorer.app.lp.personGender+":</td><td class='inforContent infor_gender'>"+this.getGenderType()+"</td>" +
  663. "<td class='inforTitle'>"+this.explorer.app.lp.personSuperior+":</td><td class='inforContent'>"+"</td></tr>";
  664. html += "<tr><td class='inforTitle'>"+this.explorer.app.lp.personMail+":</td><td class='inforContent infor_mail'>"+(this.data.mail || "")+"</td>" +
  665. "<td class='inforTitle'>"+this.explorer.app.lp.personWeixin+":</td><td class='inforContent infor_weixin'>"+(this.data.weixin || "")+"</td></tr>";
  666. html += "<tr><td class='inforTitle'>"+this.explorer.app.lp.personQQ+":</td><td class='inforContent infor_qq'>"+(this.data.qq || "")+"</td>" +
  667. "<td class='inforTitle'>"+this.explorer.app.lp.personOfficePhone+":</td><td class='inforContent infor_officePhone'>"+(this.data.officePhone || "")+"</td></tr>";
  668. html += "<tr><td class='inforTitle'>"+this.explorer.app.lp.personBoardDate+":</td><td class='inforContent infor_boardDate'>"+(this.data.boardDate || "")+"</td>" +
  669. "<td class='inforTitle'>"+this.explorer.app.lp.personBirthday+":</td><td class='inforContent infor_birthday'>"+(this.data.birthday || "")+"</td></tr>";
  670. html += "<tr><td class='inforTitle'>"+this.explorer.app.lp.ipAddress+":</td><td class='inforContent infor_ipAddress'>"+(this.data.ipAddress || "")+"</td>" +
  671. "<td class='inforTitle'>"+this.explorer.app.lp.description+":</td><td class='inforContent infor_description'>"+(this.data.description || "")+"</td></tr>";
  672. html += "<tr><td colspan='4' class='inforAction'></td></tr>";
  673. //this.baseInforRightNode.set("html", html);
  674. return html;
  675. },
  676. loadAction: function(){
  677. //this.explorer.app.lp.edit
  678. var actionAreas = this.editContentNode.getElements("td");
  679. var actionArea = actionAreas[actionAreas.length-1];
  680. if (this.data.control.allowEdit){
  681. this.baseInforEditActionAreaNode = new Element("div", {"styles": this.style.baseInforEditActionAreaNode}).inject(actionArea);
  682. this.editNode = new Element("div", {"styles": this.style.actionEditNode, "text": this.explorer.app.lp.editPerson}).inject(this.baseInforEditActionAreaNode);
  683. this.saveNode = new Element("div", {"styles": this.style.actionSaveNode, "text": this.explorer.app.lp.savePerson}).inject(this.baseInforEditActionAreaNode);
  684. this.cancelNode = new Element("div", {"styles": this.style.actionCancelNode, "text": this.explorer.app.lp.cancel}).inject(this.baseInforEditActionAreaNode);
  685. this.editNode.setStyle("display", "block");
  686. this.editNode.addEvent("click", this.edit.bind(this));
  687. this.saveNode.addEvent("click", this.save.bind(this));
  688. this.cancelNode.addEvent("click", this.cancel.bind(this));
  689. }else{
  690. }
  691. },
  692. edit: function(){
  693. var tdContents = this.editContentNode.getElements("td.inforContent");
  694. tdContents[0].setStyles(this.style.baseInforContentNode_edit).empty();
  695. this.nameInputNode = new Element("input", {"styles": this.style.inputNode}).inject(tdContents[0]);
  696. this.nameInputNode.set("value", (this.data.name));
  697. tdContents[1].setStyles(this.style.baseInforContentNode_edit).empty();
  698. this.employeeInputNode = new Element("input", {"styles": this.style.inputNode}).inject(tdContents[1]);
  699. this.employeeInputNode.set("value", (this.data.employee));
  700. tdContents[2].setStyles(this.style.baseInforContentNode_edit).empty();
  701. this.mobileInputNode = new Element("input", {"styles": this.style.inputNode}).inject(tdContents[2]);
  702. this.mobileInputNode.set("value", (this.data.mobile));
  703. tdContents[3].setStyles(this.style.baseInforContentNode_edit).empty();
  704. this.uniqueInputNode = new Element("input", {"styles": this.style.inputNode}).inject(tdContents[3]);
  705. this.uniqueInputNode.set("value", (this.data.unique));
  706. tdContents[4].setStyles(this.style.baseInforContentNode_edit).empty();
  707. var html = "<input name=\"personGenderRadioNode\" value=\"m\" type=\"radio\" "+((this.data.genderType==="m") ? "checked" : "")+"/>"+this.explorer.app.lp.man;
  708. html += "<input name=\"personGenderRadioNode\" value=\"f\" type=\"radio\" "+((this.data.genderType==="f") ? "checked" : "")+"/>"+this.explorer.app.lp.female;
  709. html += "<input name=\"personGenderRadioNode\" value=\"d\" type=\"radio\" "+((this.data.genderType==="d") ? "checked" : "")+"/>"+this.explorer.app.lp.other;
  710. tdContents[4].set("html", html);
  711. tdContents[5].setStyles(this.style.baseInforContentNode_edit).empty();
  712. this.superiorInputNode = new Element("div", {"styles": this.style.inputNode_person}).inject(tdContents[5]);
  713. //this.superiorInputNode.set("value", (this.data.superior));
  714. if (this.data.superior) new MWF.widget.O2Person({"name": this.data.superior}, this.superiorInputNode, {"style": "xform"});
  715. this.superiorInputNode.addEvent("click", function(){
  716. MWF.xDesktop.requireApp("Selector", "package", function(){
  717. var options = {
  718. "type": "person",
  719. "values": (this.data.superior) ? [this.data.superior] : [],
  720. "count": 1,
  721. "onComplete": function(items){
  722. this.data.superior = items[0].data.distinguishedName;
  723. this.superiorInputNode.empty();
  724. new MWF.widget.O2Person(items[0].data, this.superiorInputNode, {"style": "xform"});
  725. }.bind(this)
  726. };
  727. var selector = new MWF.O2Selector(this.explorer.app.content, options);
  728. }.bind(this));
  729. }.bind(this));
  730. tdContents[6].setStyles(this.style.baseInforContentNode_edit).empty();
  731. this.mailInputNode = new Element("input", {"styles": this.style.inputNode}).inject(tdContents[6]);
  732. this.mailInputNode.set("value", (this.data.mail));
  733. tdContents[7].setStyles(this.style.baseInforContentNode_edit).empty();
  734. this.weixinInputNode = new Element("input", {"styles": this.style.inputNode}).inject(tdContents[7]);
  735. this.weixinInputNode.set("value", (this.data.weixin));
  736. tdContents[8].setStyles(this.style.baseInforContentNode_edit).empty();
  737. this.qqInputNode = new Element("input", {"styles": this.style.inputNode}).inject(tdContents[8]);
  738. this.qqInputNode.set("value", (this.data.qq));
  739. tdContents[9].setStyles(this.style.baseInforContentNode_edit).empty();
  740. this.officePhoneInputNode = new Element("input", {"styles": this.style.inputNode}).inject(tdContents[9]);
  741. this.officePhoneInputNode.set("value", (this.data.officePhone));
  742. tdContents[10].setStyles(this.style.baseInforContentNode_edit).empty();
  743. this.boardDateInputNode = new Element("input", {"styles": this.style.inputNode_calendar, "readonly": true}).inject(tdContents[10]);
  744. this.boardDateInputNode.set("value", (this.data.boardDate));
  745. MWF.require("MWF.widget.Calendar", function(){
  746. var boardDateCalendar = new MWF.widget.Calendar(this.boardDateInputNode, {
  747. "style": "xform",
  748. "isTime": false,
  749. "target": this.explorer.app.content,
  750. "format": "%Y-%m-%d"
  751. });
  752. }.bind(this));
  753. tdContents[11].setStyles(this.style.baseInforContentNode_edit).empty();
  754. this.birthdayInputNode = new Element("input", {"styles": this.style.inputNode_calendar, "readonly": true}).inject(tdContents[11]);
  755. this.birthdayInputNode.set("value", (this.data.birthday));
  756. MWF.require("MWF.widget.Calendar", function(){
  757. var birthdayCalendar = new MWF.widget.Calendar(this.birthdayInputNode, {
  758. "style": "xform",
  759. "isTime": false,
  760. "target": this.explorer.app.content,
  761. "format": "%Y-%m-%d"
  762. });
  763. }.bind(this));
  764. tdContents[12].setStyles(this.style.baseInforContentNode_edit).empty();
  765. this.ipAddressInputNode = new Element("input", {"styles": this.style.inputNode, "placeHolder": this.explorer.app.lp.ipAddressPlaceHolder, }).inject(tdContents[12]);
  766. this.ipAddressInputNode.set("value", (this.data.ipAddress));
  767. tdContents[13].setStyles(this.style.baseInforContentNode_edit).empty();
  768. this.descriptionInputNode = new Element("input", {"styles": this.style.inputNode}).inject(tdContents[13]);
  769. this.descriptionInputNode.set("value", (this.data.description));
  770. var _self = this;
  771. this.editContentNode.getElements("input").addEvents({
  772. "focus": function(){if (this.get("type").toLowerCase()==="text"){this.setStyles(_self.style.inputNode_focus);}},
  773. "blur": function(){if (this.get("type").toLowerCase()==="text"){this.setStyles(_self.style.inputNode_blur);}}
  774. });
  775. this.mode = "edit";
  776. this.editNode.setStyle("display", "none");
  777. this.saveNode.setStyle("display", "block");
  778. this.cancelNode.setStyle("display", "block");
  779. },
  780. save: function(){
  781. var tdContents = this.editContentNode.getElements("td.inforContent");
  782. var gender = "";
  783. var radios = tdContents[4].getElements("input");
  784. for (var i=0; i<radios.length; i++){
  785. if (radios[i].checked){
  786. gender = radios[i].value;
  787. break;
  788. }
  789. }
  790. //if (!this.nameInputNode.get("value") || !this.employeeInputNode.get("value") || !this.mobileInputNode.get("value") || !gender){
  791. if (!this.nameInputNode.get("value") || !this.mobileInputNode.get("value") || !gender){
  792. this.explorer.app.notice(this.explorer.app.lp.inputPersonInfor, "error", this.explorer.propertyContentNode);
  793. return false;
  794. }
  795. // var array = [];
  796. // var ipAddress = this.ipAddressInputNode.get("value") || "";
  797. // var ipV4Format = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
  798. // var ipV6Format = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
  799. // if( ipAddress.trim() ){
  800. // ipAddress.split(",").each( function(ip){
  801. // if(!ip.match(ipV4Format) && !ip.match(ipV6Format))array.push( ip );
  802. // })
  803. // }
  804. // if( array.length > 0 ){
  805. // this.explorer.app.notice( this.explorer.app.lp.ipAddressIncorrectNotice + array.join(","), "error", this.explorer.propertyContentNode);
  806. // return false;
  807. // }
  808. //this.data.genderType = gender;
  809. if (!this.uniqueInputNode.get("value")) this.data.unique = this.employeeInputNode.get("value");
  810. this.content.propertyContentScrollNode.mask({
  811. "style": {
  812. "opacity": 0.7,
  813. "background-color": "#999"
  814. }
  815. });
  816. this.savePerson(function(){
  817. this.cancel();
  818. this.content.propertyContentScrollNode.unmask();
  819. }.bind(this), function(xhr, text, error){
  820. var errorText = error;
  821. if (xhr){
  822. var json = JSON.decode(xhr.responseText);
  823. if (json){
  824. errorText = json.message.trim() || "request json error";
  825. }else{
  826. errorText = "request json error: "+xhr.responseText;
  827. }
  828. }
  829. MWF.xDesktop.notice("error", {x: "right", y:"top"}, errorText);
  830. this.content.propertyContentScrollNode.unmask();
  831. }.bind(this));
  832. },
  833. savePerson: function(callback, cancel){
  834. var data = Object.clone(this.data);
  835. data.name = this.nameInputNode.get("value");
  836. data.employee = this.employeeInputNode.get("value");
  837. data.mobile = this.mobileInputNode.get("value");
  838. data.unique = this.uniqueInputNode.get("value");
  839. //data.superior = this.superiorInputNode.get("value");
  840. data.mail = this.mailInputNode.get("value");
  841. data.weixin = this.weixinInputNode.get("value");
  842. data.qq = this.qqInputNode.get("value");
  843. data.officePhone = this.officePhoneInputNode.get("value");
  844. data.boardDate = this.boardDateInputNode.get("value");
  845. data.birthday = this.birthdayInputNode.get("value");
  846. data.ipAddress = this.ipAddressInputNode.get("value");
  847. data.description = this.descriptionInputNode.get("value");
  848. var tdContents = this.editContentNode.getElements("td.inforContent");
  849. var radios = tdContents[4].getElements("input");
  850. for (var i=0; i<radios.length; i++){
  851. if (radios[i].checked){
  852. data.genderType = radios[i].value;
  853. break;
  854. }
  855. }
  856. this.explorer.actions.savePerson(data, function(json){
  857. debugger;
  858. Object.merge(this.data, data);
  859. if (this.data.id){
  860. this.data.id = json.data.id;
  861. this.item.refresh();
  862. if (callback) callback();
  863. }else{
  864. this.explorer.actions.getPerson(function(json){
  865. this.data = Object.merge(this.data, json.data);
  866. this.item.data = this.data;
  867. this.item.refresh();
  868. this.content.loadList();
  869. if (callback) callback();
  870. }.bind(this), null, json.data.id);
  871. }
  872. }.bind(this), function(xhr, text, error){
  873. if (cancel) cancel(xhr, text, error);
  874. }.bind(this));
  875. // }.bind(this), function(xhr, text, error){
  876. // if (cancel) cancel(xhr, text, error);
  877. // }.bind(this));
  878. },
  879. cancel: function(){
  880. if (this.data.id){
  881. var tdContents = this.editContentNode.getElements("td.inforContent");
  882. tdContents[0].setStyles(this.style.baseInforContentNode).set("text", this.data.name || "");
  883. tdContents[1].setStyles(this.style.baseInforContentNode).set("text", this.data.employee || "");
  884. tdContents[2].setStyles(this.style.baseInforContentNode).set("text", this.data.mobile || "");
  885. tdContents[3].setStyles(this.style.baseInforContentNode).set("text", this.data.unique || "");
  886. tdContents[4].setStyles(this.style.baseInforContentNode).set("text", this.getGenderType());
  887. tdContents[5].setStyles(this.style.baseInforContentNode).set("text", "");
  888. if (this.data.superior) new MWF.widget.O2Person({"name": this.data.superior}, tdContents[5], {"style": "xform"});
  889. tdContents[6].setStyles(this.style.baseInforContentNode).set("text", this.data.mail || "");
  890. tdContents[7].setStyles(this.style.baseInforContentNode).set("text", this.data.weixin || "");
  891. tdContents[8].setStyles(this.style.baseInforContentNode).set("text", this.data.qq || "");
  892. tdContents[9].setStyles(this.style.baseInforContentNode).set("text", this.data.officePhone || "");
  893. tdContents[10].setStyles(this.style.baseInforContentNode).set("text", this.data.boardDate || "");
  894. tdContents[11].setStyles(this.style.baseInforContentNode).set("text", this.data.birthday || "");
  895. tdContents[12].setStyles(this.style.baseInforContentNode).set("text", this.data.ipAddress || "");
  896. tdContents[13].setStyles(this.style.baseInforContentNode).set("text", this.data.description || "");
  897. this.mode = "read";
  898. this.editNode.setStyle("display", "block");
  899. this.saveNode.setStyle("display", "none");
  900. this.cancelNode.setStyle("display", "none");
  901. }else{
  902. this.item.destroy();
  903. }
  904. },
  905. getGenderType: function(){
  906. var text = "";
  907. if (this.data.genderType){
  908. switch (this.data.genderType) {
  909. case "m":
  910. text = this.explorer.app.lp.man;
  911. break;
  912. case "f":
  913. text = this.explorer.app.lp.female;
  914. break;
  915. default:
  916. text = this.explorer.app.lp.other;
  917. }
  918. }
  919. return text;
  920. },
  921. destroy: function(){
  922. this.node.empty();
  923. this.node.destroy();
  924. MWF.release(this);
  925. },
  926. _getIcon: function(nocache){
  927. var url = (this.data.id) ? this.explorer.actions.getPersonIcon(this.data.id) : "../x_component_Org/$Explorer/default/icon/man.png";
  928. return (nocache) ? url+"?"+(new Date().getTime()) : url;
  929. //return (this.data.id) ? this.explorer.actions.getPersonIcon(this.data.id) : "../x_component_Org/$Explorer/default/icon/man.png";
  930. // var src = "data:image/png;base64,"+this.data.icon;
  931. // if (!this.data.icon){
  932. // if (this.data.genderType==="f"){
  933. // src = "../x_component_Org/$Explorer/default/icon/female.png"
  934. // }else{
  935. // src = "../x_component_Org/$Explorer/default/icon/man.png"
  936. // }
  937. // }
  938. // return src;
  939. }
  940. });