12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649 |
- MWF.xApplication.Profile.options.multitask = false;
- MWF.xApplication.Profile.Main = new Class({
- Extends: MWF.xApplication.Common.Main,
- Implements: [Options, Events],
- options: {
- "style": "newVersion",
- "name": "Profile",
- "icon": "icon.png",
- "width": "1100",
- "height": "820",
- "isResize": false,
- "isMax": false,
- "mvcStyle": "style.css",
- "title": MWF.xApplication.Profile.LP.title
- },
- _loadCss: function(){},
- loadCss: function(file, callback){
- var path = (file && typeOf(file)==="string") ? file : "style.css";
- var cb = (file && typeOf(file)==="function") ? file : callback;
- var cssPath = this.path+this.options.style+"/"+path;
- this.content.loadCss(cssPath, cb);
- },
- onQueryLoad: function(){
- this.lp = MWF.xApplication.Profile.LP;
- this.action = MWF.Actions.get("x_organization_assemble_personal");
- MWF.xDesktop.requireApp("Profile", "Common", null, false);
- },
- loadApplication: function(callback){
- if( this.isThreeManager() && !this.isSystemmanager ){
- var user = layout.desktop.session.user;
- this.personData = {
- name: user.name,
- employee: user.employee
- };
- this.content.loadHtml(this.path+this.options.style+"/view_xadmin.html",
- {"bind": {"data": this.personData, "lp": this.lp}, "module": this},
- function(){
- this.loadContent_3admin();
- }.bind(this)
- );
- }else{
- this.action.getPerson(function(json){
- this.personData = json.data;
- this.personData.personIcon = this.action.getPersonIcon();
- if(this.isSystemmanager){
- var user = layout.desktop.session.user;
- this.personData.name = user.name;
- this.personData.employee = user.employee;
- this.personData.mail = "";
- }
- var url = this.path+this.options.style+"/"+( (!this.inBrowser && layout.viewMode==="Layout") ? "view": "viewBrowser")+".html";
- this.content.loadHtml( url,
- {"bind": {"data": this.personData, "lp": this.lp}, "module": this},
- function(){
- this.loadContent()
- }.bind(this)
- );
- }.bind(this));
- //this.loadCss();
- // this.loadTitle();
- // this.loadContent();
- if (callback) callback();
- }
- },
- isThreeManager: function(){
- if( typeOf(this.threeManagerFlag) === "boolean" )return this.threeManagerFlag;
- var user = layout.desktop.session.user;
- if (user.roleList) {
- var userRoleName = [];
- user.roleList.each(function (role) {
- userRoleName.push(role.substring(0, role.indexOf("@")));
- });
- user.roleList = user.roleList.concat(userRoleName);
- }
- var roleLCList = (user.roleList || []).map(function (role) {
- return role.toLowerCase();
- }.bind(this));
- this.isSystemmanager = roleLCList.isIntersect(["systemmanager"]);
- this.threeManagerFlag = roleLCList.isIntersect(["systemmanager", "securitymanager", "auditmanager"]);
- return this.threeManagerFlag;
- },
- loadContent_3admin: function(){
- var pageConfigNodes = this.content.getElements(".o2_profile_configNode");
- this.contentNode = this.content.getElement(".o2_profile_contentNode");
- MWF.require("MWF.widget.Tab", function(){
- this.tab = new MWF.widget.Tab(this.contentNode, {"style": "profileV2"});
- this.tab.load();
- var firstPage;
- pageConfigNodes.each(function(node, i){
- var page = this.tab.addTab(node, node.get("title"));
- if( !this.isSystemmanager ){
- if( i > 0 )node.hide();
- }
- if( node.getStyle("display") === "none" ){
- page.tabNode.hide();
- }else if( layout.desktop.session.user.name.toLowerCase() === "xadmin" && ["password","empower"].contains( node.get("data-o2-type") ) ){
- page.tabNode.hide();
- }else if( !firstPage ){
- firstPage = page;
- }
- }.bind(this));
- this.contentNode.getElement("[name=MWFcontentNodeContainer]").setStyles({
- "height":"calc(100% - 50px)",
- "overflow":"auto"
- });
- this.tab.pages.map(function(stab){
- var tabNode = stab.tabNode;
- tabNode.addEvent("click",function(){
- this.addClass("mainColor_border");
- this.getChildren().addClass("mainColor_color");
- this.getSiblings().removeClass("mainColor_border");
- this.getSiblings().map(function(otabNode) {
- otabNode.getChildren().removeClass("mainColor_color");
- });
- }.bind(tabNode));
- }.bind(this));
- if (this.options.tab){
- this.tab.pages[this.options.tab].showIm();
- this.tab.pages[this.options.tab].tabNode.addClass("mainColor_border");
- this.tab.pages[this.options.tab].textNode.addClass("mainColor_color");
- }else{
- firstPage.showIm();
- firstPage.tabNode.addClass("mainColor_border");
- firstPage.textNode.addClass("mainColor_color");
- }
- if( this.isSystemmanager ){
- if (!this.inBrowser&&layout.viewMode=="Layout"){
- this.loadLayoutConfigActions();
- }
- this.loadIdeaConfigActions( 2 );
- }
- }.bind(this));
- },
- loadContent: function(){
- debugger;
- var pageConfigNodes = this.content.getElements(".o2_profile_configNode");
- this.contentNode = this.content.getElement(".o2_profile_contentNode");
- MWF.require("MWF.widget.Tab", function(){
- this.tab = new MWF.widget.Tab(this.contentNode, {"style": "profileV2"});
- this.tab.load();
- var firstPage;
- pageConfigNodes.each(function(node){
- var page = this.tab.addTab(node, node.get("title"));
- if( node.getStyle("display") === "none" ) {
- page.tabNode.hide();
- }else if( layout.desktop.session.user.name.toLowerCase() === "xadmin" && ["password","empower"].contains( node.get("data-o2-type") ) ){
- page.tabNode.hide();
- }else if( !firstPage ){
- firstPage = page;
- }
- }.bind(this));
- this.contentNode.getElement("[name=MWFcontentNodeContainer]").setStyles({
- "height":"calc(100% - 50px)",
- "overflow":"auto"
- });
- this.tab.pages.map(function(stab){
- var tabNode = stab.tabNode;
- tabNode.addEvent("click",function(){
- this.addClass("mainColor_border");
- this.getChildren().addClass("mainColor_color");
- this.getSiblings().removeClass("mainColor_border");
- this.getSiblings().map(function(otabNode) {
- otabNode.getChildren().removeClass("mainColor_color");
- });
- }.bind(tabNode));
- }.bind(this));
- if (this.options.tab){
- this.tab.pages[this.options.tab].showIm();
- this.tab.pages[this.options.tab].tabNode.addClass("mainColor_border");
- this.tab.pages[this.options.tab].textNode.addClass("mainColor_color");
- }else{
- firstPage.showIm();
- firstPage.tabNode.addClass("mainColor_border");
- firstPage.textNode.addClass("mainColor_color");
- // this.tab.pages[0].showIm();
- // this.tab.pages[0].tabNode.addClass("mainColor_border");
- // this.tab.pages[0].textNode.addClass("mainColor_color");
- }
- this.loadInforConfigActions();
- if (!this.inBrowser&&layout.viewMode=="Layout"){
- this.loadLayoutConfigActions();
- }else{
- }
- this.loadIdeaConfigActions();
- this.loadEmPowerConfigAction();
- this.loadPasswordConfigActions();
- this.loadSSOConfigAction();
- }.bind(this));
- },
- // openFaceSet: function(){
- // layout.openApplication(null, "FaceSet");
- // },
- loadInforConfigActions: function(){
- this.contentImgNode = this.content.getElement(".o2_profile_inforIconContentImg");
- this.content.getElement(".o2_profile_inforIconChange").addClass("mainColor_color mainColor_border").addEvent("click", function(){
- this.changeIcon();
- }.bind(this));
- var inputs = this.tab.pages[0].contentNode.getElements("input");
- inputs.addEvent("focus",function(){
- this.addClass("mainColor_border mainColor_color");
- }).addEvent("blur",function(){
- this.removeClass("mainColor_border mainColor_color");
- });
- this.mailInputNode = inputs[0];
- this.mobileInputNode = inputs[1];
- this.officePhoneInputNode = inputs[2];
- this.weixinInputNode = inputs[3];
- this.qqInputNode = inputs[4];
- // this.ipAddressInputNode = inputs[5];
- this.nickNameInputNode = inputs[5];
- this.signatureInputNode = this.tab.pages[0].contentNode.getElement("textarea");
- this.signatureInputNode.addEvent("focus",function(){
- this.addClass("mainColor_border mainColor_color");
- }).addEvent("blur",function(){
- this.removeClass("mainColor_border mainColor_color");
- });
- this.languageSelectNode = this.tab.pages[0].contentNode.getElement("select");
- this.languageSelectNode.empty();
- if (!this.personData.language) this.personData.language = "zh-CN";
- var lps = layout.config.supportedLanguages;
- Object.keys(lps).each(function(key){
- var option = new Element("option", {"value": key, "text": lps[key]}).inject(this.languageSelectNode);
- if (this.personData.language === key) option.set("selected", true);
- }.bind(this));
- this.content.getElement(".o2_profile_saveInforAction").addEvent("click", function(){
- this.savePersonInfor();
- }.bind(this));
- },
- loadLayoutConfigActions: function(){
- var buttons = this.tab.pages[1].contentNode.getElements(".o2_profile_layoutClearDataAction");
- this.clearDataAction = buttons[0];
- this.defaultDataAction = (buttons.length>1) ? buttons[1]: null;
- this.clearDefaultDataAction = (buttons.length>2) ? buttons[2]: null;
- this.forceDataAction = (buttons.length>3) ? buttons[3]: null;
- this.deleteForceDataAction = (buttons.length>4) ? buttons[4]: null;
- this.clearDataAction.addEvent("click", function(){
- MWF.require("MWF.widget.UUID", function(){
- MWF.UD.deleteData("layout", function(){
- this.notice(this.lp.clearok, "success");
- this.desktop.notRecordStatus = true;
- }.bind(this));
- }.bind(this));
- }.bind(this));
- if( MWF.AC.isAdministrator() ){
- this.defaultDataAction.addEvent("click", function(){
- MWF.require("MWF.widget.UUID", function(){
- var text = this.lp.setDefaultOk;
- this.close();
- var status = layout.desktop.getLayoutStatusData();
- MWF.UD.putPublicData("defaultLayout", status, function(){
- MWF.xDesktop.notice("success", {"x": "right", "y": "top"}, text, layout.desktop.desktopNode);
- }.bind(this));
- }.bind(this));
- }.bind(this));
- this.clearDefaultDataAction.addEvent("click", function(){
- MWF.require("MWF.widget.UUID", function(){
- MWF.UD.deletePublicData("defaultLayout", function(){
- this.notice(this.lp.clearok, "success");
- this.desktop.notRecordStatus = true;
- }.bind(this));
- }.bind(this));
- }.bind(this));
- this.forceDataAction.addEvent("click", function(){
- MWF.require("MWF.widget.UUID", function(){
- var text = this.lp.setForceOk;
- this.close();
- var status = layout.desktop.getLayoutStatusData();
- MWF.UD.putPublicData("forceLayout", status, function(){
- MWF.xDesktop.notice("success", {"x": "right", "y": "top"}, text, layout.desktop.desktopNode);
- }.bind(this));
- }.bind(this));
- }.bind(this));
- this.deleteForceDataAction.addEvent("click", function(){
- MWF.require("MWF.widget.UUID", function(){
- MWF.UD.deletePublicData("forceLayout", function(){
- this.notice(this.lp.clearok, "success");
- this.desktop.notRecordStatus = true;
- }.bind(this));
- }.bind(this));
- }.bind(this));
- }
- var UINode = this.tab.pages[1].contentNode.getLast();
- this.loadDesktopBackground(UINode);
- },
- loadIdeaConfigActions: function( i ){
- if( typeOf(i) !== "number" ) i = (!this.inBrowser && layout.viewMode==="Layout") ? 2 : 1;
- this.ideasArea = this.tab.pages[i].contentNode.setStyle("min-height","500px").getElement("textarea").addEvent("focus",function(){
- this.addClass("mainColor_border mainColor_color");
- }).addEvent("blur",function(){
- this.removeClass("mainColor_border mainColor_color");
- });
- this.ideasSaveAction = this.ideasArea.getNext().addEvent("mouseover",function(){
- this.addClass("mainColor_bg");
- }).addEvent("mouseout",function(){
- this.removeClass("mainColor_bg");
- });
- this.ideasSaveDefaultAction = this.ideasSaveAction.getNext() || null;
- if (MWF.AC.isAdministrator()){
- this.ideasSaveDefaultAction.addEvent("mouseover",function(){
- this.addClass("mainColor_bg");
- }).addEvent("mouseout",function(){
- this.removeClass("mainColor_bg");
- });
- this.ideasSaveDefaultAction.addEvent("click", function(){
- MWF.require("MWF.widget.UUID", function(){
- var data = {};
- data.ideas = this.ideasArea.get("value").split("\n");
- MWF.UD.putPublicData("idea", data, function(){
- this.notice(this.lp.ideaSaveOk, "success");
- }.bind(this));
- }.bind(this));
- }.bind(this))
- }
- MWF.require("MWF.widget.UUID", function(){
- MWF.UD.getDataJson("idea", function(json){
- if (json){
- if (json.ideas) this.ideasArea.set("value", json.ideas.join("\n"));
- }
- }.bind(this));
- }.bind(this));
- this.ideasSaveAction.addEvent("click", function(){
- MWF.require("MWF.widget.UUID", function(){
- var data = {};
- data.ideas = this.ideasArea.get("value").split("\n");
- MWF.UD.putData("idea", data, function(){
- this.notice(this.lp.ideaSaveOk, "success");
- }.bind(this));
- }.bind(this));
- }.bind(this))
- },
- loadEmPowerConfigAction: function(){
- var i = (!this.inBrowser && layout.viewMode==="Layout")? 3 : 2;
- this.tab.pages[i].contentNode.setStyle("overflow","auto");
- var tabEmpowerNodes = this.tab.pages[i].contentNode.getElements("div.o2_profile_emPower_tab");
- this.emPowerContentNode = this.tab.pages[i].contentNode.getElement("div.o2_profile_emPower_content");
- MWF.require("MWF.widget.Tab", function() {
- this.tabEmpower = new MWF.widget.Tab(this.emPowerContentNode, {"style": "empower_v10"});
- // this.tabEmpower = new MWF.widget.Tab(this.emPowerContentNode, {"style": "empower"});
- this.tabEmpower.load();
- tabEmpowerNodes.each(function(node){
- this.tabEmpower.addTab(node, node.get("title"));
- }.bind(this));
- this.tabEmpower.pages.map(function(stab){
- var tabNode = stab.tabNode.setStyle("cursor","pointer");
- tabNode.addEvent("click",function(){
- this.addClass("mainColor_bg");
- this.getSiblings().removeClass("mainColor_bg");
- }.bind(tabNode));
- }.bind(this));
- if (!this.options.tabEmpower) {
- this.tabEmpower.pages[0].showIm();
- this.tabEmpower.pages[0].tabNode.addClass("mainColor_bg");
- } else {
- this.tabEmpower.pages[this.options.tab].showIm();
- this.tabEmpower.pages[this.options.tab].tabNode.addClass("mainColor_bg");
- }
- }.bind(this));
- this.loadEmpowerBtn();
- this.loadMyEmPower();
- this.loadReceiveEmPower();
- this.loadMyEmPowerLog();
- this.loadReceiveEmPowerLog();
- },
- loadEmpowerBtn: function(){
- var BtnImg = new Element("div.o2_profile_emPower_Btnimg");
- var BtnText = new Element("div.o2_profile_emPower_Btntext");
- var addEmPowerDiv = new Element("div.o2_profile_emPower_Add").adopt(BtnImg.cloneNode(),BtnText.cloneNode().set("text",this.lp.empower.addEmPower));
- var withDrawEmPowerDiv = new Element("div.o2_profile_emPower_WithDraw").adopt(BtnImg.cloneNode(),BtnText.cloneNode().set("text",this.lp.empower.withdraw));
- this.tabEmpower.tabNodeContainerArea.adopt(withDrawEmPowerDiv,addEmPowerDiv);
- this.tabEmpower.tabNodeContainerArea.getElements(".o2_profile_emPower_Add").addEvent("click",function(){
- var popForm = new MWF.xApplication.Profile.emPowerPopupForm(null, {}, {
- "style": "empower",
- "width": "550",
- "height": layout.desktop.session.user.identityList.length>1?"530":"480",
- "hasTop": true,
- "hasIcon": false,
- "hasTopIcon" : false,
- "hasTopContent" : false,
- "draggable": true,
- "maxAction" : true,
- "closeAction": true,
- "isFull" : false,
- "startTime" : null,
- "endTime" : null,
- "isWholeday" : false,
- "title" : this.lp.createEmpower,
- "defaultCalendarId" : ""
- }, {
- app: this,
- container : this.content,
- lp : this.lp,
- actions : this.action,
- css : {}
- });
- if(layout.desktop.session.user.identityList.length>=1){
- popForm.create();
- }else{
- this.notice( this.lp.empower.alert2 ,"error");
- }
- }.bind(this));
- //撤回按钮
- this.tabEmpower.tabNodeContainerArea.getElements(".o2_profile_emPower_WithDraw").addEvent("click",function(){
- // var checkElement = this.emPowerTable.getElements("input[name=id]:checked");
- var checkElement = this.tabEmpower.showPage.contentNode.getElements("td input[name=id]:checked")
- var editCount = 0;
- checkElement.forEach(function(item){
- this.action.deleteEmPower(item.get("value"),function(json){
- if(json.type=="success"){
- editCount += 1;
- }
- item.getParent().getParent().getParent().destroy();
- }.bind(this),null,false);
- /*enable为false时无法再次委托相同内容,又因为目前没做授权的编辑,所以撤回直接调用delete接口
- var idata = this.emPowerData[item.get("value")];
- idata.enable = false;
- this.action.editEmPower(item.get("value"),idata,function(json){
- if(json.type=="success"){
- editCount += 1;
- }
- item.getParent().getParent().destroy();
- }.bind(this),null,false);*/
- }.bind(this));
- if(checkElement.length==0){
- this.notice(this.lp.empower.selectEmPower, "error");
- }else if(checkElement.length&&editCount==checkElement.length){
- this.notice(this.lp.empower.withdrawOk, "success");
- }else{
- //this.notice(this.lp.empower.withdrawOk, "success");
- }
- if(this.myEmPower.getElements("tr").length==1){
- this["myEmPowerNoDataDiv"].setStyle("display","");
- }
- }.bind(this));
- },
- loadMyEmPower: function(){
- this.myEmPower = this.tabEmpower.pages[0].contentNode;
- //this.myEmPowerContent = new Element("div.myEmPowerContent",{text:"hhhhhh"}).inject(this.myEmPower);
- this.getAction( function( ){
- this.action.getMyEmPower(function(json){
- var data = json.data;
- this.getEmPowerTable("myEmPower",data,this.myEmPower);
- }.bind(this));
- }.bind(this));
- },
- loadReceiveEmPower: function(){
- this.receiveEmPower = this.tabEmpower.pages[1].contentNode;
- //this.myEmPowerContent = new Element("div.myEmPowerContent",{text:"hhhhhh"}).inject(this.myEmPower);
- this.getAction( function( ){
- this.action.getReceiveEmPower(function(json){
- var data = json.data;
- this.getEmPowerTable("receiveEmPower",data,this.receiveEmPower);
- }.bind(this));
- }.bind(this) );
- },
- loadMyEmPowerLog: function(){
- this.myEmPowerLog = this.tabEmpower.pages[2].contentNode;
- this.getEmPowerLogTable("myEmPowerLog","",this.myEmPowerLog);
- },
- loadReceiveEmPowerLog: function(){
- this.receiveEmPowerLog = this.tabEmpower.pages[3].contentNode;
- this.getEmPowerLogTable("receiveEmPowerLog","",this.receiveEmPowerLog);
- },
- getEmPowerLogTable: function(type,data,content){
- var _this = this;
- new MWF.xApplication.Profile.Common.Content(content, {
- "title":content.get("title"),
- "searchItemList": [
- ],
- "columns": [
- {width:"30%","title": this.lp.empower.title, "field": "subject","formatter":function(data,target){
- var _content = this;
- new Element("a",{"text":data.title,"style":"cursor:pointer"}).inject(target).addEvent("click",function(e){
- var confirm = function () {
- _this.confirm("warn", e, _this.lp.workDeletedTitle, _this.lp.workDeletedContent.replace("{title}", data.title), 300, 120, function(){
- o2.Actions.load("x_organization_assemble_personal").EmpowerLogAction.delete( data.id, function () {
- _content.pagination.toPage();
- _this.notice( _this.lp.deleteSuccess );
- });
- this.close();
- }, function(){
- this.close();
- });
- }.bind(this);
- var options = {"workId": data.work, "appId": "process.Work"+data.work};
- o2.Actions.load("x_processplatform_assemble_surface").WorkAction.getWithWorkOrWorkCompleted(data.work, function (json) {
- if( json.data && (json.data.work || json.data.workCompleted) ){
- _this.desktop.openApplication(e, "process.Work", options);
- }else{
- if( type === "receiveEmPowerLog" ){
- confirm();
- }else{
- _this.notice( _this.lp.workDeletedNote.replace("{title}", data.title), "info" );
- }
- }
- }, function () {
- if( type === "receiveEmPowerLog" ){
- confirm();
- }else{
- _this.notice( _this.lp.workDeletedNote.replace("{title}", data.title), "info" );
- }
- return true;
- });
- });
- }},
- type=="myEmPowerLog"?{width:"10%","title": this.lp.empower.toPerson, "field": "toPerson","formatter":function(data,target){
- new Element("div",{"text":data.toPerson.split("@")[0]}).inject(target);
- }}:{width:"10%","title": this.lp.empower.fromPerson, "field": "fromPerson","formatter":function(data,target){
- new Element("div",{"text":data.fromPerson.split("@")[0]}).inject(target);
- }},
- {width:"15%","title": this.lp.empower.applicationName, "field": "applicationName"},
- {width:"15%","title": this.lp.empower.processName, "field": "processName"},
- {width:"15%","title": this.lp.empower.activityName, "field": "activityName"},
- {width:"15%","title": this.lp.empower.createTime, "field": "updateTime"}
- ],
- "opButtonList": [
- ],
- "onBeforeLoadData": function () {
- _this.getAction( function( ){
- if( type=="myEmPowerLog"){
- _this.action.listWithCurrentPersonPaging(this.options.page,this.options.pageSize,"",function(json){
- this.dataList = json.data;
- this.total = json.count;
- }.bind(this),null,false);
- }else{
- _this.action.listToCurrentPersonPaging(this.options.page,this.options.pageSize,"",function(json){
- this.dataList = json.data;
- this.total = json.count;
- }.bind(this),null,false);
- }
- }.bind(this) );
- }
- }).load();
- if(!this[type+"NoDataDiv"]){
- this[type+"NoDataDiv"] = new Element("div.o2_profile_emPower_noData").adopt(
- new Element("img",{src:"../x_component_Profile/$Main/newVersion/icon_wuweituo.png"}),
- new Element("div",{text: this.lp.noTask })
- ).inject(content.getElement(".profile_common_tableDiv"));
- }
- if(content.getElements("tr").length==1){
- this[type+"NoDataDiv"].setStyle("display","");
- }else{
- if(this[type+"NoDataDiv"]){
- this[type+"NoDataDiv"].setStyle("display","none");
- }
- }
- },
- getEmPowerTable: function(type,data,content){
- //var table = content.getElement("table.emPowerTable");
- this.emPowerTable = content.getElement("table.emPowerTable");
- if(!this.emPowerTable){
- this.emPowerTable = new Element("table.emPowerTable",{
- width:"100%",
- border:"0",
- cellpadding:"0",
- cellspacing:"0"
- }).inject(content);
- }
- this.userName = layout.desktop.session.user.distinguishedName;
- var th = new Element("tr.first");
- if(type=="myEmPower"){
- var BtnImg = new Element("div.o2_profile_emPower_Btnimg");
- var BtnText = new Element("div.o2_profile_emPower_Btntext");
- this.emPowerData={};
- var cblabel = new Element("label.o2_profile_empower_checkbox").adopt(new Element("input",{
- name:"allEmpower",
- id:"allEmpower",
- type:"checkbox"
- })).setStyle("float","left").addEvent("click",function(){
- if(this.getElement("input").get("checked")){
- this.getParent().getParent().getParent().getElements("input[type=checkbox]").set("checked",true);
- this.getParent().getParent().getParent().getElements("label").addClass("o2_profile_empower_checkbox__checked o2_profile_empower_checkbox_checked");
- this.getParent().getParent().getParent().getElements("tr").addClass("selected");
- }else{
- this.getParent().getParent().getParent().getElements("input[type=checkbox]").set("checked",false);
- this.getParent().getParent().getParent().getElements("label").removeClass("o2_profile_empower_checkbox__checked o2_profile_empower_checkbox_checked");
- this.getParent().getParent().getParent().getElements("tr").removeClass("selected");
- }
- });
- th.adopt(new Element("th",{width:"16%"}).adopt(cblabel,new Element("div",{text:this.lp.empower.toPerson}).setStyle("float","left")));
- }else{
- th.adopt(new Element("th",{width:"16%"}).adopt(new Element("div",{text:this.lp.empower.fromPerson})));
- }
- th.adopt(new Element("th",{width:"7%"}).adopt(new Element("div",{text:this.lp.empower.type})));
- th.adopt(new Element("th",{width:"16%"}).adopt(new Element("div",{text:this.lp.empower.applicationName+"/"+this.lp.empower.processName})));
- th.adopt(new Element("th",{width:"18%"}).adopt(new Element("div",{text:this.lp.empower.startTime})));
- th.adopt(new Element("th",{width:"18%"}).adopt(new Element("div",{text:this.lp.empower.completedTime})));
- if(type=="myEmPower"){
- th.adopt(new Element("th",{width:"25%"}).adopt(new Element("div",{text: this.lp.action })));
- }
- this.emPowerTable.adopt(th);
- data.forEach(function(item){
- if(true||item.enable==true){
- var tr = new Element("tr"+(item.enable?"":".disabled"));
- var td = new Element("td");
- var cblabel = new Element("label.o2_profile_empower_checkbox").adopt(new Element("input",{
- name:"id",
- value:item.id,
- type:"checkbox"
- })).setStyle("float","left").addEvent("click",function(){
- if(this.getElement("input").get("checked")){
- this.addClass("o2_profile_empower_checkbox__checked o2_profile_empower_checkbox_checked");
- this.getParent().getParent().addClass("selected");
- }else{
- this.removeClass("o2_profile_empower_checkbox__checked o2_profile_empower_checkbox_checked");
- this.getParent().getParent().removeClass("selected");
- }
- })
- var tds = [];
- if(type=="myEmPower"){
- this.emPowerData[item.id]=item;
- tds.push(td.cloneNode().adopt(cblabel,new Element("div",{name:"toPerson",text:item.toPerson.split("@")[0]})));
- }else{
- tds.push(td.cloneNode().adopt(new Element("div",{name:"fromPerson",text:item.fromPerson.split("@")[0]})));
- }
- tds.push(td.cloneNode().adopt(new Element("div",{name:"type",text:this.lp.empower["type_"+item.type]})));
- tds.push(td.cloneNode().adopt(new Element("div",{name:"typeName",text:item.applicationName||item.processName||(item.type=='filter'?JSON.parse(item.filterListData)[0].value:"-")})));
- tds.push(td.cloneNode().adopt(new Element("div",{name:"startTime",text:item.startTime})));
- tds.push(td.cloneNode().adopt(new Element("div",{name:"completedTime",text:item.completedTime})));
- //后续添加编辑/删除/撤回按钮
- var _self = this;
- if(type=="myEmPower"){
- //启用、禁用按钮
- var endTime = new Date(item.completedTime);
- var startTime= new Date(item.startTime);
- var nowTime = new Date();
- //text:item.enable?_self.lp.empower.disable:_self.lp.empower.enable
- var enableClass = item.enable?"o2_profile_emPower_Disable":"o2_profile_emPower_Enable";
- var enableText = item.enable?_self.lp.empower.disable:_self.lp.empower.enable
- var isEnable = new Element("div."+enableClass).adopt(BtnImg.cloneNode(),BtnText.cloneNode().set("text",enableText)).addEvent("click",function(){
- this.enable = !this.enable;
- _self.action.editEmPower(this.id,this,function(json){
- //submitCount++;
- this.notice(this.lp.empower.saveOk,json.type);
- var content = this.content.getElement(".o2_profile_emPower_tab");
- content.getElement("table").empty();
- this.loadMyEmPower();
- }.bind(_self),null,false);
- }.bind(item));
- tds.push(td.cloneNode().setStyles({
- "margin":"auto"
- }).adopt(
- new Element("div.o2_profile_emPower_Edit").adopt(BtnImg.cloneNode(),BtnText.cloneNode().set("text",this.lp.empower.edit)).addEvent("click",function(e){
- var _data = this;
- _data.fromPerson = _data.fromIdentity;
- _data.toPerson = _data.toIdentity;
- _data.startTime = _data.startTime;
- _data.endTime = _data.completedTime;
- var editPopForm = new MWF.xApplication.Profile.emPowerPopupForm(null, _data, {
- "style": "empower",
- "width": "550",
- "height": layout.desktop.session.user.identityList.length>1?"530":"480",
- "hasTop": true,
- "hasIcon": false,
- "hasTopIcon" : false,
- "hasTopContent" : false,
- "draggable": true,
- "maxAction" : true,
- "closeAction": true,
- "isFull" : false,
- "startTime" : null,
- "endTime" : null,
- "isWholeday" : false,
- "title" : _self.lp.empower.editEmpower,
- "configData":{
- Process:(_data.type=="process"?[{name:_data.processName,id:_data.process,editon:_data.edition}]:[]),
- Application:(_data.type=="application"?[{name:_data.applicationName,id:_data.application}]:[])
- },
- "defaultCalendarId" : ""
- }, {
- app: _self,
- container : _self.content,
- lp : _self.lp,
- actions : _self.action,
- css : {}
- });
- editPopForm.edit();
- }.bind(item)),
- (nowTime<startTime||nowTime>endTime)&&false?"":(isEnable),
- 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(){
- var _this = this;
- _self.action.deleteEmPower(_this.get("empowerid"),function(json){
- this.notice(this.lp.empower.withdrawOk,json.type);
- _this.getParent().getParent().destroy();
- }.bind(_self),null,false);
- })
- ));
- }/**/
- tr.adopt(tds);
- this.emPowerTable.adopt(tr);
- }
- }.bind(this));
- if(!this[type+"NoDataDiv"]){
- this[type+"NoDataDiv"] = new Element("div.o2_profile_emPower_noData").adopt(
- new Element("img",{src:"../x_component_Profile/$Main/newVersion/icon_wuweituo.png"}),
- new Element("div",{text:this.lp.empower.noData}),
- type=="myEmPower"?new Element("div.o2_profile_emPower_Add.mainColor_color",{text: this.lp.createAuthorize }).addEvent("click",function(){
- var popForm = new MWF.xApplication.Profile.emPowerPopupForm(null, {}, {
- "style": "empower",
- "width": "550",
- "height": layout.desktop.session.user.identityList.length>1?"530":"480",
- "hasTop": true,
- "hasIcon": false,
- "hasTopIcon" : false,
- "hasTopContent" : false,
- "draggable": true,
- "maxAction" : true,
- "closeAction": true,
- "isFull" : false,
- "startTime" : null,
- "endTime" : null,
- "isWholeday" : false,
- "title" : this.lp.createEmpower,
- "defaultCalendarId" : ""
- }, {
- app: this,
- container : this.content,
- lp : this.lp,
- actions : this.action,
- css : {}
- });
- if(layout.desktop.session.user.identityList.length>=1){
- popForm.create();
- }else{
- this.notice( this.lp.empower.alert2 ,"error");
- }
- }.bind(this)):""
- ).inject(content);
- }
- if(this.emPowerTable.getElements("tr").length==1){
- this[type+"NoDataDiv"].setStyle("display","");
- //table.adopt(new Element("tr").adopt(new Element("td")).adopt()));
- }else{
- if(this[type+"NoDataDiv"]){
- this[type+"NoDataDiv"].setStyle("display","none");
- }
- //this.myEmPowerTable.adopt(trs);
- }
- },
- loadPasswordConfigActions: function(){
- var i = (!this.inBrowser && layout.viewMode==="Layout" )? 4 : 3;
- var passwordRemindNode = this.tab.pages[i].contentNode.getElement(".o2_profile_passwordRemindNode");
- var paswordRule = layout.config.passwordRegexHint || this.lp.paswordRule;
- passwordRemindNode.set("text",paswordRule);
- var inputs = this.tab.pages[i].contentNode.setStyle("min-height","300px").getElements("input");
- this.oldPasswordInputNode = inputs[0];
- this.passwordInputNode = inputs[1];
- this.morePasswordInputNode = inputs[2];
- this.savePasswordAction = this.tab.pages[i].contentNode.getElement(".o2_profile_savePasswordAction");
- this.oldPasswordInputNode.addEvents({
- "blur": function(){this.removeClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");},
- "focus": function(){this.addClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");}
- });
- this.passwordInputNode.addEvents({
- "blur": function(){this.removeClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");},
- "focus": function(){this.addClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");},
- "keyup" : function(){ this.checkPassowrdStrength( this.passwordInputNode.get("value")) }.bind(this)
- });
- this.morePasswordInputNode.addEvents({
- "blur": function(){this.removeClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");},
- "focus": function(){this.addClass("o2_profile_inforContentInput_focus mainColor_border mainColor_color");}
- });
- this.savePasswordAction.addEvent("click", function(){
- this.changePassword();
- }.bind(this)).addClass("mainColor_bg");
- },
- loadSSOConfigAction: function(){
- var i = (!this.inBrowser && layout.viewMode==="Layout") ? 5 : 4;
- this.ssoConfigAreaNode = this.tab.pages[i].contentNode.setStyle("min-height","300px").getElement(".o2_profile_ssoConfigArea");
- MWF.Actions.get("x_organization_assemble_authentication").listOauthServer(function(json){
- json.data.each(function(d){
- var node = new Element("a", {
- "class":"mainColor_color",
- "styles": {"font-size": "14px", "display": "block", "margin-bottom": "10px"},
- "text": d.displayName || d.name,
- "target": "_blank",
- "href": "../x_desktop/oauth.html?oauth="+encodeURIComponent(d.name)+"&redirect="+"&method=oauthBind"
- }).inject(this.ssoConfigAreaNode)
- }.bind(this));
- }.bind(this));
- },
- changeIcon: function(){
- var options = {};
- var width = "668";
- var height = "510";
- width = width.toInt();
- height = height.toInt();
- var size = this.content.getSize();
- var x = (size.x-width)/2;
- var y = (size.y-height)/2;
- if (x<0) x = 0;
- if (y<0) y = 0;
- if (layout.mobile){
- x = 20;
- y = 0;
- }
- var _self = this;
- MWF.require("MWF.xDesktop.Dialog", function() {
- MWF.require("MWF.widget.ImageClipper", function(){
- var dlg = new MWF.xDesktop.Dialog({
- "title": this.lp.changePersonIcon,
- "style": "image",
- "top": y,
- "left": x - 20,
- "fromTop": y,
- "fromLeft": x - 20,
- "width": width,
- "height": height,
- "html": "<div></div>",
- "maskNode": this.content,
- "container": this.content,
- "buttonList": [
- {
- "text": MWF.LP.process.button.ok,
- "action": function () {
- //_self.uploadPersonIcon();
- _self.image.uploadImage( function( json ){
- _self.action.getPerson(function(json){
- if (json.data){
- this.personData = json.data;
- _self.contentImgNode.set("src", _self.action.getPersonIcon());
- }
- this.close();
- }.bind(this));
- }.bind(this), null );
- }
- },
- {
- "text": MWF.LP.process.button.cancel,
- "action": function () {
- _self.image = null;
- this.close();
- }
- }
- ]
- });
- dlg.show();
- this.image = new MWF.widget.ImageClipper(dlg.content.getFirst(), {
- "aspectRatio": 1,
- "description" : "",
- "imageUrl" : this.action.getPersonIcon(),
- "resetEnable" : false,
- "data": null,
- "parameter": null,
- "action": this.action.action,
- "method": "changeIcon"
- });
- this.image.load();
- }.bind(this));
- }.bind(this))
- },
- uploadPersonIcon: function(){
- if (this.image){
- if( this.image.getResizedImage() ){
- this.action.changeIcon(function(){
- this.action.getPerson(function(json){
- if (json.data){
- this.personData = json.data;
- //if (this.personData.icon){
- this.contentImgNode.set("src", this.action.getPersonIcon());
- //}
- }
- }.bind(this))
- }.bind(this), null, this.image.getFormData(), this.image.resizedImage);
- }
- }
- },
- checkNickName: function( v ){
- debugger;
- var rx = /[a-z\d]/i, rxcn = /[\u4e00-\u9fa5]/, num = 0;
- for (var i = 0, j = v.length; i < j; i++) {
- if (rx.test(v[i])) num += 1;
- else if (rxcn.test(v[i])) num += 2;
- else if( ["-"," ", "_"].contains(v[i]) ) num += 1;
- else return false;
- }
- if (num < 4 || num > 20) return false;
- return true;
- },
- savePersonInfor: function(){
- // var array = [];
- // var ipAddress = this.ipAddressInputNode.get("value") || "";
- // 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]?)$/;
- // 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*$/;
- // if( ipAddress.trim() ){
- // ipAddress.split(",").each( function(ip){
- // if(!ip.match(ipV4Format) && !ip.match(ipV6Format))array.push( ip );
- // })
- // }
- // if( array.length > 0 ){
- // this.notice( this.lp.ipAddressIncorrectNotice + array.join(","), "error");
- // return false;
- // }
- var nickName = this.nickNameInputNode.get("value");
- if( nickName && nickName.trim() && !this.checkNickName( nickName ) ){
- //不包含特殊字符
- this.notice(this.lp.nickNameInforError, "error");
- return false;
- }
- this.personData.officePhone = this.officePhoneInputNode.get("value");
- this.personData.mail = this.mailInputNode.get("value");
- this.personData.mobile = this.mobileInputNode.get("value");
- this.personData.weixin = this.weixinInputNode.get("value");
- this.personData.qq = this.qqInputNode.get("value");
- var oldNickName = this.personData.nickName || "";
- this.personData.nickName = this.nickNameInputNode.get("value") || "";
- // this.personData.ipAddress = this.ipAddressInputNode.get("value");
- this.personData.signature = this.signatureInputNode.get("value");
- this.personData.language = this.languageSelectNode.options[this.languageSelectNode.selectedIndex].value;
- this.action.updatePerson(this.personData, function(){
- if( oldNickName !== this.personData.nickName ){
- //通知论坛昵称修改了
- o2.Actions.load("x_bbs_assemble_control").UserInfoAction.updateNickName( this.personData.distinguishedName );
- }
- this.notice(this.lp.saveInforOk, "success");
- localStorage.setItem('o2.language', this.personData.language);
- }.bind(this));
- },
- loadDesktopBackground: function(UINode){
- var currentSrc = layout.desktop.options.style;
- MWF.UD.getDataJson("layoutDesktop", function(json){
- if (json) currentSrc = json.src;
- }.bind(this), false);
- MWF.getJSON(layout.desktop.path+"styles.json", function(json){
- json.each(function(style){
- var img = MWF.defaultPath+"/xDesktop/$Layout/"+style.style+"/preview.jpg";
- //var dskImg = MWF.defaultPath+"/xDesktop/$Layout/"+style.style+"/desktop.jpg";
- var imgArea = new Element("div.o2_profile_previewBackground").inject(UINode);
- if (currentSrc==style.style){
- //imgArea.setStyles({"border": "4px solid #ffea00"});
- new Element("img.icon",{"src":"../x_component_Profile/$Main/newVersion/icon_ok2_click_copy_2.png"}).inject(imgArea);
- imgArea.addClass("profile_previewBackground_current");
- }
- new Element("img", {"src": img}).inject(imgArea);
- imgArea.store("dskimg", style.style);
- var _self = this;
- imgArea.addEvent("click", function(){ _self.selectDesktopImg(this, UINode); });
- }.bind(this));
- }.bind(this));
- },
- selectDesktopImg: function(item, UINode){
- var desktopImg = item.retrieve("dskimg");
- MWF.UD.putData("layoutDesktop", {"src": desktopImg}, function(){
- UINode.getChildren().each(function(node){
- //node.setStyles({"border": "4px solid #eeeeee"});
- node.removeClass("profile_previewBackground_current");
- if(node.getElement(".icon")){
- node.getElement(".icon").destroy();
- }
- }.bind(this));
- //item.setStyles({"border": "4px solid #ffea00"});
- new Element("img.icon",{"src":"../x_component_Profile/$Main/newVersion/icon_ok2_click_copy_2.png"}).inject(item);
- item.addClass("profile_previewBackground_current");
- var dskImg = MWF.defaultPath+"/xDesktop/$Layout/"+desktopImg+"/desktop.jpg";
- layout.desktop.node.setStyle("background-image", "url("+dskImg+")");
- }.bind(this));
- },
- changePassword: function(){
- var oldPassword = this.oldPasswordInputNode.get("value");
- var password = this.passwordInputNode.get("value");
- var morePassword = this.morePasswordInputNode.get("value");
- var remindNode = this.contentNode.getElement(".o2_profile_passwordWarmming");
- if (password!=morePassword){
- this.notice(this.lp.passwordNotMatch, "error");
- // this.passwordInputNode.setStyles(this.css.inforContentInputNode_error);
- // this.morePasswordInputNode.setStyles(this.css.inforContentInputNode_error);
- }else if(null||remindNode){
- this.notice(remindNode.get("text"), "error");
- }else{
- this.action.changePassword(oldPassword, password, morePassword, function(){
- this.oldPasswordInputNode.set("value", "");
- this.passwordInputNode.set("value", "");
- this.morePasswordInputNode.set("value", "");
- this.notice(this.lp.changePasswordOk, "success");
- }.bind(this), null, false);
- if (layout.config.mail){
- var url = "http://"+layout.config.mail+"//names.nsf?changepassword&password="+encodeURIComponent(oldPassword)+"&passwordnew="+encodeURIComponent(password)+"&passwordconfirm="+encodeURIComponent(password);
- var iframe = new Element("iframe", {"styles": {"display": "none"}}).inject(this.desktop.desktopNode);
- iframe.set("src", url);
- window.setTimeout(function(){
- iframe.destroy();
- }.bind(this), 2000);
- }
- }
- },
- getAction: function(callback){
- if (!this.acrion){
- this.action = MWF.Actions.get("x_organization_assemble_personal");
- if (callback) callback();
- }else{
- if (callback) callback();
- }
- },
- // createPasswordStrengthNode : function(){
- // var passwordStrengthArea = this.passwordRemindContainer;
- //
- // var lowNode = new Element( "div", {styles : this.css.passwordStrengthNode }).inject( passwordStrengthArea );
- // this.lowColorNode = new Element( "div", {styles : this.css.passwordStrengthColor }).inject( lowNode );
- // this.lowTextNode = new Element( "div", {styles : this.css.passwordStrengthText, text : this.lp.weak }).inject( lowNode );
- //
- // var middleNode = new Element( "div" , {styles : this.css.passwordStrengthNode }).inject( passwordStrengthArea );
- // this.middleColorNode = new Element( "div", {styles : this.css.passwordStrengthColor }).inject( middleNode );
- // this.middleTextNode = new Element( "div", {styles : this.css.passwordStrengthText, text : this.lp.middle }).inject( middleNode );
- //
- // var highNode = new Element("div", {styles : this.css.passwordStrengthNode }).inject( passwordStrengthArea );
- // this.highColorNode = new Element( "div", {styles : this.css.passwordStrengthColor }).inject( highNode );
- // this.highTextNode = new Element( "div", {styles : this.css.passwordStrengthText, text : this.lp.high }).inject( highNode );
- // },
- getPasswordLevel: function( password, callback ){
- /*Level(级别)
- •0-3 : [easy]
- •4-6 : [midium]
- •7-9 : [strong]
- •10-12 : [very strong]
- •>12 : [extremely strong]
- */
- this.getAction( function( ){
- this.action.checkPassword( encodeURIComponent(password), function( json ){
- if(callback)callback( json.data.value );
- }.bind(this), null, false);
- }.bind(this) );
- },
- getPasswordComplex : function(pwd){
- if( typeof pwd != "string")
- return false;
- var sum = 0;
- /*
- 5 分: 小于 8 个字符
- 10 分: 8 到 10 个字符
- 25 分: 大于 10 个字符
- */
- if(pwd.length<8){
- sum += 5;
- }else if(pwd.length<=10){
- sum += 10;
- }else{
- sum += 25;
- }
- /*
- 0 分: 没有字母
- 10 分: 全都是小(大)写字母
- 25 分: 大小写混合字母
- */
- var lowerReg = /[a-z]/;
- var uperReg = /[A-Z]/;
- if(pwd.match(lowerReg)&&pwd.match(uperReg)){
- sum += 25;
- }else if(!pwd.match(lowerReg)&&!pwd.match(uperReg)){
- sum += 0;
- }else{
- sum += 10;
- }
- /*
- 0 分: 没有数字
- 10 分: 1或2个数字
- 20 分: 大于 2 个数字
- */
- var numReg = /[0-9]/;
- var langReg = /[0-9]{3,}/;
- if(pwd.match(langReg)){
- sum += 20;
- }else if(pwd.match(numReg)){
- sum += 10;
- }else{
- sum += 0;
- }
- return sum;
- },
- checkPassowrdStrength: function(pwd){
- var i = (!this.inBrowser && layout.viewMode==="Layout")? 4 : 3;
- var passwordStrengthNode = this.tab.pages[i].contentNode.getElement(".o2_profile_passwordStrengthArea");
- var passwordRemindNode = this.tab.pages[i].contentNode.getElement(".o2_profile_passwordRemindNode");
- var nodes = passwordStrengthNode.getElements(".o2_profile_passwordStrengthColor");
- var lowColorNode = nodes[0];
- var middleColorNode = nodes[1];
- var highColorNode = nodes[2];
- nodes = passwordStrengthNode.getElements(".o2_profile_passwordStrengthText");
- var lowTextNode = nodes[0];
- var middleTextNode = nodes[1];
- var highTextNode = nodes[2];
- lowColorNode.removeClass("o2_profile_passwordStrengthColor_low");
- middleColorNode.removeClass("o2_profile_passwordStrengthColor_middle");
- highColorNode.removeClass("o2_profile_passwordStrengthColor_high");
- lowTextNode.removeClass("o2_profile_passwordStrengthText_current");
- middleTextNode.removeClass("o2_profile_passwordStrengthText_current");
- highTextNode.removeClass("o2_profile_passwordStrengthText_current");
- if (pwd==null||pwd==''){
- }else{
- this.getPasswordLevel( pwd, function( result ){
- if(result){
- passwordRemindNode.addClass("o2_profile_passwordWarmming").set("text",result);
- }else{
- var paswordRule = layout.config.passwordRegexHint || this.lp.paswordRule;
- passwordRemindNode.removeClass("o2_profile_passwordWarmming").set("text",paswordRule);
- var score = this.getPasswordComplex(pwd);
- if(score<=40){
- lowColorNode.addClass("o2_profile_passwordStrengthColor_low");
- lowTextNode.addClass("o2_profile_passwordStrengthText_current");
- }else if(score<=55){
- middleColorNode.addClass("o2_profile_passwordStrengthColor_middle");
- middleTextNode.addClass("o2_profile_passwordStrengthText_current");
- }else{
- highColorNode.addClass("o2_profile_passwordStrengthColor_high");
- highTextNode.addClass("o2_profile_passwordStrengthText_current");
- }
- }
- /*switch(level) {
- case 0:
- case 1:
- case 2:
- case 3:
- lowColorNode.addClass("o2_profile_passwordStrengthColor_low");
- lowTextNode.addClass("o2_profile_passwordStrengthText_current");
- break;
- case 4:
- case 5:
- case 6:
- middleColorNode.addClass("o2_profile_passwordStrengthColor_middle");
- middleTextNode.addClass("o2_profile_passwordStrengthText_current");
- break;
- default:
- highColorNode.addClass("o2_profile_passwordStrengthColor_high");
- highTextNode.addClass("o2_profile_passwordStrengthText_current");
- }*/
- }.bind(this) )
- }
- }
- });
- /*----2019年8月30日---外出授权---表单*/
- MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
- MWF.xApplication.Profile.emPowerPopupForm = new Class({
- Extends : MPopupForm,
- options: {
- "style": "empower",
- "width": "550",
- "height": "480",
- "hasTop": true,
- "hasIcon": false,
- "hasTopIcon" : false,
- "hasTopContent" : false,
- "draggable": true,
- "maxAction" : true,
- "closeAction": true,
- "isFull" : false,
- "startTime" : null,
- "endTime" : null,
- "isWholeday" : false,
- "defaultCalendarId" : "",
- "onPostCreateBottom": function () {
- this.formBottomNode.getElement(".formOkActionNode").addClass("mainColor_bg");
- }
- },
- load: function () {
- //重新指定css文件,由于临时用,所以尽可能写一个文件里
- this.cssPath = "../x_component_Profile/$Main/"+this.options.style+"/css.wcss";
- this._loadCss();
- this.configData = this.options.configData||{};
- this.lp = this.lp.empower;
- //this.addEvent("queryOk",this.queryOk());
- },
- _createTableContent : function() {
- this.userName = layout.desktop.session.user.distinguishedName;
- this.userId = layout.desktop.session.user.id;
- this.userIdentityList = layout.desktop.session.user.identityList;
- var identityTextList = [];
- var identityList =[];
- this.userIdentityList.each(function(it){
- identityTextList.push(it.name+"("+it.unitName+")");
- identityList.push((it.distinguishedName));
- });
- //this.formTableContainer.setStyle("width","80%");
- var startTime, endTime, defaultStartDate, defaultStartTime, defaultEndDate, defaultEndTime;
- if( this.data.startTime && this.data.endTime ){
- startTime= this.date = typeOf( this.data.startTime )=="string" ? Date.parse( this.data.startTime ) : this.data.startTime;
- endTime= typeOf( this.data.endTime )=="string" ? Date.parse( this.data.endTime ) : this.data.endTime;
- defaultStartDate = startTime.format("%Y-%m-%d");
- defaultStartTime = startTime.format("%H:%M");
- defaultEndDate = endTime.format("%Y-%m-%d");
- defaultEndTime = endTime.format("%H:%M");
- }else{
- startTime = this.date = new Date().increment("hour",1);
- endTime = startTime.clone().increment("hour",1);
- defaultStartDate = startTime.format("%Y-%m-%d");
- defaultStartTime = startTime.format("%H") + ":00";
- defaultEndDate = endTime.format("%Y-%m-%d");
- defaultEndTime = endTime.format("%H") + ":00";
- }
- var data={};
- this.formTableArea.set("html", this.getHtml());
- MWF.xDesktop.requireApp("Template", "MForm", function () {
- this.form = new MForm(this.formTableArea, data, {
- isEdited: this.isEdited || this.isNew,
- style : "profile",
- itemTemplate: {
- fromPerson: { text: this.lp.fromIdentity,type: "select", isEdited : (identityTextList.length>1),
- selectText: identityTextList,
- selectValue: identityList,
- defaultValue: this.data.fromIdentity||identityList[0],
- style:{
- "width": "310px",
- "height": "36px",
- "box-shadow": "rgb(153, 153, 153) 0px 0px 0px",
- "line-height": "36px",
- "background": "#FFFFFF",
- "border": "1px solid #DEDEDE",
- "border-radius": "4px",
- "font-family": "MicrosoftYaHei",
- "padding":"0 5px",
- "font-size": "14px",
- "color": "#666666",
- "margin": "0 0 10px 0"
- }
- },
- toPerson: { text: this.lp.toIdentity,type: "org", isEdited : this.isEdited || this.isNew, orgType: ["identity"], count : 1, orgWidgetOptions : {
- "onLoadedInfor": function(item){
- // this.loadAcceptAndReject( item );
- }.bind(this)
- },defaultValue:this.data.toPerson},
- keepTask: {
- type: "checkbox",
- selectText: [this.lp.keepTask],
- selectValue: ["true"],
- defaultValue: this.data.keepEnable ? "true" : "false"
- },
- startDateInput: {
- text: this.lp.startTime,
- tType: "date",
- defaultValue: defaultStartDate,
- notEmpty: true
- },
- startTimeInput: {
- tType: "time",
- defaultValue: defaultStartTime,
- className: ((this.isNew || this.isEdited || 1) ? "inputTimeUnformatWidth" : ""),
- disable: data.isAllDayEvent
- },
- endDateInput: {
- text: this.lp.completedTime,
- tType: "date",
- defaultValue: defaultEndDate,
- notEmpty: true
- },
- endTimeInput: {
- tType: "time",
- defaultValue: defaultEndTime,
- className: ((this.isNew || this.isEdited || 1) ? "inputTimeUnformatWidth" : ""),
- disable: data.isAllDayEvent
- },
- type: {
- text: this.lp.type, type: "radio",
- selectText: [this.lp.type_all, this.lp.type_application, this.lp.type_process],
- //selectText: ["全部", "应用", "流程"],
- selectValue: ["all", "application", "process"],
- defaultValue: this.data.type||"all",
- event :{
- "click":function(){
- var type = this.form.getItem("type").getValue();
- this.formTableArea.getElement("td[item=application]").parentNode.setStyle("display","none");
- this.formTableArea.getElement("td[item=process]").parentNode.setStyle("display","none");
- if(type=="all"){
- //this.formTableArea.getElement("td[item=application]").parentNode.setStyle("display","");
- //this.formTableArea.getElement("td[item=process]").parentNode.setStyle("display","");
- }else{
- this.formTableArea.getElement("td[item="+type+"]").parentNode.setStyle("display","");
- }
- }.bind(this)
- }
- }
- },
- onPostLoad:function(){
- /*样式重构*/
- this.formTableArea.getElements("td[item=type] div").forEach(function(item){
- 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(){
- this.getParent().getParent().getElements("label").removeClass("o2_profile_empower_radio__checked o2_profile_empower_radio_checked");
- this.addClass("o2_profile_empower_radio__checked o2_profile_empower_radio_checked");
- });
- item.adopt(labelRadio,item.getElement("span"))
- });
- }.bind(this)
- },this.app,this.css);
- this.form.load();
- }.bind(this));
- /*重构单选框样式
- * */
- this.applicationNode = this.formTableArea.getElement("td[item=application]");
- //this.applicationNode.empty();
- this.selectApplicationNode = new Element("div.selectNode", {
- width: "30",
- height: "30",
- }).inject(this.applicationNode).setStyles(this.css.selectNode).addEvents({
- "hover":function(){
- this.setStyle("background","url(../x_component_Profile/$Main/newVersion/icon_zengjia_blue2_click.png) center center no-repeat");
- },
- "blur":function(){
- this.setStyle("background","url(../x_component_Profile/$Main/newVersion/icon_zengjia_blue2.png) center center no-repeat");
- }
- });
- this.showApplicationNode = new Element("div.showNode", {
- width: "200",
- height: "30",
- // text: "选择应用"
- }).inject(this.applicationNode).setStyles(this.css.showNode);
- this.createApplicationSelect(this.showApplicationNode,this.selectApplicationNode,"Application");
- this.processNode = this.formTableArea.getElement("td[item=process]");
- this.selectProcessNode = new Element("div.selectNode", {
- width: "30",
- height: "30",
- }).inject(this.processNode).setStyles(this.css.selectNode);
- this.showProcessNode = new Element("div.showNode", {
- width: "200",
- height: "30",
- //text: "选择流程"
- }).inject(this.processNode).setStyles(this.css.showNode);
- this.createApplicationSelect(this.showProcessNode,this.selectProcessNode,"Process");
- },
- _ok: function (data, callback) {
- debugger;
- data.fromIdentity = data.fromPerson;
- data.toIdentity = data.toPerson;
- var p1 = o2.Actions.load("x_organization_assemble_express").PersonAction.listWithIdentityObject({ identityList: [data.fromIdentity]});
- var p2 = o2.Actions.load("x_organization_assemble_express").PersonAction.listWithIdentityObject({ identityList: [data.toIdentity]});
- Promise.all([p1, p2]).then(function (arr) {
- if(arr[0].data && arr[0].data.length)data.fromPerson = arr[0].data[0].distinguishedName;
- if(arr[1].data && arr[1].data.length)data.toPerson = arr[1].data[0].distinguishedName;
- this.__ok( data, callback );
- }.bind(this))
- },
- __ok: function (data, callback) {
- //data 是表单的数据, callback 是正确的回调
- //data.
- var submitData = [];
- //数据处理
- var sdata = {};
- sdata.fromIdentity = data.fromIdentity;
- sdata.fromPerson = data.fromPerson;
- sdata.toIdentity = data.toIdentity;
- sdata.toPerson = data.toPerson;
- sdata.startTime = data.startDateInput+" "+data.startTimeInput+":00";
- sdata.completedTime = data.endDateInput+" "+data.endTimeInput+":00";
- sdata.keepEnable = false; //data.keepTask === "true";
- if( Date.parse(sdata.completedTime) - Date.parse(sdata.startTime) < 0 ){
- this.app.notice(this.lp.startTimeEarlyCompleteTime,"error");
- return;
- }
- sdata.enable = true;
- if(data.type=="all"){
- sdata.type = data.type;
- submitData.push(sdata);
- }else if(data.type=="application"){
- this.configData["Application"].forEach(function(item){
- var subData = JSON.parse(JSON.stringify(sdata));
- subData["application"] = item.id;
- subData["applicationName"] = item.name;
- subData["applicationAlias"] = item.alias;
- subData.type = "application";
- submitData.push(subData);
- });
- }else if(data.type=="process"){
- this.configData["Process"].forEach(function(item){
- var subData = JSON.parse(JSON.stringify(sdata));
- subData["process"] = item.id;
- subData["processName"] = item.name;
- subData["processAlias"] = item.alias;
- subData["edition"] = !!item.edition?item.edition:(item.id);
- subData.type = "process";
- submitData.push(subData);
- });
- }
- /*this.saveConfigData=[];
- this.saveConfigCount = submitData.length;*/
- var submitCount=0;
- submitData.forEach(function(item){
- if(this.data.id&&submitCount==0){
- this.actions.editEmPower(this.data.id,item,function(json){
- submitCount++;
- }.bind(this),null,false);
- }else{
- this.actions.createEmPower(item,function(json){
- submitCount++;
- }.bind(this),null,false);
- }
- }.bind(this));
- if(!submitData.length){
- this.app.notice( this.lp.alert1 ,"error");
- }
- if(submitCount>0){
- var content = this.container.getElement(".o2_profile_emPower_tab");
- content.getElement("table").empty();
- this.app.loadMyEmPower();
- }
- if(submitData.length&&submitCount==submitData.length){
- //this.close();
- this.app.notice(this.lp.saveOk,"success");
- this.close();
- }else if(submitCount>0){
- this.app.notice(this.lp.saveNotAll,"error");
- this.close();
- }
- },
- createApplicationSelect : function(node,selectNode,type){
- if (this.configData[type]&&this.configData[type].length){
- MWF.require("MWF.widget.O2Identity", function(){
- var p = new MWF.widget.O2Process(this.configData[type][0], node);
- }.bind(this));
- }else{
- this.configData[type]=[];
- }
- selectNode.addEvent("click", function(){
- MWF.xDesktop.requireApp("Selector", "package", function(){
- var options = {
- "type": type,
- "values": this.configData[type],
- "count": 0,
- "designer": false,
- "onComplete": function (items) {
- node.empty();
- this[type] = {};
- this.configData[type] = [];
- items.forEach(function(item,indext){
- MWF.require("MWF.widget.O2Identity", function(){
- var p = new MWF.widget.O2Process(item.data, node);
- this[type] = {
- "name": item.data.name,
- "id": item.data.id,
- "edition":item.data.edition,
- "application": item.data.application,
- "applicationName": item.data.applicationName,
- "alias": item.data.alias
- };
- this.configData[type].include(this[type]);
- }.bind(this));
- }.bind(this));
- }.bind(this)
- };
- var selector = new MWF.O2Selector(this.container, options);
- }.bind(this));
- }.bind(this));
- },
- getHtml : function(){
- return "<table width='100%' bordr='0' cellpadding='0' cellspacing='0' styles='formTable' id='empowerEditTable'>" +
- //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
- "<tr style='display:"+ (this.userIdentityList.length>1?"":"none")+"'><td styles='formTableTitleRight' lable='fromPerson'></td>" +
- " <td styles='formTableValue' colspan='2'>" +
- " <div item='fromPerson'></div>" +
- " </td>" +
- "</tr>" +
- "<tr><td styles='formTableTitleRight' lable='toPerson'></td>" +
- " <td styles='formTableValue' colspan='2'>" +
- " <div item='toPerson'></div>" +
- //" <div item='selecttoPerson'></div>" +
- " </td>" +
- "</tr>" +
- "<tr><td styles='formTableTitleRight' width='100' lable='startDateInput'></td>" +
- " <td styles='formTableValue' item='startDateInput' width='205'></td>" +
- " <td styles='formTableValue' item='startTimeInput'></td>" +
- "</tr>" +
- "<tr><td styles='formTableTitleRight' lable='endDateInput'></td>" +
- " <td styles='formTableValue' item='endDateInput'></td>" +
- " <td styles='formTableValue' item='endTimeInput'></td>" +
- "</tr>" +
- "<tr><td styles='formTableTitleRight' ></td>" +
- " <td styles='formTableValue' item='type' colspan='2'></td>" +
- "</tr>" +
- "<tr style='display:"+(this.data.type=="application"?"":"none")+"'><td styles='formTableTitleRight' lable='application'>"+this.lp.application+"</td>" +
- " <td styles='formTableValue1' item='application' colspan='2'></td>" +
- "</tr>" +
- "<tr style='display:"+(this.data.type=="process"?"":"none")+"'><td styles='formTableTitleRight' lable='process'>"+this.lp.process+"</td>" +
- " <td styles='formTableValue1' item='process' colspan='2'></td>" +
- "</tr>" +
- // "<tr><td styles='formTableTitleRight' width='100'></td>" +
- // " <td styles='formTableValue' item='keepTask' colspan='2'></td>" +
- // "</tr>" +
- "</table>";
- }
- });
|