Main.js 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648
  1. MWF.xApplication.Profile.options.multitask = false;
  2. MWF.xApplication.Profile.Main = new Class({
  3. Extends: MWF.xApplication.Common.Main,
  4. Implements: [Options, Events],
  5. options: {
  6. "style": "newVersion",
  7. "name": "Profile",
  8. "icon": "icon.png",
  9. "width": "1100",
  10. "height": "820",
  11. "isResize": false,
  12. "isMax": false,
  13. "mvcStyle": "style.css",
  14. "title": MWF.xApplication.Profile.LP.title
  15. },
  16. _loadCss: function(){},
  17. loadCss: function(file, callback){
  18. var path = (file && typeOf(file)==="string") ? file : "style.css";
  19. var cb = (file && typeOf(file)==="function") ? file : callback;
  20. var cssPath = this.path+this.options.style+"/"+path;
  21. this.content.loadCss(cssPath, cb);
  22. },
  23. onQueryLoad: function(){
  24. this.lp = MWF.xApplication.Profile.LP;
  25. this.action = MWF.Actions.get("x_organization_assemble_personal");
  26. MWF.xDesktop.requireApp("Profile", "Common", null, false);
  27. },
  28. loadApplication: function(callback){
  29. if( this.isThreeManager() && !this.isSystemmanager ){
  30. var user = layout.desktop.session.user;
  31. this.personData = {
  32. name: user.name,
  33. employee: user.employee
  34. };
  35. this.content.loadHtml(this.path+this.options.style+"/view_xadmin.html",
  36. {"bind": {"data": this.personData, "lp": this.lp}, "module": this},
  37. function(){
  38. this.loadContent_3admin();
  39. }.bind(this)
  40. );
  41. }else{
  42. this.action.getPerson(function(json){
  43. this.personData = json.data;
  44. this.personData.personIcon = this.action.getPersonIcon();
  45. if(this.isSystemmanager){
  46. var user = layout.desktop.session.user;
  47. this.personData.name = user.name;
  48. this.personData.employee = user.employee;
  49. this.personData.mail = "";
  50. }
  51. var url = this.path+this.options.style+"/"+( (!this.inBrowser && layout.viewMode==="Layout") ? "view": "viewBrowser")+".html";
  52. this.content.loadHtml( url,
  53. {"bind": {"data": this.personData, "lp": this.lp}, "module": this},
  54. function(){
  55. this.loadContent()
  56. }.bind(this)
  57. );
  58. }.bind(this));
  59. //this.loadCss();
  60. // this.loadTitle();
  61. // this.loadContent();
  62. if (callback) callback();
  63. }
  64. },
  65. isThreeManager: function(){
  66. if( typeOf(this.threeManagerFlag) === "boolean" )return this.threeManagerFlag;
  67. var user = layout.desktop.session.user;
  68. if (user.roleList) {
  69. var userRoleName = [];
  70. user.roleList.each(function (role) {
  71. userRoleName.push(role.substring(0, role.indexOf("@")));
  72. });
  73. user.roleList = user.roleList.concat(userRoleName);
  74. }
  75. var roleLCList = (user.roleList || []).map(function (role) {
  76. return role.toLowerCase();
  77. }.bind(this));
  78. this.isSystemmanager = roleLCList.isIntersect(["systemmanager"]);
  79. this.threeManagerFlag = roleLCList.isIntersect(["systemmanager", "securitymanager", "auditmanager"]);
  80. return this.threeManagerFlag;
  81. },
  82. loadContent_3admin: function(){
  83. var pageConfigNodes = this.content.getElements(".o2_profile_configNode");
  84. this.contentNode = this.content.getElement(".o2_profile_contentNode");
  85. MWF.require("MWF.widget.Tab", function(){
  86. this.tab = new MWF.widget.Tab(this.contentNode, {"style": "profileV2"});
  87. this.tab.load();
  88. var firstPage;
  89. pageConfigNodes.each(function(node, i){
  90. var page = this.tab.addTab(node, node.get("title"));
  91. if( !this.isSystemmanager ){
  92. if( i > 0 )node.hide();
  93. }
  94. if( node.getStyle("display") === "none" ){
  95. page.tabNode.hide();
  96. }else if( layout.desktop.session.user.name.toLowerCase() === "xadmin" && ["password","empower"].contains( node.get("data-o2-type") ) ){
  97. page.tabNode.hide();
  98. }else if( !firstPage ){
  99. firstPage = page;
  100. }
  101. }.bind(this));
  102. this.contentNode.getElement("[name=MWFcontentNodeContainer]").setStyles({
  103. "height":"calc(100% - 50px)",
  104. "overflow":"auto"
  105. });
  106. this.tab.pages.map(function(stab){
  107. var tabNode = stab.tabNode;
  108. tabNode.addEvent("click",function(){
  109. this.addClass("mainColor_border");
  110. this.getChildren().addClass("mainColor_color");
  111. this.getSiblings().removeClass("mainColor_border");
  112. this.getSiblings().map(function(otabNode) {
  113. otabNode.getChildren().removeClass("mainColor_color");
  114. });
  115. }.bind(tabNode));
  116. }.bind(this));
  117. if (this.options.tab){
  118. this.tab.pages[this.options.tab].showIm();
  119. this.tab.pages[this.options.tab].tabNode.addClass("mainColor_border");
  120. this.tab.pages[this.options.tab].textNode.addClass("mainColor_color");
  121. }else{
  122. firstPage.showIm();
  123. firstPage.tabNode.addClass("mainColor_border");
  124. firstPage.textNode.addClass("mainColor_color");
  125. }
  126. if( this.isSystemmanager ){
  127. if (!this.inBrowser&&layout.viewMode=="Layout"){
  128. this.loadLayoutConfigActions();
  129. }
  130. this.loadIdeaConfigActions( 2 );
  131. }
  132. }.bind(this));
  133. },
  134. loadContent: function(){
  135. debugger;
  136. var pageConfigNodes = this.content.getElements(".o2_profile_configNode");
  137. this.contentNode = this.content.getElement(".o2_profile_contentNode");
  138. MWF.require("MWF.widget.Tab", function(){
  139. this.tab = new MWF.widget.Tab(this.contentNode, {"style": "profileV2"});
  140. this.tab.load();
  141. var firstPage;
  142. pageConfigNodes.each(function(node){
  143. var page = this.tab.addTab(node, node.get("title"));
  144. if( node.getStyle("display") === "none" ) {
  145. page.tabNode.hide();
  146. }else if( layout.desktop.session.user.name.toLowerCase() === "xadmin" && ["password","empower"].contains( node.get("data-o2-type") ) ){
  147. page.tabNode.hide();
  148. }else if( !firstPage ){
  149. firstPage = page;
  150. }
  151. }.bind(this));
  152. this.contentNode.getElement("[name=MWFcontentNodeContainer]").setStyles({
  153. "height":"calc(100% - 50px)",
  154. "overflow":"auto"
  155. });
  156. this.tab.pages.map(function(stab){
  157. var tabNode = stab.tabNode;
  158. tabNode.addEvent("click",function(){
  159. this.addClass("mainColor_border");
  160. this.getChildren().addClass("mainColor_color");
  161. this.getSiblings().removeClass("mainColor_border");
  162. this.getSiblings().map(function(otabNode) {
  163. otabNode.getChildren().removeClass("mainColor_color");
  164. });
  165. }.bind(tabNode));
  166. }.bind(this));
  167. if (this.options.tab){
  168. this.tab.pages[this.options.tab].showIm();
  169. this.tab.pages[this.options.tab].tabNode.addClass("mainColor_border");
  170. this.tab.pages[this.options.tab].textNode.addClass("mainColor_color");
  171. }else{
  172. firstPage.showIm();
  173. firstPage.tabNode.addClass("mainColor_border");
  174. firstPage.textNode.addClass("mainColor_color");
  175. // this.tab.pages[0].showIm();
  176. // this.tab.pages[0].tabNode.addClass("mainColor_border");
  177. // this.tab.pages[0].textNode.addClass("mainColor_color");
  178. }
  179. this.loadInforConfigActions();
  180. if (!this.inBrowser&&layout.viewMode=="Layout"){
  181. this.loadLayoutConfigActions();
  182. }else{
  183. }
  184. this.loadIdeaConfigActions();
  185. this.loadEmPowerConfigAction();
  186. this.loadPasswordConfigActions();
  187. this.loadSSOConfigAction();
  188. }.bind(this));
  189. },
  190. // openFaceSet: function(){
  191. // layout.openApplication(null, "FaceSet");
  192. // },
  193. loadInforConfigActions: function(){
  194. this.contentImgNode = this.content.getElement(".o2_profile_inforIconContentImg");
  195. this.content.getElement(".o2_profile_inforIconChange").addClass("mainColor_color mainColor_border").addEvent("click", function(){
  196. this.changeIcon();
  197. }.bind(this));
  198. var inputs = this.tab.pages[0].contentNode.getElements("input");
  199. inputs.addEvent("focus",function(){
  200. this.addClass("mainColor_border mainColor_color");
  201. }).addEvent("blur",function(){
  202. this.removeClass("mainColor_border mainColor_color");
  203. });
  204. this.mailInputNode = inputs[0];
  205. this.mobileInputNode = inputs[1];
  206. this.officePhoneInputNode = inputs[2];
  207. this.weixinInputNode = inputs[3];
  208. this.qqInputNode = inputs[4];
  209. // this.ipAddressInputNode = inputs[5];
  210. this.nickNameInputNode = inputs[5];
  211. this.signatureInputNode = this.tab.pages[0].contentNode.getElement("textarea");
  212. this.signatureInputNode.addEvent("focus",function(){
  213. this.addClass("mainColor_border mainColor_color");
  214. }).addEvent("blur",function(){
  215. this.removeClass("mainColor_border mainColor_color");
  216. });
  217. this.languageSelectNode = this.tab.pages[0].contentNode.getElement("select");
  218. this.languageSelectNode.empty();
  219. if (!this.personData.language) this.personData.language = "zh-CN";
  220. var lps = layout.config.supportedLanguages;
  221. Object.keys(lps).each(function(key){
  222. var option = new Element("option", {"value": key, "text": lps[key]}).inject(this.languageSelectNode);
  223. if (this.personData.language === key) option.set("selected", true);
  224. }.bind(this));
  225. this.content.getElement(".o2_profile_saveInforAction").addEvent("click", function(){
  226. this.savePersonInfor();
  227. }.bind(this));
  228. },
  229. loadLayoutConfigActions: function(){
  230. var buttons = this.tab.pages[1].contentNode.getElements(".o2_profile_layoutClearDataAction");
  231. this.clearDataAction = buttons[0];
  232. this.defaultDataAction = (buttons.length>1) ? buttons[1]: null;
  233. this.clearDefaultDataAction = (buttons.length>2) ? buttons[2]: null;
  234. this.forceDataAction = (buttons.length>3) ? buttons[3]: null;
  235. this.deleteForceDataAction = (buttons.length>4) ? buttons[4]: null;
  236. this.clearDataAction.addEvent("click", function(){
  237. MWF.require("MWF.widget.UUID", function(){
  238. MWF.UD.deleteData("layout", function(){
  239. this.notice(this.lp.clearok, "success");
  240. this.desktop.notRecordStatus = true;
  241. }.bind(this));
  242. }.bind(this));
  243. }.bind(this));
  244. if( MWF.AC.isAdministrator() ){
  245. this.defaultDataAction.addEvent("click", function(){
  246. MWF.require("MWF.widget.UUID", function(){
  247. var text = this.lp.setDefaultOk;
  248. this.close();
  249. var status = layout.desktop.getLayoutStatusData();
  250. MWF.UD.putPublicData("defaultLayout", status, function(){
  251. MWF.xDesktop.notice("success", {"x": "right", "y": "top"}, text, layout.desktop.desktopNode);
  252. }.bind(this));
  253. }.bind(this));
  254. }.bind(this));
  255. this.clearDefaultDataAction.addEvent("click", function(){
  256. MWF.require("MWF.widget.UUID", function(){
  257. MWF.UD.deletePublicData("defaultLayout", function(){
  258. this.notice(this.lp.clearok, "success");
  259. this.desktop.notRecordStatus = true;
  260. }.bind(this));
  261. }.bind(this));
  262. }.bind(this));
  263. this.forceDataAction.addEvent("click", function(){
  264. MWF.require("MWF.widget.UUID", function(){
  265. var text = this.lp.setForceOk;
  266. this.close();
  267. var status = layout.desktop.getLayoutStatusData();
  268. MWF.UD.putPublicData("forceLayout", status, function(){
  269. MWF.xDesktop.notice("success", {"x": "right", "y": "top"}, text, layout.desktop.desktopNode);
  270. }.bind(this));
  271. }.bind(this));
  272. }.bind(this));
  273. this.deleteForceDataAction.addEvent("click", function(){
  274. MWF.require("MWF.widget.UUID", function(){
  275. MWF.UD.deletePublicData("forceLayout", function(){
  276. this.notice(this.lp.clearok, "success");
  277. this.desktop.notRecordStatus = true;
  278. }.bind(this));
  279. }.bind(this));
  280. }.bind(this));
  281. }
  282. var UINode = this.tab.pages[1].contentNode.getLast();
  283. this.loadDesktopBackground(UINode);
  284. },
  285. loadIdeaConfigActions: function( i ){
  286. if( typeOf(i) !== "number" ) i = (!this.inBrowser && layout.viewMode==="Layout") ? 2 : 1;
  287. this.ideasArea = this.tab.pages[i].contentNode.setStyle("min-height","500px").getElement("textarea").addEvent("focus",function(){
  288. this.addClass("mainColor_border mainColor_color");
  289. }).addEvent("blur",function(){
  290. this.removeClass("mainColor_border mainColor_color");
  291. });
  292. this.ideasSaveAction = this.ideasArea.getNext().addEvent("mouseover",function(){
  293. this.addClass("mainColor_bg");
  294. }).addEvent("mouseout",function(){
  295. this.removeClass("mainColor_bg");
  296. });
  297. this.ideasSaveDefaultAction = this.ideasSaveAction.getNext() || null;
  298. if (MWF.AC.isAdministrator()){
  299. this.ideasSaveDefaultAction.addEvent("mouseover",function(){
  300. this.addClass("mainColor_bg");
  301. }).addEvent("mouseout",function(){
  302. this.removeClass("mainColor_bg");
  303. });
  304. this.ideasSaveDefaultAction.addEvent("click", function(){
  305. MWF.require("MWF.widget.UUID", function(){
  306. var data = {};
  307. data.ideas = this.ideasArea.get("value").split("\n");
  308. MWF.UD.putPublicData("idea", data, function(){
  309. this.notice(this.lp.ideaSaveOk, "success");
  310. }.bind(this));
  311. }.bind(this));
  312. }.bind(this))
  313. }
  314. MWF.require("MWF.widget.UUID", function(){
  315. MWF.UD.getDataJson("idea", function(json){
  316. if (json){
  317. if (json.ideas) this.ideasArea.set("value", json.ideas.join("\n"));
  318. }
  319. }.bind(this));
  320. }.bind(this));
  321. this.ideasSaveAction.addEvent("click", function(){
  322. MWF.require("MWF.widget.UUID", function(){
  323. var data = {};
  324. data.ideas = this.ideasArea.get("value").split("\n");
  325. MWF.UD.putData("idea", data, function(){
  326. this.notice(this.lp.ideaSaveOk, "success");
  327. }.bind(this));
  328. }.bind(this));
  329. }.bind(this))
  330. },
  331. loadEmPowerConfigAction: function(){
  332. var i = (!this.inBrowser && layout.viewMode==="Layout")? 3 : 2;
  333. this.tab.pages[i].contentNode.setStyle("overflow","auto");
  334. var tabEmpowerNodes = this.tab.pages[i].contentNode.getElements("div.o2_profile_emPower_tab");
  335. this.emPowerContentNode = this.tab.pages[i].contentNode.getElement("div.o2_profile_emPower_content");
  336. MWF.require("MWF.widget.Tab", function() {
  337. this.tabEmpower = new MWF.widget.Tab(this.emPowerContentNode, {"style": "empower"});
  338. this.tabEmpower.load();
  339. tabEmpowerNodes.each(function(node){
  340. this.tabEmpower.addTab(node, node.get("title"));
  341. }.bind(this));
  342. this.tabEmpower.pages.map(function(stab){
  343. var tabNode = stab.tabNode.setStyle("cursor","pointer");
  344. tabNode.addEvent("click",function(){
  345. this.addClass("mainColor_bg");
  346. this.getSiblings().removeClass("mainColor_bg");
  347. }.bind(tabNode));
  348. }.bind(this));
  349. if (!this.options.tabEmpower) {
  350. this.tabEmpower.pages[0].showIm();
  351. this.tabEmpower.pages[0].tabNode.addClass("mainColor_bg");
  352. } else {
  353. this.tabEmpower.pages[this.options.tab].showIm();
  354. this.tabEmpower.pages[this.options.tab].tabNode.addClass("mainColor_bg");
  355. }
  356. }.bind(this));
  357. this.loadEmpowerBtn();
  358. this.loadMyEmPower();
  359. this.loadReceiveEmPower();
  360. this.loadMyEmPowerLog();
  361. this.loadReceiveEmPowerLog();
  362. },
  363. loadEmpowerBtn: function(){
  364. var BtnImg = new Element("div.o2_profile_emPower_Btnimg");
  365. var BtnText = new Element("div.o2_profile_emPower_Btntext");
  366. var addEmPowerDiv = new Element("div.o2_profile_emPower_Add").adopt(BtnImg.cloneNode(),BtnText.cloneNode().set("text",this.lp.empower.addEmPower));
  367. var withDrawEmPowerDiv = new Element("div.o2_profile_emPower_WithDraw").adopt(BtnImg.cloneNode(),BtnText.cloneNode().set("text",this.lp.empower.withdraw));
  368. this.tabEmpower.tabNodeContainerArea.adopt(withDrawEmPowerDiv,addEmPowerDiv);
  369. this.tabEmpower.tabNodeContainerArea.getElements(".o2_profile_emPower_Add").addEvent("click",function(){
  370. var popForm = new MWF.xApplication.Profile.emPowerPopupForm(null, {}, {
  371. "style": "empower",
  372. "width": "550",
  373. "height": layout.desktop.session.user.identityList.length>1?"530":"480",
  374. "hasTop": true,
  375. "hasIcon": false,
  376. "hasTopIcon" : false,
  377. "hasTopContent" : false,
  378. "draggable": true,
  379. "maxAction" : true,
  380. "closeAction": true,
  381. "isFull" : false,
  382. "startTime" : null,
  383. "endTime" : null,
  384. "isWholeday" : false,
  385. "title" : this.lp.createEmpower,
  386. "defaultCalendarId" : ""
  387. }, {
  388. app: this,
  389. container : this.content,
  390. lp : this.lp,
  391. actions : this.action,
  392. css : {}
  393. });
  394. if(layout.desktop.session.user.identityList.length>=1){
  395. popForm.create();
  396. }else{
  397. this.notice( this.lp.empower.alert2 ,"error");
  398. }
  399. }.bind(this));
  400. //撤回按钮
  401. this.tabEmpower.tabNodeContainerArea.getElements(".o2_profile_emPower_WithDraw").addEvent("click",function(){
  402. // var checkElement = this.emPowerTable.getElements("input[name=id]:checked");
  403. var checkElement = this.tabEmpower.showPage.contentNode.getElements("td input[name=id]:checked")
  404. var editCount = 0;
  405. checkElement.forEach(function(item){
  406. this.action.deleteEmPower(item.get("value"),function(json){
  407. if(json.type=="success"){
  408. editCount += 1;
  409. }
  410. item.getParent().getParent().getParent().destroy();
  411. }.bind(this),null,false);
  412. /*enable为false时无法再次委托相同内容,又因为目前没做授权的编辑,所以撤回直接调用delete接口
  413. var idata = this.emPowerData[item.get("value")];
  414. idata.enable = false;
  415. this.action.editEmPower(item.get("value"),idata,function(json){
  416. if(json.type=="success"){
  417. editCount += 1;
  418. }
  419. item.getParent().getParent().destroy();
  420. }.bind(this),null,false);*/
  421. }.bind(this));
  422. if(checkElement.length==0){
  423. this.notice(this.lp.empower.selectEmPower, "error");
  424. }else if(checkElement.length&&editCount==checkElement.length){
  425. this.notice(this.lp.empower.withdrawOk, "success");
  426. }else{
  427. //this.notice(this.lp.empower.withdrawOk, "success");
  428. }
  429. if(this.myEmPower.getElements("tr").length==1){
  430. this["myEmPowerNoDataDiv"].setStyle("display","");
  431. }
  432. }.bind(this));
  433. },
  434. loadMyEmPower: function(){
  435. this.myEmPower = this.tabEmpower.pages[0].contentNode;
  436. //this.myEmPowerContent = new Element("div.myEmPowerContent",{text:"hhhhhh"}).inject(this.myEmPower);
  437. this.getAction( function( ){
  438. this.action.getMyEmPower(function(json){
  439. var data = json.data;
  440. this.getEmPowerTable("myEmPower",data,this.myEmPower);
  441. }.bind(this));
  442. }.bind(this));
  443. },
  444. loadReceiveEmPower: function(){
  445. this.receiveEmPower = this.tabEmpower.pages[1].contentNode;
  446. //this.myEmPowerContent = new Element("div.myEmPowerContent",{text:"hhhhhh"}).inject(this.myEmPower);
  447. this.getAction( function( ){
  448. this.action.getReceiveEmPower(function(json){
  449. var data = json.data;
  450. this.getEmPowerTable("receiveEmPower",data,this.receiveEmPower);
  451. }.bind(this));
  452. }.bind(this) );
  453. },
  454. loadMyEmPowerLog: function(){
  455. this.myEmPowerLog = this.tabEmpower.pages[2].contentNode;
  456. this.getEmPowerLogTable("myEmPowerLog","",this.myEmPowerLog);
  457. },
  458. loadReceiveEmPowerLog: function(){
  459. this.receiveEmPowerLog = this.tabEmpower.pages[3].contentNode;
  460. this.getEmPowerLogTable("receiveEmPowerLog","",this.receiveEmPowerLog);
  461. },
  462. getEmPowerLogTable: function(type,data,content){
  463. var _this = this;
  464. new MWF.xApplication.Profile.Common.Content(content, {
  465. "title":content.get("title"),
  466. "searchItemList": [
  467. ],
  468. "columns": [
  469. {width:"30%","title": this.lp.empower.title, "field": "subject","formatter":function(data,target){
  470. var _content = this;
  471. new Element("a",{"text":data.title,"style":"cursor:pointer"}).inject(target).addEvent("click",function(e){
  472. var confirm = function () {
  473. _this.confirm("warn", e, _this.lp.workDeletedTitle, _this.lp.workDeletedContent.replace("{title}", data.title), 300, 120, function(){
  474. o2.Actions.load("x_organization_assemble_personal").EmpowerLogAction.delete( data.id, function () {
  475. _content.pagination.toPage();
  476. _this.notice( _this.lp.deleteSuccess );
  477. });
  478. this.close();
  479. }, function(){
  480. this.close();
  481. });
  482. }.bind(this);
  483. var options = {"workId": data.work, "appId": "process.Work"+data.work};
  484. o2.Actions.load("x_processplatform_assemble_surface").WorkAction.getWithWorkOrWorkCompleted(data.work, function (json) {
  485. if( json.data && (json.data.work || json.data.workCompleted) ){
  486. _this.desktop.openApplication(e, "process.Work", options);
  487. }else{
  488. if( type === "receiveEmPowerLog" ){
  489. confirm();
  490. }else{
  491. _this.notice( _this.lp.workDeletedNote.replace("{title}", data.title), "info" );
  492. }
  493. }
  494. }, function () {
  495. if( type === "receiveEmPowerLog" ){
  496. confirm();
  497. }else{
  498. _this.notice( _this.lp.workDeletedNote.replace("{title}", data.title), "info" );
  499. }
  500. return true;
  501. });
  502. });
  503. }},
  504. type=="myEmPowerLog"?{width:"10%","title": this.lp.empower.toPerson, "field": "toPerson","formatter":function(data,target){
  505. new Element("div",{"text":data.toPerson.split("@")[0]}).inject(target);
  506. }}:{width:"10%","title": this.lp.empower.fromPerson, "field": "fromPerson","formatter":function(data,target){
  507. new Element("div",{"text":data.fromPerson.split("@")[0]}).inject(target);
  508. }},
  509. {width:"15%","title": this.lp.empower.applicationName, "field": "applicationName"},
  510. {width:"15%","title": this.lp.empower.processName, "field": "processName"},
  511. {width:"15%","title": this.lp.empower.activityName, "field": "activityName"},
  512. {width:"15%","title": this.lp.empower.createTime, "field": "updateTime"}
  513. ],
  514. "opButtonList": [
  515. ],
  516. "onBeforeLoadData": function () {
  517. _this.getAction( function( ){
  518. if( type=="myEmPowerLog"){
  519. _this.action.listWithCurrentPersonPaging(this.options.page,this.options.pageSize,"",function(json){
  520. this.dataList = json.data;
  521. this.total = json.count;
  522. }.bind(this),null,false);
  523. }else{
  524. _this.action.listToCurrentPersonPaging(this.options.page,this.options.pageSize,"",function(json){
  525. this.dataList = json.data;
  526. this.total = json.count;
  527. }.bind(this),null,false);
  528. }
  529. }.bind(this) );
  530. }
  531. }).load();
  532. if(!this[type+"NoDataDiv"]){
  533. this[type+"NoDataDiv"] = new Element("div.o2_profile_emPower_noData").adopt(
  534. new Element("img",{src:"../x_component_Profile/$Main/newVersion/icon_wuweituo.png"}),
  535. new Element("div",{text: this.lp.noTask })
  536. ).inject(content.getElement(".profile_common_tableDiv"));
  537. }
  538. if(content.getElements("tr").length==1){
  539. this[type+"NoDataDiv"].setStyle("display","");
  540. }else{
  541. if(this[type+"NoDataDiv"]){
  542. this[type+"NoDataDiv"].setStyle("display","none");
  543. }
  544. }
  545. },
  546. getEmPowerTable: function(type,data,content){
  547. //var table = content.getElement("table.emPowerTable");
  548. this.emPowerTable = content.getElement("table.emPowerTable");
  549. if(!this.emPowerTable){
  550. this.emPowerTable = new Element("table.emPowerTable",{
  551. width:"100%",
  552. border:"0",
  553. cellpadding:"0",
  554. cellspacing:"0"
  555. }).inject(content);
  556. }
  557. this.userName = layout.desktop.session.user.distinguishedName;
  558. var th = new Element("tr.first");
  559. if(type=="myEmPower"){
  560. var BtnImg = new Element("div.o2_profile_emPower_Btnimg");
  561. var BtnText = new Element("div.o2_profile_emPower_Btntext");
  562. this.emPowerData={};
  563. var cblabel = new Element("label.o2_profile_empower_checkbox").adopt(new Element("input",{
  564. name:"allEmpower",
  565. id:"allEmpower",
  566. type:"checkbox"
  567. })).setStyle("float","left").addEvent("click",function(){
  568. if(this.getElement("input").get("checked")){
  569. this.getParent().getParent().getParent().getElements("input[type=checkbox]").set("checked",true);
  570. this.getParent().getParent().getParent().getElements("label").addClass("o2_profile_empower_checkbox__checked o2_profile_empower_checkbox_checked");
  571. this.getParent().getParent().getParent().getElements("tr").addClass("selected");
  572. }else{
  573. this.getParent().getParent().getParent().getElements("input[type=checkbox]").set("checked",false);
  574. this.getParent().getParent().getParent().getElements("label").removeClass("o2_profile_empower_checkbox__checked o2_profile_empower_checkbox_checked");
  575. this.getParent().getParent().getParent().getElements("tr").removeClass("selected");
  576. }
  577. });
  578. th.adopt(new Element("th",{width:"16%"}).adopt(cblabel,new Element("div",{text:this.lp.empower.toPerson}).setStyle("float","left")));
  579. }else{
  580. th.adopt(new Element("th",{width:"16%"}).adopt(new Element("div",{text:this.lp.empower.fromPerson})));
  581. }
  582. th.adopt(new Element("th",{width:"7%"}).adopt(new Element("div",{text:this.lp.empower.type})));
  583. th.adopt(new Element("th",{width:"16%"}).adopt(new Element("div",{text:this.lp.empower.applicationName+"/"+this.lp.empower.processName})));
  584. th.adopt(new Element("th",{width:"18%"}).adopt(new Element("div",{text:this.lp.empower.startTime})));
  585. th.adopt(new Element("th",{width:"18%"}).adopt(new Element("div",{text:this.lp.empower.completedTime})));
  586. if(type=="myEmPower"){
  587. th.adopt(new Element("th",{width:"25%"}).adopt(new Element("div",{text: this.lp.action })));
  588. }
  589. this.emPowerTable.adopt(th);
  590. data.forEach(function(item){
  591. if(true||item.enable==true){
  592. var tr = new Element("tr"+(item.enable?"":".disabled"));
  593. var td = new Element("td");
  594. var cblabel = new Element("label.o2_profile_empower_checkbox").adopt(new Element("input",{
  595. name:"id",
  596. value:item.id,
  597. type:"checkbox"
  598. })).setStyle("float","left").addEvent("click",function(){
  599. if(this.getElement("input").get("checked")){
  600. this.addClass("o2_profile_empower_checkbox__checked o2_profile_empower_checkbox_checked");
  601. this.getParent().getParent().addClass("selected");
  602. }else{
  603. this.removeClass("o2_profile_empower_checkbox__checked o2_profile_empower_checkbox_checked");
  604. this.getParent().getParent().removeClass("selected");
  605. }
  606. })
  607. var tds = [];
  608. if(type=="myEmPower"){
  609. this.emPowerData[item.id]=item;
  610. tds.push(td.cloneNode().adopt(cblabel,new Element("div",{name:"toPerson",text:item.toPerson.split("@")[0]})));
  611. }else{
  612. tds.push(td.cloneNode().adopt(new Element("div",{name:"fromPerson",text:item.fromPerson.split("@")[0]})));
  613. }
  614. tds.push(td.cloneNode().adopt(new Element("div",{name:"type",text:this.lp.empower["type_"+item.type]})));
  615. tds.push(td.cloneNode().adopt(new Element("div",{name:"typeName",text:item.applicationName||item.processName||(item.type=='filter'?JSON.parse(item.filterListData)[0].value:"-")})));
  616. tds.push(td.cloneNode().adopt(new Element("div",{name:"startTime",text:item.startTime})));
  617. tds.push(td.cloneNode().adopt(new Element("div",{name:"completedTime",text:item.completedTime})));
  618. //后续添加编辑/删除/撤回按钮
  619. var _self = this;
  620. if(type=="myEmPower"){
  621. //启用、禁用按钮
  622. var endTime = new Date(item.completedTime);
  623. var startTime= new Date(item.startTime);
  624. var nowTime = new Date();
  625. //text:item.enable?_self.lp.empower.disable:_self.lp.empower.enable
  626. var enableClass = item.enable?"o2_profile_emPower_Disable":"o2_profile_emPower_Enable";
  627. var enableText = item.enable?_self.lp.empower.disable:_self.lp.empower.enable
  628. var isEnable = new Element("div."+enableClass).adopt(BtnImg.cloneNode(),BtnText.cloneNode().set("text",enableText)).addEvent("click",function(){
  629. this.enable = !this.enable;
  630. _self.action.editEmPower(this.id,this,function(json){
  631. //submitCount++;
  632. this.notice(this.lp.empower.saveOk,json.type);
  633. var content = this.content.getElement(".o2_profile_emPower_tab");
  634. content.getElement("table").empty();
  635. this.loadMyEmPower();
  636. }.bind(_self),null,false);
  637. }.bind(item));
  638. tds.push(td.cloneNode().setStyles({
  639. "margin":"auto"
  640. }).adopt(
  641. new Element("div.o2_profile_emPower_Edit").adopt(BtnImg.cloneNode(),BtnText.cloneNode().set("text",this.lp.empower.edit)).addEvent("click",function(e){
  642. var _data = this;
  643. _data.fromPerson = _data.fromIdentity;
  644. _data.toPerson = _data.toIdentity;
  645. _data.startTime = _data.startTime;
  646. _data.endTime = _data.completedTime;
  647. var editPopForm = new MWF.xApplication.Profile.emPowerPopupForm(null, _data, {
  648. "style": "empower",
  649. "width": "550",
  650. "height": layout.desktop.session.user.identityList.length>1?"530":"480",
  651. "hasTop": true,
  652. "hasIcon": false,
  653. "hasTopIcon" : false,
  654. "hasTopContent" : false,
  655. "draggable": true,
  656. "maxAction" : true,
  657. "closeAction": true,
  658. "isFull" : false,
  659. "startTime" : null,
  660. "endTime" : null,
  661. "isWholeday" : false,
  662. "title" : _self.lp.empower.editEmpower,
  663. "configData":{
  664. Process:(_data.type=="process"?[{name:_data.processName,id:_data.process,editon:_data.edition}]:[]),
  665. Application:(_data.type=="application"?[{name:_data.applicationName,id:_data.application}]:[])
  666. },
  667. "defaultCalendarId" : ""
  668. }, {
  669. app: _self,
  670. container : _self.content,
  671. lp : _self.lp,
  672. actions : _self.action,
  673. css : {}
  674. });
  675. editPopForm.edit();
  676. }.bind(item)),
  677. (nowTime<startTime||nowTime>endTime)&&false?"":(isEnable),
  678. new Element("div.o2_profile_emPower_WithDraw").adopt(BtnImg.cloneNode(),BtnText.cloneNode().set("text",this.lp.empower.withdraw)).set("empowerid",item.id).addEvent("click",function(){
  679. var _this = this;
  680. _self.action.deleteEmPower(_this.get("empowerid"),function(json){
  681. this.notice(this.lp.empower.withdrawOk,json.type);
  682. _this.getParent().getParent().destroy();
  683. }.bind(_self),null,false);
  684. })
  685. ));
  686. }/**/
  687. tr.adopt(tds);
  688. this.emPowerTable.adopt(tr);
  689. }
  690. }.bind(this));
  691. if(!this[type+"NoDataDiv"]){
  692. this[type+"NoDataDiv"] = new Element("div.o2_profile_emPower_noData").adopt(
  693. new Element("img",{src:"../x_component_Profile/$Main/newVersion/icon_wuweituo.png"}),
  694. new Element("div",{text:this.lp.empower.noData}),
  695. type=="myEmPower"?new Element("div.o2_profile_emPower_Add.mainColor_color",{text: this.lp.createAuthorize }).addEvent("click",function(){
  696. var popForm = new MWF.xApplication.Profile.emPowerPopupForm(null, {}, {
  697. "style": "empower",
  698. "width": "550",
  699. "height": layout.desktop.session.user.identityList.length>1?"530":"480",
  700. "hasTop": true,
  701. "hasIcon": false,
  702. "hasTopIcon" : false,
  703. "hasTopContent" : false,
  704. "draggable": true,
  705. "maxAction" : true,
  706. "closeAction": true,
  707. "isFull" : false,
  708. "startTime" : null,
  709. "endTime" : null,
  710. "isWholeday" : false,
  711. "title" : this.lp.createEmpower,
  712. "defaultCalendarId" : ""
  713. }, {
  714. app: this,
  715. container : this.content,
  716. lp : this.lp,
  717. actions : this.action,
  718. css : {}
  719. });
  720. if(layout.desktop.session.user.identityList.length>=1){
  721. popForm.create();
  722. }else{
  723. this.notice( this.lp.empower.alert2 ,"error");
  724. }
  725. }.bind(this)):""
  726. ).inject(content);
  727. }
  728. if(this.emPowerTable.getElements("tr").length==1){
  729. this[type+"NoDataDiv"].setStyle("display","");
  730. //table.adopt(new Element("tr").adopt(new Element("td")).adopt()));
  731. }else{
  732. if(this[type+"NoDataDiv"]){
  733. this[type+"NoDataDiv"].setStyle("display","none");
  734. }
  735. //this.myEmPowerTable.adopt(trs);
  736. }
  737. },
  738. loadPasswordConfigActions: function(){
  739. var i = (!this.inBrowser && layout.viewMode==="Layout" )? 4 : 3;
  740. var passwordRemindNode = this.tab.pages[i].contentNode.getElement(".o2_profile_passwordRemindNode");
  741. var paswordRule = layout.config.passwordRegexHint || this.lp.paswordRule;
  742. passwordRemindNode.set("text",paswordRule);
  743. var inputs = this.tab.pages[i].contentNode.setStyle("min-height","300px").getElements("input");
  744. this.oldPasswordInputNode = inputs[0];
  745. this.passwordInputNode = inputs[1];
  746. this.morePasswordInputNode = inputs[2];
  747. this.savePasswordAction = this.tab.pages[i].contentNode.getElement(".o2_profile_savePasswordAction");
  748. this.oldPasswordInputNode.addEvents({
  749. "blur": function(){this.removeClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");},
  750. "focus": function(){this.addClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");}
  751. });
  752. this.passwordInputNode.addEvents({
  753. "blur": function(){this.removeClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");},
  754. "focus": function(){this.addClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");},
  755. "keyup" : function(){ this.checkPassowrdStrength( this.passwordInputNode.get("value")) }.bind(this)
  756. });
  757. this.morePasswordInputNode.addEvents({
  758. "blur": function(){this.removeClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");},
  759. "focus": function(){this.addClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");}
  760. });
  761. this.savePasswordAction.addEvent("click", function(){
  762. this.changePassword();
  763. }.bind(this)).addClass("mainColor_bg");
  764. },
  765. loadSSOConfigAction: function(){
  766. var i = (!this.inBrowser && layout.viewMode==="Layout") ? 5 : 4;
  767. this.ssoConfigAreaNode = this.tab.pages[i].contentNode.setStyle("min-height","300px").getElement(".o2_profile_ssoConfigArea");
  768. MWF.Actions.get("x_organization_assemble_authentication").listOauthServer(function(json){
  769. json.data.each(function(d){
  770. var node = new Element("a", {
  771. "class":"mainColor_color",
  772. "styles": {"font-size": "14px", "display": "block", "margin-bottom": "10px"},
  773. "text": d.displayName || d.name,
  774. "target": "_blank",
  775. "href": "../x_desktop/oauth.html?oauth="+encodeURIComponent(d.name)+"&redirect="+"&method=oauthBind"
  776. }).inject(this.ssoConfigAreaNode)
  777. }.bind(this));
  778. }.bind(this));
  779. },
  780. changeIcon: function(){
  781. var options = {};
  782. var width = "668";
  783. var height = "510";
  784. width = width.toInt();
  785. height = height.toInt();
  786. var size = this.content.getSize();
  787. var x = (size.x-width)/2;
  788. var y = (size.y-height)/2;
  789. if (x<0) x = 0;
  790. if (y<0) y = 0;
  791. if (layout.mobile){
  792. x = 20;
  793. y = 0;
  794. }
  795. var _self = this;
  796. MWF.require("MWF.xDesktop.Dialog", function() {
  797. MWF.require("MWF.widget.ImageClipper", function(){
  798. var dlg = new MWF.xDesktop.Dialog({
  799. "title": this.lp.changePersonIcon,
  800. "style": "image",
  801. "top": y,
  802. "left": x - 20,
  803. "fromTop": y,
  804. "fromLeft": x - 20,
  805. "width": width,
  806. "height": height,
  807. "html": "<div></div>",
  808. "maskNode": this.content,
  809. "container": this.content,
  810. "buttonList": [
  811. {
  812. "text": MWF.LP.process.button.ok,
  813. "action": function () {
  814. //_self.uploadPersonIcon();
  815. _self.image.uploadImage( function( json ){
  816. _self.action.getPerson(function(json){
  817. if (json.data){
  818. this.personData = json.data;
  819. _self.contentImgNode.set("src", _self.action.getPersonIcon());
  820. }
  821. this.close();
  822. }.bind(this));
  823. }.bind(this), null );
  824. }
  825. },
  826. {
  827. "text": MWF.LP.process.button.cancel,
  828. "action": function () {
  829. _self.image = null;
  830. this.close();
  831. }
  832. }
  833. ]
  834. });
  835. dlg.show();
  836. this.image = new MWF.widget.ImageClipper(dlg.content.getFirst(), {
  837. "aspectRatio": 1,
  838. "description" : "",
  839. "imageUrl" : this.action.getPersonIcon(),
  840. "resetEnable" : false,
  841. "data": null,
  842. "parameter": null,
  843. "action": this.action.action,
  844. "method": "changeIcon"
  845. });
  846. this.image.load();
  847. }.bind(this));
  848. }.bind(this))
  849. },
  850. uploadPersonIcon: function(){
  851. if (this.image){
  852. if( this.image.getResizedImage() ){
  853. this.action.changeIcon(function(){
  854. this.action.getPerson(function(json){
  855. if (json.data){
  856. this.personData = json.data;
  857. //if (this.personData.icon){
  858. this.contentImgNode.set("src", this.action.getPersonIcon());
  859. //}
  860. }
  861. }.bind(this))
  862. }.bind(this), null, this.image.getFormData(), this.image.resizedImage);
  863. }
  864. }
  865. },
  866. checkNickName: function( v ){
  867. debugger;
  868. var rx = /[a-z\d]/i, rxcn = /[\u4e00-\u9fa5]/, num = 0;
  869. for (var i = 0, j = v.length; i < j; i++) {
  870. if (rx.test(v[i])) num += 1;
  871. else if (rxcn.test(v[i])) num += 2;
  872. else if( ["-"," ", "_"].contains(v[i]) ) num += 1;
  873. else return false;
  874. }
  875. if (num < 4 || num > 20) return false;
  876. return true;
  877. },
  878. savePersonInfor: function(){
  879. // var array = [];
  880. // var ipAddress = this.ipAddressInputNode.get("value") || "";
  881. // 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]?)$/;
  882. // 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*$/;
  883. // if( ipAddress.trim() ){
  884. // ipAddress.split(",").each( function(ip){
  885. // if(!ip.match(ipV4Format) && !ip.match(ipV6Format))array.push( ip );
  886. // })
  887. // }
  888. // if( array.length > 0 ){
  889. // this.notice( this.lp.ipAddressIncorrectNotice + array.join(","), "error");
  890. // return false;
  891. // }
  892. var nickName = this.nickNameInputNode.get("value");
  893. if( nickName && nickName.trim() && !this.checkNickName( nickName ) ){
  894. //不包含特殊字符
  895. this.notice(this.lp.nickNameInforError, "error");
  896. return false;
  897. }
  898. this.personData.officePhone = this.officePhoneInputNode.get("value");
  899. this.personData.mail = this.mailInputNode.get("value");
  900. this.personData.mobile = this.mobileInputNode.get("value");
  901. this.personData.weixin = this.weixinInputNode.get("value");
  902. this.personData.qq = this.qqInputNode.get("value");
  903. var oldNickName = this.personData.nickName || "";
  904. this.personData.nickName = this.nickNameInputNode.get("value") || "";
  905. // this.personData.ipAddress = this.ipAddressInputNode.get("value");
  906. this.personData.signature = this.signatureInputNode.get("value");
  907. this.personData.language = this.languageSelectNode.options[this.languageSelectNode.selectedIndex].value;
  908. this.action.updatePerson(this.personData, function(){
  909. if( oldNickName !== this.personData.nickName ){
  910. //通知论坛昵称修改了
  911. o2.Actions.load("x_bbs_assemble_control").UserInfoAction.updateNickName( this.personData.distinguishedName );
  912. }
  913. this.notice(this.lp.saveInforOk, "success");
  914. localStorage.setItem('o2.language', this.personData.language);
  915. }.bind(this));
  916. },
  917. loadDesktopBackground: function(UINode){
  918. var currentSrc = layout.desktop.options.style;
  919. MWF.UD.getDataJson("layoutDesktop", function(json){
  920. if (json) currentSrc = json.src;
  921. }.bind(this), false);
  922. MWF.getJSON(layout.desktop.path+"styles.json", function(json){
  923. json.each(function(style){
  924. var img = MWF.defaultPath+"/xDesktop/$Layout/"+style.style+"/preview.jpg";
  925. //var dskImg = MWF.defaultPath+"/xDesktop/$Layout/"+style.style+"/desktop.jpg";
  926. var imgArea = new Element("div.o2_profile_previewBackground").inject(UINode);
  927. if (currentSrc==style.style){
  928. //imgArea.setStyles({"border": "4px solid #ffea00"});
  929. new Element("img.icon",{"src":"../x_component_Profile/$Main/newVersion/icon_ok2_click_copy_2.png"}).inject(imgArea);
  930. imgArea.addClass("profile_previewBackground_current");
  931. }
  932. new Element("img", {"src": img}).inject(imgArea);
  933. imgArea.store("dskimg", style.style);
  934. var _self = this;
  935. imgArea.addEvent("click", function(){ _self.selectDesktopImg(this, UINode); });
  936. }.bind(this));
  937. }.bind(this));
  938. },
  939. selectDesktopImg: function(item, UINode){
  940. var desktopImg = item.retrieve("dskimg");
  941. MWF.UD.putData("layoutDesktop", {"src": desktopImg}, function(){
  942. UINode.getChildren().each(function(node){
  943. //node.setStyles({"border": "4px solid #eeeeee"});
  944. node.removeClass("profile_previewBackground_current");
  945. if(node.getElement(".icon")){
  946. node.getElement(".icon").destroy();
  947. }
  948. }.bind(this));
  949. //item.setStyles({"border": "4px solid #ffea00"});
  950. new Element("img.icon",{"src":"../x_component_Profile/$Main/newVersion/icon_ok2_click_copy_2.png"}).inject(item);
  951. item.addClass("profile_previewBackground_current");
  952. var dskImg = MWF.defaultPath+"/xDesktop/$Layout/"+desktopImg+"/desktop.jpg";
  953. layout.desktop.node.setStyle("background-image", "url("+dskImg+")");
  954. }.bind(this));
  955. },
  956. changePassword: function(){
  957. var oldPassword = this.oldPasswordInputNode.get("value");
  958. var password = this.passwordInputNode.get("value");
  959. var morePassword = this.morePasswordInputNode.get("value");
  960. var remindNode = this.contentNode.getElement(".o2_profile_passwordWarmming");
  961. if (password!=morePassword){
  962. this.notice(this.lp.passwordNotMatch, "error");
  963. this.passwordInputNode.setStyles(this.css.inforContentInputNode_error);
  964. this.morePasswordInputNode.setStyles(this.css.inforContentInputNode_error);
  965. }else if(null||remindNode){
  966. this.notice(remindNode.get("text"), "error");
  967. }else{
  968. this.action.changePassword(oldPassword, password, morePassword, function(){
  969. this.oldPasswordInputNode.set("value", "");
  970. this.passwordInputNode.set("value", "");
  971. this.morePasswordInputNode.set("value", "");
  972. this.notice(this.lp.changePasswordOk, "success");
  973. }.bind(this));
  974. if (layout.config.mail){
  975. var url = "http://"+layout.config.mail+"//names.nsf?changepassword&password="+encodeURIComponent(oldPassword)+"&passwordnew="+encodeURIComponent(password)+"&passwordconfirm="+encodeURIComponent(password);
  976. var iframe = new Element("iframe", {"styles": {"display": "none"}}).inject(this.desktop.desktopNode);
  977. iframe.set("src", url);
  978. window.setTimeout(function(){
  979. iframe.destroy();
  980. }.bind(this), 2000);
  981. }
  982. }
  983. },
  984. getAction: function(callback){
  985. if (!this.acrion){
  986. this.action = MWF.Actions.get("x_organization_assemble_personal");
  987. if (callback) callback();
  988. }else{
  989. if (callback) callback();
  990. }
  991. },
  992. createPasswordStrengthNode : function(){
  993. var passwordStrengthArea = this.passwordRemindContainer;
  994. var lowNode = new Element( "div", {styles : this.css.passwordStrengthNode }).inject( passwordStrengthArea );
  995. this.lowColorNode = new Element( "div", {styles : this.css.passwordStrengthColor }).inject( lowNode );
  996. this.lowTextNode = new Element( "div", {styles : this.css.passwordStrengthText, text : this.lp.weak }).inject( lowNode );
  997. var middleNode = new Element( "div" , {styles : this.css.passwordStrengthNode }).inject( passwordStrengthArea );
  998. this.middleColorNode = new Element( "div", {styles : this.css.passwordStrengthColor }).inject( middleNode );
  999. this.middleTextNode = new Element( "div", {styles : this.css.passwordStrengthText, text : this.lp.middle }).inject( middleNode );
  1000. var highNode = new Element("div", {styles : this.css.passwordStrengthNode }).inject( passwordStrengthArea );
  1001. this.highColorNode = new Element( "div", {styles : this.css.passwordStrengthColor }).inject( highNode );
  1002. this.highTextNode = new Element( "div", {styles : this.css.passwordStrengthText, text : this.lp.high }).inject( highNode );
  1003. },
  1004. getPasswordLevel: function( password, callback ){
  1005. /*Level(级别)
  1006. •0-3 : [easy]
  1007. •4-6 : [midium]
  1008. •7-9 : [strong]
  1009. •10-12 : [very strong]
  1010. •>12 : [extremely strong]
  1011. */
  1012. this.getAction( function( ){
  1013. this.action.checkPassword( encodeURIComponent(password), function( json ){
  1014. if(callback)callback( json.data.value );
  1015. }.bind(this), null, false);
  1016. }.bind(this) );
  1017. },
  1018. getPasswordComplex : function(pwd){
  1019. if( typeof pwd != "string")
  1020. return false;
  1021. var sum = 0;
  1022. /*
  1023. 5 分: 小于 8 个字符
  1024. 10 分: 8 到 10 个字符
  1025. 25 分: 大于 10 个字符
  1026. */
  1027. if(pwd.length<8){
  1028. sum += 5;
  1029. }else if(pwd.length<=10){
  1030. sum += 10;
  1031. }else{
  1032. sum += 25;
  1033. }
  1034. /*
  1035. 0 分: 没有字母
  1036. 10 分: 全都是小(大)写字母
  1037. 25 分: 大小写混合字母
  1038. */
  1039. var lowerReg = /[a-z]/;
  1040. var uperReg = /[A-Z]/;
  1041. if(pwd.match(lowerReg)&&pwd.match(uperReg)){
  1042. sum += 25;
  1043. }else if(!pwd.match(lowerReg)&&!pwd.match(uperReg)){
  1044. sum += 0;
  1045. }else{
  1046. sum += 10;
  1047. }
  1048. /*
  1049. 0 分: 没有数字
  1050. 10 分: 1或2个数字
  1051. 20 分: 大于 2 个数字
  1052. */
  1053. var numReg = /[0-9]/;
  1054. var langReg = /[0-9]{3,}/;
  1055. if(pwd.match(langReg)){
  1056. sum += 20;
  1057. }else if(pwd.match(numReg)){
  1058. sum += 10;
  1059. }else{
  1060. sum += 0;
  1061. }
  1062. return sum;
  1063. },
  1064. checkPassowrdStrength: function(pwd){
  1065. var i = (!this.inBrowser && layout.viewMode==="Layout")? 4 : 3;
  1066. var passwordStrengthNode = this.tab.pages[i].contentNode.getElement(".o2_profile_passwordStrengthArea");
  1067. var passwordRemindNode = this.tab.pages[i].contentNode.getElement(".o2_profile_passwordRemindNode");
  1068. var nodes = passwordStrengthNode.getElements(".o2_profile_passwordStrengthColor");
  1069. var lowColorNode = nodes[0];
  1070. var middleColorNode = nodes[1];
  1071. var highColorNode = nodes[2];
  1072. nodes = passwordStrengthNode.getElements(".o2_profile_passwordStrengthText");
  1073. var lowTextNode = nodes[0];
  1074. var middleTextNode = nodes[1];
  1075. var highTextNode = nodes[2];
  1076. lowColorNode.removeClass("o2_profile_passwordStrengthColor_low");
  1077. middleColorNode.removeClass("o2_profile_passwordStrengthColor_middle");
  1078. highColorNode.removeClass("o2_profile_passwordStrengthColor_high");
  1079. lowTextNode.removeClass("o2_profile_passwordStrengthText_current");
  1080. middleTextNode.removeClass("o2_profile_passwordStrengthText_current");
  1081. highTextNode.removeClass("o2_profile_passwordStrengthText_current");
  1082. if (pwd==null||pwd==''){
  1083. }else{
  1084. this.getPasswordLevel( pwd, function( result ){
  1085. if(result){
  1086. passwordRemindNode.addClass("o2_profile_passwordWarmming").set("text",result);
  1087. }else{
  1088. var paswordRule = layout.config.passwordRegexHint || this.lp.paswordRule;
  1089. passwordRemindNode.removeClass("o2_profile_passwordWarmming").set("text",paswordRule);
  1090. var score = this.getPasswordComplex(pwd);
  1091. if(score<=40){
  1092. lowColorNode.addClass("o2_profile_passwordStrengthColor_low");
  1093. lowTextNode.addClass("o2_profile_passwordStrengthText_current");
  1094. }else if(score<=55){
  1095. middleColorNode.addClass("o2_profile_passwordStrengthColor_middle");
  1096. middleTextNode.addClass("o2_profile_passwordStrengthText_current");
  1097. }else{
  1098. highColorNode.addClass("o2_profile_passwordStrengthColor_high");
  1099. highTextNode.addClass("o2_profile_passwordStrengthText_current");
  1100. }
  1101. }
  1102. /*switch(level) {
  1103. case 0:
  1104. case 1:
  1105. case 2:
  1106. case 3:
  1107. lowColorNode.addClass("o2_profile_passwordStrengthColor_low");
  1108. lowTextNode.addClass("o2_profile_passwordStrengthText_current");
  1109. break;
  1110. case 4:
  1111. case 5:
  1112. case 6:
  1113. middleColorNode.addClass("o2_profile_passwordStrengthColor_middle");
  1114. middleTextNode.addClass("o2_profile_passwordStrengthText_current");
  1115. break;
  1116. default:
  1117. highColorNode.addClass("o2_profile_passwordStrengthColor_high");
  1118. highTextNode.addClass("o2_profile_passwordStrengthText_current");
  1119. }*/
  1120. }.bind(this) )
  1121. }
  1122. }
  1123. });
  1124. /*----2019年8月30日---外出授权---表单*/
  1125. MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
  1126. MWF.xApplication.Profile.emPowerPopupForm = new Class({
  1127. Extends : MPopupForm,
  1128. options: {
  1129. "style": "empower",
  1130. "width": "550",
  1131. "height": "480",
  1132. "hasTop": true,
  1133. "hasIcon": false,
  1134. "hasTopIcon" : false,
  1135. "hasTopContent" : false,
  1136. "draggable": true,
  1137. "maxAction" : true,
  1138. "closeAction": true,
  1139. "isFull" : false,
  1140. "startTime" : null,
  1141. "endTime" : null,
  1142. "isWholeday" : false,
  1143. "defaultCalendarId" : "",
  1144. "onPostCreateBottom": function () {
  1145. this.formBottomNode.getElement(".formOkActionNode").addClass("mainColor_bg");
  1146. }
  1147. },
  1148. load: function () {
  1149. //重新指定css文件,由于临时用,所以尽可能写一个文件里
  1150. this.cssPath = "../x_component_Profile/$Main/"+this.options.style+"/css.wcss";
  1151. this._loadCss();
  1152. this.configData = this.options.configData||{};
  1153. this.lp = this.lp.empower;
  1154. //this.addEvent("queryOk",this.queryOk());
  1155. },
  1156. _createTableContent : function() {
  1157. this.userName = layout.desktop.session.user.distinguishedName;
  1158. this.userId = layout.desktop.session.user.id;
  1159. this.userIdentityList = layout.desktop.session.user.identityList;
  1160. var identityTextList = [];
  1161. var identityList =[];
  1162. this.userIdentityList.each(function(it){
  1163. identityTextList.push(it.name+"("+it.unitName+")");
  1164. identityList.push((it.distinguishedName));
  1165. });
  1166. //this.formTableContainer.setStyle("width","80%");
  1167. var startTime, endTime, defaultStartDate, defaultStartTime, defaultEndDate, defaultEndTime;
  1168. if( this.data.startTime && this.data.endTime ){
  1169. startTime= this.date = typeOf( this.data.startTime )=="string" ? Date.parse( this.data.startTime ) : this.data.startTime;
  1170. endTime= typeOf( this.data.endTime )=="string" ? Date.parse( this.data.endTime ) : this.data.endTime;
  1171. defaultStartDate = startTime.format("%Y-%m-%d");
  1172. defaultStartTime = startTime.format("%H:%M");
  1173. defaultEndDate = endTime.format("%Y-%m-%d");
  1174. defaultEndTime = endTime.format("%H:%M");
  1175. }else{
  1176. startTime = this.date = new Date().increment("hour",1);
  1177. endTime = startTime.clone().increment("hour",1);
  1178. defaultStartDate = startTime.format("%Y-%m-%d");
  1179. defaultStartTime = startTime.format("%H") + ":00";
  1180. defaultEndDate = endTime.format("%Y-%m-%d");
  1181. defaultEndTime = endTime.format("%H") + ":00";
  1182. }
  1183. var data={};
  1184. this.formTableArea.set("html", this.getHtml());
  1185. MWF.xDesktop.requireApp("Template", "MForm", function () {
  1186. this.form = new MForm(this.formTableArea, data, {
  1187. isEdited: this.isEdited || this.isNew,
  1188. style : "profile",
  1189. itemTemplate: {
  1190. fromPerson: { text: this.lp.fromIdentity,type: "select", isEdited : (identityTextList.length>1),
  1191. selectText: identityTextList,
  1192. selectValue: identityList,
  1193. defaultValue: this.data.fromIdentity||identityList[0],
  1194. style:{
  1195. "width": "310px",
  1196. "height": "36px",
  1197. "box-shadow": "rgb(153, 153, 153) 0px 0px 0px",
  1198. "line-height": "36px",
  1199. "background": "#FFFFFF",
  1200. "border": "1px solid #DEDEDE",
  1201. "border-radius": "100px",
  1202. "font-family": "MicrosoftYaHei",
  1203. "padding":"0 5px",
  1204. "font-size": "14px",
  1205. "color": "#666666",
  1206. "margin": "0 0 10px 0"
  1207. }
  1208. },
  1209. toPerson: { text: this.lp.toIdentity,type: "org", isEdited : this.isEdited || this.isNew, orgType: ["identity"], count : 1, orgWidgetOptions : {
  1210. "onLoadedInfor": function(item){
  1211. // this.loadAcceptAndReject( item );
  1212. }.bind(this)
  1213. },defaultValue:this.data.toPerson},
  1214. keepTask: {
  1215. type: "checkbox",
  1216. selectText: [this.lp.keepTask],
  1217. selectValue: ["true"],
  1218. defaultValue: this.data.keepEnable ? "true" : "false"
  1219. },
  1220. startDateInput: {
  1221. text: this.lp.startTime,
  1222. tType: "date",
  1223. defaultValue: defaultStartDate,
  1224. notEmpty: true
  1225. },
  1226. startTimeInput: {
  1227. tType: "time",
  1228. defaultValue: defaultStartTime,
  1229. className: ((this.isNew || this.isEdited || 1) ? "inputTimeUnformatWidth" : ""),
  1230. disable: data.isAllDayEvent
  1231. },
  1232. endDateInput: {
  1233. text: this.lp.completedTime,
  1234. tType: "date",
  1235. defaultValue: defaultEndDate,
  1236. notEmpty: true
  1237. },
  1238. endTimeInput: {
  1239. tType: "time",
  1240. defaultValue: defaultEndTime,
  1241. className: ((this.isNew || this.isEdited || 1) ? "inputTimeUnformatWidth" : ""),
  1242. disable: data.isAllDayEvent
  1243. },
  1244. type: {
  1245. text: this.lp.type, type: "radio",
  1246. selectText: [this.lp.type_all, this.lp.type_application, this.lp.type_process],
  1247. //selectText: ["全部", "应用", "流程"],
  1248. selectValue: ["all", "application", "process"],
  1249. defaultValue: this.data.type||"all",
  1250. event :{
  1251. "click":function(){
  1252. var type = this.form.getItem("type").getValue();
  1253. this.formTableArea.getElement("td[item=application]").parentNode.setStyle("display","none");
  1254. this.formTableArea.getElement("td[item=process]").parentNode.setStyle("display","none");
  1255. if(type=="all"){
  1256. //this.formTableArea.getElement("td[item=application]").parentNode.setStyle("display","");
  1257. //this.formTableArea.getElement("td[item=process]").parentNode.setStyle("display","");
  1258. }else{
  1259. this.formTableArea.getElement("td[item="+type+"]").parentNode.setStyle("display","");
  1260. }
  1261. }.bind(this)
  1262. }
  1263. }
  1264. },
  1265. onPostLoad:function(){
  1266. /*样式重构*/
  1267. this.formTableArea.getElements("td[item=type] div").forEach(function(item){
  1268. var labelRadio = new Element("label.o2_profile_empower_radio"+(item.getElement("input").get("checked")?".o2_profile_empower_radio__checked.o2_profile_empower_radio_checked":"")).adopt(item.getElement("input")).addEvent("click",function(){
  1269. this.getParent().getParent().getElements("label").removeClass("o2_profile_empower_radio__checked o2_profile_empower_radio_checked");
  1270. this.addClass("o2_profile_empower_radio__checked o2_profile_empower_radio_checked");
  1271. });
  1272. item.adopt(labelRadio,item.getElement("span"))
  1273. });
  1274. }.bind(this)
  1275. },this.app,this.css);
  1276. this.form.load();
  1277. }.bind(this));
  1278. /*重构单选框样式
  1279. * */
  1280. this.applicationNode = this.formTableArea.getElement("td[item=application]");
  1281. //this.applicationNode.empty();
  1282. this.selectApplicationNode = new Element("div.selectNode", {
  1283. width: "30",
  1284. height: "30",
  1285. }).inject(this.applicationNode).setStyles(this.css.selectNode).addEvents({
  1286. "hover":function(){
  1287. this.setStyle("background","url(../x_component_Profile/$Main/newVersion/icon_zengjia_blue2_click.png) center center no-repeat");
  1288. },
  1289. "blur":function(){
  1290. this.setStyle("background","url(../x_component_Profile/$Main/newVersion/icon_zengjia_blue2.png) center center no-repeat");
  1291. }
  1292. });
  1293. this.showApplicationNode = new Element("div.showNode", {
  1294. width: "200",
  1295. height: "30",
  1296. // text: "选择应用"
  1297. }).inject(this.applicationNode).setStyles(this.css.showNode);
  1298. this.createApplicationSelect(this.showApplicationNode,this.selectApplicationNode,"Application");
  1299. this.processNode = this.formTableArea.getElement("td[item=process]");
  1300. this.selectProcessNode = new Element("div.selectNode", {
  1301. width: "30",
  1302. height: "30",
  1303. }).inject(this.processNode).setStyles(this.css.selectNode);
  1304. this.showProcessNode = new Element("div.showNode", {
  1305. width: "200",
  1306. height: "30",
  1307. //text: "选择流程"
  1308. }).inject(this.processNode).setStyles(this.css.showNode);
  1309. this.createApplicationSelect(this.showProcessNode,this.selectProcessNode,"Process");
  1310. },
  1311. _ok: function (data, callback) {
  1312. debugger;
  1313. data.fromIdentity = data.fromPerson;
  1314. data.toIdentity = data.toPerson;
  1315. var p1 = o2.Actions.load("x_organization_assemble_express").PersonAction.listWithIdentityObject({ identityList: [data.fromIdentity]});
  1316. var p2 = o2.Actions.load("x_organization_assemble_express").PersonAction.listWithIdentityObject({ identityList: [data.toIdentity]});
  1317. Promise.all([p1, p2]).then(function (arr) {
  1318. if(arr[0].data && arr[0].data.length)data.fromPerson = arr[0].data[0].distinguishedName;
  1319. if(arr[1].data && arr[1].data.length)data.toPerson = arr[1].data[0].distinguishedName;
  1320. this.__ok( data, callback );
  1321. }.bind(this))
  1322. },
  1323. __ok: function (data, callback) {
  1324. //data 是表单的数据, callback 是正确的回调
  1325. //data.
  1326. var submitData = [];
  1327. //数据处理
  1328. var sdata = {};
  1329. sdata.fromIdentity = data.fromIdentity;
  1330. sdata.fromPerson = data.fromPerson;
  1331. sdata.toIdentity = data.toIdentity;
  1332. sdata.toPerson = data.toPerson;
  1333. sdata.startTime = data.startDateInput+" "+data.startTimeInput+":00";
  1334. sdata.completedTime = data.endDateInput+" "+data.endTimeInput+":00";
  1335. sdata.keepEnable = false; //data.keepTask === "true";
  1336. if( Date.parse(sdata.completedTime) - Date.parse(sdata.startTime) < 0 ){
  1337. this.app.notice(this.lp.startTimeEarlyCompleteTime,"error");
  1338. return;
  1339. }
  1340. sdata.enable = true;
  1341. if(data.type=="all"){
  1342. sdata.type = data.type;
  1343. submitData.push(sdata);
  1344. }else if(data.type=="application"){
  1345. this.configData["Application"].forEach(function(item){
  1346. var subData = JSON.parse(JSON.stringify(sdata));
  1347. subData["application"] = item.id;
  1348. subData["applicationName"] = item.name;
  1349. subData["applicationAlias"] = item.alias;
  1350. subData.type = "application";
  1351. submitData.push(subData);
  1352. });
  1353. }else if(data.type=="process"){
  1354. this.configData["Process"].forEach(function(item){
  1355. var subData = JSON.parse(JSON.stringify(sdata));
  1356. subData["process"] = item.id;
  1357. subData["processName"] = item.name;
  1358. subData["processAlias"] = item.alias;
  1359. subData["edition"] = !!item.edition?item.edition:(item.id);
  1360. subData.type = "process";
  1361. submitData.push(subData);
  1362. });
  1363. }
  1364. /*this.saveConfigData=[];
  1365. this.saveConfigCount = submitData.length;*/
  1366. var submitCount=0;
  1367. submitData.forEach(function(item){
  1368. if(this.data.id&&submitCount==0){
  1369. this.actions.editEmPower(this.data.id,item,function(json){
  1370. submitCount++;
  1371. }.bind(this),null,false);
  1372. }else{
  1373. this.actions.createEmPower(item,function(json){
  1374. submitCount++;
  1375. }.bind(this),null,false);
  1376. }
  1377. }.bind(this));
  1378. if(!submitData.length){
  1379. this.app.notice( this.lp.alert1 ,"error");
  1380. }
  1381. if(submitCount>0){
  1382. var content = this.container.getElement(".o2_profile_emPower_tab");
  1383. content.getElement("table").empty();
  1384. this.app.loadMyEmPower();
  1385. }
  1386. if(submitData.length&&submitCount==submitData.length){
  1387. //this.close();
  1388. this.app.notice(this.lp.saveOk,"success");
  1389. this.close();
  1390. }else if(submitCount>0){
  1391. this.app.notice(this.lp.saveNotAll,"error");
  1392. this.close();
  1393. }
  1394. },
  1395. createApplicationSelect : function(node,selectNode,type){
  1396. if (this.configData[type]&&this.configData[type].length){
  1397. MWF.require("MWF.widget.O2Identity", function(){
  1398. var p = new MWF.widget.O2Process(this.configData[type][0], node);
  1399. }.bind(this));
  1400. }else{
  1401. this.configData[type]=[];
  1402. }
  1403. selectNode.addEvent("click", function(){
  1404. MWF.xDesktop.requireApp("Selector", "package", function(){
  1405. var options = {
  1406. "type": type,
  1407. "values": this.configData[type],
  1408. "count": 0,
  1409. "designer": false,
  1410. "onComplete": function (items) {
  1411. node.empty();
  1412. this[type] = {};
  1413. this.configData[type] = [];
  1414. items.forEach(function(item,indext){
  1415. MWF.require("MWF.widget.O2Identity", function(){
  1416. var p = new MWF.widget.O2Process(item.data, node);
  1417. this[type] = {
  1418. "name": item.data.name,
  1419. "id": item.data.id,
  1420. "edition":item.data.edition,
  1421. "application": item.data.application,
  1422. "applicationName": item.data.applicationName,
  1423. "alias": item.data.alias
  1424. };
  1425. this.configData[type].include(this[type]);
  1426. }.bind(this));
  1427. }.bind(this));
  1428. }.bind(this)
  1429. };
  1430. var selector = new MWF.O2Selector(this.container, options);
  1431. }.bind(this));
  1432. }.bind(this));
  1433. },
  1434. getHtml : function(){
  1435. return "<table width='100%' bordr='0' cellpadding='0' cellspacing='0' styles='formTable' id='empowerEditTable'>" +
  1436. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  1437. "<tr style='display:"+ (this.userIdentityList.length>1?"":"none")+"'><td styles='formTableTitleRight' lable='fromPerson'></td>" +
  1438. " <td styles='formTableValue' colspan='2'>" +
  1439. " <div item='fromPerson'></div>" +
  1440. " </td>" +
  1441. "</tr>" +
  1442. "<tr><td styles='formTableTitleRight' lable='toPerson'></td>" +
  1443. " <td styles='formTableValue' colspan='2'>" +
  1444. " <div item='toPerson'></div>" +
  1445. //" <div item='selecttoPerson'></div>" +
  1446. " </td>" +
  1447. "</tr>" +
  1448. "<tr><td styles='formTableTitleRight' width='100' lable='startDateInput'></td>" +
  1449. " <td styles='formTableValue' item='startDateInput' width='205'></td>" +
  1450. " <td styles='formTableValue' item='startTimeInput'></td>" +
  1451. "</tr>" +
  1452. "<tr><td styles='formTableTitleRight' lable='endDateInput'></td>" +
  1453. " <td styles='formTableValue' item='endDateInput'></td>" +
  1454. " <td styles='formTableValue' item='endTimeInput'></td>" +
  1455. "</tr>" +
  1456. "<tr><td styles='formTableTitleRight' ></td>" +
  1457. " <td styles='formTableValue' item='type' colspan='2'></td>" +
  1458. "</tr>" +
  1459. "<tr style='display:"+(this.data.type=="application"?"":"none")+"'><td styles='formTableTitleRight' lable='application'>"+this.lp.application+"</td>" +
  1460. " <td styles='formTableValue1' item='application' colspan='2'></td>" +
  1461. "</tr>" +
  1462. "<tr style='display:"+(this.data.type=="process"?"":"none")+"'><td styles='formTableTitleRight' lable='process'>"+this.lp.process+"</td>" +
  1463. " <td styles='formTableValue1' item='process' colspan='2'></td>" +
  1464. "</tr>" +
  1465. // "<tr><td styles='formTableTitleRight' width='100'></td>" +
  1466. // " <td styles='formTableValue' item='keepTask' colspan='2'></td>" +
  1467. // "</tr>" +
  1468. "</table>";
  1469. }
  1470. });