WtfGlobal={sqlToJsDate:function(C){var B=null;if(C){var G;var A=C.lastIndexOf(".");if(A==-1){G=C}else{G=C.substring(0,A)}var F=G.split(" ");var D=F[0].split("-");if(F[1]!==undefined){var E=F[1].split(":");B=new Date(D[1]+"/"+D[2]+"/"+D[0]+" "+E[0]+":"+E[1]+":"+E[2])}else{B=new Date(D[1]+"/"+D[2]+"/"+D[0])}}return B},getCookie:function(A){if(document.cookie.length>0){c_start=document.cookie.indexOf(A+"=");if(c_start!=-1){c_start=c_start+A.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return""},nameRenderer:function(B){var C=B.substr(0,1);var A=new RegExp("^[a-zA-Z]");if(A.test(C)){return C.toUpperCase()}else{return"Others"}},sizeRenderer:function(B){var A=B;if(A>=1&&A<1024){text="Small"}else{if(A>1024&&A<102400){text="Medium"}else{if(A>102400&&A<1048576){text="Large"}else{text="Gigantic"}}}return text},dateFieldRenderer:function(B){var C="";if(B){var A=new Date();if((B.getMonth()==A.getMonth())&&(B.getYear()==A.getYear())){if(A.getDate()==B.getDate()){C="Today"}else{if(B.getDate()==(A.getDate()-1)){C="Yesterday"}else{if(B.getDate()<=(A.getDate()-7)&&B.getDate()>(A.getDate()-14)){C="Last Week"}}}}else{if((B.getMonth()==(A.getMonth()-1))&&(B.getYear()==A.getYear())){C="Last Month"}else{if((B.getYear()==(A.getYear()-1))){C="Last Year"}else{C="Older"}}}}else{C="None"}return C},permissionConRenderer:function(A,C){var B=A.toLowerCase();switch(B){case"everyone":B="Everyone on deskEra";break;case"all my connections":B="All Connections";break;case"selected connections":B="Selected Connections";break;default:B="Private";break}return B},permissionProjRenderer:function(A,C){var B=A.toLowerCase();switch(B){case"all my projects":B="All My Projects";break;case"selected projects":B="Selected Projects";break;default:B="None";break}return B},HTMLStripper:function(B){var A=Wtf.util.Format.stripTags(B);return A.replace(/"/g,"").trim()},ScriptStripper:function(A){A=Wtf.util.Format.stripScripts(A);if(A){return A.replace(/"/g,"")}else{return A}},URLDecode:function(A){A=A.replace(new RegExp("\\+","g")," ");return unescape(A)},getDateFormat:function(){return Wtf.pref.DateFormat},validateEmail:function(A){return Wtf.ValidateMailPatt.test(A)},renderEmailTo:function(B,C,A){return"<div class='mailTo'><a href=mailto:"+B+">"+B+"</a></div>"},validateHTField:function(A){return Wtf.validateHeadTitle.test(A.trim())},renderContactToSkype:function(B,C,A){return"<div class='mailTo'><a href=skype:"+B+"?call>"+B+"</a></div>"},validateUserid:function(A){return Wtf.ValidateUserid.test(A)},validateUserName:function(A){return Wtf.ValidateUserName.test(A.trim())},getInstrMsg:function(A){return"<span style='font-size:10px !important;color:gray !important;'>"+A+"</span>"},chkFirstRun:function(){return WtfGlobal.getCookie("lastlogin")=="1990-01-01 00:00:00.0"},EnableDisable:function(B,A){if(B&&A){if((B&A)==A){return false}}return true},loadScript:function(B){var A=document.createElement("script");A.type="text/javascript";A.src=B;document.getElementsByTagName("head")[0].appendChild(A)},loadStyleSheet:function(B){var A=document.createElement("link");A.setAttribute("rel","stylesheet");A.setAttribute("type","text/css");A.setAttribute("href",B);document.getElementsByTagName("head")[0].appendChild(A)}};Wtf.newHTMLEditor=function(A){Wtf.apply(this,A);this.createLinkText="Please enter the URL for the link:";this.defaultLinkValue="http://";this.smileyel=null;this.SmileyArray=[" ",":)",":(",";)",":D",";;)",">:D<",":-/",":x",":>>",":P",":-*","=((",":-O","X(",":>","B-)",":-S","#:-S",">:)",":((",":))",":|","/:)","=))","O:-)",":-B","=;",":-c",":)]","~X("];this.tpl=new Wtf.Template('<div id="{curid}smiley{count}" style="float:left; height:20px; width:20px; background: #ffffff;padding-left:4px;padding-top:4px;"  ><img id="{curid}smiley{count}" src="{url}" style="height:16px; width:16px"></img></div>');this.tbutton=new Wtf.Toolbar.Button({minWidth:30,disabled:true,enableToggle:true,iconCls:"smiley"});this.eventSetFlag=false;this.tbutton.on("click",this.handleSmiley,this);this.smileyWindow=new Wtf.Window({width:185,height:116,minWidth:200,plain:true,cls:"replyWind",shadow:false,buttonAlign:"center",draggable:false,header:false,closable:true,closeAction:"hide",resizable:false});this.smileyWindow.on("deactivate",this.closeSmileyWindow,this);Wtf.newHTMLEditor.superclass.constructor.call(this,{});this.on("render",this.addSmiley,this);this.on("activate",this.enableSmiley,this);this.on("hide",this.hideSmiley,this)};Wtf.extend(Wtf.newHTMLEditor,Wtf.form.HtmlEditor,{enableSmiley:function(){this.tbutton.enable()},hideSmiley:function(){if(this.smileyWindow!==undefined&&this.smileyWindow.el!==undefined){this.smileyWindow.hide()}},addSmiley:function(A){A.getToolbar().addSeparator();A.getToolbar().addButton(this.tbutton)},createLink:function(){var A=prompt(this.createLinkText,this.defaultLinkValue);if(A&&A!="http://"){var C=A.substring(0,7);if(C!="http://"){A="http://"+A}this.win.focus();var B=this.doc.getSelection().trim();B=B==""?A:B;if(this.SmileyArray.join().indexOf(B)==-1){this.insertAtCursor("<a href = '"+A+"' target='_blank'>"+B+" </a>");this.deferFocus()}else{msgBoxShow(170,1)}}},writeSmiley:function(B){var A=B;this.insertAtCursor(this.SmileyArray[A.target.id.substring(this.id.length+6)]+" ");this.smileyWindow.hide();this.tbutton.toggle(false)},handleSmiley:function(C,D){if(this.tbutton.pressed){this.smileyWindow.setPosition(D.getPageX(),D.getPageY());this.smileyWindow.show();if(!this.eventSetFlag){for(var B=1;B<29;B++){var A={url:"images/smiley"+B+".gif",count:B,curid:this.id};this.tpl.append(this.smileyWindow.body,A);this.smileyel=Wtf.get(this.id+"smiley"+B);this.smileyel.on("click",this.writeSmiley,this);this.eventSetFlag=true}}}else{this.smileyWindow.hide();this.tbutton.toggle(false)}},closeSmileyWindow:function(A){this.smileyWindow.hide();this.tbutton.toggle(false)}});Wtf.KWLTagSearch=function(A){Wtf.KWLTagSearch.superclass.constructor.call(this,A)};Wtf.extend(Wtf.KWLTagSearch,Wtf.form.TextField,{Store:null,emptyText:"Search",StorageArray:null,limit:this.limit,initComponent:function(){Wtf.KWLTagSearch.superclass.initComponent.call(this);this.addEvents({"SearchComplete":true})},timer:new Wtf.util.DelayedTask(this.callKeyUp),setPage:function(A){this.limit=A},onRender:function(B,A){Wtf.KWLTagSearch.superclass.onRender.call(this,B,A);this.el.dom.onkeyup=this.onKeyUp.createDelegate(this)},onKeyUp:function(A){if(this.Store){if(this.getValue()!=""){this.timer.cancel();this.timer.delay(1000,this.callKeyUp,this)}else{this.Store.reload({params:{start:0,limit:this.limit,ss:""}})}this.fireEvent("SearchComplete",this.Store)}},callKeyUp:function(){this.Store.reload({params:{start:0,limit:this.limit,ss:this.getValue()}})},StorageChanged:function(A){this.Store=A;this.StorageArray=this.Store.getRange()}});Wtf.reg("KWLTagSearch",Wtf.KWLTagSearch);Wtf.PagingSearchToolbar=Wtf.extend(Wtf.PagingToolbar,{searchField:null,paramNames:{start:"start",limit:"limit",ss:"ss"},doLoad:function(C){var B={},A=this.paramNames;B[A.start]=C;B[A.limit]=this.pageSize;if(this.searchField){B[A.ss]=this.searchField.getValue()}else{B[A.ss]=""}this.store.load({params:B})}});Wtf.lib.Ajax._queue=[];Wtf.lib.Ajax._activeRequests=0;Wtf.lib.Ajax.abort=function(E,D,C){if(this.isCallInProgress(E)){E.conn.abort();window.clearInterval(this.poll[E.tId]);delete this.poll[E.tId];if(C){delete this.timeout[E.tId]}this.handleTransactionResponse(E,D,true);return true}else{for(var B=0,A=this._queue.length;B<A;B++){if(this._queue[B].o.tId==E.tId){this._queue.splice(B,1);break}}return false}};Wtf.lib.Ajax.asyncRequest=function(D,B,C,A){var E=this.getConnectionObject();if(!E){return null}else{this._queue.push({o:E,method:D,uri:B,callback:C,postData:A});this._processQueue();return E}};Wtf.lib.Ajax._processQueue=function(){var A=this._queue[0];if(A&&this._activeRequests<1){A=this._queue.shift();this._asyncRequest(A.o,A.method,A.uri,A.callback,A.postData)}};Wtf.lib.Ajax._asyncRequest=function(E,D,B,C,A){this._activeRequests++;E.conn.open(D,B,true);if(this.useDefaultXhrHeader){if(!this.defaultHeaders["X-Requested-With"]){this.initHeader("X-Requested-With",this.defaultXhrHeader,true)}}if(A&&this.useDefaultHeader){this.initHeader("Content-Type",this.defaultPostHeader)}if(this.hasDefaultHeaders||this.hasHeaders){this.setHeader(E)}this.handleReadyState(E,C);E.conn.send(A||null)};Wtf.lib.Ajax.releaseObject=function(A){A.conn=null;A=null;this._activeRequests--;this._processQueue()};Wtf.Ajax.requestEx=function(config,scope,successCallback,failureCallback){Wtf.Ajax.request({method:"POST",url:config.url,scope:scope,params:Wtf.urlEncode(config.params),success:function(request,response){var res=null;try{var restext=request.responseText.trim();if(restext&&(restext.length>0)){res=eval("("+restext+")");if(res&&res.valid){try{if(successCallback){successCallback.call(this,res.data.trim(),response)}}catch(e){clog(e)}}else{if(res&&(res.valid==false)){signOut("timeout")}}}}catch(e){clog(e);if(failureCallback){failureCallback.call(this,request,response)}}},failure:function(request,response){if(failureCallback){failureCallback.call(this,request,response)}}})};function clog(A){if(console&&console.debug&&A){console.debug(A.toString())}}if(typeof dojo=="undefined"){(function(){if((!this["console"])||(!console["firebug"])){this.console={}}if(!console["debug"]){console["debug"]=function(){}}if(typeof this["dojo"]=="undefined"){this.dojo={}}var _d=dojo;dojo.global=this;dojo._unloaders=[];dojo.unloaded=function(){var mll=this._unloaders;while(mll.length){(mll.pop())()}};dojo.addOnUnload=function(obj,functionName){if(arguments.length==1){_d._unloaders.push(obj)}else{if(arguments.length>1){_d._unloaders.push(function(){obj[functionName]()})}}};dojo._blockAsync=false;dojo._contentHandlers={"text":function(xhr){return xhr.responseText},"json":function(xhr){return Wtf.decode(xhr.responseText)},"json-comment-filtered":function(xhr){var value=xhr.responseText;var cStartIdx=value.indexOf("/*");var cEndIdx=value.lastIndexOf("*/");if(cStartIdx==-1||cEndIdx==-1){throw new Error("JSON was not comment filtered")}return Wtf.decode(value.substring(cStartIdx+2,cEndIdx))},"javascript":function(xhr){if(_d.global.eval){return _d.global.eval(xhr.responseText)}else{return eval(xhr.responseText)}},"xml":function(xhr){if(Wtf.isIE&&!xhr.responseXML){Wtf.each(["MSXML2","Microsoft","MSXML","MSXML3"],function(i){try{var doc=new ActiveXObject(prefixes[i]+".XMLDOM");doc.async=false;doc.loadXML(xhr.responseText);return doc}catch(e){}})}else{return xhr.responseXML}}};dojo._contentHandlers["json-comment-optional"]=function(xhr){var handlers=_d._contentHandlers;try{return handlers["json-comment-filtered"](xhr)}catch(e){return handlers["json"](xhr)}};dojo._ioSetArgs=function(args,canceller,okHandler,errHandler){var ioArgs={args:args,url:args.url};var miArgs=[{}];if(args.content){miArgs.push(args.content)}if(args.preventCache){miArgs.push({"dojo.preventCache":new Date().valueOf()})}ioArgs.query=Wtf.urlEncode(Wtf.apply.apply(null,miArgs));ioArgs.handleAs=args.handleAs||"text";var d=new _d.Deferred(canceller);d.addCallbacks(okHandler,function(error){return errHandler(error,d)});var ld=args.load;if(ld&&_d.isFunction(ld)){d.addCallback(function(value){return ld.call(args,value,ioArgs)})}var err=args.error;if(err&&_d.isFunction(err)){d.addErrback(function(value){return err.call(args,value,ioArgs)})}var handle=args.handle;if(handle&&_d.isFunction(handle)){d.addBoth(function(value){return handle.call(args,value,ioArgs)})}d.ioArgs=ioArgs;return d};var _deferredCancel=function(dfd){dfd.canceled=true;var xhr=dfd.ioArgs.xhr;var _at=(typeof xhr.abort);if((_at=="function")||(_at=="unknown")){xhr.abort()}var err=new Error("xhr cancelled");err.dojoType="cancel";return err};var _deferredOk=function(dfd){return _d._contentHandlers[dfd.ioArgs.handleAs](dfd.ioArgs.xhr)};var _deferError=function(error,dfd){console.debug(error);return error};var _makeXhrDeferred=function(args){var dfd=_d._ioSetArgs(args,_deferredCancel,_deferredOk,_deferError);dfd.ioArgs.xhr=_d._xhrObj(dfd.ioArgs.args);return dfd};var _inFlightIntvl=null;var _inFlight=[];var _watchInFlight=function(){var now=(new Date()).getTime();if(!_d._blockAsync){for(var i=0,tif;(i<_inFlight.length)&&(tif=_inFlight[i]);i++){var dfd=tif.dfd;try{if(!dfd||dfd.canceled||!tif.validCheck(dfd)){_inFlight.splice(i--,1)}else{if(tif.ioCheck(dfd)){_inFlight.splice(i--,1);tif.resHandle(dfd)}else{if(dfd.startTime){if(dfd.startTime+(dfd.ioArgs.args.timeout||0)<now){_inFlight.splice(i--,1);var err=new Error("timeout exceeded");err.dojoType="timeout";dfd.errback(err);dfd.cancel()}}}}}catch(e){console.debug(e);dfd.errback(new Error("_watchInFlightError!"))}}}if(!_inFlight.length){clearInterval(_inFlightIntvl);_inFlightIntvl=null;return }};dojo._ioCancelAll=function(){try{Wtf.each(_inFlight,function(i){i.dfd.cancel()})}catch(e){}};if(Wtf.isIE){_d.addOnUnload(_d._ioCancelAll)}_d._ioWatch=function(dfd,validCheck,ioCheck,resHandle){if(dfd.ioArgs.args.timeout){dfd.startTime=(new Date()).getTime()}_inFlight.push({dfd:dfd,validCheck:validCheck,ioCheck:ioCheck,resHandle:resHandle});if(!_inFlightIntvl){_inFlightIntvl=setInterval(_watchInFlight,50)}_watchInFlight()};var _defaultContentType="application/x-www-form-urlencoded";var _validCheck=function(dfd){return dfd.ioArgs.xhr.readyState};var _ioCheck=function(dfd){return 4==dfd.ioArgs.xhr.readyState};var _resHandle=function(dfd){if(_d._isDocumentOk(dfd.ioArgs.xhr)){dfd.callback(dfd)}else{dfd.errback(new Error("bad http response code:"+dfd.ioArgs.xhr.status))}};var _doIt=function(type,dfd){var ioArgs=dfd.ioArgs;var args=ioArgs.args;ioArgs.xhr.open(type,ioArgs.url,args.sync!==true,args.user||undefined,args.password||undefined);if(args.headers){for(var hdr in args.headers){if(hdr.toLowerCase()==="content-type"&&!args.contentType){args.contentType=args.headers[hdr]}else{ioArgs.xhr.setRequestHeader(hdr,args.headers[hdr])}}}ioArgs.xhr.setRequestHeader("Content-Type",(args.contentType||_defaultContentType));try{ioArgs.xhr.send(ioArgs.query)}catch(e){dfd.cancel()}_d._ioWatch(dfd,_validCheck,_ioCheck,_resHandle);return dfd};dojo._ioAddQueryToUrl=function(ioArgs){if(ioArgs.query.length){ioArgs.url+=(ioArgs.url.indexOf("?")==-1?"?":"&")+ioArgs.query;ioArgs.query=null}};dojo.xhrGet=function(args){var dfd=_makeXhrDeferred(args);_d._ioAddQueryToUrl(dfd.ioArgs);return _doIt("GET",dfd)};dojo.xhrPost=function(args){return _doIt("POST",_makeXhrDeferred(args))}})();if(typeof window!="undefined"){(function(){var A=dojo;if(Wtf.isIE){if(window.location.protocol==="file:"){Wtf.ieForceActiveXXhr=true}var B=true;Wtf.EventManager.on(window,"beforeunload",function(){window.setTimeout(function(){B=false},0)});Wtf.EventManager.on(window,"unload",function(){if(B){dojo.unloaded()}})}else{Wtf.EventManager.on(window,"beforeunload",function(){dojo.unloaded()})}A._XMLHTTP_PROGIDS=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];A._xhrObj=function(){var D=null;var G=null;if(!Wtf.isIE||!Wtf.ieForceActiveXXhr){try{D=new XMLHttpRequest()}catch(F){}}if(!D){for(var E=0;E<3;++E){var C=dojo._XMLHTTP_PROGIDS[E];try{D=new ActiveXObject(C)}catch(F){G=F}if(D){dojo._XMLHTTP_PROGIDS=[C];break}}}if(!D){throw new Error("XMLHTTP not available: "+G)}return D};A._isDocumentOk=function(C){var D=C.status||0;return((D>=200)&&(D<300))||(D==304)||(D==1223)||(!D&&(location.protocol=="file:"||location.protocol=="chrome:"))}})();dojo.doc=window["document"]||null}}dojo.isString=function(A){return(Wtf.type(A)=="string")};dojo.isArray=function(A){return(Wtf.type(A)=="array")};dojo.isFunction=function(A){return(Wtf.type(A)=="function")};dojo._hitchArgs=function(B,D){var C=dojo._toArray(arguments,2);var A=dojo.isString(D);return function(){var E=dojo._toArray(arguments);var F=A?(B||dojo.global)[D]:D;return F&&F.apply(B||this,C.concat(E))}};dojo.hitch=function(A,B){if(arguments.length>2){return dojo._hitchArgs.apply(dojo,arguments)}if(!B){B=A;A=null}if(dojo.isString(B)){A=A||dojo.global;if(!A[B]){throw (['dojo.hitch: scope["',B,'"] is null (scope="',A,'")'].join(""))}return function(){return A[B].apply(A,arguments||[])}}return !A?B:function(){return B.apply(A,arguments||[])}};dojo._toArray=function(C,D){var B=[];for(var A=D||0;A<C.length;A++){B.push(C[A])}return B};dojo._listener={getDispatcher:function(){return function(){var D=Array.prototype,F=arguments.callee,A=F._listeners,C=F.target;var E=C&&C.apply(this,arguments);for(var B in A){if(!(B in D)){A[B].apply(this,arguments)}}return E}},add:function(A,D,C){A=A||dojo.global;var B=A[D];if(!B||!B._listeners){var E=dojo._listener.getDispatcher();E.target=B;E._listeners=[];B=A[D]=E}return B._listeners.push(C)},remove:function(B,D,A){var C=(B||dojo.global)[D];if(C&&C._listeners&&A--){delete C._listeners[A]}}};dojo._topics={};dojo.subscribe=function(A,B,C){return[A,dojo._listener.add(dojo._topics,A,dojo.hitch(B,C))]};dojo.unsubscribe=function(A){if(A){dojo._listener.remove(dojo._topics,A[0],A[1])}};dojo.publish=function(B,A){var C=dojo._topics[B];if(C){C.apply(this,A||[])}};dojo.AdapterRegistry=function(A){this.pairs=[];this.returnWrappers=A||false};dojo.AdapterRegistry.prototype={register:function(C,B,E,A,D){this.pairs[((D)?"unshift":"push")]([C,B,E,A])},match:function(){for(var A=0;A<this.pairs.length;A++){var B=this.pairs[A];if(B[1].apply(this,arguments)){if((B[3])||(this.returnWrappers)){return B[2]}else{return B[2].apply(this,arguments)}}}throw new Error("No match found")},unregister:function(A){for(var B=0;B<this.pairs.length;B++){var C=this.pairs[B];if(C[0]==A){this.pairs.splice(B,1);return true}}return false}};dojo.script={get:function(B){var A=this._makeScriptDeferred(B);var C=A.ioArgs;dojo._ioAddQueryToUrl(C);this.attach(C.id,C.url);dojo._ioWatch(A,this._validCheck,this._ioCheck,this._resHandle);return A},attach:function(C,B){var A=dojo.doc.createElement("script");A.type="text/javascript";A.src=B;A.id=C;dojo.doc.getElementsByTagName("head")[0].appendChild(A)},remove:function(A){Wtf.destroy(Wtf.get(A));if(this["jsonp_"+A]){delete this["jsonp_"+A]}},_makeScriptDeferred:function(B){var A=dojo._ioSetArgs(B,this._deferredCancel,this._deferredOk,this._deferredError);var C=A.ioArgs;C.id="dojoIoScript"+(this._counter++);C.canDelete=false;if(B.callbackParamName){C.query=C.query||"";if(C.query.length>0){C.query+="&"}C.query+=B.callbackParamName+"=dojo.script.jsonp_"+C.id+"._jsonpCallback";C.canDelete=true;A._jsonpCallback=this._jsonpCallback;this["jsonp_"+C.id]=A}return A},_deferredCancel:function(A){A.canceled=true;if(A.ioArgs.canDelete){dojo.script._deadScripts.push(A.ioArgs.id)}},_deferredOk:function(A){if(A.ioArgs.canDelete){dojo.script._deadScripts.push(A.ioArgs.id)}if(A.ioArgs.json){return A.ioArgs.json}else{return A.ioArgs}},_deferredError:function(B,A){if(A.ioArgs.canDelete){if(B.dojoType=="timeout"){dojo.script.remove(A.ioArgs.id)}else{dojo.script._deadScripts.push(A.ioArgs.id)}}console.debug("dojo.script error",B);return B},_deadScripts:[],_counter:1,_validCheck:function(B){var A=dojo.script;var C=A._deadScripts;if(C&&C.length>0){for(var D=0;D<C.length;D++){A.remove(C[D])}dojo.script._deadScripts=[]}return true},_ioCheck:function(dfd){if(dfd.ioArgs.json){return true}var checkString=dfd.ioArgs.args.checkString;if(checkString&&eval("typeof("+checkString+") != 'undefined'")){return true}return false},_resHandle:function(A){if(dojo.script._ioCheck(A)){A.callback(A)}else{A.errback(new Error("inconceivable dojo.script._resHandle error"))}},_jsonpCallback:function(A){this.ioArgs.json=A}};dojo.Deferred=function(A){this.chain=[];this.id=this._nextId();this.fired=-1;this.paused=0;this.results=[null,null];this.canceller=A;this.silentlyCancelled=false};dojo.Deferred.prototype={_nextId:(function(){var A=1;return function(){return A++}})(),cancel:function(){var B;if(this.fired==-1){if(this.canceller){B=this.canceller(this)}else{this.silentlyCancelled=true}if(this.fired==-1){if(!(B instanceof Error)){var A=B;B=new Error("Deferred Cancelled");B.dojoType="cancel";B.cancelResult=A}this.errback(B)}}else{if((this.fired==0)&&(this.results[0] instanceof dojo.Deferred)){this.results[0].cancel()}}},_resback:function(A){this.fired=((A instanceof Error)?1:0);this.results[this.fired]=A;this._fire()},_check:function(){if(this.fired!=-1){if(!this.silentlyCancelled){throw new Error("already called!")}this.silentlyCancelled=false;return }},callback:function(A){this._check();this._resback(A)},errback:function(A){this._check();if(!(A instanceof Error)){A=new Error(A)}this._resback(A)},addBoth:function(A,B){var C=dojo.hitch(A,B);if(arguments.length>2){C=dojo.partial(C,arguments,2)}return this.addCallbacks(C,C)},addCallback:function(A,B){var C=dojo.hitch(A,B);if(arguments.length>2){C=dojo.partial(C,arguments,2)}return this.addCallbacks(C,null)},addErrback:function(A,B){var C=dojo.hitch(A,B);if(arguments.length>2){C=dojo.partial(C,arguments,2)}return this.addCallbacks(null,C)},addCallbacks:function(A,B){this.chain.push([A,B]);if(this.fired>=0){this._fire()}return this},_fire:function(){var D=this.chain;var G=this.fired;var C=this.results[G];var B=this;var A=null;while((D.length>0)&&(this.paused==0)){var F=D.shift()[G];if(!F){continue}try{C=F(C);G=((C instanceof Error)?1:0);if(C instanceof dojo.Deferred){A=function(H){B._resback(H);B.paused--;if((B.paused==0)&&(B.fired>=0)){B._fire()}};this.paused++}}catch(E){console.debug(E);G=1;C=E}}this.fired=G;this.results[G]=C;if((A)&&(this.paused)){C.addBoth(A)}}};dojo.cometd=new function(){this.DISCONNECTED="DISCONNECTED";this.CONNECTING="CONNECTING";this.CONNECTED="CONNECTED";this.DISCONNECTING="DISCONNECING";this._initialized=false;this._connected=false;this._polling=false;this.connectionTypes=new dojo.AdapterRegistry(true);this.version="1.0";this.minimumVersion="0.9";this.clientId=null;this.messageId=0;this.batch=0;this._isXD=false;this.handshakeReturn=null;this.currentTransport=null;this.url=null;this.lastMessage=null;this._messageQ=[];this.handleAs="json-comment-optional";this._advice={};this._maxInterval=30000;this._backoffInterval=1000;this._deferredSubscribes={};this._deferredUnsubscribes={};this._subscriptions=[];this._extendInList=[];this._extendOutList=[];this.state=function(){return this._initialized?(this._connected?this.CONNECTED:this.CONNECTING):(this._connected?this.DISCONNECTING:this.DISCONNECTED)};this.init=function(M,L,E){L=L||{};L.version=this.version;L.minimumVersion=this.minimumVersion;L.channel="/meta/handshake";L.id=""+this.messageId++;this.url=M;if(!this.url){console.debug("no cometd root passed");return null}var C="^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$";var H=(""+window.location).match(new RegExp(C));if(H[4]){var J=H[4].split(":");var D=J[0];var G=J[1]||"80";H=this.url.match(new RegExp(C));if(H[4]){J=H[4].split(":");var K=J[0];var F=J[1]||"80";this._isXD=((K!=D)||(F!=G))}}if(!this._isXD){if(L.ext){if(L.ext["json-comment-filtered"]!==true&&L.ext["json-comment-filtered"]!==false){L.ext["json-comment-filtered"]=true}}else{L.ext={"json-comment-filtered":true}}}L=this._extendOut(L);var I={url:this.url,handleAs:this.handleAs,content:{"message":Wtf.encode([L])},load:dojo.hitch(this,function(O){this._finishInit(O)}),error:dojo.hitch(this,function(O){console.debug("handshake error!:",O);this._finishInit([{}])})};if(E){Wtf.apply(I,E)}this._props=L;for(var N in this._subscriptions){for(var B in this._subscriptions[N]){if(this._subscriptions[N][B].topic){dojo.unsubscribe(this._subscriptions[N][B].topic)}}}this._messageQ=[];this._subscriptions=[];this._initialized=true;this.batch=0;this.startBatch();var A;if(this._isXD){I.callbackParamName="jsonp";A=dojo.script.get(I)}else{A=dojo.xhrPost(I)}dojo.publish("/cometd/meta",[{cometd:this,action:"handshake",successful:true,state:this.state()}]);return A};this.publish=function(C,D,A){var B={data:D,channel:C};if(A){Wtf.apply(B,A)}this._sendMessage(B)};this.subscribe=function(G,B,H){if(B){var F="/cometd"+G;var E=this._subscriptions[F];if(!E||E.length==0){E=[];this._sendMessage({channel:"/meta/subscribe",subscription:G});var A=this._deferredSubscribes;A[G]=new dojo.Deferred();if(A[G]){A[G].cancel();delete A[G]}}for(var D in E){if(E[D].objOrFunc===B&&(!E[D].funcName&&!H||E[D].funcName==H)){return null}}var C=dojo.subscribe(F,B,H);E.push({topic:C,objOrFunc:B,funcName:H});this._subscriptions[F]=E}return this._deferredSubscribes[G]};this.unsubscribe=function(F,A,G){var E="/cometd"+F;var C=this._subscriptions[E];if(!C||C.length==0){return null}var D=0;for(var B in C){var H=C[B];if((!A)||(H.objOrFunc===A&&(!H.funcName&&!G||H.funcName==G))){dojo.unsubscribe(C[B].topic);delete C[B]}else{D++}}if(D==0){delete this._subscriptions[E];this._sendMessage({channel:"/meta/unsubscribe",subscription:F});this._deferredUnsubscribes[F]=new dojo.Deferred();if(this._deferredSubscribes[F]){this._deferredSubscribes[F].cancel();delete this._deferredSubscribes[F]}}return this._deferredUnsubscribes[F]};this.disconnect=function(){for(var B in this._subscriptions){for(var A in this._subscriptions[B]){if(this._subscriptions[B][A].topic){dojo.unsubscribe(this._subscriptions[B][A].topic)}}}this._subscriptions=[];this._messageQ=[];if(this._initialized&&this.currentTransport){this._initialized=false;this.currentTransport.disconnect()}if(!this._polling){this._connected=false;dojo.publish("/cometd/meta",[{cometd:this,action:"connect",successful:false,state:this.state()}])}this._initialized=false;dojo.publish("/cometd/meta",[{cometd:this,action:"disconnect",successful:true,state:this.state()}])};this.subscribed=function(B,A){};this.unsubscribed=function(B,A){};this.tunnelInit=function(B,A){};this.tunnelCollapse=function(){};this._backoff=function(){if(!this._advice||!this._advice.interval){this._advice={reconnect:"retry",interval:0}}if(this._advice.interval<this._maxInterval){this._advice.interval+=this._backoffInterval}};this._finishInit=function(A){A=A[0];this.handshakeReturn=A;if(A["advice"]){this._advice=A.advice}var B=A.successful?A.successful:false;if(A.version<this.minimumVersion){console.debug("cometd protocol version mismatch. We wanted",this.minimumVersion,"but got",A.version);B=false;this._advice.reconnect="none"}if(B){this.currentTransport=this.connectionTypes.match(A.supportedConnectionTypes,A.version,this._isXD);this.currentTransport._cometd=this;this.currentTransport.version=A.version;this.clientId=A.clientId;this.tunnelInit=dojo.hitch(this.currentTransport,"tunnelInit");this.tunnelCollapse=dojo.hitch(this.currentTransport,"tunnelCollapse");this.currentTransport.startup(A)}dojo.publish("/cometd/meta",[{cometd:this,action:"handshook",successful:B,state:this.state()}]);if(!B){console.debug("cometd init failed");this._backoff();if(this._advice&&this._advice["reconnect"]=="none"){console.debug("cometd reconnect: none")}else{if(this._advice&&this._advice["interval"]&&this._advice.interval>0){setTimeout(dojo.hitch(this,function(){this.init(this.url,this._props)}),this._advice.interval)}else{this.init(this.url,this._props)}}}};this._extendIn=function(B){var A=B;Wtf.each(dojo.cometd._extendInList,function(C){var D=C(A);if(D){A=D}});return A};this._extendOut=function(B){var A=B;Wtf.each(dojo.cometd._extendOutList,function(C){var D=C(A);if(D){A=D}});return A};this.deliver=function(A){Wtf.each(A,this._deliver,this);return A};this._deliver=function(C){C=this._extendIn(C);if(!C["channel"]){if(C["success"]!==true){console.debug("cometd error: no channel for message!",C);return }}this.lastMessage=C;if(C.advice){this._advice=C.advice}var A=null;if((C["channel"])&&(C.channel.length>5)&&(C.channel.substr(0,5)=="/meta")){switch(C.channel){case"/meta/connect":if(C.successful&&!this._connected){this._connected=this._initialized;this.endBatch()}else{if(!this._initialized){this._connected=false}}dojo.publish("/cometd/meta",[{cometd:this,action:"connect",successful:C.successful,state:this.state()}]);break;case"/meta/subscribe":A=this._deferredSubscribes[C.subscription];if(!C.successful){if(A){A.errback(new Error(C.error))}return }dojo.cometd.subscribed(C.subscription,C);if(A){A.callback(true)}break;case"/meta/unsubscribe":A=this._deferredUnsubscribes[C.subscription];if(!C.successful){if(A){A.errback(new Error(C.error))}return }this.unsubscribed(C.subscription,C);if(A){A.callback(true)}break}}this.currentTransport.deliver(C);if(C.data){try{var B="/cometd"+C.channel;dojo.publish(B,[C])}catch(D){console.debug(D)}}};this._sendMessage=function(A){if(this.currentTransport&&this._connected&&this.batch==0){return this.currentTransport.sendMessages([A])}else{this._messageQ.push(A);return null}};this.startBatch=function(){this.batch++};this.endBatch=function(){if(--this.batch<=0&&this.currentTransport&&this._connected){this.batch=0;var A=this._messageQ;this._messageQ=[];if(A.length>0){this.currentTransport.sendMessages(A)}}};this._onUnload=function(){dojo.addOnUnload(dojo.cometd,"disconnect")}};dojo.cometd.longPollTransport=new function(){this._connectionType="long-polling";this._cometd=null;this.check=function(C,A,B){return((!B)&&(C.indexOf("long-polling")>=0))};this.tunnelInit=function(){var A={channel:"/meta/connect",clientId:this._cometd.clientId,connectionType:this._connectionType,id:""+this._cometd.messageId++};A=this._cometd._extendOut(A);this.openTunnelWith({message:Wtf.encode([A])})};this.tunnelCollapse=function(){if(!this._cometd._initialized){return }if(this._cometd._advice){if(this._cometd._advice["reconnect"]=="none"){return }if((this._cometd._advice["interval"])&&(this._cometd._advice.interval>0)){setTimeout(dojo.hitch(this,function(){this._connect()}),this._cometd._advice.interval)}else{this._connect()}}else{this._connect()}};this._connect=function(){if(!this._cometd._initialized){return }if(this._cometd._polling){console.debug("wait for poll to complete or fail");return }if((this._cometd._advice)&&(this._cometd._advice["reconnect"]=="handshake")){this._cometd._connected=false;this._initialized=false;this._cometd.init(this._cometd.url,this._cometd._props)}else{if(this._cometd._connected){var A={channel:"/meta/connect",connectionType:this._connectionType,clientId:this._cometd.clientId,id:""+this._cometd.messageId++};A=this._cometd._extendOut(A);this.openTunnelWith({message:Wtf.encode([A])})}}};this.deliver=function(A){};this.openTunnelWith=function(B,A){this._cometd._polling=true;var C=dojo.xhrPost({url:(A||this._cometd.url),content:B,handleAs:this._cometd.handleAs,load:dojo.hitch(this,function(D){this._cometd._polling=false;this._cometd.deliver(D);this.tunnelCollapse()}),error:dojo.hitch(this,function(D){this._cometd._polling=false;console.debug("tunnel opening failed:",D);dojo.publish("/cometd/meta",[{cometd:this._cometd,action:"connect",successful:false,state:this._cometd.state()}]);this._cometd._backoff();this.tunnelCollapse()})})};this.sendMessages=function(A){for(var B=0;B<A.length;B++){A[B].clientId=this._cometd.clientId;A[B].id=""+this._cometd.messageId++;A[B]=this._cometd._extendOut(A[B])}return dojo.xhrPost({url:this._cometd.url,handleAs:this._cometd.handleAs,load:dojo.hitch(this._cometd,"deliver"),content:{message:Wtf.encode(A)}})};this.startup=function(A){if(this._cometd._connected){return }this.tunnelInit()};this.disconnect=function(){var A={channel:"/meta/disconnect",clientId:this._cometd.clientId,id:""+this._cometd.messageId++};A=this._cometd._extendOut(A);dojo.xhrPost({url:this._cometd.url,handleAs:this._cometd.handleAs,content:{message:Wtf.encode([A])}})}};dojo.cometd.callbackPollTransport=new function(){this._connectionType="callback-polling";this._cometd=null;this.check=function(C,A,B){return(C.indexOf("callback-polling")>=0)};this.tunnelInit=function(){var A={channel:"/meta/connect",clientId:this._cometd.clientId,connectionType:this._connectionType,id:""+this._cometd.messageId++};A=this._cometd._extendOut(A);this.openTunnelWith({message:Wtf.encode([A])})};this.tunnelCollapse=dojo.cometd.longPollTransport.tunnelCollapse;this._connect=dojo.cometd.longPollTransport._connect;this.deliver=dojo.cometd.longPollTransport.deliver;this.openTunnelWith=function(B,A){this._cometd._polling=true;dojo.script.get({load:dojo.hitch(this,function(C){this._cometd._polling=false;this._cometd.deliver(C);this.tunnelCollapse()}),error:dojo.hitch(this,function(C){this._cometd._polling=false;console.debug("tunnel opening failed:",C);dojo.publish("/cometd/meta",[{cometd:this._cometd,action:"connect",successful:false,state:this._cometd.state()}]);this._cometd._backoff();this.tunnelCollapse()}),url:(A||this._cometd.url),content:B,callbackParamName:"jsonp"})};this.sendMessages=function(A){for(var C=0;C<A.length;C++){A[C].clientId=this._cometd.clientId;A[C].id=""+this._cometd.messageId++;A[C]=this._cometd._extendOut(A[C])}var B={url:this._cometd.url,load:dojo.hitch(this._cometd,"deliver"),callbackParamName:"jsonp",content:{message:Wtf.encode(A)}};return dojo.script.get(B)};this.startup=function(A){if(this._cometd._connected){return }this.tunnelInit()};this.disconnect=dojo.cometd.longPollTransport.disconnect;this.disconnect=function(){var A={channel:"/meta/disconnect",clientId:this._cometd.clientId,id:""+this._cometd.messageId++};A=this._cometd._extendOut(A);dojo.script.get({url:this._cometd.url,callbackParamName:"jsonp",content:{message:Wtf.encode([A])}})}};dojo.cometd.connectionTypes.register("long-polling",dojo.cometd.longPollTransport.check,dojo.cometd.longPollTransport);dojo.cometd.connectionTypes.register("callback-polling",dojo.cometd.callbackPollTransport.check,dojo.cometd.callbackPollTransport);dojo.addOnUnload(dojo.cometd,"_onUnload");Wtf.ImageStore=function(){this.images=[]};Wtf.ImageStore.prototype={getImg:function(A,C,B){if(this.images[C]){B(this.images[C])}else{Wtf.Ajax.request({scope:this,params:{id:C,callback:B},url:Wtf.req.base+"getImgPath.jsp?etype="+A+"&eId="+C,success:function(F,E){var D=F.responseText.trim();if(D!="failure"){if(D==""){E.params.callback("images/defaultuser.png")}else{this.setImg(E.params.id,F.responseText);E.params.callback(F.responseText)}}},failure:function(){}})}},setImg:function(B,A){this.images[B]=A}};Wtf.iStore=new Wtf.ImageStore();Wtf.namespace("Wtf","Wtf.cal","Wtf.proj","Wtf.common","Wtf.docs.com","Wtf.portal.profile","Wtf.ux","Wtf.crm","Wtf.reportBuilder");var calLoad=false;var docScriptLoaded=false;var bHasChanged=false;var tabRegister=[];var random_number=Math.random()*100000;var fixHeight=30;var helpmode=false;var loginid=0;var loginname="";var companyid=0;Wtf.BLANK_IMAGE_URL="lib/resources/images/default/s.gif";Wtf.DEFAULT_USER_URL="images/defaultuser.png";Wtf.ValidateMailPatt=/^([a-zA-Z0-9_\-\.+]+)@(([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})$/;Wtf.ValidateUserid=/^\w+$/;Wtf.ValidateUserName=/^[\w\s\'\"\.\-]+$/;Wtf.validateHeadTitle=/^[\w\s\'\"\.\-\,\~\!\@\$\^\*\(\)\{\}\[\])]+$/;Wtf.fixHeight=30;Wtf.Week=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function getTopHtml(D,A,B){if(B===undefined){B="images/createuser.png"}var C="<div style = 'width:100%;height:100%;position:relative;float:left;'><div style='float:left;height:100%;width:auto;position:relative;'><img src = "+B+"  class = 'adminWinImg'></img></div><div style='float:left;height:100%;width:70%;position:relative;'><div style='font-size:12px;font-style:bold;float:left;margin:15px 0px 0px 10px;width:100%;position:relative;'><b>"+D+"</b></div><div style='font-size:10px;float:left;margin:15px 0px 10px 10px;width:100%;position:relative;'>"+A+"</div></div></div>";return C}smileyStore=new Array(":)",":(",";)",":D",";;)","&gt;:D&lt;",":-/",":x",":&gt;&gt;",":P",":-*","=((",":-O","X(",":&gt;","B-)",":-S","#:-S","&gt;:)",":((",":))",":|","/:)","=))","O:-)",":-B","=;",":-c");Wtf.etype={user:0,comm:1,proj:2,home:3,docs:4,cal:5,forum:6,pmessage:7,pplan:8,adminpanel:9,todo:10,search:11};function msgBoxShow(C,B){var A=[];switch(C){case 1:A=["Error","Enter points between 1 to 999"];break;case 2:A=["Error","Enter time limit between 1 to 60 seconds"];break;case 3:A=["Error","Please fill in all choices."];break;case 4:A=["Error","Error occurred while connecting to the server."];break;case 5:A=["Error","Sorry. Selected users could not be deleted."];break;case 6:A=["Error","Please select a project to add members to."];break;case 7:A=["Success","Users added successfully."];break;case 8:A=["Error","Sorry, users could not be added."];break;case 9:A=["Success","Permissions applied successfully."];break;case 10:A=["Error","No Record Selected."];break;case 11:A=["Error","There was problem loading the members. Please try again later."];break;case 12:A=["Error","You cannot drop a Moderator from the project."];break;case 13:A=["Success","Changes applied successfully."];break;case 14:A=["Error","Could not complete your request at the moment. Please try again later."];break;case 15:A=["Success","Projects deleted successfully."];break;case 16:A=["Error","Sorry, projects could not be deleted."];break;case 17:A=["Error","There is some problem loading the company details. Please try again later."];break;case 18:A=["Success","Company details edited successfully."];break;case 19:A=["Error","Operation failed. Please fill in vaild values."];break;case 20:A=["Error","Operation Failed."];break;case 21:A=["Error","Please enter an announcement to display."];break;case 22:A=["Error","Please select a date to display the announcement from."];break;case 23:A=["Error","Please select the date to display the announcement upto."];break;case 24:A=["Success","Announcement added successfully."];break;case 25:A=["Error","Unable to add announcement."];break;case 26:A=["Error","Select holiday date."];break;case 27:A=["Error","Enter valid holiday description."];break;case 28:A=["Success","The project calendar has been updated."];break;case 29:A=["Error","Please enter a name for the template."];break;case 30:A=["Error","The template field can not be left blank."];break;case 31:A=["Success","The template has been created."];break;case 32:A=["Error","Could not create template. Please try again later."];break;case 33:A=["Success","Resource created successfully."];break;case 34:A=["Error","There was an error removing resources."];break;case 35:A=["Error","The project should have atleast one moderator."];break;case 36:A=["Error","Selected color is already in use. Please select another color."];break;case 37:A=["Error","Error at server side while creating resource"];break;case 39:A=["Error","Select the tasks to be deleted."];break;case 40:A=["Error","Select the tasks to cut."];break;case 41:A=["Error","Select the tasks to copy."];break;case 42:A=["Error","Select the task to outdent."];break;case 43:A=["Error","Select the task to indent."];break;case 44:A=["Success","Baseline created successfully."];break;case 45:A=["Error","Error occurred while creating Baseline."];break;case 46:A=["Error","No tasks selected!"];break;case 47:A=["Error","Please enter valid template name."];break;case 48:A=["Error","The template field can not be left blank."];break;case 49:A=["Success","The template has been created."];break;case 50:A=["Error","Could not create template. Please try again."];break;case 51:A=["Error","No task present to create report."];break;case 52:A=["Success","Project's start date updated successfully."];break;case 53:A=["Error","An error occurred while updating project's start date."];break;case 54:A=["Error","Please enter valid data."];break;case 55:A=["Error","An error occurred while loading tasks. Please close the plan and reopen it."];break;case 56:A=["Error","Enter file of valid type."];break;case 57:A=["Error","Blank rows make it easier to add new tasks directly."];break;case 58:A=["Error","Select a row to insert the data."];break;case 59:A=["Error","An error occurred while processing data."];break;case 60:A=["Error","No data present to paste!"];break;case 61:A=["Warning","The task name has been truncated, as upto 512 characters are allowed. You can use task notes to describe them further."];break;case 62:A=["Error","Enter a valid task ID."];break;case 63:A=["Error","You cannot make a task a predecessor of itself."];break;case 64:A=["Error","You cannot link a subtask to its parent task."];break;case 65:A=["Error","You cannot link a predecessor task twice to the same successor task."];break;case 66:A=["Error","Oops! Two tasks cannot depend on each other."];break;case 67:A=["Error","You cannot link to empty task."];break;case 68:A=["Error","The entered duration value is invalid."];break;case 69:A=["Error","Please enter values between 0-100"];break;case 70:A=["Error","The entered date is not in correct format."];break;case 71:A=["Error","The start date is not in correct format. (d/m/y)"];break;case 72:A=["Error","The end date is not in correct format. (d/m/y)"];break;case 178:A=["Error","Task start date is preceeding the Project start date"];break;case 73:A=["Error","Invalid value for percent complete."];break;case 74:A=["Error","The task can not be linked to itself."];break;case 75:A=["Error","The predecessor already exist."];break;case 76:A=["Error","Please select a predecessor."];break;case 77:A=["Error","This resource is already assigned to this task."];break;case 78:A=["Error","Select a resource to add."];break;case 79:A=["Success","Invitation Sent."];break;case 80:A=["Error","Please enter required fields"];break;case 81:A=["Error","Error occurred while sending invitation."];break;case 82:A=["Success","Preferences saved successfully."];break;case 84:A=["Error","Please select a project to add members to."];break;case 88:A=["Error","Please select one user."];break;case 89:A=["Error","Select user name."];break;case 90:A=["Error","Enter Valid Email Address."];break;case 91:A=["Error","You cannot remove members from resources.<br/>You can drop project members from the 'Members' tab."];break;case 116:A=["Error","You dont have sufficient privileges to modify this event!"];break;case 117:A=["Error","Email Address is already present."];break;case 133:A=["Error","Entered passwords do not match."];break;case 134:A=["Success","Password Reset Successfully."];break;case 135:A=["Error","Please select the users you wish to invite!"];break;case 139:A=["Error","Please select a topic first."];break;case 140:A=["Error","Please select a single message at a time only."];break;case 141:A=["Success","Message has been sent successfully."];break;case 142:A=["Error","Error occurred while sending message."];break;case 143:A=["Error","Folder with this name already exists."];break;case 144:A=["Error","Please specify a recipient."];break;case 145:A=["Error","Please select a message."];break;case 146:A=["Error","Source and destination folders are same."];break;case 147:A=["Success","Message saved to drafts successfully."];break;case 148:A=["Success","Message has been deleted successfully."];break;case 149:A=["Success","Message has been restored successfully."];break;case 150:A=["Success","Contact added successfully"];break;case 151:A=["Success","Contact edited successfully"];break;case 152:A=["Error","Contacts import failed"];break;case 153:A=["Error","A problem occurred while loading Events."];break;case 154:A=["Error","Nothing to export."];break;case 155:A=["Error","Operation Failed. Profile Not Updated."];break;case 156:A=["Error","Error retrieving personal information."];break;case 157:A=["Error","A problem occurred while loading Contacts."];break;case 158:A=["Error","Please select a single topic at a time only."];break;case 159:A=["Error","Please select a single task.<br>Selected template will precede the selection."];break;case 160:A=["Error","Please select a single task.<br>New task will precede the selection."];break;case 161:A=["Error","Announcement cannot begin after its end date."];break;case 162:A=["Error","Announcement cannot end before its start date."];break;case 163:A=["Error","Only current or future announcements can be created."];break;case 164:A=["Error","Notifications are not sent for completed to-dos and empty to-do groups."];break;case 165:A=["Success","Notifications have been sent for all to-dos except completed ones and empty to-do groups."];break;case 166:A=["Success","Notifications have been sent."];break;case 167:A=["Error","Select task to send notification"];break;case 168:A=["Error","Notifications are not sent for completed and unassigned tasks."];break;case 169:A=["Success","Notifications have been sent for all tasks except completed and unassigned tasks."];break;case 170:A=["Error","You can't create a hyperlink for a smiley"];break;case 171:A=["Error","Could not create user. The userid already exists."];break;case 172:A=["Error","Could not create user. This emailid is already registered."];break;case 173:A=["Error","You can not reply to message generated by deskera"];break;case 174:A=["Error","Error at server side while creating user"];break;case 175:A=["Success","Project Plan sync completed successfully"];break;case 176:A=["Error","Project Plan sync failed"];break;case 177:A=["Error","You do not have sufficient privileges to delete the file"];break;default:A=[C[0],C[1]];break}var D=Wtf.MessageBox.INFO;if(B==0){D=Wtf.MessageBox.INFO}if(B==1){D=Wtf.MessageBox.ERROR}else{if(B==2){D=Wtf.MessageBox.WARNING}else{if(B==3){D=Wtf.MessageBox.INFO}}}Wtf.MessageBox.show({title:A[0],msg:A[1],buttons:Wtf.MessageBox.OK,animEl:"mb9",icon:D})}function calLoadControl(A){if(!Wtf.getCmp(A+"Calendar")){var C=new Wtf.DatePicker({id:A+"calctrlcalpopup1",cls:"datepicker",autoWidth:true,border:false,defaults:{autoHeight:true,autoScroll:true},renderTo:"calendarcontainer"});var B=new Wtf.CalendarTree({id:A+"Calendar",url:"jspfiles/cal/caltree.jsp",ownerid:{type:0,userid:loginid},parentid:A,renderTo:"calendartree-container",calControl:null,parentTabId:A,datePicker:C})}}function isRoleGroup(A){var B=false;var C=WtfGlobal.getCookie("featureaccess");switch(A){case 1:B=!WtfGlobal.EnableDisable(C,Wtf.Perm.Features.Dashboard);break;case 2:B=!WtfGlobal.EnableDisable(C,Wtf.Perm.Features.Projects);break;case 3:B=!WtfGlobal.EnableDisable(C,Wtf.Perm.Features.Documents);break;case 4:B=!WtfGlobal.EnableDisable(C,Wtf.Perm.Features.Community);break;case 5:B=!WtfGlobal.EnableDisable(C,Wtf.UPerm.Features.Accounts);break;case 6:B=!WtfGlobal.EnableDisable(C,Wtf.UPerm.Features.CRM);break}return B}function toggleMainCal(C){var A=Wtf.getCmp("ascalctrlcalpopup1");var B=Wtf.getCmp("asCalendar");if(C){if(A){A.show()}if(B){B.show();B.getSelectionModel().clearSelections()}}else{if(A){A.hide()}if(B){B.hide()}}}Wtf.req={base:"jspfiles/",adm:"jspfiles/admin/",cal:"jspfiles/cal/",doc:"jspfiles/docs/",lms:"jspfiles/lms/",prt:"jspfiles/portal/",prf:"jspfiles/profile/",prj:"jspfiles/project/",crm:"scripts/crm/json/"};Wtf.common.Uid=function(B,A){this.userid=B;this.type=A};function guestResponse(eid,userid,response){Wtf.Ajax.request({url:Wtf.req.cal+"guestStatus.jsp",method:"GET",params:({eid:eid,userid:userid,response:response}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");if(nodeobj.success=="Invalid"){showMsgBox(150,1)}else{if(nodeobj.success=="deleted"){showMsgBox(151,1)}else{if(nodeobj.success=="true"){showMsgBox(152,0)}else{if(nodeobj.success=="false"){showMsgBox(93,1)}}}}},failure:function(){msgBoxShow(4,1)}})}function arrayUniq(A){var C=[],D,B=A.length;for(D=0;D<B;D++){if(C.indexOf(A[D])==-1){C.push(A[D])}}return C}function setDownloadUrl(A){setDldUrl("fdownload.jsp?url="+A+"&dtype=attachment")}function setDldUrl(A){document.getElementById("downloadframe").src=A}Wtf.Perm={};Wtf.UPerm={};Wtf.subscription={};Wtf.modules={};Wtf.featuresView={};Wtf.getSep=function(){return(Wtf.isIE?"javascript:void(0)":"#")};var calContacts_Record=Wtf.data.Record.create([{name:"userid"},{name:"username"},{name:"emailid"},{name:"fullname"},{name:"userstatus"},{name:"messagetext"},{name:"image"}]);var calContacts_Reader=new Wtf.data.JsonReader({root:"data"},calContacts_Record);var calContacts_Store=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.prt+"messenger/getFriendListDetails.jsp"}),reader:calContacts_Reader});function requestMore(A){var B=Wtf.getCmp(A);B.requestMore()}function checkAdminTab(){for(var A in Wtf.Perm){for(var B in Wtf.UPerm){if(A==B){return true}}}return false}Wtf.countryStore=new Wtf.data.JsonStore({url:"admin.jsp?mode=12&action=0",root:"data",fields:["id","name"]});Wtf.timezoneStore=new Wtf.data.JsonStore({url:"admin.jsp?mode=13&action=0",root:"data",fields:["id","name"]});function deleteHoliday(B,A){Wtf.MessageBox.confirm("Confirm","Are you sure you would like to delete the holiday?",function(C){if(C=="yes"){Wtf.getCmp(A).deleteHoliday(B.id.substring(4))}},this)}function onNotifyChange(C,B,A){Wtf.getCmp(B).onNotifyChange(A)}function cancelSubsci(B,A){Wtf.MessageBox.confirm("Confirm","Are you sure you want to cancel subscription?<br>This cancellation will be effective from next billing cycle.",function(C){if(C=="yes"){Wtf.getCmp(A).cancelSubsci(B.id.substring(4))}},this)}function subscriprojval(C){var B=document.getElementById(C.id).value;if(B.match(/^[1-9][0-9]*$/)!=B){document.getElementById(C.id).value="5";B="5"}var A=document.getElementById("subscramt");var D=B*(document.getElementById("deskerarate").value);A.value="$"+D+".00";document.getElementById("subscria3").value=D;document.getElementById("subscricustom").value=companyid+"_"+B;document.getElementById("subscritemname").value="Subscription for "+B+" Deskera project"+(parseInt(B)>1?"s":"")}function cancelHoliday(){Wtf.get("addHoliday").dom.style.display="none"}function addHoliday(A){Wtf.getCmp(A).addHoliday()}function navigateSubtab(F,B,E){var D=Wtf.getCmp("subtabpanelcomprojectTabs_"+E);var C=Wtf.getCmp("subtabproj"+E);var A="";switch(F){case"p":switch(B){case"plan":C.openprojectplan();break;case"todo":C.opentodotab();break;case"cal":C.openteamcaltab();break;case"req":C.openadmintab();break}break}}function subscribeModule(B){var E=Wtf.get(B);var D=1;var A="subscription";if(E.hasClass("SUB")){E.removeClass("SUB");D=0;A="unsubscription"}else{E.removeClass("UNS")}E.dom.firstChild.nextSibling.innerHTML="Request Pending";E.dom.lastChild.innerHTML="";var C=B.split("_")[1];Wtf.Ajax.requestEx({url:"admin.jsp",params:{status:D,action:1,module:C,mode:3,emode:1,userid:loginid}},this,function(){msgBoxShow(["Success","Successfully submitted "+A+" request for the "+C+" module."],0)},function(){msgBoxShow(["Error","Error occurred while applying for the module subscription"],1)})}function subscribeSubModule(B){var E=Wtf.get(B);var D=1;var A="subscription";if(E.hasClass("SUB")){E.removeClass("SUB");D=0;A="unsubscription"}else{E.removeClass("UNS")}E.dom.firstChild.nextSibling.innerHTML="Request Pending";E.dom.lastChild.innerHTML="";var C=B.split("_")[1];Wtf.Ajax.requestEx({url:"admin.jsp",params:{status:D,action:1,module:C,mode:3,emode:2,userid:loginid}},this,function(){msgBoxShow(["Success","Successfully submitted "+A+" request for the "+C+" module."],0)},function(){msgBoxShow(["Error","Error occurred while applying for the module subscription"],1)})}function subscribeModuleErrorMsg(){msgBoxShow(["Error","Please subscribe for the parent module before subscribing for sub-modules."],1)}function featureViewUpdate(D){var C=Wtf.get(D);var B=1;var A=D.split("_")[1];var E="featureDiv_"+A;if(C.hasClass("SUB")){C.removeClass("SUB");C.addClass("UNS");B=0}else{C.removeClass("UNS");C.addClass("SUB")}if(B==0){C.dom.innerHTML=" <div class='subscriptionDiv'> "+A+" </div>  <a href='#' onclick=\"featureViewUpdate('"+E+"')\" class='sublink'>Show</a>  <div class = 'statusDiv'>Hide</div> "}else{if(B==1){C.dom.innerHTML=" <div class='subscriptionDiv'> "+A+" </div>  <div class = 'statusDiv'>Show</div>  <a href='#' onclick=\"featureViewUpdate('"+E+"')\" class='sublink'>Hide</a> "}}Wtf.Ajax.requestEx({url:"admin.jsp",params:{view:B,action:1,featurename:A,mode:3,emode:3}},this,function(){msgBoxShow(["Success","Successfully processed "+(B==0?"hide":"show")+" request for the "+A+" module. <br/>Please refresh the system for changes to be applied successfully. "],0)},function(){msgBoxShow(["Error","Error occurred while processing request."],1)})}function printInvoice(D,B,A,C){if(A==1){setDldUrl("PrintInvoice.jsp?&invoicenum="+D+"&invoicedate="+C+"&subid="+B+"&flg="+A)}else{if(A==2){setDldUrl("PrintInvoice.jsp?&rnum="+D+"&subid="+B+"&flg="+A+"&invoicenum="+C)}}}Wtf.isIE8=function(){if(Wtf.isIE&&!Wtf.isIE6&&!Wtf.isIE7){return true}return false};Wtf.common.WtfButton=function(A){Wtf.common.WtfButton.superclass.constructor.call(this,A)};Wtf.extend(Wtf.common.WtfButton,Wtf.Component,{width:72,height:91,imgWidth:35,imgHeight:35,initialized:false,imgObj:null,zoomLevel:0.11,hoverWidth:null,hoverHeight:null,diffX:null,diffY:null,flag:0,imgX:0,imgY:0,initComponent:function(){Wtf.common.WtfButton.superclass.initComponent.call(this);this.addEvents({"clicked":true})},onRender:function(){this.elDom=Wtf.get(this.renderTo).createChild({tag:"div",cls:"wtfbutton"});this.image=Wtf.get(this.elDom.dom.appendChild(document.createElement("img")));this.label=Wtf.get(this.elDom.dom.appendChild(document.createElement("span")));this.labelShadow=Wtf.get(this.elDom.dom.appendChild(document.createElement("span")));this.image.dom.src=this.imgSrc;this.image.dom.alt=this.caption;this.imgX=Math.ceil(this.width/2-this.imgWidth/2);this.imgY=Math.ceil(this.width/2-this.imgHeight/2-15);this.image.setXY([this.image.getX()+this.imgX,this.image.getY()+this.imgY+15]);this.shadow=new Wtf.common.Shadow({offset:5});this.shadow.show(this.image);this.label.dom.innerHTML=this.caption;this.label.dom.className="label";this.labelShadow.dom.innerHTML=this.caption;this.labelShadow.dom.className="labelShadow";this.elDom.addListener("mouseover",this.onHover,this);this.elDom.addListener("mouseout",this.onOut,this);this.elDom.addListener("click",this.onClick,this);this.elDom.addListener("click",this.onClick,this);this.imgObj=this.image;this.shadow.realign(this.imgX,this.imgY+15,this.imgWidth,this.imgHeight);this.hoverWidth=Math.ceil(this.imgWidth+this.imgWidth*this.zoomLevel);this.hoverHeight=Math.ceil(this.imgHeight+this.imgWidth*this.zoomLevel);this.diffX=Math.ceil(this.hoverWidth-this.imgWidth);this.diffY=Math.ceil(this.hoverHeight-this.imgHeight);this.imgX=this.imgObj.getX();this.imgY=this.imgObj.getY();this.topMove=this.diffX/2;this.leftMove=this.diffY/2;this.elDom.dom.style.display="none"},onHover:function(C,B,A){if(!(Wtf.isIE&&C.within(this.elDom,true))){this.elDom.dom.style.background="url(images/background1.png) no-repeat 0 0";if(Wtf.isIE){this.elDom.dom.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/background1.png', sizingMethod='crop')"}this.imgObj.dom.style.width=this.hoverWidth+"px";this.imgObj.dom.style.height=this.hoverHeight+"px";this.imgObj.dom.style.left=parseInt(this.imgObj.dom.style.left.split("px")[0])-this.leftMove+"px";this.imgObj.dom.style.top=parseInt(this.imgObj.dom.style.top.split("px")[0])-this.topMove+"px"}},onOut:function(C,B,A){if(!(Wtf.isIE&&C.within(this.elDom,true))){this.elDom.dom.style.background="";if(Wtf.isIE){this.elDom.dom.style.filter=""}this.imgObj.dom.style.width=this.imgWidth+"px";this.imgObj.dom.style.height=this.imgHeight+"px";this.imgObj.dom.style.left=parseInt(this.imgObj.dom.style.left.split("px")[0])+this.leftMove+"px";this.imgObj.dom.style.top=parseInt(this.imgObj.dom.style.top.split("px")[0])+this.topMove+"px"}},onClick:function(C,B,A){C.preventDefault();mainPanel.loadTab(this.href,"   "+this.id,this.caption,"navareadashboard",this.tabtype,true)},addData:function(C,B,E,A,D){this.elDom.dom.style.display="block";this.image.dom.src=C;this.image.dom.alt=B;this.id=E;this.href=A;this.tabtype=D;this.label.dom.innerHTML=Wtf.util.Format.ellipsis(B,20);this.labelShadow.dom.innerHTML=Wtf.util.Format.ellipsis(B,20);this.caption=B},removeButton:function(){this.elDom.dom.parentNode.removeChild(this.elDom.dom)},hideButton:function(){this.elDom.dom.style.display="none"}});Wtf.reg("wtfbutton",Wtf.common.WtfButton);Wtf.KWLQuickSearch=function(A){Wtf.KWLQuickSearch.superclass.constructor.call(this,A)};Wtf.extend(Wtf.KWLQuickSearch,Wtf.form.TextField,{Store:null,emptyText:"Search",StorageArray:null,layout:"form",initComponent:function(){Wtf.KWLQuickSearch.superclass.initComponent.call(this);this.addEvents({"SearchComplete":true})},onRender:function(B,A){Wtf.KWLQuickSearch.superclass.onRender.call(this,B,A);this.el.dom.onkeyup=this.onKeyUp.createDelegate(this)},onKeyUp:function(B){if(this.getValue()!=""){this.Store.removeAll();var A=0;while(A<this.StorageArray.length){var C=new RegExp("^"+this.getValue()+".*$","i");if(C.test(this.StorageArray[A].get(this.field))){this.Store.add(this.StorageArray[A])}A++}}else{this.Store.removeAll();for(A=0;A<this.StorageArray.length;A++){this.Store.insert(A,this.StorageArray[A])}}this.fireEvent("SearchComplete",this.Store)},StorageChanged:function(A){this.Store=A;this.StorageArray=this.Store.getRange()}});Wtf.reg("KWLQuickSearch",Wtf.KWLQuickSearch);Wtf.common.KWLListPanel=function(A){Wtf.common.KWLListPanel.superclass.constructor.call(this,A);this.addEvents({"loadcomplete":true})};Wtf.extend(Wtf.common.KWLListPanel,Wtf.Panel,{tempdstore:null,dstore:null,checkFlag:0,checkForAnoReq:0,prevPageSize:0,prevPageNo:0,pageSize:0,ImgSrc:"",pageno:0,jobj:null,cursor:0,paging:true,itemsContainer:null,renderTo:null,loadtext:null,contentEl:null,headerAsText:true,autoLoad:true,total:0,collapse:null,bttnArray:null,initComponent:function(){Wtf.common.KWLListPanel.superclass.initComponent.call(this);this.addEvents({"dataloaded":true,"contextmenu":true,"afterDataRender":true})},onRender:function(config){Wtf.common.KWLListPanel.superclass.onRender.call(this,config);this.headercontent=document.createElement("div");if(this.collapsible){this.collapseButton=document.createElement("div");this.collapseButton.className="collapse";this.collapseButton.id=this.id+"Collapse";this.headercontent.appendChild(this.collapseButton)}this.header.dom.className="header x-unselectable";this.header.dom.removeChild(this.header.dom.firstChild);this.el.dom.firstChild.nextSibling.firstChild.className+=" x-panel-body-noborder-KWL";this.headercontent.className="headercontent";this.headercontent.id=this.id+"-headcont";this.label=document.createElement("span");this.label.className="label";this.label.id=this.id+"-label";this.headercontent.appendChild(this.label);this.label.id=this.id+"-labelext";if(this.paging){this.btndiv=document.createElement("div");this.btndiv.className="btndiv";this.btndiv.id=this.id+"-btndiv";this.nxtdiv=document.createElement("div");this.nxtdiv.id=this.id+"-next";this.prediv=document.createElement("div");this.prediv.id=this.id+"-prev";this.nxtdiv.className="nxtBtnDivNone";this.prediv.className="preBtnDivNone";this.startlbl=document.createElement("span");this.startlbl.id=this.id+"-start";this.endlbl=document.createElement("span");this.endlbl.id=this.id+"-end";this.totallbl=document.createElement("span");this.totallbl.id=this.id+"-total";this.startlbl.innerHTML=0+"-";this.endlbl.innerHTML=0+" / ";this.totallbl.innerHTML=0;this.pagging=document.createElement("span");this.pagging.appendChild(this.startlbl);this.pagging.appendChild(this.endlbl);this.pagging.appendChild(this.totallbl);this.pagging.className="pagging";this.pagging.id=this.id+"-pagging";this.btndiv.appendChild(this.prediv);this.btndiv.appendChild(this.nxtdiv);this.headercontent.appendChild(this.btndiv);this.headercontent.appendChild(this.pagging)}this.header.dom.appendChild(this.headercontent);this.bttnArray=[];this.calculatePageSize();if(this.collapsible){Wtf.get(this.collapseButton.id).addListener("click",this.toggleCollapse,this)}if(this.url){if(this.autoLoad){this.loadUrl()}}else{if(this.ds){this.jobj=eval("("+this.ds+")");this.FillContainer()}}this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask))},onHover:function(A){if(A=="next"){this.nxtdiv.className="nxtBtnDivover"}else{this.prediv.className="preBtnDivover"}},onOut:function(A){if(A=="next"){this.nxtdiv.className="nxtBtnDivout"}else{this.prediv.className="preBtnDivout"}},onClick:function(A){if(this.dstore){if(A=="next"){this.pageno=this.pageno+1;if((this.dstore.getCount()>=((this.pageno+1)*this.pageSize))||this.dstore.getCount()==this.total){this.fillwithstore();return }}else{this.pageno=this.pageno-1;if(this.dstore.getCount()>=((this.pageno+1)*this.pageSize)){this.fillwithstore();return }}}if(this.jobj){this.remDashBttn();this.FillContainer()}else{if(this.checkFlag==1){this.checkForAnoReq=1}else{this.checkForReq()}}},fillwithstore:function(F){if(F){this.dstore=F}var E=this.pageSize*this.pageno;if(this.prevPageSize!=this.pageSize||this.prevPageNo!=this.pageno){if(this.prevPageSize<this.pageSize){if(this.Href){this.makeDashBttn(this.bttnArray.length,this.pageSize)}else{this.makeDashAlert(this.bttnArray.length,this.pageSize)}}else{this.remDashBttn()}}var D=0;for(var C=0;C<this.pageSize;C++){if(this.dstore.getAt(E)!=undefined){if(!this.dstore.getAt(C).data["img"]||this.dstore.getAt(E).data["img"].length==0){if(this.contentType){this.bttnArray[C].addData(this.dstore.getAt(E))}else{this.bttnArray[C].addData("images/"+this.ImgSrc,this.dstore.getAt(E).data["name"],this.dstore.getAt(E).data["id"],this.Href,this.TabType)}}else{if(this.contentType){this.bttnArray[C].addData(this.tempdstore.getAt(E))}else{this.bttnArray[C].addData(this.dstore.getAt(E).data["img"],this.dstore.getAt(E).data["name"],this.dstore.getAt(E).data["id"],this.Href,this.TabType)}}this.bttnArray[C].id=this.dstore.getAt(E).data["id"];E++;D++}else{break}}for(var B=C;B<this.bttnArray.length;B++){this.bttnArray[B].hideButton()}if(this.tempdstore&&this.tempdstore.reader&&this.tempdstore.reader.jsonData){var A=this.tempdstore.reader.jsonData.count;if(A!=0){this.startlbl.innerHTML=(this.pageno*this.pageSize)==0?(1+"-"):(((this.pageno*this.pageSize)+1)+"-");this.endlbl.innerHTML=(E)+"/ "}else{this.startlbl.innerHTML="0-";this.endlbl.innerHTML="0/"}this.totallbl.innerHTML=A;if(this.pageno==0){startflag=true}else{startflag=false}if(((this.pageno*this.pageSize)+D)==A){endflag=true}else{endflag=false}this.ResetNavBtns(startflag,endflag)}},FillContainer:function(){var A=0;var B=true;var C=true;if(this.jobj!=null){while(A<this.pageSize&&this.jobj["name"][((this.pageno*this.pageSize)+A)]!=null){new Wtf.common.WtfButton({caption:this.jobj["name"][((this.pageno*this.pageSize)+A)],href:"#",bodyStyle:"position:relative;float:left;",imgSrc:"images/defaultuser.png",renderTo:this.el.dom.firstChild.nextSibling.firstChild.id});this.cursor=((this.pageno*this.pageSize)+A)+1;A=A+1}this.startlbl.innerHTML=(this.pageno*this.pageSize)==0?(1+"-"):(((this.pageno*this.pageSize)+1)+"-");this.endlbl.innerHTML=this.cursor+" / ";this.totallbl.innerHTML=this.jobj["name"].length;if(this.pageno*this.pageSize==0){B=true}else{B=false}if(this.cursor==this.jobj["name"].length){C=true}else{C=false}}else{this.startlbl.innerHTML="0-";this.endlbl.innerHTML="0 / ";this.totallbl.innerHTML="0"}this.ResetNavBtns(B,C)},Refresh:function(jstring){jstring=jstring.trim();this.remDashBttn();if(jstring=="{}"){this.jobj=null}else{this.jobj=eval("("+jstring+")")}this.pageno=0;this.FillContainer()},FillContainerUrl:function(){var C=0;this.total=this.tempdstore.reader.jsonData.count;if(!this.dstore){this.dstore=new Wtf.data.Store}else{C=this.dstore.getCount()}for(var F=0;F<this.tempdstore.getCount();F++){var B=this.dstore.find("id",this.tempdstore.getAt(F).data["id"],0,false,true);if(B==-1){this.dstore.insert(C,this.tempdstore.getAt(F));C++}}if(this.checkForAnoReq==1){this.checkForReq();this.checkForAnoReq=0}var A=0;var D=true;var E=true;if(this.total!=0){while(A<this.pageSize&&this.tempdstore.getAt(A)!=null){if(this.bttnArray[A]){if(!this.tempdstore.getAt(A).data["img"]||this.tempdstore.getAt(A).data["img"].length==0){if(this.contentType){this.bttnArray[A].addData(this.tempdstore.getAt(A))}else{this.bttnArray[A].addData("images/"+this.ImgSrc,this.tempdstore.getAt(A).data["name"],this.tempdstore.getAt(A).data["id"],this.Href,this.TabType)}}else{Wtf.iStore.setImg(this.tempdstore.getAt(A).data["id"],this.tempdstore.getAt(A).data["img"]);if(this.contentType){this.bttnArray[A].addData(this.tempdstore.getAt(A))}else{this.bttnArray[A].addData(this.tempdstore.getAt(A).data["img"],this.tempdstore.getAt(A).data["name"],this.tempdstore.getAt(A).data["id"],this.Href,this.TabType)}}this.bttnArray[A].id=this.tempdstore.getAt(A).data["id"];this.cursor=(A)+1}A=A+1}}for(var B=A;B<this.bttnArray.length;B++){this.bttnArray[B].hideButton()}var C=this.total;if(this.total!=0){this.startlbl.innerHTML=(this.pageno*this.pageSize)==0?(1+"-"):(((this.pageno*this.pageSize)+1)+"-");this.endlbl.innerHTML=((this.pageno*this.pageSize)+A)+"/ "}else{this.startlbl.innerHTML="0-";this.endlbl.innerHTML="0/"}this.totallbl.innerHTML=C;if(this.pageno==0){D=true}else{D=false}if(((this.pageno*this.pageSize)+A)==C){E=true}else{E=false}this.ResetNavBtns(D,E);this.checkFlag=0;this.loadMask.hide();this.fireEvent("loadcomplete")},setTitle:function(A){this.title=A;this.label.innerHTML=this.title},ResetTitle:function(A){if(this.label){this.label.innerHTML="  '"+A+"'"}},ResetNavBtns:function(A,B){if(A){this.prediv.className="preBtnDivNone";this.prediv.onmouseover=null;this.prediv.onmouseout=null;this.prediv.onclick=null}else{this.prediv.className="preBtnDivout";this.prediv.onmouseover=this.onHover.createDelegate(this,["prev"]);this.prediv.onmouseout=this.onOut.createDelegate(this,["prev"]);this.prediv.onclick=this.onClick.createDelegate(this,["prev"])}if(B){this.nxtdiv.className="nxtBtnDivNone";this.nxtdiv.onmouseover=null;this.nxtdiv.onmouseout=null;this.nxtdiv.onclick=null}else{this.nxtdiv.className="nxtBtnDivout";this.nxtdiv.onmouseover=this.onHover.createDelegate(this,["next"]);this.nxtdiv.onmouseout=this.onOut.createDelegate(this,["next"]);this.nxtdiv.onclick=this.onClick.createDelegate(this,["next"])}},loadUrl:function(){if(this.checkFlag==1){this.checkForAnoReq=1}else{this.makeAjaxRequest();this.checkFlag=1}},makeAjaxRequest:function(A){if(!this.reader){this.RES=Wtf.data.Record.create([{name:"name",type:"string"},{name:"id",type:"string"},{name:"img",type:"string"}]);this.reader=new Wtf.data.KwlJsonReader({root:"data"},this.RES)}this.tempdstore=new Wtf.data.Store({method:"POST",id:"tempstore",url:this.url,baseParams:({pageno:this.pageno,pageSize:this.pageSize,ss:A}),reader:this.reader});this.tempdstore.on("load",function(){this.fireEvent("dataloaded",this.tempdstore);if(this.prevPageSize!=this.pageSize||this.prevPageNo!=this.pageno){if(this.prevPageSize<this.pageSize){if(this.Href){this.makeDashBttn(this.bttnArray.length,this.bttnArray.length+this.tempdstore.getCount())}else{this.makeDashAlert(this.bttnArray.length,this.bttnArray.length+this.tempdstore.getCount())}}else{this.remDashBttn()}this.prevPageSize=this.pageSize;this.prevPageNo=this.pageno}this.FillContainerUrl();this.fireEvent("afterDataRender",this.tempdstore)},this);this.tempdstore.on("loadexception",this.loadReload,this);this.loadMask.show();this.tempdstore.load()},loadReload:function(){this.loadMask.hide()},makeDashBttn:function(C,A){for(var B=C;B<A;B++){this.bttnArray.push(new Wtf.common.WtfButton({renderTo:this.el.dom.firstChild.nextSibling.firstChild.id,tabtype:this.TabType,bodyStyle:"position:relative;float:left;",id:B}))}},makeDashAlert:function(C,A){for(var B=C;B<A;B++){this.bttnArray.push(new Wtf.ux.WtfAlert({renderTo:this.el.dom.firstChild.nextSibling.firstChild.id,bodyStyle:"position:relative;float:left;",id:B}))}},remDashBttn:function(){if(this.bttnArray.length>this.pageSize){while(this.pageSize!=this.bttnArray.length){this.bttnArray[this.bttnArray.length-1].removeButton();this.bttnArray.pop()}}},checkForReq:function(A){this.loadMask.show();this.makeAjaxRequest(A);this.checkFlag=1},calculatePageSize:function(){this.prevPageSize=this.pageSize;var D=this.pageno*this.prevPageSize+1;var A=Wtf.get(this.id);if(this.Href){var C=Math.floor(A.getWidth()/82);var B=Math.floor((A.getHeight()-25)/101);this.pageSize=C*B}else{this.pageSize=Math.floor((A.getHeight()-25)/30)}if(this.pageSize<=0){this.pageSize=1}this.pageno=Math.floor((D-1)/this.pageSize)},setUrl:function(A){this.url=A;this.calculatePageSize();if(this.prevPageSize<this.pageSize){if(this.Href){this.makeDashBttn(this.bttnArray.length,this.pageSize)}else{this.makeDashAlert(this.bttnArray.length,this.pageSize)}}else{this.remDashBttn()}this.loadMask.show();this.makeAjaxRequest()}});Wtf.reg("KWLListPanel",Wtf.common.KWLListPanel);Wtf.KWLSearchBar=function(A){Wtf.KWLSearchBar.superclass.constructor.call(this,A)};Wtf.extend(Wtf.KWLSearchBar,Wtf.Panel,{searchid:"all",SearchOn:false,txt:null,searchds:null,searchds1:null,textSearchFlag:false,Noflag:0,tabpanel:null,searchgrid:null,searchgrid1:null,peoplepanel:null,peoplepanel1:null,communitypanel:null,communitypanel1:null,projectpanel:null,projectpanel1:null,KGridAll:null,KGridOnlyDoc:null,div1:null,AllSearchPanel:null,snippet:'<div><img src="{imgico}"/><div class="snippet">{title}</div><br><br/><div class = "fileinfo", style = "top : 27px;">{type}</div><div class = "fileinfo", style= "top : 38px;">{size}Kb</div><span  class="txtSearchSnippet">{descp}</span></div>',tpl:null,mainpaneltab:null,searchcolModel:null,SearchAllDocGrid:null,ds:null,contentEl:"serchForIco",layout:"form",timer:new Wtf.util.DelayedTask(this.getSearchResult),onRender:function(A){Wtf.KWLSearchBar.superclass.onRender.call(this,A);this.add(new Wtf.form.TextField({id:"textSearch",width:200,height:21,colspan:3,emptyText:"Search",cls:"searchInput",bodyStyle:"padding-left:24px !important;"}));this.add(new Wtf.Toolbar.MenuButton({text:"",renderTo:"serchForIco",id:"searchBtn",iconCls:"pwnd searchall",ctCls:"searchleftbutton",colspan:1,menu:{items:[{text:"People    ",handler:this.onItemClick,scope:this,iconCls:"pwnd searchpeople",id:"pep"},{text:"Projects  ",handler:this.onItemClick,scope:this,iconCls:"pwnd searchproject",id:"pro"},{text:"Documents ",handler:this.onItemClick,scope:this,iconCls:"pwnd searchdoc",id:"doc"},"-",{text:"All       ",cls:"selected",handler:this.onItemClick,scope:this,iconCls:"pwnd searchall",id:"all"}]}}));this.add(new Wtf.Toolbar.Button({text:"",id:"searchBtn1",iconCls:"btnsearch",ctCls:"searchrightbutton",scope:this,handler:this.onButtonClick}));Wtf.getCmp("textSearch").on("render",function(C){Wtf.EventManager.addListener("textSearch","keyup",this.txtsearchKeyPress,this);Wtf.EventManager.addListener("textSearch","keyup",this.txtsearchTitleRefresh,this);Wtf.getCmp("textSearch").on("specialkey",this.specialKeyPressed,this);Wtf.getCmp("textSearch").on("focus",function(){this.setValue("")});Wtf.getCmp("searchBtn").on("mouseover",this.btnHover);Wtf.getCmp("searchBtn1").on("mouseover",this.btnHover);Wtf.getCmp("searchBtn1").on("mouseout",this.btnOut);Wtf.getCmp("searchBtn").on("mouseout",this.btnOut)},this);var B=new Wtf.data.JsonReader({root:"data",fields:[{name:"FileName"},{name:"Size"},{name:"Type"},{name:"DateModified",type:"date",dateFormat:"Y-m-d H:i:s.0"},{name:"RevisionNumber"},{name:"Author"},{name:"Summary"},{name:"DocumentId"}]});this.searchds=new Wtf.data.Store({reader:B});this.searchds1=new Wtf.data.Store({reader:B});this.tpl=new Wtf.Template(this.snippet);this.tpl.compile();this.searchcolModel=new Wtf.grid.ColumnModel([{header:"Name     ",sortable:true,dataIndex:"FileName",width:100,scope:this,renderer:function(E,F,D){var C=MimeBasedValue(D.data.Type,true);return String.format("<img src={0} style='height:16px;width:16px;margin:0px 4px 0 0;vertical-align:text-top;'/>{1}",C,E)}},{header:"Size     ",sortable:true,dataIndex:"Size",width:100,renderer:function(D,E,C){return D+" KB"}},{header:"Type    ",sortable:true,dataIndex:"Type",width:100,renderer:function(D,E,C){return String.format("<span>{0}</span>",MimeBasedValue(D,false))}},{header:"Modified Date     ",sortable:true,renderer:Wtf.util.Format.dateRenderer("n/j/Y g:i A"),dataIndex:"DateModified",width:100},{header:"Author	",sortable:true,dataIndex:"Author",width:100}])},onButtonClick:function(B){this.SearchOn=true;var A=Wtf.getCmp("tabsearchBtn");if(!A){Wtf.getCmp("as").add(this.mainpaneltab=new Wtf.ux.ContentPanel({id:"tabsearchBtn",layout:"fit",title:"Deskera Search",iconCls:getTabIconCls(Wtf.etype.search)}));this.mainpaneltab.on("render",this.mainpaneltabrendered,this);Wtf.getCmp("as").setActiveTab(this.mainpaneltab);this.mainpaneltab.on("destroy",function(){Wtf.getCmp("textSearch").reset()})}else{Wtf.getCmp("as").activate("tabsearchBtn");if(Wtf.getCmp("textSearch").getValue()!=""){this.txt=Wtf.getCmp("textSearch").getValue();this.switchdisplay(this.searchid);this.getSearchResult()}this.switchdisplay(this.searchid)}this.txtsearchTitleRefresh()},onItemClick:function(D){var E=Wtf.getCmp("searchBtn");var B=Wtf.getCmp("textSearch");this.searchid=D.id;var A=D.parentMenu.items.items;for(var C=0;C<A.length;C++){if(A[C].el.dom.firstChild.style!==undefined){A[C].el.dom.firstChild.style.border="0"}}switch(D.id){case"pep":E.setIconClass("pwnd searchpeople");B.emptyText="Search for People";break;case"pro":E.setIconClass("pwnd searchproject");B.emptyText="Search for Projects";break;case"com":E.setIconClass("pwnd searchcommunity");B.emptyText="Search for Communities";break;case"doc":E.setIconClass("pwnd searchdoc");B.emptyText="Search in Documents";break;case"all":E.setIconClass("pwnd searchall");B.emptyText="Search on "+companyName;break}D.el.dom.firstChild.style.border="1px outset #222";B.reset()},txtsearchKeyPress:function(B){var A=Wtf.getCmp("tabsearchBtn");if(A){if(this.SearchOn){this.txt=B.getTarget().value;this.timer.cancel();this.timer.delay(1000,this.getSearchResult,this)}Wtf.getCmp("as").activate("tabsearchBtn");if(Wtf.getCmp("SearchTabPanel")){this.switchdisplay(this.searchid)}}else{this.SearchOn=false;Wtf.getCmp("as").add(this.mainpaneltab=new Wtf.ux.ContentPanel({id:"tabsearchBtn",layout:"fit",title:"Deskera Search",iconCls:getTabIconCls(Wtf.etype.search)}));this.mainpaneltab.on("render",this.mainpaneltabrendered,this);Wtf.getCmp("as").setActiveTab(this.mainpaneltab);this.mainpaneltab.on("destroy",function(){Wtf.getCmp("textSearch").reset()})}},txtsearchTitleRefresh:function(E){if(Wtf.getCmp("SearchTabPanel")){var D="Project Results for: ";var B="People Results for: ";var A="Documents Results for: ";var C=WtfGlobal.HTMLStripper(Wtf.getCmp("textSearch").getValue());switch(this.searchid){case"all":if(this.projectpanel){this.peoplepanel.ResetTitle(B+C);this.projectpanel.ResetTitle(D+C);this.KGridAll.ResetTitle(A+C)}break;case"pep":if(this.peoplepanel1){this.peoplepanel1.ResetTitle(B+C)}break;case"com":if(this.communitypanel1){this.communitypanel1.ResetTitle(C)}break;case"pro":if(this.projectpanel1){this.projectpanel1.ResetTitle(D+C)}break;case"doc":if(this.KGridOnlyDoc){this.KGridOnlyDoc.ResetTitle(A+C)}break}}},specialKeyPressed:function(A,B){if(B.getKey()==13){this.SearchOn=true}},getSearchResult:function(){if(this.txt!=""){switch(this.searchid){case"all":this.Noflag=4;this.getData("docs",true,"grid1");this.getData("user",false,"peoplepanel");this.getData("pro",false,"projectpanel");break;case"pep":this.Noflag=1;this.getData("user",false,"peoplepanel1");break;case"com":this.Noflag=1;this.getData("com",false,"communitypanel1");break;case"pro":this.Noflag=1;this.getData("pro",false,"projectpanel1");break;case"doc":this.Noflag=1;this.getData("docs",true,"grid2");break}}else{switch(this.searchid){case"all":this.searchds.removeAll();Wtf.getCmp("peoplepanel").Refresh("{}");Wtf.getCmp("projectpanel").Refresh("{}");break;case"pep":Wtf.getCmp("peoplepanel1").Refresh("{}");break;case"com":Wtf.getCmp("communitypanel1").Refresh("{}");break;case"pro":Wtf.getCmp("projectpanel1").Refresh("{}");break;case"doc":this.searchds1.removeAll();break}}},getData:function(type,urlflag,component){if(component!="grid1"&&component!="grid2"){var comp=Wtf.getCmp(component);if(comp){var stripval=WtfGlobal.HTMLStripper(this.txt).trim();Wtf.getCmp("textSearch").setValue(stripval);comp.setUrl(Wtf.req.doc+"search/QuickSearchData.jsp?type="+type+"&keyword="+stripval)}}else{if(this.document&&this.documentView){if(this.searchid=="all"&&type=="docs"){}else{}Wtf.Ajax.request({method:"GET",url:Wtf.req.doc+"search/searchIndex.jsp",params:({type:type,keyword:WtfGlobal.HTMLStripper(this.txt)}),scope:this,success:function(result,req){if(this.searchid=="all"&&type=="docs"){this.searchds.loadData(eval("("+result.responseText+")"),"data");this.ds=this.searchds}else{this.searchds1.loadData(eval("("+result.responseText+")"),"data");this.ds=this.searchds1}},failure:function(result,req){if(this.searchid=="all"&&type=="docs"){}else{}}})}}},mainpaneltabrendered:function(A){this.mainpaneltab.add(this.tabpanel=new Wtf.TabPanel({id:"SearchTabPanel",tabWidth:"auto",enableTabScroll:true,border:false}));this.switchdisplay(this.searchid);this.SearchOn=true;this.txt=Wtf.getCmp("textSearch").getValue();this.timer.cancel();this.timer.delay(1000,this.getSearchResult,this)},switchdisplay:function(A){switch(A){case"all":if(document.getElementById("SearchTabPanel__SearchAll")==null){this.KGridAll=new Wtf.common.KWLListPanel({title:"Documents Results for ",id:"gridpaneldocsearch",paging:false,autoLoad:false,border:true,layout:"fit"});this.SearchAllDocGrid=new Wtf.grid.GridPanel({id:"DocSearchGrid",store:this.searchds,cm:this.searchcolModel,autoScroll:true,viewConfig:{forceFit:true},bodyStyle:"background-color : transparent;"});this.KGridAll.add(this.SearchAllDocGrid);this.KGridAll.doLayout();this.peoplepanel=new Wtf.common.KWLListPanel({title:"People Results for ",id:"peoplepanel",autoScroll:true,Href:"user.html",autoLoad:false,anchor:"100% 33.3%",ImgSrc:"defaultuser.png",TabType:Wtf.etype.user,layout:"fit"});this.peoplepanel.doLayout();this.projectpanel=new Wtf.common.KWLListPanel({title:"Project Results for ",id:"projectpanel",autoScroll:true,Href:"project.html",anchor:"100% 33.3%",autoLoad:false,ImgSrc:"defaultcourse.png",TabType:Wtf.etype.proj,layout:"fit"});this.projectpanel.doLayout();this.AllSearchPanel=new Wtf.Panel({layout:"border",id:"AllSearchPanel",cls:"backcolor",border:false,items:[{region:"center",id:"eastAllSearchPanel",cls:"backcolor",border:false,split:true,layout:"anchor",bodyStyle:"background-color : transparent;padding: 0 0 0 8px;",anchorSize:{width:800,height:600},items:[this.peoplepanel,this.projectpanel]}]});if(this.document&&this.documentView){this.AllSearchPanel.add(new Wtf.Panel({region:"west",id:"westAllSearchPanel",layout:"fit",split:true,height:100,bodyStyle:"background-color : transparent;padding: 0 8px 0 0;",cls:"backcolor",border:false,items:[this.KGridAll]}))}this.AllSearchPanel.doLayout();this.AllSearchPanel.on("render",function(B){this.AllSearchPanel.el.dom.firstChild.className+=" backcolor";this.AllSearchPanel.el.dom.firstChild.firstChild.className+=" backcolor"},this);this.AllSearchPanel.on("resize",function(F,E,B,G,D){var C=Wtf.getCmp("westAllSearchPanel");if(C!==undefined){Wtf.getCmp("westAllSearchPanel").setWidth(E/2)}this.AllSearchPanel.doLayout()},this);this.SearchAllDocGrid.on("mouseover",this.hidewindow,this);this.SearchAllDocGrid.on("rowclick",this.searchpop,this);this.SearchAllDocGrid.on("rowdblclick",this.rowdblclick,this);this.SearchAllDocGrid.on("rowcontextmenu",this.onDocGridRowContextMenu,this);this.SearchAllDocGrid.addListener("rowdblclick",this.rowdblclick,this)}this.DisplayTab("Deskera One Search","pwnd searchalltab","SearchAll",this.AllSearchPanel);break;case"pep":if(document.getElementById("SearchTabPanel__SearchPeople")==null){this.peoplepanel1=new Wtf.common.KWLListPanel({title:"People Results for ",id:"peoplepanel1",autoScroll:true,autoLoad:false,Href:"user.html",ImgSrc:"defaultcourse.png",TabType:Wtf.etype.user,layout:"fit"})}this.DisplayTab("Deskera People Search","pwnd userTabIcon","SearchPeople",this.peoplepanel1);break;case"com":if(document.getElementById("SearchTabPanel__SearchCommunity")==null){this.communitypanel1=new Wtf.common.KWLListPanel({title:"Community Results for ",id:"communitypanel1",autoScroll:true,autoLoad:false,Href:"community.html",ImgSrc:"defaultcourse.png",TabType:Wtf.etype.comm,layout:"fit"})}this.DisplayTab("Deskera Community Search","pwnd communityTabIcon","SearchCommunity",this.communitypanel1);break;case"pro":if(document.getElementById("SearchTabPanel__SearchProject")==null){this.projectpanel1=new Wtf.common.KWLListPanel({title:"Project Results for ",id:"projectpanel1",autoScroll:true,autoLoad:false,Href:"project.html",ImgSrc:"defaultcourse.png",TabType:Wtf.etype.proj,layout:"fit"})}this.DisplayTab("Deskera Project Search","pwnd projectTabIcon","SearchProject",this.projectpanel1);break;case"doc":if(document.getElementById("SearchTabPanel__Searchdocument")==null){this.KGridOnlyDoc=new Wtf.common.KWLListPanel({title:"Documents Results for ",id:"gridpaneldocsearch1",paging:false,autoLoad:false,layout:"fit"});this.SearchOnlyDocGrid=new Wtf.grid.GridPanel({id:"DocSearchGrid1",store:this.searchds1,cm:this.searchcolModel,autoScroll:true,viewConfig:{forceFit:true},bodyStyle:"background-color : transparent;"});this.KGridOnlyDoc.add(this.SearchOnlyDocGrid);this.KGridOnlyDoc.doLayout();this.SearchOnlyDocGrid.on("mouseover",this.hidewindow,this);this.SearchOnlyDocGrid.on("rowclick",this.searchpop,this);this.SearchOnlyDocGrid.addListener("rowdblclick",this.rowdblclick,this);this.SearchOnlyDocGrid.on("rowcontextmenu",this.onDocGridRowContextMenu,this)}this.DisplayTab("Deskera Document Search","pwnd doctabicon","Searchdocument",this.KGridOnlyDoc);break}},DisplayTab:function(D,B,E,A){if(document.getElementById("SearchTabPanel__"+E)==null){var C=this.tabpanel.add({title:D,iconCls:B,id:E,layout:"fit",cls:"appbg subtab",border:false,frame:false,items:[A]});this.tabpanel.setActiveTab(E);this.tabpanel.doLayout()}else{Wtf.getCmp("SearchTabPanel").activate(E)}},hidewindow:function(){if(document.getElementById("win1")!=null){Wtf.getCmp("win1").hide()}},searchpop:function(E,B,F){var C=this.ds.getAt(B);var I=C.get("Summary");var H=C.get("FileName");var G=C.get("Type");var K=C.get("Size");F.preventDefault();var A=F.getTarget();var J=Wtf.getCmp("containpane");if(J){J.destroy()}new Wtf.Panel({id:"containpane",frame:true,hideBorders:true,baseCls:"sddsf",header:false,headerastext:false});var D=Wtf.getCmp("win1");if(D){D.destroy()}new Wtf.Window({id:"win1",animateTarget:E,width:350,height:200,plain:true,shadow:true,header:false,closable:false,border:false,items:Wtf.getCmp("containpane")}).show();this.tpl.insertAfter("containpane",{imgico:MimeBasedValue(G,true),type:MimeBasedValue(unescape(G),false),title:unescape(H),size:K,descp:unescape(I)});Wtf.getCmp("win1").setPagePosition(F.getPageX(),F.getPageY())},onDocGridRowContextMenu:function(C,B,E){E.preventDefault();var A=new Wtf.Action({text:"Open",iconCls:"pwnd Openfile",scope:this,handler:function(){this.displayContent(C)}});var D=new Wtf.menu.Menu({items:[A]});C.getSelectionModel().selectRow(B);rownum=B;var G=E.getPageX();var F=E.getPageY();D.showAt([G,F]);return false},displayContent:function(a){var selectedRow=a.getSelectionModel().getSelected();if(!docScriptLoaded){WtfGlobal.loadScript("scripts/minified/document.js?v=19");docScriptLoaded=true}Wtf.Ajax.requestEx({url:Wtf.req.doc+"file-releated/filecontent/filedownloadchk.jsp",params:{docid:selectedRow.get("DocumentId")}},this,function(resp,option){var respText=eval("("+resp+")");if(respText.download=="no"){var fileContent=Wtf.getCmp("tabfcontent"+selectedRow.get("DocumentId")+selectedRow.get("RevisionNumber"));if(fileContent==null){fileContent=new Wtf.FilecontentTab({url:selectedRow.get("DocumentId"),id:"tabfcontent"+selectedRow.get("DocumentId")+selectedRow.get("RevisionNumber"),parentid:"as",title:selectedRow.get("FileName"),fileType:selectedRow.get("Type"),RevisionNumber:selectedRow.get("RevisionNumber")});Wtf.getCmp("as").add(fileContent);Wtf.getCmp("as").doLayout()}Wtf.getCmp("as").activate(fileContent)}else{setDownloadUrl(selectedRow.get("DocumentId"))}})},btnHover:function(){Wtf.getCmp("textSearch").addClass("searchInput-over");if(this.id=="searchBtn"){Wtf.getCmp("searchBtn1").addClass("x-btn-over")}else{Wtf.getCmp("searchBtn").addClass("x-btn-over")}},btnOut:function(){Wtf.getCmp("textSearch").removeClass("searchInput-over");if(this.id=="searchBtn"){Wtf.getCmp("searchBtn1").removeClass("x-btn-over")}else{Wtf.getCmp("searchBtn").removeClass("x-btn-over")}},setDocumentValue:function(A){this.document=A;var B=Wtf.getCmp("doc");if(A){B.show()}else{B.hide()}},setDocumentViewValue:function(A){this.documentView=A;var B=Wtf.getCmp("doc");if(A){B.show()}else{B.hide()}}});function MimeBasedValue(C,A){var B;switch(C.toLowerCase()){case"microsoft excel document":if(A){B="images/XLS.png"}else{B="Microsoft Excel Document"}break;case"application/msword":if(A){B="images/word.gif"}else{B="Microsoft Word Document"}break;case"pdf Document":if(A){B="images/PDF.gif"}else{B="PDF Document"}break;case"text/plain":if(A){B="images/TXT52.png"}else{B="Plain Text File"}break;case"text/xml":if(A){B="images/XML52.png"}else{B="XML File"}break;case"text/css":if(A){B="images/CSS52.png"}else{B="CSS File"}break;case"text/html":if(A){B="images/HTML52.png"}else{B="HTML File"}break;case"text/cs":if(A){B="images/TXT52.png"}else{B="C# Source File"}break;case"text/x-javascript":if(A){B="images/TXT52.png"}else{B="JavaScript Source"}break;default:if(A){B="images/TXT52.png"}else{B="File"}}return B}Wtf.common.pPageSize=function(A){Wtf.apply(this,A)};Wtf.extend(Wtf.common.pPageSize,Wtf.util.Observable,{beforeText:"Show",afterText:"items",addBefore:"-",addAfter:null,variations:[5,10,20,50,100],init:function(A){this.pagingToolbar=A;this.pagingToolbar.on("render",this.onRender,this)},addToStore:function(A){if(A>0){this.sizes.push([A])}},updateStore:function(){var B=this.pagingToolbar.pageSize,E;B=(B>0)?B:1;this.sizes=[];var C=this.variations;for(var D=0,A=C.length;D<A;D++){this.addToStore(B-C[C.length-1-D])}this.addToStore(B);for(var D=0,A=C.length;D<A;D++){this.addToStore(B+C[D])}this.combo.store.loadData(this.sizes);this.combo.setValue(this.pagingToolbar.pageSize)},changePageSize:function(E){var F=this.pagingToolbar;E=parseInt(E)||parseInt(this.combo.getValue());E=(E>0)?E:1;if(E<F.pageSize){F.pageSize=E;var D=Math.round(F.cursor/E)+1;var H=(D-1)*E;var B=F.store;B.suspendEvents();for(var C=0,A=H-F.cursor;C<A;C++){B.remove(B.getAt(0))}while(B.getCount()>E){B.remove(B.getAt(B.getCount()-1))}B.resumeEvents();B.fireEvent("datachanged",B);F.cursor=H;var G=F.getPageData();F.afterTextEl.el.innerHTML=String.format(F.afterPageText,G.pages);F.field.dom.value=D;F.first.setDisabled(D==1);F.prev.setDisabled(D==1);F.next.setDisabled(D==G.pages);F.last.setDisabled(D==G.pages);F.updateInfo()}else{this.pagingToolbar.pageSize=E;this.pagingToolbar.doLoad(Math.floor(this.pagingToolbar.cursor/this.pagingToolbar.pageSize)*this.pagingToolbar.pageSize)}this.updateStore();this.combo.collapse()},onRender:function(){var A=Wtf.form.ComboBox;this.combo=new A({store:new Wtf.data.SimpleStore({fields:["pageSize"],data:[]}),clearTrigger:false,displayField:"pageSize",valueField:"pageSize",editable:false,mode:"local",triggerAction:"all",width:50});this.combo.on("select",this.changePageSize,this);this.updateStore();if(this.addBefore){this.pagingToolbar.add(this.addBefore)}if(this.beforeText){this.pagingToolbar.add(this.beforeText)}this.pagingToolbar.add(this.combo);if(this.afterText){this.pagingToolbar.add(this.afterText)}if(this.addAfter){this.pagingToolbar.add(this.addAfter)}}});function navigate(I,B,A,D,H){var G={};G.id=B;switch(I){case"u":mainPanel.loadTab("user.html","tab"+B,unescape(D),"navareadashboard",Wtf.etype.user,true);break;case"p":G.event="projectplanclicked";mainPanel.loadTab("project.html","tab"+B,unescape(D),"navareadashboard",Wtf.etype.proj,true,G);break;case"x":G.event="teamcalclicked";mainPanel.loadTab("project.html","tab"+A,unescape(D),"navareadashboard",Wtf.etype.proj,true,G);break;case"q":if(Wtf.subscription.cal.subscription&&!calLoad&&Wtf.featuresView.cal){WtfGlobal.loadScript("scripts/minified/calendar.js?v=19");calLoad=true}mainPanel.loadTab("project.html","tab"+B,unescape(D),"navareadashboard",Wtf.etype.proj,true,H);break;case"a":G.event="adminpageclicked";mainPanel.loadTab("project.html","tab"+B,unescape(D),"navareadashboard",Wtf.etype.proj,true,G);break;case"t":if(Wtf.featuresView.todo){var E=Wtf.getCmp("list_conainer"+G.id+"calctrl");if(!E){E=new Wtf.Panel({title:unescape(D)+" To-Do",layout:"fit",id:"list_conainer"+G.id+"calctrl",closable:true,tabType:Wtf.etype.todo,iconCls:getTabIconCls(Wtf.etype.todo),items:[new Wtf.TodoList({title:"To-Do list",id:"todo_list"+G.id+"calctrl",layout:"fit",userid:G.id,groupType:2,animate:true,baseCls:"todoPanel",enableDD:true,containerScroll:true,border:false,rootVisible:false})]});Wtf.getCmp("as").add(E);Wtf.getCmp("as").doLayout()}Wtf.getCmp("as").setActiveTab(E)}break;case"y":var F=Wtf.getCmp(mainPanel.id+"Calendar");if(F){F.selectChanged()}else{calLoadControl(mainPanel.id)}if(G.id){var C=F.getNodeById(G.id);if(C){if(!C.ui.checkbox.checked){C.ui.checkbox.checked=true;C.attributes.checked=true;F.fireEvent("treecheckchange",F,C,true)}}else{msgBoxShow(138,1)}}break;case"mp":mainPanel.loadTab("projlist.html","tabproject","My Projects","navareaproject",Wtf.etype.proj,false);break;case"armp":mainPanel.loadTab("archiveprojlist.html","tabarchiveproject","Archived Projects","navareaproject",Wtf.etype.proj,false);break;case"mn":mainPanel.loadTab("connections.html","tabfriends","My Network","navareafriends",Wtf.etype.user,false);break;case"pm":mainPanel.loadTab("pmessage.html","navpmessage","Personal Messages","navareamessages",7,false,false,true);break;case"con":mainPanel.loadTab("contacts.html","   contactpanel","Contacts","navareadashboard",Wtf.etype.contacts,false);break;case"docs":mainPanel.loadTab("documents.html","tabdocument","My Documents","navareadocs",Wtf.etype.docs,false);break}}Wtf.TagWindow=function(A){Wtf.apply(this,A);this.tagtextbox=new Wtf.form.TextField({selectOnFocus:true,labelSeparator:"",hideLabel:true,maxLength:90,width:273});this.save=document.createElement("img");this.save.src="images/check16.png";this.save.title="Save Tags";this.save.className="addtagbutton";this.cancel=document.createElement("img");this.cancel.src="images/Stop.png";this.cancel.title="Cancel";this.cancel.className="addtagbutton";this.modal=true;Wtf.TagWindow.superclass.constructor.call(this,A)};Wtf.extend(Wtf.TagWindow,Wtf.Window,{save2tag:function(){this.fireEvent("savetags",WtfGlobal.HTMLStripper(this.tagtextbox.getValue()));this.close()},cancel2tag:function(){this.close()},setTagText:function(A){this.tagtextbox.setValue(A)},onRender:function(A){Wtf.TagWindow.superclass.onRender.call(this,A);this.add({cls:"tagwindow",closable:false,resizable:false,autoHeight:true,width:276,border:false,layout:"form",items:[this.tagtextbox,{bodyStyle:"margin:5px 0 5px 228px; border:none; float:right;",layout:"column",items:[{baseCls:"savebutton",contentEl:this.save},{baseCls:"savebutton",contentEl:this.cancel}]},{bodyStyle:"padding-bottom:5px; padding-left:5px;",border:false,items:this.view20}]});Wtf.get(this.save).addListener("click",this.save2tag,this);Wtf.get(this.cancel).addListener("click",this.cancel2tag,this)},setmytagstore:function(A){var B=Wtf.data.Record.create([{name:"tagname"}]);var C=new Wtf.data.KwlJsonReader({root:"data"},B);this.view20=new Wtf.DataView({id:"view20"+this.id,itemSelector:"span.mytagspan",style:"overflow:auto",multiSelect:true,simpleSelect:true,selectedClass:"tagselected",overClass:"taghovered",store:new Wtf.data.Store({url:Wtf.req.prf+"common/getmytags.jsp",autoLoad:true,reader:C,payload:A}),tpl:new Wtf.XTemplate('<span class="taghdr">My Tags:</span>','<tpl for=".">','<span class="mytagspan">{tagname}</span>',"</tpl>")});this.view20.store.on("load",this.showtags,this)},showtags:function(B,A){var C=[];Wtf.each(B.payload,function(E){var D=B.find("tagname",new RegExp("^"+E+"$"));if(D>-1){C.push(D)}},this);this.view20.select(C);this.view20.on("containerclick",function(){return false});this.view20.on("click",function(F,E,H,J){var D=this.tagtextbox.getValue();var I=H.innerHTML;var G=new RegExp("(^|\\s)"+I+"(\\s|$)");if(G.test(D)){D=D.replace(G," ").replace(/(\s+)/g," ")}else{D+=(" "+I)}this.tagtextbox.setValue(D.trim())},this)}});Wtf.AboutView=function(A){Wtf.apply(this,A);Wtf.AboutView.superclass.constructor.call(this,A)};Wtf.extend(Wtf.AboutView,Wtf.Panel,{initComponent:function(){Wtf.AboutView.superclass.initComponent.call(this);this.image1=document.createElement("img");this.image1.className="tabimage";this.UserTagurlpath=null;this.UserTagfields=null;this.view17=new Wtf.DataView({itemSelector:"div.thumb-wrap",style:"overflow:auto",multiSelect:true,tpl:new Wtf.XTemplate('<tpl for=".">','<div id = "tagsdiv" style="float:left; margin:1px; padding: 2px;">','<span id="ts">{about}</span></div>',"</tpl>")});this.tagbutton2=document.createElement("img");this.tagbutton2.src="images/tag_green.gif";this.tagbutton2.title="Edit Tags";this.tagbutton2.className="addtagbutton";this.view18=new Wtf.DataView({itemSelector:"a.taga",style:"overflow:auto",multiSelect:true,emptyText:'<span class="tagtitle">Tags:</span>',loadingText:"Loading",tpl:new Wtf.XTemplate('<span class="tagtitle">Tags: </span>','<tpl for=".">','<a class="taga" href="" onClick="javascript: invokeTagSearch(this);">{tagname}</a>',"</tpl>")})},onRender:function(A){Wtf.AboutView.superclass.onRender.call(this,A);Wtf.get(this.tagbutton2).addListener("click",this.showTagWindow,this);this.add({bodyStyle:"background-color:transparent; margin:0 0 0 0; padding:0 0 0 0; color:#fff; font-size: 11px;",border:false,layoutConfig:{animate:true},layout:"column",items:[{columnWidth:0.15,border:false,layout:"fit",contentEl:this.image1},{columnWidth:0.84,border:false,items:[{bodyStyle:"height: 76px; overflow: hidden;",border:false,items:this.view17},{bodyStyle:"height: 20px; overflow: hidden; margin-top: 4px;",border:false,layout:"column",items:[{width:18,border:false,contentEl:this.tagbutton2},{border:false,items:this.view18}]}]}]})},setImage:function(D){if(D.match("/store")){var A=D.lastIndexOf(".");var B=D.substr(0,A);var C=D.substr(A);D=B+"_100"+C}this.image1.src=D},showTagWindow:function(){if(!this.tagwin){this.tagwin=new Wtf.TagWindow({cls:"tagwindow",border:false,resizable:false,closable:false});this.tagwin.on("savetags",function(tagstr){Wtf.Ajax.requestEx({url:this.UserTagurlpath,params:{t:tagstr,u:1}},this,function(result,req){this.view18.store.loadData(eval("("+result+")"))})},this);this.tagwin.on("close",function(){this.tagwin=null},this);var tagarr=[];this.view18.store.each(function(el){tagarr.push(el.data.tagname)},this);this.tagwin.setmytagstore(tagarr);var xy=Wtf.get(this.tagbutton2).getXY();this.tagwin.setPagePosition(xy);this.tagwin.setTagText(tagarr.join(" "));this.tagwin.show()}else{this.tagwin.close()}},setAboutDetails:function(A,B){this.view17.setStore(this._getStore(A,"data",B))},_getStore:function(A,D,E){var F=[];for(var B=0;B<E.length;B++){F.push(E[B])}var C=Wtf.data.Record.create(F);return new Wtf.data.Store({url:A,autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data"},C)})},setTagDetails:function(B,A){this.view18.setStore(this._getStore(B,"data",A));this.UserTagurlpath=B;this.UserTagfields=A}});Wtf.ProfileView=function(A){Wtf.apply(this,A);Wtf.enumStat={AI:0,AR:1,JC:2,RR:3,RC:4,RI:5,LC:6,WFA:7,DFN:8};Wtf.ProfileView.superclass.constructor.call(this,A);this.addEvents({"discussionclicked":true,"shareddocclicked":true,"projectplanclicked":true,"projdocclicked":true,"teamcalclicked":true,"adminpageclicked":true,"loadcomplete":true,"todoclicked":true});this.loading=0};Wtf.extend(Wtf.ProfileView,Wtf.Panel,{buttonPosition:1,initComponent:function(){Wtf.ProfileView.superclass.initComponent.call(this);this.view1=new Wtf.common.KWLListPanel({id:this.id+"view1",title:"Member Network",Href:"user.html",autoLoad:false,border:false,ImgSrc:"defaultuser.png",TabType:Wtf.etype.user,layout:"fit"});this.view1.on("loadcomplete",this.checkLoading,this);this.view1.on("afterDataRender",this.dataRendered,this);this.view2=new Wtf.common.KWLListPanel({id:this.id+"view2",title:"Related Communities",Href:"community.html",autoLoad:false,border:false,ImgSrc:"defaultcourse.png",TabType:Wtf.etype.comm,layout:"fit"});this.view2.on("loadcomplete",this.checkLoading,this);this.about=new Wtf.AboutView({id:this.id+"profileName",border:false});switch(this.uid.type){case Wtf.etype.user:this.setRelation(Wtf.req.prf+"user/getUserrelation.jsp","Related");break;case Wtf.etype.comm:this.setRelation(Wtf.req.prf+"community/getMembershipStatus.jsp","Related Communities");break;case Wtf.etype.proj:this.setRelation(Wtf.req.prj+"getProjectMembership.jsp","Related");break}this.dstorerecord=Wtf.data.Record.create([{name:"id1"},{name:"connstatus"},{name:"archived"},]);this.dstore=new Wtf.data.Store({method:"POST",url:this.Url,baseParams:({userid1:loginid,userid2:this.param2}),reader:new Wtf.data.KwlJsonReader({root:"data"},this.dstorerecord)});this.dstore.on("load",this.loaddata,this)},dataRendered:function(){if(!mainPanel.loadMask.hidden){mainPanel.loadMask.hide()}},checkLoading:function(){this.loading++;this.fireEvent("loadcomplete")},setRelation:function(A,B){this.Url=A;this.param2=this.uid.userid;if(this.uid.type==Wtf.etype.proj){this.view1.title="Project Members"}else{if(this.uid.type==Wtf.etype.comm){this.view1.title=this.profiletitle+"'s Members"}else{this.view1.title=this.profiletitle+"'s Network"}}this.view2.title=B},onRender:function(B){Wtf.ProfileView.superclass.onRender.call(this,B);var A=null;this.ComponentMainPanel=this.add({layout:"fit",items:[{border:false,layout:"border",bodyStyle:" background-image:url(images/bgstrip.png); background-repeat: repeat-x;",items:[{region:"north",border:false,bodyStyle:"height: 120px; background:transparent;",layout:"fit",items:[{bodyStyle:"padding:16px 16px 0 16px;",border:false,items:this.about}]},{region:"center",id:"panels"+this.id,border:false,bodyStyle:"background: transparent; padding: 16px 8px 16px 16px;",layout:"fit",items:this.view1}]}],bbar:[this.edt_tag=new Wtf.Button({text:"Edit Tags",iconCls:"pwnd edittags",detailTip:"Tagging helps you to create virtual folders for your projects and colleagues. You can add new tags or choose from the ones you have already created.",tooltip:{title:"Edit Tags",text:'<div class="dsf">Click to edit Tags</div>',closable:true},handler:this.about.showTagWindow,scope:this.about})]});Wtf.getCmp("panels"+this.id).on("resize",function(F,E,C,G,D){F.doLayout()},this);this.dstore.load();this.ComponentMainPanel.doLayout();Wtf.QuickHelp.register([this.edt_tag],this.about)},loaddata:function(){this.setconnection(this.dstore);this.setIdentity(loginid,this.uid.userid);this.ComponentMainPanel.doLayout();this.doLayout()},setLayoutDetails:function(A,E,F,D,C,B){Wtf.iStore.getImg(this.uid.type,this.uid.userid,this.about.setImage.createDelegate(this.about));this.about.setAboutDetails(A+this.uid.userid,[C,B,"about"]);this.about.setTagDetails(E+this.uid.userid,["tagname"]);this.view1.url=F+this.uid.userid;this.view1.calculatePageSize();this.view1.checkForReq()},setIdentity:function(){var A=this.ComponentMainPanel.getBottomToolbar();switch(this.uid.type){case 0:this.setLayoutDetails(Wtf.req.prf+"user/getuserdetails.jsp?login=",Wtf.req.prf+"optags.jsp?id=",Wtf.req.prf+"common/getFriendList.jsp?login=",Wtf.req.prf+"common/getUserCommunities.jsp?login=","userid","username");A.addButton({text:"Send Message",iconCls:"pwnd pmsgicon",handler:this.message,tooltip:{title:"Send Message",text:"Click to send message"},scope:this});if(!WtfGlobal.EnableDisable(Wtf.UPerm.Project,Wtf.Perm.Project.ManageMember)){A.addButton({text:"Add To",iconCls:"pwnd addppl",handler:this.addHandler,tooltip:{title:"Add To Project",text:"Add users to project as members"},scope:this})}break;case 2:this.setLayoutDetails(Wtf.req.prj+"getprojectdetails.jsp?login=",Wtf.req.prf+"optags.jsp?id=",Wtf.req.prj+"getProjectMembers.jsp?login=",Wtf.req.prj+"getRelatedProjects.jsp?login=","projectid","projectname");if(!this.dstore.getCount()==0){if(this.dstore.getAt(0).data["connstatus"]==3||this.dstore.getAt(0).data["connstatus"]==4||this.dstore.getAt(0).data["connstatus"]==5){if(Wtf.featuresView.proj){A.addButton({text:"Project Plan",iconCls:"pwnd projplan",tooltip:{title:"Project Plan",text:"Click to open project plan"},handler:this.openprojectplan,scope:this})}if(isRoleGroup(3)){A.addButton({text:"Project Documents",iconCls:"pwnd shared",tooltip:{title:"Documents",text:"Click to open project documents"},handler:this.openprojdoctab,scope:this})}if(Wtf.featuresView.disc){A.addButton({text:"Discussion",iconCls:"pwnd communitydiscuss",tooltip:{title:"Discussion",text:"Click to open discussion"},handler:this.opendiscussiontab,scope:this})}if(Wtf.subscription.cal.subscription&&Wtf.featuresView.cal){A.addButton({text:"Team Calendar",iconCls:"pwnd teamcal",tooltip:{title:"Team Calendar",text:"Click to open team calendar"},handler:this.openteamcaltab,scope:this})}if(Wtf.featuresView.todo){A.addButton({text:"To-Do List",iconCls:"pwnd todolistpane",tooltip:{title:"To-Do List",text:"Click to open todo list"},handler:this.opentodotab,scope:this})}if(this.dstore.getAt(0).data["connstatus"]==4){A.addButton({text:"Administration",iconCls:"pwnd admintab",tooltip:{title:"Administration",text:"Click to open project administration"},handler:this.openadmintab,scope:this});A.add("-");var B=new Wtf.Toolbar.Button({handler:this.archiveProj,scope:this});if(!this.dstore.getAt(0).data["archived"]){B.text="Archive";B.setIconClass("archivedProjIcon");B.tooltip={title:"Archive Project",text:"Click to archive this project"}}else{B.text="Active";B.setIconClass("pwnd projectTabIcon");B.tooltip={title:"Active Project",text:"Click to activate this project"}}A.addButton(B)}this.ComponentMainPanel.getBottomToolbar().add("-");if(!this.dstore.getAt(0).data["archived"]){this.ComponentMainPanel.getBottomToolbar().add('<a href="'+pagebaseURL+"feed.rss?m=project&u="+loginname+"&p="+this.uid.userid+'" target=\'_blank\'><img class="rssimgMid" alt="" src="images/FeedIcon16.png" title=\'Subscribe to your project RSS feed\'/> ');this.ComponentMainPanel.getBottomToolbar().add("-")}}}break}A.add("->");A.addButton({text:"Refresh",iconCls:"pwnd refresh",tooltip:{title:"Refresh",text:"Click to refresh member list"},handler:this.refreshMemberList,scope:this})},archiveProj:function(obj){Wtf.Ajax.requestEx({method:"POST",url:Wtf.req.prj+"archive.jsp",params:{action:obj.text,mode:"1",projid:this.param2,userid:loginid}},this,function(request,response){var resobj=eval("("+request.trim()+")");if(resobj.success){var msg="Project archived successfully.";var buttonText="Active";var btTT={title:"Active Project",text:"Click to activate this project"};if(resobj.res=="0"){msg="Project activated successfully.";buttonText="Archive";btTT={title:"Archive Project",text:"Click to archive this project"}}msgBoxShow(["Success",msg],0);obj.setText(buttonText);obj.setTooltip(btTT);bHasChanged=true}else{msgBoxShow(["Failure",resobj.res],1)}},function(request,response){msgBoxShow(20)})},opensharedtab:function(B,A){this.fireEvent("shareddocclicked")},opendiscussiontab:function(B,A){this.fireEvent("discussionclicked")},opentodotab:function(B,A){this.fireEvent("todoclicked")},openprojectplan:function(B,A){this.fireEvent("projectplanclicked")},openprojdoctab:function(B,A){this.fireEvent("shareddocclicked")},openteamcaltab:function(B,A){this.fireEvent("teamcalclicked")},openadmintab:function(B,A){this.fireEvent("adminpageclicked")},refreshMemberList:function(){this.view1.calculatePageSize();this.view1.prevPageSize=0;this.view1.checkForReq()},message:function(B,A){this.wind=new Wtf.ReplyWindow({uLabel:"To",bLabel:"Subject",tdisabled:true,replytoId:this.uid.userid,id:"replywin"+Math.random(),userId:loginid,groupId:"",firstReply:"",uFieldValue:this.profiletitle,bFieldValue:"",type:"Mail",sendFlag:"newmsg"});this.sendMessagePanel=new Wtf.Panel({title:"Send Message",closable:true,layout:"fit",items:this.wind});mainPanel.add(this.sendMessagePanel).show();this.wind.doLayout();this.wind.insertStore.on("load",this.handleInsertMail1,this);this.wind.on("beforedestroy",function(){if(!this.destroymsgflag){mainPanel.remove(this.sendMessagePanel);this.sendMessagePanel.destroy()}this.destroymsgflag=false},this);this.sendMessagePanel.on("beforedestroy",function(){this.destroymsgflag=true},this)},addHandler:function(){this.Addto=new Wtf.AddtoWindow({wizard:false,userid:this.uid.userid}).show()},handleInsertMail1:function(B,C,A){if(C[0].data["Success"].match("Success")){msgBoxShow(141,0)}else{if(C[0].data["Success"].match("Fail")){msgBoxShow(142,1)}}},setConnectionButton:function(B,A,C){this.connectionBttn.setText(B);this.ttipCB.setTitle(B);this.constatus=C;if(A){this.connectionBttn.setDisabled(false)}else{this.connectionBttn.setDisabled(true)}},confirmConnectionChange:function(B,A){Wtf.MessageBox.confirm("Confirm","Are you sure?",function(C){if(C=="yes"){this.connectionchange(B,A)}},this)},connectionchange:function(D,A){var B=this.constatus;this.connectionBttn.setDisabled(true);var C=Wtf.data.Record.create([{name:"result",type:"string"}]);this.dstore1=new Wtf.data.Store({method:"GET",url:Wtf.req.prf+"user/setUserrelation.jsp",baseParams:({login:loginid,userid1:loginid,userid2:this.uid.userid,relationid:B}),reader:new Wtf.data.KwlJsonReader({root:"data"},C)});if(D.stateId==Wtf.enumStat.AR){this.dstore1.baseParams.userid1=this.uid.userid;this.dstore1.baseParams.userid2=loginid;this.rejconBttn.setDisabled(true);this.dstore1.baseParams.relationid=3;B=this.constatus=3;this.connectionBttn.stateId=8}else{if(D.stateId==Wtf.enumStat.RR||D.stateId==Wtf.enumStat.DFN){this.dstore1.baseParams.userid1=this.uid.userid;this.dstore1.baseParams.userid2=loginid;this.dstore1.baseParams.relationid=0;this.rejconBttn.setDisabled(true);B=this.constatus=0;this.connectionBttn.stateId=4}else{if(D.stateId==Wtf.enumStat.RC){this.dstore1.baseParams.userid1=loginid;this.dstore1.baseParams.userid2=this.uid.userid;this.dstore1.baseParams.relationid=1;this.rejconBttn.setDisabled(true);B=this.constatus=1;this.connectionBttn.stateId=7}}}this.dstore1.on("load",function(){switch(B){case 0:this.setConnectionButton("Request Connection",true,1);this.loadContacttab(this.uid.userid,0);this.rejconBttn.hide();break;case 1:this.setConnectionButton("Waiting for Approval",false,3);this.loadContacttab(this.uid.userid,1);this.rejconBttn.hide();break;case 3:this.setConnectionButton("Drop from Network",true,0);this.loadContacttab(this.uid.userid,3);this.rejconBttn.hide();break}},this);this.dstore1.on("loadexception",function(){});this.dstore1.load()},loadContacttab:function(B,C){var F;var G=Wtf.getCmp("tabns_panel");var A=Wtf.getCmp("contactsview");if(C==0){if(A!=null){var E=A.getNodeById("kcont_"+B);if(E){E.parentNode.removeChild(E);if(Wtf.get("chatWin"+E.id.substr(6))){Wtf.get("chatWin"+E.id.substr(6)).destroy()}}}F=5}else{if(C==3){if(A!=null){var D=G.mycontactStore.getAt(G.mycontactStore.find("userid",B));this.addInContactTree(B,D.data.username,"<img id='AcceptImg' class='cancel' src='images/Delete.gif'></img>")}F=6}else{if(C==1){if(A!=null){var D=G.newContactStore.getAt(G.newContactStore.find("id",B));this.addInContactTree(B,D.data.name+" [Invited]","<img id='AcceptImg' class='cancel' src='images/Delete.gif' style=\"margin-left:5px;vertical-align:middle\" title='Delete contact'></img>")}F=7}}}if(G!=null){G.mycontactStore.load({params:{start:0,limit:15}});G.newContactStore.load({params:{start:0,limit:G.pagingToolbar.pageSize}})}Wtf.Ajax.requestEx({method:"POST",url:Wtf.req.prt+"getFriendListDetails.jsp",params:{userid:loginid,mode:F,remoteUser:B}},this)},addInContactTree:function(D,C,A){var B=Wtf.getCmp("contactsview");B.createContactNode(D,C)},setStatusButton:function(B,A,C){this.commstatusBttn.setText(B);this.ttipCSB.setTitle(B);this.memstatus=C;if(A){this.commstatusBttn.setDisabled(false)}else{this.commstatusBttn.setDisabled(true)}},confirmStatusChange:function(B,A){Wtf.MessageBox.confirm("Confirm","Are you sure?",function(C){if(C=="yes"){this.statuschange(B,A)}},this)},statuschange:function(C,A){var B=this.memstatus;this.commstatusBttn.setDisabled(true);this.dstore2=new Wtf.data.Store({method:"GET",url:Wtf.req.prf+"community/setStatuscommunity.jsp",baseParams:({login:loginid,userid:loginid,comid:this.uid.userid,status:B}),reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"result",type:"string"}]})});if(C.stateId==Wtf.enumStat.AI||C.stateId==Wtf.enumStat.AR){this.dstore2.baseParams.userid=loginid;this.dstore2.baseParams.comid=this.uid.userid;this.rejreqBttn.setDisabled(true);this.dstore2.baseParams.status=3;B=this.memstatus=3}if(C.stateId==Wtf.enumStat.RI||C.stateId==Wtf.enumStat.RR){this.dstore2.baseParams.userid=loginid;this.dstore2.baseParams.comid=this.uid.userid;this.dstore2.baseParams.status=0;this.rejreqBttn.setDisabled(true);B=this.memstatus=0}this.dstore2.on("load",function(){switch(B){case 0:this.setStatusButton("Join Community",true,1);this.rejreqBttn.hide();break;case 1:this.setStatusButton("Waiting for Approval",false,3);this.rejreqBttn.hide();break;case 3:this.setStatusButton("Leave Community",true,0);this.rejreqBttn.hide();break}},this);this.dstore2.on("loadexception",function(){},this);this.dstore2.load()},setProjStatButton:function(B,A,C){this.joinprojBttn.setText(B);this.ttipCSB.setTitle(B);this.projStat=C;this.joinprojBttn.setDisabled(!A)},confirmProjectStatusChange:function(B,A){var C=(this.projStat==0)?"you want to leave this project?":(this.projStat==1)?"you want to join this project?":"?";Wtf.MessageBox.confirm("Confirm","Are you sure "+C,function(D){if(D=="yes"){if(B.text=="Accept Invitation"){B.stateId=6}this.projchange1(B,A)}},this)},projchange1:function(item){var comm=this.projStat;this.joinprojBttn.setDisabled(true);var record=Wtf.data.Record.create([{name:"result",type:"string"}]);this.dstore2=new Wtf.data.Store({method:"GET",url:Wtf.req.prf+"project/setStatusproject.jsp",baseParams:({userid:loginid,comid:this.uid.userid,flagLeave:1,status:comm}),reader:new Wtf.data.KwlJsonReader({root:"data"},record)});if(item.stateId==Wtf.enumStat.AI||item.stateId==Wtf.enumStat.AR){this.dstore2.baseParams.userid=loginid;this.dstore2.baseParams.comid=this.uid.userid;this.rejprojBttn.setDisabled(true);this.dstore2.baseParams.status=3;comm=this.projStat=3}if(item.stateId==Wtf.enumStat.RI||item.stateId==Wtf.enumStat.RR){this.dstore2.baseParams.userid=loginid;this.dstore2.baseParams.comid=this.uid.userid;this.dstore2.baseParams.status=0;this.rejprojBttn.setDisabled(true);comm=this.projStat=0}this.dstore2.on("load",function(){switch(comm){case 0:this.setProjStatButton("Join Project",true,1);this.joinprojBttn.stateId=2;this.rejprojBttn.hide();break;case 1:this.setProjStatButton("Waiting for Approval",false,3);this.rejprojBttn.hide();break;case 3:this.setProjStatButton("Leave Project",true,0);this.rejprojBttn.hide();break}},this);this.dstore2.on("loadexception",function(obj,a,b){var obj=eval("("+b.responseText.trim()+")");obj=eval("("+obj.data.trim()+")");msgBoxShow(["Error",obj.error],1)},this);this.dstore2.load()},setconnection:function(A){switch(this.uid.type){case 0:this.connectionBttn=new Wtf.Toolbar.Button({id:this.id+"connection",stateId:Wtf.enumStat.RC,text:"Request Connection",iconCls:"pwnd addppl",handler:this.confirmConnectionChange,region:"south",scope:this});this.rejconBttn=new Wtf.Toolbar.Button({id:this.id+"rejcon",stateId:Wtf.enumStat.RR,text:"Reject Request",iconCls:"pwnd addppl",handler:this.confirmConnectionChange,region:"south",scope:this});this.ComponentMainPanel.getBottomToolbar().insertButton(0,this.connectionBttn);this.ComponentMainPanel.getBottomToolbar().insertButton(1,this.rejconBttn);this.ttipCB=new Wtf.ToolTip({id:this.id+"tooltipCB",title:"Request Connection",text:"Click to request connection",target:this.connectionBttn.id});this.ttipRB=new Wtf.ToolTip({id:this.id+"tooltipRB",title:"Click to reject request",target:this.rejconBttn.id});if(!A.getCount()==0){switch(A.getAt(0).data["connstatus"]){case"-1":this.rejconBttn.hide();this.connectionBttn.hide();break;case 0:this.constatus=1;this.rejconBttn.hide();this.connectionBttn.stateId=Wtf.enumStat.RC;this.connectionBttn.setText("Request Connection");this.ttipCB.setTitle("Click to request connection");break;case 1:if(A.getAt(0).data["id1"]==loginid){this.constatus=3;this.rejconBttn.hide();this.connectionBttn.stateId=Wtf.enumStat.WFA;this.connectionBttn.setText("Waiting for Approval");this.ttipCB.setTitle("Waiting for Approval");this.connectionBttn.disable()}else{this.constatus=3;this.connectionBttn.stateId=Wtf.enumStat.AR;this.connectionBttn.setText("Approve Request");this.ttipCB.setTitle("Click to Approve Request");this.rejconBttn.stateId=Wtf.enumStat.RR;this.rejconBttn.setText("Reject Request");this.ttipRB.setTitle("Click to Reject Request")}break;case 3:this.constatus=0;this.rejconBttn.hide();this.connectionBttn.stateId=Wtf.enumStat.DFN;this.connectionBttn.setText("Drop from Network");this.ttipCB.setTitle("Click to Drop from Network");break}}else{this.constatus=1;this.rejconBttn.hide();this.connectionBttn.stateId=Wtf.enumStat.RC;this.connectionBttn.setText("Request Connection");this.ttipCB.setTitle("Click to Request Connection")}break;case 2:this.joinprojBttn=new Wtf.Toolbar.Button({id:this.id+"joinproj",stateId:Wtf.enumStat.RR,text:"Join Project",iconCls:"pwnd addppl",handler:this.confirmProjectStatusChange,region:"south",scope:this});this.rejprojBttn=new Wtf.Toolbar.Button({id:this.id+"rejproj",stateId:Wtf.enumStat.RR,text:"Reject Request",iconCls:"pwnd addppl",handler:this.confirmProjectStatusChange,region:"south",scope:this});this.ComponentMainPanel.getBottomToolbar().insertButton(0,this.joinprojBttn);this.ComponentMainPanel.getBottomToolbar().insertButton(1,this.rejprojBttn);this.ttipCSB=new Wtf.ToolTip({id:this.id+"tooltipCSB",title:"Click to join project",target:this.joinprojBttn.id});this.ttipRRB=new Wtf.ToolTip({id:this.id+"tooltipRRB",title:"Click to reject request",target:this.rejprojBttn.id});if(!A.getCount()==0){switch(A.getAt(0).data["connstatus"]){case 0:this.projStat=1;this.rejprojBttn.hide();this.joinprojBttn.stateId=Wtf.enumStat.JC;this.joinprojBttn.setText("Join Project");this.ttipCSB.setTitle("Click to join project");break;case 1:if(A.getAt(0).data["id1"]==loginid){this.projStat=3;this.rejprojBttn.hide();this.joinprojBttn.stateId=Wtf.enumStat.WFA;this.joinprojBttn.setText("Waiting for approval");this.ttipCSB.setTitle("Waiting for approval");this.joinprojBttn.setDisabled(true);this.joinprojBttn.show()}else{this.projStat=3;this.rejprojBttn.show();this.joinprojBttn.stateId=Wtf.enumStat.AR;this.joinprojBttn.setText("Approve Request");this.ttipCSB.setTitle("Click to Approve Request");this.rejprojBttn.stateId=Wtf.enumStat.JC;this.rejprojBttn.setText("Reject Request");this.ttipRRB.setTitle("Click to Reject Request")}break;case 2:if(A.getAt(0).data["id1"]==loginid){this.projStat=3;this.rejprojBttn.show();this.joinprojBttn.stateId=Wtf.enumStat.AI;this.joinprojBttn.setText("Accept Invitation");this.ttipCSB.setTitle("Click to Accept Invitation");this.rejprojBttn.stateId=Wtf.enumStat.RI;this.rejprojBttn.setText("Reject Invitation");this.ttipRRB.setTitle("Click to Reject Invitation")}else{this.projStat=1;this.rejprojBttn.hide();this.joinprojBttn.stateId=Wtf.enumStat.JC;this.joinprojBttn.setText("Join Project");this.ttipCSB.setTitle("Click to Join Project")}break;case 3:this.projStat=0;this.rejprojBttn.hide();this.joinprojBttn.stateId=Wtf.enumStat.LC;this.joinprojBttn.setText("Leave Project");this.ttipCSB.setTitle("Click to Leave Project");break;case 4:this.rejprojBttn.hide();this.joinprojBttn.hide();break;case 5:this.rejprojBttn.hide();this.joinprojBttn.hide();break}if(A.getAt(0).data.archived){this.rejprojBttn.hide();this.joinprojBttn.hide();Wtf.get(this.about.tagbutton2).remove();this.edt_tag.hide()}}else{this.projStat=1;this.rejprojBttn.hide();this.joinprojBttn.stateId=Wtf.enumStat.JC;this.joinprojBttn.setText("Join Project");this.ttipCSB.setTitle("Click to Join Project")}break}}});Wtf.PanelView=function(A){Wtf.apply(this,A);Wtf.PanelView.superclass.constructor.call(this,A)};Wtf.extend(Wtf.PanelView,Wtf.Panel,{flag1:0,flag2:0,store:null,initComponent:function(){Wtf.PanelView.superclass.initComponent.call(this);this.addEvents({"panelready":true});var B=null;if(this.uid.type==Wtf.etype.user){var A=Wtf.data.Record.create([{name:"name"},{name:"id"},{name:"img"},{name:"description"},{name:"status"},{},{name:"o"},{name:"email"},{name:"address"},{name:"phone"}])}else{A=Wtf.data.Record.create([{name:"name"},{name:"id"},{name:"img"},{name:"description"},{name:"status"},{name:"members"},{name:"createdon",type:"date",dateFormat:"Y-m-d H:i:s"}])}B=new Wtf.data.KwlJsonReader({root:"data"},A);this.view30=new Wtf.common.KWLListPanel({id:this.id+"view30",title:" ",style:"padding: 16px;",reader:B,autoLoad:false,autoScroll:true,border:false,TabType:this.tabType,layout:"fit"});this.view30.on("dataloaded",this.dataloaded,this);this.view30.on("afterDataRender",this.dataRendered,this);this.quickPanelSearch=new Wtf.KWLQuickSearch({field:"name",width:200});this.quickPanelSearch.on("panelready",this.check1);this.quickPanelSearch.on("SearchComplete",this.QuickSearchComplete,this);switch(this.uid.type){case Wtf.etype.comm:this.setPanelDetails("My Communities","defaultcourse.png","community.html",Wtf.req.prf+"common/getUserCommunities.jsp?login=");break;case Wtf.etype.user:this.setPanelDetails("My Network","defaultuser.png","user.html",Wtf.req.prf+"common/getFriendList.jsp?login=");break;case Wtf.etype.proj:if(!this.archived){this.setPanelDetails("My Projects","defaultcourse.png","project.html",Wtf.req.prf+"dashboard/getProjList.jsp?login=")}else{this.setPanelDetails("Archived Projects","defaultcourse.png","project.html",Wtf.req.prj+"archive.jsp?mode=2&login=")}break}},check1:function(){if(this.flag1==1&&this.flag2==1){this.quickPanelSearch.StorageChanged(this.store)}},refresh:function(B,A){if(this.iconBtn.pressed){if(this.tabType==Wtf.etype.proj||this.tabType==Wtf.etype.user){this.quickPanelSearch.setValue("");this.view30.calculatePageSize();this.view30.prevPageSize=0;this.view30.checkForReq()}}else{if(this.detailBtn.pressed){this.store.reload()}}},setPanelDetails:function(D,C,B,A){this.view30.title=D;this.view30.ImgSrc=C;this.view30.Href=B;this.view30.url=A+loginid},onRender:function(A){Wtf.PanelView.superclass.onRender.call(this,A);var B=[];if(this.archived!=null&&!this.archived){B.push({text:"Archived Projects",iconCls:"pwnd arrange",handler:function(){navigate("armp")}});B.push("-")}B.push("->");B.push({text:"Refresh",iconCls:"pwnd refresh",scope:this,handler:this.refresh});this.innerPanel=this.add(new Wtf.Panel({id:this.id+"innerpanel",layout:"fit",border:false,bodyStyle:"background-image:url(images/bgstrip.png); background-repeat: repeat-x;",items:this.view30,tbar:[this.quickPanelSearch,"->",this.iconBtn=new Wtf.Button({text:"Icons",enableToggle:true,toggleGroup:1,pressed:true,scope:this,handler:this.toggleIconView}),this.detailBtn=new Wtf.Button({text:"Details",enableToggle:true,toggleGroup:1,scope:this,handler:this.toggleDetailView})],bbar:B}))},loadData:function(){this.view30.calculatePageSize();this.view30.checkForReq();this.flag1=1;this.fireEvent("panelready",this.flag1)},dataloaded:function(A){this.store=A;this.flag2=1;this.check1()},dataRendered:function(){this.fireEvent("panelready",this.flag1)},QuickSearchComplete:function(A){if(this.iconBtn.pressed){if(this.tabType==Wtf.etype.proj||this.tabType==Wtf.etype.user){this.view30.calculatePageSize();this.view30.prevPageSize=0;this.view30.checkForReq(this.quickPanelSearch.getValue())}}else{if(this.detailBtn.pressed){this.store.reload({params:{ss1:this.quickPanelSearch.getValue()}})}}},toggleIconView:function(){this.innerPanel.remove(this.detailview);this.innerPanel.add(this.view30);this.innerPanel.doLayout()},toggleDetailView:function(){if(!Wtf.getCmp("detailview"+this.id)){if(this.tabType==Wtf.etype.user){this.detailview=new Wtf.grid.GridPanel({border:false,loadMask:true,id:"detailview"+this.id,store:this.store,viewConfig:{forceFit:true},columns:[{header:"",width:50,dataIndex:"img",renderer:function(A){if(A==""){A="images/defaultuser.png"}return String.format("<img height='18px' width='18px' src='{0}'/>",A)}},{header:"Name",width:120,sortable:true,dataIndex:"name"},{header:"Email",width:120,sortable:true,renderer:WtfGlobal.renderEmailTo,dataIndex:"email"},{header:"About",width:400,sortable:true,dataIndex:"description"},{header:"Address",width:120,sortable:true,dataIndex:"address"},{header:"Phone",width:120,sortable:true,renderer:WtfGlobal.renderContactToSkype,dataIndex:"phone"},{header:"Status",width:120,sortable:true,dataIndex:"status",renderer:function(A,C,B){if(A=="1"){if(B.get("o")=="i"){return"Sent Request"}return"Received Invitation"}else{if(A=="2"){return"Received Invitation"}}return"Friend"}}]})}else{this.detailview=new Wtf.grid.GridPanel({border:false,id:"detailview"+this.id,store:this.store,loadMask:true,viewConfig:{forceFit:true},columns:[{header:"",width:50,dataIndex:"img",renderer:function(A){if(A==""){A="images/defaultcourse.png"}return String.format("<img height='18px' width='18px' src='{0}'/>",A)}},{header:"Name",width:120,sortable:true,dataIndex:"name"},{header:"About",width:400,sortable:true,dataIndex:"description"},{header:"Members",width:120,sortable:true,dataIndex:"members"},{header:"Status",width:120,sortable:true,dataIndex:"status",renderer:function(A){if(A=="1"){return"Invited"}else{if(A=="2"){return"Requested Membership"}else{if(A=="3"){return"Member"}else{if(A=="4"){return"Moderator"}}}}}},{header:"Created On",renderer:function(B,C,A){if(B!=null&&B!=""){return B.format(WtfGlobal.getDateFormat())}else{return""}},width:120,sortable:true,dataIndex:"createdon"}]})}this.detailview.on("rowdblclick",this.GridRowdbClicked,this)}this.innerPanel.remove(this.view30);this.innerPanel.add(this.detailview);this.innerPanel.doLayout()},GridRowdbClicked:function(A,C,B){switch(this.tabType){case Wtf.etype.user:mainPanel.loadTab("user.html","tab"+this.store.getAt(C).get("id"),this.store.getAt(C).get("name"),"navareadashboard",Wtf.etype.user,true);break;case Wtf.etype.comm:mainPanel.loadTab("community.html","tab"+this.store.getAt(C).get("id"),this.store.getAt(C).get("name"),"navareadashboard",Wtf.etype.comm,true);break;case Wtf.etype.proj:mainPanel.loadTab("project.html","tab"+this.store.getAt(C).get("id"),this.store.getAt(C).get("name"),"navareadashboard",Wtf.etype.proj,true);break}}});Wtf.Profile=function(){config={title:"Update Profile",id:"pprofwin",closable:true,modal:true,iconCls:"iconwin",width:460,height:450,resizable:false,layout:"border",buttonAlign:"right",renderTo:document.body,buttons:[{text:"Update",scope:this,handler:function(){if(!(this.Form.form.isValid())){return }this.Form.form.submit({waitMsg:"Loading...",scope:this,failure:function(frm,action){msgBoxShow(155,1);this.close()},success:function(frm,action){var userRes="Profile Updated Successfully.";var resObj=eval("("+action.response.responseText+")");if(resObj.success=="true"){if(resObj.data!=""){userRes+=resObj.data}msgBoxShow(["Success",userRes],3);var dateFormat=this.dateformatstore.getAt(this.dateformatstore.find("id",this.dtCombo.getValue()));Wtf.pref.DateFormatid=dateFormat.data.id;Wtf.pref.DateFormat=dateFormat.data.dateformat}else{msgBoxShow(155,1)}this.close()}})}},{text:"Cancel",scope:this,handler:function(){this.close()}}]};Wtf.Profile.superclass.constructor.call(this,config)};Wtf.extend(Wtf.Profile,Wtf.Window,{initComponent:function(A){this.dateformatstore=new Wtf.data.JsonStore({url:"admin.jsp?mode=20&action=0",root:"data",fields:["id","name","dateformat"]});this.dateformatstore.load();if(!Wtf.StoreMgr.containsKey("timezone")){Wtf.timezoneStore.load();Wtf.StoreMgr.add("timezone",Wtf.timezoneStore)}Wtf.Profile.superclass.initComponent.call(this,A);Wtf.Ajax.requestEx({url:Wtf.req.prf+"user/getuserdetails.jsp?",params:{mode:1},method:"POST"},this,function(D,B){try{var C=D;if(C){this.createForm(Wtf.util.JSON.decode(C).data[0])}}catch(E){}},function(C,B){msgBoxShow(156,1)})},createForm:function(B){this.Form=new Wtf.form.FormPanel({method:"POST",url:Wtf.req.prf+"user/updateProfile.jsp?",waitMsgTarget:true,fileUpload:true,border:false,labelWidth:120,cls:"scrollform",defaults:{width:240},defaultType:"textfield",items:[{fieldLabel:"User ID*",name:"username",disabled:true,allowBlank:false,value:B.username},{fieldLabel:"Email Address*",allowBlank:false,name:"emailid",vtype:"email",maxLength:256,value:B.emailid},{fieldLabel:"First Name*",name:"fname",maxLength:50,validator:WtfGlobal.validateUserName,allowBlank:false,value:B.fname},{fieldLabel:"Last Name*",maxLength:50,name:"lname",allowBlank:false,validator:WtfGlobal.validateUserName,value:B.lname},{fieldLabel:"User Picture",name:"image",height:24,inputType:"file"},{fieldLabel:"Contact Number",name:"contactno",maxLength:15,id:"updateContactNo",value:B.contactno},{xtype:"textarea",fieldLabel:"Address",height:80,maxLength:100,name:"address",id:"updateAddress",value:B.address},{xtype:"textarea",fieldLabel:"About Me",maxLength:512,id:"updateAboutMe",height:80,name:"about",value:B.aboutuser},this.dtCombo=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Date Format",store:this.dateformatstore,readOnly:true,displayField:"name",valueField:"id",value:Wtf.pref.DateFormatid,editable:false,hiddenName:"dateformat",mode:"local",width:240,triggerAction:"all",emptyText:"Select a type...",allowBlank:false}),this.locale=new Wtf.form.ComboBox({fieldLabel:"Time Zone",mode:"local",scope:this,triggerAction:"all",typeAhead:true,value:B.timezone,editable:false,hiddenName:"timezone",blankText:"Select a time zone",store:Wtf.timezoneStore,displayField:"name",valueField:"id"}),{fieldLabel:"Old Password",name:"oldpass",inputType:"password",minLength:4,maxLength:32,value:B.newpass},{fieldLabel:"New Password",name:"newpass",inputType:"password",minLength:4,maxLength:32,value:B.newpass},{fieldLabel:"Retype Password",name:"renewpass",inputType:"password",minLength:4,maxLength:32,value:B.renewpass}]});Wtf.getCmp("updateContactNo").on("change",function(){Wtf.getCmp("updateContactNo").setValue(WtfGlobal.HTMLStripper(Wtf.getCmp("updateContactNo").getValue()))});Wtf.getCmp("updateAddress").on("change",function(){Wtf.getCmp("updateAddress").setValue(WtfGlobal.HTMLStripper(Wtf.getCmp("updateAddress").getValue()))});Wtf.getCmp("updateAboutMe").on("change",function(){Wtf.getCmp("updateAboutMe").setValue(WtfGlobal.HTMLStripper(Wtf.getCmp("updateAboutMe").getValue()))});var A=Wtf.getCmp("profilewin");if(A){A.add(this.Form);this.doLayout()}},onRender:function(A){Wtf.Profile.superclass.onRender.call(this,A);this.add({region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getTopHtml("Update Profile","Update Profile")},{region:"center",border:false,id:"profilewin",bodyStyle:"background:#f1f1f1;font-size:10px;",layout:"fit",items:this.Form})}});Wtf.data.KwlDataReader=function(A,B){this.meta=A;this.recordType=B instanceof Array?Wtf.data.Record.create(B):B};Wtf.data.KwlDataReader.prototype={};Wtf.extend(Wtf.data.KwlDataReader,Wtf.util.Observable);Wtf.data.KwlJsonReader=function(A,B){A=A||{};Wtf.data.KwlJsonReader.superclass.constructor.call(this,A,B);this.events={aftereval:true};this.on("aftereval",this.jsonErrorResponseHandler)};Wtf.extend(Wtf.data.KwlJsonReader,Wtf.data.KwlDataReader,{read:function(response){var json=response.responseText;var o=eval("("+json+")");if(o&&o.valid==false){signOut("timeout")}else{o=eval("("+o.data+")")}if(!o){throw {message:"JsonReader.read: Json object not found"}}if(o.metaData){delete this.ef;this.meta=o.metaData;this.recordType=Wtf.data.Record.create(o.metaData.fields)}return this.readRecords(o)},jsonErrorResponseHandler:function(A,C,B){if(A&&!A.valid){signOut("timeout")}},simpleAccess:function(B,A){return B[A]},getJsonAccessor:function(){var A=/[\[\.]/;return function(C){try{return(A.test(C))?new Function("obj","return obj."+C):function(D){return D[C]}}catch(B){}return Wtf.emptyFn}}(),readRecords:function(K){this.jsonData=K;var I=this.meta,G=this.recordType,R=G.prototype.fields,F=R.items,C=R.length;if(!this.ef){if(I.totalProperty){this.getTotal=this.getJsonAccessor(I.totalProperty)}if(I.successProperty){this.getSuccess=this.getJsonAccessor(I.successProperty)}this.getRoot=I.root?this.getJsonAccessor(I.root):function(U){return U};if(I.id){var Q=this.getJsonAccessor(I.id);this.getId=function(V){var U=Q(V);return(U===undefined||U==="")?null:U}}else{this.getId=function(){return null}}this.ef=[];for(var P=0;P<C;P++){R=F[P];var T=(R.mapping!==undefined&&R.mapping!==null)?R.mapping:R.name;this.ef[P]=this.getJsonAccessor(T)}}var M=this.getRoot(K),S=M.length,H=S,A=true;if(I.totalProperty){var E=parseInt(this.getTotal(K),10);if(!isNaN(E)){H=E}}if(I.successProperty){var E=this.getSuccess(K);if(E===false||E==="false"){A=false}}var O=[];for(var P=0;P<S;P++){var L=M[P];var D={};var J=this.getId(L);for(var N=0;N<C;N++){R=F[N];var E=this.ef[N](L);D[R.name]=R.convert((E!==undefined)?E:R.defaultValue)}var B=new G(D,J);B.json=L;O[P]=B}return{success:A,records:O,totalRecords:H}}});Wtf.AddtoWindow=function(A){Wtf.apply(this,A);this.iconCls="iconwin";Wtf.AddtoWindow.superclass.constructor.call(this,A)};Wtf.extend(Wtf.AddtoWindow,Wtf.Window,{initComponent:function(){Wtf.AddtoWindow.superclass.initComponent.call(this);this.title="Add Users To";this.layout="fit";this.width=450;this.height=450},onRender:function(A){Wtf.AddtoWindow.superclass.onRender.call(this,A);var B=(this.wizard)?"Skip":"Cancel";var C=(this.wizard)?"Step 3 of 3":"Add Users To Projects.";this.AddQuickSearch=new Wtf.KWLQuickSearch({id:"AddToSearch"+this.id,width:200,field:"name"});this.listds=new Wtf.data.JsonStore({id:"listds"+this.id,url:"admin.jsp?action=0&companyid="+companyid+"&userid="+this.userid,root:"data",method:"GET",baseParams:{mode:5},fields:["id","name"]});this.listds.load();this.listds.on("load",this.createGP,this);this.listsm=new Wtf.grid.CheckboxSelectionModel();this.listcm=new Wtf.grid.ColumnModel([this.listsm,{header:"Name",dataIndex:"name",width:434,sortable:true,groupable:true}]);this.innerpanel=this.add(new Wtf.Panel({layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getTopHtml("Add User To Project As Member",C)},{region:"center",border:false,bodyStyle:"background:#f1f1f1;font-size:10px;",layout:"fit",items:[this.panel=new Wtf.common.KWLListPanel({paging:false,autoLoad:false,border:false,title:"Project",autoScroll:true,tbar:[" "," ",this.AddQuickSearch],bbar:new Wtf.PagingToolbar({pageSize:20,store:this.listds,displayInfo:false,emptyMsg:"No topics to display"})})]}],buttons:[{text:"Add",id:"addUserToProjButton",scope:this,handler:function(){if(this.listsm.getSelections().length>0){Wtf.MessageBox.confirm("Confirm","Are you sure you want to perform this action?",function(D){if(D=="yes"){Wtf.getCmp("addUserToProjButton").disable();Wtf.getCmp("cancelUserToProjButton").disable();this.addUsersTo(this.userid,this.wizard)}},this)}else{msgBoxShow(84,1)}}},{text:B,scope:this,id:"cancelUserToProjButton",handler:function(){var D=Wtf.getCmp("addto"+this.parentid);if(D){D.enable()}this.close();if(this.wizard){Wtf.getCmp(this.parentid).finishWindow()}}}]}));this.on("close",function(){var D=Wtf.getCmp("addto"+this.parentid);if(D){D.enable()}});this.listds.on("load",function(){this.AddQuickSearch.StorageChanged(this.listds);Wtf.getCmp("AddToSearch"+this.id).setValue("")},this)},createGP:function(){this.panel.add(new Wtf.grid.GridPanel({id:"list"+this.id,store:this.listds,cm:this.listcm,sm:this.listsm,border:false,width:434,loadMask:true,viewConfig:{forceFit:true}}));this.panel.doLayout();this.listds.removeListener("load",this.createGP,this)},addUsersTo:function(F,B){var A="",D="";var E;var G=this.listsm.getSelections();for(E=0;E<G.length;E++){D+=G[E].data["id"]+","}D=D.substring(0,D.length-1);if(F!==undefined){A=F}else{var C=this.selectionModel.getSelections();for(E=0;E<C.length;E++){A+=C[E].data["userid"]+","}A=A.substring(0,A.length-1)}Wtf.Ajax.requestEx({url:"admin.jsp?",params:{action:1,userslist:A,featureidslist:D,companyid:this.companyid,lid:loginid,feature:0,mode:0,emode:3},method:"POST"},this,function(J,H){this.close();if(J=="success"){var I=Wtf.getCmp("addto"+this.parentid);if(I){I.enable()}if(B){Wtf.getCmp(this.parentid).finishWindow()}else{msgBoxShow(7,0)}if(this.usergrid){this.usergrid.getStore().load()}}},function(){msgBoxShow(8,1);var H=Wtf.getCmp("addto"+this.parentid);if(H){H.enable()}this.close();if(F!==undefined){Wtf.getCmp(this.parentid).finishWindow()}})}});Wtf.Button.override({setTooltip:function(A){var B=this.getEl().child(this.buttonSelector);Wtf.QuickTips.register(Wtf.apply({target:B.id},A))}});Wtf.linkPanel=function(A){Wtf.apply(this,A);Wtf.linkPanel.superclass.constructor.call(this,A)};Wtf.extend(Wtf.linkPanel,Wtf.Panel,{border:false,baseCls:"linkPanelBorder",initComponent:function(A){Wtf.linkPanel.superclass.initComponent.call(this,A);this.addEvents({"linkClicked":true})},onRender:function(A){Wtf.linkPanel.superclass.onRender.call(this,A);this.link=document.createElement("a");this.link.id="panelLink"+this.id;this.link.onclick=this.linkClick.createDelegate(this,[this.link]);this.link.innerHTML=this.text;this.add(this.link)},afterRender:function(){this.doLayout()},linkClick:function(){this.fireEvent("linkClicked",this.link,this)},setLinkText:function(A){this.link.innerHTML=A},hideLink:function(){this.link.style.display="none"},showLink:function(){this.link.style.display="block"}});Wtf.TopicStore=function(){var A=Wtf.data.Record.create(["Details","ID","flag","Attachment"]);Wtf.TopicStore.superclass.constructor.call(this,{remoteSort:true,proxy:new Wtf.data.HttpProxy({url:Wtf.req.prt+"getDetails.jsp"}),reader:new Wtf.data.KwlJsonReader({root:"data",id:"threadid"},A)})};Wtf.extend(Wtf.TopicStore,Wtf.data.Store,{initComponent:function(A){Wtf.TopicStore.superclass.initComponent.call(this,A);this.events={"dataloaded":true}},loadForum:function(B,D,A,C){this.baseParams={topicId:B,type:D,flag:A,userId:C};this.on("load",function(){this.fireEvent("dataloaded")},this);this.load()}});Wtf.MessagePanel=function(A){Wtf.apply(this,A);this.topicstore=new Wtf.TopicStore({});this.messageId=null;this.topicstore.on("load",this.loadData,this);this.topicstore.on("loadexception",this.handleException,this);this.messagePanelDetailsTemplate=new Wtf.Template("<div id='{divImg}' style='width:10%; autoHeight:true; float:left;'>","<img id='{imgDiv}' style='float:left;height:45px; width:45px 'src='images/s.gif'></img>","</div>","<ul id='{dataDiv}'>","<li><span class='head-label'>Subject:</span>","<span id='{subjectDiv}'></span>","</li>","<li style='float:left;width:40%'><span id='{msgfrom}' class='head-label'>{fromtext}:</span>","<span id='{fromDiv}'></span>","</li>","<li style='float:left;width:40%;'><span id='{msgdate}' class='head-label'>{recdtext}:</span>","<span id='{receivedOn}'></span></li></ul>","</div>");this.messagePanelContentTemplate=new Wtf.Template("<div style='margin:3px;height:90%;width:90%;'>","<div id='{msgDiv}' style='height: auto;display:block;overflow:auto; margin-left:10px;'>No messages Selected</div></div>");Wtf.MessagePanel.superclass.constructor.call(this,{id:A.id,closable:true,split:true,border:false,bodyStyle:"background:#FFFFFF;border: solid 4px #5b84ba;",layout:"border",items:[{region:"north",cls:"messagePanelHeader",border:false,height:55,html:this.messagePanelDetailsTemplate.applyTemplate({divImg:"divImg_"+A.id,imgDiv:"imgDiv_"+A.id,dataDiv:"dataDiv_"+A.id,subjectDiv:"subjectDiv_"+A.id,msgfrom:"msgfrom_"+A.id,fromDiv:"fromDiv_"+A.id,msgdate:"msgDate_"+A.id,receivedOn:"receivedOn_"+A.id,fromtext:"From",recdtext:"Received On"})},{region:"center",cls:"messagePanelBody",border:false,html:this.messagePanelContentTemplate.applyTemplate({msgDiv:"msgDiv_"+A.id})}]});this.addEvents={"UpdateDstore":true,"UpdateMailDstore":true}};Wtf.extend(Wtf.MessagePanel,Wtf.Panel,{loadData:function(C,D,A){if(this.messageId){if(this.messageId.match("topic")){this.messageId=this.messageId.substring(5)}var B=D[0].data;if(this.messageId==B.ID){document.getElementById("msgDiv_"+this.id).innerHTML=Wtf.util.Format.stripScripts((this.parseSmiley(WtfGlobal.URLDecode(B.Details)))+WtfGlobal.URLDecode(B.Attachment))}if(B.flag=="Forum"){this.fireEvent("UpdateDstore",B.Details,B.Attachment,B.ID)}else{(B.flag=="Mail")}this.fireEvent("UpdateMailDstore",B.Details,B.Attachment,B.ID);Wtf.get("msgDiv_"+this.id).addListener("click",function(F,G){var E=F.target;F.preventDefault();if(E.tagName=="A"&&E.href.match("http://")){window.open(E.href,"_blank"+E.href);return false}},this)}},parseSmiley:function(E){E=unescape(E);var C=document.createElement("div");var B=[];B=E.match(/(:\(\()|(:\)\))|(:\))|(:x)|(:\()|(:P)|(:D)|(;\))|(;;\))|(&gt;:D&lt;)|(:-\/)|(:&gt;&gt;)|(:-\*)|(=\(\()|(:-O)|(X\()|(:&gt;)|(B-\))|(:-S)|(#:-S)|(&gt;:\))|(:\|)|(\/:\))|(=\)\))|(O:-\))|(:-B)|(=;)|(:-c)/g);if(B==null){C.innerHTML=E}else{var D;var A;C.innerHTML=E;for(D=0;D<B.length;D++){this.smiley(C,B[D])}}return C.innerHTML},smiley:function(A,B){A.innerHTML=A.innerHTML.replace(B,"<img src=images/smiley"+(smileyStore.indexOf(B)+1)+".gif style=display:inline;vertical-align:text-top;></img>")},setData:function(C,H,F,G,D,B){document.getElementById("subjectDiv_"+this.id).innerHTML=WtfGlobal.URLDecode(C);var A=(B!=null&&B=="true")?H:"<a class=\"attachmentlink\" href='#' onclick='javascript:openprofile(\""+D+'","'+H+'","'+G+"\")'>"+H+"</a>";document.getElementById("fromDiv_"+this.id).innerHTML='<span style="margin:14px;">'+A+"</span>";document.getElementById("receivedOn_"+this.id).innerHTML=F;var E=document.getElementById("divImg_"+this.id).getElementsByTagName("img")[0];if(G==""){E.src="images/defaultuser.png"}else{E.src="images/store/"+G}},loadCacheData:function(A){document.getElementById("msgDiv_"+this.id).innerHTML=Wtf.util.Format.stripScripts(this.parseSmiley(WtfGlobal.URLDecode(A)))},setData1:function(A,E,B,D,C){document.getElementById("msgDiv_"+this.id).innerHTML=Wtf.util.Format.htmlDecode(WtfGlobal.URLDecode(D));document.getElementById("subjectDiv_"+this.id).innerHTML=WtfGlobal.URLDecode(A);document.getElementById("fromDiv_"+this.id).innerHTML=E;document.getElementById("receivedOn_"+this.id).innerHTML=B;document.getElementById("divImg_"+this.id).getElementsByTagName("img")[0].src=C},setFromText:function(B,A){document.getElementById("msgfrom_"+this.id).innerHTML=B;document.getElementById("msgDate_"+this.id).innerHTML=A},clearContents:function(){document.getElementById("msgDiv_"+this.id).innerHTML="";document.getElementById("subjectDiv_"+this.id).innerHTML="";document.getElementById("fromDiv_"+this.id).innerHTML="";document.getElementById("receivedOn_"+this.id).innerHTML="";document.getElementById("divImg_"+this.id).getElementsByTagName("img")[0].src="images/s.gif"},handleException:function(){var A=document.getElementById("msgDiv_"+this.id);if(this.topicstore.reader.jsonData===undefined){A.innerHTML="<img src='lib/resources/images/default/window/icon-warning.gif' height='16px' width='16px' />Unable to load message..Please try again later"}else{A.innerHTML=""}}});Wtf.ReplyWindow=function(C){Wtf.apply(this,C);this.sendBtn=new Wtf.Toolbar.Button({text:"Send",tooltip:{title:"Send",text:"Send message"},iconCls:"pwnd outbox",id:"sendBtnid"});this.sendBtn.on("click",this.handleSend,this);this.addEvents({"beforeClosewindow":true,"loadsuccess":true});this.saveBtn=new Wtf.Toolbar.Button({text:"Save",tooltip:{title:"Save",text:"Save to drafts"},iconCls:"pwnd saveicon",id:"saveBtnid"});this.saveBtn.on("click",this.handleSave,this);this.closeBtn=new Wtf.Toolbar.Button({text:"Close",tooltip:{title:"Close",text:"Close tab"},iconCls:"pwnd closeicon",id:"closeBtnid"});this.closeBtn.on("click",this.handleClose,this);this.tButnArr=Array();this.tButnArr.push(this.sendBtn);if(C.composeMail==1||C.composeMail==5){this.composeMailFlag=true;this.tButnArr.push(this.saveBtn)}this.tButnArr.push(this.closeBtn);var A=Wtf.data.Record.create([{name:"Success"},{name:"ID"},{name:"Subject"},{name:"Received",type:"date"},{name:"From"},{name:"Details"},{name:"Flag"},{name:"Image"}]);this.insertStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.prt+"insertNewMsg.jsp"}),panelObj:this,reader:new Wtf.data.KwlJsonReader({root:"data"},A)});this.insertStore.on("loadexception",function(){msgBoxShow(4,1);this.ownerCt.remove(this);this.sendBtn.enable();this.closeBtn.enable();this.saveBtn.enable()},this);this.insertStore.on("load",this.handleLoad,this);this.uvalue=C.uFieldValue;this.projFlag=false;if(C.projectFlag){this.projFlag=true}if(this.uvalue=="NewTopic"&&C.projectFlag!=true){this.uvalue=Wtf.getCmp("sub"+C.id1.substring(4)).ownerCt.comtitle}else{if(this.uvalue=="NewTopic"&&C.projectFlag){this.uvalue=Wtf.getCmp("subtabpanelcomprojectTabs_"+C.id1.substring(4)).ownerCt.comtitle}}this.field1=new Wtf.form.TextField({fieldLabel:C.uLabel,name:C.uLabel,value:this.uvalue,emptyText:"User ID",tabIndex:1,disabled:C.tdisabled,width:"95%"});this.field1.on("change",function(){this.field1.setValue(WtfGlobal.HTMLStripper(this.field1.getValue()))},this);this.field2=new Wtf.form.TextField({fieldLabel:C.bLabel,name:C.bLabel,value:C.bFieldValue,maxLength:255,tabIndex:1,maxLengthText:"The maximum length allowed for "+C.bLabel+" is 255 characters",width:"95%"});this.field2.on("change",function(){this.field2.setValue(WtfGlobal.HTMLStripper(this.field2.getValue()))},this);this.attachPanel=new Wtf.linkPanel({text:"Attach a file",height:20});this.attachPanel.on("linkClicked",this.Attachfile,this);this.hedit=new Wtf.newHTMLEditor({height:240,border:false,enableLists:false,enableSourceEdit:false,enableAlignments:true,hideLabel:true});this.hiddenHtml=new Wtf.form.Hidden({name:"ptxt"});this.hiddentitle=new Wtf.form.Hidden({name:"title"});this.hiddenHtml.hidden=true;this.draftSendFlag=false;if(C.details!=null){this.hedit.setValue(WtfGlobal.URLDecode(C.details))}if(C.composeMail==5){this.draftSendFlag=true}this.type=C.type;this.sendflag=C.sendFlag;this.replyToId=C.replytoId;this.userId=C.userId;this.groupId=C.groupId;this.firstReply=C.firstReply;this.fid=C.fid;this.count=1;this.attachheight=75;var B=C.tdisabled?"disabled":"";this.resPanel=new Wtf.Panel({border:false,height:"20px",html:'<label style="width:80px !important;float:left;">'+C.uLabel+':</label><input class="idcheckedEnabled" type="text"  style="width: 85%" '+B+' value="'+this.uvalue+'" /><br/><div style="margin-top: 2pt; height: 18pt;"><label style="width:80px !important;float:left;">'+C.bLabel+':</label><input type="text" style="width: 85%" value="'+C.bFieldValue+'"  name="'+C.bLabel+'" /><br /></div>'});this.smartInputFloater={xtype:"panel",border:false,id:"smartInputFloater12",html:'<table id="smartInputFloater" style = "left: 64pt;top: 20pt"class="floater" cellpadding="0" cellspacing="0"><tr><td id="smartInputFloaterContent" nowrap="nowrap"></td></tr></table>'};this.top=new Wtf.FormPanel({frame:false,bodyStyle:"padding:5px 5px 0",border:false,fileUpload:true,height:this.attachheight,layout:"form",items:[this.field1,this.field2,this.attachPanel,this.hiddenHtml,this.hiddentitle]});Wtf.ReplyWindow.superclass.constructor.call(this,{layout:"border",plain:true,border:false,iconCls:"pwnd composemail",items:[{region:"center",border:false,layout:"fit",items:[this.hedit]},{region:"north",layout:"fit",border:false,height:this.attachheight,items:[this.top]}],resizable:true,tbar:this.tButnArr});this.on("destroy",function(){if(this.hedit.smileyWindow!==undefined){this.hedit.smileyWindow.destroy()}if(Wtf.getCmp("emails"+this.replyToId)!=null){Wtf.getCmp("emails"+this.replyToId).topicstore.loadForum(this.replyToId,"-1","mail","")}},this)};Wtf.extend(Wtf.ReplyWindow,Wtf.Panel,{removeFile:function(B,A){this.top.remove(A,true);this.attachheight-=27;this.top.ownerCt.setHeight(this.attachheight);this.top.setHeight(this.attachheight);this.count--;if(this.top.items.length<10){this.attachPanel.showLink()}if(this.top.items.length==5){this.attachPanel.setLinkText("Attach file")}this.doLayout()},Attachfile:function(){var A=new Wtf.form.TextField({fieldLabel:"",labelSeparator:"",name:"attach"+(this.count++),inputType:"file"});var B="fileattach_"+this.count+"_"+this.id;var C=new Wtf.linkPanel({cls:"fileattachremove",border:false,text:"Remove",items:A});this.top.insert(this.count,C);C.on("linkClicked",this.removeFile,this);this.attachheight=this.attachheight+27;this.top.ownerCt.setHeight(this.attachheight);this.top.setHeight(this.attachheight);this.attachPanel.setLinkText("Attach another file");if(this.top.items.length>=10){this.attachPanel.hideLink()}this.doLayout()},handleLoad:function(B,C,A){this.fireEvent("loadsuccess",B,C,A);this.sendBtn.enable();this.closeBtn.enable();this.saveBtn.enable();this.ownerCt.remove(this);if(this.replyds!=null){this.replyds.reload()}},handleClose:function(A,B){if(this.replyds!=null){this.replyds.reload()}if(this.ownerCt){this.fireEvent("beforeClosewindow",this);this.ownerCt.remove(this)}},sendMail:function(A,C){var B=this.hedit.getValue();B=B.replace(/<STRONG>/gi,"<b>");B=B.replace(/<\/STRONG>/gi,"</b>");B=B.replace(/<em>/gi,"<i>");B=B.replace(/<\/em>/gi,"</i>");this.hiddenHtml.setValue(encodeURIComponent(B));this.hiddentitle.setValue(encodeURIComponent(this.field2.getValue()));this.top.form.submit({url:Wtf.req.prt+"insertNewMsg.jsp?type="+this.type+"&sendflag="+this.sendflag+"&repto="+A+"&userId="+this.userId+"&groupId="+this.groupId+"&firstReply="+this.firstReply+"&draft="+C+"&fid="+this.fid,waitMsg:"sending...",scope:this,success:function(D,E){if(E.result.data.data[0].Success){if(E.result.data.data[0].Success.match("Success")){msgBoxShow(141,0);this.handleClose()}else{if(E.result.data.data[0].Success.match("Fail")){if(E.result.data.data[0].msg!=null){msgBoxShow(["Error",E.result.data.data[0].msg],1)}else{msgBoxShow(142,1)}this.handleClose()}else{if(E.result.data.data[0].Success.match("Draft")){msgBoxShow(147,0);this.handleClose()}else{if(E.result.data.data[0].Success.match("userfail")){msgBoxShow(["Delivery Failure","Message to user "+E.result.data.data[0].Subject+" is invalid."],1);this.handleClose()}}}}}},failure:function(E,D){this.handleClose()}},this);if(this.mailDS){this.mailDS.reload()}},handleSend:function(A,C){var D=0;var B=this.replyToId;this.sendBtn.disable();this.closeBtn.disable();this.saveBtn.disable();if(this.composeMailFlag){if(this.draftSendFlag){D=2}else{D=3}if(B=="-1"){B=this.field1.getValue()}}if(!(this.field1.isValid())||this.field1.getValue()==""){msgBoxShow(144,1);this.sendBtn.enable();this.closeBtn.enable();this.saveBtn.enable();return false}if(this.field2.getValue()==""){Wtf.MessageBox.confirm("Confirm","Send message without subject?",function(E){if(E=="yes"){this.sendMail(B,D)}else{this.sendBtn.enable();this.closeBtn.enable();this.saveBtn.enable();return false}},this)}else{this.sendMail(B,D)}},handleSave:function(A,C){this.closeBtn.disable();this.saveBtn.disable();this.sendBtn.disable();var B=this.replyToId;if(this.replyToId=="-1"){B=this.field1.getValue()}this.hiddenHtml.setValue(encodeURIComponent(this.hedit.getValue()));this.hiddentitle.setValue(encodeURIComponent(this.field2.getValue()));this.top.form.submit({url:Wtf.req.prt+"insertNewMsg.jsp?type="+this.type+"&sendflag="+this.sendflag+"&repto="+B+"&userId="+this.userId+"&groupId="+this.groupId+"&firstReply="+this.firstReply+"&draft=1&fid="+this.fid,waitMsg:"Saving message to draft...",scope:this,success:function(D,E){if(E.result.data.data[0].Success){if(E.result.data.data[0].Success.match("Success")){msgBoxShow(141,0);this.handleClose()}else{if(E.result.data.data[0].Success.match("Fail")){if(E.result.data.data[0].msg!=null){msgBoxShow(["Error",E.result.data.data[0].msg],1)}msgBoxShow(142,1);this.handleClose()}else{if(E.result.data.data[0].Success.match("Draft")){msgBoxShow(147,0);this.handleClose()}else{if(E.result.data.data[0].Success.match("userfail")){msgBoxShow(["Delivery Failure","Message to user "+E.result.data.data[0].Subject+" is invalid."],1);this.handleClose()}}}}}},failure:function(E,D){this.handleClose()}},this)}});function openprofile(A,C,B){mainPanel.loadTab("user.html","   "+A,C,"navareadashboard",Wtf.etype.user,true)}function Attachfile(A){Wtf.getCmp(A).Attachfile()}function removefile(A,B){Wtf.getCmp(A).destroy();Wtf.getCmp(B).removeFile()}Wtf.ForumTree=function(A){Wtf.apply(this,A);this.row;this.col=2;this.id=100;this.sm=new Wtf.grid.CheckboxSelectionModel();this.flagArray=["DESC","DESC","DESC","DESC"];this.forumPost=Wtf.data.Record.create([{name:"Subject"},{name:"From"},{name:"Received",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"Flag",type:"boolean"},{name:"ifread",type:"boolean"},{name:"ID"},{name:"Details"},{name:"Attachment"},{name:"Parent"},{name:"Level"},{name:"Image"},{name:"User_Id"}]);if(A.roleId==3){this.cmodel=new Wtf.grid.ColumnModel([this.sm,{header:"Topics",width:300,dataIndex:"Subject",renderer:this.CustomCell},{header:"From",width:170,dataIndex:"From"},{header:"Received",width:180,renderer:this.dateRenderer,dataIndex:"Received"},{header:"Flag",width:70,resizable:false,fixed:true,dataIndex:"Flag",renderer:this.FlagCell}])}else{if(A.roleId==1){this.cmodel=new Wtf.grid.ColumnModel([{header:"Topics",width:300,dataIndex:"Subject",renderer:this.CustomCell},{header:"From",width:170,dataIndex:"From"},{header:"Received",width:180,renderer:this.dateRenderer,dataIndex:"Received"},{header:"Flag",width:70,resizable:false,fixed:true,dataIndex:"Flag",renderer:this.FlagCell}])}}this.jReader=new Wtf.data.KwlJsonReader({totalProperty:"forumCount",root:"data"},this.forumPost);this.dstore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.prt+"loadForumTree.jsp"}),reader:this.jReader});Wtf.ForumTree.superclass.constructor.call(this,{ds:this.dstore,cm:this.cmodel,border:false,loadMask:true,viewConfig:{forceFit:true}});this.addEvents={"cellclick1":true,"mgContext":true}};Wtf.extend(Wtf.ForumTree,Wtf.grid.GridPanel,{ReplyWindow:function(G,H){var A=null;A=new G.forumPost({Subject:"New Reply",Received:new Date("26/10/2007 05:05:05 PM"),From:"Unknown User",Flag:"False",ID:G.id++,Details:"No Details",Level:parseInt(G.dstore.getAt(H).data["Level"])+1,Parent:G.dstore.getAt(H).data["ID"]});var F=G.search(G.dstore.getAt(H).data["ID"],G);var E=G.dstore.getAt(H);var B=2;var D=G.dstore.getAt(F+1);if(D){for(;E.data["Level"]<D.data["Level"];B++){D=G.dstore.getAt(F+B);if(!D){break}}}G.dstore.insert(H+B-1,A);var C=G.getView();if(C.getCell(F,0).firstChild.firstChild.className=="forum_plus"){C.getCell(H+B-1,0).parentNode.parentNode.parentNode.parentNode.style.display="none"}else{if(C.getCell(F,0).firstChild.firstChild.className!="forum_minus"){C.getCell(F,0).firstChild.firstChild.className="forum_minus"}}C.getCell(H+B-1,0).firstChild.style.marginLeft=parseInt(18*G.dstore.getAt(H+B-1).data["Level"])+"px"},CollExp:function(H,I,A){var F=false;var J=this.getView();if(H.className=="forum_minus"){var K=this.dstore.getAt(this.row).data["Level"];for(var G=this.row+1;G<this.dstore.getCount();G++){var B=this.dstore.getAt(G);if(B.data["Level"]<=K){break}J.getCell(G,0).parentNode.parentNode.parentNode.parentNode.style.display="none";if(J.getCell(G,A).firstChild.style.fontWeight=="bold"){F=true}}if(F){this.makeUnread(J,I,A)}H.className="forum_plus"}else{if(H.className=="forum_plus"){var K=this.dstore.getAt(this.row).data["Level"];for(var E=this.row+1;E<this.dstore.getCount();E++){var B=this.dstore.getAt(E);if(B.data["Level"]<=K){break}J.getCell(E,0).parentNode.parentNode.parentNode.parentNode.style.display="block";if(J.getCell(E,A).firstChild.firstChild.className=="forum_plus"){var C=this.dstore.getAt(E).data["Level"];for(var D=E+1;D<this.dstore.getCount();D++,E++){B=this.dstore.getAt(D);if(B.data["Level"]<=C){break}}}}H.className="forum_minus";this.makeRead(J,I,A)}}},search:function(A,B){for(var C=0;C<B.dstore.getCount();C++){if(B.dstore.getAt(C).data["ID"]==A){return C}}return null},CustomCell:function(A){return'<div id="forum_imgDiv" class="forum_blank"></div><div id="forum_postDiv" class="forum_postImage" height="13px" width="15px" ><img id="forum_img" height="12px" width="15px" src="images/read.gif"/></div><div id="forum_textDiv" class="forum_defaultText">'+WtfGlobal.URLDecode(A)+"</div>"},FlagCell:function(A){if(A){return'<div id="img_div" class="redflag" height="10px"> </div>'}else{return'<div id="img_div" class="greyflag" height="10px"> </div>'}},dateRenderer:function(A){if(A!=null){return A.format(WtfGlobal.getDateFormat())}}});Wtf.forumpPageSize=function(A){Wtf.apply(this,A);this.totalSize=null};Wtf.extend(Wtf.forumpPageSize,Wtf.common.pPageSize,{changePageSize:function(I){var E=0;var A=0;var K=this.pagingToolbar;this.combo.collapse();I=parseInt(I)||parseInt(this.combo.getValue());I=(I>0)?I:1;if(I<K.pageSize){if(this.ftree!=null){this.ftree.getSelectionModel().selections.clear()}var H=K.store;H.suspendEvents();for(var B=0;B<H.getCount();B++){if(H.getAt(B).data["ID"].match("topic")){E++;if((E)==(I+1)){break}}A++}if(E!=this.totalSize){E--}K.pageSize=I;var C=Math.round(K.cursor/A)+1;var J=(C-1)*A;H.suspendEvents();for(var D=0,F=J-K.cursor;D<F;D++){H.remove(H.getAt(0))}while(H.getCount()>A){H.remove(H.getAt(H.getCount()-1))}H.resumeEvents();H.fireEvent("datachanged",H);K.cursor=J;var G=K.getPageData();K.afterTextEl.el.innerHTML=String.format(K.afterPageText,G.pages);if(H.data.length<=0){C=1}K.field.dom.value=C;K.first.setDisabled(C==1);K.prev.setDisabled(C==1);K.next.setDisabled(C==G.pages);K.last.setDisabled(C==G.pages);K.cursor=(C-1)*I;K.updateInfo();if(H.data.length>0){K.displayEl.update("Displaying threads "+parseInt(K.cursor+1)+" - "+parseInt(K.cursor+parseInt(E))+" of "+this.totalSize)}else{K.displayEl.update("No threads to display")}}else{this.pagingToolbar.pageSize=I;this.pagingToolbar.doLoad(Math.floor(this.pagingToolbar.cursor/this.pagingToolbar.pageSize)*this.pagingToolbar.pageSize)}this.updateStore()}});Wtf.DiscussionForum=function(B){Wtf.apply(this,B);this.msgReadImg="images/read.gif";this.msgUnreadImg="images/unread.gif";this.roleId=B.roleId;this.previewPanel=new Wtf.MessagePanel({id:"ppanel"+this.id});this.searchFlag=true;this.curRecCount=1;this.searchText="";this.curComboIndex=0;this.curComboFlag=false;this.styleHelper=0;this.msgLmt=15;this.dtask=new Wtf.util.DelayedTask(this.searchForum);this.mailSearchFlag=false;this.isClearTopic=false;this.delStr="";if(this.roleId==3){this.styleHelper=1}if(B.projectFlag){this.projectFlag=true}else{this.projectFlag=false}var A=Wtf.data.Record.create([{name:"tid"}]);this.deleteReader=new Wtf.data.KwlJsonReader({root:"data"},A);this.deleteStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.prt+"deleteMessage.jsp"}),reader:this.deleteReader});this.newMsgButton=new Wtf.Toolbar.Button({text:"New Message",tooltip:{title:"New Message",text:"Create a new thread"},iconCls:"pwnd compose",id:"newMessage"+this.id});this.replyMsgButton=new Wtf.Toolbar.Button({text:"Reply",tooltip:{title:"Reply",text:"Reply to current selected item"},iconCls:"pwnd outbox",id:"Reply"+this.id});this.DeleteButton=new Wtf.Toolbar.Button({text:"Delete",tooltip:{title:"Delete",text:"Delete topic"},iconCls:"pwnd deliconwt",id:"Delete"+this.id});this.searchField=new Wtf.form.TextField({id:"searchtextbox"+this.id,emptyText:"Search",width:175,height:19});if(!this.archived){this.tButnArr=[];if(!this.createNewThreadPerm){this.tButnArr.push(this.newMsgButton);this.newMsgButton.on("click",this.createNewTopicWindow,this)}if(!this.postMessagePerm){this.tButnArr.push(this.replyMsgButton);this.replyMsgButton.on("click",this.ReplyWindow,this)}this.tButnArr.push(this.searchField);if(!this.moderateMessagePerm||this.roleId==3){this.tButnArr.push(this.DeleteButton);this.DeleteButton.on("click",this.deleteMessage,this)}}else{this.tButnArr=[this.searchField]}this.selectedRow=null;this.wind=null;this.ftree=new Wtf.ForumTree({border:false,region:"center",layout:"fit",id:"forum-grid"+B.id,roleId:this.roleId,msgReadImg:this.msgReadImg,msgUnreadImg:this.msgUnreadImg,makeUnread:this.makeUnread,makeRead:this.makeRead});this.pageLimit=new Wtf.forumpPageSize({ftree:this.ftree});this.pToolBar=new Wtf.PagingToolbar({id:"pgTbar"+this.id,pageSize:this.msgLmt,store:this.ftree.dstore,displayInfo:true,displayMsg:"Displaying threads {0} - {1} of {2}",emptyMsg:"No threads to display",plugins:this.pageLimit});Wtf.DiscussionForum.superclass.constructor.call(this,{title:"Discussion",iconCls:B.iconCls,layout:"fit",border:false,items:[{layout:"border",border:false,autoWidth:true,items:[this.ftree,{region:"south",height:225,border:false,layout:"fit",items:this.previewPanel,split:true}]}],tbar:this.tButnArr,bbar:this.pToolBar});this.on("render",this.renderDiscussion,this);this.ftree.on("cellclick1",this.ssetData,this);this.ftree.on("headerclick",this.handleSorting,this);this.previewPanel.on("UpdateDstore",this.syncDstore,this);this.ftree.on("cellcontextmenu",this.handleContext,this);this.ftree.getSelectionModel().on("rowselect",this.setSelectedRow,this);this.ftree.dstore.on("load",this.setStyle,this);this.ftree.on("mgContext",this.mContextParent,this);this.ftree.dstore.on("loadexception",this.ldException,this);this.ftree.dstore.on("beforeload",this.changeBasePara,this);this.ftree.on("cellclick",this.onClickHandle,this);this.ftree.on("rowdblclick",this.ondblClickHandle,this);this.deleteStore.on("load",this.deletePost,this);this.ftree.getSelectionModel().on("rowselect",this.rowSelHandle,this);this.ftree.getSelectionModel().on("rowdeselect",this.rowDeSelectHandle,this);dojo.cometd.subscribe("/"+this.id.substring(4)+"/forum",this,"forumPublishHandler")};Wtf.extend(Wtf.DiscussionForum,Wtf.Panel,{forumPublishHandler:function(msg){var temp=eval("("+msg.data.data+")");var temp1=Wtf.decode(temp.data[0]).data;var m=null;this.ftree.dstore.reload()},deletePost:function(D,E,C){if(E.length>0){this.getBottomToolbar().doLoad(Math.floor(this.getBottomToolbar().cursor/this.getBottomToolbar().pageSize)*this.getBottomToolbar().pageSize);for(var B=0;B<E.length;B++){var A=Wtf.getCmp("replywin"+E[B].data["tid"]);if(A!==undefined){A.ownerCt.remove(A,true)}A=Wtf.getCmp("pp"+E[B].data["tid"]);if(A!==undefined){A.ownerCt.remove(A,true)}}}},confirmDelete:function(A,L){if(A=="yes"){var E=this.ftree.getSelectionModel().getSelections();this.delStr="";for(var D=0;D<E.length;D++){var F=this.delStr.split(",");var M=false;for(var H=0;H<F.length;H++){if(F[H]==E[D].data["ID"]){M=true}}if(!M){this.delStr+=E[D].data["ID"]+","}var I=this.ftree.search(E[D].data["ID"],this.ftree);var K=this.ftree.dstore.getAt(I).data["Level"];for(var C=I+1;C<this.ftree.dstore.getCount();C++){var B=this.ftree.dstore.getAt(C);if(B.data["Level"]<=K){break}this.ftree.getSelectionModel().selectRow(C,true);var F=this.delStr.split(",");var G=false;for(var J=0;J<F.length-1;J++){if(F[J]==B.data["ID"]){G=true}}if(!G){this.delStr+=B.data["ID"]+","}}}this.delStr=this.delStr.substring(0,(this.delStr.length-1));this.deleteStore.load({params:{deleteId:this.delStr,flag:"delmsg"}})}},deleteMessage:function(B,A){if(this.ftree.getSelectionModel().getCount()>0){Wtf.MessageBox.confirm("Confirm","Sub Posts will also be deleted! Do you want to continue?",this.confirmDelete,this)}else{msgBoxShow(139,1)}},ondblClickHandle:function(E,H,F){var D=this.ftree.dstore.getAt(H).data["ID"];var B=this.ftree.dstore.getAt(H).data["Details"]+this.ftree.dstore.getAt(H).data["Attachment"];var G=Wtf.getCmp("pp"+D);if(G==null){var C=this.ftree.dstore.getAt(H).get("Subject")==""?"[No Subject]":WtfGlobal.URLDecode(this.ftree.dstore.getAt(H).get("Subject"));var G=new Wtf.MessagePanel({title:C,id:"pp"+D});var A=this.id.substring(4);if(this.projectFlag){Wtf.getCmp("subtabpanelcomprojectTabs_"+A).add(G).show()}else{Wtf.getCmp("sub"+A).add(G).show()}G.ownerCt.doLayout();G.setData1("","","",'<div class="loading-indicator">&#160;Loading...</div>',"");G.messageId=D;G.setData(this.ftree.dstore.getAt(H).get("Subject"),this.ftree.dstore.getAt(H).get("From"),this.ftree.dstore.getAt(H).get("Received").format(WtfGlobal.getDateFormat()),this.ftree.dstore.getAt(H).get("Image"),this.ftree.dstore.getAt(H).get("User_Id"));if(D.match("topic")){var I=D.substring(5);if(B==""){G.topicstore.loadForum(I,1,"forum",this.ftree.dstore.getAt(H).data["User_Id"])}else{G.loadCacheData(B)}}else{if(B==""){G.topicstore.loadForum(D,2,"forum",this.ftree.dstore.getAt(H).data["User_Id"])}else{G.loadCacheData(B)}}}else{G.show();G.loadCacheData(B)}},rowSelHandle:function(D,A,C){if(D.getSelections().length>1){this.previewPanel.clearContents()}else{var B=this.ftree.dstore.getAt(A);if(!B.data.ifread){B.data.ifread=true}this.ftree.fireEvent("cellclick1",B.data["Subject"],B.data["From"],B.data["Received"],B.data["Image"],B.data["ID"],B.data["User_Id"],A)}},rowDeSelectHandle:function(E,A,D){if(E.getSelections().length>1||!(E.hasSelection())){this.previewPanel.clearContents()}else{if(E.getSelections().length==1){var C=this.ftree.getSelectionModel().getSelected();var B=this.ftree.dstore.indexOf(C);this.rowSelHandle(E,B,D)}}},onClickHandle:function(D,B,C,G){D.row=B;D.col=C;var A=0;var H=G.target;var F=this.ftree.dstore.getAt(B).data["ID"];if(D.col==(this.styleHelper+3)){if(H.className==="greyflag"){H.className="redflag";A=1}else{if(H.className==="redflag"){H.className="greyflag"}}Wtf.Ajax.requestEx({url:"jspfiles/portal/deleteMessage.jsp",params:{flag:"forumflag",postid:F,value:A}})}else{if((H.className=="forum_plus"||H.className=="forum_minus")&&D.col==this.styleHelper){D.CollExp(G.target,B,this.styleHelper)}else{var E=this.ftree.getView();this.makeRead(E,D.row,this.styleHelper)}}},changeBasePara:function(B,A){B.baseParams={searchText:this.searchText,sortFlag:this.ftree.flagArray[this.ftree.col],col:this.ftree.col,limit:this.pToolBar.pageSize,groupId:this.id.substring(4)}},ldException:function(){this.previewPanel.ownerCt.doLayout()},mContextParent:function(A){this.checkReplyWindow(this)},setStyle:function(I,D,B){var G=[];var H=0;for(var F=0;F<I.getCount();F++){if(D[F].data["Level"]==0&&D[F].data["Parent"]==0){H++}if(G[parseInt(D[F].data["Level"])-1]==D[F].data["Parent"]){this.ftree.getView().getCell(F,0).parentNode.parentNode.parentNode.parentNode.style.display="none"}if(D[F+1]){if(D[F].data["ID"]==D[F+1].data["Parent"]){G[D[F].data["Level"]]=D[F].data["ID"];this.ftree.getView().getCell(F,this.styleHelper).firstChild.firstChild.className="forum_plus"}}var J=this.ftree.getView();J.getCell(F,this.styleHelper).firstChild.style.marginLeft=18*parseInt(D[F].data["Level"])+"px";if(!D[F].data["ifread"]){var A=D[F].data["Level"];var C=D[F].data["Parent"];this.makeUnread(J,F,this.styleHelper);while(A>0){for(var E=F;E>=0;E--){if(C==D[E].data["ID"]){this.makeUnread(J,E,this.styleHelper);C=D[E].data["Parent"];A--;break}}}}}if(this.ftree.jReader.jsonData["forumCount"]){this.getBottomToolbar().displayEl.update("Displaying threads "+parseInt(B.params["start"]+1)+" - "+parseInt(H+B.params["start"])+" of "+this.ftree.jReader.jsonData["forumCount"])}this.pageLimit.totalSize=this.ftree.jReader.jsonData["forumCount"];this.previewPanel.ownerCt.doLayout();this.ftree.ownerCt.doLayout();this.previewPanel.clearContents();this.previewPanel.addListener("click",function(L,M){var K=L.target;if(K.tagName=="A"&&K.href.match("http://")){window.open(K.href);L.preventDefault()}},this);this.ftree.getSelectionModel().selectFirstRow()},makeUnread:function(A,C,D,B){A.getCell(C,D).firstChild.style.fontWeight="bold";A.getCell(C,D+1).firstChild.style.fontWeight="bold";A.getCell(C,D+2).firstChild.style.fontWeight="bold";A.getCell(C,D).firstChild.childNodes[1].firstChild.src=this.msgUnreadImg},makeRead:function(A,B,C){A.getCell(B,C).firstChild.style.fontWeight="normal";A.getCell(B,C+1).firstChild.style.fontWeight="normal";A.getCell(B,C+2).firstChild.style.fontWeight="normal";A.getCell(B,C).firstChild.childNodes[1].firstChild.src=this.msgReadImg},handleActivate:function(A){A.pageLimit.combo.on("select",A.setIndex,A)},setSelectedRow:function(A,C,B){this.selectedRow=C},setIndex:function(D,E,B){if((this.curComboIndex>=B)||(this.curComboIndex==0)){var G=[];var C=0;var A=this.ftree.getView();for(i=0;i<this.ftree.dstore.getCount();i++){var F=this.ftree.dstore.getAt(i);if(!F.data["ifread"]){this.makeUnread(A,i,this.styleHelper,true);for(j=i;j>=0;j--){if(F.data["Parent"]==this.ftree.dstore.getAt(j).data["ID"]){this.makeUnread(A,j,this.styleHelper,true)}}}if(G[parseInt(F.data["Level"])-1]==F.data["Parent"]){A.getCell(i,0).parentNode.parentNode.parentNode.parentNode.style.display="none"}if(this.ftree.dstore.getAt(i+1)){if(F.data["ID"]==this.ftree.dstore.getAt(i+1).data["Parent"]){G[F.data["Level"]]=F.data["ID"];A.getCell(i,this.styleHelper).firstChild.firstChild.className="forum_plus"}}A.getCell(i,this.styleHelper).firstChild.style.marginLeft=18*parseInt(F.data["Level"])+"px";if(F.data["Level"]==0&&F.data["Parent"]==0){C++}}}},handleContext:function(B,H,C,E){var G=null;var F=Array();if(!this.archived&&!this.postMessagePerm){F.push(new Wtf.menu.Item({id:"newReply",iconCls:"pwnd outboxCx",text:"Reply",handler:function D(){B.fireEvent("mgContext",H)}}))}if(!this.archived&&!this.moderateMessagePerm){F.push(new Wtf.menu.Item({id:"conDelete",iconCls:"pwnd delicon",text:"Delete",scope:this,handler:function A(){this.deleteMessage(null,null)}}))}this.ftree.getSelectionModel().selectRow(H);if(F.length>0){if(!G){G=new Wtf.menu.Menu({id:"context",height:18,items:F})}G.showAt(E.getXY())}E.preventDefault()},handleSorting:function(D,A,C){this.isClearTopic=(A==0)?true:false;var B=function(F,G,E){F.col=G;F.dstore.load({params:{start:0,limit:(E.pageLimit&&E.pageLimit.combo)?(E.pageLimit.combo.getValue()||E.msgLmt):E.msgLmt}});if(F.flagArray[G]=="ASC"){F.flagArray[G]="DESC"}else{F.flagArray[G]="ASC"}};if(this.styleHelper==1){if(A!=0){B(D,A-1,this)}}else{B(D,A,this)}},syncDstore:function(B,C,D){for(var A=0;A<this.ftree.dstore.getCount();A++){var E=this.ftree.dstore.getAt(A);if(E.data["ID"]==D){E.data["Details"]=B;E.data["Attachment"]=C;this.makeRead(this.ftree.getView(),A,this.styleHelper);break}if(E.data["ID"]=="topic"+D){E.data["Details"]=B;E.data["Attachment"]=C;this.makeRead(this.ftree.getView(),A,this.styleHelper);break}}},renderDiscussion:function(A){A.ftree.dstore.load({params:{start:0,limit:(this.pageLimit&&this.pageLimit.combo)?(this.pageLimit.combo.getValue()||this.msgLmt):this.msgLmt}});A.pageLimit.combo.on("select",A.setIndex,A);Wtf.EventManager.addListener("searchtextbox"+this.id,"keyup",this.txtsearchKeyPress,this)},ssetData:function(H,J,G,E,B,D,K){var F="forum";this.previewPanel.setData1("","","",'<div class="loading-indicator">&#160;Loading...</div>',"");this.previewPanel.messageId=B;var C=this.ftree.dstore.getAt(K);var A=C.data["Details"]+C.data["Attachment"];if(B.match("topic")){var I=B.substring(5);if(A==""){this.previewPanel.topicstore.loadForum(I,1,F,C.data["User_Id"])}else{this.previewPanel.loadCacheData(A)}}else{if(A==""){this.previewPanel.topicstore.loadForum(B,2,F,C.data["User_Id"])}else{this.previewPanel.loadCacheData(A)}}this.previewPanel.setData(H,J,G.format(WtfGlobal.getDateFormat()),E,D)},searchForum:function(){this.searchText=encodeURIComponent(this.searchField.getValue().trim());var A=(this.pageLimit&&this.pageLimit.combo)?(this.pageLimit.combo.getValue()||this.msgLmt):this.msgLmt;var C=function(D){D.load({params:{start:0,limit:A}})};var B=this.ftree.dstore;if(this.searchText.length>0){C(B);this.mailSearchFlag=false}else{if(!this.mailSearchFlag){C(B);this.mailSearchFlag=true}}},checkReplyWindow:function(F){var A=null;var G=F.ftree.getSelectionModel().getSelected();var D="2";if(G.data["Parent"]==0&&G.data["Level"]==0){D="1"}var B=this.id.substring(4);var E=Wtf.getCmp("subtabpanelcomprojectTabs_"+B);if(!this.projectFlag){E=Wtf.getCmp("sub"+B).add(this.wind)}var C=Wtf.getCmp("replywin"+G.data["ID"]);if(C===undefined){this.wind=new Wtf.ReplyWindow({uLabel:"Reply To",bLabel:"Title",tdisabled:true,id:"replywin"+G.data["ID"],title:"Reply",replytoId:G.data["ID"],userId:loginid,closable:true,tabWidth:150,groupId:F.id.substring(4),firstReply:D,uFieldValue:G.data["From"],bFieldValue:WtfGlobal.URLDecode(G.data["Subject"]),type:"Forum",projectFlag:this.projectFlag,details:G.data["Details"],replyds:this.ftree.dstore});E.add(this.wind)}else{this.wind=C}E.setActiveTab(this.wind)},ReplyWindow:function(B,A){if(this.ftree.getSelectionModel().getCount()==1){this.checkReplyWindow(this,null)}else{if(this.ftree.getSelectionModel().getCount()>1){msgBoxShow(158,1)}else{msgBoxShow(139,1)}}},createNewTopicWindow:function(F,E){var B="Community";if(this.projectFlag){B="Project"}var D=this.id.substring(4);var C=this.ownerCt;if(!this.projectFlag){C=Wtf.getCmp("sub"+D)}var A=Wtf.getCmp("replywin_newTopic");if(A===undefined){this.wind=new Wtf.ReplyWindow({uLabel:B,bLabel:"Title",tdisabled:true,closable:true,id:"replywin_newTopic",replytoId:"-999",userId:loginid,title:"New Thread",tabWidth:150,groupId:D,uFieldValue:"NewTopic",bFieldValue:"",firstReply:"0",rowIndex:"0",type:"Forum",id1:"wind"+D,projectFlag:this.projectFlag,replyds:this.ftree.dstore});C.add(this.wind)}else{this.wind=A}C.setActiveTab(this.wind)},txtsearchKeyPress:function(A){this.txt=A.getTarget().value;this.dtask.cancel();this.dtask.delay(500,this.searchForum,this)}});createNewChart=function(E,B,A,I,F,H,D,J,G){var C=new SWFObject(E,B,A,I,F,H);C.addVariable("settings_file",encodeURIComponent(D));C.addVariable("data_file",encodeURIComponent(J));C.addVariable("preloader_color","#999999");C.write(G)};if(typeof deconcept=="undefined"){var deconcept=new Object()}if(typeof deconcept.util=="undefined"){deconcept.util=new Object()}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object()}deconcept.SWFObject=function(L,B,K,D,H,I,F,E,C,J){if(!document.getElementById){return }this.DETECT_KEY=J?J:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(L){this.setAttribute("swf",L)}if(B){this.setAttribute("id",B)}if(K){this.setAttribute("width",K)}if(D){this.setAttribute("height",D)}if(H){this.setAttribute("version",new deconcept.PlayerVersion(H.toString().split(".")))}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true}if(I){this.addParam("bgcolor",I)}var A=F?F:"high";this.addParam("quality",A);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var G=(E)?E:window.location;this.setAttribute("xiRedirectUrl",G);this.setAttribute("redirectUrl","");if(C){this.setAttribute("redirectUrl",C)}};deconcept.SWFObject.prototype={useExpressInstall:function(A){this.xiSWFPath=!A?"expressinstall.swf":A;this.setAttribute("useExpressInstall",true)},setAttribute:function(A,B){this.attributes[A]=B},getAttribute:function(A){return this.attributes[A]},addParam:function(B,A){this.params[B]=A},getParams:function(){return this.params},addVariable:function(B,A){this.variables[B]=A},getVariable:function(A){return this.variables[A]},getVariables:function(){return this.variables},getVariablePairs:function(){var C=new Array();var B;var A=this.getVariables();for(B in A){C[C.length]=B+"="+A[B]}return C},getSWFHTML:function(){var B="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath)}B='<embed type="application/x-shockwave-flash" src="'+this.getAttribute("swf")+'" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+'"';B+=' id="'+this.getAttribute("id")+'" name="'+this.getAttribute("id")+'" ';var F=this.getParams();for(var E in F){B+=[E]+'="'+F[E]+'" '}var D=this.getVariablePairs().join("&");if(D.length>0){B+='flashvars="'+D+'"'}B+="/>"}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath)}B='<object id="'+this.getAttribute("id")+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+'">';B+='<param name="movie" value="'+this.getAttribute("swf")+'" />';var C=this.getParams();for(var E in C){B+='<param name="'+E+'" value="'+C[E]+'" />'}var A=this.getVariablePairs().join("&");if(A.length>0){B+='<param name="flashvars" value="'+A+'" />'}B+="</object>"}return B},write:function(B){if(this.getAttribute("useExpressInstall")){var A=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(A)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title)}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var C=(typeof B=="string")?document.getElementById(B):B;C.innerHTML=this.getSWFHTML();if(!(navigator.plugins&&navigator.mimeTypes.length)){window[this.getAttribute("id")]=document.getElementById(this.getAttribute("id"))}return true}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"))}}return false}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var E=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var A=navigator.plugins["Shockwave Flash"];if(A&&A.description){E=new deconcept.PlayerVersion(A.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var B=1;var C=3;while(B){try{C++;B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+C);E=new deconcept.PlayerVersion([C,0,0])}catch(D){B=null}}}else{try{var B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(D){try{var B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");E=new deconcept.PlayerVersion([6,0,21]);B.AllowScriptAccess="always"}catch(D){if(E.major==6){return E}}try{B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(D){}}if(B!=null){E=new deconcept.PlayerVersion(B.GetVariable("$version").split(" ")[1].split(","))}}}return E};deconcept.PlayerVersion=function(A){this.major=A[0]!=null?parseInt(A[0]):0;this.minor=A[1]!=null?parseInt(A[1]):0;this.rev=A[2]!=null?parseInt(A[2]):0};deconcept.PlayerVersion.prototype.versionIsValid=function(A){if(this.major<A.major){return false}if(this.major>A.major){return true}if(this.minor<A.minor){return false}if(this.minor>A.minor){return true}if(this.rev<A.rev){return false}return true};deconcept.util={getRequestParameter:function(C){var D=document.location.search||document.location.hash;if(C==null){return D}if(D){var B=D.substring(1).split("&");for(var A=0;A<B.length;A++){if(B[A].substring(0,B[A].indexOf("="))==C){return B[A].substring((B[A].indexOf("=")+1))}}}return""}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var B=document.getElementsByTagName("OBJECT");for(var C=B.length-1;C>=0;C--){B[C].style.display="none";for(var A in B[C]){if(typeof B[C][A]=="function"){B[C][A]=function(){}}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs)};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true}}if(!document.getElementById&&document.all){document.getElementById=function(A){return document.all[A]}}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;Wtf.app.SearchField=Wtf.extend(Wtf.form.TwinTriggerField,{initComponent:function(){Wtf.app.SearchField.superclass.initComponent.call(this);this.on("specialkey",function(A,B){if(B.getKey()==B.ENTER){this.onTrigger2Click()}},this)},validationEvent:false,validateOnBlur:false,trigger1Class:"x-form-clear-trigger",trigger2Class:"x-form-search-trigger",hideTrigger1:true,width:180,hasSearch:false,paramName:"query",onTrigger1Click:function(){if(this.hasSearch){var A={start:0};A[this.paramName]="";this.store.reload({params:A});this.el.dom.value="";this.triggers[0].hide();this.hasSearch=false}},onTrigger2Click:function(){var A=this.getRawValue();if(A.length<1){this.onTrigger1Click();return }var B={start:0};B[this.paramName]=A;this.store.reload({params:B});this.hasSearch=true;this.triggers[0].show()}});Wtf.Notifier=function(){var B;function A(C,D){return['<div class="msg">','<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>','<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><h3>',C,"</h3>",D,"</div></div></div>",'<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',"</div>"].join("")}return{notify:function(E,F){if(!B){B=Wtf.DomHelper.insertFirst(document.body,{id:"msg-div"},true)}B.alignTo(document,"br-br");var D=String.format.apply(String,Array.prototype.slice.call(arguments,1));var C=Wtf.DomHelper.append(B,{html:A(E,D)},true);C.slideIn("b",{duration:0.2,easing:"easeIn"}).pause(3).ghost("b",{remove:true})}}}();var userTabs=[];var projectTabs=[];var mainPanel;var deskeraAdmin=false;var numTabs=1;var companyName="";var pagebaseURL="";Wtf.CurrencySymbol="\u0024";Wtf.ux.ContentPanel=function(A){Wtf.apply(this,A);Wtf.ux.ContentPanel.superclass.constructor.call(this,A)};Wtf.extend(Wtf.ux.ContentPanel,Wtf.Panel,{closable:true,autoScroll:true});Wtf.ux.MainPanel=function(A){Wtf.ux.MainPanel.superclass.constructor.call(this,A)};Wtf.extend(Wtf.ux.MainPanel,Wtf.TabPanel,{loadTab:function(B,E,D,I,K,H,G,L){var A="tab"+E.substr(3);var F=this.getComponent(A);if(F){this.setActiveTab(F);if(G){F.activesubtab=G;if(F.tabType==Wtf.etype.proj){if(typeof G=="string"){Wtf.getCmp("projectTabs_"+F.id.substr(3)).pro.fireEvent(G)}else{Wtf.getCmp("projectTabs_"+F.id.substr(3)).pro.fireEvent(G.event)}}if(A=="tabcompanyadminpanel"){Wtf.getCmp("mainAdmin").fireEvent(G)}}}else{if(B=="project.html"&&Wtf.subscription.cal.subscription&&!calLoad&&Wtf.featuresView.cal){WtfGlobal.loadScript("scripts/minified/calendar.js?v=19")}var J={tabid:A,url:B,scripts:true};var C=new Wtf.ux.ContentPanel({id:A,title:D,autoLoad:J,navarea:I,layout:"fit",tabType:K,closable:L!=null?L:true,iconCls:getTabIconCls(K)});if(H){switch(K){case Wtf.etype.comm:communityTabs.push(C);break;case Wtf.etype.proj:projectTabs.push(C);break;case Wtf.etype.user:userTabs.push(C);break;case Wtf.etype.lms:courseTabs.push(C);break;case Wtf.etype.acc:accountingTabs.push(C);break}}this.add(C);this.setActiveTab(C);if(G){C.activesubtab=G}Wtf.getCmp(A).on("hide",function(){var M=Wtf.getCmp("Expand");if(M!=undefined){M.hide()}},this)}}});function getTabIconCls(A){switch(A){case Wtf.etype.home:return"pwnd dashboardTabIcon";break;case Wtf.etype.comm:return"pwnd communityTabIcon";break;case Wtf.etype.proj:return"pwnd projectTabIcon";break;case Wtf.etype.user:return"pwnd userTabIcon";break;case Wtf.etype.docs:return"pwnd doctabicon";break;case Wtf.etype.cal:return"pwnd teamcal";break;case Wtf.etype.forum:return"pwnd communitydiscuss";break;case Wtf.etype.pmessage:return"pwnd pmsgicon";break;case Wtf.etype.pplan:return"pwnd projplan";break;case Wtf.etype.adminpanel:return"pwnd admintab";break;case Wtf.etype.todo:return"pwnd todolistpane";break;case Wtf.etype.search:return"pwnd searchtabpane";break;case Wtf.etype.contacts:return"pwnd contactsTabIcon";break;case Wtf.etype.crm:return"crmTabIcon";break}}Wtf.ProjSubscrib=function(A){Wtf.apply(this,A);this.subRec=Wtf.data.Record.create([{name:"subid"},{name:"billdate"},{name:"frequency"},{name:"numproj"},{name:"rate"},{name:"flag"}]);this.subscrStore=new Wtf.data.Store({url:"admin.jsp",baseParams:{action:3,mode:1},id:"subscrdstore",autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data"},this.subRec)});this.subscrStore.on("load",function(){Wtf.getCmp("subscribDataView").refresh()},this);Wtf.ProjSubscrib.superclass.constructor.call(this,{title:"Subscribe",modal:true,iconCls:"iconwin",width:530,height:485,resizable:false,buttonAlign:"right",bodyStyle:"background:#f1f1f1;",buttons:[{text:"Close",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getTopHtml("Subscribe","Click on date to see invoice and payment receipts.")},{region:"center",border:false,autoScroll:true,bodyStyle:"background:#f1f1f1;",layout:"border",items:[{region:"north",height:40,border:false,autoScroll:false,labelWidth:70,items:[{xtype:"panel",autoScroll:false,autoDestroy:true,border:false,html:"<div class='listpanelcontent' style ='font-weight:bold;'><span class='holidaySpan' style = 'width:150px;'>Subscribed on</span><span class='holidaySpan' style = 'width:90px;'>Project Count</span><span class='holidaySpan' style = 'width:70px;'>Rate ($/Month)</span><span class='holidaySpan' style = 'width:90px;'>Billing Cycle (Months)</span><span class='holidaySpan' style = 'width:50px;'>Cancel</span></div>"}]},{region:"center",border:false,bodyStyle:"border-bottom:1px solid #bfbfbf;",autoScroll:true,items:[{xtype:"dataview",id:"subscribDataView",autoScroll:true,itemSelector:"companysubscrib",tpl:new Wtf.XTemplate('<div class="listpanelcontent"><tpl for=".">{[this.f(values)]}</tpl></div>',{f:function(C){var B="";if(C.subid!="0"){B="<div><a href='#' class='mailTo' onclick='subscribeInvoice(\""+C.subid+"\")'><span class='holidaySpan' style = 'width:150px;'>"+Date.parseDate(C.billdate,"Y-m-d h:i:s.0").format(WtfGlobal.getDateFormat())+"</span></a>"}else{B="<div><span class='holidaySpan' style = 'width:150px;'>"+Date.parseDate(C.billdate,"Y-m-d h:i:s.0").format(WtfGlobal.getDateFormat())+"</span>"}B+="<span class='holidaySpan' style = 'width:90px;'>"+C.numproj+"</span><span class='holidaySpan' style = 'width:70px;'>"+C.rate+"</span><span class='holidaySpan' style = 'width:90px;'>"+C.frequency+"</span>";if(C.flag=="1"){B+="<img src='images/Delete.png' class='holidayDelete' onclick=\"cancelSubsci(this,'"+this.scope.id+"')\" id='del_"+C.subid+"' title='Cancel Subscription'>"}B+="<div><span class='holidayDiv' style = 'width:450px !important;'></span></div></div>";return B},scope:this}),store:this.subscrStore}]},{region:"south",autoScroll:false,height:110,border:false,items:[{border:false,html:'<div style="color:#666;margin:8px;">Select number of projects to subscribe</div>'},new Wtf.Panel({border:false,html:this.formcontent})]}]}]})};Wtf.extend(Wtf.ProjSubscrib,Wtf.Window,{cancelSubsci:function(subid){Wtf.Ajax.requestEx({url:"admin.jsp",params:{action:3,mode:2,subid:subid}},this,function(result,req){var res=eval("("+result+")");if(res.success){this.subscrStore.load()}else{msgBoxShow([0,"Error occured at server side"],1)}})}});Wtf.onReady(function(){validateServerSession();mainPanel=new Wtf.ux.MainPanel({id:"as",region:"center",deferredRender:false,resizeTabs:true,minTabWidth:155,loadMask:new Wtf.LoadMask(document.body,Wtf.apply(this.loadMask)),cls:"ascls",titleCollapse:true,activeTab:0,enableTabScroll:true,items:[new Wtf.ux.ContentPanel({id:"tabdashboard",title:WtfGlobal.chkFirstRun()?"Welcome to Deskera":"Dashboard",navarea:"navareadashboard",closable:false,autoLoad:{url:"jspfiles/dashboard.jsp?refresh=false",scripts:true},iconCls:getTabIconCls(Wtf.etype.home),tabType:Wtf.etype.home})]});Wtf.getCmp("tabdashboard").on("activate",function(){if(bHasChanged){Wtf.getCmp("tabdashboard").load({url:"jspfiles/dashboard.jsp?refresh=false",scripts:true});bHasChanged=false}},this);var A=new Wtf.Viewport({layout:"border",items:[new Wtf.BoxComponent({region:"north",el:"header"}),mainPanel]});var B=new Wtf.KWLSearchBar({id:"searchTopPanel",renderTo:"searchBar",autoWidth:true,layout:"table",border:false,document:Wtf.subscription.docs?Wtf.subscription.docs.subscription:Wtf.subscription.docs,documentView:Wtf.featuresView.docs,bodyStyle:"float:right;"});A.doLayout();Wtf.useShims=true;Wtf.QuickTips.init()});function setUsername(B){var A=document.getElementById("whoami");A.innerText=B;A.textContent=B;if(!WtfGlobal.EnableDisable(Wtf.UPerm.User,Wtf.Perm.User.ManageUser)||!WtfGlobal.EnableDisable(Wtf.UPerm.User,Wtf.Perm.User.AddUserToProject)||!WtfGlobal.EnableDisable(Wtf.UPerm.Project,Wtf.Perm.Project.ManageProject)||!WtfGlobal.EnableDisable(Wtf.UPerm.Project,Wtf.Perm.Project.ManageMember)||!WtfGlobal.EnableDisable(Wtf.UPerm.Company,Wtf.Perm.Company.EditCompany)||!WtfGlobal.EnableDisable(Wtf.UPerm.Company,Wtf.Perm.Company.ChangeCompanyLogo)){addToXCuts("#","Administration","loadAdminPage();");addToXCuts("#","Subscribe","subscribeForProject();")}if(Wtf.subscription.pm.subscription&&Wtf.featuresView.pm){var C=document.getElementById("userinfo");C.innerHTML+='&nbsp;&nbsp;<a href="#" onclick="navigate(\'pm\');">Personal Messages</a>'}addToXCuts("#","Send Invitation","sendInvitation();")}function sendInvitation(){this.inviteWindow=new Wtf.Window({title:"Invite User",modal:true,iconCls:"iconwin",width:450,height:395,resizable:false,buttonAlign:"right",buttons:[{text:"Invite",scope:this,handler:function(){if(this.inviteUser.form.isValid()){this.inviteUser.form.submit({scope:this,success:function(){msgBoxShow(79,0);this.inviteWindow.close()},failure:function(B,A){if(A.failureType=="client"){msgBoxShow(80,1);return }msgBoxShow(81,1);this.inviteWindow.close()}})}}},{text:"Cancel",scope:this,handler:function(){this.inviteWindow.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getTopHtml("Invite User","Invite a friend to join Deskera")},{region:"center",border:false,bodyStyle:"background:#f1f1f1;font-size:10px;",layout:"fit",items:[this.inviteUser=new Wtf.form.FormPanel({url:"signup.jsp?mode=2&u="+loginid,waitMsgTarget:true,method:"POST",border:false,labelWidth:100,bodyStyle:"margin-top:20px;margin-left:20px;font-size:10px;",defaults:{width:398,allowBlank:false},defaultType:"textfield",items:[{fieldLabel:"First Name*",validator:WtfGlobal.validateUserName,allowBlank:false,width:200,name:"fn"},{fieldLabel:"Last Name*",validator:WtfGlobal.validateUserName,allowBlank:false,width:200,name:"ln"},{fieldLabel:"Email Address*",width:200,name:"e",validator:WtfGlobal.validateEmail},{xtype:"fieldset",title:"Include a personal note",autoHeight:true,cls:"inviteFieldSet",items:[{xtype:"textarea",hideLabel:true,height:90,width:376,name:"msg",id:"invitationBody",value:"Hi,\n\tI have been using Deskera and thought you should check it out.\n\tDeskera is a Project Management Tool which aims at making life easy for us business users."}]}]})]}]});Wtf.getCmp("invitationBody").on("change",function(){Wtf.getCmp("invitationBody").setValue(WtfGlobal.HTMLStripper(Wtf.getCmp("invitationBody").getValue()))},this);this.inviteWindow.show()}function loadAdminPage(B){var A="adminclicked";switch(B){case"1":A="adminclicked";break;case 1:A="adminclicked";break;case"2":A="projectclicked";break;case 2:A="projectclicked";break;case"3":A="companyclicked";break;case 3:A="companyclicked";break}if(!WtfGlobal.EnableDisable(Wtf.UPerm.User,Wtf.Perm.User.ManageUser)||!WtfGlobal.EnableDisable(Wtf.UPerm.User,Wtf.Perm.User.AddUserToProject)||!WtfGlobal.EnableDisable(Wtf.UPerm.Project,Wtf.Perm.Project.ManageProject)||!WtfGlobal.EnableDisable(Wtf.UPerm.Project,Wtf.Perm.Project.ManageMember)||!WtfGlobal.EnableDisable(Wtf.UPerm.Company,Wtf.Perm.Company.EditCompany)||!WtfGlobal.EnableDisable(Wtf.UPerm.Company,Wtf.Perm.Company.ChangeCompanyLogo)){mainPanel.loadTab("admin.html","   companyadminpanel","Administration","navareadashboard",Wtf.etype.adminpanel,false,A)}}function signOut(B){var A="";if(B!==undefined&&typeof B!="object"){A="?type="+B}_dC("lastlogin");_dC("featureaccess");_dC("username");_dC("lid");_r(Wtf.req.base+"signOut.jsp"+A)}function _dC(A){document.cookie=A+"=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT"}function getPermissionObjects(permobj){var wrapobj=eval("("+permobj+")");if(wrapobj.Perm){Wtf.Perm=wrapobj.Perm}if(wrapobj.UPerm){Wtf.UPerm=wrapobj.UPerm}if(wrapobj.deskeraadmin){deskeraAdmin=true}}function getSubscriptionObjects(permobj){var moduleObj=eval("("+permobj+")");if(moduleObj){Wtf.subscription=moduleObj}Wtf.getCmp("searchTopPanel").setDocumentValue(Wtf.subscription.docs.subscription)}function getFeaturesView(featuresobj){var featureObj=eval("("+featuresobj+")");if(featureObj.featureView){Wtf.featuresView=featureObj.featureView}Wtf.getCmp("searchTopPanel").setDocumentViewValue(Wtf.featuresView.docs)}function validateServerSession(){Wtf.Ajax.requestEx({url:Wtf.req.base+"validate.jsp",params:{blank:-1}},this,function(result,req){var res=eval("("+result+")");getPermissionObjects(res.perm.trim());getSubscriptionObjects(res.modsub.trim());getFeaturesView(res.featureView.trim());if(res){if(!deskeraAdmin){setUsername(res.fullname);Wtf.pref=res.preferences[0];setValidUserVariables(res.validuseroptions);addToXCuts(res.forum_base_url,"Forum");addToXCuts("http://blog.deskera.com","Blog");addSignUplink();loginid=res.lid;loginname=res.username;companyid=res.companyid;document.cookie="featureaccess="+eval("("+res.perm.trim()+")").UPerm.Features+";path=/;";dojo.cometd.init("bind");var chatsubstr="/"+loginid+"/chat";dojo.cometd.subscribe(chatsubstr,this,"globalchatPublishHandler");var txtSrch=Wtf.getCmp("textSearch");companyName=res.company;pagebaseURL=res.base_url;txtSrch.emptyText="Search on "+companyName;txtSrch.reset()}else{WtfGlobal.loadScript("scripts/minified/superUser.js");WtfGlobal.loadStyleSheet("style/companystat.css")}}else{signOut()}},signOut)}function addSignUplink(){var D=window.top.location.href.split("?");if(D[1]){var C=D[1].split("&");for(var B=0;B<C.length;B++){var A=C[B].split("=");if(A[0]=="demo"&&A[1]=="true"){addToXCuts("#","Signup","newSignUp();")}}}}function newSignUp(){signOut("signup")}function addToXCuts(A,B,C){Wtf.DomHelper.append("shortcuts","<a "+(C?('onclick="'+C):('target="_blank'))+'" href="'+A+'" title="'+B+'">'+B+"</a>| ")}function setValidUserVariables(obj){var values=eval("("+obj+")");Wtf.CurrencySymbol=values.currencysymbol;var mailtoId=values.supprotlink;addToXCuts("mailto:"+values.supprotlink,"Support");document.getElementById("companyLogo").alt=values.companyname;if(Wtf.UPerm.Company!==undefined&&(!WtfGlobal.EnableDisable(Wtf.UPerm.Company,Wtf.Perm.Company.EditCompany)||!WtfGlobal.EnableDisable(Wtf.UPerm.Company,Wtf.Perm.Company.ChangeCompanyLogo))){document.getElementById("companyLogo").style.cursor="pointer";document.getElementById("companyLogo").onclick=loadAdminPage.createDelegate(this,["3"])}document.getElementById("Deskeratitle").text=values.companyname+" Workspace - Deskera"}function globalchatPublishHandler(msg){if(Wtf.getCmp("contactsview")!=null){Wtf.getCmp("contactsview").chatPublishHandler(msg)}else{var temp=eval("("+msg.data.data+")");var temp1=Wtf.decode(temp.data[0]).data;if(temp1[0].mode!="msg"){if(temp1[0].mode=="offline"){var _chatWin=Wtf.getCmp("chatWin"+temp1[1].userid);if(_chatWin!=null){_chatWin.setIconClass("K-iconOffline")}}else{if(temp1[0].mode=="online"){if(temp1[1].status=="request"){Wtf.Ajax.requestEx({url:Wtf.req.prt+"getFriendListDetails.jsp",params:{userid:loginid,mode:"2",remoteUser:temp1[1].userid}},this)}}}}else{var _chatWin=Wtf.getCmp("chatWin"+temp1[0].id);if(_chatWin){_chatWin.insertmsg(temp1[0].message,2);_chatWin.show()}else{var winChat=new Wtf.ChatWindow({id:"chatWin"+temp1[0].id,remotepersonid:temp1[0].id,remotepersonname:temp1[0].uname,iconCls:"K-icon",title:"Conversation with "+temp1[0].uname,chatstore:false});winChat.show();Wtf.getCmp("chatWin"+temp1[0].id).insertmsg(temp1[0].message,2)}}}}function showPersnProfile(){var A=Wtf.getCmp("pprofwin");if(!A){new Wtf.Profile().show()}}function invokeTagSearch(A){Wtf.getCmp("textSearch").setValue("tag:"+A.innerHTML);Wtf.getCmp("searchTopPanel").onButtonClick()}function displayChatList(){var A=Wtf.getCmp("chatListWindow");var C=document.getElementById("chatlistcontainer").offsetLeft;var B=document.getElementById("chatlistcontainer").offsetTop+document.getElementById("chatlistcontainer").offsetHeight;if(A.innerpanel==null||A.hidden==true){A.setPosition(C,B);A.show();A.showChatList()}else{A.hide()}}function subscribeForProject(){Wtf.Ajax.requestEx({url:"admin.jsp",params:{action:3,mode:4}},this,function(result,req){var res=eval("("+result+")");new Wtf.ProjSubscrib({rate:res.data[0].projrate,guid:res.data[0].subid,formcontent:res.data[0].formcontent}).show()},function(result,req){})}function subscribeInvoice(A){var G=new Wtf.data.Record.create([{name:"num"},{name:"paymentdate",type:"date",dateFormat:"Y-m-d"},{name:"subid"},{name:"amount"},{name:"receipt"}]);var F=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},G);var B=new Wtf.data.Store({url:"admin.jsp",reader:F,method:"POST",baseParams:{action:3,mode:3,subid:A}});var D=new Wtf.grid.ColumnModel([{header:"Invoice No",dataIndex:"num",renderer:function(I){return"<a href = '#' class='printInvoice' > "+I+"</a>"}},{header:"Invoice Date",dataIndex:"paymentdate",renderer:function(I){return I.format(WtfGlobal.getDateFormat())}},{header:"Receipt",dataIndex:"receipt",renderer:function(I){if(I.length>0){return"<a href = '#' class='printInvoice' > "+I+"</a>"}else{return"<span>Pending<span>"}}},{header:"Amount",dataIndex:"amount",align:"right"}]);var E=new Wtf.grid.GridPanel({store:B,cm:D,layout:"fit",autoHeight:true,sm:new Wtf.grid.RowSelectionModel({singleSelect:true}),border:false,loadMask:true,viewConfig:{forceFit:true}});E.on("cellclick",function(J,M,I,K){if(K.target.className=="printInvoice"){var L=J.getStore().getAt(M);if(I==0){printInvoice(L.data.num,L.data.subid,1,L.data.paymentdate.format("Y-m-d"))}else{if(I==2){printInvoice(L.data.receipt,L.data.subid,2,L.data.num)}}}},this);var C=new Wtf.common.KWLListPanel({title:"Following invoices/receipts are generated for selected subscription",autoLoad:false,autoScroll:true,paging:false,layout:"fit",items:[E]});var H=new Wtf.Window({width:410,height:340,iconCls:"iconwin",resizable:false,bodyStyle:"background-color:white;",id:"subinvoice"+this.id,modal:true,title:"Transactions",buttons:[{anchor:"90%",text:"Close",handler:function(){Wtf.getCmp("subinvoice"+this.id).close()},scope:this}],items:[C]}).show();B.load()}Wtf.QuickHelp=function(){return{register:function(B,A){Wtf.each(B,function(C){Wtf.QuickHelp.attachHelpTip(C,A,"beforeclick")})},attachHelpTip:function(A,B,C){if((typeof A=="object")&&(typeof A.handler=="function")){A.on(C,function(K,I){if(helpmode){var J=Wtf.getCmp("help_mode_tip");if(J){J.destroy()}J=new Wtf.Tip({closable:true,id:"help_mode_tip",width:250,title:typeof A.tooltip=="object"?A.tooltip.title:A.tooltip,items:new Wtf.Panel({buttonAlign:"right",border:false,buttons:[new Wtf.Button({text:"Go",handler:A.handler,scope:B})],html:A.detailTip}),target:A});var E=Wtf.get(A.id)!=null?Wtf.get(A.id):Wtf.get(A.el);var H="";J.show();var N=Wtf.getBody().getWidth();var G=Wtf.getBody().getHeight();var L=E.getTop()+E.getHeight()+J.getEl().getHeight()+4;var F=E.getLeft()+E.getWidth()+J.getEl().getWidth()+4;var D=0;var M=0;if(F>=N){H="tr-tr";D=-25}if(L>=G){H="tl-tl";M=-J.getEl().getHeight()}J.getEl().alignTo(E,H,[D,M])}return !helpmode})}else{if(A.menu){Wtf.each(A.menu.items.items,function(D){Wtf.QuickHelp.attachHelpTip(D,B,"click")})}}}}}();Wtf.ScrollPanel=function(A){Wtf.apply(this,A);this.addEvents({bodyscroll:true});Wtf.ScrollPanel.superclass.constructor.call(this)};Wtf.ScrollPanel=Wtf.extend(Wtf.Panel,{getScrollState:function(){var A=this.body.dom;return{left:A.scrollLeft,top:A.scrollTop}},restoreScroll:function(A){var B=this.body.dom;B.scrollLeft=A.left;B.scrollTop=A.top},scrollToTop:function(){this.body.dom.scrollTop=0;this.body.dom.scrollLeft=0},scrollTo:function(B,A){this.body.dom.scrollLeft=B;this.body.dom.scrollTop=A},syncScroll:function(){var A=this.body.dom;this.fireEvent("bodyscroll",A.scrollLeft,A.scrollTop)},onRender:function(B,A){Wtf.ScrollPanel.superclass.onRender.call(this,B,A);this.body.on("scroll",this.syncScroll,this)}});Wtf.common.Shadow=function(A){Wtf.apply(this,A);Wtf.common.Shadow.superclass.constructor.call(this,A)};Wtf.extend(Wtf.common.Shadow,Wtf.Shadow,{show:function(A){A=Wtf.get(A);if(!this.el){this.el=Wtf.Shadow.Pool.pull();if(this.el.dom.nextSibling!=A.dom){this.el.insertBefore(A)}}this.el.setStyle("z-index",this.zIndex||A.getStyle("z-index"));if(Wtf.isIE){this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")"}this.realign(A.getLeft(true),A.getTop(true),A.getWidth(),A.getHeight());this.el.dom.style.display="block"}})