Main.js 76 KB

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