Wtf.lib.Ajax._queue=[];Wtf.lib.Ajax._activeRequests=0;Wtf.lib.Ajax.abort=function(D,E,B){if(this.isCallInProgress(D)){D.conn.abort();window.clearInterval(this.poll[D.tId]);delete this.poll[D.tId];if(B){delete this.timeout[D.tId]}this.handleTransactionResponse(D,E,true);return true}else{for(var C=0,A=this._queue.length;C<A;C++){if(this._queue[C].o.tId==D.tId){this._queue.splice(C,1);break}}return false}};Wtf.lib.Ajax.asyncRequest=function(E,B,D,A){var C=this.getConnectionObject();if(!C){return null}else{this._queue.push({o:C,method:E,uri:B,callback:D,postData:A});this._processQueue();return C}};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(C,E,B,D,A){this._activeRequests++;C.conn.open(E,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(C)}this.handleReadyState(C,D);C.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=="object"||_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 C=null;var G=null;if(!Wtf.isIE||!Wtf.ieForceActiveXXhr){try{C=new XMLHttpRequest()}catch(F){}}if(!C){for(var E=0;E<3;++E){var D=dojo._XMLHTTP_PROGIDS[E];try{C=new ActiveXObject(D)}catch(F){G=F}if(C){dojo._XMLHTTP_PROGIDS=[D];break}}}if(!C){throw new Error("XMLHTTP not available: "+G)}return C};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(C,E,B){C=C||dojo.global;var A=C[E];if(!A||!A._listeners){var D=dojo._listener.getDispatcher();D.target=A;D._listeners=[];A=C[E]=D}return A._listeners.push(B)},remove:function(C,D,B){var A=(C||dojo.global)[D];if(A&&A._listeners&&B--){delete A._listeners[B]}}};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(C){var A=this._makeScriptDeferred(C);var B=A.ioArgs;dojo._ioAddQueryToUrl(B);this.attach(B.id,B.url);dojo._ioWatch(A,this._validCheck,this._ioCheck,this._resHandle);return A},attach:function(C,A){var B=dojo.doc.createElement("script");B.type="text/javascript";B.src=A;B.id=C;dojo.doc.getElementsByTagName("head")[0].appendChild(B)},remove:function(A){Wtf.destroy(Wtf.get(A));if(this["jsonp_"+A]){delete this["jsonp_"+A]}},_makeScriptDeferred:function(C){var A=dojo._ioSetArgs(C,this._deferredCancel,this._deferredOk,this._deferredError);var B=A.ioArgs;B.id="dojoIoScript"+(this._counter++);B.canDelete=false;if(C.callbackParamName){B.query=B.query||"";if(B.query.length>0){B.query+="&"}B.query+=C.callbackParamName+"=dojo.script.jsonp_"+B.id+"._jsonpCallback";B.canDelete=true;A._jsonpCallback=this._jsonpCallback;this["jsonp_"+B.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,D){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 K="^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$";var G=(""+window.location).match(new RegExp(K));if(G[4]){var I=G[4].split(":");var C=I[0];var F=I[1]||"80";G=this.url.match(new RegExp(K));if(G[4]){I=G[4].split(":");var E=I[0];var J=I[1]||"80";this._isXD=((E!=C)||(J!=F))}}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 H={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(D){Wtf.apply(H,D)}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){H.callbackParamName="jsonp";A=dojo.script.get(H)}else{A=dojo.xhrPost(H)}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,E,H){if(E){var F="/cometd"+G;var D=this._subscriptions[F];if(!D||D.length==0){D=[];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 C in D){if(D[C].objOrFunc===E&&(!D[C].funcName&&!H||D[C].funcName==H)){return null}}var B=dojo.subscribe(F,E,H);D.push({topic:B,objOrFunc:E,funcName:H});this._subscriptions[F]=D}return this._deferredSubscribes[G]};this.unsubscribe=function(F,D,G){var E="/cometd"+F;var B=this._subscriptions[E];if(!B||B.length==0){return null}var C=0;for(var A in B){var H=B[A];if((!D)||(H.objOrFunc===D&&(!H.funcName&&!G||H.funcName==G))){dojo.unsubscribe(B[A].topic);delete B[A]}else{C++}}if(C==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(A,B){};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(B){for(var A=0;A<B.length;A++){B[A].clientId=this._cometd.clientId;B[A].id=""+this._cometd.messageId++;B[A]=this._cometd._extendOut(B[A])}return dojo.xhrPost({url:this._cometd.url,handleAs:this._cometd.handleAs,load:dojo.hitch(this._cometd,"deliver"),content:{message:Wtf.encode(B)}})};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(C){for(var B=0;B<C.length;B++){C[B].clientId=this._cometd.clientId;C[B].id=""+this._cometd.messageId++;C[B]=this._cometd._extendOut(C[B])}var A={url:this._cometd.url,load:dojo.hitch(this._cometd,"deliver"),callbackParamName:"jsonp",content:{message:Wtf.encode(C)}};return dojo.script.get(A)};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.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.namespace("Wtf.common");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;this.combo.collapse();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()},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)}}});Wtf.KWLRowNumberer=function(A){Wtf.apply(this,A);if(this.rowspan){this.renderer=this.renderer.createDelegate(this.pg)}};Wtf.KWLRowNumberer.prototype={header:"",width:23,sortable:false,fixed:true,dataIndex:"",id:"numberer",rowspan:undefined,renderer:function(C,F,A,G,D,B){if(this.rowspan){F.cellAttr='rowspan="'+this.rowspan+'"'}var E=B.lastOptions.params.start;if(isNaN(E)){E=0}E=E+G+1;return E}};Wtf.TemplateHtmlEditor=function(A){Wtf.apply(this,A);this.mycontenteditor=A.mycontenteditor;this.cutBttn=new Wtf.Toolbar.Button({id:"cutbutton",minWidth:30,iconCls:"cutbttn",tooltip:{title:"Cut",text:"Cut selected text.",cls:"x-html-editor-tip"}});this.cutBttn.on("click",this.getSelectedText,this);this.copyBttn=new Wtf.Toolbar.Button({id:"copybutton",minWidth:30,iconCls:"copybttn",tooltip:{title:"Copy",text:"Copy selected text.",cls:"x-html-editor-tip"}});this.copyBttn.on("click",this.copySelectedText,this);this.pasteBttn=new Wtf.Toolbar.Button({id:"pastebutton",minWidth:30,iconCls:"pastebttn",tooltip:{text:"Paste",cls:"x-html-editor-tip"}});this.pasteBttn.on("click",this.pasteSelectedText,this);this.saveBttn=new Wtf.Toolbar.Button({id:"savebutton",minWidth:30,iconCls:"savebttn",disabled:true,tooltip:{text:"Save",cls:"x-html-editor-tip"}});Wtf.TemplateHtmlEditor.superclass.constructor.call(this,A);this.on("render",this.addButtons,this);this.on("keypress",this.applyCommand,this)};Wtf.extend(Wtf.TemplateHtmlEditor,Wtf.form.HtmlEditor,{value:null,addButtons:function(A){A.getToolbar().addSeparator();A.getToolbar().addButton(this.cutBttn);A.getToolbar().addButton(this.copyBttn);A.getToolbar().addButton(this.pasteBttn);A.getToolbar().addButton(this.saveBttn)},getSelectedText:function(A){this.value=this.doc.getSelection();temptext=this.value;if(this.value!=null){this.insertAtCursor(" ")}},pasteSelectedText:function(A){if(this.value!=""){this.insertAtCursor(this.value)}},copySelectedText:function(A){this.value=this.doc.getSelection()}});Wtf.TemplatePanel=function(A){Wtf.apply(this,A);this.createDisciplineWindow=null;this.sendForm=null;this.templateId=null;this.expander=new Wtf.grid.RowExpander({tpl:new Wtf.Template("<br>","<p><b>Description:</b> {Desc}</p>")});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:true,hideGroupedColumn:false});this.sm=new Wtf.grid.CheckboxSelectionModel();this.cmodel=new Wtf.grid.ColumnModel([this.sm,{header:"Template For",width:50,dataIndex:"Name"}]);this.cmodel.defaultSortable=true;this.sm.on("rowselect",function(){this.delBttn.enable()},this);this.sm.on("rowdeselect",function(){this.delBttn.disable()},this);this.templateRecord=Wtf.data.Record.create([{name:"Id",type:"string"},{name:"Name",type:"string"}]);this.templateReader=new Wtf.data.KwlJsonReader({root:"data"},this.templateRecord);this.templateStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.templateReader,sortInfo:{field:"Name",direction:"DESC"}});this.grid=new Wtf.grid.GridPanel({ds:this.templateStore,cm:this.cmodel,border:false,enableColumnHide:false,view:this.groupingView,sm:this.sm,trackMouseOver:true,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.dataTempRecord=Wtf.data.Record.create([{name:"template",type:"string"}]);this.dataTemReader=new Wtf.data.KwlJsonReader({root:"data"},this.dataTempRecord);this.dataTemStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.dataTemReader});this.hedit=new Wtf.TemplateHtmlEditor({id:"newHTMLEditor",height:240,border:false,enableLists:false,enableSourceEdit:true,enableAlignments:true,hideLabel:true,disabled:true});this.defferBttn=new Wtf.Toolbar.Button({text:"Add",tooltip:"Create a new template",id:"BtnNew"+this.id,scope:this});this.delBttn=new Wtf.Toolbar.Button({text:"Delete",tooltip:"Delete a template",disabled:true,id:"Btndel"+this.id,scope:this});this.defferBttn.on("click",this.handleDeferClick,this);this.delBttn.on("click",this.deleteMessage,this);Wtf.TemplatePanel.superclass.constructor.call(this,{border:false,plain:true,layout:"border",items:[{region:"center",border:false,layout:"fit",items:[this.hedit]},{region:"west",layout:"fit",border:true,width:250,tbar:["Search: ",this.quickPanelSearch=new Wtf.KWLQuickSearch({width:125,field:"Name"}),this.defferBttn,this.delBttn],items:[this.grid]}],resizable:true});this.on("render",this.handleRender,this);this.templateStore.on("load",this.handleStoreLoad,this);this.sm.on("rowselect",this.rowSelHandle,this);this.sm.on("rowdeselect",this.rowDeselHandle,this);this.dataTemStore.on("load",this.handleTempLoad,this);this.hedit.saveBttn.on("click",this.handleSaveClick,this);this.addEvents({"newTemplate":true})};Wtf.extend(Wtf.TemplatePanel,Wtf.Panel,{handleRender:function(A){this.templateStore.baseParams={type:5};this.templateStore.load()},rowSelHandle:function(B,A,C){this.dataTemStore.load({params:{type:6,templateid:this.templateStore.getAt(A).data["Id"]}});this.templateId=this.templateStore.getAt(A).data["Id"]},handleStoreLoad:function(A,C,B){this.quickPanelSearch.StorageChanged(A)},rowDeselHandle:function(C,A){var B=this.sm.getSelected();if(this.sm.getSelections().length==1){this.dataTemStore.load({params:{type:6,templateid:B.data["Id"]}});this.templateId=B.data["Id"]}else{this.hedit.setValue("");this.hedit.saveBttn.disable()}},handleTempLoad:function(B,C,A){if(this.sm.getSelections().length==1){this.hedit.saveBttn.enable();this.hedit.enable();this.hedit.setValue(C[0].data["template"])}else{this.hedit.setValue("");this.hedit.saveBttn.disable()}},handleSaveClick:function(A,B){Wtf.Ajax.requestEx({url:"jspfiles/admin/acastructure.jsp",params:{templateid:this.templateId,data:this.hedit.getValue(),type:8},method:"POST"},this,function(D,C){},function(D,C){})},deleteMessage:function(B,A){Wtf.Msg.show({title:"Delete Template",msg:"The selected template/s will be  deleted! Do you want to continue?",buttons:Wtf.Msg.YESNO,fn:this.confirmDelete,scope:this,animEl:"elId",icon:Wtf.MessageBox.QUESTION})},confirmDelete:function(C){if(C=="yes"){var B="";for(var A=0;A<this.grid.getSelections().length;A++){B+=this.grid.getSelections()[A].data["Id"];if(A<this.grid.getSelections().length-1){B+=","}}Wtf.Ajax.requestEx({url:"jspfiles/admin/acastructure.jsp",params:{delid:B,type:19},method:"POST"},this,function(H,F){var D=B.split(",");for(var E=0;E<D.length;E++){var G=this.templateStore.getAt(this.templateStore.find("Id",D[E]));this.templateStore.remove(G)}this.hedit.setValue("");this.hedit.saveBttn.disable()},function(E,D){})}},handleDeferClick:function(A,B){this.createDisciplineWindow=new Wtf.Window({title:"New Template",closable:true,modal:true,width:560,height:444,resizable:false,buttonAlign:"right",buttons:[{text:"Submit",scope:this,handler:function(){if(this.sendForm.form.isValid()){this.sendForm.form.submit({waitMsg:"Loading...",scope:this,failure:function(D,C){msgBoxShow(["Error","Error connecting to Server"],Wtf.MessageBox.INFO);this.createDisciplineWindow.close()},success:function(D,C){msgBoxShow(["Status","New Template added successfully"],Wtf.MessageBox.INFO);this.fireEvent("newTemplate");this.templateStore.reload();this.createDisciplineWindow.close()}})}}},{text:"Cancel",scope:this,handler:function(){this.createDisciplineWindow.close()}}],layout:"border",items:[{region:"north",height:1,border:false,bodyStyle:"background:transparent;border-bottom:1px solid #bfbfbf;"},{region:"center",border:false,bodyStyle:"background:#f1f1f1;font-size:10px;",layout:"fit",items:[this.sendForm=new Wtf.form.FormPanel({url:"jspfiles/admin/acastructure.jsp?type=7&",waitMsgTarget:true,method:"POST",border:false,bodyStyle:"margin-top:20px;margin-left:20px;font-size : 10px;",defaultType:"textfield",items:[{fieldLabel:"Template Name*",labelWidth:120,width:400,name:"name",allowBlank:false},new Wtf.form.HtmlEditor({height:300,name:"data",border:false,enableLists:false,enableSourceEdit:false,enableAlignments:true,hideLabel:true})]})]}]});this.createDisciplineWindow.show()}});function navigate(P,B,A,D,K){var E={};E.id=B;switch(P){case"d":mainPanel.loadTabAdv("documents.html","tabdocs",(D?unescape(D):"My Documents"),"navareadocs",Wtf.etype.docs,false);break;case"t":var F=Wtf.getCmp("list_conainer"+E.id+"calctrl");if(!F){F=new Wtf.Panel({title:unescape(D)+" To-Do",layout:"fit",id:"list_conainer"+E.id+"calctrl",closable:true,autoScroll:true,tabType:Wtf.etype.todo,iconCls:getTabIconCls(Wtf.etype.todo),items:[new Wtf.TodoList({autoScroll:true,title:"To-Do list",id:"todo_list"+E.id+"calctrl",layout:"fit",userid:E.id,groupType:2,animate:true,baseCls:"todoPanel",enableDD:true,containerScroll:true,border:false,rootVisible:false})]});Wtf.getCmp("as").add(F);Wtf.getCmp("as").doLayout()}Wtf.getCmp("as").setActiveTab(F);break;case"y":var J=Wtf.getCmp(mainPanel.id+"Calendar");if(J){J.selectChanged()}else{calLoadControl(mainPanel.id)}if(E.id){var C=J.getNodeById(E.id);if(C){if(!C.ui.checkbox.checked){C.ui.checkbox.checked=true;C.attributes.checked=true;J.fireEvent("treecheckchange",J,C,true,this.roleId)}}else{Wtf.Msg.alert("Invalid Calendar","Selected calendar doesn't exist or has been deleted!")}}break;case"econ":var I=D;var M=B;G("e"+M,Wtf.MyContentEditor,{layout:"fit",border:false,courseid:M,id:"e"+M,tabtitle:I,title:I,mode:0,use:1,closable:true,iconCls:"editor"});break;case"vcon":var I=D;var M=B;var N=A;G("v"+M,Wtf.MyContentEditor,{layout:"fit",border:false,courseid:M,id:M+"$"+N,tabtitle:I,title:I,mode:1,use:1,closable:true,iconCls:"viewer",vid:N});break;case"mcon":new Wtf.viewContentList({moduleid:B,mode:A}).show();break;case"facprof":mainPanel.loadTab("userProfile.html","mainuserProfile_"+B+"_disp",D,"navareadashboard",Wtf.etype.user);break;case"alert":mainPanel.loadTab("displayAlert.html","displayAlert"+loginid,"Alerts","navareadashboard",Wtf.etype.user);break;case"audit":mainPanel.loadTab("audittrail.html","audittrail"+loginid,"Audit Trail","navareadashboard",Wtf.etype.user);break;case"regStud":mainPanel.loadTab("appregstudents.html","appregstudents"+loginid,"Students","navareadashboard",Wtf.etype.user);break;case"genForum":mainPanel.loadTab("generalForum.html","   genForum//for_generalforum//General","General Forum","navareadashboard",Wtf.etype.user);break;case"scholForum":mainPanel.loadTab("scholForum.html","scholForum"+loginid,"Scholarships","navareadashboard",Wtf.etype.user);break;case"attend":mainPanel.loadTab("attendance.html","attendance"+loginid,"Attendance","navareadashboard",Wtf.etype.user);break;case"feedback":mainPanel.loadTab("feedback.html","feedback"+loginid,"Feedback Management","navareadashboard",Wtf.etype.feedback);break;case"transcript":var H=E.id;var O=A;var L=D;G("trans"+H+L,Wtf.transcript,{title:K,layout:"fit",programtype:O,programid:H,mode:9,userid:L,id:"trans"+H+L,closable:true});break;case"announce":mainPanel.loadTab("displayAnnouncements.html","announce"+loginid,"Announcements","navareadashboard",Wtf.etype.user);break;case"extstud":mainPanel.loadTab("externalStudent.html","   extstudent","External Students","navareadashboard",Wtf.etype.user);break;case"article":mainPanel.loadTab("displayAssignment.html","   "+B,"Assignments","navareadashboard",Wtf.etype.lms);break;case"articleassignment":mainPanel.loadTab("showAssignTab.html","   "+B,"Module Assignments","navareadashboard",Wtf.etype.lms);break}function G(T,R,Q){var S=Wtf.getCmp(T);if(!S){S=new R(Q);mainPanel.add(S);mainPanel.activate(S);mainPanel.doLayout()}mainPanel.setActiveTab(S)}}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",type:"string"},{name:"From",type:"string"},{name:"Received",type:"string"},{name:"Flag",type:"boolean"},{name:"ifread",type:"boolean"},{name:"ID",type:"string"},{name:"Details",type:"string"},{name:"Parent",type:"string"},{name:"Level"},{name:"Image",type:"string"},{name:"User_Id",type:"string"},{name:"category",type:"string"}]);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,dataIndex:"Received"},{header:"Category",width:170,dataIndex:"category",hidden:false},{header:"Flag",width:70,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,dataIndex:"Received"},{header:"Category",width:170,dataIndex:"category"},{header:"Flag",width:70,dataIndex:"Flag",renderer:this.FlagCell}])}}this.jReader=new Wtf.data.JsonReader({totalProperty:"forumCount",root:"data"},this.forumPost);this.dstore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/portal/loadForumTree.jsp",baseParams:{type:1}}),reader:this.jReader});Wtf.ForumTree.superclass.constructor.call(this,{ds:this.dstore,cm:this.cmodel,border:false,viewConfig:{forceFit:true}});this.addEvents={"cellclick1":true,"mgContext":true}};Wtf.extend(Wtf.ForumTree,Wtf.grid.GridPanel,{ReplyWindow:function(H,G){var A=null;A=new H.forumPost({Subject:"New Reply",Received:"26/10/2007 05:05:05 PM",From:"Unknown User",Flag:"False",ID:H.id++,Details:"No Details",Level:parseInt(H.dstore.getAt(G).data["Level"])+1,Parent:H.dstore.getAt(G).data["ID"]});var F=H.search(H.dstore.getAt(G).data["ID"],H);var E=H.dstore.getAt(G);var C=2;var B=H.dstore.getAt(F+1);if(B){for(;E.data["Level"]<B.data["Level"];C++){B=H.dstore.getAt(F+C);if(!B){break}}}H.dstore.insert(G+C-1,A);var D=H.getView();if(D.getCell(F,0).firstChild.firstChild.className=="forum_plus"){D.getCell(G+C-1,0).parentNode.parentNode.parentNode.parentNode.style.display="none"}else{if(D.getCell(F,0).firstChild.firstChild.className!="forum_minus"){D.getCell(F,0).firstChild.firstChild.className="forum_minus"}}D.getCell(G+C-1,0).firstChild.style.marginLeft=parseInt(18*H.dstore.getAt(G+C-1).data["Level"])+"px"},CollExp:function(F,A,C){var E=false;var B=this.getView();if(F.className=="forum_minus"){var H=this.dstore.getAt(this.row).data["Level"];for(i=this.row+1;i<this.dstore.getCount();i++){var G=this.dstore.getAt(i);if(G.data["Level"]<=H){break}B.getCell(i,0).parentNode.parentNode.parentNode.parentNode.style.display="none";if(B.getCell(i,C).firstChild.style.fontWeight=="bold"){E=true}}if(E==true){this.makeUnread(B,A,C)}F.className="forum_plus"}else{if(F.className=="forum_plus"){var H=this.dstore.getAt(this.row).data["Level"];for(j=this.row+1;j<this.dstore.getCount();j++){var G=this.dstore.getAt(j);if(G.data["Level"]<=H){break}B.getCell(j,0).parentNode.parentNode.parentNode.parentNode.style.display="block";if(B.getCell(j,C).firstChild.firstChild.className=="forum_plus"){var D=this.dstore.getAt(j).data["Level"];for(k=j+1;k<this.dstore.getCount();k++,j++){G=this.dstore.getAt(k);if(G.data["Level"]<=D){break}}}}F.className="forum_minus";this.makeRead(B,A,C)}}},search:function(A,B){for(z=0;z<B.dstore.getCount();z++){if(B.dstore.getAt(z).data["ID"]==A){return z}}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">'+A+"</div>"},FlagCell:function(A){if(A==true){return'<div id="img_div" class="redflag" height="10px"> </div>'}else{return'<div id="img_div" class="greyflag" height="10px"> </div>'}}});Wtf.forumpPageSize=function(A){Wtf.apply(this,A);this.totalSize=null};Wtf.extend(Wtf.forumpPageSize,Wtf.common.pPageSize,{changePageSize:function(H){var A=0;var B=0;var K=this.pagingToolbar;this.combo.collapse();H=parseInt(H)||parseInt(this.combo.getValue());H=(H>0)?H:1;if(H<K.pageSize){var I=K.store;I.suspendEvents();for(var D=0;D<I.getCount();D++){if(I.getAt(D).data["ID"].match("topic")){A++;if((A)==(H+1)){break}}B++}A--;K.pageSize=H;var C=Math.round(K.cursor/B)+1;var J=(C-1)*B;I.suspendEvents();for(var E=0,F=J-K.cursor;E<F;E++){I.remove(I.getAt(0))}while(I.getCount()>B){I.remove(I.getAt(I.getCount()-1))}I.resumeEvents();I.fireEvent("datachanged",I);K.cursor=J;var G=K.getPageData();K.afterTextEl.el.innerHTML=String.format(K.afterPageText,G.pages);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)*H;K.updateInfo();K.displayEl.update("Displaying threads "+parseInt(K.cursor+1)+" - "+parseInt(K.cursor+parseInt(A))+" of "+this.totalSize)}else{this.pagingToolbar.pageSize=H;this.pagingToolbar.doLoad(Math.floor(this.pagingToolbar.cursor/this.pagingToolbar.pageSize)*this.pagingToolbar.pageSize)}this.updateStore()}});Wtf.ChatWindow=function(A){Wtf.apply(this,A);Wtf.ChatWindow.superclass.constructor.call(this,A);this.remotepersonid=A.remotepersonid;this.node=A.node;if(A.iconCls=="K-icon"){this.userStatus="online"}else{this.userStatus="offline"}this.editor=new Wtf.ChatHTMLEditor({enableLists:false,enableSourceEdit:false,enableAlignments:false,hideLabel:true,border:false,deferHeight:true});this.editor.on("enterKeyPressed",this.handleEnterEvent,this)};Wtf.extend(Wtf.ChatWindow,Wtf.Window,{initComponent:function(){Wtf.ChatWindow.superclass.initComponent.call(this)},onRender:function(A){Wtf.ChatWindow.superclass.onRender.call(this,A);this.innerpanel=this.add(new Wtf.Panel({layout:"border",items:[{region:"center",border:false,height:"70%",border:false,html:'<div id="'+this.id+'_readArea_" class="readAreaClass" ></div>'},{region:"south",height:75,border:false,split:true,layout:"fit",items:this.editor}],tbar:[{text:"View Profile",scope:this,handler:function(){var C=this.remotepersonid;var B=this.remotepersonname;mainPanel.loadTab("userProfile.html","mainuserProfile_"+C+"_disp",B,"navareadashboard",Wtf.etype.user)}}],buttons:[{text:"Send",scope:this,handler:function(){var C=this.editor.getValue();if(C!=""){this.insertmsg(C,1);this.editor.setValue(null);var B=escape(C);Wtf.Ajax.requestEx({url:Wtf.req.prt+"/chatmessage.jsp",params:{user:loginid,remoteUser:this.remotepersonid,chatMessage:B,rstatus:this.userStatus,rUserName:this.remotepersonname}},this,function(D,E){},function(D,E){})}}}]}))},handleEnterEvent:function(){var B=this.editor.getValue();if(B!=""){this.insertmsg(B,1);this.editor.setValue(null);var A=escape(B);Wtf.Ajax.requestEx({url:Wtf.req.prt+"/chatmessage.jsp",params:{user:loginid,remoteUser:this.remotepersonid,chatMessage:A,rstatus:this.userStatus,rUserName:this.remotepersonname}},this,function(C,D){},function(C,D){})}},insertmsg:function(G,E){var F=document.getElementById(this.id+"_readArea_");var D=document.createElement("div");var B=[];if(E==1){name="Me"}else{if(E==2){name=this.remotepersonname;G=unescape(G)}}B=G.match(/(:\(\()|(:\)\))|(:\))|(:x)|(:\()|(:P)|(:D)|(;\))|(;;\))|(&gt;:D&lt;)|(:-\/)|(:&gt;&gt;)|(:-\*)|(=\(\()|(:-O)|(X\()|(:&gt;)|(B-\))|(:-S)|(#:-S)|(&gt;:\))|(:\|)|(\/:\))|(=\)\))|(O:-\))|(:-B)|(=;)|(:-c)/g);G=G.replace(/<STRONG>/gi,"<b>");G=G.replace(/<\/STRONG>/gi,"</b>");G=G.replace(/<em>/gi,"<i>");G=G.replace(/<\/em>/gi,"</i>");if(B==null){D.innerHTML='<p><strong><font color = "#006699">'+name+"</font>:</strong> "+G}else{var C;var A;D.innerHTML='<p><strong><font color = "#006699">'+name+"</font>:</strong> "+G;for(C=0;C<B.length;C++){smiley(D,B[C])}}F.innerHTML+=D.innerHTML;F.scrollTop=F.scrollHeight}});var ContactsTemplate=new Wtf.Template("{username}");Wtf.ContactsTree=function(A){this.nodeHash={};this.contactDetails=Wtf.data.Record.create([{name:"userid",type:"string"},{name:"username",type:"string"},{name:"emailid",type:"string"},{name:"fullname",type:"string"},{name:"userstatus",type:"string"},{name:"messagetext",type:"string"},{name:"image",type:"string"},{name:"relationid",type:"string"}]);this.contactReader=new Wtf.data.KwlJsonReader({root:"data"},this.contactDetails);this.contactStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.prt+"getFriendListDetails.jsp"}),baseParams:{mode:"1"},reader:this.contactReader});Wtf.ContactsTree.superclass.constructor.call(this,A);this.contactStore.on("load",this.handleContacts,this)};Wtf.extend(Wtf.ContactsTree,Wtf.tree.TreePanel,{autoWidth:true,autoHeight:true,rootVisible:false,id:"contactsview",autoScroll:true,animate:Wtf.enableFx,enableDD:false,contacts:null,hlDrop:Wtf.enableFx,temptreenode:null,clientwinarr:new Wtf.util.MixedCollection(),setEvents:function(){this.getNodeById("contacts").getUI().getTextEl().setAttribute("pmnode","Not Clickable")},handleContacts:function(F,D,B){var I="";for(var E=0;E<F.getCount();E++){var G=D[E].data["userid"];var H=D[E].data["username"];var A=D[E].data["userstatus"];var C="images/Offline.png";if(A=="online"){C="images/Online.png"}else{if(A=="offline"){C="images/Offline.png"}}this.temptreenode=new Wtf.tree.TreeNode({allowDrag:false,leaf:true,id:"kcont_"+G,icon:C});this.temptreenode.setText(ContactsTemplate.applyTemplate({username:H}));this.temptreenode.on("click",function(K,L){var J=L;if(J.getTarget("img[class='accept']")){this.handleAcceptContact(K)}else{if(J.getTarget("img[class='cancel']")){this.handleDeleteContact(K)}else{if(K.text.indexOf("[")<0){this.handleClick(K,true)}}}},this);I+=G+",";this.contacts.appendChild(this.temptreenode);this.contacts.expand();if(D[E].data["relationid"]=="1"){this.temptreenode.getUI().getTextEl().innerHTML+="<img id='AcceptImg' class='cancel' src='images/Delete.gif' style=\"margin-left:5px;vertical-align:middle\" title='Delete contact'></img>"}if(D[E].data["relationid"]=="0"){this.temptreenode.getUI().getTextEl().innerHTML+="<img id='AcceptImg' class='accept'  src='images/check16.png' style=\"margin-left:5px;vertical-align:middle\" title='Accept invitation'></img>  <img id='AcceptImg' class='cancel' src='images/Stop.png' style=\"margin-left:5px;vertical-align:middle\" title='Reject invitation'></img>"}if(D[E].data["relationid"]=="2"){this.temptreenode.getUI().getTextEl().innerHTML+="<img id='AcceptImg' class='cancel' src='images/Delete.gif' style=\"margin-left:5px;vertical-align:middle\" title='Delete contact'></img>"}this.temptreenode.getUI().getTextEl().setAttribute("status","f");this.temptreenode.getUI().getTextEl().setAttribute("ustat",A);this.temptreenode.getUI().getTextEl().setAttribute("mstat","f");this.temptreenode=null}dojo.cometd.subscribe("/"+loginid+"/chat",this,"chatPublishHandler");if(I.length>0){this.publishMyStatus(I.substr(0,I.length-1))}},handleDeleteContact:function(A){this.node=A;var B=A.text;if(A.text.indexOf("[")>0){B=A.text.substr(0,A.text.indexOf("["))}Wtf.Msg.show({title:"Delete/Reject Contact?",msg:'Are you sure you want to delete/reject the contact "'+B+'"?',buttons:Wtf.Msg.YESNO,fn:this.confirmDelete,scope:this,shadow:false,animEl:"elId",icon:Wtf.MessageBox.QUESTION})},confirmDelete:function(A,B){if(A=="yes"){Wtf.Ajax.request({method:"POST",url:"jspfiles/contacts.jsp",params:{type:"deleteContact",userid:loginid,requestto:this.node.id.substr(6)},scope:this,success:function(){var C=Wtf.getCmp("contactsview").getNodeById("kcont_"+this.node.id.substr(6));if(C){C.parentNode.removeChild(C);if(Wtf.get("chatWin"+C.id.substr(6))){Wtf.get("chatWin"+C.id.substr(6)).destroy()}if(Wtf.getCmp("_mycontactStore")){Wtf.getCmp("_mycontactStore").getStore().load({params:{start:0,limit:15}});Wtf.getCmp("_newcontactStore").getStore().load({params:{start:0,limit:15}})}Wtf.Ajax.requestEx({url:Wtf.req.prt+"getFriendListDetails.jsp",params:{userid:loginid,mode:"5",remoteUser:this.node.id.substr(6)}},this,function(D,E){},function(D,E){})}}})}},handleAcceptContact:function(A){this.node=A;Wtf.Msg.show({title:"Accept Contact Request?",msg:'Are you sure you want to add "'+A.text.substr(0,A.text.indexOf("["))+'" to your contact list ?',buttons:Wtf.Msg.YESNO,fn:this.confirmAccept,shadow:false,scope:this,animEl:"elId",icon:Wtf.MessageBox.QUESTION})},confirmAccept:function(A,B){if(A=="yes"){this.node.setText(this.node.text.substr(0,this.node.text.indexOf("[")));this.node.getUI().getTextEl().innerHTML+="<img id='AcceptImg' class='cancel' src='images/Delete.gif' style=\"margin-left:5px;vertical-align:middle\" title='Delete contact'></img>";Wtf.Ajax.request({method:"POST",url:"jspfiles/contacts.jsp",params:{type:"acceptContact",userid:loginid,requestto:this.node.id.substr(6)},scope:this,success:function(){if(Wtf.getCmp("_mycontactStore")){Wtf.getCmp("_mycontactStore").getStore().load({params:{start:0,limit:15}});Wtf.getCmp("_newcontactStore").getStore().load({params:{start:0,limit:15}})}}});Wtf.Ajax.requestEx({url:Wtf.req.prt+"getFriendListDetails.jsp",params:{userid:loginid,mode:"6",remoteUserId:this.node.id.substr(6),username:username}},this,function(C,D){},function(C,D){})}},addExistingFolders:function(){this.contactStore.load({params:{login:loginid}})},initComponent:function(){Wtf.ContactsTree.superclass.initComponent.call(this);var A=new Wtf.tree.AsyncTreeNode({text:"",expanded:true});this.setRootNode(A);this.contacts=new Wtf.tree.TreeNode({text:"Contacts ",allowDrag:false,id:"contacts",iconCls:"pwnd chaticon",singleClickExpand:false});A.appendChild(this.contacts);this.contacts.addListener("click",function(){mainPanel.loadTab("myContacts.html","   contacts","Contacts","navareadashboard",Wtf.etype.contacts)})},afterRender:function(){Wtf.ContactsTree.superclass.afterRender.call(this);this.setEvents();this.addExistingFolders();this.MainStore=new Wtf.data.JsonStore({url:Wtf.req.prt+"messenger/getmymessage.jsp",baseParams:({login:loginid,cts:999}),root:"data",scope:this,method:"GET",fields:["sendid","receivedid","message","messagetimestamp","rsflag","readflag"]});this.MainStore.on("load",function(){while(this.MainStore.getCount()>0){var A=this.MainStore.query("sendid",this.MainStore.getAt(0).get("sendid"));if(!this.clientwinarr.containsKey(A.first().get("sendid"))){this.clientwinarr.add(A.first().get("sendid"),null);clientwin=A.first().get("sendid");this.handleClick(this.contacts.findChild("id","kcont_"+A.first().get("sendid")),false);while(A.getCount()){Wtf.getCmp("chatWin"+A.first().get("sendid")).insertmsg(A.first().get("message"),2);this.MainStore.remove(A.first());A.remove(A.first())}}else{while(A.getCount()){this.MainStore.remove(A.first());A.remove(A.first())}}}},this);window.onbeforeunload=function(){Wtf.Ajax.requestEx({url:Wtf.req.prt+"getFriendListDetails.jsp",params:{mode:"4"}},this,function(A,B){},function(A,B){})}},handleClick:function(F,A){var C=F.getUI().getTextEl().getAttribute("ustat");var B=F.getUI().getTextEl().innerHTML;if(F.getUI().getTextEl().getAttribute("mstat")=="t"){var E=String(F.id).replace("kcont_","");var D=Wtf.getCmp("chatWin"+E);D.show();F.getUI().getTextEl().setAttribute("mstat","f")}else{F.getUI().getTextEl().setAttribute("status","t");this.win1(F,A)}},win1:function(E,B){var D=String(E.id).replace("kcont_","");var C;if(E.getUI().getTextEl().getAttribute("ustat")=="online"){C="K-icon"}else{if(E.getUI().getTextEl().getAttribute("ustat")=="offline"){C="K-iconOffline"}}if(Wtf.getCmp("chatWin"+D)){if(Wtf.getCmp("chatWin"+D).hidden){E.getUI().getTextEl().removeChild(E.getUI().getTextEl().childNodes[E.getUI().getTextEl().childNodes.length-1])}Wtf.getCmp("chatWin"+D).show()}else{var A=new Wtf.ChatWindow({layout:"fit",width:500,height:300,id:"chatWin"+D,remotepersonid:D,remotepersonname:E.text,maximizable:true,minimizable:true,plain:true,closable:true,iconCls:C,title:"Conversation with "+E.text,shadow:true,chatstore:B,node:E});A.show();A.on("minimize",this.handleChatMinimize,this)}},handleChatMinimize:function(A){A.node.getUI().getTextEl().innerHTML+='<span id="chatTreeMin"><img style="vertical-align:text-top;" src="images/Chat.png" style="height:12px;"/></span>';A.hide()},publishMyStatus:function(A){Wtf.Ajax.requestEx({url:Wtf.req.prt+"getFriendListDetails.jsp",params:{userid:loginid,mode:"3",remoteUser:A}},this,function(B,C){},function(B,C){})},chatPublishHandler:function(msg){var temp=eval("("+msg.data.data+")");var temp1=Wtf.decode(temp.data[0]).data;var tempNode=null;if(temp1[0].mode!="msg"){var obj=Wtf.getCmp(this.id).getNodeById("kcont_"+temp1[1].userid);if(temp1[0].mode=="online"){if(obj.ui.iconNode.src.match("images/Offline.png")&&obj.text.indexOf("[")<0){obj.ui.iconNode.src="images/Online.png"}if(temp1[1].status=="request"){Wtf.Ajax.requestEx({url:Wtf.req.prt+"getFriendListDetails.jsp",params:{userid:loginid,mode:"2",remoteUser:temp1[1].userid}},this,function(result,req){},function(result,req){})}}else{if(temp1[0].mode=="offline"){if(obj.ui.iconNode.src.match("images/Online.png")){obj.ui.iconNode.src="images/Offline.png"}}else{if(temp1[0].mode=="delete"){obj=Wtf.getCmp(this.id).getNodeById("kcont_"+temp1[1].userid);obj.parentNode.removeChild(obj);if(Wtf.getCmp("_mycontactStore")){Wtf.getCmp("_mycontactStore").getStore().load({params:{start:0,limit:15}});Wtf.getCmp("_newcontactStore").getStore().load({params:{start:0,limit:15}})}if(Wtf.get("chatWin"+obj.id.substr(6))){Wtf.get("chatWin"+obj.id.substr(6)).destroy()}}else{if(temp1[0].mode=="add"){obj=Wtf.getCmp(this.id).getNodeById("kcont_"+temp1[1].userid);if(obj){obj.parentNode.removeChild(obj)}this.temptreenode=new Wtf.tree.TreeNode({allowDrag:false,leaf:true,id:"kcont_"+temp1[1].userid,icon:"images/Offline.png"});this.temptreenode.setText(ContactsTemplate.applyTemplate({username:temp1[1].username}));this.temptreenode.on("click",function(node,e){var event=e;if(event.getTarget("img[class='accept']")){this.handleAcceptContact(node)}else{if(event.getTarget("img[class='cancel']")){this.handleDeleteContact(node)}else{if(node.text.indexOf("[")<0){this.handleClick(node,true)}}}},this);this.contacts.appendChild(this.temptreenode);this.contacts.expand();this.temptreenode.getUI().getTextEl().innerHTML+="<img id='AcceptImg' class='cancel' src='images/Delete.gif' style=\"margin-left:5px;vertical-align:middle\" title='Delete contact'></img>";this.publishMyStatus(temp1[1].userid);this.temptreenode=null;if(Wtf.getCmp("_mycontactStore")){Wtf.getCmp("_mycontactStore").getStore().load({params:{start:0,limit:15}});Wtf.getCmp("_newcontactStore").getStore().load({params:{start:0,limit:15}})}}else{if(temp1[0].mode=="invite"){obj=Wtf.getCmp(this.id).getNodeById("kcont_"+temp1[1].userid);if(obj){obj.parentNode.removeChild(obj)}this.temptreenode=new Wtf.tree.TreeNode({allowDrag:false,leaf:true,id:"kcont_"+temp1[1].userid,icon:"images/Offline.png"});this.temptreenode.setText(ContactsTemplate.applyTemplate({username:temp1[1].username}));this.temptreenode.on("click",function(node,e){var event=e;if(event.getTarget("img[class='accept']")){this.handleAcceptContact(node)}else{if(event.getTarget("img[class='cancel']")){this.handleDeleteContact(node)}else{if(node.text.indexOf("[")<0){this.handleClick(node,true)}}}},this);this.contacts.appendChild(this.temptreenode);this.contacts.expand();this.temptreenode.getUI().getTextEl().innerHTML+="<img id='AcceptImg' class='accept'  src='images/check16.png' style=\"margin-left:5px;vertical-align:middle\" title='Accept invitation'></img>  <img id='AcceptImg' class='cancel' src='images/Stop.png' style=\"margin-left:5px;vertical-align:middle\" title='Reject invitation'></img>";this.temptreenode=null;if(Wtf.getCmp("_mycontactStore")){Wtf.getCmp("_mycontactStore").getStore().load({params:{start:0,limit:15}});Wtf.getCmp("_newcontactStore").getStore().load({params:{start:0,limit:15}})}}}}}}}else{if(Wtf.getCmp("chatWin"+temp1[0].id)){Wtf.getCmp("chatWin"+temp1[0].id).insertmsg(temp1[0].message,2)}else{for(var i=0;i<this.getRootNode().childNodes[0].childNodes.length;i++){if(this.getRootNode().childNodes[0].childNodes[i].id=="kcont_"+temp1[0].id){tempNode=this.getRootNode().childNodes[0].childNodes[i]}}var winChat=new Wtf.ChatWindow({layout:"fit",width:500,height:300,id:"chatWin"+temp1[0].id,remotepersonid:temp1[0].id,remotepersonname:temp1[0].uname,maximizable:true,minimizable:true,plain:true,closable:true,iconCls:"K-icon",title:"Conversation with "+temp1[0].uname,shadow:true,chatstore:false,node:tempNode});winChat.show();winChat.on("minimize",this.handleChatMinimize,this);Wtf.getCmp("chatWin"+temp1[0].id).insertmsg(temp1[0].message,2)}}}});Wtf.DiscussionForum=function(A){Wtf.apply(this,A);this.msgReadImg="images/read.gif";this.msgUnreadImg="images/unread.gif";this.roleId=A.roleId;this.previewPanel=new Wtf.MessagePanel({id:"ppanel"+this.id});this.pageLimit=new Wtf.forumpPageSize();this.searchFlag=true;this.curRecCount=1;this.searchText="";this.categoryId="";this.curComboIndex=0;this.curComboFlag=false;this.styleHelper=0;this.msgLmt=15;this.dtask=new Wtf.util.DelayedTask(this.searchForum);this.mailSearchFlag=false;this.delStr="";if(this.roleId==3){this.styleHelper=1}if(A.projectFlag==true){this.projectFlag=true}else{this.projectFlag=false}this.deleteReader=new Wtf.data.JsonReader({root:"data"},["status"]);this.deleteStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/portal/deleteMessage.jsp"}),reader:this.deleteReader});this.newMsgButton=new Wtf.Toolbar.Button({text:"New Message",tooltip:{title:"New Message",text:"Create a new topic 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.SearchButton=new Wtf.Toolbar.Button({tooltip:{title:"Search",text:"Search Topic"},iconCls:"pwnd btnMailSearch",id:"Search"+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,width:175,height:19});this.tButnArr=Array();this.tButnArr.push(this.newMsgButton);this.tButnArr.push(this.replyMsgButton);if(this.roleId==3){this.tButnArr.push(this.DeleteButton)}this.tButnArr.push(this.searchField);this.tButnArr.push(this.SearchButton);this.newMsgButton.on("click",this.createNewTopicWindow,this);this.replyMsgButton.on("click",this.ReplyWindow,this);this.SearchButton.on("click",this.searchForum,this);this.DeleteButton.on("click",this.deleteMessage,this);this.selectedRow=null;this.wind=null;this.categoryRecord=Wtf.data.Record.create([{name:"categoryid",type:"string"},{name:"categoryname",type:"string"}]);this.categoryReader=new Wtf.data.JsonReader({root:"data"},this.categoryRecord);this.deptStore=new Wtf.data.Store({url:"jspfiles/admin/LacaStructure.jsp?flag=72",reader:this.categoryReader});this.categoryCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.deptStore,mode:"local",readOnly:true,displayField:"categoryname",fieldLabel:"Category",hiddenName:"categoryid",hidden:false,valueField:"categoryid",allowBlank:false,emptyText:"Select a category..."});this.deptStore.load();Wtf.DiscussionForum.superclass.constructor.call(this,{iconCls:A.iconCls,layout:"fit",border:false,items:[{layout:"border",border:false,autoWidth:true,items:[this.ftree=new Wtf.ForumTree({border:false,region:"center",layout:"fit",id:"forum-grid"+A.id,roleId:this.roleId,msgReadImg:this.msgReadImg,msgUnreadImg:this.msgUnreadImg,makeUnread:this.makeUnread,makeRead:this.makeRead}),{region:"south",height:225,border:false,layout:"fit",items:this.previewPanel,split:true}]}],bbar:this.tButnArr,tbar: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 results to display",plugins:this.pageLimit,items:["-","Select topic category :",this.categoryCombo]})});this.deptStore.on("load",function(B,D){var C=new this.categoryRecord({categoryid:"",categoryname:"All"});B.add(C);B.commitChanges()},this);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.categoryCombo.on("select",this.categorySelect,this);dojo.cometd.subscribe("/"+this.id.substring(4)+"/forum",this,"forumPublishHandler")};Wtf.extend(Wtf.DiscussionForum,Wtf.Panel,{categorySelect:function(B,C,A){this.categoryId=C.get("categoryid");this.ftree.dstore.load({params:{start:0,limit:(this.pageLimit&&this.pageLimit.combo)?(this.pageLimit.combo.getValue()||this.msgLmt):this.msgLmt}})},forumPublishHandler:function(msg){var temp=eval("("+msg.data.data+")");var temp1=Wtf.decode(temp.data[0]).data;var m=null;if(temp1[0].ID.match("topic")){m=new this.ftree.forumPost({Subject:unescape(temp1[0].Subject),Received:temp1[0].Received,From:temp1[0].From,Flag:temp1[0].Flag,ID:temp1[0].ID,Details:temp1[0].Details,Level:"0",Parent:"0",Image:temp1[0].Image,category:temp1[0].category});this.ftree.dstore.insert(0,m);this.makeUnread(this.ftree.getView(),0,this.styleHelper)}else{var rIndex=this.ftree.search(temp1[0].Parent,this.ftree);if(rIndex!=null){m=new this.ftree.forumPost({Subject:temp1[0].Subject,Received:temp1[0].Received,From:temp1[0].From,Flag:temp1[0].Flag,ID:temp1[0].ID,Details:temp1[0].Details,Level:parseInt(this.ftree.dstore.getAt(rIndex).data["Level"])+1,Parent:this.ftree.dstore.getAt(rIndex).data["ID"],Image:temp1[0].Image});var parentRow=this.ftree.search(this.ftree.dstore.getAt(rIndex).data["ID"],this.ftree);var parentRec=this.ftree.dstore.getAt(rIndex);var c=2;var tempRec=new Wtf.data.Record;tempRec=this.ftree.dstore.getAt(parentRow+1);if(tempRec){for(;parentRec.data["Level"]<tempRec.data["Level"];c++){tempRec=new Wtf.data.Record;tempRec=this.ftree.dstore.getAt(parentRow+c);if(!tempRec){break}}}this.ftree.dstore.insert(rIndex+c-1,m);var _v=this.ftree.getView();this.makeUnread(_v,(rIndex+c-1),this.styleHelper);if(_v.getCell(parentRow,this.styleHelper).firstChild.firstChild.className=="forum_plus"){_v.getCell(rIndex+c-1,0).parentNode.parentNode.parentNode.parentNode.style.display="none"}else{if(_v.getCell(parentRow,this.styleHelper).firstChild.firstChild.className!="forum_minus"){_v.getCell(parentRow,this.styleHelper).firstChild.firstChild.className="forum_minus"}}_v.getCell(rIndex+c-1,this.styleHelper).firstChild.style.marginLeft=parseInt(18*this.ftree.dstore.getAt(rIndex+c-1).data["Level"])+"px"}}},deletePost:function(B,C,A){if(C[0].data["status"]=="success"){this.getTopToolbar().doLoad(Math.floor(this.getTopToolbar().cursor/this.getTopToolbar().pageSize)*this.getTopToolbar().pageSize)}},confirmDelete:function(B,L){if(B=="yes"){var D=this.ftree.getSelectionModel().getSelections();this.delStr="";for(var F=0;F<D.length;F++){var G=this.delStr.split(",");var M=false;for(var I=0;I<G.length;I++){if(G[I]==D[F].data["ID"]){M=true}}if(M==false){this.delStr+=D[F].data["ID"]+","}var H=this.ftree.search(D[F].data["ID"],this.ftree);var K=this.ftree.dstore.getAt(H).data["Level"];for(var E=H+1;E<this.ftree.dstore.getCount();E++){var C=this.ftree.dstore.getAt(E);if(C.data["Level"]<=K){break}this.ftree.getSelectionModel().selectRow(E,true);var G=this.delStr.split(",");var A=false;for(var J=0;J<G.length-1;J++){if(G[J]==C.data["ID"]){A=true}}if(A==false){this.delStr+=C.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().getSelected()==null){Wtf.Msg.alert("Alert","No Topic Selected.")}else{Wtf.Msg.show({title:"Delete Posts?",msg:"Sub Posts will also be deleted! Do you want to continue?",buttons:Wtf.Msg.YESNO,fn:this.confirmDelete,scope:this,animEl:"elId",icon:Wtf.MessageBox.QUESTION})}},ondblClickHandle:function(C,D,B){var A=new Wtf.MessagePanel({id:this.ftree.dstore.getAt(D).data["ID"]});if(this.projectFlag==true){this.ownerCt.ownerCt.add({title:"Message",closable:true,layout:"fit",items:A}).show()}else{this.ownerCt.ownerCt.add({title:"Message",closable:true,layout:"fit",items:A}).show()}A.ownerCt.doLayout();A.setData(this.ftree.dstore.getAt(D).get("Subject"),this.ftree.dstore.getAt(D).get("From"),this.ftree.dstore.getAt(D).get("Received"),this.ftree.dstore.getAt(D).get("Image"),this.ftree.dstore.getAt(D).get("User_Id"));A.loadCacheData(this.ftree.dstore.getAt(D).get("Details"))},rowSelHandle:function(B,A,D){var C=this.ftree.dstore.getAt(A);this.ftree.fireEvent("cellclick1",C.data["Subject"],C.data["From"],C.data["Received"],C.data["Image"],C.data["ID"],C.data["User_Id"],A)},onClickHandle:function(D,B,C,G){D.row=B;D.col=C;var A=0;var F=G.target;var H=this.ftree.dstore.getAt(B).data["ID"];if(D.col==(this.styleHelper+3)){if(F.className==="greyflag"){F.className="redflag";A=1}else{if(F.className==="redflag"){F.className="greyflag"}}Wtf.Ajax.request({url:"jspfiles/portal/deleteMessage.jsp",params:{flag:"forumflag",postid:H,value:A},scope:this})}else{if((F.className=="forum_plus"||F.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,groupId:this.id.substring(4),categoryid:this.categoryId,type:1}},ldException:function(){this.previewPanel.ownerCt.doLayout()},mContextParent:function(A){this.checkReplyWindow(this)},setStyle:function(A,E,B){var F=[];var D=0;for(i=0;i<A.getCount();i++){if(E[i].data["Level"]==0&&E[i].data["Parent"]==0){D++}if(F[parseInt(E[i].data["Level"])-1]==E[i].data["Parent"]){this.ftree.getView().getCell(i,0).parentNode.parentNode.parentNode.parentNode.style.display="none"}if(E[i+1]){if(E[i].data["ID"]==E[i+1].data["Parent"]){F[E[i].data["Level"]]=E[i].data["ID"];this.ftree.getView().getCell(i,this.styleHelper).firstChild.firstChild.className="forum_plus"}}var C=this.ftree.getView();C.getCell(i,this.styleHelper).firstChild.style.marginLeft=18*parseInt(E[i].data["Level"])+"px";if(E[i].data["ifread"]==false){this.makeUnread(C,i,this.styleHelper);for(j=i;j>=0;j--){if(E[i].data["Parent"]==E[j].data["ID"]){this.makeUnread(C,j,this.styleHelper)}}}}this.getTopToolbar().displayEl.update("Displaying threads "+parseInt(B.params["start"]+1)+" - "+parseInt(D+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()},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";if(!B){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(C,D,A){if((this.curComboIndex>=A)||(this.curComboIndex==0)){var E=[];var B=0;for(i=0;i<this.ftree.dstore.getCount();i++){if(this.ftree.dstore.getAt(i).data["ifread"]==false){this.makeUnread(this.ftree.getView(),i,this.styleHelper,true);for(j=i;j>=0;j--){if(this.ftree.dstore.getAt(i).data["Parent"]==this.ftree.dstore.getAt(j).data["ID"]){this.makeUnread(this.ftree.getView(),j,this.styleHelper,true)}}}if(E[parseInt(this.ftree.dstore.getAt(i).data["Level"])-1]==this.ftree.dstore.getAt(i).data["Parent"]){this.ftree.getView().getCell(i,0).parentNode.parentNode.parentNode.parentNode.style.display="none"}if(this.ftree.dstore.getAt(i+1)){if(this.ftree.dstore.getAt(i).data["ID"]==this.ftree.dstore.getAt(i+1).data["Parent"]){E[this.ftree.dstore.getAt(i).data["Level"]]=this.ftree.dstore.getAt(i).data["ID"];this.ftree.getView().getCell(i,this.styleHelper).firstChild.firstChild.className="forum_plus"}}this.ftree.getView().getCell(i,this.styleHelper).firstChild.style.marginLeft=18*parseInt(this.ftree.dstore.getAt(i).data["Level"])+"px";if(this.ftree.dstore.getAt(i).data["Level"]==0&&this.ftree.dstore.getAt(i).data["Parent"]==0){B++}}}},handleContext:function(B,H,C,E){var G=null;var F=Array();F.push(new Wtf.menu.Item({id:"newReply",iconCls:"pwnd outboxCx",text:"Reply",handler:function D(){B.fireEvent("mgContext",H)}}));if(this.roleId==3){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(!G){G=new Wtf.menu.Menu({id:"context",height:18,items:F})}G.showAt(E.getXY());E.preventDefault()},handleSorting:function(D,B,C){var A=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(B!=0){A(D,B-1,this)}}else{A(D,B,this)}},syncDstore:function(C,A){for(var B=0;B<this.ftree.dstore.getCount();B++){var D=this.ftree.dstore.getAt(B).data["ID"];if(D==A){this.ftree.dstore.getAt(B).data["Details"]=C;this.makeRead(this.ftree.getView(),B,this.styleHelper);break}if(D=="topic"+A){this.ftree.dstore.getAt(B).data["Details"]=C;this.makeRead(this.ftree.getView(),B,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(F,I,D,B,A,C,H){var E="forum";this.previewPanel.setData1("","","",'<div class="loading-indicator">&#160;Loading...</div>',"");this.previewPanel.messageId=A;if(A.match("topic")){var G=A.substring(5);if(this.ftree.dstore.getAt(H).data["Details"]==""){this.previewPanel.topicstore.loadForum(G,1,E,this.ftree.dstore.getAt(H).data["User_Id"])}else{this.previewPanel.loadCacheData(this.ftree.dstore.getAt(H).data["Details"])}}else{if(this.ftree.dstore.getAt(H).data["Details"]==""){this.previewPanel.topicstore.loadForum(A,2,E,this.ftree.dstore.getAt(H).data["User_Id"])}else{this.previewPanel.loadCacheData(this.ftree.dstore.getAt(H).data["Details"])}}this.previewPanel.setData(F,I,D,B,C)},searchForum:function(){this.searchText=escape(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==false){C(B);this.mailSearchFlag=true}}},checkReplyWindow:function(B){var A=null;if(B.ftree.getSelectionModel().getSelected().data["Parent"]==0&&B.ftree.getSelectionModel().getSelected().data["Level"]==0){repFlag="1"}else{repFlag="2"}this.wind=new Wtf.ReplyWindow({uLabel:"Forum",bLabel:"Title",tdisabled:true,title:"Reply",replytoId:B.ftree.getSelectionModel().getSelected().data["ID"],userId:loginid,closable:true,tabWidth:150,groupId:B.id.substring(4),firstReply:repFlag,uFieldValue:this.forumName+" Forum",bFieldValue:"Re:"+B.ftree.getSelectionModel().getSelected().data["Subject"],type:"Forum",projectFlag:this.projectFlag,details:B.ftree.getSelectionModel().getSelected().data["Details"]});if(this.projectFlag==true){this.ownerCt.ownerCt.add(this.wind).show()}else{this.ownerCt.ownerCt.add(this.wind).show()}this.wind.doLayout();this.wind.insertStore.on("load",this.handleInsert,this)},ReplyWindow:function(B,A){if(this.ftree.getSelectionModel().getSelected()==null){Wtf.Msg.alert("Alert","No Topic Selected.")}else{this.checkReplyWindow(this,null)}},createNewTopicWindow:function(B,A){this.wind=new Wtf.ReplyWindow({uLabel:"Forum",bLabel:"Title",tdisabled:true,closable:true,replytoId:"-999",userId:loginid,title:"New Thread",tabWidth:150,groupId:this.id.substring(4),uFieldValue:this.forumName+" Forum",bFieldValue:"",firstReply:"0",rowIndex:"0",type:"Forum",id1:"wind"+this.id.substring(4),projectFlag:this.projectFlag});if(this.projectFlag==true){this.ownerCt.ownerCt.add(this.wind).show()}else{this.ownerCt.ownerCt.add(this.wind).show()}this.wind.doLayout();this.wind.insertStore.on("load",this.handleInsert,this)},txtsearchKeyPress:function(A){this.txt=A.getTarget().value;this.dtask.cancel();this.dtask.delay(500,this.searchForum,this)},handleInsert:function(C,A,B){this.wind.ownerCt.remove(this.wind)}});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,iconCls:"smiley"});this.eventSetFlag=false;this.tbutton.on("click",this.handleSmiley,this);Wtf.newHTMLEditor.superclass.constructor.call(this,{});this.on("render",this.addSmiley,this)};Wtf.extend(Wtf.newHTMLEditor,Wtf.form.HtmlEditor,{addSmiley:function(A){A.getToolbar().addSeparator();A.getToolbar().addButton(this.tbutton)},createLink:function(){var A=prompt(this.createLinkText,this.defaultLinkValue);if(A&&A!="http://"){this.win.focus();this.insertAtCursor("<a href = '"+A+"' target='_blank'>"+this.doc.getSelection()+"</a>");this.deferFocus()}},writeSmiley:function(B){var A=B;this.insertAtCursor(this.SmileyArray[A.target.id.substring(this.id.length+6)]);this.smileyWindow.close()},handleSmiley:function(B,D){if(!this.smileyWindow||!this.smileyWindow.isVisible()){this.smileyWindow=new Wtf.Window({width:185,height:116,minWidth:200,closable:true,plain:true,cls:"replyWind",shadow:false,buttonAlign:"center",draggable:false,header:false,resizable:false,id:"winnn"});this.smileyWindow.setPosition(D.getPageX(),D.getPageY());this.smileyWindow.show();for(var A=1;A<29;A++){var C={url:"images/smiley"+A+".gif",count:A,curid:this.id};this.tpl.append(this.smileyWindow.body,C);this.smileyel=Wtf.get(this.id+"smiley"+A);this.smileyel.on("click",this.writeSmiley,this)}}},closeSmileyWindow:function(A){if(this.smileyWindow){this.smileyWindow.close()}}});Wtf.ReplyWindow=function(B){Wtf.apply(this,B);this.dataTempRecord=Wtf.data.Record.create([{name:"template",type:"string"}]);this.dataTemReader=new Wtf.data.KwlJsonReader({root:"data"},this.dataTempRecord);this.dataTemStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.dataTemReader});this.templateRecord=Wtf.data.Record.create([{name:"Id",type:"string"},{name:"Name",type:"string"}]);this.templateReader=new Wtf.data.KwlJsonReader({root:"data"},this.templateRecord);this.templateStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.templateReader,sortInfo:{field:"Name",direction:"DESC"}});this.templateStore.baseParams={type:5};this.templateStore.load();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.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.useTemplateDD=new Wtf.form.ComboBox({triggerAction:"all",mode:"remote",store:this.templateStore,displayField:"Name",valueField:"Id",editable:false,emptyText:"Use Template"});this.useTemplateDD.on("select",this.handleTemplate,this);this.dataTemStore.on("load",this.handleTempLoad,this);this.tButnArr=Array();this.tButnArr.push(this.sendBtn);if(B.composeMail==1||B.composeMail==5){this.composeMailFlag=true;this.tButnArr.push(this.saveBtn)}this.tButnArr.push(this.closeBtn);if(isRoleGroup("4")){this.tButnArr.push(this.useTemplateDD)}this.templateBttn=new Wtf.Toolbar.Button({text:"New Template",iconCls:"newTemplate",tooltip:{title:"View templates",text:"Click to create reusable templates"},handler:function(){this.tem=new Wtf.TemplatePanel({title:"Templates",id:"templates"+this.id,closable:true});this.tem.on("newTemplate",function(){this.templateStore.reload()},this);this.ownerCt.add(this.tem);this.ownerCt.setActiveTab(this.tem)},scope:this});if(isRoleGroup("4")){this.tButnArr.push(this.templateBttn)}this.insertStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/portal/insertNewMsg.jsp"}),panelObj:this,reader:new Wtf.data.JsonReader({root:"data"},["Success","ID","Subject","Received","From","Details","Flag","Image"])});this.insertStore.on("loadexception",function C(){Wtf.Msg.alert("Error","Error occurred while connecting to the server");this.ownerCt.remove(this);this.sendBtn.enable();this.closeBtn.enable();this.saveBtn.enable()},this);this.insertStore.on("load",this.handleLoad,this);this.uvalue=B.uFieldValue;this.projFlag=false;if(B.projectFlag==true){this.projFlag=true}if(this.uvalue=="NewTopic"&&B.projectFlag!=true){this.uvalue="Forum"}else{if(this.uvalue=="NewTopic"&&B.projectFlag==true){this.uvalue=Wtf.getCmp("subtabpanelcomprojectTabs_"+B.id1.substring(4)).ownerCt.comtitle}}this.field1=new Wtf.form.TextField({fieldLabel:B.uLabel,name:B.uLabel,value:this.uvalue,disabled:B.tdisabled,width:"95%"});this.field2=new Wtf.form.TextField({fieldLabel:B.bLabel,name:B.bLabel,value:B.bFieldValue,maxLength:255,maxLengthText:"The maximum length allowed for "+B.bLabel+" is 255 characters",width:"95%"});this.deptStore=new Wtf.data.JsonStore({url:"jspfiles/admin/LacaStructure.jsp?flag=72",root:"data",fields:["categoryid","categoryname"]});this.categoryCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.deptStore,mode:"local",readOnly:true,displayField:"categoryname",fieldLabel:"Category",hiddenName:"categoryid",valueField:"categoryid",allowBlank:false,emptyText:"Select a category..."});this.deptStore.load();this.hedit=new Wtf.newHTMLEditor({height:240,border:false,enableLists:false,enableSourceEdit:false,enableAlignments:true,hideLabel:true});this.draftSendFlag=false;if(B.composeMail==5){this.hedit.setValue(unescape(B.details));this.draftSendFlag=true}this.type=B.type;this.sendflag=B.sendFlag;this.replyToId=B.replytoId;this.userId=B.userId;this.groupId=B.groupId;this.firstReply=B.firstReply;this.fid=B.fid;var A=[];A[0]=this.field1;A[1]=this.field2;this.catFlag=false;if(B.type=="Forum"&&B.title=="New Thread"){A[2]=this.categoryCombo;this.catFlag=true}this.top=new Wtf.FormPanel({frame:false,bodyStyle:"padding:5px 5px 0",border:false,height:this.catFlag?90:65,items:[{layout:"column",border:false,items:[{columnWidth:0.99,layout:"form",labelWidth:75,border:false,defaultType:"textfield",items:A}]}]});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.catFlag?90:65,items:[this.top]}],resizable:true,tbar:this.tButnArr});this.addEvents={"loadsuccess":true}};Wtf.extend(Wtf.ReplyWindow,Wtf.Panel,{handleLoad:function(B,C,A){this.fireEvent("loadsuccess",B,C,A);this.sendBtn.enable();this.closeBtn.enable();this.saveBtn.enable()},handleClose:function(A,B){this.ownerCt.remove(this)},handleTemplate:function(A,B){this.dataTemStore.load({params:{type:6,templateid:this.useTemplateDD.getValue()}})},handleTempLoad:function(B,C,A){this.hedit.enable();this.hedit.setValue(C[0].data["template"])},handleSend:function(A,B){this.draftFlag=0;this.reptoName=this.replyToId;if(this.composeMailFlag==true){this.closeBtn.disable();this.saveBtn.disable();this.sendBtn.disable();if(this.draftSendFlag==true){this.draftFlag=2}else{this.draftFlag=3}this.reptoName=this.field1.getValue()}else{this.closeBtn.disable();this.sendBtn.disable()}if(this.reptoName!=""){if(this.hedit.getValue().trim()==""){Wtf.Msg.show({title:"Message without text",msg:"Send message without text in body?",border:false,buttons:Wtf.Msg.YESNO,fn:this.prcsBody,scope:this,icon:Wtf.MessageBox.QUESTION})}else{if(this.field2.getValue().trim()==""){Wtf.Msg.show({title:"Message without subject",msg:"Send message without subject?",buttons:Wtf.Msg.YESNO,fn:this.prcsSub,scope:this,icon:Wtf.MessageBox.QUESTION})}else{this.finalSend(this)}}}else{Wtf.Msg.alert("Alert","Please specify a recipient.");this.sendBtn.enable();this.closeBtn.enable();this.saveBtn.enable()}},prcsBody:function(A,B){if(A=="yes"){if(this.field2.getValue().trim()==""){Wtf.Msg.show({title:"No Subject?",msg:"Send Message Without Subject?",buttons:Wtf.Msg.YESNO,fn:this.prcsSub,scope:this,icon:Wtf.MessageBox.QUESTION})}else{this.finalSend(this)}}else{if(A=="no"){this.sendBtn.enable();this.closeBtn.enable();this.saveBtn.enable()}}},prcsSub:function(A,B){if(A=="yes"){this.finalSend(this)}else{if(A=="no"){this.sendBtn.enable();this.closeBtn.enable();this.saveBtn.enable()}else{this.finalSend(this)}}},finalSend:function(){this.insertStore.load({params:{type:this.type,sendflag:this.sendflag,ptxt:escape(this.hedit.getValue()),title:this.field2.getValue(),repto:this.reptoName,userId:this.userId,groupId:this.groupId,firstReply:this.firstReply,draft:this.draftFlag,fid:this.fid,categoryid:this.catFlag?this.categoryCombo.getValue():""}})},handleSave:function(A,B){this.closeBtn.disable();this.saveBtn.disable();this.sendBtn.disable();this.insertStore.load({params:{type:this.type,sendflag:this.sendflag,ptxt:escape(this.hedit.getValue()),title:this.field2.getValue(),repto:(this.replyToId=="-1")?this.field1.getValue():this.replyToId,userId:this.userId,groupId:this.groupId,firstReply:this.firstReply,draft:1,fid:this.fid}})}});Wtf.TopicStore=function(){Wtf.TopicStore.superclass.constructor.call(this,{remoteSort:true,proxy:new Wtf.data.HttpProxy({url:"jspfiles/portal/getDetails.jsp"}),reader:new Wtf.data.JsonReader({root:"data",id:"threadid"},["Details","ID","flag"])})};Wtf.extend(Wtf.TopicStore,Wtf.data.Store,{initComponent:function(A){Wtf.TopicStore.superclass.initComponent.call(this,A);this.events={"dataloaded":true}},loadForum:function(D,C,A,B){this.baseParams={topicId:D,type:C,flag:A,userId:B};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/blank.png'></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(B,C,A){if(this.messageId.match("topic")){this.messageId=this.messageId.substring(5)}if(this.messageId==C[0].data["ID"]){document.getElementById("msgDiv_"+this.getId()).innerHTML=Wtf.util.Format.htmlDecode(parseSmiley(unescape(C[0].data["Details"])))}if(C[0].data["flag"]=="Forum"){this.fireEvent("UpdateDstore",C[0].data["Details"],C[0].data["ID"])}else{(C[0].data["flag"]=="Mail")}this.fireEvent("UpdateMailDstore",C[0].data["Details"],C[0].data["ID"])},setData:function(A,E,D,C,B){document.getElementById("subjectDiv_"+this.getId()).innerHTML=A;document.getElementById("fromDiv_"+this.getId()).innerHTML="<a href='#' onclick='javascript:openprofile(\""+B+'","'+E+'","'+C+"\")'>"+E+"</a>";document.getElementById("receivedOn_"+this.getId()).innerHTML=D;if(C==""){document.getElementById("divImg_"+this.getId()).getElementsByTagName("img")[0].src="images/defaultuser.png"}else{document.getElementById("divImg_"+this.getId()).getElementsByTagName("img")[0].src="images/store/"+C}},loadCacheData:function(A){document.getElementById("msgDiv_"+this.getId()).innerHTML=Wtf.util.Format.htmlDecode(parseSmiley(unescape(A)))},setData1:function(A,E,D,C,B){document.getElementById("msgDiv_"+this.getId()).innerHTML=Wtf.util.Format.htmlDecode(unescape(C));document.getElementById("subjectDiv_"+this.getId()).innerHTML=A;document.getElementById("fromDiv_"+this.getId()).innerHTML=E;document.getElementById("receivedOn_"+this.getId()).innerHTML=D;document.getElementById("divImg_"+this.getId()).getElementsByTagName("img")[0].src=B},setFromText:function(B,A){document.getElementById("msgfrom_"+this.getId()).innerHTML=B;document.getElementById("msgDate_"+this.getId()).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.getId()).getElementsByTagName("img")[0].src=""},handleException:function(){document.getElementById("msgDiv_"+this.getId()).innerHTML="<img src='lib/resources/images/default/window/icon-warning.gif' height='16px' width='16px' />Unable to load message..Please try again later"}});var PortalPersonalMessages={};PortalPersonalMessages.TopicStore=function(){PortalPersonalMessages.TopicStore.superclass.constructor.call(this,{sortInfo:{field:"folder",direction:"DESC"},proxy:new Wtf.data.HttpProxy({url:"jspfiles/portal/getmail.jsp"}),reader:new Wtf.data.JsonReader({idProperty:"post_id",root:"data",totalProperty:"totalCount",remoteGroup:true,remoteSort:false},Wtf.data.Record.create([{name:"post_time"},{name:"flag"},{name:"post_id"},{name:"post_subject"},{name:"post_text"},{name:"poster_id"},{name:"readflag"},{name:"imgsrc"},{name:"senderid"},{name:"folder"},{name:"post_fullname"}]))})};Wtf.extend(PortalPersonalMessages.TopicStore,Wtf.data.GroupingStore,{msgLmt:15,loadForum:function(A,C,B){this.baseParams={flag:A,mailflag:C,loginid:B};this.load({params:{start:0,limit:(mailPageLimit&&mailPageLimit.combo)?(mailPageLimit.combo.getValue()||this.msgLmt):this.msgLmt}})},loadSearch:function(E,B,D,C,A){this.baseParams={searchtext:E,folder_id:B,mailflag:D,loginid:C};this.load({params:{start:0,limit:A||this.msgLmt}})},loadRefresh:function(C,E,D,A,B){this.baseParams={flag:C,mailflag:E,loginid:D};this.load({params:{start:A,limit:B||this.msgLmt}})}});Wtf.MailLeftTree=function(F){this.nodeHash={};var L;var J;var B;var H;var I;var E;var K;var C;var A;var G;var D;Wtf.MailLeftTree.superclass.constructor.call(this,F)};Wtf.extend(Wtf.MailLeftTree,Wtf.tree.TreePanel,{autoWidth:true,autoHeight:true,rootVisible:false,id:"folderview",autoScroll:true,animate:Wtf.enableFx,enableDD:false,hlDrop:Wtf.enableFx,setEvents:function(){Wtf.each(["0","1","2","3","4"],function(A){this.getNodeById(A).getUI().getTextEl().setAttribute("pmnode","Personal Messages")},this);Wtf.each(["PM","folders"],function(A){this.getNodeById(A).getUI().getTextEl().setAttribute("pmnode","Not Clickable")},this)},displayMailWindow:function(){if(Wtf.get("tabmailtab")!=null){var C=portalmail_mainPanel.getComponent("tabmailtab_tab1");if(C){portalmail_mainPanel.setActiveTab(C)}var B=portalmail_grid1.getColumnModel();switch(treeObj.nodeid){case"3":B.setColumnHeader(2,"To");B.setColumnHeader(3,"Created on");var A=Wtf.getCmp("folderview").getNodeById(treeObj.nodeid).getUI().getTextEl().innerHTML;displayFoldersWindow(treeObj.nodeid,A);break;case"4":Wtf.getCmp("emails").setFromText("From:","Received on:");B.setColumnHeader(2,"From");B.setColumnHeader(3,"Received on");var A=Wtf.getCmp("folderview").getNodeById(treeObj.nodeid).getUI().getTextEl().innerHTML;displayFoldersWindow(treeObj.nodeid,A);break;case"1":Wtf.getCmp("emails").setFromText("To:","Sent on:");B.setColumnHeader(2,"To");B.setColumnHeader(3,"Sent on");var A=Wtf.getCmp("folderview").getNodeById(treeObj.nodeid).getUI().getTextEl().innerHTML;displayFoldersWindow(treeObj.nodeid,A);break;default:Wtf.getCmp("emails").setFromText("From:","Received on:");B.setColumnHeader(2,"From");B.setColumnHeader(3,"Received on");var A=Wtf.getCmp("folderview").getNodeById(treeObj.nodeid).getUI().getTextEl().innerHTML.split("<");displayFoldersWindow(treeObj.nodeid,A[0]);break}Wtf.getCmp("emails").clearContents()}},EditClick:function(E){var D=E;var C=Wtf.getCmp("folderview").getNodeById(D).getUI().getTextEl().innerHTML.split("<");Wtf.getCmp("folderview").getNodeById(D).getUI().getTextEl().setAttribute("pmnode","Not Clickable");Wtf.getCmp("folderview").getNodeById(D).setText('<input id="temp2" type="textbox" style="width: 80px;"/>');document.getElementById("temp2").value=C[0];document.getElementById("temp2").focus();document.getElementById("temp2").onkeyup=F;document.getElementById("temp2").onblur=B;function F(G){var H=(window.event)?event.keyCode:G.keyCode;switch(H){case 13:B();break;case 27:A();break}}function A(){var G=document.getElementById("temp2");G.parentNode.innerHTML=C[0]}function B(){var H=document.getElementById("temp2");var G=document.getElementById("temp2").value.trim();if(G==""){H.parentNode.innerHTML=C[0]}else{if(C[0]==G){H.parentNode.innerHTML=C[0]}else{Wtf.Ajax.requestEx({url:Wtf.req.prt+"getPageCount.jsp",params:{flag:"editfolder",folderid:D,foldername:G,loginid:loginid}},this,function(I,J){if(I=="-1"){H.parentNode.innerHTML=C[0];Wtf.Msg.alert("Error","Folder with this name already exists")}else{if(I=="-2"){H.parentNode.innerHTML=C[0];Wtf.Msg.alert("Error","Error occurred while connecting to the server")}else{H.parentNode.innerHTML=G;Wtf.getCmp(D).setText(G)}}})}}Wtf.getCmp("folderview").getNodeById(D).getUI().getTextEl().setAttribute("pmnode","Personal Messages")}},DeleteClick:function(B){var A=B;Wtf.getCmp("folderview").getNodeById(A).getUI().getTextEl().setAttribute("pmnode","Not Clickable");Wtf.MessageBox.confirm("Delete Folder","Are you sure to delete folder",function(C){if(C=="yes"){Wtf.Ajax.requestEx({url:Wtf.req.prt+"getPageCount.jsp",params:{flag:"deletefolder",folderid:A}},this,function(D,E){if(D==B){Wtf.menu.MenuMgr.get("portalmail_actionMenu").remove(Wtf.getCmp(A));Wtf.getCmp("folderview").getNodeById(A).remove();dst.loadForum("1","fetch",loginid)}else{Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}})},attachpanel:function(B){treeObj.nodeid=B.id;if(B.getUI().getTextEl().getAttribute("pmnode")!="Not Clickable"){var A=(Wtf.get("tabmailtab")!=null);mainPanel.loadTab("mail.html","   mailtab","Personal Messages","navareadashboard",Wtf.etype.pmessage,false);if(A){treeObj.displayMailWindow()}}},addExistingFolders:function(){Wtf.Ajax.requestEx({url:"jspfiles/portal/getmailfolders.jsp",params:{loginid:loginid}},this,function(result,req){var nodeobj=eval("("+result+")");for(var j=0;j<nodeobj.length;j++){var folderid=nodeobj[j].folderid;var foldernametext=nodeobj[j].foldername;Wtf.menu.MenuMgr.get("portalmail_actionMenu").add({text:foldernametext,id:folderid,icon:"lib/resources/images/default/tree/folder.gif"});treeObj.temptreenode=new Wtf.tree.TreeNode({text:foldernametext,allowDrag:false,leaf:true,id:folderid,icon:"lib/resources/images/default/tree/folder.gif",uiProvider:Wtf.tree.NewFolderUI});Wtf.getCmp("folderview").getNodeById("folders").appendChild(treeObj.temptreenode);Wtf.getCmp("folderview").getNodeById("folders").expand();treeObj.temptreenode.getUI().getTextEl().setAttribute("pmnode","Personal Messages");treeObj.temptreenode.on("click",treeObj.attachpanel);treeObj.temptreenode.on("edclick",this.EditClick);treeObj.temptreenode.on("delclick",this.DeleteClick);treeObj.temptreenode=null}})},initComponent:function(){Wtf.MailLeftTree.superclass.initComponent.call(this);treeObj=this;function C(G,H,D,F,E){return new Wtf.tree.TreeNode({text:G,id:H,allowDrag:D,leaf:F,icon:E})}var A=new Wtf.tree.AsyncTreeNode({text:"",expanded:true});var B=new Wtf.tree.TreeNode({text:"Personal Messages",id:"PM",allowDrag:false,singleClickExpand:true,expanded:true});inbox=new Wtf.tree.TreeNode({text:"Inbox",id:"0",allowDrag:false,icon:"images/inbox.png"});outbox=C("Sent Items","1",false,true,"images/outbox.png");deleteditems=C("Deleted Items","2",false,true,"images/Delete.gif");drafts=C("Drafts","3",false,true,"images/mail_generic.png");starreditems=C("Flagged Items","4",false,true,"images/FlagRed16.png");folders=new Wtf.tree.TreeNode({text:'Folders <a id="leftTreeAnchor" href="#"><span  pmnod="Not Clickable"><img style="vertical-align:text-top;" src="images/btn_add_quick.gif" style="height:12px;"/></span></a>',allowDrag:false,id:"folders",icon:"images/folder_add.gif",singleClickExpand:false});this.setRootNode(A);A.appendChild(B);B.appendChild([inbox,outbox,deleteditems,drafts,starreditems,folders]);folders.addListener("click",function(){return false})},afterRender:function(){Wtf.MailLeftTree.superclass.afterRender.call(this);document.getElementById("leftTreeAnchor").onclick=this.addFolder;this.setEvents();this.addExistingFolders();Wtf.each(["0","1","2","3","4"],function(A){this.getNodeById(A).on("click",this.attachpanel)},this)},addFolder:function(){if(treeObj.temptreenode==null){treeObj.temptreenode=new Wtf.tree.TreeNode({allowDrag:false,leaf:true,id:"TreeNode",icon:"lib/resources/images/default/tree/folder.gif",uiProvider:Wtf.tree.NewFolderUI});treeObj.temptreenode.setText('<input id="temp1" type="textbox" style="width:80px;"/>');treeObj.temptreenode.on("click",function(){return false});folders.appendChild(treeObj.temptreenode);folders.expand();treeObj.temptreenode.getUI().getTextEl().setAttribute("pmnode","Not Clickable")}document.getElementById("temp1").onkeyup=A;function D(E){if(document.getElementById("temp1")!=null){document.getElementById("temp1").focus();document.getElementById("temp1").onblur=C}}function A(E){var F=(window.event)?event.keyCode:E.keyCode;switch(F){case 13:C();break;case 27:B();break}}function B(){Wtf.getCmp("folderview").getNodeById("TreeNode").remove();treeObj.temptreenode=null}document.getElementById("temp1").onblur=C;function C(){var E=document.getElementById("temp1").value.trim();if(E==""){Wtf.getCmp("folderview").getNodeById("TreeNode").remove();treeObj.temptreenode=null}else{Wtf.Ajax.requestEx({url:Wtf.req.prt+"getPageCount.jsp",params:{flag:"savefolder",loginid:loginid,foldername:E}},this,function(F,G){if(F=="-1"){Wtf.getCmp("folderview").getNodeById("TreeNode").remove();Wtf.Msg.alert("Error","Folder with this name already exist")}else{if(F=="-2"){Wtf.getCmp("folderview").getNodeById("TreeNode").remove();Wtf.Msg.alert("Error","Error occurred while connecting to the server")}else{Wtf.menu.MenuMgr.get("portalmail_actionMenu").add({text:E,id:F,icon:"lib/resources/images/default/tree/folder.gif"});Wtf.getCmp("folderview").getNodeById("TreeNode").remove();treeObj.temptreenode=new Wtf.tree.TreeNode({allowDrag:false,leaf:true,id:F,icon:"lib/resources/images/default/tree/folder.gif",text:E,uiProvider:Wtf.tree.NewFolderUI});Wtf.getCmp("folderview").getNodeById("folders").appendChild(treeObj.temptreenode);Wtf.getCmp("folderview").getNodeById("folders").expand();treeObj.temptreenode.getUI().getTextEl().setAttribute("pmnode","Personal Messages");treeObj.temptreenode.on("click",treeObj.attachpanel,treeObj);treeObj.temptreenode.on("edclick",treeObj.EditClick,treeObj);treeObj.temptreenode.on("delclick",treeObj.DeleteClick,treeObj)}}treeObj.temptreenode=null},function(F,G){treeObj.temptreenode=null})}treeObj.temptreenode=null}}});Wtf.tree.NewFolderUI=function(A){this.node=A;this.rendered=false;this.animating=false;this.wasLeaf=true;this.addEvents={"edclick":true,"delclick":true};this.ecc="x-tree-ec-icon x-tree-elbow"};Wtf.extend(Wtf.tree.NewFolderUI,Wtf.tree.TreeNodeUI,{renderElements:function(C,H,G,I){this.indentMarkup=C.parentNode?C.parentNode.ui.getChildIndent():"";var D=typeof H.checked=="boolean";var A=H.href?H.href:Wtf.isGecko?"":"#";var B=['<li class="x-tree-node"><table wtf:tree-node-id="',C.id,'" class="x-tree-node-el x-tree-node-leaf ',H.cls,'" cellspacing="0" cellpadding="0" ><tbody><tr><td>',this.indentMarkup,'</td><td ><img src="',Wtf.BLANK_IMAGE_URL,'" class="x-tree-ec-icon x-tree-elbow" /><img src="',H.icon||this.emptyIcon,'" class="x-tree-node-icon',(H.icon?" x-tree-node-inline-icon":""),(H.iconCls?" "+H.iconCls:""),'" unselectable="on" /></td><td class="chip"><a hidefocus="on"  class="x-tree-node-anchor" tabIndex="1" ',H.hrefTarget?' target="'+H.hrefTarget+'"':"",">",'<span  unselectable="on">',C.text,'</span></td><td onmousedown="" ><img title="edit folder" id="edit',C.id,'" style="cursor: pointer;" do="edit" src="images/edit12.gif"/><img title="delete folder" id="del',C.id,'" style="cursor: pointer;" do="delete" src="images/stop12.gif"/></td></tr></tbody></table><ul class="x-tree-node-ct" style="display:none;"></ul></li>'].join("");var F=2;this.wrap=Wtf.DomHelper.insertHtml("beforeEnd",C.parentNode.ui.ctNode,B);this.elNode=this.wrap.childNodes[0].childNodes[0].rows[0];this.ctNode=this.wrap.parentNode;var E=this.elNode.childNodes;this.indentNode=E[0].firstChild;this.ecNode=E[1].firstChild;this.iconNode=E[1].lastChild;this.anchor=E[F].firstChild;this.textNode=E[F].firstChild.firstChild;Wtf.get("edit"+C.id).on("click",function(){this.fireEvent("edclick",this.node.id)},this);Wtf.get("del"+C.id).on("click",function(){this.fireEvent("delclick",this.node.id)},this)}});Wtf.ChatHTMLEditor=function(A){Wtf.ChatHTMLEditor.superclass.constructor.call(this,A);this.addEvents={"enterKeyPressed":true}};Wtf.extend(Wtf.ChatHTMLEditor,Wtf.newHTMLEditor,{applyCommand:function(C){var A=C;if(C.ctrlKey){var D=C.getCharCode(),B;if(D>0){D=String.fromCharCode(D);switch(D){case"b":B="bold";break;case"i":B="italic";break;case"u":B="underline";break}if(B){this.win.focus();this.execCmd(B);this.deferFocus();C.preventDefault()}}}if(A.getKey()==13){C.preventDefault();this.fireEvent("enterKeyPressed")}},fixKeys:function(){if(Wtf.isIE){return function(D){var A=D.getKey(),B;if(A==D.TAB){D.stopEvent();B=this.doc.selection.createRange();if(B){B.collapse(true);B.pasteHTML("&nbsp;&nbsp;&nbsp;&nbsp;");this.deferFocus()}}else{if(A==D.ENTER){D.stopEvent();B=this.doc.selection.createRange();this.fireEvent("enterKeyPressed");if(B){var C=B.parentElement();if(!C||C.tagName.toLowerCase()!="li"){D.stopEvent();B.collapse(false);B.select()}}}}}}else{if(Wtf.isOpera){return function(B){var A=B.getKey();if(A==B.TAB){B.stopEvent();this.win.focus();this.execCmd("InsertHTML","&nbsp;&nbsp;&nbsp;&nbsp;");this.deferFocus()}}}else{if(Wtf.isSafari){return function(B){var A=B.getKey();if(A==B.TAB){B.stopEvent();this.execCmd("InsertText","\t");this.deferFocus()}}}}}}()});Wtf.studentScholGrid=function(config){Wtf.apply(this,config);this.ssStore=new Wtf.data.JsonStore({url:"jspfiles/portal/loadForumTree.jsp",root:"data",totalProperty:"count",fields:["scholarshipid","name","description","status"],baseParams:{type:2}});this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.cmodel=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),this.sm,{header:"Name",dataIndex:"name"},{header:"Description",dataIndex:"description"},{header:"Status",dataIndex:"status",renderer:function(value){var rtString;if(value=="0"){rtString="Waiting for approval"}else{if(value=="1"){rtString="<font color=green>Approved<span>"}else{if(value=="2"){rtString="<font color=red>Rejected</span>"}else{rtString="Open"}}}return rtString}}]);this.cmodel.defaultSortable=true;this.ssGrid=new Wtf.grid.GridPanel({ds:this.ssStore,cm:this.cmodel,sm:this.sm,border:true,enableColumnHide:false,viewConfig:{forceFit:true}});this.applyBttn=new Wtf.Toolbar.Button({text:"Apply",disabled:true,tooltip:"Apply for selected Scholarship",scope:this});this.refBttn=new Wtf.Toolbar.Button({text:"Refresh",tooltip:"Refresh",scope:this,handler:function(){this.ssStore.load()}});this.applyBttn.on("click",function(){Wtf.MessageBox.show({title:"Confirm",msg:"Are you sure you want to apply for selected scholarship plan?",buttons:Wtf.MessageBox.YESNO,animEl:"upwin",icon:Wtf.MessageBox.WARNING,scope:this,fn:function(text){if(text=="yes"){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/portal/loadForumTree.jsp",params:{type:3,scholarshipid:this.ssGrid.selModel.getSelected().get("scholarshipid")}},this,function(response,request){var resp=eval("("+response+")");if(resp.success=="true"){msgBoxShow(["Success","Request for Scholarship has been successfully submited"],Wtf.MessageBox.INFO);this.ssStore.load()}else{msgBoxShow(["Error","Error connecting to server"],Wtf.MessageBox.ERROR)}},function(response,request){msgBoxShow(["Error","Error connecting to server"],Wtf.MessageBox.ERROR)})}}})},this);this.sm.on("selectionchange",function(sm){if(sm.hasSelection()&&(sm.getSelected().get("status")=="-1"||sm.getSelected().get("status")=="2")){this.applyBttn.enable()}else{this.applyBttn.disable()}},this);Wtf.studentScholGrid.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",tbar:[this.applyBttn,"-",this.refBttn],items:[this.ssGrid]});this.on("render",this.handleRender,this)};Wtf.extend(Wtf.studentScholGrid,Wtf.Panel,{handleRender:function(){this.ssStore.load()}});function folderClick(A,B){var C=A.id;Wtf.MessageBox.confirm("Move Message","Are you sure to move selected message",function(D){if(D=="yes"){UpdateFolderID(C)}})}portalmail_actionMenu=new Wtf.menu.Menu({id:"portalmail_actionMenu",items:[{text:"Inbox",id:"0",icon:"images/inbox.png"},{text:"Drafts",id:"3",icon:"images/mail_generic.png"},new Wtf.menu.Separator({})]});portalmail_actionMenu.on("itemclick",folderClick);portalmail_sm1=new Wtf.grid.CheckboxSelectionModel();function rowDeselect(D,A,C){if(D.getSelections().length==0){Wtf.getCmp("emails").clearContents();Wtf.getCmp("btndelete").disable();Wtf.getCmp("MoveFolders").disable();Wtf.getCmp("btnmoreactions").disable();Wtf.getCmp("btnreplyto").disable()}if(D.getCount()==1){for(i=0;i<dst.getCount();i++){if(D.isSelected(i)){var B=i}}rowSelectionChange(D,B,C)}}function rowSelectionChange(C,B,A){Wtf.getDom("msgDiv_emails").style.display="block";if(C.getSelections().length>0){Wtf.getCmp("btndelete").enable();Wtf.getCmp("MoveFolders").enable();Wtf.getCmp("btnmoreactions").enable();Wtf.getCmp("btnreplyto").enable();if(C.getSelections().length>1){Wtf.getCmp("btnreplyto").disable();Wtf.getCmp("emails").clearContents()}}MessagePanel1.setData1("","","",'<div class="loading-indicator">&#160;Loading...</div>',"");MessagePanel1.setData(dst.getAt(B).get("post_subject"),dst.getAt(B).get("post_fullname"),Wtf.modifyDateFmt(dst.getAt(B).get("post_time"),"Y-m-j G:i:s","Y-m-j h:i A"),dst.getAt(B).get("imgsrc"),dst.getAt(B).get("senderid"));MessagePanel1.messageId=dst.getAt(B).get("post_id");if(dst.getAt(B).get("post_text")==""){MessagePanel1.topicstore.loadForum(dst.getAt(B).get("post_id"),"-1","mail","")}else{MessagePanel1.loadCacheData(dst.getAt(B).get("post_text"))}if(C.getCount()>1){Wtf.getCmp("emails").clearContents();Wtf.getDom("msgDiv_emails").style.display="none"}}function inboxPublishHandler(msg){if(portalmail_folderid==0){var temp=eval("("+msg.data.data+")");var temp1=Wtf.decode(temp.data[0]).data;var ds=Wtf.getCmp("grid123").getStore();var m=new mailMsg({post_time:temp1[0].post_time,flag:temp1[0].flag,post_id:temp1[0].post_id,post_subject:temp1[0].post_subject,post_text:temp1[0].post_text,poster_id:temp1[0].poster_id,readflag:temp1[0].readflag,imgsrc:temp1[0].imgsrc,senderid:temp1[0].senderid});ds.insert(0,m)}}var snippet='<div><img src="{imgico}"/><div class="snippet">{title}</div><br/><span  class="txt">{descp}</span></div>';var tpl;tpl=new Wtf.Template(snippet);tpl.compile();function createReplyWindow(){wind=new Wtf.ReplyWindow({uLabel:"Reply To",bLabel:"Subject",tdisabled:true,title:"Reply",closable:true,layout:"fit",replytoId:portalmail_sm1.getSelected().data["post_id"],userId:loginid,groupId:"",firstReply:"",uFieldValue:portalmail_sm1.getSelected().data["poster_id"],details:"<br><br><br><br><br><br><br><br><-----------------Original Message-----------------><br><br><br>On "+Wtf.modifyDateFmt(portalmail_sm1.getSelected().data["post_time"],"Y-m-j G:i:s","Y-m-j h:i A")+", "+portalmail_sm1.getSelected().data["post_fullname"]+" wrote: <br><br>"+portalmail_sm1.getSelected().data["post_text"],bFieldValue:"Re:",type:"Mail",sendFlag:"reply",fid:portalmail_folderid,composeMail:5});wind.insertStore.on("load",handleInsertMail);portalmail_mainPanel.add(wind).show()}function createReplyWindowForPMsg(B){var A=Wtf.getCmp("grid123").getStore();wind=new Wtf.ReplyWindow({uLabel:"Reply To",bLabel:"Subject",tdisabled:true,replytoId:B,userId:loginid,title:"Reply",closable:true,layout:"fit",groupId:"",firstReply:"",uFieldValue:A.getAt(A.find("post_id",B)).get("poster_id"),bFieldValue:"Re:",type:"Mail",details:"<br><br><br><br><br><br><br><br><-----------------Original Message-----------------><br><br><br>On "+Wtf.modifyDateFmt(A.getAt(A.find("post_id",B)).get("post_time"),"Y-m-j G:i:s","Y-m-j h:i A")+", "+A.getAt(A.find("post_id",B)).get("post_fullname")+" wrote: <br><br>"+A.getAt(A.find("post_id",B)).get("post_text"),sendFlag:"reply",fid:portalmail_folderid,composeMail:5});wind.insertStore.on("load",handleInsertMail);portalmail_mainPanel.add(wind).show()}function handleInsertMail(B,C,A){if(C[0]){if(C[0].data["Success"].match("Success")){Wtf.Msg.alert("Message Sent","Message has been sent successfully.");this.panelObj.handleClose()}else{if(C[0].data["Success"].match("Fail")){Wtf.Msg.alert("Error","Error occurred while sending message.")}else{if(C[0].data["Success"].match("Draft")){Wtf.Msg.alert("Saved","Message saved to drafts successfully.");this.panelObj.handleClose()}else{if(C[0].data["Success"].match("userfail")){Wtf.Msg.alert("Delivery Failure","Message to user "+C[0].data["Subject"]+" is invalid.")}}}}}}function handleCompose(){var A=new Wtf.ReplyWindow({uLabel:"To",bLabel:"Subject",tdisabled:false,replytoId:"-1",userId:loginid,groupId:"",title:"Compose Message",closable:true,firstReply:"",uFieldValue:"",bFieldValue:"",type:"Mail",sendFlag:"newmsg",composeMail:1});A.insertStore.on("load",handleInsertMail);portalmail_mainPanel.add(A).show();A.doLayout();A.on("destroy",function(){A.hedit.closeSmileyWindow()});A.on("deactivate",function(){A.hedit.closeSmileyWindow()})}function createMailFunctions(){return([new Wtf.Action({text:"Compose Message",id:"compMail",handler:function(){handleCompose()},tooltip:{title:"Compose",text:"Compose new message"},iconCls:"pwnd compose"}),new Wtf.Action({text:"Reply",id:"btnreplyto",handler:function(){createReplyWindow()},tooltip:{title:"Reply",text:"Reply to selected message"},iconCls:"pwnd outbox"}),new Wtf.Action({text:"Delete",handler:DeleteMails,id:"btndelete",tooltip:{title:"Delete Messages",text:"Delete selected messages"},iconCls:"pwnd deliconwt"}),moveto=new Wtf.Toolbar.Button({text:"Move To",iconCls:"pwnd sendmsg",tooltip:{title:"Move Messages",text:"Move selected messages"},id:"MoveFolders",menu:portalmail_actionMenu}),moreactions=new Wtf.Toolbar.Button({text:"More Actions",iconCls:"pwnd settings",tooltip:{title:"More Actions",text:"Perform more actions"},id:"btnmoreactions",menu:{items:[{text:"Add flag",handler:addstarClick,icon:"images/FlagRed16.png"},{text:"Remove flag",handler:removestarClick,icon:"images/FlagGrey16.png"}]}}),"Search: ",new Wtf.form.TextField({id:"mailsearchtextbox",width:150,height:19}),new Wtf.Toolbar.Button({text:"",id:"btnsearch",iconCls:"pwnd btnMailSearch",handler:searchmails,ctCls:"searchrightbutton",tooltip:{title:"Search Messages",text:"Search for messages in all folders"}})])}function createMailToolbar(C){var B=Array();if(portalmail_folderid!="2"){var A=new Wtf.menu.Menu({id:"portalmail_actionMenuForPMsg"+C,items:[{text:"Drafts    ",handler:function(){Wtf.MessageBox.confirm("Move Message","Are you sure to move selected message",function(D){if(D=="yes"){UpdateFolderIDForPerMsg(C,3)}})},icon:"images/mail_generic.png"}]});if(portalmail_folderid=="0"||(portalmail_folderid!="1"&&portalmail_folderid!="4")){B.push(new Wtf.Action({text:"Reply",id:"btnreplyto1",handler:function(){createReplyWindowForPMsg(C)},tooltip:{title:"Reply",text:"Reply to selected message"},iconCls:"pwnd outbox"}))}B.push(new Wtf.Action({text:"Delete",handler:function(){Wtf.MessageBox.confirm("Delete Message","Are you sure to delete selected message",function(D){if(D=="yes"){UpdateFolderIDForPerMsg(C,2);Wtf.Msg.alert("Message Delete","Message has been deleted successfully.")}})},id:"btndelete1",tooltip:{title:"Delete Messages",text:"Delete selected messages"},iconCls:"pwnd delicon"}));B.push(moveto1=new Wtf.Toolbar.MenuButton({text:"Move To",iconCls:"pwnd sendmsg",tooltip:{title:"Move Messages",text:"Move selected messages"},id:"MoveFolders"+C,menu:A}))}else{B.push(new Wtf.Action({text:"Delete Forever",id:"btndelforever1",handler:function(){deleteMsgForever(C)},tooltip:{title:"Delete Message Forever",text:"Delete selected message forever"},iconCls:"pwnd delicon"}));B.push(new Wtf.Action({text:"Restore Message",id:"btnrestoremsg1",handler:function(){RestoreMsg(C)},tooltip:{title:"Restore Message",text:"Restore selected message"},iconCls:"pwnd sendmsg"}))}return B}function addExistingFoldersForMsgMenu(postid){if(portalmail_folderid!="2"){Wtf.Ajax.requestEx({url:Wtf.req.prt+"getmailfolders.jsp",params:{loginid:loginid}},this,function(result,req){var nodeobj=eval("("+result+")");for(var j=0;j<nodeobj.length;j++){var folderid=nodeobj[j].folderid;var foldernametext=nodeobj[j].foldername;Wtf.menu.MenuMgr.get("portalmail_actionMenuForPMsg"+postid).add({text:foldernametext,id:folderid,handler:function(e){folderid=e.id;Wtf.MessageBox.confirm("Move Message","Are you sure to move selected message",function(btn){if(btn=="yes"){UpdateFolderIDForPerMsg(postid,folderid)}})},icon:"lib/resources/images/default/tree/folder.gif"})}})}}function deleteMsgForever(A){Wtf.MessageBox.confirm("Delete Message","Are you sure to delete forever selected message",function(B){if(B=="yes"){var C=Wtf.getCmp("grid123").getStore();Wtf.Ajax.request({method:"POST",url:Wtf.req.prt+"getmail.jsp",params:({mailflag:"deleteforever",post_id:A}),scope:this,success:function(D,E){if(A==D.responseText.trim()){C.remove(C.getAt(C.find("post_id",A)));Wtf.Msg.alert("Deleted","Message has been deleted successfully.")}else{Wtf.Msg.alert("Error","Error occurred while connecting to the server")}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}})}function RestoreMsg(A){Wtf.MessageBox.confirm("Restore Message","Are you sure to restore selected message",function(B){if(B=="yes"){var C=Wtf.getCmp("grid123").getStore();Wtf.Ajax.request({method:"POST",url:Wtf.req.prt+"getmail.jsp",params:({mailflag:"restoremsg",post_id:A}),scope:this,success:function(D,E){if(A==D.responseText.trim()){C.remove(C.getAt(C.find("post_id",A)));Wtf.Msg.alert("Restored","Message has been restored successfully.")}else{Wtf.Msg.alert("Error","Error occurred while connecting to the server")}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}})}function UpdateFolderIDForPerMsg(postid,folder_id){var last_folder_id=portalmail_folderid;var ds=Wtf.getCmp("grid123").getStore();var jsonData="{data:[";jsonData+="{'post_id':'"+escape(postid)+"'}";jsonData+="]}";Wtf.Ajax.request({method:"POST",url:Wtf.req.prt+"getmail.jsp",params:({mailflag:"movemails",last_folder_id:last_folder_id,dest_folder_id:folder_id,post_id:jsonData}),scope:this,success:function(result,b){var nodeobj=eval("("+result.responseText+")");var storeobj=Wtf.getCmp("grid123").getStore();for(var j=0;j<nodeobj.data.length;j++){storeobj.remove(ds.getAt(ds.find("post_id",nodeobj.data[j].post_id)))}},failure:function(){}})}function ImageReturn(A){if(A==true){return"<img id='flagImage' class='starImgDiv' onclick='changeStarImage(this)' star=0 src='images/FlagRed.png'></img>"}else{return"<img id='flagImage' class='starImgDiv' onclick='changeStarImage(this)' star=1 src='images/FlagGrey.png'></img>"}}function MsgRead(D,C,F,B,E,A){alert(portalmail_grid1.getView().getRow(B).getElementsByTagName("td")[E])}function beforeRowselect(E,A,B,C){var D=C.get("folder");if(D){portalmail_folderid=parseInt(D)}}function onClickHandle1(A,I,C,D){if(D.target.id=="flagImage"){inboxFlag=true}if(portalmail_sm1.getCount()==1){updateButtonStatus(1);var B=Wtf.getCmp("grid123").getStore();var E=[];E=portalmail_sm1.getSelections();var F=E[0];var G=B.find("post_id",F.get("post_id"));var H=F.get("folder");if(H){portalmail_folderid=parseInt(H)}}else{if(portalmail_sm1.getCount()==0){enablemailtoolbarbtns();MessagePanel1.setData1("","","","","images/blank.png")}else{if(portalmail_sm1.getCount()>1){updateButtonStatus(portalmail_sm1.getCount());MessagePanel1.setData1("","","","","images/blank.png")}}}}function loadingDisplay(A){return'<div style="float: left; width:100%"><div style="float: left;">'+A+'</div><div style="float: right; color: rgb(0,0,0); margin-left: 20px; font-weight: normal;">&#160;Loading...</div></div>'}function loadingDisplayNo(A){return'<div style="float: left; width:100%"><div style="float: left;">'+A+'</div><div style="float: right; color: rgb(0,0,0); margin-left: 20px; font-weight: normal;">No messages to display</div></div>'}function enablemailtoolbarbtns(){Wtf.getCmp("btnreplyto").disable();Wtf.getCmp("btndelete").disable();Wtf.getCmp("MoveFolders").disable();Wtf.getCmp("btnmoreactions").disable()}function displayFoldersWindow(D,B){enablemailtoolbarbtns();document.getElementById("mailsearchtextbox").value="";portalmail_folderid=D;portalmail_titleflag=B;portalmail_grid1.setTitle(portalmail_titleflag);var A="";Wtf.Ajax.timeout=Wtf.CUSTOM_TIME_OUT;dst.loadForum(D,"fetch",loginid);dst.on("loadexception",function C(){Wtf.Ajax.timeout=Wtf.DEFAULT_TIME_OUT;Wtf.Msg.alert("Error","Error occurred while connecting to the server")});portalmail_grid1.store=dst;A=portalmail_grid1.getView();A.refresh();dst.on("load",function(G,E,H){Wtf.Ajax.timeout=Wtf.DEFAULT_TIME_OUT;var F=portalmail_grid1.getView();if(E.length==0){portalmail_grid1.setTitle(loadingDisplayNo(portalmail_titleflag))}else{F.refresh();portalmail_grid1.store.clearGrouping()}if(portalmail_folderid=="0"){for(i=0;i<G.getCount();i++){if(E[i].data["readflag"]==false){portalmail_grid1.getView().getCell(i,1).firstChild.style.fontWeight="bold";portalmail_grid1.getView().getCell(i,2).firstChild.style.fontWeight="bold";portalmail_grid1.getView().getCell(i,3).firstChild.style.fontWeight="bold"}}}})}function gridrowDoubleClick(E,I,H){var C=Wtf.getCmp("grid123").getStore();var A=C.getAt(I).get("post_id");var G=C.getAt(I).get("post_subject");if(G==""){G="[No Subject]"}var B="emailsTab"+A;var D=portalmail_mainPanel.getComponent(B);if(D){portalmail_mainPanel.setActiveTab(D)}else{var F=new Wtf.MessagePanel({id:"emails"+A});if(portalmail_folderid=="3"){wind=new Wtf.ReplyWindow({uLabel:"Reply To",bLabel:"Subject",title:"Draft",tabWidth:150,closable:true,tdisabled:false,replytoId:portalmail_sm1.getSelected().data["post_id"],userId:loginid,groupId:"",firstReply:"",uFieldValue:portalmail_sm1.getSelected().data["poster_id"],bFieldValue:portalmail_sm1.getSelected().data["post_subject"],type:"Mail",sendFlag:"reply",composeMail:5,fid:portalmail_folderid,details:portalmail_sm1.getSelected().data["post_text"]});wind.insertStore.on("loadsuccess",handleInsertMail);portalmail_mainPanel.add(wind).show()}else{portalmail_mainPanel.add({id:"emailsTab"+A,title:G,closable:true,layout:"fit",tbar:createMailToolbar(A),items:F}).show();F.setData(C.getAt(I).get("post_subject"),C.getAt(I).get("post_fullname"),Wtf.modifyDateFmt(C.getAt(I).get("post_time"),"Y-m-j G:i:s","Y-m-j h:i A"),C.getAt(I).get("imgsrc"),C.getAt(I).get("senderid"));if(portalmail_folderid=="1"){F.setFromText("To:","Sent on:")}else{F.setFromText("From:","Received on:")}if(C.getAt(I).get("post_text")==""){F.topicstore.loadForum(C.getAt(I).get("post_id"),"-1","mail","")}else{F.loadCacheData(C.getAt(I).get("post_text"))}addExistingFoldersForMsgMenu(A)}}}function DeleteMails(){var A="Are you sure to delete selected messages?";if(portalmail_folderid==2){A="Are you sure to delete selected messages permenantly?"}Wtf.MessageBox.confirm("Delete Message",A,function(B){if(B=="yes"){UpdateFolderID(2);Wtf.getCmp("btndelete").disable();Wtf.getCmp("MoveFolders").disable();Wtf.getCmp("btnmoreactions").disable();Wtf.getCmp("btnreplyto").disable();portalmail_sm1.clearSelections()}})}function UpdateFolderID(folder_id){var last_folder_id=portalmail_folderid;var ds=Wtf.getCmp("grid123").getStore();var selArray=Array();selArray=portalmail_sm1.getSelections();var jsonData="{data:[";for(i=0;i<selArray.length;i++){var rowobj=selArray[i];jsonData+="{'post_id':'"+escape(rowobj.get("post_id"))+"'},"}jsonData=jsonData.substring(0,jsonData.length-1)+"]}";Wtf.Ajax.request({method:"POST",url:"jspfiles/portal/getmail.jsp",params:({mailflag:"movemails",last_folder_id:last_folder_id,dest_folder_id:folder_id,post_id:jsonData}),scope:this,success:function(result,b){var nodeobj=eval("("+result.responseText+")");var storeobj=Wtf.getCmp("grid123").getStore();for(var j=0;j<nodeobj.data.length;j++){storeobj.remove(ds.getAt(ds.find("post_id",nodeobj.data[j].post_id)))}},failure:function(){}})}function searchmails(){enablemailtoolbarbtns();var C=escape(document.getElementById("mailsearchtextbox").value.trim());dst.on("loadexception",function D(){Wtf.Ajax.timeout=Wtf.DEFAULT_TIME_OUT;Wtf.Msg.alert("Error","Error occurred while connecting to the server")});if(C.length>0){portalmail_grid1.setTitle("Search results");var B="";var A=0;Wtf.Ajax.timeout=Wtf.CUSTOM_TIME_OUT;dst.loadSearch(C,A,"searchmails",loginid,mailPageLimit.combo.getValue());portalmail_grid1.store=dst;B=portalmail_grid1.getView();B.refresh();dst.on("load",function(F,E,G){Wtf.Ajax.timeout=Wtf.DEFAULT_TIME_OUT;if(E.length==0){portalmail_grid1.setTitle(loadingDisplayNo(portalmail_titleflag))}else{B.refresh();portalmail_grid1.getStore().groupBy("folder")}});searchFlag=true}else{if(searchFlag){Wtf.Ajax.timeout=Wtf.CUSTOM_TIME_OUT;dst.loadForum(portalmail_folderid,"fetch",loginid);searchFlag=false;dst.on("load",function(F,E,G){Wtf.Ajax.timeout=DEFAULT_TIME_OUT;portalmail_grid1.getView().refresh();portalmail_grid1.store.clearGrouping();if(portalmail_folderid=="0"){for(i=0;i<F.getCount();i++){if(E[i].data["readflag"]==false){portalmail_grid1.getView().getCell(i,1).firstChild.style.fontWeight="bold";portalmail_grid1.getView().getCell(i,2).firstChild.style.fontWeight="bold";portalmail_grid1.getView().getCell(i,3).firstChild.style.fontWeight="bold"}}}})}}}function changeStarImage(obj1){var grid=Wtf.getCmp("grid123");grid.loadMask.show();var rowobj=portalmail_sm1.getSelected();var rowindex=grid.store.find("post_id",rowobj.get("post_id"));var star=obj1.getAttribute("star");if(star==1){flag="true"}else{flag="false"}var jsonData="{data:[";jsonData+="{'post_id':'"+escape(rowobj.get("post_id"))+"'}";jsonData+="]}";Wtf.Ajax.request({method:"POST",url:"jspfiles/portal/getmail.jsp",params:({mailflag:"starchange",post_id:jsonData,flag:flag}),scope:this,success:function(action,response){var res=eval("("+action.responseText.trim()+")").data;for(var cnt=0;cnt<res.length;cnt++){var s=Wtf.getCmp("grid123").getStore();var ri=s.find("post_id",res[cnt].postid);var gV=Wtf.getCmp("grid123").getView();var img=gV.getCell(ri,4).firstChild.firstChild;if(res[cnt].flag){img.src="images/FlagRed.png";img.setAttribute("star",0)}else{img.src="images/FlagGrey.png";img.setAttribute("star",1)}}grid.loadMask.hide()},failure:function(){grid.loadMask.hide()}})}function addstarClick(){handleStarChange("true")}function removestarClick(){handleStarChange("false")}function handleContextRestore(){RestoreMsg(portalmail_sm1.getSelected().data["post_id"])}function handleStarChange(D){var B=Wtf.getCmp("grid123");var I=B.getBottomToolbar();var E=I.cursor;var A=portalmail_folderid;var H=portalmail_titleflag;var C=Array();C=portalmail_sm1.getSelections();var G='{"data":[';for(i=0;i<C.length;i++){var F=C[i];G+='{"post_id":"'+escape(F.get("post_id"))+'"},'}G=G.substring(0,G.length-1)+"]}";Wtf.Ajax.request({method:"POST",url:Wtf.req.prt+"getmail.jsp",params:({mailflag:"starchange",flag:D,post_id:G}),scope:this,success:function(){Wtf.Ajax.timeout=Wtf.CUSTOM_TIME_OUT;dst.loadRefresh(A,"fetch",loginid,E);dst.on("loadexception",function J(){Wtf.Ajax.timeout=Wtf.DEFAULT_TIME_OUT;Wtf.Msg.alert("Error","Error occurred while connecting to the server")});portalmail_grid1.store=dst;view=portalmail_grid1.getView();view.refresh();dst.on("load",function(L,K,M){Wtf.Ajax.timeout=Wtf.DEFAULT_TIME_OUT})},failure:function(){}})}function updateButtonStatus(A){if(portalmail_folderid=="0"){if(A==1){Wtf.getCmp("btnreplyto").enable()}else{Wtf.getCmp("btnreplyto").disable()}Wtf.getCmp("btndelete").enable();Wtf.getCmp("MoveFolders").enable();Wtf.getCmp("btnmoreactions").enable();Wtf.getCmp("0").disable()}else{if(portalmail_folderid=="2"){enablemailtoolbarbtns();Wtf.getCmp("btndelete").enable()}else{if(portalmail_folderid=="4"){Wtf.getCmp("btnreplyto").disable();Wtf.getCmp("btndelete").disable();Wtf.getCmp("MoveFolders").disable();Wtf.getCmp("btnmoreactions").enable()}else{if(portalmail_folderid=="1"){Wtf.getCmp("btnreplyto").disable();Wtf.getCmp("btndelete").enable();Wtf.getCmp("MoveFolders").enable();Wtf.getCmp("btnmoreactions").enable()}else{Wtf.getCmp("btnreplyto").enable();Wtf.getCmp("btndelete").enable();Wtf.getCmp("MoveFolders").enable();Wtf.getCmp("btnmoreactions").disable();Wtf.getCmp("0").enable()}}}}}function onMailGridContextmenu(B,A,C){portalmail_sm1.selectRow(A);var D=null;if(!D){D=new Wtf.menu.Menu({id:"context12",items:[{text:"Reply",id:"cntxbtnreplyto",handler:createReplyWindow,iconCls:"pwnd outboxCx"},{text:"Delete",handler:DeleteMails,id:"cntxbtndelete",iconCls:"pwnd delicon"},{text:"Restore Message",iconCls:"msgRestore",id:"cntxbtnrestore",handler:handleContextRestore},{text:"Move To",iconCls:"pwnd sendmsgwt",id:"cntxbtnmoveto",menu:portalmail_actionMenu},{text:"More Actions",iconCls:"pwnd settingswt",id:"cntxbtnmoreactions",menu:{items:[{text:"Add flag",handler:addstarClick,icon:"images/FlagRed16.png"},{text:"Remove flag",handler:removestarClick,icon:"images/FlagGrey16.png"}]}}]})}D.showAt(C.getXY());C.preventDefault();updateCntxButtonStatus()}function updateCntxButtonStatus(){if(portalmail_folderid=="0"){Wtf.getCmp("cntxbtnreplyto").enable();Wtf.getCmp("cntxbtndelete").enable();Wtf.getCmp("cntxbtnmoveto").enable();Wtf.getCmp("cntxbtnmoreactions").enable();Wtf.getCmp("cntxbtnrestore").disable();Wtf.getCmp("0").disable()}else{if(portalmail_folderid=="2"){Wtf.getCmp("cntxbtnreplyto").disable();Wtf.getCmp("cntxbtndelete").enable();Wtf.getCmp("cntxbtnrestore").enable();Wtf.getCmp("cntxbtnmoveto").disable();Wtf.getCmp("cntxbtnmoreactions").disable();Wtf.getCmp("0").disable()}else{if(portalmail_folderid=="4"){Wtf.getCmp("cntxbtnreplyto").disable();Wtf.getCmp("cntxbtndelete").disable();Wtf.getCmp("cntxbtnmoveto").disable();Wtf.getCmp("cntxbtnmoreactions").enable();Wtf.getCmp("cntxbtnrestore").disable();Wtf.getCmp("0").disable()}else{if(portalmail_folderid=="1"){Wtf.getCmp("cntxbtnreplyto").disable();Wtf.getCmp("cntxbtndelete").enable();Wtf.getCmp("cntxbtnmoveto").enable();Wtf.getCmp("cntxbtnmoreactions").enable();Wtf.getCmp("cntxbtnrestore").disable();Wtf.getCmp("0").disable()}else{Wtf.getCmp("cntxbtnreplyto").disable();Wtf.getCmp("cntxbtndelete").enable();Wtf.getCmp("cntxbtnmoveto").enable();Wtf.getCmp("cntxbtnmoreactions").disable();Wtf.getCmp("cntxbtnrestore").disable();Wtf.getCmp("0").enable()}}}}}function minchatwin(A){var B=String(A.id).replace("chatWin","kcont_");Wtf.getCmp("contactsview").getNodeById(B).getUI().getTextEl().setAttribute("mstat","t");Wtf.getCmp(A.id).hide()}function handleClick(E){var B=E.getUI().getTextEl().getAttribute("ustat");var A=E.getUI().getTextEl().innerHTML;if(E.getUI().getTextEl().getAttribute("mstat")=="t"){var D=String(E.id).replace("kcont_","");var C=Wtf.getCmp("chatWin"+D);C.show();E.getUI().getTextEl().setAttribute("mstat","f")}if(E.getUI().getTextEl().getAttribute("status")=="f"){E.getUI().getTextEl().setAttribute("status","t");win1(E)}}function win1(D){var C=String(D.id).replace("kcont_","");var B;if(D.getUI().getTextEl().getAttribute("ustat")=="online"){B="K-icon"}else{if(D.getUI().getTextEl().getAttribute("ustat")=="offline"){B="K-iconOffline"}}new Wtf.Window({layout:"border",width:500,height:300,id:"chatWin"+C,maximizable:true,minimizable:true,plain:true,closable:true,closeAction:"hide",iconCls:B,title:"K-Chat with "+D.getUI().getTextEl().innerHTML,shadow:true,items:[{region:"center",id:"northRegion"+C,layout:"fit",deferHeight:true,height:"70%",items:[new Wtf.Panel({id:"Npane_"+C,deferHeight:true,border:true,width:"100%",tbar:[{text:"View Profile",handler:function(){mainPanel.loadTab("user.html","   "+C,D.getUI().getTextEl().innerHTML,"navareadashboard",Wtf.etype.user,true)}},"-"],html:'<div id="readArea_'+C+'" class=readAreaClass ></div>'})]},{region:"south",height:100,layout:"fit",id:"southRegion"+C,items:[hEdit=new Wtf.newHTMLEditor({id:"writeArea_"+C,enableLists:false,enableSourceEdit:false,enableAlignments:false,hideLabel:true,deferHeight:true})]}],buttons:[{text:"Send",handler:function(){var E=document.getElementById("writeArea_"+C);var G=E.value;if(G!=""){insertmsg(G,C,1);Wtf.getCmp(E.id).setValue(null);var F=escape(G);Wtf.Ajax.requestEx({url:Wtf.req.prt+"messenger/msg.jsp",params:{s:portalMessenger_usr,r:C,chat:F,rstatus:D.getUI().getTextEl().getAttribute("ustat")}},this)}}}]}).on({"hide":minchatwin,"minimize":minchatwin,scope:this});var A=Wtf.getCmp("chatWin"+C);A.show()}function myclosefunction(A){document.getElementById(iddd).setAttribute("status","f");A.remove()}function smiley(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>")}function displayMsg(){var i;Wtf.Ajax.request({method:"GET",url:Wtf.req.prt+"messenger/getmymessage.jsp",params:({login:portalMessenger_usr,cts:portalMessenger_maxts}),scope:this,success:function(result,req){if(result.responseText.match("zero")==null){var mymsg=eval(("("+result.responseText+")"));var l=mymsg.message.length;portalMessenger_maxts=mymsg.messagetimestamp[l-1];for(i=0;i<l;i++){winchecker(mymsg.sendid[i],mymsg.message[i])}}},failure:function(result,req){}});portalMessenger_pollTimer=setTimeout("displayMsg()",2000)}function winchecker(A,B){alert();handleClick(A);insertmsg(B,A,2)}function insertmsg(C,J,B){var A;var F=document.getElementById("readArea_"+J);var G=document.createElement("div");var I=C;var E=[];if(B==1){A=portalMessenger_defusr}else{if(B==2){A=Wtf.getCmp("contactsview").getNodeById("kcont_"+J).getUI().getTextEl().innerHTML}}E=I.match(/(:\))|(:X)|(:\()|(:P)|(:D)|(;\))/g);if(E==null){G.innerHTML="<p><strong>"+A+":</strong> "+I}else{var D;var H;G.innerHTML="<p><strong>"+A+":</strong> "+I;for(D=0;D<E.length;D++){smiley(G,E[D])}}F.innerHTML+=G.innerHTML+"<br/>"}function openprofile(A,C,B){mainPanel.loadTab("userProfile.html","mainuserProfile_"+A+"_disp",C,"navareadashboard",Wtf.etype.user)}function parseSmiley(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++){smiley(C,B[D])}}return C.innerHTML}if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());Wtf.comboBox=Wtf.extend(Wtf.Component,{facultyCombo:null,facultyComboStore:null,programCombo:null,programComboStore:null,courseCombo:null,courseComboStore:null,sessionCombo:null,sessionComboStore:null,atCombo:null,atComboStore:null,monthCombo:null,monthComboStore:null,sectionCombo:null,sectionComboStore:null,programOptionCombo:null,programOptionStore:null,resultCombo:null,resultComboStore:null,initComponent:function(){Wtf.comboBox.superclass.initComponent.call(this)},getResultComboStore:function(){if(this.resultComboStore==null){this.resultComboStore=new Wtf.data.SimpleStore({data:[["Marks","Marks"],["Grades ","Grades"],["Both ","Both"]],fields:["name","id"]})}return this.resultComboStore},getResultCombo:function(){if(this.resultCombo==null){this.resultCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{name}" class="x-combo-list-item">{name}</div></tpl>',id:"resulttype"+this.id,hiddenName:"resulttype",store:this.getResultComboStore(),readOnly:true,displayField:"name",mode:"local",listWidth:100,width:80,triggerAction:"all",emptyText:"Select Filter..",fieldLabel:"Filter By",valueField:"id",allowBlank:false})}return this.resultCombo},getSectionComboStore:function(A){if(this.sectionComboStore==null){if(A==null){A=true}this.sectionComboStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newClass.jsp"}),baseParams:{type:"sectionCombo"},autoLoad:A,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"subcscheduleid",type:"string"},{name:"cscheduleid",type:"string"},{name:"subclassname",type:"string"}]))})}return this.sectionComboStore},getSectionCombo:function(A){if(this.sectionCombo==null){this.sectionCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{subclassname}" class="x-combo-list-item">{subclassname}</div></tpl>',triggerAction:"all",store:this.getSectionComboStore(A),mode:"local",readOnly:true,listWidth:250,fieldLabel:"Select Section",displayField:"subclassname",valueField:"subcscheduleid",allowBlank:false,emptyText:"Select a Section..."})}return this.sectionCombo},getProgramOptionComboStore:function(){if(this.sectionComboStore==null){this.sectionComboStore=new Wtf.data.SimpleStore({fields:["option","value"],reader:new Wtf.data.ArrayReader({},[{name:"option",type:"string"},{name:"value",type:"int"}]),data:[["Face to Face",0],["Online",1],["Both",2]],autoLoad:true})}return this.sectionComboStore},getProgramOptionCombo:function(){if(this.sectionCombo==null){this.sectionCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{option}" class="x-combo-list-item">{option}</div></tpl>',triggerAction:"all",store:this.getProgramOptionComboStore(),mode:"local",readOnly:true,fieldLabel:"Select Program Option",displayField:"option",valueField:"value",width:80,allowBlank:false,emptyText:"Select a Program Option..."})}return this.sectionCombo},getFacultyComboStore:function(){if(this.facultyComboStore==null){this.facultyComboStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/applications.jsp"}),baseParams:{task:"getFaculty"},autoLoad:true,reader:new Wtf.data.JsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"facid",type:"string"},{name:"facname",type:"string"}])),listeners:{scope:this,load:function(A){var C=new Wtf.data.Record.create(["facid","facname"]);var B=new C({facid:"All",facname:"All"});A.addSorted(B)}}})}return this.facultyComboStore},getFacultyCombo:function(){if(this.facultyCombo==null){this.facultyCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{facname}" class="x-combo-list-item">{facname}</div></tpl>',triggerAction:"all",store:this.getFacultyComboStore(),mode:"local",readOnly:true,listWidth:250,displayField:"facname",valueField:"facid",allowBlank:false,emptyText:"Select a Faculty..."})}return this.facultyCombo},getProgramComboStore:function(){if(this.programComboStore==null){this.programComboStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),baseParams:{type:20},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"programid",type:"string"},{name:"programname",type:"string"},{name:"programtype",type:"int"}]))})}return this.programComboStore},getProgramCombo:function(){if(this.programCombo==null){this.programCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{programname}" class="x-combo-list-item">{programname}</div></tpl>',triggerAction:"all",store:this.getProgramComboStore(),mode:"local",readOnly:true,listWidth:250,displayField:"programname",valueField:"programid",allowBlank:false,emptyText:"Select a programme...",listeners:{scope:this,select:function(C,A,B){if(this.courseComboStore!=null){this.courseComboStore.removeAll();this.courseComboStore.load({params:{programid:A.data["programid"]}})}}}})}return this.programCombo},getCourseComboStore:function(A){if(this.courseComboStore==null){if(A==null){A=true}this.courseComboStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),baseParams:{type:"programsessioncourse"},reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"courseid",type:"string"},{name:"coursename",type:"string"},{name:"programid",type:"string"},{name:"code",type:"string"}]))});if(A){this.courseComboStore.on("load",this.courseComboStore_Load_Handler,this)}}return this.courseComboStore},courseComboStore_Load_Handler:function(A){var C=new Wtf.data.Record.create(["courseid","coursename"]);var B=new C({courseid:"All",coursename:"All"});A.addSorted(B);if(this.sessionCombo!=null){this.sessionCombo.setValue("")}},getCourseCombo:function(A){if(this.courseCombo==null){this.courseCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{coursename}" class="x-combo-list-item">{coursename}</div></tpl>',triggerAction:"all",store:this.getCourseComboStore(A),mode:"local",listWidth:250,readOnly:true,displayField:"coursename",valueField:"courseid",allowBlank:false,emptyText:"Select a Course..."})}return this.courseCombo},getSessionComboStore:function(A){if(this.sessionComboStore==null){if(A==null){A=true}this.sessionComboStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"},{name:"startdate",dateFormat:"Y-m-d",type:"date"}]))});if(A){this.sessionComboStore.on("load",this.sessionComboStore_Load_Handler,this)}}return this.sessionComboStore},sessionComboStore_Load_Handler:function(A){var C=new Wtf.data.Record.create(["sessionid","sessionname"]);var B=new C({sessionid:"All",sessionname:"All"});A.addSorted(B)},getSessionCombo:function(A){if(this.sessionCombo==null){this.sessionCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{sessionname}" class="x-combo-list-item">{sessionname}</div></tpl>',triggerAction:"all",store:this.getSessionComboStore(A),mode:"local",listWidth:250,width:150,readOnly:true,displayField:"sessionname",valueField:"sessionid",allowBlank:false,emptyText:"Select a session..."})}return this.sessionCombo},getATComboStore:function(){if(this.atComboStore==null){this.atComboStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"79"},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"moduleid",type:"string"},{name:"modulename",type:"string"},{name:"gradtype",type:"int"}]))})}return this.atComboStore},getATCombo:function(){if(this.atCombo==null){this.atCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{modulename}" class="x-combo-list-item">{modulename}</div></tpl>',triggerAction:"all",store:this.getATComboStore(),mode:"local",listWidth:250,readOnly:true,displayField:"modulename",valueField:"moduleid",allowBlank:false,emptyText:"Select a Module..."})}return this.atCombo},getMonthComboStore:function(){if(this.monthComboStore==null){var B=[],C=new Date().getFirstDateOfMonth();for(var A=-12;A<=2;A++){B.push([C.add(Date.MONTH,A).format("M Y"),C.add(Date.MONTH,A).format("Y-m-d")])}this.monthComboStore=new Wtf.data.SimpleStore({fields:[{name:"month"},{name:"date"}]});this.monthComboStore.loadData(B)}return this.monthComboStore},getMonthCombo:function(){if(this.monthCombo==null){this.monthCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{month}" class="x-combo-list-item">{month}</div></tpl>',fieldLabel:"Month*",displayField:"month",valueField:"date",store:this.getMonthComboStore(),typeAhead:true,mode:"local",triggerAction:"all",emptyText:"Select a Month...",selectOnFocus:true})}return this.monthCombo}});Wtf.namespace("Wtf","Wtf.cal","Wtf.proj","Wtf.admin","Wtf.common","Wtf.docs.com","Wtf.portal.profile","Wtf.ux","Wtf.course","Wtf.content.log","Wtf.student","Wtf.content.log","Wtf.course","Wtf.faculty","Wtf.lms","Wtf.lms.com","Wtf.App","Gradebook");Wtf.QueueSize=2;Wtf.getLmsImgPath="images/store/lms/";Wtf.CUSTOM_TIME_OUT=400000;Wtf.DEFAULT_TIME_OUT=30000;Wtf.override(Wtf.form.Field,{afterRender:function(){if(this.helpText){var C=Wtf.BLANK_IMAGE_URL;if(this.helpIcon=="warning"){C="lib/resources/images/default/form/exclamation.gif"}if(this.helpIcon=="help"){C="images/help.png"}var B=findLabel(this);if(B){var A=B.createChild({tag:"img",src:C,style:"margin-bottom: -2px; margin-left: 5px; padding: -2px;"});if(this.helpDisplay=="image"||this.helpDisplay=="both"){Wtf.QuickTips.register({target:A,title:this.helpTitle,text:this.helpText,enabled:true})}if(this.helpDisplay=="field"||this.helpDisplay=="both"){Wtf.QuickTips.register({target:this,title:this.helpTitle,text:this.helpText,enabled:true})}}}Wtf.form.Field.superclass.afterRender.call(this);this.initEvents()}});var findLabel=function(C){var B=null;var A=null;B=C.getEl().up("div.x-form-item");if(B){A=B.child("label")}if(A){return A}};Wtf.override(Wtf.DatePicker,{setMinDate:function(A){this.minDate=A;this.update(this.value,true)}});Wtf.override(Wtf.form.DateField,{setMinValue:function(A){this.minValue=(Wtf.type(A)=="string"?this.parseDate(A):A);if(this.menu){this.menu.picker.setMinDate(this.minValue)}}});Wtf.convertToMoneyFrm=function(A){A=(Math.round((A-0)*100))/100;A=(A==Math.floor(A))?A+".00":((A*10==Math.floor(A*10))?A+"0":A);A=String(A);var E=A.split(".");var D=E[0];var B=E[1]?"."+E[1]:".00";var C=/(\d+)(\d{3})/;while(C.test(D)){D=D.replace(C,"$1,$2")}A=D+B;if(A.charAt(0)=="-"){return"-"+A.substr(1)}return A};function getCookie(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""}var loginid=getCookie("lid");var username=getCookie("username");var inboxFlag=false;var selected=-1;Wtf.roleperms=[];Wtf.rolesets=[];Wtf.realroles=[];Wtf.each(getCookie("perms"),function(perm){Wtf.roleperms=eval("("+perm+")")});Wtf.each(getCookie("realroles"),function(role){Wtf.realroles=eval("("+role+")")});Wtf.countryStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=country",root:"data",fields:["id","name"]});Wtf.timezoneStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=timezone",root:"data",fields:["id","name"]});Wtf.nationalityStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=nationality",root:"data",fields:["id","name"]});Wtf.raceStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=race",root:"data",fields:["id","name"]});Wtf.progStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=prog",root:"data",fields:["programid","programname"]});Wtf.facLocStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=loc",root:"data",fields:["locid","locname"]});Wtf.facLevelStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=level",root:"data",fields:["levelid","levelname"]});Wtf.facQualStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=qual",root:"data",fields:["qualid","qualname"]});Wtf.facSkillStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=skill",root:"data",fields:["skillid","skillname"]});Wtf.dateFormatStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=dt",root:"data",fields:["id","name"]});Wtf.precisionDecimalValue=function(B){var C="0.00";try{if(B!=null&&B!=""){C=parseFloat(B).toFixed(2)}}catch(A){}finally{return C}};Wtf.getDateFormat=function(){return Date.patterns[Wtf.DateArray[Wtf.pref.DateFormat]]};Wtf.modifyDateFmt=function(C,B,A){if(Wtf.isEmpty(C)){return C}else{return Date.parseDate(C,B).format(A)}};var roleid=(Wtf.roleperms&&Wtf.roleperms.length>0)?Wtf.roleperms[0]:0;Wtf.fixHeight=30;Wtf.BLANK_IMAGE_URL="lib/resources/images/default/s.gif";Wtf.etype={user:0,comm:1,course:2,home:3,alumni:4,cal:5,forum:6,pmessage:7,pplan:8,adminpanel:9,course:10,grants:11,research:12,logistics:13,lcontent:14,faculty:15,acastructure:16,loc:17,qb:18,docs:19,bursar:20,lms:21,report:22,market:23,contacts:24,todo:25,feedback:26,studentFeedback:27,humanResource:28,forumTabs:29};Date.patterns={ISO8601Long:"Y-m-d H:i:s",ISO8601Short:"Y-m-d",ShortDate:"n/j/Y",LongDate:"l, F d, Y",FullDateTime:"l, F d, Y g:i:s A",MonthDay:"F d",ShortTime:"g:i A",LongTime:"g:i:s A",SortableDateTime:"Y-m-d\\TH:i:s",UniversalSortableDateTime:"Y-m-d H:i:sO",YearMonth:"F, Y",Kdate1:"d-m-Y",Kdate2:"m-d-Y",Kdate3:"d/m/Y",Kdate4:"m/d/Y"};Wtf.DateArray=["ISO8601Long","ISO8601Short","ShortDate","LongDate","FullDateTime","MonthDay","ShortTime","LongTime","SortableDateTime","UniversalSortableDateTime","YearMonth","Kdate1","Kdate2","Kdate3","Kdate4","PlaceHolder","PlaceHolder","PlaceHolder","PlaceHolder"];Wtf.contenttype={bulletlist:0,imagelist:1,plainHTML:2};smileyStore=new Array(":)",":(",";)",":D",";;)","&gt;:D&lt;",":-/",":x",":&gt;&gt;",":P",":-*","=((",":-O","X(",":&gt;","B-)",":-S","#:-S","&gt;:)",":((",":))",":|","/:)","=))","O:-)",":-B","=;",":-c");function nameRenderer(B){var C=B.substr(0,1);var A=new RegExp("^[a-zA-Z]");if(A.test(C)){return C.toUpperCase()}else{return"Others"}}function sizeRenderer(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}function dateFieldRenderer(B){if(B){var A=new Date();if((B.getMonth()==A.getMonth())&&(B.getYear()==A.getYear())){if(A.getDate()==B.getDate()){text="Today"}else{if(B.getDate()==(A.getDate()-1)){text="Yesterday"}else{if(B.getDate()<=(A.getDate()-7)&&B.getDate()>(A.getDate()-14)){text="Later Week"}}}}else{if((B.getMonth()==(A.getMonth()-1))&&(B.getYear()==A.getYear())){text="Last Month"}else{if((B.getYear()==(A.getYear()-1))){text="Last Year"}else{text="Older"}}}}else{text="None"}return text}function permissionRenderer(A){var B=A.toLowerCase();switch(B){case"everyone":B="Everyone on Krawler";break;case"connections":B="All Connections";break;case"none":B="Private";break;default:B="Selected Connections";break}return B}function HTMLStripper(A){return Wtf.util.Format.stripTags(A)}function InitSubs(){dojo.cometd.init("bind");Wtf.QueueSize=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 getActiveSubTab(A){var B=tabRegister[A];var C=Wtf.getCmp(B);if(!C){return Wtf.getCmp(A)}return C.getActiveTab()}function calLoadControl(A){if(!WtfStudentAccessDocCal()){Wtf.getCmp("calpanel").hide();Wtf.getCmp("docpanel").hide();Wtf.getCmp("northNavRegion").doLayout()}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 msgBoxShow(A,B){if(B===undefined){B=Wtf.MessageBox.WARNING}Wtf.MessageBox.show({title:A[0],msg:A[1],buttons:Wtf.MessageBox.OK,animEl:"mb9",icon:B})}function toggleMainCal(C){var B=Wtf.getCmp("ascalctrlcalpopup1");var A=Wtf.getCmp("asCalendar");if(C){if(B){B.show()}if(A){A.show();A.getSelectionModel().clearSelections()}}else{if(B){B.hide()}if(A){A.hide()}}}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"){Wtf.Msg.alert("Status","Invalid operation ")}else{if(nodeobj.success=="deleted"){Wtf.Msg.alert("Error","Event deleted")}else{if(nodeobj.success=="true"){Wtf.Msg.alert("Status","Event shared successfully")}else{if(nodeobj.success=="false"){Wtf.Msg.alert("Error","Error in sharing event")}}}}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}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/"};function setDownloadUrl(A){setDldUrl("fdownload.jsp?url="+A+"&dtype=attachment")}function setDldUrl(A){document.getElementById("downloadframe").src=A}function isRealRoles(A){if(Wtf.realroles){return(Wtf.realroles.indexOf(A)>-1)}else{return false}}function isRoleGroup(A){if(Wtf.roleperms){return(Wtf.roleperms.indexOf(A)>-1)}else{return false}}function WtfShowAdminTab(){return(checktabperms(1,9)||checktabperms(1,20)||checktabperms(3,4)||checktabperms(1,5)=="edit"||checktabperms(1,23)||checktabperms(1,24)||checktabperms(3,12)=="edit"||checktabperms(1,28)=="edit"||checktabperms(3,2)||checktabperms(3,3)||checktabperms(3,4)||checktabperms(3,9)=="edit"||checktabperms(3,6)||checktabperms(5,13)||checktabperms(1,25)||checktabperms(3,13)=="edit"||checktabperms(1,6)||checktabperms(3,16)||checktabperms(3,17)||checktabperms(3,13)=="edit"||checktabperms(1,29)||checktabperms(5,10)||checktabperms(1,30)||checktabperms(5,11)=="edit")}function WtfShowStudentHome(){return(checktabperms(1,16)=="edit"||checktabperms(1,17)=="edit"||checktabperms(1,19)=="edit"||checktabperms(3,5)=="edit"||checktabperms(5,12)=="edit")}function WtfShowAcaStructure(){return(checktabperms(3,18)=="edit"||checktabperms(2,3)=="edit"||checktabperms(3,19)=="edit"||checktabperms(2,2)=="edit"||checktabperms(1,22)=="edit"||checktabperms(3,20)=="edit"||checktabperms(5,8)=="edit")}function WtfShowMyCourseStud(){return(checktabperms(1,26)=="edit")}function WtfShowMyCourseFac(){return(checktabperms(1,27)=="edit")}function WtfShowMarketingHR(){return(checktabperms(5,9)=="edit"&&Wtf.isHR())}function WtfShowLearningNContent(){return(checktabperms(2,1)=="edit")}function WtfShowGrant(){return((isRoleGroup("4")||isRoleGroup("3"))&&!Wtf.isHR())}function WtfShowBursary(){return(checktabperms(6,1)=="edit"||checktabperms(6,2)=="edit"||checktabperms(6,3)=="edit"||checktabperms(6,4)=="edit"||checktabperms(6,5)=="edit"||checktabperms(6,6)=="edit"||checktabperms(6,7)=="edit"||checktabperms(6,8)=="edit"||checktabperms(6,9)=="edit"||checktabperms(6,10)=="edit"||checktabperms(6,11)=="edit"||checktabperms(6,12)=="edit")}function WtfShowMarketing(){return(checktabperms(5,7)=="edit")}function WtfAcaProgramTabShow(){return(checktabperms(3,14)=="edit"||checktabperms(3,15)=="edit"||checktabperms(3,7)=="edit"||checktabperms(2,2)=="edit"||checktabperms(1,22)=="edit"||checktabperms(3,18)=="edit"||checktabperms(2,3)=="edit")}function WtfStudentAccessDocCal(){if(Wtf.studentAccess==3){return false}else{return true}}function WtfStudentFullAccess(){if(Wtf.studentAccess==1){return true}else{return false}}function WtfStudentFullAccessObj(B){var A=0;while(A<Wtf.studentAccessObj.accessdata.length){if(Wtf.studentAccessObj.accessdata[A].programid==B){if(Wtf.studentAccessObj.accessdata[A].access==1){return true}else{return false}}A++}return(Wtf.studentAccess==1)}function WtfStudentAccessDocCalObj(B){var A=0;while(A<Wtf.studentAccessObj.accessdata.length){if(Wtf.studentAccessObj.accessdata[A].programid==B){if(Wtf.studentAccessObj.accessdata[A].access==3){return false}else{return true}}A++}return(Wtf.studentAccess!=3)}function loginCheck(){document.getElementById("navcourses").style.display=(WtfShowMyCourseStud())?"":"none";document.getElementById("navcourses1").style.display=(WtfShowMyCourseFac())?"":"none";document.getElementById("navhr").style.display=(WtfShowMarketingHR())?"":"none";document.getElementById("navfaculty").style.display=(WtfShowAdminTab())?"":"none";document.getElementById("navlearning").style.display=(WtfShowLearningNContent())?"":"none";document.getElementById("navalumni").style.display=(WtfShowStudentHome())?"":"none";document.getElementById("navgrants").style.display=(WtfShowGrant())?"":"none";document.getElementById("navresearch").style.display="none";document.getElementById("navloc").style.display=((isRoleGroup("2")||isRoleGroup("4"))&&!Wtf.isHR())?"":"none";document.getElementById("navbursary").style.display=(WtfShowBursary())?"":"none";document.getElementById("navacastructure").style.display=(WtfShowAcaStructure())?"":"none";document.getElementById("navmarket").style.display=(WtfShowMarketing())?"":"none";document.getElementById("navdocs").style.display=WtfStudentAccessDocCal()?"":"none"}Wtf.getSep=function(){return(Wtf.isIE?"javascript:void(0)":"#")};Wtf.isHoD=function(){if(Wtf.realroles){return(Wtf.realroles.indexOf("12")>-1)}else{return false}};Wtf.isHoP=function(){if(Wtf.realroles){return(Wtf.realroles.indexOf("46")>-1)}else{return false}};Wtf.isHR=function(){if(Wtf.realroles){return(Wtf.realroles.length==1&&Wtf.realroles.indexOf("22")>-1)}else{return false}};Wtf.isFacCo=function(){if(Wtf.realroles){return(Wtf.realroles.length==1&&Wtf.realroles.indexOf("9")>-1)}else{return false}};Wtf.isExtStud=function(){if(Wtf.realroles){return(Wtf.realroles.length==1&&Wtf.realroles.indexOf("45")>-1)}else{return false}};if(Wtf.isExtStud()){roleid=45}function myPerProfile(){var A=new Wtf.common.myProfile({id:loginid}).show()}function setReminderInterval(){Wtf.Ajax.request({url:"jspfiles/newCourse.jsp",params:{type:"getReminderDates"},method:"POST",scope:this,success:function(result,req){var retstatus=eval("("+result.responseText.trim()+")");retstatus=eval("("+retstatus.data.trim()+")");if(retstatus.success){if(retstatus.data.length==undefined||retstatus.data.length==0){var RemWin=new Wtf.ReminderInterval({firstinterval:"0",secondinterval:"0",thirdinterval:"0"}).show()}else{RemWin=new Wtf.ReminderInterval(retstatus.data[0]).show()}}else{msgBoxShow(["Status","Error while fetching reminder interval"],Wtf.MessageBox.INFO)}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}function changePassword(){var A=new Wtf.changePassWin({});A.show()}function setPP(){var A=new Wtf.personalPref({});A.show()}Wtf.isContentDesigner=function(){if(Wtf.realroles){return(((Wtf.realroles.indexOf("11")>-1)||(Wtf.realroles.indexOf("10")>-1))&&((Wtf.realroles.indexOf("9")==-1)&&(Wtf.realroles.indexOf("12")==-1)&&(Wtf.realroles.indexOf("6")==-1)))}else{return false}};Wtf.scheduleDays=1;Wtf.Ajax.requestEx({url:"jspfiles/savePref.jsp",params:{flag:1}},this,function(A,B){Wtf.scheduleDays=A});function showHOPTab(D,E,H,G,F,B){var A;var C=Wtf.getCmp("examresult"+D);if(!C){if(Wtf.isHoP()){A=new Wtf.ExamResultGrid({id:"examresult"+D,moduleid:D,programid:E,courseid:H,sessionid:G,ptype:F,sectionFlag:B=="true"?true:false,layout:"fit",title:"Exam Result",border:false,closable:true,iconCls:getTabIconCls(Wtf.etype.report)});mainPanel.add(A);mainPanel.setActiveTab(A)}else{Wtf.Msg.alert("Alert","This link can be used to view the gradebook by the HOP only.")}}else{mainPanel.setActiveTab(C)}}function showExamTabHOP(B,C,F,E,D,A){if(C==undefined||F==undefined||E==undefined||D==undefined||A==undefined){Wtf.Ajax.requestEx({url:"jspfiles/student/gradeBook.jsp",method:"POST",params:{mode:18,moduleid:B}},this,function(G,H){var I=Wtf.decode(G);C=I.data[0].programid;F=I.data[0].courseid;E=I.data[0].sessionid;D=I.data[0].ptype;A=I.data[0].sectionFlag;showHOPTab(B,C,F,E,D,A)},function(G,H){Wtf.Msg.alert("Error","Error connecting to server",function(I){},this)})}else{showHOPTab(B,C,F,E,D,A)}}function showHODTab(C,F,E,D){var A;var B;var G;if(E){G=E}else{G="Grade Book"}if(F=="1"){B=Wtf.getCmp("spegradebkhod"+C);if(!B){A=new Wtf.disGrade({title:G,id:"spegradebkhod"+C,closable:true,moduleid:C,HOD:Wtf.isHoD(),HOP:Wtf.isHoP()});mainPanel.add(A);mainPanel.setActiveTab(A)}else{mainPanel.setActiveTab(B)}}else{B=Wtf.getCmp("showReport"+C);if(!B){new ShowReport(G,mainPanel,"showReport"+C,C,D,true,false)}else{mainPanel.setActiveTab(B)}}mainPanel.doLayout()}function showExamTabHOD(A,D,C,B){Wtf.Ajax.requestEx({url:"jspfiles/student/gradeBook.jsp",method:"POST",params:{mode:19,moduleid:A,hodid:loginid}},this,function(E,F){var G=Wtf.decode(E);if(G.success){showHODTab(A,D,C,B)}else{Wtf.Msg.alert("Alert","This link can be used to view the gradebook by the HOD only.")}},function(E,F){Wtf.Msg.alert("Error","Error connecting to server",function(G){},this)})}function getHeader(A,C,B){var D="<div style = 'width:100%;height:100%;position:relative;float:left;'><div style='float:left;height:100%;width:auto;position:relative;'><img src = "+A+" style = 'width:40px;height:52px;margin:5px 5px 5px 5px;'></img></div><div style='float:left;height:100%;width:60%;position:relative;'><div style='font-size:12px;font-style:bold;float:left;margin:15px 0px 0px 10px;width:100%;position:relative;'><b>"+C+"</b></div><div style='font-size:10px;float:left;margin:15px 0px 10px 10px;width:100%;position:relative;'>"+B+"</div></div></div>";return D}function handleIncompleteApp(obj,flag){if((isRoleGroup("4"))){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:obj.getAttribute("userid"),moduleid:obj.getAttribute("modid"),type:"accrejIncApp",status:flag==1?"20":"1"},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");if(retstatus.success){msgBoxShow(["Update Status","Status updated Successfully"],Wtf.MessageBox.INFO)}else{msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)}},function(reso,req){})}else{Wtf.Msg.alert("Alert","This link can be used by ASAD only")}}function URLDecode(A){A=A.replace(new RegExp("\\+","g")," ");return unescape(A)}function checktabperms(F,C){var B=0;var D=0;var A="";for(var E=0;E<Wtf.realroles.length;E++){if(Wtf.rolesets[Wtf.realroles[E]]!=undefined&&Wtf.rolesets[Wtf.realroles[E]][F]!=undefined){B=(Wtf.rolesets[Wtf.realroles[E]][F]).pE;D=(Wtf.rolesets[Wtf.realroles[E]][F]).pV}else{B=0;D=0}if(D&Math.pow(2,C)){if(B&Math.pow(2,C)){A="edit";break}else{A="view"}}else{if(B&Math.pow(2,C)){A="edit";break}else{if(A==""){A=false}}}}return A}Wtf.data.PagingMemoryProxy=function(B,A){Wtf.data.PagingMemoryProxy.superclass.constructor.call(this);this.data=B;Wtf.apply(this,A)};Wtf.extend(Wtf.data.PagingMemoryProxy,Wtf.data.MemoryProxy,{customFilter:null,initComponent:function(A){this.addEvents({"pagechange":true})},load:function(B,C,F,H,I){B=B||{};var J;try{J=C.readRecords(this.data)}catch(D){this.fireEvent("loadexception",this,I,null,D);F.call(H,null,I,false);return }if(this.customFilter!=null){J.records=J.records.filter(this.customFilter);J.totalRecords=J.records.length}else{if(B.filter!==undefined){J.records=J.records.filter(function(L){if(typeof (L)=="object"){var K=B.filterCol||0;return String(L.data[K]).match(B.filter)?true:false}else{return String(L).match(B.filter)?true:false}});J.totalRecords=J.records.length}}if(B.sort!==undefined){var A=String(B.dir).toUpperCase()=="DESC"?-1:1;var E=function(L,K){return L==K?0:L<K?-1:1};var G=C.recordType.getField(B.sort).sortType;J.records.sort(function(L,K){var M=0;if(typeof (L)=="object"){M=E(G(L.data[B.sort]),G(K.data[B.sort]))*A}else{M=E(L,K)*A}if(M==0){M=(L.index<K.index?-1:1)}return M})}if(B.start!==undefined&&B.limit!==undefined){J.records=J.records.slice(B.start,B.start+B.limit)}F.call(H,J,I,true);this.fireEvent("pagechange",this.id,B.start,B.limit)}});Wtf.InvCancelReq=function(A){Wtf.apply(this,A);this.TxtInvNum=new Wtf.form.TextField({fieldLabel:"Invoice :",id:"TxtInvNum"+this.id,width:200,value:A.rec.get("invoicenum"),readOnly:true});this.TxtStudName=new Wtf.form.TextField({fieldLabel:"Student Name :",id:"TxtStudName"+this.id,width:200,value:A.rec.get("studentname"),readOnly:true});this.TxtStudID=new Wtf.form.TextField({fieldLabel:"Student Name :",id:"TxtStudID"+this.id,width:200,value:A.rec.get("username"),readOnly:true});this.TxtUserID=new Wtf.form.Hidden({id:"TxtUserID"+this.id,width:200,value:A.rec.get("studentid"),readOnly:true});this.TxtRemark=new Wtf.form.TextArea({fieldLabel:"Remark :",id:"TxtCbal"+this.id,value:A.rec.get("remark"),width:200,height:100,readOnly:A.viewOnly});var B=A.viewOnly?[this.TxtRemark]:[this.TxtInvNum,this.TxtStudName,this.TxtStudID,this.TxtRemark,this.TxtUserID];this.border=false;this.layout="border";this.items=[{region:"north",height:60,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/40px-Invoice-Cancel.png",A.viewOnly?"Remark of Invoice Cancelation Request":"Invoice Cancelation Request",A.viewOnly?"Shows the remark of Invoice Cancelation Request":"Apply for the cancelation of an invoice")},{region:"center",border:false,bodyStyle:"background:#f1f1f1;font-size:10px;padding: 13px 13px 13px 13px;",layout:"fit",items:[{border:false,height:125,layout:"form",items:B}]}];this.bbar=[{text:"Submit",hidden:A.viewOnly,tooltip:{title:"Submit",text:"Click to Submit"},handler:this.SaveRequest,scope:this},{text:A.viewOnly?"Close":"Cancel",tooltip:{title:A.viewOnly?"Close":"Cancel",text:A.viewOnly?"Click to Close":"Click to Cancel"},handler:function(){this.close()},scope:this}];Wtf.InvCancelReq.superclass.constructor.call(this,A)};Wtf.extend(Wtf.InvCancelReq,Wtf.Window,{initComponent:function(){Wtf.InvCancelReq.superclass.initComponent.call(this);this.addEvents({"closeform":true})},onRender:function(B,A){Wtf.InvCancelReq.superclass.onRender.call(this,B,A)},SaveRequest:function(){var A=this.TxtRemark.getValue();if(A==""||A==null||A==undefined){Wtf.Msg.show({title:"Request Cancelation",msg:"You have not entered Remark for cancelation request, do you want to continue ?",buttons:Wtf.Msg.YESNO,fn:function(C){if(C=="yes"){this.fireEvent("closeform",{"invoicenum":this.TxtInvNum.getValue(),"remark":"","status":"Waiting for jbursa approval","userid":this.TxtUserID.getValue()});this.close()}},scope:this,animEl:"elId",icon:Wtf.MessageBox.QUESTION})}else{var B={"invoicenum":this.TxtInvNum.getValue(),"remark":this.TxtRemark.getValue(),"status":"Waiting for jbursa approval","userid":this.TxtUserID.getValue()};this.fireEvent("closeform",B);this.close()}}});Wtf.common.myProfile=function(config){Wtf.apply(this,config);Wtf.common.myProfile.superclass.constructor.call(this,{layout:"fit",border:false,plain:true,shadow:false,width:950,title:"Profile Management",modal:true,iconCls:"winicon",resizable:false,items:[{layout:"border",border:false,height:450,id:"myProfile"+this.id}],buttons:[{text:"Save",scope:this,handler:function(){if(isRoleGroup("2")||(this.parentid)){if(this.pro.form.el){if((this.pro.form.isValid())&&(this.per.form.isValid())){this.pro.form.submit({scope:this,failure:function(frm,action){Wtf.Msg.alert("Error","Error in Connection",function(btn){if(btn=="ok"){}},this)},success:function(frm,action){var nodeobj=eval("("+action.response.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","An error occurred while connecting to server.",function(btn){if(btn=="ok"){}},this)}else{if(nodeobj.success=="true"){Wtf.Msg.alert("Status","Details saved successfully.",function(btn){if(btn=="ok"){}},this)}}}});this.subPer()}else{if(!(this.pro.form.isValid())&&!(this.per.form.isValid())){msgBoxShow(["Validation Failure","Some fields in both the Personal Details and Professional Details tabs are invalid."],Wtf.MessageBox.ERROR)}else{if(!(this.pro.form.isValid())){msgBoxShow(["Validation Failure","Some fields in the Professional Details tab are invalid."],Wtf.MessageBox.ERROR)}if(!(this.per.form.isValid())){msgBoxShow(["Validation Failure","Some fields in the Personal Details tab are invalid."],Wtf.MessageBox.ERROR)}}}}}else{if(this.studentPro){if(this.pro.form.el){if((this.pro.form.isValid())&&(this.per.form.isValid())){this.pro.form.submit({scope:this,failure:function(frm,action){Wtf.Msg.alert("Error","Error in Connection",function(btn){if(btn=="ok"){}},this)},success:function(frm,action){var nodeobj=eval("("+action.response.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","An error occurred while connecting to server.",function(btn){if(btn=="ok"){}},this)}else{if(nodeobj.success=="true"){this.subPer()}}}})}else{if(!(this.pro.form.isValid())&&!(this.per.form.isValid())){msgBoxShow(["Validation Failure","Some fields in both the Personal Details and Employement Details tabs are invalid."],Wtf.MessageBox.ERROR)}else{if(!(this.pro.form.isValid())){msgBoxShow(["Validation Failure","Some fields in the Employement Details tab are invalid."],Wtf.MessageBox.ERROR)}if(!(this.per.form.isValid())){msgBoxShow(["Validation Failure","Some fields in the Personal Details tab are invalid."],Wtf.MessageBox.ERROR)}}}}}else{this.subPer()}}}},{text:"Close",scope:this,handler:function(){this.close()}}]})};Wtf.extend(Wtf.common.myProfile,Wtf.Window,{onRender:function(A){Wtf.common.myProfile.superclass.onRender.call(this,A);this.deptStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=dept",root:"data",fields:["departmentid","departmentname"]});this.deptStore.load();this.dsgStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=designation",root:"data",fields:["desigid","designame"]});this.dsgStore.load();this.posStore=new Wtf.data.SimpleStore({data:[["Supervisory","supervisory"],["Management","management"],["General","general"],["Noe",""]],fields:["designame","desigid"],reader:new Wtf.data.ArrayReader({},[{name:"designame"},{name:"desigid"}]),autoLoad:true});this.typeStore=new Wtf.data.SimpleStore({data:[["Regular","0"],["Adjunct","1"]],fields:["type","roleid"],reader:new Wtf.data.ArrayReader({},[{name:"type"},{name:"roleid"}]),autoLoad:true});this.empStatus=new Wtf.data.SimpleStore({data:[["Employed","employed"],["Unemployed","unemployed"],["Self","self"],["Self-employed","Self-employed"],["None",""]],fields:["type","empstatus"],reader:new Wtf.data.ArrayReader({},[{name:"type"},{name:"empstatus"}]),autoLoad:true});this.payStore=new Wtf.data.SimpleStore({data:[["INCEIF","0"],["Other","1"]],fields:["paytype","payid"],reader:new Wtf.data.ArrayReader({},[{name:"paytype"},{name:"payid"}]),autoLoad:true});if(isRoleGroup("1")||this.isStudent){this.salStore=new Wtf.data.SimpleStore({data:[["Mr.","0"],["Ms.","1"]],fields:["type","id"],reader:new Wtf.data.ArrayReader({},[{name:"type"},{name:"id"}]),autoLoad:true})}else{this.salStore=new Wtf.data.SimpleStore({data:[["Mr.","0"],["Ms.","1"],["Dr.","2"],["Professor","3"],["Datuk","4"]],fields:["type","id"],reader:new Wtf.data.ArrayReader({},[{name:"type"},{name:"id"}]),autoLoad:true})}this.bumiputera=new Wtf.data.SimpleStore({data:[["1","Bumiputera"],["2","Non-Bumiputera"]],fields:["id","value"],reader:new Wtf.data.ArrayReader({},[{name:"id"},{name:"value"}]),autoLoad:true});if(!Wtf.StoreMgr.containsKey("country")){Wtf.countryStore.load();Wtf.StoreMgr.add("country",Wtf.countryStore)}if(!Wtf.StoreMgr.containsKey("timezone")){Wtf.timezoneStore.load();Wtf.StoreMgr.add("timezone",Wtf.timezoneStore)}if(!Wtf.StoreMgr.containsKey("nationality")){Wtf.nationalityStore.load();Wtf.StoreMgr.add("nationality",Wtf.nationalityStore)}if(!Wtf.StoreMgr.containsKey("race")){Wtf.raceStore.load();Wtf.StoreMgr.add("race",Wtf.raceStore)}if(!Wtf.StoreMgr.containsKey("prog")){Wtf.progStore.load();Wtf.StoreMgr.add("prog",Wtf.progStore)}this.facLocStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=loc",root:"loclist",fields:["locid","locname"]});this.facLevelStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=level",root:"levellist",fields:["levelid","levelname"]});this.facQualStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=qual",root:"quallist",fields:["qualid","qualname"]});this.facSkillStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=skill",root:"skilllist",fields:["skillid","skillname"]});this.stateStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=state&country=130",root:"data",fields:["id","name"]});this.stateStore.load();this.religionStore=new Wtf.data.SimpleStore({data:[["Islam","Islam"],["Buddhist","Buddhist"],["Christian","Christian"],["Hindu","Hindu"],["Jew","Jew"],["Other","Other"]],fields:["name","id"],reader:new Wtf.data.ArrayReader({},[{name:"name"},{name:"id"}]),autoLoad:true});this.idTypeStore=new Wtf.data.SimpleStore({data:[["MyKad",1],["Passport",2],["Malaysian IC",3],["Military Number",4]],fields:["name","id"],reader:new Wtf.data.ArrayReader({},[{name:"name",name:"id"}]),autoLoad:true});if(this.studentPro){this.proDetails=[this.profield1=new Wtf.form.FieldSet({xtype:"fieldset",title:"Employment Background",height:360,layout:"fit",columnWidth:0.48,items:[{layout:"column",items:[{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.empType=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Employment Status*",hiddenName:"empstatus",store:this.empStatus,readOnly:true,displayField:"type",valueField:"empstatus",mode:"local",triggerAction:"all",emptyText:"Select a type...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.studComp=new Wtf.form.TextField({fieldLabel:"Company Name",name:"company",anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.studDesig=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Position*",hiddenName:"desg",store:this.posStore,readOnly:true,displayField:"designame",valueField:"desigid",mode:"local",triggerAction:"all",emptyText:"Select Position...",anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.studIndus=new Wtf.form.TextField({fieldLabel:"Industry",name:"industry",anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.yos=new Wtf.form.NumberField({fieldLabel:"Years of Service",name:"yos",anchor:"98%"})]}]}]})]}else{this.proDetails=[this.profield1=new Wtf.form.FieldSet({xtype:"fieldset",title:"General",height:360,layout:"fit",columnWidth:0.48,items:[{layout:"column",items:[{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facName=new Wtf.form.TextField({fieldLabel:"Faculty's Name*",name:"name",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facType=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Faculty Type*",hiddenName:"factype",store:this.typeStore,readOnly:true,displayField:"type",valueField:"roleid",mode:"local",triggerAction:"all",emptyText:"Select a type...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facDesig=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Designation*",hiddenName:"desg",store:this.dsgStore,readOnly:true,displayField:"designame",valueField:"desigid",mode:"local",triggerAction:"all",emptyText:"Select designation...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facDept=new Wtf.form.ComboBox({mode:"local",store:this.deptStore,fieldLabel:"Department*",hiddenName:"dept",valueField:"departmentid",triggerAction:"all",displayField:"departmentname",readOnly:true,emptyText:"Select department...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facLevel=new Wtf.form.ComboBox({mode:"local",store:this.facLevelStore,fieldLabel:"Level*",scope:this,hiddenName:"level",valueField:"levelid",triggerAction:"all",displayField:"levelname",readOnly:true,emptyText:"Select Level...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facCost=new Wtf.form.TextField({fieldLabel:"Cost(Per Week)*",name:"cost",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facPayroll=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Payroll*",hiddenName:"payroll",store:this.payStore,readOnly:true,displayField:"paytype",valueField:"payid",mode:"local",triggerAction:"all",emptyText:"Select payroll...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facProgramme=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},{xtype:"combo",fieldLabel:"Programs*",hiddenName:"programmes",store:Wtf.progStore,readOnly:true,displayField:"programname",valueField:"programid",mode:"local",triggerAction:"all",emptyText:"Select Program...",allowBlank:false,anchor:"98%"}))]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facLocation=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},{xtype:"combo",fieldLabel:"Locations*",hiddenName:"locations",scope:this,store:this.facLocStore,readOnly:true,displayField:"locname",valueField:"locid",mode:"local",triggerAction:"all",emptyText:"Select location...",allowBlank:false,anchor:"98%"}))]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facJoin=new Wtf.form.DateField({editable:false,format:"Y/d/m",width:160,fieldLabel:"Joining Date*",name:"joiningdate",allowBlank:false,anchor:"98%"})]}]}]}),this.profield2=new Wtf.form.FieldSet({xtype:"fieldset",title:"Skills",height:360,layout:"fit",columnWidth:0.48,items:[{layout:"column",items:[{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facQual=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},{xtype:"combo",fieldLabel:"Qualifications*",hiddenName:"qualifications",scope:this,store:this.facQualStore,readOnly:true,displayField:"qualname",valueField:"qualid",mode:"local",triggerAction:"all",emptyText:"Select qualification...",allowBlank:false,anchor:"98%"}))]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facSkill=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},{xtype:"combo",fieldLabel:"Skills*",hiddenName:"skills",scope:this,store:this.facSkillStore,readOnly:true,displayField:"skillname",valueField:"skillid",mode:"local",triggerAction:"all",emptyText:"Select skills...",allowBlank:false,anchor:"98%"}))]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facPrevWorkEx=new Wtf.form.TextArea({fieldLabel:"Work Experience*",name:"prevworkex",height:100,allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facBookRef=new Wtf.form.TextArea({fieldLabel:"Book/Article References*",name:"bookref",height:100,allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facultyId=new Wtf.form.Hidden({name:"facultyid"})]}]}]})]}var C=(this.facId)?this.facId:loginid;this.pro=new Wtf.form.FormPanel({url:this.studentPro?"jspfiles/newCourse.jsp?type=updateStudentProfile&userid="+C+"":"jspfiles/schclass.jsp?type=updateFacProfile&userid="+C,waitMsgTarget:true,method:"POST",title:this.studentPro?"Employment Details":"Professional Details",border:false,region:"center",layout:"column",layoutConfig:{deferredRender:false},frame:true,items:this.proDetails});if(!this.studentPro){this.facName.disable()}if(isRoleGroup("2")){this.facCost.disable()}var B=(this.facId)?this.facId:loginid;this.crDate=(new Date()).format("Y/m/d");this.per=new Wtf.form.FormPanel({url:"editProfile.jsp?userid="+B,waitMsgTarget:true,method:"POST",scope:this,title:"Personal Details",fileUpload:true,region:"center",border:false,autoHeight:true,layout:"column",layoutConfig:{deferredRender:false},frame:true,id:"createuserForm",items:[{xtype:"fieldset",title:"General",height:390,layout:"fit",columnWidth:0.4,items:[{layout:"form",labelWidth:84,items:[this.sal=new Wtf.form.ComboBox({fieldLabel:"Salutation*",mode:"local",scope:this,triggerAction:"all",typeAhead:true,editable:false,blankText:"Select a salutation",store:this.salStore,displayField:"type",valueField:"id",allowBlank:false,width:160}),this.idType=new Wtf.form.ComboBox({mode:"local",store:this.idTypeStore,fieldLabel:"ID Type*",valueField:"id",name:"idtype",editable:false,triggerAction:"all",displayField:"name",emptyText:"Select an ID Type...",allowBlank:false,width:160,disabled:isRoleGroup("1")}),this.idNumber=new Wtf.form.TextField({fieldLabel:"ID Number*",allowBlank:false,maxLength:30,scope:this,width:160,disabled:isRoleGroup("1")}),this.userid=new Wtf.form.TextField({fieldLabel:"User ID*",maxLength:50,scope:this,disabled:true,allowBlank:false,width:160}),this.oid=new Wtf.form.TextField({fieldLabel:"Other ID",maxLength:50,scope:this,allowBlank:true,width:160,disabled:isRoleGroup("1")}),this.dlno=new Wtf.form.TextField({fieldLabel:"Driving License No",name:"dlno",maxLength:50,scope:this,allowBlank:true,width:160}),this.fName=new Wtf.form.TextField({fieldLabel:"First Name*",scope:this,maxLength:100,allowBlank:false,width:160,disabled:isRoleGroup("1")}),this.lName=new Wtf.form.TextField({fieldLabel:"Last Name*",scope:this,maxLength:100,allowBlank:false,width:160,disabled:isRoleGroup("1")}),this.facDob=new Wtf.form.DateField({editable:false,format:"Y/m/d",width:160,fieldLabel:"Date of Birth*",name:"dob",allowBlank:false,maxValue:this.crDate,width:160}),new Wtf.form.TextField({labelStyle:"width: 80px",fieldLabel:"User Picture",hidden:isRoleGroup("1")?true:false,hideLabel:isRoleGroup("1")?true:false,name:"image",scope:this,anchor:"98%",height:24,inputType:"file"}),this.bum=new Wtf.form.ComboBox({fieldLabel:"Bumiputera Eligibility*",mode:"local",scope:this,name:"bumi",triggerAction:"all",typeAhead:true,editable:false,blankText:"Select a bumiputera eligibility",store:this.bumiputera,displayField:"value",valueField:"id",allowBlank:false,width:160,disabled:true})]}]},{xtype:"fieldset",title:"Residential Details",height:390,layout:"fit",columnWidth:0.3,items:[{layout:"form",items:[this.nationality=new Wtf.form.ComboBox({fieldLabel:"Nationality*",mode:"local",triggerAction:"all",typeAhead:true,editable:false,emptyText:"Select a nationality...",store:Wtf.nationalityStore,displayField:"name",valueField:"id",allowBlank:false,width:130}),this.race=new Wtf.form.ComboBox({fieldLabel:"Race*",mode:"local",triggerAction:"all",typeAhead:true,valueNotFoundText:"Select a race...",editable:false,disabled:true,emptyText:"Select a race...",store:Wtf.raceStore,displayField:"name",valueField:"id",allowBlank:false,width:130}),this.religion=new Wtf.form.ComboBox({mode:"local",store:this.religionStore,fieldLabel:"Religion*",valueField:"name",editable:false,triggerAction:"all",displayField:"name",emptyText:"Select a religion...",allowBlank:false,width:130}),this.country=new Wtf.form.ComboBox({fieldLabel:"Country*",mode:"local",triggerAction:"all",typeAhead:true,editable:false,emptyText:"Select a country...",store:Wtf.countryStore,displayField:"name",valueField:"id",allowBlank:false,width:130}),this.state=new Wtf.form.ComboBox({mode:"local",store:this.stateStore,fieldLabel:"State",valueField:"id",editable:false,triggerAction:"all",displayField:"name",emptyText:"Select a state...",allowBlank:true,width:130}),this.ostate=new Wtf.form.TextField({fieldLabel:"State (Non-Malaysian)",name:"ostate",maxLength:50,valuefield:"id",width:130}),this.city=new Wtf.form.TextField({fieldLabel:"City",maxLength:50,name:"city",width:130}),this.address=new Wtf.form.TextArea({fieldLabel:"Permanent Address",height:65,maxLength:256,scope:this,name:"address",width:130}),this.paddress=new Wtf.form.TextArea({fieldLabel:"Correspondence Address",height:65,scope:this,maxLength:200,name:"paddress",width:130}),this.postcode=new Wtf.form.TextField({fieldLabel:"Post Code*",name:"postcode",allowBlank:false,maxLength:50,regex:new RegExp("^(([0-9A-Z]{2,5}[ \\-]?[0-9A-Z]{2,5})|\\d{0})$"),scope:this,width:130})]}]},{xtype:"fieldset",title:"Contact Details",height:390,layout:"fit",columnWidth:0.29,items:[{layout:"form",items:[this.phone=new Wtf.form.TextField({fieldLabel:"Telephone",name:"telephone",maxLength:50,scope:this,validator:this.phoneValidator,width:123}),this.fax=new Wtf.form.TextField({fieldLabel:"Fax",name:"faxno",scope:this,maxLength:50,validator:this.phoneValidator,width:123}),this.mobile=new Wtf.form.TextField({fieldLabel:"Mobile*",name:"mobileno",maxLength:50,allowBlank:false,scope:this,validator:this.phoneValidator,width:123}),this.email=new Wtf.form.TextField({fieldLabel:"User Email*",name:"emailid",scope:this,allowBlank:false,vtype:"email",width:123}),this.locale=new Wtf.form.ComboBox({fieldLabel:"Time Zone*",mode:"local",scope:this,triggerAction:"all",typeAhead:true,editable:false,blankText:"Select a time zone",store:Wtf.timezoneStore,displayField:"name",valueField:"id",allowBlank:false,width:120}),this.about=new Wtf.form.TextArea({fieldLabel:"About User",name:"aboutuser",maxLength:256,scope:this,width:123}),new Wtf.form.Hidden({name:"userid",value:(this.facId)?this.facId:loginid,width:123})]}]}]});this.tp=new Wtf.TabPanel({activeTab:0,region:"center",layoutOnTabChange:true,layoutConfig:{deferredRender:false},deferredRender:false,defaults:{bodyStyle:"padding:10px"},items:[this.per]});this.tp.on("tabchange",function(E,D){if(D==this.pro){this.profield1.setHeight(360);if(!this.studentPro){this.profield2.setHeight(360)}}},this);this.nationality.on("select",function(E,F,D){if(F.get("name").match(/Malaysia/gi)!=null){this.race.enable();this.bum.enable()}else{this.race.disable();this.bum.disable()}},this);this.country.on("select",function(E,F,D){if(F.get("name").match(/Malaysia/gi)!=null){this.state.enable();this.ostate.disable();this.ostate.setValue("")}else{this.state.disable();this.ostate.enable();this.state.setValue("")}},this);if(isRoleGroup("2")||(this.parentid)||this.studentPro){this.tp.add(this.pro);this.pro.form.render()}this.addPer();Wtf.getCmp("myProfile"+this.id).add(this.tp)},setFormValues:function(A){if(A){if(A.loclist){this.facLocStore.loadData(A,true)}if(A.quallist){this.facQualStore.loadData(A,true)}if(A.levellist){this.facLevelStore.loadData(A,true)}if(A.skilllist){this.facSkillStore.loadData(A,true)}this.facultyId.setValue(A.Id);this.facName.setValue(A.Name);this.facType.setValue(A.Type);this.facDesig.setValue(A.Designation);this.facDept.setValue(A.Department);this.facPayroll.setValue(A.Payroll);if(A.Level){this.facLevel.setValue(A.Level)}this.facCost.setValue(A.Cost);this.facJoin.setValue(A.JoiningDate);this.facPrevWorkEx.setValue(A.PrevWorkEx);this.facBookRef.setValue(A.BookRef);if(A.LocationIds){this.facLocation.setValue(A.LocationIds)}if(A.QualIds){this.facQual.setValue(A.QualIds)}if(A.SkillIds){this.facSkill.setValue(A.SkillIds)}if(A.ProgramIds){this.facProgramme.setValue(A.ProgramIds)}}},setStudEmployment:function(A){if(A){this.empType.setValue(A.employement[0].empstatus);this.studComp.setValue(A.employement[0].comp);this.studDesig.setValue(A.employement[0].poslevel);this.studIndus.setValue(A.employement[0].industry);this.yos.setValue(A.employement[0].duration)}},createStores:function(A){this.programmeReader=new Wtf.data.Record.create([{name:"programid"},{name:"programname"}]);this.programmeStore=new Wtf.data.Store({url:"jspfiles/admin/getMasterData.jsp",method:"POST",reader:new Wtf.data.JsonReader({root:"data"},this.programmeReader)});this.locationReader=new Wtf.data.Record.create([{name:"locid"},{name:"locname"}]);this.locationStore=new Wtf.data.Store({url:"jspfiles/admin/getMasterData.jsp",method:"POST",reader:new Wtf.data.JsonReader({root:"data"},this.locationReader)});this.levelReader=new Wtf.data.Record.create([{name:"levelid"},{name:"levelname"}]);this.levelStore=new Wtf.data.Store({url:"jspfiles/admin/getMasterData.jsp",method:"POST",reader:new Wtf.data.JsonReader({root:"data"},this.levelReader)});this.qualReader=new Wtf.data.Record.create([{name:"qualid"},{name:"qualname"}]);this.qualStore=new Wtf.data.Store({url:"jspfiles/admin/getMasterData.jsp",method:"POST",reader:new Wtf.data.JsonReader({root:"data"},this.qualReader)});this.skillReader=new Wtf.data.Record.create([{name:"skillid"},{name:"skillname"}]);this.skillStore=new Wtf.data.Store({url:"jspfiles/admin/getMasterData.jsp",method:"POST",reader:new Wtf.data.JsonReader({root:"data"},this.skillReader)})},setPerformValues:function(A){if(A.info.length>0){this.sal.setValue(A.info[0].salutation);if(A.info[0].bumi==3){this.bum.setValue("Not Available")}else{this.bum.setValue(A.info[0].bumi)}this.idType.setValue(A.info[0].idtypenum);this.idNumber.setValue(A.info[0].idnumber);this.userid.setValue(A.info[0].username);this.fName.setValue(A.info[0].fname);this.lName.setValue(A.info[0].lname);this.facDob.setValue(A.info[0].dob);this.religion.setValue(A.info[0].religion);this.race.setValue(A.info[0].race);this.nationality.setValue(A.info[0].nationality);if(A.info[0].nationalityname.match(/Malaysia/gi)!=null){this.race.enable();this.bum.enable()}this.country.setValue(A.info[0].country);if(A.info[0].countryname.match(/Malaysia/gi)!=null){this.state.enable();this.ostate.disable();this.state.setValue(A.info[0].state)}else{this.state.disable();this.ostate.enable();this.ostate.setValue(A.info[0].state)}this.city.setValue(A.info[0].city);this.address.setValue(A.info[0].add);this.postcode.setValue((A.info[0].postcode==""?0:A.info[0].postcode));this.phone.setValue(A.info[0].contactno);this.fax.setValue(A.info[0].fax);this.mobile.setValue(A.info[0].mobile);this.email.setValue(A.info[0].emailid);this.locale.setValue(A.info[0].timezone);this.about.setValue(A.info[0].aboutme);this.dlno.setValue(A.info[0].dlno);this.oid.setValue(A.info[0].oid);this.paddress.setValue(A.info[0].paddr)}},phoneValidator:function(A){return true},addPer:function(){this.loadMask=new Wtf.LoadMask(this.id,{msg:"loading..."});this.loadMask.show();Wtf.Ajax.request({url:"jspfiles/profilePage.jsp",method:"POST",scope:this,params:{userid:(this.facId)?this.facId:loginid},success:function(response,options){var responseObj=eval("("+response.responseText+")");var text="Edit";var createuserForm=null;this.setPerformValues(responseObj);if(isRoleGroup("2")||(this.parentid)){this.setFormValues(responseObj)}if(this.studentPro){Wtf.Ajax.request({url:"jspfiles/newCourse.jsp?type=getStudEmpBG",method:"POST",scope:this,params:{userid:(this.facId)?this.facId:loginid},success:function(response,options){var responseObj=eval("("+response.responseText+")");this.setStudEmployment(responseObj)},failure:function(request,response){this.loadMask.hide()}})}this.loadMask.hide()},failure:function(request,response){this.loadMask.hide()}})},subPer:function(){if(this.per.form.isValid()){this.per.form.submit({useraction:1,scope:this,params:{locale:this.locale.getValue(),salutation:this.sal.getValue(),country:this.country.getValue(),state:this.state.getValue(),religion:this.religion.getValue(),nationality:this.nationality.getValue(),idtype:this.idType.getValue(),race:this.race.getValue(),idnumber:this.idNumber.getValue(),username:this.userid.getValue(),oid:this.oid.getValue(),fname:this.fName.getValue(),lname:this.lName.getValue(),bumi:this.bum.getValue()},success:function(B,A){this.close();Wtf.MessageBox.alert("Status","Details saved successfully.")},failure:function(B,A){Wtf.MessageBox.alert("Status","An error occurred while connecting to server.")}})}else{msgBoxShow(["Validation Failure","Some fields in the Personal Details tab are invalid."],Wtf.MessageBox.ERROR)}}});Wtf.changePassWin=function(A){Wtf.apply(this,A);Wtf.changePassWin.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:350,modal:true,height:250,title:"Change Password",buttons:[{text:"Change",scope:this,handler:function(){if(this.pass.form.isValid()){if(this.newPass.getValue()==this.cNewPass.getValue()){this.pass.form.submit({waitMsg:"Loading...",scope:this,params:{action:"pass"},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)},success:function(C,B){var D=Wtf.decode(B.response.responseText);if(D.flag!=null){if(D.flag==1){Wtf.Msg.alert("Alert","Please enter the correct old password",function(E){if(E=="ok"){}},this)}else{Wtf.Msg.alert("Alert","Password changed successfully",function(E){if(E=="ok"){this.close()}},this)}}}})}else{Wtf.Msg.alert("Alert","Entered passwords do not match",function(B){if(B=="ok"){}},this)}}}},{text:"Cancel",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Change Password","Enter password details")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:10px",items:[this.pass=new Wtf.form.FormPanel({url:"jspfiles/admin/getMasterData.jsp",waitMsgTarget:true,method:"POST",border:false,labelWidth:130,items:[this.oldPass=new Wtf.form.TextField({allowBlank:false,fieldLabel:"Old Password*",name:"oldpass",inputType:"password"}),this.newPass=new Wtf.form.TextField({allowBlank:false,fieldLabel:"New Password*",name:"newpass",inputType:"password"}),this.cNewPass=new Wtf.form.TextField({allowBlank:false,fieldLabel:"Confirm New Password*",name:"newpass",inputType:"password"})]})]}]})};Wtf.extend(Wtf.changePassWin,Wtf.Window,{});Wtf.passwordPolicy=function(A){Wtf.apply(this,A);Wtf.passwordPolicy.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:350,modal:true,height:315,title:"Password Policy",buttons:[{text:"Set",scope:this,handler:function(){if(this.passPolicy.form.isValid()){this.passPolicy.form.submit({waitMsg:"Loading...",scope:this,params:{action:"policy"},success:function(C,B){Wtf.Msg.alert("Alert","Password policy rules set successfully",function(D){if(D=="ok"){this.close()}},this)},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)}})}}},{text:"Cancel",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Password Policy","Set values for policy parameters")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:10px",items:[this.passPolicy=new Wtf.form.FormPanel({url:"jspfiles/admin/getMasterData.jsp",waitMsgTarget:true,method:"POST",border:false,labelWidth:130,layout:"column",items:[{columnWidth:1,border:false,layout:"form",height:115,items:[this.minchar=new Wtf.form.NumberField({name:"minchar",allowBlank:false,fieldLabel:"Minimum Characters*",allowBlank:false,allowNegative:false,value:0}),this.maxchar=new Wtf.form.NumberField({name:"maxchar",allowBlank:false,fieldLabel:"Maximum Characters*",allowBlank:false,allowNegative:false,value:0}),this.minnum=new Wtf.form.NumberField({name:"minnum",allowBlank:false,fieldLabel:"Minimum Numbers*",allowBlank:false,allowNegative:false,value:0}),this.minalpha=new Wtf.form.NumberField({name:"minalpha",allowBlank:false,fieldLabel:"Minimum alphabets*",allowBlank:false,allowNegative:false,value:0})]},{columnWidth:1,layout:"column",labelWidth:0,border:false,height:30,items:[{columnWidth:0.5,border:false,layout:"form",items:[this.specialchars=new Wtf.form.Checkbox({name:"specchars",boxLabel:"Special Characters",labelSeparator:""})]},{columnWidth:0.5,border:false,layout:"form",items:[this.appPolicy=new Wtf.form.Checkbox({name:"appPolicy",boxLabel:"Apply Password Policy",labelSeparator:""})]}]}]})]}]})};Wtf.extend(Wtf.passwordPolicy,Wtf.Window,{});Wtf.ReminderInterval=function(A){Wtf.apply(this,A);Wtf.ReminderInterval.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:420,modal:true,height:300,title:"Set Reminder Interval",buttons:[{text:"Set",scope:this,handler:function(){if(this.remInterval.form.isValid()){this.remInterval.form.submit({waitMsg:"Loading...",scope:this,params:{type:"setReminderDates"},success:function(C,B){Wtf.Msg.alert("Alert","Reminder interval days set successfully",function(D){if(D=="ok"){this.close()}},this)},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)}})}}},{text:"Cancel",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",height:100,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Reminder Intervals","Set number of days between 1st and 2nd payment reminders")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:10px",items:[this.remInterval=new Wtf.form.FormPanel({url:"jspfiles/newCourse.jsp",waitMsgTarget:true,method:"POST",border:false,labelWidth:205,layout:"form",items:[this.firstinterval=new Wtf.form.NumberField({name:"firstinterval",fieldLabel:"First reminder after (in days):",value:A.firstinterval,allowBlank:false,allowNegative:false,allowDecimals:false}),this.secondinterval=new Wtf.form.NumberField({name:"secondinterval",fieldLabel:"Second reminder after (in days):",value:A.secondinterval,allowBlank:false,allowNegative:false,allowDecimals:false})]})]}]})};Wtf.extend(Wtf.ReminderInterval,Wtf.Window,{});Wtf.SystemTimezone=function(A){if(!Wtf.StoreMgr.containsKey("timezone")){Wtf.timezoneStore.load();Wtf.StoreMgr.add("timezone",Wtf.timezoneStore)}Wtf.apply(this,A);Wtf.SystemTimezone.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:350,modal:true,height:200,buttons:[{text:"Set",scope:this,handler:function(){if(this.pass.form.isValid()){Wtf.Ajax.request({url:"jspfiles/admin/getMasterData.jsp",method:"POST",scope:this,params:{action:"tzone",id:this.tzone.getValue()},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)},success:function(C,B){Wtf.Msg.alert("Alert","Timezone set successfully",function(D){if(D=="ok"){this.close()}},this)}})}}},{text:"Cancel",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Set System Time Zone","Select a time zone for the system")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:20px",items:[this.pass=new Wtf.form.FormPanel({waitMsgTarget:true,method:"POST",border:false,labelWidth:75,items:[this.tzone=new Wtf.form.ComboBox({fieldLabel:"Time Zone*",editable:false,store:Wtf.timezoneStore,displayField:"name",valueField:"id",typeAhead:true,mode:"local",width:215,triggerAction:"all",selectOnFocus:true,allowBlank:false,blankText:"Select a time zone"})]})]}]})};Wtf.extend(Wtf.SystemTimezone,Wtf.Window,{});Wtf.Feedback=function(A){Wtf.apply(this,A);Wtf.Feedback.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:350,modal:true,height:200,buttons:[{text:"Set",scope:this,handler:function(){if(this.pass.form.isValid()){Wtf.Ajax.request({url:"jspfiles/admin/getMasterData.jsp",method:"POST",scope:this,params:{action:"setfeedback",value:this.displayFeed.getValue()},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)},success:function(C,B){Wtf.Msg.alert("Alert","Status set successfully",function(D){if(D=="ok"){this.close()}},this)}})}}},{text:"Cancel",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",border:false,height:90,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Allow Feedback","Allow students to submit feedback.")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:20px",items:[this.pass=new Wtf.form.FormPanel({waitMsgTarget:true,method:"POST",border:false,labelWidth:100,items:[this.displayFeed=new Wtf.form.Checkbox({fieldLabel:"Allow feedback?"})]})]}]})};Wtf.extend(Wtf.Feedback,Wtf.Window,{onRender:function(A){Wtf.Feedback.superclass.onRender.call(this,A);Wtf.Ajax.request({url:"jspfiles/admin/getMasterData.jsp",method:"POST",scope:this,params:{action:"getfeedback"},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)},success:function(C,B){this.displayFeed.setValue(Wtf.decode(C.responseText))}})}});Wtf.personalPref=function(A){Wtf.apply(this,A);this.dt=new Date();this.dt.format(Date.patterns.ShortDate);this.dtStore=new Wtf.data.SimpleStore({data:[[this.dt.format(Date.patterns.ISO8601Short),"1"],[this.dt.format(Date.patterns.ShortDate),"2"],[this.dt.format(Date.patterns.LongDate),"3"],[this.dt.format(Date.patterns.MonthDay),"5"],[this.dt.format(Date.patterns.YearMonth),"10"],[this.dt.format(Date.patterns.Kdate1),"11"],[this.dt.format(Date.patterns.Kdate2),"12"],[this.dt.format(Date.patterns.Kdate3),"13"],[this.dt.format(Date.patterns.Kdate4),"14"]],fields:["name","id"],reader:new Wtf.data.ArrayReader({},[{name:"name"},{name:"id"}]),autoLoad:true});if(!Wtf.StoreMgr.containsKey("timezone")){Wtf.timezoneStore.load();Wtf.StoreMgr.add("timezone",Wtf.timezoneStore)}Wtf.personalPref.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:400,modal:true,plain:true,height:245,keys:{key:[10,13],fn:this.handleKey,scope:this},title:"Personal Preferences",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Personal Preferences","Set your personal preferences")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:10px",items:[this.pp=new Wtf.form.FormPanel({url:"jspfiles/savePref.jsp",waitMsgTarget:true,method:"POST",border:false,labelWidth:100,defaultType:"textfield",items:[this.dtCombo=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Date Format*",hiddenName:"factype",store:this.dtStore,readOnly:true,displayField:"name",valueField:"id",value:Wtf.pref.DateFormat,editable:false,name:"dateformat",mode:"local",triggerAction:"all",emptyText:"Select a type...",allowBlank:false,anchor:"98%"}),this.locale=new Wtf.form.ComboBox({fieldLabel:"Time Zone*",mode:"local",scope:this,triggerAction:"all",typeAhead:true,value:Wtf.pref.Timezone,editable:false,name:"timezone",blankText:"Select a time zone",store:Wtf.timezoneStore,displayField:"name",valueField:"id",allowBlank:false,anchor:"98%"}),this.schDays=new Wtf.form.NumberField({allowDecimals:false,allowNegative:false,fieldLabel:"Dashboard Schedule",name:"min",scope:this,anchor:"98%",minValue:1,maxValue:365,allowBlank:false,blankText:"Enter dashboard schedule days",value:1})]})]}],buttons:[{text:"OK",scope:this,handler:function(){this.handleKey()}},{text:"Cancel",scope:this,handler:function(){this.close()}}]})};Wtf.extend(Wtf.personalPref,Wtf.Window,{onRender:function(A){Wtf.personalPref.superclass.onRender.call(this,A);Wtf.timezoneStore.on("load",function(){this.locale.setValue(Wtf.pref.Timezone)},this);Wtf.Ajax.requestEx({url:"jspfiles/savePref.jsp",params:{flag:1}},this,function(B,C){this.schDays.setValue(B);Wtf.scheduleDays=B})},handleKey:function(){if(this.pp.form.isValid()){this.pp.form.submit({scope:this,params:{dateformat:this.dtCombo.getValue(),timezone:this.locale.getValue(),scheduledays:this.schDays.getValue(),flag:0},success:function(B,A){msgBoxShow(["Success","Preferences saved successfully"],Wtf.MessageBox.INFO);var C=Wtf.getCmp("ascalctrl");if(C){if(C.weekWin){Wtf.each(C.weekWin.buttons,function(D){D.purgeListeners()});C.weekWin.destroy();C.weekWin=null}if(C.apptForm){C.apptForm.destroy();C.apptForm=null}}},failure:function(B,A){msgBoxShow(["Failure","Error connecting to Server"],Wtf.MessageBox.ERROR)}})}Wtf.pref.DateFormat=this.dtCombo.getValue();Wtf.pref.Timezone=this.locale.getValue();this.close()}});Wtf.grid.GroupSummary=function(A){Wtf.apply(this,A)};Wtf.extend(Wtf.grid.GroupSummary,Wtf.util.Observable,{init:function(B){this.grid=B;this.cm=B.getColumnModel();this.view=B.getView();var A=this.view;A.doGroupEnd=this.doGroupEnd.createDelegate(this);A.afterMethod("onColumnWidthUpdated",this.doWidth,this);A.afterMethod("onAllColumnWidthsUpdated",this.doAllWidths,this);A.afterMethod("onColumnHiddenUpdated",this.doHidden,this);A.afterMethod("onUpdate",this.doUpdate,this);A.afterMethod("onRemove",this.doRemove,this);if(!this.rowTpl){this.rowTpl=new Wtf.Template('<div class="x-grid3-summary-row" style="{tstyle}">','<table class="x-grid3-summary-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',"<tbody><tr>{cells}</tr>","</table></div>");this.rowTpl.disableFormats=true}this.rowTpl.compile();if(!this.cellTpl){this.cellTpl=new Wtf.Template('<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}">','<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on">{value}</div>',"</td>");this.cellTpl.disableFormats=true}this.cellTpl.compile()},toggleSummaries:function(B){var A=this.grid.getGridEl();if(A){if(B===undefined){B=A.hasClass("x-grid-hide-summary")}A[B?"removeClass":"addClass"]("x-grid-hide-summary")}},renderSummary:function(C,G){G=G||this.view.getColumnData();var H=this.cm.config;var D=[],I,A={},B,J=G.length-1;for(var E=0,F=G.length;E<F;E++){I=G[E];B=H[E];A.id=I.id;A.style=I.style;A.css=E==0?"x-grid3-cell-first ":(E==J?"x-grid3-cell-last ":"");if(B.summaryType||B.summaryRenderer){A.value=(B.summaryRenderer||I.renderer)(C.data[I.name],A,C)}else{A.value=""}if(A.value==undefined||A.value===""){A.value="&#160;"}D[D.length]=this.cellTpl.apply(A)}return this.rowTpl.apply({tstyle:"width:"+this.view.getTotalWidth()+";",cells:D.join("")})},calculate:function(C,H){var F={},A,J,I=this.cm.config,B;for(var D=0,K=C.length;D<K;D++){A=C[D];for(var E=0,G=H.length;E<G;E++){J=H[E];B=I[E];if(B.summaryType){F[J.name]=Wtf.grid.GroupSummary.Calculations[B.summaryType](F[J.name]||0,A,J.name,F)}}}return F},doGroupEnd:function(A,D,B,F,C){var E=this.calculate(D.rs,B);A.push("</div>",this.renderSummary({data:E},B),"</div>")},doWidth:function(E,B,D){var C=this.view.getGroups(),G;for(var F=0,A=C.length;F<A;F++){G=C[F].childNodes[2];G.style.width=D;G.firstChild.style.width=D;G.firstChild.rows[0].childNodes[E].style.width=B}},doAllWidths:function(G,D){var A=this.view.getGroups(),I,H,E=G.length;for(var C=0,F=A.length;C<F;C++){I=A[C].childNodes[2];I.style.width=D;I.firstChild.style.width=D;H=I.firstChild.rows[0].childNodes;for(var B=0;B<E;B++){H[B].style.width=G[B]}}},doHidden:function(D,G,C){var B=this.view.getGroups(),F,H=G?"none":"";for(var E=0,A=B.length;E<A;E++){F=B[E].childNodes[2];F.style.width=C;F.firstChild.style.width=C;F.firstChild.rows[0].childNodes[D].style.display=H}},refreshSummary:function(A){return this.refreshSummaryById(this.view.getGroupId(A))},getSummaryNode:function(A){var B=Wtf.fly(A,"_gsummary");if(B){return B.down(".x-grid3-summary-row",true)}return null},refreshSummaryById:function(D){var F=document.getElementById(D);if(!F){return false}var B=[];this.grid.store.each(function(H){if(H._groupId==D){B[B.length]=H}});var C=this.view.getColumnData();var G=this.calculate(B,C);var A=this.renderSummary({data:G},C);var E=this.getSummaryNode(D);if(E){F.removeChild(E)}Wtf.DomHelper.append(F,A);return true},doUpdate:function(B,A){this.refreshSummaryById(A._groupId)},doRemove:function(D,A,B,C){if(!C){this.refreshSummaryById(A._groupId)}},showSummaryMsg:function(A,D){var B=this.view.getGroupId(A);var C=this.getSummaryNode(B);if(C){C.innerHTML='<div class="x-grid3-summary-msg">'+D+"</div>"}}});Wtf.grid.GroupSummary.Calculations={"sum":function(B,A,C){return B+(A.data[C]||0)},"count":function(B,A,D,C){return C[D+"count"]?++C[D+"count"]:(C[D+"count"]=1)},"max":function(C,B,E,D){var C=B.data[E];var A=D[E+"max"]===undefined?(D[E+"max"]=C):D[E+"max"];return C>A?(D[E+"max"]=C):A},"min":function(B,A,E,D){var B=A.data[E];var C=D[E+"min"]===undefined?(D[E+"min"]=B):D[E+"min"];return B<C?(D[E+"min"]=B):C},"average":function(B,A,E,D){var F=D[E+"count"]?++D[E+"count"]:(D[E+"count"]=1);var C=(D[E+"total"]=((D[E+"total"]||0)+(A.data[E]||0)));return C===0?0:C/F}};Wtf.grid.HybridSummary=Wtf.extend(Wtf.grid.GroupSummary,{calculate:function(B,D){var A=this.view.getGroupField();var C=B[0].data[A];var E=this.getSummaryData(C);return E||Wtf.grid.HybridSummary.superclass.calculate.call(this,B,D)},updateSummaryData:function(A,D,C){var B=this.grid.store.reader.jsonData;if(!B.summaryData){B.summaryData={}}B.summaryData[A]=D;if(!C){this.refreshSummary(A)}},getSummaryData:function(A){var B=this.grid.store.reader.jsonData;if(B&&B.summaryData){return B.summaryData[A]}return null}});Wtf.common.KWLListPanel=function(A){Wtf.common.KWLListPanel.superclass.constructor.call(this,A)};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,current:null,initComponent:function(){Wtf.common.KWLListPanel.superclass.initComponent.call(this);this.addEvents({"dataloaded":true,"contextmenu":true,"buttonclick":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.labelext=document.createElement("span");this.labelext.innerHTML="";this.labelext.className="label";this.labelext.style.margin="0px 0px 0px 4px";this.label.id=this.id+"-labelext";this.headercontent.appendChild(this.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);if(this.collapsible){Wtf.get(this.collapseButton.id).addListener("click",this.toggleCollapse,this)}if(this.url){if(this.autoLoad==true){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));this.bttnArray=new Array();if(!this.contentType){this.calculatePageSize();if(this.Href){this.makeDashBttn(0,this.pageSize)}else{this.makeDashAlert(0,this.pageSize)}}},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(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.remDashAlert();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{if(this.Href){this.remDashBttn()}else{this.remDashAlert()}}}var D=0;for(var C=0;C<this.pageSize;C++){if(this.dstore.getAt(E)!=undefined){if(this.dstore.getAt(E).data["img"].length==0){this.bttnArray[C].addData("images/"+this.ImgSrc,this.dstore.getAt(E).data["name"],this.dstore.getAt(E).data["id"],this.Href)}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.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()}var A=this.total;if(this.tempdstore.reader.jsonData.count!=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 B=0;var A=true;var C=true;if(this.jobj!=null){while(B<this.pageSize&&this.jobj["name"][((this.pageno*this.pageSize)+B)]!=null){new Wtf.common.WtfButton({caption:this.jobj["name"][((this.pageno*this.pageSize)+B)],href:"#",bodyStyle:"position:relative;float:left;",imgSrc:"images/defaultuser.png",renderTo:this.el.dom.firstChild.nextSibling.firstChild.id});this.cursor=((this.pageno*this.pageSize)+B)+1;B=B+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){A=true}else{A=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(A,C)},Refresh:function(jstring){jstring=(jstring||"{}").trim();this.remDashAlert();if(jstring=="{}"){this.jobj=null}else{this.jobj=eval("("+jstring+")")}this.pageno=0;this.FillContainer()},FillContainerUrl:function(){var D=0;this.total=this.tempdstore.reader.jsonData.count;if(!this.dstore){this.dstore=new Wtf.data.Store}else{D=this.dstore.getCount()}for(var F=0;F<this.tempdstore.getCount();F++){var C=this.dstore.find("id",this.tempdstore.getAt(F).data["id"],0,false,true);if(C==-1){this.dstore.insert(D,this.tempdstore.getAt(F));D++}}if(this.checkForAnoReq==1){this.checkForReq();this.checkForAnoReq=0}var B=0;var A=true;var E=true;if(this.total!=0){while(B<this.pageSize&&this.tempdstore.getAt(B)!=null){if(this.tempdstore.getAt(B).data["img"].length==0){this.bttnArray[B].addData("images/"+this.ImgSrc,this.tempdstore.getAt(B).data["name"],this.tempdstore.getAt(B).data["id"],this.Href,this.TabType)}else{this.bttnArray[B].addData(this.tempdstore.getAt(B).data["img"],this.tempdstore.getAt(B).data["name"],this.tempdstore.getAt(B).data["id"],this.Href,this.TabType)}this.bttnArray[B].id=this.tempdstore.getAt(B).data["id"];this.cursor=(B)+1;B=B+1}}for(var C=B;C<this.bttnArray.length;C++){this.bttnArray[C].hideButton()}var D=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)+B)+"/ "}else{this.startlbl.innerHTML="0-";this.endlbl.innerHTML="0/"}this.totallbl.innerHTML=D;if(this.pageno==0){A=true}else{A=false}if(((this.pageno*this.pageSize)+B)==D){E=true}else{E=false}this.ResetNavBtns(A,E);this.checkFlag=0;this.loadMask.hide()},setTitle:function(A){this.title=A;this.label.innerHTML=this.title},ResetTitle:function(A){if(this.labelext){this.labelext.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(){var A=this.url+"&pageno=1&pageSize=4";this.tempdstore=new Wtf.data.Store({method:"GET",id:"tempstore",url:A,reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"name",type:"string"},{name:"id",type:"string"},{name:"img",type:"string"}]})});this.tempdstore.on("load",function(){this.fireEvent("dataloaded",this.tempdstore);this.FillContainerUrl()},this);this.tempdstore.on("loadexception",this.loadReload,this);this.loadMask.show();this.tempdstore.load({params:this.params})},loadReload:function(){this.loadMask.hide()},remDashAlert:function(){while(this.pageSize!=this.bttnArray.length){this.bttnArray[this.bttnArray.length-1].removeButton();this.bttnArray.pop()}},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}));this.bttnArray[B].on("clicked",function(D){this.fireEvent("buttonclick",D);if(this.current!=null){this.current.clickedFlag=false;this.current.onOut();this.current=D}else{this.current=D}},this)}},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(){while(this.pageSize!=this.bttnArray.length){this.bttnArray[this.bttnArray.length-1].removeButton();this.bttnArray.pop()}},checkForReq:function(){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{if(this.Href){this.remDashBttn()}else{this.remDashAlert()}}this.prevPageSize=this.pageSize;this.prevPageNo=this.pageno}},calculatePageSize:function(){this.prevPageSize=this.pageSize;var E=this.pageno*this.prevPageSize+1;var D=0;if(this.Href){var A=document.getElementById(this.id);var B=(parseInt(A.clientWidth)/82);var C=(parseInt(A.clientHeight-25)/101);this.pageSize=Math.floor(B)*Math.floor(C);if(this.pageSize<=0){this.pageSize=1}while(true){if(E<=D*this.pageSize){break}D++}this.pageno=D-1}else{var A=document.getElementById(this.id);var C=(parseInt(A.clientHeight-25)/30);this.pageSize=Math.floor(C);if(this.pageSize<=0){this.pageSize=1}while(true){if(E<=D*this.pageSize){break}D++}this.pageno=D-1}},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{if(this.Href){this.remDashBttn()}else{this.remDashAlert()}}this.loadMask.show();this.makeAjaxRequest()}});Wtf.reg("KWLListPanel",Wtf.common.KWLListPanel);Wtf.KWLTagSearch=function(A){Wtf.KWLTagSearch.superclass.constructor.call(this,A)};Wtf.extend(Wtf.KWLTagSearch,Wtf.form.TextField,{Store:null,StorageArray:null,limit:15,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.ux.WtfAlert=function(A){Wtf.ux.WtfAlert.superclass.constructor.call(this,A)};Wtf.extend(Wtf.ux.WtfAlert,Wtf.Component,{width:300,height:20,imgWidth:4,imgHeight:4,initialized:false,imgObj:null,zoomLevel:0.11,initComponent:function(){Wtf.ux.WtfAlert.superclass.initComponent.call(this)},onRender:function(){this.elDom=Wtf.get(this.renderTo).createChild({tag:"li",cls:"wtfalert"});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.image.getY()]);this.shadow=new Wtf.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.imgObj=this.image;this.elDom.dom.style.display="none";this.docID=document.getElementById(this.elDom.id)},onHover:function(C,B,A){this.docID.style.background="url(images/alertbackground.png) no-repeat 0 0";this.docID.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/alertbackground.png', sizingMethod='crop')"},onOut:function(C,B,A){this.docID.style.background="";this.docID.style.filter=""},onClick:function(C,B,A){C.preventDefault()},addData:function(C,B,D,A){this.elDom.dom.style.display="block";this.image.dom.src=C;this.image.dom.alt=B;this.id=D;this.label.dom.innerHTML=B;this.labelShadow.dom.innerHTML=B;this.caption=B},removeButton:function(){this.elDom.dom.parentNode.removeChild(this.elDom.dom)},hideButton:function(){this.elDom.dom.style.display="none"}});Wtf.reg("wtfalert",Wtf.ux.WtfAlert);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,clickedFlag:false,initComponent:function(){Wtf.common.WtfButton.superclass.initComponent.call(this);this.addEvents({"clicked":true})},onRender:function(){this.elDom=Wtf.get(this.renderTo).createChild({tag:"li",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.TransDiv=Wtf.get(this.elDom.dom.appendChild(document.createElement("div")));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.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.TransDiv.dom.className="wtfbuttonTrans";this.TransDiv.addListener("mouseover",this.onHover,this);this.TransDiv.addListener("mouseout",this.onOut,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.docID=document.getElementById(this.elDom.id);this.topMove=this.diffX/2;this.leftMove=this.diffY/2;this.elDom.dom.style.display="none"},onHover:function(C,B,A){if(this.clickedFlag==false){this.docID.style.background="url(images/background1.png) no-repeat 0 0";this.docID.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(this.clickedFlag==false){this.docID.style.background="";this.docID.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()},addData:function(D,C,E,B,A){this.elDom.dom.style.display="block";this.image.dom.src=D;this.image.dom.alt=C;this.id=E;this.href=B;this.tabtype=A;this.label.dom.innerHTML=Wtf.util.Format.ellipsis(C,32);this.labelShadow.dom.innerHTML=Wtf.util.Format.ellipsis(C,32);this.caption=C},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.grid.DynamicColumnModel=function(C){var B=[];for(var A=0;A<C.length;A++){switch(C[A].length){case 0:B[A]=C[A];break;case 3:B[A]={header:C[A][0],width:C[A][1],dataIndex:C[A][2]};break;case 5:B[A]={header:C[A][0],width:C[A][1],dataIndex:C[A][2],renderer:C[A][3],editor:C[A][4]};break}}Wtf.grid.DynamicColumnModel.superclass.constructor.call(this,B)};Wtf.extend(Wtf.grid.DynamicColumnModel,Wtf.grid.ColumnModel,{});Wtf.WtfGridMaker=function(A){Wtf.apply(this,A);this.columnModel=new Wtf.grid.DynamicColumnModel(A.columnModel);this.dataRecord=this.createRec(A.dataRecord);this.storeUrl=A.storeUrl;this.paging=A.paging;this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:true,hideGroupedColumn:false});this.columnModel.defaultSortable=true;this.dataReader=new Wtf.data.JsonReader({root:"data"},this.dataRecord);this.dataStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:this.storeUrl}),reader:this.dataReader});this.grid=new Wtf.grid.GridPanel({ds:this.dataStore,cm:this.columnModel,border:false,enableColumnHide:false,view:this.groupingView,trackMouseOver:true,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});if(this.paging==true){this.bbar=new Wtf.PagingToolbar({id:"pgTbar"+this.id,pageSize:5,store:this.dataStore,displayInfo:true,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:new Wtf.common.pPageSize({})})}Wtf.WtfGridMaker.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",items:[this.grid]})};Wtf.extend(Wtf.WtfGridMaker,Wtf.Panel,{createRec:function(A){var C=[];for(var B=0;B<A.length;B++){var D={name:A[B][0],type:A[B][1]};C.push(D)}return Wtf.data.Record.create(C)}});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(C,A,B){if(C&&!C.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 H=this.meta,A=this.recordType,R=A.prototype.fields,F=R.items,E=R.length;if(!this.ef){if(H.totalProperty){this.getTotal=this.getJsonAccessor(H.totalProperty)}if(H.successProperty){this.getSuccess=this.getJsonAccessor(H.successProperty)}this.getRoot=H.root?this.getJsonAccessor(H.root):function(U){return U};if(H.id){var Q=this.getJsonAccessor(H.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 O=0;O<E;O++){R=F[O];var T=(R.mapping!==undefined&&R.mapping!==null)?R.mapping:R.name;this.ef[O]=this.getJsonAccessor(T)}}var M=this.getRoot(K),S=M.length,I=S,D=true;if(H.totalProperty){var G=parseInt(this.getTotal(K),10);if(!isNaN(G)){I=G}}if(H.successProperty){var G=this.getSuccess(K);if(G===false||G==="false"){D=false}}var P=[];for(var O=0;O<S;O++){var L=M[O];var B={};var J=this.getId(L);for(var N=0;N<E;N++){R=F[N];var G=this.ef[N](L);B[R.name]=R.convert((G!==undefined)?G:R.defaultValue)}var C=new A(B,J);C.json=L;P[O]=C}return{success:D,records:P,totalRecords:I}}});Wtf.grid.RowExpander=function(A){Wtf.apply(this,A);Wtf.grid.RowExpander.superclass.constructor.call(this);if(this.tpl){if(typeof this.tpl=="string"){this.tpl=new Wtf.Template(this.tpl)}this.tpl.compile()}this.state={};this.bodyContent={};this.addEvents({beforeexpand:true,expand:true,beforecollapse:true,collapse:true})};Wtf.extend(Wtf.grid.RowExpander,Wtf.util.Observable,{header:"",width:20,sortable:false,fixed:true,dataIndex:"",id:"expander",lazyRender:true,enableCaching:true,getRowClass:function(A,E,D,C){D.cols=D.cols-1;var B=this.bodyContent[A.id];if(!B&&!this.lazyRender){B=this.getBodyContent(A,E)}if(B){D.body=B}return this.state[A.id]?"x-grid3-row-expanded":"x-grid3-row-collapsed"},init:function(B){this.grid=B;var A=B.getView();A.getRowClass=this.getRowClass.createDelegate(this);A.enableRowBody=true;B.on("render",function(){A.mainBody.on("mousedown",this.onMouseDown,this)},this)},getBodyContent:function(A,B){if(!this.enableCaching){return this.tpl.apply(A.data)}var C=this.bodyContent[A.id];if(!C){C=this.tpl.apply(A.data);this.bodyContent[A.id]=C}return C},onMouseDown:function(B,A){if(A.className=="x-grid3-row-expander"){B.stopEvent();var C=B.getTarget(".x-grid3-row");this.toggleRow(C)}},renderer:function(B,C,A){C.cellAttr='rowspan="2"';return'<div class="x-grid3-row-expander">&#160;</div>'},beforeExpand:function(B,A,C){if(this.fireEvent("beforexpand",this,B,A,C)!==false){if(this.tpl&&this.lazyRender){A.innerHTML=this.getBodyContent(B,C)}return true}else{return false}},toggleRow:function(A){if(typeof A=="number"){A=this.grid.view.getRow(A)}this[Wtf.fly(A).hasClass("x-grid3-row-collapsed")?"expandRow":"collapseRow"](A)},expandRow:function(C){if(typeof C=="number"){C=this.grid.view.getRow(C)}var B=this.grid.store.getAt(C.rowIndex);var A=Wtf.DomQuery.selectNode("tr:nth(2) div.x-grid3-row-body",C);if(this.beforeExpand(B,A,C.rowIndex)){this.state[B.id]=true;Wtf.fly(C).replaceClass("x-grid3-row-collapsed","x-grid3-row-expanded");this.fireEvent("expand",this,B,A,C.rowIndex)}},collapseRow:function(C){if(typeof C=="number"){C=this.grid.view.getRow(C)}var B=this.grid.store.getAt(C.rowIndex);var A=Wtf.fly(C).child("tr:nth(1) div.x-grid3-row-body",true);if(this.fireEvent("beforcollapse",this,B,A,C.rowIndex)!==false){this.state[B.id]=false;Wtf.fly(C).replaceClass("x-grid3-row-expanded","x-grid3-row-collapsed");this.fireEvent("collapse",this,B,A,C.rowIndex)}}});Wtf.transcript=function(A){Wtf.apply(this,A);if(this.programtype==0){this.cmodel1=new Wtf.grid.ColumnModel([{hidden:true,dataIndex:"moduleid"},{header:"Session",dataIndex:"sessionname",groupable:true},{header:"Module Name",width:150,dataIndex:"modulename",groupable:false},{header:"Grade",align:"center",dataIndex:"grades",width:100,groupable:false}]);this.moduleRecord=Wtf.data.Record.create([{name:"sessionname"},{name:"moduleid",type:"string"},{name:"modulename",type:"string"},{name:"total"},{name:"basemoduleid"},{name:"status"},{name:"credithrs"},{name:"creditTotal"},{name:"grades",type:"string"}])}else{Wtf.grid.GroupSummary.Calculations["cgpa"]=function(C,B,E,D){if(B.data[E]===-1){return C+0}else{return C+(B.data["credithrs"]-B.data["credithrsEx"])*B.data[E]}};this.cmodel1=new Wtf.grid.ColumnModel([{hidden:true,dataIndex:"moduleid"},{header:"Session",dataIndex:"sessionname",groupable:true},{header:"Module Name",width:150,dataIndex:"modulename",groupable:false},{header:"Grade",align:"center",dataIndex:"grades",width:100,groupable:false},{header:"Grade Point",dataIndex:"gradepoint",groupable:false,summaryType:"cgpa",align:"center",summaryRenderer:function(B,D,C){if(C.data["credithrs"]==0){return"GPA: "+0}else{B=(((Math.round(B*100))/100)/(C.data["credithrs"]-C.data["credithrsEx"])).toFixed(4);if(isNaN(B)){return"GPA: 0"}else{return"GPA: "+(Math.round(B*100)/100).toFixed(2)}}},renderer:function(D,C,G,B,E,F){if(D===-1){return"-"}else{return D}},width:100},{header:"Credit Hours",dataIndex:"credithrs",summaryType:"sum",groupable:false,align:"center",summaryRenderer:function(B,D,C){return"Credit Hours: "+B},width:75},{header:"Credit Hours",dataIndex:"credithrsEx",summaryType:"sum",groupable:false,hidden:true,align:"center",summaryRenderer:function(B,D,C){return B},width:75}]);this.moduleRecord=Wtf.data.Record.create([{name:"sessionname"},{name:"moduleid",type:"string"},{name:"modulename",type:"string"},{name:"total"},{name:"basemoduleid"},{name:"status"},{name:"credithrs"},{name:"gradepoint"},{name:"cgpaTotal"},{name:"creditTotal"},{name:"grades",type:"string"},{name:"credithrsEx",type:"int"}])}this.moduleReader=new Wtf.data.JsonReader({root:"data"},this.moduleRecord);this.moduleStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/result.jsp"}),baseParams:{mode:this.mode,programid:this.programid,userid:this.userid},groupField:"sessionname",sortInfo:{field:"modulename",direction:"ASC"},reader:this.moduleReader});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableNoGroups:false,hideGroupedColumn:true});this.summary=new Wtf.grid.GroupSummary({});this.grid1=new Wtf.grid.GridPanel({ds:this.moduleStore,region:"center",cm:this.cmodel1,plugins:this.summary,enableColumnHide:false,enableColumnMove:false,enableHdMenu:false,border:false,view:this.groupingView,trackMouseOver:true,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});Wtf.transcript.superclass.constructor.call(this,{layout:"fit",items:[{layout:"border",border:false,autoWidth:true,items:[this.grid1,this.southPanel=new Wtf.Panel({region:"south",minHeight:40,height:40,frame:false,border:false})],bbar:[new Wtf.Toolbar.Button({text:"Print Transcript",tooltip:"Click to open",scope:this,hidden:Wtf.isExtStud(),handler:function(){if(this.moduleStore.data.length>0){var B="";if(this.userid){B=this.userid}else{B=loginid}setDldUrl("PrintInvoice.jsp?&userid="+B+"&programid="+this.programid+"&flg=6")}}})]}]})};Wtf.extend(Wtf.transcript,Wtf.Panel,{onRender:function(A){Wtf.transcript.superclass.onRender.call(this,A);this.moduleStore.load();this.moduleStore.on("load",function(B,C,D){if(this.programtype==1){this.tpl=new Wtf.XTemplate('<div style = "font-size:14px;color: #083772;height:100%;overflow:auto;float: right;margin: 10px;"><table style ="padding:0px 8px;font-size:11px"><tr><td align = "left" width="100"><div><b>CGPA : </b>{cgpa}</div></td><td align = "left" width="150"><div><b>Total Credit Hours: </b>{credit}</div></td></tr></table></div>');this.tplObj={cgpa:C[C.length-1].get("cgpaTotal"),credit:C[C.length-1].get("creditTotal")};this.tpl.overwrite(this.southPanel.el.dom.firstChild.firstChild,this.tplObj)}},this)}});Wtf.WtfStudentResult=function(config){Wtf.apply(this,config);this.createInstitutionWindow=null;this.sendForm=null;this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.cmodel1=new Wtf.grid.ColumnModel([this.sm,{hidden:true,dataIndex:"moduleid"},{header:"Module Name",width:150,dataIndex:"modulename"},{header:"Grade",dataIndex:"grade",width:100},{header:"Status",dataIndex:"status",width:100},{header:"Feedback",dataIndex:"feedback",renderer:function(value){if(!value||value==""){return"<label style='color: red'>Not submitted</label>"}else{if(value=="-"){return"<label style='color: red'>-</label>"}else{return"<label style='color: green'>Submitted</label>"}}},width:100}]);this.moduleRecord=Wtf.data.Record.create([{name:"moduleid",type:"string"},{name:"modulename",type:"string"},{name:"grade",type:"string"},{name:"feedback",type:"string"},{name:"status",type:"string"},{name:"statusInt"},{name:"courseid",type:"string"}]);this.moduleReader=new Wtf.data.JsonReader({root:"data"},this.moduleRecord);this.moduleStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/result.jsp"}),reader:this.moduleReader});this.grid1=new Wtf.grid.GridPanel({ds:this.moduleStore,sm:this.sm,cm:this.cmodel1,border:false,trackMouseOver:true,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.grievanceBttn=new Wtf.Toolbar.Button({text:"Appeal Examination Result/Submit Grievance",scope:this,disabled:true,handler:this.onSubmitGrievance});this.AcceptBttn=new Wtf.Toolbar.Button({text:"Accept Marks",scope:this,disabled:true,handler:this.onSubmitAcceptance});this.trans=new Wtf.Toolbar.Button({text:"View Transcript",scope:this,handler:function(){if(!Wtf.getCmp("trans"+this.programid)){this.t=new Wtf.transcript({title:"Transcript",layout:"fit",programtype:this.programtype,programid:this.programid,mode:8,id:"trans"+this.programid,closable:true});this.ownerCt.ownerCt.add(this.t);this.t.doLayout()}this.ownerCt.ownerCt.activate(this.t)}});Wtf.WtfStudentResult.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLQuickSearch({width:200,field:"modulename"})],items:[this.grid1],bbar:[{text:"Register for Graduation",scope:this,hidden:Wtf.isExtStud(),handler:function(){Wtf.MessageBox.confirm("Confirm","Are you sure you want to register for Graduation. If you click YES, your request will be sent to ASAD for review.",function(btn){if(btn=="yes"){Wtf.Ajax.request({url:"jspfiles/student/applyForGrad.jsp",method:"POST",params:{type:"gradapplication",programid:this.programid,programtype:this.programtype},success:function(response,e){var v=eval("("+response.responseText.trim()+")");msgBoxShow(["Info",v.data],Wtf.MessageBox.INFO)},failure:function(response,e){msgBoxShow(["Error","Operation failed"],Wtf.MessageBox.INFO)},scope:this})}},this)}},this.trans]});this.grid1.getSelectionModel().on("rowselect",function(){var selected=this.sm.getSelected();var st=selected.data["statusInt"];var fb=selected.data["feedback"];if(st==4){this.grievanceBttn.enable()}else{this.grievanceBttn.disable()}},this);this.grid1.getSelectionModel().on("rowdeselect",function(){this.grievanceBttn.disable()},this)};Wtf.extend(Wtf.WtfStudentResult,Wtf.Panel,{onRender:function(A){Wtf.WtfStudentResult.superclass.onRender.call(this,A);this.moduleStore.baseParams={type:"usermod"};this.moduleStore.load({params:{mode:1,userid:loginid,programtype:this.programtype,programid:this.programid}});this.grid1.on("sortchange",function(B,C){this.grid1.getView().refresh()},this)},showFeedbackWin:function(){var B=this.grid1.getSelectionModel().getSelected();if(!B){msgBoxShow(["Attention","Please select a module to submit feedback for"],Wtf.MessageBox.INFO)}else{var A=new Wtf.Window({title:"Submit Feedback",width:400,height:210,layout:"fit",buttons:[{text:"Submit",scope:this,handler:function(){this.feedBackForm.form.submit({waitMsg:"Submitting...",params:{mode:2,mid:B.data["moduleid"]},scope:this,success:function(){B.set("feedback",this.rat.getValue());msgBoxShow(["Feedback","The feedback has been submitted successfully."],Wtf.MessageBox.INFO);A.close()},failure:function(){msgBoxShow(["Error","There was an error while submitting the feedback."],Wtf.MessageBox.ERROR);A.close()}})}},{text:"Cancel",scope:this,handler:function(){A.close()}}],items:[this.feedBackForm=new Wtf.form.FormPanel({url:"jspfiles/result.jsp",waitMsgTarget:true,method:"POST",border:false,labelWidth:120,height:160,bodyStyle:"margin: 10px 0 0 10px;font-size : 10px;",defaults:{width:200},defaultType:"textfield",items:[new Wtf.form.TextArea({fieldLabel:"Feedback Text*",height:80,allowBlank:false,name:"feedback"}),this.rat=new Wtf.form.NumberField({fieldLabel:"Rating (on 10)*",name:"rating",allowDecimals:false,maxValue:10,allowNegative:false,allowBlank:false})]})]});A.show()}},onSubmitGrievance:function(){var A=this.grid1.getSelectionModel().getSelected();if(!A){msgBoxShow(["Attention","Please select a module to appeal reevaluation for"],Wtf.MessageBox.INFO)}else{Wtf.MessageBox.confirm("Confirm","Are you sure you want to appeal examination result. If you click YES, your request will be sent to Appeal Board for review.",function(B){if(B=="yes"){Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:3,uid:loginid,mid:A.data["moduleid"]},success:function(C,D){A.set("status","Grievance Pending");A.set("statusInt",3);this.grievanceBttn.disable();msgBoxShow(["Info","The Marks Have Been Applied For Re-evaluation"],Wtf.MessageBox.INFO)},failure:function(C,D){msgBoxShow(["Error","Operation failed"],Wtf.MessageBox.ERROR)},scope:this})}},this)}},onSubmitAcceptance:function(){var A=this.grid1.getSelectionModel().getSelected();if(!A){msgBoxShow(["Attention","Please select a module to accept final evaluation"],Wtf.MessageBox.INFO)}else{Wtf.MessageBox.confirm("Confirm","Are you sure you want to accept final evaluation for selected module. If you click YES, you will not be able to change the status.",function(B){if(B=="yes"){A.set("status","Final Result");A.set("statusInt",4);this.grievanceBttn.disable();Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:4,uid:loginid,mid:A.data["moduleid"]},success:function(C,D){msgBoxShow(["Info","The Final Marks Have Been Registered"],Wtf.MessageBox.INFO)},failure:function(C,D){msgBoxShow(["Error","Operation failed"],Wtf.MessageBox.ERROR)},scope:this})}},this)}}});Wtf.ns("Report");Report.abstractClass=Wtf.extend(Wtf.Panel,{createTopToolBar:function(){this.topToolBar=new Wtf.Toolbar(["Programme:",this.programCombo,"-","Course:",this.courseCombo,"-","Session:",this.sessionCombo,"-",this.submit,this.clearFilter])},createTopToolBarItems:function(){this.quickPanelSearch=new Wtf.KWLTagSearch({width:120,field:"studentname"});this.facultyCombo=new Wtf.form.ComboBox({triggerAction:"all",store:new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/applications.jsp"}),baseParams:{task:"getFaculty"},autoLoad:true,reader:new Wtf.data.JsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"facid",type:"string"},{name:"facname",type:"string"}])),listeners:{scope:this,load:function(A){var C=new Wtf.data.Record.create(["facid","facname"]);var B=new C({facid:"All",facname:"All"});A.addSorted(B)}}}),mode:"local",readOnly:true,listWidth:250,displayField:"facname",valueField:"facid",allowBlank:false,emptyText:"Select a Faculty..."});this.programCombo=new Wtf.form.ComboBox({triggerAction:"all",store:new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),baseParams:{type:20},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"programid",type:"string"},{name:"programname",type:"string"}]))}),mode:"local",readOnly:true,listWidth:250,displayField:"programname",valueField:"programid",allowBlank:false,emptyText:"Select a programme..."});this.courseCombo=new Wtf.form.ComboBox({triggerAction:"all",listeners:{scope:this,select:function(C,A,B){this.cname=A.get("name")}},store:new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:"cifpcourselist"},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"id",type:"string"},{name:"name",type:"string"}])),listeners:{scope:this,load:function(A){var C=new Wtf.data.Record.create(["id","name"]);var B=new C({id:"All",name:"All"});A.addSorted(B);this.sessionCombo.setValue("")}}}),mode:"local",listWidth:250,readOnly:true,displayField:"name",valueField:"id",allowBlank:false,emptyText:"Select a Course..."});this.sessionCombo=new Wtf.form.ComboBox({triggerAction:"all",store:new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}])),listeners:{scope:this,load:function(A){var C=new Wtf.data.Record.create(["sessionid","sessionname"]);var B=new C({sessionid:"All",sessionname:"All"});A.addSorted(B);this.sessionCombo.setValue("")}}}),mode:"local",listWidth:250,readOnly:true,displayField:"sessionname",valueField:"sessionid",allowBlank:false,emptyText:"Select a session..."});this.submit=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:this.handleSubmit});this.clearFilter=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:this.handleClear});this.createTopToolBar()},handleStoreLoad:function(B,A,C){this.quickPanelSearch.StorageChanged(B)},createStoreReader:function(){},createStore:function(){this.reader=this.createStoreReader();return new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:this.reporttype,label:this.label},reader:this.reader,listeners:{scope:this,load:this.handleStoreLoad},sortInfo:{field:"name",direction:"asc"},groupField:"name"})},statusRenderer:function(A){},createColumnModel:function(){},createBbar:function(){return new Wtf.PagingSearchToolbar({pageSize:25,store:this.store,searchField:this.quickPanelSearch,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:this.handleExport})]})},createGroupView:function(){return new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true})},createGridPanel:function(){this.store=this.createStore();this.cm=this.createColumnModel();this.bbar=this.createBbar();this.groupingView=this.createGroupView();return new Wtf.grid.GridPanel({id:"gridPanel"+this.id,store:this.store,cm:this.cm,autoScroll:true,border:false,loadMask:{msg:"Loading..."},view:this.groupingView,viewConfig:{forceFit:true},bbar:this.bbar})},createLayout:function(){this.grid=this.createGridPanel();var A={border:false,layout:"fit",tbar:this.topToolBar,items:[this.grid]};return A},initComponent:function(){this.createTopToolBarItems();var A=this.createLayout();Wtf.apply(this,Wtf.apply(this.initialConfig,A));Report.abstractClass.superclass.initComponent.apply(this,arguments)},removeAllDataFromStore:function(){if(this.store.getCount()>0){this.store.removeAll()}},handleClear:function(){this.quickPanelSearch.setValue("");this.programCombo.setValue("");this.sessionCombo.setValue("");this.courseCombo.setValue("");this.facultyCombo.setValue("");this.removeAllDataFromStore();if(this.store){this.store.baseParams={type:this.reporttype,reportFlag:false};this.store.load({params:{start:0,limit:25}})}},handleExport:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({courseid:this.courseCombo.getValue(),cname:this.cname,ss:this.quickPanelSearch.getValue(),type:"reports",dtype:"attachment",report:this.reporttype,title:this.title,reportFlag:true});setDldUrl("fileDownload.jsp?"+A)}},handleSubmit:function(){this.removeAllDataFromStore();this.store.load({params:{programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),start:0,limit:15}})}});Report.abstractClass_Dnyamic_ColModel=Wtf.extend(Wtf.Panel,{createTopToolBar:function(){this.comboArray.push(this.submit);this.comboArray.push(this.clearFilter);this.topToolBar=new Wtf.Toolbar(this.comboArray)},getProgramComboStore:function(){return this.programStore},getConfig:function(){return{items:[{region:"center",border:false,layout:"fit",split:true,id:"gridPanel"+this.id},{region:"south",id:"graphPanel"+this.id,height:250,layout:"fit",split:true,bodyStyle:"background:white",autoScroll:true,title:this.graphTitle}],tbar:this.topToolBar}},initComponent:function(){this.comboBoxes=new Wtf.comboBox();this.comboArray=new Array();this.topToolBar=null;if(this.combos.program){this.programCombo=this.comboBoxes.getProgramCombo();this.programCombo.on("select",this.programSelect,this);this.comboArray.push("Programme:");this.comboArray.push(this.programCombo);this.comboArray.push("-");this.programComboStore=this.comboBoxes.getProgramComboStore()}if(this.combos.course.enable){this.courseCombo=this.comboBoxes.getCourseCombo(this.combos.course.addAllOnLoad);this.comboArray.push("Course:");this.comboArray.push(this.courseCombo);this.comboArray.push("-");this.courseComboStore=this.comboBoxes.getCourseComboStore()}if(this.combos.session.enable){this.sessionCombo=this.comboBoxes.getSessionCombo(this.combos.session.addAllOnLoad);this.comboArray.push("Session:");this.comboArray.push(this.sessionCombo);this.comboArray.push("-");this.sessionComboStore=this.comboBoxes.getSessionComboStore()}this.submit=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:this.getColumns});this.clearFilter=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:this.handleClear});this.createTopToolBar();Wtf.apply(this,Wtf.apply(this.initialConfig,this.getConfig()));Report.abstractClass_Dnyamic_ColModel.superclass.initComponent.apply(this,arguments)},programSelect:function(B,C,A){this.programType=C.get("programtype");this.comboBoxes.getCourseComboStore().load({params:{type:"programsessioncourse",programid:C.data["programid"]}})},handleClear:function(){if(this.programCombo){this.programCombo.setValue("")}if(this.sessionCombo){this.sessionCombo.setValue("")}if(this.courseCombo){this.courseCombo.setValue("")}if(this.store){this.store.baseParams={type:this.reporttype};this.store.load({params:{start:0,limit:15}})}if(Wtf.getCmp("graph"+this.id)){Wtf.getCmp("graph"+this.id).destroy()}if(Wtf.getCmp("grid"+this.id)){Wtf.getCmp("grid"+this.id).destroy()}},showGraph:function(M,F,O){if(Wtf.getCmp("graph"+this.id)){Wtf.getCmp("graph"+this.id).destroy()}var J="";var B="";var E="";var G=40;var C=0;for(var H=0;H<this.gradeArray.length;H++){var D=this.gradeArray[H]["grade"+H];for(var I=0;I<F.length;I++){J+=F[I].get("grade"+D+"per")+",";if(H==0){B+=F[I].get("paper")+"|";C++}}E+=this.gradeArray[H]["grade"+H]+"|";J=J.substring(0,J.length-1);J+="|"}J=J.substring(0,J.length-1);B=B.substring(0,B.length-1);E=E.substring(0,E.length-1);E=E.replace(/ /g,"+");if(C==1){C=5}var N=G*(C);if(N>800){N=800}var L="http://chart.apis.google.com/chart?cht=bvg&chd=t:"+J+"&chs=1000x200&chbh=10,0,20&chg=100,5&chco=FF990080,C6D9FD,2060FFFF,EE8800,994499,99BBE8,CC3333,FF000080&chxt=y,x&chl="+B+"&chdl="+E+"&chtt=Percentage+by+Modules";var K='<div style="text-align:center"><img id="chartdiv2" src ='+L+"></img></div>";var A=new Wtf.Panel({id:"graph"+this.id,html:K,autoScroll:true,layout:"fit",border:false});Wtf.getCmp("graphPanel"+this.id).add(A);Wtf.getCmp("graphPanel"+this.id).doLayout()},createGridStore:function(A){return new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:this.gridStoreBaseParams,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create(A))})},createGridBBar:function(){return new Wtf.PagingToolbar({pageSize:this.pageSizeGrid,store:this.store,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExportAsCsv},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]})},createGridPanel:function(A,B){return new Wtf.grid.GridPanel({id:"grid"+this.id,store:this.store,columns:A,autoScroll:true,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:this.forceFit},plugins:[new Wtf.GroupHeaderGrid({rows:[B],hierarchicalColMenu:true})],bbar:this.pg=this.createGridBBar()})},createColumnModel:function(B,A,C,D){if(Wtf.getCmp("grid"+this.id)){Wtf.getCmp("grid"+this.id).destroy()}this.store=this.createGridStore(A);B.unshift(new Wtf.KWLRowNumberer());C.unshift({header:"",colspan:1,align:"center"});this.grid=this.createGridPanel(B,C);this.store.on("load",this.showGraph,this);Wtf.getCmp("gridPanel"+this.id).add(this.grid);Wtf.getCmp("gridPanel"+this.id).doLayout();this.handleSubmit()},handleExportAsCsv:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),courseid:this.courseCombo.getValue(),type:"reports",dtype:"attachment",report:this.reporttype,title:this.title});setDldUrl("fileDownload.jsp?"+A)}},handleExportAsPdf:function(){if(this.courseCombo.getValue()!=""&&this.store.getCount()>0){var B=false;if(this.courseCode!="CP003"){var D=this.sessionComboStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionComboStore.getAt(D).get("startdate").format("Y-m-d");B=(A>="2010-01-11")}var C=Wtf.urlEncode({programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),courseid:"ALL",programName:this.programCombo.lastSelectionText,sessionName:this.sessionCombo.lastSelectionText,courseName:this.courseCombo.lastSelectionText,sectionFlag:B,type:"reports",dtype:"attachment",report:this.reporttype,title:this.title,mode:43});setDldUrl("ReportsServlet.jsp?"+C)}},sendRequest:function(A){Wtf.Ajax.request({url:"jspfiles/report.jsp",method:"POST",params:A,scope:this,success:function(B,C){var D=Wtf.util.JSON.decode(B.responseText);if(D.success){D=Wtf.util.JSON.decode(D.data);this.groupHeader=D.groupHeader;this.createColumnModel(D.column,D.record,D.groupHeader)}else{if(D.msg){msgBoxShow(["Error",D.msg],Wtf.MessageBox.ERROR)}this.handleClear()}},failure:function(){msgBoxShow(["Error","Error. Please try again later."],Wtf.MessageBox.ERROR)}})},getColumns:function(){var A={type:this.type,reporttype:this.reporttype,ptype:this.programType,part3Flag:this.courseCode=="CP003",programid:this.combos.program?this.programCombo.getValue():-1,courseid:this.combos.course?this.courseCombo.getValue():-1,coursename:this.combos.course?this.courseCombo.getRawValue():""};this.sendRequest(A)},getSectionFlag:function(){var B=false;if(this.sessionCombo){var C=this.sessionComboStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionComboStore.getAt(C).get("startdate").format("Y-m-d");B=(A>="2010-01-11")}return B},handleSubmit:function(){var C=this.courseCombo.getValue();if(C){var A=false;var B=false;if(this.courseCode!="CP003"){A=this.getSectionFlag()}else{if(this.programType==0){B=true}}this.store.load({params:{courseid:C,type:this.storeType,dataType:"json",programid:this.combos.program?this.programCombo.getValue():-1,sessionid:this.combos.session.enable?this.sessionCombo.getValue():-1,sectionFlag:A,ptype:this.programType,part3Flag:B,start:0,limit:15}})}}});Wtf.ns("Wtf.MyCourse");Wtf.MyCourse.facultyMapping=Wtf.extend(Report.abstractClass,{initComponent:function(A){Wtf.MyCourse.facultyMapping.superclass.initComponent.call(this,A);this.store.removeAll();this.store.baseParams={moduleid:this.moduleid,type:"facultyMapping",reportFlag:false,tablename:this.gradtype==2?"article":"ppp",facid:"All"};this.store.load({params:{start:0,limit:25}})},printstudDetail:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({userid:this.checkBoxModel.getSelected().get("userid"),username:this.checkBoxModel.getSelected().get("username"),studname:this.checkBoxModel.getSelected().get("name"),moduleid:this.checkBoxModel.getSelected().get("moduleid"),gradtype:this.checkBoxModel.getSelected().get("gradtype"),facname:this.checkBoxModel.getSelected().get("facultyname"),type:"reports",dtype:"attachment",report:"atstudentinformation",mode:75});setDldUrl("ReportsServlet.jsp?"+A)}},extendStartDate:function(){if(this.store.getCount()>0){var B=this.checkBoxModel.getSelected().get("userid");var A=this.checkBoxModel.getSelected().get("gradtype");var C=this.checkBoxModel.getSelected().get("startdate");var D=this.checkBoxModel.getSelected().get("moduleid");this.changeDateWindow=new Wtf.Window({iconCls:"setnewdate",resizable:false,id:"setdate",width:370,height:170,title:"Set New Date",scope:this,buttons:[{text:"Submit",scope:this,handler:function(){if(this.dateForm.form.isValid()){var E=this.newStartDate.value;Wtf.Ajax.requestEx({url:"jspfiles/newClass.jsp",method:"post",params:{type:"updateDate",userid:B,gradType:A,stdate:C,moduleid:D,newstdate:E}},this,function(F,G){if(F=="{'success':true}"){msgBoxShow(["Update Start Date","Start date updated successfully."],Wtf.MessageBox.INFO);this.changeDateWindow.close();this.store.load({params:{start:0,limit:25}})}else{msgBoxShow(["ERROR","Error while updating start date."],Wtf.MessageBox.ERROR);this.changeDateWindow.close()}},function(F,G){})}}},{text:"Cancel",scope:this,handler:function(){this.changeDateWindow.close()}}],items:[this.dateForm=new Wtf.FormPanel({labelWidth:120,labelAlign:"left",border:false,clientValidation:true,bodyStyle:"margin-top:20px;margin-left:20px;font-size : 10px;",defaults:{width:190},layout:"form",items:[this.oldStartDate=new Wtf.form.TextField({id:"olddate"+this.id,name:"oldstartdate",fieldLabel:"Old  Start Date",allowBlank:false,value:C,disabled:true}),this.newStartDate=new Wtf.form.DateField({id:"newdate"+this.id,format:"Y-m-d",name:"newstartdate",fieldLabel:"New Start Date",allowBlank:false,minValue:C,emptyText:"Select the new start date."})]})]});this.changeDateWindow.show()}},showDetail:function(){var B=this.checkBoxModel.getSelected().get("userid");var C=this.checkBoxModel.getSelected().get("moduleid");var D=this.checkBoxModel.getSelected().get("modulename");var A=this.checkBoxModel.getSelected().get("gradtype");if(A==2){Wtf.Ajax.request({url:"jspfiles/newCourse.jsp",params:{userid:B,moduleid:C,type:"getArticleDetails",mode:"faculty"},method:"post",success:function(E,F){var G=Wtf.util.JSON.decode(E.responseText);this.articleWindow1=new Wtf.Window({closable:true,modal:true,width:420,scope:this,height:375,resizable:false,buttonAlign:"right",buttons:[{text:"Close",scope:this,handler:function(){this.articleWindow1.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","Articleship","Articleship Information")},{region:"center",border:false,bodyStyle:"background:#f1f1f1;font-size:10px;",layout:"fit",items:[this.sendForm1=new Wtf.form.FormPanel({border:false,labelWidth:100,bodyStyle:"margin-top:20px;margin-left:20px;font-size : 10px;",defaults:{width:190},items:[this.datefield=new Wtf.form.TextField({id:"date"+this.id,readOnly:true,format:Wtf.getDateFormat(),fieldLabel:"Start Date*",value:G.data[0].stdate}),this.decision=new Wtf.form.TextField({fieldLabel:"Decision*",id:"des"+this.id,name:"decision",readOnly:true,value:G.data[0].decision}),this.address=new Wtf.form.TextField({fieldLabel:"Address*",id:"add"+this.id,name:"address",readOnly:true,value:G.data[0].address}),this.instname=new Wtf.form.TextField({fieldLabel:"Institution Name*",id:"add"+this.id,name:"instname",readOnly:true,value:G.data[0].instname}),this.loc=new Wtf.form.TextField({fieldLabel:"Location*",id:"location"+this.id,name:"location",readOnly:true,value:G.data[0].location}),this.supervisor=new Wtf.form.TextField({fieldLabel:"Supervisor*",id:"sup"+this.id,name:"supervisor",readOnly:true,value:G.data[0].supervisor}),this.email=new Wtf.form.TextField({fieldLabel:"Email*",id:"email"+this.id,name:"email",readOnly:true,value:G.data[0].email}),this.option=new Wtf.form.TextField({fieldLabel:"Another option*",id:"opt"+this.id,name:"option",readOnly:true,value:G.data[0].option}),{html:G.data[0].filename,border:false,width:250}]})]}]});this.articleWindow1.show()},failure:function(){}})}else{if(A==3){Wtf.Ajax.request({url:"jspfiles/newCourse.jsp",params:{userid:B,moduleid:C,type:"getPPPDetails",mode:"faculty"},method:"post",success:function(E,F){var G=Wtf.util.JSON.decode(E.responseText);this.pppWindow=new Wtf.Window({closable:true,modal:true,width:420,height:450,resizable:false,buttonAlign:"right",buttons:[{text:"Close",scope:this,handler:function(){this.pppWindow.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","Articleship Exemption/PPP Registration","Articleship Exemption/PPP Registration")},{region:"center",border:false,bodyStyle:"background:#f1f1f1;font-size:10px;",layout:"fit",items:[this.sendForm=new Wtf.form.FormPanel({waitMsgTarget:true,method:"POST",border:false,labelWidth:100,bodyStyle:"margin-top:20px;margin-left:20px;font-size : 10px;",defaults:{width:190},items:[this.empexp=new Wtf.form.TextArea({fieldLabel:"Employment Experience*",id:"ee"+this.id,name:"empexp",readOnly:true,value:G.data[0].empexp}),this.contact=new Wtf.form.TextField({fieldLabel:"Contact No.*",id:"contact"+this.id,name:"contact",readOnly:true,value:G.data[0].contact}),this.pppemail=new Wtf.form.TextField({fieldLabel:"Email ID*",id:"email"+this.id,name:"email",readOnly:true,value:G.data[0].email}),this.topic=new Wtf.form.TextArea({fieldLabel:"Topic for PPP*",id:"topic"+this.id,name:"topic",readOnly:true,value:G.data[0].topic}),this.sdate=new Wtf.form.TextField({id:"date"+this.id,fieldLabel:"Start Date*",emptyText:"Select the start date.",readOnly:true,name:"sdate",value:G.data[0].sdate}),this.pppsup=new Wtf.form.TextField({fieldLabel:"Proposed supervisor*",id:"sup"+this.id,name:"sup",readOnly:true,value:G.data[0].sup}),{html:G.data[0].cv,border:false,width:250},{html:G.data[0].empol,border:false,width:250}]})]}]});this.pppWindow.show()},failure:function(){msgBoxShow(["ERROR","A problem occurred while connection to server."],Wtf.MessageBox.ERROR)}})}}},handleClear:function(){this.quickPanelSearch.setValue("");this.facultyCombo.setValue("");if(this.store){this.store.baseParams={moduleid:this.moduleid,type:"facultyMapping",reportFlag:false,tablename:this.gradtype==2?"article":"ppp",facid:"All"};this.store.load({params:{start:0,limit:25}})}},createStore:function(){this.reader=this.createStoreReader();return new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:this.reporttype,label:this.label},reader:this.reader,listeners:{scope:this,load:this.handleStoreLoad},sortInfo:{field:"facultyname",direction:"asc"},groupField:"facultyname"})},createTopToolBar:function(){this.viewDetail=new Wtf.Toolbar.Button({text:"View Detail",scope:this,handler:this.showDetail,disabled:true});this.printDetail=new Wtf.Toolbar.Button({text:"Print Detail",scope:this,handler:this.printstudDetail,disabled:true});this.exetendDate=new Wtf.Toolbar.Button({text:"Extend Start Date",scope:this,handler:this.extendStartDate,disabled:true,hidden:true});this.topToolBar=new Wtf.Toolbar(["Quick Search:",this.quickPanelSearch,"-","Faculty:",this.facultyCombo,"-",this.submit,this.clearFilter,"-",this.viewDetail,"-",this.printDetail,"-",this.exetendDate])},handleSubmit:function(){this.store.removeAll();this.store.baseParams={moduleid:this.moduleid,type:"facultyMapping",reportFlag:false,tablename:this.gradtype==2?"article":"ppp",facid:this.facultyCombo.getValue()};this.store.load({params:{start:0,limit:25}})},createBbar:function(){return new Wtf.PagingSearchToolbar({pageSize:25,store:this.store,searchField:this.quickPanelSearch,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:["-",this.csv=new Wtf.Toolbar.Button({scope:this,id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",handler:this.handleExportAsPdf}),"-",{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({moduleid:this.moduleid,tablename:this.gradtype==2?"article":"ppp",facid:this.facultyCombo.getValue().length==0?"All":this.facultyCombo.getValue(),facName:this.facultyCombo.getValue().length==0?"All":this.facultyCombo.getRawValue(),type:"facMapArticleship",dtype:"attachment",report:"facultyMapping",title:this.code,reportFlag:true});setDldUrl("fileDownload.jsp?"+A)}}}]})},handleExportAsPdf:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({moduleid:this.moduleid,tablename:this.gradtype==2?"article":"ppp",facid:this.facultyCombo.getValue().length==0?"All":this.facultyCombo.getValue(),facName:this.facultyCombo.getValue().length==0?"All":this.facultyCombo.getRawValue(),type:"reports",dtype:"attachment",report:"facultyMapping",title:this.code,reportFlag:true,mode:74});setDldUrl("ReportsServlet.jsp?"+A)}},createGridPanel:function(){this.checkBoxModel=new Wtf.grid.CheckboxSelectionModel({singleSelect:true,listeners:{scope:this,rowselect:function(C,B,A){this.viewDetail.enable();this.printDetail.enable();this.exetendDate.enable()},rowdeselect:function(C,B,A){this.viewDetail.disable();this.printDetail.disable();this.exetendDate.disable()}}});this.store=this.createStore();this.cm=this.createColumnModel();this.bbar=this.createBbar();this.groupingView=this.createGroupView();return new Wtf.grid.GridPanel({id:"gridPanel"+this.id,store:this.store,cm:this.cm,sm:this.checkBoxModel,autoScroll:true,border:false,loadMask:{msg:"Loading..."},view:this.groupingView,viewConfig:{forceFit:true},bbar:this.bbar})},createStoreReader:function(){this.record=Wtf.data.Record.create([{name:"name",type:"string"},{name:"username",type:"string"},{name:"facultyname",type:"string"},{name:"modulename",type:"string"},{name:"startdate",type:"string"},{name:"userid",type:"string"},{name:"moduleid",type:"string"},{name:"gradtype",type:"int"}]);return new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.record)},createColumnModel:function(){return new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),this.checkBoxModel,{header:"Name",dataIndex:"name",sortable:true},{header:"Student ID",dataIndex:"username",sortable:true},{header:"Faculty Name",dataIndex:"facultyname",sortable:true},{header:"Start Date",dataIndex:"startdate"}])}});Wtf.moduleassign=function(A){Wtf.apply(this,A);this.quickSearchTF=new Wtf.KWLTagSearch({field:"tags",width:200});this.modulesm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.modulesm1=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});Wtf.ux.comboBoxRenderer=function(B){return function(D){var C=B.store.find(B.valueField,D);if(C==-1){return""}var E=B.store.getAt(C);return E.get(B.displayField)}};this.statStore=new Wtf.data.SimpleStore({fields:["statid","statname"],data:[["0","Confirmation Pending"],["1","Active"]]});this.comboStatus=new Wtf.form.ComboBox({id:"cmbStat"+this.id,valueField:"statid",displayField:"statname",store:this.statStore,mode:"local",triggerAction:"all"});this.groupingView1=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:true,hideGroupedColumn:true});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:true,hideGroupedColumn:true});this.cmodel1=new Wtf.grid.ColumnModel([this.modulesm,{header:"Module Name",width:150,sortable:true,dataIndex:"name"},{header:"Module Code",width:150,sortable:true,dataIndex:"code"},{header:"Session",width:150,sortable:true,dataIndex:"sessionname"},{header:"Status",width:150,sortable:true,dataIndex:"status",editor:this.comboStatus,renderer:Wtf.ux.comboBoxRenderer(this.comboStatus)}]);this.sessionRecord=Wtf.data.Record.create([{name:"id",type:"string"},{name:"name",type:"string"},{name:"code",type:"string"},{name:"status",type:"string"},{name:"programtype",type:"int"},{name:"programid",type:"string"},{name:"sessionname",type:"string"},{name:"specialgrade",type:"string"},{name:"basemoduleid",type:"string"},{name:"gradtype",type:"int"}]);this.sessionReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.sessionRecord);this.sessionds=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/faculty/getModules.jsp"}),reader:this.sessionReader,sortInfo:{field:"sessionname",direction:"DESC"},groupField:"sessionname"});this.validateBtn=new Wtf.Toolbar.Button({tooltip:"Validate Result",text:"Validate Result",hidden:(Wtf.realroles.indexOf("46")>-1)?false:true,scope:this,handler:function(D,E){var C=Wtf.getCmp("exam"+this.id);if(!C){var B=new Wtf.ExamResultGrid({id:"exam"+this.id,title:"Validate Result",layout:"fit",sectionFlag:false,closable:true,border:false});this.ownerCt.add(B);this.ownerCt.activate(B);this.ownerCt.doLayout();this.ownerCt.setActiveTab(B)}else{this.ownerCt.setActiveTab(C)}}});this.grid=new Wtf.grid.GridPanel({border:true,store:this.sessionds,sm:this.modulesm,cm:this.cmodel1,view:this.groupingView1,viewConfig:{forceFit:true},loadMask:{msg:"Loading Modules..."},tbar:["Quick Search: ",this.quickSearchTF,"-",this.validateBtn]});this.cmodel2=new Wtf.grid.ColumnModel([this.modulesm1,{header:"Section Name",width:150,dataIndex:"name"},{header:"Venue",width:150,dataIndex:"venue",renderer:this.sectionRenderer},{header:"Timezone",width:150,dataIndex:"tname",renderer:this.sectionRenderer},{header:"Date",width:100,dataIndex:"date",renderer:this.sectionRenderer},{header:"Start Time",width:100,dataIndex:"starttime",renderer:this.sectionRenderer},{header:"End Time",width:100,dataIndex:"endtime",renderer:this.sectionRenderer},{header:"Recurrence",width:100,dataIndex:"recurrence",renderer:function(B){if(B==0){return"One Time"}else{if(B==1){return"Weekly"}else{if(B==2){return"Monthly"}}}}},{header:"Type",width:100,dataIndex:"stype"},{header:"Status",width:100,dataIndex:"status"},{header:"Module",width:100,dataIndex:"modulename"},{header:"Class Type",width:100,dataIndex:"ctype"}]);this.cmodel2.defaultSortable=true;this.sectionRecord=Wtf.data.Record.create([{name:"name",type:"string"},{name:"venue",type:"string"},{name:"venueid",type:"string"},{name:"tname",type:"string"},{name:"date",type:"string"},{name:"stype",type:"string"},{name:"id",type:"string"},{name:"facid",type:"string"},{name:"status",type:"string"},{name:"modulename",type:"string"},{name:"ctype",type:"string"},{name:"starttime",type:"string"},{name:"endtime",type:"string"},{name:"recurrence",type:"string"},{name:"moduleid",type:"string"},{name:"classcount",type:"string"}]);this.sectionReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.sectionRecord);this.sectionStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newClass.jsp"}),reader:this.sectionReader,sortInfo:{field:"modulename",direction:"DESC"},groupField:"modulename"});this.quickSearchTF1=new Wtf.KWLTagSearch({field:"tags",width:200});this.grid1=new Wtf.grid.GridPanel({ds:this.sectionStore,cm:this.cmodel2,sm:this.modulesm1,border:false,view:this.groupingView,trackMouseOver:true,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true},tbar:["Quick Search: ",this.quickSearchTF1]});Wtf.moduleassign.superclass.constructor.call(this,{layout:"fit",items:[{layout:"border",border:false,items:[{title:"Modules",xtype:"KWLListPanel",paging:false,autoLoad:false,border:false,height:250,region:"north",layout:"fit",split:true,items:this.grid,bbar:new Wtf.PagingSearchToolbar({id:"pgTbar1"+this.id,pageSize:10,searchField:this.quickSearchTF,store:this.sessionds,displayInfo:true,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:this.pP=new Wtf.common.pPageSize({}),buttons:[this.ass=new Wtf.Button({id:"btnAss"+this.id,text:"Set Assignment Types",scope:this,hidden:true,handler:function(){}}),"-",this.open=new Wtf.Button({id:"btnOpen"+this.id,text:"Open Module",scope:this,handler:function(){var B=this.modulesm.getSelected();mainPanel.loadTab("modulePanel.html","   _"+B.data.id+"_"+B.data.name+"_"+B.data.specialgrade+"_"+B.data.basemoduleid,B.data.name,"navareadashboard",Wtf.etype.course)}}),"-",this.showStudentMapping=new Wtf.Button({text:"Faculty Mapping",scope:this,disabled:true,hidden:Wtf.realroles.indexOf("9")>-1?false:true,handler:function(){var C=this.modulesm.getSelected();var B=Wtf.getCmp("facultyMap"+this.id+C.get("gradtype"));if(!B){B=new Wtf.MyCourse.facultyMapping({layout:"fit",title:"Faculty Mapping of "+C.get("code"),closable:true,code:C.get("code"),moduleid:C.get("id"),gradtype:C.get("gradtype"),border:false,id:"facultyMap"+this.id+C.get("gradtype")});this.ownerCt.add(B)}this.ownerCt.setActiveTab(B);this.ownerCt.doLayout()}})]})},{title:"Classes",xtype:"KWLListPanel",border:false,paging:false,autoLoad:false,region:"center",layout:"fit",items:this.grid1,bbar:new Wtf.PagingToolbar({id:"pgTbar11"+this.id,pageSize:10,store:this.sectionStore,displayInfo:true,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:new Wtf.common.pPageSize({}),buttons:["-",this.approve1=new Wtf.Button({id:"btnApprove"+this.id,text:"Approve Request",hidden:true,scope:this,handler:function(){Wtf.Ajax.requestEx({url:"jspfiles/newClass.jsp",method:"POST",params:{status:1,sectionid:this.sectionid,type:"setfacclass",userid:loginid}},this,function(B,C){this.sectionStore.reload();this.approve1.disable();this.reject1.disable()},function(C,B){})}}),this.reject1=new Wtf.Button({id:"btnReject"+this.id,text:"Reject Request",hidden:true,scope:this,handler:function(){Wtf.Ajax.requestEx({url:"jspfiles/newClass.jsp",method:"POST",params:{status:2,type:"setfacclass",sectionid:this.sectionid,userid:loginid}},this,function(B,C){this.sectionStore.reload();this.approve1.disable();this.reject1.disable()},function(C,B){})}}),this.attndList=new Wtf.Toolbar.Button({text:"View Attendance List",scope:this,hidden:(isRoleGroup("1")||Wtf.isExtStud())?true:false,disabled:true,handler:this.attendanceList}),this.classBtn=new Wtf.Button({text:"Class Activities",scope:this,hidden:false,disabled:true,id:"class"+this.id,menu:[{id:"gradeBttn"+this.id,text:"Gradebook",iconCls:"gradebookIcon",scope:this,handler:function(){var B="gradebk"+this.id+this.sectionid;this.openTab(B,Wtf.course.gradeBook,{title:"Grade Book",closable:true,modulerunid:this.sectionid,id:B,HOD:(Wtf.realroles.indexOf("6")>-1)?false:Wtf.isHoD(),HOP:Wtf.isHoP()})}},{text:"Assign Weightage",scope:this,id:"assignWt"+this.id,handler:this.assignWt},{text:"Assignment",scope:this,id:"assignment"+this.id,handler:this.showAssignment}]})]})}]}]});this.approve1.disable();this.reject1.disable();this.attndList.disable();this.open.disable();this.ass.disable();this.sessionds.load({params:{start:0,limit:10}});this.modulesm.on("rowselect",function(){if(this.modulesm.getSelected().data.status==0){this.showStudentMapping.disable();this.open.disable();this.ass.disable()}else{if(this.modulesm.getSelected().data.status==1){this.showStudentMapping.enable();this.open.enable()}}if(this.modulesm.getSelected().data.programtype==1&&this.modulesm.getSelected().data.status==1){this.ass.enable()}},this);this.modulesm.on("rowdeselect",function(){this.showStudentMapping.disable();this.open.disable();this.ass.disable()},this);this.modulesm1.on("rowselect",function(){this.sectionid=this.modulesm1.getSelected().data.id;this.moduleid=this.modulesm1.getSelected().data.moduleid;this.venueid=this.modulesm1.getSelected().data.venueid;this.ctype=this.modulesm1.getSelected().data.ctype;this.classcount=this.modulesm1.getSelected().data.classcount;if(this.modulesm1.getSelected().data.status=="Confirmation Pending"){this.approve1.enable();this.reject1.enable();this.attndList.enable();this.classBtn.disable()}else{this.approve1.disable();this.reject1.disable();this.attndList.enable();this.classBtn.enable()}},this);this.modulesm1.on("rowdeselect",function(){this.approve1.disable();this.reject1.disable();this.attndList.disable();this.classBtn.disable()},this);this.grid.on("rowdblclick",function(B,D,C){if(this.modulesm.getSelected().data.status==1){mainPanel.loadTab("modulePanel.html","   _"+this.sessionds.getAt(D).data["id"]+"_"+this.sessionds.getAt(D).data["name"]+"_"+this.sessionds.getAt(D).data["specialgrade"]+"_"+this.sessionds.getAt(D).data["basemoduleid"],this.sessionds.getAt(D).data["name"],"navareadashboard",Wtf.etype.course)}},this);this.on("render",this.handleRender,this);this.sessionds.on("load",this.handleStoreLoad,this);this.sessionds.on("datachanged",function(){var B=this.pP.combo.value;this.quickSearchTF.setPage(B)},this)};Wtf.extend(Wtf.moduleassign,Wtf.Panel,{sectionRenderer:function(F,D,A,G,C,B){var E=F;if(A.get("venueid")=="Online"){E="-"}return E},showAssignment:function(){var A=Wtf.getCmp("assignSection"+this.sectionid);if(!A){A=new Wtf.common.assignmentDropBox({id:"assignSection"+this.sectionid,ctCls:"assignments",title:"Section Assignments",moduleid:this.sectionid,closable:true,faculty:(isRoleGroup("1")||Wtf.isExtStud())?false:true,layout:"fit",border:false});this.ownerCt.add(A)}this.ownerCt.setActiveTab(A);this.ownerCt.doLayout()},attendanceList:function(){var A="attndList"+this.id;var B;if(this.ctype=="Tutorial"){B=1}else{if(this.ctype=="Preexam Seminar"){B=2}else{if(this.ctype=="Lecture"){B=3}else{if(this.ctype=="Paper"){B=4}}}}this.openTab(A,Wtf.lms.WtfLmsModuleAttendanceList,{mode:15,moduleid:this.moduleid,programid:"",classtype:B,venueid:this.venueid,classcount:this.classcount,hideDate:false,hideClass:true,hideFaculty:true,faculty:loginid,hideVenue:true,id:A,layout:"fit",title:"Attendance List",border:false,closable:true,iconCls:getTabIconCls(Wtf.etype.report),scope:this,repTitle:"Attendance List"})},createWin:function(){this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.cm=new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),this.sm,{header:"Assignment Type",width:100,dataIndex:"assname"},{header:"Weightage",width:100,dataIndex:"weight",align:"center",editor:new Wtf.form.NumberField({value:0,allowNegative:false,maxLength:3,maxValue:this.max,maxLengthText:"Entered number cannot be greater than 100"})},{header:"Full Marks",width:100,dataIndex:"outof",align:"center",editor:new Wtf.form.NumberField({value:0,allowNegative:false})},{header:"Submitable",width:100,dataIndex:"submitable",align:"center",editor:new Wtf.form.ComboBox({mode:"local",triggerAction:"all",displayField:"tag",valueField:"value",store:new Wtf.data.SimpleStore({fields:["tag","value"],data:[["N",0],["S",1]],autoLoad:true})}),renderer:function(value,metadata,record,rowIndex,colIndex,store){if(value==1){return"S"}else{return"N"}}},{header:"Due Date",width:100,scope:this,align:"center",dataIndex:"submissionon",editor:new Wtf.form.DateField({minValue:new Date(),format:"Y-m-d"})},{header:"Upload",width:100,scope:this,align:"center",renderer:function(value,metadata,record,rowIndex,colIndex,store){if(record.get("assid")==""){return"<label id='upload_"+rowIndex+"' style='color:gray;cursor:pointer'>Upload</label>"}else{return"<label id='upload_"+rowIndex+"' style='color:blue;cursor:pointer'>Upload</label>"}}},{header:"Download",width:100,hidden:true,renderer:function(value,metadata,record,rowIndex,colIndex,store){if(record.get("ext")!="empty"){return"<label id='download_"+rowIndex+"'><a href='#' title='Download' onclick='setDldUrl(\"fileDownload.jsp?url="+record.get("assid")+"/faculty/"+record.get("assname")+record.get("ext")+"&type=assignmentBank&dtype=attachment\")'><div class='pwnd dldiconwt' style='height:16px; width:16px;'></div></a></label>"}else{return"<label id='download_"+rowIndex+"' style='color:gray;cursor:pointer'>No File</label>"}}},{header:"Require Upload",width:100,hidden:true,dataIndex:"requp",editor:new Wtf.form.Checkbox({checked:true})}]);this.assgrid=new Wtf.grid.EditorGridPanel({border:false,cm:this.cm,sm:this.sm,clicksToEdit:1,store:this.asstypestore,viewConfig:{forceFit:true,autoFill:true},loadMask:{msg:"Loading assignment type list..."}});this.assgrid.on("afteredit",this.showExamWeight,this);this.assgrid.on({"beforeedit":{fn:function(e){var field=e.field;if(e.record.get("assname")=="No Records Found."){e.cancel=true}else{e.cancel=false}if(field=="submitable"||field=="submissionon"){if(e.record.get("assid")==""){e.cancel=true}else{e.cancel=false}}},scope:this},"validateedit":{fn:this.updateSubmitable,scope:this}});this.sm.on("beforerowselect",function(smObj,ri,ci){if(this.asstypestore.getCount()!=1){if(this.flag){this.flag=false;return true}return false}},this);this.sm.on("rowselect",function(obj,row,rec){if(this.upObj[row]._disabled&&rec.get("assname")!="No Records Found."){Wtf.getCmp("delType"+this.id).enable()}else{Wtf.getCmp("delType"+this.id).disable()}this.showExamWeightBeforeSelect(obj,row,rec)},this);this.sm.on("rowdeselect",function(obj,row,rec){this.deselflag=true;Wtf.getCmp("delType"+this.id).disable();this.showExamWeightBeforeSelect(obj,row,rec)},this);this.addContentWin=new Wtf.Window({title:"Assignment Types",closable:true,modal:true,iconCls:"win",width:520,height:525,resizable:false,buttonAlign:"right",buttons:[{text:"Delete Assignment Type",tooltip:"Delete assignment type",scope:this,id:"delType"+this.id,disabled:true,handler:function(){var selected=this.sm.getSelected();Wtf.Msg.show({title:"Delete Assignment Type?",msg:"Are you sure you want to delete the selected assignment type",buttons:Wtf.Msg.YESNO,scope:this,fn:function(btn){if(btn=="yes"){Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:({asstypeid:selected.get("asstypeid"),action:18,assigname:selected.get("assname"),moduleid:this.asstypestore.getAt(0).get("typeid")}),scope:this,success:function(result,req){var obj=Wtf.decode(result.responseText);if(obj.success){Wtf.Msg.alert("Alert","Assignment type deleted successfully",function(btn){if(btn=="ok"){this.flag=true;this.asstypestore.load({params:{action:30,modulerunid:this.sectionid,type:1}});Wtf.getCmp("delType"+this.id).disable()}},this)}else{Wtf.Msg.alert("Alert","Cannot delete assignment type due to dependency")}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}},animEl:"elId",icon:Wtf.MessageBox.QUESTION})}},{text:"Add New Assignment Type",tooltip:"Add New assignment type",scope:this,handler:function(){this.mbWin=new Wtf.Window({height:100,modal:true,title:"Add New Assignment Type",width:250,scope:this,bodyStyle:"margin: 10px 0 0 10px;float: right;",items:[this.newasstype=new Wtf.form.TextField({width:210,scope:this,maxLength:256,maxLengthText:"Name should be less than 256 characters",allowBlank:false})],buttons:[{text:"OK",scope:this,handler:function(bttn,e){if(this.newasstype.getValue()!=""){if(this.asstypestore.getCount()!=0){var index=this.asstypestore.find("assname",this.newasstype.getValue());if(index!=-1){msgBoxShow(["Add New Assignment Type","Assignment Type already exists."],Wtf.MessageBox.ERROR);return }}Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:({assname:this.newasstype.getValue(),action:9,programid:this.asstypestore.getAt(0).get("programid"),moduleid:this.sectionid,mid:this.moduleid}),scope:this,success:function(result,req){var obj=eval("("+result.responseText+")");if(obj.success){Wtf.Msg.alert("Add New Assignment Type","New assignment type created successfully",function(btn){if(btn=="ok"){this.flag=true;this.asstypestore.load({params:{action:30,modulerunid:this.sectionid,type:1}})}},this)}else{msgBoxShow(["Add New Assignment Type","Error occurred. Please try again."],Wtf.MessageBox.ERROR)}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}});this.mbWin.close()}else{Wtf.Msg.alert("Alert","Please enter a name")}}},{text:"Cancel",scope:this,handler:function(){this.mbWin.close()}}]});this.mbWin.show()}},{text:"Update",scope:this,disabled:this.showFlag,id:"create"+this.id,handler:function(){if(this.assForm.form.isValid()){var asstypeid="";var weights="";var outofs="";var typeid="";var requp="";var level="";var maxvalue=0;var submitable=0;var name="";for(var i=0;i<this.asstypestore.getCount();i++){var rec=this.asstypestore.getAt(i);maxvalue+=rec.get("weight");asstypeid+=rec.get("asstypeid")+"_";weights+=rec.get("weight")+"_";outofs+=rec.get("outof")+"_";typeid+=rec.get("typeid")+"_";name+=rec.get("assname")+"_";submitable+=rec.get("submitable")+"_";if(rec.get("requp")=="false"){requp+=0+"_"}else{requp+=1+"_"}}if(maxvalue>this.max){msgBoxShow(["Assignment Types","Weight can't be greater than "+this.max],Wtf.MessageBox.ERROR);return }else{if(maxvalue<this.min){msgBoxShow(["Assignment Types","Weight can't be less than "+this.min],Wtf.MessageBox.ERROR);return }}submitable=submitable.substring(0,submitable.length-1);asstypeid=asstypeid.substring(0,asstypeid.length-1);weights=weights.substring(0,weights.length-1);outofs=outofs.substring(0,outofs.length-1);typeid=typeid.substring(0,typeid.length-1);requp=requp.substring(0,requp.length-1);name=name.substring(0,name.length-1);asstypeid+="_999";weights+="_"+this.examwt.getValue();outofs+="_"+this.examOutOf.getValue();requp+="_0";Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:({asstypeid:asstypeid,weights:weights,outofs:outofs,requp:requp,typeid:typeid,level:1,action:11,moduleid:this.sectionid,submitable:submitable,name:name,programid:this.asstypestore.getAt(0).get("programid")}),scope:this,success:function(result,req){var obj=Wtf.decode(result.responseText);if(obj.success){Wtf.Msg.alert("Create Assignment","Assigned weights successfully",function(btn){if(btn=="ok"){this.flag=true;this.asstypestore.load({params:{action:30,modulerunid:this.sectionid,type:1}})}},this)}else{msgBoxShow(["Create Assignment","Error occurred. Please try again."],Wtf.MessageBox.ERROR)}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server",function(btn){if(btn=="ok"){this.addContentWin.close()}},this)}})}}},{text:"Close",scope:this,handler:function(){this.addContentWin.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Assignment Types","Set assignment types and assign weights")},{region:"center",bodyStyle:"background:white;font-size : 10px;padding:10px;",border:false,layout:"fit",items:[this.assForm=new Wtf.form.FormPanel({border:false,labelWidth:152,items:[this.examwt=new Wtf.form.NumberField({fieldLabel:"Final Exam Weightage(%)",readOnly:true,allowNegative:false,value:0}),this.examOutOf=new Wtf.form.NumberField({fieldLabel:"Full Marks",allowNegative:false,value:this.asstypestore.getAt(0).get("examoutof")}),this.total=new Wtf.form.NumberField({fieldLabel:"Total",readOnly:true,allowNegative:false,value:100})]})]},{region:"south",border:false,height:280,layout:"fit",items:[this.assgrid]}]});this.addContentWin.show();this.upObj=new Array();for(var i=0;i<this.asstypestore.getCount();i++){this.upObj[i]=this.upLoadAssignFile("jspfiles/faculty/uploadAssignmentFile.jsp","upload_"+i,false);var record=this.asstypestore.getAt(i);if(record.get("asstypeid")==""){this.upObj[i].disable();document.getElementById("upload_"+i).style.color="gray"}else{if(record.get("assid")!=""){document.getElementById("upload_"+i).style.color="blue";var json={assignmentname:record.get("assname"),assignmentid:record.get("assid"),isPO:false};this.upObj[i].setData(json)}else{this.upObj[i].disable();document.getElementById("upload_"+i).style.color="gray"}}}this.showExamWeightBeforeSelect()},assignWt:function(){this.flag=false;this.showFlag=false;this.asstypestore=new Wtf.data.Store({url:"jspfiles/admin/assignment.jsp",reader:new Wtf.data.JsonReader({root:"data"},[{name:"submissionon",type:"date"},"submitable","success","msg","ext","assid","asstypeid","assname","weight","outof","minWeight","maxWeight","requp","typeid","programid","examoutof"])});this.asstypestore.load({params:{action:30,modulerunid:this.sectionid,type:1}});this.asstypestore.on("load",function(A){var B=A.getAt(0);if(B.get("success")==false&&!this.flag){msgBoxShow(["Alert",B.get("msg")],Wtf.MessageBox.ERROR);return }if(B.get("success")==true&&B.get("assname")=="No Records Found."){if(!this.flag){this.createWin()}Wtf.getCmp("create"+this.id).disable();this.showFlag=true;return }this.max=A.getAt(0).get("maxWeight");this.min=A.getAt(0).get("minWeight");Wtf.Ajax.request({url:"jspfiles/faculty/getAssignments.jsp",method:"POST",params:({gradebook:"section",modulerunid:this.sectionid,sectionid:this.sectionid,studentid:loginid}),scope:this,success:function(K,I){var E=Wtf.decode(K.responseText);for(var F=0;F<E.data.length;F++){var H=E.data[F].type;for(var D=0;D<A.getCount();D++){var C=A.getAt(D);if(H==C.get("asstypeid")){C.set("assid",E.data[F].assignmentid);C.set("assname",E.data[F].assignmentname);C.set("ext",E.data[F].ext);C.set("submitable",E.data[F].submitable);C.set("submissionon",E.data[F].submissionon);break}}}if(!this.flag){this.createWin()}else{for(F=0;F<A.getCount();F++){this.upObj[F]=this.upLoadAssignFile("jspfiles/faculty/uploadAssignmentFile.jsp","upload_"+F,false);var G=this.asstypestore.getAt(F);if(G.get("asstypeid")==""){this.upObj[F].disable();document.getElementById("upload_"+F).style.color="gray"}else{if(G.get("assid")!=""){document.getElementById("upload_"+F).style.color="blue";var J={assignmentname:G.get("assname"),assignmentid:G.get("assid"),isPO:false};this.upObj[F].setData(J)}else{this.upObj[F].disable();document.getElementById("upload_"+F).style.color="gray"}}}}Wtf.getCmp("create"+this.id).enable()},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})},this)},handleRender:function(A){this.sectionStore.baseParams={type:"getfacclass",userid:loginid};this.sectionStore.load({params:{start:0,limit:10}});this.sectionStore.on("load",function(B,D,C){this.quickSearchTF1.StorageChanged(B)},this);this.sectionStore.on("datachanged",function(){var B=this.pP.combo.value;this.quickSearchTF1.setPage(B)},this);this.grid1.on("sortchange",function(B,C){this.grid1.getStore().groupBy(C.field)},this)},upLoadAssignFile:function(url,id,imageCheck){var obj=new AjaxUpload(id,{action:url,name:"filepath",scope:this,fileType:"",hoverClass:"uploadHover",onSubmit:function(file,ext){if(imageCheck){if(!(ext&&/^(jpg|png|jpeg|gif)$/.test(ext))){alert("Error: invalid file extension");return false}}},onComplete:function(file,response){var obj=eval("("+response+")");if(obj.success){alert("File Uploaded successfully!!");var index=id.split("_")[1];var assname=obj.data[0].assname;var assid=obj.data[0].assid;var ext=obj.data[0].ext}else{alert("Error! Please try again")}}});return obj},updateSubmitable:function(e){if(e.field=="submitable"||e.field=="submissionon"){Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",params:{action:31,assid:e.record.get("assid"),userid:loginid,val:e.field=="submitable"?e.value:e.value.format("Y-m-d"),field:e.field,table:e.field=="submitable"?"lassignmentmaster":"assmodulemap",moduleid:this.sectionid},scope:this,success:function(resp,option){var respText=eval("("+resp.responseText+")");if(!respText.success){e.cancel=true;msgBoxShow(["Error","Error connecting to server"],Wtf.MessageBox.INFO)}else{this.flag=true;this.asstypestore.load({params:{action:30,modulerunid:this.sectionid,type:1}})}}})}},openTab:function(D,B,A){var C=Wtf.getCmp(D);if(!C){C=new B(A);this.ownerCt.add(C);this.ownerCt.doLayout()}this.ownerCt.setActiveTab(C)},handleStoreLoad:function(A,C,B){this.quickSearchTF.StorageChanged(A);if(Wtf.isIE){this.addListener("activate",this.handleActivate,this);this.ownerCt.ownerCt.addListener("activate",this.handleActivate,this)}if(A.getCount()==0){this.validateBtn.disable()}},handleActivate:function(A){A.doLayout();var B=(this.grid.ownerCt.getSize().height>100)?this.grid.ownerCt.getSize().height:250;this.grid.ownerCt.setHeight(B);A.doLayout()},setAssTypes:function(){this.asstypestore=new Wtf.data.Store({url:"jspfiles/admin/assignment.jsp",reader:new Wtf.data.JsonReader({root:"data"},["assid","assname","weight","requp"])});this.asstypestore.load({params:{action:10}});this.asstypestore.on("load",this.getLevelType,this);this.sm=new Wtf.grid.CheckboxSelectionModel();this.cm=new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),this.sm,{header:"Assignment Type",width:100,dataIndex:"assname"},{header:"Weight",width:100,dataIndex:"weight",editor:new Wtf.form.NumberField({value:0,allowNegative:false,maxValue:100,maxLengthText:"Entered number cannot be greater than 100"})},{header:"Require Upload",width:100,hidden:true,dataIndex:"requp",editor:new Wtf.form.Checkbox({checked:true})}]);this.assgrid=new Wtf.grid.EditorGridPanel({border:false,cm:this.cm,sm:this.sm,clicksToEdit:1,store:this.asstypestore,singleSelect:true,viewConfig:{forceFit:true,autoFill:true},loadMask:{msg:"Loading assignment type list..."}});this.deselflag=false;this.assgrid.on("afteredit",this.showExamWeight,this);this.assgrid.on("headerclick",function(F,B,E){if(B==0){var D=false;var C=Wtf.fly(this.assgrid.getView().getHeaderCell(0).firstChild);var D=C.hasClass("x-grid3-hd-checker-on");for(var A=0;A<this.asstypestore.getCount();A++){if(!D){this.sm.deselectRow(A);this.deselflag=false}else{this.flag=true;this.sm.selectRow(A,true)}}}},this);this.assgrid.on("cellclick",function(D,A,B,C){if(B==1){if(!this.deselflag){this.flag=true;this.deselflag=false;this.sm.selectRow(A,true)}else{this.deselflag=false}}},this);this.sm.on("beforerowselect",function(C,A,B){if(this.flag){this.flag=false;return true}return false},this);this.sm.on("rowselect",this.showExamWeightBeforeSelect,this);this.sm.on("rowdeselect",function(A,C,B){this.deselflag=true;this.showExamWeightBeforeSelect(A,C,B)},this);this.ptype=this.modulesm.getSelected().data.programtype;this.leveltype=new Wtf.form.TextField({fieldLabel:"Level Type*",allowBlank:false,editable:false,width:290,forceSelection:true,value:"Course Level",name:"Course Level",disabled:true}),this.multi=new Wtf.form.TextField({fieldLabel:"Course*",allowBlank:false,editable:false,name:"Course",width:290,forceSelection:true,displayField:"name",value:this.modulesm.getSelected().data.name,disabled:true}),this.examwt=new Wtf.form.NumberField({fieldLabel:"Final Exam",width:60,readOnly:true,allowNegative:false,value:100,maxValue:100}),this.coursewt=new Wtf.form.NumberField({fieldLabel:"Coursework",width:60,readOnly:true,allowNegative:false,value:100,maxValue:100}),this.total=new Wtf.form.NumberField({fieldLabel:"Total",width:60,readOnly:true,allowNegative:false,value:100,maxValue:100});this.addContentWin=new Wtf.Window({title:"Assignment Types",closable:true,modal:true,iconCls:"win",width:450,height:500,resizable:false,buttonAlign:"right",buttons:[{text:"Delete",tooltip:"Delete assignment type",scope:this,handler:function(){Wtf.Msg.alert("Alert","Are you sure you want to delete the selected assignment type",function(A){if(A=="ok"){Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:({asstypeid:this.assgrid.selModel.getSelected().get("assid"),action:18}),scope:this,success:function(B,C){var D=Wtf.decode(B.responseText);if(D.flag==0){Wtf.Msg.alert("Alert","Cannot delete assignment type due to dependency")}else{if(D.flag==1){this.asstypestore.reload();msgBoxShow(["Delete Assignment","The selected assignment has been deleted successfully"],Wtf.MessageBox.INFO)}}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}},this)}},{text:"New",tooltip:"Create new assignment type",scope:this,handler:function(){this.mbWin=new Wtf.Window({height:100,modal:true,title:"Add new assignment type",width:250,scope:this,bodyStyle:"margin: 10px 0 0 10px;float: right;",items:[this.newasstype=new Wtf.form.TextField({width:210,scope:this,maxLength:256,maxLengthText:"Name should be less than 256 characters",allowBlank:false})],buttons:[{text:"OK",scope:this,handler:function(A,B){if(this.newasstype.getValue()!=""){Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:({assname:this.newasstype.getValue(),action:9}),scope:this,success:function(C,E){var F=Wtf.decode(C.responseText);var G=new Wtf.data.Record.create([{name:"assid",type:"string"},{name:"assname",type:"string"},{name:"weight",type:"string"},{name:"requp",type:"string"}]);var D=new G({assid:F.assid,assname:this.newasstype.getValue()});this.asstypestore.add(D);msgBoxShow(["Success","New assignment type created successfully"],Wtf.MessageBox.INFO)},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}});this.mbWin.close()}else{Wtf.Msg.alert("Alert","Please enter a name")}}},{text:"Cancel",scope:this,handler:function(){this.mbWin.close()}}]});this.mbWin.show()}},{text:"Apply",scope:this,handler:function(){if(this.assForm.form.isValid()){var D=this.assgrid.selModel.getSelections();var F="";var C="";var A="";var E="";for(var B=0;B<D.length;B++){F+=D[B].data.assid+"_";C+=D[B].data.weight+"_";if(D[B].data.requp=="false"){E+=0+"_"}else{E+=1+"_"}}A=this.modulesm.getSelected().data.basemoduleid;F=F.substring(0,F.length-1);C=C.substring(0,C.length-1);E=E.substring(0,E.length-1);if(D.length==0){F+="999";C+=this.examwt.getValue();E+="0"}else{F+="_999";C+="_"+this.examwt.getValue();E+="_0"}Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:({asstypeid:F,weights:C,requp:E,typeid:A,level:1,action:11,programid:this.modulesm.getSelected().data.programid}),scope:this,success:function(G,H){Wtf.Msg.alert("Success","Assigned weights successfully",function(I){if(I=="ok"){this.addContentWin.close()}},this)},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server",function(G){if(G=="ok"){this.addContentWin.close()}},this)}})}}},{text:"Cancel",scope:this,handler:function(){this.addContentWin.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Assignment Types","Set assignment types and assign weights")},{region:"center",bodyStyle:"background:white;font-size : 10px;padding:10px;",border:false,layout:"fit",items:[this.assForm=new Wtf.form.FormPanel({border:false,items:[{region:"north",width:408,bodyStyle:"padding:8px 0px 8px 8px",border:false,layout:"form",labelWidth:90,items:[this.leveltype,this.multi]},{region:"center",border:false,labelWidth:80,layout:"column",items:[{width:240,bodyStyle:"padding:8px 0px 8px 8px",border:false,layout:"form",labelWidth:90,columnWidth:0.48,items:[this.examwt,this.coursewt]},{width:240,bodyStyle:"padding:34px 0px 8px 8px",border:false,layout:"form",labelWidth:40,columnWidth:0.48,items:this.total}]},{region:"south",border:false,height:200,layout:"fit",items:[this.assgrid]}]})]}]});this.setWeight();this.addContentWin.show()},getLevelType:function(B,C,A){Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:({action:16,programid:this.modulesm.getSelected().data.programid}),scope:this,success:function(D,G){var H=Wtf.decode(D.responseText);if(H.type!=null){if(H.type[0]==1){}else{if(H.type[0]==0){if(H.success!=null){for(var E=0;E<H.success.length;E++){var J=H.success[E].asstypeid;var I=this.assgrid.getStore().find("assid",J);this.flag=true;this.assgrid.selModel.selectRow(I,true);this.assgrid.getStore().getAt(I).set("weight",H.success[E].weight)}var F=this.assgrid.selModel.getSelections();var K=null;for(var E=0;E<F.length;E++){K+=F[E].get("weight")}if(K>100){Wtf.Msg.alert("Alert","Sum of weights for selected assignments cannot be greater than 100 %",function(L){if(L=="ok"){this.sm.clearSelections()}},this)}else{this.coursewt.setValue(Math.round(K*100)/100);this.examwt.setValue(Math.round((100-K)*100)/100)}}}}}},failure:function(D,E){}})},setWeight:function(){Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:({action:17,programid:this.modulesm.getSelected().data.programid,typeid:this.modulesm.getSelected().data.basemoduleid}),scope:this,success:function(A,D){var E=Wtf.decode(A.responseText);if(E.success!=null){this.deselflag=false;for(var B=0;B<E.success.length;B++){var G=E.success[B].asstypeid;var F=this.assgrid.getStore().find("assid",G);this.flag=true;this.assgrid.selModel.selectRow(F,true);this.assgrid.getStore().getAt(F).set("weight",E.success[B].weight)}var C=this.assgrid.selModel.getSelections();var H=null;for(var B=0;B<C.length;B++){H+=C[B].get("weight")}if(H>100){Wtf.Msg.alert("Alert","Sum of weights for selected assignments cannot be greater than 100 %",function(I){if(I=="ok"){this.sm.clearSelections()}},this)}else{this.coursewt.setValue(Math.round(H*100)/100);this.examwt.setValue(Math.round((100-H)*100)/100)}}},failure:function(A,B){}})},showExamWeight:function(E){if(E.field=="weight"){if(E.value<=100){var D=this.assgrid.selModel.getSelections();var G=null;for(var C=0;C<this.asstypestore.getCount();C++){var F=this.asstypestore.getAt(C);if(F.get("weight")){G+=F.get("weight")}}if(G>this.max){Wtf.Msg.alert("Alert","Total weight cannot be greater than "+this.max,function(H){if(H=="ok"){E.record.set("weight",E.originalValue)}},this);return }if(G<this.min){Wtf.Msg.alert("Alert","Total weight cannot be less than "+this.min,function(H){if(H=="ok"){E.record.set("weight",E.originalValue)}},this);return }var A=this.asstypestore.getAt(E.row);A.set("outof",E.value);if(A.get("assid")){this.upObj[E.row].destroy();this.upObj[E.row]=this.upLoadAssignFile("jspfiles/faculty/uploadAssignmentFile.jsp","upload_"+E.row,false);var B={assignmentname:A.get("assname"),assignmentid:A.get("assid"),isPO:false};this.upObj[E.row].setData(B)}this.examwt.setValue(Math.round((100-G)*100)/100)}else{Wtf.Msg.alert("Alert","Value for weight cannot be greater than 100",function(H){if(H=="ok"){E.record.set("weight",E.originalValue)}},this)}}},showExamWeightBeforeSelect:function(D,F,A){var C=this.assgrid.selModel.getSelections();var G=null;for(var B=0;B<this.asstypestore.getCount();B++){var E=this.asstypestore.getAt(B);if(E.get("weight")){G+=E.get("weight")}}if(G>100){Wtf.Msg.alert("Alert","Sum of weights for selected assignments cannot be greater than 100 %",function(H){if(H=="ok"){this.sm.clearSelections()}},this)}else{this.examwt.setValue(100-G)}}});Wtf.courseIncomplete=function(A){Wtf.apply(this,A);this.modulesm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.groupingView1=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:true,hideGroupedColumn:true});this.cmodel1=new Wtf.grid.ColumnModel([this.modulesm,{header:"Student Name",width:150,dataIndex:"username"},{header:"Module Name",width:150,dataIndex:"modulename"},{header:"Program",width:150,dataIndex:"programname"},{header:"Session",width:150,dataIndex:"sessionname"}]);this.sessionRecord=Wtf.data.Record.create([{name:"userid",type:"string"},{name:"username",type:"string"},{name:"modulename",type:"string"},{name:"programname",type:"string"},{name:"moduleid",type:"string"},{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.sessionRecord);this.sessionds=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/faculty/getFacMod.jsp"}),reader:this.sessionReader,baseParams:{userid:loginid,type:"getIncompleteMod"}});this.grid=new Wtf.grid.GridPanel({border:true,store:this.sessionds,sm:this.modulesm,cm:this.cmodel1,viewConfig:{forceFit:true},loadMask:{msg:"Loading Data..."}});this.assignMarkBttn=new Wtf.Toolbar.Button({text:"Assign Marks",tooltip:"Assign Marks For Selected Item",scope:this,handler:this.assignMarks,disabled:true});Wtf.courseIncomplete.superclass.constructor.call(this,{layout:"fit",items:[{layout:"border",border:false,items:[{autoLoad:false,border:false,region:"center",layout:"fit",items:this.grid}],tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLQuickSearch({width:200,field:"name"}),"|",this.assignMarkBttn]}]});this.grid.getSelectionModel().on("selectionchange",this.disableBttn,this)};Wtf.extend(Wtf.courseIncomplete,Wtf.Panel,{afterRender:function(A){Wtf.courseIncomplete.superclass.afterRender.call(this,A);this.sessionds.load({params:{start:0,limit:15}})},assignMarks:function(){var A="gradebk"+this.id+this.modulesm.getSelected().get("moduleid");this.openTab(A,Wtf.course.gradeBook,{title:"Grade Book",closable:true,modulerunid:this.modulesm.getSelected().get("moduleid"),id:"gradebk"+this.id+this.modulesm.getSelected().get("moduleid")})},disableBttn:function(A){if(A.getSelections().length==1){this.assignMarkBttn.enable()}else{this.assignMarkBttn.disable()}},openTab:function(D,B,A){var C=Wtf.getCmp(D);if(!C){C=new B(A);this.parent.add(C);this.parent.doLayout()}this.parent.setActiveTab(C)}});Wtf.facSab=function(A){Wtf.apply(this,A);this.expander=new Wtf.grid.RowExpander({tpl:new Wtf.Template("<br>","<p><b>Reason:</b> {reason}</p>")});this.colConfig=[{header:"From",width:50,dataIndex:"startdate",sortable:true,renderer:function(B){if(Wtf.isEmpty(B)){return B}else{return B.format(Wtf.getDateFormat())}}},{header:"To",width:50,dataIndex:"enddate",sortable:true,renderer:function(B){if(Wtf.isEmpty(B)){return B}else{return B.format(Wtf.getDateFormat())}}},{header:"Reason",width:300,dataIndex:"reason",sortable:true},{header:"Status",width:100,dataIndex:"status",sortable:true,renderer:function(F,D,B,G,E,C){if(F==0){return"Applied"}else{if(F==1){return"<label style = 'color : green;'>Approved</label>"}else{if(F==2){return"<label style = 'color : red;'>Rejected</label>"}}}}}];if((isRoleGroup("4")||Wtf.isHR())){this.colConfig.unshift({header:"Faculty Name",width:100,dataIndex:"name",sortable:true,groupable:true})}this.colConfig.unshift(new Wtf.grid.RowNumberer({}));this.colConfig.unshift(this.expander);this.cmodel=new Wtf.grid.ColumnModel(this.colConfig);this.record=Wtf.data.Record.create([{name:"sabid",type:"string"},{name:"startdate",type:"date",dateFormat:"Y-m-d"},{name:"enddate",type:"date",dateFormat:"Y-m-d"},{name:"reason",type:"string"},{name:"status",type:"string"},{name:"name",type:"string"},{name:"userid",type:"string"}]);this.reader=new Wtf.data.JsonReader({root:"data"},this.record);this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.gridView=new Wtf.grid.GridView({forceFit:true});this.ds=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/faculty/sabbatical.jsp"}),reader:this.reader,baseParams:{mode:(isRoleGroup("4")||Wtf.isHR())?2:1},sortInfo:{field:"name",direction:"ASC"},groupField:"name"});this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,cm:this.cmodel,plugins:this.expander,view:(isRoleGroup("4")||Wtf.isHR())?this.groupingView:this.gridView,loadMask:{msg:"Loading..."}});if((isRoleGroup("4")||Wtf.isHR())){this.bbarConfig=[this.approveBttn=new Wtf.Toolbar.Button({text:"Approve Application",scope:this,disabled:true,handler:function(){var C=this.grid.getSelectionModel().getSelected();var B={edit:true,mode:6,status:1,startdate:C.get("startdate"),enddate:C.get("enddate"),reason:C.get("reason"),sabid:C.get("sabid"),facid:C.get("userid")};this.createWin(B)}}),this.disBttn=new Wtf.Toolbar.Button({text:"Reject Application",scope:this,disabled:true,handler:function(){Wtf.MessageBox.confirm("Reject Application","Are you sure you want to reject the application?",function(C){if(C=="yes"){var E=this.grid.getSelectionModel().getSelected();var D=E.get("startdate");var B=E.get("enddate");Wtf.Ajax.requestEx({url:"jspfiles/faculty/sabbatical.jsp",method:"POST",params:{status:2,mode:6,stdate:E.get("startdate").format("Y-m-j"),enddate:E.get("enddate").format("Y-m-j"),sabid:E.get("sabid"),facid:E.get("userid"),reason:E.get("reason")}},this,function(){msgBoxShow(["Reject Application","The application has been rejected."],Wtf.MessageBox.INFO);this.ds.reload()},function(){msgBoxShow(["Error","Error occurred while updating status. Please try again later."],Wtf.MessageBox.ERROR)});this.ds.reload()}},this)}})]}else{this.bbarConfig=[this.addBttn=new Wtf.Toolbar.Button({text:"New Application",scope:this,handler:function(){var B={edit:false,mode:3,status:0};this.createWin(B)}}),this.editBttn=new Wtf.Toolbar.Button({text:"Edit Application",scope:this,disabled:true,handler:function(){var C=this.grid.getSelectionModel().getSelected();var B={edit:true,mode:4,status:0,startdate:C.get("startdate"),enddate:C.get("enddate"),reason:C.get("reason"),sabid:C.get("sabid")};this.createWin(B)}}),this.delBttn=new Wtf.Toolbar.Button({text:"Delete Application",scope:this,disabled:true,handler:function(){Wtf.MessageBox.confirm("Delete Application","Are you sure you want to delete your application for sabbatical?",function(B){if(B=="yes"){var C=this.grid.getSelectionModel().getSelected();Wtf.Ajax.request({url:"jspfiles/faculty/sabbatical.jsp",method:"POST",scope:this,params:{mode:5,sabid:C.get("sabid")},success:function(D,E){this.ds.reload()},failure:function(){msgBoxShow(["Error","Error occurred while deleting. Please try again later."],Wtf.MessageBox.ERROR)}})}},this)}})]}Wtf.facSab.superclass.constructor.call(this,{layout:"fit",items:[{layout:"border",border:false,items:[{border:false,region:"center",layout:"fit",items:this.grid}]}],bbar:this.bbarConfig});this.grid.getSelectionModel().on("selectionchange",this.selChange,this)};Wtf.extend(Wtf.facSab,Wtf.Panel,{onRender:function(A){Wtf.facSab.superclass.onRender.call(this,A);this.ds.load()},selChange:function(B){var A=B.getSelected();if(!B.hasSelection()){if((isRoleGroup("4")||Wtf.isHR())){this.approveBttn.disable();this.disBttn.disable()}else{this.editBttn.disable();this.delBttn.disable()}}else{if((isRoleGroup("4")||Wtf.isHR())){this.approveBttn.enable();if(B.getSelected().get("status")!=2){this.disBttn.enable()}else{this.disBttn.disable()}}else{if(A.get("status")==0){this.editBttn.enable();this.delBttn.enable()}}}},handleKey:function(D){if(this.fP.form.isValid()){var C=this.fromField.getRawValue();var B=this.toField.getRawValue();if(D.facid){var A=D.facid}else{var A=""}this.fP.form.submit({scope:this,params:{status:D.status,mode:D.mode,stdate:Wtf.modifyDateFmt(C,Wtf.getDateFormat(),"Y-m-j"),enddate:Wtf.modifyDateFmt(B,Wtf.getDateFormat(),"Y-m-j"),sabid:D.sabid,facid:A,reason:this.reasonField.getValue()},success:function(){this.win.close();this.ds.reload()},failure:function(){msgBoxShow(["Error","Error occurred while connecting to server. Please try again later."],Wtf.MessageBox.ERROR)}})}},createWin:function(A){if((isRoleGroup("4")||Wtf.isHR())){if(A.status==1){var B="Approve sabbatical application. You can edit the dates for this application"}else{if(A.status==2){var B="Reject sabbatical application. You can edit the dates for this application"}}}else{var B="Apply for sabbatical"}this.win=new Wtf.Window({iconCls:"winicon",resizable:false,width:350,modal:true,plain:true,height:280,title:"Application for Sabbatical",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Sabbatical Application",B)},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:10px",items:[this.fP=new Wtf.form.FormPanel({url:"jspfiles/faculty/sabbatical.jsp",waitMsgTarget:true,method:"POST",border:false,labelWidth:100,items:[this.fromField=new Wtf.form.DateField({fieldLabel:"From*",scope:this,allowBlank:false,format:Wtf.getDateFormat(),width:190,value:A.edit?A.startdate:null}),this.toField=new Wtf.form.DateField({fieldLabel:"To*",scope:this,allowBlank:false,format:Wtf.getDateFormat(),width:190,value:A.edit?A.enddate:null}),this.reasonField=new Wtf.form.TextArea({fieldLabel:"Reason*",scope:this,allowBlank:false,disabled:(isRoleGroup("4")||Wtf.isHR())?true:false,width:190,maxLength:1024,value:A.edit?A.reason:""})]})]}],buttons:[{text:"OK",scope:this,handler:function(){if(this.fromField.getValue()<=this.toField.getValue()){this.handleKey(A)}else{this.fromField.markInvalid("From date should be before To date");this.toField.markInvalid("From date should be before To date")}}},{text:"Cancel",scope:this,handler:function(){this.win.close()}}]});this.win.show()}});Wtf.disGrade=function(A){Wtf.apply(this,A);this.gradeRecord2=Wtf.data.Record.create([{name:"grade",type:"string"}]);this.gradeReader2=new Wtf.data.KwlJsonReader({root:"data"},this.gradeRecord2);this.gradeds2=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.gradeReader2});this.gradeStore2=new Wtf.form.ComboBox({triggerAction:"all",store:this.gradeds2,mode:"local",readOnly:true,displayField:"grade",valueField:"grade"});this.gradeds2.load({params:{type:82,moduleid:this.moduleid,flag:(this.moduleid==-1)?1:0}});this.gradeStore2.on("select",function(C,D,B){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/admin/acastructure.jsp",params:{type:83,moduleid:this.gradeSM.getSelected().get("moduleid"),userid:this.gradeSM.getSelected().get("userid"),grade:D.data.grade}},this,function(F,E){},function(F,E){})},this);this.valueRec=Wtf.data.Record.create([{name:"grade"}]);this.valueReader=new Wtf.data.KwlJsonReader({root:"data"},this.valueRec);this.valueStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:this.valueReader});this.valueCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.valueStore,mode:"local",readOnly:true,displayField:"grade",allowBlank:false,valueField:"grade"});this.gradeSM=new Wtf.grid.CheckboxSelectionModel({});this.gradeRecord=Wtf.data.Record.create([{name:"userid",type:"string"},{name:"username",type:"string"},{name:"grade",type:"string"},{name:"modulename",type:"string"},{name:"moduleid",type:"string"},{name:"status",type:"string"},{name:"Feedback",type:"string"},{name:"nationality",type:"string"},{name:"matricno",type:"string"}]);this.gradeReader=new Wtf.data.KwlJsonReader({root:"data"},this.gradeRecord);this.gradeStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.gradeReader});this.gradeCM=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),this.gradeSM,{header:"Student",dataIndex:"username",sortable:true},{header:"Matric Number",dataIndex:"matricno",sortable:true},{header:"Nationality",dataIndex:"nationality",sortable:true},{header:"Module name",dataIndex:"modulename",sortable:true},{header:"Status",dataIndex:"status",sortable:true,renderer:function(B){if(B==0){return"Result pending"}if(B==1){return"<div><div>Pending HOD Verification</div><div>Pending HOP Validation</div></div>"}if(B==2){return"<div><div>Verified by HOD</div><div>Pending HOP Validation</div></div>"}if(B==3){return"Grievance Application"}if(B==4){return"Final Marks"}if(B==5){return"Re-Assess"}if(B==6){return"ASAD Confirmed"}if(B==7){return"<div><div>Pending HOD Verification</div><div>Validated by HOP</div></div>"}if(B==8){return"<div><div>Verified by HOD</div><div>Validated by HOP</div></div>"}}},{header:"Feedback",dataIndex:"Feedback",sortable:true,hidden:true},{header:"Grade",dataIndex:"grade",editor:this.gradeStore2}]);this.filterStore=new Wtf.data.SimpleStore({fields:["statusid","status"],data:[["0","Result pending"],["1","<div><div>Pending HOD Verification</div><div>Pending HOP Validation</div></div>"],["2","<div><div>Verified by HOD</div><div>Pending HOP Validation</div></div>"],["7","<div><div>Pending HOD Verification</div><div>Validated by HOP</div></div>"],["3","Grievance Application"],["4","Final Marks"],["5","Re-Assess"],["6","ASAD Confirmed"],["8","<div><div>Verified by HOD</div><div>Validated by HOP</div></div>"]]});this.filterCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.filterStore,mode:"local",readOnly:true,displayField:"status",fieldLabel:"Filter by status",width:isRoleGroup("4")?100:175,listWidth:175,valueField:"statusid",emptyText:"Select a status..."});this.clearFilter=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.gradeStore.removeAll();this.gradeStore.clearFilter(false);this.filterCombo.clearValue();if(isRoleGroup("4")){this.atCombo.clearValue();this.facultyCombo.clearValue();this.sdate.reset();this.edate.reset()}}});this.dldCsv=new Wtf.Toolbar.Button({text:"Export",scope:this,iconCls:"csvIcon",handler:this.handleExport});this.archive=new Wtf.Toolbar.Button({text:"Archive Result",scope:this,handler:function(){var B=Wtf.getCmp("archive"+this.id);if(!B){B=new Wtf.archiveResult({layout:"fit",id:"archive"+this.id,title:"Archive Result",closable:true,moduleid:this.moduleid});this.ownerCt.add(B)}this.ownerCt.activate(B);this.ownerCt.doLayout()}});this.filterCombo.on("select",this.filter,this);this.gradeGrid=new Wtf.grid.EditorGridPanel({ds:this.gradeStore,cm:this.gradeCM,sm:this.gradeSM,autoScroll:true,collapsible:true,trackMouseOver:true,layout:"fit",clicksToEdit:1,viewConfig:{forceFit:true,autoFill:true}});this.gradeGrid.on({"beforeedit":{fn:this.be,scope:this}});this.layout="fit";this.items=this.gradeGrid;this.submit=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:this.refresh});this.edate=new Wtf.form.DateField({fieldLabel:"End Date:",width:80,allowBlank:false,format:Wtf.getDateFormat()});this.sdate=new Wtf.form.DateField({fieldLabel:"Start Date:",allowBlank:false,width:80,format:Wtf.getDateFormat(),listeners:{scope:this,change:function(E,C,B){this.edate.reset();if(C!=""){this.edate.setMinValue(C);var D=new Date(C).add(Date.MONTH,6);this.edate.setValue(D)}}}});this.comboBox=new Wtf.comboBox();this.facultyCombo=this.comboBox.getFacultyCombo();this.atCombo=this.comboBox.getATCombo();if(isRoleGroup("4")){this.tbar=["Filter by status: ",this.filterCombo,"Module:",this.atCombo,"Faculty:",this.facultyCombo,"Start Date:",this.sdate,"End Date:",this.edate,this.submit,this.clearFilter]}else{this.tbar=["Filter by status: ",this.filterCombo,this.clearFilter]}this.bbar=[this.setGradeBtn=new Wtf.Toolbar.Button({id:"setgrade",text:"Set Grade",scope:this,handler:this.setGrade,disabled:true,hidden:(isRoleGroup("4"))?true:false}),this.confirmGradeBtn=new Wtf.Toolbar.Button({id:"confirmgrade",text:"Confirm Grade",scope:this,handler:this.confirmGrade,disabled:true,hidden:(isRoleGroup("4"))?true:false}),{id:"hodaccept",text:"Accept",scope:this,handler:this.acceptGrades,disabled:true},{id:"hodreject",text:"Reject",scope:this,handler:this.rejectGrades,disabled:true},{id:"hodsubmitappeal",text:"Submit Appeal",scope:this,handler:this.submitAppeal,disabled:true},{id:"generategrade",text:"Generate GradeBook",scope:this,handler:this.generategrade,disabled:true,hidden:(isRoleGroup("4"))?false:true},{id:"anagrade",text:"GradeBook Analysis",scope:this,handler:this.anagrade,disabled:false},this.dldCsv,this.archive];this.gradeSM.on("selectionchange",this.disablebtn,this);Wtf.disGrade.superclass.constructor.call(this,A)};Wtf.extend(Wtf.disGrade,Wtf.Panel,{handleExport:function(){var C="";var B="";var A="";var D="";if(isRoleGroup("4")){B=this.facultyCombo.getValue();A=this.sdate.value;D=this.edate.value;C=this.atCombo.getValue()}else{B=loginid;C=this.moduleid}setDldUrl("fileDownload.jsp?modulerunid="+C+"&type=gradebookspe&dtype=attachment&hod="+this.HOD+"&hop="+this.HOP+"&facid="+B+"&sdate="+A+"&edate="+D+"&archiveFlag="+false)},onRender:function(A){Wtf.disGrade.superclass.onRender.call(this,A);if(this.HOD||this.HOP){this.setGradeBtn.setVisible(false);this.confirmGradeBtn.setVisible(false);Wtf.getCmp("hodaccept").setVisible(true);Wtf.getCmp("hodreject").setVisible(true);Wtf.getCmp("hodsubmitappeal").setVisible(true)}else{this.setGradeBtn.setVisible(true);Wtf.getCmp("hodaccept").setVisible(false);Wtf.getCmp("hodreject").setVisible(false);Wtf.getCmp("hodsubmitappeal").setVisible(false)}this.refresh()},confirmGrade:function(){var B="";var E="";var D="";var F="";var A=0;var H=0;var C=this.gradeSM.getSelections();for(var G=0;G<C.length;G++){D+=C[G].get("userid");D+=",";F+="-2,"}Wtf.MessageBox.confirm("Confirm Grades","Are you sure you want to confirm the grades?",function(I){if(I=="yes"){if(this.moduleid==-1){H=this.gradeSM.getSelected().get("moduleid")}else{H=this.moduleid}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",method:"POST",params:{type:"storeMarks",mid:H,total:F,ids:D,uid:loginid,specialgrade:1}},this,function(J,K){var L=Wtf.decode(J);if(L.error){msgBoxShow(["Grade Confirmation",L.msg],Wtf.MessageBox.ERROR)}else{msgBoxShow(["Grade Confirmation","The grades of selected the students have been confirmed."],Wtf.MessageBox.INFO);this.refresh()}},function(){msgBoxShow(["Error","Error occurred while confirming the grades. Please try again later."],Wtf.MessageBox.ERROR)})}},this)},refresh:function(){var B=this.facultyCombo.getValue();var C=this.atCombo.getValue();if(!isRoleGroup("4")){this.gradeStore.load({params:{type:87,archiveFlag:false,facid:loginid,moduleid:this.moduleid,hod:this.HOD,hop:this.HOP}})}else{var A=this.sdate.value;var D=this.edate.value;if(B&&C&&A&&D){this.gradeStore.load({params:{type:87,archiveFlag:false,sdate:A,edate:D,facid:B,moduleid:C}})}}},setGrade:function(){this.gradesm1=new Wtf.grid.CheckboxSelectionModel();this.gradeRecord1=Wtf.data.Record.create([{name:"grade",type:"string"}]);this.gradeReader1=new Wtf.data.KwlJsonReader({root:"data"},this.gradeRecord1);this.gradeds1=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.gradeReader1});this.gradecm1=new Wtf.grid.ColumnModel([this.gradesm1,{dataIndex:"grade",header:"Grades"}]);this.gradeGrid1=new Wtf.grid.GridPanel({sm:this.gradesm1,ds:this.gradeds1,cm:this.gradecm1,viewConfig:{autoFill:true,forceFit:true}});var A=0;if(this.moduleid==-1){A=1}this.gradeds1.load({params:{type:82,moduleid:this.gradeSM.getSelected().get("moduleid"),flag:A}});this.gradewin=new Wtf.Window({width:400,height:250,layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:"<div style = 'width:100%;height:100%;position:relative;float:left;'><div style='float:left;height:100%;width:auto;position:relative;'><img src = 'images/upload52.gif' style = 'width:52px;height:52px;margin:5px 5px 5px 5px;'></img></div><div style='float:left;height:100%;width:80%;position:relative;'><div style='font-size:12px;font-style:bold;float:left;margin:20px 0px 0px 10px;width:100%;position:relative;'><b>Grades</b></div><div style='font-size:10px;float:left;margin:15px 0px 0px 10px;width:100%;position:relative;'>Set Grades.</div></div></div>"},{region:"center",border:false,layout:"fit",items:[{border:false,layout:"fit",items:this.gradeGrid1}]}],buttons:[{text:"Save",scope:this,handler:this.insertGrade},{text:"Cancel",scope:this,handler:function(){this.gradewin.close()}}]});this.gradewin.show()},disablebtn:function(G){var E=this.gradeSM.getSelections();if(E.length==1){this.setGradeBtn.setDisabled(false);this.confirmGradeBtn.setDisabled(false);Wtf.getCmp("hodaccept").setDisabled(false);Wtf.getCmp("hodreject").setDisabled(false);Wtf.getCmp("hodsubmitappeal").setDisabled(false);Wtf.getCmp("generategrade").setDisabled(false)}else{this.setGradeBtn.setDisabled(true);this.confirmGradeBtn.setDisabled(true);Wtf.getCmp("hodaccept").setDisabled(true);Wtf.getCmp("hodreject").setDisabled(true);Wtf.getCmp("hodsubmitappeal").setDisabled(true);Wtf.getCmp("generategrade").setDisabled(true)}if(E.length==1){if(this.HOD){if(G.getSelected().get("status")!=1||G.getSelected().get("status")==3){this.setGradeBtn.setDisabled(true)}if(G.getSelected().get("status")!=3){Wtf.getCmp("hodsubmitappeal").setDisabled(true)}}else{if(this.HOP){if(G.getSelected().get("status")!=7||G.getSelected().get("status")==3){this.setGradeBtn.setDisabled(true)}if(G.getSelected().get("status")!=3){Wtf.getCmp("hodsubmitappeal").setDisabled(true)}}else{if(isRoleGroup("4")){if(G.getSelected().get("status")==2){this.setGradeBtn.setDisabled(false)}else{this.setGradeBtn.setDisabled(true)}}else{if(G.getSelected().get("status")==0||G.getSelected().get("status")==5){this.setGradeBtn.setDisabled(false)}else{this.setGradeBtn.setDisabled(true)}}}}}else{this.setGradeBtn.setDisabled(true);this.confirmGradeBtn.setDisabled(true);Wtf.getCmp("hodaccept").setDisabled(true);Wtf.getCmp("hodreject").setDisabled(true);Wtf.getCmp("hodsubmitappeal").setDisabled(true);Wtf.getCmp("generategrade").setDisabled(true)}var C=true;var B=true;var F=true;var D=false;var A=G.getSelections();if(A.length>0){for(i=0;i<A.length;i++){if(!this.HOD&&!this.HOP){if(A[i].get("status")!="0"&&A[i].get("status")!="5"){C=false}if(A[i].get("status")!="8"){F=false}}else{if(A[i].get("status")!="1"&&A[i].get("status")!="7"){B=false;break}}}if(!this.HOD&&!this.HOP){if(C){this.confirmGradeBtn.setDisabled(false)}else{this.confirmGradeBtn.setDisabled(true)}if(F){Wtf.getCmp("generategrade").setDisabled(false)}else{Wtf.getCmp("generategrade").setDisabled(true)}}else{if(B){if(G.getSelected().get("status")=="1"||G.getSelected().get("status")=="7"){Wtf.getCmp("hodaccept").setDisabled(false);Wtf.getCmp("hodreject").setDisabled(false)}else{if(G.getSelected().get("status")=="3"){Wtf.getCmp("hodsubmitappeal").setDisabled(false)}}}else{Wtf.getCmp("hodaccept").setDisabled(true);Wtf.getCmp("hodreject").setDisabled(true);Wtf.getCmp("hodsubmitappeal").setDisabled(true)}}}else{if(!this.HOD&&!this.HOP){this.confirmGradeBtn.setDisabled(true);Wtf.getCmp("generategrade").setDisabled(true)}else{Wtf.getCmp("hodaccept").setDisabled(true);Wtf.getCmp("hodreject").setDisabled(true)}}},insertGrade:function(){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/admin/acastructure.jsp",params:{type:83,moduleid:this.gradeSM.getSelected().get("moduleid"),userid:this.gradeSM.getSelected().get("userid"),grade:this.gradesm1.getSelected().get("grade")}},this,function(B,A){this.gradewin.close();this.refresh()},function(B,A){})},getUsers:function(){var C="";var A=this.gradeSM.getSelections();for(var B=0;B<A.length;B++){C+=A[B].get("userid")+","}return C},be:function(A){if(this.HOD||this.HOP){A.cancel=true}else{if(isRoleGroup("4")){if(this.gradeSM.getSelected().get("status")==2){}else{A.cancel=true}}else{if(this.gradeSM.getSelected().get("status")==0||this.gradeSM.getSelected().get("status")==5){}else{A.cancel=true}}}},acceptGrades:function(){Wtf.MessageBox.confirm("Confirm Grades","Are you sure you want to accept?",function(A){if(A=="yes"){var B=this.getUsers();var C;if(this.moduleid==-1||this.moduleid==-2){C=this.gradeSM.getSelected().get("moduleid")}else{C=this.moduleid}Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:5,mid:C,ids:B,uid:loginid},scope:this,success:function(){msgBoxShow(["Accept Grades","Grade status updated."],Wtf.MessageBox.INFO);this.refresh()},failure:function(){msgBoxShow(["Error","Error occurred while accepting the grades. Please try again later."],Wtf.MessageBox.ERROR)}})}},this)},rejectGrades:function(){Wtf.MessageBox.confirm("Confirm Grades","Are you sure you want to reject?",function(A){if(A=="yes"){var B=this.getUsers();var C;if(this.moduleid==-1||this.moduleid==-2){C=this.gradeSM.getSelected().get("moduleid")}else{C=this.moduleid}Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:6,mid:C,ids:B,uid:loginid},scope:this,success:function(){msgBoxShow(["Reject Grades","Grade status updated."],Wtf.MessageBox.INFO);this.refresh()},failure:function(){msgBoxShow(["Error","Error occurred while rejecting the grades. Please try again later."],Wtf.MessageBox.ERROR)}})}},this)},submitAppeal:function(){Wtf.MessageBox.confirm("Confirm Grades","Are you sure you want to submit the appeal?",function(A){if(A=="yes"){var B=this.getUsers();var C;if(this.moduleid==-1||this.moduleid==-2){C=this.gradeSM.getSelected().get("moduleid")}else{C=this.moduleid}Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:7,mid:C,ids:B,uid:loginid},scope:this,success:function(){msgBoxShow(["Forward Appeal to Faculty","Grievance(s) forwarded to faculty for re-assessment."],Wtf.MessageBox.INFO);this.refresh()},failure:function(){msgBoxShow(["Error","Error occurred while submitting request. Please try again later."],Wtf.MessageBox.ERROR)}})}},this)},generategrade:function(){Wtf.MessageBox.confirm("Generate Grade Book","Are you sure you want to generate Grade Book for selected students?",function(A){if(A=="yes"){var B=this.gradeSM.getSelected().get("moduleid");Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:{action:7,moduleid:B,ids:this.getUsers()},scope:this,success:function(D,C){msgBoxShow(["Grade Book Generation","Grade Book Generated.<br/>Notification has been sent to the students in this module."],Wtf.MessageBox.INFO);this.refresh()},failure:function(D,C){Wtf.getCmp("gengb_"+this.id).enable();msgBoxShow(["Error","Error in connection."],Wtf.MessageBox.ERROR)}})}else{}},this)},anagrade:function(){if(this.gradeStore.getCount()>0){var C=true;var B=15;if(C){var A=this.sdate.value;var D=this.edate.value;this.gradeanawin=new Wtf.Window({width:415,height:215,title:"Grade Chart",modal:true,bodyStyle:"background-color:#FFFFFF",items:[new Wtf.analysisArPanel({modulerunid:isRoleGroup("4")?this.atCombo.getValue():this.moduleid,facid:isRoleGroup("4")?this.facultyCombo.getValue():loginid,typeFlag:B,sdate:A,edate:D,hod:this.HOD,hop:this.HOP})]});if(isRoleGroup("4")){if(this.atCombo.getValue()&&this.facultyCombo.getValue()&&A&&D){this.gradeanawin.show()}}else{this.gradeanawin.show()}}}else{msgBoxShow(["Grade Book Analysis","Grade Book should contain minimum 1 record to display analysis."],Wtf.MessageBox.INFO)}},filter:function(B,C,A){this.gradeStore.filter("status",C.get("statusid"))}});Wtf.analysisArPanel=function(A){Wtf.apply(this,A);Wtf.analysisArPanel.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"form",autoScroll:true,items:[this.northP=new Wtf.Panel({region:"north",id:"gdchart",border:false,layout:"fit",height:215})]});this.on("render",this.handleRender,this)};Wtf.extend(Wtf.analysisArPanel,Wtf.Panel,{handleRender:function(obj){this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});this.loadMask.show();Wtf.Ajax.requestEx({url:"jspfiles/student/gradeBook.jsp",method:"POST",params:{mode:this.typeFlag,modulerunid:this.modulerunid,userid:loginid,facid:this.facid,sdate:this.sdate,edate:this.edate,hod:this.hod,hop:this.hop}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.gradeChart[0].data[0]!==undefined){this.loadMask.hide()}this.plotChart(resObj.gradeChart[0].data[0])}}},function(resp,req){this.loadMask.hide()})},plotChart:function(D){var F="";var B="";var C=0;if(D.totalCnt>0){for(var A=0;A<D.gradedata.length;A++){C=(D.gradedata[A].cnt/D.totalCnt)*100;F+=D.gradedata[A].grade.replace("+","%2b")+"["+this.roundNumber(C,2)+"%]|";B+=C+","}}F=F.substring(0,F.length-1);B=B.substring(0,B.length-1);var E='<div ><img style = "" align="center" src ="http://chart.apis.google.com/chart?cht=p3&chd=t:'+B+"&chco=3e85e5,fcb441,e0400a&chs=400x185&chl="+F+'"</img></div>';document.getElementById("gdchart").innerHTML=E},roundNumber:function(B,C){var A=Math.round(B*Math.pow(10,C))/Math.pow(10,C);return A}});Wtf.archiveResult=Wtf.extend(Wtf.disGrade,{initComponent:function(){Wtf.archiveResult.superclass.initComponent.call(this);this.archive.hide();this.setGradeBtn.hide();this.confirmGradeBtn.hide()},onRender:function(A){Wtf.archiveResult.superclass.onRender.call(this,A)},refresh:function(){var B=this.facultyCombo.getValue();var C=this.atCombo.getValue();if(!isRoleGroup("4")){this.gradeStore.load({params:{archiveFlag:true,type:87,facid:loginid,moduleid:this.moduleid,hod:this.HOD,hop:this.HOP}})}else{var A=this.sdate.value;var D=this.edate.value;if(B&&C&&A&&D){this.gradeStore.load({params:{type:87,archiveFlag:true,sdate:A,edate:D,facid:B,moduleid:C}})}}},handleExport:function(){var C="";var B="";var A="";var D="";if(isRoleGroup("4")){B=this.facultyCombo.getValue();A=this.sdate.value;D=this.edate.value;C=this.atCombo.getValue()}else{B=loginid;C=this.moduleid}setDldUrl("fileDownload.jsp?modulerunid="+C+"&type=gradebookspe&dtype=attachment&hod="+this.HOD+"&hop="+this.HOP+"&facid="+B+"&sdate="+A+"&edate="+D+"&archiveFlag="+true)}});Wtf.userAttendance=function(A){Wtf.apply(this,A);this.moduleid=A.moduleid;this.userAttencm=new Wtf.grid.ColumnModel([{header:"Student Name",dataIndex:"username"},{header:"Online Attendance",dataIndex:"online",renderer:this.returnTime},{header:"Last Access",dataIndex:"lastaccess",renderer:function(F,D,B,G,E,C){return"<lable style = 'color : green;'>"+F+"</lable>"}}]);this.attenStore=new Wtf.data.Store({url:"jspfiles/newCourse.jsp",reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["userid","username","online","lastaccess","phyatten","total"]),baseParams:{type:"atten",moduleid:this.moduleid}});this.attenStore.load({params:{start:0,limit:15}});Wtf.userAttendance.superclass.constructor.call(this,{border:false,store:this.attenStore,cm:this.userAttencm,singleSelect:true,viewConfig:{forceFit:true,autoFill:true},loadMask:{msg:"Loading Courses..."},bbar:new Wtf.PagingToolbar({pageSize:15,store:this.attenStore,displayInfo:true,displayMsg:"Displaying results {0} - {1} of {2}",emptyMsg:"No topics to results",plugins:new Wtf.common.pPageSize({id:"pPageSize_"+this.id})})});this.colModel.setEditable(0,false);this.colModel.setEditable(1,false)};Wtf.extend(Wtf.userAttendance,Wtf.grid.EditorGridPanel,{returnTime:function(D){var C=D%60;var B=Math.floor(D/60)%60;var A=Math.floor(D/3600);if(B%60==0){B=0}if(C<10){C="0"+C}if(B<10){B="0"+B}if(A<10){A="0"+A}var E=A+":"+B+":"+C;return E}});Wtf.teamMgmt=function(A){Wtf.apply(this,A);this.border=false;this.bodyStyle="background:none;";this.title=(this.faculty?"Manage Teams":"My Teams");this.teamReader=new Wtf.data.JsonReader({root:"data",totalProperty:"totalCount",fields:[{name:"teamid"},{name:"moduleid"},{name:"name"},{name:"description"},{name:"timestamp"}]});this.teamStore=new Wtf.data.Store({id:this.id+"_teamStore",baseParams:{start:0,limit:15},reader:this.teamReader,url:"jspfiles/admin/manageTeams.jsp",method:"GET"});this.teamStore.load({params:{action:0,moduleid:this.moduleid}});this.teamSM=new Wtf.grid.CheckboxSelectionModel({width:25,singleSelect:true});this.teamSM.id=this.id+"_teamSM";this.teamCM=new Wtf.grid.ColumnModel([this.teamSM,{header:"Team Name",autoWidth:true,sortable:true,dataIndex:"name"},{header:"Description",autoSize:true,sortable:true,dataIndex:"description"}]);this.teamGrid=new Wtf.grid.GridPanel({id:this.id+"_teamGrid",store:this.teamStore,cm:this.teamCM,sm:this.teamSM,border:false,loadMask:true,viewConfig:{forceFit:true}});this.memberReader=new Wtf.data.JsonReader({root:"data",totalProperty:"totalCount",fields:[{name:"userid"},{name:"username"},{name:"checked"}]});this.memberStore=new Wtf.data.Store({id:this.id+"_memberStore",reader:this.memberReader,url:"jspfiles/admin/manageTeams.jsp",method:"GET"});this.memberSM=new Wtf.grid.CheckboxSelectionModel({width:25});this.memberSM.id=this.id+"_memberSM";this.memberCM=new Wtf.grid.ColumnModel([this.memberSM,{header:"Member Name",autoWidth:true,sortable:true,dataIndex:"username"}]);this.memberGrid=new Wtf.grid.GridPanel({id:this.id+"_memberGrid",store:this.memberStore,cm:this.memberCM,sm:this.memberSM,border:false,loadMask:true,viewConfig:{forceFit:true}});this.items=new Wtf.Panel({layout:"border",border:false,items:[this.upperPanel=new Wtf.Panel({region:"north",title:"Team(s)",split:true,height:350,layout:"fit",border:false,tbar:["Quick Search: ",this.quickPanelSearch1=new Wtf.KWLQuickSearch({width:200,field:"name"}),"-",this.newBtn=new Wtf.Toolbar.Button({text:"New",iconCls:"pwnd newcal",tooltip:"Create New Team",scope:this,handler:this.newTeam}),this.editBtn=new Wtf.Toolbar.Button({text:"Edit",iconCls:"pwnd editicon",tooltip:"Edit Team Information",scope:this,handler:this.editTeam}),this.delBtn=new Wtf.Toolbar.Button({text:"Delete",iconCls:"pwnd deliconwt",tooltip:"Delete Team(s)",scope:this,handler:this.delTeam})],bbar:new Wtf.PagingToolbar({id:this.id+"_pgTbar1",pageSize:5,store:this.teamStore,displayInfo:true,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:new Wtf.common.pPageSize({})}),items:[this.teamGrid]}),this.lowerPanel=new Wtf.Panel({teamid:null,region:"center",title:"Team Member(s)",split:true,layout:"fit",border:false,tbar:["Quick Search: ",this.quickPanelSearch2=new Wtf.KWLQuickSearch({width:200,field:"username"}),this.updateBtn=new Wtf.Toolbar.Button({text:"Update Team",iconCls:"pwnd editiconwt",tooltip:"Update Team Member(s) List",scope:this,handler:this.insertUpdateMembers})],items:[this.memberGrid]})]});this.items.on("resize",function(D,B,C){this.upperPanel.setHeight(C/2);this.doLayout()},this);this.teamStore.on("load",function(){this.quickPanelSearch1.StorageChanged(this.teamStore)},this);this.memberStore.on("load",function(G,E,D){this.quickPanelSearch2.StorageChanged(this.memberStore);var F=[];var B=0;for(var C=0;C<E.length;C++){if(E[C].data["checked"]=="1"){F[B++]=C}}this.memberSM.selectRows(F)},this);if(!this.faculty){this.newBtn.hide();this.editBtn.hide();this.delBtn.hide();this.updateBtn.hide()}this.teamGrid.addListener("rowclick",this.teamGridRowClick,this);Wtf.teamMgmt.superclass.constructor.call(this)};Wtf.extend(Wtf.teamMgmt,Wtf.Panel,{initComponent:function(A){Wtf.teamMgmt.superclass.initComponent.call(this,A)},onRender:function(B,A){Wtf.teamMgmt.superclass.onRender.call(this,B,A);this.on("refereshteamgrid",function(){this.teamStore.reload()})},teamGridRowClick:function(E,B,D){var F=this.teamStore.getAt(B);var C=F.data["teamid"];var A=F.data["name"];this.lowerPanel.teamid=C;this.lowerPanel.setTitle("Team Member(s) of "+A);this.memberStore.load({params:{action:1,teamid:C,moduleid:this.moduleid}})},newTeam:function(){this.showTeamWindow(null)},editTeam:function(){if(this.teamSM.getCount()==1){var A=this.teamSM.getSelected();this.showTeamWindow(A.get("teamid"),A.get("name"),A.get("description"))}else{Wtf.Msg.alert("Invalid Selection","Please select a single record to edit!");return false}},delTeam:function(){if(this.teamSM.getCount()>0){Wtf.MessageBox.confirm("Confirm","Are you sure you want to delete the selected team(s)?",function(B){if(B=="yes"){var D=this.teamSM.getSelections();var C="";for(var A=0;A<D.length;A++){C+=D[A].data["teamid"];if((A+1)!=D.length){C+=","}}this.deleteRequest(C)}},this)}else{Wtf.Msg.alert("Invalid Selection","Please select a single record to delete!");return false}},insertUpdateMembers:function(){if(this.memberSM.getCount()>0){var C=this.memberSM.getSelections();var A="";for(var B=0;B<C.length;B++){A+=C[B].data["userid"];if((B+1)!=C.length){A+=","}}this.membersRequest(A,this.lowerPanel.teamid)}else{Wtf.Msg.alert("Invalid Selection","Please select a single record to update!");return false}},membersRequest:function(members,teamid){Wtf.Ajax.request({method:"POST",url:"jspfiles/admin/manageTeams.jsp",params:({action:5,teamid:teamid,userids:members,moduleid:this.moduleid}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","Update operation failed!")}else{if(nodeobj.success=="true"){Wtf.Msg.alert("Status","Record(s) saved successfully!",function(btn){if(btn=="ok"){}},this)}else{Wtf.Msg.alert("Status","The following students are already assigned to a team: -<br />"+nodeobj.success);this.memberStore.reload()}}},failure:function(result,req){Wtf.Msg.alert("Error","Error in Connection")}})},deleteRequest:function(teamids){Wtf.Ajax.request({method:"POST",url:"jspfiles/admin/manageTeams.jsp",params:({action:4,teamids:teamids}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","Team doesn't exist or already has been deleted!")}else{if(nodeobj.success=="true"){Wtf.Msg.alert("Status","Record(s) deleted successfully!",function(btn){if(btn=="ok"){this.teamStore.reload()}},this)}}},failure:function(result,req){Wtf.Msg.alert("Error","Error in Connection")}})},insertUpdateTeam:function(){if(this.teamName.getValue()==""||this.teamName.getValue()==null){Wtf.Msg.alert("Invalid Name","Please enter a valid Team Name!",function(btn){if(btn=="ok"){return false}},this)}else{var action=2;if(this.teamWin.teamid){action=3}Wtf.Ajax.request({method:"POST",url:"jspfiles/admin/manageTeams.jsp",params:({action:action,moduleid:this.moduleid,name:this.teamName.getValue(),description:this.teamDesc.getValue(),teamid:this.teamWin.teamid}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","Save operation failed!",function(btn){if(btn=="ok"){this.teamWin.hide()}},this)}else{if(nodeobj.success=="true"){Wtf.Msg.alert("Status","Record saved successfully!",function(btn){if(btn=="ok"){this.teamWin.hide();this.teamStore.reload()}},this)}}},failure:function(result,req){Wtf.Msg.alert("Error","Error in Connection",function(btn){if(btn=="ok"){this.teamWin.hide()}},this)}})}},showTeamWindow:function(B,A,C){if(!this.teamWin){this.formPanel=new Wtf.FormPanel({labelWidth:70,labelAlign:"left",border:false,bodyStyle:"padding:5px 5px 0",layout:"form",anchor:"100%",defaultType:"textfield",buttonAlign:"right",items:[this.teamName=new Wtf.form.TextField({fieldLabel:"Name*",anchor:"99%",allowBlank:false}),this.teamDesc=new Wtf.form.TextArea({fieldLabel:"Description",width:"95.5%"})]});this.teamWin=new Wtf.Window({id:this.id+"_newTeamWin",width:400,teamid:null,resizable:false,closeAction:"hide",modal:true,title:"Team Details",buttons:[{anchor:"90%",id:this.id+"_saveBtn",text:"Save",handler:this.insertUpdateTeam,scope:this},{anchor:"90%",id:this.id+"_cancelBtn",text:"Cancel",handler:function(){this.teamName.setValue("");this.teamDesc.setValue("");this.teamWin.hide()},scope:this}],items:[this.formPanel]})}this.teamName.setValue("");this.teamDesc.setValue("");this.teamWin.teamid=B;if(B){this.teamName.setValue(A);this.teamDesc.setValue(C)}this.teamWin.show()}});var timeStr=null;var activecell="`";var x=null;var xy=null;var y=null;var counter=0;Wtf.DataView.DragSelector=function(H){H=H||{};var M,A,P,F;var J,G,C=new Wtf.lib.Region(0,0,0,0);var O=H.dragSafe===true;this.init=function(W){M=W;M.on("render",E)};function B(){J=[];M.all.each(function(W){J[J.length]=W.getRegion()});G=M.el.getRegion()}function Q(){return false}function V(W){return !O||W.target==M.el.dom}function S(W){M.on("containerclick",Q,M,{single:true});if(!P){P=M.el.createChild({cls:"x-view-selector"})}else{P.setDisplayed("block")}B();M.clearSelections()}function E(W){if(H.calDrag==true){F=new Wtf.dd.DragTracker({onBeforeStart:T,onStart:R,onDrag:N,onEnd:U})}else{F=new Wtf.dd.DragTracker({onBeforeStart:V,onStart:S,onDrag:L,onEnd:I})}F.initEl(W.el)}if(H.calDrag){var K=H.calContainer;function N(u){if(activecell.match("`")){var v=u.getTarget("td");if(v){activecell=v.id;xy=Wtf.get(activecell).getXY()}}else{xy=F.getXY()}var Z=activecell.split("_");var AA=F.startXY;var a=Wtf.get(activecell);if(a){var g=a.getWidth();if(x==null){x=Math.min(AA[0],xy[0])}y=Math.min(AA[1],xy[1]);var b=g;var s=Math.abs(AA[1]-xy[1]);C.left=x;C.top=y;C.right=x+b;C.bottom=y+s;var d=document.getElementById(activecell);var X=parseInt(Z[1])-1;var c=Wtf.get(K.id+K.currentview+"eventPanel").getHeight();var W=d.height;var Y=parseInt(W);Y=(Y*c)/100;var AB=(X+(s/(Y))-0.1).toPrecision("2");timeStr=X+1;C.constrainTo(G);P.setRegion(C);for(var n=0,o=J.length;n<o;n++){var f=J[n],l=C.intersect(f);if(l&&!f.selected){f.selected=true;M.select(n,true)}else{if(!l&&f.selected){f.selected=false;M.deselect(n)}}}}else{return false}}function U(f){f.stopPropagation();f.preventDefault();if(P){var v=0;var a=f.getTarget("td");if(a){var X=a.id;var w=X.indexOf("_");var c=X.lastIndexOf("_");var l=Wtf.get(P.id).getHeight();var g=Wtf.get(X).getHeight();var s=parseInt((l/g),10);var d=0;if(l>g){d=(g*s)+g}else{d=g}l=d;var u=X.split("_");var b=activecell.split("_");u[1]=parseInt(u[1],10);b[1]=parseInt(b[1],10);var Y=X.substring(w+1,c);if(b[1]>u[1]){v=activecell;activecell=X;X=v;v=1}Y=parseInt(Y)+1;if(v==0){timeStr+="-"+Y}else{timeStr=Y+"-"+timeStr}var Z=Wtf.get(activecell).getWidth();var n=Wtf.get(K.id+K.currentview+"eventPanel").getWidth();var o=Wtf.get(K.id+K.currentview+"eventPanel").getHeight();Z=(Z/n)*100-1;l=(l/o)*100;var W=[];P.setDisplayed(false);K.eventWin.showWindowWeek(activecell,timeStr,l,Z);timeStr=null;x=null}else{P.setDisplayed(false)}activecell="`"}P=null}function T(W){return !O||W.target==M.el.dom}function R(W){M.on("containerclick",Q,M,{single:true});if(!P){P=M.el.createChild({cls:"x-view-selector"})}else{P.setDisplayed("block")}B();M.clearSelections()}}else{if(H.calDrag==false){var D=H.contid;function L(d){var Y=Wtf.getCmp(D).containerPanel.editGrid;Y.dragFlag=true;var o=F.getXY();var f=F.startXY;var b=Wtf.get(D).getY();b+=Y.dragOffset;f[1]=b;var g=b;var l=Math.min(f[0],o[0]);var n=Math.abs(f[0]-o[0]);var a=10;C.left=l;C.top=g;C.right=l+n;C.bottom=g+a;C.constrainTo(G);P.setRegion(C);for(var Z=0,c=J.length;Z<c;Z++){var W=J[Z],X=C.intersect(W);if(X&&!W.selected){W.selected=true;M.select(Z,true)}else{if(!X&&W.selected){W.selected=false;M.deselect(Z)}}}}function I(c){if(P){var f=F.startXY;var W=Wtf.getCmp(D);var b=W.TaskminWidth;var d=Wtf.get(P.id).getRight(true);var Z=Wtf.get(P.id).getLeft(true);if((d-Z)>5){Z=parseInt(Z/b)*b;if((d/b)>parseInt(d/b)){d=parseInt(d/b)*b+b}else{d=parseInt(d/b)*b}var X=d-Z;var g=parseInt(Z/b);var a=new Date(W.StartDate);a=a.add(Date.DAY,(g));var Y=a.add(Date.DAY,parseInt(X/b)-1);W.fireEvent("insertProxyPanel",a,Y)}P.setDisplayed(false)}}}}};Wtf.cal.utils=function(){return{evtRec:Wtf.data.Record.create(["eid","cid","startts","endts","subject","descr","location","showas","priority","recpattern","recend","resources","timestamp","dbflag"]),calRec:Wtf.data.Record.create([{name:"cid"},{name:"cname"},{name:"description"},{name:"location"},{name:"timezone"},{name:"colorcode"},{name:"caltype"},{name:"isdefault"},{name:"userid"},{name:"timestamp"}]),tempCalRec:Wtf.data.Record.create([{name:"id"},{name:"state1"}]),HexToDec:function(A){return(parseInt(A,16).toString(10))},MultiplyInt:function(B,A){return Math.round(B*A)},getTimeIndNo:function(B,A){var D=[];B=B.toLowerCase();var C=B.split(" ");C[0]=C[0].split(":")[0];B=C[0]+C[1];if(B.indexOf("a")!=-1){D=B.split("am");if(D[0]==12){if(A){D[0]=24}else{D[0]=0}}}else{D=B.split("pm");if(D[0]!=12){D[0]=parseInt(D[0],10)+12}else{D[0]=12}}return D[0]},getHourStr:function(A){var B=[];if(A==24){B.push("12 ");B.push("AM")}else{if(A>12){B.push(A%12+" ");B.push("PM")}else{if(A==12){B.push("12 ");B.push("PM")}else{if(A==0){B.push("12 ");B.push("AM")}else{B.push(A+" ");B.push("AM")}}}}return B},getCalCtrl:function(){var A=Wtf.getCmp("as").getActiveTab();var B=null;if(A!=null){if(A.id=="ascalctrl"){B=Wtf.getCmp("ascalctrl")}else{B=Wtf.getCmp(A.id.substr(3)+"calctrl")}}return B},sqlToJsDate:function(B){if(B){var F;var A=B.lastIndexOf(".");if(A==-1){F=B}else{F=B.substring(0,A)}var E=F.split(" ");var C=E[0].split("-");var D=E[1].split(":");return(new Date(C[1]+"/"+C[2]+"/"+C[0]+" "+D[0]+":"+D[1]+":"+D[2]))}return null},findAndReplace:function(D,B,A){var C=D.find(B,A[0].data[B],0,false,true);if(C!=-1){D.remove(D.getAt(C))}D.add(A)},DateDiff:function(B,E){var D=typeof B;var F=0;if(D=="string"){var C=new Date();C=Date.parseDate(B,"d/m/Y");var A=new Date();A=Date.parseDate(E,"d/m/Y");var G=C.getTime()-A.getTime();F=Math.floor(G/1000/60/60/24)}else{E=E.clearTime(false);var G=B.getTime()-E.getTime();F=Math.floor(G/1000/60/60/24)}return(F)},ShowErrorMsgBox:function(A){msgBoxShow(["Invalid Input",A],Wtf.MessageBox.ERROR)},getPermissionLevel:function(C,D){var B="";var A=C.calTree.agendaStore.find("cid",D);if(A!=-1){B=C.calTree.agendaStore.getAt(A).data["permissionlevel"]}return B},HTMLScriptStripper:function(A){return Wtf.util.Format.stripTags(A)},getPermLevelByEid:function(D,A){var E="";var C="";var B=D.eStore.find("eid",A);if(B!=-1){E=D.eStore.getAt(B).data["cid"]}B=D.calTree.agendaStore.find("cid",E);if(B!=-1){C=D.calTree.agendaStore.getAt(B).data["permissionlevel"]}return C}}}();Wtf.form.ComboBox.country=[["ma","Malaysia"],["In","India"],["jp","Japan"],["US","America"]];Wtf.form.ComboBox.timezone=[["myt","(GMT+08:00)Malaysian Standard Time"],["ist","(GMT+05:30)Indian Standard Time"],["jst","(GMT+09:00)Japan Standard Time"],["hst","(GMT-10:00)Hawaii Standard Time"]];Wtf.form.ComboBox.dupdata=[["b","Busy"],["t","Tentative"],["o","Out of Office"]];Wtf.form.ComboBox.dupmark=[["h","High"],["m","Moderate"],["l","Low"]];Wtf.form.ComboBox.dupReminder=[["e","E-mail"],["p","Pop up"]];Wtf.form.ComboBox.dupReminTime=[["5","5 minutes"],["10","10 minutes"],["15","15 minutes"],["30","30 minutes"],["60","1 hour"],["120","2 hours"],["300","5 hours"],["720","12 hours"],["1440","1 day"],["2880","2 days"],["10080","1 week"]];Wtf.form.ComboBox.duptime=[[0,"12 AM"],[1,"1 AM"],[2,"2 AM"],[3,"3 AM"],[4,"4 AM"],[5,"5 AM"],[6,"6 AM"],[7,"7 AM"],[8,"8 AM"],[9,"9 AM"],[10,"10 AM"],[11,"11 AM"],[12,"12 PM"],[13,"1 PM"],[14,"2 PM"],[15,"3 PM"],[16,"4 PM"],[17,"5 PM"],[18,"6 PM"],[19,"7 PM"],[20,"8 PM"],[21,"9 PM"],[22,"10 PM"],[23,"11 PM"]];Wtf.form.ComboBox.resourcename=[["1","Make changes to events"],["2","See all the events details"]];Wtf.cal.eventForms=function(A){this.parent=A;Wtf.cal.eventForms.superclass.constructor.call(this)};Wtf.extend(Wtf.cal.eventForms,Wtf.Component,{AddRecurring:function(){if(Wtf.isGecko==true){h=150}if(Wtf.isIE==true){h=130}win1=new Wtf.Window({id:this.parent.id+"Recurring",title:"Recurring",closable:true,width:240,height:350,resizable:false,modal:true,plain:true,layout:"fit",items:[{xtype:"form",frame:true,border:false,hideBorders:true,items:[{xtype:"fieldset",title:"Recurring Pattern",height:h,items:[{items:[{xtype:"radio",hideLabel:"true",checked:true,id:this.parent.id+"Daily",boxLabel:"Daily",name:"group1",value:"Daily"},{layout:"column",items:[{columnWidth:0.4,items:[{xtype:"radio",id:this.parent.id+"Weekly",hideLabel:"true",boxLabel:"Weekly , ",name:"group1",value:"Weekly"}]},{columnWidth:0.6,items:[{xtype:"textfield",id:this.parent.id+"weekTextBox",width:25}],html:"<label class='labelAlign'> week(s)</label>"}]},{xtype:"radio",hideLabel:"true",id:this.parent.id+"Monthly",boxLabel:"Monthly",name:"group1",value:"Monthly"},{xtype:"radio",hideLabel:"true",id:this.parent.id+"Yearly",boxLabel:"Yearly",name:"group1",value:"Yearly"}]}]},{xtype:"fieldset",title:"End of Recurrence",height:100,items:[{items:[{xtype:"radio",hideLabel:"true",checked:true,id:this.parent.id+"noEnd",boxLabel:"No end",name:"group2",value:"noEnd"},{layout:"column",items:[{columnWidth:0.4,items:[{xtype:"radio",hideLabel:"true",id:this.parent.id+"EndBy",boxLabel:"End by",name:"group2",value:"EndBy"}]},{columnWidth:0.6,labelWidth:50,items:[new Wtf.form.DateField({editable:false,hideLabel:true,format:Wtf.getDateFormat(),id:this.parent.id+"edate2"})]}]}]}]}]}],buttons:[{id:this.parent.id+"OkButton",handler:this.RecurrsionOK,scope:this,text:"OK"},{id:this.parent.id+"CancelButton",handler:this.RecurrsionCancel,scope:this,text:"Cancel"}]});win1.show();if(this.parent.rec[0]!=undefined&&this.parent.rec[0]!=""){Wtf.getCmp(this.parent.id+this.parent.rec[0]).setValue(1);if(this.parent.rec[0]=="Weekly"){Wtf.getCmp(this.parent.id+"weekTextBox").setValue(this.parent.rec[1])}}if(this.parent.rec[2]!=undefined&&this.parent.rec[2]!=""){Wtf.getCmp(this.parent.id+this.parent.rec[2]).setValue(1);if(this.parent.rec[2]=="EndBy"){Wtf.getCmp(this.parent.id+"edate2").setValue(this.parent.rec[3])}}},oncheck1:function(A,B){if(B.checked==true){Wtf.get(this.id+"timeRight").hide()}if(B.checked==false){Wtf.get(this.id+"timeRight").show()}},oncheck2:function(A,B){if(B.checked==true){}else{for(i=0;i<4;i++){this.parent.rec[i]=""}}},AddEditToolbar:function(){this.parent.add(new Wtf.Panel({border:false,layout:"fit",id:this.parent.id+"Appointmentform"}))},deleteGuest:function(E){var B=Wtf.getCmp(this.parent.id+"guestGrid");var A=B.getSelectionModel();var C=A.getSelections();var D=B.getStore();Wtf.MessageBox.confirm("Confirm Delete","Are you sure you want to delete?",function(F){if(F=="yes"){D.remove(C[0])}})},clearAppointmentValues:function(){Wtf.getCmp(this.parent.id+"Subject").setValue("");Wtf.getCmp(this.parent.id+"Location").setValue("");Wtf.getCmp(this.parent.id+"stime1").setValue("");Wtf.getCmp(this.parent.id+"etime1").setValue("");Wtf.getCmp(this.parent.id+"sdate1").setValue("");Wtf.getCmp(this.parent.id+"edate1").setValue("");Wtf.getCmp(this.parent.id+"Description").setValue("");Wtf.getCmp(this.parent.id+"showas").setValue("b");Wtf.getCmp(this.parent.id+"comboPriority").setValue("m");Wtf.getCmp(this.parent.id+"Resources").setValue("");var A=Wtf.getCmp(this.parent.id+"guestGrid");A.getStore().removeAll();for(var B=0;B<5;B++){if(Wtf.getCmp(this.parent.id+"MainRemindPanel"+B)!=undefined){Wtf.getCmp(this.parent.id+"MainRemindPanel"+B).destroy()}Wtf.getCmp(this.parent.id+"ReminderButton").enable()}},AddingTabPanelEvent:function(){var F;this.parent.hideMaintoolbar();this.parent.showFormtoolbar();this.parent.formview="Appointmentform";var D=Wtf.getCmp(this.parent.id+"Appointmentform");if(!D||!this.parent.apptForm){this.AddEditToolbar();D=Wtf.getCmp(this.parent.id+"Appointmentform");this.parent.showCalPanel(D)}else{this.parent.showCalPanel(D);this.clearAppointmentValues();return }this.guestRecord=Wtf.data.Record.create([{name:"username"},{name:"userid"},{name:"emailid"},{name:"response"},{name:"delmail"}]);this.dsGuest=new Wtf.data.Store({reader:new Wtf.data.ArrayReader({},this.guestRecord)});var B=new Wtf.grid.ColumnModel([{header:"Name",dataIndex:"username",mapping:"username"},{header:"user Id",dataIndex:"userid",mapping:"userid",hidden:true},{header:"Email Id",dataIndex:"emailid",mapping:"emailid"},{header:"Response",dataIndex:"response",mapping:"response"},{header:"Delete",width:40,renderer:this.delmail,dataIndex:"delmail"}]);var C=new Wtf.grid.RowSelectionModel();var E=new Wtf.grid.GridPanel({ds:this.dsGuest,id:this.parent.id+"guestGrid",cm:B,sm:C,height:190,width:"100%",viewConfig:{forceFit:true}});var A;if(Wtf.isGecko){A=150}if(Wtf.isIE){A=140}Wtf.getCmp(this.parent.id+"Appointmentform").add(tabpanel=new Wtf.TabPanel({id:this.parent.id+"tabPanel",border:false,deferredRender:true,activeTab:0,items:[{title:"Event",id:this.parent.id+"Appointment",autoScroll:true,bodyStyle:"position: relative;",border:false,layout:"column",frame:true,items:[new Wtf.Panel({frame:true,border:false,columnWidth:0.65,height:440,items:[{xtype:"form",title:"Event Details",items:[{xtype:"fieldset",id:this.parent.id+"detailsDiv",title:"Details",height:85,labelWidth:65,items:[{xtype:"textfield",fieldLabel:"Subject*",allowBlank:false,id:this.parent.id+"Subject",width:"97%"},{layout:"column",items:[{columnWidth:0.4999,labelWidth:65,layout:"form",items:[new Wtf.form.ComboBox({fieldLabel:"Show As",id:this.parent.id+"showas",store:this.parent.eventWin.storeShowas,displayField:"state1",value:"b",editable:false,typeAhead:true,valueField:"abbr1",mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"98%"})]},{columnWidth:0.4999,labelWidth:65,layout:"form",items:[new Wtf.form.ComboBox({fieldLabel:"Priority",value:"m",id:this.parent.id+"comboPriority",store:this.parent.eventWin.store4,editable:false,valueField:"abbr",displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"98%"})]}]}]},{xtype:"fieldset",title:"Time",height:A,items:[{layout:"column",items:[{columnWidth:0.9,layout:"form",items:[new Wtf.form.Checkbox({id:this.parent.id+"CheckAllDay1",boxLabel:"All day event",hideLabel:true,disabled:true})]},{columnWidth:0.4999,labelWidth:65,layout:"form",items:[new Wtf.form.DateField({fieldLabel:"Start Date",format:Wtf.getDateFormat(),readOnly:true,id:this.parent.id+"sdate1",anchor:"98%"}),new Wtf.form.DateField({format:Wtf.getDateFormat(),readOnly:true,fieldLabel:"End Date",id:this.parent.id+"edate1",anchor:"98%"})]},{columnWidth:0.4999,labelWidth:65,id:this.parent.id+"timeRight",layout:"form",items:[new Wtf.form.ComboBox({fieldLabel:"Start Time",id:this.parent.id+"stime1",store:this.parent.eventWin.store3,editable:false,displayField:"state1",typeAhead:true,valueField:"abbr1",mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"98%"}),new Wtf.form.ComboBox({fieldLabel:"End Time",id:this.parent.id+"etime1",store:this.parent.eventWin.store3,editable:false,displayField:"state1",valueField:"abbr1",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"98%"})]},{columnWidth:0.9,layout:"column"}]}]},{xtype:"fieldset",title:"Other Details",labelWidth:70,height:A,items:[{xtype:"textarea",fieldLabel:"Description",id:this.parent.id+"Description",width:"97%"},{xtype:"textfield",fieldLabel:"Location",id:this.parent.id+"Location",width:"97%"},{xtype:"textfield",fieldLabel:"Resources",id:this.parent.id+"Resources",width:"97%"}]}]}]}),{columnWidth:0.35,layout:"border",height:440,items:[new Wtf.Panel({autoHeight:true,title:"Guests",region:"north",layout:"fit",items:E,tbar:[{text:"Add guests",id:this.parent.id+"AddAction1",iconCls:"add",handler:this.AddGuest,scope:this}]}),new Wtf.Panel({height:195,title:"Reminder",frame:true,region:"center",border:true,items:[{xtype:"form",border:true,tbar:[{text:"Add Reminder",id:this.parent.id+"ReminderButton",iconCls:"add",scope:this,handler:this.AddingReminder}],items:[new Wtf.Panel({border:false,cls:"reminderDiv",id:this.parent.id+"RemainderPanel"})]}]})]}]}]}));this.parent.doLayout();this.parent.apptForm=tabpanel;Wtf.getCmp(this.parent.id+"edate1").disable();Wtf.get(this.parent.id+"CheckAllDay1").addListener("click",this.oncheck1,this)},TabChangeFun:function(B,A){if(A.id==this.parent.id+"schedule"){this.parent.doLayout()}},SaveGuests:function(){var A=this.grid.getSelections();this.dsGuest.removeAll();for(i=0;i<A.length;i++){if(this.dsGuest.find("userid",A[i].get("userid"))==-1){var C=new this.guestRecord({username:A[i].get("username"),userid:A[i].get("userid"),emailid:A[i].get("emailid"),response:A[i].get("response")});this.dsGuest.add(C);Wtf.get("_delGuest").on("click",this.deleteGuest,this)}}var B=Wtf.getCmp("contactsview");B.contactStore.rejectChanges();this.CloseWindow()},CloseWindow:function(){this.win.close()},delmail:function(){return("<img src='images/Delete.gif'  id=_delGuest title='Delete Person' class='xbtn'></img>")},AddGuest:function(){var H=new Wtf.grid.CheckboxSelectionModel();var F=Wtf.getCmp("contactsview");var A=new Wtf.grid.ColumnModel([H,{header:"Contact Name",dataIndex:"username"},{header:"user id",dataIndex:"userid",hidden:true},{header:"Email-Id",dataIndex:"emailid"},{header:"Response",dataIndex:"response",hidden:true}]);A.defaultSortable=true;this.grid=new Wtf.grid.GridPanel({ds:F.contactStore,cm:A,sm:H,headerStyle:"background-color: rgb(231,240,250) ",viewConfig:{forceFit:true}});this.win=new Wtf.Window({id:this.parent.id+"_Addguest",title:"Add guest",closable:true,width:300,height:400,modal:true,resizable:false,plain:true,renderTo:document.body,layout:"fit",items:this.grid,buttons:[{text:"Save",id:this.parent.id+"Save"},{text:"Cancel",id:this.parent.id+"cancelGuest"}]});this.win.show();var B=Wtf.getCmp(this.parent.id+"guestGrid");var D=B.getStore();for(i=0;i<D.getCount();i++){var E=F.contactStore.find("userid",D.getAt(i).get("userid"));if(E!=-1){H.selectRow(E,true);var G=F.contactStore.getAt(E);var C=D.getAt(i).get("response");G.set("response",C)}}Wtf.get(this.parent.id+"Save").on("click",this.SaveGuests,this);Wtf.get(this.parent.id+"cancelGuest").on("click",this.CloseWindow,this)},AddingReminder:function(E,C,F){if(E!=1){C="e";F="5"}this.parent.Calendar_countReminder++;var A=0;for(A=0;A<5;A++){if(Wtf.getCmp(this.parent.id+"MainRemindPanel"+A)==undefined){break}}if(this.parent.Calendar_countReminder==5){Wtf.getCmp(this.parent.id+"ReminderButton").disable()}var D=new Wtf.Panel({border:false,id:this.parent.id+"MainRemindPanel"+A,layout:"column",items:[{columnWidth:0.45,layout:"form",items:[new Wtf.form.ComboBox({id:this.parent.id+"PopupCombo"+A,hideLabel:true,store:this.parent.eventWin.storeReminder,editable:false,displayField:"state1",valueField:"abbr1",typeAhead:true,mode:"local",value:C,triggerAction:"all",selectOnFocus:true,anchor:"95%"})]},{columnWidth:0.45,layout:"form",items:[new Wtf.form.ComboBox({hideLabel:true,id:this.parent.id+"ReminderEndTime"+A,store:this.parent.eventWin.storereminderTime,valueField:"abbr1",editable:false,displayField:"state1",typeAhead:true,mode:"local",value:F,triggerAction:"all",selectOnFocus:true,anchor:"95%"})]},{columnWidth:0.1,layout:"form",items:[new Wtf.Panel({border:false,id:this.parent.id+"_RemoveReminderPanel_"+A})]}]});Wtf.getCmp(this.parent.id+"RemainderPanel").add(D);Wtf.getCmp(this.parent.id+"RemainderPanel").doLayout();var B=document.getElementById(this.parent.id+"_RemoveReminderPanel_"+A);B.innerHTML="<span id="+this.parent.id+"_button_"+A+" class ='AddReminderClass'><img src = 'images/Cancel.gif' height = '16px' width = '16px'/></span>";Wtf.get(B).addListener("click",this.RemoveReminder)},RemoveReminder:function(C){var A=this.id.split("_");Wtf.getCmp(A[0]+"MainRemindPanel"+A[2]).destroy();var B=Wtf.getCmp(A[0]);B.Calendar_countReminder--;if(B.Calendar_countReminder<5){Wtf.getCmp(A[0]+"ReminderButton").enable()}},AddingEventValues:function(a,eventClick){this.parent.EventClick=eventClick;this.parent.calPerm=Wtf.cal.utils.getPermissionLevel(this.parent,a[13]);this.parent.dbflag=a[14];if(this.parent.calPerm!=""&&this.parent.calPerm>1){Wtf.getCmp(this.parent.id+"SaveAction1").disable();Wtf.getCmp(this.parent.id+"deleteEventClick").disable()}else{if(a[14]=="true"){Wtf.getCmp(this.parent.id+"SaveAction1").enable();Wtf.getCmp(this.parent.id+"deleteEventClick").enable()}else{Wtf.getCmp(this.parent.id+"SaveAction1").disable();Wtf.getCmp(this.parent.id+"deleteEventClick").disable()}}Wtf.getCmp(this.parent.id+"Subject").setValue(a[0]);Wtf.getCmp(this.parent.id+"Location").setValue(a[1]);Wtf.getCmp(this.parent.id+"stime1").setValue(a[2]);Wtf.getCmp(this.parent.id+"etime1").setValue(a[3]);Wtf.getCmp(this.parent.id+"sdate1").setValue(a[4]);Wtf.getCmp(this.parent.id+"edate1").setValue(a[5]);Wtf.getCmp(this.parent.id+"Description").setValue(a[6]);Wtf.getCmp(this.parent.id+"showas").setValue(a[7]);Wtf.getCmp(this.parent.id+"comboPriority").setValue(a[8]);if(a[9]==""&&a[10]==this.parent.defaultTS){}else{var checkpattern=a[9].substring(0,1);if(checkpattern=="D"){this.parent.rec[0]="Daily";this.parent.rec[1]=""}else{if(checkpattern=="W"){this.parent.rec[0]="Weekly";this.parent.rec[1]=a[9].substring(1,3)}else{if(checkpattern=="M"){this.parent.rec[0]="Monthly";this.parent.rec[1]=""}else{if(checkpattern=="Y"){this.parent.rec[0]="Yearly";this.parent.rec[1]=""}}}}if(a[10]==this.parent.defaultTS){this.parent.rec[2]="noEnd";this.parent.rec[3]=""}else{this.parent.rec[2]="EndBy";this.parent.rec[3]=a[12]}}Wtf.getCmp(this.parent.id+"Resources").setValue(a[11]);if(this.parent.EventClick!=""){var eid;if(this.parent.currentview!="agendaView"){eid=this.parent.EventClick.split("e_")[1]}else{eid=this.parent.EventClick}Wtf.Ajax.request({url:Wtf.req.cal+"calEvent.jsp",method:"POST",params:({action:4,eid:eid}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");var Grid=Wtf.getCmp(this.parent.id+"guestGrid");var guestStore=Grid.getStore();var guestRecord=Wtf.data.Record.create([{name:"username"},{name:"userid"},{name:"emailid"},{name:"response"},{name:"delmail"}]);var contacts=Wtf.getCmp("contactsview");for(var i=0;i<nodeobj.data.length;i++){var contactCheck=contacts.contactStore.find("userid",nodeobj.data[i].userid);if(contactCheck!=-1){var statusfield;if(nodeobj.data[i].status=="p"){statusfield="Awaiting"}else{if(nodeobj.data[i].status=="r"){statusfield="Rejected"}else{if(nodeobj.data[i].status=="a"){statusfield="Accepted"}}}var p=new guestRecord({username:contacts.contactStore.getAt(contactCheck).get("username"),userid:contacts.contactStore.getAt(contactCheck).get("userid"),emailid:contacts.contactStore.getAt(contactCheck).get("emailid"),response:statusfield});guestStore.add(p);Wtf.get("_delGuest").on("click",this.deleteGuest,this)}}for(var i=0;i<nodeobj.Data1.data.length;i++){var remtype=nodeobj.Data1.data[i].rtype;var remtime=nodeobj.Data1.data[i].rtime;this.AddingReminder(1,remtype,remtime)}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}},AddingValue:function(A){Wtf.getCmp(this.parent.id+"Subject").setValue(A[0]);Wtf.getCmp(this.parent.id+"sdate1").setValue(A[1]);Wtf.getCmp(this.parent.id+"edate1").setValue(A[2]);Wtf.getCmp(this.parent.id+"stime1").setValue(A[3]);Wtf.getCmp(this.parent.id+"etime1").setValue(A[4]);Wtf.getCmp(this.parent.id+"Location").setValue(A[5]);Wtf.getCmp(this.parent.id+"comboPriority").setValue(A[7]);Wtf.getCmp(this.parent.id+"showas").setValue(A[6]);if(A[8]!="none"&&A[8]!=""){this.AddingReminder(1,A[8],A[9])}},RecurrsionOK:function(){var D=Wtf.getCmp(this.parent.id+"Daily").getValue();var C=Wtf.getCmp(this.parent.id+"Weekly").getValue();var H=Wtf.getCmp(this.parent.id+"Monthly").getValue();var G=Wtf.getCmp(this.parent.id+"Yearly").getValue();var F=Wtf.getCmp(this.parent.id+"noEnd").getValue();var E=Wtf.getCmp(this.parent.id+"EndBy").getValue();if(E==true){if(Wtf.getCmp(this.parent.id+"edate2").getValue()==""){Wtf.Msg.alert("Error","Please enter the valid end date for recurrence!");return }}if(C==true){var B=Wtf.getCmp(this.parent.id+"weekTextBox").getValue();B=Wtf.cal.utils.HTMLScriptStripper(B);var A=this.IsNum(B);if(A==false){Wtf.Msg.alert("Error","Please enter the no. of week(s) for recurrence!");return }this.parent.rec[0]="Weekly";this.parent.rec[1]=B}else{if(D==true){this.parent.rec[0]="Daily";this.parent.rec[1]=""}else{if(H==true){this.parent.rec[0]="Monthly";this.parent.rec[1]=""}else{if(G==true){this.parent.rec[0]="Yearly";this.parent.rec[1]=""}}}}if(F==true){this.parent.rec[2]="noEnd";this.parent.rec[3]=""}else{if(E==true){this.parent.rec[2]="EndBy";this.parent.rec[3]=Wtf.getCmp(this.parent.id+"edate2").getValue()}}Wtf.getCmp(this.parent.id+"Recurring").close()},IsNum:function(A){var B;if(A==""){B=false}else{B=(!isNaN(A))}return B},RecurrsionCancel:function(){Wtf.getCmp(this.parent.id+"Recurring").close()}});Wtf.calStore=function(){Wtf.calStore.superclass.constructor.call(this,{remoteSort:true,proxy:new Wtf.data.HttpProxy({url:Wtf.req.cal+"calEvent.jsp"}),reader:new Wtf.data.JsonReader({root:"data",id:"jsonReader"},["eid","cid","startts","endts","subject","descr","location","showas","priority","recpattern","recend","resources","timestamp","dbflag"])})};Wtf.extend(Wtf.calStore,Wtf.data.Store,{findRec:function(H,F,C){var B=[];var D=0;if(this.getCount()){var E;for(var G=0;G<F[0].length;G++){E=[F[0][G]];for(var A=1;A<F.length;A++){E[A]=F[A]}this.queryBy(function(I){for(var J=0;J<E.length;J++){if(C[J]==0){if(!(I.data[H[J]]==E[J])){return false}}else{if(C[J]==1){if(!(I.data[H[J]]>E[J])){return false}}else{if(C[J]==2){if(!(I.data[H[J]]<E[J])){return false}}else{if(C[J]==3){if(!(I.data[H[J]]>=E[J])){return false}}else{if(C[J]==4){if(!(I.data[H[J]]<=E[J])){return false}}}}}}}B[D++]=I;return true},this)}}return B},checkAndAdd:function(A,B){A.each(function(D){var C=this.find(B,D.data[B],0,false,true);if(C!=-1){this.remove(this.getAt(C))}this.add(D)},this)},updateStore:function(C,D,A){var B=this.find(C,D[0].data[C],0,false,true);if(B!=-1){this.remove(this.getAt(B));this.add(D)}}});Wtf.cal.eventWindow=function(A){this.activeCells;this.timeString;this.heighttoevent;this.widthtoevent;this.parent=A;this.store4=new Wtf.data.SimpleStore({fields:["abbr","state"],data:Wtf.form.ComboBox.dupmark});this.store3=new Wtf.data.SimpleStore({fields:["abbr1","state1"],data:Wtf.form.ComboBox.duptime});this.storeReminder=new Wtf.data.SimpleStore({fields:["abbr1","state1"],data:Wtf.form.ComboBox.dupReminder});this.storereminderTime=new Wtf.data.SimpleStore({fields:["abbr1","state1"],data:Wtf.form.ComboBox.dupReminTime});this.storeShowas=new Wtf.data.SimpleStore({fields:["abbr1","state1"],data:Wtf.form.ComboBox.dupdata});this.id="window_"+this.parent.id;Wtf.cal.eventWindow.superclass.constructor.call(this)};Wtf.extend(Wtf.cal.eventWindow,Wtf.Component,{CancelfuncWeek:function(){Wtf.getCmp(this.parent.id+"OtherWinShow").hide()},OkfuncWeek:function(){var J=Wtf.get(this.parent.id+"subjectweek").getValue();var E=(Wtf.getCmp(this.parent.id+"sdateweek").getValue()).format("Y-m-d");var F=Wtf.getCmp(this.parent.id+"Showasweek").getValue();var K=Wtf.getCmp(this.parent.id+"priorityweek").getValue();var H=Wtf.getCmp(this.parent.id+"Reminderweek").getValue();var D=Wtf.getCmp(this.parent.id+"ReminderTimeweek").getValue();if(H!=""&&H!="none"){if(D!="----------"){H+="_"+D}else{Wtf.cal.utils.ShowErrorMsgBox("Please select Time interval");return false}}else{H=""}if(J==""){Wtf.cal.utils.ShowErrorMsgBox("Please enter the required fields");return false}cid=Wtf.getCmp(this.parent.id+"calendarweek").getValue();var A=Wtf.getCmp(this.parent.id+"stimeweek").getValue();var B=Wtf.getCmp(this.parent.id+"etimeweek").getValue();var L=parseInt(A);var G=parseInt(B);if(L>=G){Wtf.cal.utils.ShowErrorMsgBox("Please enter a valid start time & end time ");return }Wtf.getCmp(this.parent.id+"OtherWinShow").hide();if(A.length==1){A="0"+A}if(B.length==1){B="0"+B}var I=Wtf.get(this.parent.id+"locationweek").getValue();I=Wtf.cal.utils.HTMLScriptStripper(I);if(!I||I=="undefined"){I=""}var C=["0",cid,E+" "+A+":00:00.00",E+" "+B+":00:00.00",J,"",I,F,K,"",this.parent.defaultTS,"","",H];this.parent.insertEvent(C)},closeEvent:function(B){var A=this.id;Wtf.MessageBox.confirm("Confirm Delete","Are you sure you want to delete the event?",function(F){if(F=="yes"){A=A.split("close_");var C=Wtf.getCmp(A[0]+"e_"+A[1]);var G=Wtf.getCmp(A[0]);var E=null;var D=G.eStore.find("eid",A[1]);if(D!=-1){E=G.eStore.getAt(D).data["cid"]}var H=[A[1],E];C.destroy();G.deleteEvent(H,"0")}})},eventHtmlStr:function(B,C,A,F){var E="";var D=this.parent.id;E+="<div id="+this.parent.id+"wrapper_"+B+" style='width: 100%; height: 15px;'>";E+="<span class=titleDiv id="+this.parent.id+"title_"+B+" style='font-size:smaller; height:15px; float: left; margin-left:1px;' wtf:qtip='"+C+"' wtf:qtitle='"+A+"'>"+C+"</span>";E+="<div class=closeDiv id="+this.parent.id+"close_"+B+" style='float: right; height:15px; display: none;' ><img id="+this.parent.id+"calImg_"+B+" style='height:11px;' src='images/deleteLink.gif' alt='Delete'/></div></div>";E+="<div class=textDiv id="+this.parent.id+"text_"+B+" style='clear: both; height:100%; padding:1 1 1 1;' wtf:qtip='"+C+"' wtf:qtitle='"+A+"'>"+A+"</div>";return(E)},showIcon:function(){var A=this.id.split("e_");Wtf.get(A[0]+"close_"+A[1]).dom.style.display="block";Wtf.get(A[0]+"text_"+A[1]).dom.style.textDecoration="underline"},hideIcon:function(){var A=this.id.split("e_");Wtf.get(A[0]+"close_"+A[1]).dom.style.display="none";Wtf.get(A[0]+"text_"+A[1]).dom.style.textDecoration="none"},createEventCell:function(A,J,D,O,I,L,C,H,K){var B=false;var G=Wtf.cal.utils.getPermissionLevel(this.parent,C);if(G==""||G==1){if(K=="true"){B=true}}var F=new Wtf.Panel({id:this.parent.id+"e_"+A,baseCls:"dummyclass",html:this.eventHtmlStr(A,D,O),height:I,width:L+"%",cls:"innerPanel",border:true,cellId:J.id,style:"z-index:1000;position:absolute;border:1px solid; cursor:pointer;",ts:H,editable:B});var N=J.getXY();F.setPagePosition(N[0]+3,N[1]);F.render(this.parent.id+this.parent.currentview+"eventPanel");if(B){var M=new Wtf.Resizable(F.id,{id:this.parent.id+"r_"+A,height:I,width:L+"%",border:true,transparent:true,heightIncrement:Wtf.fixHeight,minHeight:Wtf.fixHeight,handles:"n s"});M.on("resize",this.resizeEvent);F.el.addListener("mouseover",this.showIcon);F.el.addListener("mouseout",this.hideIcon);Wtf.get(this.parent.id+"close_"+A).addListener("click",this.closeEvent);this.parent.addDragCmp(F.id,true)}F.el.addListener("dblclick",this.showEventDetails);F.el.dom.style.position="absolute";F.el.dom.style.color="white";F.el.dom.setAttribute("Name",C);var E=this.parent.CheckforChecked(C);if(E==false){this.parent.HidingOtherSingleEvent(this.parent.id+"e_"+A)}this.parent.ChangingOtherSingleEventColor(C,this.parent.id+"e_"+A);return F},showEventDetails:function(E){E.preventDefault();E.stopPropagation();var I=this.id.split("e_");var C=Wtf.getCmp(I[0]);if(I[1]&&C.eStore&&C.eStore.getCount()){var B=C.eStore.find("eid",I[1]);var H=null;if(B!=-1){H=C.eStore.getAt(B)}if(H){var A=new Date(Wtf.cal.utils.sqlToJsDate(H.data["startts"]));var D=new Date(Wtf.cal.utils.sqlToJsDate(H.data["endts"]));var G=[];G[0]=H.data["subject"];G[1]=H.data["location"];var F=A.format("i");if(F&&F!="00"){G[2]=A.format("g:i A");G[3]=D.format("g:i A")}else{G[2]=A.format("G");G[3]=D.format("G")}G[4]=A;G[5]=D;G[6]=H.data["descr"];G[7]=H.data["showas"];G[8]=H.data["priority"];G[9]=H.data["recpattern"];G[10]=H.data["recend"];if(H.data["recend"]!=""){G[10]=(Wtf.cal.utils.sqlToJsDate(H.data["recend"])).format("Y-m-d 00:00:00");var J=new Date(Wtf.cal.utils.sqlToJsDate(H.data["recend"]));G[12]=J}else{G[10]=C.defaultTS}G[11]=H.data["resources"];G[13]=H.data["cid"];G[14]=H.data["dbflag"];C.RemoveMainPanelContent();eventobj=new Wtf.cal.eventForms(C);eventobj.AddingTabPanelEvent();eventobj.AddingEventValues(G,this.id)}else{Wtf.Msg.alert("Invalid Event","Event doesn't exist!");this.destroy()}}},resizeEvent:function(J){var L=J.el;var C=L.getHeight()/Wtf.fixHeight;var B=L.dom.getElementsByTagName("span");L=B[0].innerHTML;var A=L.split("-");var K=new Date();var N=this.id.split("r_");var H=Wtf.getCmp(N[0]);var O=H.eStore.find("eid",N[1]);if(this.activeHandle.position=="south"){K=Date.parseDate(A[0],"g:i A");K=K.add(Date.HOUR,C);if(O!=-1){var G=H.eStore.getAt(O);var E=Wtf.cal.utils.sqlToJsDate(G.data["endts"].toString());E=E.format("Y-m-d");var D=K.format("H");var I=[];var F=[G.data["eid"],G.data["cid"],G.data["startts"],E+" "+D+":00:00.0",G.data["subject"],G.data["descr"],G.data["location"],G.data["showas"],G.data["priority"],G.data["recpattern"],G.data["recend"],G.data["resources"],"","",0];H.updateEvent(F,"0")}}else{K=Date.parseDate(A[1],"g:i A");K=K.add(Date.HOUR,-C);if(O!=-1){var G=H.eStore.getAt(O);var M=Wtf.cal.utils.sqlToJsDate(G.data["startts"].toString());M=M.format("Y-m-d");var D=K.format("H");var I=[];var F=[G.data["eid"],G.data["cid"],M+" "+D+":00:00.0",G.data["endts"],G.data["subject"],G.data["descr"],G.data["location"],G.data["showas"],G.data["priority"],G.data["recpattern"],G.data["recend"],G.data["resources"],"","",0];H.updateEvent(F,"0")}}},getDateAndValue:function(G,H,A){var E=H;var F=A;var J=G.target.id.split("Day1");if(!J[1]){J=G.target.parentNode.id.split("Day1");if(!J[1]){return null}}var B=J[1].split("/");var C;if(!B[1]){C=Date.parseDate(B[0]+"/"+E+"/"+F,"d/n/Y");this.parent.changeCalDate(C)}else{if(B[1]<E){if(B[1]==1&&E==12){E=B[1];F++}else{E--}}else{if(B[1]==12&&E==1){E=B[1];F--}else{E++}}C=new Date();C=Date.parseDate(F+"-"+E+"-"+B[0],"Y-n-j");this.parent.RemoveMainPanelContent();this.parent.changeCalDate(C);this.parent.RemoveDiv();this.parent.AddMonth();var I=this.parent.calendar.getValue();var D=Wtf.getCmp(this.parent.id+"dateText1");D.setText(Date.monthNames[I.getMonth()]+" "+I.getFullYear());this.parent.seldate=I;this.parent.onCalViewChange()}return C},showWindowWeek:function(E,J,D,K){var I=Wtf.getCmp(this.parent.id+"OtherWinShow");if(!I||!this.parent.weekWin){var F=340;if(Wtf.isIE==true){F=374}var L=this.getTopFormPanel();var A=this.getCenterFormPanel(t,t);var G=this.getBottomFormPanel();var H=new Wtf.Window({title:"Create Event",id:this.parent.id+"OtherWinShow",closable:true,cls:"fontstyle",resizable:false,modal:true,width:400,height:F,layout:"border",items:[L,A,G],closeAction:"hide",buttons:[{cls:"padd",text:"Add More Details",id:this.parent.id+"addDetailsweek"},{text:"OK",id:this.parent.id+"okweek"},{text:"Cancel",id:this.parent.id+"cancelweek"}]});H.show();Wtf.getCmp(this.parent.id+"CheckAllDayweek").disable();Wtf.getCmp(this.parent.id+"edateweek").disable();Wtf.get(this.parent.id+"cancelweek").addListener("click",this.CancelfuncWeek,this);Wtf.get(this.parent.id+"addDetailsweek").addListener("click",this.addDetailsForm1,this);Wtf.get(this.parent.id+"okweek").addListener("click",this.OkfuncWeek,this);var B=Wtf.get(this.parent.id+"CheckAllDayweek").addListener("click",this.oncheck,this);this.parent.weekWin=H}else{I.show()}var C=this.parent.calendar.getValue();if(this.parent.currentview==("WeekView")){var M=E.split("_");M=parseInt(M[2],10);M=M-C.format("w");C=C.add(Date.DAY,M)}else{if(this.parent.currentview==("WorkWeekView")){var M=E.split("_");M=parseInt(M[2],10);M++;M=M-C.format("w");C=C.add(Date.DAY,M)}}this.activeCells=E;this.timeString=J;this.heighttoevent=D;this.widthtoevent=K;J=J.split("-");if(J[1]==24){J[1]=0}Wtf.getCmp(this.parent.id+"calendarweek").setValue(this.parent.tempCalStore.getAt(0).data["id"]);Wtf.getCmp(this.parent.id+"subjectweek").setValue("");Wtf.getCmp(this.parent.id+"locationweek").setValue("");Wtf.getCmp(this.parent.id+"sdateweek").setValue(C);Wtf.getCmp(this.parent.id+"edateweek").setValue(C);Wtf.getCmp(this.parent.id+"stimeweek").setValue(J[0]);Wtf.getCmp(this.parent.id+"etimeweek").setValue(J[1]);Wtf.getCmp(this.parent.id+"Showasweek").setValue("b");Wtf.getCmp(this.parent.id+"priorityweek").setValue("m");Wtf.getCmp(this.parent.id+"Reminderweek").setValue("none");Wtf.getCmp(this.parent.id+"ReminderTimeweek").setValue("----------")},addDetailsForm1:function(){var A=[];A[0]=Wtf.get(this.parent.id+"subjectweek").getValue();A[1]=Wtf.get(this.parent.id+"sdateweek").getValue();A[2]=Wtf.get(this.parent.id+"edateweek").getValue();A[3]=Wtf.getCmp(this.parent.id+"stimeweek").getValue();A[4]=Wtf.getCmp(this.parent.id+"etimeweek").getValue();A[5]=Wtf.get(this.parent.id+"locationweek").getValue();A[6]=Wtf.getCmp(this.parent.id+"Showasweek").getValue();A[7]=Wtf.getCmp(this.parent.id+"priorityweek").getValue();A[8]=Wtf.getCmp(this.parent.id+"Reminderweek").getValue();A[9]=Wtf.getCmp(this.parent.id+"ReminderTimeweek").getValue();Wtf.getCmp(this.parent.id+"OtherWinShow").hide();this.parent.RemoveMainPanelContent();var B=Wtf.getCmp(this.parent.id);eventfrm=new Wtf.cal.eventForms(B);eventfrm.AddingTabPanelEvent();eventfrm.AddingValue(A)},getTopFormPanel:function(){if(Wtf.isGecko){simHeight=98;cwidth=275}if(Wtf.isIE){simHeight=107;cwidth=265}var A=new Wtf.FormPanel({labelWidth:75,border:true,id:this.parent.id+"f1",frame:true,bodyStyle:"padding:5px 5px 0",width:250,height:simHeight,defaultType:"textfield",region:"north",items:[{fieldLabel:"Subject*",name:"subject",id:this.parent.id+"subjectweek",width:275,allowBlank:false},{fieldLabel:"Location",id:this.parent.id+"locationweek",width:275,name:"location"},CalendarCombo=new Wtf.form.ComboBox({id:this.parent.id+"calendarweek",fieldLabel:"Calendar",store:this.parent.tempCalStore,cls:"winshow",valueField:"id",displayField:"state1",typeAhead:true,mode:"local",editable:false,triggerAction:"all",selectOnFocus:true,width:cwidth})]});return A},getCenterFormPanel:function(A,C){var B=new Wtf.FormPanel({labelWidth:75,id:this.parent.id+"f2",frame:true,xtype:"fieldset",border:true,bodyStyle:"padding:0px 5px 0px",width:250,height:80,region:"center",layout:"column",items:[{columnWidth:0.5,layout:"form",items:[new Wtf.form.Checkbox({id:this.parent.id+"CheckAllDayweek",boxLabel:"All day event",hideLabel:true}),new Wtf.form.DateField({fieldLabel:"Start Date",readOnly:true,format:Wtf.getDateFormat(),value:A,id:this.parent.id+"sdateweek",anchor:"95%"}),new Wtf.form.DateField({layout:"form",readOnly:true,format:Wtf.getDateFormat(),value:C,fieldLabel:"End Date",id:this.parent.id+"edateweek",anchor:"95%"})]},{columnWidth:0.5,bodyStyle:"padding:33px 0px 0px 0px",id:this.parent.id+"timePan",layout:"form",items:[new Wtf.form.ComboBox({fieldLabel:"Start Time",id:this.parent.id+"stimeweek",store:this.store3,editable:false,displayField:"state1",valueField:"abbr1",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"}),new Wtf.form.ComboBox({fieldLabel:"End Time",name:"etime",id:this.parent.id+"etimeweek",store:this.store3,valueField:"abbr1",editable:false,displayField:"state1",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"})]}]});return B},getBottomFormPanel:function(){if(Wtf.isGecko){simHeight=72}if(Wtf.isIE){simHeight=87}var A=new Wtf.FormPanel({labelWidth:75,frame:true,id:this.parent.id+"f3",border:false,xtype:"fieldset",bodyStyle:"padding:5px 5px 10px",width:250,height:simHeight,region:"south",layout:"column",items:[{columnWidth:0.5,layout:"form",items:[new Wtf.form.ComboBox({id:this.parent.id+"Showasweek",fieldLabel:"Show as",value:"b",store:this.storeShowas,editable:false,displayField:"state1",typeAhead:true,valueField:"abbr1",mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"}),new Wtf.form.ComboBox({id:this.parent.id+"Reminderweek",fieldLabel:"Reminder",emptyText:"none",store:this.storeReminder,editable:false,displayField:"state1",valueField:"abbr1",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"})]},{columnWidth:0.5,layout:"form",items:[new Wtf.form.ComboBox({id:this.parent.id+"priorityweek",fieldLabel:"Priority",name:"markas",value:"m",store:this.store4,editable:false,valueField:"abbr",displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"}),new Wtf.form.ComboBox({fieldLabel:"Time",id:this.parent.id+"ReminderTimeweek",store:this.storereminderTime,editable:false,emptyText:" ---------- ",displayField:"state1",valueField:"abbr1",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"})]}]});return A},oncheck:function(B,C){if(C.checked==true){var A=Wtf.get(this.parent.id+"timePan").dom;A.style.display="none"}if(C.checked==false){var A=Wtf.get(this.parent.id+"timePan");A.show()}}});Wtf.cal.DDProxy=function(C,A,B){if(C){this.init(C,A,B);this.initFrame()}};Wtf.extend(Wtf.cal.DDProxy,Wtf.dd.DDProxy,{startDrag:function(B,D){var A=Wtf.get(this.getDragEl());var C=Wtf.get(this.getEl());A.applyStyles({border:"","z-index":2000,backgroundColor:C.dom.style.backgroundColor});A.update(C.dom.innerHTML);A.addClass(C.dom.className+" dd-proxy")},onDragOver:function(C,A){var B=Wtf.get(A);this.lastTarget=B;B.addClass("DragClass")},onDragOut:function(C,A){var B=Wtf.get(A);this.lastTarget=null;B.removeClass("DragClass")},endDrag:function(K){var F=Wtf.getCmp(this.id.split("e_")[0]);var C=Wtf.get(this.getDragEl());var B=Wtf.get(this.getEl());var O=Wtf.get(this.lastTarget);if(O){O=(O.id);O=O.split("Day1");if((B.id.indexOf("Showing"))>=0){var G=Wtf.get(F.id+"e_"+O[1]);var B=G.dom.cloneNode(true);G.dom.parentNode.removeChild(G)}if(this.lastTarget){Wtf.get(this.lastTarget).appendChild(B);this.lastTarget.removeClass("DragClass")}if("function"===typeof this.config.fn){this.config.fn.apply(this.config.scope||window,[this,this.config.dragData])}if(!F.ifArrayContains((K.getTarget().childNodes[0].innerHTML))){F.AddToArray(K.getTarget().childNodes[0].innerHTML)}var N=this.lastTarget.id.split("Day1");if(F.eStore){var H=F.eStore.find("eid",this.id.split("e_")[1]);if(H!=-1){var E=F.eStore.getAt(H);var L=Wtf.cal.utils.sqlToJsDate(E.data["startts"].toString());var A=Wtf.cal.utils.sqlToJsDate(E.data["endts"].toString());var M=L.format("Y-m-")+N[1]+L.format(" H:i:s");M=Wtf.cal.utils.sqlToJsDate(M.toString());var J=Wtf.cal.utils.DateDiff(M,L);var I=new Date(A);I.setDate(A.getDate()+J);var D=[E.data["eid"],E.data["cid"],M.format("Y-m-d H:i:s"),I.format("Y-m-d H:i:s"),E.data["subject"],E.data["descr"],E.data["location"],E.data["showas"],E.data["priority"],E.data["recpattern"],E.data["recend"],E.data["resources"],"","",0];F.updateEvent(D,"0")}}F.CalculateHowMore()}}});Wtf.cal.EventDZ=function(B,A){A=A||{};Wtf.apply(A,{ddel:document.createElement("div")});Wtf.cal.EventDZ.superclass.constructor.call(this,B,A)};Wtf.extend(Wtf.cal.EventDZ,Wtf.dd.DragZone,{getDragData:function(B){var A=Wtf.get(B.getTarget());if(A.hasClass("dd-ct")){return false}return{ddel:this.ddel,item:A}},onInitDrag:function(A){this.ddel.innerHTML=this.dragData.item.dom.innerHTML;this.ddel.className=this.dragData.item.dom.className;this.ddel.style.width=this.dragData.item.getWidth()+"px";this.proxy.update(this.ddel)},getRepairXY:function(B,A){A.item.highlight("#e8edff");return A.item.getXY()}});Wtf.cal.EventDT=function(B,A){Wtf.cal.EventDT.superclass.constructor.call(this,B,A)};Wtf.extend(Wtf.cal.EventDT,Wtf.dd.DropTarget,{notifyDrop:function(V,S,W){var J=Wtf.cal.utils.getCalCtrl();if(W.item.id.search(J.id+"e_")==0||W.item.id.search(J.id+"title_")==0||W.item.id.search(J.id+"wrapper_")==0||W.item.id.search(J.id+"text_")==0||W.item.id.search(J.id+"calImg_")==0){var X=W.item.id.split("_");var G=Wtf.getCmp(J.id+"e_"+X[1]);if(!G.editable){Wtf.Msg.alert("Invalid Operation","You dont have sufficient privileges to modify this event!");return false}var D=this.el.getXY();var P=Wtf.get(J.id+"title_"+X[1]);var A=P.dom.innerHTML.split("-");var Q=Wtf.cal.utils.getTimeIndNo(A[0],false);var E=Wtf.cal.utils.getTimeIndNo(A[1],true);var H=E-Q;var B=this.id.split("_");var U=parseInt(B[1]);if((U<0)||((U+H)>23)){return false}var O=[];var I=[];O=Wtf.cal.utils.getHourStr(U);I=Wtf.cal.utils.getHourStr(U+H);var R=O[0]+O[1]+"-"+I[0]+I[1];P.innerHTML=R;G.el.fadeIn({duration:0.5});G.setPagePosition(D[0],D[1]);G.render(J.id+J.currentview+"eventPanel");var N=J.eStore.find("eid",X[1]);if(N!=-1){var F=J.eStore.getAt(N);var T=Wtf.cal.utils.sqlToJsDate(F.data["startts"].toString());var L=Wtf.cal.utils.sqlToJsDate(F.data["endts"].toString());var K=0;var M=0;if(J.currentview!="DayView"){K=T.format("w");if(J.currentview!="WorkWeekView"){M=B[2]-K}else{M=B[2]-K+1}}T.setDate(T.getDate()+M);L.setDate(L.getDate()+M);Q=Wtf.cal.utils.getTimeIndNo(O[0]+O[1],false);E=Wtf.cal.utils.getTimeIndNo(I[0]+I[1],true);T.setHours(Q,0,0);L.setHours(E,0,0);var C=[F.data["eid"],F.data["cid"],T.format("Y-m-d H:i:s"),L.format("Y-m-d H:i:s"),F.data["subject"],F.data["descr"],F.data["location"],F.data["showas"],F.data["priority"],F.data["recpattern"],F.data["recend"],F.data["resources"],"","",0];J.updateEvent(C,"0")}return true}else{return false}}});Wtf.tree.TableTreeUI=function(A){this.node=A;this.rendered=false;this.animating=false;this.wasLeaf=true;this.addEvents={"contextmenu":true,"checkchange":true};this.ecc="x-tree-ec-icon x-tree-elbow";this.actualColors=["#d96666","#e67399","#b373b3","#8c66d9","#668cb3","#668cd9","#59bfb3","#65ad89","#4cb052","#8cbf40","#bfbf4d","#e0c240","#f2a640","#e6804d","#be9494","#a992a9","#8997a5","#94a2be","#85aaa5","#a7a77d","#c4a883"]};Wtf.extend(Wtf.tree.TableTreeUI,Wtf.tree.TreeNodeUI,{SetBackColor:function(D){var B=this.actualColors[D];var A=this.iconNode.firstChild;A.style.backgroundPosition="-"+(D*15)+"px 0";var C=this.ecNode.childNodes;C[0].style.backgroundColor=B;C[0].style.borderColor=B;C[1].style.backgroundColor=B;C[2].style.backgroundColor=B;C[2].style.borderColor=B;return B},GetBackColor:function(A,C){var B=this.ecNode.childNodes;return(B[1].style.backgroundColor)},renderElements:function(D,I,H,J){this.indentMarkup=D.parentNode?D.parentNode.ui.getChildIndent():"";var E=typeof I.checked=="boolean";var A=I.href?I.href:Wtf.isGecko?"":"#";var K="-"+(I.colorIndex*15)+"px 0";var C=['<li class="x-tree-node"><table wtf:tree-node-id="',D.id,'" class="x-tree-node-el x-tree-node-leaf ',I.cls,'" cellspacing="0" cellpadding="0" class="s-tabletree-node-el "><tbody><tr><td>',this.indentMarkup,'</td><td class="s-tabletree-td">',E?('<input class="x-tree-node-cb" type="checkbox" '+(I.checked?'checked="checked" /></td><td class="chip">':'/></td><td class="chip">')):"</td>",'<div class="t2" style="border-color:',this.actualColors[I.colorIndex],"; background-color: ",this.actualColors[I.colorIndex],';"> </div>','<div style="padding-left: 3px; background-color:',this.actualColors[I.colorIndex],'; padding-bottom: 1px; white-space: normal;">','<a hidefocus="on"  class="x-tree-node-anchor" tabIndex="1" ',I.hrefTarget?' target="'+I.hrefTarget+'"':"",">",'<span class="calMenuLabel" unselectable="on" id="txtspan'+D.id+'">',D.text,"</span></div>",'<div style="border-color:',this.actualColors[I.colorIndex],"; background-color:",this.actualColors[I.colorIndex],';" class="b2"> </div></td><td class="calMenuImgCell">','<img src="',Wtf.BLANK_IMAGE_URL,'"  id="imgdiv'+D.id+'" nodeid="'+D.id+'" style="background-position:',K,'"/></td></tr></tbody></table><ul class="x-tree-node-ct" style="display:none;"></ul></li>'].join("");var G=1;this.wrap=Wtf.DomHelper.insertHtml("beforeEnd",D.parentNode.ui.ctNode,C);this.elNode=this.wrap.childNodes[0].childNodes[0].rows[0];this.ctNode=this.wrap.parentNode;var F=this.elNode.childNodes;this.indentNode=F[0].firstChild;this.ecNode=F[2];this.iconNode=F[3];if(E){this.checkbox=F[1].firstChild;G++}this.anchor=F[G].childNodes[1].firstChild;this.textNode=F[G].childNodes[1].firstChild.firstChild;Wtf.get("imgdiv"+D.id).on("click",this.onContextMenu,this);var B=Wtf.get("txtspan"+D.id);B.on("click",this.onClick,this);B.on("dblclick",this.onDblClick,this)},updateExpandIcon:function(){if(this.rendered){var F=this.node,D,C;var A="x-tree-elbow";var E=F.hasChildNodes();if(E||F.attributes.expandable){if(F.expanded){A+="-minus";D="x-tree-node-collapsed";C="x-tree-node-expanded"}else{A+="-plus";D="x-tree-node-expanded";C="x-tree-node-collapsed"}if(this.wasLeaf){this.removeClass("x-tree-node-leaf");this.wasLeaf=false}if(this.c1!=D||this.c2!=C){Wtf.fly(this.elNode).replaceClass(D,C);this.c1=D;this.c2=C}}else{if(!this.wasLeaf){Wtf.fly(this.elNode).replaceClass("x-tree-node-expanded","x-tree-node-leaf");delete this.c1;delete this.c2;this.wasLeaf=true}}var B="x-tree-ec-icon "+A;if(this.ecc!=B){this.ecNode.className=B;this.ecc=B}}},toggleCheck:function(B){var A=this.checkbox;if(A){A.checked=(B===undefined?!A.checked:B);this.node.attributes.checked=A.checked;this.fireEvent("checkchange",this.node,A.checked)}},onSelectedChange:function(A){if(A){this.focus();this.addClass("nodeSelected")}else{this.removeClass("nodeSelected")}},onContextMenu:function(A){if(this.node.hasListener("contextmenu")||this.node.getOwnerTree().hasListener("contextmenu")){A.preventDefault();this.focus();this.fireEvent("contextmenu",this.node,A.getPageX(),A.getPageY())}}});Wtf.CalendarTree=function(A){Wtf.apply(this,A);this.nodeHash={};this.containerScroll=true;this.border=false;this.bodyStyle="padding:10px;";this.rootVisible=true;this.lines=false;this.treeRoot=new Wtf.tree.TreeNode({id:this.parentid+"rn",cls:"calroot",expanded:true,text:"Calendar(s)",cls:"takeleft",singleClickExpand:false});this.setRootNode(this.treeRoot);this.agendaStore=new Wtf.data.Store({url:this.url,baseParams:{action:0,userid:this.ownerid.userid,caltype:this.ownerid.type,latestts:"1970-01-01 00:00:00"},reader:new Wtf.data.JsonReader({root:"data"},["children","cid","cname","description","location","timezone","colorcode","caltype","isdefault","userid","timestamp","permissionlevel","marginclass"])});this.agendaStore.on("load",this.loadTree,this);Wtf.Ajax.timeout=80000;this.agendaStore.load();this.datePicker.on("select",this.DateSelected,this);this.addEvents({"treecheckchange":true,"changecolor":true,"deletecalendar":true,"calendarsettings":true});Wtf.CalendarTree.superclass.constructor.call(this)};Wtf.extend(Wtf.CalendarTree,Wtf.tree.TreePanel,{onRender:function(A){Wtf.CalendarTree.superclass.onRender.call(this,A);this.getSelectionModel().on("beforeselect",this.selectChanged,this)},loadTree:function(E,G,C){var D=false;for(var B=0;B<this.agendaStore.getTotalCount();B++){var A=name=Wtf.util.Format.ellipsis(this.agendaStore.getAt(B).data["cname"],15);var F=this.treeRoot.appendChild(new Wtf.tree.TreeNode({text:A,allowDrop:false,allowDrag:false,checked:(!D),childNodes:this.agendaStore.getAt(B).data["children"],icon:"lib/resources/images/default/s.gif",iconCls:"imgchange",cls:this.agendaStore.getAt(B).data["marginclass"],qtip:this.agendaStore.getAt(B).data["description"],qtipTitle:this.agendaStore.getAt(B).data["cname"],id:this.agendaStore.getAt(B).data["cid"],uiProvider:Wtf.tree.TableTreeUI,colorIndex:parseInt(this.agendaStore.getAt(B).data["colorcode"])}));if(F){F.attributes.request=false}D=true}if(D){this.defaultNode=this.getNodeById(this.agendaStore.getAt(0).data["cid"]);if(this.delayFlag){this.defaultNode.attributes.request=false;this.calcontrol=Wtf.getCmp(this.calControl);this.calcontrol.startCalEventBot(this.defaultNode.id);this.calcontrol.onDayViewClick();this.calcontrol.CalculatingTotalCalendar()}}this.attachListeners()},makeContextMenu:function(){var A=new Wtf.menu.ColorItem({id:this.parentid+"coloritem",colors:["CC3333","DD4477","994499","6633CC","336699","3366CC","22AA99","329262","109618","66AA00","AAAA11","D6AE00","EE8800","DD5511","A87070","8C6D8C","627487","7083A8","5C8D87","898951","B08B59"]});this.contextMenu=new Wtf.menu.Menu({id:this.parentid+"contextMenu",items:[{id:this.parentid+"Delete",iconCls:"pwnd delicon",text:"Delete",scope:this,handler:function(){if(this.treeRoot.firstChild==this.getSelectionModel().getSelectedNode()){Wtf.MessageBox.confirm("Confirm","Are you sure you want to delete all events?",function(B){if(B=="yes"){var C={};C.events=true;C.id=this.treeRoot.firstChild.id;this.fireEvent("deletecalendar",C.id)}},this)}else{Wtf.MessageBox.confirm("Confirm","Are you sure you want to delete?",function(B){if(B=="yes"){var C={};C.events=false;C.id=this.getSelectionModel().getSelectedNode().id;this.fireEvent("deletecalendar",C.id)}},this)}}},{id:this.parentid+"Edit",iconCls:"pwnd editiconwt",text:"Settings",scope:this,handler:function(){this.fireEvent("calendarsettings",this.getSelectionModel().getSelectedNode().id)}},{id:this.parentid+"thisonly",text:"Display only this calendar",iconCls:"pwnd checked",scope:this,handler:function(){var D=this.getSelectionModel().getSelectedNode();var C=this.treeRoot.childNodes;for(var B=0;B<C.length;B++){if(C[B].attributes.checked){C[B].ui.checkbox.checked=false;C[B].attributes.checked=false;var E=Wtf.getCmp(this.parentid+"calctrl");if(E){E.stopCalEventBot(C[B].id);E.HidingOtherCalendarEvent(C[B].id)}}}D.ui.checkbox.checked=true;D.attributes.checked=true;this.fireEvent("treecheckchange",this,D,true)}},"-",A]});A.on("select",function(C,B){var E=C.colors.indexOf(B);var D=this.getSelectionModel().getSelectedNode();this.fireEvent("changecolor",this,D,E)},this)},attachListeners:function(){this.on("checkchange",function(A,B){A.select();this.fireEvent("treecheckchange",this,A,B)},this);this.on("contextmenu",function(B,A,E){if(B!=this.treeRoot){this.getNodeById(B.id).select();if(!this.contextMenu){this.makeContextMenu()}this.contextMenu.showAt([A+11,E]);var C=this.agendaStore.find("cid",B.id);var D=1;if(C!=-1){D=this.agendaStore.getAt(C).data["permissionlevel"]}if(D!=""){Wtf.getCmp(this.parentid+"Delete").disable();Wtf.getCmp(this.parentid+"Edit").disable();Wtf.getCmp(this.parentid+"coloritem").disable()}else{Wtf.getCmp(this.parentid+"Delete").enable();Wtf.getCmp(this.parentid+"Edit").enable();Wtf.getCmp(this.parentid+"coloritem").enable()}}},this);this.on("click",function(A,B){var C=this.getNodeById(A.id).ui;C.getTextEl().style.background="transparent none repeat scroll 0%";C.getTextEl().style.color="#000000"},this)},selectChanged:function(){this.calcontrol=Wtf.getCmp(this.parentid+"calctrl");var A=Wtf.getCmp(this.parentTabId);if(!this.calcontrol){this.calcontrol=new Wtf.cal.control({id:this.parentid+"calctrl",title:"My Calendar",tabType:Wtf.etype.cal,iconCls:getTabIconCls(Wtf.etype.cal),closable:true,border:false,ownerid:{type:0,userid:loginid},myToolbar:true,calTabId:"tabmycal",layout:"fit",url:Wtf.req.cal+"caltree.jsp",calTree:this,calendar:this.datePicker,mainCal:true});A.add(this.calcontrol);A.doLayout();A.setActiveTab(this.calcontrol);this.calcontrol.on("destroy",function(C){var D=C.calTree.getChecked();for(var B=0;B<D.length;B++){D[B].attributes.request=false}C.calTree.getSelectionModel().clearSelections();C.calTree.calcontrol=null})}else{A.setActiveTab(this.calcontrol)}},DateSelected:function(){if(!this.calcontrol){this.selectChanged()}else{var A=Wtf.getCmp(this.parentTabId);A.setActiveTab(this.calcontrol)}}});Wtf.cal.createCal=function(A){this.parent=A;this.selNodeId=null;this.colorInd="";this.calRec=Wtf.data.Record.create([{name:"cid"},{name:"cname"},{name:"description"},{name:"location"},{name:"timezone"},{name:"colorcode"},{name:"caltype"},{name:"isdefault"},{name:"userid"},{name:"timestamp"}]);Wtf.cal.createCal.superclass.constructor.call(this)};Wtf.extend(Wtf.cal.createCal,Wtf.Component,{createcal:function(J){var E=Wtf.getCmp(this.parent.id+"gridpanel");var D=E.getStore();var B="";for(var F=0;F<D.getCount();F++){B+=D.getAt(F).get("userid");B+="_"+D.getAt(F).get("resourcename")+","}var K=this.parent.calTree.treeRoot.childNodes.length;var M=this.parent.calTree.tree;var A=Wtf.get(this.parent.id+"calname").getValue();A=Wtf.cal.utils.HTMLScriptStripper(A);var L=Wtf.get(this.parent.id+"des").getValue();L=Wtf.cal.utils.HTMLScriptStripper(L);var H=Wtf.get(this.parent.id+"timezone").getValue();var C=Wtf.get(this.parent.id+"country").getValue();if(this.colorInd==""){this.colorInd=0}if(A==""){Wtf.MessageBox.alert("Invalid Entry","Please enter the calendar name!")}else{if(!this.selNodeId){var G=[A,L,C,H,this.colorInd,this.parent.calTree.ownerid.type,"0",this.parent.calTree.ownerid.userid,B];this.parent.insertCalendar(G)}else{var I="0";var N=this.parent.calTree.agendaStore.find("cid",this.selNodeId);if(N!=-1){I=this.parent.calTree.agendaStore.getAt(N).data["isdefault"]}var G=[this.selNodeId,A,L,C,H,this.colorInd,this.parent.calTree.ownerid.type,I,this.parent.calTree.ownerid.userid,B];this.parent.updateCalendar(G)}this.parent.addCalendarTab1();this.selNodeId=null}},CreateCalendar:function(A){this.parent.add(new Wtf.Panel({frame:true,layout:"fit",deferredRender:true,id:this.parent.id+"createCalForm",border:false,items:[{bodyStyle:"position: relative;",autoScroll:true,id:this.parent.id+"innerpanel"}]}));this.Addfield();this.Addbuttons();this.clearCalFormFields();if(A){this.showSettingsForm(A)}},clearCalFormFields:function(){this.parent.formview="CreateCal";Wtf.getCmp(this.parent.id+"calname").setValue("");Wtf.getCmp(this.parent.id+"des").setValue("");Wtf.getCmp(this.parent.id+"selectColor").select("CC3333");Wtf.getCmp(this.parent.id+"person").setValue("< Select the user name >");var A=Wtf.getCmp(this.parent.id+"gridpanel");A.getStore().removeAll();Wtf.getCmp(this.parent.id+"create").setText("Create Calendar")},showSettingsForm:function(D){this.parent.formview="CreateCal";if(D){this.selNodeId=D;if(this.parent.calTree.agendaStore){var C=new this.calRec();var A=this.parent.calTree.agendaStore.find("cid",this.selNodeId);if(A!=-1){C=this.parent.calTree.agendaStore.getAt(A);var B=[C.data["cid"],C.data["cname"],C.data["description"],C.data["location"],C.data["timezone"],C.data["colorcode"],C.data["caltype"],C.data["isdefault"],C.data["userid"],C.data["timestamp"]];this.displaySettingValues(B)}}}},Addbuttons:function(){Wtf.getCmp(this.parent.id+"inner1").add(new Wtf.Panel({id:this.parent.id+"addbuttons",items:[new Wtf.Button({cls:"button1",text:"Cancel",id:this.parent.id+"cancel",scope:this.parent,handler:function(){this.addCalendarTab1();this.selNodeId=null}}),new Wtf.Button({cls:"button11",text:"Create Calendar",id:this.parent.id+"create",handler:this.createcal,scope:this})]}));this.parent.doLayout()},Addfield:function(){var B=new Wtf.data.SimpleStore({fields:["abbr","state"],data:Wtf.form.ComboBox.sharing});if(!Wtf.StoreMgr.containsKey("timezone")){Wtf.timezoneStore.load();Wtf.StoreMgr.add("timezone",Wtf.timezoneStore)}if(!Wtf.StoreMgr.containsKey("country")){Wtf.countryStore.load();Wtf.StoreMgr.add("country",Wtf.countryStore)}Wtf.Ajax.request({url:"jspfiles/cal/caltree.jsp",params:{action:7},method:"POST",scope:this,success:function(F,G){var H=Wtf.decode(F.responseText);Wtf.getCmp(this.parent.id+"timezone").setValue(H.timezone);Wtf.getCmp(this.parent.id+"country").setValue(H.country)},failure:function(F,G){}});var C=new Wtf.data.SimpleStore({fields:["abbr","resourcename"],data:Wtf.form.ComboBox.resourcename});Wtf.ux.comboBoxRenderer=function(F){return function(H){var G=F.store.find(F.valueField,H);var I=F.store.getAt(G);return I.get(F.displayField)}};var E=new Wtf.form.ComboBox({selectOnFocus:true,triggerAction:"all",editable:false,mode:"local",store:C,displayField:"resourcename",valueField:"abbr"});var A=new Wtf.grid.EditorGridPanel({id:this.parent.id+"gridpanel",clicksToEdit:1,selModel:new Wtf.grid.RowSelectionModel(),ds:new Wtf.data.Store({id:this.parent.id+"datastore",reader:new Wtf.data.ArrayReader({},[{name:"Email"},{name:"userid"},{name:"resourcename"},{name:"setbutton"}])}),cm:new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Name",dataIndex:"fullname"},{header:"Email",dataIndex:"Email"},{header:"Permission",dataIndex:"resourcename",editor:E,renderer:Wtf.ux.comboBoxRenderer(E)},{header:"User Id",dataIndex:"userid",hidden:true},{header:"Delete",renderer:this.setbutton,dataIndex:"setbutton",width:20}]),viewConfig:{forceFit:true,autoFill:true},height:95});var D=Wtf.getCmp("contactsview");Wtf.getCmp(this.parent.id+"innerpanel").add(new Wtf.FormPanel({id:this.parent.id+"inner1",labelWidth:130,items:[{xtype:"fieldset",title:"Details",autoHeight:true,items:[{fieldLabel:"Calendar Name*",xtype:"textfield",id:this.parent.id+"calname",width:"98%",allowBlank:false},{xtype:"textarea",fieldLabel:"Description",id:this.parent.id+"des",width:"98%"},new Wtf.form.ComboBox({fieldLabel:"Country",editable:false,id:this.parent.id+"country",store:Wtf.countryStore,displayField:"name",valueField:"id",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"71%"}),new Wtf.form.ComboBox({editable:false,fieldLabel:"Time Zone",id:this.parent.id+"timezone",store:Wtf.timezoneStore,displayField:"name",valueField:"id",mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"71%"}),new Wtf.Panel({height:60,xtype:"fieldset",layout:"column",items:[{layout:"form",width:135,items:{labelWidth:130,fieldLabel:"Color",id:"textField",hideField:true,xtype:"textfield"}},{width:150,items:[new Wtf.ColorPalette({cls:"palette",value:"CC3333",id:this.parent.id+"selectColor",colors:["CC3333","DD4477","994499","6633CC","336699","3366CC","22AA99","329262","109618","66AA00","AAAA11","D6AE00","EE8800","DD5511","A87070","8C6D8C","627487","7083A8","5C8D87","898951","B08B59"]})]}]})]},{xtype:"fieldset",title:"Sharing",height:170,id:this.parent.id+"sharingfield",items:[{id:this.parent.id+"pqrs",layout:"column",items:[{columnWidth:0.715,labelWidth:130,layout:"form",items:[new Wtf.form.ComboBox({editable:false,fieldLabel:"User Name",emptyText:"< Select the user name >",id:this.parent.id+"person",store:D.contactStore,displayField:"username",valueField:"userid",mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"100%"})]},{columnWidth:0.1,layout:"form",items:[new Wtf.Template("<table id="+this.parent.id+"addedperson><tr>","<td><img  id="+this.parent.id+'addperson src="images/tabicons_02.gif" title="ADD PERSON" class = "addpersonbutton""></img></td></tr></table>')]}]},{border:false,id:this.parent.id+"mailGridPanel",height:110,layout:"border",items:[{height:100,region:"center",layout:"fit",items:A}]}]}]}));if(this.parent.calTree.ownerid.type==2){Wtf.getCmp(this.parent.id+"sharingfield").hide()}this.parent.doLayout();Wtf.getCmp(this.parent.id+"gridpanel").on("afteredit",this.remGridClass,this);Wtf.get(this.parent.id+"addperson").on("click",this.addshareperson,this);Wtf.get("textField").hide();Wtf.getCmp(this.parent.id+"selectColor").on("select",function(G,F){this.colorInd=G.colors.indexOf(F)},this)},remGridClass:function(A){Wtf.get(Wtf.getCmp(this.parent.id+"gridpanel").getView().getCell(A.row,A.column)).removeClass("x-grid3-dirty-cell")},setbutton:function(){return("<img src='images/Delete.gif'  id=_delbutton  title='Delete Person' class='xbtn'></img>")},addshareperson:function(){var D=Wtf.getCmp(this.parent.id+"gridpanel").store;var A=/^[^@]+@[^@]+.[a-z]{2,}$/i;var G=Wtf.getCmp(this.parent.id+"person").getValue();var K=Wtf.get(this.parent.id+"person").getValue();if(K=="< Select the user name >"){msgBoxShow(["Warning","Select user name"]);return 0}var I=Wtf.getCmp("contactsview");var J=I.contactStore.find("userid",G);var C=I.contactStore.getAt(J);if(C){var F=C.data["emailid"];var B=C.data["userid"];var E=Wtf.data.Record.create({name:"username"},{name:"Email"},{name:"userid"},{name:"resourcename"},{name:"setbutton"});var H=new E({fullname:K,Email:F,userid:G,resourcename:1,setbutton:""});B=this.checkRepeatMail(B);if(B==null){D.add(H)}Wtf.get("_delbutton").on("click",this.deleteClick,this)}},checkRepeatMail:function(A){var B=Wtf.getCmp(this.parent.id+"gridpanel").store;for(i=0;i<B.getCount();i++){if(A==B.getAt(i).data["userid"]){Wtf.Msg.alert("Error","User already Present");return(A)}}A=null;return(A)},deleteClick:function(E){var B=Wtf.getCmp(this.parent.id+"gridpanel");var A=B.getSelectionModel();var C=A.getSelections();var D=B.getStore();Wtf.MessageBox.confirm("Confirm Delete","Are you sure you want to delete?",function(F){if(F=="yes"){D.remove(C[0])}})},displaySettingValues:function(rec){Wtf.getCmp(this.parent.id+"create").setText("Edit Calendar");Wtf.getCmp(this.parent.id+"calname").setValue(rec[1]);Wtf.getCmp(this.parent.id+"des").setValue(rec[2]);Wtf.getCmp(this.parent.id+"country").setValue(rec[3]);Wtf.getCmp(this.parent.id+"timezone").setValue(rec[4]);var colorfield=["CC3333","DD4477","994499","6633CC","336699","3366CC","22AA99","329262","109618","66AA00","AAAA11","D6AE00","EE8800","DD5511","A87070","8C6D8C","627487","7083A8","5C8D87","898951","B08B59"];Wtf.getCmp(this.parent.id+"selectColor").select(colorfield[rec[5]]);Wtf.Ajax.request({url:Wtf.req.cal+"caltree.jsp",method:"GET",params:({action:4,cid:this.selNodeId,caltype:this.parent.calTree.ownerid.type}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");var Grid=Wtf.getCmp(this.parent.id+"gridpanel");var mailStore=Grid.getStore();var mailRecord=Wtf.data.Record.create([{name:"username"},{name:"Email"},{name:"userid"},{name:"resourcename"},{name:"setbutton"}]);var contacts=Wtf.getCmp("contactsview");for(var i=0;i<nodeobj.data.length;i++){var contactCheck=contacts.contactStore.find("userid",nodeobj.data[i].userid);if(contactCheck!=-1){var p=new mailRecord({fullname:contacts.contactStore.getAt(contactCheck).get("username"),Email:contacts.contactStore.getAt(contactCheck).get("emailid"),userid:contacts.contactStore.getAt(contactCheck).get("userid"),resourcename:nodeobj.data[i].permissionlevel,setbutton:""});mailStore.add(p)}if(Wtf.get("_delbutton")){Wtf.get("_delbutton").on("click",this.deleteClick,this)}}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}});Wtf.cal.oneDay=function(A){this.baseCls="oneDayPanelBase";Wtf.apply(this,A);Wtf.cal.oneDay.superclass.constructor.call(this)};Wtf.extend(Wtf.cal.oneDay,Wtf.Panel,{initComponent:function(){Wtf.cal.oneDay.superclass.initComponent.call(this)},onRender:function(B,A){Wtf.cal.oneDay.superclass.onRender.call(this,B,A);this.createtableBody()},createtableBody:function(){var B="<table width=100% height=100% cellspacing=0 cellpadding=0 style=position:relative;><tbody>";for(var A=0;A<24;A++){B+="<tr><td id="+this.parent.id+"cell_"+A+"_"+this.initcolcount+' class="daycompCell">&nbsp;</td></tr>'}B+="</tbody></table>";Wtf.DomHelper.insertHtml("beforeEnd",this.body.dom,B)}});Wtf.cal.control=function(A){Wtf.apply(this,A);this.id=A.id;this.currentview=null;this.formview=null;this.EventClick="";this.rec=[];this.eStore=null;this.tmpStore=null;this.defaultTS="1970-01-01 00:00:00";this.created=false;Wtf.cal.control.superclass.constructor.call(this);this.createCalComp=new Wtf.cal.createCal(this);this.eventWin=new Wtf.cal.eventWindow(this);this.tempCalStore=null;this.Calendar_countReminder=0;this.calPerm="";this.dbflag=""};Wtf.extend(Wtf.cal.control,Wtf.Panel,{selectedDate:null,seldate:null,EventInc:null,ResizeArray:null,day:null,delid:null,droi1:null,droi2:null,startdate:null,enddate:null,calList:[],chkCalList:[],initComponent:function(){if(!this.height){this.height="100%"}if(this.width==null){this.width="100%"}this.on("activate",function(){toggleMainCal(0);this.calTree.show();this.calendar.show();if(!this.created){this.addListener("resize",this.CalculateHow,this);this.layout.activeItem=Wtf.getCmp(this.id+"dayPanel");if(!this.calTree.delayFlag){this.onDayViewClick()}this.startCalTreeBot();this.CalculatingTotalCalendar();this.created=true;if(this.calTree.defaultNode){this.startCalEventBot(this.calTree.defaultNode.id)}}},this);this.on("deactivate",function(){this.calTree.hide();this.calendar.hide();toggleMainCal(1);var k=Wtf.getCmp("Expand");if(k!=undefined){k.close()}},this);this.on("destroy",function(){var winForm=Wtf.getCmp(this.id+"OtherWinShow");if(winForm){winForm.destroy();winForm=null;this.weekWin=null}},this);this.calendar.on("select",this.getCurrentDate,this);var toolbar=new Wtf.Toolbar({id:this.id+"calMainToolbar",cls:"toolbarcls",ctCls:"toolbarcls",items:[{text:"New Calendar",iconCls:"pwnd newcal caltb",tooltip:"Add New Calendar",id:this.id+"newCal",scope:this,handler:this.onButtonNewCalClick,ctCls:"fontstyle"},{text:"Refresh",id:this.id+"refreshAction1",iconCls:"pwnd refresh caltb",handler:this.onCalViewChange,scope:this,tooltip:"Refresh"},{text:"Export",id:this.id+"pdfAction1",iconCls:"pwnd printicon caltb",handler:this.onPdfClick,toggleGroup:"tabs",tooltip:"Export PDF",scope:this,toggleGroup:"tabs"},{text:"Day",id:this.id+"dayAction1",iconCls:"pwnd calday caltb",handler:this.onDayViewClick,tooltip:"Day View",scope:this,toggleGroup:"tabs"},{text:"WorkWeek",id:this.id+"workweekAction1",iconCls:"pwnd calworkwk caltb",handler:this.onWorkWeekViewClick,tooltip:"Work Week View",scope:this,toggleGroup:"tabs"},{text:"Week",id:this.id+"weekAction1",iconCls:"pwnd calweek caltb",handler:this.onWeekViewClick,tooltip:"Week View",scope:this,toggleGroup:"tabs"},{text:"Month",id:this.id+"monthAction1",iconCls:"pwnd calmonth caltb",handler:this.onMonthViewClick,tooltip:"Month View",scope:this,toggleGroup:"tabs"},{text:"Agenda",id:this.id+"agendaAction1",iconCls:"pwnd propicon caltb",handler:this.onAgendaClick,tooltip:"Write Your Agenda",scope:this,toggleGroup:"tabs"},{text:"To-Do",id:this.id+"todolist",iconCls:"pwnd todolistpane caltb",handler:this.ontodoClick,tooltip:"Show To-Do list",scope:this},{text:"",id:this.id+"prevAction1",iconCls:"pwnd previcon caltb",scope:this,handler:this.onPrevClick},{text:"selecteddaymon",id:this.id+"dateText1",ctCls:"fontstyle",scope:this},{text:"",id:this.id+"nextAction1",iconCls:"pwnd nexticon caltb",scope:this,handler:this.onNextClick,scope:this},{text:"Save",id:this.id+"SaveAction1",iconCls:"pwnd saveicon caltb",handler:this.onSaveClick,scope:this},{text:"Close",id:this.id+"CloseAction1",iconCls:"pwnd closeicon caltb",handler:this.onCloseClick,scope:this},{text:"Delete",id:this.id+"deleteEventClick",iconCls:"pwnd delicon caltb",handler:this.onDeleteClick,scope:this}]});if(this.myToolbar==true){this.tbar=toolbar}if(this.mView){if(typeof this.mView=="object"){this.monthView=this.mView}delete this.mView}if(this.dView){if(typeof this.dView=="object"){this.dayView=this.dView}delete this.dView}Wtf.cal.control.superclass.initComponent.call(this);this.calTree.on("changecolor",function(treeobj,node,color){if(this.calTree.agendaStore){var permissionString="";var rec=new this.createCalComp.calRec();var t=this.calTree.agendaStore.find("cid",node.id);if(t!=-1){rec=this.calTree.agendaStore.getAt(t);Wtf.Ajax.request({url:Wtf.req.cal+"caltree.jsp",method:"GET",params:({action:4,cid:rec.data["cid"],caltype:this.calTree.ownerid.type}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");for(var i=0;i<nodeobj.data.length;i++){permissionString+=nodeobj.data[i].userid;permissionString+="_"+nodeobj.data[i].permissionlevel+","}var cRecord=[rec.data["cid"],rec.data["cname"],rec.data["description"],rec.data["location"],rec.data["timezone"],color,rec.data["caltype"],rec.data["isdefault"],rec.data["userid"],permissionString];this.updateCalendar(cRecord)},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}}},this);this.calTree.on("treecheckchange",function(treeobj,treenode,event,roleId){if(this.currentview=="agendaView"){this.getStartEndDate();this.getCalIds();this.reloadAgenda()}else{if(event==false){this.stopCalEventBot(treenode.id);this.HidingOtherCalendarEvent(treenode.id)}else{this.startCalEventBot(treenode.id);this.ShowingOtherCalendarEvent(treenode.id)}}this.onCalViewChange()},this);this.calTree.on("calendarsettings",function(nodeId){this.RemoveMainPanelContent();var cc=Wtf.getCmp(this.id+"createCalForm");if(!cc){this.createCalComp.CreateCalendar(nodeId);cc=Wtf.getCmp(this.id+"createCalForm");this.showCalPanel(cc)}else{this.showCalPanel(cc);this.createCalComp.showSettingsForm(nodeId)}},this);this.calTree.on("deletecalendar",function(nodeId){if(this.calTree.agendaStore){var rec=new this.createCalComp.calRec();var t=this.calTree.agendaStore.find("cid",nodeId);if(t!=-1){rec=this.calTree.agendaStore.getAt(t);this.deleteCalendar(rec)}}},this)},CalculateHow:function(){this.CalculateHowMore()},hideFormtoolbar:function(){Wtf.getCmp(this.id+"SaveAction1").hide();Wtf.getCmp(this.id+"CloseAction1").hide();Wtf.getCmp(this.id+"deleteEventClick").hide()},showFormtoolbar:function(){Wtf.getCmp(this.id+"SaveAction1").show();Wtf.getCmp(this.id+"CloseAction1").show();Wtf.getCmp(this.id+"deleteEventClick").show()},hideMaintoolbar:function(){Wtf.getCmp(this.id+"newCal").hide();Wtf.getCmp(this.id+"refreshAction1").hide();Wtf.getCmp(this.id+"pdfAction1").hide();Wtf.getCmp(this.id+"dayAction1").hide();Wtf.getCmp(this.id+"workweekAction1").hide();Wtf.getCmp(this.id+"weekAction1").hide();Wtf.getCmp(this.id+"monthAction1").hide();Wtf.getCmp(this.id+"agendaAction1").hide();Wtf.getCmp(this.id+"todolist").hide();Wtf.getCmp(this.id+"prevAction1").hide();Wtf.getCmp(this.id+"dateText1").hide();Wtf.getCmp(this.id+"nextAction1").hide()},showMaintoolbar:function(){Wtf.getCmp(this.id+"newCal").show();Wtf.getCmp(this.id+"refreshAction1").show();Wtf.getCmp(this.id+"pdfAction1").show();Wtf.getCmp(this.id+"dayAction1").show();Wtf.getCmp(this.id+"workweekAction1").show();Wtf.getCmp(this.id+"weekAction1").show();Wtf.getCmp(this.id+"monthAction1").show();Wtf.getCmp(this.id+"agendaAction1").show();Wtf.getCmp(this.id+"todolist").show();Wtf.getCmp(this.id+"prevAction1").show();Wtf.getCmp(this.id+"dateText1").show();Wtf.getCmp(this.id+"nextAction1").show()},onPdfClick:function(){var A=Wtf.getCmp(this.id+"_agendaGrid");var B=A.getStore();Wtf.get("downloadframe").dom.src="exportPdf.jsp?start="+B.lastOptions.params["start"]+"&limit="+B.lastOptions.params["limit"]+"&cidList="+B.lastOptions.params["cidList"]+"&viewdt1="+B.lastOptions.params["viewdt1"]+"&viewdt2="+B.lastOptions.params["viewdt2"]},onRender:function(B,A){Wtf.cal.control.superclass.onRender.call(this,B,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.id))},startCalTreeBot:function(){dojo.cometd.subscribe("/calTree/"+this.ownerid.userid,this,"calTreeHandler")},stopCalTreeBot:function(){dojo.cometd.unsubscribe("/calTree/"+this.ownerid.userid)},calTreeHandler:function(msg){if(msg.data.action=="1"){if(msg.data.success=="true"){var msgobj=eval("("+msg.data.data+")");if(this.calTree.agendaStore){var rec=this.calTree.agendaStore.reader.readRecords(msgobj).records;this.calTree.agendaStore.add(rec);var calname=Wtf.util.Format.ellipsis(rec[0].data["cname"],15);var node=this.calTree.treeRoot.appendChild(new Wtf.tree.TreeNode({text:calname,allowDrop:false,allowDrag:false,checked:false,icon:"lib/resources/images/default/s.gif",iconCls:"imgchange",cls:"treenodeclass",qtip:rec[0].data["description"],qtipTitle:rec[0].data["cname"],id:rec[0].data["cid"],uiProvider:Wtf.tree.TableTreeUI,colorIndex:parseInt(rec[0].data["colorcode"])}));if(node){node.attributes.request=false;node.select()}}this.CalculatingTotalCalendar()}}if(msg.data.action=="2"){if(msg.data.success=="true"){var msgobj=eval("("+msg.data.data+")");if(this.calTree.agendaStore){var rec=this.calTree.agendaStore.reader.readRecords(msgobj).records;Wtf.cal.utils.findAndReplace(this.calTree.agendaStore,"cid",rec);var node=this.calTree.getNodeById(rec[0].data["cid"]);if(node){node.getUI().SetBackColor(rec[0].data["colorcode"]);var calname=Wtf.util.Format.ellipsis(rec[0].data["cname"],15);node.ui.getTextEl().setAttributeNS("wtf","qtip",rec[0].data["description"]);node.ui.getTextEl().setAttributeNS("wtf","qtitle",rec[0].data["cname"]);node.setText(calname);node.select();this.ChangingOtherColor(rec[0].data["colorcode"],node.id)}}this.CalculatingTotalCalendar()}}if(msg.data.action=="3"){if(msg.data.success=="true"){if(this.calTree.agendaStore){var cid=msg.data.cid;var t=this.calTree.agendaStore.find("cid",cid);if(t!=-1){var rec=this.calTree.agendaStore.getAt(t);if(rec.data["permissionlevel"]==""){if(rec.data["isdefault"]!="1"){var node=this.calTree.getNodeById(cid);if(node){node.remove();this.calTree.agendaStore.remove(rec)}}}else{var node=this.calTree.getNodeById(cid);if(node){node.remove();this.calTree.agendaStore.remove(rec)}}var recs=this.eStore.query("cid",cid,true);recs.each(function(r){if((this.currentview=="MonthView")){var evt=Wtf.get(this.id+"e_"+r.data["eid"]);if(evt||evt!=undefined){evt.remove()}}else{if((this.currentview=="DayView")||(this.currentview=="WorkWeekView")||(this.currentview=="WeekView")){var evt=Wtf.getCmp(this.id+"e_"+r.data["eid"]);if(evt||evt!=undefined){evt.destroy()}}}this.eStore.remove(r)},this);if(this.currentview=="agendaView"){this.getCalIds();this.reloadAgenda()}}}this.CalculatingTotalCalendar()}}},startCalEventBot:function(A){dojo.cometd.subscribe("/calEvent/"+A,this,"calEventHandler")},stopCalEventBot:function(A){dojo.cometd.unsubscribe("/calEvent/"+A)},calEventHandler:function(msg){if(msg.data.calView=="0"||msg.data.calView=="1"){if(msg.data.action=="1"){if(msg.data.success=="true"){var msgobj=eval("("+msg.data.data+")");var jsonrec=this.eStore.reader.readRecords(msgobj);var stdt=Wtf.cal.utils.sqlToJsDate(jsonrec.records[0].data["startts"]);if(this.droi1<=stdt&&this.droi2>=stdt){this.eStore.add(jsonrec.records)}if(this.currentview!="agendaView"){if(this.startdate<=stdt&&this.enddate>=stdt){this.renderEventsOnPanel(jsonrec.records)}}else{this.reloadAgenda()}}}else{if(msg.data.action=="2"){if(msg.data.success=="true"){var msgobj=eval("("+msg.data.data+")");var jsonrec=this.eStore.reader.readRecords(msgobj);var stdt=Wtf.cal.utils.sqlToJsDate(jsonrec.records[0].data["startts"]);if(this.droi1<=stdt&&this.droi2>=stdt){this.eStore.updateStore("eid",jsonrec.records,0)}if(this.currentview!="agendaView"){if(this.startdate<=stdt&&this.enddate>=stdt){this.renderEventsOnPanel(jsonrec.records)}else{if((this.currentview=="MonthView")){var evt=Wtf.get(this.id+"e_"+jsonrec.records[0].data.eid);if(evt||evt!=undefined){evt.parentNode.removeChild(evt.dom)}}else{if((this.currentview=="DayView")||(this.currentview=="WorkWeekView")||(this.currentview=="WeekView")){var evt=Wtf.getCmp(this.id+"e_"+jsonrec.records[0].data.eid);if(evt||evt!=undefined){evt.destroy()}}}}}else{this.reloadAgenda()}}}else{if(msg.data.action=="3"){if(msg.data.success=="true"){var stdt;var t=this.eStore.find("eid",msg.data.eid);if(t!=-1){var rec=this.eStore.getAt(t);stdt=Wtf.cal.utils.sqlToJsDate(rec.data["startts"]);this.eStore.remove(rec)}if(this.currentview!="agendaView"){if(stdt&&stdt!=undefined&&this.startdate<=stdt&&this.enddate>=stdt){if((this.currentview=="MonthView")){var evt=Wtf.get(this.id+"e_"+msg.data.eid);if(evt||evt!=undefined){evt.dom.parentNode.removeChild(evt.dom)}}else{if((this.currentview=="DayView")||(this.currentview=="WorkWeekView")||(this.currentview=="WeekView")){var evt=Wtf.getCmp(this.id+"e_"+msg.data.eid);if(evt||evt!=undefined){evt.destroy()}}}}}else{var Grid=Wtf.getCmp(this.id+"_agendaGrid");if(Grid&&Grid!=undefined){this.reloadAgenda()}}}}}}}},onButtonNewCalClick:function(A){var E=15;var D=0;for(var B=0;B<(this.calTree.agendaStore.getCount());B++){if((this.calTree.agendaStore.getAt(B).data["permissionlevel"])==""){D++}}if(D<E){this.RemoveMainPanelContent();var C=Wtf.getCmp(this.id+"createCalForm");if(!C){this.createCalComp.CreateCalendar(null);C=Wtf.getCmp(this.id+"createCalForm")}this.showCalPanel(C);Wtf.getCmp(this.id+"newCal").disable()}else{Wtf.Msg.alert("Invalid Operation","You cannot exceed the calendar limit(max) of "+E+"!");return false}},onDayViewClick:function(A){this.RemoveMainPanelContent();Wtf.getCmp(this.id+"dayAction1").disable();this.seldate=this.calendar.getValue();var B=Wtf.getCmp(this.id+"dateText1");this.getval();if((this.currentview=="WorkWeekView")||(this.currentview=="WeekView")){B.setText(selecteddate+" "+Date.monthNames[this.seldate.getMonth()]+" "+this.seldate.getFullYear());this.ModifyView(selectedday,1,24,false);this.currentview="DayView"}else{this.currentview="DayView";B.setText(selecteddate+" "+Date.monthNames[this.seldate.getMonth()]+" "+this.seldate.getFullYear());this.AddDayView(selectedday,1,24)}this.onCalViewChange()},viewNextPrev:function(A){this.seldate=this.calendar.getValue();var D=Wtf.getCmp(this.id+"dateText1");if(this.currentview==("MonthView")){d1=this.seldate.add(Date.MONTH,A);this.calendar.setValue(d1);this.RemoveDiv();this.AddMonth();D.setText(Date.monthNames[d1.getMonth()]+" "+d1.getFullYear());this.seldate=this.calendar.getValue();var C=Wtf.getCmp(this.id+"MonthPanel1");this.showCalPanel(C)}else{var B=new Date();B=this.seldate.add(Date.DAY,A);this.calendar.setValue(B);this.seldate=this.calendar.getValue();if(this.currentview==("DayView")){this.removeFunction();D.setText(B.format("d F Y"));var E=Wtf.get(this.id+"calDay1");E.dom.innerHTML=B.format("D")+"/"+B.format("j");E.dom.style.display="block"}else{if(this.currentview==("WorkWeekView")||this.currentview==("WeekView")){this.removeFunction();if(this.currentview==("WorkWeekView")){selddate=this.selectDayDate(5);D.setText(selddate[1]+" "+selddate[0]+", "+selddate[6]+" - "+selddate[5]+" "+selddate[4]+", "+selddate[7]);this.changeDayHeaderText(5,selddate)}if(this.currentview==("WeekView")){selddate=this.selectDayDate(7);D.setText(selddate[1]+" "+selddate[0]+", "+selddate[6]+" - "+selddate[5]+" "+selddate[4]+", "+selddate[7]);this.changeDayHeaderText(7,selddate)}}else{if(this.currentview==("agendaView")){this.getval();D.setText(B.format("d F Y"));this.reloadAgenda()}}}}},RemoveMainPanelContent:function(){this.hideFormtoolbar();Wtf.getCmp(this.id+"pdfAction1").disable();if(Wtf.get(this.id+"dayPanel")!=null){this.removeFunction("DayView");Wtf.getCmp(this.id+"dayPanel").hide();Wtf.getCmp(this.id+"dayAction1").enable()}if(Wtf.get(this.id+"weekPanel")!=null){this.removeFunction("WeekView");Wtf.getCmp(this.id+"weekPanel").hide();Wtf.getCmp(this.id+"weekAction1").enable()}if(Wtf.get(this.id+"workWeekPanel")!=null){this.removeFunction("WorkWeekView");Wtf.getCmp(this.id+"workWeekPanel").hide();Wtf.getCmp(this.id+"workweekAction1").enable()}if(Wtf.get(this.id+"MonthPanel1")!=null){var A=Wtf.getCmp("Expand");if(A!=undefined){A.close()}Wtf.getCmp(this.id+"MonthPanel1").hide();Wtf.getCmp(this.id+"monthAction1").enable()}if(Wtf.get(this.id+"agendaPanel")!=null){Wtf.getCmp(this.id+"agendaPanel").hide();Wtf.getCmp(this.id+"agendaAction1").enable()}if(Wtf.get(this.id+"createCalForm")!=null){this.createCalComp.clearCalFormFields();this.createCalComp.selNodeId=null;Wtf.getCmp(this.id+"createCalForm").hide();Wtf.getCmp(this.id+"newCal").enable()}if(Wtf.get(this.id+"Appointmentform")!=null){Wtf.getCmp(this.id+"Appointmentform").hide()}},getval:function(){this.seldate=this.calendar.getValue();var A=this.seldate.format("d,D,M,Y,y").toLocaleString();this.day=[];this.day=A.split(",");selecteddate=this.day[0];selectedday=this.day[1]},ModifyOldView:function(A,C,D){var B=null;var E=null;if((B=Wtf.getCmp(this.id+"dayPanel"))){if(C==5||C==7){E="DayView";this.ModifyView(A,C,D,true,E)}else{this.addDays(C);this.showCalPanel(B)}}else{if((B=Wtf.getCmp(this.id+"workWeekPanel"))){if(C==1){E="WorkWeekView";this.ModifyView(A,C,D,false,E)}else{if(C==7){E="WorkWeekView";this.ModifyView(A,C,D,true,E)}else{this.addDays(C);this.showCalPanel(B)}}}else{if((B=Wtf.getCmp(this.id+"weekPanel"))){if(C==1||C==5){E="WeekView";this.ModifyView(A,C,D,false,E)}else{this.addDays(C);this.showCalPanel(B)}}}}},ModifyView:function(F,M,G,I,L){var J=null;var A=1;var E=G;var K=0;var O="";var N="";if(!L||L==""||L==undefined){L=this.currentview}if((L=="DayView")||(L=="WeekView")||(L=="WorkWeekView")){if(I){if(L=="DayView"){if(M==5){O="workWeekPanel";N="WorkWeekView"}else{O="weekPanel";N="WeekView"}J=Wtf.getCmp(this.id+"dayPanel")}else{if(L=="WorkWeekView"){A=5;O="weekPanel";N="WeekView";J=Wtf.getCmp(this.id+"workWeekPanel")}}this.addDays(M);var D=(99/M);for(var H=0;H<M;H++){var B=Wtf.getCmp(this.id+"_"+H);B.show();B.el.dom.style.width=D+"%"}J.hide();Wtf.ComponentMgr.unregister(J);var C=Wtf.get(this.id+L+"eventPanel");C.dom.id=this.id+N+"eventPanel";J.id=this.id+O;J.el.id=this.id+O;J.el.dom.id=this.id+O;Wtf.ComponentMgr.register(J)}else{if(L=="WeekView"){A=7;if(M==1){O="dayPanel";N="DayView"}else{O="workWeekPanel";N="WorkWeekView"}J=Wtf.getCmp(this.id+"weekPanel")}else{if(L=="WorkWeekView"){A=5;O="dayPanel";N="DayView";J=Wtf.getCmp(this.id+"workWeekPanel")}}this.addDays(M);var D=(99/M);for(var H=0;H<A;H++){var B=Wtf.getCmp(this.id+"_"+H);if(H>=M){B.hide()}else{B.el.dom.style.width=D+"%"}}Wtf.ComponentMgr.unregister(J);var C=Wtf.get(this.id+L+"eventPanel");C.dom.id=this.id+N+"eventPanel";J.id=this.id+O;J.el.id=this.id+O;J.el.dom.id=this.id+O;Wtf.ComponentMgr.register(J)}this.showCalPanel(J)}},addDays:function(H){var J=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var I=new Array(6);var A=93.5/H;this.getval();I=this.selectDayDate(H);var F=I[0];var B=I[2];var E=Wtf.get(this.id+"calDay0");E.dom.style.display="block";E.dom.style.width="4.5%";if(H==1){J[1]=selectedday}var G=7;for(var D=1;D<=G;D++){var C=Wtf.get(this.id+"calDay"+D);if(D<=H){if(F>I[3]){F=1}C.dom.style.display="block";C.dom.style.width=A+"%";C.dom.innerHTML=J[B++]+"/"+F;if(H!=1){F++}}else{C.dom.innerHTML="";C.dom.style.display="none"}}},addCells:function(F,H,D,A){var E=(100/A);var G=[];for(var C=0;C<D;C++){if(!G[C]||G[C]==undefined){G[C]=""}for(var B=(H);B<A;B++){G[C]+="<td id="+F+this.id+"cell_"+C+"_"+B+' style="z-index:-1000; border:1px solid #e8eef7; height:'+Wtf.fixHeight+"px;width="+E+'%" >&nbsp;</td>'}}return([E,G])},changeDayHeaderText:function(G,C){var A=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var F=93.5/G;this.getval();var H=C[0];var B=C[2];if(G==1){A[1]=selectedday}for(var E=1;E<=G;E++){var D=Wtf.get(this.id+"calDay"+E);if(H>C[3]){H=1}D.dom.innerHTML=A[B++]+"/"+H;if(G!=1){H++}}},AddDayView:function(B,I,C){var G=null;ctr=0;startDay=1;if(Wtf.getCmp(this.id+"dayPanel")||Wtf.getCmp(this.id+"workWeekPanel")||Wtf.getCmp(this.id+"weekPanel")){this.ModifyOldView(B,I,C)}else{if(I==1){G=this.id+"dayPanel"}else{if(I==7){G=this.id+"weekPanel"}else{if(I==5){G=this.id+"workWeekPanel"}}}if(!(Wtf.getCmp(G))){var F=this.createDays(I,startDay);var A=this.createHours(C);this.add(new Wtf.Panel({id:G,layout:"border",bodyStyle:"background-color:white",border:false,items:[{region:"center",layout:"fit",bodyStyle:"background-color:white",border:false,items:[{bodyStyle:"background-color:white;overflow-y:auto;overflow-x:hidden;",layout:"border",border:false,items:[{autoHeight:true,region:"center",border:false,layout:"fit",items:new Wtf.DataView({cls:"centerCalDview",store:new Wtf.data.JsonStore({url:"get-images.php",root:"images",fields:["name","url",{name:"size",type:"float"},{name:"lastmod",type:"date",dateFormat:"timestamp"}]}),id:this.id+"dview",multiSelect:true,overClass:"x-view-over",itemSelector:"div.thumb-wrap",emptyText:"<div id='"+this.id+this.currentview+"eventPanel' class=calevtPanel></div>",plugins:[new Wtf.DataView.DragSelector({calDrag:true,calContainer:this})]})},{region:"west",id:this.id+"fixHourPanel",autoHeight:true,border:false,width:42,cls:"fixedhourPanel"}]}]},{region:"north",id:this.id+"fixDayPanel",border:false,height:20,cls:"headerDays"}]}));var J=Wtf.getCmp(G);this.showCalPanel(J);new Wtf.Panel({id:this.id+"dayComp",renderTo:this.id+this.currentview+"eventPanel",layout:"column",baseCls:"dayCompPanel",items:[new Wtf.cal.oneDay({columnWidth:1,parent:this,id:this.id+"_0",currview:this.currentview,initcolcount:0}),new Wtf.cal.oneDay({columnWidth:0.167,parent:this,id:this.id+"_1",initcolcount:1}).hide(),new Wtf.cal.oneDay({columnWidth:0.167,parent:this,id:this.id+"_2",initcolcount:2}).hide(),new Wtf.cal.oneDay({columnWidth:0.167,id:this.id+"_3",parent:this,initcolcount:3}).hide(),new Wtf.cal.oneDay({columnWidth:0.167,parent:this,id:this.id+"_4",initcolcount:4}).hide(),new Wtf.cal.oneDay({columnWidth:0.167,parent:this,id:this.id+"_5",initcolcount:5}).hide(),new Wtf.cal.oneDay({columnWidth:0.167,parent:this,id:this.id+"_6",initcolcount:6}).hide()]});Wtf.get(this.id+"fixDayPanel").dom.innerHTML=F;Wtf.get(this.id+"fixHourPanel").dom.innerHTML=A;for(var E=0;E<C;E++){for(var D=0;D<7;D++){this.addDragCmp(this.id+"cell_"+E+"_"+D,false);var H=Wtf.get(this.id+"cell_"+E+"_"+D).dom;H.ondblclick=this.onCellClick}}}else{var J=Wtf.getCmp(G);this.showCalPanel(J)}}},createDays:function(J,B){var K=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var I=new Array(8);var E=93.5/J;var C=B;this.getval();var A="";A+="<div id="+this.id+'table2 style="background-color:#BDD3EF; color:#15428B; height:20px; width:98%;">';A+="<div id="+this.id+'calDay0 style="width:42px; display:block; float:left;vertical-align:middle; text-align:center; font-weight:bold; font-size:11px;">Time</div>';I=this.selectDayDate(J);var H=I[0];var D=I[2];if(J==1){K[1]=selectedday}var G=7;for(var F=1;F<=G;F++){if(F<=J){if(H>I[3]){H=1}A+="<div id="+this.id+"calDay"+F+' style="width:'+E+'%; display:block; float:left;vertical-align:middle; text-align:center; font-weight:bold; font-size:11px;">'+K[D++]+"/"+H+"</div>";if(J!=1){H++}}else{A+="<div id="+this.id+"calDay"+F+' style="width:'+E+'%; display:none; float:left;vertical-align:middle; text-align:center; font-weight:bold; font-size:11px;"></div>'}}A+="</div>";return A},createHours:function(B){var C;str="<div id="+this.id+'table1  style="width:42px;background-color:#E8EEF7; color:#15428B;">';for(var A=0;A<B;A++){C=Wtf.cal.utils.getHourStr(A);str+="<div id="+this.id+"hour_"+A+' style="display:block;width:42px;height:'+Wtf.fixHeight+'px;font-size:11px;text-align:center;vertical-align:top;" >'+C[0]+C[1]+"</div>"}str+="</div>";return str},selectDayDate:function(B){var D=new Array(8);var A=this.seldate.format("N");if(A==7){A=0}var E=new Date(this.seldate);if(B==7){E=new Date(E).add(Date.DAY,-A)}else{if(B==5){A--;E=new Date(E).add(Date.DAY,-A)}}var C=new Date(E).add(Date.DAY,(B-1));D[0]=E.format("j");D[1]=E.format("M");D[2]=((B==7)?0:1);D[3]=E.getLastDateOfMonth().format("j");D[4]=C.format("j");D[5]=C.format("M");D[6]=E.format("Y");D[7]=C.format("Y");return D},getdroi:function(){var D=new Date(this.seldate);var C=new Date(this.seldate);D.setDate(1);var J=D.getMonth();if(J!=11){C.setMonth(J+2);C.setDate(1);C.setDate(D.getDate()-1)}else{C.setMonth(0);C.setDate(31);C.setYear(D.getFullYear()+1)}if((!this.droi1)||(!this.droi2)){this.droi1=D;this.droi2=C;if(this.eStore&&this.eStore.getCount()){this.eStore.removeAll()}}else{var A=this.droi1.format("Y-m-d H:i:s");var H=this.droi2.format("Y-m-d H:i:s");var I=D.format("Y-m-d H:i:s");var F=C.format("Y-m-d H:i:s");if(A!=I&&H!=F){if(this.eStore&&this.eStore.getCount()){this.eStore.removeAll()}var B=[];var G=this.calTree.getChecked();for(var E=0;E<G.length;E++){G[E].attributes.request=false;B[E]=G[E].id}this.droi1=D;this.droi2=C;this.chkCalList=B}}},getStartEndDate:function(){var D=[];D[0]=new Date(this.seldate);D[1]=new Date(this.seldate);if(this.currentview!="MonthView"){var B=this.seldate.format("w");var C=0,E=0;if(this.currentview=="DayView"){D[1].setDate(D[0].getDate());this.startdate=D[0];D[1].setHours(23,59,59);this.enddate=D[1];this.getdroi();return D}else{if(this.currentview=="WeekView"){C=-B;E=6-B}else{if(this.currentview=="WorkWeekView"){C=-(B-1);E=5-B}}}D[0].setDate(this.seldate.getDate()+C);D[1].setDate(this.seldate.getDate()+E);D[1].setHours(23,59,59)}else{var A=new Date(this.seldate);A.setDate(1);D[0]=new Date(A);A.setMonth(A.getMonth()+1);A.setDate(A.getDate()-1);D[1]=A;D[1].setHours(23,59,59)}this.startdate=D[0];this.enddate=D[1];this.getdroi();return D},onCalViewChange:function(A){if(this.currentview!="agendaView"){this.getStartEndDate();this.getCalIds();this.triggerEvent()}},onCellClick:function(F){var B=this.id.split("cell_");var E=B[1].split("_");B[1]=parseInt(E[0]);var G=B[1]+"-"+(B[1]+1);var A=Wtf.get(this.id).getWidth();var D=Wtf.getCmp(B[0]);var C=Wtf.get(D.id+D.currentview+"eventPanel").getWidth();var A=(A/C)*100-1;D.eventWin.showWindowWeek(this.id,G,Wtf.fixHeight,A)},removeFunction:function(D){if(!D||D==""||D==undefined){D=this.currentview}this.getval();if((D==("DayView"))||(D==("WeekView"))||(D==("WorkWeekView"))){var B=Wtf.get(this.id+D+"eventPanel");for(var A=B.dom.childNodes.length-1;A>0;A--){var C=Wtf.get(B.dom.childNodes[A].id);C.remove()}}},HidingOtherCalendarEvent:function(C){var A=Wtf.query("div[name="+C+"]");for(var B=0;B<A.length;B++){this.HidingOtherSingleEvent(A[B].id)}if(this.currentView=="MonthView"){this.CalculateHowMore()}},ShowingOtherCalendarEvent:function(C){var A=Wtf.query("div[name="+C+"]");for(var B=0;B<A.length;B++){this.ShowingOtherSingleEvent(A[B].id)}},HidingOtherSingleEvent:function(A){A=Wtf.get(A).dom;A.className+=" HidingEvent"},ShowingOtherSingleEvent:function(B){B=Wtf.get(B).dom;var A=B.className.split(" HidingEvent");if(A.length==3){B.className=A[0]+" "+A[2]}else{B.className=A[0]}},ChangingOtherColor:function(F,B){var D=this.calTree.getNodeById(B).getUI().GetBackColor();var E=this.ApplyColorTransform(D,0.68);var A=Wtf.query("div[name="+B+"]");for(var C=0;C<A.length;C++){if(A[C].className!="moreDiv"){this._changeEventItemColor(B,A[C].id,D,E)}}},ChangingOtherSingleEventColor:function(A,B){var C=this.calTree.getNodeById(A).getUI().GetBackColor();var D=this.ApplyColorTransform(C,0.68);this._changeEventItemColor(A,B,C,D)},_changeEventItemColor:function(C,D,E,F){if(this.currentview=="MonthView"){this.ChangingMonthSingleEventColor(C,D)}else{var B=Wtf.get(D).dom;B.style.backgroundColor=E;B.style.borderColor=F;var A=D.split("_");A=Wtf.get(this.id+"wrapper_"+A[1]).dom;A.style.backgroundColor=F}},onWeekViewClick:function(){var B=Wtf.getCmp(this.id+"dateText1");this.RemoveMainPanelContent();var A=new Array(8);this.getval();this.seldate=this.calendar.getValue();A=this.selectDayDate(7);Wtf.getCmp(this.id+"weekAction1").disable();if((this.currentview=="DayView")||(this.currentview=="WorkWeekView")){B.setText(A[1]+" "+A[0]+", "+A[6]+" - "+A[5]+" "+A[4]+", "+A[7]);this.ModifyView(selectedday,7,24,true);this.currentview="WeekView"}else{this.currentview="WeekView";B.setText(A[1]+" "+A[0]+", "+A[6]+" - "+A[5]+" "+A[4]+", "+A[7]);this.AddDayView(selectedday,7,24)}this.onCalViewChange()},onWorkWeekViewClick:function(){var A=Wtf.getCmp(this.id+"dateText1");this.RemoveMainPanelContent();Wtf.getCmp(this.id+"workweekAction1").disable();this.seldate=this.calendar.getValue();this.getval();selddate=this.selectDayDate(5);if((this.currentview=="DayView")||(this.currentview=="WeekView")){A.setText(selddate[1]+" "+selddate[0]+", "+selddate[6]+" - "+selddate[5]+" "+selddate[4]+", "+selddate[7]);if(this.currentview=="DayView"){this.ModifyView(selectedday,5,24,true)}else{this.ModifyView(selectedday,5,24,false)}this.currentview="WorkWeekView"}else{this.currentview="WorkWeekView";A.setText(selddate[1]+" "+selddate[0]+", "+selddate[6]+" - "+selddate[5]+" "+selddate[4]+", "+selddate[7]);this.AddDayView(selectedday,5,24)}this.onCalViewChange()},onMonthViewClick:function(B){this.seldate=this.calendar.getValue();this.RemoveMainPanelContent();this.RemoveDiv();this.AddMonth();var A=Wtf.getCmp(this.id+"MonthPanel1");this.showCalPanel(A);Wtf.getCmp(this.id+"monthAction1").disable();Wtf.getCmp(this.id+"dateText1").setText(Date.monthNames[this.seldate.getMonth()]+" "+this.seldate.getFullYear());this.currentview="MonthView";this.onCalViewChange()},RemoveDiv:function(){var A=Wtf.getCmp(this.id+"MonthPanel1");if(A){A.destroy()}},AddMonth:function(){this.ResizeArray=[];var B=this.calendar.getValue();TodayMonth=B.getMonth()+1;TodayYear=B.getFullYear();this.add(new Wtf.Panel({id:this.id+"MonthPanel1",border:false,html:"<div style = 'width : 100%;height:100%' id='"+this.id+"MonthPanel2'></div>"}));this.doLayout();var D=Wtf.get(this.id+"MonthPanel2").dom;D.innerHTML+="<div style = 'width : 100%;height:100%' id ='"+this.id+"MonthPanel'></div>";var A=Wtf.get(this.id+"MonthPanel").dom;A.innerHTML+="<div id='"+this.id+"MonthDayTitle' style = 'background-color:#BDD3EF;height:19px;padding-top:3px;font-weight:bold;color:#15428B;font-size:11px; width:100%' ><div class='innerDiv ctext'>Sun</div><div class='innerDiv ctext'>Mon</div><div class='innerDiv ctext'>Tue</div><div class='innerDiv ctext'>Wed</div><div class='innerDiv ctext'>Thu</div><div class='innerDiv ctext'>Fri</div><div class='innerDiv ctext'>Sat</div></div><div id = '"+this.id+"MonthDayPanel' class = 'TotalDayPanel'></div>";this.AddDays();var C=Wtf.getCmp(this.id+"MonthPanel1");this.showCalPanel(C)},AddDays:function(){var C=this.CalculateDate();var A=C[2],F=1,B,J="BlurtaskPanel";var E="OneDayPanel";if(C[4]==42){E="OneDayPanel SmallDayPanel"}var G=Wtf.get(this.id+"MonthDayPanel").dom;for(var D=0;D<C[4];D++){if(D==C[0]){F=0;A=0;J="taskPanel"}else{if(A==C[1]&&F==0){A=0;F=1;C[3]=C[3]+2;if(C[3]==13){C[3]=1}J="BlurtaskPanel"}}A++;B=A;if(F==1){if(C[3]==14){C[3]=2}B=A+"/"+C[3]}else{if(B<10){B="0"+B}}var I=this.id+"Day2"+B;var H=this.id+"Day1"+B;Wtf.DomHelper.insertHtml("beforeEnd",G,"<div class = '"+E+"' id ='"+I+"'><div class = '"+J+"' id='"+H+"'><div class = 'taskPanel1'>"+B+"</div></div></div>");Wtf.get(H).addListener("click",this.DateSglClick,this);Wtf.get(H).addListener("dblclick",this.DateDblClick,this)}this.MakeDraggable(C[1]);this.doLayout()},DateDblClick:function(B){B.preventDefault();var A=new Date();var C=A.format("G")+"-";A.setHours(A.getHours()+1);C+=A.format("G");this.eventWin.showWindowWeek("",C,5,5)},AddItem:function(H,M,D,A,F,B,L){var C=Wtf.get(M.id).getWidth();var N=true;H=Wtf.util.Format.ellipsis(H,C/7);var J=Wtf.get(this.id+"e_"+B);if(J){if(J.dom.parentNode.id!=M.id){J.dom.parentNode.removeChild(J.dom)}else{J.dom.firstChild.innerHTML=H;N=false}}if(N){var K="eventPanel";var I="eventPanel";if(A>0){if(F==1){K="eventPanel moreright"}else{if(F==A){K="eventPanel ";I="eventPanel moreleft"}else{K="eventPanel moreright";I="eventPanel moreleft"}}}Wtf.DomHelper.append(M,{tag:"div",name:D,cls:"eventClass1",id:this.id+"e_"+B,html:"<div class='"+K+"' >"+H+"</div>"});this.ChangingMonthSingleEventColor(D,this.id+"e_"+B);Wtf.get(this.id+"e_"+B).on("dblclick",this.eventWin.showEventDetails);var G=Wtf.cal.utils.getPermissionLevel(this,D);if(G==""||G==1){if(L=="true"){this.MakeDropSource1(this.id+"e_"+B)}}}var E=this.CheckforChecked(D);if(E==false){this.HidingMonthCalendarSingleEvent(this.id+"e_"+B)}},addCalendarTab1:function(){this.hideFormtoolbar();this.showMaintoolbar();this.RemoveMainPanelContent();this.formview=null;if(this.currentview!="agendaView"){if(this.currentview=="DayView"){this.AddDayView(this.selectedday,1,24);Wtf.getCmp(this.id+"dayAction1").disable()}else{if(this.currentview=="WorkWeekView"){this.AddDayView(this.selectedday,5,24);Wtf.getCmp(this.id+"workweekAction1").disable()}else{if(this.currentview=="WeekView"){this.AddDayView(this.selectedday,7,24);Wtf.getCmp(this.id+"weekAction1").disable()}else{if(this.currentview=="MonthView"){this.RemoveDiv();this.AddMonth();Wtf.getCmp(this.id+"monthAction1").disable();var B=Wtf.getCmp(this.id+"MonthPanel1");this.showCalPanel(B)}}}}this.onCalViewChange()}else{this.RemoveMainPanelContent();var A=Wtf.getCmp(this.id+"agendaPanel");if(!A){Wtf.getCmp(this.id+"dateText1").setText(selecteddate+" "+Date.monthNames[this.seldate.getMonth()]+" "+this.seldate.getFullYear());this.Addagenda();A=Wtf.getCmp(this.id+"agendaPanel");this.showCalPanel(A)}else{this.showCalPanel(A);this.reloadAgenda()}this.currentview="agendaView";Wtf.getCmp(this.id+"agendaAction1").disable();Wtf.getCmp(this.id+"pdfAction1").enable()}},DateSglClick:function(B){var A=this.eventWin.getDateAndValue(B,TodayMonth,TodayYear);if(A){this.DifferBackGround(A.format("d"))}},DifferBackGround:function(A){if(this.selectedDate!=null){this.selectedDate.dom.style.backgroundColor="";daaa=this.selectedDate.dom.childNodes[0];daaa.style.backgroundColor=""}this.selectedDate=Wtf.get(this.id+"Day1"+A);if(this.selectedDate){daaa=this.selectedDate.dom.childNodes[0];daaa.style.backgroundColor="#BBCCDD";this.selectedDate.dom.style.backgroundColor="#FFFFCC"}},changeCalDate:function(A){if(A){this.calendar.setValue(A)}},ifArrayContains:function(B){for(var A=0;A<this.ResizeArray.length;A++){if(this.ResizeArray[A]==B){return true}}return false},AddToArray:function(A){this.ResizeArray.push(A)},RemoveExpandWin:function(){var C=Wtf.getCmp("Expand");if(C!=undefined){var F=Wtf.get("tempexpandDiv");if(F){var B=[];for(var E=0;E<F.dom.childNodes.length;E++){B[E]=F.dom.childNodes[E]}var A=B.length;for(var D=1;D<A;D++){B[D].style.display="none";C.eventContainer.appendChild(B[D])}}}},MakeDraggable:function(C){for(var B=1;B<=C;B++){var A=this.id+"Day1"+B;if(B<10){A=this.id+"Day10"+B}new Wtf.dd.DropZone(A,{ddGroup:"group"})}},MakeDropSource1:function(A){this.MakeDropSource(A)},ChangingMonthColor:function(B){var A=Wtf.query("div[name="+B+"]");for(var C=0;C<A.length;C++){this.ChangingMonthSingleEventColor(B,A[C].id)}},ChangingMonthSingleEventColor:function(D,C){var B=this.calTree.getNodeById(D).getUI().GetBackColor();var A=Wtf.get(C).dom;A.style.backgroundColor=B},HidingMonthCalendarSingleEvent:function(B){var A=Wtf.get(B);if(A){A.dom.className="eventPanel HidingEvent"}},ShowingMonthCalendarSingleEvent:function(B){var A=Wtf.get(B);if(A){A.dom.className="eventPanel"}},CheckforChecked:function(C){var B=this.calTree.getChecked();for(var A=0;A<B.length;A++){if(C==B[A].id){return true}}return false},checkMoreEvents:function(A){var C=Wtf.get(A.id).getHeight();var J=18;C=Math.round(C/J);var B=Wtf.get(A.id+"more");var F=0;var I=null;var D=0;for(var E=0;E<A.childNodes.length;E++){var G=A.childNodes[E];if(G.className!="moreDiv"){if(!G.className.match("HidingEvent")){D++}if(D<C){G.style.display="block";if(!I){I=G.getAttribute("name")}}else{G.style.display="none";F++}}}if(F>0){if(!B){var H=document.createElement("div");H.setAttribute("name",I);H.className="moreDiv";H.style.textAlign="right";H.style.fontSize="10px";H.style.width="100%";H.style.display="block";H.style.cursor="pointer";H.id=A.id+"more";H.innerHTML="+"+F+" more";A.appendChild(H);B=H}else{B.dom.style.display="block";B.dom.innerHTML="+"+F+" more";Wtf.get(B.id).removeListener("click",this.ShowRemaining,this)}Wtf.get(B.id).addListener("click",this.ShowRemaining,this)}else{if(B){B.dom.style.display="none"}}},CalculateHowMore:function(G,A,D){if(this.formview==null){if(this.currentview=="MonthView"){var C=Wtf.getCmp("Expand");if(C!=undefined){C.close()}if(D){this.checkMoreEvents(D)}else{var H=this.seldate.getDaysInMonth();for(var F=1;F<H;F++){var B=this.id+"Day1"+F;if(F<10){B=this.id+"Day10"+F}var E=Wtf.get(B);if(E){this.checkMoreEvents(E.dom)}}}}else{if(this.currentview!="agendaView"){this.onCalViewChange()}}}},ShowRemaining:function(M){M.preventDefault();M.stopPropagation();targetdiv=M.target;if(targetdiv.className=="moreDiv"){if(targetdiv.parentNode){var K=targetdiv.parentNode;var J=Wtf.getCmp("Expand");var N=Wtf.get(K.id);if(J){J.close()}else{J=new Wtf.Window({id:"Expand",header:false,footer:false,autoHeight:true,width:"15%",cls:"remainingevents",closable:true,renderTo:document.body,eventContainer:null,shim:false,draggable:false,shadow:false});J.show();var F=document.createElement("div");F.id="tempexpandDiv";J.add(F);if(N){var P=N.getXY();var C=Wtf.get(this.id+"MonthPanel");var B=(N.getWidth()/5);var L=(N.getHeight()/5);var D=C.getWidth()-B;var I=C.getHeight()-L;if(P[0]>=D){P[0]=P[0]-B}if(P[1]>=I){P[1]=P[1]-L}J.setPagePosition(P[0],P[1]);J.eventContainer=K;J.setTitle(K.childNodes[0].innerHTML+" "+Date.getShortMonthName(this.seldate.getMonth()));J.doLayout();var H=K.childNodes.length;var A=[];for(var E=0;E<H;E=E+1){A[E]=K.childNodes[E]}for(var G=1;G<A.length;G++){var O=A[G];if(O.className!="moreDiv"){O.style.display="block";F.appendChild(O);this.MakeDropSource1(O)}else{K.removeChild(O)}}J.on("beforeclose",function(Q){this.RemoveExpandWin()},this);J.on("close",function(Q){this.CalculateHowMore()},this)}}}}},onAgendaClick:function(){Wtf.getCmp(this.id+"dateText1").setText(selecteddate+" "+Date.monthNames[this.seldate.getMonth()]+" "+this.seldate.getFullYear());this.RemoveMainPanelContent();var A=Wtf.getCmp(this.id+"agendaPanel");if(!A){this.Addagenda();A=Wtf.getCmp(this.id+"agendaPanel");this.showCalPanel(A)}else{this.showCalPanel(A);this.reloadAgenda()}this.currentview="agendaView";Wtf.getCmp(this.id+"agendaAction1").disable();Wtf.getCmp(this.id+"pdfAction1").enable()},ontodoClick:function(){var A=Wtf.getCmp("list_conainer"+this.id);if(!A){A=new Wtf.Panel({title:"My To-Do List",layout:"fit",id:"list_conainer"+this.id,closable:true,autoScroll:true,tabType:Wtf.etype.todo,iconCls:getTabIconCls(Wtf.etype.todo),items:[new Wtf.TodoList({autoScroll:true,title:"To-Do list",id:"todo_list"+this.id,layout:"fit",userid:this.ownerid.userid,groupType:this.ownerid.type,animate:true,baseCls:"todoPanel",enableDD:true,containerScroll:true,border:false,rootVisible:false})]});Wtf.getCmp("as").add(A);Wtf.getCmp("as").doLayout()}Wtf.getCmp("as").setActiveTab(A)},Addagenda:function(){dt1=new Date(this.seldate);dt2=new Date(this.seldate);dt2.setMonth(dt1.getMonth()+2);var B=new Wtf.data.Store({url:Wtf.req.cal+"calEvent.jsp",reader:new Wtf.data.JsonReader({root:"data",totalProperty:"totalCount"},["eid","cid","startts","endts","subject","descr","location","showas","priority","recpattern","recend","resources","timestamp","dbflag"])});var D=new Wtf.grid.CheckboxSelectionModel();var A=new Wtf.grid.ColumnModel([D,{header:"eid",dataIndex:"eid",hidden:true},{header:"Event(s)",width:100,dataIndex:"subject"},{header:"Location",width:100,dataIndex:"location"},{header:"Day",width:100,dataIndex:"eventday"},{header:"Date",width:100,dataIndex:"eventdate"},{header:"Time",width:100,dataIndex:"eventtime"},{header:"Priority",width:100,dataIndex:"eventpri"}]);A.defaultSortable=true;var C=new Wtf.grid.GridPanel({ds:B,cm:A,loadMask:true,id:this.id+"_agendaGrid",sm:D,layout:"fit",width:"100%",height:"100%",headerStyle:"background-color: rgb(231,240,250) ",viewConfig:{forceFit:true}});B.baseParams={calView:1,action:0,cidList:this.chkCalList,viewdt1:dt1.format("Y-m-d 00:00:00"),viewdt2:dt1.add(Date.DAY,15).format("Y-m-d 24:00:00")};B.load({params:{start:0,limit:10}});B.on("Load",function(){for(var J=0;J<B.getCount();J++){var L=Wtf.cal.utils.sqlToJsDate(B.getAt(J).data["startts"]);var M=Wtf.cal.utils.sqlToJsDate(B.getAt(J).data["endts"]);var F=new Date(L);var E=new Date(M);var G=B.getAt(J);var I=F.format("d M")+" - "+E.format("d M");var H=F.format("g:i A")+" - "+E.format("g:i A");var K=B.getAt(J).data["priority"];if(K=="h"){K="High"}else{if(K=="m"){K="Moderate"}else{if(K=="l"){K="Low"}}}G.set("eventdate",I);G.set("eventtime",H);G.set("eventday",F.format("l"));G.set("eventpri",K)}});B.on("loadexception",this.showErrorBox,this);this.add(new Wtf.Panel({id:this.id+"agendaPanel",frame:false,layout:"fit",width:"100%",border:false,items:[{border:false,id:this.id+"agendaPanel1",width:"100%",layout:"fit",items:C,tbar:[{text:"Edit",id:this.id+"_editAgenda",iconCls:"pwnd editicon caltb"},{text:"Delete",id:this.id+"_deleteAgenda",iconCls:"pwnd deliconwt caltb"}]}]}));this.doLayout();Wtf.get(this.id+"_editAgenda").on("click",this.editEvent,this);Wtf.get(this.id+"_deleteAgenda").on("click",this.deleteAgendaEvent,this);Wtf.getCmp(this.id+"_agendaGrid").on("celldblclick",this.editEvent,this)},editEvent:function(){var D=Wtf.getCmp(this.id+"_agendaGrid");var M=D.getSelectionModel();var F=M.getSelections();var A=D.getStore();var G=M.getCount();if(G==1){var K=F[0].get("eid");var C=A.find("eid",K);var J=A.getAt(C);var B=new Date(Wtf.cal.utils.sqlToJsDate(J.data["startts"]));var E=new Date(Wtf.cal.utils.sqlToJsDate(J.data["endts"]));var I=[];I[0]=J.data["subject"];I[1]=J.data["location"];var H=B.format("i");if(H&&H!="00"){I[2]=B.format("g:i A");I[3]=E.format("g:i A")}else{I[2]=B.format("G");I[3]=E.format("G")}I[4]=B;I[5]=E;I[6]=J.data["descr"];I[7]=J.data["showas"];I[8]=J.data["priority"];I[9]=J.data["recpattern"];if(J.data["recend"]!=""){I[10]=(Wtf.cal.utils.sqlToJsDate(J.data["recend"])).format("Y-m-d 00:00:00");var L=new Date(Wtf.cal.utils.sqlToJsDate(J.data["recend"]));I[12]=L}else{I[10]=this.defaultTS}I[11]=J.data["resources"];I[13]=J.data["cid"];I[14]=J.data["dbflag"];this.RemoveMainPanelContent();eventfrm=new Wtf.cal.eventForms(this);eventfrm.AddingTabPanelEvent();eventfrm.AddingEventValues(I,K)}else{if(G==0){Wtf.Msg.alert("Error","Please select a row to edit")}else{Wtf.Msg.alert("Error","Select only one event at a time")}}},deleteAgendaEvent:function(){var D=Wtf.getCmp(this.id+"_agendaGrid");var M=D.getSelectionModel();var F=M.getSelections();var B=D.getStore();var G=M.getCount();if(G==0){Wtf.Msg.alert("Error","Please select a row to delete")}else{var K="";var J="";for(var E=0;E<(G);E++){var A=F[E].get("eid");var C=Wtf.cal.utils.getPermLevelByEid(this,A);if(C!=""&&C>1){Wtf.Msg.alert("Invalid Operation","You dont have sufficient privileges to delete the event(s)!");return false}var L=B.find("eid",A);if(L!=-1){var H=B.getAt(L).data["cid"];var I=B.getAt(L).data["dbflag"];if(I=="true"){K+=A+",";J+=H+","}else{Wtf.Msg.alert("Invalid Operation","You dont have sufficient privileges to delete the event(s)!");return false}}}Wtf.MessageBox.confirm("Confirm Delete","Are you sure you want to delete the event?",function(N){if(N=="yes"){var O=[K,J];this.deleteEvent(O,"1")}},this)}},reloadAgenda:function(B){dt1=new Date(this.seldate);dt2=new Date(this.seldate);if(B){dt2.setDate(dt1.getDate())}else{dt2.setDate(dt1.getDate()+15)}var A=Wtf.getCmp(this.id+"_agendaGrid");var C=A.getStore();C.baseParams={calView:1,action:0,cidList:this.chkCalList,viewdt1:dt1.format("Y-m-d 00:00:00"),viewdt2:dt2.format("Y-m-d 24:00:00")};C.load({params:{start:C.lastOptions.params["start"],limit:C.lastOptions.params["limit"]}})},CalculateDate:function(){var H=new Array(10);var B=new Date();var D=this.calendar.getValue();var G=D.getMonth()+1;TadayMonth=D.getMonth();TadayYear=D.getFullYear();var F=D.getFullYear();B=Date.parseDate(F+"-"+G+"-01","Y-n-d");if(G==2){B=Date.parseDate(F+"-Feb-01","Y-M-d")}H[0]=B.getFirstDayOfMonth();H[1]=B.getDaysInMonth();var A=new Date();var C=B.getMonth();var E=F+"-"+C;A=Date.parseDate(E,"Y-n");H[2]=A.getDaysInMonth()-H[0];H[3]=C;if(H[3]==0){H[3]=12}H[4]=35;switch(H[0]){case 5:if(H[1]==31){H[4]=42}break;case 6:if(H[1]==31||H[1]==30){H[4]=42}break}return H},onPrevClick:function(A){if(this.currentview!=("agendaView")){if(this.currentview==("WorkWeekView")||this.currentview==("WeekView")){this.viewNextPrev(-7)}else{if(this.currentview==("DayView")){this.viewNextPrev(-1)}else{if(this.currentview==("MonthView")){this.viewNextPrev(-1)}}}this.onCalViewChange()}else{this.viewNextPrev(-15)}},onNextClick:function(A){if(this.currentview!=("agendaView")){if(this.currentview==("WorkWeekView")||this.currentview==("WeekView")){this.viewNextPrev(7)}else{if(this.currentview==("DayView")){this.viewNextPrev(1)}else{if(this.currentview==("MonthView")){this.viewNextPrev(1)}}}this.onCalViewChange()}else{this.viewNextPrev(15)}},DblClick:function(A){showWindow(A)},getCurrentDate:function(){var C=7;var G=Wtf.getCmp(this.id+"dateText1");if(this.currentview!="agendaView"){if(this.currentview==("WorkWeekView")||this.currentview==("WeekView")){if(this.currentview==("WorkWeekView")){C=5}if(this.calendar!=null){var E=this.calendar.getValue();this.removeFunction();selddate=this.selectDayDate(C);G.setText(selddate[1]+" "+selddate[0]+", "+selddate[6]+" - "+selddate[5]+" "+selddate[4]+", "+selddate[7]);this.changeDayHeaderText(C,selddate)}}else{if(this.currentview==("DayView")){if(this.calendar!=null){var E=this.calendar.getValue();this.removeFunction();G.setText(selecteddate+" "+Date.monthNames[E.getMonth()]+" "+E.getFullYear());var H=Wtf.get(this.id+"calDay1");var F=selectedday.substring(0,3);H.dom.innerHTML=F+"/"+selecteddate;H.dom.style.display="block"}}else{if(this.currentview==("MonthView")){var E=this.calendar.getValue();var B=new Date();var D=new Date();B=E.getMonth();D=E.getFullYear();if(B!=TadayMonth||D!=TadayYear){TadayMonth=B;TadayYear=D;this.RemoveDiv();this.AddMonth();var A=this.calendar.getValue();G.setText(Date.monthNames[A.getMonth()]+" "+A.getFullYear())}B=E.getDate();if(B>=1&&B<=9){B="0"+B}this.DifferBackGround(B);this.seldate=this.calendar.getValue()}}}this.onCalViewChange()}else{var E=this.calendar.getValue();this.removeFunction();G.setText(selecteddate+" "+Date.monthNames[E.getMonth()]+" "+E.getFullYear());this.reloadAgenda(true)}},MakeDropSource:function(A){var B=Wtf.get(A);B.dd=new Wtf.cal.DDProxy(A,"group")},ApplyColorTransform:function(A,C){var D=[];if(!A.match("#")){D=A.replace(/rgb\(|\)/g,"").split(",")}else{var B=A.substr(1);D=[Wtf.cal.utils.HexToDec(B.substring(0,2)),Wtf.cal.utils.HexToDec(B.substring(2,4)),Wtf.cal.utils.HexToDec(B.substring(4,6))]}return String.format("rgb({0}, {1}, {2})",Wtf.cal.utils.MultiplyInt(D[0],C),Wtf.cal.utils.MultiplyInt(D[1],C),Wtf.cal.utils.MultiplyInt(D[2],C))},addDragCmp:function(B,C){if(C){var A=new Wtf.cal.EventDZ(B,{ddGroup:"group",scroll:false})}else{var A=new Wtf.cal.EventDT(B,{ddGroup:"group"})}},getCalIds:function(){var D=0;var E=[];var B=[];var C=this.calTree.getChecked();for(var A=0;A<C.length;A++){if(!C[A].attributes.request){E[D++]=C[A].id}B[A]=C[A].id}this.calList=E;this.chkCalList=B},MakingMoreDaysEventRemove:function(C,F,B){var D=new Date(TodayMonth+"/"+B+"/"+TodayYear);var G=F;var J="";var I;var H;for(i=0;i<(J.length-1);i++){var A=J[i];I="";if(I==F){H=Wtf.get(J[i]).dom;if(TodayMonth==D.format("n")){var E=Wtf.get(this.id+"Day1"+D.format("d")).dom;E.appendChild(H)}else{H.parentNode.removeChild(I)}D=D.add(Date.DAY,1)}}I.className+=" moreleft"},insertCalendar:function(rec){Wtf.Ajax.request({method:"GET",url:this.url,params:({action:1,cname:rec[0],description:rec[1],location:rec[2],timezone:rec[3],colorcode:rec[4],caltype:rec[5],isdefault:rec[6],userid:rec[7],permission:rec[8]}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","Create Calendar Failed!")}},failure:function(result,req){msgBoxShow(["Error","Error in connection"],Wtf.MessageBox.INFO)}})},updateCalendar:function(rec){Wtf.Ajax.request({method:"GET",url:this.url,params:({action:2,cid:rec[0],cname:rec[1],description:rec[2],location:rec[3],timezone:rec[4],colorcode:rec[5],caltype:rec[6],isdefault:rec[7],userid:rec[8],permission:rec[9]}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","Calendar Updation Failed!")}},failure:function(result,req){msgBoxShow(["Error","Error in connection"],Wtf.MessageBox.INFO)}})},deleteCalendar:function(rec){Wtf.Ajax.request({method:"GET",url:this.url,params:({action:3,cid:rec.data["cid"],isdefault:rec.data["isdefault"],caltype:this.calTree.ownerid.type,userid:this.calTree.ownerid.userid}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","Calendar Deletion Failed!")}},failure:function(result,req){msgBoxShow(["Error","Error in connection"],Wtf.MessageBox.INFO)}})},deleteRenderedEvents:function(A){},setRequestAttribute:function(){for(var A=0;A<this.calList.length;A++){var B=this.calTree.getNodeById(this.calList[A]);if(B){B.attributes.request=true}}},showErrorBox:function(){msgBoxShow(["ERROR","A problem occurred while loading Events"],Wtf.MessageBox.INFO);this.loadMask.hide()},getEvents:function(C,B,A){if(!this.eStore){this.eStore=new Wtf.calStore();this.eStore.on("loadexception",this.showErrorBox,this);this.eStore.on("load",this.renderLoadedEvent,this);this.eStore.load({params:{calView:0,action:0,cid:C,startts:this.droi1.format("Y-m-d 00:00:00"),endts:this.droi2.format("Y-m-d 24:00:00")}})}else{if(!this.eStore.getCount()){this.eStore.load({params:{calView:0,action:0,cid:C,startts:this.droi1.format("Y-m-d 00:00:00"),endts:this.droi2.format("Y-m-d 24:00:00")}})}else{if(!this.tmpStore){this.createTempStore();this.tmpStore.load({params:{calView:0,action:0,cid:C,startts:this.droi1.format("Y-m-d 00:00:00"),endts:this.droi2.format("Y-m-d 24:00:00")}})}else{this.tmpStore.load({params:{calView:0,action:0,cid:C,startts:this.droi1.format("Y-m-d 00:00:00"),endts:this.droi2.format("Y-m-d 24:00:00")}})}}}this.loadMask.show()},createTempStore:function(){this.tmpStore=new Wtf.calStore();this.tmpStore.on("load",this.addToMainStore,this);this.tmpStore.on("loadexception",this.showErrorBox,this)},renderLoadedEvent:function(C,B,A){if(A){this.findAndRender();this.setRequestAttribute()}this.loadMask.hide()},addToMainStore:function(B,C,A){this.eStore.checkAndAdd(B,"eid");B.removeAll();this.findAndRender();this.setRequestAttribute();this.loadMask.hide()},findAndRender:function(){var B=[this.chkCalList,this.startdate.format("Y-m-d 00:00:00"),this.enddate.format("Y-m-d 24:00:00")];var A=this.eStore.findRec(["cid","startts","endts"],B,["0","3","4"]);if(A){this.renderEventsOnPanel(A)}},renderEventsOnPanel:function(D){for(var A=0;A<D.length;A++){if(this.currentview!="MonthView"){var C=Wtf.getCmp(this.id+"e_"+D[A].data["eid"]);if(C&&C!=undefined){C.destroy()}this.createChipBody(D[A])}else{var B=Wtf.get(this.id+"Day1"+Wtf.cal.utils.sqlToJsDate(D[A].data["startts"]).format("d")).dom;this.AddItem(D[A].data["subject"],B,D[A].data["cid"],0,0,D[A].data["eid"],D[A].data["dbflag"]);this.CalculateHowMore(null,null,B)}}},createChipBody:function(F){var N=F.data["eid"];var K=Wtf.cal.utils.sqlToJsDate(F.data["startts"]);var O=Wtf.cal.utils.sqlToJsDate(F.data["endts"]);var G=F.data["subject"];var D=F.data["cid"];var L=K.format("G");var B=O.format("G");eh=(B-L)*Wtf.fixHeight;var E=0;if(this.currentview=="WorkWeekView"){E=K.getDay()-1}else{if(this.currentview!="DayView"){E=K.getDay()}}var I=K.format("g:i A")+"-"+O.format("g:i A");if(B=="24"){B="0"}var C=this.id+"cell_"+L+"_"+E;var M=Wtf.get(C);var H=M.getWidth();var A=Wtf.get(this.id+this.currentview+"eventPanel").getWidth();var J=(H/A)*98-1;this.eventWin.createEventCell(N,M,I,G,eh,J,D,F.data["timestamp"],F.data["dbflag"]);this.updatecellvalue(D,L,B,K,E,J)},triggerEvent:function(){if(this.calList.length){this.getEvents(this.calList,this.startdate.format("Y-m-d H:00:00"),this.enddate.format("Y-m-d 23:59:59"))}else{if(this.eStore){this.findAndRender()}}},insertEvent:function(rec){Wtf.Ajax.request({method:"GET",url:Wtf.req.cal+"calEvent.jsp",params:({calView:0,action:1,eid:rec[0],cid:rec[1],startts:rec[2],endts:rec[3],subject:rec[4],descr:rec[5],location:rec[6],showas:rec[7],priority:rec[8],recpattern:rec[9],recend:rec[10],resources:rec[11],userid:rec[12],reminders:rec[13]}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","Event Updation Failed!")}},failure:function(result,req){msgBoxShow(["Error","Error in connection"],Wtf.MessageBox.INFO)}})},updateEvent:function(rec,view){Wtf.Ajax.request({method:"GET",url:Wtf.req.cal+"calEvent.jsp",params:({calView:view,action:2,eid:rec[0],cid:rec[1],startts:rec[2],endts:rec[3],subject:rec[4],descr:rec[5],location:rec[6],showas:rec[7],priority:rec[8],recpattern:rec[9],recend:rec[10],resources:rec[11],userid:rec[12],reminders:rec[13],fullupdate:rec[14]}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","Event Updation Failed!")}},failure:function(result,req){msgBoxShow(["Error","Error in connection"],Wtf.MessageBox.INFO)}})},deleteEvent:function(rec,view){Wtf.Ajax.request({method:"GET",url:Wtf.req.cal+"calEvent.jsp",params:({calView:view,action:3,eid:rec[0],cid:rec[1]}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","Event(s) doesn't exist or its already deleted!")}},failure:function(result,req){msgBoxShow(["Error","Error in connection"],Wtf.MessageBox.INFO)}})},updatecellvalue:function(U,V,X,R,T,S){var B=["cid","startts","startts"];var Z=[this.chkCalList,R.format("Y-m-d 00:00:00"),R.format("Y-m-d 23:59:59")];var E=["0","3","4"];var C=this.eStore.findRec(B,Z,E,false,false);var K=[];var Q=false;var O=0;var P;for(var L=0;L<C.length;L++){var H=C[L].data["eid"];P=Wtf.getCmp(this.id+"e_"+H);if(P){Q=true;var I=P.cellId;var N=parseInt(I.split("_")[1]);var Y=parseInt(P.el.getHeight()/30)+N;if((V>=N&&V<=Y)||(X>N&&X<=Y)){K[O]=[H,"d",++O]}}}if(Q){for(L=0;L<O;L++){var J=Wtf.getCmp(this.id+"e_"+K[L][0]);var W=Wtf.get(this.id+"_"+T).getWidth();var Z=0;if(O>1){Z=W/O}var M=Wtf.get(J.cellId);var A=M.getXY();var D=S;if(O){D=D/O}var G=A[0]+2+(Z*L);J.el.dom.style.width=D+"%";var F=A[1];J.el.dom.style.left=G-(Wtf.get("navigationpanel").getWidth()+46)+"px"}}},CalculatingTotalCalendar:function(){if(!this.tempCalStore){var A=[],B=0;var C=this.calTree.agendaStore.queryBy(function(D){var E=D.get("permissionlevel");if(E=="2"){return false}A[B++]=[D.get("cid"),D.get("cname")];return true},this);this.tempCalStore=new Wtf.data.SimpleStore({fields:["id","state1"],data:A})}else{if(this.tempCalStore.getCount()){this.tempCalStore.removeAll()}var B=0;this.calTree.agendaStore.each(function(D){var E=new Wtf.cal.utils.tempCalRec({id:D.get("cid"),state1:D.get("cname")});this.tempCalStore.insert(B++,E)},this)}},showCalPanel:function(A){A.show();this.layout.activeItem=A;this.doLayout()},saveEvent:function(){var I=Wtf.getCmp(this.id+"Subject").getValue();I=Wtf.cal.utils.HTMLScriptStripper(I);if(I==""){Wtf.cal.utils.ShowErrorMsgBox("Please enter the required field(s)!");return }var W=(Wtf.getCmp(this.id+"sdate1").getValue()).format("Y-m-d");var S=Wtf.getCmp(this.id+"Description").getValue();S=Wtf.cal.utils.HTMLScriptStripper(S);if(!S||S=="undefined"){S=""}var C=Wtf.getCmp(this.id+"Resources").getValue();C=Wtf.cal.utils.HTMLScriptStripper(C);if(!C||C=="undefined"){C=""}var F=Wtf.getCmp(this.id+"showas").getValue();var X=Wtf.getCmp(this.id+"comboPriority").getValue();var N=Wtf.getCmp(this.id+"stime1").getValue();var E=Wtf.getCmp(this.id+"etime1").getValue();var M=parseInt(N);var J=parseInt(E);if(M>=J){Wtf.cal.utils.ShowErrorMsgBox("Please enter a valid start time / end time");return }var L=Wtf.get(this.id+"Location").getValue();L=Wtf.cal.utils.HTMLScriptStripper(L);if(!L||L=="undefined"){L=""}var H=Wtf.getCmp(this.id+"RecurringPattern");var D="";for(var V=0;V<5;V++){if(Wtf.getCmp(this.id+"MainRemindPanel"+V)!=undefined){D+=Wtf.getCmp(this.id+"PopupCombo"+V).getValue();D+="_"+Wtf.getCmp(this.id+"ReminderEndTime"+V).getValue()+",";Wtf.getCmp(this.id+"MainRemindPanel"+V).destroy()}}var G=Wtf.getCmp(this.id+"guestGrid");var A=G.getStore();var P="";var U;for(var V=0;V<A.getCount();V++){U=this.setResponse(A.getAt(V).get("response"));P+=A.getAt(V).get("userid");P+="/"+A.getAt(V).get("username");P+="_"+U+","}var R;R="";this.rec[3]=this.defaultTS;if(this.EventClick==""){if(this.currentview!="agendaView"){K=Wtf.getCmp(this.id+"calendarweek").getValue();var B=["0",K,W+" "+N+":00:00.00",W+" "+E+":00:00.00",I,S,L,F,X,R,this.rec[3],C,P,D];this.insertEvent(B)}}else{if(this.currentview=="agendaView"){var O=this.EventClick;var G=Wtf.getCmp(this.id+"_agendaGrid");if(G&&G!=undefined){var Y=null;var Q=G.getStore();var T=Q.find("eid",O);if(T!=-1){Y=Q.getAt(T).data["cid"];var B=[this.EventClick,Y,W+" "+N+":00:00.00",W+" "+E+":00:00.00",I,S,L,F,X,R,this.rec[3],C,P,D,1];this.updateEvent(B,"1")}}}else{var O=this.EventClick.split("e_")[1];var T=this.eStore.find("eid",O);var K=null;if(T!=-1){K=this.eStore.getAt(T).data["cid"]}var B=[O,K,W+" "+N+":00:00.00",W+" "+E+":00:00.00",I,S,L,F,X,R,this.rec[3],C,P,D,1];this.updateEvent(B,"0")}}this.addCalendarTab1()},onSaveClick:function(){this.saveEvent();for(i=0;i<4;i++){this.rec[i]=""}this.Calendar_countReminder=0},onDeleteClick:function(){Wtf.MessageBox.confirm("Confirm Delete","Are you sure you want to delete the event?",function(E){if(E=="yes"){if(this.EventClick==""){Wtf.Msg.alert("Error","No event to delete");return }else{if(this.currentview=="agendaView"){var A=Wtf.getCmp(this.id+"_agendaGrid");if(A&&A!=undefined){var D=null;var F=A.getStore();var C=F.find("eid",this.EventClick);if(C!=-1){D=F.getAt(C).data["cid"];var G=[this.EventClick,D];this.deleteEvent(G,"1")}}}else{var B=this.EventClick.split("e_")[1];var C=this.eStore.find("eid",B);var H=null;if(C!=-1){H=this.eStore.getAt(C).data["cid"]}var G=[B,H];this.deleteEvent(G,"0")}}this.addCalendarTab1()}},this)},show1:function(B){if(B=="yes"){this.saveEvent()}if(B=="no"){this.addCalendarTab1()}for(var A=0;A<4;A++){this.rec[A]=""}this.Calendar_countReminder=0},onCloseClick:function(){if(this.calPerm==""||this.calPerm==1){if(this.dbflag=="true"){Wtf.Msg.show({title:"Save Changes?",msg:"Would you like to save your changes?",buttons:Wtf.Msg.YESNOCANCEL,fn:this.show1,scope:this,animEl:"elId",icon:Wtf.MessageBox.QUESTION})}else{this.addCalendarTab1()}}else{this.addCalendarTab1()}},setResponse:function(A){if(A=="Accepted"){return("a")}else{if(A=="Rejected"){return("r")}else{return("p")}}}});Wtf.TodoList=function(A){Wtf.apply(this,A);this.nodeHash={};this.url=A.url;if(!this.url){this.url=Wtf.req.prj+"todolistmanager.jsp"}this.groupForm=null;this.taskform=null;this.newTaskWindow=null;this.priorityCombo=null;this.assignedCombo=null;this.taskNameField=null;this.tbar=[{iconCls:"addnewgroup",text:"Add new Task Group",tooltip:"Add new Task Group",handler:this.addTaskGroup,scope:this},{iconCls:"addnew",tooltip:"Add new Task",text:"Add new Task",handler:this.addTask,scope:this},{iconCls:"deleteselected",tooltip:"Delete selected",text:"Delete selected",handler:this.deleteSelected,scope:this}];this.listRoot=new Wtf.tree.TreeNode({draggable:false,id:"root_todo"+A.id});this.setRootNode(this.listRoot);if(A.groupType==Wtf.etype.proj){this.memberstore=new Wtf.data.Store({method:"GET",id:"tempstore",url:"jspfiles/project/getProjectMembers.jsp?login="+A.userid+"&pageno=0&pageSize=10000",reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"name",type:"string"},{name:"id",type:"string"}]})});this.memberstore.load()}this.reader=new Wtf.data.JsonReader({root:"data",fields:[{name:"description"},{name:"taskid"},{name:"parentId"},{name:"status"},{name:"taskorder"},{name:"assignedto"},{name:"leafflag"}]});this.ds1=new Wtf.data.Store({url:this.url,baseParams:{action:1,userid:A.userid,grouptype:A.groupType},reader:this.reader});this.selModel=new Wtf.tree.MultiSelectionModel({id:"test"+this.id}),this.ds1.on("load",this.dataRefresh,this);this.ds1.load();Wtf.TodoList.superclass.constructor.call(this);this.on("movenode",this.nodeMoved,this);this.on("beforemovenode",this.beforeNodeMove,this);this.on("contextmenu",this.contextMenu,this);this.getSelectionModel().on("selectionchange",this.selectionChange,this)};Wtf.extend(Wtf.TodoList,Wtf.tree.TreePanel,{dataRefresh:function(E,J,H){for(var I=0;I<J.length;I++){var O=J[I].get("description");var C=J[I].get("taskid");var A=parseInt(J[I].get("status"));var D=parseInt(J[I].get("taskorder"));var N=J[I].get("parentId");var K=J[I].get("assignedto");var L=Boolean(J[I].get("leafflag"));var G=false;N=this.getNodeById(N);var F="todoNode";if(!N){N=this.listRoot}if(!L){F="groupNode"}if(A==1){G=true}else{G=false}var M=new Wtf.tree.TreeNode({id:C,checked:G,text:O,iconCls:F,leaf:L,nodestate:A,Torder:D,assignedTo:K});N.insertBefore(M,N.item(D));N.expand();if(A==1){M.ui.getTextEl().style.textDecoration="line-through"}M.on("checkchange",this.nodeCheckChange,this);M.on("dblclick",this.editNode,this)}var B=this.getChecked();if(B.length<=0){this.getTopToolbar().items.items[2].disable()}else{this.getTopToolbar().items.items[2].enable()}},contextMenu:function(A,B){A.select();menu=new Wtf.menu.Menu({id:"todotreeMenu",items:[{text:"Edit",id:"name",iconCls:"pwnd renameicon",scope:this,handler:this.editNodeOncontextMenu},new Wtf.Action({text:"Delete",iconCls:"pwnd delicon",scope:this,handler:this.deleteSelected})]});menu.showAt(B.getXY())},editNodeOncontextMenu:function(){if(this.getSelectionModel().getSelectedNodes()[0].isLeaf()){this.editnode(this.getSelectionModel().getSelectedNodes()[0])}else{this.editGroup(this.getSelectionModel().getSelectedNodes()[0])}},beforeNodeMove:function(A,E,C,D,B){if(!E.isLeaf()&&D!=this.listRoot){return false}},deleteSelected:function(){var B=this.getSelectionModel().getSelectedNodes();for(var C=0;C<B.length;C++){tempnode=B[C];this.updatedb(4,tempnode);tempnode.remove()}B=this.getSelectionModel().getSelectedNodes();var A=B.length;for(var C=0;C<A;C++){tempnode=B.shift();this.updatedb(4,tempnode);tempnode.remove()}this.getTopToolbar().items.items[2].disable()},editNode:function(B,A){if(B.isLeaf()){this.editnode(B)}else{this.editGroup(B)}},editGroup:function(A){this.makeForm(1);this.taskNameField.setValue(A.text);this.newTaskWindow=new Wtf.Window({width:300,resizable:false,modal:true,title:"Edit Task Group",buttons:[{anchor:"90%",id:"save",text:"Submit",handler:this.editsinglegroup,scope:this}],items:[this.groupForm]}).show()},editnode:function(C){this.makeForm(0);var B=C.text;var A=C.attributes.assignedTo;this.taskNameField.setValue(B.split(" : ")[1]);if(this.assignedCombo){this.assignedCombo.setValue(A)}this.newTaskWindow=new Wtf.Window({width:300,resizable:false,modal:true,title:"Edit Task",buttons:[{anchor:"90%",id:"save",text:"Submit",handler:this.editsinglenode,scope:this}],items:[this.taskform]}).show()},editsinglegroup:function(){var A=this.getSelectionModel().getSelectedNodes()[0];A.setText(this.taskNameField.getValue());this.updatedb(2,A)},editsinglenode:function(){var B=this.taskNameField.getValue();var A="me";if(this.assignedCombo){var C=this.assignedCombo.getValue();if(C!=loginid){A=this.memberstore.getAt(this.memberstore.find("id",C)).data["name"]}}var D=this.getSelectionModel().getSelectedNodes()[0];D.setText(A+" : "+B);D.attributes.assignedTo=C;this.updatedb(2,D)},makeForm:function(A){this.taskNameField=new Wtf.form.TextField({fieldLabel:"Task*",anchor:"99%",allowBlank:false});if(A==0){this.taskform=new Wtf.FormPanel({labelWidth:100,labelAlign:"left",border:false,bodyStyle:"padding:5px 5px 0",layout:"form",anchor:"100%",defaultType:"textfield",buttonAlign:"right",items:[this.taskNameField]});if(this.groupType==Wtf.etype.proj){this.assignedCombo=new Wtf.form.ComboBox({fieldLabel:"Assigned to*",store:this.memberstore,anchor:"99%",displayField:"name",valueField:"id",mode:"local",triggerAction:"all",editable:false,selectOnFocus:true,allowBlank:false});this.taskform.add(this.assignedCombo)}}else{this.taskNameField.fieldLabel="Group Name";this.groupForm=new Wtf.FormPanel({labelWidth:100,labelAlign:"left",border:false,bodyStyle:"padding:5px 5px 0",layout:"form",anchor:"100%",defaultType:"textfield",buttonAlign:"right",items:[this.taskNameField]})}},createNode:function(){var B=this.taskNameField.getValue();if(B!=""){var A="me";if(this.assignedCombo){var C=this.assignedCombo.getValue();if(C!=loginid){A=this.memberstore.getAt(this.memberstore.find("id",this.assignedCombo.getValue())).data["name"]}}var E=new Wtf.tree.TreeNode({checked:false,text:A+" : "+B,iconCls:"todoNode",leaf:true,nodestate:0,Torder:0,assignedTo:C});this.taskNameField.reset();this.taskNameField.focus();this.listRoot.appendChild(E);var D=this.listRoot.indexOf(E);E.on("checkchange",this.nodeCheckChange,this);this.updatedb(3,E)}},createGroup:function(){var A=this.taskNameField.getValue();if(A!=""){var C=new Wtf.tree.TreeNode({checked:false,text:A,iconCls:"groupNode",leaf:false,nodestate:0,Torder:0});this.taskNameField.reset();this.taskNameField.focus();this.listRoot.appendChild(C);var B=this.listRoot.indexOf(C);C.on("checkchange",this.nodeCheckChange,this);C.on("beforeinsert",this.groupbinsert,this);C.on("beforeappend",this.groupbinsert,this);this.updatedb(3,C)}},groupbinsert:function(A,D,C,B){if(!C.isLeaf()){return false}},addTask:function(){this.makeForm(0);this.newTaskWindow=new Wtf.Window({width:300,resizable:false,modal:true,title:"Add New Task",keys:{key:[10,13],fn:this.createNode,scope:this},buttons:[{anchor:"90%",id:"save",text:"Add",handler:this.createNode,scope:this}],items:[this.taskform]}).show()},addTaskGroup:function(){this.makeForm(1);this.newTaskWindow=new Wtf.Window({width:300,resizable:false,modal:true,title:"Add New Task Group",keys:{key:[10,13],fn:this.createGroup,scope:this},buttons:[{anchor:"90%",id:"save",text:"Add",handler:this.createGroup,scope:this}],items:[this.groupForm]}).show();this.taskNameField.reset()},nodeCheckChange:function(C,B){if(B){C.ui.getTextEl().style.textDecoration="line-through";C.attributes.nodestate=1;if(!C.isLeaf()){this.updatedb(2,C)}else{this.updatedb(2,C)}C.eachChild(function(D){D.ui.getTextEl().style.textDecoration="line-through";D.attributes.nodestate=1;D.ui.toggleCheck(true);this.updatedb(2,D)},this)}if(!B){C.ui.getTextEl().style.textDecoration="none";C.attributes.nodestate=0;if(!C.isLeaf()){this.updatedb(2,C)}else{this.updatedb(2,C)}C.eachChild(function(D){D.ui.getTextEl().style.textDecoration="none";D.attributes.nodestate=0;D.ui.toggleCheck(false);this.updatedb(2,D)},this)}var A=this.getChecked();if(A.length<=0){if(this.getSelectionModel().getSelectedNodes().length<=0){this.getTopToolbar().items.items[2].disable()}}else{this.getTopToolbar().items.items[2].enable()}},selectionChange:function(A,B){if(B.length<=0){this.getTopToolbar().items.items[2].disable()}else{this.getTopToolbar().items.items[2].enable()}},nodeMoved:function(A,E,C,D,B){D.eachChild(function(F){this.updatedb(2,F)},this)},updatedb:function(actiontype,node){var tid=node.id;var parentid=node.parentNode.id;if(parentid==this.listRoot.id){parentid=""}var torder=node.parentNode.indexOf(node);var description=node.text;Wtf.Ajax.request({method:"POST",url:this.url,params:({description:description,localid:tid,taskorder:torder,status:node.attributes.nodestate,parentId:parentid,taskid:tid,userid:this.userid,grouptype:this.groupType,assignedto:node.attributes.assignedTo,leafflag:node.isLeaf(),action:actiontype}),scope:this,success:function(result,req){var data=eval("("+result.responseText+")");switch(req.params.action){case 3:var tnode=this.getNodeById(data.localid);tnode.id=data.remoteid;break}},failure:function(result,req){}})}});Wtf.docs.com.permissionwin=function(A){Wtf.apply(this,A);this.Docid=A.docid;this.Grid=A.grid1;this.userid=A.userid;this.per=A.per;Wtf.docs.com.permissionwin.superclass.constructor.call(this,{id:"perwin",title:"Set File Permission",closable:true,plain:true,layout:"fit",width:517,resizable:false,modal:true,autoHeight:true,shadow:false,iconCls:"winicon",border:false,animEl:"setperid",items:[{layout:"border",height:170,id:"perwinRegion",items:[{region:"north",height:170,layout:"fit",border:false,items:[{xtype:"fieldset",title:"Permissions",autoHeight:true,defaultType:"radio",labelWidth:0,layoutConfig:{labelSeparator:""},items:[{id:"nosel",boxLabel:"All My Connections",name:"permissiongrp"},{id:"sel",boxLabel:"Selected Connections",name:"permissiongrp"},{id:"nosel1",boxLabel:"For Everyone",name:"permissiongrp"},{id:"nosel2",boxLabel:"None",name:"permissiongrp"}]}]},{region:"center",id:"perwinCenter",layout:"fit",border:false}]}],buttons:[new Wtf.Button({text:"OK",type:"submit",id:"docok",scope:this,handler:this.okClicked,minWidth:60,cls:"docbutton"}),new Wtf.Button({text:"Cancel",id:"doccancel",scope:this,handler:this.cancelClicked,minWidth:60,cls:"docbutton"})]});Wtf.getCmp("sel").addListener("focus",this.RadioCheck,this);Wtf.getCmp("nosel").addListener("focus",this.RadioCheckblur,this);Wtf.getCmp("nosel1").addListener("focus",this.RadioCheckblur,this);Wtf.getCmp("nosel2").addListener("focus",this.RadioCheckblur,this);Wtf.getCmp("sel").addListener("check",this.disableOther2,this);Wtf.getCmp("nosel1").addListener("check",this.disableOther3,this);Wtf.getCmp("nosel2").addListener("check",this.disableOther4,this)};Wtf.extend(Wtf.docs.com.permissionwin,Wtf.Window,{loadMask:null,panel:null,colModel1:null,colModel:null,ds:null,leftGrid:null,ds1:null,myData1:null,rightGrid:null,middiv:null,leftrecord:null,leftflag:null,rightflag:null,rightrecord:null,onRender:function(A){Wtf.docs.com.permissionwin.superclass.onRender.call(this,A);this.perDefault(this.per);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(Wtf.get("perwin")))},perDefault:function(A){if(A=="All My Connections"){Wtf.getCmp("nosel").checked=true}else{if(A=="Selected Connections"){Wtf.getCmp("sel").checked=true;this.RadioCheck(Wtf.getCmp("sel"))}else{if(A=="Everyone"){Wtf.getCmp("nosel1").checked=true}else{if(A=="None"){Wtf.getCmp("nosel2").checked=true}}}}},disableOther2:function(A,B){Wtf.getCmp("nosel").checked=false;Wtf.getCmp("nosel1").checked=false;Wtf.getCmp("nosel2").checked=false},disableOther3:function(A,B){Wtf.getCmp("nosel").checked=false;Wtf.getCmp("sel").checked=false;Wtf.getCmp("nosel2").checked=false},disableOther4:function(A,B){Wtf.getCmp("nosel").checked=false;Wtf.getCmp("sel").checked=false;Wtf.getCmp("nosel1").checked=false},cancelClicked:function(){Wtf.getCmp("perwin").close()},FillLeftGrid:function(){var A=this.leftGrid.getView();A.refresh()},FillRightGrid:function(){var A=this.rightGrid.getView();A.refresh();for(var B=0;B<this.ds1.getCount();B++){if(this.ds1.getAt(B).data["perm"]==1){A.getCell(B,1).firstChild.firstChild.checked=true}}},LeftGridRowClicked:function(C,A,B){this.leftflag=1;this.leftrecord=this.ds.getAt(A)},RightGridRowClicked:function(A,B,C){this.rightflag=1;this.rightrecord=this.ds1.getAt(B)},NxtBtnClicked:function(){if(this.leftflag==1){this.ds1.add(this.leftrecord);this.ds.remove(this.leftrecord);this.leftflag=0}else{msgBoxShow(["File Permission","Must Select a Connection"],Wtf.MessageBox.INFO)}},PrevBtnClicked:function(){if(this.rightflag==1){this.ds.add(this.rightrecord);this.ds1.remove(this.rightrecord);this.rightflag=0}else{msgBoxShow(["File Permission","Must Select a Connection"],Wtf.MessageBox.INFO)}},Resetclicked:function(){var A=this.ds1.getRange();if(A.length>0){this.ds.add(A);for(i=0;i<A.length;i++){this.ds1.remove(A[i])}}else{msgBoxShow(["File Permission","No Records To Transfer"],Wtf.MessageBox.INFO)}},okClicked:function(){Wtf.getCmp("docok").disable();this.loadMask.show();var type;var docid="3";var userid="2";if(Wtf.getCmp("sel").checked){type=2;if(this.ds1.getCount()>=0){var ids="";var check="";for(i=0;i<this.ds1.getCount();i++){if(i==(this.ds1.getCount()-1)){ids=ids+(this.ds1.getAt(i)).get("id");if(this.rightGrid.getView().getCell(i,1).firstChild.firstChild.checked==true){check=check+"1"}else{check=check+"0"}}else{ids=ids+(this.ds1.getAt(i)).get("id")+",";if(this.rightGrid.getView().getCell(i,1).firstChild.firstChild.checked==true){check=check+"1,"}else{check=check+"0,"}}}Wtf.Ajax.requestEx({url:Wtf.req.doc+"perm/setpermission.jsp",params:{docid:this.Docid,type:type,check:check,ids:ids}},this,function(result,req){this.loadMask.hide();var p=eval("("+result+")");if(p["res"]==0){var rec=this.Grid.store.find("Id",this.Docid,0,false,true);this.Grid.store.getAt(rec).set("Permission","Selected Connections");this.Grid.getView().refresh();this.f1()}else{Wtf.MessageBox.show({title:"ERROR!!!",msg:"A problem occurred while setting permissions!",buttons:Wtf.MessageBox.OK,animEl:"ok",fn:this.f1,icon:Wtf.MessageBox.ERROR})}})}else{msgBoxShow(["File Permission","No Records To Transfer"],Wtf.MessageBox.INFO)}}else{if(Wtf.getCmp("nosel").checked){type=1}else{if(Wtf.getCmp("nosel1").checked){type=3}else{if(Wtf.getCmp("nosel2").checked){type=4}else{this.f1()}}}Wtf.Ajax.requestEx({url:Wtf.req.doc+"perm/setpermission.jsp",params:{docid:this.Docid,type:type}},this,function(result,req){this.loadMask.hide();var rec=this.Grid.store.find("Id",this.Docid,0,false,true);if(type==1){this.Grid.store.getAt(rec).set("Permission","All My Connections")}else{if(type==3){this.Grid.store.getAt(rec).set("Permission","Everyone")}else{if(type==4){this.Grid.store.getAt(rec).set("Permission","None")}}}this.Grid.getView().refresh();this.f1()},function(result,req){this.loadMask.hide();Wtf.MessageBox.show({title:"ERROR!!!",msg:"A problem occurred while setting permissions!",buttons:Wtf.MessageBox.OK,animEl:"ok",fn:this.f1,icon:Wtf.MessageBox.ERROR})})}},foraddrecord:function(){var A=this.Grid.store.find("Id",Docid,0,false,true);if(type==1){this.Grid.store.getAt(A).set("Permission","All My Connections")}else{if(type==3){this.Grid.store.getAt(A).set("Permission","Everyone")}else{if(type==4){this.Grid.store.getAt(A).set("Permission","None")}}}this.Grid.getView().refresh();this.f1()},RadioCheck:function(A,B){Wtf.getCmp("perwinRegion").setHeight(470);Wtf.getCmp("perwinCenter").setHeight(275);this.addPanel();Wtf.getCmp("perwinCenter").doLayout();this.ds1.removeAll();this.ds.load();this.ds1.load();this.leftGrid.on("rowclick",this.LeftGridRowClicked,this);this.rightGrid.on("rowclick",this.RightGridRowClicked,this)},addPanel:function(){this.colModel1=new Wtf.grid.ColumnModel([{header:"Selected Connections",dataIndex:"name",width:115,renderer:this.imgrenderer},{header:"Write",width:35,renderer:this.rwcheckBox}]);this.colModel=new Wtf.grid.ColumnModel([{header:"All My Connections",width:150,renderer:this.imgrenderer,dataIndex:"name"}]);this.ds=new Wtf.data.Store({url:Wtf.req.doc+"grid/getConnections.jsp?docid="+this.Docid+"&flag=1",reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"id"},{name:"name"}]})});this.ds.on("load",this.FillLeftGrid,this);this.leftGrid=new Wtf.grid.GridPanel({id:"leftgrid",cm:this.colModel,border:false,store:this.ds,width:180,height:250,autoScroll:true,bodyBorder:false});this.ds1=new Wtf.data.Store({url:Wtf.req.doc+"grid/getConnections.jsp?docid="+this.Docid+"&flag=2",reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"id"},{name:"name"},{name:"perm"}]})});this.ds1.on("load",this.FillRightGrid,this);this.rightGrid=new Wtf.grid.GridPanel({id:"rightgrid",cm:this.colModel1,border:false,ds:this.ds1,width:180,height:250,autoWidth:true,autoScroll:true,bodyBorder:false});this.movetoright=document.createElement("img");this.movetoright.src="images/arrowright.gif";this.movetoright.style.width="24px";this.movetoright.style.height="24px";this.movetoright.style.cursor="pointer";this.movetoright.style.margin="62px 0px 5px 59px";this.movetoright.onclick=this.NxtBtnClicked.createDelegate(this,[]);this.movetoleft=document.createElement("img");this.movetoleft.src="images/arrowleft.gif";this.movetoleft.style.width="24px";this.movetoleft.style.height="24px";this.movetoleft.style.margin="5px 0px 5px 59px";this.movetoleft.style.cursor="pointer";this.movetoleft.onclick=this.PrevBtnClicked.createDelegate(this,[]);this.centerdiv=document.createElement("div");this.centerdiv.appendChild(this.movetoright);this.centerdiv.appendChild(this.movetoleft);this.panelResetButt=new Wtf.Panel({id:"panelResetButtContainer",height:24,width:24,baseCls:"resetArrow",items:[new Wtf.Button({id:"panelresetButt",text:"Reset",scope:this,handler:this.Resetclicked})]});this.panel=new Wtf.Panel({id:"SelectDiv",border:false,title:"Selected Connections",layout:"border",items:[{region:"west",height:250,width:180,layout:"fit",border:false,bodyStyle:"padding:5px",items:[this.leftGrid]},{region:"center",id:"lrarrowContainer",height:250,border:false,layout:"border",items:[{region:"north",border:false,height:125,contentEl:this.centerdiv},{region:"center",height:125,border:false,items:[this.panelResetButt]}]},{region:"east",height:250,border:false,width:180,layout:"fit",bodyStyle:"padding:5px",items:[this.rightGrid]}]});Wtf.getCmp("perwinCenter").add(this.panel);Wtf.getCmp("perwinCenter").doLayout()},RadioCheckblur:function(A,B){Wtf.getCmp("sel").checked=false;Wtf.getCmp("perwinRegion").setHeight(170);Wtf.getCmp("perwinCenter").setHeight(0);if(this.panel!=null){this.panel.destroy()}Wtf.getCmp("perwinCenter").doLayout()},rwcheckBox:function(){return'<input type="Checkbox" />'},imgrenderer:function(B,A,F,E,D,C){return"<img src = 'images/user16.png'/> "+B},f1:function(){Wtf.getCmp("perwin").close()}});function uploadButttonClick(doccmp){var grid1=doccmp.grid1;var groupid=doccmp.groupid;var pcid=doccmp.pcid;var userid=doccmp.userid;var ChkValue;var flagforgrid=0;var filename;var flagforconfirm=0;var ChkOwner;fs=new Wtf.FormPanel({id:"uploadfrm",frame:true,labelWidth:55,width:340,method:"POST",fileUpload:true,waitMsgTarget:true,url:"fileAddAction.jsp?fileadd=false",onSubmit:FileUpload,layoutConfig:{labelSeparator:""},items:[new Wtf.form.TextField({fieldLabel:"File Path:",id:"filepath",inputType:"file"}),new Wtf.form.TextArea({fieldLabel:"Comment:",width:265,height:60,maxLength:80,id:"comment"}),this.groupcombo=new Wtf.form.ComboBox({mode:"local",store:doccmp.deptStore,fieldLabel:"Select Folder",hiddenName:"deptid",valueField:"deptid",hidden:false,triggerAction:"all",displayField:"deptname",readOnly:true,emptyText:"Select a Folder",allowBlank:false,width:265}),new Wtf.Button({cls:"button11",text:"Cancel",handler:close}),new Wtf.Button({id:"upbtn",cls:"button1new",text:"Upload",handler:FileUpload}),new Wtf.Panel({height:0,items:[new Wtf.form.TextField({id:"pcid",value:pcid,height:0}),new Wtf.form.TextField({id:"userid",height:0,value:userid}),new Wtf.form.TextField({id:"groupid",height:0,value:groupid}),new Wtf.form.TextField({fieldLabel:"docid",id:"docid",height:0}),new Wtf.form.TextField({fieldLabel:"docownerid",id:"docownerid",height:0}),new Wtf.form.TextArea({fieldLabel:"type",id:"type",height:0})]})]});Wtf.getCmp("groupid").hide();Wtf.getCmp("userid").hide();Wtf.getCmp("pcid").hide();var div=document.createElement("div");div.id="formct";win=new Wtf.Window({id:"upfilewin",modal:true,title:"Upload File",closable:true,width:357,plain:true,iconCls:"winicon",resizable:false,layout:"fit",contentEl:div}).show();fs.render("formct");function UploadFile(){Wtf.getCmp("docid").setValue(ChkValue);Wtf.getCmp("docownerid").setValue(ChkOwner);filename=Wtf.get("filepath").dom.value;fs.form.submit({waitMsg:"Uploading...",success:function(result,req){msgBoxShow(["Error","A problem occurred while uploading"],Wtf.MessageBox.ERROR);close()},success:function(frm,action){close();if(action.response.responseText!=""){var uploadstr=eval("("+action.response.responseText+")");if(uploadstr.msg!=null&&uploadstr.msg!="1"){msgBoxShow(["Error",uploadstr.msg],Wtf.MessageBox.ERROR)}else{if(uploadstr.action=="add"){var recarr=doccmp.reader.readRecords(eval("("+uploadstr.data+")"));if(doccmp.grid1.getStore().find("Id",recarr.records[0].data["Id"])==-1){var nodelength=doccmp.mainTree.root.childNodes.length;var nodearr=doccmp.mainTree.root.childNodes;for(var q=0;q<nodelength;q++){doccmp.mainTree.root.removeChild(nodearr.shift())}doccmp.ds.load()}}else{if(uploadstr.action=="commit"){var com=eval("("+uploadstr.data+")");var index=doccmp.grid1.getStore().find("Id",com.Id);if(index>-1){doccmp.grid1.getStore().getAt(index).set("Size",com.Size);doccmp.grid1.getStore().getAt(index).set("DateModified",Date.parseDate(com.DateModified,"Y-m-d H:i:s.0"))}}}}}else{frm.reset()}if(flagforconfirm==1){close1()}}})}function CheckChanged(radio,value){if(value){ChkValue=radio.value;ChkOwner=radio.id}}function result1(val,userdocid,flagtype){var panelContainer=new Wtf.Panel({id:"panelContainer",border:false,frame:false,autoWidth:true,items:[{xtype:"fieldset",labelWidth:140,id:"uploadconfirm",height:100,autoWidth:true,defaultType:"radio",autoScroll:true,border:false},new Wtf.Button({cls:"button11",minWidth:60,text:"Cancel",handler:close1}),new Wtf.Button({id:"OK",cls:"button1new",minWidth:60,text:"OK",handler:UploadFile})]});var div1=document.createElement("div");div1.id="formct1";win=new Wtf.Window({id:"confirm",title:"Confirmation",modal:true,closable:true,width:357,plain:true,iconCls:"iconwin",resizable:false,layout:"fit",contentEl:div1}).show();panelContainer.render("formct1");flagforconfirm=1;for(var i=0;i<val.length;i++){if(i==0){ChkValue=val[i].docid;ChkOwner=val[i].userid}var str="Update "+val[i].username+"'s version";Wtf.getCmp("uploadconfirm").add({id:val[i].userid,name:"a",value:val[i].docid,fieldLabel:str});Wtf.getCmp("uploadconfirm").doLayout();Wtf.getCmp(val[i].userid).on("change",CheckChanged)}if(flagtype==1){var str="Update to My version";Wtf.getCmp("uploadconfirm").add({id:"my",name:"a",fieldLabel:str,value:userdocid});Wtf.getCmp("uploadconfirm").doLayout();Wtf.getCmp("my").on("change",CheckChanged)}else{var str="Upload new file ";Wtf.getCmp("uploadconfirm").add({id:"my",name:"a",fieldLabel:str});Wtf.getCmp("uploadconfirm").doLayout();Wtf.getCmp("my").on("change",CheckChanged)}}function ResultFun(response,option){var value=eval("("+response+")");var rs=value.type;Wtf.getCmp("type").setValue(rs);var val=value.data;var userdocid=value.userdocid;if(rs==1||rs==2){if(rs==1){result1(val,userdocid,1)}if(rs==2){ChkValue=userdocid;ChkOwner=value.userid;UploadFile()}}else{if(rs==3){result1(val,userdocid,0)}else{if(rs==4){UploadFile()}}}}function FileUpload(){Wtf.getCmp("upbtn").disable();if(document.getElementById("filepath").value<=0){msgBoxShow(["File Path","Please Enter File path"],Wtf.MessageBox.INFO);Wtf.getCmp("upbtn").enable()}else{var textArea=Wtf.get("filepath");Wtf.Ajax.requestEx({url:Wtf.req.doc+"file-releated/filecontent/chkfile.jsp",params:{docname:textArea.getValue(),groupid:groupid,pcid:pcid}},this,ResultFun,function(){msgBoxShow(["Error","Error Occurred While Uploading File"],Wtf.MessageBox.INFO);close()})}}function close1(){flagforconfirm=0;Wtf.getCmp("confirm").close()}function close(){Wtf.getCmp("upfilewin").close()}return flagforgrid}function deleteButttonClick(groupid,docid,userid,count,mainTree,pcid,grid){Wtf.Ajax.request({url:"deleteAction.jsp",params:{DOCID:docid,GROUPID:groupid,COMMENT:"f",COUNT:count,PCID:pcid},scope:this,success:function(result,req){if(eval("("+result.responseText+")")["res"]==1){msgBoxShow(["Error In Connection","Error In Deleting File"],Wtf.MessageBox.INFO)}else{var docids=eval("("+eval("("+result.responseText+")")["docids"]+")");for(var i=0;i<docids.docid.length;i++){var rec=grid.store.find("Id",docids.docid[i]);if(rec>-1){for(var j=0;j<grid.store.getAt(rec).data["Tags"].split(",").length;j++){mainTree.breakTree(grid.store.getAt(rec).data["Tags"].split(",")[j],mainTree.root)}grid.store.remove(grid.store.getAt(rec))}}grid.getView().refresh()}}})}function statusButttonClick(grid1,MyDocId,per,userid,lms){var form;var win;form=new Wtf.FormPanel({id:"perfrm",frame:true,minWidth:385,url:"http://www.google.com",method:"POST",onSubmit:MyokClicked,items:[{xtype:"fieldset",title:"Status",id:"statusRadio",autoHeight:true,defaultType:"radio",labelWidth:0,layoutConfig:{labelSeparator:""},items:[{id:"waiting",boxLabel:"Waiting for Approval",name:"statusgrp"},{id:"completed",boxLabel:"Completed",name:"statusgrp"},{id:"draft",boxLabel:"Draft",name:"statusgrp"},{id:"Nonestatus",boxLabel:"None",name:"statusgrp"}]},new Wtf.Button({text:"Cancel",id:"doccancel",handler:MycancelClicked,minWidth:60,cls:"docbutton"}),new Wtf.Button({text:"OK",type:"submit",id:"docok",handler:MyokClicked,minWidth:60,cls:"docbutton"})]});var divstatus=document.createElement("div");divstatus.id="formst";statusDefault(per);win=new Wtf.Window({id:"statusupwin",title:"Set Status for File",closable:true,modal:true,width:400,autoHeight:true,plain:true,iconCls:"iconwin",resizable:false,layout:"fit",contentEl:divstatus}).show();form.render("formst");function MyokClicked(){var string="";if(Wtf.getCmp("waiting").getValue()){string="Waiting"}else{if(Wtf.getCmp("completed").getValue()){string="Completed"}else{if(Wtf.getCmp("draft").getValue()){string="Draft"}else{string="None"}}}var xmlHttp,i=0;var response;if(lms){Wtf.Ajax.requestEx({url:"jspfiles/lms/CreateCourse.jsp",params:({flag:19,courseid:MyDocId,status:string})},this,function(result,req){if(eval("("+result+")")["res"]==0){var rec=grid1.store.find("courseid",MyDocId,0,false,true);grid1.store.getAt(rec).set("status",string);grid1.getView().refresh();Wtf.getCmp("statusupwin").close()}else{msgBoxShow(["Error In Connection","Please Change Status Again"],Wtf.MessageBox.INFO)}})}else{Wtf.Ajax.requestEx({url:Wtf.req.doc+"perm/setStatus.jsp",params:({docid:MyDocId,status:string})},this,function(result,req){if(eval("("+result+")")["res"]==0){var rec=grid1.store.find("Id",MyDocId,0,false,true);grid1.store.getAt(rec).set("Status",string);grid1.getView().refresh();Wtf.getCmp("statusupwin").close()}else{msgBoxShow(["Error In Connection","Please Change Status Again"],Wtf.MessageBox.INFO)}})}}function MycancelClicked(){Wtf.getCmp("statusupwin").close()}function statusDefault(per){if(per=="Waiting"){Wtf.getCmp("waiting").checked=true}else{if(per=="Completed"){Wtf.getCmp("completed").checked=true}else{if(per=="Draft"){Wtf.getCmp("draft").checked=true}else{Wtf.getCmp("Nonestatus").checked=true}}}}}Wtf.docs.com.Grid=function(A){Wtf.apply(this,A);this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:false});this.Parentfolder="";this.reader=new Wtf.data.JsonReader({root:"data",fields:[{name:"Id",type:"string"},{name:"Name",type:"string"},{name:"Size",type:"float"},{name:"Type",type:"string"},{name:"DateModified",type:"date",dateFormat:"Y-m-d H:i:s.0"},{name:"Permission",type:"string"},{name:"Status",type:"string"},{name:"Author",type:"string"},{name:"Owner",type:"string"},{name:"version",type:"string"},{name:"Tags",type:"string"},{name:"storeindex",type:"string"},{name:"readwrite",type:"string"}]});this.sm=new Wtf.grid.CheckboxSelectionModel();this.sm2=new Wtf.grid.CheckboxSelectionModel();this.sm2.id="chk";this.sm2.addListener("selectionchange",this.rowSelectionHandler,this);this.txtareaid=A.id+"edittag";this.divele=document.createElement("div");this.divele.id="divTag"+A.id;this.divele.style.width="80%";this.divele.style.height="80%";this.divele.style.display="none";this.myTextArea=document.createElement("textarea");this.myTextArea.id=this.txtareaid;this.myTextArea.style.height="100%";this.myTextArea.style.width="80%";this.myTextArea.style.display="none";this.myTextArea.style.fontSize="20px";this.txtboxid=A.id+"tagtextbox";this.bttnid=A.id+"tagbttn";this.delbttid=A.id+"del_butt";this.downbttid=A.id+"down_butt";this.showbttid=A.id+"show_butt";this.addFilesid=A.id+"addFile";this.tabtabpanelid=A.id+"tabtabpanel";this.textbox=new Wtf.form.TextField({id:this.txtboxid,cls:"txt",width:100});this.textbox.setVisible(false);this.bttn=new Wtf.Button({id:this.bttnid,text:"Add Tag",cls:"bttn",disabled:true});this.bttn.setVisible(false);var C=Wtf.urlEncode({groupid:this.groupid,pcid:this.pcid,tab:"*flag*"});this.ds=new Wtf.data.GroupingStore({url:Wtf.req.doc+"grid/fillGrid.jsp?"+C,reader:this.reader,sortInfo:{field:"DateModified",direction:"DESC"}});this.cm=new Wtf.grid.ColumnModel([this.sm,{id:"Name",header:"Name",dataIndex:"Name",sortable:true,groupable:true,groupRenderer:nameRenderer},{header:"Size",dataIndex:"Size",sortable:true,align:"right",groupable:true,renderer:function(D){return D+" KB"},groupRenderer:sizeRenderer},{header:"Type",dataIndex:"Type",sortable:true,groupable:true},{id:"Date_Modified",header:"Date Modified",dataIndex:"DateModified",sortable:true,renderer:function(D){if(Wtf.isEmpty(D)){return D}else{return D.format(Wtf.getDateFormat())}},groupable:true,groupRenderer:dateFieldRenderer},{header:"Permission",dataIndex:"Permission",sortable:true,groupable:true,groupRenderer:permissionRenderer},{header:"Status",dataIndex:"Status",sortable:true,groupable:true},{header:"Author",dataIndex:"Author",sortable:true,groupable:true}]);this.cm.defaultSortable=true;var B=function(D,G,E,F){D.setIconClass(D.getIconClass()=="none"?"pwnd checked":"pwnd checked");Wtf.each(G,function(H){H.setIconClass("none")});F.fireEvent("headerclick",F,E)};this.deptRecord=Wtf.data.Record.create([{name:"deptid",type:"string"},{name:"deptname",type:"string"}]);this.deptReader=new Wtf.data.JsonReader({root:"data"},this.deptRecord);this.deptStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.deptReader,baseParams:{type:"fetchDept"}});this.rolegrRecord=Wtf.data.Record.create([{name:"groupid",type:"string"},{name:"groupname",type:"string"},{name:"description",type:"string"}]);this.rolegrReader=new Wtf.data.JsonReader({root:"data"},this.rolegrRecord);this.rolegrStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/authorization.jsp?action=1"}),reader:this.rolegrReader});Wtf.docs.com.Grid.superclass.constructor.call(this,{layout:"fit",items:[{layout:"border",border:false,autoWidth:true,items:[this.grid1=new Wtf.grid.GridPanel({border:false,region:"center",id:"topic-grid"+A.id,store:this.ds,enableColumnHide:false,view:this.groupingView,cm:this.cm,sm:this.sm2,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading Documents..."},tbar:["Quick Search: ",this.quickSearchTF=new Wtf.KWLQuickSearch({field:"Name",width:200})]}),{region:"south",minHeight:75,height:100,id:this.tabtabpanelid,title:"Tags",frame:true,border:false,items:[this.divele,this.myTextArea,this.textbox,this.bttn],split:true}]}],bbar:[{text:"Add Folder",iconCls:"pwnd doctabicon",hidden:isRoleGroup("4")?false:true,scope:this,tooltip:{text:"Click to Add  Folder"},handler:this.AddDept},{text:"Add Files",id:this.addFilesid,iconCls:"pwnd doctabicon",scope:this,tooltip:{text:"Click to Add  Files"},handler:this.AddFiles},"-",{iconCls:"pwnd delicon",id:this.delbttid,scope:this,tooltip:{text:"Click to Delete  Files"},handler:this.DeleteFiles},"-",toggleBttn=new Wtf.Button({id:"toggleBttn"+A.id,text:"Show in Groups",iconCls:"pwnd showgrp",enableToggle:true}),{text:"Sort",iconCls:"pwnd arrange",tooltip:{text:"Click to Sort"},menu:[sortBy1=new Wtf.Action({text:"Name",iconCls:"pwnd checked",scope:this,handler:function(){B(sortBy1,[sortBy2,sortBy3,sortBy4,sortBy5,sortBy6,sortBy7],1,this.grid1)}},this),sortBy2=new Wtf.Action({text:"Size",iconCls:"none",scope:this,handler:function(){B(sortBy2,[sortBy1,sortBy3,sortBy4,sortBy5,sortBy6,sortBy7],2,this.grid1)}},this),sortBy3=new Wtf.Action({text:"Type",iconCls:"none",scope:this,handler:function(){B(sortBy3,[sortBy1,sortBy2,sortBy4,sortBy5,sortBy6,sortBy7],3,this.grid1)}},this),sortBy4=new Wtf.Action({text:"Date Modified",iconCls:"none",scope:this,handler:function(){B(sortBy4,[sortBy1,sortBy2,sortBy3,sortBy5,sortBy6,sortBy7],4,this.grid1)}},this),sortBy5=new Wtf.Action({text:"Permission",iconCls:"none",scope:this,handler:function(){B(sortBy5,[sortBy1,sortBy2,sortBy3,sortBy4,sortBy6,sortBy7],5,this.grid1)}},this),sortBy6=new Wtf.Action({text:"Status",iconCls:"none",scope:this,handler:function(){B(sortBy6,[sortBy1,sortBy2,sortBy3,sortBy4,sortBy5,sortBy7],6,this.grid1)}},this),sortBy7=new Wtf.Action({text:"Author",iconCls:"none",scope:this,handler:function(){B(sortBy7,[sortBy1,sortBy2,sortBy3,sortBy4,sortBy5,sortBy6],7,this.grid1)}},this)]},"-",{text:"Download",iconCls:"pwnd dldicon",id:this.downbttid,scope:this,tooltip:{text:"Click to Download  File"},handler:this.DownloadFiles}]});if(this.groupid=="1"){}else{}};Wtf.extend(Wtf.docs.com.Grid,Wtf.Panel,{loadMask:null,txtboxid:"",editable:0,gridrowindex:"",root:null,defaultTag:null,tagsArray:null,tempSpans:null,spanlength:null,mainTree:null,flagForTreeClick:0,flagForReloadTree:0,regx:"^(['\"]?)\\s*([\\w]+[(/|\\{1})]?)*[\\w]\\1$",tagregx:"\\w+|((['\"])\\s*([\\w][\\s[\\\\|\\/]\\w]*)\\s*\\2)|([\\w][\\s[\\\\|\\/]\\w]*)",patt1:/(['"])\s*([\w]+[\s\\|\/\w]*)\s*\1/g,patt2:/([\w][\\|\/\w]*\w)/g,timer:new Wtf.util.DelayedTask(this.callrefreshGrid),publishHandler:function(msg){if(msg.data.action=="add"){var recarr=this.reader.readRecords(eval("("+msg.data.data+")"));if(this.grid1.getStore().find("Id",recarr.records[0].data["Id"])==-1){this.grid1.getStore().add(recarr.records);this.grid1.getView().refresh();this.mainTree.makeTree(recarr.records[0].data["Tags"],this.mainTree.root);this.tagsArray[this.grid1.getStore().getCount()]=[]}if(Wtf.get("upfilewin")!=null){Wtf.get("upfilewin").hide();Wtf.get("upfilewin").destroy()}}else{if(msg.data.action=="svnadd"){var index=this.grid1.getStore().find("Id",msg.data.data);if(index>-1){this.grid1.getStore().getAt(index).set("version","Active")}}else{if(msg.data.action=="status"){var respobj=eval("("+msg.data.data+")");var index=this.grid1.getStore().find("Id",respobj[0].id);if(index>-1){this.grid1.getStore().getAt(index).set("Status",respobj[0].status)}}else{if(msg.data.action=="delete"){var rec=this.grid1.store.find("Id",msg.data.data);if(rec>-1){for(var j=0;j<this.grid1.store.getAt(rec).data["Tags"].split(",").length;j++){this.mainTree.breakTree(this.grid1.store.getAt(rec).data["Tags"].split(",")[j],this.mainTree.root)}this.grid1.store.remove(this.grid1.store.getAt(rec));this.grid1.getView().refresh()}}else{if(msg.data.action=="commit"){var com=eval("("+msg.data.data+")");var index=this.grid1.getStore().find("Id",com.Id);if(index>-1){this.grid1.getStore().getAt(index).set("Size",com.Size);this.grid1.getStore().getAt(index).set("DateModified",Date.parseDate(com.DateModified,"Y-m-d H:i:s.0"))}}}}}}},onRender:function(A){Wtf.docs.com.Grid.superclass.onRender.call(this,A);this.initPage();this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(Wtf.get("topic-grid"+A.id)));this.defaultTag=new Array();this.defaultTag=["shared","uncategorized","shared/"];this.tagsArray=[];this.tempSpans=[];this.spanlength=[];this.rolegrStore.load();this.deptStore.load();this.ds.load();this.loadMask.show();this.ds.on("loadexception",function(){msgBoxShow(["Error","A problem occurred while loading docs"],Wtf.MessageBox.ERROR);this.loadMask.hide()},this);this.ds.on("load",function(){var G=[];var F=0;this.loadMask.hide();Wtf.getCmp(this.tabtabpanelid).doLayout();for(var E=0;E<this.ds.getCount();E++){var C=this.ds.getAt(E).data["Tags"].split(",");for(var D=0;D<C.length;D++){this.mainTree.makeTree(C[D],this.mainTree.root);G[F]=C[D];F++}}var I=0;for(var B=0;B<this.deptStore.getCount();B++){for(I=0;I<G.length;I++){if(this.deptStore.getAt(B).get("deptname")==G[I]){break}}if(I==G.length){this.mainTree.makeTree(this.deptStore.getAt(B).get("deptname"),this.mainTree.root)}}var H=this.ds.getCount();for(x=0;x<=H;x++){this.tagsArray[x]=[];this.tempSpans[x]=[];this.tagsArray[x][0]="Uncategorized";this.tempSpans[x][0]="Uncategorized"}this.quickSearchTF.StorageChanged(this.ds);this.mainTree.on("click",function(J,K){this.timer.cancel();this.timer.delay(1000,this.callrefreshGrid,this);this.flagForTreeClick=1},this);this.mainTree.root.expand(false,false)},this);this.mainTree=new Wtf.docs.com.Tree({rootText:this.treeroot,grid:this.grid1,userid:this.userid,id:this.treeid,groupid:this.groupid,defaultTag:this.defaultTag,pcid:this.pcid});this.mainTree.render(this.treeRenderto);this.mainTree.root.select();this.mainTree.on("onDeleteComplete",this.onDeleteComplete,this);Wtf.getCmp(this.delbttid).disable();Wtf.getCmp(this.downbttid).disable();this.grid1.on("sortchange",function(B,C){if(toggleBttn.pressed){this.grid1.getStore().groupBy(C.field)}},this)},callrefreshGrid:function(){this.refreshGrid(this.mainTree.getSelectionModel().getSelectedNode())},onDestroy:function(A){Wtf.destroy(this.mainTree)},onDeleteComplete:function(){this.refreshGrid(this.mainTree.root);this.flagForReloadTree=1},abc:function(a,b){var selectedRow=this.grid1.getSelectionModel().getSelected();Wtf.Ajax.requestEx({url:Wtf.req.doc+"file-releated/filecontent/filedownloadchk.jsp",params:{docid:selectedRow.get("Id")}},this,function(resp,option){var respText=eval("("+resp+")");if(respText.download=="no"){filecontentTab(selectedRow.get("Id"),"tabfcontent"+selectedRow.get("Id"),selectedRow.get("Name"),selectedRow.get("Type"))}else{setDownloadUrl(selectedRow.get("Id"))}})},fileShow:function(){this.abc(this.grid1,this.grid1.getSelectionModel().getSelected())},DeleteFiles:function(){Wtf.MessageBox.confirm("Confirm","Are you sure you want to delete selected files?",function(A){if(A=="yes"){this.DeleteFile()}},this)},DeleteFile:function(){var C=this.sm2.getSelections();if(C.length!=0){var B="";for(var A=0;A<C.length;A++){if(A==(C.length-1)){if(C[A].data["Name"]!=""&&C[A].data["Cost"]!=""){B+=C[A].data["Id"]}}else{if(C[A].data["Name"]!=""&&C[A].data["Cost"]!=""){B+=C[A].data["Id"]+","}}}deleteButttonClick(this.groupid,B,this.userid,C.length,this.mainTree,this.pcid,this.grid1)}else{msgBoxShow(["Document","Please Select Document"],Wtf.MessageBox.INFO)}},ViewRevlist:function(){var C=this.sm2.getSelections();var D="";var B="";var A="";if(C[0].data["Name"].indexOf(".")>-1){A=C[0].data["Name"].substr(C[0].data["Name"].lastIndexOf("."))}D+=C[0].data["Id"]+A;B+=C[0].data["Id"];revisionlistFun(D,B+"revisionlist",C[0].data["Name"],C[0].data["Id"],C[0].data["Type"])},ActivateVer:function(){var selected=this.sm2.getSelections();var selNames="";var selIds="";var fileExt="";function addfile(val){if(val=="yes"){Wtf.Ajax.request({url:"fileAddAction.jsp",params:{fileadd:"true",filename:selNames,fileid:selIds,groupid:this.groupid,pcid:this.pcid},scope:this,method:"POST",success:function(frm,action){if(frm.responseText!=""){var uploadstr=eval("("+frm.responseText+")");if(uploadstr.msg!=null&&uploadstr.msg!="1"){msgBoxShow(["Error",uploadstr.msg],Wtf.MessageBox.ERROR)}else{if(uploadstr.action=="svnadd"){var index=this.grid1.getStore().find("Id",uploadstr.data);if(index>-1){this.grid1.getStore().getAt(index).set("version","Active")}}}}}})}}if(selected[0].data["Name"].indexOf(".")>-1){fileExt=selected[0].data["Name"].substr(selected[0].data["Name"].lastIndexOf("."))}selNames+=selected[0].data["Id"]+fileExt;selIds+=selected[0].data["Id"];Wtf.Msg.confirm("Activate Versioning?","Activating versioning may slow down your system. Do you want to continue?",addfile,this)},DownloadFiles:function(){var D=this.sm2.getSelections();var G=this.sm2.getCount();var E="";var F="";var C="";var A="";if(G==1){if(D[0].data["Name"].indexOf(".")>-1){A=D[0].data["Name"].substr(D[0].data["Name"].lastIndexOf("."))}F+=D[0].data["Id"]+A;C+=D[0].data["Id"];setDownloadUrl(C)}else{if(G>1){for(var B=0;B<G;B++){E=E+(D[B].data["Id"]).toString()+","}setDownloadUrl(E.substring(0,E.length-1))}}},AddFiles:function(){if(Wtf.get("upfilewin")==null){var A=uploadButttonClick(this)}},rowSelectionHandler:function(){var A=this.sm2.getSelections();if(A.length==0){Wtf.getCmp(this.delbttid).disable();Wtf.getCmp(this.downbttid).disable();Wtf.getCmp(this.txtboxid).setVisible(false);Wtf.getCmp(this.bttnid).setVisible(false)}else{Wtf.getCmp(this.delbttid).enable();Wtf.getCmp(this.txtboxid).setVisible(true);Wtf.getCmp(this.bttnid).setVisible(true)}if(A.length>0){Wtf.getCmp(this.downbttid).enable()}else{Wtf.getCmp(this.downbttid).disable()}this.onDocGridRowClick(this.grid1,0)},onDocGridRowContextMenu:function(A,F,H){H.preventDefault();var G=new Wtf.Action({text:"Open",iconCls:"pwnd OpenfileCx",handler:function(){A.fireEvent("rowdblclick",A,A.getSelectionModel().getSelected())}});var I=new Wtf.Action({text:"Set Permission",iconCls:"pwnd rtclickper",id:"setperid",scope:this,handler:function(){new Wtf.docs.com.permissionwin({userid:this.userid,grid1:A,title:"Set Permission",height:400,docid:A.getSelectionModel().getSelected().get("Id"),per:A.getSelectionModel().getSelected().get("Permission")}).show()}},this);var D=new Wtf.Action({text:"Set Status",iconCls:"pwnd statusicon",scope:this,handler:function(){statusButttonClick(A,A.getSelectionModel().getSelected().get("Id"),A.getSelectionModel().getSelected().get("Status"),this.userid)}},this);if(this.groupid==1&&A.store.getAt(F).data["Owner"]==1){var E=new Wtf.menu.Menu({items:[G,I,D]})}else{var E=new Wtf.menu.Menu({items:[G,D]})}A.getSelectionModel().selectRow(F);A.fireEvent("rowclick",A,F,H);rownum=F;var C=H.getPageX();var B=H.getPageY();E.showAt([C,B]);return false},initPage:function(){Wtf.EventManager.addListener(this.myTextArea,"blur",this.handleLost,this);Wtf.EventManager.addListener(this.divele,"dblclick",this.handleClickDiv,this);Wtf.EventManager.addListener(this.myTextArea,"keydown",this.handleTextSubmit,this);this.quickSearchTF.on("SearchComplete",this.QuickSearchComplete,this);this.grid1.on("rowclick",this.onDocGridRowClick,this);this.grid1.on("rowcontextmenu",this.onDocGridRowContextMenu,this);toggleBttn.on("toggle",this.onGroupBttnClick,this);this.grid1.addListener("rowdblclick",this.abc,this);this.textbox.on("specialkey",this.specialKey,this)},refreshGrid:function(B){this.loadMask.show();var I=B;this.textbox.setVisible(false);this.bttn.setVisible(false);this.divele.style.display="none";var D=B.getDepth();var A=[];for(var E=0;E<D;E++){A[E]=B.text.split(" (")[0];B=B.parentNode}var F="";for(var C=A.length-1;C>=0;C--){F+=A[C]+"/"}if(D==0){F="*flag*/"}var G=new Wtf.data.JsonReader({root:"data",fields:[{name:"Id",type:"string"},{name:"Name",type:"string"},{name:"Size",type:"float"},{name:"Type",type:"string"},{name:"DateModified",type:"date",dateFormat:"Y-m-d H:i:s.0"},{name:"Permission",type:"string"},{name:"Status",type:"string"},{name:"Author",type:"string"},{name:"Owner",type:"string"},{name:"version",type:"string"},{name:"Tags",type:"string"},{name:"storeindex",type:"string"},{name:"readwrite",type:"string"}]});F=F.substr(0,F.length-1);var H=Wtf.urlEncode({groupid:this.groupid,pcid:this.pcid,tab:F});this.Parentfolder=(F=="*flag*")?"":F+"/";ds1=new Wtf.data.GroupingStore({url:Wtf.req.doc+"grid/fillGrid.jsp?"+H,reader:G,sortInfo:{field:"Type",direction:"DESC"}});ds1.load();ds1.on("loadexception",function(){msgBoxShow(["Error","A problem occurred while loading docs"],Wtf.MessageBox.ERROR);this.loadMask.hide()},this);ds1.on("load",function(){this.flagForTreeClick=0;this.grid1.getStore().removeAll();view=this.grid1.getView();view.refresh();var K=ds1.getRange(0,(ds1.getTotalCount()-1));this.grid1.getStore().add(K);view.refresh();this.quickSearchTF.StorageChanged(this.grid1.getStore());if(this.flagForReloadTree==1){this.flagForReloadTree=0;var N=this.mainTree.root.childNodes.length;var M=this.mainTree.root.childNodes;for(var P=0;P<N;P++){this.mainTree.root.removeChild(M.shift())}for(var O=0;O<ds1.getCount();O++){var J=ds1.getAt(O).data["Tags"].split(",");for(var L=0;L<J.length;L++){this.mainTree.makeTree(J[L],this.mainTree.root)}}this.mainTree.root.expand(false,false)}this.loadMask.hide()},this)},stringToArray:function(B,A){return B.split(A)},onDocGridRowClick:function(C,D,E){if(this.flagForTreeClick==0){var I=[];Wtf.EventManager.addListener(this.textbox.id,"keyup",this.handleKeyPress,this);Wtf.EventManager.addListener(this.bttn.id,"click",this.handleBttnClick,this);var J="";for(var H=0;H<this.grid1.getSelectionModel().getCount();H++){var B=this.grid1.getSelectionModel().getSelections()[H];var K=B.data["Id"];I=I.concat(this.stringToArray(B.data["Tags"],","))}I=I.sort();var G=new Array();vardocid=K;G=arrayUniq(I);var F;var A=this.divele;A.innerHTML="";A.style.display="block";this.editable=1;for(i=0;i<G.length;i++){F=document.createElement("span");F.className="spanelement";F.innerHTML=G[i];F.id="span"+i;F.style.color="#15428b";A.appendChild(F);Wtf.EventManager.addListener("span"+i,"mouseover",this.handleMouseOver,this);Wtf.EventManager.addListener("span"+i,"mouseout",this.handleMouseOut,this);Wtf.EventManager.addListener("span"+i,"click",this.handleMouseClick,this)}}},onGroupBttnClick:function(C,A){if(A){this.grid1.store.sort("DateModified","DESC");var B=this.grid1.getColumnModel().getColumnHeader(3);this.grid1.getStore().groupBy(B)}else{this.grid1.store.clearGrouping()}},handleTextSubmit:function(C){var B=C.getKey();if(B==13){var A=Wtf.getCmp(this.txtboxid);var D=this.myTextArea;D.style.display="none";div=this.divele;div.style.display="block";A.focus()}},handleKeyPress:function(B){var A=this.textbox.getValue();if(A==""||(this.editable==0)){this.bttn.disable()}else{this.bttn.enable()}},checkSystemTag:function(A){if(this.defaultTag.indexOf(A.toLowerCase())!=-1){return false}else{if(this.defaultTag.indexOf(A.toLowerCase().substr(0,A.indexOf("/")+1))!=-1){return false}}return true},_fillTmpArray:function(B){var C=B.split(",");var A=[];for(var D=0;D<C.length;D++){if(!this.checkSystemTag(C[D])){A.push(C[D]);break}}return A},checkForDuplicateEntry:function(A){var C=A.join(",").toLowerCase().split(",");for(var B=0;B<A.length;B++){C.shift();if(C.indexOf(A[B].toLowerCase())>-1||!this.checkSystemTag(A[B])){A[B]="-"}}while(A.length!=A.remove("-").length){A.remove("-")}return A},handleLost:function(e){var flagtemp=0;var spanele;this.textbox.setVisible(true);this.bttn.setVisible(true);var div=this.divele;div.innerHTML="";var shared="shared";var Uncategorized="uncategorized";var tarea=this.myTextArea;var text=tarea.value;var tagMatches;tagMatches=text.trim().match(this.patt1);text=text.replace(this.patt1,"");if(tagMatches!=null){if(text.trim()!=""){tagMatches=tagMatches.concat(text.match(this.patt2))}}else{tagMatches=text.trim().match(this.patt2)}var arr=[];var tagArray=new Array();var selectedRow=this.grid1.getSelectionModel().getSelected();var recno=this.grid1.store.find("Id",selectedRow.data["Id"],0,false,true);if(tagMatches&&tagMatches.length>0){tagMatches=this.checkForDuplicateEntry(tagMatches)}if(tagMatches&&tagMatches.length>0){if(selectedRow.data["Owner"]==0&&this.groupid==1){arr=this._fillTmpArray(selectedRow.data["Tags"])}if(arr.length>0){arr=arr.concat(tagMatches)}else{arr=tagMatches}}else{if(selectedRow.data["Owner"]==0&&this.groupid==1){arr=this._fillTmpArray(selectedRow.data["Tags"])}else{arr[0]="Uncategorized";if(selectedRow.data["Tags"]!="Uncategorized"){this.mainTree.makeTree(arr[0],this.mainTree.root)}}}var allTag="";for(i=0;i<arr.length;i++){arr[i]=this.mainTree.tagClean(arr[i]);spanele=document.createElement("span");spanele.className="spanelement";spanele.innerHTML=arr[i];spanele.id="span"+i;spanele.style.color="#15428b";div.appendChild(spanele);Wtf.EventManager.addListener("span"+i,"mouseover",this.handleMouseOver,this);Wtf.EventManager.addListener("span"+i,"mouseout",this.handleMouseOut,this);Wtf.EventManager.addListener("span"+i,"click",this.handleMouseClick,this)}tarea.style.display="none";div.style.display="block";allTag=arr.join(",");var selectedtagArr=selectedRow.data["Tags"].split(",");for(var l=0;l<arr.length;l++){if(arr[l]!=null){if(this.tempSpans[recno].indexOf(arr[l].toLowerCase())>-1){flagtemp=1;this.tempSpans[recno][this.tempSpans[recno].indexOf(arr[l].toLowerCase())]="-"}if(flagtemp==0||this.tempSpans[recno][0]==""){if(this.checkSystemTag(arr[l])){this.mainTree.makeTree(arr[l],this.mainTree.root)}}flagtemp=0}}var asd=0;for(m=0;m<this.tempSpans[recno].length;m++){if(this.tempSpans[recno][m]!="-"){if(this.tempSpans[recno][m].toLowerCase()!=shared&&this.tempSpans[recno][m].toLowerCase().substr(0,7)!=shared+"/"){this.mainTree.breakTree(this.tempSpans[recno][m],this.mainTree.root)}}}var alltag1=selectedRow.data["Tags"];selectedRow.data["Tags"]=allTag;Wtf.Ajax.requestEx({url:Wtf.req.doc+"tree/tab_tag.jsp",params:{docid:vardocid,tags:allTag,groupid:this.groupid,pcid:this.pcid}},this,function(result,req){if(eval("("+result+")")["res"]==1){selectedRow.data["Tags"]=alltag1;msgBoxShow(["Error","Please Edit Tag Again"],Wtf.MessageBox.ERROR)}})},handleBttnClick:function(obj,e){var flagbtclick=0;var flagbtclick1=1;var shared="shared";var Uncategorized="uncategorized";var flagShared=0;var flag=0;var uncatflag=0;if(this.bttn.disabled==false){var spanele;var div=this.divele;div.style.display="block";var text=this.textbox.getValue();text=text.trim();var check=text.match(this.patt1);if(check==null){check=text.match(/^([\w][\s]*[\\|\/\w\s]*)$/g)}else{text=text.replace(/'|"/g,"")}var docidarr="";if(check!=null&&this.checkSystemTag(text.toLowerCase())){text=text.replace(/\/+/g,"/");if(text.trim().match(/\s+/g)!=null){text="'"+text+"'"}var spans=div.getElementsByTagName("span");for(i=0;i<spans.length;i++){if(spans[i].innerHTML.toLowerCase()==Uncategorized){spans[i].innerHTML=""}}var selectedRow=this.grid1.getSelectionModel().getSelections();for(var a=0;a<this.grid1.getSelectionModel().getCount();a++){var rec=selectedRow[a];var temp=rec.data["Id"];var tagname1=rec.data["Tags"].split(",");for(i=0;i<tagname1.length;i++){if(tagname1[i].toLowerCase()==text.toLowerCase()){flagbtclick=1;flagbtclick1=0}if(tagname1[i].toLowerCase()=="uncategorized"){this.mainTree.breakTree(tagname1[i],this.mainTree.root);rec.data["Tags"]=""}}if(flagbtclick==0){docidarr+=temp+","}flagbtclick=0}docidarr=docidarr.substr(0,docidarr.length-1);if(this.checkSystemTag(text)){if(flagbtclick1==1){spanele=document.createElement("span");spanele.className="spanelement";var child=div.getElementsByTagName("span");spanele.id="span"+child.length;spanele.innerHTML=text;spanele.style.color="#15428b";div.appendChild(spanele);Wtf.EventManager.addListener(spanele.id,"mouseover",this.handleMouseOver,this);Wtf.EventManager.addListener(spanele.id,"mouseout",this.handleMouseOut,this);Wtf.EventManager.addListener(spanele.id,"click",this.handleMouseClick,this)}this.textbox.setValue("");var docidarr1=docidarr.split(",");for(var l=0;l<docidarr1.length;l++){if(docidarr1[l]!=""){this.mainTree.makeTree(text,this.mainTree.root);var rec=this.grid1.store.find("Id",docidarr1[l],0,false,true);var alltag1=this.grid1.store.getAt(rec).data["Tags"];var rec1=this.grid1.store.getAt(rec);if(rec1.data["Tags"]!=""){rec1.data["Tags"]+=","+text}else{rec1.data["Tags"]=text}}}if(docidarr1[0]!=""){Wtf.Ajax.requestEx({url:Wtf.req.doc+"grid/addButtonTag.jsp",params:{res:text,docid:docidarr,groupid:this.groupid,pcid:this.pcid}},this,function(result,req){if(eval("("+result+")")["res"]==1){msgBoxShow(["Error","Please Edit Tag Again"],Wtf.MessageBox.ERROR)}})}}}else{Wtf.Msg.alert("Error","A tag can contain only alphanumeric characters");this.textbox.setValue("")}this.textbox.setValue("")}this.bttn.setDisabled(true)},specialKey:function(D,C){var B=C.getKey();if(B==13){var A=this.textbox.getValue();if(A!=""){this.handleBttnClick()}}},handleClickDiv:function(G){if(this.grid1.getSelectionModel().getCount()==1){var F=this.grid1.getSelectionModel().getSelected();var D=this.grid1.store.find("Id",F.data["Id"],0,false,true);this.textbox.setVisible(false);this.bttn.setVisible(false);var C=this.divele;var H=C.getElementsByTagName("span");var A=this.myTextArea;var E="shared";A.style.display="block";A.value="";var I=0;this.spanlength[D]=H.length;for(i=0;i<H.length;i++){if(i<(H.length-1)){if(!this.checkSystemTag(H[i].innerHTML)){A.value+=" "}else{A.value+=H[i].innerHTML+" "}}else{if(!this.checkSystemTag(H[i].innerHTML)){A.value+=" "}else{A.value+=H[i].innerHTML}}var B=H[i].innerHTML;this.tempSpans[D][i]=B.toLowerCase();H[i].style.display="none"}C.style.display="none";A.style.display="block";A.focus()}},handleMouseOver:function(B){var A=B.getTarget();A.style.backgroundColor="White";A.style.cursor="pointer"},handleMouseOut:function(B){var A=B.getTarget();A.style.backgroundColor=""},handleMouseClick:function(H,G){var F=G.innerHTML;F=F.replace(/'/g,"");var B=F.split("/");var A=this.mainTree.root;for(var E=0;E<B.length;E++){for(var D=0;D<A.childNodes.length;D++){var C=A.childNodes[D].text.split(" (");if(B[E].toLowerCase()==C[0].toLowerCase()){A=A.childNodes[D];if(A.childNodes.length>0&&E+1!=B.length){A.expand()}}}}A.fireEvent("click",A);this.divele.innerHTML=""},QuickSearchComplete:function(A){view=this.grid1.getView();view.refresh()},AddDept:function(){this.groupcombo=new Wtf.form.ComboBox({mode:"local",store:this.rolegrStore,fieldLabel:"User Groups",hidden:isRoleGroup("4")?false:true,hideLabel:isRoleGroup("4")?false:true,hiddenName:"groupid",valueField:"groupid",triggerAction:"all",displayField:"groupname",readOnly:true,emptyText:"Select a Group",allowBlank:false,width:200});if(!isRoleGroup("4")){this.groupcombo.setValue(this.groupid)}this.deptTextf=new Wtf.form.TextField({fieldLabel:"Folder Name",allowBlank:false,name:"deptname",width:200});this.winDept=new Wtf.Window({title:"New Folder",height:170,bodyStyle:"background-color:#eeeeee;padding:10px;",width:400,layout:"form",items:[this.deptTextf,this.groupcombo],buttons:[{text:"Add",minWidth:60,scope:this,handler:this.addNewDept},{text:"Cancel",minWidth:60,scope:this,handler:function(){this.winDept.close()}}]});this.winDept.show()},addNewDept:function(){if(this.groupcombo.getValue()==""||this.deptTextf.getValue()==""){msgBoxShow(["Error","Please give values for required fields"],Wtf.MessageBox.ERROR)}else{Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{deptname:this.Parentfolder+this.deptTextf.getValue(),groupid:this.groupcombo.getValue(),type:"addDocDept"}},this,function(result,req){if(eval("("+result+")").success==true){this.winDept.close();msgBoxShow(["Success","Folder added successfully"],Wtf.MessageBox.INFO);var div=this.divele;spanele=document.createElement("span");spanele.className="spanelement";var child=div.getElementsByTagName("span");spanele.id="span"+child.length;spanele.innerHTML=this.deptTextf.getValue();spanele.style.color="#15428b";div.appendChild(spanele);Wtf.EventManager.addListener(spanele.id,"mouseover",this.handleMouseOver,this);Wtf.EventManager.addListener(spanele.id,"mouseout",this.handleMouseOut,this);Wtf.EventManager.addListener(spanele.id,"click",this.handleMouseClick,this);this.mainTree.makeTree(this.deptTextf.getValue(),this.mainTree.getSelectionModel().getSelectedNode());this.deptStore.load()}else{msgBoxShow(["Error","Error connecting to server"],Wtf.MessageBox.ERROR)}},function(result,req){msgBoxShow(["Error","Error connecting to server"],Wtf.MessageBox.ERROR)})}}});function filecomparefun(url,rev1,rev2,tabid,v1,v2,tabname){if(Wtf.getCmp(tabid)==null){var currentPosition=-1;var array;var frameNames;var arraySize;function set(numbers,names){array=numbers;frameNames=names;arraySize=array.length}function next(){var dest=array[arraySize-1];if(arraySize>0){if(currentPosition!=arraySize-1){dest=array[++currentPosition]}}jump(dest)}function previous(){var dest=array[0];if(arraySize>0){if(currentPosition!=-1&&currentPosition!=0){dest=array[--currentPosition]}}jump(dest)}function jump(dest){if(self.frames[leftFrameName]==null||self.frames[rightFrameName]==null){return }else{var path=frameNames[currentPosition];if(path.indexOf("startrev")!=-1){self.frames[leftFrameName].location=path+"#"+dest}else{self.frames[rightFrameName].location=path+"#"+dest}}}var loadedFrameNum=0;Wtf.getCmp("as").add({id:tabid,tabType:Wtf.etype.docs,layout:"fit",title:"[v"+v1+" - v"+v2+"] "+tabname,closable:true,iconCls:getTabIconCls(Wtf.etype.docs)});Wtf.getCmp("as").doLayout();Wtf.getCmp("as").setActiveTab(Wtf.getCmp(tabid));function SuccessPanel(resp,option){var respobj=eval("("+resp+")");var endurl=respobj.endurl;var starturl=respobj.starturl;var itemsadded=respobj.itemsadded;var itemsmodified=respobj.itemsmodified;var itemsdeleted=respobj.itemsdeleted;var data={items:[{h:"Added",i:"images/added_ico.gif",t:itemsadded},{h:"Changed",i:"images/changed_ico.gif",t:itemsmodified},{h:"Deleted",i:"images/removed_ico.gif",t:itemsdeleted}]};var tpl=new Wtf.XTemplate('<div class="docHdr"><tpl for="items"><div class="docHdrTxt"><img src="{i}"/><span class="sb">{h}:</span><span class="st">&nbsp;{t}</span></div></tpl></div>');var obj1=new Wtf.ScrollPanel({id:"iframe1"+tabid,width:"100%",border:false,autoLoad:starturl,autoScroll:true});var obj2=new Wtf.ScrollPanel({id:"iframe2"+tabid,width:"100%",border:false,autoLoad:endurl,autoScroll:true});Wtf.getCmp("iframe1"+tabid).on("bodyscroll",function(scrollLeft,scrollTop){Wtf.getCmp("iframe2"+tabid).body.dom.scrollTop=scrollTop;Wtf.getCmp("iframe2"+tabid).body.dom.scrollLeft=scrollLeft});Wtf.getCmp("iframe2"+tabid).on("bodyscroll",function(scrollLeft,scrollTop){Wtf.getCmp("iframe1"+tabid).body.dom.scrollTop=scrollTop;Wtf.getCmp("iframe1"+tabid).body.dom.scrollLeft=scrollLeft});var viewport=new Wtf.Panel({baseCls:"ascls1",layout:"border",items:[{region:"east",id:"east"+tabid,border:false,title:"Version "+v2,width:"50%",layout:"fit",items:obj2},{region:"north",id:"north",border:false,height:32,items:new Wtf.Panel({html:tpl.apply(data),border:false})},{region:"center",id:"center"+tabid,border:false,title:"Version "+v1,width:"50%",layout:"fit",items:obj1}]});Wtf.getCmp(tabid).add(viewport);Wtf.getCmp(tabid).doLayout()}Wtf.Ajax.requestEx({url:Wtf.req.doc+"file-releated/filecompare/fileCompare.jsp",params:{url:url,startrev:rev1,endrev:rev2,flag:"0"}},this,SuccessPanel)}else{Wtf.getCmp("as").setActiveTab(Wtf.getCmp(tabid))}}function revisionlistFun(url,tabid,tabname,docid,fileType){if(Wtf.getCmp(tabid)==null){var displayButflag=0;Wtf.getCmp("as").add({id:tabid,tabType:Wtf.etype.docs,layout:"fit",title:"[Versions] "+tabname,closable:true,iconCls:getTabIconCls(Wtf.etype.docs)});Wtf.getCmp("as").doLayout();Wtf.getCmp("as").setActiveTab(Wtf.getCmp(tabid));function SuccessFun(resp,option){var respobj=eval("("+resp+")");var version=respobj.version;function Compare_Click(){var val=sm.getSelections();if(val.length==2){var rev1=parseInt(val[1].get("Revision"));var rev2=parseInt(val[0].get("Revision"));var v1=parseInt(val[1].get("Version"));var v2=parseInt(val[0].get("Version"));if(rev1>rev2){rev1=rev1^rev2;rev2=rev1^rev2;rev1=rev1^rev2;v1=v1^v2;v2=v1^v2;v1=v1^v2}filecomparefun(url,rev1,rev2,"compare"+url+rev1+rev2,v1,v2,tabname)}else{Wtf.Msg.alert("Error","Please select two revisions to compare")}}function GetToolbar(){return([new Wtf.Action({text:"Compare",tooltip:{text:"Click to view a comparison of any two revisions"},iconCls:"pwnd RevisionList",disabled:((displayButflag==0)?false:true),handler:Compare_Click})])}var reader=new Wtf.data.JsonReader({idProperty:"taskId",root:"data",remoteGroup:true,remoteSort:true,fields:[{name:"Revision",type:"string"},{name:"Version",type:"string"},{name:"Age",type:"string"},{name:"Author",type:"string"},{name:"Comment",type:"string"},{name:"Download",type:"string"}]});var sm=new Wtf.grid.CheckboxSelectionModel();var ds=new Wtf.data.Store({url:Wtf.req.doc+"file-releated/revision/revisionlistin.jsp?url="+url,reader:reader});function DownloadLink(a,b,c,d,e,f){return"<a href='#' title='Download' onclick='setDldUrl(\""+unescape(a)+"\")'><div class='pwnd dldiconwt' style='height:16px; width:16px;'></div></a>"}var sm=new Wtf.grid.CheckboxSelectionModel();var cm=new Wtf.grid.ColumnModel([sm,{header:"Version",dataIndex:"Version"},{header:"Age",dataIndex:"Age"},{header:"Author",dataIndex:"Author"},{header:"Comments",dataIndex:"Comment"},{header:"Download",dataIndex:"Download",renderer:DownloadLink}]);cm.defaultSortable=true;var grid=new Wtf.grid.GridPanel({ds:ds,cm:cm,sm:sm,trackMouseOver:true,enableColumnHide:false,headerStyle:"background-color: rgb(231,240,250)",viewConfig:{forceFit:true,autoFill:true}});ds.load();ds.on("loadexception",function(){msgBoxShow(["Error","A problem comparing docs"],Wtf.MessageBox.ERROR)});var panel1=new Wtf.Panel({id:"panelforrevisionlist"+tabid,frame:false,border:false,layout:"border",items:[{region:"north",border:false,frame:false,height:55,layout:"fit",tbar:GetToolbar(),items:new Wtf.Panel({html:'<div class="docHdr"><div class="docHdrTxt"><span class="sb">Displayed Versions:</span>&nbsp;'+version+"</div></div>",border:false})},{region:"center",border:false,frame:false,layout:"fit",items:new Wtf.Panel({border:false,frame:false,items:[grid],autoScroll:true,layout:"fit",bodyStyle:"background-color: #FFFFFF;"})}]});Wtf.getCmp(tabid).add(panel1);Wtf.getCmp(tabid).doLayout();panel1.doLayout()}Wtf.Ajax.requestEx({url:Wtf.req.doc+"file-releated/filecontent/filedownloadchk.jsp",params:{docid:docid}},this,function(resp,option){var respText=eval("("+resp+")");if(respText.download=="yes"||fileType=="Image"){displayButflag=1}});Wtf.Ajax.requestEx({url:Wtf.req.doc+"file-releated/revision/revisionListMain.jsp",params:{url:url}},this,SuccessFun)}else{Wtf.getCmp("as").setActiveTab(Wtf.getCmp(tabid))}}function filecontentTab(url,tabid,tabname,fileType,RevisionNumber){if(Wtf.getCmp(tabid)==null){Wtf.getCmp("as").add({id:tabid,tabType:Wtf.etype.docs,layout:"fit",title:tabname,closable:true,iconCls:getTabIconCls(Wtf.etype.docs)});Wtf.getCmp("as").doLayout();Wtf.getCmp("as").setActiveTab(Wtf.getCmp(tabid));function SuccessFun(resp,option){var respobj=eval("("+resp+")");function CallRevisionList(){revisionlistFun(respobj.svnname,url+"revisionlist",respobj.docname,url,fileType)}function Downlist(){setDownloadUrl(url)}function GetToolbar(){return([new Wtf.Action({id:"Download"+tabid,text:"Download",iconCls:"pwnd dldicon",handler:Downlist})])}var containerdiv='<div class="docHdr" style="height:50px"><div class="docHdrTxt" style="width:240px"><span class="sb">Uploaded On:</span>&nbsp;'+respobj.date+'</div><div class="docHdrTxt" style="width:240px"><span class="sb">Author:</span>&nbsp;'+respobj.author+'</div><div class="docHdrTxt"><span class="sb">Size:</span>&nbsp;'+respobj.size+'</div><div style="clear:both;"></div><div class="docHdrTxt" style="width:100%"><span class="sb">Comment:</span>&nbsp;'+URLDecode(respobj.comment)+"</div></div>";var containerdiv1=document.createElement("div");containerdiv1.id="file1div"+tabid;containerdiv1.style.height="100%";containerdiv1.style.overflow="hidden";var obj1=document.createElement("iframe");obj1.id="iframe1"+Wtf.getCmp(tabid);obj1.name="iframe1"+tabid;obj1.cls="ascls";obj1.style.width="100%";obj1.style.height="100%";obj1.style.border="0";obj1.style.autoScroll=false;if(RevisionNumber=="-"||RevisionNumber==null){obj1.src="fileData.jsp?url="+url}else{Wtf.Ajax.requestEx({url:Wtf.req.doc+"file-releated/filecompare/fileCompare.jsp",params:{url:respobj.svnname,startrev:RevisionNumber,endrev:-1,flag:"1"}},this,function(){obj1.src=Wtf.req.doc+"file-releated/filecompare/fileCompareData.jsp?startrev="+RevisionNumber+"&extension="+tabname.substr(tabname.lastIndexOf(".")+1)+"&flag=1"})}containerdiv1.appendChild(obj1);var panel1=new Wtf.Panel({id:"panel1"+tabid,frame:false,layout:"border",tbar:GetToolbar(),items:[{region:"north",border:false,frame:false,height:50,layout:"fit",items:new Wtf.Panel({layout:"fit",html:containerdiv,border:false})},{region:"center",border:false,frame:false,layout:"fit",items:new Wtf.Panel({border:false,frame:false,items:[containerdiv1],autoScroll:true,layout:"fit",bodyStyle:"background-color: #FFFFFF;"})}]});Wtf.getCmp(tabid).add(panel1);Wtf.getCmp(tabid).doLayout();panel1.doLayout()}Wtf.Ajax.requestEx({url:Wtf.req.doc+"file-releated/filecontent/fileContent.jsp",params:({url:url})},this,SuccessFun)}else{Wtf.getCmp("as").setActiveTab(Wtf.getCmp(tabid))}}Wtf.docs.com.Tree=function(A){Wtf.apply(this,A);Wtf.docs.com.Tree.superclass.constructor.call(this,{baseCls:"docscom",width:"100%",minSize:175,maxSize:400,baseCls:"docscom",collapsible:true,margins:"0 0 5 5",cmargins:"0 5 5 5",rootVisible:true,lines:true,root:new Wtf.tree.TreeNode({id:"root",text:this.rootText,expanded:true,iconCls:"back_image_open"}),autoScroll:true,collapseFirst:false,baseCls:"treebac",border:true});this.ge=new Wtf.tree.TreeEditor(this,{allowBlank:false,container:this.getEl,completeOnEnter:true,ignoreNoChange:true,cancelOnEsc:true,updateEl:true,blankText:"A name is required",selectOnFocus:true},this);this.ge.on("beforestartedit",this.beforeStartEdit,this);this.ge.on("startedit",this.startEdit,this);this.ge.on("beforecomplete",this.beforeComplete,this);this.ge.on("complete",this.onComplete,this);this.on("contextmenu",this.contextMenu,this);this.on("expandnode",function(B,C){B.ui.getIconEl().className="x-tree-node-icon back_image_open"},this);this.on("collapsenode",function(B,C){B.ui.getIconEl().className="x-tree-node-icon back_image_close"},this);this.addEvents=({"onDeleteComplete":true})};Wtf.extend(Wtf.docs.com.Tree,Wtf.tree.TreePanel,{ge:null,initComponent:function(A){Wtf.docs.com.Tree.superclass.initComponent.call(this,A);this.addEvents({"deleteNode":true})},setRootNode1:function(A){var B=new Wtf.tree.TreeNode({id:"root",text:A,expanded:true,iconCls:"back_image_open"});return B},contextMenu:function(node,e){menu=new Wtf.menu.Menu({id:"treeMenu",items:[{text:"Rename",id:"name",iconCls:"pwnd renameicon",scope:this,handler:renameNode},new Wtf.Action({text:"Delete",iconCls:"pwnd delicon",scope:this,handler:deleteNode})]});var abcd=this.grid;var user=this.userid;var pcid=this.pcid;var groupid=this.groupid;if(node!=this.root){if((node.getDepth()==1&&this.defaultTag.indexOf(node.text.toLowerCase().split(" (")[0])==-1)||node.getDepth()!=1){if(node.getDepth()>1){var depth=node.getDepth();var tempNode=node;do{tempNode=tempNode.parentNode}while(tempNode.getDepth()!=1);if(this.defaultTag.indexOf(tempNode.text.match("([\\w]+[\\s]*)*")[0].trim().toLowerCase())==-1){menu.showAt(e.getXY())}}else{menu.showAt(e.getXY())}}}Wtf.destroy("treeMenu");function renameNode(){this.getSelectionModel().select(node);this.ge.triggerEdit(this.getSelectionModel().getSelectedNode())}function deleteNode(){var root=node.getOwnerTree().root;var parentnode=node;var str="";var nodeText="";var nodocs=node.text.match("\\s[(](\\d+)[)]");if(node.getDepth()==0){nodeText=parentnode.text}else{for(var i=(node.getDepth());i>0;i--){nodeText+=parentnode.text.split(" (")[0]+"/";parentnode=parentnode.parentNode}nodeText=nodeText.substr(0,nodeText.length-1);str=nodeText.split("/");nodeText="";for(var j=(str.length-1);j>=0;j--){nodeText+=str[j]+"/"}nodeText=nodeText.substr(0,nodeText.length-1);Wtf.destroy("treeMenu")}Wtf.destroy("treeMenu");for(var i=0;i<abcd.getStore().getCount();i++){var a=abcd.getStore().getAt(i);var b=this.delTag(abcd.getStore().getAt(i).data["Tags"],nodeText);a.set("Tags",b)}var tag=nodeText;tag=tag.trim();if(tag.length==0){tag="Uncategorized"}if(nodocs==null){this.breakTree(tag,this.root)}else{for(var k=0;k<nodocs[1];k++){this.breakTree(tag,this.root)}}this.fireEvent("deleteNode",nodeText);Wtf.destroy("treeMenu");Wtf.Ajax.requestEx({url:Wtf.req.doc+"tree/deleteTag.jsp",params:{tagname:nodeText,groupid:groupid,pcid:pcid}},this,function(result,req){if(eval("("+result+")")["res"]==1){msgBoxShow(["Error","A problem occurred while deleting tags"],Wtf.MessageBox.ERROR)}})}},delTag:function(H,E){var G=H.split(",");var C="";for(var B=0;B<G.length;B++){if(G[B]!=this.checkTag(E)){if(B==G.length-1){C+=G[B]+""}else{C+=G[B]+","}}}var D="";var F=C.split(",");for(B=0;B<F.length;B++){if(F[B].substring(0,E.length+1)!=E+"/"){if(B==F.length-1){D+=F[B]+""}else{D+=F[B]+","}}}if(D==""&&E!=""){D="Uncategorized";this.makeTree(D,this.root)}var A=D.length-1;if(D[A]==","){return D.substring(0,A)}else{return D}},beforeStartEdit:function(B,A,D){if(D==this.root.text){return false}else{if(this.getSelectionModel().getSelectedNode().getDepth()==1&&this.defaultTag.indexOf(D.match("([\\w]+[\\s]*)*")[0].trim().toLowerCase())!=-1){return false}else{if(this.getSelectionModel().getSelectedNode().getDepth()>1){var E=this.getSelectionModel().getSelectedNode().getDepth();var C=this.getSelectionModel().getSelectedNode();do{C=C.parentNode}while(C.getDepth()!=1);if(this.defaultTag.indexOf(C.text.match("([\\w]+[\\s]*)*")[0].trim().toLowerCase())!=-1){return false}}}}},startEdit:function(A,B){this.ge.setValue(B.replace(/\s[(]\d+[)]/g,""))},beforeComplete:function(ge,value,startValue){if(value!=startValue){var str="^[\\w+\\s*]*$";var flag=0;value=value.trim();var matchValue=value.match(str);if(matchValue!=null&&this.defaultTag.indexOf(value.toLowerCase())==-1){value=matchValue[0];value=value.replace(/\/+/g,"/");var depth=this.getSelectionModel().getSelectedNode().getDepth();var node=this.getSelectionModel().getSelectedNode();path="";path+=this.getSelectionModel().getSelectedNode().text.replace(/\s[(]\d+[)]/g,"")+"/";while(depth>1){node=node.parentNode;path+=node.text.split(" (")[0]+"/";depth--}path=path.substr(0,path.length-1);var newpath=path.split("/");path="";for(var i=(newpath.length-1);i>=0;i--){path+=newpath[i]+"/"}path=path.substr(0,path.length-1);depth=this.getSelectionModel().getSelectedNode().getDepth();if(depth>1){var finalnewpath=path.substr(0,path.lastIndexOf("/"))+"/"+value;var oldpath=path.substr(0,path.lastIndexOf("/"))+"/"+startValue}else{var finalnewpath=value;var oldpath=startValue}Wtf.Ajax.requestEx({url:Wtf.req.doc+"tree/editTagTree.jsp",params:{oldTabName:oldpath.split(" (")[0],newTabName:finalnewpath,groupid:this.groupid,pcid:this.pcid}},this,function(result,req){if(eval("("+result+")")["res"]==0){for(var i=0;i<this.grid.getStore().getCount();i++){var a=this.grid.getStore().getAt(i);var b=this.editTreeNode(this.grid.getStore().getAt(i).data["Tags"],oldpath.split(" (")[0],finalnewpath);a.set("Tags",b)}}else{msgBoxShow(["Error","A problem occurred while loading tags"],Wtf.MessageBox.ERROR)}})}else{this.ge.setValue(startValue.match("([\\w]+[\\s]*)*")[0].trim());return false}value+=startValue.replace(/\s[(]\d+[)]/g,"")}},mergeNode:function(A,F,G){var B=1;var D=new Array();var C;var H=0;for(var E=0;E<A.childNodes.length;E++){if(G.match("^"+A.childNodes[E].text.match("([\\w]+[\\s]*)*")[0].trim()+"$","i")!=null){this.fireEvent("onDeleteComplete");return true}}return false},onComplete:function(D,E,B){if(E.replace(/\s[(]\d+[)]/g,"")!=B.replace(/\s[(]\d+[)]/g,"")){var C=new Array();var A;var F=0;if(this.mergeNode(this.getSelectionModel().getSelectedNode().parentNode,this.getSelectionModel().getSelectedNode(),E)){return false}if(B.match("\\s[(]\\d+[)]")!=null){this.getSelectionModel().getSelectedNode().setText(E+B.match("\\s[(]\\d+[)]"));return false}}if(E.match("^"+B.match("([\\w]+[\\s]*)*")[0].trim()+"$","i")!=null){this.getSelectionModel().getSelectedNode().setText(B);return false}},editTreeNode:function(D,B,F){var A=D.split(",");var E="";F=this.checkTag(F);B=this.checkTag(B);for(var C=0;C<A.length;C++){if(A[C]==B){A[C]=F}else{if(A[C].substr(0,B.length).toLowerCase()==B.toLowerCase()){A[C]=F+A[C].substr(B.length)}}E+=A[C]+","}E=E.substr(0,E.length-1);return E},tagClean:function(A){var B=A.replace(/\s*\/\s*/g,"/");B=B.replace(/^['"]\s*|\s*['"]$/g,"'");B=B.replace(/\s+/g," ");B=B.replace(/[\/]+/g,"/");B=B.replace(/([\/]*'[\/]*)/g,"'");return B.trim()},checkTag:function(A){return A.trim().match(" ")?"'"+A+"'":A},makeTree:function(I,H){if(H.childNodes!=null){I=this.tagClean(I);I=I.replace(/'|"/g,"");var A=I.split("/");var G=1;for(var D=0;D<A.length;D++){if(A!=""){var C=new Wtf.tree.TreeNode({text:A[D],lines:true,iconCls:"back_image_close"});G=1;for(var E=0;E<H.childNodes.length;E++){var F=H.childNodes[E].text.split(" (");if(F[0].toLowerCase()==A[D].toLowerCase()){H=H.childNodes[E];G=0;var B=D+1;H.setText(A[D]);break}}if(G==1){H.appendChild(C);H=C}}}}},breakTree:function(M,I){if(I.childNodes!=null){M=this.tagClean(M);M=M.replace(/'|"/g,"");M=M.trim();if(M.length==0){M="Uncategorized"}var A=M.split("/");var H=1;var L=0;var F=[];for(var C=0;C<A.length;C++){H=1;for(var D=0;D<I.childNodes.length;D++){var E=I.childNodes[D].text.split(" (");if(E[0].toLowerCase()==A[C].toLowerCase()){I=I.childNodes[D];H=0;var B=C+1;if(I.text.split(" (").length==1){if(I.getOwnerTree()!=null){I.remove()}}else{var K=I.text.split(" (")[1];var J=parseInt(K.substr(0,K.length-1));J=J-1;if(J>1){K=I.text.split(" (")[0]+" ("+J.toString()+")";I.setText(K)}else{if(J==1){var G=I.text.split(" (")[0];I.setText(G)}}}}}}}},breakTree2:function(J,H){J=J.trim();if(J.length==0){J="Uncategorized"}var A=J.split("/");var G=1;var I=0;var F=[];for(var C=0;C<A.length;C++){G=1;for(var D=0;D<H.childNodes.length;D++){var E=H.childNodes[D].text.split(" (");if(E[0].toLowerCase()==A[C].toLowerCase()){H=H.childNodes[D];G=0;var B=C+1;if(B==A.length){if(H.getOwnerTree()!=null){H.remove()}}}}}}});Wtf.KWLQuickSearch=function(A){Wtf.KWLQuickSearch.superclass.constructor.call(this,A)};Wtf.extend(Wtf.KWLQuickSearch,Wtf.form.TextField,{Store:null,StorageArray:null,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(C){if(this.Store){if(this.getValue()!=""){this.Store.removeAll();var B=0;while(B<this.StorageArray.length){var D=new RegExp("^(?:.+\\s)*"+this.getValue()+".*$","i");if(this.field.indexOf(",")>0){var A=this.field.split(",");if(A.length==2){if(D.test(this.StorageArray[B].get(A[0])+" "+this.StorageArray[B].get(A[1]))){this.Store.add(this.StorageArray[B])}}}else{if(D.test(this.StorageArray[B].get(this.field))){this.Store.add(this.StorageArray[B])}}B++}}else{this.Store.removeAll();for(B=0;B<this.StorageArray.length;B++){this.Store.insert(B,this.StorageArray[B])}}this.fireEvent("SearchComplete",this.Store)}},StorageChanged:function(A){this.Store=A;this.StorageArray=this.Store.getRange()}});Wtf.reg("KWLQuickSearch",Wtf.KWLQuickSearch);Wtf.KWLTagSearch=function(A){Wtf.KWLTagSearch.superclass.constructor.call(this,A)};Wtf.extend(Wtf.KWLTagSearch,Wtf.form.TextField,{Store:null,StorageArray:null,limit:15,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.CreditNote=function(A){Wtf.apply(this,A);Wtf.CreditNote.superclass.constructor.call(this,A)};Wtf.extend(Wtf.CreditNote,Wtf.Window,{initComponent:function(A){customerId=null;refNo=null;customerName=null;creditAmount=null;receivableAccid=null;this.bankAccid=1;creditId=null;totalTid=null;moduleid=null;Wtf.CreditNote.superclass.initComponent.call(this,A);this.addEvents({"closeform":true})},onRender:function(A){Wtf.CreditNote.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask));this.chargeStore=new Wtf.data.SimpleStore({fields:["id","name"],data:[["0","Flat Fee"],["1","% Fee"]]});this.add({border:false,layout:"border",items:[{region:"north",border:false,height:75,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:"<div style = 'width:100%;height:100%;position:relative;float:left;'><div style='float:left;height:100%;width:auto;position:relative;'><img src = 'images/createuser.gif' style = 'width:40px;height:52px;margin:5px 5px 5px 5px;'></img></div><div style='float:left;height:100%;width:60%;position:relative;'><div style='font-size:12px;font-style:bold;float:left;margin:15px 0px 0px 10px;width:100%;position:relative;'><b>Credit Note</b></div><div style='font-size:10px;float:left;margin:15px 0px 10px 10px;width:100%;position:relative;'>Generate credit note</div></div></div>"},{region:"center",autoScroll:true,bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,items:[{border:false,layout:"form",bodyStyle:"padding:13px 13px 13px 13px",labelWidth:100,items:[this.CustName=new Wtf.form.TextField({fieldLabel:"Customer Name*",anchor:"93%",allowBlank:false,id:"custname"+this.id,value:this.customerName,msgTarget:"side",readOnly:true}),this.RefAmt=new Wtf.form.TextField({fieldLabel:"Credit Amount*",anchor:"93%",allowBlank:false,value:this.creditAmount,id:"refamt"+this.id,msgTarget:"side",readOnly:true}),this.amtcut=new Wtf.form.NumberField({fieldLabel:"Refund(%)",anchor:"93%",allowBlank:false,id:"amtcut"+this.id,msgTarget:"side"}),this.chargeCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.chargeStore,anchor:"93%",fieldLabel:"Charge Mode",mode:"local",readOnly:true,displayField:"name",hiddenName:"id",allowBlank:false,valueField:"id",emptyText:"Select Charge Mode"}),this.RefundAmt=new Wtf.form.NumberField({fieldLabel:"Total Refund Amount*",anchor:"93%",allowBlank:false,id:"refundamt"+this.id,decimalPrecision:2,msgTarget:"side"}),this.dateTimePickerdate=new Wtf.form.DateField({fieldLabel:"Date*",anchor:"93%",id:"Date"+this.id,displayField:"Date",allowBlank:false}),this.memo=new Wtf.form.TextArea({fieldLabel:"Memo",height:40,anchor:"93%",allowBlank:true,id:"memo"+this.id})]}]}],buttonAlign:"center",buttons:[{text:"Submit",handler:this.generateCreditNote,scope:this},{text:"Cancel",handler:function(){this.close()},scope:this}]});this.amtcut.on("blur",this.calRefamount,this);this.chargeCombo.on("select",this.calRefamount,this);if(this.fullrefund=="true"){this.amtcut.enable();this.chargeCombo.enable();this.RefundAmt.value=this.creditAmount;this.RefundAmt.enable()}},calRefamount:function(){if(this.amtcut.getValue()!=""&&this.chargeCombo.getValue()!=null){var A=0;if(this.chargeCombo.getValue()=="0"){A=parseFloat(this.amtcut.getValue())}else{A=(parseFloat(this.RefAmt.getValue()))*(parseFloat(this.amtcut.getValue())/100)}this.RefundAmt.setValue(Wtf.precisionDecimalValue(A))}},generateCreditNote:function(){this.RefAmt.validate();this.dateTimePickerdate.validate();this.RefundAmt.validate();this.CustName.validate();if(!this.RefAmt.isValid()||!this.dateTimePickerdate.isValid()||!this.RefundAmt.isValid()||!this.CustName.isValid()){return }var A=3;this.UUIDStore=new Wtf.data.Store({url:"jspfiles/accounting/Accounts.jsp?flag=3&count="+A,reader:new Wtf.data.JsonReader({root:"data"},["id"])});this.UUIDStore.load();this.UUIDStore.on("load",this.submitcreditmemo,this)},submitcreditmemo:function(N,L,C){this.loadMask.show();var U=Wtf.common.CreateJsonStart();var H;var R=1;var O=0;var K=0;var W=0;var S=L[0].data["id"];this.totalTid=S;var M=0;var T=new Date(this.dateTimePickerdate.getValue());var V=T.format("Y-m-d H:i:s");var Q=this.receivableAccid;var P="3";var D=this.refNo;var I=this.customerId;M=this.RefundAmt.getValue();var B=0;var J=new Number(M);var A=new Array("tablename","id","tid","ttypeid","dateval","num","total","customerid","amount","amountdue","salestaxid");var E=new Array("transaction1",O,S,10,V,D,"true",I,-J,-J,0);H=Wtf.common.getJsonObjectForAccounting(A,E);O++;U+=H;var A=new Array("tablename","id","tid","accid","balance");var E=new Array("accounttransaction",K,S,Q,-J);H=Wtf.common.getJsonObjectForAccounting(A,E);K++;U+=H;var F=L[1].data["id"];var G=L[2].data["id"];var A=new Array("tablename","id","tid","creditmemoid","num","memo","amount","itemid","itemqty","price");var E=new Array("creditmemo",W,S,F,D,this.memo.getValue(),J,"",1,J);H=Wtf.common.getJsonObjectForAccounting(A,E);W++;U+=H;var A=new Array("tablename","id","tid","ttypeid","dateval","num","total","customerid","amount","amountdue","salestaxid");E=new Array();E[0]="transaction1";E[1]=O;E[2]=G;E[3]=10;E[4]=V;E[5]=D;E[6]="false";E[7]=I;E[8]=-J;E[9]=-J;E[10]=0;H=Wtf.common.getJsonObjectForAccounting(A,E);O++;U+=H;var A=new Array("tablename","id","tid","accid","balance");var E=new Array("accounttransaction",K,G,P,-J);H=Wtf.common.getJsonObjectForAccounting(A,E);K++;U+=H;var A=new Array("tablename","id","tid","dateval","num","amount","amountdue","ctype","credittype");var E=new Array("credit",0,S,V,D,J,J,"creditmemo","Withdrawal");H=Wtf.common.getJsonObjectForAccounting(A,E);U+=H;U=Wtf.common.CreateJsonEnd(U);this.InsertStore=new Wtf.data.Store({method:"POST",url:"jspfiles/accounting/CreditMemo.jsp",baseParams:{flag:0,jsondata:U,programid:this.programid},reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"result",type:"string"},{name:"ErrorMsg",type:"string"}]})});this.InsertStore.on("load",function(Z,b,Y){this.loadMask.hide();if(b[0].data["result"]=="Success"){var a="";var X="";if(this.status=="Waiting for deferment approval from bursar"){a="Your request for deferment approved";X="4"}else{a="Your request for withdrawal approved";X="18"}Wtf.Msg.alert("Status","Credit note has been generated successfully");if(this.moduleid){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.customerId,moduleid:this.moduleid,sessionid:this.sessionid,classtypeid:this.classtypeid,type:this.type,operation:"approvewithdrawal",msg:a,status:X},method:"POST"},this,function(d,c){this.fireEvent("closeform",this.id);this.close()},function(d,c){})}else{this.fireEvent("closeform",this.id);this.close()}}else{Wtf.Msg.alert("Transaction Failure",b[0].get("ErrorMsg"));this.close()}},this);this.InsertStore.on("loadexception",function(){Wtf.Msg.alert("Error","Error occurred while connecting to server")});this.InsertStore.load()}});Wtf.IssueRefund=function(A){Wtf.apply(this,A);Wtf.IssueRefund.superclass.constructor.call(this,A)};Wtf.extend(Wtf.IssueRefund,Wtf.Window,{initComponent:function(A){customerId=null;refNo=null;customerName=null;creditAmount=null;receivableAccid=null;this.bankAccid=1;totalTid=null;moduleid=null;Wtf.IssueRefund.superclass.initComponent.call(this,A);this.addEvents({"closeform":true})},onRender:function(A){Wtf.IssueRefund.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask));this.storePacc=new Wtf.data.SimpleStore({fields:["abbr","title"],data:[["1","Cash"],["2","Cheque"]]});this.chargeStore=new Wtf.data.SimpleStore({fields:["id","name"],data:[["0","Flat Fee"],["1","% Fee"]]});this.add({border:false,layout:"border",items:[{region:"north",border:false,height:75,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:"<div style = 'width:100%;height:100%;position:relative;float:left;'><div style='float:left;height:100%;width:auto;position:relative;'><img src = 'images/createuser.gif' style = 'width:40px;height:52px;margin:5px 5px 5px 5px;'></img></div><div style='float:left;height:100%;width:60%;position:relative;'><div style='font-size:12px;font-style:bold;float:left;margin:15px 0px 0px 10px;width:100%;position:relative;'><b>Issue Refund</b></div><div style='font-size:10px;float:left;margin:15px 0px 10px 10px;width:100%;position:relative;'>Refund credit memo amount</div></div></div>"},{region:"center",autoScroll:true,bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,items:[{border:false,layout:"form",bodyStyle:"padding:13px 13px 13px 13px",labelWidth:100,items:[this.CustName=new Wtf.form.TextField({fieldLabel:"Customer Name*",anchor:"93%",allowBlank:false,id:"custname"+this.id,value:this.customerName,msgTarget:"side",readOnly:true}),this.RefAmt=new Wtf.form.TextField({fieldLabel:"Amount*",anchor:"93%",allowBlank:false,value:this.creditAmount,id:"refamt"+this.id,msgTarget:"side",readOnly:true}),this.amtcut=new Wtf.form.NumberField({fieldLabel:"Refund Amount",anchor:"93%",allowBlank:false,value:this.refundAmount,id:"amtcut"+this.id,msgTarget:"side"}),this.chargeCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.chargeStore,anchor:"93%",fieldLabel:"Charge Mode",mode:"local",readOnly:true,displayField:"name",hiddenName:"id",allowBlank:false,valueField:"id",emptyText:"Select Charge Mode"}),this.RefundAmt=new Wtf.form.NumberField({fieldLabel:"Actual Refund Amount*",anchor:"93%",allowBlank:false,id:"refundamt"+this.id,msgTarget:"side",decimalPrecision:2,readOnly:true}),this.dateTimePickerdate=new Wtf.form.DateField({fieldLabel:"Date*",format:"m/d/Y",anchor:"93%",id:"Date"+this.id,displayField:"Date",allowBlank:false,minValue:new Date()}),this.via=new Wtf.form.ComboBox({fieldLabel:"Refund via*",anchor:"93%",id:"via"+this.id,mode:"local",triggerAction:"all",typeAhead:true,editable:false,allowBlank:false,store:this.storePacc,displayField:"title",valueField:"abbr",value:this.storePacc.getAt(0).data["abbr"],msgTarget:"side"}),this.textBoxCNno=new Wtf.form.TextField({fieldLabel:"Ref No#",anchor:"93%",id:"creditNote"+this.id,allowBlank:true,disabled:true}),this.memo=new Wtf.form.TextArea({fieldLabel:"Memo",height:40,anchor:"93%",allowBlank:false,id:"memo"+this.id})]}]}],buttonAlign:"center",buttons:[{text:"Submit",handler:this.generateCreditNote,scope:this},{text:"Cancel",handler:function(){this.close()},scope:this}]});this.amtcut.on("blur",this.calRefamount,this);this.via.on("select",this.checkFun,this);this.chargeCombo.on("select",this.calRefamount,this);if(this.fullrefund=="true"){this.amtcut.enable();this.chargeCombo.enable();this.RefundAmt.value=this.creditAmount;this.RefundAmt.enable()}},calRefamount:function(){if(this.amtcut.getValue()!=""&&this.chargeCombo.getValue()!=null){var A=0;if(this.chargeCombo.getValue()=="0"){A=parseFloat(this.amtcut.getValue())}else{A=(parseFloat(this.RefAmt.getValue()))*(parseFloat(this.amtcut.getValue())/100)}this.RefundAmt.setValue(Wtf.precisionDecimalValue(A))}},checkFun:function(B,C,A){if(C.get("abbr")=="2"){this.textBoxCNno.allowBlank=false;this.textBoxCNno.setValue("");this.textBoxCNno.setDisabled(false)}else{this.textBoxCNno.allowBlank=true;this.textBoxCNno.setValue("");this.textBoxCNno.setDisabled(true)}},generateCreditNote:function(){this.RefAmt.validate();this.dateTimePickerdate.validate();this.via.validate();this.RefundAmt.validate();this.CustName.validate();if(this.via.getValue()!=1){this.textBoxCNno.validate();if(!this.textBoxCNno.isValid()){return }}if(!this.RefAmt.isValid()||!this.dateTimePickerdate.isValid()||!this.via.isValid()||!this.RefundAmt.isValid()||!this.CustName.isValid()){return }var A=1;this.UUIDStore=new Wtf.data.Store({url:"jspfiles/accounting/Accounts.jsp?flag=3&count="+A,reader:new Wtf.data.JsonReader({root:"data"},["id"])});this.UUIDStore.load();this.UUIDStore.on("load",this.submitcreditmemo,this)},submitcreditmemo:function(I,G,B){this.loadMask.show();var H=Wtf.common.CreateJsonStart();var L;var K=1;var O=0;var M=0;var J=G[0].data["id"];var E="3";var N=new Date(this.dateTimePickerdate.getValue());var D=N.format("Y-m-d H:i:s");var A="";if(this.via.getValue()==2){A=this.textBoxCNno.getValue()}var F=new Array("tablename","id","tid","ttypeid","dateval","num","total","customerid","amount","amountdue","salestaxid");var C=new Array("transaction1",O,J,13,D,this.refNo,true,this.customerId,-this.RefundAmt.getValue(),-this.RefundAmt.getValue(),0);L=Wtf.common.getJsonObjectForAccounting(F,C);O++;H+=L;var F=new Array("tablename","id","tid","accid","balance");var C=new Array();C[0]="accounttransaction";C[1]=M;C[2]=J;C[3]=this.bankAccid;C[4]=-this.creditAmount;L=Wtf.common.getJsonObjectForAccounting(F,C);M++;H+=L;var C=new Array("accounttransaction",M,J,E,-this.creditAmount);L=Wtf.common.getJsonObjectForAccounting(F,C);M++;H+=L;var F=new Array("tablename","id","tid","num","memo","chequeno","refundmode","amount");var C=new Array("refund",0,J,"",this.memo.getValue(),A,this.via.getValue(),this.creditAmount);L=Wtf.common.getJsonObjectForAccounting(F,C);H+=L;H=Wtf.common.CreateJsonEnd(H);this.InsertStore=new Wtf.data.Store({method:"POST",url:"jspfiles/accounting/CreditMemo.jsp",baseParams:{flag:0,jsondata:H,programid:this.programid},reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"result",type:"string"},{name:"ErrorMsg",type:"string"}]})});this.InsertStore.on("load",function(R,T,Q){this.loadMask.hide();if(T[0].data["result"]=="Success"){var S="";var P="";if(this.status=="Waiting for deferment approval from bursar"){S="Your request for deferment approved";P="4"}else{S="Your request for withdrawal approved";P="18"}Wtf.Msg.alert("Status","Amount refunded successfully");if(this.moduleid){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.customerId,moduleid:this.moduleid,sessionid:this.sessionid,classtypeid:this.classtypeid,type:this.type,operation:"approvewithdrawal",msg:S,status:P},method:"POST"},this,function(V,U){this.fireEvent("closeform",this.id);this.close()},function(V,U){})}else{this.fireEvent("closeform",this.id);this.close()}}else{Wtf.Msg.alert("Transaction Failure",T[0].get("ErrorMsg"));this.close()}},this);this.InsertStore.on("loadexception",function(){Wtf.Msg.alert("Error","Error occurred while connecting to server")});this.InsertStore.load()}});Wtf.NewGenInvoice=function(A){Wtf.apply(this,A);Wtf.NewGenInvoice.superclass.constructor.call(this,A)};Wtf.extend(Wtf.NewGenInvoice,Wtf.Window,{modal:true,initComponent:function(){customerId=null;type=null;feetypeid=null;moduleid=null;sessionid=null;incomeid=null;accountid=null;phdflag=null;balDue=0;totalTid=null;amountDue=0;creditHrs=null;Wtf.NewGenInvoice.superclass.initComponent.call(this);this.addEvents({"closeform":true})},onRender:function(A){Wtf.NewGenInvoice.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask));this.NewInv=Wtf.data.Record.create([{name:"code",type:"string"},{name:"descval",type:"string"},{name:"id",type:"string"},{name:"amount",type:"string"},{name:"rid",type:"string"}]);this.dsNewInv=new Wtf.data.Store({baseParams:{flag:1,num:""},url:"jspfiles/accounting/NewInvoice.jsp",reader:new Wtf.data.JsonReader({root:"data"},this.NewInv)});this.cmNewInv=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Code",hidden:true,dataIndex:"code"},{header:"Description",dataIndex:"descval"},{header:"Amount",dataIndex:"amount",width:50,renderer:function(B){return Wtf.precisionDecimalValue(B)}}]);this.newapplycredits=new Wtf.Panel({frame:true,border:false,layout:"fit",items:[{border:false,region:"center",layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createcommunity.png","Invoice","Generate Invoice")},{border:false,region:"center",bodyStyle:"background:#f1f1f1;font-size:10px;",layout:"border",items:[{region:"center",id:"center"+this.id,height:225,border:false,layout:"border",items:[{region:"center",id:"MGrid"+this.id,border:false,title:"Selected Modules",layout:"fit",items:this.AccGridModuleList=new Wtf.AccGridComp({id:"accGridMList"+this.id,selModel:new Wtf.grid.RowSelectionModel(),ds:this.dsNewInv,cm:this.cmNewInv})},{region:"south",id:"MFTot"+this.id,height:38,border:false,items:[this.totAmt=new Wtf.form.TextField({fieldLabel:"Original Amount",labelWidth:"35%",editable:false,anchor:"100%",id:"origAmt"+this.id,readOnly:true,value:isNaN(Wtf.precisionDecimalValue(this.amountDue))?0:Wtf.precisionDecimalValue(this.amountDue),cls:"floatrightdiv"})]}]},{region:"south",id:"south"+this.id,border:false}]}]}],bbar:[{id:"submit"+this.id,text:"Submit",iconCls:"tags",tooltip:{title:"Submit",text:"Click to Submit"},handler:this.SaveInvoice,scope:this},{text:"Cancel",iconCls:"tags",tooltip:{title:"Cancel",text:"Click to Cancel"},handler:function(){this.close()},scope:this}]});this.add(this.newapplycredits);this.populateGridInv()},populateGridInv:function(){var C=0;for(var B=0;B<this.store.getCount();B++){var A=new this.NewInv({code:this.store.getAt(B).get("code"),descval:this.store.getAt(B).get("name"),id:this.store.getAt(B).get("id"),amount:this.store.getAt(B).get("fee"),rid:this.store.getAt(B).get("rid")});this.dsNewInv.add(A)}},SaveInvoice:function(){this.loadMask.show();var A=2+this.dsNewInv.getCount()*3;this.UUIDStore=new Wtf.data.Store({url:"jspfiles/accounting/Accounts.jsp?flag=3&count="+A,reader:new Wtf.data.JsonReader({root:"data"},["id"])});this.UUIDStore.on("load",this.submitinvoice,this);this.UUIDStore.load()},submitinvoice:function(E,F,B){var D="{tableinfo:[";for(ii=0;ii<this.dsNewInv.getCount();ii++){var A=new Array();A[0]="amount";A[1]="itemid";var C=new Array();C[0]=new Number(this.dsNewInv.getAt(ii).data["amount"]).toFixed(2);C[1]=this.dsNewInv.getAt(ii).data["id"];jobj=Wtf.common.getJsonObjectForAccounting(A,C);D+=jobj}D=Wtf.common.CreateJsonEnd(D);this.InsertStore=new Wtf.data.Store({method:"POST",url:"jspfiles/accounting/NewInvoice.jsp",baseParams:{flag:0,jsondata:D},reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"result",type:"string"},{name:"ErrorMsg",type:"string"}]})});this.InsertStore.on("load",function(H,I,G){this.loadMask.hide();if(I[0].data["result"]=="Success"){Wtf.Msg.alert("Status","Invoice created successfully");if(this.feetypeid=="2"||this.feetypeid=="7"){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.customerId,moduleid:this.moduleid,type:"insertCreditHrForExempted",credithr:this.creditHrs},method:"POST"},this,function(K,J){},function(K,J){})}}else{Wtf.Msg.alert("Transaction Failure",I[0].get("ErrorMsg"))}this.fireEvent("closeform",this.id);this.close()},this);this.InsertStore.on("loadexception",function(){this.loadMask.hide();Wtf.Msg.alert("Error","Error occurred while connecting to server")},this);this.InsertStore.load({params:{flag:0,jsondata:D,moduleid:this.moduleid,userid:this.customerId,feetypeid:this.feetypeid,type:this.type,sessionid:this.sessionid,accountid:this.accountid,incomeid:this.incomeid}})}});Wtf.genCreditNote=function(A){Wtf.apply(this,A);Wtf.genCreditNote.superclass.constructor.call(this,A)};Wtf.extend(Wtf.genCreditNote,Wtf.Window,{initComponent:function(A){customerId=null;refNo=null;customerName=null;creditAmount=null;receivableAccid=null;this.bankAccid=1;creditId=null;totalTid=null;moduleid=null;Wtf.genCreditNote.superclass.initComponent.call(this,A);this.addEvents({"closeform":true})},show:function(A){Wtf.genCreditNote.superclass.show.call(this,A);Wtf.get("matricno"+this.id).dom.onkeyup=this.onKeyUp.createDelegate(this)},onRender:function(A){Wtf.genCreditNote.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask));this.programRecord=Wtf.data.Record.create([{name:"id",type:"string"},{name:"name",type:"string"}]);this.programReader=new Wtf.data.KwlJsonReader({root:"data"},this.programRecord);this.programStore=new Wtf.data.Store({reader:this.programReader});this.add({border:false,layout:"border",items:[{region:"north",border:false,height:75,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:"<div style = 'width:100%;height:100%;position:relative;float:left;'><div style='float:left;height:100%;width:auto;position:relative;'><img src = 'images/createuser.gif' style = 'width:40px;height:52px;margin:5px 5px 5px 5px;'></img></div><div style='float:left;height:100%;width:60%;position:relative;'><div style='font-size:12px;font-style:bold;float:left;margin:15px 0px 0px 10px;width:100%;position:relative;'><b>Credit Note</b></div><div style='font-size:10px;float:left;margin:15px 0px 10px 10px;width:100%;position:relative;'>Generate credit note</div></div></div>"},{region:"center",autoScroll:true,bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,items:[{border:false,layout:"form",xtype:"form",id:"creditFrm"+this.id,bodyStyle:"padding:13px 13px 13px 13px",labelWidth:70,items:[this.metricno=new Wtf.form.TextField({fieldLabel:"Matric No.*",anchor:"93%",allowBlank:false,id:"matricno"+this.id,name:"metricno",msgTarget:"side"}),this.CustName=new Wtf.form.TextField({fieldLabel:"Name*",anchor:"93%",name:"name",id:"custname"+this.id,msgTarget:"side",readOnly:true}),this.sponsor=new Wtf.form.TextField({fieldLabel:"Sponsor",anchor:"93%",name:"sponsor",id:"sponsor"+this.id,msgTarget:"side",readOnly:true}),this.programCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.programStore,anchor:"93%",fieldLabel:"Program",name:"pname",mode:"local",readOnly:true,displayField:"name",allowBlank:false,valueField:"id",emptyText:"Select program",listeners:{scope:this,select:function(D,B,C){this.pname.setValue(B.get("id"))}}}),this.RefundAmt=new Wtf.form.NumberField({fieldLabel:"Amount*",anchor:"93%",allowBlank:false,minValue:1,name:"amount",id:"refundamt"+this.id,decimalPrecision:2,msgTarget:"side"}),this.dateTimePickerdate=new Wtf.form.DateField({fieldLabel:"Date*",anchor:"93%",name:"appliedDate",id:"Date"+this.id,displayField:"Date",allowBlank:false}),this.memo=new Wtf.form.TextArea({fieldLabel:"Memo",height:40,name:"memo",anchor:"93%",allowBlank:true,id:"memo"+this.id}),this.reason=new Wtf.form.TextArea({fieldLabel:"Reason",height:40,name:"reason",anchor:"93%",allowBlank:false,id:"reason"+this.id}),this.pname=new Wtf.form.TextField({fieldLabel:"",name:"programid",inputType:"hidden"}),this.userid=new Wtf.form.TextField({fieldLabel:"",name:"userid",inputType:"hidden"})]}]}],buttonAlign:"center",buttons:[{text:"Submit",handler:this.generateCreditNote,scope:this},{text:"Cancel",handler:function(){this.close()},scope:this}]})},onKeyUp:function(e){if(this.metricno.getValue().length==7){Wtf.Ajax.requestEx({url:"jspfiles/admin/acastructure.jsp",params:{matricno:this.metricno.getValue(),type:101},method:"POST"},this,function(resp,req){this.CustName.setValue("");this.customerId=="";this.programStore.removeAll();this.programCombo.setValue("");this.sponsor.setValue("");var respobj=eval("("+resp+")");var arrobj=[];if(respobj.data!=null){for(var ctr=0;ctr<respobj.data.length;ctr++){this.CustName.setValue(respobj.data[ctr].name);this.sponsor.setValue(respobj.data[ctr].code);this.customerId=respobj.data[ctr].id;this.userid.setValue(this.customerId);var arrelement=new this.programRecord({id:respobj.data[ctr].programid,name:respobj.data[ctr].programname});arrobj.push(arrelement)}this.programStore.add(arrobj)}},function(resp,req){})}},generateCreditNote:function(){this.dateTimePickerdate.validate();this.RefundAmt.validate();this.CustName.validate();if(!this.dateTimePickerdate.isValid()||!this.RefundAmt.isValid()||!this.CustName.isValid()){return }var A=Wtf.getCmp("creditFrm"+this.id).form;if(A.isValid()){A.submit({url:"jspfiles/admin/acastructure.jsp",params:{type:111},scope:this,clientValidation:true,waitMsg:"Submitting..",success:function(C,B){msgBoxShow(["Credit Note","Credit Note generated successfully."],Wtf.MessageBox.INFO);this.fireEvent("closeform",this.id);this.close()},failure:function(C,B){msgBoxShow(["Credit Note","Error in connecting to server.Please try again later."],Wtf.MessageBox.ERROR)}})}},submitcreditmemo:function(N,L,C){this.loadMask.show();var U=Wtf.common.CreateJsonStart();var H;var R=1;var O=0;var K=0;var W=0;var S=L[0].data["id"];this.totalTid=S;var M=0;var T=new Date(this.dateTimePickerdate.getValue());var V=T.format("Y-m-d H:i:s");var Q=this.receivableAccid;var P="3";var D=this.refNo;var I=this.customerId;M=this.RefundAmt.getValue();var B=0;var J=new Number(M);var A=new Array("tablename","id","tid","ttypeid","dateval","num","total","customerid","amount","amountdue","salestaxid");var E=new Array("transaction1",O,S,10,V,D,"true",I,-J,-J,0);H=Wtf.common.getJsonObjectForAccounting(A,E);O++;U+=H;var A=new Array("tablename","id","tid","accid","balance");var E=new Array("accounttransaction",K,S,Q,-J);H=Wtf.common.getJsonObjectForAccounting(A,E);K++;U+=H;var F=L[1].data["id"];var G=L[2].data["id"];var A=new Array("tablename","id","tid","creditmemoid","num","memo","amount","itemid","itemqty","price");var E=new Array("creditmemo",W,S,F,D,this.memo.getValue(),J,"",1,J);H=Wtf.common.getJsonObjectForAccounting(A,E);W++;U+=H;var A=new Array("tablename","id","tid","ttypeid","dateval","num","total","customerid","amount","amountdue","salestaxid");E=new Array();E[0]="transaction1";E[1]=O;E[2]=G;E[3]=10;E[4]=V;E[5]=D;E[6]="false";E[7]=I;E[8]=-J;E[9]=-J;E[10]=0;H=Wtf.common.getJsonObjectForAccounting(A,E);O++;U+=H;var A=new Array("tablename","id","tid","accid","balance");var E=new Array("accounttransaction",K,G,P,-J);H=Wtf.common.getJsonObjectForAccounting(A,E);K++;U+=H;var A=new Array("tablename","id","tid","dateval","num","amount","amountdue","ctype","credittype","manual");var E=new Array("credit",0,S,V,D,J,J,"creditmemo","Withdrawl",1);H=Wtf.common.getJsonObjectForAccounting(A,E);U+=H;U=Wtf.common.CreateJsonEnd(U);this.InsertStore=new Wtf.data.Store({method:"POST",url:"jspfiles/accounting/CreditMemo.jsp",baseParams:{flag:0,jsondata:U,programid:this.programCombo.getValue()},reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"result",type:"string"},{name:"ErrorMsg",type:"string"}]})});this.InsertStore.on("load",function(Y,Z,X){this.loadMask.hide();if(Z[0].data["result"]=="Success"){Wtf.Msg.alert("Status","Credit note has been generated successfully");this.close()}else{Wtf.Msg.alert("Transaction Failure",Z[0].get("ErrorMsg"));this.close()}},this);this.InsertStore.on("loadexception",function(){Wtf.Msg.alert("Error","Error occurred while connecting to server")});this.InsertStore.load()}});Wtf.grid.AccCheckboxSelectionModel=function(A){Wtf.apply(this,A);Wtf.grid.AccCheckboxSelectionModel.superclass.constructor.call(this,A);this.addEvents=({"getGridColNo":true})};Wtf.extend(Wtf.grid.AccCheckboxSelectionModel,Wtf.grid.RowSelectionModel,{header:'<div class="x-grid3-hd-checker">&#160;</div>',width:30,sortable:false,fixed:true,dataIndex:"",id:"AccChecker",gridCol:1,initEvents:function(){Wtf.grid.CheckboxSelectionModel.superclass.initEvents.call(this);this.grid.on("render",function(){var A=this.grid.getView();A.mainBody.on("mousedown",this.onMouseDown,this);Wtf.fly(A.innerHd).on("mousedown",this.onHdMouseDown,this)},this)},onMouseDown:function(C,B){this.fireEvent("getGridColNo");C.stopEvent();if(this.gridCol=="0"){var D=C.getTarget(".x-grid3-row");if(D){var A=D.rowIndex;if(this.isSelected(A)){this.deselectRow(A)}else{this.selectRow(A,true)}}}},onHdMouseDown:function(C,A){if(A.className=="x-grid3-hd-checker"){C.stopEvent();var B=Wtf.fly(A.parentNode);var D=B.hasClass("x-grid3-hd-checker-on");if(D){B.removeClass("x-grid3-hd-checker-on");this.clearSelections()}else{B.addClass("x-grid3-hd-checker-on");this.selectAll()}}},renderer:function(B,C,A){return'<div class="x-grid3-row-checker">&#160;</div>'}});Wtf.AccGridComp=function(A){Wtf.apply(this,A);Wtf.AccGridComp.superclass.constructor.call(this,{clicksToEdit:1,border:false,viewConfig:{forceFit:true,autoFill:true}});this.addEvents({"onAccGridEdit":true,"onChkboxClick":true,"onAccCelldblclick":true,"onimgdivclick":true});this.on("afteredit",this.AfterGridEdit,this);this.on("cellclick",this.OnCellClick,this);this.on("celldblclick",this.OnCellDblClick,this);this.getSelectionModel().on("getGridColNo",this.ReturnColumnNo,this)};Wtf.extend(Wtf.AccGridComp,Wtf.grid.EditorGridPanel,{arow:0,acol:0,AfterGridEdit:function(A){this.fireEvent("onAccGridEdit",A.row,A.originalValue,A.value,A.field,A.record)},OnCellClick:function(B,A,D,C){this.arow=A;this.acol=D;if(D==0){this.fireEvent("onChkboxClick",A)}if(C.target.className=="minus"||C.target.className=="plus"){this.fireEvent("onimgdivclick",A,C.target)}},OnCellDblClick:function(B,A,D,C){this.fireEvent("onAccCelldblclick",A)},ReturnColumnNo:function(){this.getSelectionModel().gridCol=this.acol}});Wtf.common.CreateJsonStart=function(){var A=1;return"{tableinfo:[{tablename:'company', id:'1', companyid:'"+A+"'},"},Wtf.common.CreateJsonEnd=function(A){A=A.substring(0,A.length-1)+"]}";return A},Wtf.common.getJsonObjectForAccounting=function(A,C){var B="{";for(i=0;i<A.length;i++){B+=A[i]+":'"+C[i]+"',"}B=B.substring(0,B.length-1)+"},";return B};Wtf.grid.MultiSelectionModel=function(A){Wtf.apply(this,A);this.selections=new Wtf.util.MixedCollection(false,function(B){return B.id});this.last=false;this.lastActive=false;this.selection=null;this.addEvents({"beforecellselect":true,"cellselect":true,"selectionchange":true,"beforerowselect":true,"rowselect":true,"rowdeselect":true,"multiplerowSelect":true});Wtf.grid.MultiSelectionModel.superclass.constructor.call(this)};Wtf.extend(Wtf.grid.MultiSelectionModel,Wtf.grid.AbstractSelectionModel,{singleSelect:false,initEvents:function(){if(!this.grid.enableDragDrop&&!this.grid.enableDrag){}else{this.grid.on("rowclick",function(B,D,C){if(C.button===0&&!C.shiftKey&&!C.ctrlKey){this.selectRow(D,false);B.view.focusRow(D)}},this)}this.rowNav=new Wtf.KeyNav(this.grid.getGridEl(),{"up":function(C){if(!C.shiftKey){this.selectPrevious(C.shiftKey)}else{if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive-1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B}}else{this.selectFirstRow()}}},"down":function(C){if(!C.shiftKey){this.selectNext(C.shiftKey)}else{if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive+1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B}}else{this.selectFirstRow()}}},scope:this});this.grid.on("cellmousedown",this.handleMouseDown,this);this.grid.getGridEl().on(Wtf.isIE?"keydown":"keypress",this.handleKeyDown,this);var A=this.grid.view;A.on("refresh",this.onViewChange,this);A.on("rowupdated",this.onRowUpdated,this);A.on("beforerowremoved",this.clearSelections,this);A.on("beforerowsinserted",this.clearSelections,this);if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this)}},beforeEdit:function(A){this.select(A.row,A.column,false,true,A.record)},onRowUpdated:function(A,B,C){if(this.selection&&this.selection.record==C){A.onCellSelect(B,this.selection.cell[1])}},onViewChange:function(){this.clearSelections(true)},getCount:function(){return this.selections.length},selectFirstRow:function(){this.selectRow(0)},selectLastRow:function(A){this.selectRow(this.grid.store.getCount()-1,A)},selectNext:function(A){if(this.hasNext()){this.selectRow(this.last+1,A);this.grid.getView().focusRow(this.last)}},selectPrevious:function(A){if(this.hasPrevious()){this.selectRow(this.last-1,A);this.grid.getView().focusRow(this.last)}},hasNext:function(){return this.last!==false&&(this.last+1)<this.grid.store.getCount()},hasPrevious:function(){return !!this.last},getSelections:function(){return[].concat(this.selections.items)},getSelected:function(){return this.selections.itemAt(0)},each:function(E,D){var C=this.getSelections();for(var B=0,A=C.length;B<A;B++){if(E.call(D||this,C[B],B)===false){return false}}return true},getSelectedCell:function(){return this.selection?this.selection.cell:null},deselectRow:function(B,A){if(this.locked){return }if(this.last==B){this.last=false}if(this.lastActive==B){this.lastActive=false}var C=this.grid.store.getAt(B);this.selections.remove(C);if(!A){this.grid.getView().onRowDeselect(B)}this.fireEvent("rowdeselect",this,B,C);this.fireEvent("selectionchange",this)},clearSelections:function(B){fast=false;if(this.locked){return }if(fast!==true){var C=this.grid.store;var A=this.selections;A.each(function(D){this.deselectRow(C.indexOfId(D.id),B)},this);A.clear()}else{this.selections.clear()}this.last=false;var A=this.selection;if(A){if(B!==true){this.grid.view.onCellDeselect(A.cell[0],A.cell[1])}this.selection=null;this.fireEvent("selectionchange",this,null)}},hasSelection:function(){return this.selection?true:false},isSelected:function(A){var B=typeof A=="number"?this.grid.store.getAt(A):A;return(B&&this.selections.key(B.id)?true:false)},isIdSelected:function(A){return(this.selections.key(A)?true:false)},handleMouseDown:function(E,G,A,F){if(F.button!==0||this.isLocked()){return }if(A==0){var B=this.grid.getView();if(F.shiftKey&&this.last!==false){var D=this.last;this.selectRange(D,G,F.ctrlKey);this.fireEvent("multiplerowSelect",D,G);this.last=D;B.focusRow(G)}else{var C=this.isSelected(G);if(F.ctrlKey&&C){this.deselectRow(G)}else{if(!C||this.getCount()>1){this.selectRow(G,F.ctrlKey||F.shiftKey);this.fireEvent("multiplerowSelect",D,G);B.focusRow(G)}}}}else{this.select(G,A)}},selectRange:function(B,A,D){if(this.locked){return }if(!D){this.clearSelections()}if(B<=A){for(var C=B;C<=A;C++){this.selectRow(C,true)}}else{for(var C=B;C>=A;C--){this.selectRow(C,true)}}},select:function(F,C,B,E,D){if(this.fireEvent("beforecellselect",this,F,C)!==false){this.clearSelections();D=D||this.grid.store.getAt(F);this.selection={record:D,cell:[F,C]};if(!B){var A=this.grid.getView();A.onCellSelect(F,C);if(E!==true){A.focusCell(F,C)}}this.fireEvent("cellselect",this,F,C);this.fireEvent("selectionchange",this,this.selection)}},isSelectable:function(C,B,A){return !A.isHidden(B)},handleKeyDown:function(F){if(!F.isNavKeyPress()){return }var E=this.grid,J=this.selection;if(!J){F.stopEvent();var I=E.walkCells(0,0,1,this.isSelectable,this);if(I){this.select(I[0],I[1])}return }var B=this;var H=function(M,K,L){return E.walkCells(M,K,L,B.isSelectable,B)};var C=F.getKey(),A=J.cell[0],G=J.cell[1];var D;switch(C){case F.TAB:if(F.shiftKey){D=H(A,G-1,-1);E.startEditing(A,G-1)}else{D=H(A,G+1,1);E.startEditing(A,G+1)}break;case F.DOWN:D=H(A+1,G,1);if((A+1)!=this.grid.store.getCount()){E.startEditing(A+1,G)}else{F.stopEvent()}this.selectFirstRow();break;case F.UP:D=H(A-1,G,-1);if((A)==0){F.stopEvent()}else{E.startEditing(A-1,G)}break;case F.RIGHT:D=H(A,G+1,1);E.startEditing(A,G+1);break;case F.LEFT:D=H(A,G-1,-1);E.startEditing(A,G-1);break;case F.ENTER:D=H(A+1,G,1);E.startEditing(A+1,G);if(E.isEditor&&!E.editing){F.stopEvent();return }break;default:}if(D){this.select(D[0],D[1]);F.stopEvent()}},onRowDeselect:function(A){this.removeRowClass(A,"x-grid3-row-selected")},acceptsNav:function(C,B,A){return !A.isHidden(B)&&A.isCellEditable(B,C)},onEditorKey:function(I,G){var K=this.selection;var B=this;var C=G.getKey(),D,E=this.grid,F=E.activeEditor,A=K.cell[0],H=K.cell[1];var J=function(N,L,M){return E.walkCells(N,L,M,B.isSelectable,B)};switch(C){case G.TAB:if(G.shiftKey){D=J(A,H-1,-1);E.startEditing(A,H-1)}else{D=J(A,H+1,1);E.startEditing(A,H+1)}break;case G.DOWN:D=J(A+1,H,1);if((A+1)!=this.grid.store.getCount()){E.startEditing(A+1,H)}else{G.stopEvent()}break;case G.UP:D=J(A-1,H,-1);if((A)==0){G.stopEvent()}else{E.startEditing(A-1,H)}break;case G.RIGHT:D=J(A,H+1,1);E.startEditing(A,H+1);break;case G.LEFT:D=J(A,H-1,-1);E.startEditing(A,H-1);break;case G.ESC:F.cancelEdit();E.startEditing(A,H);break;case G.ENTER:D=J(A+1,H,1);E.startEditing(A+1,H);break}},selectRow:function(B,D,A){if(this.locked||(B<0||B>=this.grid.store.getCount())){return }var C=this.grid.store.getAt(B);if(this.fireEvent("beforerowselect",this,B,D,C)!==false){if(!D||this.singleSelect){this.clearSelections()}this.selections.add(C);this.last=this.lastActive=B;if(!A){this.grid.getView().onRowSelect(B)}this.fireEvent("rowselect",this,B,C);this.fireEvent("selectionchange",this)}}});Wtf.CurrencyRateWin=function(A){Wtf.apply(this,A);Wtf.CurrencyRateWin.superclass.constructor.call(this,A)};Wtf.extend(Wtf.CurrencyRateWin,Wtf.Window,{initComponent:function(A){Wtf.CurrencyRateWin.superclass.initComponent.call(this,A);this.addEvents({"closeform":true})},onRender:function(A){Wtf.CurrencyRateWin.superclass.onRender.call(this,A);this.add({border:false,layout:"border",items:[{region:"north",border:false,height:75,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","Currency Rate","Set currency rate for particular period")},{region:"center",autoScroll:true,bodyStyle:"background:#f1f1f1;font-size:10px; padding:13px 13px 13px 13px;",border:false,layout:"form",labelWidth:100,items:[this.dateTimePicker=new Wtf.form.DateField({fieldLabel:"Date*",anchor:"93%",id:"DatDate"+this.id,format:Wtf.getDateFormat(),allowBlank:false,disabled:this.flag==0?false:true,value:this.flag==0?null:this.dateVal}),this.TxtAmnt=new Wtf.form.NumberField({fieldLabel:"Rate*",anchor:"93%",id:"TxtAmnt"+this.id,allowDecimals:true,decimalPrecision:4,allowBlank:false,value:this.flag==0?0:this.rate})]}],buttonAlign:"center",buttons:[{text:"Submit",handler:this.saveItem,scope:this},{text:"Cancel",handler:function(){this.close()},scope:this}]})},saveItem:function(){Wtf.Ajax.request({url:"jspfiles/faculty/getFacMod.jsp",method:"POST",params:{type:"currencyRateNew",date:(new Date(this.dateTimePicker.getValue())).format("Y-m-d H:i:s"),rate:this.TxtAmnt.getValue(),flag:this.flag},success:function(response,e){var v=eval("("+response.responseText.trim()+")");msgBoxShow(["Info",v.success],Wtf.MessageBox.INFO);this.fireEvent("closeform",this.id);this.close()},failure:function(response,e){msgBoxShow(["Set currency rate","Error while setting currency rate"],Wtf.MessageBox.INFO)},scope:this})}});Wtf.viewCredit=function(B){Wtf.apply(this,B);this.addEvents({"closeform":true});this.layout="fit",this.NewApp=Wtf.data.Record.create([{name:"ntid"},{name:"ndateval",type:"date",dateFormat:"Y-m-j H:i:s.0"},{name:"ncreditamt",type:"string"},{name:"ncnum",type:"string"},{name:"nctype",type:"string"},{name:"currency",type:"string"}]);this.dsNewApp=new Wtf.data.Store({baseParams:{flag:1,customerid:this.customerId,sponsorflag:this.sponsorFlag},url:"jspfiles/accounting/CreditMemo.jsp",reader:new Wtf.data.JsonReader({root:"data"},this.NewApp)});var A=new Wtf.grid.AccCheckboxSelectionModel({singleSelect:true});this.cmNewApp=new Wtf.grid.ColumnModel([A,{dataIndex:"ntid",hidden:true},{header:"Number",dataIndex:"ncnum",align:"right"},{header:"Date",dataIndex:"ndateval",sortable:false,renderer:function(C){if(Wtf.isEmpty(C)){return C}else{return C.format(Wtf.getDateFormat())}}},{header:"Credit Amount",dataIndex:"ncreditamt",align:"right",renderer:function(C){return Wtf.precisionDecimalValue(C)}},{header:"Currency",dataIndex:"currency"}]);this.AccGridAppCre=new Wtf.AccGridComp({id:"accGrid123"+this.id,columnWidth:1,selModel:A,ds:this.dsNewApp,cm:this.cmNewApp});this.items=this.AccGridAppCre;this.bbar=[{text:"Submit",tooltip:{title:"Submit",text:"Click to Submit"},scope:this,handler:function(){if(this.AccGridAppCre.getSelectionModel().selections.length>0){var C=Wtf.precisionDecimalValue(this.AccGridAppCre.getSelectionModel().getSelections()[0].data["ncreditamt"]);var F=this.AccGridAppCre.getSelectionModel().getSelections()[0].data["ncnum"];var D=this.AccGridAppCre.getSelectionModel().getSelections()[0].data["ntid"];var E=this.AccGridAppCre.getSelectionModel().getSelections()[0].data["currency"];this.fireEvent("closeform",C,F,D,E)}this.close()}},{text:"Cancel",tooltip:{title:"Cancel",text:"Click to Cancel"},handler:function(){this.close()},scope:this}];Wtf.viewCredit.superclass.constructor.call(this,B)};Wtf.extend(Wtf.viewCredit,Wtf.Window,{onRender:function(A){Wtf.viewCredit.superclass.onRender.call(this,A);this.dsNewApp.load()}});Wtf.LedgerMapping=function(A){Wtf.apply(this,A);this.recarr=[];Wtf.LedgerMapping.superclass.constructor.call(this,A)};Wtf.extend(Wtf.LedgerMapping,Wtf.Window,{initComponent:function(A){Wtf.LedgerMapping.superclass.initComponent.call(this,A);this.addEvents({"closeform":true})},onRender:function(A){Wtf.LedgerMapping.superclass.onRender.call(this,A);this.ledgerReader=new Wtf.data.Record.create([{name:"ledgername"},{name:"ledgerid"}]);this.ledgerds=new Wtf.data.Store({url:"jspfiles/accounting/Accounts.jsp",reader:new Wtf.data.JsonReader({root:"data"},this.ledgerReader)});this.ledgerCombo=new Wtf.form.ComboBox({fieldLabel:"Ledger Name",valueField:"ledgerid",displayField:"ledgername",id:this.id+"ledger",store:this.ledgerds,editable:true,typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true});this.ledgerds.load({params:{flag:"20"}});this.ledgerCombo.on("select",this.getLedgerMap,this);this.ledgerCombo.on("change",this.ledgerComboFocus,this);this.NewPay=Wtf.data.Record.create([{name:"accid",type:"string"},{name:"name",type:"string"},{name:"typename",type:"string"}]);this.dsNewPay=new Wtf.data.Store({baseParams:{flag:21,companyid:1},url:"jspfiles/accounting/Accounts.jsp",reader:new Wtf.data.JsonReader({root:"data"},this.NewPay)});this.dsNewPay.load();this.seModel=new Wtf.grid.CheckboxSelectionModel({width:25});this.cmNewPay=new Wtf.grid.ColumnModel([this.seModel,{dataIndex:"accid",hidden:true},{header:"Account Name",dataIndex:"name"},{header:"Account Type",dataIndex:"typename"}]);this.cmNewPay.defaultSortable=true;this.add({border:false,layout:"border",items:[{region:"north",border:false,height:75,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","Ledger Account","Create and map ledger with existing accounts")},{region:"center",autoScroll:true,bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,layout:"border",items:[{region:"north",id:"north"+this.id,border:false,height:95,bodyStyle:"padding:13px 13px 13px 13px",layout:"form",labelWidth:100,items:[this.ledgerCombo,this.description=new Wtf.form.TextArea({fieldLabel:"Description*",anchor:"93%",allowBlank:false,id:"desc"+this.id,msgTarget:"side",height:43})]},{region:"center",id:"center"+this.id,border:false,layout:"fit",items:this.AccGridNpay=new Wtf.grid.GridPanel({id:"accGrid"+this.id,columnWidth:1,layout:"column",sm:this.seModel,ds:this.dsNewPay,cm:this.cmNewPay,viewConfig:{forceFit:true}})}]}],buttonAlign:"center",buttons:[{text:"Submit",handler:this.saveItem,scope:this},{text:"Cancel",handler:function(){this.close()},scope:this}]})},ledgerComboFocus:function(){this.seModel.clearSelections()},getLedgerMap:function(combo,record,index){Wtf.Ajax.request({method:"POST",url:"jspfiles/accounting/Accounts.jsp",params:{flag:"19",ledgerid:this.ledgerCombo.getValue()},scope:this,success:function(response,option){this.seModel.clearSelections();if(this.recarr.length>0){for(var i=0;i<this.recarr.length;i++){this.dsNewPay.remove(this.recarr[i])}this.recarr=[]}var res=eval("("+response.responseText+")");if(res.data){for(var i=0;i<res.data.length;i++){var newPayRec=new this.NewPay({accid:res.data[i].accid,name:res.data[i].name,typename:res.data[i].typename});this.recarr.push(newPayRec)}this.dsNewPay.insert(0,this.recarr);this.seModel.selectRecords(this.recarr)}}})},saveItem:function(){var selectedRecord=this.AccGridNpay.getSelectionModel().getSelections();var accid="";for(var ctr=0;ctr<selectedRecord.length;ctr++){accid+=selectedRecord[ctr].data["accid"];if(ctr!=selectedRecord.length-1){accid+=","}}if(this.ledgerCombo.getValue()!=""){flagval=22,ledgernameval=this.ledgerCombo.getValue()}else{flagval=17,ledgernameval=this.ledgerCombo.el.dom.value}Wtf.Ajax.request({url:"jspfiles/accounting/Accounts.jsp",params:{flag:flagval,ledgername:ledgernameval,description:this.description.getValue(),accid:accid},method:"POST",scope:this,success:function(response,option){var res=eval("("+response.responseText+")");if(res.data[0].result=="Success"){msgBoxShow(["Ledger Status","Ledger created successfully"],Wtf.MessageBox.INFO)}else{msgBoxShow(["Ledger Status","Error while creating ledger"],Wtf.MessageBox.INFO)}this.close()},failure:function(){msgBoxShow(["Ledger Status","Error while creating ledger"],Wtf.MessageBox.INFO);this.close()}})}});Wtf.NewPayment1=function(A){Wtf.apply(this,A);this.edited=new Array();detailFlag=null;customerId=null;accountId=null;InvoiceNum=null;sponsorCode=null;this.islocal=this.islocal==null?-1:this.islocal;this.curchkflag=this.curchkflg==null?0:this.curchkflag;this.NewPay=Wtf.data.Record.create([{name:"npayistid",type:"string"},{name:"npaydate",type:"date",dateFormat:"Y-m-j H:i:s.0"},{name:"npaynumb",type:"string"},{name:"npayoamt",type:"string"},{name:"npayadue",type:"string"},{name:"npaypymt",type:"string"},{name:"npayid",type:"string"},{name:"npaycust",type:"string"},{name:"npaymaindate",type:"string"},{name:"npaytotal",type:"string"},{name:"npaynote",type:"string"},{name:"npaybal",type:"string"},{name:"npayacct",type:"string"},{name:"amountdue",type:"string"}]);this.dsNewPay=new Wtf.data.Store({baseParams:{flag:1,receivedid:this.customerId,acctype:this.accountId,invoicenum:this.invoiceNum},url:"jspfiles/accounting/ReceivePayment.jsp",reader:new Wtf.data.JsonReader({root:"data"},this.NewPay)});this.seModel=new Wtf.grid.AccCheckboxSelectionModel();this.cmNewPay=new Wtf.grid.ColumnModel([this.seModel,{dataIndex:"npayistid",hidden:true},{header:"Date",dataIndex:"npaydate",sortable:false,renderer:function(B){if(Wtf.isEmpty(B)){return B}else{return B.format(Wtf.getDateFormat())}}},{header:"Number",dataIndex:"npaynumb"},{header:"Original Amount",dataIndex:"npayoamt",align:"right",renderer:function(B){return Wtf.precisionDecimalValue(B)}},{header:"Amt. Due",dataIndex:"npayadue",align:"right",renderer:function(B){return Wtf.precisionDecimalValue(B)}},{header:"Payment",dataIndex:"npaypymt",align:"right"}]);this.TxtAmnt=new Wtf.form.NumberField({fieldLabel:"Amount*",anchor:"94%",id:"TxtAmnt"+this.id,validator:this.ValidateAmount,allowDecimals:true,decimalPrecision:2,allowBlank:false});this.dateTimePicker=new Wtf.form.DateField({fieldLabel:"Date*",anchor:"94%",id:"DatDate"+this.id,format:Wtf.getDateFormat(),allowBlank:false});this.dateTimePicker.setValue(new Date());this.TxtBalance=new Wtf.form.TextField({fieldLabel:"Customer Balance",anchor:"94%",readOnly:true,id:"TxtCbal"+this.id});this.textBoxMemo=new Wtf.form.TextField({fieldLabel:"Note",anchor:"94%",id:"TxtNote"+this.id});this.textBoxCNno=new Wtf.form.TextField({fieldLabel:"Ref No#",anchor:"94%",id:"creditNote"+this.id,allowBlank:true,disabled:true});this.textBoxCNno.setValue("");this.NP_store=new Wtf.data.SimpleStore({fields:["id","name"],data:[["1","Cash"],["2","Cheque"],["5","Credit Card"],["4","Credit Note"],["7","Other"]]});this.viewCredit=new Wtf.Button({text:"View Credits",id:"viewCredit"+this.id,disabled:true,handler:this.viewCredits,tooltip:{title:"View Credits",text:"Click to view all your credits"},scope:this});this.ComboPymt=new Wtf.form.ComboBox({fieldLabel:"Payment Method",anchor:"94%",id:"CmbPymt"+this.id,mode:"local",triggerAction:"all",typeAhead:true,editable:false,store:this.NP_store,displayField:"name",valueField:"id"}),this.ComboPymt.on("select",this.checkFun,this);this.NewCust=new Wtf.data.Record.create([{name:"name",type:"string"},{name:"id",type:"string"}]);this.storeCust=new Wtf.data.Store({url:"jspfiles/accounting/ReceivePayment.jsp?flag=4&sponsorcode="+this.sponsorCode,reader:new Wtf.data.JsonReader({root:"data"},this.NewCust)});this.ComboFrom=new Wtf.form.ComboBox({fieldLabel:"Received From*",anchor:"94%",id:"CmbFrom"+this.id,mode:"remote",triggerAction:"all",typeAhead:true,editable:false,store:this.storeCust,displayField:"name",valueField:"id",allowBlank:false,hideLabel:this.sponsorCode==""?true:false,hidden:this.sponsorCode==""?true:false});this.border=false;this.layout="border";this.items=[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createcommunity.png","Payment","Track your payments")},{region:"center",border:false,bodyStyle:"background:#f1f1f1;font-size:10px;",layout:"border",items:[{region:"north",id:"north"+this.id,border:false,height:125,columnWidth:1,layout:"column",items:[{columnWidth:0.5,layout:"form",bodyStyle:"padding:13px 13px 0px 13px",border:false,labelWidth:84,items:[this.dateTimePicker,this.TxtAmnt,this.ComboFrom]},{columnWidth:0.5,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",labelWidth:101,items:[this.ComboPymt,this.viewCredit,this.TxtBalance,this.textBoxCNno]}]},{region:"center",id:"center"+this.id,border:false,layout:"fit",bodyStyle:"padding:13px 13px 13px 13px",items:this.AccGridNpay=new Wtf.AccGridComp({id:"accGrid"+this.id,columnWidth:1,layout:"column",selModel:this.seModel,ds:this.dsNewPay,cm:this.cmNewPay})}]}];this.bbar=[{text:"Submit",tooltip:{title:"Submit",text:"Click to Submit"},handler:this.SaveItem,scope:this},{text:"Cancel",tooltip:{title:"Cancel",text:"Click to Cancel"},handler:function(){this.close()},scope:this}];this.AccGridNpay.on("onAccGridEdit",this.AccGridEdit,this);this.AccGridNpay.on("onChkboxClick",this.UncheckRow,this);this.dsNewPay.on("load",this.onDataLoad,this);this.TxtAmnt.on("change",this.AdjustAmount,this);Wtf.NewPayment1.superclass.constructor.call(this,A)};Wtf.extend(Wtf.NewPayment1,Wtf.Window,{contentTitle:null,contentTitle1:null,textBoxWidth:225,remaining:0,initComponent:function(){Wtf.NewPayment1.superclass.initComponent.call(this);this.addEvents({"closeform":true})},onRender:function(B,A){this.ComboPymt.setValue(this.NP_store.getAt(0).data["id"]);Wtf.NewPayment1.superclass.onRender.call(this,B,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask));this.LoadGrid()},viewCredits:function(){this.viewCreditsWin=new Wtf.viewCredit({customerId:this.customerId,sponsorFlag:this.sponsorcode==""?0:1,width:350,height:300});this.viewCreditsWin.show();this.viewCreditsWin.on("closeform",function(B,E,A,D){this.textBoxCNno.setValue(E);var C=this.cmNewPay.getColumnHeader(4).substring(this.cmNewPay.getColumnHeader(4).indexOf("(")+1,this.cmNewPay.getColumnHeader(4).indexOf(")"));if(D=="USD"&&C=="RM"){this.TxtAmnt.setValue(parseFloat(B*this.convrate).toFixed(2))}else{if(D=="RM"&&C=="USD"){this.TxtAmnt.setValue(parseFloat(B/this.convrate).toFixed(2))}else{this.TxtAmnt.setValue(Wtf.precisionDecimalValue(B))}}this.creditTid=A},this)},checkFun:function(D,G,E){if(this.previndex!=E){if(G.get("id")=="5"||G.get("id")=="7"){this.textBoxCNno.allowBlank=false;this.textBoxCNno.setValue("");this.textBoxCNno.setDisabled(false);this.viewCredit.setDisabled(true);this.ComboFrom.enable();var I=this.cmNewPay.getColumnHeader(4).substring(this.cmNewPay.getColumnHeader(4).indexOf("(")+1,this.cmNewPay.getColumnHeader(4).indexOf(")"));var C=this.cmNewPay.getColumnHeader(4).substring(0,this.cmNewPay.getColumnHeader(4).indexOf("("));var B=this.cmNewPay.getColumnHeader(5).substring(0,this.cmNewPay.getColumnHeader(5).indexOf("("));var A=this.cmNewPay.getColumnHeader(6).substring(0,this.cmNewPay.getColumnHeader(6).indexOf("("));this.cmNewPay.setColumnHeader(4,C+"("+this.altcurrency+")");this.cmNewPay.setColumnHeader(5,B+"("+this.altcurrency+")");this.cmNewPay.setColumnHeader(6,A+"("+this.altcurrency+")");if(I=="USD"){if(this.currency!=this.altcurrency){for(var F=0;F<this.dsNewPay.getCount();F++){this.dsNewPay.getAt(F).set("npayoamt",(this.dsNewPay.getAt(F).get("npayoamt")*this.convrate).toFixed(2));this.dsNewPay.getAt(F).set("npayadue",(this.dsNewPay.getAt(F).get("npayadue")*this.convrate).toFixed(2))}this.TxtBalance.setValue((this.TxtBalance.getValue()*this.convrate).toFixed(2))}}this.ComboPymt.setValue(this.NP_store.getAt(E).data["id"])}else{if(G.get("id")=="2"){this.textBoxCNno.allowBlank=false;this.textBoxCNno.setValue("");this.textBoxCNno.setDisabled(false);this.ComboFrom.enable();this.viewCredit.setDisabled(true);this.textBoxCNno.readOnly=false}else{if(G.get("id")=="4"){var H=this.cmNewPay.getColumnHeader(4).substring(this.cmNewPay.getColumnHeader(4).indexOf("(")+1,this.cmNewPay.getColumnHeader(4).indexOf(")"));if(H!=this.currency){var C=this.cmNewPay.getColumnHeader(4).substring(0,this.cmNewPay.getColumnHeader(4).indexOf("("));var B=this.cmNewPay.getColumnHeader(5).substring(0,this.cmNewPay.getColumnHeader(5).indexOf("("));var A=this.cmNewPay.getColumnHeader(6).substring(0,this.cmNewPay.getColumnHeader(6).indexOf("("));this.cmNewPay.setColumnHeader(4,C+"("+this.currency+")");this.cmNewPay.setColumnHeader(5,B+"("+this.currency+")");this.cmNewPay.setColumnHeader(6,A+"("+this.currency+")");if(this.currency!=this.altcurrency){for(var F=0;F<this.dsNewPay.getCount();F++){this.dsNewPay.getAt(F).set("npayoamt",(this.dsNewPay.getAt(F).get("npayoamt")/this.convrate).toFixed(2));this.dsNewPay.getAt(F).set("npayadue",(this.dsNewPay.getAt(F).get("npayadue")/this.convrate).toFixed(2))}this.TxtBalance.setValue((this.TxtBalance.getValue()/this.convrate).toFixed(2))}}this.textBoxCNno.setDisabled(false);this.TxtAmnt.setValue(null);this.ComboFrom.disable();this.viewCredit.setDisabled(false);this.textBoxCNno.disable();this.textBoxCNno.setValue("")}else{this.textBoxCNno.readOnly=false;this.viewCredit.setDisabled(true);this.textBoxCNno.allowBlank=true;this.textBoxCNno.setValue("");this.ComboFrom.enable();this.textBoxCNno.setDisabled(true)}}this.TxtAmnt.setDisabled(false);var I=this.cmNewPay.getColumnHeader(4).substring(this.cmNewPay.getColumnHeader(4).indexOf("(")+1,this.cmNewPay.getColumnHeader(4).indexOf(")"));var C=this.cmNewPay.getColumnHeader(4).substring(0,this.cmNewPay.getColumnHeader(4).indexOf("("));var B=this.cmNewPay.getColumnHeader(5).substring(0,this.cmNewPay.getColumnHeader(5).indexOf("("));var A=this.cmNewPay.getColumnHeader(6).substring(0,this.cmNewPay.getColumnHeader(6).indexOf("("));this.cmNewPay.setColumnHeader(4,C+"("+this.currency+")");this.cmNewPay.setColumnHeader(5,B+"("+this.currency+")");this.cmNewPay.setColumnHeader(6,A+"("+this.currency+")");if(I=="RM"){if(this.currency!=this.altcurrency){for(var F=0;F<this.dsNewPay.getCount();F++){this.dsNewPay.getAt(F).set("npayoamt",(this.dsNewPay.getAt(F).get("npayoamt")/this.convrate).toFixed(2));this.dsNewPay.getAt(F).set("npayadue",(this.dsNewPay.getAt(F).get("npayadue")/this.convrate).toFixed(2))}this.TxtBalance.setValue((this.TxtBalance.getValue()/this.convrate).toFixed(2))}}this.ComboPymt.setValue(this.NP_store.getAt(E).data["id"])}this.previndex=E}},AccGridEdit:function(A,C,B,D,E){if(C!=""&&(B==""||B=="0")){this.edited[A]=0}else{this.edited[A]=1}},LoadGrid:function(){this.dsNewPay.baseParams={flag:0,receivedid:this.customerId,acctype:this.accountId,invoicenum:this.invoiceNum,admin:true};this.dsNewPay.load()},AdjustAmount:function(){this.remaining=this.TxtAmnt.getValue();this.AdjustPayment()},AdjustPayment:function(){if(this.AccGridNpay.getSelectionModel().hasSelection()){var F=this.AccGridNpay.getSelectionModel().getSelections();var D=new Array();var B=0;for(var C=0;C<F.length;C++){var E=F[C];if(this.edited[this.dsNewPay.find("npayistid",E.data["npayistid"])]==1){if(this.remaining>=parseFloat(E.data["npaypymt"])){E.set("npaypymt",E.data["npaypymt"]);this.remaining-=E.data["npaypymt"]}else{if(this.remaining!="0"){E.set("npaypymt",this.remaining);this.remaining=0}else{E.set("npaypymt","0")}}}else{D[B++]=F[C]}}for(var A=0;A<D.length;A++){var E=D[A];if(this.remaining>=parseFloat(E.data["npayadue"])){E.set("npaypymt",E.data["npayadue"]);this.remaining-=E.data["npayadue"]}else{if(this.remaining!="0"){E.set("npaypymt",this.remaining);this.remaining=0}else{E.set("npaypymt","0")}}}}},UncheckRow:function(A){if(this.TxtAmnt.getValue()!=""){this.remaining=this.TxtAmnt.getValue();var B=this.dsNewPay.getAt(A);B.set("npaypymt","0");this.edited[A]=0;this.AdjustPayment()}},onDataLoad:function(B,D){if(B.getCount()>0){this.currency=B.getAt(0).store.reader.jsonData.currency;this.altcurrency=B.getAt(0).store.reader.jsonData.altcurrency;this.convrate=B.getAt(0).store.reader.jsonData.rate;this.cmNewPay.setColumnHeader(4,this.cmNewPay.getColumnHeader(4)+"("+B.getAt(0).store.reader.jsonData.currency+")");this.cmNewPay.setColumnHeader(5,this.cmNewPay.getColumnHeader(5)+"("+B.getAt(0).store.reader.jsonData.currency+")");this.cmNewPay.setColumnHeader(6,this.cmNewPay.getColumnHeader(6)+"("+B.getAt(0).store.reader.jsonData.currency+")")}var A=0;for(var C=0;C<B.getCount();C++){this.edited[C]=0;D[C].set("npaypymt","0");A+=new Number(D[C].data["npayadue"])}this.TxtBalance.setValue(A.toFixed(2))},SaveItem:function(){if(this.AccGridNpay.getSelections().length>0){this.TxtAmnt.validate();this.dateTimePicker.validate();if(this.sponsorCode!=""){this.ComboFrom.validate();if(!this.ComboFrom.isValid()){return }}if(this.ComboPymt.getValue()!=1){this.textBoxCNno.validate();if(!this.textBoxCNno.isValid()){return }}if(!this.TxtAmnt.isValid()||!this.dateTimePicker.isValid()){return }dsarray=this.AccGridNpay.getSelections();var A=0;for(ii=0;ii<dsarray.length;ii++){A+=parseFloat(dsarray[ii].data["npaypymt"]);if(parseFloat(dsarray[ii].data["npaypymt"])==0){msgBoxShow(["Error","Amount applied to selected invoice is 0"],Wtf.MessageBox.ERROR);return }}if(A<=0){msgBoxShow(["Error","Amount applied to invoice is 0"],Wtf.MessageBox.ERROR)}else{this.loadMask.show();this.receivedPayment()}}else{msgBoxShow(["Error","Select at least one invoice to pay"],Wtf.MessageBox.ERROR)}},receivedPayment:function(){var I=new Date(this.dateTimePicker.getValue()).format("Y-m-d H:i:s");var F=0;var C="";var A="";if(this.ComboPymt.getValue()==2||this.ComboPymt.getValue()==5||this.ComboPymt.getValue()==7||this.ComboPymt.getValue()==4){A=this.textBoxCNno.getValue()}dsarray=this.AccGridNpay.getSelections();if(dsarray.length>0){C=dsarray[0].data.npayistid;F=this.ComboPymt.getValue()}var G=this.TxtAmnt.getValue();var H=this.textBoxMemo.getValue();if(this.sponsorCode!=""){this.customerId=this.ComboFrom.getValue()}dsarray=this.AccGridNpay.getSelections();var E="{tableinfo:[";for(ii=0;ii<dsarray.length;ii++){var D=new Array();D[0]="amount";D[1]="istid";D[2]="Paid";D[3]="invamtdue";D[4]="disamount";var B=new Array();B[0]=dsarray[ii].data["npaypymt"];B[1]=dsarray[ii].data["npayistid"];B[2]="false";B[3]=dsarray[ii].data["npayadue"];if(parseFloat(dsarray[ii].data["npayadue"])<=parseFloat(dsarray[ii].data["npaypymt"])){B[4]=dsarray[ii].data["discount"]}else{B[4]=0}jobj=Wtf.common.getJsonObjectForAccounting(D,B);E+=jobj}E=Wtf.common.CreateJsonEnd(E);this.InsertStore=new Wtf.data.Store({method:"POST",url:"jspfiles/accounting/ReceivePayment.jsp",reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"result",type:"string"},{name:"ErrorMsg",type:"string"}]})});this.InsertStore.on("beforeload",function(J){Wtf.Ajax.timeout=400000},this);this.InsertStore.on("load",function(M,N,L){this.loadMask.hide();if(N[0].data["result"]=="Success"){Wtf.Msg.alert("Status","Payment done successfully");var J=this.AccGridNpay.getSelections();var K=false;if(J.length>0){if(J[0].get("npayadue")==J[0].get("npaypymt")){K=true}}this.fireEvent("closeform",this.id,this.TxtAmnt.getValue(),K);this.close()}else{Wtf.Msg.alert("Transaction Failure",N[0].get("ErrorMsg"))}Wtf.Ajax.timeout=30000;this.close()},this);this.InsertStore.on("loadexception",function(){this.loadMask.hide();Wtf.Msg.alert("Error","An error occurred while connecting to server");Wtf.Ajax.timeout=30000;this.close()},this);this.InsertStore.load({params:{flag:1,jsondata:E,userid:this.customerId,accid:this.accountId,date:I,paymode:F,istid:C,amount:G,memo:H,custchk:false,islocal:this.islocal,creditid:this.creditTid,curchkflag:this.curchkflag,chequeno:A}})},ValidateAmount:function(){if(this.getValue()<=0){this.invalidText="Enter a valid decimal greater than 0";return false}else{return true}}});Wtf.NewPayment2=function(A){Wtf.apply(this,A);this.edited=new Array();detailFlag=null;customerId=null;sponsorFlag=0;accountId=null;InvoiceNum=null;this.creditTid="";this.islocal=this.islocal==null?-1:this.islocal;this.curchkflag=this.curchkflg==null?0:this.curchkflag;this.NewPay=Wtf.data.Record.create([{name:"npayistid",type:"string"},{name:"npaydate",type:"date",dateFormat:"Y-m-j H:i:s.0"},{name:"npaynumb",type:"string"},{name:"npayoamt",type:"string"},{name:"npayadue",type:"string"},{name:"npaypymt",type:"string"},{name:"npayid",type:"string"},{name:"npaycust",type:"string"},{name:"npaymaindate",type:"string"},{name:"npaytotal",type:"string"},{name:"npaynote",type:"string"},{name:"npaybal",type:"string"},{name:"npayacct",type:"string"},{name:"amountdue",type:"string"}]);this.dsNewPay=new Wtf.data.Store({baseParams:{flag:1,receivedid:this.customerId,acctype:this.accountId,invoicenum:this.invoiceNum},url:"jspfiles/accounting/ReceivePayment.jsp",reader:new Wtf.data.JsonReader({root:"data"},this.NewPay)});this.seModel=new Wtf.grid.AccCheckboxSelectionModel();this.cmNewPay=new Wtf.grid.ColumnModel([this.seModel,{dataIndex:"npayistid",hidden:true},{header:"Date",dataIndex:"npaydate",sortable:false,renderer:function(B){if(Wtf.isEmpty(B)){return B}else{return B.format(Wtf.getDateFormat())}}},{header:"Number",dataIndex:"npaynumb"},{header:"Original Amount",dataIndex:"npayoamt",align:"right",renderer:function(B){return Wtf.precisionDecimalValue(B)}},{header:"Amt. Due",dataIndex:"npayadue",align:"right",renderer:function(B){return Wtf.precisionDecimalValue(B)}},{header:"Payment",dataIndex:"npaypymt",align:"right"}]);this.TxtAmnt=new Wtf.form.NumberField({fieldLabel:"Amount*",anchor:"94%",id:"TxtAmnt"+this.id,validator:this.ValidateAmount,allowDecimals:true,decimalPrecision:2,allowBlank:false,readOnly:true});this.dateTimePicker=new Wtf.form.DateField({fieldLabel:"Date*",anchor:"94%",id:"DatDate"+this.id,allowBlank:false});this.dateTimePicker.setValue(new Date());this.TxtBalance=new Wtf.form.TextField({fieldLabel:"Balance",anchor:"94%",readOnly:true,id:"TxtCbal"+this.id});this.NP_store=new Wtf.data.SimpleStore({fields:["no","method"],data:[["3","Direct Bank Debit - FPX"],["6","Credit Card Payment - MIGS"],["4","Credit Note"]]});this.ComboPymt=new Wtf.form.ComboBox({fieldLabel:"Payment Method",anchor:"94%",id:"CmbPymt"+this.id,mode:"local",triggerAction:"all",typeAhead:true,editable:false,store:this.NP_store,displayField:"method",valueField:"no"});this.viewCredit=new Wtf.Button({text:"View Credits",id:"viewCredit"+this.id,disabled:true,handler:this.viewCredits,tooltip:{title:"View Credits",text:"Click to view all your credits"},scope:this});this.ComboPymt.on("select",this.checkFun,this);this.textBoxCNno=new Wtf.form.TextField({fieldLabel:"Credit note#",anchor:"94%",readOnly:true,id:"creditNote"+this.id,disabled:true});this.textBoxMemo=new Wtf.form.TextField({fieldLabel:"Note",anchor:"94%",id:"TxtNote"+this.id});this.border=false;this.layout="border";this.items=[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createcommunity.png","Payment","Track your payments")},{region:"center",border:false,bodyStyle:"background:#f1f1f1;font-size:10px;",layout:"border",items:[{region:"north",id:"north"+this.id,border:false,height:155,columnWidth:1,layout:"column",items:[{columnWidth:0.5,layout:"form",bodyStyle:"padding:13px 13px 0px 13px",border:false,labelWidth:84,items:[this.dateTimePicker,this.TxtAmnt]},{columnWidth:0.5,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",labelWidth:101,items:[this.ComboPymt,this.viewCredit,this.TxtBalance,this.textBoxCNno]}]},{region:"center",id:"center"+this.id,border:false,layout:"fit",bodyStyle:"padding:13px 13px 13px 13px",items:this.AccGridNpay=new Wtf.AccGridComp({id:"accGrid"+this.id,columnWidth:1,layout:"column",selModel:this.seModel,ds:this.dsNewPay,cm:this.cmNewPay})}]}];this.bbar=[this.submitBtn=new Wtf.Button({text:"Submit",tooltip:{title:"Submit",text:"Click to Submit"},handler:this.SaveItem,scope:this}),{text:"Cancel",tooltip:{title:"Cancel",text:"Click to Cancel"},handler:function(){this.close()},scope:this}];this.AccGridNpay.on("onAccGridEdit",this.AccGridEdit,this);this.AccGridNpay.on("onChkboxClick",this.UncheckRow,this);this.dsNewPay.on("load",this.onDataLoad,this);this.TxtAmnt.on("change",this.AdjustAmount,this);Wtf.NewPayment2.superclass.constructor.call(this,A)};Wtf.extend(Wtf.NewPayment2,Wtf.Window,{contentTitle:null,contentTitle1:null,textBoxWidth:225,remaining:0,initComponent:function(){Wtf.NewPayment2.superclass.initComponent.call(this);this.addEvents({"closeform":true})},onRender:function(B,A){this.ComboPymt.setValue(this.NP_store.getAt(0).data["no"]);Wtf.NewPayment2.superclass.onRender.call(this,B,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask));this.LoadGrid()},viewCredits:function(){this.viewCreditsWin=new Wtf.viewCredit({customerId:this.customerId,sponsorFlag:this.sponsorFlag==1?1:0,width:350,height:300});this.viewCreditsWin.show();this.viewCreditsWin.on("closeform",function(B,E,A,D){this.textBoxCNno.setValue(E);var C=this.cmNewPay.getColumnHeader(4).substring(this.cmNewPay.getColumnHeader(4).indexOf("(")+1,this.cmNewPay.getColumnHeader(4).indexOf(")"));if(D=="USD"&&C=="RM"){this.TxtAmnt.setValue(parseFloat(B*this.convrate).toFixed(2))}else{if(D=="RM"&&C=="USD"){this.TxtAmnt.setValue(parseFloat(B/this.convrate).toFixed(2))}else{this.TxtAmnt.setValue(Wtf.precisionDecimalValue(B))}}this.creditTid=A},this)},checkFun:function(F,H,D){if(this.previndex!=D){this.seModel.clearSelections();for(var C=0;C<this.dsNewPay.getCount();C++){this.dsNewPay.getAt(C).set("npaypymt",0)}if(H.get("no")=="4"){var G=this.cmNewPay.getColumnHeader(4).substring(0,this.cmNewPay.getColumnHeader(4).indexOf("("));var E=this.cmNewPay.getColumnHeader(5).substring(0,this.cmNewPay.getColumnHeader(5).indexOf("("));var B=this.cmNewPay.getColumnHeader(6).substring(0,this.cmNewPay.getColumnHeader(6).indexOf("("));this.cmNewPay.setColumnHeader(4,G+"("+this.currency+")");this.cmNewPay.setColumnHeader(5,E+"("+this.currency+")");this.cmNewPay.setColumnHeader(6,B+"("+this.currency+")");if(this.currency!=this.altcurrency){for(var C=0;C<this.dsNewPay.getCount();C++){this.dsNewPay.getAt(C).set("npayoamt",(this.dsNewPay.getAt(C).get("npayoamt")/this.convrate).toFixed(2));this.dsNewPay.getAt(C).set("npayadue",(this.dsNewPay.getAt(C).get("npayadue")/this.convrate).toFixed(2))}this.TxtBalance.setValue((this.TxtBalance.getValue()/this.convrate).toFixed(2))}this.textBoxCNno.setDisabled(false);this.TxtAmnt.setValue(null);Wtf.getCmp("viewCredit"+this.id).setDisabled(false)}else{var A=this.cmNewPay.getColumnHeader(4).substring(this.cmNewPay.getColumnHeader(4).indexOf("(")+1,this.cmNewPay.getColumnHeader(4).indexOf(")"));var G=this.cmNewPay.getColumnHeader(4).substring(0,this.cmNewPay.getColumnHeader(4).indexOf("("));var E=this.cmNewPay.getColumnHeader(5).substring(0,this.cmNewPay.getColumnHeader(5).indexOf("("));var B=this.cmNewPay.getColumnHeader(6).substring(0,this.cmNewPay.getColumnHeader(6).indexOf("("));this.cmNewPay.setColumnHeader(4,G+"("+this.altcurrency+")");this.cmNewPay.setColumnHeader(5,E+"("+this.altcurrency+")");this.cmNewPay.setColumnHeader(6,B+"("+this.altcurrency+")");if(A=="USD"){if(this.currency!=this.altcurrency){for(var C=0;C<this.dsNewPay.getCount();C++){this.dsNewPay.getAt(C).set("npayoamt",(this.dsNewPay.getAt(C).get("npayoamt")*this.convrate).toFixed(2));this.dsNewPay.getAt(C).set("npayadue",(this.dsNewPay.getAt(C).get("npayadue")*this.convrate).toFixed(2))}this.TxtBalance.setValue((this.TxtBalance.getValue()*this.convrate).toFixed(2))}}this.textBoxCNno.setDisabled(true);this.textBoxCNno.setValue(null);this.TxtAmnt.setValue(null);Wtf.getCmp("viewCredit"+this.id).setDisabled(true)}this.previndex=D}},AccGridEdit:function(A,C,B,D,E){if(C!=""&&(B==""||B=="0")){this.edited[A]=0}else{this.edited[A]=1}},LoadGrid:function(){this.dsNewPay.baseParams={flag:0,receivedid:this.customerId,acctype:this.accountId,invoicenum:this.invoiceNum,admin:false};this.dsNewPay.load()},AdjustAmount:function(){this.remaining=this.TxtAmnt.getValue();this.AdjustPayment()},AdjustPayment:function(){if(this.AccGridNpay.getSelectionModel().hasSelection()){var F=this.AccGridNpay.getSelectionModel().getSelections();var D=new Array();var B=0;for(var C=0;C<F.length;C++){var E=F[C];if(this.edited[this.dsNewPay.find("npayistid",E.data["npayistid"])]==1){if(this.remaining>=parseFloat(E.data["npaypymt"])){E.set("npaypymt",E.data["npaypymt"]);this.remaining-=E.data["npaypymt"]}else{if(this.remaining!="0"){E.set("npaypymt",this.remaining);this.remaining=0}else{E.set("npaypymt","0")}}}else{D[B++]=F[C]}}for(var A=0;A<D.length;A++){var E=D[A];if(this.remaining>=parseFloat(E.data["npayadue"])){E.set("npaypymt",E.data["npayadue"]);this.remaining-=E.data["npayadue"]}else{if(this.remaining!="0"){E.set("npaypymt",this.remaining);this.remaining=0}else{E.set("npaypymt","0")}}}}},UncheckRow:function(A){if(this.ComboPymt.getValue()=="4"){if(this.TxtAmnt.getValue()!=""){this.remaining=this.TxtAmnt.getValue();var E=this.dsNewPay.getAt(A);E.set("npaypymt","0");this.edited[A]=0;this.AdjustPayment()}}else{var B=0;var C=this.seModel.getSelections();if(this.seModel.isSelected(A)){this.dsNewPay.getAt(A).set("npaypymt",this.dsNewPay.getAt(A).get("npayadue"))}else{this.dsNewPay.getAt(A).set("npaypymt",0)}for(var D=0;D<C.length;D++){B+=parseFloat(this.dsNewPay.getAt(D).get("npayadue"))}this.TxtAmnt.setValue(B.toFixed(2))}},onDataLoad:function(B,D){if(B.getCount()>0){this.currency=B.getAt(0).store.reader.jsonData.currency;this.altcurrency=B.getAt(0).store.reader.jsonData.altcurrency;this.convrate=B.getAt(0).store.reader.jsonData.rate;this.cmNewPay.setColumnHeader(4,this.cmNewPay.getColumnHeader(4)+"("+B.getAt(0).store.reader.jsonData.altcurrency+")");this.cmNewPay.setColumnHeader(5,this.cmNewPay.getColumnHeader(5)+"("+B.getAt(0).store.reader.jsonData.altcurrency+")");this.cmNewPay.setColumnHeader(6,this.cmNewPay.getColumnHeader(6)+"("+B.getAt(0).store.reader.jsonData.altcurrency+")")}var A=0;for(var C=0;C<B.getCount();C++){this.edited[C]=0;D[C].set("npaypymt","0");A+=new Number(D[C].data["npayadue"])}this.TxtBalance.setValue(A.toFixed(2))},SaveItem:function(){var A=this.ComboPymt.getValue();if(A=="M"){Wtf.MessageBox.show({title:"Payment mode not available",msg:"FPX Payment mode is not available at this time",buttons:Wtf.MessageBox.OK,animEl:"upwin",icon:Wtf.MessageBox.INFO,fn:function(){return }})}else{if(this.AccGridNpay.getSelections().length>0){this.TxtAmnt.validate();this.dateTimePicker.validate();if(!this.TxtAmnt.isValid()||!this.dateTimePicker.isValid()||this.TxtAmnt.getValue()==""){return }dsarray=this.AccGridNpay.getSelections();var B=0;for(ii=0;ii<dsarray.length;ii++){B+=parseFloat(dsarray[ii].data["npaypymt"]);if(parseFloat(dsarray[ii].data["npaypymt"])==0){msgBoxShow(["Error","Amount applied to selected invoice is 0"],Wtf.MessageBox.ERROR);return }}if(B<=0){msgBoxShow(["Error","Amount applied to invoice is 0"],Wtf.MessageBox.ERROR)}else{this.loadMask.show();this.receivedPayment()}}else{msgBoxShow(["Error","Select at least one invoice to pay"],Wtf.MessageBox.ERROR)}}},receivedPayment:function(){var I=new Date(this.dateTimePicker.getValue()).format("Y-m-d H:i:s");var F=0;var C="";var A="";if(this.ComboPymt.getValue()==4){A=this.textBoxCNno.getValue()}dsarray=this.AccGridNpay.getSelections();if(dsarray.length>0){C=dsarray[0].data.npayistid;F=this.ComboPymt.getValue()}var G=this.TxtAmnt.getValue();var H=this.textBoxMemo.getValue();dsarray=this.AccGridNpay.getSelections();var E="{tableinfo:[";for(ii=0;ii<dsarray.length;ii++){var D=new Array();D[0]="amount";D[1]="istid";D[2]="Paid";D[3]="invamtdue";D[4]="disamount";var B=new Array();B[0]=dsarray[ii].data["npaypymt"];B[1]=dsarray[ii].data["npayistid"];B[2]="false";B[3]=dsarray[ii].data["npayadue"];if(parseFloat(dsarray[ii].data["npayadue"])<=parseFloat(dsarray[ii].data["npaypymt"])){B[4]=dsarray[ii].data["discount"]}else{B[4]=0}jobj=Wtf.common.getJsonObjectForAccounting(D,B);E+=jobj}E=Wtf.common.CreateJsonEnd(E);this.InsertStore=new Wtf.data.Store({method:"POST",url:"jspfiles/accounting/ReceivePayment.jsp",reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"result",type:"string"},{name:"ErrorMsg",type:"string"}]})});this.InsertStore.on("load",function(N,O,M){this.loadMask.hide();if(O&&O[0].data["result"]=="Success"){Wtf.Msg.alert("Status","Payment done successfully");var J=this.AccGridNpay.getSelections();var L=false;if(J.length>0){if(J[0].get("npayadue")==J[0].get("npaypymt")){L=true}}this.fireEvent("closeform",this.id,this.TxtAmnt.getValue(),L)}else{if(O&&O[0].data["result"].indexOf("Success")>-1){var K=O[0].data["result"].substring(8);if(K){window.open(K,"_paymentgateway")}else{Wtf.Msg.alert("Error","Cannot complete transaction at this time. Please try again later.")}}else{Wtf.Msg.alert("Transaction Failure",O[0].get("ErrorMsg"))}}this.close()},this);this.InsertStore.on("loadexception",function(){this.loadMask.hide();Wtf.Msg.alert("Error","An error occurred while connecting to server");this.close()},this);this.InsertStore.load({params:{flag:1,jsondata:E,userid:this.customerId,accid:this.accountId,date:I,paymode:F,istid:C,amount:G,memo:H,custchk:false,islocal:this.islocal,creditid:this.creditTid,curchkflag:this.curchkflag,chequeno:A}})},ValidateAmount:function(){if(this.getValue()<=0){this.invalidText="Enter a valid decimal greater than 0";return false}else{return true}}});function KWLAccValidation(){}function FloatCheck(B){var A="^(\\d+|\\d+\\.\\d{1,2})$";if(B.match(A)!=null){return B}else{return -1}}function NumCheck(B){var A="^(\\d+)$";if(B.match(A)!=null){return B}else{return -1}}KWLAccValidation.prototype.FloatCheck=FloatCheck;KWLAccValidation.prototype.NumCheck=NumCheck;Wtf.student.UnpaidDefaultCourse=function(A){Wtf.student.UnpaidDefaultCourse.superclass.constructor.call(this,A);this.sm=new Wtf.grid.CheckboxSelectionModel({});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.cmodel1=new Wtf.grid.ColumnModel([this.sm,{header:"Applicant's Name",dataIndex:"name"},{header:"Country",dataIndex:"country"},{header:"Email-id",dataIndex:"emailid"},{header:"Program Name",dataIndex:"programname"},{header:"Application Status",dataIndex:"status"},{dataIndex:"programid",hidden:true},{dataIndex:"appid",hidden:true}]);this.cmodel1.defaultSortable=true;this.moduleRecord=Wtf.data.Record.create([{name:"name",type:"string"},{name:"country",type:"string"},{name:"emailid",type:"string"},{name:"programname",type:"string"},{name:"appid",type:"string"},{name:"status",type:"string"},{name:"programid",type:"string"},{name:"invoicenum",type:"string"},{name:"accountid",type:"string"},{name:"programtype",type:"string"},{name:"userid",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.moduleRecord);this.moduleStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader,sortInfo:{field:"name",direction:"asc"},groupField:"name"});this.grid1=new Wtf.grid.GridPanel({ds:this.moduleStore,cm:this.cmodel1,border:false,view:this.groupingView,trackMouseOver:true,sm:this.sm,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.PayBttn=new Wtf.Toolbar.Button({text:"Pay Fee",tooltip:"Pay fee for selected module",id:"BtnPay"+this.id,scope:this,disabled:true});this.printBttn=new Wtf.Toolbar.Button({text:"Print Invoice",tooltip:"Print Invoice",id:"printNew"+this.id,scope:this,disabled:true});this.PayBttn.on("click",this.handlePayFee,this);this.printBttn.on("click",this.handlePrintInvoice,this);Wtf.student.UnpaidDefaultCourse.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"studentname"}),this.PayBttn],bbar:new Wtf.PagingSearchToolbar({pageSize:15,store:this.moduleStore,searchField:this.quickPanelSearch,displayInfo:false,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:this.pP=new Wtf.common.pPageSize({})}),items:[this.grid1]});this.grid1.on("cellclick",this.clickHandle,this);this.moduleStore.on("load",this.handleStoreLoad,this);this.moduleStore.on("datachanged",function(){this.quickPanelSearch.setPage(this.pP.combo.value)},this)};Wtf.extend(Wtf.student.UnpaidDefaultCourse,Wtf.Panel,{onRender:function(A){Wtf.student.UnpaidDefaultCourse.superclass.onRender.call(this,A);this.moduleStore.baseParams={type:"sponsorUnpaidInv",userid:loginid,flag:this.flag};this.moduleStore.load({params:{start:0,limit:15}})},clickHandle:function(C,E,B,D){var A=this.grid1.getSelectionModel().getSelections();if(A.length==1){this.printBttn.enable();this.PayBttn.enable()}else{this.printBttn.disable();this.PayBttn.disable()}},handlePayFee:function(item,e){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/admin/acastructure.jsp",params:{type:84,appid:this.sm.getSelected().get("appid"),userid:this.sm.getSelected().get("userid")}},this,function(response,option){var resp=eval("("+response+")");if(resp!=null){if(resp.success!=null){if(resp.success){if(resp.amount!=null){if(resp.amount>0){if(resp.num!=null&&resp.accid!=null){this.sm.getSelected().set("invoicenum",resp.num);this.sm.getSelected().set("accountid",resp.accid);var islocal=0;if(resp.currency=="RM"){islocal=1}new Wtf.NewPayment2({id:"coursepayment"+this.id,resizable:false,width:650,invoiceNum:resp.num,height:500,modal:true,accountId:resp.accid,customerId:loginid,sponsorFlag:1,islocal:islocal}).show();Wtf.getCmp("coursepayment"+this.id).on("closeform",function(id,amount,full){this.sendmail(id,amount,full,resp.num)},this)}}else{Wtf.Msg.show({title:"Register",msg:"Fee amount is 0. Do you want to register the student?",buttons:Wtf.Msg.YESNO,scope:this,fn:this.processResult,animEl:"elId",icon:Wtf.MessageBox.QUESTION})}}}}}},function(resp,req){})},processResult:function(A){if(A=="yes"){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/admin/acastructure.jsp",params:{type:98,userid:this.sm.getSelected().get("userid"),programid:this.sm.getSelected().get("programid"),programname:this.sm.getSelected().get("programname"),id:this.sm.getSelected().get("appid")}},this,function(C,B){msgBoxShow(["Success","Notification mail has been sent to the applicant"],Wtf.MessageBox.INFO);this.fireEvent("refreshapplicationgrid")},function(C,B){})}},sendmail:function(D,A,B,C){if(fullflag){Wtf.Ajax.request({url:"jspfiles/admin/applications.jsp",method:"POST",params:{task:"acceptcoursefee",appid:this.grid1.getSelectionModel().getSelections()[0].data["appid"]},scope:this,success:function(E,F){msgBoxShow(["Success","Notification mail has been sent to the student"],Wtf.MessageBox.INFO);this.moduleStore.load({params:{start:0,limit:15}})},failure:function(E,F){msgBoxShow(["Error","Error notifying the applicant"],Wtf.MessageBox.INFO)}})}},handlePrintInvoice:function(B,D){var A=this.grid1.getSelectionModel().getSelections();var E="";for(var C=0;C<A.length;C++){E+=A[C].data["invoicenum"];if(C!=A.length-1){E+=","}}setDldUrl("PrintInvoice.jsp?&invoicenum="+A[0].data["invoicenum"]+"&flg=1")},handleStoreLoad:function(A,C,B){this.quickPanelSearch.StorageChanged(A)}});Wtf.student.sponsorUnpaid=function(A){Wtf.student.sponsorUnpaid.superclass.constructor.call(this,A);this.sm=new Wtf.grid.CheckboxSelectionModel({});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.cmodel1=new Wtf.grid.ColumnModel([this.sm,{header:"Invoice No",width:150,dataIndex:"invoicenum"},{header:"Student Name",width:150,dataIndex:"studentname"},{header:"Dated On",width:100,dataIndex:"date",sortable:false,renderer:function(B){if(Wtf.isEmpty(B)){return B}else{return B.format(Wtf.getDateFormat())}}},{header:"Fee Type",width:150,dataIndex:"feetype"},{header:"Amount",width:150,dataIndex:"amount",renderer:function(B){return Wtf.precisionDecimalValue(B)}},{header:"Amount Due",width:150,dataIndex:"amountdue",renderer:function(B){return Wtf.precisionDecimalValue(B)}}]);this.cmodel1.defaultSortable=true;this.moduleRecord=Wtf.data.Record.create([{name:"invoicenum",type:"string"},{name:"studentname",type:"string"},{name:"studentid",type:"string"},{name:"amount",type:"string"},{name:"amountdue",type:"string"},{name:"feetype",type:"string"},{name:"accountid",type:"string"},{name:"studenttype",type:"string"},{name:"date",type:"date",dateFormat:"Y-m-j H:i:s.0"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.moduleRecord);this.moduleStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader,sortInfo:{field:"studentname",direction:"asc"},groupField:"studentname"});this.grid1=new Wtf.grid.GridPanel({ds:this.moduleStore,cm:this.cmodel1,border:false,view:this.groupingView,trackMouseOver:true,sm:this.sm,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.PayBttn=new Wtf.Toolbar.Button({text:"Pay Fee",tooltip:"Pay fee for selected module",id:"BtnPay"+this.id,scope:this,disabled:true});this.printBttn=new Wtf.Toolbar.Button({text:"Print Invoice",tooltip:"Print Invoice",id:"printNew"+this.id,scope:this,disabled:true});this.PayBttn.on("click",this.handlePayFee,this);this.printBttn.on("click",this.handlePrintInvoice,this);Wtf.student.sponsorUnpaid.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"invoicenum"}),this.PayBttn,this.printBttn],bbar:new Wtf.PagingSearchToolbar({pageSize:15,store:this.moduleStore,searchField:this.quickPanelSearch,displayInfo:false,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:this.pP=new Wtf.common.pPageSize({})}),items:[this.grid1]});this.grid1.on("cellclick",this.clickHandle,this);this.moduleStore.on("load",this.handleStoreLoad,this);this.moduleStore.on("datachanged",function(){this.quickPanelSearch.setPage(this.pP.combo.value)},this)};Wtf.extend(Wtf.student.sponsorUnpaid,Wtf.Panel,{onRender:function(A){Wtf.student.sponsorUnpaid.superclass.onRender.call(this,A);this.moduleStore.baseParams={type:"sponsorUnpaidInv",userid:loginid,flag:this.flag};this.moduleStore.load({params:{start:0,limit:15}})},clickHandle:function(D,G,C,F){var A=this.grid1.getSelectionModel().getSelections();if(A.length>1){if(A[A.length-2].data["studenttype"]!=this.moduleStore.getAt(G).data["studenttype"]||A[A.length-2].data["accountid"]!=this.moduleStore.getAt(G).data["accountid"]){var B=this.grid1.getSelectionModel().getSelections();this.grid1.getSelectionModel().clearSelections();this.PayBttn.disable();this.printBttn.disable();var E=[];E[0]=B[B.length-1];this.grid1.getSelectionModel().selectRecords(E)}else{this.PayBttn.enable();this.printBttn.disable()}}else{if(A.length==1){this.printBttn.enable();this.PayBttn.enable()}else{this.printBttn.disable();this.PayBttn.disable()}}},handlePayFee:function(B,D){var A=this.grid1.getSelectionModel().getSelections();var E="";for(var C=0;C<A.length;C++){E+=A[C].data["invoicenum"];if(C!=A.length-1){E+=","}}this.newInv=new Wtf.NewPayment2({id:"coursepayment"+this.id,resizable:false,width:650,invoiceNum:E,height:500,modal:true,accountId:this.sm.getSelected().get("accountid"),customerId:loginid,sponsorFlag:1,islocal:this.sm.getSelected().get("studenttype")});this.newInv.show();this.newInv.on("closeform",function(F){this.moduleStore.load({params:{start:0,limit:15}})},this)},handlePrintInvoice:function(B,D){var A=this.grid1.getSelectionModel().getSelections();var E="";for(var C=0;C<A.length;C++){E+=A[C].data["invoicenum"];if(C!=A.length-1){E+=","}}setDldUrl("PrintInvoice.jsp?&invoicenum="+A[0].data["invoicenum"]+"&flg=1")},handleStoreLoad:function(A,C,B){this.quickPanelSearch.StorageChanged(A)}});Wtf.WtfNewCourseBursar=function(A){Wtf.apply(this,A);this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.cmodel1=new Wtf.grid.ColumnModel([this.sm,{header:"Student Name",width:150,dataIndex:"username"},{header:"Module Name",width:150,dataIndex:"modulename"},{header:"Module Code",width:150,dataIndex:"modulecode"},{header:"Type",width:100,dataIndex:"type"},{header:"Status",width:100,dataIndex:"status",renderer:function(F,D,B,G,E,C){if(F=="Applied for registration after due date"||F=="Payment is not made within stipulated time"){return"<lable style = 'color : red;'>"+F+"</lable>"}else{return F}}}]);this.cmodel1.defaultSortable=true;this.moduleRecord=Wtf.data.Record.create([{name:"username",type:"string"},{name:"modulename",type:"string"},{name:"status",type:"string"},{name:"userid",type:"string"},{name:"sessionid",type:"string"},{name:"type",type:"string"},{name:"moduleid",type:"string"},{name:"modulecode",type:"string"},{name:"invoicenum",type:"string"},{name:"amount",type:"string"},{name:"statusid",type:"int"},{name:"programid",type:"string"},{name:"gradtype",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.moduleRecord);this.moduleStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader,sortInfo:{field:"username",direction:"ASC"},groupField:"username"});this.grid1=new Wtf.grid.GridPanel({ds:this.moduleStore,cm:this.cmodel1,border:false,view:this.groupingView,trackMouseOver:true,sm:this.sm,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.regBttn=new Wtf.Toolbar.Button({text:"Approve",tooltip:"Approve selected request",id:"BtnNew"+this.id,scope:this,disabled:true});this.rejectBttn=new Wtf.Toolbar.Button({text:"Reject",tooltip:"Reject selected request",id:"rejeNew"+this.id,scope:this,disabled:true});this.regBttn.on("click",this.handleRegister,this);this.rejectBttn.on("click",this.handleReject,this);Wtf.WtfNewCourseBursar.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"modulename"}),this.regBttn,this.rejectBttn],bbar:new Wtf.PagingToolbar({pageSize:15,store:this.moduleStore,displayInfo:false,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:new Wtf.common.pPageSize({})}),items:[this.grid1]});this.on("render",this.handleRender,this);this.grid1.on("cellclick",this.clickHandle,this);this.moduleStore.on("load",this.handleStoreLoad,this)};Wtf.WtfNewPOHistory=function(A){Wtf.apply(this,A);this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.cmodel1=new Wtf.grid.ColumnModel([this.sm,{header:"Student Name",width:150,dataIndex:"username"},{header:"Module Name",width:150,dataIndex:"modulename"},{header:"Module Code",width:150,dataIndex:"modulecode"},{header:"Applied Date",width:100,dataIndex:"appdate"},{header:"Approved Date",width:100,dataIndex:"approvedate"}]);this.cmodel1.defaultSortable=true;this.moduleRecord=Wtf.data.Record.create([{name:"username",type:"string"},{name:"modulename",type:"string"},{name:"userid",type:"string"},{name:"sessionid",type:"string"},{name:"moduleid",type:"string"},{name:"modulecode",type:"string"},{name:"gradtype",type:"string"},{name:"appdate",type:"string"},{name:"approvedate",type:"string"},{name:"metricno",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.moduleRecord);this.moduleStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader,sortInfo:{field:"username",direction:"ASC"},groupField:"username"});this.grid1=new Wtf.grid.GridPanel({ds:this.moduleStore,cm:this.cmodel1,border:false,view:this.groupingView,sm:this.sm,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});Wtf.WtfNewPOHistory.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"modulename"})],bbar:new Wtf.PagingToolbar({pageSize:15,store:this.moduleStore,displayInfo:false,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:new Wtf.common.pPageSize({})}),items:[this.grid1]});this.on("render",this.handleRender,this);this.moduleStore.on("load",this.handleStoreLoad,this)};Wtf.extend(Wtf.WtfNewPOHistory,Wtf.Panel,{handleStoreLoad:function(A,C,B){this.quickPanelSearch.StorageChanged(A)},handleRender:function(A){this.moduleStore.baseParams={type:"withdrawalhistory"};this.moduleStore.load({params:{userid:loginid,start:0,limit:15}})}});Wtf.extend(Wtf.WtfNewCourseBursar,Wtf.Panel,{handleRender:function(A){this.moduleStore.baseParams={type:"examapplistbursar"};this.moduleStore.load({params:{userid:loginid,start:0,limit:15}});this.grid1.on("sortchange",function(B,C){this.grid1.getStore().groupBy(C.field)},this)},handleStoreLoad:function(A,C,B){this.quickPanelSearch.StorageChanged(A)},clickHandle:function(D,G,C,F){this.moduleid=this.moduleStore.getAt(G).data["moduleid"];this.modulename=this.moduleStore.getAt(G).data["modulename"];this.userid=this.moduleStore.getAt(G).data["userid"];this.sessionid=this.moduleStore.getAt(G).data["sessionid"];var A=this.grid1.getSelectionModel().getSelections();if(A.length>1&&A[A.length-2].data["userid"]==this.moduleStore.getAt(G).data["userid"]){if(A[A.length-2].data["status"]!=this.moduleStore.getAt(G).data["status"]){var B=this.grid1.getSelectionModel().getSelections();this.grid1.getSelectionModel().clearSelections();this.regBttn.disable();this.rejectBttn.disable();var E=[];E[0]=B[B.length-1];this.grid1.getSelectionModel().selectRecords(E)}}else{if(A.length>1&&A[A.length-2].data["userid"]!=this.moduleStore.getAt(G).data["userid"]){var B=this.grid1.getSelectionModel().getSelections();this.grid1.getSelectionModel().clearSelections();this.regBttn.disable();this.rejectBttn.disable();var E=[];E[0]=B[B.length-1];this.grid1.getSelectionModel().selectRecords(E)}}this.status=this.moduleStore.getAt(G).data["status"];this.statusid=this.moduleStore.getAt(G).data["statusid"];if(this.status=="Waiting for withdrawal approval from bursar"||this.status=="Applied for withdrawal"){this.regBttn.enable();this.rejectBttn.enable()}else{if(this.status=="Waiting for deferment approval from bursar"){this.regBttn.enable();this.rejectBttn.enable()}else{if(this.status=="Waiting for deferment confirmation"){this.regBttn.enable();this.rejectBttn.enable()}else{this.regBttn.disable();this.rejectBttn.disable()}}}},handleRegister:function(C,J){var B=this.grid1.getSelectionModel().getSelections();var H="";if(B[0].data["amount"]=="0"){var A=this.grid1.getSelectionModel().getSelections().length;for(var F=0;F<B.length;F++){H+=B[F].data["moduleid"];if(F!=B.length-1){H+=","}}var E="Exam";var I="updateUserTutStatus";var K=B[0].data["status"];var G="";var D="";if(K=="Waiting for deferment approval from bursar"){D="Your request for deferment approved",G="4"}else{D="Your request for withdrawal approved",G="18"}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:B[0].data["userid"],moduleid:H,sessionid:B[0].data["sessionid"],classtypeid:E,type:I,operation:"approvewithdrawal",msg:D,status:G},method:"POST"},this,function(L,M){Wtf.Msg.alert("Success","The selected module has been withdrawn successfully.");this.moduleStore.reload()},function(M,L){Wtf.Msg.alert("Error","Error connecting to the server.")})}else{var G=B[0].data["status"];var E="Exam";this.msgbox=new Wtf.Window({id:"msgbox"+this.id,title:"Withdrawn",closable:true,border:false,modal:true,height:280,width:350,layout:"fit",resizable:false,items:[{border:false,layout:"border",items:[{region:"north",id:"north1"+this.id,border:false,height:50,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"This credit note or refund has a remaining balance which you may use."}]},{region:"center",id:"center1"+this.id,border:false,height:20,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"What would you like to do with this withdrawn amount?"}]},{region:"south",id:"south1"+this.id,border:false,height:110,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:2px 13px 0px 43px;",items:[this.check1=new Wtf.form.Radio({hideLabel:true,boxLabel:"Generate credit note",name:"chck"+this.id,id:"check1"+this.id}),this.check2=new Wtf.form.Radio({hideLabel:true,boxLabel:"Give a refund",name:"chck"+this.id,checked:true,id:"check2"+this.id}),this.check3=new Wtf.form.Radio({hideLabel:true,boxLabel:"No refund",name:"chck"+this.id,id:"check3"+this.id})]}]}]}],buttonAlign:"center",buttons:[{text:"OK",handler:function(){var L=null;if(this.check1.getValue()){L="Credit"}if(this.check2.getValue()){L="Refund"}if(this.check3.getValue()){L="Norefund";this.withdrawwithoutrefundE(L,E)}Wtf.getCmp("msgbox"+this.id).close();if(L!="Norefund"){this.requestTocheckFullrefund(L,E)}},scope:this},{text:"Cancel",handler:function(){Wtf.getCmp("msgbox"+this.id).close()},scope:this}]}).show()}},withdrawwithoutrefundE:function(checkFlag,classtypeid){var selectedRecord=this.grid1.getSelectionModel().getSelections();var statustext=selectedRecord[0].data["status"];var status="";var msg="";if(statustext=="Waiting for deferment approval from bursar"){msg="Your request for deferment approved",status="4"}else{msg="Your request for withdrawal approved",status="18"}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{classtypeid:classtypeid,moduleid:selectedRecord[0].data["moduleid"],type:"updateUserTutStatus",sessionid:selectedRecord[0].data["sessionid"],userid:selectedRecord[0].data["userid"],msg:msg,status:status},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");Wtf.Msg.alert("Success","The selected module has been withdrawn successfully.");this.showWindow(checkFlag,classtypeid,retstatus.success);this.moduleStore.load({params:{userid:loginid,start:0,limit:15}})},function(resp,req){})},requestTocheckFullrefund:function(checkFlag,classtypeid){var selectedRecord=this.grid1.getSelectionModel().getSelections();Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{classtypeid:classtypeid,moduleid:selectedRecord[0].data["moduleid"],type:"checkforAddDropPeriod",userid:selectedRecord[0].data["userid"],mode:classtypeid},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");this.showWindow(checkFlag,classtypeid,retstatus.success)},function(resp,req){})},showWindow:function(A,C,F){var I="updateUserTutStatus";var J=new Date();var D=J.format("Y-m-d H:i:s");var K="RF"+J.format("y")+"/"+Math.floor(Math.random()*10001);var E=this.grid1.getSelectionModel().getSelections();var G="";var H=0;for(var B=0;B<E.length;B++){G+=E[B].data["moduleid"];H=E[B].data["amount"];if(B!=E.length-1){G+=","}}H=Wtf.precisionDecimalValue(H);if(A=="Refund"){this.newissuerefund=new Wtf.IssueRefund({id:"IssueRef"+this.id,customerId:E[0].data["userid"],customerName:E[0].data["username"],sessionid:E[0].data["sessionid"],status:E[0].data["status"],refNo:K,creditAmount:H,refundAmount:H,moduleid:G,receivableAccid:17,type:I,classtypeid:C,title:"Issue Refund",closable:true,border:false,modal:true,width:340,height:400,iconCls:"win",layout:"fit",fullrefund:F,resizable:false,programid:E[0].data["programid"]});this.newissuerefund.show();this.newissuerefund.on("closeform",function(L){this.moduleStore.load({params:{userid:loginid,start:0,limit:15}})},this)}else{if(A=="Credit"){this.newcreditnote=new Wtf.CreditNote({id:"CreNote"+this.id,customerId:E[0].data["userid"],sessionid:E[0].data["sessionid"],customerName:E[0].data["username"],status:E[0].data["status"],refNo:K,type:I,classtypeid:C,creditAmount:H,moduleid:G,receivableAccid:17,title:"Issue Refund",closable:true,border:false,modal:true,width:340,height:400,iconCls:"win",layout:"fit",fullrefund:F,resizable:false,programid:E[0].data["programid"]});this.newcreditnote.show();this.newcreditnote.on("closeform",function(L){this.moduleStore.load({params:{userid:loginid,start:0,limit:15}})},this)}}},handleReject:function(){var classtypeid="Exam";var status="1";var selectedRecord=this.grid1.getSelectionModel().getSelections();var idstr="";for(var ctr=0;ctr<selectedRecord.length;ctr++){idstr+=selectedRecord[ctr].data["moduleid"];if(ctr!=selectedRecord.length-1){idstr+=","}}var statustext=selectedRecord[0].data["status"];var status="";var msg="";var regfor="";if(statustext=="Waiting for deferment approval from bursar"){msg="Your request for exam deferment rejected";status="1";regfor="deferment"}else{msg="Your request for withdrawal rejected";status="1";regfor="withdrawal"}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:selectedRecord[0].data["userid"],moduleid:idstr,sessionid:this.sessionid,type:"updateUserTutStatus",classtypeid:classtypeid,status:status,reqfor:regfor,msg:msg},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");if(retstatus.success){msgBoxShow(["Update Status","Status updated Successfully"],Wtf.MessageBox.INFO);this.moduleStore.load({params:{userid:loginid,start:0,limit:15}})}else{msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)}},function(result,req){msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)});this.rejectBttn.disable();this.regBttn.disable()}});Wtf.paymentReversal=function(A){Wtf.apply(this,A);this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.approveMenu=new Wtf.menu.Menu({id:"approve"+this.id});this.approveMenu1=new Wtf.Toolbar.Button({text:"Approve",scope:this,tooltip:{title:"Approve Request",text:"Click to Open"},menu:this.approveMenu});this.rejectMenu=new Wtf.menu.Menu({id:"reject"+this.id});this.rejectMenu1=new Wtf.Toolbar.Button({text:"Reject",scope:this,tooltip:{title:"Reject Request",text:"Click to Open"},menu:this.rejectMenu});Wtf.paymentReversal.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"modulename"}),this.approveMenu1,this.rejectMenu1]});this.on("render",this.handleRender,this);this.sm.on("selectionchange",this.clickHandle,this)};Wtf.extend(Wtf.paymentReversal,Wtf.Panel,{handleRender:function(A){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",method:"GET",params:{type:"getColStructForclassType",userid:loginid,auditflag:0}},this,function(B,C){this.DisplayReport(B)},function(C,B){})},handleRejectRequest:function(A,B){var D=A.text;var C=A.id.substring(6,A.id.length);this.rejectRequest(C,"Withdrawl","1","Your request for "+D+" withdrawal has been rejected")},rejectRequest:function(classtypeid,reqfor,status,msg){var selectedRecord=this.grid1.getSelectionModel().getSelections();var idstr="";for(var ctr=0;ctr<selectedRecord.length;ctr++){idstr+=selectedRecord[ctr].data["moduleid"];if(ctr!=selectedRecord.length-1){idstr+=","}}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:selectedRecord[0].data["userid"],moduleid:idstr,sessionid:this.sessionid,type:"updateUserTutStatus",classtypeid:classtypeid,status:"1",reqfor:"withdrawal",msg:msg},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");if(retstatus.success){msgBoxShow(["Update Status","Status updated Successfully"],Wtf.MessageBox.INFO);this.loadGrid()}else{msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)}},function(result,req){msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)})},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];E[E.length]=this.sm;for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][1];C["width"]=70;C["sortable"]=true;if(B>5){C["renderer"]=this.statusRenderer;Wtf.menu.MenuMgr.get("approve"+this.id).add({text:D[B][0],id:"approve"+D[B][1],disabled:true});Wtf.menu.MenuMgr.get("reject"+this.id).add({text:D[B][0],id:"reject"+D[B][1],disabled:true})}E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);Wtf.menu.MenuMgr.get("approve"+this.id).on("itemclick",this.handleApprove,this);Wtf.menu.MenuMgr.get("reject"+this.id).on("itemclick",this.handleRejectRequest,this);return A},DisplayReport:function(response){this.obj=eval("("+response.trim()+")");var fields=this.createFields(this.obj.recorddata);this.moduleRecord=Wtf.data.Record.create(fields);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data"},this.moduleRecord);this.moduleStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader,sortInfo:{field:"Student Name",direction:"ASC"},groupField:"Student Name"});this.moduleStore.baseParams={type:"classapplistbursar",userid:loginid};this.grid1=new Wtf.grid.GridPanel({ds:this.moduleStore,cm:this.createColModel(this.obj.columnheader),sm:this.sm,border:false,view:this.groupingView,trackMouseOver:true,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.grid1.colModel.defaultSortable=true;this.grid1.on("sortchange",function(b,bd){this.grid1.getStore().groupBy(bd.field)},this);this.moduleStore.on("load",this.handleStoreLoad,this);this.add(this.grid1);this.doLayout();this.moduleStore.load()},statusRenderer:function(E,C,A,F,D,B){if(E=="Applied for withdrawal after due date"){return"<lable style = 'color : red;'>"+E+"</lable>"}else{if(E==""){return"<lable style = 'color : gray;'>Not Applicable</lable>"}else{return E}}},handleStoreLoad:function(A,C,B){this.quickPanelSearch.StorageChanged(A)},initComponent:function(){Wtf.paymentReversal.superclass.initComponent.call(this)},handleApprove:function(C,F){var H=C.id.substring(7,C.id.length);var B="";var G="amount_"+H;var A=this.grid1.getSelectionModel().getSelections();if(A[0].data[G]=="0"){var E="updateUserTutStatus";for(var D=0;D<A.length;D++){B+=A[D].data["moduleid"];if(D!=A.length-1){B+=","}}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:A[0].data["userid"],moduleid:B,sessionid:A[0].data["sessionid"],classtypeid:H,type:E,operation:"approvewithdrawal",msg:"Your request for withdrawal approved",status:"18"},method:"POST"},this,function(I,J){Wtf.Msg.alert("Success","The selected module has been withdrawn successfully.");this.moduleStore.reload()},function(J,I){Wtf.Msg.alert("Error","Error connecting to the server.")})}else{this.msgbox=new Wtf.Window({id:"msgbox"+this.id,title:"Withdrawn",closable:true,border:false,modal:true,height:280,width:350,layout:"fit",resizable:false,items:[{border:false,layout:"border",items:[{region:"north",id:"north1"+this.id,border:false,height:50,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"This credit note or refund has a remaining balance which you may use."}]},{region:"center",id:"center1"+this.id,border:false,height:20,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"What would you like to do with this withdrawn amount?"}]},{region:"south",id:"south1"+this.id,border:false,height:110,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:2px 13px 0px 43px;",items:[this.check1=new Wtf.form.Radio({hideLabel:true,boxLabel:"Generate credit note",name:"chck"+this.id,id:"check1"+this.id,checked:true}),this.check2=new Wtf.form.Radio({hideLabel:true,boxLabel:"Give a refund",name:"chck"+this.id,id:"check2"+this.id}),this.check3=new Wtf.form.Radio({hideLabel:true,boxLabel:"No refund",name:"chck"+this.id,id:"check3"+this.id})]}]}]}],buttonAlign:"center",buttons:[{text:"OK",handler:function(){var I=null;if(this.check2.getValue()){I="Refund"}if(this.check1.getValue()){I="Credit"}if(this.check3.getValue()){I="Norefund";this.withdrawwithoutrefund(I,H)}Wtf.getCmp("msgbox"+this.id).close();if(I!="Norefund"){this.requestTocheckFullrefund(I,H)}},scope:this},{text:"Cancel",handler:function(){Wtf.getCmp("msgbox"+this.id).close()},scope:this}]}).show()}},withdrawwithoutrefund:function(checkFlag,classtypeid){var selectedRecord=this.grid1.getSelectionModel().getSelections();Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{classtypeid:classtypeid,moduleid:selectedRecord[0].data["moduleid"],type:"updateUserTutStatus",sessionid:selectedRecord[0].data["sessionid"],userid:selectedRecord[0].data["userid"],msg:"Your request for withdrawal approved",status:"18"},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");Wtf.Msg.alert("Success","The selected module has been withdrawn successfully.");this.showWindow(checkFlag,classtypeid,retstatus.success);this.moduleStore.load({params:{userid:loginid}})},function(resp,req){})},requestTocheckFullrefund:function(checkFlag,classtypeid){var selectedRecord=this.grid1.getSelectionModel().getSelections();Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{classtypeid:classtypeid,moduleid:selectedRecord[0].data["moduleid"],type:"checkforAddDropPeriod",userid:selectedRecord[0].data["userid"],mode:"class"},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");this.showWindow(checkFlag,classtypeid,retstatus.success)},function(resp,req){})},showWindow:function(A,C,F){var I="updateUserTutStatus";var J=new Date();var D=J.format("Y-m-d H:i:s");var K="RF"+J.format("y")+"/"+Math.floor(Math.random()*10001);var E=this.grid1.getSelectionModel().getSelections();var G="";var H=0;for(var B=0;B<E.length;B++){G+=E[B].data["moduleid"];H=E[B].data["amount_"+C];if(B!=E.length-1){G+=","}}H=Wtf.precisionDecimalValue(H);if(A=="Refund"){this.newissuerefund=new Wtf.IssueRefund({id:"IssueRef"+this.id,customerId:E[0].data["userid"],customerName:E[0].data["Student Name"],sessionid:E[0].data["sessionid"],refNo:K,creditAmount:H,moduleid:G,receivableAccid:17,type:I,classtypeid:C,title:"Issue Refund",closable:true,border:false,modal:true,width:340,height:400,iconCls:"win",layout:"fit",fullrefund:F,resizable:false,programid:E[0].data["programid"]});this.newissuerefund.show();this.newissuerefund.on("closeform",function(L){this.loadGrid()},this)}else{if(A=="Credit"){this.newcreditnote=new Wtf.CreditNote({id:"CreNote"+this.id,customerId:E[0].data["userid"],sessionid:E[0].data["sessionid"],customerName:E[0].data["Student Name"],refNo:K,type:I,classtypeid:C,creditAmount:H,moduleid:G,receivableAccid:17,title:"Issue Refund",closable:true,border:false,modal:true,width:340,height:400,iconCls:"win",layout:"fit",fullrefund:F,resizable:false,programid:E[0].data["programid"]});this.newcreditnote.show();this.newcreditnote.on("closeform",function(L){this.loadGrid()},this)}}},clickHandle:function(A,K,C,I){var E=this.grid1.getSelectionModel().getSelections();var D=this.obj.columnheader;var G="";var F=[];var J=6;for(var H=J;H<D.length;H++){Wtf.getCmp("approve"+D[H][1]).disable();Wtf.getCmp("reject"+D[H][1]).disable()}if(E.length>0){this.userid=E[0].data["userid"];this.sessionid=E[0].data["sessionid"];this.username=E[0].data["Student Name"];G=E[0].get("userid");for(var H=J;H<D.length;H++){F.push(E[0].get(D[H][1]))}}for(var B=0;B<E.length-1;B++){if(E[B].get("userid")==E[B+1].get("userid")){G=E[B].get("userid")}else{G="";break}for(var H=J;H<D.length;H++){if(E[B].get(D[H][1])!=E[B+1].get(D[H][1])){F[H-J]=""}}}if(G!=""){for(var B=0;B<F.length;B++){if(F[B]!=""){if(F[B]=="Waiting for withdrawal approval from bursar"){Wtf.getCmp("approve"+D[B+J][1]).enable();Wtf.getCmp("reject"+D[B+J][1]).enable()}}}}},loadGrid:function(){this.moduleStore.load({params:{userid:loginid}})}});Wtf.schRefund=function(A){Wtf.apply(this,A);this.layout="fit",this.sm=new Wtf.grid.CheckboxSelectionModel();this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.cmodel1=new Wtf.grid.ColumnModel([this.sm,{header:"Fullname",width:150,dataIndex:"name",hidden:true},{header:"Fee",width:150,dataIndex:"fee"},{header:"Reason",width:150,dataIndex:"reason"},{header:"Refund amount",width:100,dataIndex:"refundamount",align:"right",renderer:function(B){return Wtf.precisionDecimalValue(B)}},{header:"Currency",width:50,dataIndex:"currency"}]);this.cmodel1.defaultSortable=true;this.moduleRecord=Wtf.data.Record.create([{name:"username",type:"string"},{name:"name",type:"string"},{name:"refundamount",type:"float"},{name:"newamountdue",type:"float"},{name:"dueflag",type:"string"},{name:"invoiceid",type:"string"},{name:"feetype",type:"int"},{name:"fee",type:"string"},{name:"reason",type:"string"},{name:"userid",type:"string"},{name:"tid",type:"string"},{name:"sponsor",type:"string"},{name:"currency",type:"string"},{name:"programid",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.moduleRecord);this.moduleStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.moduleReader,sortInfo:{field:"name",direction:"ASC"},groupField:"name"});this.simstore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:this.moduleReader,baseParams:{type:60,refundtype:this.refundtype}});this.grid1=new Wtf.grid.GridPanel({ds:this.moduleStore,cm:this.cmodel1,border:false,view:this.groupingView,trackMouseOver:true,sm:this.sm,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.regBttn=new Wtf.Toolbar.Button({text:"Approve",tooltip:"Approve selected request",id:"BtnNew"+this.id,scope:this,disabled:true});this.deferBttn=new Wtf.Toolbar.Button({text:"Reject",tooltip:"Accept payment for selected module",id:"defNew"+this.id,scope:this,disabled:true});this.items=[this.grid1];this.bbar=new Wtf.PagingSearchToolbar({pageSize:15,searchField:this.quickPanelSearch,store:this.moduleStore,displayInfo:false,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:this.pP=new Wtf.common.pPageSize({})});this.tbar=["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"username"}),this.regBttn,this.deferBttn];this.regBttn.on("click",this.handleApprove,this);this.grid1.getSelectionModel().on("selectionchange",this.disableBttn,this);this.simstore.on("load",this.handleStoreLoad,this);this.moduleStore.on("datachanged",function(){this.quickPanelSearch.setPage(this.pP.combo.value)},this)};Wtf.extend(Wtf.schRefund,Wtf.Panel,{onRender:function(B,A){Wtf.schRefund.superclass.onRender.call(this,B,A);this.simstore.load();this.grid1.on("sortchange",function(C,D){this.grid1.getStore().groupBy(D.field)},this)},handleStoreLoad:function(A,C,B){this.quickPanelSearch.StorageChanged(A);this.moduleStore.proxy.data=this.moduleReader.jsonData;this.moduleStore.load({params:{start:0,limit:this.pP.combo.value}})},disableBttn:function(A){if(A.getSelections().length>0){this.regBttn.enable();this.deferBttn.enable()}else{this.regBttn.disable();this.deferBttn.disable()}},showWindow:function(C){var A=this.grid1.getSelectionModel().getSelections();var B="";if(A[0].data["sponsor"]!=""){B=A[0].data["sponsor"]}else{B=A[0].data["username"]}if(C=="Refund"){this.newissuerefund=new Wtf.IssueRefund({id:"IssueRef"+this.id,customerId:A[0].data["userid"],customerName:B,refNo:"",creditAmount:Wtf.precisionDecimalValue(A[0].data["refundamount"]),receivableAccid:17,title:"Issue Refund",closable:true,border:false,modal:true,width:340,height:400,iconCls:"win",layout:"fit",fullrefund:"true",resizable:false,programid:A[0].data["programid"]});this.newissuerefund.show();this.newissuerefund.on("closeform",function(D){Wtf.Ajax.requestEx({url:"jspfiles/admin/acastructure.jsp",method:"POST",params:{type:63,invoiceid:A[0].data["invoiceid"],dueflag:A[0].data["dueflag"],newAmtDue:A[0].data["newamountdue"],tid:A[0].data["tid"]}},this,function(F,E){this.simstore.load({params:{type:60,refundtype:this.refundtype}})},function(F,E){})},this)}else{if(C=="Credit"){this.newcreditnote=new Wtf.CreditNote({id:"CreNote"+this.id,customerId:A[0].data["userid"],customerName:B,refNo:"",creditAmount:Wtf.precisionDecimalValue(A[0].data["refundamount"]),receivableAccid:17,title:"Issue Refund",closable:true,border:false,modal:true,width:340,height:400,iconCls:"win",layout:"fit",fullrefund:"true",resizable:false,programid:A[0].data["programid"]});this.newcreditnote.show();this.newcreditnote.on("closeform",function(D){Wtf.Ajax.requestEx({url:"jspfiles/admin/acastructure.jsp",method:"POST",params:{type:63,invoiceid:A[0].data["invoiceid"],dueflag:A[0].data["dueflag"],newAmtDue:A[0].data["newamountdue"],tid:A[0].data["tid"]}},this,function(F,E){this.simstore.load({params:{type:60,refundtype:this.refundtype}})},function(F,E){})},this)}}},handleApprove:function(A,B){var C=A.id.substring(7,A.id.length);this.msgbox=new Wtf.Window({id:"msgbox"+this.id,title:"Withdrawn",closable:true,border:false,modal:true,height:280,width:350,layout:"fit",resizable:false,items:[{border:false,layout:"border",items:[{region:"north",id:"north1"+this.id,border:false,height:50,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"This credit note or refund has a remaining balance which you may use."}]},{region:"center",id:"center1"+this.id,border:false,height:20,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"What would you like to do with this withdrawn amount?"}]},{region:"south",id:"south1"+this.id,border:false,height:110,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:2px 13px 0px 43px;",items:[this.check1=new Wtf.form.Radio({hideLabel:true,boxLabel:"Generate credit note",name:"chck"+this.id,id:"check1"+this.id,checked:true}),this.check2=new Wtf.form.Radio({hideLabel:true,boxLabel:"Give a refund",name:"chck"+this.id,id:"check2"+this.id}),this.check3=new Wtf.form.Radio({hideLabel:true,boxLabel:"No refund",name:"chck"+this.id,id:"check3"+this.id})]}]}]}],buttonAlign:"center",buttons:[{text:"OK",handler:function(){var D=null;if(this.check2.getValue()){D="Refund"}if(this.check1.getValue()){D="Credit"}if(this.check3.getValue()){D="Norefund";this.withdrawwithoutrefundex(D,C)}Wtf.getCmp("msgbox"+this.id).close();if(D!="Norefund"){this.showWindow(D)}},scope:this},{text:"Cancel",handler:function(){Wtf.getCmp("msgbox"+this.id).close()},scope:this}]}).show()},withdrawwithoutrefundex:function(B,C){var A=this.grid1.getSelectionModel().getSelections();Wtf.Ajax.requestEx({url:"jspfiles/admin/acastructure.jsp",method:"POST",params:{type:63,invoiceid:A[0].data["invoiceid"],dueflag:A[0].data["dueflag"],newAmtDue:A[0].data["newamountdue"],tid:A[0].data["tid"]}},this,function(E,D){Wtf.Msg.alert("Success","Your request for withdrawal approved.");this.simstore.load({params:{type:60,refundtype:this.refundtype}})},function(E,D){})}});Wtf.WtfCourseWithBursar=function(A){Wtf.apply(this,A);this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.cmodel1=new Wtf.grid.ColumnModel([this.sm,{header:"Student Name",width:150,dataIndex:"username"},{header:"Course Name",width:150,dataIndex:"coursename"},{header:"Course Code",width:150,dataIndex:"coursecode"},{header:"Program Name",width:100,dataIndex:"programname"},{header:"Status",width:100,dataIndex:"status",renderer:function(F,D,B,G,E,C){if(F=="7"){return"<lable style = 'color : red;'>Applied for registration after due date</lable>"}else{if(F=="17"){return"Waiting for withdrawal approval from bursar"}else{if(F=="8"){return"Rejected"}else{if(F=="18"){return"Withdrawn"}else{if(F=="10"){return"<lable style = 'color : red;'>Applied for withdrawal after due date</lable>"}}}}}}}]);this.cmodel1.defaultSortable=true;this.moduleRecord=Wtf.data.Record.create([{name:"username",type:"string"},{name:"coursename",type:"string"},{name:"coursecode",type:"string"},{name:"status",type:"string"},{name:"userid",type:"string"},{name:"sessionid",type:"string"},{name:"programtype",type:"string"},{name:"courseid",type:"string"},{name:"invoicenum",type:"string"},{name:"amount",type:"string"},{name:"programid",type:"string"},{name:"programname",type:"string"},{name:"provstatus",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.moduleRecord);this.moduleStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader,sortInfo:{field:"username",direction:"ASC"},groupField:"username"});this.grid1=new Wtf.grid.GridPanel({ds:this.moduleStore,cm:this.cmodel1,border:false,view:this.groupingView,trackMouseOver:true,sm:this.sm,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.regBttn=new Wtf.Toolbar.Button({text:"Approve",tooltip:"Approve selected request",id:"BtnNew"+this.id,scope:this,disabled:true});this.rejectBttn=new Wtf.Toolbar.Button({text:"Reject",tooltip:"Reject selected request",id:"rejeNew"+this.id,scope:this,disabled:true});this.regBttn.on("click",this.handleRegister,this);this.rejectBttn.on("click",this.handleReject,this);Wtf.WtfCourseWithBursar.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"coursename"}),this.regBttn,this.rejectBttn],bbar:new Wtf.PagingSearchToolbar({pageSize:15,searchField:this.quickPanelSearch,store:this.moduleStore,displayInfo:false,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:this.pP=new Wtf.common.pPageSize({})}),items:[this.grid1]});this.on("render",this.handleRender,this);this.grid1.on("cellclick",this.clickHandle,this);this.moduleStore.on("load",this.handleStoreLoad,this);this.moduleStore.on("datachanged",function(){this.quickPanelSearch.setPage(this.pP.combo.value)},this)};Wtf.extend(Wtf.WtfCourseWithBursar,Wtf.Panel,{handleRender:function(A){this.moduleStore.baseParams={type:"coursewithdrawalapp"};this.moduleStore.load({params:{start:0,limit:15}});this.grid1.on("sortchange",function(B,C){this.grid1.getStore().groupBy(C.field)},this)},handleStoreLoad:function(A,C,B){this.quickPanelSearch.StorageChanged(A)},clickHandle:function(D,G,C,F){this.moduleid=this.moduleStore.getAt(G).data["courseid"];this.modulename=this.moduleStore.getAt(G).data["coursename"];this.userid=this.moduleStore.getAt(G).data["userid"];this.sessionid=this.moduleStore.getAt(G).data["sessionid"];var A=this.grid1.getSelectionModel().getSelections();if(A.length>1&&A[A.length-2].data["userid"]==this.moduleStore.getAt(G).data["userid"]){if(A[A.length-2].data["status"]!=this.moduleStore.getAt(G).data["status"]){var B=this.grid1.getSelectionModel().getSelections();this.grid1.getSelectionModel().clearSelections();this.regBttn.disable();this.rejectBttn.disable();var E=[];E[0]=B[B.length-1];this.grid1.getSelectionModel().selectRecords(E)}}else{if(A.length>1&&A[A.length-2].data["userid"]!=this.moduleStore.getAt(G).data["userid"]){var B=this.grid1.getSelectionModel().getSelections();this.grid1.getSelectionModel().clearSelections();this.regBttn.disable();this.rejectBttn.disable();var E=[];E[0]=B[B.length-1];this.grid1.getSelectionModel().selectRecords(E)}}this.status=this.moduleStore.getAt(G).data["status"];if(this.status=="17"){this.regBttn.enable();this.rejectBttn.enable()}else{if(this.status=="10"){this.regBttn.enable();this.rejectBttn.enable()}else{this.regBttn.disable();this.rejectBttn.disable()}}if(A.length==0){this.regBttn.disable();this.rejectBttn.disable()}},handleRegister:function(B,G){var E=this.grid1.getSelectionModel().getSelections();var H="";if(this.grid1.getSelectionModel().getSelections().length>0){if(E[0].data["amount"]=="0"){var A=this.grid1.getSelectionModel().getSelections().length;for(var D=0;D<E.length;D++){H+=E[D].data["courseid"];if(D!=E.length-1){H+=","}}var I="Course";var F="updateUserTutStatus";Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:E[0].data["userid"],moduleid:H,sessionid:E[0].data["sessionid"],classtypeid:I,type:F,operation:"approvewithdrawal",msg:"Your request for withdrawal approved",status:"18"},method:"POST"},this,function(J,K){Wtf.Msg.alert("Alert","The selected module has been withdrawn successfully.");this.modulestore.reload()},function(K,J){Wtf.Msg.alert("Error","Error connecting to the server.")})}else{var C="Course";this.msgbox=new Wtf.Window({id:"msgbox"+this.id,title:"Withdrawn",closable:true,border:false,modal:true,height:280,width:350,layout:"fit",resizable:false,items:[{border:false,layout:"border",items:[{region:"north",id:"north1"+this.id,border:false,height:50,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"This credit note or refund has a remaining balance which you may use."}]},{region:"center",id:"center1"+this.id,border:false,height:20,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"What would you like to do with this withdrawn amount?"}]},{region:"south",id:"south1"+this.id,border:false,height:110,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:2px 13px 0px 43px;",items:[this.check1=new Wtf.form.Radio({hideLabel:true,boxLabel:"Generate credit note",name:"chck"+this.id,id:"check1"+this.id,checked:true}),this.check2=new Wtf.form.Radio({hideLabel:true,boxLabel:"Give a refund",name:"chck"+this.id,id:"check2"+this.id}),this.check3=new Wtf.form.Radio({hideLabel:true,boxLabel:"No refund",name:"chck"+this.id,id:"check3"+this.id})]}]}]}],buttonAlign:"center",buttons:[{text:"OK",handler:function(){var J=null;if(this.check2.getValue()){J="Refund"}if(this.check1.getValue()){J="Credit"}if(this.check3.getValue()){J="Norefund";this.withdrawwithoutrefundco(J,C)}Wtf.getCmp("msgbox"+this.id).close();if(J!="Norefund"){this.requestTocheckFullrefund(J,C)}},scope:this},{text:"Cancel",handler:function(){Wtf.getCmp("msgbox"+this.id).close()},scope:this}]}).show()}}this.rejectBttn.disable();this.regBttn.disable()},withdrawwithoutrefundco:function(checkFlag,classtypeid){var selectedRecord=this.grid1.getSelectionModel().getSelections();Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{classtypeid:classtypeid,moduleid:selectedRecord[0].data["courseid"],type:"updateUserTutStatus",sessionid:selectedRecord[0].data["sessionid"],userid:selectedRecord[0].data["userid"],msg:"Your request for withdrawal approved",status:"18"},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");Wtf.Msg.alert("Success","The selected course has been withdrawn successfully.");this.showWindow(checkFlag,classtypeid,retstatus.success);this.moduleStore.load({params:{userid:loginid,start:0,limit:15}})},function(resp,req){})},requestTocheckFullrefund:function(checkFlag,classtypeid){var selectedRecord=this.grid1.getSelectionModel().getSelections();Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{classtypeid:classtypeid,moduleid:selectedRecord[0].data["courseid"],type:"checkforAddDropPeriod",userid:selectedRecord[0].data["userid"],mode:classtypeid},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");this.showWindow(checkFlag,classtypeid,retstatus.success)},function(resp,req){})},showWindow:function(A,C,F){var I="updateUserTutStatus";var J=new Date();var D=J.format("Y-m-d H:i:s");var K="RF"+J.format("y")+"/"+Math.floor(Math.random()*10001);var E=this.grid1.getSelectionModel().getSelections();var G="";var H=0;for(var B=0;B<E.length;B++){G+=E[B].data["courseid"];H=E[B].data["amount"];if(B!=E.length-1){G+=","}}H=Wtf.precisionDecimalValue(H);if(A=="Refund"){this.newissuerefund=new Wtf.IssueRefund({id:"IssueRef"+this.id,customerId:E[0].data["userid"],customerName:E[0].data["username"],sessionid:E[0].data["sessionid"],refNo:K,creditAmount:H,moduleid:G,receivableAccid:17,type:I,classtypeid:C,title:"Issue Refund",closable:true,border:false,modal:true,width:340,height:400,iconCls:"win",layout:"fit",fullrefund:F,resizable:false,programid:E[0].data["programid"]});this.newissuerefund.show();this.newissuerefund.on("closeform",function(L){this.moduleStore.load({params:{userid:loginid,start:0,limit:15}})},this)}else{if(A=="Credit"){this.newcreditnote=new Wtf.CreditNote({id:"CreNote"+this.id,customerId:E[0].data["userid"],sessionid:E[0].data["sessionid"],customerName:E[0].data["username"],refNo:K,type:I,classtypeid:C,creditAmount:H,moduleid:G,receivableAccid:17,title:"Issue Refund",closable:true,border:false,modal:true,width:340,height:400,iconCls:"win",layout:"fit",fullrefund:F,resizable:false,programid:E[0].data["programid"]});this.newcreditnote.show();this.newcreditnote.on("closeform",function(L){this.moduleStore.load({params:{userid:loginid,start:0,limit:15}})},this)}}this.rejectBttn.disable();this.regBttn.disable()},handleReject:function(){if(this.grid1.getSelectionModel().getSelections().length>0){var classtypeid="Course";var msg="Your request for course withdrawal rejected";var status="1";var provstatus=this.grid1.getSelectionModel().getSelected().get("provstatus");var selectedRecord=this.grid1.getSelectionModel().getSelections();var idstr="";for(var ctr=0;ctr<selectedRecord.length;ctr++){idstr+=selectedRecord[ctr].data["courseid"];if(ctr!=selectedRecord.length-1){idstr+=","}}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:selectedRecord[0].data["userid"],moduleid:idstr,sessionid:this.sessionid,type:"updateUserTutStatus",classtypeid:classtypeid,status:"1",reqfor:"withdrawal",msg:msg},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");if(retstatus.success){msgBoxShow(["Update Status","Status updated Successfully"],Wtf.MessageBox.INFO);this.moduleStore.load({params:{start:0,limit:15}})}else{msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)}},function(result,req){msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)})}this.rejectBttn.disable();this.regBttn.disable()}});Wtf.WtfProgramWithdraw=function(A){Wtf.apply(this,A);this.sm1=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.cmodel1=new Wtf.grid.ColumnModel([this.sm1,{header:"Student Name",width:150,dataIndex:"username"},{header:"Student ID",width:150,dataIndex:"metricno"},{header:"E-mail",width:150,dataIndex:"emailid"},{header:"Program Name",width:150,dataIndex:"programname"},{header:"Application Status",width:150,dataIndex:"status",renderer:function(F,D,B,G,E,C){if(F=="9"){return"Pending ASAD Approval"}else{if(F=="17"){return"Pending Bursary Approval"}else{if(F=="18"){return"Withdrawn"}else{if(F=="50"){return"Pending KMC Approval"}else{if(F=="22"){return"Pending Bursary Approval"}else{if(F=="23"){return"Dismissed"}}}}}}}},{header:"Status Modified on",width:150,dataIndex:"modifiedon"}]);this.cmodel1.defaultSortable=true;this.studRecord=Wtf.data.Record.create([{name:"userid",type:"string"},{name:"username",type:"string"},{name:"emailid",type:"string"},{name:"status",type:"string"},{name:"programname",type:"string"},{name:"programid",type:"string"},{name:"modifiedon",type:"string"},{name:"invoicenum",type:"string"},{name:"metricno",type:"string"},{name:"amount",type:"string"}]);this.studReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.studRecord);this.studStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.studReader});this.regBttn=new Wtf.Toolbar.Button({text:"Approve",tooltip:"Approve selected waiting request",id:"AppNew"+this.id,scope:this,disabled:true});this.rejectBttn=new Wtf.Toolbar.Button({text:"Reject",tooltip:"Reject selected course",id:"rejNew"+this.id,scope:this,disabled:true});this.studGrid=new Wtf.grid.GridPanel({border:true,store:this.studStore,cm:this.cmodel1,sm:this.sm1,viewConfig:{forceFit:true},loadMask:{msg:"Loading ..."}});this.regBttn=new Wtf.Toolbar.Button({text:"Approve",tooltip:"Approve selected request",id:"BtnNew"+this.id,scope:this,disabled:true});this.rejectBttn=new Wtf.Toolbar.Button({text:"Reject",tooltip:"Reject selected request",id:"rejeNew"+this.id,scope:this,disabled:true});this.RefundAmtBttn=new Wtf.Toolbar.Button({text:"Refund Amount",tooltip:"View total refund amount for selected student",id:"refundNew"+this.id,scope:this,disabled:true});Wtf.WtfProgramWithdraw.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"programname"}),this.regBttn,this.rejectBttn,this.RefundAmtBttn],items:[this.studGrid],bbar:new Wtf.PagingSearchToolbar({pageSize:15,searchField:this.quickPanelSearch,store:this.studStore,displayInfo:false,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:this.pP=new Wtf.common.pPageSize({})})});this.studStore.on("load",function(B,D,C){this.quickPanelSearch.StorageChanged(B)},this);this.studStore.on("datachanged",function(){this.quickPanelSearch.setPage(this.pP.combo.value)},this);this.on("render",this.handleRender,this);this.studGrid.on("cellclick",this.clickHandle,this);this.studGrid.on("rowdblclick",this.withdrawalInfo,this);this.regBttn.on("click",this.handleRegister,this);this.rejectBttn.on("click",this.handleReject,this);this.RefundAmtBttn.on("click",this.withdrawalInfo,this)};Wtf.extend(Wtf.WtfProgramWithdraw,Wtf.Panel,{handleRender:function(A){this.studStore.baseParams={type:"programWithdrawlist",checkWith:this.checkWith};this.studStore.load({params:{start:0,limit:25}})},clickHandle:function(B,D,A,C){this.userid=this.studStore.getAt(D).data["userid"];this.programid=this.studStore.getAt(D).data["programid"];if(this.studGrid.getSelectionModel().getSelections().length>0&&(this.studStore.getAt(D).data["status"]=="17"||this.studStore.getAt(D).data["status"]=="22")){this.regBttn.enable();this.rejectBttn.enable();this.RefundAmtBttn.enable()}else{this.regBttn.disable();this.rejectBttn.disable();this.RefundAmtBttn.disable()}},handleRegister:function(A,B){if(this.studGrid.getSelectionModel().getSelections().length>0){var C="Program";this.msgbox=new Wtf.Window({id:"msgbox"+this.id,title:"Withdrawn",closable:true,border:false,modal:true,height:280,width:350,layout:"fit",resizable:false,items:[{border:false,layout:"border",items:[{region:"north",id:"north1"+this.id,border:false,height:50,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"This credit note or refund has a remaining balance which you may use."}]},{region:"center",id:"center1"+this.id,border:false,height:20,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"What would you like to do with this withdrawn amount?"}]},{region:"south",id:"south1"+this.id,border:false,height:110,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:2px 13px 0px 43px;",items:[this.check1=new Wtf.form.Radio({hideLabel:true,boxLabel:"Generate credit note",name:"chck"+this.id,id:"check1"+this.id,checked:true}),this.check2=new Wtf.form.Radio({hideLabel:true,boxLabel:"Give a refund",name:"chck"+this.id,id:"check2"+this.id}),this.check3=new Wtf.form.Radio({hideLabel:true,boxLabel:"No refund",name:"chck"+this.id,id:"check3"+this.id})]}]}]}],buttonAlign:"center",buttons:[{text:"OK",handler:function(){var D=null;if(this.check2.getValue()){D="Refund"}if(this.check1.getValue()){D="Credit"}if(this.check3.getValue()){D="Norefund";this.withdrawwithoutrefundpro(D,C)}Wtf.getCmp("msgbox"+this.id).close();if(D!="Norefund"){this.showWindow(D,C,"false")}},scope:this},{text:"Cancel",handler:function(){Wtf.getCmp("msgbox"+this.id).close()},scope:this}]}).show()}this.rejectBttn.disable();this.regBttn.disable();this.RefundAmtBttn.disable()},withdrawwithoutrefundpro:function(checkFlag,classtypeid){var selectedRecord=this.studGrid.getSelectionModel().getSelections();var status="18";var msgWith="Your request for withdrawal approved";if(this.checkWith=="proDism"){status="23";msgWith="You request for student dismissal approved"}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{classtypeid:classtypeid,moduleid:selectedRecord[0].data["programid"],type:"updateUserTutStatus",sessionid:selectedRecord[0].data["sessionid"],userid:selectedRecord[0].data["userid"],msg:msgWith,status:status},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");Wtf.Msg.alert("Success","Program has been withdrawn successfully.");this.showWindow(checkFlag,classtypeid,retstatus.success);this.studStore.load({params:{start:0,limit:25}})},function(resp,req){})},requestTocheckFullrefund:function(checkFlag,classtypeid){var selectedRecord=this.studGrid.getSelectionModel().getSelections();Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{classtypeid:classtypeid,moduleid:selectedRecord[0].data["programid"],type:"checkforAddDropPeriod",userid:selectedRecord[0].data["userid"],mode:classtypeid},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");this.showWindow(checkFlag,classtypeid,retstatus.success)},function(resp,req){})},showWindow:function(A,C,F){var I="updateUserTutStatus";var J=new Date();var D=J.format("Y-m-d H:i:s");var K="RF"+J.format("y")+"/"+Math.floor(Math.random()*10001);var E=this.studGrid.getSelectionModel().getSelections();var G="";var H=0;for(var B=0;B<E.length;B++){G+=E[B].data["programid"];H=E[B].data["amount"];if(B!=E.length-1){G+=","}}H=Wtf.precisionDecimalValue(H);if(A=="Refund"){this.newissuerefund=new Wtf.IssueRefund({id:"IssueRef"+this.id,customerId:E[0].data["userid"],customerName:E[0].data["username"],sessionid:E[0].data["sessionid"],refNo:K,creditAmount:H,moduleid:G,receivableAccid:17,type:I,classtypeid:C,title:"Issue Refund",closable:true,border:false,modal:true,width:340,height:400,iconCls:"win",layout:"fit",fullrefund:F,resizable:false,programid:E[0].data["programid"]});this.newissuerefund.show();this.newissuerefund.on("closeform",function(L){this.studStore.load({params:{start:0,limit:25}})},this)}else{if(A=="Credit"){this.newcreditnote=new Wtf.CreditNote({id:"CreNote"+this.id,customerId:E[0].data["userid"],sessionid:E[0].data["sessionid"],customerName:E[0].data["username"],refNo:K,type:I,classtypeid:C,creditAmount:H,moduleid:G,receivableAccid:17,title:"Issue Refund",closable:true,border:false,modal:true,width:340,height:400,iconCls:"win",layout:"fit",fullrefund:F,resizable:false,programid:E[0].data["programid"]});this.newcreditnote.show();this.newcreditnote.on("closeform",function(L){this.studStore.load({params:{start:0,limit:25}})},this)}}this.rejectBttn.disable();this.regBttn.disable();this.RefundAmtBttn.disable()},handleReject:function(){if(this.studGrid.getSelectionModel().getSelections().length>0){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{type:"programWithdrawReq",userid:this.studGrid.selModel.getSelected().get("userid"),programid:this.studGrid.selModel.getSelected().get("programid"),status:"1"},method:"POST"},this,function(A,B){msgBoxShow(["Status update","Status update successfully"],Wtf.MessageBox.INFO);this.studStore.load({params:{start:0,limit:25}});this.rejectBttn.disable()},function(B,A){})}this.rejectBttn.disable();this.regBttn.disable();this.RefundAmtBttn.disable()},withdrawalInfo:function(){if(this.studGrid.selModel.getSelected().get("status")=="17"){this.newProgramReg=new Wtf.userProgramWithInfo({id:"regidate"+this.id,width:500,height:400,resizable:false,layout:"fit",userid:this.studGrid.selModel.getSelected().get("userid"),programid:this.studGrid.selModel.getSelected().get("programid")});this.newProgramReg.show()}}});Wtf.userProgramWithInfo=function(A){Wtf.apply(this,A);Wtf.userProgramWithInfo.superclass.constructor.call(this,A)};Wtf.extend(Wtf.userProgramWithInfo,Wtf.Window,{initComponent:function(){programId=null;type=null;Wtf.userProgramWithInfo.superclass.initComponent.call(this);this.addEvents({"closeform":true})},onRender:function(A){Wtf.userProgramWithInfo.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask));this.dsNewInv=new Wtf.data.Store({baseParams:{type:"userRecordOnProgWithdraw",userid:this.userid,programid:this.programid},url:"jspfiles/newCourse.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["courseid","moduleid","name","feename","amount","totamount"])});this.dsNewInv.load();this.cmNewInv=new Wtf.grid.ColumnModel([{header:"Name",dataIndex:"name"},{header:"Fee For",dataIndex:"feename"},{header:"Invoice Amount",dataIndex:"totamount"},{header:"Amount Paid",dataIndex:"amount",renderer:function(B){return Wtf.precisionDecimalValue(B)}}]);this.newapplycredits=new Wtf.Panel({frame:true,border:false,layout:"fit",items:[{border:false,region:"center",layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:"<div style = 'width:100%;height:100%;position:relative;float:left;'><div style='float:left;height:100%;width:auto;position:relative;'><img src = 'images/createcommunity.png' style = 'width:40px;height:52px;margin:5px 5px 5px 5px;'></img></div><div style='float:left;height:100%;width:80%;position:relative;'><div style='font-size:12px;font-style:bold;float:left;margin:20px 0px 0px 10px;width:100%;position:relative;'><b>Total Refund Amount</b></div><div style='font-size:10px;float:left;margin:15px 0px 0px 10px;width:100%;position:relative;'>Total Registered Items and Refund Amount</div></div></div>"},{border:false,region:"center",bodyStyle:"background:#f1f1f1;font-size:10px;",layout:"border",items:[{region:"center",id:"center"+this.id,height:150,border:false,layout:"fit",items:this.GridList=new Wtf.AccGridComp({id:"accGridMList"+this.id,layout:"column",ds:this.dsNewInv,cm:this.cmNewInv})},{region:"south",id:"south"+this.id,border:false}]}]}],buttonAlign:"right",buttons:[{anchor:"90%",id:"close",text:"Close",scope:this,handler:function(){this.close()}}]});this.add(this.newapplycredits)}});AcceptOrRejectGrade=function(F,A,E,D){var B="";var C="";A.each(function(G){B+=G.get("userid")+",";C+=G.get("total")+","});Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",waitMsg:"Loading..",params:{mode:D,mid:E,ids:B,total:C,uid:loginid},scope:this,success:function(G,H){A.removeAll();msgBoxShow([F,"Grade status updated."],Wtf.MessageBox.INFO);A.reload()},failure:function(){if(D==5){msgBoxShow(["Error","Error occurred while accepting the grades. Please try again later."],Wtf.MessageBox.ERROR)}else{msgBoxShow(["Error","Error occurred while rejecting the grades. Please try again later."],Wtf.MessageBox.ERROR)}}})};ShowReport=function(c,X,Q,V,H,D,L){var G=Wtf.getCmp(c+Q);if(G){X.setActiveTab(G);return }var P="";var a=new Wtf.data.KwlJsonReader({root:"data",successProperty:"success",totalProperty:"totalRows"},[{name:"name",mapping:"name"},{name:"studid",mapping:"studid"},{name:"userid",mapping:"userid"},{name:"grade",mapping:"grade"},{name:"total",mapping:"total"},{name:"status",mapping:"status"},{name:"hodname",mapping:"hodname"},{name:"hopname",mapping:"hopname"},{name:"mode",mapping:"mode"},{name:"fundingtype",mapping:"fundingtype"},{name:"gradeStr",mapping:"gradeStr"},{name:"code",mapping:"code"}]);var U=new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"});var C=new Wtf.data.Store({proxy:U,reader:a,baseParams:{type:"aeercreport",ptype:H,moduleid:V,flag:true,hodFlag:(D||L)}});var Z=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Mode",width:100,sortable:true,dataIndex:"mode"},{header:"Funding Type",width:100,sortable:false,hidden:true,dataIndex:"fundingtype"},{header:"Scholarship",width:100,hidden:true,sortable:false,dataIndex:"code"},{header:"Name",width:100,sortable:true,dataIndex:"name"},{header:"Student ID",width:100,sortable:true,align:"center",dataIndex:"studid"},{header:"Rounded Marks",width:100,align:"center",sortable:false,dataIndex:"total"},{header:"Grade",width:100,align:"center",sortable:true,dataIndex:"grade"}]);var S=new Wtf.grid.GridPanel({layout:"fit",region:"center",id:"center"+c+Q,store:C,border:false,cm:Z,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true},sm:new Wtf.grid.RowSelectionModel({singleSelect:true})});var N=new Wtf.Template('<div style="margin-left:{size}px;margin-top:5px">','<div>HOD: {hod} <label style="margin-left:20px">HOP: {hop}</label></div>',"</div>");var Y=new Wtf.PagingToolbar({pageSize:300,displayInfo:true,displayMsg:"{0} - {1} of {2}",emptyMsg:"No results to display",hidden:(D||L),store:C,items:["-",this.csv1=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){var d=Wtf.urlEncode({type:"reports",dtype:"attachment",report:c,flag:false,ptype:H,moduleid:V,footer:P,hodFlag:false,mode:34});setDldUrl("ReportsServlet.jsp?"+d)}})]});var B=new Wtf.data.SimpleStore({fields:["grade","number","per"]});var E=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Grade",width:100,sortable:true,align:"center",dataIndex:"grade"},{header:"Mode",width:100,hidden:true,align:"center",dataIndex:"mode"},{header:"Number",width:100,align:"center",dataIndex:"number"},{header:"Percentage %",width:100,align:"center",dataIndex:"per"}]);var R=new Wtf.Toolbar.Button({tooltip:"Verify Grades",text:"Approve",disabled:C.getCount()==0,hidden:isRoleGroup("4"),handler:function(d,f){Wtf.MessageBox.confirm("Accept Grades","Are you sure you want to accept grades of all students?",function(e){if(e=="yes"){new AcceptOrRejectGrade("Accept Grades",C,V,5);R.disable();W.disable()}},this)}});var W=new Wtf.Toolbar.Button({tooltip:"Reject Grades",disabled:C.getCount()==0,text:"Reject",hidden:isRoleGroup("4"),handler:function(d,f){Wtf.MessageBox.confirm("Reject Grades","Are you sure you want to reject grades of all students?",function(e){if(e=="yes"){new AcceptOrRejectGrade("Reject Grades",C,V,6);W.disable();R.disable()}},this)}});var F=new Wtf.grid.GridPanel({layout:"fit",region:"west",split:true,width:"50%",store:B,title:"Analysis",id:"result"+c+Q,cm:E,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true},bbar:[R,W,{xtype:"tbbutton",tooltip:"Show GradeBook",text:"View Details",hidden:(isRoleGroup("4"))?true:false,handler:function(){var e=Wtf.getCmp("gradebk"+Q);if(!e){var d=new Wtf.course.gradeBook({title:"Grade Book",closable:true,modulerunid:V,id:"gradebk"+Q,HOD:Wtf.isHoD(),HOP:Wtf.isHoP()});X.add(d);X.setActiveTab(d)}else{X.setActiveTab(e)}}}]});var J=new Wtf.Panel({title:c,id:c+Q,closable:true,border:false,iconCls:getTabIconCls(Wtf.etype.report),layout:"border",defaults:{border:false,split:true},items:[{region:"north",title:c,height:350,layout:"border",items:[S,{region:"south",height:22,id:"footer"+Q,hidden:c=="PRE-AEERC Report"?true:(D||L)}],bbar:Y},{region:"center",layout:"border",items:[F,{layout:"fit",region:"center",id:"graph"+Q,bodyStyle:"background:white;",title:"Result Analysis Graph"}]}]});X.add(J);X.activate(J);X.doLayout();X.setActiveTab(J);C.on("load",b);C.load({params:{start:0,limit:300}});function A(e,d,f){Wtf.MessageBox.alert("Error Message","Please contact support with the following: Status: "+d.status+", Status Text: "+d.statusText)}function I(n,l,d,g){var f=Wtf.util.JSON.decode(d.responseText);var e="Error loading data.";if(f.data.success){e="The data returned from the server is in the wrong format. Please notify support with the following information: "+d.responseText}else{e=f.data.message}Wtf.MessageBox.alert("Error Message",e)}function M(d,f,e){}function K(){if(D){C.filterBy(function(e){var d=e.get("status");if(d==1||d==7){return true}})}if(L){C.filterBy(function(e){var d=e.get("status");if(d==1||d==2){return true}})}if(C.getCount()==0){R.disable();W.disable()}else{R.enable();W.enable()}}function T(){if(Wtf.getCmp("graph")){Wtf.getCmp("graph").destroy()}var f="";var g="";B.each(function(l){if(l.get("per")!=0){g+=l.get("per")+",";f+=l.get("grade").replace("+","%2b")+"["+l.get("per")+"%]|"}});g=g.substring(0,g.length-1);f=f.substring(0,f.length-1);var e="http://chart.apis.google.com/chart?chs=400x180&chd=t:"+g+"&cht=p3&chl="+f+"&chco=3e85e5,fcb441,e0400a";var d=Wtf.getCmp("graph"+Q);d.add({autoScroll:true,split:true,layout:"fit",id:"chart"+Q,border:false,html:"<div><img style ='padding:50px' src="+e+"></img></div>"});d.doLayout()}function O(){Wtf.Ajax.request({url:"jspfiles/report.jsp",method:"POST",params:{type:"getAEERCgrades",ptype:H,moduleid:V,hodFlag:(D||L)},scope:this,success:function(d,g){var l=Wtf.util.JSON.decode(d.responseText);var f=new Wtf.data.Record.create([{name:"grade"},{name:"number"},{name:"per"}]);for(var e=0;e<l.data.length;e++){var n=new f({grade:l.data[e].grade,number:l.data[e].number,per:l.data[e].per});B.add(n);T()}},failure:function(){msgBoxShow(["Error","Error. Please try again later."],Wtf.MessageBox.ERROR)}})}function b(f,u,s){B.removeAll();O();var g=C.getCount();if(!isRoleGroup("4")&&g!=0){R.enable();W.enable()}if(c=="AEERC Report"||(D||L)&&g!=0){var l=0;var d=0;C.each(function(v){if(v.get("status")==2||v.get("status")==8){l++}if(v.get("status")==7||v.get("status")==8){d++}},this);var e=C.findBy(function(v){if(v.get("status")!=8){if(v.get("status")!=4){return true}}},this);var o=C.getAt(0).get("hodname");var n=C.getAt(0).get("hopname");if(e==-1){N.overwrite(Wtf.getCmp("footer"+Q).body,{hod:"Verified By "+o,hop:"Validated By "+n,size:J.items.items[0].lastSize.width/5});P="HOD: Verified By "+o+"_HOP:Validated By "+n;F.doLayout()}else{if(l==C.getCount()&&d<l){N.overwrite(Wtf.getCmp("footer"+Q).body,{hod:"Verified By "+o,hop:"Not Validated By "+n,size:J.items.items[0].lastSize.width/5});P="HOD: Verified By "+o+"_HOP:Not Validated By "+n}else{if(d==C.getCount()&&l<d){N.overwrite(Wtf.getCmp("footer"+Q).body,{hod:"Not Verified By "+o,hop:"Validated By "+n,size:J.items.items[0].lastSize.width/5});P="HOD: Not Verified By "+o+"_HOP:Validated By "+n}else{N.overwrite(Wtf.getCmp("footer"+Q).body,{hod:"Not Verified By "+o,hop:"Not Validated By "+n,size:J.items.items[0].lastSize.width/5});P="HOD: Not Verified By "+o+"_HOP:Not Validated By "+n}}}}}};Wtf.data.DynamicJsonReader=function(A){Wtf.data.DynamicJsonReader.superclass.constructor.call(this,A,[])};Wtf.extend(Wtf.data.DynamicJsonReader,Wtf.data.JsonReader,{getRecordType:function(D){var C=0,A=[];for(var B in D[0]){A[C++]=B}this.recordType=Wtf.data.Record.create(A);return this.recordType},readRecords:function(o){this.jsonData=o;var s=this.meta;var sid=s.id;var totalRecords=0;if(s.totalProperty){var v=parseInt(eval("o."+s.totalProperty),10);if(!isNaN(v)){totalRecords=v}}var root=s.root?eval("o."+s.root):o;var recordType=this.getRecordType(root);var fields=recordType.prototype.fields;var records=[];for(var i=0;i<root.length;i++){var n=root[i];var values={};var id=(n[sid]!==undefined&&n[sid]!==""?n[sid]:null);for(var j=0,jlen=fields.length;j<jlen;j++){var f=fields.items[j];var map=f.mapping||f.name;var v=n[map]!==undefined?n[map]:f.defaultValue;v=f.convert(v);values[f.name]=v}var record=new recordType(values,id);record.json=n;records[records.length]=record}return{records:records,totalRecords:totalRecords||records.length}}});function sortCols(A){var D;for(var C=0;C<A.length;C++){for(var B=0;B<A.length-1-C;B++){var F=A[B+1].split("/")[3];var E=A[B].split("/")[3];if(!Wtf.type(F)){F=""}if(!Wtf.type(E)){E=""}if(F>E){D=A[B];A[B]=A[B+1];A[B+1]=D}else{if(F==E){var G=A[B+1].split("/")[0];var H=A[B].split("/")[0];if(G<H){D=A[B];A[B]=A[B+1];A[B+1]=D}}}}}return A}Wtf.grid.DynamicColumnModel1=function(B,D){this.cols1=[];this.groupHeader=[];var H=B.recordType;var A=H.prototype.fields;A.keys=sortCols(A.keys);for(var C=0;C<A.keys.length;C++){var G=A.keys[C];var F=G.split("/");if(F.length==6&&F[2]=="-"){var E=H.getField(G);this.groupHeader.push({header:E.name.split("/")[0],colspan:2,align:"center"});this.cols1.push({header:"Raw("+(E.name.split("/")[4])+")",dataIndex:E.name+"/Raw",align:"center",editor:new Wtf.form.NumberField({allowBlank:false,allowNegative:true,maxValue:E.name.split("/")[4],minValue:-1}),renderer:function(M,J,I,N,L,K){if(L==0){return M}else{if(M=="Not Graded"||M==-1){return"Not Graded"}else{if(M==-2){return"N/A"}else{if(M<0&&M>-1){return"Not Graded"}else{if(Wtf.isEmpty(M)){return"N/A"}else{if(!isNaN(M)){return Wtf.precisionDecimalValue(M)}else{return M}}}}}}}});this.cols1.push({header:"Score("+(E.name.split("/")[5])+"%)",dataIndex:E.name+"/Weightage",align:"center",renderer:function(M,J,I,N,L,K){if(L==0){return M}else{if(M=="Not Graded"||M==-1){return"Not Graded"}else{if(M==-2){return"N/A"}else{if(M<0&&M>-1){return"Not Graded"}else{if(Wtf.isEmpty(M)){return"N/A"}else{if(!isNaN(M)){return Wtf.precisionDecimalValue(M)}else{return M}}}}}}}})}if(G.match("Name")){this.appendFirst11={header:"",colspan:1,align:"center"};var E=H.getField(G);this.appendFirst1={header:E.name,dataIndex:E.name,id:"Name",sortable:true,width:100,renderer:function(M,J,I,N,L,K){return M.split("/")[0]}}}if(G.match("Matric Number")){this.appendFirst22={header:"",colspan:1,align:"center"};var E=H.getField(G);this.appendFirst2={header:E.name,align:"center",dataIndex:E.name,sortable:true,width:100}}if(G.match("Final Exam Marks")){var E=H.getField(G);if(G.match("Raw")==null&&G.match("Weightage")==null){this.finalGrpHeader={header:E.name.split("/")[0],colspan:2,align:"center"};this.finalRawHeader={header:"Raw("+(E.name.split("/")[3])+")",dataIndex:E.name+"/Raw",align:"center",editor:new Wtf.form.NumberField({allowBlank:false,allowNegative:true,maxValue:E.name.split("/")[3],minValue:-1}),renderer:function(M,J,I,N,L,K){if(L==0){return M}else{if(M=="Not Graded"||M==-1){return"Not Graded"}else{if(M==-2){return"N/A"}else{if(M<0&&M>-1){return"Not Graded"}else{if(!isNaN(M)){return Wtf.precisionDecimalValue(M)}else{return M}}}}}}};this.finalScoreHeader={header:"Score("+(E.name.split("/")[2])+"%)",dataIndex:E.name+"/Weightage",align:"center",renderer:function(M,J,I,N,L,K){if(L==0){return M}else{if(M=="Not Graded"||M==-1){return"Not Graded"}else{if(M==-2){return"N/A"}else{if(M<0&&M>-1){return"Not Graded"}else{if(Wtf.isEmpty(M)){return"N/A"}else{if(!isNaN(M)){return Wtf.precisionDecimalValue(M)}else{return M}}}}}}}}}}if(G=="Total"){this.appendLast22={header:"",colspan:1,align:"center"};var E=H.getField(G);this.appendLast2={header:E.name,align:"center",dataIndex:E.name,sortable:true,renderer:function(M,J,I,N,L,K){if(M==-2){return"N/A"}else{if(!isNaN(M)){return Wtf.precisionDecimalValue(M)+"%"}else{return M+"%"}}}}}if(G.match("Status")){this.appendLast33={header:"",colspan:1,align:"center"};var E=H.getField(G);this.appendLast3={align:"center",header:E.name,dataIndex:E.name,sortable:true,renderer:function(M,J,I,N,L,K){return M}}}if(G.match("Grade")){this.appendLast44={header:"",colspan:1,align:"center"};var E=H.getField(G);this.appendLast4={align:"center",header:E.name,dataIndex:E.name,sortable:true,renderer:function(M,J,I,N,L,K){return M}}}if(G.match("Attendance")){this.appendLast66={header:"",colspan:1,align:"center",hidden:!isRoleGroup("4")};E=H.getField(G);this.appendLast6={align:"center",hidden:!isRoleGroup("4"),header:E.name,dataIndex:E.name,sortable:true,editor:new Wtf.form.ComboBox({mode:"local",triggerAction:"all",displayField:"present",valueField:"present",store:new Wtf.data.SimpleStore({fields:["present"],data:[["Absent"],["Present"]],autoLoad:true})})}}if(G.match("Total Continuous Assessment")){var E=H.getField(G);if(E.name.split("/") instanceof Array){this.assTotalGrpHeader={header:E.name.split("/")[0],colspan:1,align:"center",width:100};this.assTotalHeader={header:"Score("+E.name.split("/")[1]+")",dataIndex:E.name,id:"assTotal",sortable:true,align:"center",renderer:function(M,J,I,N,L,K){if(M==-2){return"N/A"}else{if(!isNaN(M)){return Wtf.precisionDecimalValue(M)+"%"}else{return M+"%"}}}}}}}if(this.assTotalHeader){this.cols1.push(this.assTotalHeader);this.groupHeader.push(this.assTotalGrpHeader)}if(this.finalGrpHeader){this.cols1.push(this.finalRawHeader);this.cols1.push(this.finalScoreHeader);this.groupHeader.push(this.finalGrpHeader)}if(this.appendLast2){this.cols1.push(this.appendLast2);this.groupHeader.push(this.appendLast22)}if(this.appendLast3){this.cols1.push(this.appendLast3);this.groupHeader.push(this.appendLast33)}if(this.appendLast4){this.cols1.push(this.appendLast4);this.groupHeader.push(this.appendLast44)}if(this.appendLast6){this.cols1.push(this.appendLast6);this.groupHeader.push(this.appendLast66)}if(this.appendFirst2){this.cols1.unshift(this.appendFirst2);this.groupHeader.unshift(this.appendFirst22)}if(this.appendFirst1){this.cols1.unshift(this.appendFirst1);this.groupHeader.unshift(this.appendFirst11)}this.cols1.unshift(D);this.groupHeader.unshift({header:"",colspan:1,align:"center"});this.cols1.unshift(new Wtf.grid.RowNumberer({}));this.groupHeader.unshift({header:"",colspan:1,align:"center"});Wtf.grid.DynamicColumnModel1.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModel1,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1},getColumnJSON:function(){var C=[];for(var A=2;A<this.cols1.length;A++){if(!this.cols1[A].hidden){var B={header:this.cols1[A].header,colspan:this.cols1[A].colspan,dataIndex:this.cols1[A].dataIndex};C.push(B)}}return JSON.stringify(C)},getGroupHeaderJSON:function(){var C=[];for(var A=2;A<this.groupHeader.length;A++){if(!this.groupHeader[A].hidden){var B={header:this.groupHeader[A].header,colspan:this.groupHeader[A].colspan};C.push(B)}}return JSON.stringify(C)},getGroupHeader:function(){return this.groupHeader}});Wtf.course.gradeBook=function(A){Wtf.apply(this,A);this.buttonConfig=[this.calGradeBttn=new Wtf.Toolbar.Button({text:"Calculate Grade",disabled:true,scope:this,handler:function(){var B=this.examSM.getSelections();var D=new Array();for(var C=0;C<B.length;C++){var E={userid:B[C].get("Name").split("/")[1],total:B[C].get("Total")};D.push(E)}if(D.length>0){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",method:"POST",params:{type:"saveTotal",mid:this.modulerunid,data:JSON.stringify(D),uid:loginid,specialgrade:0,flag:1,isJasad:isRoleGroup("4")}},this,function(){if(this.HOD){this.acceptBttn.disable();this.rejectBttn.disable();this.appealBttn.disable()}this.reload()},function(){msgBoxShow(["Error","Error occurred while calculating the grades. Please try again later."],Wtf.MessageBox.ERROR)})}}}),this.confirmBttn=new Wtf.Toolbar.Button({text:"Confirm Grades",disabled:true,scope:this,handler:function(){var D="";var G="";var F="";var H="";var C=true;var B=this.examSM.getSelections();for(var E=0;E<B.length;E++){F+=B[E].get("Name").split("/")[1]+",";H+=B[E].get("Total")+","}Wtf.MessageBox.confirm("Confirm Grades","Are you sure you want to confirm the grades?",function(I){if(I=="yes"){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",method:"POST",params:{type:"storeMarks",mid:this.modulerunid,total:H,ids:F,uid:loginid,specialgrade:0,flag:1,isJasad:isRoleGroup("4")}},this,function(J,K){var L=Wtf.decode(J);if(L.error){msgBoxShow(["Grade Confirmation",L.msg],Wtf.MessageBox.ERROR)}else{msgBoxShow(["Grade Confirmation","The grades of selected the students have been confirmed."],Wtf.MessageBox.INFO);this.reload()}},function(){msgBoxShow(["Error","Error occurred while confirming the grades. Please try again later."],Wtf.MessageBox.ERROR)});this.confirmBttn.disable()}},this)}}),this.analysisBttn=new Wtf.Toolbar.Button({text:"Gradebook Analysis",scope:this,disabled:false,handler:this.hdlAnalysis}),"->",this.genGb=new Wtf.Toolbar.Button({text:"<div style='color:Red'>Generate Grade Book</div>",id:"gengb_"+this.id,hidden:(isRoleGroup("4"))?false:true,disabled:true,scope:this,handler:function(){this.genGb.disable();Wtf.MessageBox.confirm("Generate Grade Book","Are you sure you want to generate Grade Book for selected students?<br/>After gradebook generation, you can no longer to edit and change the grades",function(D){if(D=="yes"){var E="";var F="";var B=this.examSM.getSelections();for(var C=0;C<B.length;C++){E+=B[C].get("Name").split("/")[1]+",";F+=B[C].get("Total")+","}Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:{action:7,moduleid:this.modulerunid,ids:E,total:F},scope:this,success:function(H,G){this.genGb.disable();this.reload();msgBoxShow(["Grade Book Generation","Grade Book Generated.<br/>Notification has been sent to the students in this module"],Wtf.MessageBox.INFO);this.examSM.clearSelections()},failure:function(H,G){this.genGb.enable();msgBoxShow(["Error","Error in connection."],Wtf.MessageBox.ERROR)}})}else{this.genGb.enable()}},this)}})];if(this.HOD||this.HOP){this.buttonConfig=[this.calGradeBttn=new Wtf.Toolbar.Button({text:"Calculate Grade",hidden:true,scope:this,handler:function(){this.confirmBttn.disable();if(this.HOD){this.acceptBttn.disable();this.rejectBttn.disable();this.appealBttn.disable()}this.reload()}}),this.acceptBttn=new Wtf.Toolbar.Button({text:"Accept",scope:this,disabled:true,handler:this.acceptGrades}),this.rejectBttn=new Wtf.Toolbar.Button({text:"Reject",scope:this,disabled:true,handler:this.rejectGrades}),this.appealBttn=new Wtf.Toolbar.Button({text:"Submit Appeal",scope:this,disabled:true,handler:this.submitAppeal}),this.analysisBttn=new Wtf.Toolbar.Button({text:"Gradebook Analysis",scope:this,disabled:false,handler:this.hdlAnalysis})]}this.filterStore=new Wtf.data.SimpleStore({fields:["statusid","status"],data:[["0","Result pending"],["1","<div><div>Pending HOD Verification</div><div>Pending HOP Validation</div></div>"],["2","<div><div>Verified by HOD</div><div>Pending HOP Validation</div></div>"],["7","<div><div>Pending HOD Verification</div><div>Validated by HOP</div></div>"],["3","Grievance Application"],["4","Final Marks"],["5","Re-Assess"],["6","ASAD Confirmed"],["8","<div><div>Verified by HOD</div><div>Validated by HOP</div></div>"]]});this.filterCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.filterStore,mode:"local",readOnly:true,displayField:"status",fieldLabel:"Filter by status",valueField:"statusid",emptyText:"Select a status...",listeners:{scope:this,select:function(D,B,C){var E=D.getRawValue().replace(/<\/div><div>/g," ");E=E.replace(/<div>/g,"");E=E.replace(/<\/div>/g,"");D.setValue(E)}}});this.filterCombo.on("select",this.filter,this);Wtf.course.gradeBook.superclass.constructor.call(this,{layout:"fit",items:[this.conPan=new Wtf.Panel({layout:"fit",items:[this.centerPanel=new Wtf.Panel({layout:"fit",border:false,frame:false})]})],bbar:this.buttonConfig,tbar:["Filter by status: ",this.filterCombo,this.clearFilter=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.ds.clearFilter(false);this.filterCombo.clearValue()}}),"-",this.dldCsv=new Wtf.Toolbar.Button({text:"Export",scope:this,iconCls:"csvIcon",handler:function(){var B=this.modulerunid;var C=Wtf.urlEncode({modulerunid:B,type:"gradebook",dtype:"attachment"});setDldUrl("fileDownload.jsp?"+C)}}),"-",this.preaercReportBtn=new Wtf.Toolbar.Button({text:"View PRE-AEERC Report",scope:this,hidden:(isRoleGroup("4"))?false:true,handler:function(){this.hdlAEERCReport("PRE-AEERC Report")},iconCls:getTabIconCls(Wtf.etype.report)}),this.aercReportBtn=new Wtf.Toolbar.Button({text:"View AEERC Report",scope:this,hidden:(isRoleGroup("4"))?false:true,handler:function(){this.hdlAEERCReport("AEERC Report")},iconCls:getTabIconCls(Wtf.etype.report)})]});this.on("render",this.renderGrids,this)};Wtf.extend(Wtf.course.gradeBook,Wtf.Panel,{onRender:function(A){Wtf.course.gradeBook.superclass.onRender.call(this,A);this.examSM=new Wtf.grid.CheckboxSelectionModel({});this.examSM.on("selectionchange",function(G){var D=true;var C=true;var F=true;var B=G.getSelections();if(B.length>0){for(var E=0;E<B.length;E++){if(!this.HOD&&!this.HOP){if(isRoleGroup("4")&&B[E].get("Name").split("/")[2]!=4){D=true}else{if(B[E].get("Name").split("/")[2]=="3"||B[E].get("Name").split("/")[2]=="4"){D=false}}if(B[E].get("Name").split("/")[2]!="8"){F=false}}else{if(this.HOD){if(B[E].get("Name").split("/")[2]!="1"&&B[E].get("Name").split("/")[2]!="7"&&B[E].get("Name").split("/")[2]!="3"){C=false;break}}else{if(this.HOP){if(B[E].get("Name").split("/")[2]!="1"&&B[E].get("Name").split("/")[2]!="2"&&B[E].get("Name").split("/")[2]!="3"){C=false;break}}}}}if(!this.HOD&&!this.HOP){if(D){this.confirmBttn.enable();this.calGradeBttn.enable()}else{this.confirmBttn.disable();this.calGradeBttn.disable()}if(F){this.genGb.enable()}else{this.genGb.disable()}}else{if(C){if(G.getSelected().get("Name").split("/")[2]=="1"||G.getSelected().get("Name").split("/")[2]=="2"||G.getSelected().get("Name").split("/")[2]=="7"){this.acceptBttn.enable();this.rejectBttn.enable()}else{if(G.getSelected().get("Name").split("/")[2]=="3"){this.appealBttn.enable()}}}else{this.acceptBttn.disable();this.rejectBttn.disable();this.appealBttn.disable()}}}else{if(!this.HOD&&!this.HOP){this.confirmBttn.disable();this.calGradeBttn.disable();this.genGb.disable();if(this.appealBttn){this.appealBttn.disable()}}else{this.acceptBttn.disable();this.rejectBttn.disable();if(this.appealBttn){this.appealBttn.disable()}}}},this)},renderGrids:function(){this.ptype=-1;this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});this.loadMask.show();Wtf.Ajax.requestEx({url:"jspfiles/student/gradeBook.jsp",method:"POST",params:{mode:0,modulerunid:this.modulerunid}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){this.ptype=resObj.ptype;if(resObj.data[0].nameAssMap!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data[0].nameAssMap);this.ds=new Wtf.data.Store({reader:jreader});this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;var groupHeader=[];this.cm=new Wtf.grid.DynamicColumnModel1(this.ds,this.examSM,false);groupHeader=this.cm.getGroupHeader();this.grid=new Wtf.grid.EditorGridPanel({loadMask:this.loadMask,border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,clicksToEdit:1,viewConfig:{autoFill:true},plugins:[new Wtf.GroupHeaderGrid({rows:[groupHeader],hierarchicalColMenu:true})]});this.centerPanel.add(this.grid);this.ds.loadData(resObj.data[0].nameAssMap);this.grid.on({"validateedit":{fn:this.ve,scope:this},"beforeedit":{fn:this.be,scope:this}})}this.doLayout();this.loadMask.hide()}}},function(resp,req){this.loadMask.hide()})},acceptGrades:function(){var C="";var D="";var A=this.examSM.getSelections();for(var B=0;B<A.length;B++){C+=A[B].get("Name").split("/")[1]+",";D+=A[B].get("Total")+","}Wtf.MessageBox.confirm("Accept Grades","Are you sure you want to accept?",function(E){if(E=="yes"){Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:5,mid:this.modulerunid,ids:C,total:D,uid:loginid},scope:this,success:function(){msgBoxShow(["Accept Grades","Grade status updated."],Wtf.MessageBox.INFO);this.reload();this.acceptBttn.disable();this.rejectBttn.disable();this.examSM.clearSelections()},failure:function(){msgBoxShow(["Error","Error occurred while accepting the grades. Please try again later."],Wtf.MessageBox.ERROR)}})}},this)},rejectGrades:function(){var A=this.getUsers();Wtf.MessageBox.confirm("Reject Grades","Are you sure you want to reject?",function(B){if(B=="yes"){Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:6,mid:this.modulerunid,ids:A,uid:loginid},scope:this,success:function(){msgBoxShow(["Reject Grades","Grade status updated."],Wtf.MessageBox.INFO);this.reload();this.acceptBttn.disable();this.rejectBttn.disable();this.examSM.clearSelections()},failure:function(){msgBoxShow(["Error","Error occurred while rejecting the grades. Please try again later."],Wtf.MessageBox.ERROR)}})}},this)},hdlAEERCReport:function(A){new ShowReport(A,this.ownerCt,"showReport"+this.modulerunid,this.modulerunid,this.ptype,false,false)},hdlAnalysis:function(){if(Wtf.getCmp("ana"+this.id)!=undefined){Wtf.getCmp("ana"+this.id).show()}else{this.ownerCt.add(new Wtf.analysisPanel({title:"Gradebook Analysis",id:"ana"+this.id,modulerunid:this.modulerunid,closable:true}));this.ownerCt.doLayout();Wtf.getCmp("ana"+this.id).show()}},submitAppeal:function(){var A=this.getUsers();Wtf.MessageBox.confirm("Submit Appeal","Are you sure you want to submit the appeal to the concerned facluty?",function(B){if(B=="yes"){Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:7,mid:this.modulerunid,ids:A,uid:loginid},scope:this,success:function(){msgBoxShow(["Forward Appeal to Faculty","Grievance(s) forwarded to faculty for re-assessment."],Wtf.MessageBox.INFO);this.reload();this.acceptBttn.disable();this.rejectBttn.disable();this.appealBttn.disable();this.examSM.clearSelections()},failure:function(){msgBoxShow(["Error","Error occurred while submitting request. Please try again later."],Wtf.MessageBox.ERROR)}})}},this)},getUsers:function(){var C="";var A=this.examSM.getSelections();for(var B=0;B<A.length;B++){C+=A[B].get("Name").split("/")[1]+","}return C},reload:function(){this.filterCombo.clearValue();this.centerPanel.remove(this.grid);this.renderGrids()},ve:function(e){var grid=e.grid;var record=e.record;var field=e.field;var value=e.value;var originalValue=e.originalValue;var row=e.row;var column=e.column;var studid=record.get("Name").split("/")[1];var assignid=field.split("/")[1];var outof=0;if(field!="Attendance"){if(assignid==999){outof=parseFloat(field.split("/")[3])}else{outof=parseFloat(field.split("/")[4])}if(parseFloat(value)>outof){e.cancel=true;return }}else{assignid=-1;this.confirmBttn.enable();this.calGradeBttn.enable()}Wtf.Ajax.request({url:"jspfiles/student/gradeBook.jsp",params:{field:e.field,studId:studid,marks:value,assignId:assignid,moduleid:this.modulerunid,mode:(assignid=="999")?8:3},scope:this,success:function(resp,option){var respText=eval("("+resp.responseText+")");if(!respText.valid){msgBoxShow(["Error","Error connecting to server"],Wtf.MessageBox.INFO);e.cancel=true}else{var fullMark=0;var wt=0;var assignMark=0;var fieldName="";if(field!="Attendance"){if(assignid=="999"){fullMark=parseFloat(field.split("/")[3]);wt=parseFloat(field.split("/")[2]);assignMark=value/fullMark*wt;fieldName=field.substring(0,field.search("Raw"));record.set(fieldName+"Weightage",assignMark)}else{fullMark=parseFloat(field.split("/")[4]);wt=parseFloat(field.split("/")[5]);assignMark=value/fullMark*wt;fieldName=field.substring(0,field.search("Raw"));record.set(fieldName+"Weightage",assignMark)}record.set("Status","Result Pending")}else{var examWeight=record.get("Name").split("/")[3];var examOutOf=record.get("Name").split("/")[4];record.beginEdit();if(value=="Absent"){var Total=parseFloat(record.get("Total"));var mrk=parseFloat(record.get("Final Exam Marks/999/"+examWeight+"/"+examOutOf+"/Weightage"));record.set("Final Exam Marks/999/"+examWeight+"/"+examOutOf+"/Raw","Absent");record.set("Final Exam Marks/999/"+examWeight+"/"+examOutOf+"/Weightage","Absent");if(Total>0&&!isNaN(mrk)){record.set("Total",Total-mrk)}}else{record.set("Final Exam Marks/999/"+examWeight+"/"+examOutOf+"/Raw","Not Graded");record.set("Final Exam Marks/999/"+examWeight+"/"+examOutOf+"/Weightage","Not Graded")}}record.commit()}}})},be:function(A){if(A.value==-2){A.cancel=true}if(this.HOD||this.HOP){A.cancel=true}else{if(isRoleGroup("4")&&A.record.get("Name").split("/")[2]!=4){if(A.field=="Attendance"){A.cancel=false;return }if(A.field.split("/")[4]=="Raw"){if(A.record.get("Attendance")=="Present"){A.cancel=false}else{A.cancel=true}}else{A.cancel=false}}else{if(A.record.get("Status")=="Final Marks"||A.record.get("Status")=="Grievance Application"){A.cancel=true}else{if(A.field=="Attendance"){A.cancel=false;return }if(A.field.split("/")[4]=="Raw"){if(A.record.get("Attendance")=="Present"){A.cancel=false}else{A.cancel=true}}else{A.cancel=false}}}}},filter:function(B,C,A){this.ds.filter("Status",C.get("status"))}});Wtf.grid.DynamicColumnModel2=function(B){this.cols1=[];var F=B.recordType;var A=F.prototype.fields;A.keys=sortCols(A.keys);for(var C=0;C<A.keys.length;C++){var E=A.keys[C];if(!E.match("Name")&&!E.match("Total")&&!E.match("studId")&&!E.match("Status")&&!E.match("Final Exam Marks")&&!E.match("Grade")&&!E.match("Misconduct")&&!E.match("Feedback")&&!E.match("Matric Number")&&!E.match("Nationality")){var D=F.getField(E);this.cols1.push({header:D.name.split("/")[0],dataIndex:D.name,editor:new Wtf.form.NumberField({allowBlank:false,allowNegative:false,maxValue:100}),renderer:function(K,H,G,L,J,I){if(J==0){return K}else{if(K=="Not Graded"){return"Not Graded"}else{if(K==-2){return"N/A"}else{if(Wtf.isEmpty(K)){return"N/A"}else{return K+"%"}}}}}})}if(E.match("Name")){var D=F.getField(E);this.appendFirst1={header:D.name,dataIndex:D.name,id:"Name",sortable:true,width:100,renderer:function(K,H,G,L,J,I){return K.split("/")[0]}}}if(E.match("Matric Number")){var D=F.getField(E);this.appendFirst2={header:D.name,dataIndex:D.name,sortable:true,width:100}}if(E.match("Nationality")){var D=F.getField(E);this.appendFirst3={header:D.name,dataIndex:D.name,sortable:true,width:100}}if(E.match("Misconduct")){var D=F.getField(E);this.appendFirst4={header:D.name,dataIndex:D.name,width:100,renderer:function(K,H,G,L,J,I){if(K==0){return"No misconduct record"}else{if(K==1){return"<label style = 'color : red;'>Found Guilty</label>"}}}}}if(E.match("Feedback")){var D=F.getField(E);this.appendFirst5={header:D.name,dataIndex:D.name,width:100}}if(E.match("Final Exam Marks")){var D=F.getField(E);this.appendLast1={header:D.name.split("/")[0],dataIndex:D.name,editor:new Wtf.form.NumberField({allowBlank:false,allowNegative:false,maxValue:100}),renderer:function(K,H,G,L,J,I){if(J==0){return K}else{if(K=="Not Graded"){return"Not Graded"}if(K==-2){return"N/A"}else{return K+"%"}}}}}if(E.match("Total")){var D=F.getField(E);this.appendLast2={header:D.name,dataIndex:D.name,sortable:true,renderer:function(K,H,G,L,J,I){if(K==-2){return"N/A"}else{return K+"%"}}}}if(E.match("Status")){var D=F.getField(E);this.appendLast3={header:D.name,dataIndex:D.name,sortable:true,renderer:function(K,H,G,L,J,I){return K}}}if(E.match("Grade")){var D=F.getField(E);this.appendLast4={header:D.name,dataIndex:D.name,sortable:true,renderer:function(K,H,G,L,J,I){return K}}}}if(this.appendLast1){this.cols1.push(this.appendLast1)}if(this.appendLast2){this.cols1.push(this.appendLast2)}if(this.appendLast3){this.cols1.push(this.appendLast3)}if(this.appendLast4){this.cols1.push(this.appendLast4)}if(this.appendFirst5){this.cols1.unshift(this.appendFirst5)}if(this.appendFirst4){this.cols1.unshift(this.appendFirst4)}if(this.appendFirst3){this.cols1.unshift(this.appendFirst3)}if(this.appendFirst2){this.cols1.unshift(this.appendFirst2)}if(this.appendFirst1){this.cols1.unshift(this.appendFirst1)}Wtf.grid.DynamicColumnModel2.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModel2,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1}});Wtf.course.sectionGradeBook=function(A){Wtf.apply(this,A);this.buttonConfig=[this.confirmBttn=new Wtf.Toolbar.Button({text:"Confirm Grades",disabled:true,hidden:(isRoleGroup("4"))?true:false,scope:this,handler:function(){var D="";var G="";var F="";var H="";var C=true;var B=this.examSM.getSelections();for(var E=0;E<B.length;E++){F+=B[E].get("Name").split("/")[1]+",";H+=B[E].get("Total")+","}Wtf.MessageBox.confirm("Confirm Grades","Are you sure you want to confirm the grades?",function(I){if(I=="yes"){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",method:"POST",params:{type:"storeMarks",mid:this.modulerunid,total:H,ids:F,uid:loginid,specialgrade:0,flag:1}},this,function(){msgBoxShow(["Grade Confirmation","The grades of selected students have been confirmed."],Wtf.MessageBox.INFO);this.confirmBttn.disable();this.reload()},function(){msgBoxShow(["Error","Error occurred while confirming the grades. Please try again later."],Wtf.MessageBox.ERROR)});this.confirmBttn.disable()}},this)}}),this.calGradeBttn=new Wtf.Toolbar.Button({text:(isRoleGroup("4"))?"Refresh":"Calculate Grade",scope:this,handler:function(){this.confirmBttn.disable();if(this.HOD){this.acceptBttn.disable();this.rejectBttn.disable();this.appealBttn.disable()}this.reload()}}),this.genGb=new Wtf.Toolbar.Button({text:"Generate Grade Book",id:"gengb_"+this.id,hidden:(isRoleGroup("4"))?false:true,disabled:true,scope:this,handler:function(){Wtf.getCmp("gengb_"+this.id).disable();Wtf.MessageBox.confirm("Generate Grade Book","Are you sure you want to generate Grade Book for selected students?",function(D){if(D=="yes"){var E="";var F="";var B=this.examSM.getSelections();for(var C=0;C<B.length;C++){E+=B[C].get("Name").split("/")[1]+",";F+=B[C].get("Total")+","}Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:{action:7,moduleid:this.modulerunid,ids:E,total:F},scope:this,success:function(H,G){Wtf.getCmp("gengb_"+this.id).disable();this.reload();msgBoxShow(["Grade Book Generation","Grade Book Generated.<br/>Notification has been sent to the students in this module"],Wtf.MessageBox.INFO);this.examSM.clearSelections()},failure:function(H,G){Wtf.getCmp("gengb_"+this.id).enable();msgBoxShow(["Error","Error in connection."],Wtf.MessageBox.ERROR)}})}else{Wtf.getCmp("gengb_"+this.id).enable()}},this)}}),this.analysisBttn=new Wtf.Toolbar.Button({text:"Gradebook Analysis",scope:this,disabled:false,handler:this.hdlAnalysis})];if(this.HOD){this.buttonConfig=[this.calGradeBttn=new Wtf.Toolbar.Button({text:"Calculate Grade",scope:this,handler:function(){this.confirmBttn.disable();if(this.HOD){this.acceptBttn.disable();this.rejectBttn.disable();this.appealBttn.disable()}this.reload()}}),this.acceptBttn=new Wtf.Toolbar.Button({text:"Accept",scope:this,disabled:true,handler:this.acceptGrades}),this.rejectBttn=new Wtf.Toolbar.Button({text:"Reject",scope:this,disabled:true,handler:this.rejectGrades}),this.appealBttn=new Wtf.Toolbar.Button({text:"Submit Appeal",scope:this,disabled:true,handler:this.submitAppeal}),this.analysisBttn=new Wtf.Toolbar.Button({text:"Gradebook Analysis",scope:this,disabled:false,handler:this.hdlAnalysis})]}this.filterStore=new Wtf.data.SimpleStore({fields:["statusid","status"],data:[["0","Result pending"],["1","Pending HOD Confirmation"],["2","HOD Confirmed"],["3","Grievance Application"],["4","Final Marks"],["5","Re-Assess"],["6","ASAD Confirmed"]]});this.filterCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.filterStore,mode:"local",readOnly:true,displayField:"status",fieldLabel:"Filter by status",valueField:"statusid",emptyText:"Select a status..."});this.filterCombo.on("select",this.filter,this);Wtf.course.sectionGradeBook.superclass.constructor.call(this,{layout:"fit",items:[this.conPan=new Wtf.Panel({layout:"fit",items:[this.centerPanel=new Wtf.Panel({layout:"fit",border:false,frame:false})]})],bbar:this.buttonConfig,tbar:["Filter by status: ",this.filterCombo,this.clearFilter=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.ds.clearFilter(false);this.filterCombo.clearValue()}}),"-",this.dldCsv=new Wtf.Toolbar.Button({text:"Export",scope:this,iconCls:"csvIcon",handler:function(){var B=this.modulerunid;setDldUrl("fileDownload.jsp?modulerunid="+B+"&type=gradebook&dtype=attachment&sectionFlag=true&sectionid="+this.sectionid)}})]});this.on("render",this.renderGrids,this)};Wtf.extend(Wtf.course.sectionGradeBook,Wtf.Panel,{onRender:function(A){Wtf.course.gradeBook.superclass.onRender.call(this,A);this.examSM=new Wtf.grid.CheckboxSelectionModel({});this.examSM.on("selectionchange",function(F){var D=true;var C=true;var E=true;var B=F.getSelections();if(B.length>0){for(i=0;i<B.length;i++){if(!this.HOD){if(B[i].get("Name").split("/")[2]!="0"&&B[i].get("Name").split("/")[2]!="5"){D=false}if(B[i].get("Name").split("/")[2]!="2"){E=false}}else{if(B[i].get("Name").split("/")[2]!="1"&&B[i].get("Name").split("/")[2]!="3"){C=false;break}}}if(!this.HOD){if(D){this.confirmBttn.enable()}else{this.confirmBttn.disable()}if(E){this.genGb.enable()}else{this.genGb.disable()}}else{if(C){if(F.getSelected().get("Name").split("/")[2]=="1"){this.acceptBttn.enable();this.rejectBttn.enable()}else{if(F.getSelected().get("Name").split("/")[2]=="3"){this.appealBttn.enable()}}}else{this.acceptBttn.disable();this.rejectBttn.disable();this.appealBttn.disable()}}}else{if(!this.HOD){this.confirmBttn.disable();this.genGb.disable();if(this.appealBttn){this.appealBttn.disable()}}else{this.acceptBttn.disable();this.rejectBttn.disable();if(this.appealBttn){this.appealBttn.disable()}}}},this)},renderGrids:function(){this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});this.loadMask.show();Wtf.Ajax.requestEx({url:"jspfiles/student/gradeBook.jsp",method:"POST",params:{mode:17,modulerunid:this.modulerunid,sectionid:this.sectionid}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data[0].nameAssMap!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data[0].nameAssMap);this.ds=new Wtf.data.Store({reader:jreader});this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel1(this.ds,this.examSM,this.sectionFlag);this.grid=new Wtf.grid.EditorGridPanel({loadMask:this.loadMask,border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,clicksToEdit:1,viewConfig:{autoFill:true}});this.centerPanel.add(this.grid);this.ds.loadData(resObj.data[0].nameAssMap);this.grid.on({"validateedit":{fn:this.ve,scope:this},"beforeedit":{fn:this.be,scope:this}})}this.doLayout();this.loadMask.hide()}}},function(resp,req){this.loadMask.hide()})},acceptGrades:function(){var C="";var D="";var A=this.examSM.getSelections();for(var B=0;B<A.length;B++){C+=A[B].get("Name").split("/")[1]+",";D+=A[B].get("Total")+","}Wtf.MessageBox.confirm("Accept Grades","Are you sure you want to accept?",function(E){if(E=="yes"){Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:5,mid:this.modulerunid,ids:C,total:D,uid:loginid},scope:this,success:function(){msgBoxShow(["Accept Grades","Grade status updated."],Wtf.MessageBox.INFO);this.reload();this.acceptBttn.disable();this.rejectBttn.disable();this.examSM.clearSelections()},failure:function(){msgBoxShow(["Error","Error occurred while accepting the grades. Please try again later."],Wtf.MessageBox.ERROR)}})}},this)},rejectGrades:function(){var A=this.getUsers();Wtf.MessageBox.confirm("Reject Grades","Are you sure you want to reject?",function(B){if(B=="yes"){Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:6,mid:this.modulerunid,ids:A,uid:loginid},scope:this,success:function(){msgBoxShow(["Reject Grades","Grade status updated."],Wtf.MessageBox.INFO);this.reload();this.acceptBttn.disable();this.rejectBttn.disable();this.examSM.clearSelections()},failure:function(){msgBoxShow(["Error","Error occurred while rejecting the grades. Please try again later."],Wtf.MessageBox.ERROR)}})}},this)},hdlAnalysis:function(){if(Wtf.getCmp("ana"+this.id)!=undefined){Wtf.getCmp("ana"+this.id).show()}else{this.ownerCt.add(new Wtf.analysisPanel({title:"Gradebook Analysis",id:"ana"+this.id,modulerunid:this.modulerunid,closable:true}));this.ownerCt.doLayout();Wtf.getCmp("ana"+this.id).show()}},submitAppeal:function(){var A=this.getUsers();Wtf.MessageBox.confirm("Submit Appeal","Are you sure you want to submit the appeal to the concerned facluty?",function(B){if(B=="yes"){Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",params:{mode:7,mid:this.modulerunid,ids:A,uid:loginid},scope:this,success:function(){msgBoxShow(["Forward Appeal to Faculty","Grievance(s) forwarded to faculty for re-assessment."],Wtf.MessageBox.INFO);this.reload();this.acceptBttn.disable();this.rejectBttn.disable();this.appealBttn.disable();this.examSM.clearSelections()},failure:function(){msgBoxShow(["Error","Error occurred while submitting request. Please try again later."],Wtf.MessageBox.ERROR)}})}},this)},getUsers:function(){var C="";var A=this.examSM.getSelections();for(var B=0;B<A.length;B++){C+=A[B].get("Name").split("/")[1]+","}return C},reload:function(){this.filterCombo.clearValue();this.centerPanel.remove(this.grid);this.renderGrids()},ve:function(e){var grid=e.grid;var record=e.record;var field=e.field;var value=e.value;var originalValue=e.originalValue;var row=e.row;var column=e.column;var studid=record.get("Name").split("/")[1];var assignid=field.split("/")[1];Wtf.Ajax.requestEx({url:"jspfiles/student/gradeBook.jsp",params:{studId:studid,marks:value,assignId:assignid,moduleid:this.modulerunid,mode:(assignid=="999")?8:3}},this,function(resp,option){var respText=eval("("+resp+")");if(!respText.valid){msgBoxShow(["Error","Error connecting to server"],Wtf.MessageBox.INFO)}})},be:function(A){if(A.value==-2){A.cancel=true}if(this.HOD){if(A.record.get("Status")!="Pending HOD Confirmation"||A.record.get("Status")=="Grievance Application"){A.cancel=true}}else{if(isRoleGroup("4")){A.cancel=true}else{if(A.record.get("Status")=="Result pending"||A.record.get("Status")=="Re-Assess"){A.cancel=false}else{A.cancel=true}}}},filter:function(B,C,A){this.ds.filter("Status",C.get("status"))}});Wtf.analysisPanel=function(A){Wtf.apply(this,A);this.studentRecord=Wtf.data.Record.create([{name:"username",type:"string"},{name:"userid",type:"string"}]);this.studentReader=new Wtf.data.KwlJsonReader({root:"data"},this.studentRecord);this.studentStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/student/gradeBook.jsp"}),reader:this.studentReader});this.studentCombo=new Wtf.form.ComboBox({id:"stud"+this.id,store:this.studentStore,readOnly:true,displayField:"username",mode:"local",triggerAction:"all",width:275,listWidth:275,emptyText:"Select student...",fieldLabel:"Student",name:"userid",valueField:"userid"});this.assiRecord=Wtf.data.Record.create([{name:"assiname",type:"string"},{name:"assiid",type:"string"}]);this.assiReader=new Wtf.data.KwlJsonReader({root:"data"},this.assiRecord);this.assiStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/student/gradeBook.jsp"}),reader:this.assiReader});this.assiCombo=new Wtf.form.ComboBox({id:"assi"+this.id,store:this.assiStore,readOnly:true,displayField:"assiname",mode:"local",triggerAction:"all",width:275,listWidth:275,emptyText:"Select assignment...",fieldLabel:"Student",name:"assiid",valueField:"assiid"});this.studentCombo.on("select",this.studSelect,this);this.assiCombo.on("select",this.assiSelect,this);Wtf.analysisPanel.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"border",autoScroll:true,title:"Gradebook Analysis",tbar:["Select a student:",this.studentCombo,"-","Select assignment:",this.assiCombo],items:[this.northP=new Wtf.Panel({id:"northregion_"+this.id,border:false,layout:"fit",split:true,region:"north",height:130}),new Wtf.Panel({layout:"border",split:true,region:"center",height:200,border:false,items:[{region:"center",layout:"fit",title:"Assignment Legend",split:true,autoScroll:true,items:new Wtf.Panel({id:"middlewest"+this.id,border:false,bodyStyle:"font-size:11px;height:100%;overflow-y:auto;background-color:#FFFFFF"})},{region:"west",layout:"fit",width:"60%",bodyStyle:"background-color:#FFFFFF",split:true,title:"Marks Chart",autoScroll:true,items:new Wtf.Panel({id:"middleeast"+this.id,border:false})}]}),new Wtf.Panel({split:true,region:"south",height:250,border:false,layout:"border",items:[{region:"center",layout:"fit",title:"Assignment Statistics",bodyStyle:"background-color:#FFFFFF",autoScroll:true,split:true,items:new Wtf.Panel({id:"loweast"+this.id,border:false,layout:"fit"})},{region:"west",layout:"fit",width:"50%",bodyStyle:"background-color:#FFFFFF",title:"Grade Chart",autoScroll:true,split:true,items:new Wtf.Panel({id:"gdchart"+this.id,border:false,layout:"fit"})}]})]});this.on("render",this.handleRender,this)};Wtf.extend(Wtf.analysisPanel,Wtf.Panel,{handleRender:function(obj){this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});this.loadMask.show();Wtf.Ajax.requestEx({url:"jspfiles/student/gradeBook.jsp",method:"POST",params:{mode:10,modulerunid:this.modulerunid}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data[0].nameAssMap!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data[0].nameAssMap);this.ds=new Wtf.data.Store({reader:jreader});this._reader=jreader;this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel2(this.ds);this.grid=new Wtf.grid.GridPanel({loadMask:this.loadMask,border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,viewConfig:{autoFill:true}});this.northP.add(this.grid);this.ds.loadData(resObj.data[0].nameAssMap)}this.doLayout();this.loadMask.hide();this.plotGraph(this.ds);if(resObj.data[0].gradeChart!==undefined){this.plotChart(resObj.data[0].gradeChart[0])}}}},function(resp,req){this.loadMask.hide()});this.studentStore.load({params:{mode:11,modulerunid:this.modulerunid}});this.assiStore.load({params:{mode:13,modulerunid:this.modulerunid}})},plotChart:function(E){var G="";var C="";var D=0;var A=false;if(E.totalCnt>0){A=true;for(var B=0;B<E.gradedata.length;B++){D=(E.gradedata[B].cnt/E.totalCnt)*100;G+=E.gradedata[B].grade.replace("+","%2b")+"["+this.roundNumber(D,2)+"%]|";C+=D+","}}if(A){G=G.substring(0,G.length-1);C=C.substring(0,C.length-1)}var F='<div><img style = "" align="center" src ="http://chart.apis.google.com/chart?cht=p3&chd=t:'+C+"&chco=3e85e5,fcb441,e0400a&chs=450x185&chl="+G+'"</img></div>';document.getElementById("gdchart"+this.id).innerHTML=F},roundNumber:function(B,C){var A=Math.round(B*Math.pow(10,C))/Math.pow(10,C);return A},legendFunc:function(B,A,D){var C='<tr style ="margin-top:3px;background-color:'+this.returnColor(D)+';"><td style ="margin-left:2px;padding-left:4px; width:20px;">'+B+'</td><td style="margin-left:2px;">'+A+"</td></tr>";if(Wtf.isIE){Wtf.DomHelper.insertHtml("afterEnd",Wtf.DomQuery.select("table#letable"+this.id)[0].lastChild,C)}else{Wtf.getCmp("middlewest"+this.id).el.dom.firstChild.firstChild.firstChild.innerHTML+=C}},plotGraph:function(E){var J=0;var M="";var T="";var O="";var C="";var U="";var S=1;Wtf.getCmp("middlewest"+this.id).el.dom.firstChild.firstChild.innerHTML='<table id="letable'+this.id+'"></table>';for(var L=0;L<E.getCount();L++){E.data.items[L].fields.keys=sortCols(E.data.items[L].fields.keys);var B="";var H="";var N="";var F="";var G=false;var I=false;if(L==0){J=(100)/(E.data.items[0].fields.length-2);for(var K=0;K<E.data.items[0].fields.length;K++){var R=E.data.items[L].fields.keys[K].split("/")[0];if(R!="Name"&&R!="Final Exam Marks"&&R!="Total"){if(!I){M+="|"+S;this.legendFunc(S,R,G);G=this.invertFlag(G);S++}}if(R=="Final Exam Marks"){T+=R}if(R=="Total"){O+=R}if(K==(E.data.items[0].fields.length-2)){var Q=E.data.items[L].fields.keys[K+1].split("/")[0];if(Q!="Name"&&Q!="Final Exam Marks"&&Q!="Total"){M+="|"+S;this.legendFunc(S,Q,G);G=this.invertFlag(G);S++;I=true}M+="|"+S;this.legendFunc(S,T,G);G=this.invertFlag(G);S++}if(K==(E.data.items[0].fields.length-1)){M+="|"+S;this.legendFunc(S,O,G);G=this.invertFlag(G);S++}}}var A=0;var P=false;if(E.data.items[L].data["Name"].split(">")[1].split("/")[0]!="Min"&&E.data.items[L].data["Name"].split(">")[1].split("/")[0]!="Max"){for(K=0;K<E.data.items[0].fields.length;K++){var R=E.data.items[L].fields.keys[K].split("/")[0];if(R!="Name"&&R!="Final Exam Marks"&&R!="Total"){if(!P){B+=((A)*(J)).toString()+",";H+=E.data.items[L].data[E.data.items[L].fields.keys[K]]+",";A++}}if(R=="Final Exam Marks"){N=E.data.items[L].data[E.data.items[L].fields.keys[K]]}if(R=="Total"){F=E.data.items[L].data[E.data.items[L].fields.keys[K]]}if(K==(E.data.items[0].fields.length-2)){var Q=E.data.items[L].fields.keys[K+1].split("/")[0];if(Q!="Name"&&Q!="Final Exam Marks"&&Q!="Total"){B+=((A)*(J)).toString()+",";H+=E.data.items[L].data[E.data.items[L].fields.keys[K+1]]+",";A++;P=true}B+=((A)*(J)).toString()+",";H+=N+",";A++}if(K==(E.data.items[0].fields.length-1)){if(L!=(E.getCount()-1)){H+=F+"|"}else{H+=F}B+=((A)*(J)).toString()+"|";A++}}U+=B+H}if(E.data.items[L].data["Name"].split(">")[1].split("/")[0]!="Min"&&E.data.items[L].data["Name"].split(">")[1].split("/")[0]!="Max"){if(L!=(E.getCount()-1)){C+=E.data.items[L].data["Name"].split(">")[1].split("/")[0]+"|"}else{C+=E.data.items[L].data["Name"].split(">")[1].split("/")[0]}}}if(C.substring(C.length-1)=="|"){C=C.substring(0,C.length-1)}if(U.substring(U.length-1)=="|"){U=U.substring(0,U.length-1)}var D="http://chart.apis.google.com/chart?cht=lxy&chs=600x185&chd=t:"+U+"&chco=3072F3,ff0000,00aaaa&chls=2,4,1&chm=s,FF0000,0,-1,5|s,0000ff,1,-1,5|s,00aa00,2,-1,5&chxt=x,y&chxl=0:"+M+"|1:|||20||40||60||80||100&chdl="+C+"&chdlp=b&chg=0,20,1,0&chtt=x-axis+-+Assignments+,+y-axis+-+Marks+in+% ";document.getElementById("middleeast"+this.id).innerHTML='<div ><img style = "" align="center" src ="'+D+'"></div>'},returnColor:function(A){if(A==false){return"#FFFFFF"}else{return"#EFEFEF"}},invertFlag:function(A){if(A==false){return true}else{return false}},studSelect:function(rec,com,index){if(this.ds.getCount()>3){this.ds.remove(this.ds.getAt(this.ds.getCount()-1))}Wtf.Ajax.requestEx({url:"jspfiles/student/gradeBook.jsp",method:"POST",params:{mode:12,modulerunid:this.modulerunid,userid:com.data.userid}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data[0].nameAssMap!==undefined){var abc=this._reader.readRecords(resObj.data[0].nameAssMap);this.ds.add(abc.records)}this.plotGraph(this.ds)}}},function(resp,req){this.loadMask.hide()})},assiSelect:function(rec,com,index){Wtf.Ajax.requestEx({url:"jspfiles/student/gradeBook.jsp",method:"POST",params:{mode:14,modulerunid:this.modulerunid,assiid:com.data.assiid}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data[0]!==undefined){this.plotBar(resObj.data[0])}}}},function(resp,req){this.loadMask.hide()})},plotBar:function(C){var B=C.oneCnt+","+C.twoCnt+","+C.threeCnt+","+C.fourCnt+","+C.fiveCnt+","+C.sixCnt+","+C.sevenCnt+","+C.eightCnt+","+C.nineCnt+","+C.tenCnt;var A="http://chart.apis.google.com/chart?cht=bvg&chg=100,20&chs=550x200&chco=76A4FB&chd=t:"+B+"&chbh=30&chxt=x,y&chm=N,000000,0,-1,11|D,4D89F9,0,0,2,0&chxl=0:|0-10|10-20|20-30|30-40|40-50|50-60|60-70|70-80|80-90|90-100&chtt=x-axis+-+Marks+Range+,+y-axis+-+No.+of+Students%";document.getElementById("loweast"+this.id).innerHTML='<div ><img style = "padding-left:30px" align="center" src ="'+A+'"></div>'}});Wtf.CourseView=function(A){this.modassign=new Wtf.moduleassign({title:"My Modules",id:"modassign"+A.id});this.disGrade=new Wtf.disGrade({title:"Dissertation/Thesis",id:"disgrade"+A.id,moduleid:-1,HOD:false});this.courseIncomplete=new Wtf.courseIncomplete({title:"Course Incomplete",id:"courseincomp"+A.id,parent:this});this.facSab=new Wtf.facSab({title:"Sabbatical"});Wtf.CourseView.superclass.constructor.call(this,{border:false,items:[this.modassign,this.disGrade,this.courseIncomplete,this.facSab]});this.setActiveTab(0);this.doLayout(0)};Wtf.extend(Wtf.CourseView,Wtf.TabPanel,{});Wtf.ReportGrid=function(A){Wtf.apply(this,A);this.FirstAttemptFlag=true;Wtf.ReportGrid.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.ReportGrid,Wtf.Panel,{initComponent:function(A){Wtf.ReportGrid.superclass.initComponent.call(this)},DisplayReport:function(response){var obj=eval("("+response.trim()+")");this.temprecord=Wtf.data.Record.create(this.createFields(obj.columnheader));this.jsonReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.temprecord);this.simstore=new Wtf.data.Store({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.jsonReader,remoteSort:true});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),id:this.id+"_reportGrid",ds:this.simstore,border:false,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true,enableRowBody:true,showPreview:true},bbar:new Wtf.PagingToolbar({pageSize:25,store:this.simstore,displayInfo:true,displayMsg:"Displaying Records {0} - {1} of {2}",emptyMsg:"No records to display"})});this.simstore.proxy.data=obj;this.simstore.load({params:{start:0,limit:25}});this.add(this.reportGrid);this.doLayout();if(this.reporttype=="registeredstudent"){this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var str=Wtf.urlEncode({reptype:"registeredstudent",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+str)}});this.reportGrid.getBottomToolbar().add(this.csv1)}if(this.reporttype=="offeredstudent"){this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var str=Wtf.urlEncode({reptype:"offeredstudent",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+str)}});this.reportGrid.getBottomToolbar().add(this.csv1)}if(this.reporttype=="part1modulelist"){this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var str=Wtf.urlEncode({reptype:"part1modulelist",type:"part1modulelist",dtype:"attachment",report:"cifppart1modulelistcsv"});setDldUrl("fileDownload.jsp?"+str)}});this.reportGrid.getBottomToolbar().add(this.csv1)}if(this.reporttype=="part2modulelist"){this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var str=Wtf.urlEncode({reptype:"part2modulelist",type:"part2modulelist",dtype:"attachment",report:"cifppart2modulelistcsv"});setDldUrl("fileDownload.jsp?"+str)}});this.reportGrid.getBottomToolbar().add(this.csv1)}},onRender:function(A){Wtf.ReportGrid.superclass.onRender.call(this,A);if(this.FirstAttemptFlag){Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:this.reporttype}},this,function(B,C){this.DisplayReport(B)},function(C,B){});this.FirstAttemptFlag=false}},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["width"]=70;C["sortable"]=false;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A}});Wtf.CustomReportPanel=function(A){Wtf.apply(this,A);Wtf.CustomReportPanel.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.CustomReportPanel,Wtf.Panel,{initComponent:function(){Wtf.CustomReportPanel.superclass.initComponent.call(this)},createCombo:function(A){this.combostore=new Wtf.data.SimpleStore({fields:this.createFields(A.columnheader),data:A.data});this.comboBoxDates=new Wtf.form.ComboBox({anchor:"98%",mode:"local",triggerAction:"all",typeAhead:true,editable:false,store:this.combostore,fieldLabel:this.combofieldLabel.toString()+"*",displayField:"name",valueField:"id",allowBlank:false,msgTarget:"side"});this.comboBoxDates.setValue(this.combostore.getAt(0).data["id"]);this.comboBoxDates.on("select",this.onComboChange,this);Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:this.reporttype,filterval:this.comboBoxDates.getValue()}},this,function(B,C){this.createGrid(B);this.DisplayReport()},function(C,B){})},onComboChange:function(C,B,A){Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:this.reporttype,filterval:B.data.id}},this,function(D,E){Wtf.getCmp("centerGridRegion").remove(this.reportGrid);this.createGrid(D);Wtf.getCmp("centerGridRegion").add(this.reportGrid);this.doLayout()},function(E,D){})},getComboboxData:function(tablename){Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:"retrivetableentry",tablename:tablename}},this,function(response,e){this.createCombo(eval("("+response.trim()+")"))},function(resp,req){})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.simstore=new Wtf.data.JsonStore({fields:this.createFields(obj.columnheader),data:obj.data});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),id:this.id+"_reportGrid",ds:this.simstore,border:false,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}})},onRender:function(A){Wtf.CustomReportPanel.superclass.onRender.call(this,A);this.getComboboxData(this.tablename)},DisplayReport:function(){this.panel={border:false,layout:"border",items:[{title:this.combofieldLabel,region:"north",height:0,border:false,layout:"fit",bodyStyle:"background:#f1f1f1;",tbar:[this.combofieldLabel.toString()+"* :",this.comboBoxDates]},{region:"center",autoScroll:true,id:"centerGridRegion",bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,layout:"fit",items:this.reportGrid}]};this.add(this.panel);this.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["width"]=70;C["sortable"]=false;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A}});Wtf.ExamReportPanel=function(A){Wtf.apply(this,A);Wtf.ExamReportPanel.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.ExamReportPanel,Wtf.Panel,{initComponent:function(){Wtf.ExamReportPanel.superclass.initComponent.call(this);this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,minWidth:30});this.criBttn.on("click",this.onComboChange,this);this.sessionCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.sessionStore,mode:"local",readOnly:true,displayField:"sessionname",fieldLabel:"Session*",hiddenName:"sessionid",valueField:"sessionid",allowBlank:false,emptyText:"Select a session..."});this.comboRecord=Wtf.data.Record.create([{name:"id",type:"string"},{name:"name",type:"string"}]);this.comboReader=new Wtf.data.KwlJsonReader({root:"data"},this.comboRecord);this.courseStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:"retrivetableentry",tablename:"course"},reader:this.comboReader});this.comboBoxDates=new Wtf.form.ComboBox({anchor:"98%",mode:"local",triggerAction:"all",typeAhead:true,editable:false,store:this.courseStore,fieldLabel:"CIFP Courses*",displayField:"name",valueField:"id",allowBlank:false,msgTarget:"side",emptyText:"Select a course..."});this.paymentStore=new Wtf.data.SimpleStore({fields:["pid","pvalue"],data:[["1","Paid"],["2","Unpaid"],["3","All"]]});this.paymentCombo=new Wtf.form.ComboBox({anchor:"98%",mode:"local",triggerAction:"all",typeAhead:true,editable:false,store:this.paymentStore,fieldLabel:"Payment Status",displayField:"pvalue",valueField:"pid",allowBlank:false,msgTarget:"side",emptyText:"Select a mode..."});this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var A=Wtf.urlEncode({courseid:this.comboBoxDates.getValue(),sessionid:this.sessionCombo.getValue(),paystatusid:this.paymentCombo.getValue(),paystatusvalue:this.paymentCombo.lastSelectionText,reptype:"exam",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+A)}})},onComboChange:function(){Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:this.reporttype,filterval:this.comboBoxDates.getValue(),sessionid:this.sessionCombo.getValue(),paymentid:this.paymentCombo.getValue()}},this,function(A,B){Wtf.getCmp("centerGridRegion").remove(this.reportGrid);this.createGrid(A);Wtf.getCmp("centerGridRegion").add(this.reportGrid);this.doLayout()},function(B,A){})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.temprecord=Wtf.data.Record.create(this.createFields(obj.columnheader));this.jsonReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.temprecord);this.simstore=new Wtf.data.Store({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.jsonReader,remoteSort:true});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),id:this.id+"_reportGrid",ds:this.simstore,border:false,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true,enableRowBody:true,showPreview:true},bbar:new Wtf.PagingToolbar({pageSize:25,store:this.simstore,displayInfo:true,displayMsg:"Displaying Records {0} - {1} of {2}",emptyMsg:"No records to display"})});this.simstore.proxy.data=obj;this.simstore.load({params:{start:0,limit:25}})},onRender:function(A){Wtf.ExamReportPanel.superclass.onRender.call(this,A);this.sessionStore.load();this.courseStore.load();Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:this.reporttype,filterval:this.comboBoxDates.getValue(),sessionid:this.sessionCombo.getValue(),paymentid:this.paymentCombo.getValue()}},this,function(B,C){this.createGrid(B);this.DisplayReport()},function(C,B){})},DisplayReport:function(){this.panel={border:false,layout:"border",items:[{title:this.combofieldLabel,region:"north",height:0,border:false,layout:"fit",bodyStyle:"background:#f1f1f1;",tbar:[this.combofieldLabel.toString()+"* :",this.comboBoxDates,"-","Session* :",this.sessionCombo,"-","Payment Status* :",this.paymentCombo,"-",this.criBttn,"-",this.csv1]},{region:"center",autoScroll:true,id:"centerGridRegion",bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,layout:"fit",items:this.reportGrid}]};this.add(this.panel);this.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["width"]=70;C["sortable"]=false;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A}});Wtf.ExamDeferPanel=function(A){Wtf.apply(this,A);Wtf.ExamDeferPanel.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.ExamDeferPanel,Wtf.Panel,{initComponent:function(){Wtf.ExamDeferPanel.superclass.initComponent.call(this);this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,minWidth:30});this.criBttn.on("click",this.onComboChange,this);this.sessionCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.sessionStore,mode:"local",readOnly:true,displayField:"sessionname",fieldLabel:"Session*",hiddenName:"sessionid",valueField:"sessionid",allowBlank:false,emptyText:"Select a session..."});this.comboRecord=Wtf.data.Record.create([{name:"id",type:"string"},{name:"name",type:"string"}]);this.comboReader=new Wtf.data.KwlJsonReader({root:"data"},this.comboRecord);this.courseStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:"retrivetableentry",tablename:"course"},reader:this.comboReader});this.comboBoxDates=new Wtf.form.ComboBox({anchor:"98%",mode:"local",triggerAction:"all",typeAhead:true,editable:false,store:this.courseStore,fieldLabel:"CIFP Courses*",displayField:"name",valueField:"id",allowBlank:false,msgTarget:"side",emptyText:"Select a course..."});this.deferstore=new Wtf.data.SimpleStore({fields:[{name:"type"},{name:"name"}],data:[["4","Deferred"],["6","Exempted"],["18","Withdrawn"]]});this.comboBoxType=new Wtf.form.ComboBox({anchor:"98%",mode:"local",triggerAction:"all",typeAhead:true,editable:false,store:this.deferstore,fieldLabel:"Type*",displayField:"name",valueField:"type",allowBlank:false,msgTarget:"side",emptyText:"Select a type..."});this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var A=Wtf.urlEncode({courseid:this.comboBoxDates.getValue(),sessionid:this.sessionCombo.getValue(),dtypeval:this.comboBoxType.getValue(),dtypename:this.comboBoxType.getRawValue(),reptype:"defer",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+A)}})},onComboChange:function(){Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:this.reporttype,filterval:this.comboBoxDates.getValue(),sessionid:this.sessionCombo.getValue(),dtype:this.comboBoxType.getValue()}},this,function(A,B){Wtf.getCmp("centerGridRegion").remove(this.reportGrid);this.createGrid(A);Wtf.getCmp("centerGridRegion").add(this.reportGrid);this.doLayout()},function(B,A){})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.temprecord=Wtf.data.Record.create(this.createFields(obj.columnheader));this.jsonReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.temprecord);this.simstore=new Wtf.data.Store({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.jsonReader,remoteSort:true});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),id:this.id+"_reportGrid",ds:this.simstore,border:false,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true,enableRowBody:true,showPreview:true},bbar:new Wtf.PagingToolbar({pageSize:25,store:this.simstore,displayInfo:true,displayMsg:"Displaying Records {0} - {1} of {2}",emptyMsg:"No records to display"})});this.simstore.proxy.data=obj;this.simstore.load({params:{start:0,limit:25}})},onRender:function(A){Wtf.ExamDeferPanel.superclass.onRender.call(this,A);this.sessionStore.load();this.courseStore.load();Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:this.reporttype,filterval:this.comboBoxDates.getValue(),sessionid:this.sessionCombo.getValue(),dtype:this.comboBoxType.getValue()}},this,function(B,C){this.createGrid(B);this.DisplayReport()},function(C,B){})},DisplayReport:function(){this.panel={border:false,layout:"border",items:[{title:this.combofieldLabel,region:"north",height:0,border:false,layout:"fit",bodyStyle:"background:#f1f1f1;",tbar:[this.combofieldLabel.toString()+"* :",this.comboBoxDates,"-","Type:*",this.comboBoxType,"Session* :",this.sessionCombo,"-",this.criBttn,"-",this.csv1]},{region:"center",autoScroll:true,id:"centerGridRegion",bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,layout:"fit",items:this.reportGrid}]};this.add(this.panel);this.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["width"]=70;C["sortable"]=false;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A}});Wtf.GroupingReportGrid=function(A){Wtf.apply(this,A);this.FirstAttemptFlag=true;Wtf.GroupingReportGrid.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.GroupingReportGrid,Wtf.Panel,{initComponent:function(A){Wtf.GroupingReportGrid.superclass.initComponent.call(this)},DisplayReport:function(response){var obj=eval("("+response.trim()+")");this.simstore=new Wtf.data.GroupingStore({reader:this.createFields(obj.columnheader),data:obj.data,groupField:this.groupField,sortInfo:{field:this.sortfield,direction:"desc"}});this.GroupingReportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),id:this.id+"GroupingReportGrid",ds:this.simstore,autoScroll:true,collapsible:true,layout:"fit",viewConfig:{forceFit:true,autoFill:true},view:new Wtf.grid.GroupingView({forceFit:true,groupTextTpl:'{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'}),loadMask:{msg:"Loading..."}});this.add(this.GroupingReportGrid);this.doLayout()},onRender:function(A){Wtf.GroupingReportGrid.superclass.onRender.call(this,A);if(this.FirstAttemptFlag){Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:this.reporttype}},this,function(B,C){this.DisplayReport(B)},function(C,B){});this.FirstAttemptFlag=false}},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return(new Wtf.data.ArrayReader({},A))},createColModel:function(D){var E=[];for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["width"]=70;C["sortable"]=false;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A}});Wtf.ClassRegReport=function(A){Wtf.apply(this,A);this.FirstAttemptFlag=true;Wtf.ClassRegReport.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.ClassRegReport,Wtf.Panel,{initComponent:function(A){Wtf.ClassRegReport.superclass.initComponent.call(this);this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,minWidth:30});this.criBttn.on("click",this.onComboValChange,this);this.sessionCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.sessionStore,mode:"local",readOnly:true,displayField:"sessionname",fieldLabel:"Session*",hiddenName:"sessionid",valueField:"sessionid",allowBlank:false,emptyText:"Select a session..."});this.comboRecord=Wtf.data.Record.create([{name:"id",type:"string"},{name:"name",type:"string"}]);this.comboReader=new Wtf.data.KwlJsonReader({root:"data"},this.comboRecord);this.courseStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:"retrivetableentry",tablename:"course"},reader:this.comboReader});this.classStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:"retrivetableentry",tablename:"classtype"},reader:this.comboReader});this.comboBoxCourse=new Wtf.form.ComboBox({fieldLabel:"Courses*",triggerAction:"all",typeAhead:true,editable:false,store:this.courseStore,displayField:"name",valueField:"id",readOnly:true,emptyText:"Select a CIFP course...",allowBlank:false});this.classtypeCombo=new Wtf.form.ComboBox({triggerAction:"all",typeAhead:true,editable:false,store:this.classStore,fieldLabel:"Classes*",displayField:"name",valueField:"id",readOnly:true,emptyText:"Select a class type...",allowBlank:false});this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var B=Wtf.urlEncode({courseid:this.comboBoxCourse.getValue(),classtypeid:this.classtypeCombo.getValue(),classname:this.classtypeCombo.getRawValue(),sessionid:this.sessionCombo.getValue(),reptype:"class",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+B)}})},onRender:function(A){Wtf.ClassRegReport.superclass.onRender.call(this,A);this.courseStore.load();this.classStore.load();this.sessionStore.load();Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:"classregistration",courseid:this.comboBoxCourse.getValue(),classtypeid:this.classtypeCombo.getValue(),sessionid:this.sessionCombo.getValue()}},this,function(B,C){this.createGrid(B);this.DisplayReport()},function(C,B){})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.temprecord=Wtf.data.Record.create(this.createFields(obj.columnheader));this.jsonReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.temprecord);this.simstore=new Wtf.data.Store({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.jsonReader,remoteSort:true});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),id:this.id+"_reportGrid",ds:this.simstore,border:false,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true,enableRowBody:true,showPreview:true},bbar:new Wtf.PagingToolbar({pageSize:25,store:this.simstore,displayInfo:true,displayMsg:"Displaying Records {0} - {1} of {2}",emptyMsg:"No records to display"})});this.simstore.proxy.data=obj;this.simstore.load({params:{start:0,limit:25}})},DisplayReport:function(){this.panel={border:false,layout:"border",items:[{title:"Criteria",region:"north",height:0,border:false,layout:"fit",bodyStyle:"background:#f1f1f1;",tbar:["Courses* :",this.comboBoxCourse,"-","Classes* :",this.classtypeCombo,"-","Session* :",this.sessionCombo,"-",this.criBttn,"-",this.csv1]},{region:"center",autoScroll:true,id:"centerClasaRegRegion",bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,layout:"fit",items:this.reportGrid}]};this.add(this.panel);this.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["width"]=70;C["sortable"]=false;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A},onComboValChange:function(C,B,A){Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:"classregistration",courseid:this.comboBoxCourse.getValue(),classtypeid:this.classtypeCombo.getValue(),sessionid:this.sessionCombo.getValue()}},this,function(D,E){Wtf.getCmp("centerClasaRegRegion").remove(this.reportGrid);this.createGrid(D);Wtf.getCmp("centerClasaRegRegion").add(this.reportGrid);this.doLayout()},function(E,D){})}});Wtf.candidateVenueList=function(A){Wtf.apply(this,A);this.FirstAttemptFlag=true;Wtf.candidateVenueList.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.candidateVenueList,Wtf.Panel,{initComponent:function(A){Wtf.candidateVenueList.superclass.initComponent.call(this);this.moduleRecord=Wtf.data.Record.create([{name:"coursename",type:"string"},{name:"courseid",type:"string"},{name:"programid",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data"},this.moduleRecord);this.moduleStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader});this.programRecord=Wtf.data.Record.create([{name:"programid",type:"string"},{name:"programname",type:"string"}]);this.programReader=new Wtf.data.KwlJsonReader({root:"data"},this.programRecord);this.programStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.programReader});this.programCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.programStore,mode:"local",readOnly:true,displayField:"programname",fieldLabel:"Program*",hiddenName:"programid",valueField:"programid",allowBlank:false,emptyText:"Select a program..."});this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.sessionCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.sessionStore,mode:"local",readOnly:true,displayField:"sessionname",fieldLabel:"Program*",valueField:"sessionid",allowBlank:false,emptyText:"Select a session..."});this.courseCombo=new Wtf.form.ComboBox({id:"course"+this.id,store:this.moduleStore,readOnly:true,displayField:"coursename",mode:"local",triggerAction:"all",emptyText:"Select a course...",fieldLabel:"Course/Group*",name:"courseid",valueField:"courseid",allowBlank:false});this.courseCombo.on("select",this.onComboValChange,this);this.programCombo.on("select",this.programSelect,this);this.sessionCombo.on("select",this.onSessionValChange,this);this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var B=Wtf.urlEncode({sessionid:this.sessionCombo.getValue(),programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue(),reptype:"venue",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+B)}})},programSelect:function(B,C,A){this.moduleStore.load({params:{type:"programsessioncourse",programid:C.data["programid"]}})},onRender:function(A){Wtf.candidateVenueList.superclass.onRender.call(this,A);this.programStore.load({params:{type:20}}),this.sessionStore.load(),Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:"calndidatevenuelist",sessionid:this.sessionCombo.getValue(),programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue()}},this,function(B,C){this.createGrid(B);this.DisplayReport()},function(C,B){})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.classregstore=new Wtf.data.JsonStore({fields:this.createFields(obj.columnheader),data:obj.data});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.classregstore,border:false,title:"Candidate List According To Venue",layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}})},DisplayReport:function(){this.panel={border:false,layout:"border",items:[{title:"Criteria",region:"north",height:0,border:false,tbar:["Program* :",this.programCombo,"-","Course/Group* :",this.courseCombo,"-","Session* :",this.sessionCombo,"-",this.csv1],bodyStyle:"background:#f1f1f1;"},{region:"center",autoScroll:true,id:"centerClasaRegRegion",bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,layout:"fit",items:this.reportGrid}]};this.add(this.panel);this.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];E[E.length]=new Wtf.grid.RowNumberer();for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["sortable"]=false;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A},onComboValChange:function(C,B,A){Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:"calndidatevenuelist",sessionid:this.sessionCombo.getValue(),programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue()}},this,function(D,E){Wtf.getCmp("centerClasaRegRegion").remove(this.reportGrid);this.createGrid(D);Wtf.getCmp("centerClasaRegRegion").add(this.reportGrid);this.doLayout()},function(E,D){})},onSessionValChange:function(C,B,A){Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:"calndidatevenuelist",sessionid:this.sessionCombo.getValue(),programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue()}},this,function(D,E){Wtf.getCmp("centerClasaRegRegion").remove(this.reportGrid);this.createGrid(D);Wtf.getCmp("centerClasaRegRegion").add(this.reportGrid);this.doLayout()},function(E,D){})}});Wtf.ArticleshipRegDTList=function(A){Wtf.apply(this,A);this.FirstAttemptFlag=true;Wtf.ArticleshipRegDTList.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.ArticleshipRegDTList,Wtf.Panel,{initComponent:function(A){Wtf.ArticleshipRegDTList.superclass.initComponent.call(this);this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var B=Wtf.urlEncode({reptype:"Articleshipdate",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+B)}})},onRender:function(A){Wtf.ArticleshipRegDTList.superclass.onRender.call(this,A);Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:"articleshipdate"}},this,function(B,C){this.createGrid(B);this.DisplayReport()},function(C,B){})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.classregstore=new Wtf.data.JsonStore({fields:this.createFields(obj.columnheader),data:obj.data});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.classregstore,border:false,title:"Articleship Registrations",layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}})},DisplayReport:function(){this.panel={border:false,layout:"border",items:[{region:"center",autoScroll:true,id:"centerClasaRegRegion",bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,layout:"fit",tbar:[this.csv1],items:this.reportGrid}]};this.add(this.panel);this.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];E[E.length]=new Wtf.grid.RowNumberer();for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["sortable"]=false;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A}});Wtf.ExamResultGrid=function(A){Wtf.apply(this,A);Wtf.ExamResultGrid.superclass.constructor.call(this,{border:false,autoScroll:true})};Wtf.extend(Wtf.ExamResultGrid,Wtf.Panel,{initComponent:function(A){Wtf.ExamResultGrid.superclass.initComponent.call(this);this.atFlag=false;this.moduleRecord=Wtf.data.Record.create([{name:"coursename",type:"string"},{name:"courseid",type:"string"},{name:"programid",type:"string"},{name:"code",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data"},this.moduleRecord);this.moduleStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader});this.programRecord=Wtf.data.Record.create([{name:"programid",type:"string"},{name:"programname",type:"string"},{name:"programtype"},{name:"programtype",type:"int"}]);this.programReader=new Wtf.data.KwlJsonReader({root:"data"},this.programRecord);this.programStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.programReader,listeners:{scope:this,load:function(C){var E=C.find("programid",this.programid);if(E!=-1){var D=C.getAt(E);this.pType=D.get("programtype")}}}});this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"},{name:"code",type:"string"},{name:"startdate",dateFormat:"Y-m-d",type:"date"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,disabled:true,minWidth:30});this.criBttn.on("click",this.onComboValChange,this);this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",tooltip:"Clear selected criteria",id:"btnClear"+this.id,scope:this,minWidth:30});this.clearBttn.on("click",function(){this.programCombo.setValue("");this.courseCombo.setValue("");this.sessionCombo.setValue("");this.criBttn.disable()},this);if(isRoleGroup("4")){this.MSComboconfig1={id:"session"+this.id,hiddenName:"sessionid",store:this.sessionStore,readOnly:true,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",fieldLabel:"Session*",valueField:"sessionid",allowBlank:false};this.sessionCombo=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},this.MSComboconfig1))}else{this.sessionCombo=new Wtf.form.ComboBox({id:"session"+this.id,hiddenName:"sessionid",store:this.sessionStore,readOnly:true,displayField:"sessionname",mode:"local",listWidth:300,triggerAction:"all",emptyText:"Select a session...",fieldLabel:"Session*",valueField:"sessionid",allowBlank:false})}var B=new Wtf.comboBox({});this.facyltycombo=B.getFacultyCombo();this.sectionCombo=B.getSectionCombo(false);this.sectionComboStore=B.getSectionComboStore();this.facyltycombo.disable();if(this.sectionFlag){if(Wtf.isHoP()){this.sectionCombo.enable();this.sectionComboStore.on("load",function(C){var D=C.find("subcscheduleid",this.moduleid);if(D!=-1){this.sectionCombo.setValue(this.moduleid)}else{this.sectionCombo.setValue("")}},this);this.sectionCombo.on("select",function(E,C,D){this.moduleid=E.getValue();this.criBttn.enable()},this);this.sectionComboStore.load({params:{moduleid:this.courseid,sessionid:this.sessionid}})}}else{this.sectionCombo.disable()}this.edate=new Wtf.form.DateField({fieldLabel:"End Date:",width:80,disabled:true,hidden:true,allowBlank:false,format:Wtf.getDateFormat()});this.sdate=new Wtf.form.DateField({fieldLabel:"Start Date:",allowBlank:false,width:80,hidden:true,disabled:true,format:Wtf.getDateFormat(),listeners:{scope:this,change:function(F,D,C){this.edate.reset();if(D!=""){this.edate.setMinValue(D);var E=new Date(D).add(Date.MONTH,6);this.edate.setValue(E)}}}});this.programCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.programStore,mode:"local",readOnly:true,displayField:"programname",fieldLabel:"Program*",hiddenName:"programid",valueField:"programid",allowBlank:false,emptyText:"Select a program..."});this.courseCombo=new Wtf.form.ComboBox({id:"course"+this.id,store:this.moduleStore,readOnly:true,displayField:"coursename",mode:"local",triggerAction:"all",emptyText:"Select a Course...",fieldLabel:"Course/Group*",name:"courseid",valueField:"courseid",allowBlank:false});this.acceptGrade=new Wtf.Toolbar.Button({tooltip:"Validate Grades",text:"Approve",hidden:(isRoleGroup("4"))?true:false,disabled:true,scope:this,handler:function(C,D){Wtf.MessageBox.confirm("Accept Grades","Are you sure you want to validate grades of all students?",function(E){if(E=="yes"){this.accept_reject_grade("Approve",10)}},this)}});this.graphBtn=new Wtf.Toolbar.Button({tooltip:"Result Analysis Graph",text:"Result Analysis Graph",hidden:(isRoleGroup("4"))?true:false,scope:this,handler:function(C,D){this.makeresultAnalysisGraph(this.grafData)}});this.rejectGrade=new Wtf.Toolbar.Button({tooltip:"Reject Grades",text:"Reject",hidden:(isRoleGroup("4"))?true:false,disabled:true,scope:this,handler:function(C,D){Wtf.MessageBox.confirm("Reject Grades","Are you sure you want to reject grades of all students?",function(E){if(E=="yes"){this.accept_reject_grade("Reject",10)}},this)}});this.resultSM=new Wtf.grid.CheckboxSelectionModel({listeners:{scope:this,beforerowselect:function(F,G,E,D){var C=true;if(D.get("total")=="0"){C=false}return C},selectionchange:function(C){if(C.getCount()>0){if(!isRoleGroup("4")){this.acceptGrade.enable();this.rejectGrade.enable()}else{this.acceptGrade.disable();this.rejectGrade.disable()}}else{this.rejectGrade.disable();this.acceptGrade.disable()}}}});this.resultAnaCM=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer({}),this.resultSM,{header:"Name",dataIndex:"name"},{header:"Session",dataIndex:"code"},{header:"A",dataIndex:"pd"},{header:"A %",dataIndex:"pdpercent"},{header:"B",dataIndex:"pass"},{header:"B %",dataIndex:"passpercent"},{header:"F",dataIndex:"fail"},{header:"F %",dataIndex:"failpercent"},{header:"Total",dataIndex:"total"}]);this.resultAnaStore=new Wtf.data.JsonStore({root:"dataanalysis",fields:["moduleid","code","name","dist","distpercent","merit","meritpercent","avg","avgpercent","aa","aapercent","pd","pdpercent","pass","passpercent","fail","failpercent","total","atpass","atfail","inprogress","inprogressextend","atpassper","atfailper","inprogressper","inprogressextendper","inprogessextend","inprogessextendper"],autoLoad:false});this.resultAnalyGrid=new Wtf.grid.GridPanel({ds:this.resultAnaStore,cm:this.resultAnaCM,sm:this.resultSM,border:false,autoScroll:true,loadMask:{msg:"Loading Programs..."},viewConfig:{forceFit:true},bbar:[this.acceptGrade,this.rejectGrade,this.graphBtn]});this.programCombo.on("select",this.programSelect,this);this.courseCombo.on("select",function(E,C,D){this.courseid=E.getValue();if(C.get("code")=="CP003"){this.atFlag=true;this.sessionCombo.disable();this.sectionCombo.disable();this.criBttn.enable()}else{this.atFlag=false;this.sessionCombo.enable();this.facyltycombo.disable();this.edate.disable();this.sdate.disable();this.sectionComboStore.removeAll();this.sectionComboStore.load({params:{moduleid:this.courseid,sessionid:this.sessionid}})}},this);this.sessionCombo.on("select",this.enableCriteria,this);this.moduleStore.on("load",function(C,D){C.commitChanges();if(Wtf.realroles.indexOf("46")>-1){var E=C.find("courseid",this.courseid);if(E!=-1){this.courseCombo.setValue(this.courseid)}if(this.sessionid=="NA"){this.atFlag=true;this.sessionCombo.disable();this.criBttn.enable();this.onComboValChange()}else{this.atFlag=false}}},this);this.sessionStore.on("load",function(C,D){if(Wtf.realroles.indexOf("46")>-1){if(this.sessionid!="NA"){this.sessionCombo.setValue(this.sessionid);this.criBttn.enable();this.onComboValChange()}}},this)},accept_reject_grade:function(D,C){var A=this.resultSM.getSelections();var B="";if(A.length>0){Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",waitMsg:"Updating status..",params:{mode:C,courseid:this.courseCombo.getValue(),session:this.sessionCombo.getValue(),moduleid:this.moduleid,sectionFlag:this.sectionFlag,uid:loginid,action:D},scope:this,success:function(E,F){var G=Wtf.util.JSON.decode(E.responseText);if(G.success){msgBoxShow([D,"Grade status updated."],Wtf.MessageBox.INFO);this.onComboValChange()}else{msgBoxShow([D,"Error in updating grade.Please try again."],Wtf.MessageBox.ERROR)}},failure:function(){if(C==10){msgBoxShow(["Error","Error occurred while accepting the grades. Please try again later."],Wtf.MessageBox.ERROR)}else{msgBoxShow(["Error","Error occurred while rejecting the grades. Please try again later."],Wtf.MessageBox.ERROR)}}})}},enableCriteria:function(C,B){if(this.courseCombo.isValid()&&this.sessionCombo.isValid()&&B){this.sessionid=C.getValue();var A=B.get("startdate").format("Y-m-d");if(A<"2010-01-11"){this.sectionFlag=false;this.sectionCombo.disable()}else{if(Wtf.isHoP()){this.sectionFlag=true;this.sectionCombo.enable();this.sectionComboStore.removeAll();if(this.courseid&&this.sessionid){this.sectionComboStore.load({params:{moduleid:this.courseid,sessionid:this.sessionid}})}}}this.criBttn.enable()}},programSelect:function(B,C,A){this.pType=C.get("programtype");this.courseCombo.setValue("");this.programid=C.data["programid"];this.moduleStore.load({params:{type:"programsessioncourse",programid:this.programid}});this.criBttn.disable()},onRender:function(A){Wtf.ExamResultGrid.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask));var B;if(Wtf.realroles.indexOf("46")>-1){B={type:106,userid:loginid}}else{B={type:20}}this.programStore.load({params:B});this.sessionStore.load();this.loadMask.show();Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:"examresult",ptype:0,programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue(),sessionid:this.sessionCombo.getValue(),sectionFlag:this.sectionFlag,sectionid:this.sectionFlag?this.sectionCombo.getValue():this.moduleid,status:(Wtf.realroles.indexOf("46")>-1)?"1,2":"4,8",isAsad:(Wtf.realroles.indexOf("46")>-1)?false:true}},this,function(C,D){this.createGrid(C);this.DisplayReport();if(Wtf.realroles.indexOf("46")>-1){this.programCombo.setValue(this.programid);var F=this.programStore.find("programid",this.programid);if(F!=-1){var E=this.programStore.getAt(F);this.pType=E.get("programtype");this.programSelect(this.programCombo,E,1);Wtf.getCmp("resultgraph"+this.id).destroy();Wtf.getCmp("centerRegion_"+this.id).doLayout()}}this.loadMask.hide()},function(D,C){this.loadMask.hide()})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.classregstore=new Wtf.data.JsonStore({fields:this.createFields(obj.columnheader),data:obj.data});this.temprecord=Wtf.data.Record.create(this.createFields(obj.columnheader));this.jsonReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.temprecord);this.simstore=new Wtf.data.Store({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.jsonReader,remoteSort:true});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.simstore,border:false,title:"Exam Result",layout:"fit",loadMask:{msg:"Loading..."},autoScroll:true,autoWidth:true,bbar:new Wtf.PagingToolbar({pageSize:25,emptyMsg:"No records to display",store:this.simstore,displayInfo:true,displayMsg:"{0} - {1} of {2}",items:[this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var str=Wtf.urlEncode({ptype:this.pType,programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue(),sessionid:this.sessionCombo.getValue(),sectionFlag:this.sectionFlag,sectionid:this.sectionFlag?this.sectionCombo.getValue():this.moduleid,reptype:"result",type:"reports",status:(Wtf.realroles.indexOf("46")>-1)?"1,2":"4,8",isAsad:(Wtf.realroles.indexOf("46")>-1)?false:true,dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+str)}})]})});this.simstore.proxy.data=obj;this.simstore.load({params:{start:0,limit:25}});this.resultAnaStore.loadData(obj,false);this.reportGrid2=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.classregstore,border:false,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}})},makeresultAnalysisGraph:function(M){if(Wtf.getCmp("ResultGraphinnerPanel")){Wtf.getCmp("ResultGraphinnerPanel").destroy()}var E="";var B="";var H="";var Q="";var I="";var G="";var F="";var C="";var L="";var A="";var O="";var R="";var J="";if(this.sectionFlag){J="15,20,25"}else{J="10,0,20"}if(this.pType==1){for(var P=0;P<M.length;P++){R+=M[P].name+"|";if(M[P].distpercent){Q+=M[P].distpercent+","}else{Q+=0+","}if(M[P].meritpercent){I+=M[P].meritpercent+","}else{I+=0+","}if(M[P].aapercent){G+=M[P].aapercent+","}else{G+=0+","}if(M[P].avgpercent){F+=M[P].avgpercent+","}else{F+=0+","}if(M[P].failpercent){H+=M[P].failpercent+","}else{H+=0+","}}if(Q.length>0){Q=Q.substr(0,Q.length-1)+"|"+I.substr(0,I.length-1)+"|"+G.substr(0,G.length-1)+"|"+F.substr(0,F.length-1)+"|"+H.substr(0,H.length-1);R=R.substring(0,R.length-1);R=R.replace(/ /g,"+")}var N='<div><img id="chartdiv2" src ="http://chart.apis.google.com/chart?cht=bvg&chd=t:'+Q+"&chs=1000x200&chbh="+J+"&chg=100,5&chco=2060FFFF,EE8800,994499,99BBE8,CC3333&chxt=y,x&chl="+R+'&chdl=Distinction|Merit|Above Avg|Avg|Fail&chtt=Percentage+by+Modules"</img></div>'}else{if(this.atFlag){for(var P=0;P<M.length;P++){if(M[P].atpassper){C+=M[P].atpassper+","}else{C+=M[P].atpassper+","}if(M[P].atfailper){L+=M[P].atfailper+","}else{L+=M[P].atfailper+","}if(M[P].inprogressper){A+=M[P].inprogressper+","}else{A+=M[P].inprogressper+","}if(M[P].inprogessextendper){O+=M[P].inprogessextendper+","}else{O+=M[P].inprogessextendper+","}}if(C.length>0){C=C.substr(0,C.length-1)+"|"+L.substr(0,L.length-1)+"|"+A.substr(0,A.length-1)+"|"+O.substr(0,O.length-1)}var N='<div><img id="chartdiv2" src ="http://chart.apis.google.com/chart?cht=bvg&chd=t:'+C+"&chs=1000x200&chbh="+J+'&chg=100,5&chco=2060FFFF,8B0000,EED800,FF0000&chxt=x,y&chxl=0:|PPP|Articleship|1:1|2&chdl=P|F|IP|IPE&chtt=Percentage+by+Modules"</img></div>'}else{for(var P=0;P<M.length;P++){R+=M[P].name+"|";if(M[P].pdpercent){E+=M[P].pdpercent+","}else{E+=M[P].pdpercent+","}if(M[P].passpercent){B+=M[P].passpercent+","}else{B+=M[P].passpercent+","}if(M[P].failpercent){H+=M[P].failpercent+","}else{H+=M[P].failpercent+","}}if(E.length>0){E=E.substr(0,E.length-1)+"|"+B.substr(0,B.length-1)+"|"+H.substr(0,H.length-1);R=R.substring(0,R.length-1);R=R.replace(/ /g,"+")}var N='<div><img id="chartdiv2" src ="http://chart.apis.google.com/chart?cht=bvg&chd=t:'+E+"&chs=1000x200&chbh="+J+"&chg=100,5&chco=2060FFFF,8B0000,EED800&chxt=y,x&chl="+R+'&chdl=A|B|F&chtt=Percentage+by+Modules"</img></div>'}}var K=new Wtf.Panel({id:"ResultGraphinnerPanel",border:false,layout:"fit",autoScroll:true,html:N});if(isRealRoles("46")){var D=new Wtf.Window({layout:"fit",width:"40%",autoScroll:true,title:"Result Analysis Graph",items:[K]}).show()}else{document.getElementById("ResultGraphinnerPanelresult").innerHTML=N;Wtf.getCmp("resultgraph"+this.id).doLayout()}},DisplayReport:function(){if(isRoleGroup("4")){this.panel=new Wtf.Panel({border:false,tbar:["Programme* :",this.programCombo,"-","Course/Group* :",this.courseCombo,"-","Session* :",this.sessionCombo,"-",this.criBttn,"-",this.clearBttn],layout:"fit",bbar:[],items:[{border:false,autoScroll:true,bodyStyle:"background:transparent;",layout:"fit",id:"subPanel"+this.id,tbar:["Faculty :",this.facyltycombo,"-","Section:",this.sectionCombo,this.sdate,this.edate],items:[{layout:"border",border:false,items:[{region:"north",id:"centerClasaRegRegion"+this.id,border:false,baseCls:"reportCont",paging:false,autoLoad:false,layout:"fit",split:true,bodyStyle:"background:transparent;",items:[this.reportGrid]},{region:"center",id:"centerRegion_"+this.id,border:false,bodyStyle:"background:transparent;",layout:"border",items:[{region:"east",split:true,border:false,paging:false,width:"50%",id:"resultgraph"+this.id,autoLoad:false,autoScroll:true,html:"<div id = 'ResultGraphinnerPanelresult'></div>",title:"Result Analysis Graph",bodyStyle:"background:white;"},{region:"center",width:"50%",title:"Result Analysis Report",paging:false,autoLoad:false,bodyStyle:"background:transparent;",id:"resultanalysisgraph",border:false,layout:"fit",split:true,items:[this.resultAnalyGrid]}]}]}]}]})}else{this.panel=new Wtf.Panel({border:false,tbar:["Programme* :",this.programCombo,"-","Course/Group* :",this.courseCombo,"-","Session* :",this.sessionCombo,"-",this.criBttn,"-",this.clearBttn],layout:"fit",bbar:[],items:[{border:false,autoScroll:true,bodyStyle:"background:transparent;",layout:"fit",id:"subPanel"+this.id,tbar:["Section:",this.sectionCombo],items:[{layout:"border",border:false,items:[{region:"north",id:"centerClasaRegRegion"+this.id,border:false,baseCls:"reportCont",paging:false,autoLoad:false,layout:"fit",split:true,bodyStyle:"background:transparent;",items:[this.reportGrid]},{region:"center",id:"centerRegion_"+this.id,border:false,bodyStyle:"background:transparent;",layout:"border",items:[{region:"east",split:true,border:false,id:"resultgraph"+this.id,paging:false,autoLoad:false,autoScroll:true,html:"<div id = 'ResultGraphinnerPanelresult'></div>",title:"Result Analysis Graph",bodyStyle:"background:white;"},{region:"center",width:"50%",title:"Result Analysis Report",paging:false,autoLoad:false,bodyStyle:"background:transparent;",id:"resultanalysisgraph",border:false,layout:"fit",split:true,items:[this.resultAnalyGrid]}]}]}]}]})}this.add(this.panel);this.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["sortable"]=true;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A},onComboValChange:function(obj,newval,oldval){var data={};if(Wtf.realroles.indexOf("46")>-1){data={type:"examresult",ptype:this.pType,programid:this.programid,courseid:this.courseid,sessionid:this.sessionid,sectionid:this.moduleid,sectionFlag:this.sectionFlag,status:"1,2",isAsad:false}}else{data={type:"examresult",ptype:this.pType,programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue(),sessionid:this.sessionCombo.getValue(),sectionFlag:this.sectionFlag,sectionid:this.sectionCombo.getValue(),status:"4,8",isAsad:true}}this.loadMask.show();Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:data},this,function(response,e){if(this.reportGrid){Wtf.getCmp("centerClasaRegRegion"+this.id).remove(this.reportGrid)}this.createGrid(response);this.grafData=eval("("+response.trim()+")").dataanalysis;if(isRoleGroup("4")){this.makeresultAnalysisGraph(this.grafData)}Wtf.getCmp("centerClasaRegRegion"+this.id).add(this.reportGrid);if(this.pType==1){this.resultAnaStore2=new Wtf.data.JsonStore({root:"dataanalysis",fields:["name","code","dist","distpercent","merit","meritpercent","avg","avgpercent","aa","aapercent","fail","failpercent","total"]});this.resultAnaCM2=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer({}),this.resultSM,{header:"Name",dataIndex:"name"},{header:"Session",dataIndex:"code"},{header:"Distinction",dataIndex:"dist"},{header:"Distinction %",dataIndex:"distpercent"},{header:"Merit",dataIndex:"merit"},{header:"Merit %",dataIndex:"meritpercent"},{header:"Above Average",dataIndex:"aa"},{header:"Above Average %",dataIndex:"aapercent"},{header:"Average",dataIndex:"avg"},{header:"Average %",dataIndex:"avgpercent"},{header:"Pass",dataIndex:"pass"},{header:"Pass %",dataIndex:"passpercent"},{header:"Fail",dataIndex:"fail"},{header:"Fail %",dataIndex:"failpercent"},{header:"Total",dataIndex:"total"}]);this.resultAnalyGrid.reconfigure(this.resultAnaStore,this.resultAnaCM2)}else{if(this.atFlag){this.resultAnaStore2=new Wtf.data.JsonStore({root:"dataanalysis",fields:["mname","name","total"]});this.resultAnaCM2=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer({}),this.resultSM,{header:"Code",dataIndex:"name"},{header:"Session",dataIndex:"code"},{header:"P",dataIndex:"atpass"},{header:"P %",dataIndex:"atpassper"},{header:"F",dataIndex:"atfail"},{header:"F %",dataIndex:"atfailper"},{header:"IP",dataIndex:"inprogress"},{header:"IP %",dataIndex:"inprogressper"},{header:"IPE",dataIndex:"inprogessextend"},{header:"IPE %",dataIndex:"inprogessextendper"},{header:"Total",dataIndex:"total"}]);this.resultAnalyGrid.reconfigure(this.resultAnaStore,this.resultAnaCM2)}else{this.resultAnalyGrid.reconfigure(this.resultAnaStore,this.resultAnaCM)}}this.doLayout();this.loadMask.hide()},function(resp,req){this.loadMask.hide()})}});Wtf.ApplicationStatistics=function(A){Wtf.apply(this,A);Wtf.ApplicationStatistics.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.ApplicationStatistics,Wtf.Panel,{initComponent:function(A){Wtf.ApplicationStatistics.superclass.initComponent.call(this);this.programRecord=Wtf.data.Record.create([{name:"programid",type:"string"},{name:"programname",type:"string"}]);this.programReader=new Wtf.data.KwlJsonReader({root:"data"},this.programRecord);this.programStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.programReader});this.programStore.on("load",function(){this.criBttn.enable()},this);this.programCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.programStore,mode:"local",readOnly:true,displayField:"programname",fieldLabel:"Program*",hiddenName:"programid",valueField:"programid",allowBlank:false,emptyText:"Select a program..."});this.userDate=new Wtf.form.DateField({fieldLabel:"Date*",width:140,allowBlank:false,name:"userdate",format:Wtf.getDateFormat(),value:new Date()});this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,disabled:true,minWidth:30});this.criBttn.on("click",this.onComboValChange,this);this.csv1=new Wtf.menu.Item({text:"Statistics by Gender",scope:this,handler:function(){var B=Wtf.urlEncode({programid:this.programCombo.getValue(),userdate:this.userDate.getValue().format("Y-m-d"),reptype:"gender",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+B)}});this.csv2=new Wtf.menu.Item({text:"Statistics by Religion",scope:this,handler:function(){var B=Wtf.urlEncode({programid:this.programCombo.getValue(),userdate:this.userDate.getValue().format("Y-m-d"),type:"reports",reptype:"religion",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+B)}});this.gendregionCM=new Wtf.grid.ColumnModel([{header:"Category",dataIndex:"Category"},{header:"Total",dataIndex:"Total"},{header:"Male",dataIndex:"Male"},{header:"Female",dataIndex:"Female"},{header:"Muslim",dataIndex:"Muslim"},{header:"Non Muslim",dataIndex:"Non Muslim"}]);this.gendregionStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["Category","Total","Male","Female","Muslim","Non Muslim"]),autoLoad:false,url:"jspfiles/report.jsp"});this.gendregionStore.on("load",this.makeresultAnalysisGraph,this);this.gendregionGrid=new Wtf.grid.GridPanel({ds:this.gendregionStore,cm:this.gendregionCM,border:false,layout:"fit",autoScroll:true,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true,autoFill:true}});this.nationStaticCM=new Wtf.grid.ColumnModel([{header:"Nationality",dataIndex:"nationality"},{header:"Registered",dataIndex:"registered"},{header:"Offered",dataIndex:"offered"},{header:"Total",dataIndex:"total"}]);this.nationStaticStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["nationality","registered","offered","total"]),autoLoad:false,url:"jspfiles/report.jsp",baseParams:{type:"nationalityStatistics"}});this.nationalityGrid=new Wtf.grid.GridPanel({ds:this.nationStaticStore,cm:this.nationStaticCM,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.doLayout()},onRender:function(A){Wtf.ApplicationStatistics.superclass.onRender.call(this,A);this.panel=new Wtf.Panel({border:false,bodyStyle:"background:transparent;",layout:"fit",tbar:["Program   :",this.programCombo,"-","  Date*  :",this.userDate,"-",this.criBttn,"-",this.programOperBttn=new Wtf.Toolbar.Button({text:"Export",tooltip:"Click to open",id:"examscheduleMenu"+this.id,scope:this,menu:[this.csv1,this.csv2]})],items:[{layout:"border",items:[{region:"north",border:false,baseCls:"reportCont",layout:"border",items:[{title:"Student Statistics by Gender and Religion",region:"center",paging:false,autoLoad:false,bodyStyle:"background:transparent;",border:false,layout:"fit",items:[this.gendregionGrid]},{border:false,region:"east",width:500,id:"gendreganalysisgraph",paging:false,split:true,autoLoad:false,autoScroll:true,title:"Student Statistics by Gender (Graph)",html:"<div id = 'ResultGraphinnerPanel1'></div>",layout:"fit",bodyStyle:"background:white;"}]},{region:"center",border:false,baseCls:"reportCont",layout:"border",items:[{title:"Application Statistics",region:"center",paging:false,autoLoad:false,bodyStyle:"background:transparent;",border:false,layout:"fit",split:true,items:[this.nationalityGrid]},{region:"east",width:500,border:false,paging:false,autoLoad:false,split:true,autoScroll:true,id:"natanalysisgraph",html:"<div id = 'ResultGraphinnerPanel'></div>",title:"Student Statistics by Religion (Graph)",layout:"fit",bodyStyle:"background:white;"}]}]}]});this.add(this.panel);this.programStore.load({params:{type:20}})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.classregstore=new Wtf.data.JsonStore({fields:this.createFields(obj.columnheader),data:obj.data});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.classregstore,border:false,title:"Exam Result",layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.resultAnaStore.loadData(obj,false);this.reportGrid2=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.classregstore,border:false,autoScroll:true,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}})},makeresultAnalysisGraph:function(){var C="0";var B=this.gendregionStore.getAt(2);if(B.data["Muslim"]!=""){C=(B.data["Muslim"]/B.data["Total"])*100}if(B.data["Non Muslim"]!=""){C+=","+(B.data["Non Muslim"]/B.data["Total"])*100}var A='<div><img style = "padding:50px" src ="http://chart.apis.google.com/chart?cht=p3&chd=t:'+C+'&chs=350x150&chl=Muslim|NonMuslim&chtt=Student+Statistics+by Religion&chts=0000dd,15"</img></div>';document.getElementById("ResultGraphinnerPanel").innerHTML=A;C="0";if(B.data["Male"]!=""){C=(B.data["Male"]/B.data["Total"])*100}if(B.data["Female"]!=""){C+=","+(B.data["Female"]/B.data["Total"])*100}var D='<div><img style = "padding:50px" src ="http://chart.apis.google.com/chart?cht=p3&chd=t:'+C+'&chs=350x150&chl=Male|Female&chtt=Student+Statistics+by Gender&chts=0000dd,15"</img></div>';document.getElementById("ResultGraphinnerPanel1").innerHTML=D},onComboValChange:function(C,B,A){this.gendregionStore.load({params:{type:"applicationstatistics",programid:this.programCombo.getValue(),userdate:this.userDate.getValue().format("Y-m-d")}});this.nationStaticStore.load({params:{programid:this.programCombo.getValue(),userdate:this.userDate.getValue().format("Y-m-d")}})}});Wtf.TutorialAttendance=function(A){Wtf.apply(this,A);Wtf.TutorialAttendance.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.TutorialAttendance,Wtf.Panel,{initComponent:function(A){Wtf.TutorialAttendance.superclass.initComponent.call(this);this.moduleRecord=Wtf.data.Record.create([{name:"modulename",type:"string"},{name:"moduleid",type:"string"},{name:"courseid",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data"},this.moduleRecord);this.moduleStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader});this.courseRecord=Wtf.data.Record.create([{name:"coursename",type:"string"},{name:"courseid",type:"string"},{name:"programid",type:"string"}]);this.courseReader=new Wtf.data.KwlJsonReader({root:"data"},this.courseRecord);this.courseStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.courseReader});this.programRecord=Wtf.data.Record.create([{name:"programid",type:"string"},{name:"programname",type:"string"}]);this.programReader=new Wtf.data.KwlJsonReader({root:"data"},this.programRecord);this.programStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.programReader});this.programStore.on("load",function(){this.criBttn.enable()},this);this.programCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.programStore,mode:"local",readOnly:true,displayField:"programname",fieldLabel:"Program*",valueField:"programid",allowBlank:false,emptyText:"Select a program..."});this.courseCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.courseStore,mode:"local",readOnly:true,displayField:"coursename",fieldLabel:"Course*",valueField:"courseid",allowBlank:false,emptyText:"Select a course..."});this.moduleCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.moduleStore,mode:"local",readOnly:true,displayField:"modulename",fieldLabel:"Module*",valueField:"moduleid",allowBlank:false,emptyText:"Select a module..."});this.userDate=new Wtf.form.DateField({fieldLabel:"Date*",allowBlank:false,format:"F, Y",value:new Date()});this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,disabled:true,minWidth:30});this.criBttn.on("click",this.onComboValChange,this);this.nationStaticCM=new Wtf.grid.ColumnModel([{header:"Nationality",dataIndex:"nationality"},{header:"Registered",dataIndex:"registered"},{header:"Provisional Offered",dataIndex:"offered"},{header:"Total",dataIndex:"total"}]);this.nationStaticStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["nationality","registered","offered","total"]),autoLoad:false,url:"jspfiles/report.jsp",baseParams:{type:"nationalityStatistics"}});this.nationalityGrid=new Wtf.grid.GridPanel({ds:this.nationStaticStore,cm:this.nationStaticCM,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.panel=new Wtf.Panel({border:false,bodyStyle:"background:transparent;",layout:"border",items:[{title:"Criteria4",region:"north",height:120,border:false,layout:"form",bodyStyle:"background:#f1f1f1;",items:[{border:false,layout:"column",bodyStyle:"padding:5px 5px 5px 5px;background:transparent;",items:[{columnWidth:0.4,layout:"form",border:false,bodyStyle:"background:transparent;",items:this.programCombo},{columnWidth:0.3,layout:"form",border:false,bodyStyle:"background:transparent;",items:this.courseCombo},{columnWidth:0.3,layout:"form",border:false,bodyStyle:"background:transparent;",items:this.moduleCombo}]},{border:false,layout:"column",bodyStyle:"padding:5px 5px 5px 5px;background:transparent;",items:[{columnWidth:0.4,layout:"form",border:false,bodyStyle:"background:transparent;",items:this.userDate},{columnWidth:0.3,layout:"form",border:false,bodyStyle:"background:transparent;",items:this.criBttn}]}]},{region:"center",autoScroll:true,bodyStyle:"background:transparent;",layout:"fit",items:this.nationalityGrid}]});this.add(this.panel);this.panel.doLayout();this.doLayout()},onRender:function(A){Wtf.TutorialAttendance.superclass.onRender.call(this,A);this.programStore.load({params:{type:20}});this.courseStore.load({params:{type:"allcourses"}});this.programStore.load({params:{type:"allmodules"}})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.classregstore=new Wtf.data.JsonStore({fields:this.createFields(obj.columnheader),data:obj.data});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.classregstore,border:false,title:"Exam Result",layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.resultAnaStore.loadData(obj,false);this.reportGrid2=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.classregstore,border:false,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}})},makeresultAnalysisGraph:function(){if(Wtf.getCmp("ResultGraphinnerPanel")){Wtf.getCmp("ResultGraphinnerPanel").destroy()}if(Wtf.getCmp("ResultGraphinnerPanel1")){Wtf.getCmp("ResultGraphinnerPanel1").destroy()}var D="0";var C=this.gendregionStore.getAt(2);if(C.data["Muslim"]!=""){D=C.data["Muslim"]}if(C.data["Non Muslim"]!=""){D+=","+C.data["Non Muslim"]}var B='<div "><img style = "padding:50px" src ="http://chart.apis.google.com/chart?cht=p3&chd=t:'+D+'&chs=350x150&chl=Muslim|NonMuslim"</img></div>';var E=new Wtf.Panel({id:"ResultGraphinnerPanel",border:false,layout:"fit",html:B});Wtf.getCmp("natanalysisgraph").add(E);Wtf.getCmp("natanalysisgraph").doLayout();D="0";if(C.data["Male"]!=""){D=C.data["Male"]}if(C.data["Female"]!=""){D+=","+C.data["Female"]}var F='<div "><img style = "padding:50px" src ="http://chart.apis.google.com/chart?cht=p3&chd=t:'+D+'&chs=350x150&chl=Male|Female"</img></div>';var A=new Wtf.Panel({id:"ResultGraphinnerPanel1",border:false,layout:"fit",html:F});Wtf.getCmp("gendreganalysisgraph").add(A);Wtf.getCmp("gendreganalysisgraph").doLayout()},onComboValChange:function(C,B,A){this.gendregionStore.load({params:{type:"applicationstatistics",programid:this.programCombo.getValue(),userdate:this.userDate.getValue().format("Y-m-d")}});this.nationStaticStore.load({params:{programid:this.programCombo.getValue(),userdate:this.userDate.getValue().format("Y-m-d")}})}});Wtf.moduleList=function(A){Wtf.apply(this,A);Wtf.moduleList.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.moduleList,Wtf.Panel,{initComponent:function(){Wtf.moduleList.superclass.initComponent.call(this);this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,minWidth:30});this.criBttn.on("click",this.onComboChange,this);this.sessionCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.sessionStore,mode:"local",readOnly:true,displayField:"sessionname",fieldLabel:"Session*",hiddenName:"sessionid",valueField:"sessionid",allowBlank:false,emptyText:"Select a session..."});this.comboRecord=Wtf.data.Record.create([{name:"id",type:"string"},{name:"name",type:"string"}]);this.comboReader=new Wtf.data.KwlJsonReader({root:"data"},this.comboRecord);this.courseStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:"retrivetableentry",tablename:"course"},reader:this.comboReader});this.comboBoxDates=new Wtf.form.ComboBox({anchor:"98%",mode:"local",triggerAction:"all",typeAhead:true,editable:false,store:this.courseStore,fieldLabel:"CIFP Courses*",displayField:"name",valueField:"id",allowBlank:false,msgTarget:"side",emptyText:"Select a course..."});this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var A=Wtf.urlEncode({courseid:this.comboBoxDates.getValue(),sessionid:this.sessionCombo.getValue(),reptype:"modulelist",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+A)}})},onComboChange:function(){Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:this.reporttype,filterval:this.comboBoxDates.getValue(),sessionid:this.sessionCombo.getValue()}},this,function(A,B){Wtf.getCmp("centerGridRegion").remove(this.reportGrid);this.createGrid(A);Wtf.getCmp("centerGridRegion").add(this.reportGrid);this.doLayout()},function(B,A){})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.temprecord=Wtf.data.Record.create(this.createFields(obj.columnheader));this.jsonReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.temprecord);this.simstore=new Wtf.data.Store({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.jsonReader,remoteSort:true});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),id:this.id+"_reportGrid",ds:this.simstore,border:false,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true,enableRowBody:true,showPreview:true},bbar:new Wtf.PagingToolbar({pageSize:25,emptyMsg:"No records to display",store:this.simstore,displayInfo:true,displayMsg:"Displaying Records {0} - {1} of {2}",emptyMsg:"No records to display"})});this.simstore.proxy.data=obj;this.simstore.load({params:{start:0,limit:25}})},onRender:function(A){Wtf.ExamDeferPanel.superclass.onRender.call(this,A);this.sessionStore.load();this.sessionStore.on("load",function(B,D){var C=new this.sessionRecord({sessionid:"AllSessions",sessionname:"All Sessions"});B.add(C)},this);this.courseStore.load();Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:this.reporttype,filterval:this.comboBoxDates.getValue(),sessionid:this.sessionCombo.getValue()}},this,function(B,C){this.createGrid(B);this.DisplayReport()},function(C,B){})},DisplayReport:function(){this.panel={border:false,layout:"border",items:[{title:this.combofieldLabel,region:"north",height:0,border:false,layout:"fit",bodyStyle:"background:#f1f1f1;",tbar:[this.combofieldLabel.toString()+"* :",this.comboBoxDates,"-","Session* :",this.sessionCombo,"-",this.criBttn,"-",this.csv1]},{region:"center",autoScroll:true,id:"centerGridRegion",bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,layout:"fit",items:this.reportGrid}]};this.add(this.panel);this.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["width"]=70;C["sortable"]=false;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A}});Wtf.modeOfStudy=function(A){Wtf.apply(this,A);this.modeOfStudyReader=new Wtf.data.KwlJsonReader({totalProperty:"count",root:"data"},["name","id","programname","dateapplied","dateapprove"]);this.modeOfStudySM=new Wtf.grid.CheckboxSelectionModel();this.modeOfStudyCM=new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),this.modeOfStudySM,{header:"Student ID",width:40,dataIndex:"id",sortable:true,groupable:true},{header:"Student Name",dataIndex:"name",sortable:true,groupable:true},{header:"Student Programme",dataIndex:"programname",sortable:true,groupable:true},{header:"Date Applied",dataIndex:"dateapplied",sortable:true,groupable:true},{header:"Date Approved",dataIndex:"dateapprove",sortable:true,groupable:true}]);this.modeOfStudyDs=new Wtf.data.Store({url:"jspfiles/reportNew.jsp",reader:this.modeOfStudyReader});this.fromDate1=new Wtf.form.DateField({fieldLabel:"From Date",emptyText:"Select start date...",width:110,format:"j-m-Y",value:new Date()});this.toDate1=new Wtf.form.DateField({fieldLabel:"To Date",emptyText:"Select end date...",width:110,name:"sdate",format:"j-m-Y",value:new Date()});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,disable:true,handler:function(){if(this.modeOfStudyDs.getCount()>0){var B=Wtf.urlEncode({fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue(),start:0,limit:this.modeOfStudyDs.getTotalCount(),type:"reports",dtype:"attachment",report:"changeModeReport",title:"Change of mode of study report"});setDldUrl("fileDownload.jsp?"+B)}}});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.modeOfStudyDs.baseParams={mode:40,fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue()};this.modeOfStudyDs.load({params:{start:0,limit:5}});this.csv.enable()}});this.modeOfStudyGrid=new Wtf.grid.GridPanel({store:this.modeOfStudyDs,cm:this.modeOfStudyCM,sm:this.modeOfStudySM,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true},tbar:["Applied:","From ",this.fromDate1,"To ",this.toDate1,this.submitBttn],bbar:new Wtf.PagingToolbar({scope:this,pageSize:5,emptyMsg:"No records to display",store:this.modeOfStudyDs,displayInfo:true,displayMsg:"Displaying Records {0} - {1} of {2}",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv]})});Wtf.modeOfStudy.superclass.constructor.call(this,{layout:"fit",border:false,items:[this.modeOfStudyGrid]})};Wtf.extend(Wtf.modeOfStudy,Wtf.Panel,{onRender:function(A){Wtf.modeOfStudy.superclass.onRender.call(this,A)}});Wtf.programWithdraw=function(A){Wtf.apply(this,A);this.programWithdrawReader=new Wtf.data.KwlJsonReader({totalProperty:"count",root:"data"},["name","id","programname","dateapplied"]);this.programWithdrawCM=new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),{header:"Student ID",width:40,dataIndex:"id",sortable:true,groupable:true},{header:"Student Name",dataIndex:"name",sortable:true,groupable:true},{header:"Student Programme",dataIndex:"programname",sortable:true,groupable:true},{header:"Date Applied",dataIndex:"dateapplied",sortable:true,groupable:true}]);this.programWithdrawDs=new Wtf.data.Store({url:"jspfiles/reportNew.jsp",reader:this.programWithdrawReader});this.fromDate1=new Wtf.form.DateField({fieldLabel:"From Date",emptyText:"Select start date...",width:110,format:"j-m-Y",value:new Date()});this.toDate1=new Wtf.form.DateField({fieldLabel:"To Date",emptyText:"Select end date...",width:110,name:"sdate",format:"j-m-Y",value:new Date()});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,disable:true,handler:function(){if(this.programWithdrawDs.getCount()>0){var B=Wtf.urlEncode({fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue(),start:0,limit:this.programWithdrawDs.getTotalCount(),type:"reports",dtype:"attachment",report:"changeProgramReport",title:"Change of Programme report"});setDldUrl("fileDownload.jsp?"+B)}}});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.programWithdrawDs.baseParams={mode:44,fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue()};this.programWithdrawDs.load({params:{start:0,limit:5}});this.csv.enable()}});this.programWithdrawGrid=new Wtf.grid.GridPanel({store:this.programWithdrawDs,cm:this.programWithdrawCM,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true},tbar:["Applied:","From ",this.fromDate1,"To ",this.toDate1,this.submitBttn],bbar:new Wtf.PagingToolbar({scope:this,pageSize:5,emptyMsg:"No records to display",store:this.programWithdrawDs,displayInfo:true,displayMsg:"Displaying Records {0} - {1} of {2}",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv]})});Wtf.programWithdraw.superclass.constructor.call(this,{layout:"fit",border:false,items:[this.programWithdrawGrid]})};Wtf.extend(Wtf.programWithdraw,Wtf.Panel,{onRender:function(A){Wtf.programWithdraw.superclass.onRender.call(this,A)}});Wtf.inactiveStudents=function(A){Wtf.apply(this,A);this.inactiveStudentsReader=new Wtf.data.KwlJsonReader({totalProperty:"count",root:"data"},["name","id","emailid","status","appdate"]);this.inactiveStudentsCM=new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),{header:"Student ID",dataIndex:"id",width:40,sortable:true,groupable:true},{header:"Student Name",dataIndex:"name",sortable:true,groupable:true},{header:"e-mail ID",dataIndex:"emailid",sortable:true,groupable:true},{header:"Reason",width:80,dataIndex:"status",sortable:true,groupable:true},{header:"Date Modified",dataIndex:"appdate",sortable:true,groupable:true}]);this.inactiveStudentsDs=new Wtf.data.Store({url:"jspfiles/reportNew.jsp",reader:this.inactiveStudentsReader});this.fromDate1=new Wtf.form.DateField({fieldLabel:"From Date",emptyText:"Select start date...",width:110,format:"j-m-Y",value:new Date()});this.toDate1=new Wtf.form.DateField({fieldLabel:"To Date",emptyText:"Select end date...",width:110,name:"sdate",format:"j-m-Y",value:new Date()});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,disable:true,handler:function(){if(this.inactiveStudentsDs.getCount()>0){var B=Wtf.urlEncode({fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue(),start:0,limit:this.inactiveStudentsDs.getTotalCount(),type:"reports",dtype:"attachment",report:"changeStatusReport",title:"Change of Status report"});setDldUrl("fileDownload.jsp?"+B)}}});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.inactiveStudentsDs.baseParams={mode:45,fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue()};this.inactiveStudentsDs.load({params:{start:0,limit:5}});this.csv.enable()}});this.inactiveStudentsGrid=new Wtf.grid.GridPanel({store:this.inactiveStudentsDs,cm:this.inactiveStudentsCM,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true},tbar:["Applied:","From ",this.fromDate1,"To ",this.toDate1,this.submitBttn],bbar:new Wtf.PagingToolbar({scope:this,pageSize:5,emptyMsg:"No records to display",store:this.inactiveStudentsDs,displayInfo:true,displayMsg:"Displaying Records {0} - {1} of {2}",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv]})});Wtf.inactiveStudents.superclass.constructor.call(this,{layout:"fit",border:false,items:[this.inactiveStudentsGrid]})};Wtf.extend(Wtf.inactiveStudents,Wtf.Panel,{onRender:function(A){Wtf.inactiveStudents.superclass.onRender.call(this,A)}});Wtf.StudentStatus=function(A){Wtf.StudentStatus.superclass.constructor.call(this,A)};Wtf.extend(Wtf.StudentStatus,Wtf.Panel,{initComponent:function(A){Wtf.StudentStatus.superclass.initComponent.call(this,A)},onRender:function(A){Wtf.StudentStatus.superclass.onRender.call(this,A);this.studid=new Wtf.form.TextField({id:"studnum",scope:this,emptyText:"Enter student ID",listeners:{scope:this,focus:function(){this.studname.reset();this.studname.clearValue()}}});this.studRecord=Wtf.data.Record.create([{name:"name",type:"string"},{name:"metricno",type:"string"},{name:"fullname",type:"string"}]);this.studReader=new Wtf.data.KwlJsonReader({root:"data"},this.studRecord);this.studStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),baseParams:{type:"getAllStudent"},reader:this.studReader});this.studStore.load();this.studname=new Wtf.form.ComboBox({anchor:"98%",mode:"local",triggerAction:"all",typeAhead:true,forceSelection:true,store:this.studStore,fieldLabel:"Enter Student Name",displayField:"fullname",valueField:"metricno",msgTarget:"side",listeners:{scope:this,focus:function(B){this.studid.setValue("")}}});this.submitnum=new Wtf.Button({id:"subbutton"+this.id,text:"Submit",scope:this,handler:function(){var B=this.studname.getValue();if(B.length==0){B=this.studid.getValue()}if(B.length>0){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/report.jsp",params:{studentnum:B,type:"studentstatus"}},this,function(E,H){var G=Wtf.decode(E);if(G.success){this.dataFlag=true;var D={name:G.data[0].name,studentid:G.data[0].studentid,dob:G.data[0].dob,idtype:G.data[0].idtype,idnumber:G.data[0].idnumber,nationality:G.data[0].nationality,religion:G.data[0].religion,address:G.data[0].address,city:G.data[0].city,state:G.data[0].state,countryname:G.data[0].countryname,postcode:G.data[0].postcode,contactno:G.data[0].contactno,mobile:G.data[0].mobile,emailid:G.data[0].emailid,pinfo:G.pinfo};var F=new Wtf.XTemplate('<div style="margin-left:42px">','<table width="70%">',"<tr></tr><tr></tr><tr></tr><tr></tr>","<tr>","<td><b>STUDENT STATUS</b></td>","<td></td>","</tr>","<tr>",'<td style="font-size:12px;">Name : {name}</td>','<td style="font-size:12px;">Student ID : {studentid}</td>',"</tr>","<tr>",'<td style="font-size:12px;">Date of Birth : {dob}</td>',"</tr>","<tr>",'<td style="font-size:12px;">ID Type : {idtype}</td>','<td style="font-size:12px;">ID Number : {idnumber}</td>',"</tr>","<tr>",'<td style="font-size:12px;">Nationality : {nationality}</td>','<td style="font-size:12px;">Religion : {idnumber}</td>',"</tr>","<tr>",'<td style="font-size:12px;">Address : {address}</td>','<td style="font-size:12px;">City : {city}</td>',"</tr>","<tr>",'<td style="font-size:12px;">State : {state}</td>','<td style="font-size:12px;">Country : {countryname}</td>',"</tr>","<tr>",'<td style="font-size:12px;">Postcode : {postcode}</td>',"</tr>","<tr>",'<td style="font-size:12px;">Telephone : {contactno}</td>','<td style="font-size:12px;">Mobile : {mobile}</td>',"</tr>","<tr>",'<td style="font-size:12px;">Email-id : {emailid}</td>',"</tr>","</table>","</div>","<br><br>",'<tpl for="pinfo">',"<br><br><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Program : {programname}",'<div style="margin-left:42px">','<table width="70%" border="1">',"<tr>","<th>Semester</th><th>Status</th>","</tr>",'<tpl for="info">',"<tr><td>{sessionname}</td><td>{access}</td></tr></tpl>","</table>","</div>","</p></tpl>");F.overwrite(this.studpanel.body,D)}else{this.dataFlag=false;var C=new Wtf.XTemplate('<br><br><p style="font-size:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No record for display.</p>');C.overwrite(this.studpanel.body,D)}},function(D,C){})}}});this.exportPdf=new Wtf.Button({id:"export"+this.id,scope:this,text:"Export",handler:function(){if(this.dataFlag){var B=this.studname.getValue();if(B.length==0){B=this.studid.getValue()}var C=Wtf.urlEncode({studentnum:B,flg:11});setDldUrl("PrintInvoice.jsp?"+C)}}});this.studpanel=new Wtf.Panel({id:"studinfo"+this.id,layout:"fit",tbar:["Enter Student Name:",this.studname,"-","Enter Student ID:",this.studid,"-",this.submitnum,"-",this.exportPdf]});this.add(this.studpanel)}});Wtf.ExamResultCompareSemReport=Wtf.extend(Report.abstractClass_Dnyamic_ColModel,{programType:0,getConfig:function(){return{items:[{region:"center",border:false,layout:"fit",split:true,id:"gridPanel"+this.id}],tbar:this.topToolBar}},createTopToolBar:function(){this.comboBoxesTwo=new Wtf.comboBox();this.sem2Combo=this.comboBoxesTwo.getSessionCombo(false);this.comboArray.push("Session 2:");this.comboArray.push(this.sem2Combo);this.comboArray.push("-");this.programOptionCombo=this.comboBoxesTwo.getProgramOptionCombo();this.comboArray.push("Program Option:");this.comboArray.push(this.programOptionCombo);this.comboArray.push("-");this.resultCmb=this.comboBoxesTwo.getResultCombo();this.comboArray.push("Filter By:");this.comboArray.push(this.resultCmb);this.comboArray.push("-");Wtf.ExamResultCompareSemReport.superclass.createTopToolBar.call(this)},handleClear:function(){this.sem2Combo.setValue("");this.programOptionCombo.clearValue();this.programOptionCombo.selectedIndex=-1;this.resultCmb.clearValue();this.resultCmb.reset();Wtf.ExamResultCompareSemReport.superclass.handleClear.call(this)},getColumns:function(){var D=this.courseCombo.getValue();var B=this.sessionCombo.getValue();var A=this.sem2Combo.getValue();if(D&&B&&A){var C={type:this.type,reporttype:this.reporttype,ptype:this.programType,part3Flag:this.courseCode=="CP003",courseid:this.courseCombo.getValue(),coursename:this.courseCombo.getRawValue(),sessionid1:B,sessionid2:A,sessionname1:this.sessionCombo.getRawValue(),sessionname2:this.sem2Combo.getRawValue()};this.sendRequest(C)}},onRender:function(A){Wtf.ExamResultCompareSemReport.superclass.onRender.call(this,A);this.comboBoxes.getCourseComboStore().on("load",function(C,B,D){var E=C.find("code","CP003");if(E!=-1){C.remove(C.getAt(E))}},this);this.comboBoxes.getCourseComboStore().load({params:{type:"programsessioncourse",programid:"71ef3cf8-d51d-4c4d-8fa4-6fc81399421b"}})},showGraph:function(){},getExportParams:function(){var G={};if(this.courseCombo.getValue()!=""&&this.store.getCount()>0){var E=false;var C=false;var D=this.comboBoxes.getSessionComboStore();var B=this.comboBoxesTwo.getSessionComboStore();if(this.courseCode!="CP003"){var F=D.find("sessionid",this.sessionCombo.getValue());var A=D.getAt(F).get("startdate").format("Y-m-d");E=(A>="2010-01-11");F=B.find("sessionid",this.sem2Combo.getValue());A=B.getAt(F).get("startdate").format("Y-m-d");C=(A>="2010-01-11")}G=Wtf.urlEncode({courseid:this.courseCombo.getValue(),coursename:this.courseCombo.getRawValue(),sessionid1:this.sessionCombo.getValue(),sessionname1:this.sessionCombo.getRawValue(),sessionid2:this.sem2Combo.getValue(),sessionname2:this.sem2Combo.getRawValue(),poption:this.programOptionCombo.getValue(),poptionname:this.programOptionCombo.getRawValue(),sectionFlag1:E,sectionFlag2:C,ptype:this.programType,filter:this.resultCmb.getValue(),reportFlag:true,type:this.storeType,dataType:"json",dtype:"attachment",report:this.reporttype,reporttype:this.reporttype,title:this.title,mode:79})}return G},handleExportAsCsv:function(){if(this.store.getCount()>0){setDldUrl("fileDownload.jsp?"+this.getExportParams())}},handleExportAsPdf:function(){if(this.store.getCount()>0){setDldUrl("ReportsServlet.jsp?"+this.getExportParams())}},handleSubmit:function(){var J=this.courseCombo.getValue();var E=this.sessionCombo.getValue();var K=this.sem2Combo.getValue();var G=this.programOptionCombo.getValue();var D=this.resultCmb.getValue();var B=this.comboBoxes.getSessionComboStore();var A=this.comboBoxesTwo.getSessionComboStore();if(J&&E&&K){var I=false;var H=false;var C=false;if(this.courseCode!="CP003"){var L=B.find("sessionid",this.sessionCombo.getValue());var F=B.getAt(L).get("startdate").format("Y-m-d");I=(F>="2010-01-11");L=A.find("sessionid",this.sem2Combo.getValue());F=A.getAt(L).get("startdate").format("Y-m-d");H=(F>="2010-01-11")}else{if(this.programType==0){C=true}}this.store.baseParams={type:this.storeType,reporttype:this.reporttype,courseid:J,coursename:this.courseCombo.getRawValue(),sessionid1:E,sessionid2:K,poption:G,sectionFlag1:I,sectionFlag2:H,ptype:this.programType,part3Flag:C,filter:D,dataType:"json",reportFlag:false};this.store.load({params:{start:0,limit:this.pageSizeGrid}})}}});Wtf.ExamResultGridASAD=function(A){Wtf.apply(this,A);Wtf.ExamResultGrid.superclass.constructor.call(this,{border:false,autoScroll:true})};Wtf.extend(Wtf.ExamResultGridASAD,Wtf.Panel,{initComponent:function(A){Wtf.ExamResultGrid.superclass.initComponent.call(this);this.atFlag=false;this.moduleRecord=Wtf.data.Record.create([{name:"coursename",type:"string"},{name:"courseid",type:"string"},{name:"programid",type:"string"},{name:"code",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data"},this.moduleRecord);this.moduleStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader});this.resultStore=new Wtf.data.SimpleStore({data:[["Marks","marks"],["Grades ","grades"],["Both ","both"]],fields:["name","id"]});this.resultCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{name}" class="x-combo-list-item">{name}</div></tpl>',id:"resulttype"+this.id,hiddenName:"resulttype",store:this.resultStore,readOnly:true,displayField:"name",mode:"local",listWidth:100,width:100,triggerAction:"all",emptyText:"Both",fieldLabel:"Filter By",valueField:"id",allowBlank:false});this.programRecord=Wtf.data.Record.create([{name:"programid",type:"string"},{name:"programname",type:"string"},{name:"programtype"},{name:"programtype",type:"int"}]);this.programReader=new Wtf.data.KwlJsonReader({root:"data"},this.programRecord);this.programStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.programReader,listeners:{scope:this,load:function(C){var E=C.find("programid",this.programid);if(E!=-1){var D=C.getAt(E);this.pType=D.get("programtype")}}}});this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"},{name:"code",type:"string"},{name:"startdate",dateFormat:"Y-m-d",type:"date"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,disabled:true,minWidth:30});this.criBttn.on("click",this.onComboValChange,this);this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",tooltip:"Clear selected criteria",id:"btnClear"+this.id,scope:this,minWidth:30});this.clearBttn.on("click",function(){this.programCombo.setValue("");this.courseCombo.setValue("");this.sessionCombo.setValue("");this.courseCombo.setValue("");this.moduleCombo.setValue("");this.criBttn.disable();this.simstore.removeAll();this.resultAnalyGrid.getStore().removeAll();document.getElementById("ResultGraphinnerPanelresult").innerHTML=""},this);if(isRoleGroup("4")){this.MSComboconfig1={tpl:'<tpl for="."><div wtf:qtip="{sessionname}" class="x-combo-list-item">{sessionname}</div></tpl>',id:"session"+this.id,hiddenName:"sessionid",store:this.sessionStore,readOnly:true,displayField:"sessionname",mode:"local",width:160,listWidth:250,triggerAction:"all",emptyText:"Select a session...",fieldLabel:"Session*",valueField:"sessionid",allowBlank:false};this.sessionCombo=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},this.MSComboconfig1));this.moduleComboRecord=new Wtf.data.Record.create([{name:"modulename",type:"string"},{name:"moduleid",type:"string"},{name:"code",type:"string"}]);this.moduleComboReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.moduleComboRecord);this.moduleComboStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleComboReader});this.MSComboconfig={tpl:'<tpl for="."><div wtf:qtip="{modulename}" class="x-combo-list-item">{modulename}</div></tpl>',id:"module"+this.id,store:this.moduleComboStore,readOnly:true,displayField:"modulename",mode:"local",Width:160,triggerAction:"all",emptyText:"Select a Module...",fieldLabel:"Module*",name:"moduleid",valueField:"moduleid",allowBlank:false};this.moduleCombo=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},this.MSComboconfig))}else{this.sessionCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{sessionname}" class="x-combo-list-item">{sessionname}</div></tpl>',id:"session"+this.id,hiddenName:"sessionid",store:this.sessionStore,readOnly:true,displayField:"sessionname",mode:"local",listWidth:300,triggerAction:"all",emptyText:"Select a session...",fieldLabel:"Session*",valueField:"sessionid",allowBlank:false})}var B=new Wtf.comboBox({});this.facyltycombo=B.getFacultyCombo();this.sectionCombo=B.getSectionCombo(false);this.sectionComboStore=B.getSectionComboStore();this.facyltycombo.disable();if(this.sectionFlag){if(Wtf.isHoP()){this.sectionCombo.enable();this.sectionComboStore.on("load",function(C){var D=C.find("subcscheduleid",this.moduleid);if(D!=-1){this.sectionCombo.setValue(this.moduleid)}else{this.sectionCombo.setValue("")}},this);this.sectionCombo.on("select",function(E,C,D){this.moduleid=E.getValue();this.criBttn.enable()},this);this.sectionComboStore.load({params:{moduleid:this.courseid,sessionid:this.sessionid}})}}else{this.sectionCombo.disable()}this.edate=new Wtf.form.DateField({fieldLabel:"End Date:",width:80,disabled:true,hidden:true,allowBlank:false,format:Wtf.getDateFormat()});this.sdate=new Wtf.form.DateField({fieldLabel:"Start Date:",allowBlank:false,width:80,hidden:true,disabled:true,format:Wtf.getDateFormat(),listeners:{scope:this,change:function(F,D,C){this.edate.reset();if(D!=""){this.edate.setMinValue(D);var E=new Date(D).add(Date.MONTH,6);this.edate.setValue(E)}}}});this.programCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{programname}" class="x-combo-list-item">{programname}</div></tpl>',triggerAction:"all",store:this.programStore,mode:"local",readOnly:true,displayField:"programname",fieldLabel:"Program*",hiddenName:"programid",valueField:"programid",allowBlank:false,width:160,emptyText:"Select a program..."});this.courseCombo=new Wtf.form.ComboBox({tpl:'<tpl for="."><div wtf:qtip="{coursename}" class="x-combo-list-item">{coursename}</div></tpl>',id:"course"+this.id,store:this.moduleStore,readOnly:true,displayField:"coursename",mode:"local",triggerAction:"all",emptyText:"Select a Course...",fieldLabel:"Course/Group*",name:"courseid",valueField:"courseid",width:160,allowBlank:false});this.resultSM=new Wtf.grid.CheckboxSelectionModel({listeners:{scope:this,beforerowselect:function(F,G,E,D){var C=true;if(D.get("total")=="0"){C=false}return C},selectionchange:function(C){if(C.getCount()>0){if(!isRoleGroup("4")){this.acceptGrade.enable();this.rejectGrade.enable()}else{this.acceptGrade.disable();this.rejectGrade.disable()}}else{this.rejectGrade.disable();this.acceptGrade.disable()}}}});this.resultAnaCM=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer({}),this.resultSM,{header:"Name",dataIndex:"name"},{header:"Session",dataIndex:"code"},{header:"A",dataIndex:"pd"},{header:"A %",dataIndex:"pdpercent"},{header:"B",dataIndex:"pass"},{header:"B %",dataIndex:"passpercent"},{header:"F",dataIndex:"fail"},{header:"F %",dataIndex:"failpercent"},{header:"Total",dataIndex:"total"}]);this.resultAnaStore=new Wtf.data.JsonStore({root:"dataanalysis",fields:["moduleid","code","name","dist","distpercent","merit","meritpercent","avg","avgpercent","aa","aapercent","pd","pdpercent","pass","passpercent","fail","failpercent","total","atpass","atfail","inprogress","inprogressextend","atpassper","atfailper","inprogressper","inprogressextendper","inprogessextend","inprogessextendper"],autoLoad:false});this.resultAnaExport=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var C=Wtf.urlEncode({ptype:this.pType,programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue(),sessionid:this.sessionCombo.getValue(),sectionFlag:this.sectionFlag,sectionid:this.sectionFlag?this.sectionCombo.getValue():this.moduleid,reptype:"result",type:"reports",moduleid:this.moduleCombo.getValue(),status:(Wtf.realroles.indexOf("46")>-1)?"1,2":"4,8",isAsad:(Wtf.realroles.indexOf("46")>-1)?false:true,dtype:"attachment",report:"applicationstatisticscsv",resulttype:this.resultCombo.getValue()});setDldUrl("fileDownload.jsp?"+C)}});this.resultAnalyGrid=new Wtf.grid.GridPanel({ds:this.resultAnaStore,cm:this.resultAnaCM,sm:this.resultSM,border:false,autoScroll:true,loadMask:{msg:"Loading Programs..."},viewConfig:{forceFit:true}});this.resultCombo.on("select",function(){if(this.programCombo.isValid()&&this.courseCombo.isValid()&&this.sessionCombo.isValid()&&this.moduleCombo.isValid()){if(this.criBttn.disabled==false){this.onComboValChange()}}},this);this.programCombo.on("select",this.programSelect,this);this.courseCombo.on("select",function(E,C,D){this.courseid=E.getValue();this.criBttn.disable();this.moduleCombo.setValue("");this.sessionCombo.setValue("");if(C.get("code")=="CP003"){this.atFlag=true;this.sessionCombo.disable();this.sectionCombo.disable();if(isRoleGroup("4")){this.facyltycombo.enable();this.criBttn.enable();this.edate.enable();this.sdate.enable()}this.moduleCombo.setValue("");this.moduleComboStore.load({params:{type:"examreultsreportmodule",courseid:this.courseid}})}else{this.atFlag=false;this.sessionCombo.enable();this.facyltycombo.disable();this.edate.disable();this.sdate.disable();this.sectionComboStore.removeAll();this.sectionComboStore.load({params:{moduleid:this.courseid,sessionid:this.sessionid}})}},this);this.sessionCombo.on("select",this.enableCriteria,this);this.criBttn.disable();this.moduleCombo.on("select",function(){if(this.moduleCombo.isValid()){this.criBttn.enable()}},this);this.moduleStore.on("load",function(C,D){var F="";C.each(function(G){F+=G.get("courseid")+","},this);if(F.length>0){F=F.substring(0,F.length-1)}C.commitChanges();if(Wtf.realroles.indexOf("46")>-1){var E=C.find("courseid",this.courseid);if(E!=-1){this.courseCombo.setValue(this.courseid)}if(this.sessionid=="NA"){this.atFlag=true;this.sessionCombo.disable();this.criBttn.enable();this.onComboValChange()}else{this.atFlag=false}}},this);this.sessionStore.on("load",function(C,D){if(Wtf.realroles.indexOf("46")>-1){if(this.sessionid!="NA"){this.sessionCombo.setValue(this.sessionid);this.criBttn.enable();this.onComboValChange()}}},this)},accept_reject_grade:function(D,C){var A=this.resultSM.getSelections();var B="";if(A.length>0){Wtf.Ajax.request({url:"jspfiles/result.jsp",method:"POST",waitMsg:"Updating status..",params:{mode:C,courseid:this.courseCombo.getValue(),session:this.sessionCombo.getValue(),moduleid:this.moduleid,sectionFlag:this.sectionFlag,uid:loginid,action:D},scope:this,success:function(E,F){var G=Wtf.util.JSON.decode(E.responseText);if(G.success){msgBoxShow([D,"Grade status updated."],Wtf.MessageBox.INFO);this.onComboValChange()}else{msgBoxShow([D,"Error in updating grade.Please try again."],Wtf.MessageBox.ERROR)}},failure:function(){if(C==10){msgBoxShow(["Error","Error occurred while accepting the grades. Please try again later."],Wtf.MessageBox.ERROR)}else{msgBoxShow(["Error","Error occurred while rejecting the grades. Please try again later."],Wtf.MessageBox.ERROR)}}})}},enableCriteria:function(C,B){if(this.courseCombo.isValid()&&this.sessionCombo.isValid()&&B){this.sessionid=C.getValue();var A=B.get("startdate").format("Y-m-d");if(A<"2010-01-11"){this.sectionFlag=false;this.sectionCombo.disable()}this.moduleCombo.setValue("");this.moduleComboStore.removeAll();this.moduleComboStore.load({params:{type:"examreultsreportmodule",courseid:this.courseid,sessionid:this.sessionid}})}},programSelect:function(B,C,A){this.pType=C.get("programtype");this.courseCombo.setValue("");this.moduleCombo.setValue("");this.programid=C.data["programid"];this.moduleStore.load({params:{type:"programsessioncourse",programid:this.programid}});this.criBttn.disable()},onRender:function(A){Wtf.ExamResultGrid.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask));var B;if(Wtf.realroles.indexOf("46")>-1){B={type:106,userid:loginid}}else{B={type:20}}this.programStore.load({params:B});this.sessionStore.load();this.loadMask.show();Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:"examresult",ptype:0,programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue(),sessionid:this.sessionCombo.getValue(),moduleid:this.moduleCombo.getValue(),sectionFlag:this.sectionFlag,sectionid:this.sectionFlag?this.sectionCombo.getValue():this.moduleid,status:(Wtf.realroles.indexOf("46")>-1)?"1,2":"4,8",isAsad:(Wtf.realroles.indexOf("46")>-1)?false:true}},this,function(C,D){this.createGrid(C);this.DisplayReport();if(Wtf.realroles.indexOf("46")>-1){this.programCombo.setValue(this.programid);var F=this.programStore.find("programid",this.programid);if(F!=-1){var E=this.programStore.getAt(F);this.pType=E.get("programtype");this.programSelect(this.programCombo,E,1);Wtf.getCmp("resultgraph"+this.id).destroy();Wtf.getCmp("centerRegion_"+this.id).doLayout()}}this.loadMask.hide()},function(D,C){this.loadMask.hide()})},createGrid:function(response){var obj=eval("("+response.trim()+")");this.classregstore=new Wtf.data.JsonStore({fields:this.createFields(obj.columnheader),data:obj.data});this.temprecord=Wtf.data.Record.create(this.createFields(obj.columnheader));this.jsonReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.temprecord);this.simstore=new Wtf.data.Store({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.jsonReader,remoteSort:true});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.simstore,border:false,title:"Exam Result",layout:"fit",loadMask:{msg:"Loading..."},autoScroll:true,autoWidth:true,bbar:new Wtf.PagingToolbar({pageSize:25,emptyMsg:"No records to display",store:this.simstore,displayInfo:true,displayMsg:"{0} - {1} of {2}",items:[this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var str=Wtf.urlEncode({ptype:this.pType,programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue(),sessionid:this.sessionCombo.getValue(),sectionFlag:this.sectionFlag,sectionid:this.sectionFlag?this.sectionCombo.getValue():this.moduleid,reptype:"result",type:"reports",moduleid:this.moduleCombo.getValue(),status:(Wtf.realroles.indexOf("46")>-1)?"1,2":"4,8",isAsad:(Wtf.realroles.indexOf("46")>-1)?false:true,dtype:"attachment",report:"applicationstatisticscsv",resulttype:this.resultCombo.getValue()});setDldUrl("fileDownload.jsp?"+str)}})]})});this.simstore.proxy.data=obj;this.simstore.load({params:{start:0,limit:25}});this.resultAnaStore.loadData(obj,false);this.reportGrid2=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.classregstore,border:false,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}})},makeresultAnalysisGraph:function(M){if(Wtf.getCmp("ResultGraphinnerPanel")){Wtf.getCmp("ResultGraphinnerPanel").destroy()}var E="";var B="";var H="";var Q="";var I="";var G="";var F="";var C="";var L="";var A="";var O="";var R="";var J="";if(this.sectionFlag){J="15,20,25"}else{J="10,0,20"}if(this.pType==1){for(var P=0;P<M.length;P++){R+=M[P].name+"|";if(M[P].distpercent){Q+=M[P].distpercent+","}else{Q+=0+","}if(M[P].meritpercent){I+=M[P].meritpercent+","}else{I+=0+","}if(M[P].aapercent){G+=M[P].aapercent+","}else{G+=0+","}if(M[P].avgpercent){F+=M[P].avgpercent+","}else{F+=0+","}if(M[P].failpercent){H+=M[P].failpercent+","}else{H+=0+","}}if(Q.length>0){Q=Q.substr(0,Q.length-1)+"|"+I.substr(0,I.length-1)+"|"+G.substr(0,G.length-1)+"|"+F.substr(0,F.length-1)+"|"+H.substr(0,H.length-1);R=R.substring(0,R.length-1);R=R.replace(/ /g,"+")}var N='<div><img id="chartdiv2" src ="http://chart.apis.google.com/chart?cht=bvg&chd=t:'+Q+"&chs=1000x200&chbh="+J+"&chg=100,5&chco=2060FFFF,EE8800,994499,99BBE8,CC3333&chxt=y,x&chl="+R+'&chdl=Distinction|Merit|Above Avg|Avg|Fail&chtt=Percentage+by+Modules"</img></div>'}else{if(this.atFlag){for(var P=0;P<M.length;P++){if(M[P].atpassper){C+=M[P].atpassper+","}else{C+=M[P].atpassper+","}if(M[P].atfailper){L+=M[P].atfailper+","}else{L+=M[P].atfailper+","}if(M[P].inprogressper){A+=M[P].inprogressper+","}else{A+=M[P].inprogressper+","}if(M[P].inprogessextendper){O+=M[P].inprogessextendper+","}else{O+=M[P].inprogessextendper+","}}if(C.length>0){C=C.substr(0,C.length-1)+"|"+L.substr(0,L.length-1)+"|"+A.substr(0,A.length-1)+"|"+O.substr(0,O.length-1)}var N='<div><img id="chartdiv2" src ="http://chart.apis.google.com/chart?cht=bvg&chd=t:'+C+"&chs=1000x200&chbh="+J+'&chg=100,5&chco=2060FFFF,8B0000,EED800,FF0000&chxt=x,y&chxl=0:|PPP|Articleship|1:1|2&chdl=P|F|IP|IPE&chtt=Percentage+by+Modules"</img></div>'}else{for(var P=0;P<M.length;P++){R+=M[P].name+"|";if(M[P].pdpercent){E+=M[P].pdpercent+","}else{E+=M[P].pdpercent+","}if(M[P].passpercent){B+=M[P].passpercent+","}else{B+=M[P].passpercent+","}if(M[P].failpercent){H+=M[P].failpercent+","}else{H+=M[P].failpercent+","}}if(E.length>0){E=E.substr(0,E.length-1)+"|"+B.substr(0,B.length-1)+"|"+H.substr(0,H.length-1);R=R.substring(0,R.length-1);R=R.replace(/ /g,"+")}var N='<div><img id="chartdiv2" src ="http://chart.apis.google.com/chart?cht=bvg&chd=t:'+E+"&chs=1000x200&chbh="+J+"&chg=100,5&chco=2060FFFF,8B0000,EED800&chxt=y,x&chl="+R+'&chdl=A|B|F&chtt=Percentage+by+Modules"</img></div>'}}var K=new Wtf.Panel({id:"ResultGraphinnerPanel",border:false,layout:"fit",autoScroll:true,html:N});if(isRealRoles("46")){var D=new Wtf.Window({layout:"fit",width:"40%",autoScroll:true,title:"Result Analysis Graph",items:[K]}).show()}else{document.getElementById("ResultGraphinnerPanelresult").innerHTML=N;Wtf.getCmp("resultgraph"+this.id).doLayout()}},DisplayReport:function(){if(isRoleGroup("4")){this.panel=new Wtf.Panel({border:false,tbar:["Programme* :",this.programCombo,"-","Course/Group* :",this.courseCombo,"-","Session* :",this.sessionCombo,"-","Module* :",this.moduleCombo,"-",this.criBttn,"-",this.clearBttn],layout:"fit",items:[{border:false,autoScroll:true,bodyStyle:"background:transparent;",layout:"fit",id:"subPanel"+this.id,tbar:["Filter By :",this.resultCombo,"-"],items:[{layout:"border",border:false,items:[{region:"north",id:"centerClasaRegRegion"+this.id,border:false,baseCls:"reportCont",paging:false,autoLoad:false,layout:"fit",split:true,bodyStyle:"background:transparent;",items:[this.reportGrid]},{region:"center",id:"centerRegion_"+this.id,border:false,bodyStyle:"background:transparent;",layout:"border",items:[{region:"east",split:true,border:false,paging:false,width:"50%",id:"resultgraph"+this.id,autoLoad:false,autoScroll:true,html:"<div id = 'ResultGraphinnerPanelresult'></div>",title:"Result Analysis Graph",bodyStyle:"background:white;"},{region:"center",width:"50%",title:"Result Analysis Report",paging:false,autoLoad:false,bodyStyle:"background:transparent;",id:"resultanalysisgraph",border:false,layout:"fit",split:true,items:[this.resultAnalyGrid]}]}]}]}]})}this.add(this.panel);this.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][1];C["type"]="string";C["mapping"]=D[B][1];A[A.length]=C}return A},createColModel:function(D){var E=[];E[E.length]=new Wtf.KWLRowNumberer();for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][1];C["sortable"]=true;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A},onComboValChange:function(obj,newval,oldval){var data={};if(Wtf.realroles.indexOf("46")>-1){data={type:"examresult",ptype:this.pType,programid:this.programid,courseid:this.courseid,sessionid:this.sessionid,sectionid:this.moduleid,sectionFlag:this.sectionFlag,status:"1,2",isAsad:false}}else{data={type:"examresult",ptype:this.pType,programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue(),sessionid:this.sessionCombo.getValue(),sectionFlag:this.sectionFlag,sectionid:this.sectionCombo.getValue(),moduleid:this.moduleCombo.getValue(),status:"4,8",isAsad:true,resulttype:this.resultCombo.getValue()}}this.loadMask.show();Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:data},this,function(response,e){if(this.reportGrid){Wtf.getCmp("centerClasaRegRegion"+this.id).remove(this.reportGrid)}this.createGrid(response);this.grafData=eval("("+response.trim()+")").dataanalysis;if(isRoleGroup("4")){this.makeresultAnalysisGraph(this.grafData)}Wtf.getCmp("centerClasaRegRegion"+this.id).add(this.reportGrid);if(this.pType==1){this.resultAnaStore2=new Wtf.data.JsonStore({root:"dataanalysis",fields:["name","code","dist","distpercent","merit","meritpercent","avg","avgpercent","aa","aapercent","fail","failpercent","total"]});this.resultAnaCM2=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer({}),this.resultSM,{header:"Name",dataIndex:"name"},{header:"Session",dataIndex:"code"},{header:"Distinction",dataIndex:"dist"},{header:"Distinction %",dataIndex:"distpercent"},{header:"Merit",dataIndex:"merit"},{header:"Merit %",dataIndex:"meritpercent"},{header:"Above Average",dataIndex:"aa"},{header:"Above Average %",dataIndex:"aapercent"},{header:"Average",dataIndex:"avg"},{header:"Average %",dataIndex:"avgpercent"},{header:"Pass",dataIndex:"pass"},{header:"Pass %",dataIndex:"passpercent"},{header:"Fail",dataIndex:"fail"},{header:"Fail %",dataIndex:"failpercent"},{header:"Total",dataIndex:"total"}]);this.resultAnalyGrid.reconfigure(this.resultAnaStore,this.resultAnaCM2)}else{if(this.atFlag){this.resultAnaStore2=new Wtf.data.JsonStore({root:"dataanalysis",fields:["mname","name","total"]});this.resultAnaCM2=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer({}),this.resultSM,{header:"Code",dataIndex:"name"},{header:"Session",dataIndex:"code"},{header:"P",dataIndex:"atpass"},{header:"P %",dataIndex:"atpassper"},{header:"F",dataIndex:"atfail"},{header:"F %",dataIndex:"atfailper"},{header:"IP",dataIndex:"inprogress"},{header:"IP %",dataIndex:"inprogressper"},{header:"IPE",dataIndex:"inprogessextend"},{header:"IPE %",dataIndex:"inprogessextendper"},{header:"Total",dataIndex:"total"}]);this.resultAnalyGrid.reconfigure(this.resultAnaStore,this.resultAnaCM2)}else{this.resultAnalyGrid.reconfigure(this.resultAnaStore,this.resultAnaCM)}}this.doLayout();this.loadMask.hide()},function(resp,req){this.loadMask.hide()})}});Wtf.appList=function(A){Wtf.apply(this,A);this.sortindex="";this.dir=0;this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:this.flag?"Applicant Name":"Student Name",dataIndex:this.flag?"Applicant Name":"Student Name"},{header:"Student ID",dataIndex:"Student ID",hidden:this.flag},{header:"IC/Passport No.",dataIndex:"IC/Passport No",sortable:false},{header:"Contact No.",dataIndex:"Contact No",sortable:false},{header:this.flag?"Applied On":"Enrollment Date",dataIndex:this.flag?"Applied On":"Enrollment Date",sortable:false},{header:"DOB",dataIndex:"Date of Birth",sortable:false},{header:"Country",dataIndex:"Country",sortable:false},{header:"Nationality",dataIndex:"Nationality"},{header:"Program Name",dataIndex:"Program Name",sortable:false},{header:"University/Institution",dataIndex:"University/Institution",sortable:false},{header:"Diploma/Degree",dataIndex:"Diploma/Degree",sortable:false},{header:"Class Degree",dataIndex:"Class Degree",sortable:false},{header:"CGPA",dataIndex:"CGPA",sortable:false},{header:"English Proficiency",dataIndex:"English Proficiency",sortable:false},{header:"Industry",dataIndex:"Industry",sortable:false},{header:"Employment Status",dataIndex:"Employment Status",sortable:false},{header:"Company Name",dataIndex:"Company Name",sortable:false},{header:"Position Level",dataIndex:"Position Level",sortable:false},{header:"Years of Service",dataIndex:"Years of Service",sortable:false},{header:"Health Condition",dataIndex:"Health Condition",sortable:false},{header:"Sponsor",dataIndex:"Sponsor",sortable:false},{header:"Status",dataIndex:"Status",hidden:!this.flag,sortable:false}]);var C=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["Student Name","Student ID","IC/Passport No","Contact No","Enrollment Date","Date of Birth","Country","Nationality","Program Name","University/Institution","Diploma/Degree","Class Degree","CGPA","English Proficiency","Industry","Employment Status","Company Name","Position Level","Years of Service","Health Condition","Sponsor"]);var B=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["Applicant Name","IC/Passport No","Contact No","Applied On","Date of Birth","Country","Nationality","Program Name","University/Institution","Diploma/Degree","Class Degree","CGPA","English Proficiency","Industry","Employment Status","Company Name","Position Level","Years of Service","Health Condition","Sponsor","Status"]);this.ds=new Wtf.data.Store({reader:this.flag?B:C,autoLoad:false,url:"jspfiles/reportNew.jsp"});this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.sessionCmb=new Wtf.form.ComboBox({store:this.sessionStore,editable:false,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",valueField:"sessionid",allowBlank:false});this.progStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=prog",root:"data",fields:["programid","programname"]});this.programCmb=new Wtf.form.ComboBox({store:this.progStore,editable:false,displayField:"programname",mode:"local",width:140,triggerAction:"all",emptyText:"Select a program...",valueField:"programid"});this.fromDate1=new Wtf.form.DateField({fieldLabel:"Start Date",emptyText:"Select start date...",width:110,format:"Y-m-j"});this.toDate1=new Wtf.form.DateField({fieldLabel:"Start Date",emptyText:"Select end date...",width:110,name:"sdate",format:"Y-m-j"});this.appStatusStore=new Wtf.data.SimpleStore({data:[["Application Fee not paid","-2"],["Archived Application","-1"],["Applied","0"],["Approved","1"],["On Hold","2"],["Rejected","3"],["Partial Course Fee paid","4"],["Student","5"],["Graduate","6"],["Alumni","7"]],fields:["status","id"],reader:new Wtf.data.ArrayReader({},[{name:"status"},{name:"id"}]),autoLoad:true});this.appStatusCombo=new Wtf.form.ComboBox({mode:"local",triggerAction:"all",editable:false,width:110,emptyText:"Select a status...",store:this.appStatusStore,displayField:"status",valueField:"id",value:(this.flag)?-2:5});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.ds.baseParams={mode:3,progid:this.programCmb.getValue(),fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue(),stat:this.appStatusCombo.getValue(),session:this.sessionCmb.getValue(),sortindex:this.sortindex,dir:this.dir,flag:(this.flag)?0:1};this.p=this.programCmb.getValue();this.f=this.fromDate1.getRawValue();this.t=this.toDate1.getRawValue();this.s=this.appStatusCombo.getValue();this.ses=this.sessionCmb.getValue();this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});if(this.flag){this.tbarConfig=["Program: ",this.programCmb,"-","Applied:","    From ",this.fromDate1,"   To ",this.toDate1,"-","Status: ",this.appStatusCombo,"-",this.submitBttn]}else{this.tbarConfig=["Session: ",this.sessionCmb,"-","Program: ",this.programCmb,"-","Applied:","    From ",this.fromDate1,"   To ",this.toDate1,"-",this.submitBttn]}Wtf.appList.superclass.constructor.call(this,{layout:"fit",border:false,items:[this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,cm:this.cm,viewConfig:{autoFill:true},loadMask:{msg:"Loading..."},tbar:this.tbarConfig,bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.ds,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){if(this.ds.getCount()>0){var D=Wtf.urlEncode({mode:3,progid:this.p,fromdate:this.f,todate:this.t,stat:this.s,session:this.ses,sortindex:this.sortindex,dir:this.dir,flag:(this.flag)?0:1,fileName:(this.flag)?"List_of_Applicants.pdf":"Registered_Students.pdf"});setDldUrl("ReportsServlet.jsp?"+D)}}}),"-",this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var D=Wtf.urlEncode({progid:this.p,fromdate:this.f,todate:this.t,stat:this.s,session:this.ses,sortindex:this.sortindex,dir:this.dir,flag:(this.flag)?0:1,type:"reports",dtype:"attachment",report:"getApplications"});setDldUrl("fileDownload.jsp?"+D)}}})]})})]})};Wtf.extend(Wtf.appList,Wtf.Panel,{onRender:function(A){Wtf.appList.superclass.onRender.call(this,A);this.ds.baseParams={mode:3,progid:this.programCmb.getValue(),fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue(),stat:this.appStatusCombo.getValue(),session:this.sessionCmb.getValue(),sortindex:this.sortindex,dir:this.dir,flag:(this.flag)?0:1};this.p=this.programCmb.getValue();this.f=this.fromDate1.getRawValue();this.t=this.toDate1.getRawValue();this.s=this.appStatusCombo.getValue();this.ses=this.sessionCmb.getValue();this.ds.load({params:{start:0,limit:15}});this.sessionStore.load();this.progStore.load();this.progStore.on("load",function(){var C=new Wtf.data.Record.create(["programid","programname"]);var B=new C({programid:"",programname:"All"});this.progStore.addSorted(B)},this);this.grid.on("headerclick",function(C,B,D){if(C.colModel.config[B].sortable==false){return }var E=Wtf.get(D.getTarget().id);if(!this.prevTarget||this.prevTarget!==E){if(this.prevTarget){if(this.prevTarget.hasClass("sort-asc")){this.prevTarget.removeClass("sort-asc")}else{if(this.prevTarget.hasClass("sort-desc")){this.prevTarget.removeClass("sort-desc")}}}this.prevTarget=E}if(E.hasClass("sort-asc")){E.addClass("sort-desc");E.removeClass("sort-asc");this.dir=1}else{E.addClass("sort-asc");E.addClass("x-grid3-hd-inner");if(E.hasClass("sort-desc")){E.removeClass("sort-desc")}this.dir=0}this.sortindex=C.colModel.config[B].dataIndex;this.ds.baseParams={mode:3,progid:this.programCmb.getValue(),fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue(),stat:this.appStatusCombo.getValue(),session:this.sessionCmb.getValue(),sortindex:this.sortindex,dir:this.dir,flag:(this.flag)?0:1};this.ds.load({params:{start:0,limit:this.pP.combo.value}})},this)}});Wtf.grid.DynamicColumnModel4=function(B){this.cols1=[];var F=B.recordType;var A=F.prototype.fields;for(var C=0;C<A.keys.length;C++){var E=A.keys[C];var D=F.getField(E);if(E.match("No. of Applicants")){this.appendLast2={header:D.name,dataIndex:D.name}}else{if(E.match("No. of Students")){this.appendLast2={header:D.name,dataIndex:D.name}}else{this.cols1.push({header:D.name,dataIndex:D.name})}}}if(this.appendLast2){this.cols1.push(this.appendLast2)}Wtf.grid.DynamicColumnModel4.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModel4,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1}});Wtf.analysisReport=function(A){Wtf.apply(this,A);this.progStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=prog",root:"data",fields:["programid","programname"]});this.programCmb=new Wtf.form.ComboBox({store:this.progStore,editable:false,displayField:"programname",mode:"local",width:140,triggerAction:"all",emptyText:"Select a program...",valueField:"programid"});this.fromDate1=new Wtf.form.DateField({fieldLabel:"Start Date",emptyText:"Select start date...",width:110,format:"Y-m-j"});this.toDate1=new Wtf.form.DateField({fieldLabel:"Start Date",emptyText:"Select end date...",width:110,name:"sdate",format:"Y-m-j"});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.northP.remove(this.grid);this.loadGrid()}});this.printBttn=new Wtf.Toolbar.Button({text:"Print",scope:this,disabled:false,handler:this.printReport});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.setValue("");this.fromDate1.setValue("");this.toDate1.setValue("");this.northP.remove(this.grid);this.loadGrid()}});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var B=Wtf.urlEncode({mode:this.mode,progid:this.programCmb.getValue(),fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue(),type:"reports",dtype:"attachment",report:this.mode});setDldUrl("fileDownload.jsp?"+B)}});Wtf.analysisReport.superclass.constructor.call(this,{border:false,layout:"border",bbar:[this.printBttn,"-",this.csv],tbar:["Select Program",this.programCmb,"Select start date",this.fromDate1,"Select end date",this.toDate1,this.submitBttn,this.clearBttn],items:[{region:"west",layout:"fit",width:300,bodyStyle:"background-color:#FFFFFF",items:this.northP=new Wtf.Panel({id:"middleeast"+this.id,border:false,layout:"fit"})},{region:"center",layout:"fit",bodyStyle:"background-color:#FFFFFF",items:new Wtf.Panel({id:"middlewest"+this.id,layout:"fit",border:false})}]});this.on("render",this.handleRender,this)};Wtf.extend(Wtf.analysisReport,Wtf.Panel,{handleRender:function(A){this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});this.loadMask.show();this.loadGrid();this.progStore.load();this.progStore.on("load",function(){var C=new Wtf.data.Record.create(["programid","programname"]);var B=new C({programid:"",programname:"All"});this.progStore.addSorted(B)},this);if(Wtf.isIE){this.ownerCt.addListener("activate",this.handleActivate,this)}},handleActivate:function(A){A.doLayout();var B=(Wtf.getCmp("middleeast"+this.id).ownerCt.getSize().width<300)?300:Wtf.getCmp("middleeast"+this.id).ownerCt.getSize().width;Wtf.getCmp("middleeast"+this.id).ownerCt.setWidth(B);A.doLayout()},loadGrid:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:this.mode,progid:this.programCmb.getValue(),fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue()}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data);this.ds=new Wtf.data.Store({reader:jreader});this._reader=jreader;this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel4(this.ds);this.grid=new Wtf.grid.GridPanel({loadMask:this.loadMask,border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,viewConfig:{autoFill:true}});this.northP.add(this.grid);this.ds.loadData(resObj.data)}this.doLayout();this.loadMask.hide();if(resObj!==undefined){this.plotChart(resObj)}}}},function(resp,req){this.loadMask.hide()})},plotChart:function(E){var G="";var C="";var D=0;var A=false;if(E.totalCnt>0){A=true;for(var B=0;B<E.chartdata.length;B++){D=(E.chartdata[B].cnt/E.totalCnt)*100;G+=E.chartdata[B].item.replace("+","%2b")+"+["+this.roundNumber(D,2)+"%]|";C+=D+","}}if(A){G=G.substring(0,G.length-1);C=C.substring(0,C.length-1);G=G.replace(/&/,"%26");G=G.replace(/#/,"%23")}var F='<div><img style = "" align="center" src ="http://chart.apis.google.com/chart?cht=p3&chd=t:'+C+"&chco=3e85e5,fcb441,e0400a&chs=510x120&chl="+G+'"</img></div>';Wtf.getCmp("middlewest"+this.id).el.dom.firstChild.firstChild.innerHTML=F},roundNumber:function(B,C){var A=Math.round(B*Math.pow(10,C))/Math.pow(10,C);return A},printReport:function(){setDldUrl("ReportsServlet.jsp?mode="+this.mode+"&progid="+this.programCmb.getValue()+"&fromdate="+this.fromDate1.getRawValue()+"&todate="+this.toDate1.getRawValue())}});Wtf.analysisReport1=function(A){Wtf.apply(this,A);this.progStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=prog",root:"data",fields:["programid","programname"]});this.programCmb=new Wtf.form.ComboBox({store:this.progStore,editable:false,displayField:"programname",mode:"local",width:140,triggerAction:"all",emptyText:"Select a program...",valueField:"programid"});this.fromDate1=new Wtf.form.DateField({fieldLabel:"Start Date",emptyText:"Select start date...",width:110,format:"Y-m-j"});this.toDate1=new Wtf.form.DateField({fieldLabel:"Start Date",emptyText:"Select end date...",width:110,name:"sdate",format:"Y-m-j"});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.northP.remove(this.grid);this.northP1.remove(this.grid1);this.loadGrid()}});this.printBttn=new Wtf.Toolbar.Button({text:"Print",scope:this,disabled:false,handler:this.printReport});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var B=Wtf.urlEncode({mode:this.mode,progid:this.programCmb.getValue(),fromdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue(),type:"reports",dtype:"attachment",report:this.mode});setDldUrl("fileDownload.jsp?"+B)}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.setValue("");this.fromDate1.setValue("");this.toDate1.setValue("");this.northP.remove(this.grid);this.northP1.remove(this.grid1);this.loadGrid()}});Wtf.analysisReport1.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"form",bodyStyle:"background-color:#FFFFFF;position:relative;",height:640,autoScroll:true,bbar:[this.printBttn,"-",this.csv],tbar:["Select Program",this.programCmb,"Select start date",this.fromDate1,"Select end date",this.toDate1,this.submitBttn,this.clearBttn],items:[{layout:"fit",height:250,border:false,items:[{border:false,layout:"border",items:[{region:"center",layout:"fit",bodyStyle:"background-color:#FFFFFF",items:new Wtf.Panel({id:"middlewest"+this.id,border:false,bodyStyle:"background-color:#FFFFFF"})},{region:"west",layout:"fit",width:320,bodyStyle:"background-color:#FFFFFF",items:this.northP=new Wtf.Panel({id:"middleeast"+this.id,border:false,layout:"fit"})}]}]},new Wtf.Panel({layout:"fit",height:250,border:false,items:[{border:false,layout:"border",items:[{region:"center",layout:"fit",bodyStyle:"background-color:#FFFFFF",items:new Wtf.Panel({id:"middlewest1"+this.id,border:false})},{region:"west",layout:"fit",width:320,bodyStyle:"background-color:#FFFFFF",items:this.northP1=new Wtf.Panel({id:"middleeast1"+this.id,border:false,layout:"fit"})}]}]})]});this.on("render",this.handleRender,this)};Wtf.extend(Wtf.analysisReport1,Wtf.Panel,{handleRender:function(A){this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});this.loadMask.show();this.loadGrid();this.progStore.load();this.progStore.on("load",function(){var C=new Wtf.data.Record.create(["programid","programname"]);var B=new C({programid:"",programname:"All"});this.progStore.addSorted(B)},this);if(Wtf.isIE){this.ownerCt.addListener("activate",this.handleActivate,this)}},handleActivate:function(A){A.doLayout();var C=(Wtf.getCmp("middleeast"+this.id).ownerCt.getSize().width<320)?320:Wtf.getCmp("middleeast"+this.id).ownerCt.getSize().width;Wtf.getCmp("middleeast"+this.id).ownerCt.setWidth(C);A.doLayout();var B=(Wtf.getCmp("middleeast1"+this.id).ownerCt.getSize().width<320)?320:Wtf.getCmp("middleeast1"+this.id).ownerCt.getSize().width;Wtf.getCmp("middleeast1"+this.id).ownerCt.setWidth(B);A.doLayout()},loadGrid:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:this.mode,progid:this.programCmb.getValue(),fomdate:this.fromDate1.getRawValue(),todate:this.toDate1.getRawValue()}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data);this.ds=new Wtf.data.Store({reader:jreader});this._reader=jreader;this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel4(this.ds);this.grid=new Wtf.grid.GridPanel({loadMask:this.loadMask,border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,viewConfig:{autoFill:true}});this.northP.add(this.grid);this.ds.loadData(resObj.data);this.doLayout();this.northP.ownerCt.doLayout()}if(resObj.data1!==undefined){var jreader1=new Wtf.data.DynamicJsonReader({});jreader1.readRecords(resObj.data1);this.ds1=new Wtf.data.Store({reader:jreader1});this._reader1=jreader1;this.ds1.recordType=jreader1.recordType;this.ds1.fields=jreader1.recordType.prototype.fields;this.cm1=new Wtf.grid.DynamicColumnModel4(this.ds1);this.grid1=new Wtf.grid.GridPanel({loadMask:this.loadMask,border:false,store:this.ds1,enableColumnHide:false,enableColumnMove:false,cm:this.cm1,sm:this.examSM1,viewConfig:{autoFill:true}});this.northP1.add(this.grid1);this.ds1.loadData(resObj.data1)}this.doLayout();this.loadMask.hide();if(resObj!==undefined){this.plotChart(resObj)}}}},function(resp,req){this.loadMask.hide()})},plotChart:function(F){var H="";var D="";var E=0;var B=false;if(F.totalCnt>0){B=true;for(var C=0;C<F.chartdata.length;C++){E=(F.chartdata[C].cnt/F.totalCnt)*100;H+=F.chartdata[C].item.replace("+","%2b")+"+["+this.roundNumber(E,2)+"%]|";D+=E+","}}if(B){H=H.substring(0,H.length-1);D=D.substring(0,D.length-1)}var A='<div><img style = "" align="center" src ="http://chart.apis.google.com/chart?cht=p3&chd=t:'+D+"&chco=3e85e5,fcb441,e0400a&chs=510x120&chl="+H+'"</img></div>';document.getElementById("middlewest"+this.id).innerHTML=A;H="";D="";E=0;B=false;if(F.totalCnt1>0){B=true;for(var C=0;C<F.chartdata1.length;C++){E=(F.chartdata1[C].cnt/F.totalCnt1)*100;H+=F.chartdata1[C].item.replace("+","%2b")+"+["+this.roundNumber(E,2)+"%]|";D+=E+","}}if(B){H=H.substring(0,H.length-1);D=D.substring(0,D.length-1)}var G='<div><img style = "" align="center" src ="http://chart.apis.google.com/chart?cht=p3&chd=t:'+D+"&chco=3e85e5,fcb441,e0400a&chs=510x120&chl="+H+'"</img></div>';document.getElementById("middlewest1"+this.id).innerHTML=G},roundNumber:function(B,C){var A=Math.round(B*Math.pow(10,C))/Math.pow(10,C);return A},printReport:function(){setDldUrl("ReportsServlet.jsp?mode="+this.mode+"&progid="+this.programCmb.getValue()+"&fromdate="+this.fromDate1.getRawValue()+"&todate="+this.toDate1.getRawValue())}});Wtf.MonthPicker=Wtf.extend(Wtf.Component,{format:"M, Y",okText:"OK",cancelText:"Cancel",constrainToViewport:true,monthNames:Date.monthNames,value:0,noPastYears:true,useDayDate:null,initComponent:function(){Wtf.MonthPicker.superclass.initComponent.call(this);this.value=this.value?this.value.clearTime():new Date().clearTime();this.addEvents("select");if(this.handler){this.on("select",this.handler,this.scope||this)}},focus:function(){if(this.el){this.update(this.activeDate)}},onRender:function(C,B){var A=['<div style="width: 175px; height:175px;"></div>'];A[A.length]='<div class="x-date-mp"></div>';var D=document.createElement("div");D.className="x-date-picker";D.innerHTML=A.join("");C.dom.insertBefore(D,B);this.el=Wtf.get(D);this.monthPicker=this.el.down("div.x-date-mp");this.monthPicker.enableDisplayMode("block");this.el.unselectable();this.showMonthPicker();if(Wtf.isIE){this.el.repaint()}this.update(this.value)},createMonthPicker:function(){if(!this.monthPicker.dom.firstChild){var A=['<table border="0" cellspacing="0">'];for(var B=0;B<6;B++){A.push('<tr><td class="x-date-mp-month"><a href="#">',this.monthNames[B].substr(0,3),"</a></td>",'<td class="x-date-mp-month x-date-mp-sep"><a href="#">',this.monthNames[B+6].substr(0,3),"</a></td>",B==0?'<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td></tr>':'<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>')}A.push('<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',this.okText,'</button><button type="button" class="x-date-mp-cancel">',this.cancelText,"</button></td></tr>","</table>");this.monthPicker.update(A.join(""));this.monthPicker.on("click",this.onMonthClick,this);this.monthPicker.on("dblclick",this.onMonthDblClick,this);this.mpMonths=this.monthPicker.select("td.x-date-mp-month");this.mpYears=this.monthPicker.select("td.x-date-mp-year");this.mpMonths.each(function(C,D,E){E+=1;if((E%2)==0){C.dom.xmonth=5+Math.round(E*0.5)}else{C.dom.xmonth=Math.round((E-1)*0.5)}})}},showMonthPicker:function(){this.createMonthPicker();var A=this.el.getSize();this.monthPicker.setSize(A);this.monthPicker.child("table").setSize(A);this.mpSelMonth=(this.activeDate||this.value).getMonth();this.updateMPMonth(this.mpSelMonth);this.mpSelYear=(this.activeDate||this.value).getFullYear();this.updateMPYear(this.mpSelYear);this.monthPicker.show()},updateMPYear:function(F){if(this.noPastYears){var D=new Date().getFullYear();if(F<(D+4)){F=D+4}}this.mpyear=F;var C=this.mpYears.elements;for(var B=1;B<=10;B++){var E=C[B-1],A;if((B%2)==0){A=F+Math.round(B*0.5);E.firstChild.innerHTML=A;E.xyear=A}else{A=F-(5-Math.round(B*0.5));E.firstChild.innerHTML=A;E.xyear=A}this.mpYears.item(B-1)[A==this.mpSelYear?"addClass":"removeClass"]("x-date-mp-sel")}},updateMPMonth:function(A){this.mpMonths.each(function(B,C,D){B[B.dom.xmonth==A?"addClass":"removeClass"]("x-date-mp-sel")})},selectMPMonth:function(A){},getAdjustedDate:function(A,B){return new Date(A,B,this.useDayDate?(Math.min(this.useDayDate,(new Date(A,B,1)).getDaysInMonth())):(this.activeDate||this.value).getDate())},onMonthClick:function(D,B){D.stopEvent();var C=new Wtf.Element(B),A;if(C.is("button.x-date-mp-cancel")){this.hideMonthPicker()}else{if(C.is("button.x-date-mp-ok")){this.update(this.getAdjustedDate(this.mpSelYear,this.mpSelMonth));this.fireEvent("select",this,this.value)}else{if(A=C.up("td.x-date-mp-month",2)){this.mpMonths.removeClass("x-date-mp-sel");A.addClass("x-date-mp-sel");this.mpSelMonth=A.dom.xmonth}else{if(A=C.up("td.x-date-mp-year",2)){this.mpYears.removeClass("x-date-mp-sel");A.addClass("x-date-mp-sel");this.mpSelYear=A.dom.xyear}else{if(C.is("a.x-date-mp-prev")){this.updateMPYear(this.mpyear-10)}else{if(C.is("a.x-date-mp-next")){this.updateMPYear(this.mpyear+10)}}}}}}},onMonthDblClick:function(D,B){D.stopEvent();var C=new Wtf.Element(B),A;if(A=C.up("td.x-date-mp-month",2)){this.update(this.getAdjustedDate(this.mpSelYear,A.dom.xmonth));this.fireEvent("select",this,this.value)}else{if(A=C.up("td.x-date-mp-year",2)){this.update(this.getAdjustedDate(A.dom.xyear,this.mpSelMonth));this.fireEvent("select",this,this.value)}}},hideMonthPicker:function(A){Wtf.menu.MenuMgr.hideAll()},showPrevMonth:function(A){this.update(this.activeDate.add("mo",-1))},showNextMonth:function(A){this.update(this.activeDate.add("mo",1))},showPrevYear:function(){this.update(this.activeDate.add("y",-1))},showNextYear:function(){this.update(this.activeDate.add("y",1))},update:function(C){this.activeDate=C;this.value=C;if(!this.internalRender){var A=this.el.dom.firstChild;var B=A.offsetWidth;this.el.setWidth(B+this.el.getBorderWidth("lr"));Wtf.fly(A).setWidth(B);this.internalRender=true;if(Wtf.isOpera&&!this.secondPass){A.rows[0].cells[1].style.width=(B-(A.rows[0].cells[0].offsetWidth+A.rows[0].cells[2].offsetWidth))+"px";this.secondPass=true;this.update.defer(10,this,[C])}}},setValue:function(A){this.activeDate=A;this.value=A}});Wtf.MonthItem=function(A){Wtf.MonthItem.superclass.constructor.call(this,new Wtf.MonthPicker(A),A);this.picker=this.component;this.addEvents("select");this.picker.on("render",function(B){B.getEl().swallowEvent("click");B.container.addClass("x-menu-date-item")});this.picker.on("select",this.onSelect,this)};Wtf.extend(Wtf.MonthItem,Wtf.menu.Adapter,{onSelect:function(B,A){this.fireEvent("select",this,A,B);Wtf.MonthItem.superclass.handleClick.call(this)}});Wtf.MonthMenu=function(B){Wtf.MonthMenu.superclass.constructor.call(this,B);this.plain=true;var A=new Wtf.MonthItem(B);this.add(A);this.picker=A.picker;this.relayEvents(A,["select"])};Wtf.extend(Wtf.MonthMenu,Wtf.menu.Menu,{cls:"x-date-menu"});Wtf.MonthField=function(A){Wtf.MonthField.superclass.constructor.call(this,A)};Wtf.extend(Wtf.MonthField,Wtf.form.DateField,{format:Wtf.MonthPicker.prototype.format,noPastYears:Wtf.MonthPicker.prototype.noPastYears,useDayDate:Wtf.MonthPicker.prototype.useDayDate,onTriggerClick:function(){if(this.disabled){return }if(this.menu==null){this.menu=new Wtf.MonthMenu()}Wtf.apply(this.menu.picker,{format:this.format,noPastYears:this.noPastYears,useDayDate:this.useDayDate});this.menu.on(Wtf.apply({},this.menuListeners,{scope:this}));this.menu.picker.setValue(this.getValue()||new Date());this.menu.show(this.el,"tl-bl?")}});Wtf.grid.DynamicColumnModel5=function(B){this.cols1=[];var F=B.recordType;var A=F.prototype.fields;A.keys=A.keys.sort();for(var C=0;C<A.keys.length;C++){var E=A.keys[C];var D=F.getField(E);if(E.match("Student Name")){this.appendFirst={header:D.name,dataIndex:D.name}}else{if(E.match("Student Id")){this.appendSecond={header:D.name,dataIndex:D.name}}else{this.cols1.push({header:D.name,dataIndex:D.name})}}}if(this.appendSecond){this.cols1.unshift(this.appendSecond)}if(this.appendFirst){this.cols1.unshift(this.appendFirst)}this.cols1.unshift(new Wtf.grid.RowNumberer({}));Wtf.grid.DynamicColumnModel5.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModel5,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1}});Wtf.WtfAttendanceList=function(A){Wtf.apply(this,A);this.venueRecord=Wtf.data.Record.create([{name:"vname",type:"string"},{name:"id",type:"string"},{name:"timezone"}]);this.venueReader=new Wtf.data.JsonReader({root:"data"},this.venueRecord);this.venueStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newClass.jsp"}),reader:this.venueReader});this.programStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","code","duration","id","note","appfee","exemptiontype","programtype","feetype","auditper"]),autoLoad:false,url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:1}});this.courseStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","code","duration","id","note","prereqcourseid","level","parentcourse","isdefault","grpruleflag","subgrp","courseno"]),autoLoad:false,url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:2}});this.moduleStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","id"]),autoLoad:false,url:"jspfiles/reportNew.jsp",baseParams:{mode:29}});this.classTypeStore=new Wtf.data.Store({url:"jspfiles/newCourse.jsp",reader:new Wtf.data.JsonReader({fields:[{name:"typeid",type:"string"},{name:"classtype",type:"string"}],root:"data"})});this.facRecord=Wtf.data.Record.create([{name:"username",type:"string"},{name:"id",type:"string"}]);this.facReader=new Wtf.data.KwlJsonReader({root:"data"},this.facRecord);this.facStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newClass.jsp"}),reader:this.facReader});this.programStore.load();this.programCmb=new Wtf.form.ComboBox({id:"prog"+this.id,store:this.programStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a program...",fieldLabel:"Program",name:"id",valueField:"id"});this.courseCmb=new Wtf.form.ComboBox({id:"course"+this.id,store:this.courseStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a course...",fieldLabel:"Course",name:"id",valueField:"id"});this.moduleCmb=new Wtf.form.ComboBox({id:"module"+this.id,store:this.moduleStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a module...",fieldLabel:"Module",name:"id",valueField:"id"});this.ctypeCombo=new Wtf.form.ComboBox({id:"ctype"+this.id,store:this.classTypeStore,editable:false,valueField:"typeid",displayField:"classtype",mode:"local",triggerAction:"all",emptyText:"Select a type...",fieldLabel:"Classroom Type",name:"ctype"});this.facCombo=new Wtf.form.ComboBox({id:"facc11"+this.id,store:this.facStore,editable:false,displayField:"username",mode:"local",triggerAction:"all",emptyText:"Select faculty...",fieldLabel:"Faculty",name:"facid",width:145,listWidth:165,valueField:"id",disabled:false});this.venueCombo=new Wtf.form.ComboBox({id:"venuess"+this.id,store:this.venueStore,editable:false,displayField:"vname",mode:"local",triggerAction:"all",emptyText:"Select a venue...",fieldLabel:"Venue",name:"venueid",valueField:"id",width:125,listWidth:140});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.northP.remove(this.grid);this.loadMask.hide();this.loadGrid()}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.reset();this.fromDate.reset();this.moduleCmb.reset();this.venueCombo.reset();this.ctypeCombo.reset();this.facCombo.reset();this.northP.remove(this.grid)}});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({mode:this.mode,moduleid:this.modId,date:this.fromDate.getValue().format("Y-m-d"),venueid:this.venueCombo.getValue(),classtype:this.ctypeCombo.getValue(),facid:this.facCombo.getValue(),type:"reports",dtype:"attachment",report:this.mode});setDldUrl("fileDownload.jsp?"+B)}}});this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){var B=Wtf.urlEncode({mode:this.mode,moduleid:this.modId,date:this.fromDate.getValue().format("Y-m-d"),venueid:this.venueCombo.getValue(),classtype:this.ctypeCombo.getValue(),facid:this.facCombo.getValue(),fileName:"Student_Attendance_List.pdf"});setDldUrl("ReportsServlet.jsp?"+B)}});this.programCmb.on("select",this.handleProgSelect,this);this.courseCmb.on("select",this.handleCourseSelect,this);this.moduleCmb.on("select",this.handleModuleSelect,this);this.fromDate=new Wtf.MonthField({});this.fromDate.on("change",this.handleDateChange,this);Wtf.WtfAttendanceList.superclass.constructor.call(this,{layout:"fit",border:false,tbar:["Date ",this.fromDate,"Program ",this.programCmb," Module ",this.moduleCmb],bbar:[this.print,"-",this.csv],items:[this.northP=new Wtf.Panel({border:false,layout:"fit",tbar:["Class Type",this.ctypeCombo,"Faculty",this.facCombo,"Venue",this.venueCombo,this.submitBttn,this.clearBttn]})]})};Wtf.extend(Wtf.WtfAttendanceList,Wtf.Panel,{onRender:function(A){Wtf.WtfAttendanceList.superclass.onRender.call(this,A);this.venueStore.load({params:{type:"venue"}});this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."})},handleProgSelect:function(C,A,B){this.moduleCmb.reset();this.ctypeCombo.reset();this.moduleStore.removeAll();this.classTypeStore.removeAll();this.classTypeStore.load({params:{type:"programsessionclasstype",progid:A.data.id}});if(this.fromDate.getValue()!=""){this.moduleStore.load({params:{progid:A.data.id,fromdate:this.fromDate.getValue().format("Y-m-d")}})}else{this.fromDate.markInvalid("This field is required.")}},handleCourseSelect:function(C,A,B){this.moduleCmb.reset();this.moduleStore.removeAll();this.moduleStore.load({params:{id:A.data.id}})},handleDateChange:function(C,B,A){this.programCmb.reset()},handleModuleSelect:function(C,A,B){this.modId=A.data.id;this.facStore.removeAll();this.facStore.baseParams={type:"facvenue"};this.facStore.removeAll();this.facStore.load({params:{moduleid:A.data.id}})},loadGrid:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:this.mode,moduleid:this.modId,date:this.fromDate.getValue().format("Y-m-d"),venueid:this.venueCombo.getValue(),classtype:this.ctypeCombo.getValue(),facid:this.facCombo.getValue()}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data);this.ds=new Wtf.data.Store({reader:jreader});this._reader=jreader;this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel5(this.ds);this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,viewConfig:{autoFill:true}});this.northP.add(this.grid);this.ds.loadData(resObj.data)}this.doLayout();this.loadMask.hide()}}},function(resp,req){this.loadMask.hide()})}});Wtf.WtfAttendanceRep=function(A){Wtf.apply(this,A);this.venueRecord=Wtf.data.Record.create([{name:"vname",type:"string"},{name:"id",type:"string"},{name:"timezone"}]);this.venueReader=new Wtf.data.JsonReader({root:"data"},this.venueRecord);this.venueStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),reader:this.venueReader});this.dateRecord=Wtf.data.Record.create([{name:"dateid",type:"string"},{name:"date",type:"string"}]);this.dateReader=new Wtf.data.JsonReader({root:"data"},this.dateRecord);this.dateStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),reader:this.dateReader});this.programStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","code","duration","id","note","appfee","exemptiontype","programtype","feetype","auditper"]),autoLoad:false,url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:1}});this.courseStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","code","duration","id","note","prereqcourseid","level","parentcourse","isdefault","grpruleflag","subgrp","courseno"]),autoLoad:false,url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:2}});this.moduleStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","id"]),autoLoad:false,url:"jspfiles/reportNew.jsp",baseParams:{mode:32}});this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.sessionCmb=new Wtf.form.ComboBox({store:this.sessionStore,editable:false,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",valueField:"sessionid",allowBlank:false});this.classTypeStore=new Wtf.data.Store({url:"jspfiles/newCourse.jsp",reader:new Wtf.data.JsonReader({fields:[{name:"typeid",type:"string"},{name:"classtype",type:"string"}],root:"data"})});this.facRecord=Wtf.data.Record.create([{name:"username",type:"string"},{name:"id",type:"string"}]);this.facReader=new Wtf.data.KwlJsonReader({root:"data"},this.facRecord);this.facStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newClass.jsp"}),reader:this.facReader});this.fromDate=new Wtf.form.DateField({fieldLabel:"From",id:"DateFrom"+this.id,format:"Y-m-d"});this.programStore.load();this.programCmb=new Wtf.form.ComboBox({id:"prog"+this.id,store:this.programStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a program...",fieldLabel:"Program",name:"id",valueField:"id"});this.courseCmb=new Wtf.form.ComboBox({id:"course"+this.id,store:this.courseStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a course...",fieldLabel:"Course",name:"id",valueField:"id"});this.moduleCmb=new Wtf.form.ComboBox({id:"module"+this.id,store:this.moduleStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a module...",fieldLabel:"Module",name:"id",valueField:"id"});this.ctypeCombo=new Wtf.form.ComboBox({id:"ctype"+this.id,store:this.classTypeStore,editable:false,valueField:"typeid",displayField:"classtype",mode:"local",triggerAction:"all",emptyText:"Select a type...",fieldLabel:"Classroom Type",width:100,listWidth:100,name:"ctype"});this.facCombo=new Wtf.form.ComboBox({id:"facc11"+this.id,store:this.facStore,editable:false,displayField:"username",mode:"local",triggerAction:"all",emptyText:"Select faculty...",fieldLabel:"Faculty",name:"facid",width:145,listWidth:220,valueField:"id",disabled:false});this.venueCombo=new Wtf.form.ComboBox({id:"venuess"+this.id,store:this.venueStore,editable:false,displayField:"vname",mode:"local",triggerAction:"all",emptyText:"Select a venue...",fieldLabel:"Venue",name:"venueid",valueField:"id",width:125,listWidth:220});this.dateCombo=new Wtf.form.ComboBox({id:"dateid"+this.id,store:this.dateStore,editable:false,displayField:"date",mode:"local",triggerAction:"all",emptyText:"Select a date...",fieldLabel:"Date",name:"dateid",valueField:"dateid",width:100,listWidth:100});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.loadMask.show();this.ds.removeAll();this.ds.load({params:{mode:this.mode,moduleid:this.modId,date:this.fromDate.getRawValue(),venueid:this.venueCombo.getValue(),classtype:this.ctypeCombo.getValue(),facid:this.facCombo.getValue(),subclassdate:this.dateCombo.getValue()}})}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.reset();this.fromDate.reset();this.moduleCmb.reset();this.venueCombo.reset();this.ctypeCombo.reset();this.facCombo.reset();this.sessionCmb.reset();this.dateCombo.reset();this.ds.removeAll()}});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({mode:this.mode,moduleid:this.modId,date:this.fromDate.getRawValue(),venueid:this.venueCombo.getValue(),classtype:this.ctypeCombo.getValue(),facid:this.facCombo.getValue(),subclassdate:this.dateCombo.getValue(),type:"reports",dtype:"attachment",report:this.mode});setDldUrl("fileDownload.jsp?"+B)}}});this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({mode:this.mode,moduleid:this.modId,date:this.fromDate.getRawValue(),venueid:this.venueCombo.getValue(),subclassdate:this.dateCombo.getValue(),classtype:this.ctypeCombo.getValue(),facid:this.facCombo.getValue(),fileName:"Student_Attendance_Report.pdf"});setDldUrl("ReportsServlet.jsp?"+B)}}});this.programCmb.on("select",this.handleProgSelect,this);this.courseCmb.on("select",this.handleCourseSelect,this);this.moduleCmb.on("select",this.handleModuleSelect,this);this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Student Name",dataIndex:"Student Name"},{header:"Student ID",dataIndex:"Student ID"},{header:"No. of Classes Attended",dataIndex:"Classes Attended"},{header:"% of Classes Attended",dataIndex:"Classes Percent"}]);this.ds=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["Student Name","Student ID","Classes Attended","Classes Percent"]),url:"jspfiles/reportNew.jsp",baseParams:{mode:this.mode}});this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,viewConfig:{autoFill:true}});this.ds.on("load",function(D,B,C){this.loadMask.hide()},this);this.ds.on("loadException",function(){this.loadMask.hide()},this);Wtf.WtfAttendanceRep.superclass.constructor.call(this,{layout:"fit",border:false,tbar:["Session ",this.sessionCmb,"Program ",this.programCmb," Module ",this.moduleCmb],bbar:[this.print,"-",this.csv],items:[this.northP=new Wtf.Panel({border:false,layout:"fit",items:this.grid,tbar:["Class Type",this.ctypeCombo,"Faculty",this.facCombo,"Venue",this.venueCombo,"Date",this.dateCombo,this.submitBttn,this.clearBttn]})]})};Wtf.extend(Wtf.WtfAttendanceRep,Wtf.Panel,{onRender:function(A){Wtf.WtfAttendanceRep.superclass.onRender.call(this,A);this.sessionStore.load();this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."})},handleProgSelect:function(C,A,B){this.moduleCmb.reset();this.ctypeCombo.reset();this.moduleStore.removeAll();this.classTypeStore.removeAll();this.classTypeStore.load({params:{type:"programsessionclasstype",progid:A.data.id}});this.moduleStore.load({params:{progid:A.data.id,sessionid:this.sessionCmb.getValue()}})},handleCourseSelect:function(C,A,B){this.moduleCmb.reset();this.venueCombo.reset();this.ctypeCombo.reset();this.facCombo.reset();this.dateCombo.reset();this.moduleStore.removeAll();this.moduleStore.load({params:{id:A.data.id}})},handleModuleSelect:function(C,A,B){this.modId=A.data.id;this.facStore.removeAll();this.venueCombo.reset();this.ctypeCombo.reset();this.facCombo.reset();this.dateCombo.reset();this.facStore.baseParams={type:"facvenue"};this.facStore.removeAll();this.facStore.load({params:{moduleid:A.data.id,userid:loginid}});this.venueStore.removeAll();this.venueStore.load({params:{flag:80,moduleid:A.data.id}});this.dateStore.removeAll();this.dateStore.load({params:{flag:86,moduleid:A.data.id}})}});Wtf.data.DynamicJsonReader2=function(A){Wtf.data.DynamicJsonReader2.superclass.constructor.call(this,A,[])};Wtf.extend(Wtf.data.DynamicJsonReader2,Wtf.data.JsonReader,{getRecordType:function(D){var C=0,A=[];for(var B in D[0]){A[C++]=B}this.recordType=Wtf.data.Record.create(A);return this.recordType},readRecords:function(o){this.jsonData=o;var s=this.meta;var sid=s.id;var totalRecords=0;if(s.totalProperty){var v=parseInt(eval("o."+s.totalProperty),10);if(!isNaN(v)){totalRecords=v}}var root=s.root?eval("o."+s.root):o;var recordType=this.getRecordType(root);var fields=recordType.prototype.fields;var records=[];for(var i=0;i<root.length;i++){var n=root[i];var values={};var id=(n[sid]!==undefined&&n[sid]!==""?n[sid]:null);for(var j=0,jlen=fields.length;j<jlen;j++){var f=fields.items[j];var map=f.mapping||f.name;var v=n[map]!==undefined?n[map]:f.defaultValue;v=f.convert(v);values[f.name]=v}var record=new recordType(values,id);record.json=n;records[records.length]=record}return{records:records,totalRecords:totalRecords||records.length}}});Wtf.grid.DynamicColumnModel7=function(B,D){this.cols1=[];var G=B.recordType;var A=G.prototype.fields;for(var C=0;C<A.keys.length;C++){var F=A.keys[C];var E=G.getField(F);if(F.match("Name")){var E=G.getField(F);this.appendFirst1={header:E.name,dataIndex:E.name,id:"Name",width:100,renderer:function(L,I,H,M,K,J){return L}}}else{if(F.match("Matric Number")){var E=G.getField(F);this.appendFirst2={header:E.name,dataIndex:E.name,width:100}}else{if(F.match("Nationality")){var E=G.getField(F);this.appendFirst3={header:E.name,dataIndex:E.name,width:100}}else{this.cols1.push({header:E.name,dataIndex:E.name})}}}}if(this.appendFirst3){this.cols1.unshift(this.appendFirst3)}if(this.appendFirst2){this.cols1.unshift(this.appendFirst2)}if(this.appendFirst1){this.cols1.unshift(this.appendFirst1)}Wtf.grid.DynamicColumnModel7.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModel7,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1}});Wtf.ScoreRep=function(A){Wtf.apply(this,A);this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.sessionCmb=new Wtf.form.ComboBox({store:this.sessionStore,editable:false,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",valueField:"sessionid",allowBlank:false});this.courseRecord=Wtf.data.Record.create([{name:"courseid",type:"string"},{name:"coursename",type:"string"}]);this.courseReader=new Wtf.data.KwlJsonReader({root:"data"},this.courseRecord);this.courseStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/reportNew.jsp"}),baseParams:{mode:"30"},reader:this.courseReader});this.courseCmb=new Wtf.form.ComboBox({store:this.courseStore,editable:false,displayField:"coursename",mode:"local",triggerAction:"all",emptyText:"Select a course...",valueField:"courseid",allowBlank:false});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){if(this.grid!=undefined){this.centerPanel.remove(this.grid)}this.loadMask.show();this.loadGrid()}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.courseCmb.setValue("");this.sessionCmb.setValue("");this.centerPanel.remove(this.grid)}});this.bttnArr=[];if(this.mode==12){this.programStore=new Wtf.data.Store({url:"jspfiles/reportNew.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["programid","programname"])});this.programStore.load({params:{mode:31}});this.programCmb=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"programid",displayField:"programname",store:this.programStore,emptyText:"Select a program..."});this.bttnArr.push("Program ");this.bttnArr.push(this.programCmb);this.programCmb.on("select",this.handleProgSelect,this)}this.bttnArr.push("Session ");this.bttnArr.push(this.sessionCmb);this.bttnArr.push("Course ");this.bttnArr.push(this.courseCmb);this.bttnArr.push(this.submitBttn);this.bttnArr.push(this.clearBttn);Wtf.ScoreRep.superclass.constructor.call(this,{layout:"fit",border:false,items:[this.centerPanel=new Wtf.Panel({layout:"fit",border:false,region:"center",tbar:this.bttnArr,frame:false})]});this.on("render",this.renderGrids,this)};Wtf.extend(Wtf.ScoreRep,Wtf.Panel,{onRender:function(A){Wtf.ScoreRep.superclass.onRender.call(this,A)},renderGrids:function(){this.sessionStore.load();if(this.mode==13){this.courseStore.load({params:{mode:30,repmode:this.mode}})}this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."})},loadGrid:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:this.mode,sessionid:this.sessionCmb.getValue(),courseid:this.courseCmb.getValue(),venueid:""}},this,function(request){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader2({root:"data",totalProperty:"count"});jreader.readRecords(resObj);this.ds=new Wtf.data.Store({reader:jreader,url:"jspfiles/reportNew.jsp",baseParams:{mode:this.mode,flag:true}});this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel7(this.ds,this.examSM);this.grid=new Wtf.grid.GridPanel({loadMask:this.loadMask,border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,bbar:this.pg=new Wtf.PagingToolbar({pageSize:25,store:this.ds,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:["-",this.printBttn=new Wtf.Toolbar.Button({text:"Print",scope:this,disabled:false,handler:this.printReport}),this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var str=Wtf.urlEncode({mode:this.mode,progid:this.mode==12?this.programCmb.getValue():"",acad:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),venueid:"",type:"reports",dtype:"attachment",report:this.mode});setDldUrl("fileDownload.jsp?"+str)}})]}),viewConfig:{autoFill:true}});this.centerPanel.add(this.grid);this.ds.baseParams={mode:this.mode,sessionid:this.sessionCmb.getValue(),courseid:this.courseCmb.getValue(),venueid:"",flag:true};this.ds.loadData(resObj)}this.doLayout();this.loadMask.hide()}}},function(){this.loadMask.hide()})},handleProgSelect:function(B,A){this.courseCmb.reset();this.courseStore.removeAll();this.courseStore.load({params:{mode:30,progid:A.data.programid,repmode:this.mode}})},printReport:function(){var A=Wtf.urlEncode({mode:this.mode,progid:this.mode==12?this.programCmb.getValue():"",acad:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),venueid:"",limit:this.pP.combo.value,fileName:"Analysis_Of_Student_Result_By_Learning_Center.pdf"});setDldUrl("ReportsServlet.jsp?"+A)}});Wtf.grid.DynamicColumnModel8=function(B){this.cols1=[];var F=B.recordType;var A=F.prototype.fields;for(var C=0;C<A.keys.length;C++){var E=A.keys[C];var D=F.getField(E);if(E.match("Course/Module")){this.appendFirst={header:D.name,dataIndex:D.name}}else{if(E.search("% of change")!=-1){if(this.appendLast){this.appendLast1={header:D.name,dataIndex:D.name}}else{this.appendLast={header:D.name,dataIndex:D.name}}}else{this.cols1.push({header:D.name,dataIndex:D.name})}}}if(this.appendSecond){this.cols1.unshift(this.appendSecond)}if(this.appendFirst){this.cols1.unshift(this.appendFirst)}if(this.appendLast1){this.cols1.push(this.appendLast1)}if(this.appendLast){this.cols1.push(this.appendLast)}this.cols1.unshift(new Wtf.grid.RowNumberer({}));Wtf.grid.DynamicColumnModel8.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModel8,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1}});Wtf.SessionResultRep=function(A){Wtf.apply(this,A);this.programStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","code","duration","id","note","appfee","exemptiontype","programtype","feetype","auditper"]),autoLoad:false,url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:1}});this.programCmb=new Wtf.form.ComboBox({id:"prog"+this.id,store:this.programStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a program...",fieldLabel:"Program",name:"id",valueField:"id"});this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.sessionCmb=new Wtf.form.ComboBox({store:this.sessionStore,editable:false,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",valueField:"sessionid",allowBlank:false});this.courseRecord=Wtf.data.Record.create([{name:"courseid",type:"string"},{name:"coursename",type:"string"}]);this.courseReader=new Wtf.data.KwlJsonReader({root:"data"},this.courseRecord);this.courseStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/reportNew.jsp"}),baseParams:{mode:"34"},reader:this.courseReader});this.courseCmb=new Wtf.form.ComboBox({store:this.courseStore,editable:false,displayField:"coursename",mode:"local",triggerAction:"all",emptyText:"Select a course...",valueField:"courseid",allowBlank:false});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.loadMask.show();if(this.ds!=undefined){this.ds.removeAll()}this.northP.remove(this.grid);this.loadGrid()}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.reset();this.sessionCmb.reset();this.courseCmb.reset();this.northP.remove(this.grid);this.southP.el.dom.firstChild.firstChild.innerHTML=""}});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({mode:this.mode,moduleid:this.modId,progid:this.programCmb.getValue(),acad:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),type:"reports",dtype:"attachment",report:this.mode});setDldUrl("fileDownload.jsp?"+B)}}});this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){var B=Wtf.urlEncode({mode:this.mode,progid:this.programCmb.getValue(),acad:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),fileName:"Student_Result_Analysis.pdf"});setDldUrl("ReportsServlet.jsp?"+B)}});this.programCmb.on("select",this.handleProgSelect,this);Wtf.SessionResultRep.superclass.constructor.call(this,{layout:"border",border:false,tbar:[" Session ",this.sessionCmb,"Program ",this.programCmb,"Course",this.courseCmb,this.submitBttn,this.clearBttn],bbar:[this.print,"-",this.csv],items:[this.northP=new Wtf.Panel({border:true,region:"center",bodyStyle:"background-color:#FFFFFF",layout:"fit"}),{border:true,region:"south",layout:"fit",bodyStyle:"background-color:#FFFFFF",title:"Graph",height:210,items:this.southP=new Wtf.Panel({border:false,layout:"fit"})}]})};Wtf.extend(Wtf.SessionResultRep,Wtf.Panel,{onRender:function(A){Wtf.SessionResultRep.superclass.onRender.call(this,A);this.programStore.load();this.sessionStore.load();this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});if(Wtf.isIE){this.ownerCt.addListener("activate",this.handleActivate,this)}},handleActivate:function(A){A.doLayout();var B=this.southP.ownerCt.getSize().height<210?210:this.southP.ownerCt.getSize().height;this.southP.ownerCt.setHeight(B);A.doLayout()},handleProgSelect:function(B,A){this.courseCmb.reset();this.courseStore.removeAll();this.courseStore.load({params:{progid:A.data.id}})},loadGrid:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:this.mode,courseid:this.courseCmb.getValue(),sessionid:this.sessionCmb.getValue(),progid:this.programCmb.getValue()}},this,function(request){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data);this.ds=new Wtf.data.Store({reader:jreader});this._reader=jreader;this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel8(this.ds);this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,viewConfig:{autoFill:true}});this.northP.add(this.grid);this.ds.loadData(resObj.data);var graphdata1='<div><img style = "" align="center" src ="'+resObj.imgurl+'"</img></div>';this.southP.el.dom.firstChild.firstChild.innerHTML=graphdata1}this.doLayout();this.loadMask.hide()}}},function(resp,req){this.loadMask.hide()})}});Wtf.grid.DynamicColumnModel15=function(B){this.cols1=[];var F=B.recordType;var A=F.prototype.fields;for(var C=0;C<A.keys.length;C++){var E=A.keys[C];var D=F.getField(E);if(E.match("Student Name")){this.appendFirst={header:D.name,dataIndex:D.name}}else{if(E.match("Student Id")){this.appendSecond={header:D.name,dataIndex:D.name}}else{if(E.match("CGPA")){this.appendLast={header:D.name,dataIndex:D.name}}else{if(E.match("GPA")){this.appendSecondLast={header:D.name,dataIndex:D.name}}else{this.cols1.push({header:D.name,dataIndex:D.name})}}}}}if(this.appendSecondLast){this.cols1.push(this.appendSecondLast)}if(this.appendLast){this.cols1.push(this.appendLast)}if(this.appendSecond){this.cols1.unshift(this.appendSecond)}if(this.appendFirst){this.cols1.unshift(this.appendFirst)}this.cols1.unshift(new Wtf.grid.RowNumberer({}));Wtf.grid.DynamicColumnModel15.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModel15,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1}});Wtf.grid.DynamicColumnModel16=function(B){this.cols1=[];this.cols2=[];var F=B.recordType;var A=F.prototype.fields;for(var C=0;C<A.keys.length;C++){var E=A.keys[C];var D=F.getField(E);if(E.match("Name")){this.appendFirst={header:D.name,dataIndex:D.name}}else{if(E.match("Matric No.")){this.appendSecond={header:D.name,dataIndex:D.name,sortable:true}}else{if(E.match("TGP")||E.match("TCH")||E.match("GPA")||E.match("CGP")||E.match("CCH")||E.match("CGPA")||E.match("Status")){this.cols2[D.name]={header:D.name,dataIndex:D.name}}else{this.cols1.push({header:D.name,dataIndex:D.name})}}}}this.cols1.push(this.cols2["TGP"]);this.cols1.push(this.cols2["TCH"]);this.cols1.push(this.cols2["GPA"]);this.cols1.push(this.cols2["CGP"]);this.cols1.push(this.cols2["CCH"]);this.cols1.push(this.cols2["CGPA"]);this.cols1.push(this.cols2["Status"]);if(this.appendSecond){this.cols1.unshift(this.appendSecond)}if(this.appendFirst){this.cols1.unshift(this.appendFirst)}this.cols1.unshift(new Wtf.grid.RowNumberer({}));Wtf.grid.DynamicColumnModel15.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModel16,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1}});Wtf.grid.DynamicColumnModelSum=function(B){this.cols1=[];var F=B.recordType;var A=F.prototype.fields;A.keys=A.keys.sort();for(var C=0;C<A.keys.length;C++){var E=A.keys[C];var D=F.getField(E);if(E.match("Course/Module")){this.appendFirst={header:D.name,dataIndex:D.name}}else{if(E.match("Total")){this.appendLast={header:D.name,dataIndex:D.name}}else{this.cols1.push({header:D.name,dataIndex:D.name})}}}if(this.appendSecond){this.cols1.unshift(this.appendSecond)}if(this.appendFirst){this.cols1.unshift(this.appendFirst)}if(this.appendLast){this.cols1.push(this.appendLast)}this.cols1.unshift(new Wtf.grid.RowNumberer({}));Wtf.grid.DynamicColumnModelSum.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModelSum,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1}});Wtf.ResultSummaryRep=function(A){Wtf.apply(this,A);this.programStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","code","duration","id","note","appfee","exemptiontype","programtype","feetype","auditper"]),autoLoad:false,url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:1}});this.programCmb=new Wtf.form.ComboBox({id:"prog"+this.id,store:this.programStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a program...",fieldLabel:"Program",name:"id",valueField:"id"});this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.sessionCmb=new Wtf.form.ComboBox({store:this.sessionStore,editable:false,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",valueField:"sessionid",allowBlank:false});this.courseRecord=Wtf.data.Record.create([{name:"courseid",type:"string"},{name:"coursename",type:"string"}]);this.courseReader=new Wtf.data.KwlJsonReader({root:"data"},this.courseRecord);this.courseStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/reportNew.jsp"}),baseParams:{mode:"34"},reader:this.courseReader});this.courseCmb=new Wtf.form.ComboBox({store:this.courseStore,editable:false,displayField:"coursename",mode:"local",triggerAction:"all",emptyText:"Select a course...",valueField:"courseid",allowBlank:false});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.loadMask.show();if(this.ds!=undefined){this.ds.removeAll()}if(this.ds1!=undefined){this.ds1.removeAll()}this.northP.remove(this.grid);this.southWP.remove(this.grid1);this.loadGrid();this.loadGrid1()}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.reset();this.sessionCmb.reset();this.courseCmb.reset();this.northP.remove(this.grid);this.southWP.remove(this.grid1);this.southEP.el.dom.firstChild.firstChild.innerHTML=""}});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({mode:this.mode,moduleid:this.modId,progid:this.programCmb.getValue(),acad:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),type:"reports",dtype:"attachment",report:this.mode});setDldUrl("fileDownload.jsp?"+B)}}});this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){var B=Wtf.urlEncode({mode:this.mode,moduleid:this.modId,progid:this.programCmb.getValue(),acad:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),fileName:"Student_Result_Summary_Report.pdf"});setDldUrl("ReportsServlet.jsp?"+B)}});this.programCmb.on("select",this.handleProgSelect,this);Wtf.ResultSummaryRep.superclass.constructor.call(this,{layout:"border",border:false,bodyStyle:"background-color:#FFFFFF",tbar:[" Session ",this.sessionCmb,"Program ",this.programCmb,"Course",this.courseCmb,this.submitBttn,this.clearBttn],bbar:[this.print,"-",this.csv],items:[{layout:"fit",border:true,region:"center",bodyStyle:"background-color:#FFFFFF",items:this.northP=new Wtf.Panel({border:false,layout:"fit"})},{layout:"border",border:true,region:"south",bodyStyle:"background-color:#FFFFFF",height:200,id:"southp"+this.id,items:[{layout:"fit",border:true,region:"west",width:300,title:"Result Summary",items:this.southWP=new Wtf.Panel({border:false,layout:"fit"})},{layout:"fit",border:true,region:"center",title:"Graph",items:this.southEP=new Wtf.Panel({border:false,layout:"fit"})}]}]})};Wtf.extend(Wtf.ResultSummaryRep,Wtf.Panel,{onRender:function(A){Wtf.ResultSummaryRep.superclass.onRender.call(this,A);this.programStore.load();this.sessionStore.load();this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});if(Wtf.isIE){this.ownerCt.addListener("activate",this.handleActivate,this)}},handleActivate:function(A){A.doLayout();var C=Wtf.getCmp("southp"+this.id).getSize().height<200?200:Wtf.getCmp("southp"+this.id).getSize().height;Wtf.getCmp("southp"+this.id).setHeight(C);A.doLayout();var B=this.southWP.ownerCt.getSize().width<300?300:this.southWP.ownerCt.getSize().width;this.southWP.ownerCt.setWidth(B);A.doLayout()},handleProgSelect:function(B,A){this.courseCmb.reset();this.courseStore.removeAll();this.courseStore.load({params:{progid:A.data.id}})},loadGrid:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:this.mode,courseid:this.courseCmb.getValue(),sessionid:this.sessionCmb.getValue(),progid:this.programCmb.getValue()}},this,function(request){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data);this.ds=new Wtf.data.Store({reader:jreader});this._reader=jreader;this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel15(this.ds);this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,viewConfig:{autoFill:true}});this.northP.add(this.grid);this.ds.loadData(resObj.data)}this.doLayout()}}},function(resp,req){})},loadGrid1:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:35,courseid:this.courseCmb.getValue(),sessionid:this.sessionCmb.getValue(),progid:this.programCmb.getValue()}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data);this.ds1=new Wtf.data.Store({reader:jreader});this._reader1=jreader;this.ds1.recordType=jreader.recordType;this.ds1.fields=jreader.recordType.prototype.fields;this.cm1=new Wtf.grid.DynamicColumnModelSum(this.ds1);this.grid1=new Wtf.grid.GridPanel({border:false,store:this.ds1,enableColumnHide:false,enableColumnMove:false,cm:this.cm1,viewConfig:{autoFill:true}});this.southWP.add(this.grid1);this.ds1.loadData(resObj.data);var graphdata1='<div><img style = "" align="center" src ="'+resObj.imgurl+'"</img></div>';this.southEP.el.dom.firstChild.firstChild.innerHTML=graphdata1}this.doLayout();this.loadMask.hide()}}},function(resp,req){this.loadMask.hide()})}});Wtf.StudSponsor=function(A){Wtf.apply(this,A);this.sortindex="";this.dir=0;this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Student Name",dataIndex:"Registered Student"},{header:"Student ID",dataIndex:"Student ID"},{header:"Contact No.",dataIndex:"Contact No",sortable:false},{header:"Program",dataIndex:"Program",sortable:false},{header:"Applied On",dataIndex:"Applied On",sortable:false},{header:"Nationality",dataIndex:"Nationality"},{header:"Funding Method",dataIndex:"Funding Method",sortable:false},{header:"Fee Plan",dataIndex:"Fee Plan",sortable:false},{header:"Sponsor",dataIndex:"Sponsor"}]);this.ds=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["Registered Student","Student ID","Contact No","Program","Applied On","Nationality","Funding Method","Fee Plan","Sponsor"]),url:"jspfiles/reportNew.jsp",baseParams:{mode:4,progid:"",funding:"",sponsor:"",fromdate:"",todate:"",sortindex:this.sortindex,dir:this.dir}});this.programStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["programid","programname"])});this.programStore.on("load",function(B){var D=new Wtf.data.Record.create(["programid","programname"]);var C=new D({programid:"",programname:"All"});B.addSorted(C);this.programCmb.setValue("")},this);this.programStore.load({params:{type:20}});this.programCmb=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"programid",displayField:"programname",store:this.programStore,emptyText:"Select a program..."});this.fundingStore=new Wtf.data.SimpleStore({fields:["fundmeth","name"],data:[["INCEIF-Funding","INCEIF-Funding"],["Self-funding","Self-funding"],["Sponsorship","Sponsorship"]]});this.fundingCombo=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"fundmeth",displayField:"name",store:this.fundingStore,emptyText:"Select a Funding Method..."});this.sponsorStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["code","name"])});this.sponsorStore.load({params:{type:99}});this.sponsorCombo=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"code",displayField:"name",store:this.sponsorStore,emptyText:"Select a sponsor..."});this.fromDate=new Wtf.form.DateField({fieldLabel:"From",id:"DateFrom"+this.id,format:Wtf.getDateFormat()});this.toDate=new Wtf.form.DateField({fieldLabel:"To",id:"DateTo"+this.id,format:Wtf.getDateFormat()});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.ds.baseParams={mode:4,progid:this.programCmb.getValue(),funding:this.fundingCombo.getValue(),sponsor:this.sponsorCombo.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.setValue("");this.fundingCombo.setValue("");this.sponsorCombo.setValue("");this.fromDate.setValue("");this.toDate.setValue("");this.ds.baseParams={mode:4,progid:"",funding:"",sponsor:"",fromdate:"",todate:"",sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});Wtf.StudSponsor.superclass.constructor.call(this,{layout:"fit",border:false,tbar:["Program: ",this.programCmb,"-","Funding method:",this.fundingCombo],items:[this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,cm:this.cm,viewConfig:{autoFill:true},loadMask:{msg:"Loading..."},tbar:["Sponsor:",this.sponsorCombo,"-","Applied:","From ",this.fromDate,"   To ",this.toDate,"-",this.submitBttn,this.clearBttn],bbar:this.pg=new Wtf.PagingToolbar({pageSize:25,store:this.ds,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({mode:4,progid:this.programCmb.getValue(),funding:this.fundingCombo.getValue(),sponsor:this.sponsorCombo.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),sortindex:this.sortindex,dir:this.dir,fileName:"Student_Sponsor_List.pdf"});setDldUrl("ReportsServlet.jsp?"+B)}}}),"-",this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({progid:this.programCmb.getValue(),funding:this.fundingCombo.getValue(),sponsor:this.sponsorCombo.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),sortindex:this.sortindex,dir:this.dir,type:"reports",dtype:"attachment",report:"studentsponsor"});setDldUrl("fileDownload.jsp?"+B)}}})]})})]});this.grid.on("headerclick",function(C,B,D){if(C.colModel.config[B].sortable==false){return }var E=Wtf.get(D.getTarget().id);if(!this.prevTarget||this.prevTarget!==E){if(this.prevTarget){if(this.prevTarget.hasClass("sort-asc")){this.prevTarget.removeClass("sort-asc")}else{if(this.prevTarget.hasClass("sort-desc")){this.prevTarget.removeClass("sort-desc")}}}this.prevTarget=E}if(E.hasClass("sort-asc")){E.addClass("sort-desc");E.removeClass("sort-asc");this.dir=1}else{E.addClass("sort-asc");E.addClass("x-grid3-hd-inner");if(E.hasClass("sort-desc")){E.removeClass("sort-desc")}this.dir=0}this.sortindex=C.colModel.config[B].dataIndex;this.ds.baseParams={mode:4,progid:this.programCmb.getValue(),funding:this.fundingCombo.getValue(),sponsor:this.sponsorCombo.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})},this)};Wtf.extend(Wtf.StudSponsor,Wtf.Panel,{onRender:function(A){Wtf.StudSponsor.superclass.onRender.call(this,A);this.ds.load({params:{start:0,limit:25}})}});Wtf.creditNote=function(A){Wtf.apply(this,A);Wtf.grid.GroupSummary.Calculations["amount"]=function(C,B){return B.data.amount};this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Date",dataIndex:"date"},{header:"Credit Note No.",dataIndex:"num",renderer:function(B){return"<a href = '#' class='printInvoice' > "+B+"</a>"}},{header:"Student ID",dataIndex:"sid"},{header:"Student Name",dataIndex:"name"},{header:"Amount",dataIndex:"amount",summaryType:"sum",align:"right",summaryRenderer:function(B){B=B+"";if(B!=null&&B!=""){return"Total: "+Wtf.precisionDecimalValue(B)}else{return"Total: "+B}},renderer:function(B){return Wtf.precisionDecimalValue(B)}},{header:"Credit Note",dataIndex:"credit"}]);this.ds=new Wtf.data.GroupingStore({reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["date","num","sid","name","amount","currency","credit"]),url:"jspfiles/reportNew.jsp",baseParams:{mode:36},sortInfo:{field:"credit",direction:"asc"},groupField:"credit"});this.programStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["programid","programname"])});this.programStore.on("load",function(B){var D=new Wtf.data.Record.create(["programid","programname"]);var C=new D({programid:"",programname:"All"});B.addSorted(C);this.programCmb.setValue("")},this);this.programStore.load({params:{type:20}});this.programCmb=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"programid",displayField:"programname",store:this.programStore,emptyText:"Select a program..."});this.fromDate=new Wtf.form.DateField({fieldLabel:"From",id:"DateFrom"+this.id,format:"Y-m-d"});this.toDate=new Wtf.form.DateField({fieldLabel:"To",id:"DateTo"+this.id,format:"Y-m-d"});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.ds.load({params:{progid:this.programCmb.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),start:0,limit:this.pP.combo.value},waitMsg:"Loading..."})}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.setValue("");this.fromDate.setValue("");this.toDate.setValue("");this.ds.load({params:{start:0,limit:this.pP.combo.value},waitMsg:"Loading..."})}});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"studentname"});this.summary=new Wtf.grid.GroupSummary({});this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,cm:this.cm,viewConfig:{autoFill:true},loadMask:{msg:"Loading..."},view:this.groupingView,plugins:this.summary,bbar:this.pg=new Wtf.PagingToolbar({pageSize:25,store:this.ds,searchField:this.quickPanelSearch,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:["-",this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({progid:this.programCmb.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),type:"reports",dtype:"attachment",report:"creditnote"});setDldUrl("fileDownload.jsp?"+B)}}})]})});Wtf.creditNote.superclass.constructor.call(this,{layout:"fit",border:false,tbar:["Quick Search: ",this.quickPanelSearch,"Program: ",this.programCmb,"-","Applied:","From ",this.fromDate,"   To ",this.toDate,"-",this.submitBttn,this.clearBttn],items:[this.grid]});this.grid.on("cellclick",this.clickHandle,this);this.ds.on("load",this.handleStoreLoad,this);this.ds.on("datachanged",function(){var B=this.pP.combo.value;this.quickPanelSearch.setPage(B)},this)};Wtf.extend(Wtf.creditNote,Wtf.Panel,{onRender:function(A){Wtf.creditNote.superclass.onRender.call(this,A);this.ds.load({params:{start:0,limit:25},waitMsg:"Loading..."})},handleStoreLoad:function(A,D,B){this.quickPanelSearch.StorageChanged(A);var C=A.reader.jsonData.studCnt},clickHandle:function(B,E,A,C){if(C.target.className=="printInvoice"){var D=B.getStore().getAt(E);printInvoice(D.get("num"),2)}}});Wtf.auditTrial=function(A){Wtf.apply(this,A);this.dir=0;Wtf.grid.GroupSummary.Calculations["amount"]=function(C,B){return B.data.amount};this.numStore=new Wtf.data.SimpleStore({fields:["no","type"],data:[["1","Invoice"],["2","Official Receipt"]]});this.typeCombo=new Wtf.form.ComboBox({mode:"local",triggerAction:"all",typeAhead:false,editable:false,width:120,store:this.numStore,displayField:"type",valueField:"no",value:"1"}),this.programStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["programid","programname","programtype"])});this.programStore.on("load",function(B){var D=new Wtf.data.Record.create(["programid","programname","programtype"]);var C=new D({programid:"",programname:"All"});B.addSorted(C);this.programCmb.setValue("")},this);this.programStore.load({params:{type:20}});this.programCmb=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"programid",displayField:"programname",store:this.programStore,width:100,emptyText:"Select a program..."});this.programCmb.on("select",this.programSelect,this);this.fromDate=new Wtf.form.DateField({fieldLabel:"From",id:"DateFrom"+this.id,format:Wtf.getDateFormat()});this.toDate=new Wtf.form.DateField({fieldLabel:"To",id:"DateTo"+this.id,format:Wtf.getDateFormat()});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.ds.baseParams={mode:37,progid:this.programCmb.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),choice:this.typeCombo.getValue(),ptype:this.programType};this.ds.load({params:{start:0,limit:this.pP.combo.value},waitMsg:"Loading..."})}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.setValue("");this.fromDate.setValue("");this.toDate.setValue("");this.typeCombo.setValue("1");this.ds.baseParams={mode:37,progid:"",fromdate:"",todate:"",choice:this.typeCombo.getValue()};this.ds.load({params:{start:0,limit:this.pP.combo.value},waitMsg:"Loading..."})}});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.summary=new Wtf.grid.GroupSummary({});this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Date",dataIndex:"date"},{header:"Type",dataIndex:"type"},{header:"Document No.",dataIndex:"num",renderer:function(B){return"<a href = '#' class='printInvoice' > "+B+"</a>"}},{header:"Student ID",dataIndex:"sid"},{header:"Student Name",dataIndex:"name"},{header:"Fee Type",dataIndex:"fee"},{header:"Sponsor",dataIndex:"sponsor"},{header:"Amount(RM)",dataIndex:"amount",summaryType:"sum",align:"right",summaryRenderer:function(B){B=B+"";if(B!=null&&B!=""){return"Total: "+Wtf.precisionDecimalValue(B)}else{return"Total: "+B}},renderer:function(B){return Wtf.precisionDecimalValue(B)}}]);this.ds=new Wtf.data.GroupingStore({reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["date","type","num","sid","name","amount","fee","sponsor"]),url:"jspfiles/reportNew.jsp",baseParams:{mode:37,progid:"",fromdate:"",todate:"",choice:this.typeCombo.getValue()},sortInfo:{field:"type",direction:"asc"},groupField:"type"});this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,cm:this.cm,view:this.groupingView,plugins:this.summary,viewConfig:{autoFill:true},loadMask:{msg:"Loading..."},bbar:this.pg=new Wtf.PagingToolbar({pageSize:25,store:this.ds,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:["-",this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({progid:this.programCmb.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),type:"reports",dtype:"attachment",report:"audittrial",choice:this.typeCombo.getValue(),ptype:this.programType});setDldUrl("fileDownload.jsp?"+B)}}})]})});Wtf.auditTrial.superclass.constructor.call(this,{layout:"fit",border:false,tbar:["Type:",this.typeCombo,"Program: ",this.programCmb,"-","Applied:","From ",this.fromDate,"   To ",this.toDate,"-",this.submitBttn,"-",this.clearBttn],items:[this.grid]});this.grid.on("cellclick",this.clickHandle,this)};Wtf.extend(Wtf.auditTrial,Wtf.Panel,{onRender:function(A){Wtf.auditTrial.superclass.onRender.call(this,A);this.ds.load({params:{start:0,limit:25},waitMsg:"Loading..."})},clickHandle:function(C,F,B,D){if(D.target.className=="printInvoice"){var E=C.getStore().getAt(F);var A=E.get("num");if(A.search("IN")!=-1){printInvoice(A,1)}else{printInvoice(A,3)}}},programSelect:function(B,C,A){this.programType=C.get("programtype")}});Wtf.PaymentAging=function(A){Wtf.apply(this,A);this.invoiceReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["name","date","invoice","amount","metricno","email","feename","status","firstdate","seconddate","thirddate","fundingmethod","mindate"]);this.ds=new Wtf.data.GroupingStore({url:"jspfiles/report.jsp",baseParams:{type:"paymentaging",progid:"",feetype:"",age:"1",summaryFlag:false},reader:this.invoiceReader,sortInfo:{field:"name",direction:"ASC"},groupField:"name"});this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true,listeners:{scope:this,rowselect:function(B,D,C){if(C.get("seconddate")!="N/A"){this.reminderBtn.enable()}else{this.reminderBtn.disable()}},rowdeselect:function(C,D,B){this.reminderBtn.disable()}}});this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),this.sm,{header:"Date",dataIndex:"date"},{header:"Invoice No.",dataIndex:"invoice",align:"center",renderer:function(B){return"<a href = '#' class='printInvoice' > "+B+"</a>"}},{header:"Metric No",dataIndex:"metricno",align:"center"},{header:"Student Name",dataIndex:"name"},{header:"Status",dataIndex:"status"},{header:"Fee Type",dataIndex:"feename"},{header:"Funding Method",dataIndex:"fundingmethod"},{header:"1st Reminder sent on",dataIndex:"firstdate"},{header:"2nd Reminder sent on",dataIndex:"seconddate"},{header:"3rd Reminder sent on",dataIndex:"thirddate"},{header:"Amount",dataIndex:"amount",sortable:false,align:"right",summaryType:"sum",summaryRenderer:function(B){B=B+"";if(B!=null&&B!=""){return"Total: "+Wtf.convertToMoneyFrm(B)}else{return"Total: "+B}},renderer:function(B){B=B+"";if(B!=null&&B!=""){return Wtf.convertToMoneyFrm(B)}else{return B}}}]);this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.summary=new Wtf.grid.GroupSummary({});this.programStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["programid","programname"])});this.programStore.on("load",function(B){var D=new Wtf.data.Record.create(["programid","programname"]);var C=new D({programid:"",programname:"All"});B.addSorted(C);this.programCmb.setValue("")},this);this.programStore.load({params:{type:20}});this.programCmb=new Wtf.form.ComboBox({triggerAction:"all",editable:false,width:150,mode:"local",valueField:"programid",displayField:"programname",store:this.programStore,emptyText:"Select a program...",minListWidth:230});this.typeStore=new Wtf.data.JsonStore({url:"CountryList.jsp",root:"data",fields:["id","name"]});this.typeStore.on("load",function(B){var D=new Wtf.data.Record.create(["id","name"]);var C=new D({id:"",name:"All"});B.addSorted(C);this.typeCombo.setValue("")},this);this.typeStore.load({params:{mode:"feetype"}});this.typeCombo=new Wtf.form.ComboBox({triggerAction:"all",editable:false,width:150,mode:"local",valueField:"id",displayField:"name",store:this.typeStore,emptyText:"Select a fee type...",minListWidth:240});this.userRec=Wtf.data.Record.create([{name:"no"},{name:"type"},{name:"diff"}]);this.userReader=new Wtf.data.KwlJsonReader(this.userRec);this.ageStore=new Wtf.data.SimpleStore({fields:["no","type","diff"],data:[["1","All",0],["2","0 - 30 Days",30],["3","31 - 60 Days",60],["4","61 - 90 Days",90],["5","91 - 120 Days",120],["6","121 - 150 Days",150],["7","151 - 180 Days",180],["8","Over 180 Days",181]],reader:this.userReader});this.ageCombo=new Wtf.form.ComboBox({mode:"local",triggerAction:"all",typeAhead:false,editable:false,width:85,store:this.ageStore,displayField:"type",valueField:"no",value:"1",minListWidth:100}),this.payRec=Wtf.data.Record.create([{name:"no"},{name:"type"}]);this.paymodeReader=new Wtf.data.KwlJsonReader(this.payRec);this.paymodeStore=new Wtf.data.SimpleStore({fields:["no","type"],data:[["All","All"],["Selffunding","Self Funding"],["Sponsorship","Sponsorship"]],reader:this.paymodeReader});this.paymodeCombo=new Wtf.form.ComboBox({mode:"local",triggerAction:"all",typeAhead:false,editable:false,width:85,store:this.paymodeStore,displayField:"type",valueField:"no",value:"All",minListWidth:100}),this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.ds.removeAll();this.summaryStore.removeAll();this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});this.reminderBtn=new Wtf.Toolbar.Button({text:"Send Reminder Letter",scope:this,disabled:true,handler:this.sendReminderLetter});this.startdate=new Wtf.form.DateField({id:"startdate"+this.id,width:80,fieldLabel:"Start Date*",format:"Y-m-d H:i:s",emptyText:"Select the start date."});this.enddate=new Wtf.form.DateField({id:"enddate"+this.id,width:80,fieldLabel:"End Date*",format:"Y-m-d H:i:s",emptyText:"Select the end date.",maxValue:new Date(),maxText:"nothing in the future"});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.setValue("");this.typeCombo.setValue("");this.ageCombo.setValue("All");this.quickPanelSearch.setValue("");this.startdate.setValue("");this.enddate.setValue("");var B=this.ds.getTotalCount();if(B>0){var C=this.ds.getAt(0).get("mindate")}if(C!="9999-99-99"){this.enddate.setMinValue(C);this.startdate.setMinValue(C)}this.ds.load({params:{start:0,limit:this.pP.combo.value,age:"1"}})}});Wtf.PaymentAging.superclass.constructor.call(this,{layout:"border",border:false,items:[this.innerPanel=new Wtf.Panel({region:"north",xtype:"Panel",layout:"fit",height:25,paging:false,tbar:["Program: ",this.programCmb,"-","Fee Type: ",this.typeCombo,"-","Payment Mode",this.paymodeCombo],border:false}),this.grid=new Wtf.grid.GridPanel({region:"center",border:false,id:"grid"+this.id,store:this.ds,enableColumnHide:false,cm:this.cm,sm:this.sm,autoScroll:true,view:this.groupingView,plugins:this.summary,loadMask:{msg:"Loading..."},tbar:["Quick Search:",this.quickPanelSearch=new Wtf.KWLTagSearch({width:90,field:"name",emptyText:"Search"}),"-","-","Start Date*:",this.startdate,"End Date*:",this.enddate,"-","Age: ",this.ageCombo,"-",this.submitBttn,"-",this.clearBttn],bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.ds,displayInfo:true,searchField:this.quickPanelSearch,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({type:"reports",dtype:"attachment",report:"agingReport",flag:true,summaryFlag:false,progid:this.programCmb.getValue(),prog:this.programCmb.lastSelectionText,feetype:this.typeCombo.getValue(),fee:this.typeCombo.lastSelectionText,age:this.ageCombo.getValue(),ageval:this.ageCombo.lastSelectionText,startdate:this.startdate.value,enddate:this.enddate.value,paymode:this.paymodeCombo.getValue(),date:this.startdate.value,ss:this.quickPanelSearch.getValue()});setDldUrl("fileDownload.jsp?"+B)}}}),"-",this.reminderBtn]})}),{region:"south",height:100,xtype:"grid",title:"Ageing Analysis",layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:true},border:false,cm:new Wtf.grid.ColumnModel([{header:"1-30 Days",dataIndex:"1-30",align:"center",renderer:function(B){return Wtf.convertToMoneyFrm(B)}},{header:"31-60 Days",dataIndex:"31-60",align:"center",renderer:function(B){return Wtf.convertToMoneyFrm(B)}},{header:"61-90 Days",dataIndex:"61-90",align:"center",renderer:function(B){return Wtf.convertToMoneyFrm(B)}},{header:"91-120 Days",dataIndex:"91-120",align:"center",renderer:function(B){return Wtf.convertToMoneyFrm(B)}},{header:"121-150 Days",dataIndex:"121-150",align:"center",renderer:function(B){return Wtf.convertToMoneyFrm(B)}},{header:"151-180 Days",dataIndex:"151-180",align:"center",renderer:function(B){return Wtf.convertToMoneyFrm(B)}},{header:"180 Days & Above",dataIndex:"180",align:"center",renderer:function(B){return Wtf.convertToMoneyFrm(B)}},{header:"Grand Total",dataIndex:"total",align:"center",renderer:function(B){return Wtf.convertToMoneyFrm(B)}}]),ds:this.summaryStore=new Wtf.data.Store({baseParams:{type:"paymentaging",summaryFlag:true},url:"jspfiles/report.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["1-30","31-60","61-90","91-120","121-150","151-180","180","total"])})}]});this.grid.on("cellclick",this.clickHandle,this);this.ds.on("datachanged",function(){var B=this.pP.combo.value;this.quickPanelSearch.setPage(B)},this);this.ds.on("beforeload",function(){this.ds.baseParams={type:"paymentaging",progid:this.programCmb.getValue(),feetype:this.typeCombo.getValue(),age:this.ageCombo.getValue(),startdate:this.startdate.value,enddate:this.enddate.value,paymode:this.paymodeCombo.getValue(),ss:this.quickPanelSearch.getValue(),summaryFlag:false}},this);this.ds.on("load",function(B,E,C){this.quickPanelSearch.StorageChanged(B);this.reminderBtn.disable();var D=this.ds.getTotalCount();if(D>0){var F=this.ds.getAt(0).get("mindate")}if(F!="9999-99-99"){this.enddate.setMinValue(F);this.startdate.setMinValue(F)}this.summaryStore.load({params:{progid:this.programCmb.getValue(),feetype:this.typeCombo.getValue(),age:this.ageCombo.getValue(),startdate:this.startdate.value,enddate:this.enddate.value,paymode:this.paymodeCombo.getValue(),ss:this.quickPanelSearch.getValue(),start:0,limit:0}})},this);this.startdate.on("change",function(D,C,B){this.enddate.setMinValue(C);this.enddate.setValue("")},this);this.enddate.on("change",function(){this.ageCombo.setValue("All")},this);this.ageCombo.on("expand",function(){var C=this.enddate.getValue();var B=this.startdate.getValue();var D=-1;if(B==""&&C!=""){var E=this.ds.getTotalCount();if(E>0){var F=this.ds.getAt(0).get("mindate")}if(F!="9999-99-99"){B=Date.parseDate(F,"Y-m-d")}}if(B!=""&&C==""){C=new Date()}if(C!=""&&B!=""){D=Wtf.cal.utils.DateDiff(C,B)+1}this.ageStore.filterBy(function(H){var G=H.get("diff");if(D==-1){return true}else{if(D>=G){return true}else{return false}}})},this)};Wtf.extend(Wtf.PaymentAging,Wtf.Panel,{sendReminderLetter:function(){if(this.sm.getCount()==1){var B=this.sm.getSelected();var A="Hi "+B.get("name")+",<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;We have yet to get any replies from you regarding your outstanding payment due to INCEIF. Please be informed that we will proceed in blocking your access to eUniversity.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;If you have already made the payment, please advise us the method used and date it was made so that we can update our record and release your eUniversity access. For any assistance or enquiries, please email us at bursary@inceif.org.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;Thank you and your attention on this matter is highly appreciated.<br/><br/>Regards,<br/>&nbsp;Bursary";if(Wtf.getCmp("winCompose"+this.id)){Wtf.getCmp("winCompose"+this.id).destroy()}new Wtf.Window({title:"Compose",height:380,resizable:false,modal:true,id:"winCompose"+this.id,items:[{xtype:"form",id:"frmCompose"+this.id,layout:"form",bodyStyle:"padding:5px",frame:true,border:"false",enableSourceEdit:false,height:360,items:[{xtype:"textfield",fieldLabel:"To",name:"to",value:B.get("email"),width:"95%",readOnly:false},{xtype:"textfield",fieldLabel:"Subject",name:"subject",width:"95%",value:"Payment Aging",allowBlank:false},{xtype:"textfield",fieldLabel:"",name:"username",width:"95%",value:B.get("metricno"),inputType:"hidden"},{xtype:"textfield",fieldLabel:"",name:"invoice",width:"95%",value:B.get("invoice"),inputType:"hidden"},{xtype:"htmleditor",name:"editor",hideLabel:true,labelSeparator:"",value:A},{xtype:"textfield",fieldLabel:"",name:"type",value:"reminderLetter",inputType:"hidden"}],buttons:[{text:"Send",scope:this,type:"submit",handler:this.sendMail},{text:"Close",scope:this,handler:function(){Wtf.getCmp("winCompose"+this.id).close()}}]}]}).show()}},sendMail:function(){var bodyTxt=Wtf.getCmp("frmCompose"+this.id).getForm().findField("editor").getValue();var subject=Wtf.getCmp("frmCompose"+this.id).getForm().findField("subject").getValue();if(subject.length==0||subject==""){msgBoxShow(["Error","Please enter subject."],Wtf.MessageBox.ERROR);return }if(bodyTxt==""||bodyTxt=="<br>"){msgBoxShow(["Error","Message body can't be empty"],Wtf.MessageBox.ERROR);return }Wtf.getCmp("frmCompose"+this.id).getForm().submit({url:"jspfiles/report.jsp",waitMsg:"Sending...",clientValidation:true,scope:this,success:function(result,req){var obj=eval("("+req.response.responseText+")");if(obj.success==true){msgBoxShow(["Status","Reminder letter successfully sent to selected student."],Wtf.MessageBox.INFO);this.ds.load({params:{start:0,limit:15}})}else{msgBoxShow(["Status","Error in sending reminder letter."],Wtf.MessageBox.ERROR)}Wtf.getCmp("winCompose"+this.id).close()},failure:function(result,req){msgBoxShow(["Error","Error in connection."],Wtf.MessageBox.ERROR)}})},onRender:function(A){Wtf.PaymentAging.superclass.onRender.call(this,A);this.ds.load({params:{start:0,limit:15}})},clickHandle:function(C,F,B,D){if(D.target.className=="printInvoice"){var E=C.getStore().getAt(F);var A=E.get("invoice");printInvoice(A,1)}}});Wtf.accountReport=function(C){Wtf.apply(this,C);this.sortindex="";this.dir=0;var B=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["Type","Student Name","Metric No","Date","Invoice No","Amount"]);var D=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["Type","Student Name","Date","Invoice No","Payment No","Payment Mode","Reference Number","Amount","Metric No","feename"]);this.group="";if(this.flag){this.group="feename"}else{this.group="Type"}this.ds=new Wtf.data.GroupingStore({url:"jspfiles/reportNew.jsp",baseParams:{mode:5,progid:"",type:"",fromdate:"",todate:"",flag:this.flag,sortindex:this.sortindex,dir:this.dir},reader:D,sortInfo:{field:this.group,direction:"ASC"},groupField:this.group});Wtf.grid.GroupSummary.Calculations["Amount"]=function(F,E){return E.data.Amount};this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{dataIndex:"Type",groupable:this.flag==2?true:false,sortable:this.flag==2?true:false,hidden:this.flag==2?false:true},{header:"Date",dataIndex:"Date"},{header:this.flag==2?"Document No.":"Invoice No.",dataIndex:"Invoice No",sortable:false,renderer:function(E){return"<a href = '#' class='printInvoice' > "+E+"</a>"}},{header:"Payment No.",dataIndex:"Payment No",sortable:false,hidden:this.flag==1?false:true,renderer:function(E){return"<a href = '#' class='printPayment' > "+E+"</a>"}},{header:"Payment Mode",dataIndex:"Payment Mode",hidden:this.flag==1?false:true},{header:"Reference Number",dataIndex:"Reference Number",hidden:this.flag==1?false:true},{header:"Metric No",dataIndex:"Metric No",sortable:true},{header:"Student Name",dataIndex:"Student Name",sortable:false},{header:this.flag?"Amount(RM)":"Amount",dataIndex:"Amount",sortable:false,align:"right",summaryType:"sum",summaryRenderer:function(E){E=E+"";if(E!=null&&E!=""){return"Total: "+Wtf.precisionDecimalValue(E)}else{return"Total: "+E}},renderer:function(E){E=E+"";if(E!=null&&E!=""){return Wtf.precisionDecimalValue(E)}else{return E}}},{header:"Feename",dataIndex:"feename",hidden:this.flag==1?false:true}]);this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.summary=new Wtf.grid.GroupSummary({});this.programStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["programid","programname"])});this.programStore.on("load",function(E){var G=new Wtf.data.Record.create(["programid","programname"]);var F=new G({programid:"",programname:"All"});E.addSorted(F);this.programCmb.setValue("")},this);this.programStore.load({params:{type:20}});this.programCmb=new Wtf.form.ComboBox({triggerAction:"all",editable:false,width:140,mode:"local",valueField:"programid",displayField:"programname",store:this.programStore,emptyText:"Select a program..."});this.typeStore=new Wtf.data.JsonStore({url:"CountryList.jsp",root:"data",fields:["id","name"]});this.accStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["accid","accountname"])});if(this.flag==2){this.accStore.load({params:{type:69,typeid:9}})}else{this.typeStore.load({params:{mode:this.flag==0?"feetype":"paymode"}})}this.typeCombo=new Wtf.form.ComboBox({triggerAction:"all",editable:false,width:140,mode:"local",valueField:this.flag==2?"accid":"id",displayField:this.flag==2?"accountname":"name",store:this.flag==2?this.accStore:this.typeStore,emptyText:this.flag==0?"Select a fee type...":this.flag==1?"Select paymode...":"Select an account..."});this.fromDate=new Wtf.form.DateField({fieldLabel:"From",format:Wtf.getDateFormat()});this.toDate=new Wtf.form.DateField({fieldLabel:"To",format:Wtf.getDateFormat()});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.ds.baseParams={mode:5,progid:this.programCmb.getValue(),type:this.typeCombo.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),flag:this.flag,sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.setValue("");this.typeCombo.setValue("");this.fromDate.setValue("");this.toDate.setValue("");this.ds.baseParams={mode:5,progid:"",type:"",fromdate:"",todate:"",flag:this.flag,sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});var A=this.flag==0?"Fee Type: ":this.flag==1?"Paymode: ":"Account: ";Wtf.accountReport.superclass.constructor.call(this,{layout:"fit",border:false,items:[this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,cm:this.cm,view:this.groupingView,plugins:this.summary,loadMask:{msg:"Loading..."},tbar:["Program: ",this.programCmb,"-",A,this.typeCombo,"-","Applied:","From ",this.fromDate,"   To ",this.toDate,"-",this.submitBttn,this.clearBttn],bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.ds,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){if(this.ds.getCount()>0){var E=Wtf.urlEncode({mode:5,progid:this.programCmb.getValue(),type:this.typeCombo.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),flag:this.flag,sortindex:this.sortindex,dir:this.dir,exportType:"pdf",fileName:this.flag==0?"Account_Receivable_Report.pdf":this.flag==1?"Payment_Mode_Report.pdf":"Income_Report.pdf"});setDldUrl("ReportsServlet.jsp?"+E)}}}),"-",this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var E=Wtf.urlEncode({progid:this.programCmb.getValue(),paytype:this.typeCombo.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),flag:this.flag,sortindex:this.sortindex,dir:this.dir,exportType:"csv",type:"reports",dtype:"attachment",report:"getAccountReport"});setDldUrl("fileDownload.jsp?"+E)}}})]})})]});this.grid.on("headerclick",function(F,E,G){if(F.colModel.config[E].sortable==false){return }var H=Wtf.get(G.getTarget().id);if(!this.prevTarget||this.prevTarget!==H){if(this.prevTarget){if(this.prevTarget.hasClass("sort-asc")){this.prevTarget.removeClass("sort-asc")}else{if(this.prevTarget.hasClass("sort-desc")){this.prevTarget.removeClass("sort-desc")}}}this.prevTarget=H}if(H.hasClass("sort-asc")){H.addClass("sort-desc");H.removeClass("sort-asc");this.dir=1}else{H.addClass("sort-asc");H.addClass("x-grid3-hd-inner");if(H.hasClass("sort-desc")){H.removeClass("sort-desc")}this.dir=0}this.sortindex=F.colModel.config[E].dataIndex;this.ds.baseParams={mode:5,progid:this.programCmb.getValue(),type:this.typeCombo.getValue(),fromdate:this.fromDate.getRawValue(),todate:this.toDate.getRawValue(),flag:this.flag,sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})},this);this.grid.on("cellclick",this.clickHandle,this)};Wtf.extend(Wtf.accountReport,Wtf.Panel,{onRender:function(A){Wtf.accountReport.superclass.onRender.call(this,A);this.ds.load({params:{start:0,limit:15}})},clickHandle:function(B,E,A,C){if(C.target.className=="printInvoice"){var D=B.getStore().getAt(E);printInvoice(D.get("Invoice No"),1)}if(C.target.className=="printPayment"){var D=B.getStore().getAt(E);printInvoice(D.get("Payment No"),3)}}});Wtf.GraduationReport=function(A){Wtf.apply(this,A);this.sortindex="";this.dir=0;var B=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["Student Name","Student ID","Contact No","Nationality","Country","Intake Session","Graduation Date",this.flag?"Degree":"Final Result"]);this.ds=new Wtf.data.Store({url:"jspfiles/reportNew.jsp",baseParams:{mode:6,progid:"",year:"",acad:"",flag:this.flag,sortindex:this.sortindex,dir:this.dir},reader:B});this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Student Name",dataIndex:"Student Name"},{header:"Student ID",dataIndex:"Student ID"},{header:"Contact No",dataIndex:"Contact No",sortable:false},{header:"Nationality",dataIndex:"Nationality"},{header:"Country",dataIndex:"Country",sortable:false},{header:"Intake Session",dataIndex:"Intake Session",sortable:false},{header:"Graduation Date",dataIndex:"Graduation Date"},{header:this.flag?"Degree":"Final Result",dataIndex:this.flag?"Degree":"Final Result",sortable:false}]);if(!this.flag){this.cm.config[7].sortable=false}this.programStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["programid","programname"])});this.programStore.on("load",function(C){var E=new Wtf.data.Record.create(["programid","programname"]);var D=new E({programid:"",programname:"All"});C.addSorted(D);this.programCmb.setValue("")},this);this.programStore.load({params:{type:20}});this.programCmb=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"programid",displayField:"programname",store:this.programStore,emptyText:"Select a program..."});this.yearStore=new Wtf.data.SimpleStore({data:[],fields:["name","id"]});if(this.flag){this.fillYearStore("2006",new Date().getFullYear())}this.gradYear=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",store:this.yearStore,valueField:"id",displayField:"name",emptyText:"Select Graduation Year..."});this.acadStore=new Wtf.data.JsonStore({url:"CountryList.jsp",root:"data",fields:["id","name"]});this.acadStore.load({params:{mode:"intake"}});this.acadCombo=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"id",displayField:"name",store:this.acadStore,emptyText:"Select an Academic Session..."});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.ds.baseParams={mode:6,progid:this.programCmb.getValue(),year:this.flag?this.gradYear.getValue():"",acad:this.acadCombo.getValue(),flag:this.flag,sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.setValue("");this.gradYear.setValue("");this.acadCombo.setValue("");this.ds.baseParams={mode:6,progid:"",year:"",acad:"",flag:this.flag,sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});this.tbar=this.flag?["Program: ",this.programCmb,"-","Year: ",this.gradYear,"-","Academic Session: ",this.acadCombo,"-",this.submitBttn,this.clearBttn]:["Program: ",this.programCmb,"-","Academic Session: ","-",this.acadCombo,this.submitBttn,this.clearBttn];Wtf.GraduationReport.superclass.constructor.call(this,{layout:"fit",border:false,items:[this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,cm:this.cm,viewConfig:{autoFill:true},loadMask:{msg:"Loading..."},bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.ds,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){if(this.ds.getCount()>0){var C=Wtf.urlEncode({mode:6,progid:this.programCmb.getValue(),year:this.flag?this.gradYear.getValue():"",acad:this.acadCombo.getValue(),flag:this.flag,sortindex:this.sortindex,dir:this.dir,fileName:this.flag?"INCEIF_Graduates.pdf":"Graduating_Students.pdf"});setDldUrl("ReportsServlet.jsp?"+C)}}}),"-",this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var C=Wtf.urlEncode({progid:this.programCmb.getValue(),year:this.flag?this.gradYear.getValue():"",acad:this.acadCombo.getValue(),flag:this.flag,sortindex:this.sortindex,dir:this.dir,type:"reports",dtype:"attachment",report:"getGraduateReport"});setDldUrl("fileDownload.jsp?"+C)}}})]})})]});this.grid.on("headerclick",function(D,C,E){if(D.colModel.config[C].sortable==false){return }var F=Wtf.get(E.getTarget().id);if(!this.prevTarget||this.prevTarget!==F){if(this.prevTarget){if(this.prevTarget.hasClass("sort-asc")){this.prevTarget.removeClass("sort-asc")}else{if(this.prevTarget.hasClass("sort-desc")){this.prevTarget.removeClass("sort-desc")}}}this.prevTarget=F}if(F.hasClass("sort-asc")){F.addClass("sort-desc");F.removeClass("sort-asc");this.dir=1}else{F.addClass("sort-asc");F.addClass("x-grid3-hd-inner");if(F.hasClass("sort-desc")){F.removeClass("sort-desc")}this.dir=0}this.sortindex=D.colModel.config[C].dataIndex;this.ds.baseParams={mode:6,progid:this.programCmb.getValue(),year:this.flag?this.gradYear.getValue():"",acad:this.acadCombo.getValue(),flag:this.flag,sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})},this)};Wtf.extend(Wtf.GraduationReport,Wtf.Panel,{onRender:function(A){Wtf.GraduationReport.superclass.onRender.call(this,A);this.ds.load({params:{start:0,limit:15}})},fillYearStore:function(D,A){this.yearStore.removeAll();var C=Wtf.data.Record.create([{name:"id"},{name:"name"}]);for(var B=A;B>=D;B--){this.yearStore.add(new C({id:B,name:B}))}}});Wtf.data.DynamicJsonReader2=function(A){Wtf.data.DynamicJsonReader2.superclass.constructor.call(this,A,[])};Wtf.extend(Wtf.data.DynamicJsonReader2,Wtf.data.JsonReader,{getRecordType:function(D){var C=0,A=[];for(var B in D[0]){A[C++]=B}this.recordType=Wtf.data.Record.create(A);return this.recordType},readRecords:function(o){this.jsonData=o;var s=this.meta;var sid=s.id;var totalRecords=0;if(s.totalProperty){var v=parseInt(eval("o."+s.totalProperty),10);if(!isNaN(v)){totalRecords=v}}var root=s.root?eval("o."+s.root):o;var recordType=this.getRecordType(root);var fields=recordType.prototype.fields;var records=[];for(var i=0;i<root.length;i++){var n=root[i];var values={};var id=(n[sid]!==undefined&&n[sid]!==""?n[sid]:null);for(var j=0,jlen=fields.length;j<jlen;j++){var f=fields.items[j];var map=f.mapping||f.name;var v=n[map]!==undefined?n[map]:f.defaultValue;v=f.convert(v);values[f.name]=v}var record=new recordType(values,id);record.json=n;records[records.length]=record}return{records:records,totalRecords:totalRecords||records.length}}});Wtf.grid.DynamicColumnModel111=function(C){this.cols1=[];var B=[];var G=C.recordType;var A=G.prototype.fields;String.prototype.startsWith=function(H){return(this.match("^"+H)==H)};for(var D=0;D<A.keys.length;D++){var F=A.keys[D];var E=G.getField(F);if(F.match("Registered Student")){var E=G.getField(F);this.appendFirst1={header:E.name,dataIndex:E.name,width:300}}else{if(F.match("Student ID")){var E=G.getField(F);this.appendFirst2={header:E.name,dataIndex:E.name,width:300}}else{if(F.match("IC/Passport No")){var E=G.getField(F);this.appendFirst3={header:E.name,dataIndex:E.name,sortable:false,width:300}}else{if(F.match("Contact No")){var E=G.getField(F);this.appendFirst4={header:E.name,dataIndex:E.name,sortable:false,width:300}}else{if(F.match("Nationality")){var E=G.getField(F);this.appendFirst5={header:E.name,dataIndex:E.name,width:300}}else{if(F.startsWith("Reg ")){var E=G.getField(F);B[B.length]={header:E.name,dataIndex:E.name,sortable:false,width:300}}else{this.cols1.push({header:E.name,dataIndex:E.name,sortable:false})}}}}}}}if(this.appendFirst5){this.cols1.unshift(this.appendFirst5)}if(this.appendFirst4){this.cols1.unshift(this.appendFirst4)}if(this.appendFirst3){this.cols1.unshift(this.appendFirst3)}if(this.appendFirst2){this.cols1.unshift(this.appendFirst2)}if(this.appendFirst1){this.cols1.unshift(this.appendFirst1)}this.cols1.unshift(new Wtf.grid.RowNumberer());for(var D=B.length-1;D>=0;D--){this.cols1.push(B[D])}Wtf.grid.DynamicColumnModel111.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModel111,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1}});Wtf.RegDetails=function(A){Wtf.apply(this,A);this.sortindex="";this.dir=0;this.acadStore=new Wtf.data.JsonStore({url:"CountryList.jsp",root:"data",fields:["id","name"]});this.acadCombo=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"id",displayField:"name",store:this.acadStore,emptyText:"Select an Academic Session..."});this.partStore=new Wtf.data.Store({url:"jspfiles/reportNew.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["id","name"])});this.partStore.on("load",function(B,C){this.partCombo.setValue(C[0].data.id);if(this.rendered){this.loadMask.show();this.loadGrid()}},this);this.acadStore.on("load",function(C){var B=new Wtf.data.Record.create(["id","name"]);var D=new B({id:"",name:"All"});C.addSorted(D);this.acadCombo.setValue("");this.partStore.load({params:{mode:7}})},this);this.acadStore.load({params:{mode:"intake"}});this.partCombo=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"id",displayField:"name",store:this.partStore,emptyText:"Select an Academic Part..."});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){if(this.grid!=undefined){this.remove(this.grid)}this.loadMask.show();this.loadGrid()}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.partCombo.setValue("");this.acadCombo.setValue("");this.ds.baseParams={mode:1,part:"",acad:"",sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});Wtf.RegDetails.superclass.constructor.call(this,{border:false,layout:"fit",tbar:["Academic Session: ",this.acadCombo,"-","Part: ",this.partCombo,"-",this.submitBttn]})};Wtf.extend(Wtf.RegDetails,Wtf.Panel,{onRender:function(A){Wtf.RegDetails.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."})},loadGrid:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:1,part:this.partCombo.getValue(),acad:this.acadCombo.getValue(),sortindex:this.sortindex,dir:this.dir}},this,function(request){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader2({root:"data",totalProperty:"count"});jreader.readRecords(resObj);this.ds=new Wtf.data.Store({reader:jreader,url:"jspfiles/reportNew.jsp",baseParams:{mode:1,part:this.partCombo.getValue(),acad:this.acadCombo.getValue(),sortindex:this.sortindex,dir:this.dir}});this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel111(this.ds);this.grid=new Wtf.grid.GridPanel({loadMask:this.loadMask,border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.ds,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:["-",this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){if(this.ds.getCount()>0){var str=Wtf.urlEncode({mode:1,part:this.partCombo.getValue(),acad:this.acadCombo.getValue(),sortindex:this.sortindex,dir:this.dir,limit:this.pP.combo.value,fileName:"Module_Registration_Details.pdf"});setDldUrl("ReportsServlet.jsp?"+str)}}}),this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var str=Wtf.urlEncode({part:this.partCombo.getValue(),acad:this.acadCombo.getValue(),sortindex:this.sortindex,dir:this.dir,type:"reports",dtype:"attachment",report:"getRegistrationReport"});setDldUrl("fileDownload.jsp?"+str)}}})]}),viewConfig:{autoFill:true}});this.add(this.grid);this.ds.baseParams={mode:1,part:this.partCombo.getValue(),acad:this.acadCombo.getValue(),sortindex:this.sortindex,dir:this.dir};this.ds.loadData(resObj)}this.doLayout();this.loadMask.hide()}}},function(){this.loadMask.hide()})}});Wtf.CourseRegReport=function(A){Wtf.apply(this,A);this.sortindex="";this.dir=0;var B=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["Registered Student","Student ID","IC/Passport No","Contact No","Nationality","code","course"]);this.ds=new Wtf.data.GroupingStore({url:"jspfiles/reportNew.jsp",baseParams:{mode:2,progid:"",acad:"",course:"",sortindex:this.sortindex,dir:this.dir},reader:B,sortInfo:{field:"code",direction:"ASC"},groupField:"code"});this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Registered Student",dataIndex:"Registered Student"},{header:"Student ID",dataIndex:"Student ID"},{header:"IC/Passport No",dataIndex:"IC/Passport No",sortable:false},{header:"Contact No",dataIndex:"Contact No",sortable:false},{header:"Nationality",dataIndex:"Nationality"},{dataIndex:"code",groupable:true},{header:"",dataIndex:"course",sortable:false,align:"center",summaryType:"sum",summaryRenderer:function(C){return"Total: "+C}}]);this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.summary=new Wtf.grid.GroupSummary({});this.programStore=new Wtf.data.Store({url:"jspfiles/reportNew.jsp",baseParams:{mode:9,type:1},reader:new Wtf.data.KwlJsonReader({root:"data"},["programid","programname"])});this.programCmb=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"programid",displayField:"programname",store:this.programStore,emptyText:"Select a program..."});this.programCmb.on("select",function(C){this.courseStore.removeAll();this.courseStore.load({params:{progid:C.getValue(),acad:this.acadCombo.getValue()}})},this);this.acadStore=new Wtf.data.JsonStore({url:"CountryList.jsp",root:"data",fields:["id","name"]});this.acadCombo=new Wtf.form.ComboBox({triggerAction:"all",editable:false,mode:"local",valueField:"id",displayField:"name",store:this.acadStore,emptyText:"Select an Academic Session..."});this.acadCombo.on("select",function(C){this.courseStore.removeAll();this.courseStore.load({params:{progid:this.programCmb.getValue(),acad:C.getValue()}})},this);this.courseStore=new Wtf.data.Store({url:"jspfiles/reportNew.jsp",baseParams:{mode:8},reader:new Wtf.data.KwlJsonReader({root:"data"},["id","name"])});this.courseStore.on("load",this.courseLoad,this);this.acadStore.on("load",function(D){var C=new Wtf.data.Record.create(["id","name"]);var E=new C({id:"",name:"All"});D.addSorted(E);this.acadCombo.setValue("");this.courseStore.load()},this);this.programStore.on("load",function(C){var E=new Wtf.data.Record.create(["programid","programname"]);var D=new E({programid:"",programname:"All"});C.addSorted(D);this.programCmb.setValue("");this.acadStore.load({params:{mode:"intake"}})},this);this.programStore.load();this.courseCombo=new Wtf.form.ComboBox({triggerAction:"all",editable:false,width:220,mode:"local",valueField:"id",displayField:"name",store:this.courseStore,emptyText:"Select a Course..."});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.cm.setColumnHeader(7,this.courseStore.getAt(this.courseStore.find("id",this.courseCombo.getValue())).data.name);this.ds.baseParams={mode:2,progid:this.programCmb.getValue(),acad:this.acadCombo.getValue(),course:this.courseCombo.getValue(),sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});this.tbar=["Program: ",this.programCmb,"-","Academic Session: ",this.acadCombo,"-","Course: ",this.courseCombo,"-",this.submitBttn];Wtf.CourseRegReport.superclass.constructor.call(this,{layout:"fit",border:false,items:[this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,cm:this.cm,view:this.groupingView,plugins:this.summary,loadMask:{msg:"Loading..."},bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.ds,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){if(this.ds.getCount()>0){var C=Wtf.urlEncode({mode:2,progid:this.programCmb.getValue(),acad:this.acadCombo.getValue(),course:this.courseCombo.getValue(),sortindex:this.sortindex,dir:this.dir,fileName:"Course_Registration_Details.pdf"});setDldUrl("ReportsServlet.jsp?"+C)}}}),"-",this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var C=Wtf.urlEncode({progid:this.programCmb.getValue(),acad:this.acadCombo.getValue(),course:this.courseCombo.getValue(),sortindex:this.sortindex,dir:this.dir,type:"reports",dtype:"attachment",report:"getCourseRegReport"});setDldUrl("fileDownload.jsp?"+C)}}})]})})]});this.grid.on("headerclick",function(D,C,E){if(D.colModel.config[C].sortable==false){return }var F=Wtf.get(E.getTarget().id);if(!this.prevTarget||this.prevTarget!==F){if(this.prevTarget){if(this.prevTarget.hasClass("sort-asc")){this.prevTarget.removeClass("sort-asc")}else{if(this.prevTarget.hasClass("sort-desc")){this.prevTarget.removeClass("sort-desc")}}}this.prevTarget=F}if(F.hasClass("sort-asc")){F.addClass("sort-desc");F.removeClass("sort-asc");this.dir=1}else{F.addClass("sort-asc");F.addClass("x-grid3-hd-inner");if(F.hasClass("sort-desc")){F.removeClass("sort-desc")}this.dir=0}this.sortindex=D.colModel.config[C].dataIndex;this.ds.baseParams={mode:2,progid:this.programCmb.getValue(),acad:this.acadCombo.getValue(),course:this.courseCombo.getValue(),sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})},this)};Wtf.extend(Wtf.CourseRegReport,Wtf.Panel,{courseLoad:function(A,B){this.courseCombo.setValue(B[0].data.id);this.cm.setColumnHeader(7,B[0].data.name);if(this.rendered){this.ds.baseParams={mode:2,progid:this.programCmb.getValue(),acad:this.acadCombo.getValue(),course:this.courseCombo.getValue(),sortindex:this.sortindex,dir:this.dir};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}A.removeListener("load",this.courseLoad,this);A.on("load",function(C,D){this.courseCombo.setValue(D[0].data.id)},this)}});Wtf.Scholarship=function(A){Wtf.apply(this,A);this.scholreader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["name","date","subcode","amount","metricno","type"]);this.ds=new Wtf.data.GroupingStore({url:"jspfiles/report.jsp",baseParams:{type:"scholarship",progid:"",scholarship:"All",fromdate:"",todate:""},reader:this.scholreader,sortInfo:{field:"type",direction:"ASC"},groupField:"type"});this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Type",dataIndex:"type"},{header:"Date",dataIndex:"date",sortable:true},{header:"Metric No",dataIndex:"metricno",sortable:true},{header:"Student Name",dataIndex:"name",sortable:true},{header:"Code",dataIndex:"subcode",sortable:true},{header:"Amount",dataIndex:"amount",sortable:false,align:"right",summaryType:"sum",summaryRenderer:function(B){B=B+"";if(B!=null&&B!=""){return"Total: "+Wtf.precisionDecimalValue(B)}else{return"Total: "+B}},renderer:function(B){B=B+"";if(B!=null&&B!=""){return Wtf.precisionDecimalValue(B)}else{return B}}}]);this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.summary=new Wtf.grid.GroupSummary({});this.programStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["programid","programname"])});this.programStore.on("load",function(B){var D=new Wtf.data.Record.create(["programid","programname"]);var C=new D({programid:"",programname:"All"});B.addSorted(C);this.programCmb.setValue("")},this);this.programStore.load({params:{type:20}});this.programCmb=new Wtf.form.ComboBox({triggerAction:"all",editable:false,width:140,mode:"local",valueField:"programid",displayField:"programname",store:this.programStore,emptyText:"Select a program..."});this.scholarshipStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["id","code"])});this.scholarshipStore.load({params:{type:102}});this.scholarshipStore.on("load",function(B){var D=new Wtf.data.Record.create(["id","code"]);var C=new D({id:"",code:"All"});B.addSorted(C);this.scholarshipCombo.setValue("All")},this);this.fromdate=new Wtf.form.DateField({fieldLabel:"Start Date",emptyText:"Select start date...",name:"sdate",width:110,format:"Y-m-j"});this.todate=new Wtf.form.DateField({fieldLabel:"To Date",emptyText:"Select end date...",width:110,name:"edate",format:"Y-m-j"});this.scholarshipCombo=new Wtf.form.ComboBox({triggerAction:"all",editable:false,width:140,mode:"local",valueField:"code",displayField:"code",store:this.scholarshipStore,emptyText:"Select a Scholarship..."});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.ds.baseParams={type:"scholarship",progid:this.programCmb.getValue(),scholarship:this.scholarshipCombo.getValue(),fromdate:this.fromdate.getRawValue(),todate:this.todate.getRawValue()};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.setValue("");this.scholarshipCombo.setValue("");this.fromdate.setValue("");this.todate.setValue("");this.ds.baseParams={type:"scholarship",progid:"",scholarship:"All",fromdate:"",todate:""};this.ds.load({params:{start:0,limit:this.pP.combo.value}})}});Wtf.Scholarship.superclass.constructor.call(this,{layout:"fit",border:false,items:[this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,cm:this.cm,view:this.groupingView,plugins:this.summary,loadMask:{msg:"Loading..."},tbar:["Program: ",this.programCmb,"-","Scholarships: ",this.scholarshipCombo,"-","From Date: ",this.fromdate,"-","To Date: ",this.todate,"-",this.submitBttn,"-",this.clearBttn],bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.ds,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({start:this.pg.cursor,limit:this.pP.combo.value,progid:this.programCmb.getValue(),scholarship:this.scholarshipCombo.getValue(""),fromdate:this.fromdate.getRawValue(),todate:this.todate.getRawValue(),type:"reports",dtype:"attachment",report:"scholarshipReport"});setDldUrl("fileDownload.jsp?"+B)}}})]})})]})};Wtf.extend(Wtf.Scholarship,Wtf.Panel,{onRender:function(A){Wtf.Scholarship.superclass.onRender.call(this,A);this.ds.load({params:{start:0,limit:15}})}});Wtf.crReport=function(A){Wtf.apply(this,A);this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.sessionCmb=new Wtf.form.ComboBox({store:this.sessionStore,editable:false,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",valueField:"sessionid",allowBlank:false});this.sessionCmb.on("select",this.loadProgStore,this);this.progStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","code","id"]),autoLoad:false,url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:1}});this.programCmb=new Wtf.form.ComboBox({store:this.progStore,editable:false,displayField:"name",valueField:"id",mode:"local",triggerAction:"all",emptyText:"Select a program...",fieldLabel:"Program"});this.programCmb.on("select",this.afterProgLoad,this);this.courseno=new Wtf.form.NumberField({width:100,maxLength:64,disabled:true});this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,disabled:true,minWidth:30});this.criBttn.on("click",this.submitBtnHandler,this);this.clearBtn=new Wtf.Button({text:"Clear",tooltip:"Clear Filters",scope:this,disabled:true,minWidth:30,handler:function(){this.sessionCmb.reset();this.programCmb.reset();this.courseno.reset();if(this.reportGrid){Wtf.getCmp(this.id).remove(this.reportGrid)}}});this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,disabled:true,handler:function(){var B=Wtf.urlEncode({sessionid:this.sessionCmb.getValue(),programid:this.programCmb.getValue(),courseCount:this.courseno.getValue(),reptype:"GSReport",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+B)}});Wtf.crReport.superclass.constructor.call(this,{border:false,closable:true,autoScroll:true,bodyStyle:"background:#ffff;font-size:10px;",tbar:["Session* :",this.sessionCmb,"-","Program :",this.programCmb,"-","Number of courses Registered : ",this.courseno,"-",this.criBttn,"-",this.clearBtn,"-",this.csv1],layout:"fit"})};Wtf.extend(Wtf.crReport,Wtf.Panel,{initComponent:function(){Wtf.crReport.superclass.initComponent.call(this)},onRender:function(A){Wtf.crReport.superclass.onRender.call(this,A);this.sessionStore.load()},loadProgStore:function(){this.progStore.load()},afterProgLoad:function(){this.courseno.enable();this.criBttn.enable();this.clearBtn.enable();this.csv1.enable()},submitBtnHandler:function(){if(this.programCmb.getValue()==""||this.sessionCmb.getValue()==""){msgBoxShow(["Warning","Please select session from drop down."],Wtf.MessageBox.WARNING)}else{if(this.courseno.getValue()!=""&&this.courseno.getValue()<1){msgBoxShow(["Warning","Please enter valid no of courses registred "],Wtf.MessageBox.WARNING)}else{Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"GET",params:{mode:48,sessionid:this.sessionCmb.getValue(),programid:this.programCmb.getValue(),courseCount:this.courseno.getValue()}},this,function(A,B){Wtf.getCmp(this.id).remove(this.reportGrid);this.createGrid(A);Wtf.getCmp(this.id).add(this.reportGrid);this.doLayout()},function(B,A){})}}},createGrid:function(response){var obj=eval("("+response.trim()+")");this.temprecord=Wtf.data.Record.create(this.createFields(obj.columnheader));this.jsonReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.temprecord);this.simstore=new Wtf.data.Store({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.jsonReader,remoteSort:true});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),id:this.id+"_reportGrid",ds:this.simstore,border:false,layout:"fit",autoScroll:true,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true,enableRowBody:true,showPreview:true},bbar:new Wtf.PagingToolbar({pageSize:28,store:this.simstore,displayInfo:true,displayMsg:"Displaying Records {0} - {1} of {2}",emptyMsg:"No records to display"})});this.simstore.proxy.data=obj;this.simstore.load({params:{start:0,limit:28}})},DisplayReport:function(){Wtf.getCmp(this.id).remove(this.reportGrid);Wtf.getCmp(this.id).add(this.reportGrid);Wtf.getCmp(this.id).ownerCt.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(E){var G=[];var C=60;var F="left";G[0]=new Wtf.KWLRowNumberer();for(var B=0;B<E.length;B++){var D={};D["header"]=E[B][0];D["dataIndex"]=E[B][0];if(B==0){C=150}else{C=60}D["width"]=C;D["sortable"]=false;if(B>3){F="center"}D["align"]=F;G[G.length]=D}var A=new Wtf.grid.ColumnModel(G);return A}});Wtf.resgisteredGSCourses=function(A){Wtf.apply(this,A);this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.MSsessionComboConfig={store:this.sessionStore,editable:false,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",valueField:"sessionid",allowBlank:false,id:"course"+this.id,readOnly:true};this.sessionCmb=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},this.MSsessionComboConfig));this.progStore=new Wtf.data.SimpleStore({fields:["name","id"],data:[["PhD in Islamic Finance","225a5969-0eb0-42a6-bd2b-f65d9b98be26"],["Masters in Islamic Finance","aea724ca-f690-4d1a-a59c-5c8c34ae4f6c"]]});this.programCmb=new Wtf.form.ComboBox({store:this.progStore,editable:false,displayField:"name",valueField:"id",mode:"local",triggerAction:"all",emptyText:"Select a program..."});this.programCmb.on("select",this.afterProgLoad,this);this.moduleStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","id"]),autoLoad:false,url:"jspfiles/reportNew.jsp",baseParams:{mode:50}});this.MSmoduleComboConfig={store:this.moduleStore,editable:false,disabled:true,displayField:"name",valueField:"id",mode:"local",triggerAction:"all",emptyText:"Select a module...",readOnly:true};this.moduleCmb=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},this.MSmoduleComboConfig));this.moduleCmb.on("select",this.afterModuleLoad,this);this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,disabled:true,minWidth:30});this.criBttn.on("click",this.submitBtnHandler,this);this.clearBtn=new Wtf.Button({text:"Clear",tooltip:"Clear Filters",scope:this,minWidth:30,handler:function(){this.sessionCmb.reset();this.programCmb.reset();this.moduleCmb.reset();if(this.reportGrid){Wtf.getCmp(this.id).remove(this.reportGrid)}}});this.csv1=new Wtf.Toolbar.Button({text:"Export",scope:this,disabled:true,handler:function(){var B=Wtf.urlEncode({sessionid:this.sessionCmb.getValue(),sessionName:this.sessionCmb.lastSelectionText,programid:this.programCmb.getValue(),moduleid:this.moduleCmb.getValue(),modulename:this.moduleCmb.lastSelectionText,reptype:"GSregCourseReport",type:"reports",dtype:"attachment",report:"applicationstatisticscsv"});setDldUrl("fileDownload.jsp?"+B)}});Wtf.resgisteredGSCourses.superclass.constructor.call(this,{border:false,closable:true,autoScroll:true,bodyStyle:"background:#ffff;font-size:10px;",tbar:["Session* :",this.sessionCmb,"-","Program :",this.programCmb,"-","Module : ",this.moduleCmb,"-",this.criBttn,"-",this.clearBtn,"-",this.csv1],layout:"fit"})};Wtf.extend(Wtf.resgisteredGSCourses,Wtf.Panel,{initComponent:function(){Wtf.resgisteredGSCourses.superclass.initComponent.call(this)},onRender:function(A){Wtf.resgisteredGSCourses.superclass.onRender.call(this,A);this.sessionStore.load()},afterProgLoad:function(){if(this.sessionCmb.getValue()==""){msgBoxShow(["Warning","Please select a session."],Wtf.MessageBox.WARNING)}else{this.moduleCmb.enable();this.moduleStore.load({params:{sessionid:this.sessionCmb.getValue(),programid:this.programCmb.getValue()}})}},afterModuleLoad:function(){this.criBttn.enable();this.csv1.enable()},submitBtnHandler:function(){if(this.programCmb.getValue()==""||this.sessionCmb.getValue()==""){msgBoxShow(["Warning","Please select session."],Wtf.MessageBox.WARNING)}else{Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"GET",params:{mode:51,sessionid:this.sessionCmb.getValue(),programid:this.programCmb.getValue(),moduleid:this.moduleCmb.getValue()}},this,function(A,B){Wtf.getCmp(this.id).remove(this.reportGrid);this.createGrid(A);Wtf.getCmp(this.id).add(this.reportGrid);this.doLayout()},function(B,A){})}},createGrid:function(response){var obj=eval("("+response.trim()+")");this.temprecord=Wtf.data.Record.create(this.createFields(obj.columnheader));this.jsonReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.temprecord);this.simstore=new Wtf.data.Store({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.jsonReader,remoteSort:true});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),id:this.id+"_reportGrid",ds:this.simstore,border:false,layout:"fit",autoScroll:true,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true,enableRowBody:true,showPreview:true},bbar:new Wtf.PagingToolbar({pageSize:28,store:this.simstore,displayInfo:true,displayMsg:"Displaying Records {0} - {1} of {2}",emptyMsg:"No records to display"})});this.simstore.proxy.data=obj;this.simstore.load({params:{start:0,limit:28}})},DisplayReport:function(){Wtf.getCmp(this.id).remove(this.reportGrid);Wtf.getCmp(this.id).add(this.reportGrid);Wtf.getCmp(this.id).ownerCt.doLayout()},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(E){var G=[];var C=60;var F="left";G[0]=new Wtf.KWLRowNumberer();for(var B=0;B<E.length;B++){var D={};D["header"]=E[B][0];D["dataIndex"]=E[B][0];if(B==0){C=150}else{C=60}D["width"]=C;D["sortable"]=false;if(B>3){F="center"}D["align"]=F;G[G.length]=D}var A=new Wtf.grid.ColumnModel(G);return A}});Wtf.crHrDt=function(A){Wtf.apply(this,A);this.programStore=new Wtf.data.SimpleStore({fields:["programcode","programname"],data:[["PIF","PhD in Islamic Finance"],["MIF","Masters in Islamic Finance"]]});this.programCmb=new Wtf.form.ComboBox({store:this.programStore,editable:false,displayField:"programname",mode:"local",triggerAction:"all",emptyText:"Select a program...",valueField:"programcode"});this.creditNo=new Wtf.form.NumberField({width:100,maxLength:64,disabled:true});this.subBtn=new Wtf.Button({text:"Submit",tooltip:"Submit",scope:this,handler:this.submitBtn});this.credHrStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["name","credithr","status","userid","username","salutation","nationality"]),url:"jspfiles/reportNew.jsp"});this.credHrStore.on("beforeload",function(){this.credHrStore.baseParams={mode:39,programcode:this.programCmb.getValue(),creditSearch:this.creditNo.getValue()}},this);this.cmodel=new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),{header:"Student Name",dataIndex:"name"},{header:"ID",dataIndex:"username"},{header:"Gender",dataIndex:"salutation",renderer:function(B){if(B==0){return"Male"}else{return"Female"}}},{header:"Nationality",dataIndex:"nationality"},{header:"Status(Credit Hr Left)",dataIndex:"credithr"}]);this.cmodel.defaultSortable=true;this.crGrid=new Wtf.grid.GridPanel({ds:this.credHrStore,cm:this.cmodel,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.programCmb.on("select",this.loadStore,this);Wtf.crHrDt.superclass.constructor.call(this,{layout:"fit",closable:true,border:false,title:"Credit Hr Details",tbar:["Program ",this.programCmb,"-","Enter Credit Hour : ",this.creditNo,"-",this.subBtn],items:[this.crGrid],bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.credHrStore,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.credHrStore.getCount()>0){var B=Wtf.urlEncode({start:0,limit:this.credHrStore.getTotalCount(),programcode:this.programCmb.getValue(),creditSearch:this.creditNo.getValue(),progName:this.programCmb.lastSelectionText,type:"reports",dtype:"attachment",report:"creditHrDetailsReport",mode:35});setDldUrl("ReportsServlet.jsp?"+B)}}})]})})};Wtf.extend(Wtf.crHrDt,Wtf.Panel,{loadStore:function(C,A,B){this.creditNo.enable();if(A.get("programcode")=="MIF"){this.creditNo.maxValue=42}else{this.creditNo.maxValue=64}},submitBtn:function(){if(this.programCmb.getValue()==""){msgBoxShow(["Warning","Please select program from drop down."],Wtf.MessageBox.WARNING)}else{this.credHrStore.load({params:{start:0,limit:this.pP.combo.value}})}}});Wtf.stdResult=function(A){Wtf.apply(this,A);this.programStore=new Wtf.data.SimpleStore({fields:["programcode","programname"],data:[["0","CIFP"],["1","GS"]]});this.programCmb=new Wtf.form.ComboBox({store:this.programStore,editable:false,displayField:"programname",mode:"local",triggerAction:"all",emptyText:"Select a program...",valueField:"programcode"});this.programStore=new Wtf.data.SimpleStore({fields:["programcode","programname"],data:[["0","CIFP"],["1","GS"]]});this.programCmb=new Wtf.form.ComboBox({store:this.programStore,editable:false,displayField:"programname",mode:"local",triggerAction:"all",emptyText:"Select a program...",valueField:"programcode"});this.studentStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["studentid","studentname"]),autoLoad:false,url:"jspfiles/reportNew.jsp",baseParams:{mode:41}});this.studentCmb=new Wtf.form.ComboBox({store:this.studentStore,editable:true,displayField:"studentname",mode:"local",triggerAction:"all",emptyText:"Select a Student...",valueField:"studentid",typeAhead:true});this.subBtn=new Wtf.Button({text:"Submit",tooltip:"Submit",scope:this,handler:this.submitBtn});this.clrbtn=new Wtf.Button({text:"Clear Filter",tooltip:"Submit",scope:this,handler:function(){this.studentCmb.reset();this.programCmb.reset();if(this.crGrid){Wtf.getCmp("resultGr"+this.id).remove(this.crGrid)}}});this.moduleReader=new Wtf.data.JsonReader({root:"data"},["modulename","grades","cgpaTotal","creditTotal","credithrs","cgpa","sessionname","gradepoint"]);this.paperStore=new Wtf.data.GroupingStore({url:"jspfiles/reportNew.jsp",groupField:"sessionname",sortInfo:{field:"modulename",direction:"ASC"},reader:this.moduleReader});this.paperStore.on("beforeload",function(){this.paperStore.baseParams={mode:42,progtype:this.programCmb.getValue(),studentid:this.studentCmb.getValue()}},this);this.paperStore.on("load",this.loadDataStore,this);this.programCmb.on("select",this.loadStore,this);this.print=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.paperStore.getCount()){var B=Wtf.urlEncode({programid:this.programCmb.getValue(),programname:this.programCmb.lastSelectionText,studentid:this.studentCmb.getValue(),studentname:this.studentCmb.lastSelectionText,type:"reports",dtype:"attachment",report:this.reporttype,title:"Result By Student",reportFlag:true,mode:61});setDldUrl("ReportsServlet.jsp?"+B)}}});Wtf.stdResult.superclass.constructor.call(this,{layout:"border",closable:true,border:false,title:"Result By Student",tbar:["Program ",this.programCmb,"-","Select Student","-",this.studentCmb,"-",this.subBtn,"-",this.clrbtn],bbar:[this.print],items:[this.centerP=new Wtf.Panel({id:"resultGr"+this.id,region:"center",bodyStyle:"background-color:#ffffff;",border:false,layout:"fit"}),this.southPanel=new Wtf.Panel({region:"south",minHeight:40,bodyStyle:"background-color:#ffffff;",height:40,frame:false,border:false})]})};Wtf.extend(Wtf.stdResult,Wtf.Panel,{loadStore:function(C,A,B){this.studentCmb.reset();this.studentStore.load({params:{progtype:this.programCmb.getValue()}})},loadDataStore:function(A,B,C){if(this.programCmb.getValue()=="1"&&A.getCount()>0){this.tpl=new Wtf.XTemplate('<div style = "font-size:14px;color: #083772;height:100%;overflow:auto;margin: 10px;"><table style ="padding:0px 8px;font-size:11px"><tr><td align = "left" width="100"><div><b>CGPA : </b>{cgpa}</div></td></tr></table></div>');this.tplObj={cgpa:B[B.length-1].get("cgpaTotal"),credit:B[B.length-1].get("creditTotal")};this.tpl.overwrite(this.southPanel.el.dom.firstChild.firstChild,this.tplObj)}else{this.southPanel.el.dom.firstChild.firstChild.innerHTML=""}},submitBtn:function(){if(this.programCmb.getValue()==""){msgBoxShow(["Warning","Please select program from the  drop down."],Wtf.MessageBox.WARNING)}else{if(this.studentCmb.getValue()==""){msgBoxShow(["Warning","Please select student from the drop down."],Wtf.MessageBox.WARNING)}else{Wtf.getCmp("resultGr"+this.id).remove(this.crGrid);Wtf.grid.GroupSummary.Calculations["cgpa"]=function(B,A,D,C){if(A.data["gradepoint"]===-1){return B+0}else{return B+A.data["credithrs"]*A.data["gradepoint"]}};if(this.programCmb.getValue()=="1"){this.cmodel=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Session Name",dataIndex:"sessionname"},{header:"Paper/Course",dataIndex:"modulename"},{header:"Grades",dataIndex:"gradepoint",groupable:false,summaryType:"cgpa",align:"center",summaryRenderer:function(A,C,B){if(B.data["credithrs"]==0){return"GPA: "+0}else{A=(((Math.round(A*100))/100)/B.data["credithrs"]).toFixed(4);return"GPA: "+(Math.round(A*100)/100).toFixed(2)}},renderer:function(C,B,F,A,D,E){return F.get("grades")},width:100},{header:"Credit Hours",dataIndex:"credithrs",summaryType:"sum",hidden:true,groupable:false,align:"center",summaryRenderer:function(A,C,B){return"Credit Hours: "+A},width:75}])}else{this.cmodel=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Session Name",dataIndex:"sessionname"},{header:"Paper/Course",dataIndex:"modulename"},{header:"Grades",align:"center",dataIndex:"grades"}])}this.cmodel.defaultSortable=true;this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableNoGroups:false,hideGroupedColumn:true});this.summary=new Wtf.grid.GroupSummary({});this.crGrid=new Wtf.grid.GridPanel({ds:this.paperStore,cm:this.cmodel,border:false,loadMask:{msg:"Loading..."},plugins:this.summary,enableColumnHide:false,enableColumnMove:false,enableHdMenu:false,view:this.groupingView});Wtf.getCmp("resultGr"+this.id).add(this.crGrid);Wtf.getCmp("resultGr"+this.id).doLayout();this.paperStore.load()}}}});Wtf.ResAEERC=function(A){Wtf.apply(this,A);this.code="PIF";this.programStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","code","id"]),autoLoad:false,url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:1}});this.programCmb=new Wtf.form.ComboBox({id:"prog"+this.id,store:this.programStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a program...",fieldLabel:"Program",name:"id",valueField:"id"});this.programCmb.on("select",function(D,B,C){this.code=B.get("code");if(this.code=="CIFP"){this.courseCmb.enable()}else{this.courseCmb.reset();this.courseCmb.disable()}},this);this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"},{name:"code",type:"string"},{name:"startdate",dateFormat:"Y-m-d",type:"date"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.sessionCmb=new Wtf.form.ComboBox({store:this.sessionStore,editable:false,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",valueField:"sessionid",allowBlank:false,listeners:{scope:this,select:function(E,C,D){var B=C.get("startdate").format("Y-m-d");if(B<"2010-01-11"){this.sectionFlag=false}else{this.sectionFlag=true}}}});this.courseStore=new Wtf.data.SimpleStore({fields:["code","course"],data:[["CP001","CIFP Part I"],["CP002","CIFP Part II"]]});this.courseCmb=new Wtf.form.ComboBox({store:this.courseStore,editable:false,displayField:"course",mode:"local",width:150,disabled:true,triggerAction:"all",emptyText:"Select a course...",valueField:"code",allowBlank:false});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){if(this.sessionCmb.getValue()==""){msgBoxShow(["Warning","Please select a session."]);return }if(this.programCmb.getValue()==""){msgBoxShow(["Warning","Please select a program."]);return }if(this.code=="CIFP"&&this.courseCmb.getValue()==""){msgBoxShow(["Warning","Please select a course."]);return }this.loadMask.show();if(this.ds!=undefined){this.ds.removeAll()}if(this.ds1!=undefined){this.ds1.removeAll()}this.remove(this.grid);if(this.code=="CIFP"){this.loadGridCF()}else{this.loadGridGs()}}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.reset();this.sessionCmb.reset();this.courseCmb.reset();this.courseCmb.disable();this.remove(this.grid)}});this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){var B=Wtf.urlEncode({mode:this.mode,sectionFlag:this.sectionFlag,moduleid:this.modId,progid:this.programCmb.getValue(),acad:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),fileName:"Student_Result_Summary_Report.pdf"});setDldUrl("ReportsServlet.jsp?"+B)}});Wtf.ResAEERC.superclass.constructor.call(this,{border:false,closable:true,layout:"fit",bodyStyle:"background-color:#FFFFFF",tbar:[" Session ",this.sessionCmb,"-","Program ",this.programCmb,"-","Course",this.courseCmb,"-",this.submitBttn,"-",this.clearBttn],bbar:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,disabled:false,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExport},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]})};Wtf.extend(Wtf.ResAEERC,Wtf.Panel,{onRender:function(A){Wtf.ResAEERC.superclass.onRender.call(this,A);this.programStore.load();this.sessionStore.load();this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."})},handleExport:function(){if(this.courseCmb.getValue()==""){if(this.ds.getCount()>0){var A=Wtf.urlEncode({moduleid:this.modId,progid:this.programCmb.getValue(),sessionid:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),progname:this.programCmb.lastSelectionText,acadname:this.sessionCmb.lastSelectionText,partname:this.courseCmb.lastSelectionText,type:"reports",dtype:"attachment",report:"cifpphdmaster",sectionFlag:this.sectionFlag});setDldUrl("fileDownload.jsp?"+A)}}else{if(this.courseCmb.getValue()!=""){if(this.part1Store.getCount()>0){var A=Wtf.urlEncode({moduleid:this.modId,sectionFlag:this.sectionFlag,progid:this.programCmb.getValue(),sessionid:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),progname:this.programCmb.lastSelectionText,acadname:this.sessionCmb.lastSelectionText,partname:this.courseCmb.lastSelectionText,type:"reports",dtype:"attachment",report:"cifpphdmaster"});setDldUrl("fileDownload.jsp?"+A)}}}},handleExportAsPdf:function(){if(this.courseCmb.getValue()==""){if(this.ds.getCount()>0){var A=Wtf.urlEncode({moduleid:this.modId,progid:this.programCmb.getValue(),sessionid:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),progname:this.programCmb.lastSelectionText,acadname:this.sessionCmb.lastSelectionText,partname:this.courseCmb.lastSelectionText,type:"reports",dtype:"attachment",report:"cifpphdmaster",mode:72,sectionFlag:this.sectionFlag});setDldUrl("ReportsServlet.jsp?"+A)}}else{if(this.courseCmb.getValue()!=""){if(this.part1Store.getCount()>0){var A=Wtf.urlEncode({moduleid:this.modId,sectionFlag:this.sectionFlag,progid:this.programCmb.getValue(),sessionid:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),progname:this.programCmb.lastSelectionText,acadname:this.sessionCmb.lastSelectionText,partname:this.courseCmb.lastSelectionText,type:"reports",dtype:"attachment",report:"cifpphdmaster",mode:72});setDldUrl("ReportsServlet.jsp?"+A)}}}},loadGridGs:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:43,sessionid:this.sessionCmb.getValue(),progid:this.programCmb.getValue(),sectionFlag:this.sectionFlag}},this,function(request){this.loadMask.hide();if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data);this.ds=new Wtf.data.Store({reader:jreader});this._reader=jreader;this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel16(this.ds);this.gridP=new Wtf.grid.GridPanel({border:false,region:"center",store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,viewConfig:{autoFill:true,forceFit:true}});this.ds.loadData(resObj.data);this.add(this.grid=new Wtf.Panel({layout:"border",border:false,items:[this.gridP,{region:"south",height:130,bodyStyle:"background-color:#ffffff",title:"Legend",split:true,html:'<div style="padding:10px"><table><tr><td>TGP</td><td>:<span style="margin-left:5px;">Total Grade Point</span></td></td><tr><td>TCP</td><td>:<span style="margin-left:5px;">Total Credit Hour</span></td></td><tr><td>GPA</td><td>:<span style="margin-left:5px;">Grade Point Average</span></td></td><tr><td>CGPA</td><td>:<span style="margin-left:5px;">Cumulative Grade Point Average</span></td></td></table></div>'}]}))}this.doLayout()}}},function(resp,req){this.loadMask.hide()})},loadGridCF:function(){this.part1Store=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["paper","student","cCount","per","gradeAtotal","gradeAper","gradeBtotal","gradeBper","gradeFtotal","gradeFper","notgrade"]),autoLoad:false,url:"jspfiles/reportNew.jsp",baseParams:{mode:47,sessionid:this.sessionCmb.getValue(),code:this.courseCmb.getValue(),sectionFlag:this.sectionFlag}});this.part1Store.load();this.grid=new Wtf.grid.GridPanel({border:false,store:this.part1Store,stripeRows:true,columns:[{align:"center",header:"No.of Candidates",dataIndex:"paper"},{align:"center",header:"Student",dataIndex:"student"},{align:"center",header:"No. of Candidate",dataIndex:"cCount"},{align:"center",header:"%",dataIndex:"per"},{align:"center",header:"A",dataIndex:"gradeAtotal"},{align:"center",header:"%",dataIndex:"gradeAper"},{align:"center",header:"B",dataIndex:"gradeBtotal"},{align:"center",header:"%",dataIndex:"gradeBper"},{align:"center",header:"<div style='color:red'>F</div>",dataIndex:"gradeFtotal",renderer:function(A){return"<div style='color:red'>"+A+"</div>"}},{align:"center",header:"<div style='color:red'>%</div>",dataIndex:"gradeFper",renderer:function(A){return"<div style='color:red'>"+A+"</div>"}},{align:"center",header:"# of Std",dataIndex:"notgrade"}],viewConfig:{autoFill:true},plugins:[new Wtf.GroupHeaderGrid({rows:[[{align:"center",header:"Module/",colspan:1},{align:"center",header:"",colspan:1},{align:"center",header:"",colspan:1},{align:"center",header:"",colspan:1},{align:"center",header:"Pass",colspan:4},{align:"center",header:"<div style='color:red'>Fail</div>",colspan:2},{align:"center",header:"Not Graded*",colspan:1}]],hierarchicalColMenu:true})]});this.add(this.grid);this.loadMask.hide();this.doLayout()}});Wtf.convoList=function(A){Wtf.apply(this,A);this.moduleRecord=Wtf.data.Record.create([{name:"coursename",type:"string"},{name:"courseid",type:"string"},{name:"code",type:"string"},{name:"programid",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data"},this.moduleRecord);this.moduleStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader});this.typeStore=new Wtf.data.SimpleStore({fields:["id","value"]});this.moduleStore.on("load",this.fillType,this);this.criBttn=new Wtf.Toolbar.Button({text:"Submit",tooltip:"Search according to criteria",id:"btnNew1"+this.id,scope:this,minWidth:30});this.criBttn.on("click",this.onComboValChange,this);this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",tooltip:"Clear selected criteria",id:"btnClear"+this.id,scope:this,minWidth:30});this.clearBttn.on("click",function(){this.courseCombo.reset();this.remove(this.reportGrid)},this);this.courseCombo=new Wtf.form.ComboBox({id:"course"+this.id,store:this.typeStore,readOnly:true,displayField:"value",mode:"local",triggerAction:"all",emptyText:"Select a Type...",fieldLabel:"Type",name:"id",valueField:"id",allowBlank:false});Wtf.ExamResultGrid.superclass.constructor.call(this,{border:false,autoScroll:true,closable:true,tbar:["Select Type :",this.courseCombo,"-",this.criBttn,"-",this.clearBttn]})};Wtf.extend(Wtf.convoList,Wtf.Panel,{initComponent:function(A){Wtf.convoList.superclass.initComponent.call(this)},onRender:function(A){Wtf.convoList.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});this.moduleStore.load({params:{type:"programsessioncourse",programid:"CIFP"}})},fillType:function(A){var B=A.find("code","CP001");var C="";if(B!=-1){C=A.getAt(B).get("courseid")}this.typeStore.add(new Wtf.data.Record({id:C,value:"Associate Member"}));B=A.find("code","CP002");if(B!=-1){C+=","+A.getAt(B).get("courseid")}B=A.find("code","ST0001");if(B!=-1){C+=","+A.getAt(B).get("courseid")}B=A.find("code","SB0001");if(B!=-1){C+=","+A.getAt(B).get("courseid")}this.typeStore.add(new Wtf.data.Record({id:C,value:"Proficient Member"}));B=A.find("code","CP003");if(B!=-1){C+=","+A.getAt(B).get("courseid")}this.typeStore.add(new Wtf.data.Record({id:C,value:"Practicing Member"}));this.typeStore.add(new Wtf.data.Record({id:"-1",value:"Serial No."}))},createGrid:function(response){var obj=eval("("+response.trim()+")");this.classregstore=new Wtf.data.JsonStore({fields:this.createFields(obj.columnheader),data:obj.data});this.temprecord=Wtf.data.Record.create(this.createFields(obj.columnheader));this.jsonReader=new Wtf.data.JsonReader({root:"data",totalProperty:"count"},this.temprecord);this.simstore=new Wtf.data.Store({proxy:new Wtf.data.PagingMemoryProxy([]),reader:this.jsonReader,remoteSort:true});this.reportGrid=new Wtf.grid.GridPanel({cm:this.createColModel(obj.columnheader),ds:this.simstore,border:false,layout:"fit",loadMask:{msg:"Loading..."},viewConfig:{forceFit:(this.courseCombo.getValue()=="-1")?true:false},plugins:[new Wtf.GroupHeaderGrid({rows:[obj.groupheader],hierarchicalColMenu:true})],autoScroll:true,autoWidth:true,bbar:new Wtf.PagingToolbar({pageSize:25,emptyMsg:"No records to display",store:this.simstore,displayInfo:true,displayMsg:"{0} - {1} of {2}"})});this.simstore.proxy.data=obj;this.simstore.load({params:{start:0,limit:25}})},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return A},createColModel:function(D){var E=[];for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];C["dataIndex"]=D[B][0];C["sortable"]=true;E[E.length]=C}E.unshift(new Wtf.KWLRowNumberer());var A=new Wtf.grid.ColumnModel(E);return A},onComboValChange:function(C,B,A){this.loadMask.show();Wtf.Ajax.requestEx({url:"jspfiles/report.jsp",method:"GET",params:{type:"examresultReport",courseid:this.courseCombo.getValue(),viewFlag:(this.courseCombo.getValue()=="-1")?true:false}},this,function(D,E){this.remove(this.reportGrid);this.createGrid(D);this.add(this.reportGrid);this.loadMask.hide();this.doLayout()},function(E,D){this.loadMask.hide()})}});Wtf.progAuditTrail=function(A){Wtf.apply(this,A);this.programStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","code","id"]),autoLoad:false,url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:1}});this.programCmb=new Wtf.form.ComboBox({id:"prog"+this.id,store:this.programStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a program...",fieldLabel:"Program",name:"id",valueField:"id"});this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"},{name:"startdate",dateFormat:"Y-m-d",type:"date"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.sessionCmb=new Wtf.form.ComboBox({store:this.sessionStore,editable:false,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",valueField:"sessionid",allowBlank:false});this.sessionCmb.on("select",this.enableCriteriaForSection,this);this.moduleStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","id"]),autoLoad:false,url:"jspfiles/reportNew.jsp",baseParams:{mode:32}});this.moduleCmb=new Wtf.form.ComboBox({id:"module"+this.id,store:this.moduleStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a module...",fieldLabel:"Module",name:"id",valueField:"id"});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.loadGrid()}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.reset();this.sessionCmb.reset();this.moduleCmb.reset();if(this.auditStore){this.auditStore.removeAll()}}});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.moduleCmb.getValue()!=""&&this.gradeStore.getCount()>0){setDldUrl("fileDownload.jsp?modulerunid="+this.moduleCmb.getValue()+"&type=gradebook&dtype=attachment")}}});this.print=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){var B=0;var C=this.programStore.find("id",this.programCmb.getValue());if(C!=-1&&this.programStore.getAt(C).get("code")!="CIFP"){B=1;this.cm.setHidden(4,false)}else{this.cm.setHidden(4,true)}if(this.auditStore.getCount()){var D=Wtf.urlEncode({sessionid:this.sessionCmb.getValue(),sessionname:this.sessionCmb.lastSelectionText,programid:this.programCmb.getValue(),programname:this.programCmb.lastSelectionText,moduleid:this.moduleCmb.getValue(),modulename:this.moduleCmb.lastSelectionText,type:"reports",sectionFlagValue:this.sectionFlagValue,dtype:"attachment",ptype:B,report:this.reporttype,title:this.title,reportFlag:true,mode:60});setDldUrl("ReportsServlet.jsp?"+D)}}});this.programCmb.on("select",this.handleProgSelect,this);this.sessionCmb.on("select",this.handleSessionSel,this);this.auditStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["studid","grade","name","status","cgpa"]),autoLoad:false,url:"jspfiles/report.jsp"});this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Student Name",dataIndex:"name"},{align:"center",header:"Student Id",dataIndex:"studid"},{align:"center",header:"Grade",dataIndex:"grade"},{align:"center",header:"CGPA",hidden:true,dataIndex:"cgpa"},{align:"center",header:"HOP Validate",dataIndex:"status",renderer:function(B){if(B=="4"||B=="5"||B=="6"||B=="7"||B=="8"){return'<div style="color:green;">Yes</div>'}else{if(B=="-2"){return"-"}else{return'<div style="color:red;">No</div>'}}}},{align:"center",header:"HOD Verify",dataIndex:"status",renderer:function(B){if(B=="2"||B=="4"||B=="5"||B=="6"||B=="8"){return'<div style="color:green;">Yes</div>'}else{if(B=="-2"){return"-"}else{return'<div style="color:red;">No</div>'}}}}]);this.grid=new Wtf.grid.GridPanel({border:false,store:this.auditStore,stripeRows:true,loadMask:{msg:"Loading..."},cm:this.cm,viewConfig:{forceFit:true}});Wtf.progAuditTrail.superclass.constructor.call(this,{layout:"fit",border:false,tbar:[" Session ",this.sessionCmb,"-","Program ",this.programCmb,"-","Module",this.moduleCmb,"-",this.submitBttn,"-",this.clearBttn],bbar:[this.print],items:[this.grid],closable:true});this.on("render",this.handleRender,this)};Wtf.extend(Wtf.progAuditTrail,Wtf.Panel,{handleRender:function(A){this.programStore.load();this.sessionStore.load();this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."})},enableCriteriaForSection:function(B,A){this.sectionFlagValue=false;var C=A.get("startdate").format("Y-m-d");if(C<"2010-01-11"){this.sectionFlagValue=false}else{this.sectionFlagValue=true}},handleSessionSel:function(){this.moduleCmb.reset();this.programCmb.reset()},handleProgSelect:function(B,A){this.moduleCmb.reset();this.moduleStore.removeAll();this.moduleStore.load({params:{progid:A.data.id,sessionid:this.sessionCmb.getValue()}})},loadGrid:function(){this.auditStore.removeAll();var A=0;var B=this.programStore.find("id",this.programCmb.getValue());if(B!=-1&&this.programStore.getAt(B).get("code")!="CIFP"){A=1;this.cm.setHidden(4,false)}else{this.cm.setHidden(4,true)}this.auditStore.load({params:{moduleid:this.moduleCmb.getValue(),ptype:A,type:"aeercreportAudit",programid:this.programCmb.getValue(),sectionFlagValue:this.sectionFlagValue}})},printReport:function(){setDldUrl("ReportsServlet.jsp?mode="+this.mode+"&progid="+this.programCmb.getValue()+"&fromdate="+this.fromDate1.getRawValue()+"&todate="+this.toDate1.getRawValue())}});Wtf.moheStudList=function(A){Wtf.apply(this,A);this.teachStore=new Wtf.data.SimpleStore({fields:["id","value"],data:[["1","Local (Graduated)"],["2","International by Intake"],["3","International by Enrollment"],["4","International (Graduated)"]]});this.teachCmb=new Wtf.form.ComboBox({store:this.teachStore,editable:false,displayField:"value",mode:"local",width:200,triggerAction:"all",emptyText:"Select a Type...",valueField:"id",allowBlank:false});this.sessionCombo=new Wtf.form.ComboBox({triggerAction:"all",store:new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}])),listeners:{scope:this,load:function(B){var D=new Wtf.data.Record.create(["sessionid","sessionname"]);var C=new D({sessionid:"All",sessionname:"All"});B.addSorted(C);this.sessionCombo.setValue("")}}}),mode:"local",listWidth:250,readOnly:true,disabled:true,displayField:"sessionname",valueField:"sessionid",allowBlank:false,emptyText:"Select a session..."});this.teachCmb.on("select",function(){if(this.teachCmb.getValue()=="3"){this.sessionCombo.setValue("All");this.sessionCombo.disable()}else{if(this.teachCmb.getValue()=="2"){this.sessionCombo.reset();this.sessionCombo.enable()}else{this.sessionCombo.reset();this.sessionCombo.disable()}}},this);this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){if(this.teachCmb.getValue()==""){msgBoxShow(["Warning","Please select a value from drop down."]);return }this.remove(this.grid);if(this.teachCmb.getValue()=="1"||this.teachCmb.getValue()=="4"){this.loadGridGrad()}else{if(this.teachCmb.getValue()=="2"||this.teachCmb.getValue()=="3"){this.loadGrid()}}}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.teachCmb.reset();this.remove(this.grid);this.csv.disable();this.sessionCombo.reset();this.sessionCombo.disable()}});Wtf.moheStudList.superclass.constructor.call(this,{border:false,closable:true,layout:"fit",bodyStyle:"background-color:#FFFFFF",tbar:["Select Type",this.teachCmb,"-",this.sessionCombo,"-",this.submitBttn,"-",this.clearBttn]})};Wtf.extend(Wtf.moheStudList,Wtf.Panel,{onRender:function(A){Wtf.moheStudList.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."})},handleExport:function(){if(this.teachDataStore.getCount()>0){var A=Wtf.urlEncode({type:"reports",dtype:"attachment",report:"moheStudIntlist",title:this.title,sessionid:this.sessionCombo.getValue(),ckmode:this.teachCmb.getValue(),start:0,limit:this.teachDataStore.getTotalCount()});setDldUrl("fileDownload.jsp?"+A)}},handleExportAsPdf:function(){if(this.teachDataStore.getCount()>0){var A=Wtf.urlEncode({type:"reports",dtype:"attachment",report:"moheStudIntlist",title:this.title,sessionid:this.sessionCombo.getValue(),sessionname:this.sessionCombo.lastSelectionText,ckmode:this.teachCmb.getValue(),ckmodevalue:this.teachCmb.lastSelectionText,start:0,limit:this.teachDataStore.getTotalCount(),mode:70});setDldUrl("ReportsServlet.jsp?"+A)}},loadGridGrad:function(){var A=false;if(this.teachCmb.getValue()=="4"){A=true}this.teachDataStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["gender","coursecode","distype","studstatus","nationality","race","bhumi","intake","finance","disstatus","studyscheme","state","idtype","progtype","name","coursename","currentsem","passport"]),autoLoad:false,url:"jspfiles/report.jsp"});this.teachDataStore.on("beforeload",function(){this.teachDataStore.baseParams={type:"getLocGradMohe",ckmode:this.teachCmb.getValue()};this.loadMask.show()},this);this.teachDataStore.on("load",function(B){this.loadMask.hide();if(B.getCount()>0){this.csv.enable()}else{this.csv.disable()}},this);this.teachDataStore.on("loadexception",function(){this.loadMask.hide()},this);this.teachDataStore.load({params:{start:0,limit:15}});this.grid=new Wtf.grid.GridPanel({border:false,store:this.teachDataStore,stripeRows:true,columns:[new Wtf.KWLRowNumberer(),{header:"Student Name",dataIndex:"name"},{align:"center",header:"Identification Id",dataIndex:"idtype",hidden:A},{align:"center",header:"Passport No",dataIndex:"passport",hidden:!A},{align:"center",header:"Gender",dataIndex:"gender"},{align:"center",header:"Race",dataIndex:"race",hidden:A},{header:"State",dataIndex:"state",hidden:A},{align:"center",header:"Bumiputra Status",dataIndex:"bhumi",hidden:A},{align:"center",header:"Nationality",dataIndex:"nationality"},{align:"center",header:"Nationality Status (PR etc)",dataIndex:"natstatus"},{align:"center",header:"Current Semester Number",dataIndex:"currentsem"},{align:"center",header:"Intake Month and Year",dataIndex:"intake"},{align:"center",header:"Projected Graduation (month & year)",dataIndex:"projgrad"},{align:"center",header:"Course Name",dataIndex:"coursename"},{align:"center",header:"Program Type",dataIndex:"progtype"},{align:"center",header:"Course Code",dataIndex:"coursecode"},{align:"center",header:"Course Area Code",dataIndex:"coursearea"},{align:"center",header:"Study Scheme",dataIndex:"studyscheme"},{align:"center",header:"Offer Type",dataIndex:"offertype"},{align:"center",header:"Program Level",dataIndex:"proglevel"},{align:"center",header:"Student Intake Requirement",dataIndex:"proglevel",hidden:A},{align:"center",header:"Disability Status",dataIndex:"disstatus"},{align:"center",header:"Type of Disability",dataIndex:"distype"},{align:"center",header:"Financial Sources",dataIndex:"finance"}],bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.teachDataStore,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,disabled:true,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExport},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]})});this.add(this.grid);this.doLayout()},loadGrid:function(){var A=false;if(this.teachCmb.getValue()=="2"){A=true}if(this.sessionCombo.getValue()==""){msgBoxShow(["Warning","Please select a session from drop down."],Wtf.MessageBox.WARNING);return }this.teachDataStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["name","passport","gender","nationality","natstatus","currentsem","intake","projgrad","coursename","progtype","coursecode","coursearea","studyscheme","offertype","proglevel","disstatus","distype","finance","studstatus"]),autoLoad:false,url:"jspfiles/report.jsp"});this.teachDataStore.on("beforeload",function(){this.teachDataStore.baseParams={type:"getStudIntMohe",sessionid:this.sessionCombo.getValue()};this.loadMask.show()},this);this.teachDataStore.on("load",function(B){this.loadMask.hide();if(B.getCount()>0){this.csv.enable()}else{this.csv.disable()}},this);this.teachDataStore.on("loadexception",function(){this.loadMask.hide()},this);this.teachDataStore.load({params:{start:0,limit:15}});this.grid=new Wtf.grid.GridPanel({border:false,store:this.teachDataStore,stripeRows:true,columns:[new Wtf.KWLRowNumberer(),{header:"Student Name",dataIndex:"name"},{align:"center",header:"Passport No",dataIndex:"passport"},{align:"center",header:"Gender",dataIndex:"gender"},{align:"center",header:"Nationality",dataIndex:"nationality"},{align:"center",header:"Nationality Status (PR etc)",dataIndex:"natstatus"},{align:"center",header:"Current Semester Number",dataIndex:"currentsem"},{align:"center",header:"Intake Month and Year",dataIndex:"intake"},{align:"center",header:"Projected Graduation (month & year)",dataIndex:"projgrad"},{align:"center",header:"Course Name",dataIndex:"coursename"},{align:"center",header:"Program Type",dataIndex:"progtype"},{align:"center",header:"Course Code",dataIndex:"coursecode"},{align:"center",header:"Course Area Code",dataIndex:"coursearea"},{align:"center",header:"Study Scheme",dataIndex:"studyscheme"},{align:"center",header:"Offer Type",dataIndex:"offertype"},{align:"center",header:"Program Level",dataIndex:"proglevel"},{align:"center",header:"Disability Status",dataIndex:"disstatus"},{align:"center",header:"Type of Disability",dataIndex:"distype"},{align:"center",header:"Financial Sources",dataIndex:"finance"},{align:"center",header:"Student Status",dataIndex:"studstatus",hidden:A,renderer:function(B){if(B=="1"){return"<div style='color:green'>"+B+"<div>"}else{return"<div style='color:red'>"+B+"<div>"}}}],bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.teachDataStore,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,disabled:true,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExport},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]})});this.add(this.grid);this.doLayout()}});Wtf.moheTeacherList=function(A){Wtf.apply(this,A);this.addEvents({strLoad:true});this.teachStore=new Wtf.data.SimpleStore({fields:["id","value"],data:[["1","Local"],["2","International"]]});this.teachCmb=new Wtf.form.ComboBox({store:this.teachStore,editable:false,displayField:"value",mode:"local",width:150,triggerAction:"all",emptyText:"Select a Type...",valueField:"id",allowBlank:false});this.qualStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=qual",root:"data",fields:["qualid","qualname"]});this.qualStore.on("load",this.getColumn,this);this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){if(this.teachCmb.getValue()==""){msgBoxShow(["Warning","Please select a value from drop down."]);return }this.remove(this.grid);if(this.teachCmb.getValue()=="1"){this.loadGrid()}else{this.loadGridInt()}}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.teachCmb.reset();this.remove(this.grid);this.csv.disable()}});this.on("strLoad",function(B){if(B.getCount()>0){this.csv.enable()}else{this.csv.disable()}},this);Wtf.moheTeacherList.superclass.constructor.call(this,{border:false,closable:true,layout:"fit",bodyStyle:"background-color:#FFFFFF",tbar:["Select Type",this.teachCmb,"-",this.submitBttn,"-",this.clearBttn],bbar:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,disabled:true,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExport},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]})};Wtf.extend(Wtf.moheTeacherList,Wtf.Panel,{onRender:function(A){Wtf.moheTeacherList.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});this.qualStore.load()},handleExport:function(){if(this.grid.getStore().getCount()>1){var A=Wtf.urlEncode({type:"reports",dtype:"attachment",report:"moheTechlist",title:this.title,rpType:this.teachCmb.getValue()});setDldUrl("fileDownload.jsp?"+A)}},handleExportAsPdf:function(){if(this.grid.getStore().getCount()>0){var A=Wtf.urlEncode({rpType:this.teachCmb.getValue(),rpTypeValue:this.teachCmb.lastSelectionText,type:"reports",dtype:"attachment",report:"moheTechlist",title:this.title,mode:71});setDldUrl("ReportsServlet.jsp?"+A)}},loadGrid:function(){this.teachDataStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["degree","MELAYUFullM","MELAYUFullF","BUMIPUTRA SARAWAKFullM","BUMIPUTRA SARAWAKFullF","BUMIPUTRA SABAHFullF","BUMIPUTRA SABAHFullM","CINAFullM","CINAFullF","INDIAFullF","INDIAFullM","LAIN-LAINFullM","LAIN-LAINFullF","MELAYUPartF","MELAYUPartM","BUMIPUTRA SARAWAKPartF","BUMIPUTRA SARAWAKPartM","BUMIPUTRA SABAHPartF","BUMIPUTRA SABAHPartM","CINAPartF","CINAPartM","INDIAPartF","INDIAPartM","LAIN-LAINPartF","LAIN-LAINPartM"]),autoLoad:false,url:"jspfiles/report.jsp",baseParams:{type:"getTeachMohe"}});this.teachDataStore.on("beforeload",function(){this.loadMask.show()},this);this.teachDataStore.on("load",function(A){this.loadMask.hide();this.fireEvent("strLoad",A)},this);this.teachDataStore.on("loadexception",function(){this.loadMask.hide()},this);this.teachDataStore.load();this.grid=new Wtf.grid.GridPanel({border:false,store:this.teachDataStore,loadMask:{msg:"Loading..."},stripeRows:true,columns:[new Wtf.grid.RowNumberer(),{header:"Academic Qualification",dataIndex:"degree",renderer:function(A){if(A=="Total"){return"<div align='center'><b>Total</b></div>"}else{return A}}},{align:"center",header:"L(Full Time)",dataIndex:"MELAYUFullM"},{align:"center",header:"P(Full Time)",dataIndex:"MELAYUFullF"},{align:"center",header:"L(Full Time)",dataIndex:"BUMIPUTRA SARAWAKFullM"},{align:"center",header:"P(Full Time)",dataIndex:"BUMIPUTRA SARAWAKFullF"},{align:"center",header:"L(Full Time)",dataIndex:"BUMIPUTRA SABAHFullM"},{align:"center",header:"P(Full Time)",dataIndex:"BUMIPUTRA SABAHFullF"},{align:"center",header:"L(Full Time)",dataIndex:"CINAFullM"},{align:"center",header:"P(Full Time)",dataIndex:"CINAFullF"},{align:"center",header:"L(Full Time)",dataIndex:"INDIAFullM"},{align:"center",header:"P(Full Time)",dataIndex:"INDIAFullF"},{align:"center",header:"L(Full Time)",dataIndex:"LAIN-LAINFullM"},{align:"center",header:"P(Full Time)",dataIndex:"LAIN-LAINFullF"},{align:"center",header:"P(Part Time)",dataIndex:"MELAYUPartF"},{align:"center",header:"L(Part Time)",dataIndex:"MELAYUPartM"},{align:"center",header:"P(Part Time)",dataIndex:"BUMIPUTRA SARAWAKPartF"},{align:"center",header:"L(Part Time)",dataIndex:"BUMIPUTRA SARAWAKPartM"},{align:"center",header:"P(Part Time)",dataIndex:"BUMIPUTRA SABAHPartF"},{align:"center",header:"L(Part Time)",dataIndex:"BUMIPUTRA SABAHPartM"},{align:"center",header:"P(Part Time)",dataIndex:"CINAPartF"},{align:"center",header:"L(Part Time)",dataIndex:"CINAPartM"},{align:"center",header:"P(Part Time)",dataIndex:"INDIAPartF"},{align:"center",header:"L(Part Time)",dataIndex:"INDIAPartM"},{align:"center",header:"P(Part Time)",dataIndex:"LAIN-LAINPartF"},{align:"center",header:"L(Part Time)",dataIndex:"LAIN-LAINPartM"}],plugins:[new Wtf.GroupHeaderGrid({rows:[[{align:"center",header:"",colspan:1},{align:"center",header:"",colspan:1},{align:"center",header:"Melayu",colspan:2},{align:"center",header:"Bumiputera Sarawak",colspan:2},{align:"center",header:"Bumiputra Sabah",colspan:2},{align:"center",header:"Cina",colspan:2},{align:"center",header:"India",colspan:2},{align:"center",header:"Lain-lain",colspan:2},{align:"center",header:"Melayu",colspan:2},{align:"center",header:"Bumiputera Sarawak",colspan:2},{align:"center",header:"Bumiputra Sabah",colspan:2},{align:"center",header:"Cina",colspan:2},{align:"center",header:"India",colspan:2},{align:"center",header:"Lain-lain",colspan:2}]],hierarchicalColMenu:true})]});this.add(this.grid);this.doLayout()},loadGridInt:function(){this.teachIntDataStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},this.storeArray),autoLoad:false,url:"jspfiles/report.jsp",baseParams:{type:"getTeachIntMohe"}});this.teachIntDataStore.on("beforeload",function(){this.loadMask.show()},this);this.teachIntDataStore.on("load",function(A){this.loadMask.hide();this.fireEvent("strLoad",A)},this);this.teachIntDataStore.on("loadexception",function(){this.loadMask.hide()},this);this.teachIntDataStore.load();this.grid=new Wtf.grid.GridPanel({border:false,store:this.teachIntDataStore,loadMask:{msg:"Loading..."},stripeRows:true,bodyStyle:"cursor:pointer;",columns:this.columnArr,plugins:[new Wtf.GroupHeaderGrid({rows:[this.headerArr],hierarchicalColMenu:true})]});this.add(this.grid);this.doLayout()},getColumn:function(A){this.columnArr=[];this.headerArr=[];this.storeArray=[];this.storeArray.push("nation");var D=2,C=2;this.headerArr[0]={align:"center",header:"",colspan:1};this.headerArr[1]={align:"center",header:"",colspan:1};this.columnArr[0]=new Wtf.grid.RowNumberer(),this.columnArr[1]={header:"List of Countries",dataIndex:"nation"};for(var B=0;B<A.getCount();B++){this.headerArr[D]={align:"center",header:A.getAt(B).get("qualname"),colspan:2};D++;this.columnArr[C]={align:"center",header:"L(Full Time)",dataIndex:A.getAt(B).get("qualname")+"mFull"};this.storeArray.push(A.getAt(B).get("qualname")+"mFull");C++;this.columnArr[C]={align:"center",header:"P(Full Time)",dataIndex:A.getAt(B).get("qualname")+"fFull"};this.storeArray.push(A.getAt(B).get("qualname")+"fFull");C++}for(var B=0;B<A.getCount();B++){this.headerArr[D]={align:"center",header:A.getAt(B).get("qualname"),colspan:2};D++;this.columnArr[C]={align:"center",header:"L(Part Time)",dataIndex:A.getAt(B).get("qualname")+"mPart"};this.storeArray.push(A.getAt(B).get("qualname")+"mPart");C++;this.columnArr[C]={align:"center",header:"P(Part Time)",dataIndex:A.getAt(B).get("qualname")+"fPart"};this.storeArray.push(A.getAt(B).get("qualname")+"fPart");C++}}});Wtf.prePayment=function(A){Wtf.apply(this,A);this.programStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:new Wtf.data.KwlJsonReader({root:"data"},["programid","programname"])});this.programStore.on("load",function(B){var D=new Wtf.data.Record.create(["programid","programname"]);var C=new D({programid:"",programname:"All"});B.addSorted(C);this.programCmb.setValue("")},this);this.programStore.load({params:{type:20}});this.programCmb=new Wtf.form.ComboBox({triggerAction:"all",editable:false,width:140,mode:"local",valueField:"programid",displayField:"programname",store:this.programStore,emptyText:"Select a program..."});this.fromDate=new Wtf.form.DateField({fieldLabel:"From",format:Wtf.getDateFormat()});this.toDate=new Wtf.form.DateField({fieldLabel:"To",format:Wtf.getDateFormat()});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.loadGrid()}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.toDate.reset();this.fromDate.reset();this.programCmb.reset();this.dataStore.removeAll()}});this.dataStore=new Wtf.data.GroupingStore({reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},["payment","date","payno","studno","name","amount"]),autoLoad:false,url:"jspfiles/report.jsp",sortInfo:{field:"date",direction:"ASC"},groupField:"payment"});this.dataStore.on("beforeload",function(){this.dataStore.baseParams={type:"prepayment",start:this.pg.cursor,limit:this.pP.combo.value,sdate:this.toDate.getRawValue(),edate:this.fromDate.getRawValue(),programid:this.programCmb.getValue()};this.loadMask.show()},this);this.dataStore.on("load",function(){this.loadMask.hide()},this);this.dataStore.on("loadexception",function(){this.loadMask.hide()},this);Wtf.grid.GroupSummary.Calculations["amount"]=function(C,B){return B.data.amount};this.summary=new Wtf.grid.GroupSummary({});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,enableNoGroups:true,enableGroupingMenu:false,hideGroupedColumn:true});this.cmodel=new Wtf.grid.ColumnModel([{header:"Payment",align:"center",dataIndex:"payment"},{header:"Date",align:"center",dataIndex:"date"},{header:"Payment No",align:"center",dataIndex:"payno"},{header:"Student ID",align:"center",dataIndex:"studno"},{header:"Student Name",dataIndex:"name"},{header:"Amount(RM)",summaryType:"sum",align:"right",dataIndex:"amount",summaryRenderer:function(B,D,C){return"Total:"+Wtf.precisionDecimalValue(B)},renderer:function(D,C,B){return Wtf.precisionDecimalValue(D)}}]);this.grid=new Wtf.grid.GridPanel({border:false,store:this.dataStore,cm:this.cmodel,plugins:this.summary,loadMask:{msg:"Loading..."},view:this.groupingView});Wtf.prePayment.superclass.constructor.call(this,{border:false,closable:true,layout:"fit",bodyStyle:"background-color:#FFFFFF",items:[this.grid],tbar:["Select Type",this.programCmb,"-","Apply Dates",this.fromDate,"-",this.toDate,"-",this.submitBttn,"-",this.clearBttn],bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.dataStore,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({})})})};Wtf.extend(Wtf.prePayment,Wtf.Panel,{onRender:function(A){Wtf.prePayment.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."})},loadGrid:function(){this.dataStore.load()}});Report.CIFPleftPaper=Wtf.extend(Report.abstractClass,{initComponent:function(A){Report.CIFPleftPaper.superclass.initComponent.call(this,A)},createTopToolBar:function(){this.topToolBar=new Wtf.Toolbar(["Quick Search:",this.quickPanelSearch,"-","Course:",this.courseCombo,"-",this.submit,this.clearFilter])},handleSubmit:function(){var A=this.courseCombo.getValue();if(A){this.store.baseParams={courseid:A,type:this.reporttype,reportFlag:false};this.store.load({params:{start:0,limit:25}})}},createBbar:function(){return new Wtf.PagingSearchToolbar({pageSize:25,store:this.store,searchField:this.quickPanelSearch,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExport},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]})},handleExportAsPdf:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({courseName:this.courseCombo.lastSelectionText,courseid:this.courseCombo.getValue(),cname:this.cname,ss:this.quickPanelSearch.getValue(),type:"reports",dtype:"attachment",report:this.reporttype,title:this.title,reportFlag:true,mode:36});setDldUrl("ReportsServlet.jsp?"+A)}},createStoreReader:function(){this.record=Wtf.data.Record.create([{name:"name",type:"string"},{name:"username",type:"string"},{name:"code",type:"string"},{name:"modulename",type:"string"},{name:"status",type:"string"},{name:"type",type:"string"}]);return new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.record)},createColumnModel:function(){return new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),{header:"Name",dataIndex:"name",sortable:true,renderer:function(D,B,E){var A=E.data.name;var C=E.data.username;return A+"["+C+"]"}},{header:"Module Code",dataIndex:"code",sortable:true},{header:"Modulename",dataIndex:"modulename",sortable:true},{header:"Status",dataIndex:"status"},{header:"Type",dataIndex:"type"}])}});Gradebook.reportByProgramm=Wtf.extend(Wtf.Panel,{createTopToolBar:function(){this.topToolBar=new Wtf.Toolbar(["Programme:",this.programCombo,"-","Course/Group:",this.courseCombo,"-","Session:",this.sessionCombo,"-",this.submit,this.clearFilter])},getProgramComboStore:function(){return this.programStore},initComponent:function(){this.moduleRecord=Wtf.data.Record.create([{name:"coursename",type:"string"},{name:"courseid",type:"string"},{name:"programid",type:"string"},{name:"code",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data"},this.moduleRecord);this.moduleStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader});this.programCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.programStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:this.prgCmbUrl}),autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"programid",type:"string"},{name:"programname",type:"string"},{name:"programtype",type:"int"}]))}),mode:"local",readOnly:true,listWidth:250,displayField:"programname",valueField:"programid",allowBlank:false,emptyText:"Select a programme..."});this.courseCombo=new Wtf.form.ComboBox({id:"course"+this.id,store:this.moduleStore,readOnly:true,displayField:"coursename",mode:"local",triggerAction:"all",emptyText:"Select a course...",fieldLabel:"Course/Group*",name:"courseid",valueField:"courseid",allowBlank:false,listeners:{scope:this,select:function(D,B,C){this.courseCode=B.get("code");this.sessionCombo.setDisabled(this.courseCode=="CP003")}}});this.programCombo.on("select",this.programSelect,this);this.sessionCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"},{name:"startdate",dateFormat:"Y-m-d",type:"date"}]))}),mode:"local",listWidth:250,readOnly:true,displayField:"sessionname",valueField:"sessionid",allowBlank:false,emptyText:"Select a session..."});this.submit=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:this.getColumns});this.clearFilter=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:this.handleClear});this.createTopToolBar();var A={items:[{region:"center",border:false,layout:"fit",split:true,id:"gridPanel"+this.id},{region:"south",id:"graphPanel"+this.id,height:250,layout:"fit",split:true,bodyStyle:"background:white",autoScroll:true,title:this.graphTitle}],tbar:this.topToolBar};Wtf.apply(this,Wtf.apply(this.initialConfig,A));Gradebook.reportByProgramm.superclass.initComponent.apply(this,arguments)},programSelect:function(B,C,A){this.programType=C.get("programtype");this.moduleStore.load({params:{type:"programsessioncourse",programid:C.data["programid"]}})},handleClear:function(){this.programCombo.setValue("");this.sessionCombo.setValue("");this.courseCombo.setValue("");if(this.store){this.store.baseParams={type:this.reporttype};this.store.load({params:{start:0,limit:15}})}if(Wtf.getCmp("graph"+this.id)){Wtf.getCmp("graph"+this.id).destroy()}if(Wtf.getCmp("grid"+this.id)){Wtf.getCmp("grid"+this.id).destroy()}},showGraph:function(M,F,O){if(Wtf.getCmp("graph"+this.id)){Wtf.getCmp("graph"+this.id).destroy()}var J="";var B="";var E="";var G=40;var C=0;for(var H=0;H<this.gradeArray.length;H++){var D=this.gradeArray[H]["grade"+H];for(var I=0;I<F.length;I++){J+=F[I].get("grade"+D+"per")+",";if(H==0){B+=F[I].get("paper")+"|";C++}}E+=this.gradeArray[H]["grade"+H]+"|";J=J.substring(0,J.length-1);J+="|"}J=J.substring(0,J.length-1);B=B.substring(0,B.length-1);E=E.substring(0,E.length-1);E=E.replace(/ /g,"+");if(C==1){C=5}var N=G*(C);if(N>800){N=800}var L="http://chart.apis.google.com/chart?cht=bvg&chd=t:"+J+"&chs=1000x200&chbh=10,0,20&chg=100,5&chco=FF990080,C6D9FD,2060FFFF,EE8800,994499,99BBE8,CC3333,FF000080&chxt=y,x&chl="+B+"&chdl="+E+"&chtt=Percentage+by+Modules";var K='<div style="text-align:center"><img id="chartdiv2" src ='+L+"></img></div>";var A=new Wtf.Panel({id:"graph"+this.id,html:K,autoScroll:true,layout:"fit",border:false});Wtf.getCmp("graphPanel"+this.id).add(A);Wtf.getCmp("graphPanel"+this.id).doLayout()},createColumnModel:function(B,A,C,E){if(Wtf.getCmp("grid"+this.id)){Wtf.getCmp("grid"+this.id).destroy()}this.store=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:this.reporttype,label:this.label},reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create(A))});var D=new Wtf.grid.GridPanel({id:"grid"+this.id,store:this.store,columns:B,autoScroll:true,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:this.forceFit},plugins:[new Wtf.GroupHeaderGrid({rows:[C],hierarchicalColMenu:true})],bbar:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExport},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]});this.store.on("load",this.showGraph,this);Wtf.getCmp("gridPanel"+this.id).add(D);Wtf.getCmp("gridPanel"+this.id).doLayout();this.handleSubmit()},handleExport:function(){if(this.store.getCount()>0){var B=false;if(this.courseCode!="CP003"){var D=this.sessionStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionStore.getAt(D).get("startdate").format("Y-m-d");B=(A>="2010-01-11")}var C=Wtf.urlEncode({programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),courseid:this.courseCombo.getValue(),label:this.label,sectionFlag:B,type:"reports",dtype:"attachment",report:this.reporttype,title:this.title});setDldUrl("fileDownload.jsp?"+C)}},handleExportAsPdf:function(){if(this.courseCombo.getValue()!=""&&this.store.getCount()>0){var B=false;if(this.courseCode!="CP003"){var D=this.sessionStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionStore.getAt(D).get("startdate").format("Y-m-d");B=(A>="2010-01-11")}var C=Wtf.urlEncode({programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),courseid:"ALL",programName:this.programCombo.lastSelectionText,sessionName:this.sessionCombo.lastSelectionText,courseName:this.courseCombo.lastSelectionText,sectionFlag:B,type:"reports",dtype:"attachment",report:this.reporttype,label:this.label,title:this.title,mode:43});setDldUrl("ReportsServlet.jsp?"+C)}},getColumns:function(){var A=this.programCombo.getValue();if(A){Wtf.Ajax.request({url:"jspfiles/report.jsp",method:"POST",params:{type:this.type,reporttype:this.reporttype,ptype:this.programType,programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue()},scope:this,success:function(B,C){var D=Wtf.util.JSON.decode(B.responseText);this.gradeCnt=D.totalGrades;this.gradeArray=D.gradeArray;this.columnArrayGr=D.column;this.createColumnModel(D.column,D.record,D.groupHeader,D.ptype)},failure:function(){msgBoxShow(["Error","Error. Please try again later."],Wtf.MessageBox.ERROR)}})}},handleSubmit:function(){var E=this.courseCombo.getValue();if(E){var B=false;var C=false;if(this.courseCode!="CP003"){var D=this.sessionStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionStore.getAt(D).get("startdate").format("Y-m-d");B=(A>="2010-01-11")}else{if(this.programType==0){C=true}}this.store.load({params:{courseid:E,programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),sectionFlag:B,ptype:this.programType,part3Flag:C,start:0,limit:15}})}}});Gradebook.reportByCourse=Wtf.extend(Gradebook.reportByProgramm,{handleClear:function(){this.hodCmb.setValue("");Gradebook.reportByCourse.superclass.handleClear.call(this)},handleExport:function(){if(this.store.getCount()>0){var B=false;var D=this.sessionStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionStore.getAt(D).get("startdate").format("Y-m-d");B=(A>="2010-01-11");var C=Wtf.urlEncode({programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),courseid:this.hodCmb.getValue(),label:this.label,sectionFlag:B,type:"reports",dtype:"attachment",report:this.reporttype,title:this.title});setDldUrl("fileDownload.jsp?"+C)}},createTopToolBar:function(){this.topToolBar=new Wtf.Toolbar(["Programme:",this.programCombo,"-","HOD:",this.hodCmb,"-","Session:",this.sessionCombo,"-",this.submit,this.clearFilter])},initComponent:function(A){this.hodRecord=Wtf.data.Record.create([{name:"hodid",type:"string"},{name:"hodname",type:"string"},{name:"moduleid",type:"string"}]);this.hodReader=new Wtf.data.KwlJsonReader({root:"data"},this.hodRecord);this.hodStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),baseParams:{type:107},reader:this.hodReader,listeners:{scope:this,load:function(B){var D=new Wtf.data.Record.create(["hodid","hodname"]);var C=new D({sessionid:"All",sessionname:"All"})}}});this.hodCmb=new Wtf.form.ComboBox({store:this.hodStore,editable:false,displayField:"hodname",mode:"local",listWidth:250,triggerAction:"all",emptyText:"Select a HOD...",valueField:"moduleid",allowBlank:false});Gradebook.reportByCourse.superclass.initComponent.call(this,A);this.programCombo.on("change",function(D,C,B){this.hodCmb.setValue("");this.hodStore.load({params:{programid:C}})},this);this.programCombo.on("select",function(D,B,C){this.hodCmb.setValue("");this.hodStore.removeAll()},this)},onRender:function(A){Gradebook.reportByCourse.superclass.onRender.call(this,A)},handleExportAsPdf:function(){if(this.hodCmb.getValue()!=""&&this.store.getCount()>0){var B=false;var D=this.sessionStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionStore.getAt(D).get("startdate").format("Y-m-d");B=(A>="2010-01-11");var C=Wtf.urlEncode({programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),sectionFlag:B,courseid:this.hodCmb.getValue(),programName:this.programCombo.lastSelectionText,sessionName:this.sessionCombo.lastSelectionText,courseName:this.hodCmb.lastSelectionText,type:"reports",dtype:"attachment",report:"resultByCourse",label:this.label,title:this.title,mode:42});setDldUrl("ReportsServlet.jsp?"+C)}},handleSubmit:function(){var E=this.sessionCombo.getValue();var C=this.hodCmb.getValue();if(E&&C){var B=false;var D=this.sessionStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionStore.getAt(D).get("startdate").format("Y-m-d");B=(A>="2010-01-11");this.store.load({params:{programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),courseid:this.hodCmb.getValue(),sectionFlag:B,start:0,limit:15}})}}});Gradebook.resultByExamCenter=Wtf.extend(Gradebook.reportByProgramm,{handleClear:function(){this.venueCmb.setValue("");Gradebook.reportByCourse.superclass.handleClear.call(this)},handleExport:function(){var A=Wtf.urlEncode({programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),courseid:this.venueCmb.getValue(),label:this.label,type:"reports",dtype:"attachment",report:this.reporttype,title:this.title});setDldUrl("fileDownload.jsp?"+A)},createTopToolBar:function(){this.topToolBar=new Wtf.Toolbar(["Programme:",this.programCombo,"-","Venue:",this.venueCmb,"-","Session:",this.sessionCombo,"-",this.submit,this.clearFilter])},initComponent:function(A){this.venueRecord=Wtf.data.Record.create([{name:"vname",type:"string"},{name:"id",type:"string"}]);this.venueReader=new Wtf.data.JsonReader({root:"data"},this.venueRecord);this.venueStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newClass.jsp"}),baseParams:{type:"venue"},reader:this.venueReader,listeners:{scope:this,load:function(B){var D=new Wtf.data.Record.create(["vname","id"]);var C=new D({sessionid:"All",sessionname:"All"})}}});this.venueCmb=new Wtf.form.ComboBox({store:this.venueStore,editable:false,displayField:"vname",mode:"local",listWidth:250,triggerAction:"all",emptyText:"Select a Venue...",valueField:"id",allowBlank:false});Gradebook.reportByCourse.superclass.initComponent.call(this,A);this.programCombo.on("change",function(D,C,B){this.venueCmb.setValue("");this.venueStore.load()},this);this.programCombo.on("select",function(D,B,C){this.venueCmb.setValue("");this.venueStore.removeAll()},this)},onRender:function(A){Gradebook.reportByCourse.superclass.onRender.call(this,A);Wtf.getCmp("graphPanel"+this.id).hide()},handleSubmit:function(){var B=this.sessionCombo.getValue();var A=this.venueCmb.getValue();if(B&&A){this.store.load({params:{programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),courseid:this.venueCmb.getValue(),start:0,limit:15}})}}});Gradebook.resultByScholershipPlan=Wtf.extend(Gradebook.reportByProgramm,{show:function(){this.remove("graphPanel"+this.id);this.doLayout()},getColumns:function(){var A=this.programCombo.getValue();if(A){Wtf.Ajax.request({url:"jspfiles/report.jsp",method:"POST",params:{type:this.type,reporttype:this.reporttype,ptype:this.programType,part3Flag:this.courseCode=="CP003",programid:this.programCombo.getValue(),courseid:this.courseCombo.getValue()},scope:this,success:function(B,C){var D=Wtf.util.JSON.decode(B.responseText);if(D.success){D=Wtf.util.JSON.decode(D.data);this.groupHeader=D[0].groupHeader;this.createColumnModel(D[0].column,D[0].record,D[0].groupHeader)}else{if(D.msg){msgBoxShow(["Error",D.msg],Wtf.MessageBox.ERROR)}this.handleClear()}},failure:function(){msgBoxShow(["Error","Error. Please try again later."],Wtf.MessageBox.ERROR)}})}},showGraph:function(B,A,C){},createColumnModel:function(B,A,C,E){if(Wtf.getCmp("grid"+this.id)){Wtf.getCmp("grid"+this.id).destroy()}this.store=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:this.reporttype,label:this.label},reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create(A))});var D=new Wtf.grid.GridPanel({id:"grid"+this.id,store:this.store,columns:B,autoScroll:true,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:this.forceFit},plugins:[new Wtf.GroupHeaderGrid({rows:[C],hierarchicalColMenu:true})],bbar:this.pg=new Wtf.PagingToolbar({pageSize:15,store:this.store,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExportAsCsv},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]})});this.store.on("load",this.showGraph,this);Wtf.getCmp("gridPanel"+this.id).add(D);Wtf.getCmp("gridPanel"+this.id).doLayout();this.handleSubmit()},handleExportAsCsv:function(){if(this.store.getCount()>0){var F=this.courseCombo.getValue();if(F){var B=false;var C=false;if(this.courseCode!="CP003"){var E=this.sessionStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionStore.getAt(E).get("startdate").format("Y-m-d");B=(A>="2010-01-11")}else{if(this.programType==0){C=true}}var D=Wtf.urlEncode({courseid:F,programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),sessionName:this.sessionCombo.getRawValue(),programName:this.programCombo.getRawValue(),courseName:this.courseCombo.getRawValue(),sectionFlag:B,reporttype:this.reporttype,ptype:this.programType,part3Flag:C,type:"reports",dtype:"attachment",report:this.reporttype,reportFlag:true,title:this.title});setDldUrl("fileDownload.jsp?"+D)}}},handleExportAsPdf:function(){if(this.store.getCount()>0){var F=this.courseCombo.getValue();if(F){var B=false;var C=false;if(this.courseCode!="CP003"){var E=this.sessionStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionStore.getAt(E).get("startdate").format("Y-m-d");B=(A>="2010-01-11")}else{if(this.programType==0){C=true}}var D=Wtf.urlEncode({courseid:F,programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),sessionName:this.sessionCombo.getRawValue(),programName:this.programCombo.getRawValue(),courseName:this.courseCombo.getRawValue(),sectionFlag:B,ptype:this.programType,part3Flag:C,type:"reports",dtype:"attachment",reporttype:this.reporttype,reportFlag:true,title:this.title,mode:77});setDldUrl("ReportsServlet.jsp?"+D)}}}});Wtf.grid.DynamicColumnModelGradeReport=function(B,D){this.cols1=[];this.groupHeader=[];var G=B.recordType;var A=G.prototype.fields;A.keys=sortCols(A.keys);for(var C=0;C<A.keys.length;C++){var F=A.keys[C];if(!F.match("Attendance")&&!F.match("outof")&&!F.match("Name")&&!F.match("Raw")&&!F.match("Weightage")&&!F.match("Total")&&!F.match("studId")&&!F.match("Status")&&!F.match("Final Exam Marks")&&!F.match("Grade")&&!F.match("Misconduct")&&!F.match("Feedback")&&!F.match("Matric Number")&&!F.match("Nationality")){var E=G.getField(F);this.groupHeader.push({header:E.name.split("/")[0],colspan:2,align:"center"});this.cols1.push({header:"Raw("+(E.name.split("/")[4])+")",dataIndex:E.name+"/Raw",align:"center",editor:new Wtf.form.NumberField({allowBlank:false,allowNegative:true,maxValue:E.name.split("/")[4],minValue:-1}),renderer:function(L,I,H,M,K,J){if(K==0){return L}else{if(L=="Not Graded"||L==-1){return"Not Graded"}else{if(L==-2){return"N/A"}else{if(L<0&&L>-1){return"Not Graded"}else{if(Wtf.isEmpty(L)){return"N/A"}else{if(!isNaN(L)){return Wtf.precisionDecimalValue(L)}else{return L}}}}}}}});this.cols1.push({header:"Weightage("+(E.name.split("/")[5])+"%)",dataIndex:E.name+"/Weightage",align:"center",renderer:function(L,I,H,M,K,J){if(K==0){return L}else{if(L=="Not Graded"||L==-1){return"Not Graded"}else{if(L==-2){return"N/A"}else{if(L<0&&L>-1){return"Not Graded"}else{if(Wtf.isEmpty(L)){return"N/A"}else{if(!isNaN(L)){return Wtf.precisionDecimalValue(L)}else{return L}}}}}}}})}if(F.match("Name")){this.appendFirst11={header:"",colspan:1,align:"center"};var E=G.getField(F);this.appendFirst1={header:E.name,dataIndex:E.name,id:"Name",sortable:true,width:100,renderer:function(L,I,H,M,K,J){return L.split("/")[0]}}}if(F.match("Matric Number")){this.appendFirst22={header:"",colspan:1,align:"center"};var E=G.getField(F);this.appendFirst2={header:E.name,align:"center",dataIndex:E.name,sortable:true,width:100}}if(F.match("Final Exam Marks")){var E=G.getField(F);if(F.match("Raw")==null&&F.match("Weightage")==null){this.groupHeader.push({header:E.name.split("/")[0],colspan:2,align:"center"});this.cols1.push({header:"Raw("+(E.name.split("/")[3])+")",dataIndex:E.name+"/Raw",align:"center",editor:new Wtf.form.NumberField({allowBlank:false,allowNegative:true,maxValue:E.name.split("/")[3],minValue:-1}),renderer:function(L,I,H,M,K,J){if(K==0){return L}else{if(L=="Not Graded"||L==-1){return"Not Graded"}else{if(L==-2){return"N/A"}else{if(L<0&&L>-1){return"Not Graded"}else{if(!isNaN(L)){return Wtf.precisionDecimalValue(L)+"%"}else{return L+"%"}}}}}}});this.cols1.push({header:"Weightage("+(E.name.split("/")[2])+"%)",dataIndex:E.name+"/Weightage",align:"center",renderer:function(L,I,H,M,K,J){if(K==0){return L}else{if(L=="Not Graded"||L==-1){return"Not Graded"}else{if(L==-2){return"N/A"}else{if(L<0&&L>-1){return"Not Graded"}else{if(Wtf.isEmpty(L)){return"N/A"}else{if(!isNaN(L)){return Wtf.precisionDecimalValue(L)+"%"}else{return L+"%"}}}}}}}})}}if(F.match("Total Continuous Assessment")&&F!="Total"){this.assTotalGrpHeader={header:"Total Continuous Assessment",colspan:1,align:"center"};var E=G.getField(F);this.assTotalHeader={header:"Score("+E.name.split("/")[1]+")",align:"center",dataIndex:E.name,sortable:true,renderer:function(L,I,H,M,K,J){if(L==-2){return"N/A"}else{return L+"%"}}}}if(F=="Total Marks(Rounded)"&&F!="Total"){this.appendLast22={header:"",colspan:1,align:"center"};var E=G.getField(F);this.appendLast2={header:E.name,align:"center",dataIndex:E.name,sortable:true,renderer:function(L,I,H,M,K,J){if(L==-2){return"N/A"}else{return L+"%"}}}}if(F.match("Status")){this.appendLast33={header:"",colspan:1,align:"center"};var E=G.getField(F);this.appendLast3={align:"center",header:E.name,dataIndex:E.name,sortable:true,hidden:true,renderer:function(L,I,H,M,K,J){return L}}}if(F.match("Grade")){this.appendLast44={header:"",colspan:1,align:"center"};var E=G.getField(F);this.appendLast4={align:"center",header:E.name,dataIndex:E.name,sortable:true,renderer:function(L,I,H,M,K,J){return L}}}if(F.match("Attendance")){this.appendLast66={header:"",colspan:1,align:"center",hidden:!isRoleGroup("4")};E=G.getField(F);this.appendLast6={align:"center",hidden:true,header:E.name,dataIndex:E.name,sortable:true,editor:new Wtf.form.ComboBox({mode:"local",triggerAction:"all",displayField:"present",valueField:"present",store:new Wtf.data.SimpleStore({fields:["present"],data:[["Absent"],["Present"]],autoLoad:true})})}}}if(this.assTotalHeader){this.cols1.push(this.assTotalHeader);this.groupHeader.push(this.assTotalGrpHeader)}if(this.appendLast1){this.cols1.push(this.appendLast1);this.groupHeader.push(this.appendLast11)}if(this.appendLast2){this.cols1.push(this.appendLast2);this.groupHeader.push(this.appendLast22)}if(this.appendLast3){this.cols1.push(this.appendLast3);this.groupHeader.push(this.appendLast33)}if(this.appendLast4){this.cols1.push(this.appendLast4);this.groupHeader.push(this.appendLast44)}if(this.appendLast6){this.cols1.push(this.appendLast6);this.groupHeader.push(this.appendLast66)}if(this.appendFirst2){this.cols1.unshift(this.appendFirst2);this.groupHeader.unshift(this.appendFirst22)}if(this.appendFirst1){this.cols1.unshift(this.appendFirst1);this.groupHeader.unshift(this.appendFirst11)}this.cols1.unshift(D);this.groupHeader.unshift({header:"",colspan:1,align:"center"});this.cols1.unshift(new Wtf.grid.RowNumberer({}));this.groupHeader.unshift({header:"",colspan:1,align:"center"});Wtf.grid.DynamicColumnModelGradeReport.superclass.constructor.call(this,this.cols1)};Wtf.extend(Wtf.grid.DynamicColumnModelGradeReport,Wtf.grid.ColumnModel,{getConfig:function(){return this.cols1},getGroupHeader:function(){return this.groupHeader},getColumnJSON:function(){var C=[];for(var A=2;A<this.cols1.length;A++){if(!this.cols1[A].hidden){var B={header:this.cols1[A].header,colspan:this.cols1[A].colspan,dataIndex:this.cols1[A].dataIndex};C.push(B)}}return JSON.stringify(C)},getGroupHeaderJSON:function(){var C=[];for(var A=2;A<this.groupHeader.length;A++){if(!this.groupHeader[A].hidden){var B={header:this.groupHeader[A].header,colspan:this.groupHeader[A].colspan};C.push(B)}}return JSON.stringify(C)}});Wtf.course.gradeBookReport=function(A){Wtf.apply(this,A);this.filterStore=new Wtf.data.SimpleStore({fields:["statusid","status"],data:[["0","Result pending"],["1","Pending HOD Verification<br/>Pending HOP Validation"],["2","Verified by HOD<br/>Pending HOP Validation"],["7","Pending HOD Verification<br/>Validated by HOP"],["3","Grievance Application"],["4","Final Marks"],["5","Re-Assess"],["6","ASAD Confirmed"],["8","Verified by HOD<br/>Validated by HOP"]]});this.filterCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.filterStore,mode:"local",readOnly:true,displayField:"status",fieldLabel:"Filter by status",valueField:"statusid",emptyText:"Select a status..."});this.filterCombo.on("select",this.filter,this);Wtf.course.gradeBookReport.superclass.constructor.call(this,{layout:"fit",border:false,items:[this.conPan=new Wtf.Panel({layout:"fit",border:false,items:[this.centerPanel=new Wtf.Panel({layout:"fit",border:false,frame:false})]})]});this.on("render",this.renderGrids,this)};Wtf.extend(Wtf.course.gradeBookReport,Wtf.Panel,{getCMModel:function(){return this.cm.getConfig()},getCMHeaderModel:function(){return this.cm.getGroupHeader()},onRender:function(A){Wtf.course.gradeBookReport.superclass.onRender.call(this,A);this.examSM=new Wtf.grid.CheckboxSelectionModel({});this.addEvents={"loadGrid":true}},plotChart:function(F,D){var G="";var C="";var E=0;var A=false;if(F.totalCnt>0){A=true;for(var B=0;B<F.gradedata.length;B++){E=(F.gradedata[B].cnt/F.totalCnt)*100;G+=F.gradedata[B].grade.replace("+","%2b")+"["+this.roundNumber(E,2)+"%]|";C+=E+","}}if(A){G=G.substring(0,G.length-1);C=C.substring(0,C.length-1)}this.graphdata1='<br/><br/><div style="background-color: white"><img style = "" align="center" src ="http://chart.apis.google.com/chart?cht=p3&chd=t:'+C+"&chco=3e85e5,fcb441,e0400a&chs=550x200&chl="+G+'"</img></div>';this.fireEvent("loadGrid",this.graphdata1,F,D)},roundNumber:function(B,C){var A=Math.round(B*Math.pow(10,C))/Math.pow(10,C);return A},renderGrids:function(){this.ptype=-1;this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."});this.loadMask.show();Wtf.Ajax.requestEx({url:"jspfiles/student/gradeBook.jsp",method:"POST",params:{mode:0,modulerunid:this.modulerunid}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){this.ptype=resObj.ptype;if(resObj.data[0].nameAssMap!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data[0].nameAssMap);this.ds=new Wtf.data.Store({reader:jreader});this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;var groupHeader=[];this.cm=new Wtf.grid.DynamicColumnModelGradeReport(this.ds,this.examSM);groupHeader=this.cm.getGroupHeader();this.grid=new Wtf.grid.GridPanel({loadMask:this.loadMask,border:false,store:this.ds,autoScroll:true,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,viewConfig:{autoFill:true},plugins:[new Wtf.GroupHeaderGrid({rows:[groupHeader],hierarchicalColMenu:true})]});this.centerPanel.add(this.grid);this.ds.loadData(resObj.data[0].nameAssMap);this.loadMask.hide();this.plotChart(resObj.gradechart[0],this.cm);this.grid.on({"validateedit":{fn:this.ve,scope:this}})}this.doLayout()}}},function(resp,req){this.loadMask.hide()})},getUsers:function(){var C="";var A=this.examSM.getSelections();for(var B=0;B<A.length;B++){C+=A[B].get("Name").split("/")[1]+","}return C},reload:function(){this.filterCombo.clearValue();this.centerPanel.remove(this.grid);this.renderGrids()},ve:function(A){A.cancel=true},filter:function(B,C,A){this.ds.filter("Status",C.get("status"))}});Wtf.resAnlsSem=function(A){Wtf.apply(this,A);this.programStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","id"]),url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:1}});this.programCmb=new Wtf.form.ComboBox({id:"prog"+this.id,store:this.programStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a program...",valueField:"id"});this.moduleStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["modulename","moduleid"]),autoLoad:false,url:"jspfiles/reportNew.jsp",baseParams:{mode:38}});this.moduleCmb=new Wtf.form.ComboBox({store:this.moduleStore,editable:true,displayField:"modulename",mode:"local",triggerAction:"all",emptyText:"Select a module...",fieldLabel:"Module",valueField:"moduleid",typeAhead:true});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:this.getColumns});this.clrBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:this.clearRep});this.programCmb.on("select",this.selPro,this);Wtf.resAnlsSem.superclass.constructor.call(this,{layout:"border",title:"Result Analysis",border:false,closable:true,tbar:["Program: ",this.programCmb,"Course/Paper: ",this.moduleCmb,"-",this.submitBttn,"-",this.clrBttn],items:[{region:"center",border:false,layout:"fit",id:"center"+this.id,split:true},{region:"south",border:false,bodyStyle:"background-color:#ffffff",id:"south"+this.id,title:"Result Analysis for Last Three Semesters",height:250,split:true}]})};Wtf.extend(Wtf.resAnlsSem,Wtf.Panel,{onRender:function(A){Wtf.resAnlsSem.superclass.onRender.call(this,A);this.programStore.load()},selPro:function(B,C,A){this.moduleStore.load({params:{progid:C.get("id")}})},clearRep:function(){this.programCmb.setValue("");this.moduleCmb.setValue("");Wtf.getCmp("grid"+this.id).destroy();Wtf.getCmp("graph"+this.id).destroy()},getColumns:function(){var A=this.programCmb.getValue();if(A){Wtf.Ajax.request({url:"jspfiles/report.jsp",method:"POST",params:{type:"getGrades",programid:this.programCmb.getValue(),colmn:"thrSemanalys"},scope:this,success:function(B,C){var D=Wtf.util.JSON.decode(B.responseText);this.gradeCnt=D.totalGrades;this.gradeArray=D.gradeArray;this.createColumnModel(D.column,D.record,D.groupHeader,D.ptype)},failure:function(){msgBoxShow(["Error","Error. Please try again later."],Wtf.MessageBox.ERROR)}})}},createColumnModel:function(B,A,C,E){if(Wtf.getCmp("grid"+this.id)){Wtf.getCmp("grid"+this.id).destroy()}this.store=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create(A))});var D=new Wtf.grid.GridPanel({id:"grid"+this.id,store:this.store,columns:B,autoScroll:true,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true},plugins:[new Wtf.GroupHeaderGrid({rows:[C],hierarchicalColMenu:true})],bbar:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:function(){if(this.store.getCount()>0){var F=Wtf.urlEncode({programid:this.programCmb.getValue(),courseid:this.moduleCmb.getValue(),type:"reports",dtype:"attachment",report:"thrsem",title:this.title,mode:40});setDldUrl("fileDownload.jsp?"+F)}}},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]});this.store.on("load",this.showGraph,this);Wtf.getCmp("center"+this.id).add(D);Wtf.getCmp("center"+this.id).doLayout();this.store.load({params:{courseid:this.moduleCmb.getValue(),type:"getthrsem",mode:40}})},handleExportAsPdf:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({programName:this.programCmb.lastSelectionText,programid:this.programCmb.getValue(),courseName:this.moduleCmb.lastSelectionText,courseid:this.moduleCmb.getValue(),type:"reports",dtype:"attachment",report:"thrsem",title:this.title,mode:40});setDldUrl("ReportsServlet.jsp?"+A)}},showGraph:function(K,E,L){if(Wtf.getCmp("graph"+this.id)){Wtf.getCmp("graph"+this.id).destroy()}var H="";var B="";var C="";for(var F=0;F<this.gradeArray.length;F++){var D=this.gradeArray[F]["grade"+F];for(var G=0;G<E.length;G++){if(F==0){B+=E[G].get("paper")+"|"}}C+=this.gradeArray[F]["grade"+F]+"|"}for(var G=0;G<E.length;G++){for(var F=0;F<this.gradeArray.length;F++){var D=this.gradeArray[F]["grade"+F];H+=E[G].get("grade"+D+"per")+","}H=H.substring(0,H.length-1);H+="|"}H=H.substring(0,H.length-1);B=B.substring(0,B.length-1);B=B.replace(/\s/gi,"+");C=C.substring(0,C.length-1);var J="http://chart.apis.google.com/chart?cht=bvg&chd=t:"+H+"&chs=1000x200&chbh=15,0,10&chg=100,5&chco=FF990080,C6D9FD,2060FFFF,EE8800,994499,99BBE8,CC3333,FF000080&chxt=y,x&chl="+C+"&chdl="+B+"&chtt=+Analysis+for+Last+Three+Semesters";var I='<div style= "padding:10px;"><img id="chartdiv2" src ='+J+"></img></div>";var A=new Wtf.Panel({id:"graph"+this.id,html:I,autoScroll:true,layout:"fit",border:false});Wtf.getCmp("south"+this.id).add(A);Wtf.getCmp("south"+this.id).doLayout()}});Wtf.resultbyPaperReport=function(A){Wtf.apply(this,A);this.programStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","code","duration","id","note","appfee","exemptiontype","programtype","feetype","auditper"]),autoLoad:false,url:"jspfiles/admin/LacaStructure.jsp",baseParams:{flag:1}});this.programCmb=new Wtf.form.ComboBox({id:"prog"+this.id,store:this.programStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a program...",fieldLabel:"Program",name:"id",valueField:"id"});this.sessionRecord=Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"},{name:"code",type:"string"},{name:"startdate",dateFormat:"Y-m-d",type:"date"}]);this.sessionReader=new Wtf.data.KwlJsonReader({root:"data"},this.sessionRecord);this.sessionStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},reader:this.sessionReader});this.sessionCmb=new Wtf.form.ComboBox({store:this.sessionStore,editable:false,displayField:"sessionname",mode:"local",triggerAction:"all",emptyText:"Select a session...",valueField:"sessionid",allowBlank:false,listeners:{scope:this,select:function(F,D,E){this.moduleCmb.reset();this.moduleStore.removeAll();var C=D.get("startdate").format("Y-m-d");if(C<"2010-01-11"){this.sectionCombo.disable()}else{this.sectionCombo.enable()}if(this.programCmb.getValue()){this.moduleStore.load({params:{progid:this.programCmb.getValue(),sessionid:this.sessionCmb.getValue()}})}}}});this.moduleStore=new Wtf.data.Store({reader:new Wtf.data.KwlJsonReader({root:"data"},["name","id","baseid"]),autoLoad:false,url:"jspfiles/reportNew.jsp",baseParams:{mode:32}});this.moduleCmb=new Wtf.form.ComboBox({id:"module"+this.id,store:this.moduleStore,editable:false,displayField:"name",mode:"local",triggerAction:"all",emptyText:"Select a module...",fieldLabel:"Module",name:"id",valueField:"id",listeners:{scope:this,select:function(E,C,D){if(!this.sectionCombo.disabled){this.sectionCombo.reset();this.sectionComboStore.removeAll();this.sectionComboStore.load({params:{moduleid:E.getValue(),sessionid:this.sessionCmb.getValue()}})}}}});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){var C=this.moduleCmb.getValue();if(C){if(this.ds!=undefined){this.ds.removeAll()}this.graphdata1="";this.gradeStoreData=undefined;this.northP.remove(this.grid);if(!this.sectionCombo.disabled){if(this.sectionCombo.getValue()){C=this.sectionCombo.getValue()}else{return }}this.grid=new Wtf.course.gradeBookReport({closable:true,modulerunid:C,id:"gradebk"+C,HOD:Wtf.isHoD(),HOP:Wtf.isHoP()});this.grid.on("loadGrid",function(E,F,D){this.graphdata1=E;this.gradeStoreData=F;this.columnModel=D},this);this.northP.add(this.grid);this.northP.doLayout()}}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.programCmb.reset();this.sessionCmb.reset();this.courseCmb.reset();this.northP.remove(this.grid)}});this.gradeAnalysis=new Wtf.Toolbar.Button({text:"Grade Analysis",scope:this,handler:function(){if(this.gradeStoreData==undefined){return }var G=Wtf.getCmp("gradeAnalysis"+this.id);if(!G){Wtf.grid.GroupSummary.Calculations["cnt"]=function(L,K){return K.data.cnt};var E=new Wtf.grid.GroupingView({forceFit:true,enableNoGroups:true,enableGroupingMenu:false,hideGroupedColumn:true});var D=new Wtf.grid.GroupSummary({});var F=new Wtf.grid.ColumnModel([{header:"Grade",width:150,dataIndex:"gradegroup"},{header:"Grade",width:150,dataIndex:"grade"},{header:"Count",width:150,summaryType:"sum",dataIndex:"cnt",summaryRenderer:function(K,M,L){return"Total:"+K},renderer:function(M,L,K){return M+" ["+K.get("per")+"%]"}}]);F.defaultSortable=true;var C=Wtf.data.Record.create([{name:"grade",type:"string"},{name:"cnt",type:"int"},{name:"gradegroup",type:"string"},{name:"per",type:"string"}]);var J=new Wtf.data.JsonReader({root:"gradedata"},C);var H=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/getdiscipline.jsp"}),id:"gradeGridStore",reader:J,sortInfo:{field:"grade",direction:"ASC"},groupField:"gradegroup"});H.loadData(this.gradeStoreData);var I=new Wtf.grid.GridPanel({ds:H,cm:F,border:false,plugins:D,trackMouseOver:true,loadMask:{msg:"Loading..."},view:E});G=new Wtf.Panel({layout:"border",border:false,id:"gradeAnalysis"+this.id,title:"Grade Analysis",closable:true,items:[{region:"east",split:true,title:"Analysis Graph",width:"50%",layout:"fit",bodyStyle:"background-color: white",items:[{layout:"fit",id:"gdchartsouth",border:false}]},{split:true,title:"Grade Distribution",region:"center",layout:"fit",items:I}]});this.ownerCt.ownerCt.add(G);G.on("afterlayout",function(){document.getElementById("gdchartsouth").innerHTML=this.graphdata1},this)}this.ownerCt.ownerCt.activate(G);this.ownerCt.ownerCt.doLayout()}});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:function(){if(this.moduleCmb.getValue()!=""&&this.gradeStoreData!=undefined){var C=this.moduleCmb.getValue();if(!this.sectionCombo.disabled){if(this.sectionCombo.getValue()){C=this.sectionCombo.getValue()}else{return }}var D=Wtf.urlEncode({modulerunid:C,type:"gradebook",dtype:"attachment",column:this.columnModel.getColumnJSON(),header:this.columnModel.getGroupHeaderJSON()});setDldUrl("fileDownload.jsp?"+D)}}},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]});this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){var C=Wtf.urlEncode({mode:this.mode,progid:this.programCmb.getValue(),acad:this.sessionCmb.getValue(),part:this.courseCmb.getValue(),fileName:"Student_Result_Analysis.pdf"});setDldUrl("ReportsServlet.jsp?"+C)}});this.programCmb.on("select",this.handleProgSelect,this);var B=new Wtf.comboBox();this.sectionCombo=B.getSectionCombo(false);this.sectionComboStore=B.getSectionComboStore();Wtf.resultbyPaperReport.superclass.constructor.call(this,{layout:"border",border:false,tbar:["Session ",this.sessionCmb,"Program ",this.programCmb,"Module",this.moduleCmb,"-",this.sectionCombo,"-",this.submitBttn],bbar:[this.csv,this.gradeAnalysis],collapsible:true,items:[this.northP=new Wtf.Panel({border:false,region:"center",bodyStyle:"background-color:#FFFFFF",layout:"fit",split:true,collapsible:true,items:this.grid=new Wtf.course.gradeBookReport({closable:true,border:false,modulerunid:"tf",id:"gradebkhj",HOD:Wtf.isHoD(),HOP:Wtf.isHoP()})})]});this.on("render",this.handleRender,this)};Wtf.extend(Wtf.resultbyPaperReport,Wtf.Panel,{handleRender:function(A){this.programStore.load();this.sessionStore.load();this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."})},handleExportAsPdf:function(){if(this.moduleCmb.getValue()!=""&&this.gradeStoreData!=undefined){var I=this.moduleCmb.getValue();var A="NA";if(!this.sectionCombo.disabled){if(this.sectionCombo.getValue()){I=this.sectionCombo.getValue();A=this.sectionCombo.lastSelectionText}else{return }}var B=this.grid.getCMHeaderModel();var C=new Array();for(var E=0;E<B.length;E++){var D={column:B[E].header};C.push(D)}var F=this.grid.getCMModel();var H=new Array();for(E=0;E<F.length;E++){D={column:F[E].header,dataindex:F[E].dataIndex};H.push(D)}var G=Wtf.urlEncode({programName:this.programCmb.lastSelectionText,programid:this.programCmb.getValue(),courseName:this.moduleCmb.lastSelectionText,sectionName:A,modulerunid:I,sessionName:this.sessionCmb.lastSelectionText,sessionid:this.sessionCmb.getValue(),groupHeader:JSON.stringify(C),colModel:JSON.stringify(H),type:"reports",dtype:"attachment",report:"gradebook",title:"Result Analysis by Paper",mode:41});setDldUrl("ReportsServlet.jsp?"+G)}},handleProgSelect:function(B,A){this.moduleCmb.reset();this.moduleStore.removeAll();this.moduleStore.load({params:{progid:A.data.id,sessionid:this.sessionCmb.getValue()}})},loadGrid:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:this.mode,courseid:this.courseCmb.getValue(),sessionid:this.sessionCmb.getValue(),progid:this.programCmb.getValue()}},this,function(request){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data);this.ds=new Wtf.data.Store({reader:jreader});this._reader=jreader;this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel8(this.ds);this.grid=new Wtf.grid.GridPanel({border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,viewConfig:{autoFill:true}});this.northP.add(this.grid);this.ds.loadData(resObj.data);this.graphdata1='<div><img style = "" align="center" src ="'+resObj.imgurl+'"</img></div>'}this.doLayout();this.loadMask.hide()}}},function(resp,req){this.loadMask.hide()})},printReport:function(){setDldUrl("ReportsServlet.jsp?mode="+this.mode+"&progid="+this.programCmb.getValue()+"&fromdate="+this.fromDate1.getRawValue()+"&todate="+this.toDate1.getRawValue())}});Gradebook.detailedResult=Wtf.extend(Gradebook.reportByProgramm,{onRender:function(A){Gradebook.detailedResult.superclass.onRender.call(this,A);this.getColumns();Wtf.getCmp("graphPanel"+this.id).add(this.graphPanel);Wtf.getCmp("graphPanel"+this.id).doLayout()},createTopToolBar:function(){this.topToolBar=new Wtf.Toolbar(["Programme:",this.programCombo,"Select CGPA :",this.cgpaCombo,"-",this.submit,this.clearFilter])},initComponent:function(){this.cgpaStore=new Wtf.data.SimpleStore({data:[["CGPA 3.5 and above","1"],["CGPA More than 3 and less than 3.5","2"],["CGPA Less than 3","3"],["All Students","4"]],fields:["cgpavalue","cgpaid"],reader:new Wtf.data.ArrayReader({},[{name:"cgpavalue"},{name:"cgpaid"}])});this.finalcm=new Wtf.grid.ColumnModel([{header:"CGPA",dataIndex:"regstudent"},{header:"#",dataIndex:"abovecnt"},{header:"%",dataIndex:"abovepercent"},{header:"#",dataIndex:"middlecnt"},{header:"%",dataIndex:"middlepercent"},{header:"#",dataIndex:"lowercnt"},{header:"%",dataIndex:"lowerpercent"},{header:"Total No.of Student",dataIndex:"totalcnt"}]);this.graphStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:this.reporttype},fields:["regstudent","abovecnt","abovepercent","middlecnt","middlepercent","lowercnt","lowercnt","totalcnt"],reader:new Wtf.data.ArrayReader({},[{name:"regstudent"},{name:"abovecnt"},{name:"abovepercent"},{name:"middlecnt"},{name:"middlepercent"},{name:"lowercnt"},{name:"lowercnt"},{name:"totalcnt"}])});this.cgpaCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.cgpaStore,mode:"local",readOnly:true,listWidth:200,displayField:"cgpavalue",valueField:"cgpaid",allowBlank:false,emptyText:"Select CGPA..."});this.graphPanel={layout:"border",border:false,items:[{region:"center",border:false,layout:"fit",split:true,autoScroll:true,bodyStyle:"background:white",id:"graphPanelCenter"+this.id,title:"CGPA Result"},{region:"west",id:"graphPanelWest"+this.id,width:"50%",layout:"fit",split:true,bodyStyle:"background:white",border:false,autoScroll:true,title:"Results Analysis",items:[this.finalgrid=new Wtf.grid.GridPanel({border:false,store:this.graphStore,enableColumnHide:false,cm:this.finalcm,viewConfig:{autoFill:true,forceFit:true},loadMask:{msg:"Loading..."},plugins:[new Wtf.GroupHeaderGrid({rows:[[{header:"",colspan:1,align:"center"},{header:"Above 3.5",colspan:2,align:"center"},{header:"3.0-3.5",colspan:2,align:"center"},{header:"Less 3.0",colspan:2,align:"center"},{header:"",colspan:1,align:"center"}]],hierarchicalColMenu:true})]})]}]},Gradebook.detailedResult.superclass.initComponent.call(this,arguments)},handleClear:function(){this.cgpaCombo.setValue("");this.programCombo.setValue("");this.store.removeAll();this.graphStore.removeAll();if(this.store){this.store.baseParams={type:this.reporttype};this.store.load({params:{cgpaid:this.cgpaCombo.getValue(),programid:this.programCombo.getValue(),start:0,limit:15}})}},handleSubmit:function(){var A=this.programCombo.getValue();if(A){this.graphStore.removeAll();this.store.load({params:{cgpaid:this.cgpaCombo.getValue(),programid:A,start:0,limit:15}})}},handleExportAsPdf:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({cgpaid:this.cgpaCombo.getValue(),cgpexp:this.cgpaCombo.lastSelectionText,type:"reports",dtype:"attachment",programid:this.programCombo.getValue(),programName:this.programCombo.getRawValue(),report:this.reporttype,label:this.label,title:"Result Analysis for Students",mode:44});setDldUrl("ReportsServlet.jsp?"+A)}},handleExport:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({cgpaid:this.cgpaCombo.getValue(),cgpexp:this.cgpaCombo.lastSelectionText,type:"reports",programid:this.programCombo.getValue(),programName:this.programCombo.getRawValue(),dtype:"attachment",report:this.reporttype,title:this.title});setDldUrl("fileDownload.jsp?"+A)}},showGraph:function(E){var J=E.data.last().json.abovepercent;var G=E.data.last().json.middlepercent;var C=E.data.last().json.lowerpercent;var K=E.data.last().json.totalcnt;var F=E.data.last().json.abovecnt;var M=E.data.last().json.middlecnt;var B=E.data.last().json.lowercnt;this.finalrec=new Wtf.data.Record({"regstudent":"Registered Student","abovecnt":F,"abovepercent":J,"middlecnt":M,"middlepercent":G,"lowercnt":B,"lowerpercent":C,"totalcnt":K});var L=this.cgpaCombo.getValue();this.graphStore.add(this.finalrec);if(Wtf.getCmp("graph"+this.id)){Wtf.getCmp("graph"+this.id).destroy()}var H="";if(E.data.last()){H=J+","+G+","+C}var D="http://chart.apis.google.com/chart?cht=lxy&chs=600x220&chd=t:25,50,75|"+H+"&chco=3072F3,ff0000,00aaaa&chls=2,4,1&chm=s,FF0000,0,-1,5|s,0000ff,1,-1,5|s,00aa00,2,-1,5&chxt=x,y&chxl=0:|0|1|2|3|4|1:|0|10|20|30|40|50&chdl=Series 1&chdlp=b&chg=0,20,1,0&chtt=Student+CGPA";var I='<div style="text-align:center"><img id="chartdiv2" style = "" align="center" src ="'+D+'"></div>';var A=new Wtf.Panel({id:"graph"+this.id,html:I,autoScroll:true,layout:"fit",border:false});Wtf.getCmp("graphPanelCenter"+this.id).add(A);Wtf.getCmp("graphPanelCenter"+this.id).doLayout()}});Report.candidateVenueList=Wtf.extend(Report.abstractClass,{initComponent:function(A){Report.candidateVenueList.superclass.initComponent.call(this,A)},createTopToolBar:function(){this.topToolBar=new Wtf.Toolbar(["Programme:",this.programCombo,"-","Session:",this.sessionCombo,"-",this.submit,this.clearFilter])},handleSubmit:function(){var B=this.programCombo.getValue();var A=this.sessionCombo.getValue();if(B!=""&&A!=""){this.store.baseParams={programid:B,sessionid:A,type:this.reporttype,reportFlag:false};this.store.load({params:{start:0,limit:25}})}},createBbar:function(){return new Wtf.PagingSearchToolbar({pageSize:25,store:this.store,searchField:this.quickPanelSearch,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExport},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]})},handleExportAsPdf:function(){if(this.store.getCount()>0){var B=this.programCombo.getValue();var A=this.sessionCombo.getValue();var C=Wtf.urlEncode({programid:B,sessionid:A,programName:this.programCombo.getRawValue(),sessionName:this.sessionCombo.getRawValue(),type:"reports",dtype:"attachment",report:this.reporttype,reportFlag:true,mode:73});setDldUrl("ReportsServlet.jsp?"+C)}},handleExport:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({programid:this.programCombo.getValue(),sessionid:this.sessionCombo.getValue(),programName:this.programCombo.getRawValue(),sessionName:this.sessionCombo.getRawValue(),type:"reports",dtype:"attachment",report:this.reporttype,reportFlag:true,title:this.title});setDldUrl("fileDownload.jsp?"+A)}},createStoreReader:function(){this.record=Wtf.data.Record.create([{name:"name",type:"string"},{name:"username",type:"string"},{name:"code",type:"string"},{name:"city",type:"string"},{name:"country",type:"string"},{name:"venue",type:"string"},]);return new Wtf.data.KwlJsonReader({root:"data",totalProperty:"total"},this.record)},createColumnModel:function(){return new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),{header:"Name",dataIndex:"name",sortable:true,renderer:function(D,B,E){var A=E.data.name;var C=E.data.username;return A+"["+C+"]"}},{header:"Module Code",dataIndex:"code",sortable:true},{header:"City",dataIndex:"city",sortable:true},{header:"Country",dataIndex:"country"},{header:"Venue",dataIndex:"venue"}])}});Report.StudentActiveStatus=Wtf.extend(Report.abstractClass,{createTopToolBar:function(){this.topToolBar=new Wtf.Toolbar(["Programme:",this.programCombo,"-",this.submit,this.clearFilter])},createGridPanel:function(){this.store=this.createStore();this.cm=this.createColumnModel();this.bbar=this.createBbar();return new Wtf.grid.GridPanel({id:"gridPanel"+this.id,store:this.store,cm:this.cm,autoScroll:true,border:false,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true},bbar:this.bbar})},createStore:function(){this.reader=this.createStoreReader();return new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:this.reporttype,label:this.label},reader:this.reader,listeners:{scope:this,load:this.handleStoreLoad}})},createStoreReader:function(){this.record=Wtf.data.Record.create([{name:"active",type:"int"},{name:"dismissalfialedexam",type:"int"},{name:"dismissaldisciplinary",type:"int"},{name:"total",type:"int"},{name:"inactive",type:"int"},{name:"intake",type:"string"},{name:"withdrawl",type:"int"}]);return new Wtf.data.KwlJsonReader({root:"data"},this.record)},createColumnModel:function(){return new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),{header:"Intake Session",dataIndex:"intake",sortable:true,renderer:function(C,B,D){var A=D.data.intake;return A}},{header:"Active",dataIndex:"active",sortable:true},{header:"Inactive",dataIndex:"inactive",sortable:true},{header:"Withdrawal From Program",dataIndex:"withdrawl"},{header:"Dismissal:Failed Exam",dataIndex:"dismissalfialedexam"},{header:"Dismissal:Disciplinary",dataIndex:"dismissaldisciplinary"},{header:"Total",dataIndex:"total"}])},createBbar:function(){return new Wtf.PagingSearchToolbar({pageSize:25,store:this.store,searchField:this.quickPanelSearch,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExportAsCsv},{id:"exportAsPdf"+this.id,iconCls:"exportAsPdf",text:"Export As Pdf",scope:this,handler:this.handleExportAsPdf}]})]})},handleExportAsCsv:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({programid:this.programCombo.getValue(),programName:this.programCombo.getRawValue(),type:"reports",dtype:"attachment",report:this.reporttype,reportFlag:true,title:this.title});setDldUrl("fileDownload.jsp?"+A)}},handleExportAsPdf:function(){if(this.store.getCount()>0){var A=this.programCombo.getValue();var B=Wtf.urlEncode({programid:A,programName:this.programCombo.getRawValue(),sessionName:this.sessionCombo.getRawValue(),type:"reports",dtype:"attachment",report:this.reporttype,reportFlag:true,title:this.title,mode:76});setDldUrl("ReportsServlet.jsp?"+B)}}});Wtf.reportForCIFPCourseAudit=Wtf.extend(Report.abstractClass_Dnyamic_ColModel,{programType:0,sessionFlag:false,createTopToolBar:function(){this.courseComboConfig={listeners:{scope:this,select:function(C,A,B){this.cname=A.get("name")}},store:new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:"cifpcourselist"},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"id",type:"string"},{name:"name",type:"string"}]))}),mode:"local",listWidth:250,readOnly:true,displayField:"name",valueField:"id",allowBlank:false,emptyText:"Select a Course..."};this.McourseCombo=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},this.courseComboConfig));this.comboArray.push("Course :");this.comboArray.push(this.McourseCombo);this.comboArray.push("-");Wtf.reportForCIFPCourseAudit.superclass.createTopToolBar.call(this)},getConfig:function(){return{items:[{region:"center",border:false,layout:"fit",split:true,autoScroll:true,id:"gridPanel"+this.id}],tbar:this.topToolBar}},handleClear:function(){this.sessionCombo.setValue("");this.McourseCombo.setValue("");Wtf.reportForCIFPCourseAudit.superclass.handleClear.call(this)},handleSubmit:function(){var A=this.sessionCombo.getValue();this.store.baseParams={type:this.storeType,reporttype:this.reporttype,courseid:this.McourseCombo.getValue(),coursename:this.McourseCombo.getRawValue(),sessionid:A,ptype:this.programType,dataType:"json",reportFlag:false,part3Flag:true,prePartFlag:this.getPrePartFlag()};this.store.load({params:{start:0,limit:this.pageSizeGrid}})},getColumns:function(){var A={type:this.type,reporttype:this.reporttype,ptype:this.programType,courseid:this.McourseCombo.getValue(),coursename:this.McourseCombo.getRawValue(),sessionid:this.sessionCombo.getValue(),prePartFlag:this.getPrePartFlag()};this.sendRequest(A)},handleExportAsCsv:function(){if(this.store.getCount()>0){var A=Wtf.urlEncode({sessionid:this.sessionCombo.getValue(),reporttype:this.reporttype,courseid:this.McourseCombo.getValue(),coursename:this.McourseCombo.getRawValue(),ptype:this.programType,dataType:"json",reportFlag:true,part3Flag:true,prePartFlag:this.getPrePartFlag(),type:"getReport",dtype:"attachment",report:this.reporttype,title:this.title});setDldUrl("fileDownload.jsp?"+A)}},createGridBBar:function(){return new Wtf.PagingToolbar({pageSize:this.pageSizeGrid,store:this.store,displayInfo:true,displayMsg:"Displaying items {0} - {1} of {2}",emptyMsg:"No items to display",items:[this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,menu:[{id:"exportAsExcel"+this.id,iconCls:"csvIcon",text:"Export As Excel",scope:this,handler:this.handleExportAsCsv}]})]})},getPrePartFlag:function(){var B=false;if(this.sessionCombo){var C=this.sessionComboStore.find("sessionid",this.sessionCombo.getValue());var A=this.sessionComboStore.getAt(C).get("startdate").format("Y-m-d");B=(A>="2009-01-11")}return B},showGraph:function(){}});var icon;var communityTabs=new Array();var userTabs=new Array();var courseTabs=[];var docTabs=new Array();var contentTabs=new Array();var pvar=new Array();var alumniTabs=new Array();var grantsTabs=new Array();var researchTabs=new Array();var acastructTabs=new Array();var logistics=new Array();var learningTabs=new Array();var facultyTabs=new Array();var bursarTabs=new Array();var reportTabs=[];var forumTabs=[];var feedbackTabs=[];var studentFeedbackTabs=[];var hrTabs=[];var locTabs=[];var qbTabs=[];var modTab={};var aflag=0;var sectionFlag=false;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,{loadTabAdv:function(B,D,H,K,J,G,F){var A="tab"+D.substr(3);var E=this.getComponent(A);if(E){this.setActiveTab(E);if(F){E.activesubtab=F;if(E.tabType==Wtf.etype.proj){Wtf.getCmp("projectTabs_"+E.id.substr(3)).pro.fireEvent(F.event)}if(A=="tabcompanyadminpanel"){Wtf.getCmp("mainAdmin").fireEvent(F)}}}else{var I={tabid:A,url:B,scripts:true};var C=new Wtf.ux.ContentPanel({id:A,title:H,autoLoad:I,navarea:K,layout:"fit",tabType:J,iconCls:getTabIconCls(J)});if(G){switch(J){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(F){C.activesubtab=F}}},loadTab:function(B,D,G,J,I,K,F){var A="tab"+D.substr(3);var E=this.getComponent(A);if(E){this.setActiveTab(E)}else{var H={tabid:A,url:B,scripts:true};var C=new Wtf.ux.ContentPanel({id:A,title:G,autoLoad:H,navarea:J,layout:"fit",tabType:I,imgsource:K,cls:"backgroundstrip",iconCls:getTabIconCls(I)});switch(I){case Wtf.etype.comm:communityTabs[communityTabs.length]=C;break;case Wtf.etype.course:courseTabs[courseTabs.length]=C;break;case Wtf.etype.user:userTabs[userTabs.length]=C;break;case Wtf.etype.alumni:alumniTabs[alumniTabs.length]=C;break;case Wtf.etype.content:contentTabs[contentTabs.length]=C;break;case Wtf.etype.grants:grantsTabs[grantsTabs.length]=C;break;case Wtf.etype.research:researchTabs[researchTabs.length]=C;break;case Wtf.etype.logistics:logistics[logistics.length]=C;break;case Wtf.etype.lcontent:learningTabs[learningTabs.length]=C;break;case Wtf.etype.faculty:facultyTabs[facultyTabs.length]=C;break;case Wtf.etype.acastructure:acastructTabs[acastructTabs.length]=C;break;case Wtf.etype.loc:locTabs[locTabs.length]=C;break;case Wtf.etype.qb:qbTabs[qbTabs.length]=C;break;case Wtf.etype.lms:courseTabs[courseTabs.length]=C;break;break;case Wtf.etype.bursar:bursarTabs[bursarTabs.length]=C;break;case Wtf.etype.report:reportTabs[reportTabs.length]=C;break;case Wtf.etype.feedback:feedbackTabs[feedbackTabs.length]=C;break;case Wtf.etype.studentFeedback:studentFeedbackTabs[studentFeedbackTabs.length]=C;break;case Wtf.etype.humanResource:hrTabs[hrTabs.length]=C;break;case Wtf.etype.forumTabs:forumTabs[forumTabs.length]=C;break}this.add(C);this.setActiveTab(C);if(F){C.activesubtab=F}}}});Wtf.ux.NavigationPanel=function(A){Wtf.ux.NavigationPanel.superclass.constructor.call(this,A)};Wtf.extend(Wtf.ux.NavigationPanel,Wtf.Panel,{selectTab:function(C){var B=Wtf.get("navcontainer");B.select("a").removeClass("selected");var A=Wtf.fly("nav"+C);if(A&&!A.hasClass("selected")){A.addClass("selected")}}});var mainPanel;function getTabIconCls(A){switch(A){case Wtf.etype.home:return"pwnd dashboardTabIcon";break;case Wtf.etype.comm:return"pwnd communityTabIcon";break;case Wtf.etype.course:return"pwnd courseTabIcon";break;case Wtf.etype.user:return"pwnd userTabIcon";break;case Wtf.etype.alumni:return"pwnd userTabIcon";break;case Wtf.etype.cal:return"pwnd teamcal";break;case Wtf.etype.forum:return"pwnd discussionTabIcon";break;case Wtf.etype.pmessage:return"pwnd pmessageTabIcon";break;case Wtf.etype.adminpanel:return"pwnd adminpanelTabIcon";break;case Wtf.etype.content:return"contentTabIcon";break;case Wtf.etype.loc:return"locTabIcon";break;case Wtf.etype.qb:return"qbTabIcon";break;case Wtf.etype.docs:return"pwnd doctabicon";break;case Wtf.etype.faculty:return"pwnd facultyTabIcon";break;case Wtf.etype.bursar:return"bursarTabIcon";break;case Wtf.etype.acastructure:return"acaStructTabIcon";break;case Wtf.etype.lcontent:return"lcontentIcon";break;case Wtf.etype.report:return"reportTabIcon";break;case Wtf.etype.feedback:return"feedbackTabIcon";break;case Wtf.etype.market:return"marketTabIcon";break;case Wtf.etype.contacts:return"pwnd contactsTabIcon";break;case Wtf.etype.todo:return"pwnd todolistpane";break;case Wtf.etype.humanResource:return"pwnd facultyTabIcon";break}}function toggleAccordion(A){switch(A){case Wtf.etype.docs:Wtf.getCmp("docpanel").expand();break;case Wtf.etype.cal:Wtf.getCmp("calpanel").expand();break;case Wtf.etype.contacts:Wtf.getCmp("contpanel").expand();break;default:Wtf.getCmp("pmessage").expand();break}}var contactsTree=null;Wtf.onReady(function(){validateServerSession();var B=function(H){var G=H.getTarget("a");if(G){H.preventDefault();mainPanel.loadTab(G.href,G.id,G.title,G.getAttribute("navarea"),parseInt(G.getAttribute("tabType")));D.selectTab(G.id.substr(3))}};function F(J,M,I,H,L){var G=2;if(isRoleGroup("1")||isRoleGroup("2")||isRoleGroup("7")){G=3}else{G=2}if(WtfShowAdminTab()){G++}if(WtfShowStudentHome()){G++}if(WtfShowAcaStructure()){G++}if(WtfShowMyCourseStud()){G++}if(WtfShowMyCourseFac()){G++}if(WtfShowMarketingHR()){G++}if(WtfShowLearningNContent()){G++}if(WtfShowGrant()){G++}if(WtfShowBursary()){G++}if(WtfShowMarketing()){G++}if(!WtfStudentAccessDocCal()){G--}Wtf.getCmp("centerNavRegion").setHeight(G*31);var K=L-(G*31)-1;if(Wtf.isIE6){K=K-G+1}if(!isNaN(K)){Wtf.getCmp("northNavRegion").setHeight(K)}}mainPanel=new Wtf.ux.MainPanel({id:"as",region:"center",deferredRender:false,minTabWidth:165,cls:"ascls",titleCollapse:true,activeTab:0,enableTabScroll:true,items:[new Wtf.ux.ContentPanel({id:"tabdashboard",title:"Dashboard",navarea:"navareadashboard",autoLoad:{url:"dashboard.html",scripts:true},iconCls:getTabIconCls(Wtf.etype.home),tabType:Wtf.etype.home})]});var D=new Wtf.ux.NavigationPanel({region:"west",split:true,id:"navigationpanel",cls:"navigationPanel",collapsible:true,title:"Navigation",margins:"0 0 0 0",layout:"border",items:[new Wtf.Panel({id:"northNavRegion",bodyStyle:"background-color:white;",region:"north",layout:"Accordion",layoutConfig:{activeOnTop:true},border:false,items:[new Wtf.Panel({border:false,id:"pmessage",autoScroll:true,title:"Personal Messages",contentEl:"navareadashboard"}),new Wtf.Panel({border:false,id:"calpanel",autoScroll:true,title:"Calendar",contentEl:"calContainer"}),new Wtf.Panel({border:false,id:"docpanel",autoScroll:true,title:"Documents",contentEl:"navareadocs"}),new Wtf.Panel({border:false,autoScroll:true,id:"contpanel",title:"Contacts",contentEl:"navareacont"})]}),new Wtf.Panel({border:false,id:"centerNavRegion",region:"center",contentEl:"navcontainer"})]});D.on("resize",F);mainPanel.on("tabchange",function(H,G){D.selectTab(G.id.substr(3));toggleAccordion(G.tabType)});var E=Wtf.get("navcontainer");E.on("click",B);var A=new Wtf.Viewport({layout:"border",items:[new Wtf.BoxComponent({region:"north",el:"header"}),mainPanel,D]});A.doLayout();var C=new Wtf.MailLeftTree({renderTo:"navareadashboard"});document.getElementById("folderview").getElementsByTagName("div")[0].getElementsByTagName("div")[0].style.border="none";contactsTree=new Wtf.ContactsTree({renderTo:"navareacont"});document.getElementById("contactsview").getElementsByTagName("div")[0].getElementsByTagName("div")[0].style.border="none";Wtf.QuickTips.init()});function setUsername(B){var A=document.getElementById("whoami");A.innerText=B;A.textContent=B}function signOut(C){var A="";for(var D in modTab){if(D!=null){A+=D+"_"}}if(A!=""){A=A.substring(0,A.length-1);var B=A.split("_");Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{type:"sstime",moduleids:A,type:C},method:"POST"},this,function(G,F){_dC("username");_dC("lid");_dC("perms");_dC("realroles");var H="jspfiles/signOut.jsp?type="+C;_r(H)},function(G,F){})}else{_dC("username");_dC("lid");_dC("perms");_dC("realroles");var E="jspfiles/signOut.jsp?type="+C;_r(E)}}function _dC(A){document.cookie=A+"=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT"}function validateServerSession(){Wtf.Ajax.request({method:"GET",url:Wtf.req.base+"validate.jsp",scope:this,success:function(result,req){var res=eval("("+result.responseText.trim()+")");if(res&&res.valid==true){setUsername(res.username);Wtf.username=res.username;Wtf.studentAccess=res.access;Wtf.studentAccessObj=res.accessObj;Wtf.pref=res.preferences[0];Wtf.userid=res.lid;Wtf.each(res.roleperms,function(perm){Wtf.roleperms.push(perm.rolegroupid);Wtf.each(perm.roleset,function(rset){Wtf.rolesets[rset.roleid]=Wtf.rolesets[rset.roleid]||[];Wtf.rolesets[rset.roleid][rset.permgrid]=Wtf.rolesets[rset.roleid][rset.permgrid]||{};(Wtf.rolesets[rset.roleid][rset.permgrid]).pE=rset.permvaledit;(Wtf.rolesets[rset.roleid][rset.permgrid]).pV=rset.permvalview})},this);var ht=Wtf.getCmp("navigationpanel").body.getHeight();Wtf.getCmp("navigationpanel").setHeight(ht+25);loginCheck();calLoadControl(mainPanel.id);dojo.cometd.init("bind")}else{signOut("signout")}},failure:function(result,req){signOut("signout")}})}function showPersnProfile(){var A=Wtf.getCmp("pprofwin");if(!A){new Wtf.Profile().show()}}function trim(A){if(!A||typeof A!="string"){return null}return A.replace(/^[\s]+/,"").replace(/[\s]+$/,"").replace(/[\s]{2,}/," ")}function loadApplicationsPage(){mainPanel.loadTab("applications.html","   studentApplications","Admission [Applications]","navareadashboard",Wtf.etype.course)}function loadAtGradeBook(){var A=Wtf.getCmp("atGradebook");if(!A){var B=new Wtf.disGrade({layout:"fit",border:false,id:"atGradebook",closable:true,title:"Grade Book",iconCls:"gradebookIcon",moduleid:this.moduleid,HOD:false,HOP:false});mainPanel.add(B);mainPanel.doLayout();mainPanel.setActiveTab(B)}else{mainPanel.setActiveTab(A)}}function loadAuthorizationPage(){var B=Wtf.getCmp("tabauth");if(!B){var A=new Wtf.Panel({layout:"fit",border:false,id:"tabauth",closable:true,title:"Manage Access Rights",items:[new Wtf.MainAuthPanel({layout:"fit"})]});mainPanel.add(A);mainPanel.doLayout();mainPanel.setActiveTab(A)}else{mainPanel.setActiveTab(B)}}function printInvoice(B,A){if(A==1){setDldUrl("PrintInvoice.jsp?&invoicenum="+B+"&flg="+A)}else{if(A==2){setDldUrl("PrintInvoice.jsp?&crnum="+B+"&flg="+A)}else{if(A==3){setDldUrl("PrintInvoice.jsp?&rnum="+B+"&flg="+A)}else{if(A==4){setDldUrl("PrintInvoice.jsp?&snum="+B+"&flg="+A)}}}}}function GenExamSlip(C,A,B){setDldUrl("GenExamSlip.jsp?&id="+C+"&flag=1&courseid="+B+"&type=data")}function showExamSlip(C,A,B){Wtf.Ajax.request({method:"POST",url:"GenExamSlip.jsp",params:{id:C,flag:1,type:"ajax",courseid:B},scope:this,success:function(E,F){var H=Wtf.decode(E.responseText);var I=H.msg.split("_");if(I[1]==2||I[1]==3){if(I[1]==3){msgBoxShow(["FeedBack","Your feedback has been already submitted."],Wtf.MessageBox.INFO)}else{var D=new Wtf.form.ComboBox({triggerAction:"all",store:new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/report.jsp"}),baseParams:{type:"getFeedbackModules",courseid:B},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"moduleid",type:"string"},{name:"modulename",type:"string"}]))}),mode:"local",readOnly:true,fieldLabel:"Select Module",displayField:"modulename",valueField:"moduleid",allowBlank:false,emptyText:"Select a Module..."});var G=new Wtf.Window({title:"FeedBack Window",closable:true,modal:true,iconCls:"win",width:400,height:150,resizable:false,buttonAlign:"right",items:[this.assForm=new Wtf.form.FormPanel({border:false,bodyStyle:"font-size : 10px;padding:15px;",labelWidth:100,items:[D]})],buttons:[{text:"Submit",tooltip:"Submit",scope:this,handler:function(){var J=D.getValue();if(J){G.close();mainPanel.loadTab("feedbackTemplate.html","fbk"+J,"Submit Feedback","navareadashboard",Wtf.etype.feedback)}}}]});G.show()}}else{alert(I[0])}},failure:function(D,E){msgBoxShow(["Alert","Operation Failed"],Wtf.MessageBox.INFO)}})}function editMyProfile(){var A=new Wtf.common.myProfile({id:loginid,parentid:1,facId:loginid}).show()}function setPasswordPolicy(){var A=new Wtf.passwordPolicy({});Wtf.Ajax.request({method:"POST",url:"jspfiles/admin/getMasterData.jsp",params:({action:"getpolicy"}),scope:this,success:function(B,D){var C=Wtf.decode(B.responseText);if(C.minchar!=null){A.minchar.setValue(C.minchar);A.maxchar.setValue(C.maxchar);A.minnum.setValue(C.minnum);A.minalpha.setValue(C.minalphabet);if(C.specialchar=="true"){A.specialchars.setValue(true)}if(C.setpolicy=="true"){A.appPolicy.setValue(true)}}A.show()},failure:function(B,C){Wtf.Msg.alert("Error","Error connecting to server",function(D){},this)}})}function setSystemTimezone(){var A=new Wtf.SystemTimezone({});A.show()}function feedbackMgmt(){var A=new Wtf.Feedback({});A.show()}function loadMemberManagementPage(){mainPanel.loadTab("MemberManagement.html","   memberManagement","User Management","navareadashboard",Wtf.etype.course)}function loadSponsorTab(){mainPanel.loadTab("sponsor.html","   sponsor","Sponsors","navareadashboard",Wtf.etype.course)}function loadGradApplications(){mainPanel.loadTab("gradApplications.html","   gradApplications","Graduation [Applications]","navareadashboard",Wtf.etype.course)}function loadCourseApplications(){mainPanel.loadTab("courseApplications.html","   courseApplications","Course Completion [Applications]","navareadashboard",Wtf.etype.course)}function loadcurrencyRate(){mainPanel.loadTab("currencyRate.html","   currencyRate","Currency Rate","navareadashboard",Wtf.etype.course)}function loadonlinePmtSearch(){mainPanel.loadTab("onlinePaymentSearch.html","   onlinePmts","Online Payments","navareadashboard",Wtf.etype.course)}function loadStudentplan(){mainPanel.loadTab("studentplan.html","   viewStudentPlan","Student Plan","navareadashboard",Wtf.etype.course)}function loadwrongInvoices(){mainPanel.loadTab("cancelWrongInvoices.html","   wrongInv","Knock-off Invoice","navareadashboard",Wtf.etype.course)}function loadWithdrawApp(){mainPanel.loadTab("programWithdraw.html","   programWithdraw","Program Withdrawal [Applications]","navareadashboard",Wtf.etype.course)}function loadFisabillahApp(){mainPanel.loadTab("fisabillahApp.html","   scholarship","Fisabilillah [Applications]","navareadashboard",Wtf.etype.course)}function loadCountry(){mainPanel.loadTab("countryWeight.html","   countryweight","Country [Weightage]","navareadashboard",Wtf.etype.course)}function loadScholarshipApp(){mainPanel.loadTab("scholarshipApp.html","   newScholarship","Scholarship [Applications]","navareadashboard",Wtf.etype.course)}function myContacts(){mainPanel.loadTab("myContacts.html","   contacts","Contacts","navareadashboard",Wtf.etype.contacts)}function setLedgerMapping(){this.ledgerMap=new Wtf.LedgerMapping({id:"LedMap"+this.id,title:"Create Ledger",closable:true,border:false,modal:true,width:400,height:350,iconCls:"win",layout:"fit",resizable:false}).show()}function generatecredit(){mainPanel.loadTab("creditNote.html","   creditNote","Credit Note Requests","navareadashboard",Wtf.etype.report)}function loadCourseAudit(A){if(A=="CIFP"){mainPanel.loadTab("courseAudit.html","   cifpAudit","CIFP Course Audit","navareadashboard",Wtf.etype.report)}else{mainPanel.loadTab("courseAudit.html","   gsAudit","GS Course Audit","navareadashboard",Wtf.etype.report)}}function loadAnnouncementsPage(){mainPanel.loadTab("announcements.html","   createAnnouncements","Announcements","navareadashboard",Wtf.etype.course)}function loadStudentHomePage(){mainPanel.loadTab("studentHomeBursar.html","   viewStudentDetails","Student Home","navareadashboard",Wtf.etype.alumni)}function loadExamRegPage(){mainPanel.loadTab("examRegistrationBursar.html","   viewExamRegistration","Exam Registration","navareadashboard",Wtf.etype.course)}function loadClassRegPage(){mainPanel.loadTab("classRegistrationBursar.html","   viewClassRegistration","Class Registration","navareadashboard",Wtf.etype.course)}function loadExemptionAppPage(){mainPanel.loadTab("exemptionBursar.html","   viewExemptionApplications","Exemption Applications","navareadashboard",Wtf.etype.course)}function loadReportTab(){mainPanel.loadTab("reports.html","   reports","Reports","navareadashboard",Wtf.etype.report)}function loadForumTab(){mainPanel.loadTab("forumTab.html","   forum","My Forums","navareadashboard",Wtf.etype.forumTabs)}function openReportPrivWin(){mainPanel.loadTab("reportPrivileges.html","   reportPriv","Reports","navareadashboard",Wtf.etype.report)}function loadBookmarksPage(){mainPanel.loadTab("bookmarksTab.html","   createBookmarks","My Bookmarks","navareadashboard",Wtf.etype.docs)}function loadHistoryTab(){mainPanel.loadTab("history.html","   history","History","navareadashboard",Wtf.etype.report)}function showAssignments(A){if(!Wtf.getCmp("assignDropBox_"+A)){Wtf.getCmp(A).innerTabPanel.add(new Wtf.common.assignmentDropBox({id:"assignDropBox_"+A,ctCls:"assignments",title:"Module Assignments",moduleid:A,closable:true,faculty:(isRoleGroup("1"))?false:true,layout:"fit"}))}Wtf.getCmp(A).innerTabPanel.activate("assignDropBox_"+A);Wtf.getCmp(A).innerTabPanel.doLayout()}function loadCourseTab(A,D,E,G){var C=A.split("_")[0];var H=A.split("_")[1];var F=A.split("_")[2];sectionFlag=new Boolean(parseInt(G));if(D=="0"){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{type:"ltime",moduleid:C},method:"POST"},this,function(J,I){},function(J,I){});mainPanel.loadTab("modulePanel.html","   _"+C+"_"+E+"_"+H+"_"+F,E,"navareadashboard",Wtf.etype.course)}else{aflag=A.split("_")[3];if(!Wtf.getCmp(C)){mainPanel.loadTab("modulePanel.html","   _"+C+"_"+E+"_"+H+"_"+F,E,"navareadashboard",Wtf.etype.course)}else{if(sectionFlag==false){mainPanel.loadTab("modulePanel.html","   _"+C+"_"+E+"_"+H+"_"+F,E,"navareadashboard",Wtf.etype.course)}var B="assignDropBox_"+C;if(aflag==1||sectionFlag){if(!Wtf.getCmp(B)){Wtf.getCmp(C).innerTabPanel.add(new Wtf.common.assignmentDropBox({id:B,ctCls:"assignments",title:sectionFlag?"Section Assignments":"Module Assignments",moduleid:C,closable:true,faculty:(isRoleGroup("1"))?false:true,layout:"fit"}))}Wtf.getCmp(C).innerTabPanel.activate(B);Wtf.getCmp(C).innerTabPanel.doLayout();aflag=0}}}}function uploadFile(params){if(params[0]=="1"){this.teamListStore=new Wtf.data.JsonStore({root:"data",fields:["teamid","teamname"],url:"jspfiles/admin/assignment.jsp"});this.teamListStore.load({params:{action:26,moduleid:params[2]}});this.teamListStore.on("load",function(){if(this.teamListStore.getCount()>0){this.teamlist.setValue(this.teamListStore.getAt(0).data["teamid"])}},this)}this.newUploadWin=new Wtf.Window({title:"Submit Assignment",closable:true,modal:true,iconCls:"win",width:400,height:230,resizable:false,buttonAlign:"right",buttons:[{text:"Upload",scope:this,handler:function(){if(this.newUploadWin.buttons[0].getText()=="Upload"){this.newUploadWin.buttons[0].disable();this.newUploadWin.buttons[0].setText("OK");this.newUploadWin.buttons[1].disable();this.fileUploadForm.form.submit({scope:this,params:{check:"faculty",teamid:this.teamlist.getValue()},failure:function(frm,action){this.uploadbar.reset();this.uploadbar.updateText("Error Submitting...");this.newUploadWin.buttons[0].enable();this.newUploadWin.buttons[1].enable()},success:function(frm,action){var respObj=eval("("+action.response.responseText+")");this.uploadbar.reset();this.uploadbar.updateProgress(respObj.data[0].msg=="true"?1:0,respObj.data[0].msg);this.newUploadWin.buttons[0].enable();this.newUploadWin.buttons[1].enable()}});this.fileUploadForm.hide();this.uploadbar.show();this.uploadbar.wait()}else{this.newUploadWin.close()}}},{text:"Cancel",scope:this,handler:function(){this.newUploadWin.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/upload52.gif","Submit Assignment File","Upload your assignment file to be submitted.")},{region:"center",border:false,bodyStyle:"background:#f1f1f1;font-size : 10px;padding:20px 20px 20px 20px;",layout:"fit",items:[{border:false,bodyStyle:"background:transparent;",layout:"fit",items:[this.fileUploadForm=new Wtf.form.FormPanel({url:"jspfiles/student/submitAssignment.jsp?flag=1",waitMsgTarget:true,method:"POST",border:false,fileUpload:true,bodyStyle:"font-size:10px;",labelWidth:100,defaultType:"textfield",items:[{fieldLabel:"Assignment File",inputType:"file",id:"fileinput"+this.id,name:"filepath"},this.teamlist=new Wtf.form.ComboBox({fieldLabel:"Team*",hiddenName:"team",store:this.teamListStore,readOnly:true,displayField:"teamname",disabled:params[0]=="0"?true:false,valueField:"teamid",mode:"local",triggerAction:"all",emptyText:"Select a team...",allowBlank:false,blankText:"Click to select a team"}),new Wtf.form.Hidden({name:"assignmentid",value:params[1]}),new Wtf.form.Hidden({name:"modulerunid",value:params[2]}),new Wtf.form.Hidden({name:"subtype",value:params[0]})]}),this.uploadbar=new Wtf.ProgressBar({text:"Submitting ...",id:"uploadfile"+this.id,hidden:true})]}]}]});this.newUploadWin.show()}function uploadAssignment(B){var A=B.split("_");Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/student/submitAssignment.jsp",params:({flag:2,modulerunid:A[2],assignid:A[1]})},this,function(C,D){var E=Wtf.decode(C);if(E.flag==0){uploadFile(A)}else{Wtf.MessageBox.show({title:"Submit Assignment",msg:"Are you sure you want to submit the assignment after due date",buttons:Wtf.MessageBox.YESNO,icon:Wtf.MessageBox.WARNING,scope:this,fn:function(F){if(F=="yes"){uploadFile(A)}}})}},function(C,D){msgBoxShow(["Alert","Operation Failed"],Wtf.MessageBox.INFO)})}Wtf.UploadWindow=function(A){Wtf.apply(this,A);this.uploadPanel=new Wtf.FormPanel({frame:true,method:"POST",fileUpload:true,waitMsgTarget:true,url:"FileUpload.jsp?flag=1",layout:"column",items:[{columnWidth:1,layout:"form",items:[{html:"Select the file you want to upload"},{layout:"form",layoutConfig:{labelSeparator:""},labelWidth:0,items:[new Wtf.form.TextField({id:"browseBttn",inputType:"file"})]},{layout:"form",items:[{buttons:[{text:"Upload",type:"submit",scope:this,handler:function(){if(Wtf.getCmp("browseBttn").getValue()!=""){this.uploadPanel.form.submit({scope:this,waitMsg:"Loading...",success:function(B,D){var E=D.result.success.path;var F=Wtf.getLmsImgPath+E;var C;if(this.cid){C=document.getElementById(this.cid)}else{C=document.getElementById("picUpload2")}C.value=E;C.src=F;msgBoxShow(["Upload Successful","File Uploaded Successfully"],Wtf.MessageBox.INFO);this.close()},failure:function(B,C){msgBoxShow(["Error","A problem occurred while uploading"],Wtf.MessageBox.ERROR);this.close()}})}}},{text:"Cancel",scope:this,handler:function(){this.close()}}]}]}]}]});Wtf.UploadWindow.superclass.constructor.call(this,{iconCls:"winicon",modal:true,resizable:false,width:300,title:"Upload File...",items:[this.uploadPanel]})};Wtf.extend(Wtf.UploadWindow,Wtf.Window,{onRender:function(A){Wtf.UploadWindow.superclass.onRender.call(this,A);this.add(this.uploadPanel)}});function createDatstore(){var A=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"quiz.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["quesid","author","tags"])});return A}function AjaxReq(L,N,I,B,P,Q,F,O,A,D,C,M,G,H){var J="2";var K=createDatstore();K.load({params:{flag:J,quiznode:A,type:L,ques:N,attemp:I,Tl:B,point:P,feed:Q,difficulty:F,ans:O,pic:M,cid:G,qtag:H}});K.on("load",E);function E(S,T,R){updateId(T,D,C)}}function AjaxReqMult(D,L,F,I,G,O,H,Q,N,E,M,J,R,C,B){var P="2";var K=createDatstore();K.load({params:{flag:P,quiznode:E,type:D,ques:L,attemp:F,shuf:I,Tl:G,point:O,feed:H,difficulty:Q,ans:N,pic:R,cid:C,qtag:B}});K.on("load",A);function A(T,U,S){updateId(U,M,J)}}function AjaxReqUpdate(C,K,E,F,N,G,Q,M,D,I,L,H,R,B,A){var O="4";var J=createDatstore();J.load({params:{flag:O,quiznode:D,quesid:I,type:C,ques:K,attemp:E,Tl:F,point:N,feed:G,difficulty:Q,ans:M,pic:R,cid:B,qtag:A}});J.on("load",P);function P(T,U,S){updateTags(U,L,H)}}function updateTags(E,C,B){var A=(E[0].data.tags);var D=C.getAt(B);D.set("tags",A)}function updateId(G,D,C){var F=(G[0].data.quesid);var B=(G[0].data.author);var A=(G[0].data.tags);var E=D.getAt(C);E.set("quesid",F);E.set("author",B);E.set("tags",A)}function AjaxReqMultUpdate(C,L,E,H,F,O,G,R,N,D,J,M,I,S,B,A){var P="4";var K=createDatstore();K.load({params:{flag:P,quiznode:D,quesid:J,type:C,ques:L,attemp:E,shuf:H,Tl:F,point:O,feed:G,difficulty:R,ans:N,pic:S,cid:B,qtag:A}});K.on("load",Q);function Q(U,V,T){updateTags(V,M,I)}}Wtf.override(Wtf.dd.DDProxy,{startDrag:function(B,D){var A=Wtf.get(this.getDragEl());var C=Wtf.get(this.getEl());A.applyStyles({border:"","z-index":2000});A.update(C.dom.innerHTML);A.addClass(C.dom.className+" dd-proxy")},onDragOver:function(C,A){var B=Wtf.get(A);this.lastTarget=B;B.addClass("DragClass")},onDragOut:function(C,A){var B=Wtf.get(A);this.lastTarget=null;B.removeClass("DragClass")},endDrag:function(D){var A=Wtf.get(this.getDragEl());var C=Wtf.get(this.getEl());var B=Wtf.get(this.lastTarget);if(this.lastTarget){Wtf.get(this.lastTarget).appendChild(C);this.lastTarget.removeClass("DragClass")}if("function"===typeof this.config.fn){this.config.fn.apply(this.config.scope||window,[this,this.config.dragData])}}});Wtf.namespace("Tutorial");function MakeDropZone(B){var A=new Wtf.dd.DropZone(B,{ddGroup:"group"})}function MakeDropSource(A){var B=Wtf.get(A);B.dd=new Wtf.dd.DDProxy(A,"group")}Wtf.MyHtmlEditor=function(A){Wtf.apply(this,A);this.saveflag=0;this.mycontenteditor=A.mycontenteditor;this.cutBttn=new Wtf.Toolbar.Button({id:"cutbutton",minWidth:30,iconCls:"cutbttn",tooltip:{title:"Cut",text:"Cut selected text.",cls:"x-html-editor-tip"}});this.cutBttn.on("click",this.getSelectedText,this);this.copyBttn=new Wtf.Toolbar.Button({id:"copybutton",minWidth:30,iconCls:"copybttn",tooltip:{title:"Copy",text:"Copy selected text.",cls:"x-html-editor-tip"}});this.copyBttn.on("click",this.copySelectedText,this);this.pasteBttn=new Wtf.Toolbar.Button({id:"pastebutton",minWidth:30,iconCls:"pastebttn",tooltip:{text:"Paste",cls:"x-html-editor-tip"}});this.pasteBttn.on("click",this.pasteSelectedText,this);Wtf.MyHtmlEditor.superclass.constructor.call(this,A);this.on("render",this.addButtons,this);if(Wtf.isGecko){this.on("keypress",this.applyCommand,this)}if(Wtf.isIE||Wtf.isSafari||Wtf.isOpera){this.on("keypress",this.fixKeys,this)}};Wtf.extend(Wtf.MyHtmlEditor,Wtf.form.HtmlEditor,{value:null,addButtons:function(A){A.getToolbar().addSeparator();A.getToolbar().addButton(this.cutBttn);A.getToolbar().addButton(this.copyBttn);A.getToolbar().addButton(this.pasteBttn)},getSelectedText:function(A){this.value=this.doc.getSelection();if(this.value!=null){this.insertAtCursor(" ")}},pasteSelectedText:function(A){if(this.value!=""){this.insertAtCursor(this.value)}},copySelectedText:function(A){this.value=this.doc.getSelection()},applyCommand:function(B){if(B.ctrlKey){var E=B.getCharCode(),A;if(E>0){E=String.fromCharCode(E);switch(E){case"b":A="bold";break;case"i":A="italic";break;case"u":A="underline";break}if(A){this.win.focus();this.execCmd(A);this.deferFocus();B.preventDefault()}}}var D=B.getCharCode();if(D!=27&&!(D>=19&&D<=20)&&D!=0&&!(D>=144&&D<=145)){if(this.saveflag==0){var C=this.mycontenteditor.tabPanelContainer.getActiveTab().title;this.mycontenteditor.tabPanelContainer.getActiveTab().setTitle(C+"*");this.saveflag=1;this.save=0}}},createLink:function(){var A=prompt(this.createLinkText,this.defaultLinkValue);if(A&&A!="http://"){this.win.focus();this.insertAtCursor("<a href = '"+A+"' target='_blank'>"+this.doc.getSelection()+"</a>");this.deferFocus()}},fixKeys:function(){if(Wtf.isIE){return function(D){var A=D.getKey(),B;if(A==D.TAB){D.stopEvent();B=this.doc.selection.createRange();if(B){B.collapse(true);B.pasteHTML("&nbsp;&nbsp;&nbsp;&nbsp;");this.deferFocus()}}else{if(A==D.ENTER){B=this.doc.selection.createRange();if(B){var C=B.parentElement();if(!C||C.tagName.toLowerCase()!="li"){D.stopEvent();B.pasteHTML("<br />");B.collapse(false);B.select()}}}}var F=D.getCharCode();if(F!=27&&!(F>=19&&F<=20)&&F!=0&&!(F>=144&&F<=145)){if(this.saveflag==0){var E=this.mycontenteditor.tabPanelContainer.getActiveTab().title;this.mycontenteditor.tabPanelContainer.getActiveTab().setTitle(E+"*");this.saveflag=1;this.save=0}}}}else{if(Wtf.isOpera){return function(B){var A=B.getKey();if(A==B.TAB){B.stopEvent();this.win.focus();this.execCmd("InsertHTML","&nbsp;&nbsp;&nbsp;&nbsp;");this.deferFocus()}}}else{if(Wtf.isSafari){return function(B){var A=B.getKey();if(A==B.TAB){B.stopEvent();this.execCmd("InsertText","\t");this.deferFocus()}}}}}}()});Wtf.LMSlayout=function(B){Wtf.apply(this,B);this.peda=true;this.courseid=B.courseid;this.editor=B.editor;this.pubArray=B.pubexpArray;this.nodeArray={};this.linkArrayObj={};this.ruleArray={};this.selboxes={};this.id=B.id;this.rad=0;this.lper=-1;this.gper=-1;this.lnum=-1;this.gnum=-1;var A="01/01/70 00:00:00";this.ldt=A;this.gdt=A;this.rows="";this.frompos="";this.topos="";this.comp="";this.cnt=0;this.cnt1=0;this.X1=0;this.Y1=0;this.X2=0;this.Y2=0;this.myUnitcount=0;this.wincount=0;this.dbflag=0;this.tabflag=0;this.myArray=[];this.root=B.root;this.mytree=B.mytree;this.tmp=this.getNodes(this.root);this.lineId="";this.i=0;this.child1=[];this.bchild=[];this.mchild=[];this.achild=[];this.conContainer=document.createElement("div");this.conContainer.className="conContainer";this.conContainer.id="parentCon";this.child1[this.i]=document.createElement("div");this.child1[this.i].className="child1";this.child1[this.i].innerHTML="Apply this rule after chapter completes.";this.conContainer.appendChild(this.child1[this.i]);this.i++;this.split="|$|";this.close=0;this.store=new Wtf.data.Store({reader:new Wtf.data.ArrayReader({},[{name:"company"}])});this.sm=new Wtf.grid.CheckboxSelectionModel();this.sm.on("rowselect",this.onRowSelect,this);this.sm.on("rowdeselect",this.onRowDeselect,this);this.cm=new Wtf.grid.ColumnModel([this.sm,{id:"company",header:"Rules",width:150,sortable:true,dataIndex:"company"}]);this.assessCon=[["When attempts are less than a number."],["When attempts are greater than a number."],["When completed before specified date/time."],["When completed after specified date/time."],["When completed."],["When score is less than a percentage."],["When score is greater than a percentage."]];this.secCon=[["When attempts are less than a number."],["When attempts are greater than a number."],["When completed before specified date/time."],["When completed after specified date/time."],["When completed."]];this.toblock="";this.fromblock="";this.fromdiv="";this.todiv="";this.dstore=this.createDataStore();this.retstore=this.createDataStore();this.retstore.on("load",this.hload,this);this.primitive=new Wtf.Panel({id:"primi"+this.id,layout:"fit"});this.myunit=new Wtf.Panel({id:"myun"+this.id,layout:"fit"});this.tabpanel=new Wtf.TabPanel({cls:"pedTabPanel",activeTab:0,frame:true,items:[{title:"Primitives",items:[this.primitive]},{id:"myunity",title:"My Units",autoScroll:true,items:[this.myunit]}]});this.tabpanel.on("tabchange",this.addMyUnits,this);this.span=document.createElement("span");this.left=new Wtf.Panel({title:"Content Palette",layout:"border",items:[{region:"north",layout:"fit",frame:true,html:"Drag-Drop shapes to the designer<br><br>"},{region:"center",layout:"fit",items:[this.tabpanel]},{region:"south",height:50,items:[this.span]}]});this.right1=new Wtf.Panel({id:"right"+this.id,cls:"chart"});this.right1.addListener("render",function(){this.right1.el.addListener("mouseup",this.rightPanelUp,this);this.right1.el.addListener("mousemove",this.mymousemove,this);this.right1.el.addListener("mouseup",this.rightPanelUp,this);this.js=new jsGraphics("right"+this.id)},this);this.panelbottom=new Wtf.Panel({layout:"form",items:[{buttons:[{text:"OK",scope:this,handler:function(){this.close=1;this.dataSave()}},{text:"Cancel",handler:function(){mainPanel.remove(mainPanel.getActiveTab().id)}},{text:"Apply",scope:this,handler:this.dataSave}]}]});this.pedContainer=new Wtf.Panel({layout:"border",border:false,items:[{region:"west",border:true,width:200,frame:true,layout:"fit",items:[this.left]},{frame:true,layout:"fit",region:"center",autoScroll:false,items:[this.right1]},{id:"pedSouth"+this.id,frame:true,region:"south",items:[this.panelbottom]}]});Wtf.LMSlayout.superclass.constructor.call(this,{});Wtf.getCmp("pedSouth"+this.id).on("render",this.actSouthPan,this);this.right1.on("render",this.retrieveDbContent,this);this.on("destroy",this.onLogout,this);mainPanel.on("beforetabchange",this.tabChange,this)};Wtf.extend(Wtf.LMSlayout,Wtf.Panel,{onLogout:function(){this.editor.RightTabPanel.activate("subtab1"+this.editor.id)},onRender:function(A){Wtf.MyContentEditor.superclass.onRender.call(this,A);this.add(this.pedContainer);this.primitive.on("render",this.addPrimitives,this)},afterRender:function(){Wtf.MyContentEditor.superclass.afterRender.call(this);this.on("beforedestroy",this.tabClose)},tabClose:function(A){this.peda=false},tabChange:function(A,C,B){if(this.peda==false){return true}else{if(B.id.match("ped")){if(C.id!=B.id){msgBoxShow(["Warning","Please close Pedagogy."]);return false}else{return true}}}},addPrimitives:function(){this.wb1=new Wtf.ux.WtfButton({caption:"Section",imgSrc:"images/lms/logo1.png",ID:"section_primi"+this.id,renderTo:"primi"+this.id}).addListener("mouseOver",this.handleMouseOver,this);this.wb3=new Wtf.ux.WtfButton({caption:"Assessment",imgSrc:"images/lms/assessment.png",ID:"assessment_primi"+this.id,renderTo:"primi"+this.id}).addListener("mouseOver",this.handleMouseOver,this);this.wb5=new Wtf.ux.WtfButton({caption:"Note",imgSrc:"images/lms/notes.png",ID:"note_primi"+this.id,renderTo:"primi"+this.id}).addListener("mouseOver",this.handleMouseOver,this);this.addDragCmp("section_primi"+this.id,true);this.addDragCmp("assessment_primi"+this.id,true);this.addDragCmp("note_primi"+this.id,true);this.addDragCmp("right"+this.id,false)},handleMouseOver:function(B,A){this.span.innerHTML=A},addDragCmp:function(A,B){if(B){this.MyDragZone=new MyDragZone(A,{ddGroup:"group",scroll:false})}else{this.MyDropTarget=new MyDropTarget(A,{ddGroup:"group",overClass:"dd-over",mainobj:this})}},actSouthPan:function(){Wtf.getCmp("pedSouth"+this.id).doLayout()},addMyUnits:function(){if(this.tabpanel.getActiveTab().id=="myunity"){if(this.tabflag==0&&this.dbflag==1){this.tabflag=1;Wtf.getCmp("myun"+this.id).ownerCt.doLayout();for(var A=this.myUnitcount;A<this.tmp.length;A++){if(this.tmp[A].attributes.cls=="sectionclass"){new Wtf.ux.WtfButton({caption:this.tmp[A].attributes.text,imgSrc:"images/lms/logo1.png",ID:"section_myun/"+this.tmp[A].attributes.id,IDM:"section_myun/"+this.tmp[A].attributes.id,renderTo:"myun"+this.id}).addListener("mouseOver",this.handleMouseOver,this);this.addDragCmp("section_myun/"+this.tmp[A].attributes.id,true)}else{if(this.tmp[A].attributes.cls=="quizclass"||this.tmp[A].attributes.cls=="rquizclass"){new Wtf.ux.WtfButton({caption:this.tmp[A].attributes.text,imgSrc:"images/lms/assessment.png",ID:"assessment_myun/"+this.tmp[A].attributes.id,IDM:"assessment_myun/"+this.tmp[A].attributes.id,renderTo:"myun"+this.id}).addListener("mouseOver",this.handleMouseOver,this);this.addDragCmp("assessment_myun/"+this.tmp[A].attributes.id,true)}else{if(this.tmp[A].attributes.cls=="fileclass"){new Wtf.ux.WtfButton({caption:this.tmp[A].attributes.text,imgSrc:"images/lms/logo1.png",ID:"section_myun/"+this.tmp[A].attributes.id,IDM:"section_myun/"+this.tmp[A].attributes.id,renderTo:"myun"+this.id}).addListener("mouseOver",this.handleMouseOver,this);this.addDragCmp("section_myun/"+this.tmp[A].attributes.id,true)}}}this.myUnitcount++}}}},removeMyUnits:function(){for(var A in this.nodeArray){var B=A.split("/");for(var C=0;C<this.tmp.length;C++){if(B[1]==this.tmp[C].attributes.id){this.tmp.splice(C,1)}}}this.dbflag=1;this.addMyUnits()},getNodes:function(A){if(A.id!="rootNode"){this.myArray[this.cnt1]=A;this.cnt1++}if(A.firstChild!=null){this.getNodes(A.firstChild)}if(A.nextSibling!=null){this.getNodes(A.nextSibling)}return this.myArray},mymousemove:function(C){if(this.X1>0){var A=C.getPageX()-Wtf.get("right"+this.id).getLeft();var B=C.getPageY()-Wtf.get("right"+this.id).getTop();this.js.clear();this.js.setStroke(1);this.js.setColor("#939599");this.js.drawLine(this.X1,this.Y1,A,B);this.js.paint()}},rightPanelUp:function(){this.js.clear();this.X1=0},disableSelection:function(A){if(typeof A.onselectstart!="undefined"){A.onselectstart=function(){return false}}else{if(typeof A.style.MozUserSelect!="undefined"){A.style.MozUserSelect="none"}else{A.onmousedown=function(){return false}}}A.style.cursor="default"},createDataStore:function(){var A=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"padagogy.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["Details"])});return A},dataSave:function(){var AG=this.courseid;var AH="",S="",E="",A="",Q="",g="",AP="",J="";for(var w in this.nodeArray){var U=w.split("/");if(U[0]=="note"){var AK=new String(this.nodeArray[w]);var T=AK.split(this.split);var a=Wtf.getCmp("noteText"+U[1]).getValue();AK=T[0]+this.split+T[1]+this.split+T[2]+this.split+T[3]+this.split+a+this.split+T[5]+this.split+T[6];this.nodeArray[w]=AK}var AC=U[1];var AN=this.nodeArray[w];var d=AN.split(this.split);var v=d[0];var s=d[1];var AF=d[2];var H=d[3];var l=d[4];var V=d[5]+"_"+AC;var AO=d[6];AH+=v+"/";S+=s+"/";E+=AF+"/";A+=H+"/";Q+=l+"/";g+=V+"/";AP+=AO+"/";J+=U[1]+"/"}var e="";var L="";var Z="";var c="";var G="";var P="";for(var w in this.linkArrayObj){var b=w.split("_");var AB=b[0].split("/");var n=b[1].split("/");G+=AB[0]+"/";P+=n[0]+"/";var I=AB[2];var W=AB[3];var AI=n[2];var f=n[3];e+=W+"/";L+=f+"/";Z+=I+"/";c+=AI+"/"}var M="",K="",R="",O="",o="",N="",AE="",F="",AJ="",D="",X="",B="";for(var C in this.ruleArray){var AD=C.split("_");var AM=AD[1].split("/");var AL=AD[2].split("/");var d=this.ruleArray[C].split("_");M+=d[0]+"/";K+=d[1]+"/";R+=d[2]+"/";O+=d[3]+"/";o+=d[4]+"_";N+=d[5]+"_";AE+=d[7]+"/";AJ+=d[6]+"_";D+=d[8]+"/";X+=d[9]+"/";F+=AM[1]+"/";L+=AL[1]+"/";B+=d[10]+"/"}var u="-1";var Y="-1";for(var AA in this.pubArray){u=this.pubArray[AA]+",";Y=AA+","}this.dstore.load({params:{flag:"6",courseId:AG,x:AH,y:S,ht:E,wd:A,title:Q,handle:g,nodeId:J,class1:AP,ftid:e,ftid1:Z,ttid:L,ttid1:c,ftype:G,ttype:P,lper:M,gper:K,lnum:R,gnum:O,ldt:o,gdt:N,rows:AJ,cond:AE,ftaskid:F,totaskid:L,frompos:D,topos:X,pubdate1:u,pubNode:Y,comp:B}});this.dstore.on("load",this.setId,this)},setId:function(N,H,B){var D=Wtf.getCmp(this.id);if(D){var g=H[0].json.nodeId;if(g!="1"){var K=g.split(",");for(var S in this.nodeArray){var O=S.split("/");for(var b=0;b<K.length-1;b++){var X=K[b].split("/");if(O[1]==X[0]){Wtf.getCmp(S).destroy();var C=(this.nodeArray[S]).split(this.split);var M=C[0];var W=C[1];var f=C[2];var L=C[3];var o=C[4];var d=C[5]+"_"+X[1];var a=O[0]+"/"+X[1];var Z=C[6];if(Z=="note"){this.MyDropTarget.notes(M,W,o,L,f,X[1])}else{var J=new pedagogyBlock(this.MyDropTarget,this.cnt,"right"+this.id,M,W,f,L,o,d,a,Z,{mainobj:this});J.on("blockUp",this.MyDropTarget.panelmouseup,this.MyDropTarget);J.on("blockDown",this.MyDropTarget.panelmousedown,this.MyDropTarget);J.on("rightClick",this.MyDropTarget.onRightClick,{scope:this.MyDropTarget,blockId:a});this.addDragCmp(d,true)}nodeKey=a;delete this.nodeArray[S];this.nodeArray[nodeKey]=M+this.split+W+this.split+f+this.split+L+this.split+o+this.split+C[5]+this.split+Z}}}for(r1 in this.ruleArray){var Y=this.ruleArray[r1];var C=r1.split("_");var F=C[1].split("/");var A=C[2].split("/");var l,e;for(var b=0;b<K.length-1;b++){var X=K[b].split("/");if(F[1]==X[0]){l=F[0]+"/"+X[1]+"/"+F[2]+"/"+X[1];C[1]=l}else{l=C[1]}if(A[1]==X[0]){e=A[0]+"/"+X[1]+"/"+A[2]+"/"+X[1];C[2]=e}else{e=C[2]}var n=C[0]+"_"+l+"_"+e;delete this.ruleArray[r1];this.ruleArray[n]=Y}}for(var T in this.linkArrayObj){var C=T.split("_");var F=C[0].split("/");var A=C[1].split("/");var G=false,U=false;var l=null,e=null;for(var b=0;b<K.length-1;b++){var X=K[b].split("/");if(F[1]==X[0]&&G==false){l=F[0]+"/"+X[1]+"/"+F[2]+"/"+X[1];G=true;continue}else{if(A[1]==X[0]&&U==false){e=A[0]+"/"+X[1]+"/"+A[2]+"/"+X[1];U=true}}}if(l==null){l=C[0]}else{if(e==null){e=C[1]}}if(G==true||U==true){var n=l+"_"+e;var V=this.linkArrayObj[T];delete this.linkArrayObj[T];var I="tempp_"+T;Wtf.get(I).remove();this.linkArrayObj[n]=V;this.MyDropTarget.AttachNewlink(n,l,e)}}for(var T in this.pubArray){var l;for(var b=0;b<K.length-1;b++){var X=K[b].split("/");if(T==X[0]){l=X[1];var R=this.pubArray[T];delete this.pubArray[T];this.pubArray[l]=R}}}for(T in this.nodeArray){var E=T.split("/");var Q=false;var P=(this.nodeArray[T]).split(this.split);for(var b=0;b<this.root.childNodes.length;b++){if(E[1]==this.root.childNodes[b].id){Q=true;break}}if(Q==false){if(E[0]=="custom"){this.root.appendChild(new Wtf.tree.TreeNode({id:E[1],iconCls:"file",cls:"sectionclass",text:P[4],expanded:true}))}else{if(E[0]=="assess"){this.root.appendChild(new Wtf.tree.TreeNode({id:E[1],iconCls:"quiz",cls:"quizclass",text:P[4],expanded:true,owner:true,auth:loginid}))}}}}}if(this.close==1){mainPanel.remove(mainPanel.getActiveTab().id)}}},retrieveDbContent:function(){this.retstore.load({params:{flag:"2",courseid:this.courseid}})},hload:function(N,G,C){var V=0;var A=Wtf.decode(G[0].json.Details);var F=Wtf.decode(G[1].json.Lines);var E=Wtf.decode(G[2].json.Rules);if(A.clas!=null){var S=A.clas.length;for(var W=0;W<S;W++){var M=A.xpos[W];var X=A.ypos[W];var a=A.clas[W];var D=A.nodeid[W];var O=A.nodetext[W];var e=A.height[W];var I=A.width[W];var b="";if(a=="cust1"){b="assess/"+D}else{if(a=="cust"){b="custom/"+D}else{if(a=="exitped"){b="exit/"+D}else{if(a=="retry"){b="retry/"+D}}}}if(a=="note"){b=D;this.MyDropTarget.notes(M,X,O,I,e,b)}else{var R=b.split("/");this.cnt=R[1];e=parseInt(e);I=parseInt(I);this.cnt=parseInt(this.cnt);var c=A.handle[W];c=c+"";var Z=c.split("_");var H=new pedagogyBlock(this.MyDropTarget,this.cnt,"right"+this.id,M,X,e,I,O,c,b,a,{mainobj:this});H.on("blockUp",this.MyDropTarget.panelmouseup,this.MyDropTarget);H.on("blockDown",this.MyDropTarget.panelmousedown,this.MyDropTarget);H.on("rightClick",this.MyDropTarget.onRightClick,{scope:this.MyDropTarget,blockId:b});nodeKey=b;this.nodeArray[nodeKey]=M+this.split+X+this.split+e+this.split+I+this.split+O+this.split+Z[0]+this.split+a;this.addDragCmp(c,true)}if(this.cnt>V){V=this.cnt}}this.cnt=V+1}if(F.totaskidpos!=null){var K=F.totaskidpos.length;for(var W=0;W<K;W++){var g=null,B=null;var P=F.fromtype[W];var d=F.totype[W];var J=F.totaskidpos[W];var L=F.fromtaskidpos[W];if(P=="custom"){g="custom/"+F.fromtaskid[W]+"/"+L+"/"+F.fromtaskid[W]}else{if(P=="assess"){g="assess/"+F.fromtaskid[W]+"/"+L+"/"+F.fromtaskid[W]}}if(d=="custom"){B="custom/"+F.totaskid[W]+"/"+J+"/"+F.totaskid[W]}else{if(d=="assess"){B="assess/"+F.totaskid[W]+"/"+J+"/"+F.totaskid[W]}else{if(d=="exit"){B="exit/"+F.totaskid[W]+"/"+J+"/"+F.totaskid[W]}else{if(d=="retry"){B="retry/"+F.totaskid[W]+"/"+J+"/"+F.totaskid[W]}}}}var l=g+"_"+B;var Y=F.fromtaskid[W];var Q=F.totaskid[W];if(E.fromtaskid!=null){for(var U=0;U<E.fromtaskid.length;U++){if(Y==E.fromtaskid[U]&&L==E.frompos[U]&&J==E.topos[U]&&Q==E.totaskid[U]){var T=(new Date(E.ldate[U])).format("m/d/y H:i:s");var f=(new Date(E.gdate[U])).format("m/d/y H:i:s");this.ruleArray["tempp_"+l]=E.lper[U]+"_"+E.gper[U]+"_"+E.lnum[U]+"_"+E.gnum[U]+"_"+T+"_"+f+"_"+E.rows[U]+"_"+E.cond[U]+"_"+E.frompos[U]+"_"+E.topos[U]+"_"+E.completed[U]}}}this.MyDropTarget.AttachNewlink(l,g,B)}}this.removeMyUnits()},onRowSelect:function(B,N,D){var C="",I="",A="",E="",J="",H="",L=0,M=0,G="";for(var F in this.ruleArray){if(F==this.lineId){M=1;var K=this.ruleArray[this.lineId].split("_");A=K[0];E=K[1];C=K[2];I=K[3];J=K[4];H=K[5];L=K[7];G=K[10]}}this.child1[N]=document.createElement("div");this.child1[N].id="con"+N;this.mchild[N]=document.createElement("div");this.mchild[N].className="mchild";this.bchild[N]=document.createElement("div");this.bchild[N].className="bchild";this.bchild[N].onclick=this.showRuleWin1.createDelegate(this);if(L==0){this.bchild[N].innerHTML="and "}else{this.bchild[N].innerHTML="or "}this.achild[N]=document.createElement("div");this.achild[N].className="achild";if(N==0){this.mchild[N].innerHTML="When attempts are less than ";if(M==1&&C!=-1){this.achild[N].innerHTML=C}else{this.achild[N].innerHTML=" number"}this.achild[N].id="ac"+N;this.achild[N].onclick=this.showRuleWinNum.createDelegate({scope:this,row:N})}if(N==1){this.mchild[N].innerHTML="When attempts are greater than ";if(M==1&&I!=-1){this.achild[N].innerHTML=I}else{this.achild[N].innerHTML=" number"}this.achild[N].id="ac"+N;this.achild[N].onclick=this.showRuleWinNum.createDelegate({scope:this,row:N})}if(N==2){this.mchild[N].innerHTML="When completed before specified ";if(M==1&&J!="01/01/70 00:00:00"){this.achild[N].innerHTML=J}else{this.achild[N].innerHTML=" date/time"}this.achild[N].id="ac"+N;this.achild[N].onclick=this.showRuleWinDate.createDelegate({scope:this,row:N})}if(N==3){this.mchild[N].innerHTML="When completed after specified ";if(M==1&&H!="01/01/70 00:00:00"){this.achild[N].innerHTML=H}else{this.achild[N].innerHTML=" date/time"}this.achild[N].id="ac"+N;this.achild[N].onclick=this.showRuleWinDate.createDelegate({scope:this,row:N})}if(N==4){this.mchild[N].innerHTML="When completed";this.achild[N].innerHTML="&nbsp";this.achild[N].className="abc"}if(N==5){this.mchild[N].innerHTML="When score is less than ";if(M==1&&A!=-1){this.achild[N].innerHTML=A+"%"}else{this.achild[N].innerHTML=" percentage"}this.achild[N].id="ac"+N;this.achild[N].onclick=this.showRuleWinPer.createDelegate({scope:this,row:N})}if(N==6){this.mchild[N].innerHTML="When score is greater than ";if(M==1&&E!=-1){this.achild[N].innerHTML=E+"%"}else{this.achild[N].innerHTML=" percentage"}this.achild[N].id="ac"+N;this.achild[N].onclick=this.showRuleWinPer.createDelegate({scope:this,row:N})}this.child1[N].appendChild(this.bchild[N]);this.child1[N].appendChild(this.mchild[N]);this.child1[N].appendChild(this.achild[N]);this.conContainer.appendChild(this.child1[N])},showRuleWinNum:function(){if(this.row==0){Wtf.MessageBox.prompt("Number Less Than","Please enter Number",this.scope.valNum,{scope:this.scope,row:this.row})}else{Wtf.MessageBox.prompt("Number Greater Than","Please enter Number",this.scope.valNum,{scope:this.scope,row:this.row})}},valNum:function(A,C){var B="^[1-9]+[0-9]*$";if(A=="ok"){if(C.match(B)!=null){if(this.row==0){this.scope.lnum=C;this.scope.achild[0].innerHTML=C}else{this.scope.gnum=C;this.scope.achild[1].innerHTML=C}}else{Wtf.MessageBox.alert("Warning","Please Enter Valid Number")}}},showRuleWinPer:function(){if(this.row==5){Wtf.MessageBox.prompt("Percentage","When score is less than",this.scope.valPercent,{scope:this.scope,row:this.row})}else{Wtf.MessageBox.prompt("Percentage","When score is greater than",this.scope.valPercent,{scope:this.scope,row:this.row})}},valPercent:function(B,A){var C="^100$|^[0-9]{1,2}$|^[0-9]{1,2},[0-9]{1,3}$";if(B=="ok"){if(A.match(C)!=null){if(this.row==5){this.scope.lper=A;this.scope.achild[5].innerHTML=A+"%"}else{this.scope.gper=A;this.scope.achild[6].innerHTML=A+"%"}}else{Wtf.MessageBox.alert("Warning","Please Enter Valid Percentage")}}},showRuleWinDate:function(){var B=new Wtf.Panel({frame:true,layout:"form",labelWidth:70,items:[df=new Wtf.form.DateField({width:175,id:"dfield",editable:false,fieldLabel:"Select Date",format:"m/d/Y"}),time=new Wtf.form.TimeField({width:100,id:"tfield",fieldLabel:"Enter Time"}),{buttons:[{text:"OK",scope:this,handler:function(){var H="^([1-9]|1[0-2]|0[1-9]){1}(:[0-5][0-9] [aApP][mM]){1}$";var E="^\d{1,2}/\d{1,2}/\d{2}$";var G=document.getElementById("dfield");var F=document.getElementById("tfield");if(F.value.match(H)!=null){if(G.value!=""){bdate=G.value+" "+F.value;var D=new Date(bdate).format("m/d/Y G:i:s");if(this.row==2){this.scope.ldt=D;this.scope.achild[2].innerHTML=bdate}else{this.scope.gdt=D;this.scope.achild[3].innerHTML=bdate}A.close()}else{Wtf.MessageBox.alert("Warning","Please Enter Valid Date")}}else{Wtf.MessageBox.alert("Warning","Please Enter Valid Time")}}},{text:"Cancel",handler:function(){A.close()}}]}]});var C=null;if(this.row==2){C="Before Date/Time"}else{C="After Date/Time"}var A=new Wtf.Window({title:C,width:300,iconCls:"winicon",resizable:false,autoDestroy:true,modal:true,border:false,items:[B]});A.show()},showRuleWin1:function(){var B=new Wtf.Panel({frame:true,items:[{layout:"form",items:[{layout:"column",items:[{html:"Apply Rule If:<br><br>"}]},{layout:"column",fieldWidth:0,items:[new Wtf.form.Radio({name:"cond",id:"and",checked:true,boxLabel:"All Conditions Match"})]},{layout:"column",fieldWidth:0,items:[new Wtf.form.Radio({name:"cond",id:"or",boxLabel:"Any One Condition Matches"})]}]},{layout:"column",items:[{layout:"form",buttons:[{text:"OK",scope:this,handler:function(){if(Wtf.getCmp("and").checked==true){this.rad=0}if(Wtf.getCmp("or").checked==true){this.rad=1}var C=this.sm.getSelections();var E="";for(i=0;i<C.length;i++){if(i==C.length-1){E+=this.store.find("company",C[i].data["company"])}else{E+=this.store.find("company",C[i].data["company"])+"/"}}var D=E.split("/");for(i=0;i<D.length;i++){if(this.rad==1){this.bchild[D[i]].innerHTML="or"}else{this.bchild[D[i]].innerHTML="and"}}A.close()}},{text:"Cancel",handler:function(){A.close()}}]}]}]});Wtf.getCmp("and").on("check",this.invRadiobttn,this);Wtf.getCmp("or").on("check",this.invRadiobttn,this);var A=new Wtf.Window({title:"And/Or",closable:true,width:200,iconCls:"winicon",resizable:false,autoDestroy:true,modal:true,border:false,id:"conditionWindow",items:[B]});A.show();A.on("render",this.selectRadiobttn,this)},invRadiobttn:function(B,A){if(B.id=="and"){Wtf.getCmp("or").checked=false}if(B.id=="or"){Wtf.getCmp("and").checked=false}},selectRadiobttn:function(){for(var B in this.ruleArray){if(B==this.lineId){var A=this.ruleArray[this.lineId].split("_");if(A[7]==1){Wtf.getCmp("or").checked=true}else{(A[7]==0)}Wtf.getCmp("and").checked=true}}},onRowDeselect:function(A,C,B){document.getElementById("parentCon").removeChild(document.getElementById("con"+C))},showRuleManager:function(B,A,E){if(E=="assess"){this.store.removeAll();this.store.loadData(this.assessCon)}else{this.store.removeAll();this.store.loadData(this.secCon)}var C=new Wtf.Panel({id:"feed",layout:"column",frame:true,items:[{columnWidth:1,layout:"form",html:"Select your Conditions and Actions First,then specify the Value in the Description<br>"},{columnWidth:1,layout:"form",bodyStyle:"margin-top:10px;",border:false,cls:"fontsize",layoutConfig:{labelSeparator:""},items:[new Wtf.form.FieldSet({height:140,layout:"fit",id:"rules",title:"1.Select the conditions for your rule",items:[this.grid=new Wtf.grid.GridPanel({id:"rulegrid",store:this.store,cm:this.cm,sm:this.sm,viewConfig:{forceFit:true,autoFill:true}})]}),new Wtf.form.FieldSet({height:155,id:"subrules",title:"2.Rule Description(click on an underlined value to edit it)",items:[new Wtf.Panel({id:"addCon",contentEl:this.conContainer})]}),{buttons:[{text:"Reset",scope:this,handler:function(){this.sm.clearSelections()}},{text:"Apply",scope:this,handler:function(){if(this.sm.getCount()>0){var G=this.sm.getSelections();var K="";for(var N=0;N<G.length;N++){var M=this.store.find("company",G[N].data["company"]);switch(M){case 0:if(this.lnum==-1){K+="this.lnum!=-1 &&"}break;case 1:if(this.gnum==-1){K+="this.gnum!=-1 &&"}break;case 2:if(this.ldt=="01/01/70 00:00:00"){K+="this.ldt!='01/01/70 00:00:00' &&"}break;case 3:if(this.gdt=="01/01/70 00:00"){K+="this.gdt!='01/01/70 00:00:00' &&"}break;case 5:if(this.lper==-1){K+="this.lper!=-1 &&"}break;case 6:if(this.gper==-1){K+="this.gper!=-1 &&"}break}}K=K.substring(0,K.length-2);if(!K){var H=false;var I="",L="",J="";L=this.lineId.split("_")[1].split("/")[2];J=this.lineId.split("_")[2].split("/")[2];this.selboxes=this.sm.getSelections();for(i=0;i<this.selboxes.length;i++){var M=this.store.find("company",this.selboxes[i].data["company"]);if(i==this.selboxes.length-1){I+=M}else{I+=M+"/"}}if(this.sm.isSelected(0)==false){this.lnum=-1}if(this.sm.isSelected(1)==false){this.gnum=-1}if(this.sm.isSelected(2)==false){this.ldt="01/01/70 00:00:00"}if(this.sm.isSelected(3)==false){this.gdt="01/01/70 00:00:00"}if(this.sm.isSelected(4)==false){this.comp=-1}else{this.comp=1}if(this.sm.isSelected(5)==false){this.lper=-1}if(this.sm.isSelected(6)==false){this.gper=-1}this.ruleArray[this.lineId]=this.lper+"_"+this.gper+"_"+this.lnum+"_"+this.gnum+"_"+this.ldt+"_"+this.gdt+"_"+I+"_"+this.rad+"_"+L+"_"+J+"_"+this.comp;this.sm.clearSelections();D.close();var F=((this.lineId).split("_"))[1].split("/");this.MyDropTarget.flushLink(F[0]+"/"+F[1])}else{msgBoxShow(["Information","You cannot leave the field blank!<br>Enter a Value"],Wtf.MessageBox.INFO)}}else{msgBoxShow(["Information","Select at least one condition"],Wtf.MessageBox.INFO)}}},{text:"Cancel",scope:this,handler:function(){this.sm.clearSelections();D.close()}}]}]}]});this.grid.on("render",this.selectCheckboxes,this);var D=new Wtf.Window({title:"Rule Manager",id:"rulemanager",iconCls:"winicon",closable:true,modal:true,resizable:false,width:420,items:[C]});D.show();D.on("beforeclose",this.onRuleManClose,this)},onRuleManClose:function(){this.sm.clearSelections()},selectCheckboxes:function(){for(var C in this.ruleArray){if(C==this.lineId){var A=this.ruleArray[this.lineId].split("_");var B=A[6].split("/");for(i=0;i<B.length;i++){this.sm.selectRow(B[i],true)}}}}});MyDragZone=function(B,A){A=A||{};Wtf.apply(A,{ddel:document.createElement("div")});MyDragZone.superclass.constructor.call(this,B,A)};Wtf.extend(MyDragZone,Wtf.dd.DragZone,{getDragData:function(B){var A=Wtf.get(B.getTarget());if(A.hasClass("dd-ct")){return false}return{ddel:this.ddel,item:A}},onInitDrag:function(A){this.ddel.innerHTML=this.dragData.item.dom.innerHTML;this.ddel.className=this.dragData.item.dom.className;this.ddel.style.width=this.dragData.item.getWidth()+"px";this.proxy.update(this.ddel)},getRepairXY:function(B,A){A.item.highlight("#e8edff");return A.item.getXY()}});MyDropTarget=function(B,A){this.mainobj=A.mainobj;MyDropTarget.superclass.constructor.call(this,B,A);this.split=this.mainobj.split};Wtf.extend(MyDropTarget,Wtf.dd.DropTarget,{notifyDrop:function(O,M,I){var J=I.item.id;var N=I.item.id.split("_");var P=new String(N[1]);var G=P.split("/");var K=M.getPageX()-Wtf.get("right"+this.mainobj.id).getLeft();var E=M.getPageY()-Wtf.get("right"+this.mainobj.id).getTop();if(N[1]=="primi"+this.mainobj.id||G[0]=="myun"){if(N[1]=="primi"+this.mainobj.id){if(J=="section_primi"+this.mainobj.id){this.drop(M,1,I)}else{if(J=="retry_primi"+this.mainobj.id){this.drop(M,2,I)}else{if(J=="assessment_primi"+this.mainobj.id){this.drop(M,3,I)}else{if(J=="exit_primi"+this.mainobj.id){this.drop(M,4,I)}else{if(J=="note_primi"+this.mainobj.id){var D=this.mainobj.cnt;this.notes(K,E,"","100","75",D)}}}}}}else{var C=Wtf.get(J);C.remove();var C=Wtf.get(J);C.remove();var A=J.split("/");if(A[0]=="section_myun"){this.drop(M,1,I)}else{if(A[0]=="assessment_myun"){this.drop(M,3,I)}}}}else{var B=O.id.split("_");var C=Wtf.get("lab"+B[1]);switch(B[0]){case"handle":var L="custom/"+B[1];var H=this.mainobj.nodeArray[L];var F=H.split(this.split);this.mainobj.nodeArray[L]=K+this.split+E+this.split+F[2]+this.split+F[3]+this.split+F[4]+this.split+F[5]+this.split+F[6];Wtf.getCmp(L).setPosition(K,E);this.flushLink(L);break;case"ahandle":var L="assess/"+B[1];var H=this.mainobj.nodeArray[L];var F=H.split(this.split);this.mainobj.nodeArray[L]=K+this.split+E+this.split+F[2]+this.split+F[3]+this.split+F[4]+this.split+F[5]+this.split+F[6];Wtf.getCmp(L).setPosition(K,E);this.flushLink(L);break;case"retryhandle":var L="retry/"+B[1];var H=this.mainobj.nodeArray[L];var F=H.split(this.split);this.mainobj.nodeArray[L]=K+this.split+E+this.split+F[2]+this.split+F[3]+this.split+F[4]+this.split+F[5]+this.split+F[6];Wtf.getCmp(L).setPosition(K,E);this.flushLink(L);break;case"exithandle":var L="exit/"+B[1];var H=this.mainobj.nodeArray[L];var F=H.split(this.split);this.mainobj.nodeArray[L]=K+this.split+E+this.split+F[2]+this.split+F[3]+this.split+F[4]+this.split+F[5]+this.split+F[6];Wtf.getCmp(L).setPosition(K,E);this.flushLink(L);break}}return true},drop:function(L,M,H){var J;var I=L.getPageX()-Wtf.get("right"+this.mainobj.id).getLeft();var C=L.getPageY()-Wtf.get("right"+this.mainobj.id).getTop();var D=(H.item.id).split("/");var O=H.item.dom.alt;switch(M){case 1:if(D[1]==null){var B="custom/"+this.mainobj.cnt;var A="handle_"+this.mainobj.cnt}else{var B="custom/"+D[1];var A="handle_"+D[1]}var K="cust";var G="handle";break;case 2:var B="retry/"+this.mainobj.cnt;var K="retry";var A="retryhandle_"+this.mainobj.cnt;var G="retryhandle";break;case 3:if(D[1]==null){var B="assess/"+this.mainobj.cnt;var A="ahandle_"+this.mainobj.cnt}else{var B="assess/"+D[1];var A="ahandle_"+D[1]}var K="cust1";var G="ahandle";break;case 4:var B="exit/"+this.mainobj.cnt;var K="exitped";var A="exithandle_"+this.mainobj.cnt;var G="exithandle";break}var N=63;var E=150;var F=new pedagogyBlock(this,this.mainobj.cnt,"right"+this.mainobj.id,I,C,63,150,O,A,B,K,{mainobj:this.mainobj});F.on("blockUp",this.panelmouseup,this);F.on("blockDown",this.panelmousedown,this);if(H.item.id.match("primi")!=null){nodeType="primi"}else{nodeType="myun"}F.on("rightClick",this.onRightClick,{scope:this,blockId:B,type:nodeType});this.mainobj.addDragCmp(A,true);this.mainobj.cnt++;J=B;this.mainobj.nodeArray[J]=I+this.split+C+this.split+N+this.split+E+this.split+O+this.split+G+this.split+K},notes:function(G,C,K,J,L,D){this.noteWin=new Wtf.Window({title:"Note",width:J,height:L,minHeight:50,minWidth:100,closable:true,id:"note/"+D,collapsible:true,renderTo:"right"+this.mainobj.id,items:[this.txtPanel=new Wtf.Panel({layout:"fit",items:[this.noteText=new Wtf.form.TextArea({id:"noteText"+D,value:K,layout:"fit"})]})]});this.noteWin.setPosition(G,C);this.noteWin.show();this.noteWin.addListener("bodyresize",this.winResize,this);this.noteWin.addListener("close",this.noteDelete,this);this.noteWin.addListener("move",this.noteMove,this);var H=this.noteWin.getSize();var M=H.height;var E=H.width;var N="hello";var I="note";var F="noteHandle";this.mainobj.cnt++;var A="note/"+this.noteWin.id;var B=this.noteWin.id;this.mainobj.nodeArray[B]=G+this.split+C+this.split+M+this.split+E+this.split+N+this.split+F+this.split+I},winResize:function(E,G,C){var H=(E.id).split("/");var B=Wtf.getCmp("noteText"+H[1]);B.setSize((G-14),(C-36));var A=E.id;var D=this.mainobj.nodeArray[A];var F=D.split(this.split);this.mainobj.nodeArray[A]=F[0]+this.split+F[1]+this.split+C+this.split+G+this.split+F[4]+this.split+F[5]+this.split+F[6]},noteDelete:function(B){var A=B.id;delete this.mainobj.nodeArray[A]},noteMove:function(D,B,F){var A=D.id;var C=this.mainobj.nodeArray[A];var E=C.split(this.split);this.mainobj.nodeArray[A]=B+this.split+F+this.split+E[2]+this.split+E[3]+this.split+E[4]+this.split+E[5]+this.split+E[6]},panelmouseup:function(B,C){this.mainobj.toblock=C;if(this.mainobj.todiv!=null){if(this.mainobj.todiv!=""){var A=this.mainobj.fromblock+"/"+this.mainobj.fromdiv+"_"+this.mainobj.toblock+"/"+this.mainobj.todiv;if(this.mainobj.X1>0){this.mainobj.X2=B.getPageX();this.mainobj.Y2=B.getPageY();this.AttachNewlink(A,this.mainobj.fromblock+"/"+this.mainobj.fromdiv,this.mainobj.toblock+"/"+this.mainobj.todiv);this.mainobj.X1=0}}}},panelmousedown:function(A,B){this.mainobj.fromblock=B},onRightClick:function(A,C){var B=C.split("/");this.menu=new Wtf.menu.Menu({id:"context",items:[{id:"delete",icon:"images/Delete.gif",text:"Delete",scope:this,handler:this.scope.deleteSection},{id:"publishdate",text:"Set publish date",icon:"images/office.png",scope:this,handler:this.scope.mainobj.editor.showExpiryScreen},{id:"duration",text:"Set Duration",icon:"images/document.png",scope:this,handler:this.scope.setDuration}]});if(B[0]=="custom"){Wtf.getCmp("duration").hide()}else{if(B[0]=="exit"||B[0]=="retry"){Wtf.getCmp("duration").hide();Wtf.getCmp("publishdate").hide()}}this.menu.showAt(A.getXY());A.preventDefault()},setDuration:function(){Wtf.MessageBox.prompt("Time Limit","Time limit for Quiz in min",this.lessperval1);Wtf.MessageBox.setIcon("url(../images/lms/Krawler.png)")},lessperval1:function(A,C){var B="^[1-9]+[0-9]*$";if(bt=="ok"){if(C.match(B)!=null){}else{Wtf.MessageBox.alert("Warning","Please Enter Valid Number")}}},deleteSection:function(){var D=this.blockId.split("/");for(var G in this.scope.mainobj.linkArrayObj){var A=G.split("_");var K=A[0].split("/");var F=A[1].split("/");var C=this.blockId.split("/");if(K[1]==C[1]||F[1]==C[1]){delete this.scope.mainobj.linkArrayObj[G];delete this.scope.mainobj.ruleArray["tempp_"+G];var L="tempp_"+G;if(Wtf.get(L)!=null){Wtf.get(L).remove()}}}var M=this.blockId.split("/");var B=Wtf.get("lab"+M[1]);if(B!=null){var I=this.type;if(I=="primi"||M[0]=="exit"||M[0]=="retry"){delete this.scope.mainobj.nodeArray[this.blockId]}else{if(this.scope.mainobj.tabpanel.getActiveTab().id=="myunity"){if(M[0]=="custom"){new Wtf.ux.WtfButton({caption:B.dom.innerHTML,imgSrc:"images/lms/logo1.png",ID:"section_myun/"+D[1],IDM:"section_myun/"+D[1],renderTo:"myun"+this.scope.mainobj.id});this.scope.mainobj.addDragCmp("section_myun/"+D[1],true)}else{new Wtf.ux.WtfButton({caption:B.dom.innerHTML,imgSrc:"images/lms/assessment.png",ID:"assessment_myun/"+D[1],IDM:"assessment_myun/"+D[1],renderTo:"myun"+this.scope.mainobj.id});this.scope.mainobj.addDragCmp("assessment_myun/"+D[1],true)}this.scope.mainobj.myUnitcount++}delete this.scope.mainobj.nodeArray[this.blockId];var J=this.scope.mainobj.tmp.length;for(var H=0;H<this.scope.mainobj.mytree.root.childNodes.length;H++){if(this.scope.mainobj.mytree.root.childNodes[H].id==D[1]){this.scope.mainobj.tmp[J]=this.scope.mainobj.mytree.root.childNodes[H];this.scope.mainobj.tabflag=0;break}else{if(this.scope.mainobj.mytree.root.childNodes[H].childNodes!=null){for(var E=0;E<this.scope.mainobj.mytree.root.childNodes[H].childNodes.length;E++){if(this.scope.mainobj.mytree.root.childNodes[H].childNodes[E].id==D[1]){this.scope.mainobj.tmp[J]=this.scope.mainobj.mytree.root.childNodes[H].childNodes[E];this.scope.mainobj.tabflag=0;break}}}}}}}Wtf.get(this.blockId).remove()},flushLink:function(B){for(var F in this.mainobj.linkArrayObj){var E=F.split("_");var D=E[0].split("/");var C=E[1].split("/");if((D[0]+"/"+D[1])==B||(C[0]+"/"+C[1]==B)){var A="tempp_"+F;if(Wtf.get(A)!=null){Wtf.get(A).remove()}this.AttachNewlink(F,E[0],E[1])}}},AttachNewlink:function(D,G,U){var R,B,P,A;var O=G.split("/");var L=U.split("/");if(O[1]!=L[1]){if(O[0]=="custom"||O[0]=="assess"){var L=U.split("/");G=O[2]+"/"+O[3]+"_"+this.mainobj.id;U=L[2]+"/"+L[3]+"_"+this.mainobj.id;var F=D;var M=new Wtf.Panel({id:"tempp_"+F,cls:"line",renderTo:"right"+this.mainobj.id});var V="tempp_"+F;var H=new jsGraphics(V);this.mainobj.linkArrayObj[D]=H;var K=0;this.mainobj.js.clear();H.clear();for(var N in this.mainobj.ruleArray){if(N==V){K=1;break}else{K=0}}if(K==1){H.setColor("#454647");H.setStroke(2)}else{H.setColor("#939599");H.setStroke(2)}var T=(Wtf.get(G).first()).getX()-Wtf.get("right"+this.mainobj.id).getX();var Q=(Wtf.get(G).first()).getY()-Wtf.get("right"+this.mainobj.id).getY();var C=T+8;var J=Q+9;var X=(Wtf.get(U).first()).getX()-Wtf.get("right"+this.mainobj.id).getX();var W=(Wtf.get(U).first()).getY()-Wtf.get("right"+this.mainobj.id).getY();var Y=X+3;var E=W;M.setPosition(C,J);Wtf.get(V).addListener("dblclick",this.lineclick,{scope:this,lineId:V});Wtf.get(V).on("contextmenu",this.rightclick,{scope:this,lineId:V});var S=G.charAt(0);var I=U.charAt(0);switch(S){case"s":B=J+15;R=C;H.drawLine(C,J,C,B);break;case"w":R=C-15;B=J;H.drawLine(C,J,R,B);break;case"e":R=C+15;B=J;H.drawLine(C,J,R,B);break;case"t":R=C;B=J-15;H.drawLine(C,J,R,B);break}switch(I){case"t":P=Y+6;A=E-15;H.drawLine(P,E,P,A);H.fillPolygon(new Array(Y+6,Y+1,Y+11),new Array(E+5,E,E));break;case"w":P=Y-15;A=E+9;H.drawLine(Y,A,P,A);H.fillPolygon(new Array(Y-2,Y+3,Y-2),new Array(A+5,A,A-5));break;case"e":P=Y+30;A=E+9;H.drawLine(Y+15,A,P,A);H.fillPolygon(new Array(Y+15,Y+10,Y+15),new Array(A-5,A,A+5));break;case"s":P=Y+6;A=E+33;H.drawLine(P,E+18,P,A);H.fillPolygon(new Array(Y+1,Y+6,Y+11),new Array(E+18,E+13,E+18));break}H.drawLine(R,B,P,A);H.paint()}this.todiv=""}},rightclick:function(A){var B=new Wtf.menu.Menu({id:"context",items:[{id:"delete",icon:"images/Delete.gif",text:"Delete",scope:this,handler:this.scope.deleteLine},{id:"apply",text:"Set Rule",icon:"images/document.png",scope:this,handler:this.scope.lineclick}]});B.showAt(A.getXY());A.preventDefault()},deleteLine:function(){var B=this.lineId.split("_");var A=B[1]+"_"+B[2];delete this.scope.mainobj.linkArrayObj[A];delete this.scope.mainobj.ruleArray[this.lineId];Wtf.getCmp(this.lineId).destroy()},lineclick:function(){this.scope.mainobj.rad=0;this.scope.mainobj.lper=-1;this.scope.mainobj.gper=-1;this.scope.mainobj.lnum=-1;this.scope.mainobj.gnum=-1;this.scope.mainobj.ldt="01/01/70 00:00:00";this.scope.mainobj.gdt="01/01/70 00:00:00";this.scope.mainobj.lineId=this.lineId;this.scope.mainobj.comp=-1;for(var D in this.scope.mainobj.ruleArray){if(D==this.lineId){var E=this.scope.mainobj.ruleArray[this.lineId].split(this.split);this.scope.mainobj.rad=0;this.scope.mainobj.lper=E[0];this.scope.mainobj.gper=E[1];this.scope.mainobj.lnum=E[2];this.scope.mainobj.gnum=E[3];this.scope.mainobj.ldt=E[4];this.scope.mainobj.gdt=E[5];this.scope.mainobj.comp=E[10];break}}if(this.scope.mainobj.wincount==0){var C=this.lineId.split("_");var A=C[1].split("/");var B=A[0];if(A[0]=="assess"){this.scope.mainobj.showRuleManager(this.scope,this,B)}else{this.scope.mainobj.showRuleManager(this.scope,this,B)}}}});Wtf.prevTemp=function(A){Wtf.apply(this,A);this.exsCon=document.createElement("div");this.exsCon.className="exsCon";this.headerPanel=new Wtf.Panel({layout:"fit",border:false,baseCls:"header1"});this.contentPanel=new Wtf.Panel({cls:"content",autoScroll:true,layout:"fit",border:false,collapsible:true,contentEl:this.exsCon});this.previewContainer=new Wtf.Panel({layout:"border",border:false,bodyStyle:"background:transparent;",items:[{region:"north",cls:"northClass",layout:"fit",border:false,items:[this.headerPanel]},{region:"center",layout:"fit",border:false,items:[this.contentPanel]}]});Wtf.prevTemp.superclass.constructor.call(this,A)};Wtf.extend(Wtf.prevTemp,Wtf.Panel,{onRender:function(A){Wtf.prevTemp.superclass.onRender.call(this,A);this.add(this.previewContainer);this.addEvents({"unlockObject":true});this.loadMask=new Wtf.LoadMask(this.el.dom,{msg:"Saving.."});this.loadContent=new Wtf.LoadMask(this.el.dom,{msg:"Loading..."});if(this.cat){this.store=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["content"])});this.store.load({params:{flag:"5",nodeid:this.nid,courseid:this.cid,mode:this.lmode}});this.store.on("load",this.catReadFile,this)}else{if(this.quizView){this.getQuizInfo=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["quizid","maxmarks","totalques","score","attempts"])});this.getQuizInfo.load({params:{flag:17,nodeid:this.nid,userid:loginid,cid:this.scope.courseid}});this.getQuizInfo.on("load",this.showQuizInfo,this)}else{if(this.rquizView){this.getrQuizInfo=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["quizid","totalques","score","attempts"])});this.getrQuizInfo.load({params:{flag:28,nodeid:this.nid,cid:this.scope.courseid}});this.getrQuizInfo.on("load",this.showRquizInfo,this)}}}},catReadFile:function(C,D,A){content=(D[0].data.content);Wtf.getCmp(this.id).loadContent.hide();var B=("[Learning Object]:").length;var E="Section : "+(Wtf.getCmp(this.id).title).substring(B);Wtf.getCmp(this.id).headerPanel.body.dom.innerHTML="<div id='labelCont'><label class='prevLabel'>"+E+"</label></div>";Wtf.getCmp(this.id).contentPanel.body.dom.innerHTML=content},showQuizInfo:function(J,E,A){Wtf.getCmp(this.id).loadContent.hide();maxmarks=E[0].data.maxmarks;totques=E[0].data.totalques;if(totques<1){this.scope.stquiz.disable();this.scope.txt.setAttribute("flag",false);this.scope.msg=0}else{this.scope.msg=1;var L=this.scope.nodeInfo[this.node.attributes.id].split("_");if(parseInt(L[2])>=parseInt(this.node.attributes.attemp)&&this.node.attributes.attemp!=""){this.scope.stquiz.disable();this.scope.txt.setAttribute("flag",false)}else{this.scope.stquiz.enable()}}var N=document.createElement("div");N.className="insCon";var K=document.createElement("div");K.classname="quizins";K.innerHTML="<label class='quizhead'>Instructions :</label>";var H=document.createElement("div");H.className="ins";var F=document.createElement("div");F.className="ins";var M=document.createElement("div");M.className="detailCon";var B=document.createElement("div");B.classname="quizins";B.innerHTML="<label class='quizhead'>Details :</label>";var G=document.createElement("div");G.className="ins";var D=document.createElement("div");D.className="ins";var C=document.createElement("div");C.className="ins";score=E[0].data.score;if(score!=null){var I=E[0].data.attempts;var P=null;var O=1;if(I==0){P="1>You have not attempted this assessment."}else{H.innerHTML="<label class='quizlog'>1>Your highest score so far is : "+score+"%</label>";O=O+1;if(I==1){P=O+">You have attempted this assessment 1 time."}else{if(I>1){P=O+">You have attempted this assessment "+I+" times."}}}F.innerHTML="<label class='quizlog'>"+P+"</label>"}else{H.innerHTML="<label class='quizlog'>1>You cannot leave the assessment procedure once you start it.</label>";F.innerHTML="<label class='quizlog'>2>Any attempt to switch to other programs will result in termination of the quiz.</label>"}N.appendChild(K);N.appendChild(H);N.appendChild(F);G.innerHTML="<label class='quizlog'>1>Maximum Marks : "+maxmarks+"</label>";D.innerHTML="<label class='quizlog'>2>Time Limit is not set.</label>";C.innerHTML="<label class='quizlog'>3>Total Number of Questions : "+totques+"</label>";M.appendChild(B);M.appendChild(G);M.appendChild(D);M.appendChild(C);Wtf.getCmp(this.id).exsCon.appendChild(N);Wtf.getCmp(this.id).exsCon.appendChild(M)},showRquizInfo:function(H,D,A){Wtf.getCmp(this.id).loadContent.hide();totques=D[0].data.totalques;if(totques<1){this.scope.strquiz.disable();this.scope.txt.setAttribute("flag",false);this.scope.msg=0}else{this.scope.msg=1;var J=this.scope.nodeInfo[this.node.attributes.id].split("_");if(parseInt(J[2])>=parseInt(this.node.attributes.attemp)&&this.node.attributes.attemp!=""){this.scope.strquiz.disable();this.scope.txt.setAttribute("flag",false)}else{this.scope.strquiz.enable()}}var L=document.createElement("div");L.className="insCon";var I=document.createElement("div");I.classname="quizins";I.innerHTML="<label class='quizhead'>Instructions :</label>";var F=document.createElement("div");F.className="ins";var E=document.createElement("div");E.className="ins";var K=document.createElement("div");K.className="detailCon";var B=document.createElement("div");B.classname="quizins";B.innerHTML="<label class='quizhead'>Details :</label>";var C=document.createElement("div");C.className="ins";score=D[0].data.score;if(score!=null){var G=D[0].data.attempts;var N=null;var M=1;if(G==0){N="1>You have not attempted this assessment."}else{F.innerHTML="<label class='quizlog'>1>Your highest score so far is : "+score+"%</label>";M=M+1;if(G==1){N=M+">You have attempted this assessment 1 time."}else{if(G>1){N=M+">You have attempted this assessment "+G+" times."}}}E.innerHTML="<label class='quizlog'>"+N+"</label>"}else{F.innerHTML="<label class='quizlog'>1>You cannot leave the assessment procedure once you start it.</label>";E.innerHTML="<label class='quizlog'>2>Any attempt to switch to other programs will result in termination of the quiz.</label>"}L.appendChild(I);L.appendChild(F);L.appendChild(E);C.innerHTML="<label class='quizlog'>1>Total Number of Questions : "+totques+"</label>";K.appendChild(B);K.appendChild(C);Wtf.getCmp(this.id).exsCon.appendChild(L);Wtf.getCmp(this.id).exsCon.appendChild(K)}});Wtf.MyEditor=function(A){Wtf.apply(this,A);this.mycontenteditor=A.mycontenteditor;this.mode=A.mode;this.preview=new Wtf.prevTemp({border:false,cls:"prevPanel",layout:"fit"});this.editor=new Wtf.MyHtmlEditor({mycontenteditor:this.mycontenteditor});this.editorCon=new Wtf.Panel({layout:"fit",border:false,items:[this.editor]});this.edit=new Wtf.Toolbar.Button({text:"Editor",enableToggle:true,toggleGroup:"editorbttn",scope:this,handler:function(){this.preview.hide();this.editorCon.show();this.layout.activeItem=this.editorCon;this.doLayout()}});this.mstone=new Wtf.Toolbar.Button({text:"Mark as Completed",scope:this,handler:function(){Wtf.MessageBox.show({title:"Submit",msg:"Do you want to mark this section completed ?",buttons:Wtf.MessageBox.OKCANCEL,animEl:"upwin",icon:Wtf.MessageBox.QUESTION,scope:this,fn:function(C){if(C=="ok"){var D=(this.id).substring(3);var E=D.split("$");var B=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["nodes","nodeid","refnode"])});B.load({params:{flag:"23",secid:E[0],cmpflag:"1"}});B.on("load",this.result,this)}}})}});this.prevBtn=new Wtf.Toolbar.Button({scope:this,text:"Preview",enableToggle:true,toggleGroup:"editorbttn",handler:function(){var C="";var B=this.mycontenteditor.tabPanelContainer.getActiveTab().title;if(this.editor.saveflag==1){C=B.substr(0,B.length-1)}else{C=B}this.preview.headerPanel.body.dom.innerHTML="<div id='labelCont'><label class='prevLabel'>"+C+"</label></div>";this.preview.contentPanel.body.dom.innerHTML=this.editor.getValue();this.editorCon.hide();this.preview.show();this.layout.activeItem=this.preview;this.doLayout()}});this.pubBtn=new Wtf.Toolbar.Button({scope:this,text:"Publish",hidden:(Wtf.isContentDesigner()||(this.nodeidObj?false:true)),handler:function(){var E=this.ownerCt.getActiveTab().id;var B=Wtf.getCmp(E).editor.getValue();if(Wtf.getCmp(E).editor.save==0){if(this.nodeidObj){var D=this.nodeidObj;Wtf.getCmp(E).editor.save=1;Wtf.getCmp(E).editor.saveflag=0;this.autoSave=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["courseid"])});this.autoSave.load({params:{flag:"4",courseid:this.courseid,nodeid:D,content:B}});this.autoSave.on("load",function(){var F=this.ownerCt.getActiveTab().title;this.ownerCt.getActiveTab().setTitle(F.substring(0,F.length-1))},this);this.autoSave.on("loadException",function(){msgBoxShow(["Error","Error occurred while saving content, Please save before publish"],Wtf.MessageBox.ERROR)},this)}}if(Wtf.getCmp(E).editor.save==1||!(Wtf.getCmp(E).editor.save)){var C=(this.id).substring(3);this.publish=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"metagrid.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["success"])});this.publish.on("load",this.pubresp,this);this.publish.load({params:{flag:"6",loid:C,content:B}})}}});this.saveBtn=new Wtf.Toolbar.Button({scope:this,text:"Save",hidden:this.nodeidObj?false:true,handler:this.saveContent});Wtf.MyEditor.superclass.constructor.call(this,{hideMode:"display",layout:"fit",bbar:[this.edit,this.prevBtn,this.mstone,this.saveBtn,this.pubBtn,{text:"Unlock",hidden:(this.nodeidObj?false:true),scope:this,handler:function(){Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"GET",params:({objid:this.nodeidObj,flag:9}),scope:this,success:function(B,C){this.fireEvent("unlockObject");Wtf.MessageBox.show({title:"Success",msg:"Lock successfully released",buttons:Wtf.MessageBox.OK,fn:this.closeTab,scope:this,icon:Wtf.MessageBox.INFO})},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}}]});this.store2=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["content"])})};Wtf.extend(Wtf.MyEditor,Wtf.Panel,{onRender:function(A){Wtf.MyEditor.superclass.onRender.call(this,A);if(this.mode==1){this.edit.hide();this.prevBtn.hide();this.add(this.preview)}else{this.mstone.hide();this.add(this.editorCon,this.preview)}this.addEvents({"publishObject":true});this.loadMask=new Wtf.LoadMask(this.el.dom,{msg:"Saving.."});this.loadContent=new Wtf.LoadMask(this.el.dom,{msg:"Loading..."});this.store2.load({params:{flag:"5",nodeid:this.nid,courseid:this.cid,mode:this.lmode}});if(this.cid==""){this.store2.on("load",this.CatReadFile,this)}else{this.store2.on("load",this.ContReadFile,this)}},result:function(E,F,C){if(F[0].json.nodes[0]!=null){var B=this.mycontenteditor.root.childNodes.length;var A=this.mycontenteditor.root.childNodes;this.mycontenteditor.mytree.getRootNode().select();for(var D=0;D<B;D++){this.mycontenteditor.root.removeChild(A.shift())}this.mycontenteditor.loadNodes()}},closeTab:function(){this.ownerCt.remove(this)},pubresp:function(B,C,A){if(C[0].json.Success=="true"){this.fireEvent("publishObject");Wtf.MessageBox.alert("Status","Object published successfully")}else{if(C[0].json.Success=="false"){msgBoxShow(["Warning","There is no change to publish this object."])}else{Wtf.MessageBox.alert("Status","Problem in publishing content")}}},saveContent:function(){if(this.ownerCt.getActiveTab()!=null){var A=this.ownerCt.getActiveTab().id;var B=Wtf.getCmp(A).editor.getValue();if(this.nodeidObj){var C=this.nodeidObj;Wtf.getCmp(A).editor.save=1}else{var C=this.mytree.getSelectionModel().getSelectedNode().attributes.id}this.store1=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["courseid"])});this.store1.load({params:{flag:"4",courseid:this.courseid,nodeid:C,content:B}});this.store1.on("load",function(){msgBoxShow(["Success","Content saved successfully"],Wtf.MessageBox.INFO)},this);if(Wtf.getCmp(A).editor.saveflag==1){var D=this.ownerCt.getActiveTab().title;this.ownerCt.getActiveTab().setTitle(D.substring(0,D.length-1))}Wtf.getCmp(A).editor.saveflag=0}},ContReadFile:function(C,D,B){content=(D[0].data.content);if(this.mode==1){var A="tab"+this.node.attributes.id;if(Wtf.getCmp(A)){var E="Section : "+Wtf.getCmp(A).title;Wtf.getCmp(A).loadContent.hide();Wtf.getCmp(A).preview.headerPanel.body.dom.innerHTML="<div id='labelCont'><label class='prevLabel'>"+E+"</label></div>";Wtf.getCmp(A).preview.contentPanel.body.dom.innerHTML=content}}else{if(this.node.attributes.lobject=="1"&&!(loginid==this.node.attributes.auth)){var A="tab"+B.params.nodeid;if(Wtf.getCmp(A)){Wtf.getCmp(A).loadContent.hide();var E="Section : "+Wtf.getCmp(A).title;Wtf.getCmp(A).headerPanel.body.dom.innerHTML="<div id='labelCont'><label class='prevLabel'>"+E+"</label></div>";Wtf.getCmp(A).contentPanel.body.dom.innerHTML=content}}else{var A="tab"+B.params.nodeid;if(Wtf.getCmp(A)){Wtf.getCmp(A).loadContent.hide();Wtf.getCmp(A).editor.setValue(content)}}}},CatReadFile:function(D,E,B){content=(E[0].data.content);var A="tab"+B.params.nodeid;Wtf.getCmp(A).loadContent.hide();if(this.mode==1){var F="Section : "+Wtf.getCmp(A).title;Wtf.getCmp(A).preview.headerPanel.body.dom.innerHTML="<div id='labelCont'><label class='prevLabel'>"+F+"</label></div>";Wtf.getCmp(A).preview.contentPanel.body.dom.innerHTML=content}else{if(Wtf.getCmp(A)){Wtf.getCmp(A).editor.setValue(content)}else{A="tab"+this.getCombid(this.secid,this.vid);var C=("[Learning Object]:").length;var F="Section : "+(this.ownerCt.getActiveTab().title).substring(C);Wtf.getCmp(A).headerPanel.body.dom.innerHTML="<div id='labelCont'><label class='prevLabel'>"+F+"</label></div>";Wtf.getCmp(A).contentPanel.body.dom.innerHTML=content}}}});Wtf.lms.qBankGrid=function(A){Wtf.apply(this,A);this.store1=new Wtf.data.SimpleStore({fields:["abbr","state"],data:[["1","True/False"],["2","Multiple Choice"],["3","Fill in the Blank"],["4","Matching"],["5","Ranking"],["6","Multiple Response"]]});this.Task=Wtf.data.Record.create([{name:"taskid",type:"int"},{name:"type",type:"string",dataIndex:"type"},{name:"question",type:"string",dataIndex:"question"},{name:"feedback",type:"string",dataIndex:"feedback"},{name:"attempts",type:"int",dataIndex:"attempts"},{name:"points",type:"int",dataIndex:"points"},{name:"difficulty",type:"int",dataIndex:"difficulty"},{name:"shuffle",dataIndex:"shuffle"},{name:"timelimit",type:"int",dataIndex:"timelimit"},{name:"del123",dataIndex:"del"},{name:"quesid",dataIndex:"quesid",type:"string"}]);this.reader=new Wtf.data.JsonReader({totalProperty:"count",root:"data",fields:[{name:"quesid",type:"string"},{name:"question",type:"string"},{name:"difficulty",type:"string"},{name:"type",type:"string"},{name:"points",type:"float"},{name:"timelimit",type:"string"},{name:"shuffle",type:"string"},{name:"attempts",type:"string"},{name:"author",type:"string"},{name:"authorid",type:"string"},{name:"choice",type:"string"},{name:"correctans",type:"string"},{name:"tags",type:"string"},{name:"pic",type:"string"},{name:"feedback",type:"string"}]});this.sm=new Wtf.grid.CheckboxSelectionModel();this.ds=new Wtf.data.GroupingStore({url:"jspfiles/lms/qbankgrid.jsp",baseParams:{mode:0},reader:this.reader});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,hideGroupedColumn:false});this.expander=new Wtf.grid.RowExpander({tpl:new Wtf.Template("<br>","<p><b>Question:</b> {question}</p>","<br>","<p><b>Timelimit:</b> {timelimit}</p>","<br>","<p><b>Shuffle:</b> {shuffle}</p>","<br>","<p><b>Attempts:</b> {attempts}</p>")});this.cm=new Wtf.grid.ColumnModel([this.expander,this.sm,{header:"Question",dataIndex:"question",align:"left",sortable:true,groupable:true},{header:"Difficulty",dataIndex:"difficulty",align:"center",sortable:true,groupable:true},{header:"Type",dataIndex:"type",align:"center",sortable:true,groupable:true},{header:"Points",dataIndex:"points",align:"center",sortable:true,groupable:true},{header:"Author",dataIndex:"author",align:"center",sortable:true,groupable:true},{header:"Tags",dataIndex:"tags",sortable:true,groupable:true}]);this.cm.defaultSortable=true;this.truefalse=new Wtf.menu.Item({text:"True/False",icon:"images/s.gif",iconCls:"iconclass",scope:this,handler:function(){var B=this.id;Truefalseshowwin(this,this.ds,this.Task,null,B,1)}});this.mc=new Wtf.menu.Item({text:"Multiple Choice",icon:"images/s.gif",iconCls:"iconclass",scope:this,handler:function(){var B=this.id;MultipleShowWin(this,this.ds,this.Task,null,B,1)}});this.fill=new Wtf.menu.Item({text:"Fill in the blanks",icon:"images/s.gif",iconCls:"iconclass",scope:this,handler:function(){var B=this.id;FillBlankShowWin(this,this.ds,this.Task,null,B,1)}});this.match=new Wtf.menu.Item({text:"Matching",icon:"images/s.gif",iconCls:"iconclass",scope:this,handler:function(){var B=this.id;MatchingShowWin(this,this.ds,this.Task,null,B,1)}});this.rank=new Wtf.menu.Item({text:"Ranking",icon:"images/s.gif",iconCls:"iconclass",scope:this,handler:function(){var B=this.id;RankShowWin(this,this.ds,this.Task,null,B,1)}});this.mulres=new Wtf.menu.Item({text:"Multiple Response",icon:"images/s.gif",iconCls:"iconclass",scope:this,handler:function(){var B=this.id;MultipleResponseShowWin(this,this.ds,this.Task,null,B,1)}});this.quickSearchTF=new Wtf.KWLTagSearch({field:"tags",width:200});Wtf.lms.qBankGrid.superclass.constructor.call(this,{layout:"fit",items:[{layout:"border",border:false,autoWidth:true,items:[this.grid=new Wtf.grid.GridPanel({border:false,region:"center",store:this.ds,cm:this.cm,plugins:this.expander,sm:this.sm,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading Question Bank..."},tbar:["Search by Tags: ",this.quickSearchTF,"-",this.tagBttn=new Wtf.Toolbar.Button({text:"Edit Tags",scope:this,disabled:true,tooltip:{text:"Click to edit selected question"},handler:this.addTags}),"-",this.archiveBtn=new Wtf.Toolbar.Button({text:"Archive Questions",scope:this,disabled:true,hidden:(isRoleGroup("4"))?false:true,handler:this.archiveQues}),this.getArchived=new Wtf.Toolbar.Button({text:"Show Archived Questions",scope:this,hidden:(isRoleGroup("4"))?false:true,handler:this.archiveTab})]})]}],bbar:[this.pg=new Wtf.PagingSearchToolbar({pageSize:15,searchField:this.quickSearchTF,id:"paggintoolbar"+this.id,store:this.ds,scope:this,plugins:this.pP=new Wtf.common.pPageSize({id:"pPageSize_"+this.id}),items:["-",new Wtf.Toolbar.Button({text:"Add Questions",menu:{items:[this.truefalse,this.mc,this.fill,this.match,this.rank,this.mulres]}}),this.delBttn=new Wtf.Toolbar.Button({text:"Delete Question",scope:this,disabled:true,tooltip:{text:"Click to delete selected question"},handler:this.deleteQuestion}),this.expQues=new Wtf.Toolbar.Button({text:"Export Question",scope:this,disabled:true,handler:this.expQuestion,tooltip:{text:"Click to export selected question"}})]})]});this.ds.on("datachanged",function(){var B=this.pP.combo.value;this.quickSearchTF.setPage(B)},this)};Wtf.extend(Wtf.lms.qBankGrid,Wtf.Panel,{editMeta:null,flag:false,onRender:function(A){Wtf.lms.qBankGrid.superclass.onRender.call(this,A);this.ds.load({params:{start:0,limit:15}});this.grid.on("sortchange",function(B,C){this.grid.getStore().groupBy(C.field)},this);this.ds.on("load",this.handleStoreLoad,this);this.grid.on("rowdblclick",this.editQuestion,this);this.sm.addListener("selectionchange",this.rowSelectionHandler,this)},addTags:function(){this.RESWin=Wtf.data.Record.create([{name:"tagid",type:"string"},{name:"tagname",type:"string"},{name:"check",type:"string"}]);this.allResourcesWin=new Wtf.data.Store({url:Wtf.req.lms+"fetchTags.jsp",reader:new Wtf.data.JsonReader({root:"data",id:"res-reader"},this.RESWin)});this.MSComboconfigWin={store:this.allResourcesWin,displayField:"tagname",valueField:"tagid",triggerAction:"all",mode:"local"};this.allResourcesWin.load({params:{flag:0,nodeid:this.grid.getSelectionModel().getSelected().data["quesid"]}});this.tagWin=new Wtf.Window({title:"Add Tags",closable:true,modal:true,layout:"fit",iconCls:"win",width:400,height:120,scope:this,resizable:false,buttons:[{text:"OK",scope:this,handler:function(){Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"GET",params:({tags:this.multiWin.getValue(),flag:0,nodeid:this.grid.getSelectionModel().getSelected().data["quesid"],type:"ques"}),scope:this,success:function(A,B){this.ds.reload();this.tagWin.close()},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}},{text:"Cancel",scope:this,handler:function(){this.tagWin.close()}}],items:[this.form=new Wtf.form.FormPanel({url:"admin.jsp?",waitMsgTarget:true,method:"POST",border:false,bodyStyle:"margin-top:10px;margin-left:10px;font-size:10px;",items:[{layout:"column",border:false,items:[{columnWidth:0.8,labelWidth:50,border:false,layout:"form",items:[this.multiWin=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,fieldLabel:"Tags",width:150,forceSelection:true},this.MSComboconfigWin))]},{border:false,layout:"form",items:[{xtype:"button",text:"New Tag",scope:this,handler:function(){this.mbWin=new Wtf.Window({height:100,modal:true,title:"Edit Tags",width:250,scope:this,resizable:false,bodyStyle:"margin: 10px 0 0 10px;float: right;",items:[this.tagFieldWin=new Wtf.form.TextField({width:210,scope:this,validator:this.alphaNumCheck})],buttons:[{text:"OK",scope:this,handler:function(A,C){var B=this.tagFieldWin.getValue().trim();if(B.length>0&&this.tagFieldWin.isValid()){Wtf.Ajax.request({url:Wtf.req.lms+"fetchTags.jsp",method:"GET",params:({tag:this.tagFieldWin.getValue(),flag:1}),scope:this,success:function(D,E){this.allResourcesWin.reload()},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}});this.mbWin.close()}}},{text:"Cancel",scope:this,handler:function(){this.mbWin.close()}}]});this.mbWin.show()}}]}]}]})]});this.allResourcesWin.on("load",function(){var A=[];for(var B=0;B<this.allResourcesWin.getCount();B++){if(this.allResourcesWin.getAt(B).data["check"]==1){A.push(this.allResourcesWin.getAt(B).data["tagid"])}}this.multiWin.setValue(A)},this);this.tagWin.show()},alphaNumCheck:function(A){if(A.match(/^\w+[\w\s]*$/g)!=null){return true}else{return false}},getStore:function(){return this.ds},getColModel:function(){return this.cm},getSelModel:function(){return this.sm},rowSelectionHandler:function(){var A=this.sm.getSelections();if(A.length>0){this.delBttn.enable();this.archiveBtn.enable()}else{this.delBttn.disable();this.archiveBtn.disable()}if(A.length==1){this.tagBttn.enable();this.expQues.enable()}else{this.tagBttn.disable();this.expQues.disable()}},handleStoreLoad:function(A,C,B){if(A==this.ds){this.quickSearchTF.StorageChanged(A)}else{if(A=this.dsWin2){this.quickSearchTFContent.StorageChanged(A)}else{if(A=this.dsWin){this.quickSearchTFHidden.StorageChanged(A)}}}},addP:function(){this.hiddenGrid=new Wtf.grid.GridPanel({id:"gridCompo"+this.id,border:false,region:"south",store:this.dsWin,view:this.gV,name:"grid",height:240,width:590,cm:this.cmWin,sm:this.smWin,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading Content List..."},tbar:["Quick Search: ",this.quickSearchTFHidden=new Wtf.KWLQuickSearch({field:"nodetext",width:150})],bbar:[new Wtf.PagingToolbar({pageSize:10,id:"paggintoolbar"+this.id,store:this.dsWin,scope:this,plugins:new Wtf.common.pPageSize({id:"pPageSize_"+this.id})})]});Wtf.getCmp("addToCon").hide();this.southPanel.add(this.hiddenGrid);this.southPanel.doLayout();this.locWin.doLayout()},changeval:function(A){var C=A.getValue();var B=this.id;this.getfirstrow();switch(C){case"True/False":Truefalseshowwin(this,this.ds,this.Task,null,B,1);break;case"Multiple Choice":MultipleShowWin(this,this.ds,this.Task,null,B,1);break;case"Fill in the Blank":FillBlankShowWin(this,this.ds,this.Task,null,B,1);break;case"Matching":MatchingShowWin(this,this.ds,this.Task,null,B,1);break;case"Ranking":RankShowWin(this,this.ds,this.Task,null,B,1);break;case"Multiple Response":MultipleResponseShowWin(this,this.ds,this.Task,null,B,1);break}},editQuestion:function(A,C,B){type=this.ds.getAt(C).data["type"];switch(type){case"True/False":Truefalseshowwin(this,this.ds,this.Task,C,this.id,1);break;case"Multiple Choice":MultipleShowWin(this,this.ds,this.Task,C,this.id,1);break;case"Fill in the Blanks":FillBlankShowWin(this,this.ds,this.Task,C,this.id,1);break;case"Matching":MatchingShowWin(this,this.ds,this.Task,C,this.id,1);break;case"Ranking":RankShowWin(this,this.ds,this.Task,C,this.id,1);break;case"Multiple Response":MultipleResponseShowWin(this,this.ds,this.Task,C,this.id,1);break}},getfirstrow:function(){var B=this.ds.getCount();var A=new this.Task({type:"",question:"",feedback:"",attempts:"",points:"",difficulty:"",shuffle:"",timelimit:"",del123:""});this.ds.insert(B,A)},deleteQuestion:function(){Wtf.Msg.show({msg:"Are you sure you want to delete selected questions?",buttons:Wtf.Msg.YESNO,scope:this,fn:function(B,E){if(B=="yes"){var C=this.sm.getSelections();var D="";for(var A=0;A<C.length;A++){D+=C[A].data["quesid"]+"/"}if(D.length>0){D=D.substring(0,(D.length-1))}Wtf.Ajax.requestEx({url:Wtf.req.lms+"deleteQuestion.jsp",scope:this,params:{quesArray:D}},this,function(G,L){var H=Wtf.decode(G);if(H["res"]==0){this.ds.reload()}else{var J=H["res"];var F=J.split(",");var I="";for(var K=0;K<F.length;K++){I+=F[K]+"<br>"}Wtf.MessageBox.show({title:"Warning",msg:"Some questions could not be deleted either because they are being used in a published quiz or because you do not have the necessary permissions",buttons:Wtf.MessageBox.OK,scope:this,animEl:"ok",fn:function(){this.ds.reload()},icon:Wtf.MessageBox.WARNING})}})}},icon:Wtf.MessageBox.QUESTION})},archiveQues:function(){Wtf.Msg.show({msg:"Do you want to archive selected questions?",buttons:Wtf.Msg.YESNO,scope:this,fn:function(B,E){if(B=="yes"){var C=this.sm.getSelections();var D="";for(var A=0;A<C.length;A++){D+=C[A].data["quesid"]+"/"}if(D.length>0){D=D.substring(0,(D.length-1))}Wtf.Ajax.request({url:Wtf.req.lms+"qbankgrid.jsp",method:"GET",params:({mode:5,qids:D}),scope:this,success:function(F){if(F.responseText.trim()=="true"){this.ds.reload();msgBoxShow(["Success","Questions archived successfully."],Wtf.MessageBox.INFO)}else{msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}},failure:function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}})}},icon:Wtf.MessageBox.QUESTION})},archiveTab:function(){var A="arcTab"+this.id;this.openTab(A,Wtf.lms.arcQBank,{id:A,title:"Archived Questions",border:false,layout:"fit",closable:true})},openTab:function(D,B,A){var C=Wtf.getCmp(D);if(!C){C=new B(A);this.ownerCt.add(C);this.ownerCt.doLayout()}this.ownerCt.setActiveTab(C);C.on("resQuestion",function(){this.ds.reload()},this)},expQuestion:function(){var A="tab"+this.sm.getSelected().get("quesid");setDldUrl("QuestionExport.jsp?qid="+A.substr(3,A.length))}});Wtf.createNewAssignment=function(A){this.mode=A.mode;this.assTypeStore=new Wtf.data.JsonStore({root:"data",fields:["asstypeid","assname"],url:"jspfiles/admin/assignment.jsp"});this.subTypeStore=new Wtf.data.SimpleStore({data:[["Individual","0"],["Team","1"]],fields:["type","id"],reader:new Wtf.data.ArrayReader({},[{name:"type"},{name:"id"}]),autoLoad:true});Wtf.createNewAssignment.superclass.constructor.call(this,{title:this.mode=="1"?"Edit Assignment":"Add Assignment",closable:true,modal:true,iconCls:"win",width:400,height:320,resizable:false,buttonAlign:"center",buttons:[{text:this.mode=="1"?"Edit":"Create",scope:this,handler:function(){if(this.sendForm.form.isValid()){this.sendForm.form.submit({waitMsg:"Loading...",scope:this,params:{mode:this.mode},failure:function(C,B){var D=Wtf.decode(B.response.responseText);msgBoxShow(["Failure",D.data[0].msg],Wtf.MessageBox.INFO)},success:function(C,B){var D=Wtf.decode(B.response.responseText);Wtf.MessageBox.show({title:"Success",msg:D.data[0].msg,buttons:Wtf.MessageBox.OK,scope:this,fn:function(){this.fireEvent("addAss");this.close()},icon:Wtf.MessageBox.INFO})}})}}},{text:"Cancel",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.png",this.mode=="1"?"Edit Assignment/Project":"Add Assignment/Project","Enter assignment details")},{region:"center",border:false,bodyStyle:"background:#f1f1f1;font-size:10px;border-bottom:1px solid #bfbfbf;",layout:"fit",items:[this.sendForm=new Wtf.form.FormPanel({url:"jspfiles/admin/assignment.jsp?action=24",waitMsgTarget:true,method:"POST",border:false,fileUpload:true,labelWidth:120,height:150,bodyStyle:"margin: 10px 0 0 10px;font-size : 10px;",defaults:{width:200},defaultType:"textfield",items:[this.nameField=new Wtf.form.TextField({fieldLabel:"Assignment Name*",name:"assignmentname",allowBlank:false,maxLength:50,validator:function(B){if(B.search("/")==-1){return true}else{return"Assignment name should not contain a /"}}}),this.desc=new Wtf.form.TextArea({fieldLabel:"Description*",height:80,allowBlank:false,maxLength:1024,name:"description"}),this.assFile=new Wtf.form.TextField({fieldLabel:"Assignment File*",inputType:"file",name:"filepath",allowBlank:false}),this.hidden1=new Wtf.form.Hidden({name:"assignmentid"})]})]}]})};Wtf.extend(Wtf.createNewAssignment,Wtf.Window,{onRender:function(A){Wtf.createNewAssignment.superclass.onRender.call(this,A);this.addEvents={"addAss":true}}});Wtf.assignmentBankGrid=function(A){Wtf.apply(this,A);this.quickSearchTF=new Wtf.KWLTagSearch({field:"assignmentname",width:200});this.assignmentStore=new Wtf.data.JsonStore({url:"jspfiles/admin/assignment.jsp",totalProperty:"count",root:"data",fields:["assignmentid","assname","assignmentname","description","ext","subdate","subtype","type","author","authorid","owner"]});if(this.type==0){this.assignmentStore.baseParams={action:20,mode:this.mode}}else{this.assignmentStore.baseParams={action:22,modulerunid:this.modulerunid}}this.assignmentStore.load({params:{start:0,limit:15}});this.sm=new Wtf.grid.CheckboxSelectionModel();this.sm.on("selectionchange",function(B){if(B.hasSelection()){this.archiveBtn.enable();this.importAss.enable();this.delbttn.enable();if(B.getCount()==1){if(B.getSelected().get("owner")=="1"){this.editbttn.enable()}}else{this.editbttn.disable()}}else{this.archiveBtn.disable();this.importAss.disable();this.delbttn.disable();this.editbttn.disable()}},this);this.assignmentexpander=new Wtf.grid.RowExpander({tpl:new Wtf.Template('<div style="margin-left:4px;">',"<div><b>Description :</b>{description}</div>","</div>")});this.assignmentCM=new Wtf.grid.ColumnModel([this.assignmentexpander,this.sm,{header:"Assignment Name",dataIndex:"assignmentname",autoWidth:true,sortable:true,groupable:true,renderer:function(F,D,B,G,E,C){return"<b>"+F+"</b>"}},{header:"Author",dataIndex:"author",autoWidth:true,sortable:true,groupable:true},{header:"Assignment Download",width:80,renderer:this.DownloadLink}]);Wtf.assignmentBankGrid.superclass.constructor.call(this,{store:this.assignmentStore,cm:this.assignmentCM,sm:this.sm,border:false,plugins:this.assignmentexpander,loadMask:{msg:"Loading..."},tbar:["Quick Search: ",this.quickSearchTF],viewConfig:{forceFit:true},bbar:[this.pg=new Wtf.PagingSearchToolbar({pageSize:15,searchField:this.quickSearchTF,id:"paggintoolbar"+this.id,store:this.assignmentStore,scope:this,plugins:this.pP=new Wtf.common.pPageSize({id:"pPageSize_"+this.id}),items:[this.archiveBtn=new Wtf.Toolbar.Button({text:this.mode==0?"Archive":"Restore",tooltip:this.mode==0?"Archive selected assignments":"Restore selected assignments",scope:this,disabled:true,hidden:(isRoleGroup("4"))?false:true,handler:function(){this.archiveAssignments(this.mode)}}),this.getArchived=new Wtf.Toolbar.Button({text:"Show Archived Assignments",scope:this,hidden:(isRoleGroup("4"))?false:true,handler:this.archivedAssignmentsTab}),this.importAss=new Wtf.Toolbar.Button({text:"Import",tooltip:"Import selected assignments",scope:this,disabled:true,hidden:this.type==1?false:true,handler:this.importAssignments}),this.canbttn=new Wtf.Toolbar.Button({text:"Cancel",scope:this,hidden:this.type==1?false:true,handler:function(){Wtf.getCmp("importAssignment").close()}}),this.addbttn=new Wtf.Toolbar.Button({text:"New",scope:this,hidden:this.type==1?true:false,handler:function(){this.addAssWin=new Wtf.createNewAssignment({mode:0});this.addAssWin.on("addAss",function(){this.assignmentStore.reload()},this);this.addAssWin.show()}}),this.editbttn=new Wtf.Toolbar.Button({text:"Edit",scope:this,disabled:true,hidden:this.type==1?true:false,handler:function(){this.editAssWin=new Wtf.createNewAssignment({mode:1});this.editAssWin.on("addAss",function(){this.assignmentStore.reload()},this);this.editAssWin.nameField.setValue(this.selModel.getSelected().get("assignmentname"));this.editAssWin.desc.setValue(this.selModel.getSelected().get("description"));this.editAssWin.hidden1.setValue(this.selModel.getSelected().get("assignmentid"));this.editAssWin.show()}}),this.delbttn=new Wtf.Toolbar.Button({text:"Delete",scope:this,disabled:true,hidden:this.type==1?true:false,handler:function(){Wtf.Msg.show({msg:"Are you sure you want to delete selected assignments ?",buttons:Wtf.Msg.YESNO,scope:this,fn:function(C,F){if(C=="yes"){var E=this.selModel.getSelections();var D="";for(var B=0;B<E.length;B++){D+=E[B].data["assignmentid"]+","}D=D.substring(0,(D.length-1));Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:({action:25,assids:D}),scope:this,success:function(G,H){var I=Wtf.decode(G.responseText);if(I.flag=="1"){Wtf.Msg.alert("Alert","Selected assignments could not be deleted due to dependency")}else{Wtf.Msg.alert("Alert","Selected assignments deleted successfully")}this.assignmentStore.reload()},failure:function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}})}}})}})]})]});if(this.type==1){this.archiveBtn.hide();this.getArchived.hide()}if(this.mode==1){this.addbttn.hide();this.delbttn.hide();this.editbttn.hide()}this.assignmentStore.on("load",this.handleStoreLoad,this)};Wtf.extend(Wtf.assignmentBankGrid,Wtf.grid.GridPanel,{onRender:function(A){this.assignmentStore.on("datachanged",function(){var B=this.pP.combo.value;this.quickSearchTF.setPage(B)},this);Wtf.assignmentBankGrid.superclass.onRender.call(this,A);if(this.mode=="1"){this.getArchived.hide()}this.addEvents={"refreshassignmentgrid":true,"archive":true}},DownloadLink:function(B,A,F,E,D,C){if(F.data.ext!="empty"){return"<a href='#' title='Download' onclick='setDldUrl(\"fileDownload.jsp?url="+F.data.assignmentid+"/faculty/"+F.data.assignmentname+F.data.ext+"&type=assignmentBank&dtype=attachment\")'><div class='pwnd dldiconwt' style='height:16px; width:16px;'></div></a>"}else{return"No File"}},importAssignments:function(){if(this.obj.form.isValid()){var D=this.selModel.getSelections();var C="";for(var B=0;B<D.length;B++){C+=D[B].data["assignmentid"]+","}C=C.substring(0,(C.length-1));var A=this.duedate.getRawValue();Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp?duedate="+Wtf.modifyDateFmt(A,Wtf.getDateFormat(),"Y-m-j"),method:"POST",scope:this,params:({action:23,modulerunid:this.modulerunid,assids:C,asstype:this.asstype.getValue(),subtype:this.subtype.getValue()}),success:function(E,F){this.fireEvent("refreshassignmentgrid");Wtf.getCmp("importAssignment").close()},failure:function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}})}},archivedAssignmentsTab:function(){var A="arcAssTab";this.openTab(A,Wtf.assignmentBankGrid,{id:A,title:"Archived Assignments",border:false,layout:"fit",closable:true,mode:1,type:0});Wtf.getCmp(A).on("archive",function(){this.assignmentStore.reload()},this)},openTab:function(D,B,A){var C=Wtf.getCmp(D);if(!C){C=new B(A);this.ownerCt.add(C);this.ownerCt.doLayout()}this.ownerCt.setActiveTab(C)},archiveAssignments:function(A){Wtf.Msg.show({msg:A=="0"?"Are you sure you want to archive the selected assignments?":"Are you sure you want to restore the selected assignments?",buttons:Wtf.Msg.YESNO,scope:this,fn:function(C,F){if(C=="yes"){var E=this.selModel.getSelections();var D="";for(var B=0;B<E.length;B++){D+=E[B].data["assignmentid"]+","}D=D.substring(0,(D.length-1));Wtf.Ajax.request({url:"jspfiles/admin/assignment.jsp",method:"POST",params:({action:21,mode:A,assids:D}),scope:this,success:function(){if(A=="0"){if(Wtf.getCmp("arcAssTab")){Wtf.getCmp("arcAssTab").assignmentStore.reload()}}else{this.fireEvent("archive")}this.assignmentStore.reload();msgBoxShow(["Success",A=="0"?"Assignments archived successfully":"Assignments restored successfully."],Wtf.MessageBox.INFO)},failure:function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}})}},icon:Wtf.MessageBox.QUESTION})},handleStoreLoad:function(A,C,B){this.quickSearchTF.StorageChanged(A)}});Wtf.lms.quizResponse=function(A){Wtf.apply(this,A);this.expander=new Wtf.grid.RowExpander({tpl:new Wtf.XTemplate("<br><p><b>Question type: </b> {qtype}</p>","<br>",'<tpl if="type = 1">',"<p><b>Correct Answer: </b>{cans}</p>","<br>","<p><b>User Response: </b>{uresp}</p>","</tpl>")});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,enableGroupingMenu:false,showGroupName:false,hideGroupedColumn:false});this.quickSearchTF=new Wtf.KWLTagSearch({field:"tags",width:200});this.reader=new Wtf.data.JsonReader({totalProperty:"count",root:"data",fields:[{name:"question"},{name:"uname"},{name:"cans"},{name:"uresp"},{name:"time"},{name:"qtype"}]});this.ds=new Wtf.data.GroupingStore({url:"jspfiles/lms/quiz.jsp",reader:this.reader,baseParams:{flag:15,cid:this.courseid,quizid:this.quizid},sortInfo:{field:"uname",direction:"DESC"}});this.cm=new Wtf.grid.ColumnModel([this.expander,{header:"Question",dataIndex:"question",sortable:true,groupable:false},{header:"Uname",dataIndex:"uname",hidden:true,sortable:true,groupable:true}]);this.cm.defaultSortable=true;Wtf.lms.quizResponse.superclass.constructor.call(this,{layout:"fit",items:[{layout:"border",border:false,autoWidth:true,items:[this.grid=new Wtf.grid.GridPanel({border:false,region:"center",store:this.ds,view:this.groupingView,cm:this.cm,plugins:this.expander,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading..."},tbar:["Search by Tags: ",this.quickSearchTF]})]}],bbar:[this.pg=new Wtf.PagingSearchToolbar({pageSize:15,id:"paggintoolbar"+this.id,searchField:this.quickSearchTF,store:this.ds,scope:this,plugins:this.pP=new Wtf.common.pPageSize({id:"pPageSize_"+this.id})})]});this.ds.on("load",this.handleStoreLoad,this);this.ds.on("datachanged",function(){var B=this.pP.combo.value;this.quickSearchTF.setPage(B)},this)};Wtf.extend(Wtf.lms.quizResponse,Wtf.Panel,{onRender:function(A){Wtf.lms.quizResponse.superclass.onRender.call(this,A);this.grid.on("sortchange",function(B,C){this.grid.getStore().groupBy("uname")},this);this.ds.load({params:{start:0,limit:15}})},handleStoreLoad:function(A,C,B){this.quickSearchTF.StorageChanged(A)}});Wtf.lmsQlist=function(A){Wtf.apply(this,A);this.lcontStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["courseid","coursename"])});this.lquizStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["nodeid","nodetext"])});this.lcontStore.load({params:{flag:30,moduleid:this.moduleid}});this.lquizStore.on("load",this.selQuiz,this);this.form=new Wtf.form.FormPanel({url:"admin.jsp?",waitMsgTarget:true,method:"POST",border:false,bodyStyle:"margin-top:20px;margin-left:35px;font-size:10px;",items:[this.content=new Wtf.form.ComboBox({fieldLabel:"Content Name",mode:"local",width:140,labelWidth:120,triggerAction:"all",typeAhead:true,editable:false,blankText:"Select a type",store:this.lcontStore,displayField:"coursename",valueField:"courseid",allowBlank:false,msgTarget:"side"}),this.quiz=new Wtf.form.ComboBox({fieldLabel:"Quiz Name",mode:"local",width:140,labelWidth:120,triggerAction:"all",disable:true,typeAhead:true,editable:false,blankText:"Select a quiz",store:this.lquizStore,displayField:"nodetext",valueField:"nodeid",allowBlank:false,msgTarget:"side"})]});Wtf.lmsQlist.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,modal:true,layout:"fit",buttons:[{text:"View",scope:this,handler:function(){if(this.form.form.isValid()){this.openResponse()}}},{text:"Close",scope:this,handler:function(){this.close()}}],items:[this.form]})};Wtf.extend(Wtf.lmsQlist,Wtf.Window,{onRender:function(A){Wtf.lmsQlist.superclass.onRender.call(this,A);this.content.on("select",this.getQuiz,this)},getQuiz:function(){this.quiz.setValue("");var A=this.content.getValue();this.lquizStore.load({params:{flag:31,cid:A}})},selQuiz:function(){this.quiz.enable()},openResponse:function(){var A="qresp"+this.quiz.getValue();this.openTab(A,Wtf.lms.quizResponse,{id:A,title:"User Response",border:false,layout:"fit",closable:true,courseid:this.content.getValue(),quizid:this.quiz.getValue()})},openTab:function(D,B,A){var C=Wtf.getCmp(D);if(!C){C=new B(A);this.innerTabPanel.add(C);this.innerTabPanel.doLayout()}this.innerTabPanel.setActiveTab(C);this.close()}});Wtf.MyContentEditor=function(A){this.treeNodelevel=null;this.ret=0;this.arr=[];this.i=1;this.j=1;this.k=1;this.l=1;this.r=1;this.cnt=0;this.msg=1;this.mode=A.mode;this.tabtitle=A.tabtitle;this.nodeid=null;Wtf.apply(this,A);this.courseid=A.courseid;this.pubexpArray={};this.nodeInfo={};var C=new Wtf.data.SimpleStore({fields:["abbr","type"],data:Wtf.form.ComboBox.types});this.store1=this.getStore();this.store1.on("load",this.hello,this);this.store1.on("loadexception",function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)},this);this.getContentInfo=this.getStore();this.store3=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["id","flag","text","pubdate","expdate","iobject","loauth","lock","lockauthor","children","wr","qattemp"])});this.store3.on("load",this.addNodes,this);this.store4=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"createObject.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["id","flag","text","pubdate","expdate","iobject","loauth","lock","lockauthor","children"])});this.store4.on("load",this.addNodes,this);this.publish=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["success"])});this.publish.on("load",this.pubresp,this);var B=null;if(this.mode==1){B=this.combId("lms-"+this.courseid,this.vid)}else{B="lms-"+this.courseid}this.mytree=new Wtf.tree.TreePanel({id:B,border:false,animate:true,layout:"fit",collapsible:true,rootVisible:true,enableDD:(this.mode==0)?true:false,lines:true,containerScroll:true,autoScroll:true});this.mytree.on("render",this.loadNodes,this);this.root=new Wtf.tree.TreeNode({text:this.tabtitle,qtip:this.tabtitle,id:this.courseid,expanded:true,expandable:true,singleClickExpand:true,lines:true,cls:"rootclass"});if(this.mode!=1){this.treeEditor=new Wtf.tree.TreeEditor(this.mytree,{allowBlank:false,cancelOnEsc:true,completeOnEnter:true})}this.mytree.setRootNode(this.root);this.mytree.on("contextmenu",this.OnContextMenu,this);this.mytree.on("click",this.OnDblClick,this);this.mytree.on("dblclick",function(D,E){if(D.attributes.cls=="fileclass"){this.filecontentTab(D.attributes.text,"tab"+D.attributes.id,D.attributes.text,this.courseid,this)}},this);this.mytree.on("textchange",this.ReflectTab,this);this.mytree.on("append",this.setNodeIndex,this);this.mytree.on("insert",function(E,I,J,F){var H="",K="";var D=I.childNodes;for(var G=0;G<D.length;G++){H+=D[G].attributes.id+",";K+=I.indexOf(D[G])+","}if(H!=""){H=H.substring(0,H.length-1);K=K.substring(0,K.length-1)}Wtf.Ajax.request({method:"POST",url:"jspfiles/lms/CreateCourse.jsp",params:({flag:33,level:K,nodeids:H,courseid:this.courseid}),scope:this,success:function(L,M){},failure:function(L,M){Wtf.Msg.alert("Error","Error connecting to server. Node level could not be updated",function(N){},this)}})},this);this.mytree.on("startdrag",function(F,D,E){this.parent=D.parentNode},this);this.mytree.on("dragdrop",function(H,E,O,K){var I=E.parentNode;var N=I.childNodes;var L=this.parent.childNodes;var M="",D="",G="",J="";for(var F=0;F<N.length;F++){M+=N[F].attributes.id+",";D+=I.indexOf(N[F])+","}if(M!=""){M=M.substring(0,M.length-1);D=D.substring(0,D.length-1)}for(var F=0;F<L.length;F++){G+=L[F].attributes.id+",";J+=this.parent.indexOf(L[F])+","}if(G!=""){G=G.substring(0,G.length-1);J=J.substring(0,J.length-1)}Wtf.Ajax.request({method:"POST",url:"jspfiles/lms/CreateCourse.jsp",params:({flag:32,parentid:I.attributes.id,level:D,nodeid:E.attributes.id,nodeids:M,olevel:J,onodeids:G,courseid:this.courseid}),scope:this,failure:function(P,Q){Wtf.Msg.alert("Error","Error connecting to server",function(R){},this)}})},this);if(this.mode==1){this.mytree.getSelectionModel().on("selectionchange",this.callActivateTab,this)}this.tabPanelContainer=new Wtf.TabPanel({border:false,tabWidth:135,activeTab:0,resizeTabs:true,enableTabScroll:true});this.tabPanelContainer.on("tabchange",this.ReflectOnTabChange,this);this.tabPanelContainer.on("beforeremove",this.beforeTabRemove,this);this.tabPanelContainer.on("remove",this.disableTabs,this);this.LeftPanel=new Wtf.Panel({border:false,autoScroll:true,layout:"fit",frame:true,items:[this.mytree]});this.titleDiv=[];this.containerDiv=[];this.img=[];this.bulDiv=[];this.link1=[];this.bulletContainer=document.createElement("div");this.bulletContainer.className="bulletContainer";for(i=0;i<3;i++){this.containerDiv[i]=document.createElement("div");this.containerDiv[i].className="items";this.link1[i]=document.createElement("span");this.link1[i].onmouseover=this.changeColorBlue.createDelegate(this);this.link1[i].onmouseout=this.changeColorBlack.createDelegate(this);if(i==0){this.link1[i].innerHTML="Insert Section";this.containerDiv[i].onclick=this.InsertSection.createDelegate(this)}else{if(i==1){this.link1[i].innerHTML="Insert Quiz";this.containerDiv[i].onclick=this.InsertQuiz.createDelegate(this)}else{if(i==2){this.link1[i].innerHTML="Insert File";this.containerDiv[i].onclick=this.InsertFile.createDelegate(this)}}}this.img[i]=document.createElement("img");this.img[i].src="images/lms/bullet.GIF";this.bulDiv[i]=document.createElement("div");this.bulDiv[i].className="bullet";this.bulDiv[i].appendChild(this.img[i]);this.titleDiv[i]=document.createElement("div");this.titleDiv[i].className="mylabel";this.titleDiv[i].appendChild(this.link1[i]);this.containerDiv[i].appendChild(this.bulDiv[i]);this.containerDiv[i].appendChild(this.titleDiv[i]);this.bulletContainer.appendChild(this.containerDiv[i])}this.RightPanel=new Wtf.Panel({border:false,width:"100%",contentEl:this.bulletContainer});this.rulesdiv=document.createElement("div");this.rulesdiv.className="rules";this.hlink=[];this.setdatediv=[];this.label=[];this.rightCon=new Wtf.Panel({layout:"fit",border:false});this.RightTabPanel=new Wtf.TabPanel({border:false,collapsible:true,activeTab:0,collapseFirst:true,tabWidth:75,items:[{title:"Tasks",id:"subtab1"+this.id,layout:"fit",items:[this.RightPanel]},{title:"Questions",id:"subtab2"+this.id,disabled:true,layout:"fit",items:[getQuizLayout(this.id)]},{title:"Rules",id:"subtab3"+this.id,disabled:true,ctCls:"ruleInfo",layout:"fit",contentEl:this.rulesdiv}]});this.RightTabPanel.on("tabchange",this.getRuleInfo,this);this.prev=new Wtf.Toolbar.Button({text:"Previous",scope:this,handler:function(){this.mytree.getSelectionModel().selectPrevious()}});this.nxt=new Wtf.Toolbar.Button({text:"Next",scope:this,handler:function(){this.mytree.getSelectionModel().selectNext()}});this.openTabs=document.createElement("div");this.openTabs.className="openTabs";this.tasks=document.createElement("div");this.tasks.className="openTabs";this.task1=document.createElement("div");this.task1.className="con1";this.task2=document.createElement("div");this.task2.className="con2";this.task3=document.createElement("div");this.task3.className="con3";this.txt=document.createElement("span");this.txt.setAttribute("flag",true);this.txt.onmouseover=this.changeColorBlue.createDelegate(this);this.txt.onmouseout=this.changeColorBlack.createDelegate(this);this.img=document.createElement("img");this.img.src="images/lms/bullet.GIF";this.viewRight=new Wtf.Panel({layout:"border",border:false,frame:true,bbar:[this.prev,this.nxt],items:[{region:"north",height:150,layout:"fit",items:[new Wtf.Panel({frame:true,layout:"fit",title:"Tasks",contentEl:this.tasks})]},{region:"center",layout:"fit",autoScroll:true,items:[this.op=new Wtf.Panel({frame:true,layout:"fit",title:"Open",autoScroll:true,contentEl:this.openTabs})]},{region:"south",height:150,layout:"fit",items:[this.conInfo=new Wtf.Panel({frame:true,layout:"fit",title:"Content Info",autoScroll:true})]}]});if(this.mode==1){this.rightCon.add(this.viewRight)}else{this.rightCon.add(this.RightTabPanel)}this.findnRep=new Wtf.menu.Item({text:"Find And Replace",icon:"images/search.gif",scope:this,disabled:true,handler:function(){new Wtf.FindAndReplace({}).show()}});this.sep1=new Wtf.menu.Separator({hidden:(this.mode==1)?true:false});this.sep2=new Wtf.menu.Separator({hidden:(this.mode==1)?true:false});this.sep3=new Wtf.menu.Separator({hidden:(this.mode==1)?true:false});this.saveBtn=new Wtf.menu.Item({text:"Save",icon:"images/Save.gif",iconCls:"iconclass",disabled:true,hidden:(this.mode==1)?true:false,scope:this,handler:this.saveContent});this.saveBtn1=new Wtf.Toolbar.Button({text:"Save",icon:"images/Save.gif",iconCls:"iconclass",disabled:true,hidden:(this.mode==1)?true:false,scope:this,handler:this.saveContent});this.saveAllBtn1=new Wtf.Toolbar.Button({text:"Save All",icon:"images/lms/save_all.png",iconCls:"iconclass",hidden:(this.mode==1)?true:false,scope:this,handler:this.handleSaveAll});this.saveAllBtn=new Wtf.menu.Item({text:"Save All",icon:"images/lms/save_all.png",iconCls:"iconclass",hidden:(this.mode==1)?true:false,scope:this,handler:this.handleSaveAll});this.pubBtn=new Wtf.menu.Item({text:"Publish",icon:"images/pub.PNG",iconCls:"iconclass",hidden:(this.mode==1)?true:false,scope:this,handler:function(){}});this.pubBtn1=new Wtf.Toolbar.Button({text:"Publish",icon:"images/pub.PNG",iconCls:"iconclass",hidden:(this.mode==1)?true:false,scope:this,handler:function(){this.handleSaveAll();this.publish.load({params:{flag:"24",courseid:this.courseid}})}});this.deleteBtn=new Wtf.menu.Item({text:"Delete",icon:"images/Delete.gif",iconCls:"iconclass",hidden:(this.mode==1)?true:false,scope:this,disabled:true,handler:function(){var D=this.tabPanelContainer.getActiveTab().id;Wtf.getCmp(D).editor.getSelectedText()}});this.undoBtn=new Wtf.menu.Item({text:"Undo",icon:"images/Back2.gif",hidden:(this.mode==1)?true:false,scope:this,disabled:true,handler:function(){}});this.redoBtn=new Wtf.menu.Item({text:"Redo",icon:"images/Forward2.gif",hidden:(this.mode==1)?true:false,scope:this,disabled:true,handler:function(){}});this.cutBtn=new Wtf.menu.Item({text:"Cut",icon:"images/Cut.gif",hidden:(this.mode==1)?true:false,scope:this,disabled:true,handler:function(){var D=this.tabPanelContainer.getActiveTab().id;Wtf.getCmp(D).editor.getSelectedText()}});this.copyBtn=new Wtf.menu.Item({text:"Copy",icon:"images/Copy.gif",hidden:(this.mode==1)?true:false,scope:this,disabled:true,handler:function(){var D=this.tabPanelContainer.getActiveTab().id;Wtf.getCmp(D).editor.copySelectedText()}});this.pasteBtn=new Wtf.menu.Item({text:"Paste",icon:"images/Paste.gif",hidden:(this.mode==1)?true:false,scope:this,disabled:true,handler:function(){var D=this.tabPanelContainer.getActiveTab().id;Wtf.getCmp(D).editor.pasteSelectedText()}});this.selAllBtn=new Wtf.menu.Item({text:"Select All",icon:"images/lms/s.gif",scope:this,hidden:(this.mode==1)?true:false,disabled:true,handler:function(){var D=this.tabPanelContainer.getActiveTab().id;Wtf.getCmp(D).editor.execCmd("copy",false)}});this.clearAttempt=new Wtf.menu.Item({text:"Clear Attempts",icon:"images/lms/s.gif",scope:this,hidden:(this.mode==1)?true:false,handler:function(){Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"GET",params:({flag:18,cid:this.courseid}),scope:this,success:function(D){if(D.responseText.trim()=="true"){msgBoxShow(["Attempt History","Attempts clear successfully."],Wtf.MessageBox.INFO)}else{msgBoxShow(["Attempt History","No attempt history for this user."],Wtf.MessageBox.INFO)}},failure:function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}})}});this.closeBtn=new Wtf.menu.Item({text:"Close",icon:"images/lms/s.gif",scope:this,handler:function(){if(this.tabPanelContainer.getActiveTab()!=null){var H=this.tabPanelContainer.getActiveTab().ctCls;var E=this.mytree.getSelectionModel().getSelectedNode();if(this.mode==1||H=="quizclass"||H=="fileclass"){this.removeTab(E)}else{if(H=="section"){var F=Wtf.getCmp(this.tabPanelContainer.getActiveTab().id).editor.saveflag;if(F==1){var G=this.tabPanelContainer.getActiveTab().title;G=G.substring(0,G.length-1);Wtf.MessageBox.show({title:"Save Changes!!!",msg:"Do you want to save the changes to "+G,buttons:Wtf.MessageBox.YESNOCANCEL,animEl:"upwin",scope:this,icon:Wtf.MessageBox.INFO,fn:this.getChoice})}else{this.removeTab(E)}}else{if(H=="rquizclass"){var D=Wtf.getCmp(this.tabPanelContainer.getActiveTab().id).editor.saveflag;if(D==1){var G=this.tabPanelContainer.getActiveTab().title;G=G.substring(0,G.length-1);Wtf.MessageBox.show({title:"Save Changes!!!",msg:"Do you want to save the changes to "+G,buttons:Wtf.MessageBox.YESNOCANCEL,animEl:"upwin",scope:this,icon:Wtf.MessageBox.INFO,fn:this.getChoice})}else{this.removeTab(E)}}}}}}});this.exitBtn=new Wtf.menu.Item({text:"Exit",icon:"images/exit.png",scope:this,handler:function(){if(Wtf.getCmp("ped"+this.id)!=null){mainPanel.remove("ped"+this.id)}mainPanel.remove(mainPanel.getActiveTab().id)}});this.insImg=new Wtf.menu.Item({text:"Image",icon:"images/lms/s.gif",scope:this,disabled:true,handler:function(){if(this.tabPanelContainer.getActiveTab()!=null){if(this.mytree.getSelectionModel().getSelectedNode().attributes.cls=="sectionclass"){this.imgWin=new Wtf.Window({title:"Enter Image",iconCls:"winicon",modal:true,autoDestroy:true,closable:true,resizable:false,width:360,height:165,layout:"border",border:false,items:[{region:"north",height:50,border:false,layout:"form",labelWidth:80,bodyStyle:"padding:5px",items:[this.alignType=new Wtf.form.ComboBox({fieldLabel:"Align",forceSelection:true,store:C,displayField:"type",typeAhead:true,mode:"local",value:"Bottom",triggerAction:"all",selectOnFocus:true,width:200}),this.imgTitle=new Wtf.form.TextField({fieldLabel:"Image Title",width:200})]},{region:"center",border:false,layout:"fit",bodyStyle:"padding:5px",items:[this.imgIns=new Wtf.FormPanel({bodyStyle:"margin-top:5px",method:"POST",fileUpload:true,waitMsgTarget:true,url:"FileUpload.jsp?flag=1",border:false,layout:"form",labelWidth:80,items:[new Wtf.form.TextField({id:"imgname",inputType:"file",fieldLabel:"Location"})]})]}],buttons:[{text:"Insert Image",type:"submit",scope:this,handler:function(){if(Wtf.getCmp("imgname").getValue()!=""){this.imgIns.form.submit({waitMsg:"Loading...",scope:this,success:function(D,F){var H=F.result.success.path;var J=Wtf.getLmsImgPath+H;var E=this.tabPanelContainer.getActiveTab().id;var G=Wtf.getCmp(E).editor;var K=this.alignType.getValue();var I=this.imgTitle.getValue();G.insertAtCursor("<img src='"+J+"' align='"+K+"' title='"+I+"'></img>");this.imgWin.close()},failure:function(D,E){msgBoxShow(["Error","A problem occurred while uploading"],Wtf.MessageBox.ERROR)}})}}},{text:"Cancel",scope:this,handler:function(){this.imgWin.close()}}]});this.imgWin.show()}}}});this.insQues=new Wtf.menu.Item({text:"Question",icon:"images/lms/s.gif",scope:this,disabled:true,menu:{items:[{text:"True/False...",icon:"images/lms/s.gif",scope:this,handler:function(){if(this.tabPanelContainer.getActiveTab()!=null){if(this.tabPanelContainer.getActiveTab().ctCls=="quizclass"){var D=getCompObj(this.id);this.quiz.grid.createtruefalseques(D.dsstore)}}}},{text:"Multiple Choice...",icon:"images/lms/s.gif",scope:this,handler:function(){if(this.tabPanelContainer.getActiveTab()!=null){if(this.tabPanelContainer.getActiveTab().ctCls=="quizclass"){var D=getCompObj(this.id);this.quiz.grid.createMulChoiceques(D.dsstore)}}}},{text:"Fill in the Blanks...",icon:"images/lms/Fillblank.PNG",scope:this,handler:function(){if(this.tabPanelContainer.getActiveTab()!=null){if(this.tabPanelContainer.getActiveTab().ctCls=="quizclass"){var D=getCompObj(this.id);this.quiz.grid.createFillBlankques(D.dsstore)}}}},{text:"Matching...",icon:"images/lms/s.gif",scope:this,handler:function(){if(this.tabPanelContainer.getActiveTab()!=null){if(this.tabPanelContainer.getActiveTab().ctCls=="quizclass"){var D=getCompObj(this.id);this.quiz.grid.createMatchingques(D.dsstore)}}}},{text:"Ranking...",icon:"images/lms/s.gif",scope:this,handler:function(){if(this.tabPanelContainer.getActiveTab()!=null){if(this.tabPanelContainer.getActiveTab().ctCls=="quizclass"){var D=getCompObj(this.id);this.quiz.grid.createRankques(D.dsstore)}}}},{text:"Multiple Response...",icon:"images/lms/s.gif",scope:this,handler:function(){if(this.tabPanelContainer.getActiveTab()!=null){if(this.tabPanelContainer.getActiveTab().ctCls=="quizclass"){var D=getCompObj(this.id);this.quiz.grid.MultipleResponseques(D.dsstore)}}}}]}});this.editor=new Wtf.Panel({border:false,cls:"container",frame:true,layout:"border",tbar:[new Wtf.Toolbar.Button({text:"Content",menu:{items:[this.saveBtn,this.saveAllBtn,this.sep2,this.closeBtn,this.sep2,this.clearAttempt,this.exitBtn]},scope:this,handler:function(){if(this.tabPanelContainer.items.items.length>0){this.closeBtn.enable();this.saveBtn.enable();this.saveAllBtn.enable()}else{this.closeBtn.disable();this.saveBtn.disable();this.saveAllBtn.disable()}}}),new Wtf.Toolbar.Button({text:"Edit",hidden:(this.mode==1)?true:false,scope:this,handler:function(){if(this.tabPanelContainer.getActiveTab()){if(this.tabPanelContainer.getActiveTab().ctCls=="section"){this.undoBtn.enable();this.redoBtn.enable();this.cutBtn.enable();this.copyBtn.enable();this.pasteBtn.enable();this.deleteBtn.enable();this.selAllBtn.enable();this.findnRep.enable()}else{this.undoBtn.disable();this.redoBtn.disable();this.cutBtn.disable();this.copyBtn.disable();this.pasteBtn.disable();this.deleteBtn.disable();this.selAllBtn.disable();this.findnRep.disable()}}},menu:{items:[this.cutBtn,this.copyBtn,this.pasteBtn,this.deleteBtn]}}),new Wtf.Toolbar.Button({text:"View",scope:this,menu:[{text:"Task Pane",icon:"images/lms/s.gif",checked:true,scope:this,checkHandler:this.onTaskPaneToggle},{text:"Content Layout",icon:"images/lms/s.gif",checked:true,scope:this,checkHandler:this.onConLayoutToggle},this.sep3,{text:"Content Info",icon:"images/lms/s.gif",scope:this,hidden:(this.mode==1)?true:false,handler:function(){if(this.mytree.getSelectionModel().getSelectedNode()!=null){var D=this.mytree.getSelectionModel().getSelectedNode().attributes.id;this.getContentInfo.load({params:{flag:"12",nodeid:D}})}}},{text:"Content History",icon:"images/lms/s.gif",hidden:(this.mode==1)?true:false,scope:this,handler:function(){this.showContHistory(this.courseid)}}]}),this.insertBtn=new Wtf.Toolbar.Button({hidden:(this.mode==1)?true:false,text:"Insert",scope:this,handler:function(){if(this.tabPanelContainer.getActiveTab()!=null){var D=this.mytree.getSelectionModel().getSelectedNode().attributes;if(D.cls=="quizclass"){this.insQues.enable();this.insImg.disable()}else{if(D.cls=="sectionclass"&&D.lobject=="0"){this.insImg.enable();this.insQues.disable()}else{this.insImg.disable();this.insQues.disable()}}}},menu:[{text:"Section",icon:"images/lms/s.gif",scope:this,handler:function(){if(this.mytree.getSelectionModel().getSelectedNode()!=null){var D=this.mytree.getSelectionModel().getSelectedNode();this.createSectionNode(D)}}},{text:"Quiz/Assessment",icon:"images/lms/s.gif",scope:this,handler:function(){if(this.mytree.getSelectionModel().getSelectedNode()!=null){var D=this.mytree.getSelectionModel().getSelectedNode();this.createQuizNode(D)}}},{text:"File",icon:"images/lms/file.png",scope:this,handler:function(){if(this.mytree.getSelectionModel().getSelectedNode()!=null){var D=this.mytree.getSelectionModel().getSelectedNode();this.uploadfile(D)}}},"-",this.insImg,this.insQues]}),this.manageBtn=new Wtf.Toolbar.Button({text:"Manage",hidden:(this.mode==1)?true:false,menu:[{text:"Pedagogy",icon:"images/lms/s.gif",scope:this,handler:function(){this.showPedagogy()}}]}),this.saveBtn1,this.saveAllBtn1,this.pubBtn1,"-",this.loc=new Wtf.Toolbar.Button({text:"Import Learning Object",icon:"images/import.gif",iconCls:"iconclass",hidden:(this.mode==1)?true:false,scope:this,handler:this.createObj})],items:[{border:false,id:"west"+this.id,region:"west",title:"Content Layout",collapsible:true,layout:"fit",split:true,width:200,minSize:100,maxSize:300,items:[this.LeftPanel]},{border:false,id:"center"+this.id,frame:true,region:"center",collapsible:true,split:true,layout:"fit",items:[this.tabPanelContainer]},{border:false,id:"east"+this.id,collapsible:true,region:"east",split:true,width:200,layout:"fit",minSize:170,maxSize:300,items:[this.rightCon]}]});Wtf.MyContentEditor.superclass.constructor.call(this,A)};Wtf.form.ComboBox.types=[["1","AbsBottom"],["2","AbsMiddle"],["3","Baseline"],["4","Bottom"],["5","Left"],["6","Middle"],["7","Right"],["8","TextTop"],["9","Top"]];Wtf.extend(Wtf.MyContentEditor,Wtf.Panel,{onRender:function(A){Wtf.MyContentEditor.superclass.onRender.call(this,A);this.add(this.editor);dojo.cometd.subscribe("/"+loginid+"/rules",this,"rulesPublishHandler")},handleActivate:function(A){A.doLayout();var B=(this.LeftPanel.ownerCt.getSize().width>100)?this.LeftPanel.ownerCt.getSize().width:200;this.LeftPanel.ownerCt.setWidth(B);A.doLayout();var B=(this.rightCon.ownerCt.getSize().width>100)?this.rightCon.ownerCt.getSize().width:200;this.rightCon.ownerCt.setWidth(B);A.doLayout()},getTree:function(A){if(A.isRoot==null){this.arr[this.ret]=A;this.ret++}if(A.firstChild!=null){this.getTree(A.firstChild)}if(A.nextSibling!=null){this.getTree(A.nextSibling)}return this.arr},rulesPublishHandler:function(A){var E=Wtf.decode(A.data);this.ret=0;if(E.data[0].nodes[0]!=null){this.mytree.getRootNode().select();var C=Wtf.getCmp(this.mytree.id).root.childNodes.length;var B=Wtf.getCmp(this.mytree.id).root.childNodes;for(var D=0;D<C;D++){Wtf.getCmp(this.mytree.id).root.removeChild(B.shift())}this.loadNodes()}},OnContextMenu:function(A,B){A.select();this.parent=A.parentNode;this.viewTreeMenu=new Wtf.menu.Menu({shadow:false,items:[{text:"Open",icon:"images/lms/s.gif",scope:this,handler:function(){this.OnDblClick(A,B)}}]});this.editTreeMenu=new Wtf.menu.Menu({shadow:false,items:[{id:"insertsection"+this.id,text:"Insert Section",icon:"images/lms/section.png",scope:this,handler:function(){this.createSectionNode(A)}},{id:"insertquiz"+this.id,text:"Insert Quiz/Assessment",icon:"images/lms/ques_icon.png",scope:this,handler:function(){this.createQuizNode(A)}},{id:"insertrquiz"+this.id,text:"Insert Random Quiz",icon:"images/lms/ques_icon.png",scope:this,handler:function(){this.createRQuizNode(A)}},{id:"insertfile"+this.id,text:"Insert File",icon:"images/lms/file.png",scope:this,handler:function(){this.uploadfile(A)}},{id:"insertlink"+this.id,text:"Insert Link",icon:"images/lms/file.png",scope:this,handler:function(){this.createlink(A)}},"-",{id:"view"+this.id,text:"View",icon:"images/lms/s.gif",scope:this,handler:function(){if(A.attributes.cls=="fileclass"){this.filecontentTab(A.attributes.text,"tab"+A.attributes.id,A.attributes.text,this.courseid,this)}}},{id:"filedwn"+this.id,text:"Download",icon:"images/lms/s.gif",scope:this,handler:function(){setDldUrl("fileDownload.jsp?courseid="+this.courseid+"&nodeid="+A.attributes.id+"&dtype=attachment&type=lms")}},"-",{id:"moveup"+this.id,text:"Move Up",icon:"images/lms/s.gif",scope:this,handler:function(){this.parent=A.parentNode;this.prev=A.previousSibling;this.parent.insertBefore(A,this.prev)}},{id:"movedown"+this.id,text:"Move Down",icon:"images/lms/s.gif",scope:this,handler:function(){this.parent=A.parentNode;this.next=A.nextSibling;this.parent.insertBefore(this.next,A)}},"-",{id:"delete"+this.id,text:"Delete",icon:"images/lms/s.gif",scope:this,handler:function(){Wtf.MessageBox.show({title:"Delete Confirmation!",msg:"Are you sure you want to delete this node!",buttons:Wtf.MessageBox.YESNO,icon:Wtf.MessageBox.WARNING,scope:this,fn:C});function C(D){if(D=="yes"){this.delstore=this.getStore();this.delstore.on("load",this.delNode,this);this.pnode=A.parentNode;this.delstore.load({params:{flag:"6",nodeid:A.attributes.id,courseid:this.courseid,parentid:A.parentNode.id}})}}}},{id:"rename"+this.id,text:"Rename",icon:"images/lms/s.gif",scope:this,handler:function(){this.treeEditor.triggerEdit(A)}},"-",{id:"expirydate"+this.id,text:"Set Publish/Expiry Date",icon:"images/lms/s.gif",scope:this,handler:this.showExpiryScreen},{id:"maxattmp"+this.id,text:"Maximum Attempts",icon:"images/lms/s.gif",scope:this,disabled:true,handler:function(){this.showmaxAttmp(A)}},{id:"quiztime"+this.id,text:"Quiz Time Limit",icon:"images/lms/s.gif",scope:this,disabled:true,handler:function(){this.showmaxQuizTime(A)}},"-",{id:"addtag"+this.id,text:"Add Tag",icon:"images/lms/s.gif",scope:this,handler:this.addTag},{id:"adddes"+this.id,text:"Add Description",icon:"images/lms/s.gif",scope:this,handler:this.addDesc}]});this.tmp1=Wtf.getCmp("delete"+this.id);this.tmp2=Wtf.getCmp("moveup"+this.id);this.tmp3=Wtf.getCmp("movedown"+this.id);this.tmp4=Wtf.getCmp("rename"+this.id);this.tmp5=Wtf.getCmp("expirydate"+this.id);this.tmp6=Wtf.getCmp("filedwn"+this.id);this.tmp7=Wtf.getCmp("view"+this.id);this.maxattmp=Wtf.getCmp("maxattmp"+this.id);this.maxQtime=Wtf.getCmp("quiztime"+this.id);if(A.attributes.cls=="rootclass"){this.tmp1.disable();this.tmp2.disable();this.tmp3.disable();this.tmp4.disable();this.tmp5.disable();this.tmp6.disable()}if(A.attributes.cls=="quizclass"||A.attributes.cls=="rquizclass"){this.maxattmp.enable();this.maxQtime.enable()}if(A.attributes.cls=="sectionclass"||A.attributes.cls=="quizclass"){this.tmp6.disable()}if(A.attributes.cls=="fileclass"){}if(A.isFirst()==true&&A.nextSibling==null){this.tmp2.disable();this.tmp3.disable()}else{if(A.isLast()==true&&A.previousSibling!=null){this.tmp3.disable()}else{if(A.isFirst()==true&&A.nextSibling!=null){this.tmp2.disable()}}}if(this.mode==1){this.viewTreeMenu.showAt(B.getXY())}else{this.editTreeMenu.showAt(B.getXY())}B.preventDefault()},setDescription:function(C,D,B){var A=D[0].data.description;if(A!=null){this.desArea.setValue(A)}},addDesc:function(){var A=this.mytree.getSelectionModel().getSelectedNode();this.desDs=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"catalog.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["description"])});this.desDs.load({params:{flag:3,nodeid:A.attributes.id}});this.desDs.on("load",this.setDescription,this);this.desWin=new Wtf.Window({title:"Add Description",closable:true,modal:true,iconCls:"win",width:355,autoHeight:true,scope:this,resizable:false,buttons:[{text:"OK",scope:this,handler:function(){this.desWin.close();Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"GET",params:({description:this.desArea.getValue(),flag:2,nodeid:A.attributes.id}),scope:this,success:function(){msgBoxShow(["Success","Description added successfully."],Wtf.MessageBox.INFO)},failure:function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}})}},{text:"Cancel",scope:this,handler:function(){this.desWin.close()}}],items:[{region:"center",height:100,items:[this.form=new Wtf.form.FormPanel({url:"admin.jsp?",waitMsgTarget:true,method:"POST",border:false,bodyStyle:"margin-top:10px;margin-left:10px;font-size:10px;",items:[{labelWidth:75,border:false,layout:"form",items:[this.desArea=new Wtf.form.TextArea({fieldLabel:"Description",height:80,width:240,maxLength:1024})]}]})]}]});this.desWin.show()},addTag:function(){var A=this.mytree.getSelectionModel().getSelectedNode();this.RES=Wtf.data.Record.create([{name:"tagid",type:"string"},{name:"tagname",type:"string"},{name:"check",type:"string"}]);this.allResources=new Wtf.data.Store({url:Wtf.req.lms+"fetchTags.jsp",reader:new Wtf.data.JsonReader({root:"data",id:"res-reader"},this.RES)});this.MSComboconfig={store:this.allResources,displayField:"tagname",valueField:"tagid",triggerAction:"all",mode:"local"};this.allResources.load({params:{flag:0,nodeid:A.attributes.id}});this.typeWin=new Wtf.Window({title:"Add Tags",closable:true,modal:true,iconCls:"win",width:400,height:120,layout:"fit",scope:this,resizable:false,buttons:[{text:"OK",scope:this,handler:function(){Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"GET",params:({tags:this.multi.getValue(),flag:0,nodeid:A.attributes.id,type:"content"}),scope:this,success:function(B,C){this.typeWin.close()},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}},{text:"Cancel",scope:this,handler:function(){this.typeWin.close()}}],items:[this.form=new Wtf.form.FormPanel({url:"admin.jsp?",waitMsgTarget:true,method:"POST",border:false,bodyStyle:"margin-top:10px;margin-left:10px;font-size:10px;",items:[{layout:"column",border:false,items:[{columnWidth:0.8,labelWidth:50,border:false,layout:"form",items:[this.multi=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,fieldLabel:"Tags",width:150,forceSelection:true},this.MSComboconfig))]},{border:false,layout:"form",items:[{xtype:"button",text:"New Tag",scope:this,handler:function(){this.mb=new Wtf.Window({height:100,title:"New Tag",width:250,modal:true,scope:this,resizable:false,bodyStyle:"margin: 10px 0 0 10px;float: right;",items:[this.tagField=new Wtf.form.TextField({width:210,scope:this,vtype:"alphanum"})],buttons:[{text:"OK",scope:this,handler:function(B,D){var C=this.tagField.getValue().trim();if(C.length>0&&this.tagField.isValid()){Wtf.Ajax.request({url:Wtf.req.lms+"fetchTags.jsp",method:"GET",params:({tag:this.tagField.getValue(),flag:1}),scope:this,success:function(E,F){this.allResources.reload()},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}});this.mb.close()}}},{text:"Cancel",scope:this,handler:function(){this.mb.close()}}]});this.mb.show()}}]}]}]})]});this.allResources.on("load",function(){var B=[];for(var C=0;C<this.allResources.getCount();C++){if(this.allResources.getAt(C).data["check"]==1){B.push(this.allResources.getAt(C).data["tagid"])}}this.multi.setValue(B)},this);this.typeWin.show()},getRuleInfo:function(B,A){if(A.ctCls=="ruleInfo"){Wtf.Ajax.request({url:"jspfiles/lms/CreateCourse.jsp",params:{flag:27,courseid:this.courseid,nodeid:this.mytree.getSelectionModel().getSelectedNode().attributes.id},method:"POST",scope:this,success:function(D,C){this.rulesdiv.innerHTML="";var J=Wtf.decode(D.responseText);if(J.dates[0]!=null){this.datediv=document.createElement("div");this.datediv.innerHTML="<b>Publish & Expiry Date :</b><hr>"+J.dates[0].pubdate+"<br>"+J.dates[0].expdate+"<br>";this.datediv.innerHTML+="<br>";this.rulesdiv.appendChild(this.datediv)}else{var I=document.createElement("div");I.className="setdate";var F=document.createElement("label");var E=document.createElement("a");E.className="anchor";E.innerHTML="Set Date";E.onclick=this.showExpiryScreen.createDelegate(this);F.innerHTML="<b>Publish & Expiry Date :</b><hr>Publish & Expiry Date not set.";F.appendChild(E);I.appendChild(F);this.rulesdiv.appendChild(I)}if(J.success[0]!=null){var H=this.mytree.getSelectionModel().getSelectedNode().attributes.text;this.rulediv=document.createElement("div");for(var K=0;K<J.success[0].lnum.length;K++){var G=J.success[0].nodetext[K];this.rulediv.innerHTML+="<b>Rules :</b>"+H+"-->"+G+"<hr>";if(J.success[0].lnum[K]!=-1){this.rulediv.innerHTML+="When attempts are less than <label class='ruletxt'>"+J.success[0].lnum[K]+"</label><br>"}if(J.success[0].gnum[K]!=-1){this.rulediv.innerHTML+="When attempts are greater than <label class='ruletxt'>"+J.success[0].gnum[K]+"</label><br>"}if(J.success[0].lper[K]!=-1){this.rulediv.innerHTML+="When score is less than <label class='ruletxt'>"+J.success[0].lper[K]+"</label><br>"}if(J.success[0].gper[K]!=-1){this.rulediv.innerHTML+="When score is greater than <label class='ruletxt'>"+J.success[0].gper[K]+"</label><br>"}if(J.success[0].ldate[K]!="1899-12-31 18:30:00"){this.rulediv.innerHTML+="When completed before <label class='ruletxt'>"+J.success[0].ldate[K]+"</label><br>"}if(J.success[0].gdate[K]!="1899-12-31 18:30:00"){this.rulediv.innerHTML+="When completed after <label class='ruletxt'>"+J.success[0].gdate[K]+"</label><br>"}if(J.success[0].completed[K]!=-1){this.rulediv.innerHTML+="When completed</label><br>"}this.rulediv.innerHTML+="<br>"}this.rulesdiv.appendChild(this.rulediv)}else{var I=document.createElement("div");I.className="setdate";var F=document.createElement("label");var E=document.createElement("a");E.className="anchor";E.innerHTML="Set Rules";E.onclick=this.showPedagogy.createDelegate(this);F.innerHTML="<b>Rules :</b><hr>No rules defined yet.";F.appendChild(E);I.appendChild(F);this.rulesdiv.appendChild(I)}}})}},saveNodeInfo:function(E,F,D){var B=Wtf.decode(F[0].data.content);if(B.attempts!=null){var C=B.attempts[0];C=C+1}else{C=1}if(B.startedon!=null){var A=B.startedon[0]}else{A="Not Available"}if(B.lastaccess!=null){var H=B.lastaccess[0]}else{H="Not Available"}if(this.node.attributes.cls=="quizclass"||this.node.attributes.cls=="rquizclass"){C=C-1}this.scope.nodeInfo[this.node.attributes.id]=A+"_"+H+"_"+C;this.scope.conInfo.body.dom.innerHTML="<div class='infocon'><div class='info'><label class='nodeinfo'>Start Date : "+A+"</label></div><div class='info'><label class='nodeinfo'>Last Accessed : "+H+"</label></div><div class='info'><label class='nodeinfo'>Attempts : "+C+"</label></div></div>";this.starton=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["nodes","nodeid","refnode"])});var G=this.scope.getObjId(this.node.attributes.id);if(this.node.attributes.cls!="quizclass"&&this.node.attributes.cls!="rquizclass"){this.starton.load({params:{flag:"13",nodeid:G,userid:loginid,attempt:C,courseid:this.scope.courseid}});this.starton.on("load",this.scope.appendRuleNodes,this.scope)}},appendRuleNodes:function(E,F,C){if(F[0].json.nodes[0]!=null){var B=this.root.childNodes.length;var A=this.root.childNodes;this.mytree.getRootNode().select();for(var D=0;D<B;D++){this.root.removeChild(A.shift())}this.loadNodes()}},appendToTree:function(F,E,B){var G=B.id;var A="";var D="";if(B.flag==2){A="quizclass";D="quiz"}else{if(B.flag==3){A="sectionclass";D="file"}else{if(B.flag==6){A="fileclass";D="file"}}}var H=new Wtf.tree.TreeNode({id:G,cls:A,text:B.text,qtip:B.text,iconCls:D,expanded:true});if(E!=null){var C=this.mytree.getNodeById(E)}if(C!=null){this.mytree.getNodeById(E).parentNode.insertBefore(H,C)}else{this.mytree.getNodeById(F).appendChild(H)}if(B.children!=null){this.appendChildNodes(H,B.children)}},createSectionNode:function(B){var A=null;B.appendChild(new Wtf.tree.TreeNode({id:"secnode"+this.i,iconCls:"file",cls:"sectionclass",text:"New Section"+this.i,qtip:"New Section"+this.i,expanded:true,lobject:"0"}));A=this.mytree.getSelectionModel().getSelectedNode().attributes.id;this.store1.load({params:{flag:"3",courseid:this.courseid,cls:3,text:"New Section"+this.i,parentid:A,id:"secnode"+this.i,level:this.treeNodelevel}});this.i++},createlink:function(A){this.linkWin=new Wtf.Window({title:"Task",closable:true,iconCls:"win",width:350,height:180,scope:this,layout:"form",bodyStyle:"padding:5px 5px 0",resizable:false,buttons:[{text:"OK",scope:this,handler:function(){var B=null;var D=this.linkTitle.getValue();A.appendChild(new Wtf.tree.TreeNode({id:"linknode"+this.i,iconCls:"file",cls:"linkclass",text:D,qtip:D,expanded:true}));var C=this.editlink.getValue();B=this.mytree.getSelectionModel().getSelectedNode().attributes.id;this.store1.load({params:{flag:"3",courseid:this.courseid,cls:7,text:D,parentid:B,id:"linknode"+this.i,level:this.treeNodelevel,link:C}});this.i++;this.linkWin.close()}},{text:"Cancel",scope:this,handler:function(){this.linkWin.close()}}],items:[new Wtf.form.FormPanel({border:false,bodyStyle:"margin: 20px",items:[this.linkTitle=new Wtf.form.TextField({fieldLabel:"Title*",width:180,labelWidth:20,scope:this,allowBlank:false}),this.editlink=new Wtf.form.TextField({fieldLabel:"Link/URL*",id:"url",name:"name",width:180,labelWidth:20,scope:this,allowBlank:false})]})]});this.linkWin.show()},hello:function(G,F,B){var H=(F[0].data.content);var I=H.split(",");var A=I[0];var J=I[1];var D=this.mytree.getNodeById(J).parentNode;var E=this.mytree.getNodeById(J).attributes.text;var C=this.mytree.getNodeById(J).attributes.cls;if(C=="sectionclass"){this.mytree.getNodeById(J).remove();this.createNode(D,A,"sectionclass",E,"file")}else{if(C=="quizclass"){this.mytree.getNodeById(J).remove();this.createNode(D,A,"quizclass",E,"quizIcon")}else{if(C=="rquizclass"){this.mytree.getNodeById(J).remove();this.createNode(D,A,"rquizclass",E,"quizIcon")}else{if(C=="fileclass"){var K=this.mytree.getNodeById(J).attributes.icon;this.mytree.getNodeById(J).remove();D.appendChild(new Wtf.tree.TreeNode({id:A,cls:"fileclass",icon:K,text:E,qtip:E,iconCls:"file",expanded:true}))}else{if(C=="linkclass"){this.mytree.getNodeById(J).remove();this.createNode(D,A,"linkclass",E,"file")}}}}}D.expand()},createNode:function(C,D,A,E,B){C.appendChild(new Wtf.tree.TreeNode({id:D,cls:A,text:E,qtip:E,iconCls:B,expanded:true,owner:true,auth:loginid,lobject:"0"}))},delNode:function(G,E,B){this.cnt=0;this.arr_nodes=[];var D=this.mytree.getNodeById(B.params.nodeid);this.arr_nodes[this.cnt]=D;this.cnt++;if(D.firstChild==null){if(Wtf.getCmp("tab"+D.attributes.id)!=null){if(Wtf.getCmp("tab"+D.attributes.id).ctCls=="section"){Wtf.getCmp("tab"+D.attributes.id).editor.saveflag=0}this.tabPanelContainer.setActiveTab("tab"+D.attributes.id);this.tabPanelContainer.findById("tab"+D.attributes.id).closeflag=1;this.tabPanelContainer.remove("tab"+D.attributes.id)}D.remove()}else{var A=this.getChildNodes(D.firstChild);for(F=A.length-1;F>=0;F--){if(Wtf.getCmp("tab"+A[F].attributes.id)!=null){if(A[F].attributes.cls=="sectionclass"){Wtf.getCmp("tab"+A[F].attributes.id).editor.saveflag=0}this.tabPanelContainer.setActiveTab("tab"+A[F].attributes.id);this.tabPanelContainer.findById("tab"+A[F].attributes.id).closeflag=1;this.tabPanelContainer.remove("tab"+A[F].attributes.id)}A[F].remove()}}var J=this.pnode.childNodes;var I="";var C="";for(var F=0;F<J.length;F++){I+=J[F].attributes.id+",";C+=this.pnode.indexOf(J[F])+","}I=I.substring(0,I.length-1);C=C.substring(0,C.length-1);var H=this.getStore();H.load({params:{flag:"16",nodes:I,level:C}})},loadNodes:function(A){if(this.use==0){this.store4.load({params:{flag:"uuid",courseid:this.courseid}})}else{if(this.use==2){this.store4.load({params:{flag:this.courseid,objectids:A}})}else{if(this.mode==1){this.store3.load({params:{flag:"2",courseid:this.courseid,mode:1}})}else{this.store3.load({params:{flag:"2",courseid:this.courseid,mode:0}})}}}},addNodes:function(E,D,B){if(Wtf.isIE){this.addListener("activate",this.handleActivate,this)}this.mytree.getRootNode().select();for(var H=0;H<D.length;H++){var A=D[H].data.id;var K="";var J="";var I="";if(D[H].data.flag==2){K="quizclass";J="quizIcon"}else{if(D[H].data.flag==3){K="sectionclass";J="file"}else{if(D[H].data.flag==6){K="fileclass";J="file";var L=D[H].data.text.substring(D[H].data.text.lastIndexOf(".")+1);if(L=="doc"){I="images/lms/doc.png"}else{if(L=="pdf"){I="images/lms/pdf.png"}else{I="images/lms/txt.png"}}}else{if(D[H].data.flag==7){K="linkclass";J="file"}else{if(D[H].data.flag==8){K="rquizclass";J="quizIcon"}else{if(D[H].json.wr){msgBoxShow(["Warning","Same Object is already present."]);break}}}}}}if(this.mode==1){A=this.combId(A,this.vid)}var C=new Wtf.tree.TreeNode({id:A,cls:K,text:D[H].data.text,qtip:D[H].data.text,iconCls:J,icon:I,expanded:true,lock:D[H].data.lock,lockAuthor:D[H].data.lockauthor,lobject:D[H].data.iobject,auth:D[H].data.loauth,attemp:D[H].data.qattemp});var G=(D[H].json.pubdate);var F=(D[H].json.expdate);if(G!="1970-01-01"){this.pubexpArray[A]=G+"_"+F}this.root.appendChild(C);if(D[H].data.children!=""){this.appendChildNodes(C,D[H].data.children)}}this.root.expand()},appendChildNodes:function(D,H){for(var G=0;G<H.length;G++){var A="";var B="";var C="";if(H[G].flag==2){A="quizclass";B="quizIcon"}else{if(H[G].flag==3){A="sectionclass";B="file"}else{if(H[G].flag==6){A="fileclass";B="file";var E=H[G].text.substring(H[G].text.lastIndexOf(".")+1);if(E=="doc"){C="images/lms/doc.png"}else{if(E=="pdf"){C="images/lms/pdf.png"}else{C="images/lms/txt.png"}}}else{if(H[G].flag==7){A="linkclass";B="file"}else{if(H[G].flag==8){A="rquizclass";B="quizIcon"}}}}}if(this.mode==1){nodeid=this.combId(H[G].id,this.vid)}else{nodeid=H[G].id}var F=new Wtf.tree.TreeNode({id:nodeid,cls:A,text:H[G].text,qtip:H[G].text,iconCls:B,icon:C,expanded:true,lock:H[G].lock,lockAuthor:H[G].lockauthor,lobject:H[G].iobject,auth:H[G].loauth,attemp:H[G].qattemp});D.appendChild(F);if(H[G].children!=""){this.appendChildNodes(F,H[G].children)}}},createRQuizNode:function(B){var A=null;B.appendChild(new Wtf.tree.TreeNode({id:"rquiznode"+this.r,cls:"rquizclass",text:"New Random Quiz"+this.r,qtip:"New Random Quiz"+this.r,iconCls:"quizIcon",expanded:true,owner:true,auth:loginid}));A=this.mytree.getSelectionModel().getSelectedNode().attributes.id;this.store1.load({params:{flag:"3",courseid:this.courseid,cls:8,text:"New Random Quiz"+this.r,parentid:A,id:"rquiznode"+this.r,level:this.treeNodelevel}});this.r++},createQuizNode:function(B){var A=null;B.appendChild(new Wtf.tree.TreeNode({id:"quiznode"+this.j,cls:"quizclass",text:"New Quiz"+this.j,qtip:"New Quiz"+this.j,iconCls:"quizIcon",expanded:true,owner:true,auth:loginid}));A=this.mytree.getSelectionModel().getSelectedNode().attributes.id;this.store1.load({params:{flag:"3",courseid:this.courseid,cls:2,text:"New Quiz"+this.j,parentid:A,id:"quiznode"+this.j,level:this.treeNodelevel}});this.j++},createFileNode:function(C,A,D,E){var B=null;C.appendChild(new Wtf.tree.TreeNode({id:"filenode"+this.k,cls:"fileclass",icon:D,text:A,qtip:A,iconCls:"file",expanded:true}));B=this.mytree.getSelectionModel().getSelectedNode().attributes.id;this.store1.load({params:{flag:"3",courseid:this.courseid,cls:6,text:A,parentid:B,path:D,id:"filenode"+this.k,level:this.treeNodelevel,fileid:E}});this.k++},uploadfile:function(A){this.UploadPanel=new Wtf.FormPanel({border:false,width:"100%",frame:true,method:"POST",fileUpload:true,url:"FileUpload.jsp?flag=2&courseid="+this.courseid,labelWidth:125,items:[new Wtf.form.TextField({id:"uploadbttn1",inputType:"file",fieldLabel:"Select a file to Upload"})]});this.upWin=new Wtf.Window({border:false,modal:true,resizable:false,iconCls:"winicon",width:415,title:"Upload File...",items:[this.UploadPanel],buttons:[{text:"Upload",cls:"canbttn",scope:this,handler:function(){if(Wtf.getCmp("uploadbttn1").getValue()!=""){this.UploadPanel.form.submit({scope:this,success:function(B,D){var E;var C=D.result.success.filename;var G=D.result.success.fileid;var F=C.substring(C.lastIndexOf(".")+1);if(F=="doc"){E="images/lms/doc.png"}else{if(F=="pdf"){E="images/lms/pdf.png"}else{E="images/lms/txt.png"}}this.createFileNode(A,C,E,G);this.upWin.close()},failure:function(B,C){msgBoxShow(["Error","A problem occurred while uploading"],Wtf.MessageBox.ERROR)}})}}},{text:"Cancel",cls:"canbttn",scope:this,handler:function(){this.upWin.close()}}]});this.upWin.show()},getFileName:function(B){var C=B.lastIndexOf("\\");var A=B.substring(C+1,B.length);return A},getFileExtension:function(B){var C=B.lastIndexOf(".");var A=B.substring(C+1,B.length);return A},OnDblClick:function(F,J){F.select();if(this.mode==1&&F.attributes.cls!="rootclass"){this.getNodeInfo=this.getStore();this.getNodeInfo.on("load",this.saveNodeInfo,{scope:this,node:F});var A=this.getObjId(F.attributes.id);this.getNodeInfo.load({params:{flag:"14",nodeid:A,userid:loginid,courseid:this.courseid}});var L=F.attributes.cls;if(L=="sectionclass"||L=="fileclass"){this.txt.innerHTML="Mark As Completed";this.txt.onclick=this.markCompleted.createDelegate(this)}else{if(L=="quizclass"){this.txt.innerHTML="Start Quiz";this.txt.onclick=this.startQuiz.createDelegate(this)}else{if(L=="rquizclass"){this.txt.innerHTML="Start Random Quiz";this.txt.onclick=this.startRquiz.createDelegate(this)}}}this.task2.appendChild(this.img);this.task3.appendChild(this.txt);this.task1.appendChild(this.task2);this.task1.appendChild(this.task3);this.tasks.appendChild(this.task1);if(Wtf.get("link"+F.attributes.id)==null){var P=document.createElement("div");P.className="con1";P.id="link"+F.attributes.id;var O=document.createElement("div");O.className="con2";var N=document.createElement("div");N.className="con3";N.onclick=this.selectTab.createDelegate(this);var H=document.createElement("span");H.innerHTML=F.attributes.text;H.onmouseover=this.changeColorBlue.createDelegate(this);H.onmouseout=this.changeColorBlack.createDelegate(this);var G=document.createElement("img");G.src="images/lms/bullet.GIF";O.appendChild(G);N.appendChild(H);P.appendChild(O);P.appendChild(N);this.openTabs.appendChild(P)}}else{if(F.attributes.lobject=="1"&&!(loginid==F.attributes.auth)){var M=Wtf.getCmp("tab"+F.attributes.id);if(M==null){if(F.attributes.cls=="sectionclass"){var A=this.getObjId(F.attributes.id);var F=this.mytree.getSelectionModel().getSelectedNode();this.tabPanelContainer.add(this.section=new Wtf.prevTemp({border:false,id:"tab"+F.attributes.id,ctCls:"section",title:F.attributes.text,closable:true,cat:1,layout:"fit",mode:1,cid:this.courseid,lmode:F.attributes.lobject=="1"?1:this.mode,node:F,nid:A}));this.tabPanelContainer.activate("tab"+F.attributes.id);this.RightTabPanel.activate("subtab1"+this.id);this.tabPanelContainer.ownerCt.doLayout()}}}}if(F.attributes.cls=="rootclass"){if(this.mode!=1){this.getContentInfo.on("load",this.showCourseInfo,this);this.getContentInfo.load({params:{flag:"12",nodeid:F.attributes.id}})}}else{var E="tab"+F.attributes.id;var M=Wtf.getCmp(E);if(M==null){if(F.attributes.cls=="sectionclass"){var C;var K;if(F.attributes.lobject=="1"){C=1;K=""}else{C=this.mode;K=this.courseid}var A=this.getObjId(F.attributes.id);var F=this.mytree.getSelectionModel().getSelectedNode();this.tabPanelContainer.add(new Wtf.MyEditor({border:false,id:E,ctCls:"section",title:F.attributes.text,closable:true,closeflag:0,mycontenteditor:this,layout:"fit",mode:this.mode,cid:K,lmode:C,nid:A,node:F}));this.tabPanelContainer.activate(E);this.RightTabPanel.activate("subtab1"+this.id);this.tabPanelContainer.ownerCt.doLayout();this.saveBtn1.enable();Wtf.getCmp(E).loadContent.show()}else{if(F.attributes.cls=="quizclass"){if(this.mode==1){this.tabPanelContainer.add(this.obj=new Wtf.prevTemp({id:E,ctCls:"quizclass",title:F.attributes.text,closable:true,layout:"fit",quizView:1,nid:A,scope:this,node:F,bbar:[this.stquiz=new Wtf.Toolbar.Button({text:"Start Quiz",scope:this,disabled:true,handler:function(){var S=this.mytree.getSelectionModel().selNode;var R=this.nodeInfo[S.attributes.id].split("_");var U=1+parseInt(R[2]);this.nodeInfo[S.attributes.id]=R[0]+"_"+R[1]+"_"+U;if(U>=parseInt(S.attributes.attemp)&&S.attributes.attemp!=""){this.stquiz.disable();this.txt.setAttribute("flag",false)}else{this.stquiz.enable()}var Q="";var T="1?tab"+A+"?simp?"+this.courseid;Q+=escape(T);window.open("qpreview.html?"+Q,"fs","fullscreen=yes","titlebar=no")}})]}))}else{var D;var B=this.mytree.getSelectionModel().getSelectedNode().attributes.auth;if(B==loginid||Wtf.isContentDesigner()){D=true}else{D=false}this.tabPanelContainer.add(this.quiz=new Wtf.quizPanel({border:false,compId:this,id:E,ctCls:"quizclass",title:F.attributes.text,closable:true,layout:"fit",owner:D,cid:this.courseid}))}this.tabPanelContainer.activate(E);this.tabPanelContainer.ownerCt.doLayout();this.RightTabPanel.activate("subtab2"+this.id);if(this.mode==1){var I="Assessment : "+F.attributes.text;this.obj.headerPanel.body.dom.innerHTML="<div id='labelCont'><label class='prevLabel'>"+I+"</label></div>";this.obj.loadContent.show()}else{this.quiz.loadQuiz.show()}}else{if(F.attributes.cls=="fileclass"){Wtf.getCmp("subtab3"+this.id).enable()}else{if(F.attributes.cls=="linkclass"){var A=null;if(this.mode==1){A=this.getObjId(F.attributes.id)}else{A=F.attributes.id}this.linkDs=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"catalog.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["filename","link","author"])});this.linkDs.load({params:{flag:5,nodeid:A}});this.linkDs.on("load",this.openWindow,this)}else{if(F.attributes.cls=="rquizclass"){if(this.mode==1){var A=this.getObjId(F.attributes.id);this.tabPanelContainer.add(this.obj=new Wtf.prevTemp({id:E,ctCls:"rquizclass",title:F.attributes.text,closable:true,scope:this,layout:"fit",rquizView:1,scope:this,nid:A,node:F,bbar:[this.strquiz=new Wtf.Toolbar.Button({text:"Start Quiz",scope:this,disabled:true,handler:function(){var S=this.mytree.getSelectionModel().selNode;var R=this.nodeInfo[S.attributes.id].split("_");var U=1+parseInt(R[2]);this.nodeInfo[S.attributes.id]=R[0]+"_"+R[1]+"_"+U;if(U>=parseInt(S.attributes.attemp)&&S.attributes.attemp!=""){this.strquiz.disable();this.txt.setAttribute("flag",false)}else{this.strquiz.enable()}var Q="";var T="1?tab"+A+"?rand?"+this.courseid;Q+=escape(T);window.open("qpreview.html?"+Q,"fs","fullscreen=yes","titlebar=no")}})]}))}else{var D;var B=this.mytree.getSelectionModel().getSelectedNode().attributes.auth;if(B==loginid||Wtf.isContentDesigner()){D=true}else{D=false}this.tabPanelContainer.add(this.obj=new Wtf.randomQuiz({title:F.attributes.text,id:E,tabPanelContainer:this.tabPanelContainer,closable:true,ctCls:"rquizclass",nodeid:F.attributes.id,layout:"fit",nodeid:F.attributes.id,cid:this.courseid,owner:D}))}this.tabPanelContainer.activate(E);this.tabPanelContainer.ownerCt.doLayout();if(this.mode==1){this.obj.loadContent.show();var I="Assessment : "+F.attributes.text;this.obj.headerPanel.body.dom.innerHTML="<div id='labelCont'><label class='prevLabel'>"+I+"</label></div>"}else{this.obj.loadrQuiz.show()}}}}}}}else{if(F.attributes.cls=="sectionclass"){this.tabPanelContainer.activate(E);this.RightTabPanel.activate("subtab1"+this.id)}else{if(F.attributes.cls=="quizclass"){this.tabPanelContainer.activate(E);this.RightTabPanel.activate("subtab2"+this.id)}else{if(F.attributes.cls=="rquizclass"){this.tabPanelContainer.activate(E)}}}}}},openWindow:function(E,F,B){var D=F[0].data.filename;var A=F[0].data.link;var C=F[0].data.author;if(this.tabPanelContainer.getActiveTab()){this.mytree.getSelectionModel().select(this.mytree.getNodeById(this.tabPanelContainer.getActiveTab().id.substring(3)))}else{this.mytree.getSelectionModel().select(this.mytree.getRootNode())}window.open(A);window.close()},startQuiz:function(){var C=this.mytree.getSelectionModel().selNode;var B=this.nodeInfo[C.attributes.id].split("_");var E=1+parseInt(B[2]);this.nodeInfo[C.attributes.id]=B[0]+"_"+B[1]+"_"+E;if(this.txt.getAttribute("flag")=="true"){if(E>=C.attributes.attemp&&C.attributes.attemp!=""){this.txt.setAttribute("flag",false);this.stquiz.disable()}var A="";var C=this.mytree.getSelectionModel().getSelectedNode();var G=this.getObjId(C.attributes.id);var D="1?tab"+G;A+=escape(D);window.open("qpreview.html?"+A,"fs","fullscreen=yes","titlebar=no")}else{var F="";if(this.msg==0){F="Questions are not available for this quiz"}else{F="Maximum attempts allowed for this quiz is: "+C.attributes.attemp}msgBoxShow(["Status",F],Wtf.MessageBox.INFO)}},startRquiz:function(){var C=this.mytree.getSelectionModel().selNode;var B=this.nodeInfo[C.attributes.id].split("_");var E=1+parseInt(B[2]);this.nodeInfo[C.attributes.id]=B[0]+"_"+B[1]+"_"+E;if(this.txt.getAttribute("flag")=="true"){if(E>=C.attributes.attemp&&C.attributes.attemp!=""){this.txt.setAttribute("flag",false);this.stquiz.disable()}var A="";var C=this.mytree.getSelectionModel().getSelectedNode();var G=this.getObjId(C.attributes.id);var D="1?tab"+G+"?rand?"+this.courseid;A+=escape(D);window.open("qpreview.html?"+A,"fs","fullscreen=yes","titlebar=no")}else{var F="";if(this.msg==0){F="Questions are not available for this quiz"}else{F="Maximum attempts allowed for this quiz is: "+C.attributes.attemp}msgBoxShow(["Status",F],Wtf.MessageBox.INFO)}},markCompleted:function(){Wtf.MessageBox.show({title:"Submit",msg:"Do you want to mark this section completed ?",buttons:Wtf.MessageBox.OKCANCEL,animEl:"upwin",icon:Wtf.MessageBox.QUESTION,scope:this,fn:function(B){if(B=="ok"){var C=this.mytree.getSelectionModel().getSelectedNode().attributes.id;var D=this.getObjId(C);var A=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["nodes","nodeid","refnode"])});A.load({params:{flag:"23",secid:D,cmpflag:"1"}});A.on("load",this.result,this)}}})},result:function(E,F,C){if(F[0].json.nodes[0]!=null){var B=this.root.childNodes.length;var A=this.root.childNodes;this.mytree.getRootNode().select();for(var D=0;D<B;D++){this.root.removeChild(A.shift())}this.loadNodes()}},showCourseInfo:function(C,D,B){var A=Wtf.decode(D[0].json.content);var C=new Wtf.createCourse({courseid:this.courseid,root:this.root});C.title1.value=A.coursename[0];C.desc.value=A.description[0];C.img1.src=Wtf.getLmsImgPath+A.contenturl[0];C.img1.value=Wtf.getLmsImgPath+A.contenturl[0];C.show();Wtf.getCmp("createbttn").enable()},showPedagogy:function(){this.openPedagogy()},openPedagogy:function(){var A="ped"+this.id;this.openTab(A,Wtf.LMSlayout,{layout:"fit",border:false,courseid:this.courseid,root:this.root,mytree:this.mytree,pubexpArray:this.pubexpArray,editor:this,id:"ped"+this.id,closable:true,title:"Pedagogy"})},openTab:function(D,B,A){var C=Wtf.getCmp(D);if(!C){C=new B(A);mainPanel.add(C);mainPanel.activate(C);mainPanel.doLayout()}mainPanel.setActiveTab(C)},setQattemp:function(B,C,A){this.maxAttmpField.setValue(C[0].data.qattemp)},setQtime:function(B,C,A){this.quizHr.setValue(C[0].data.hour);this.quizMin.setValue(C[0].data.min)},getTimearr:function(){var A=Wtf.data.Record.create([{name:"value"},{name:"state"}]);for(var B=0;B<=99;B++){this.hrStore.add(new A({value:B,state:B}));if(B<=60){this.minStore.add(new A({value:B,state:B}))}}},showmaxQuizTime:function(B){27;this.qtiStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"quiz.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["hour","min"])});this.qtiStore.load({params:{flag:"14",cid:this.courseid,nodeid:B.attributes.id}});this.qtiStore.on("load",this.setQtime,this);this.hrStore=new Wtf.data.SimpleStore({fields:["value","state"],data:[]});this.minStore=new Wtf.data.SimpleStore({fields:["value","state"],data:[]});this.getTimearr();var A=new Wtf.form.FormPanel({frame:true,layout:"column",labelWidth:70,items:[{columnWidth:0.5,layout:"form",items:[this.quizHr=new Wtf.form.ComboBox({fieldLabel:"Hour(s)*",editable:false,store:this.hrStore,displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,width:75,allowBlank:false})]},{columnWidth:0.5,layout:"form",items:[this.quizMin=new Wtf.form.ComboBox({fieldLabel:"Minutes(s)*",editable:false,store:this.minStore,displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,width:75,allowBlank:false})]}],buttons:[{text:"OK",scope:this,handler:function(){if(A.form.isValid()){if(this.quizMin.getValue()==0&&this.quizHr.getValue()==0){this.quizMin.markInvalid("Time limit cannot be zero")}else{Wtf.Ajax.request({url:Wtf.req.lms+"quiz.jsp",method:"POST",params:({flag:13,cid:this.courseid,nodeid:B.attributes.id,hr:this.quizHr.getValue(),min:this.quizMin.getValue()}),scope:this,success:function(D){if(D.responseText.trim()=="true"){msgBoxShow(["Success","Time limit set successfully."],Wtf.MessageBox.INFO)}},failure:function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}});C.close()}}}},{text:"Cancel",scope:this,handler:function(){C.close()}}]});var C=new Wtf.Window({title:"Maximum Quiz Time",closable:true,iconCls:"winicon",modal:true,resizable:false,width:340,items:[A]});C.show()},showmaxAttmp:function(B){this.attStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"quiz.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["qattemp"])});this.attStore.load({params:{flag:"12",cid:this.courseid,nodeid:B.attributes.id}});this.attStore.on("load",this.setQattemp,this);var A=new Wtf.form.FormPanel({frame:true,layout:"form",labelWidth:110,items:[this.maxAttmpField=new Wtf.form.NumberField({fieldLabel:"Maximum Attempts*",width:150,minValue:1,maxValue:100,allowBlank:false})],buttons:[{text:"OK",scope:this,handler:function(){if(A.form.isValid()){Wtf.Ajax.request({url:Wtf.req.lms+"quiz.jsp",method:"POST",params:({flag:11,cid:this.courseid,nodeid:B.attributes.id,attemp:this.maxAttmpField.getValue()}),scope:this,success:function(D){if(D.responseText.trim()=="true"){msgBoxShow(["Success","Maximum attempts set successfully."],Wtf.MessageBox.INFO)}},failure:function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}});C.close()}}},{text:"Cancel",scope:this,handler:function(){C.close()}}]});var C=new Wtf.Window({title:"Maximum Attempts",closable:true,iconCls:"winicon",modal:true,resizable:false,width:300,items:[A]});C.show()},showExpiryScreen:function(){var L;var E=true;var J;var H;var A;if(this.mytree){A=this.mytree.getSelectionModel().getSelectedNode().attributes.id;if(this.pubexpArray[A]){var C=(this.pubexpArray[A]).split("_");J=C[0];H=C[1]}else{J=new Date().format("Y-m-d");H=new Date().format("Y-m-d")}}else{var B=(this.blockId).split("/");if(this.scope.mainobj.pubArray[B[1]]){var C=(this.scope.mainobj.pubArray[B[1]]).split("_");J=C[0];H=C[1]}else{J=new Date().format("Y-m-d");H=new Date().format("Y-m-d")}}var I=new Wtf.Panel({frame:true,layout:"column",items:[{columnWidth:1,layout:"form",height:30,items:[L=new Wtf.form.DateField({id:"PubDate",fieldLabel:"To Publish on",width:150,value:J,format:"Y-m-d",validator:function(){var M=new Date().dateFormat("Y-m-d");var N=Wtf.getCmp("PubDate").getRawValue();if(N<M){E=false;return"Should be future date"}else{return true}}})]},{columnWidth:1,layout:"column",height:30,items:[{columnWidth:0.5,layout:"form",items:[new Wtf.form.Checkbox({id:"expCheck",fieldLabel:"Expires on",checked:true})]},{columnWidth:0.5,layout:"form",items:[date2=new Wtf.form.DateField({id:"ExpOnDate",width:120,hideLabel:true,format:"Y-m-d",value:H,validator:function(){var M=Wtf.getCmp("ExpOnDate").getRawValue();var N=Wtf.getCmp("PubDate").getRawValue();if(M<N){E=false;return"Should be future date"}else{return true}}})]}]},{columnWidth:1,layout:"column",height:30,items:[{columnWidth:0.8,layout:"form",items:[text1=new Wtf.form.NumberField({id:"ExpAftDate",fieldLabel:"Or Expires After",disabled:true,width:100,minValue:0,maxValue:100})]},{columnWidth:0.2,html:"<label id='days'>days</label>"}]},{columnWidth:1,height:30,layout:"column",items:[{columnWidth:0.4,layout:"form",layoutConfig:{labelSeparator:""},labelWidth:0,items:[new Wtf.form.Checkbox({hidden:true})]},{columnWidth:0.6,layout:"form",layoutConfig:{labelSeparator:""},bodyStyle:"margin-left:-5px",labelWidth:0,items:[chk1=new Wtf.form.Checkbox({id:"chk1",boxLabel:"or Never Expires"})]}]},{columwidth:1},{columnWidth:1,items:[{buttons:[{text:"OK",scope:this,handler:function(){var M=false;if(this.RightTabPanel){this.RightTabPanel.activate("subtab1"+this.id)}var P=Wtf.getCmp("PubDate").getRawValue();var N;if(!Wtf.getCmp("ExpOnDate").disabled){N=Wtf.getCmp("ExpOnDate").getRawValue()}else{if(!Wtf.getCmp("ExpAftDate").disabled){var O=Wtf.getCmp("ExpAftDate").getValue();N=((Wtf.getCmp("PubDate").getValue()).add(Date.DAY,O)).format("Y-m-d")}else{N=""}}if(N!=""){if(N<P){M=true}}if(M||!Wtf.getCmp("PubDate").isValid()||!Wtf.getCmp("ExpOnDate").isValid()){msgBoxShow(["Error","Please enter valid date"],Wtf.MessageBox.ERROR)}else{if(this.mytree){this.pubStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["Details"])});this.pubStore.load({params:{flag:"8",courseid:this.courseid,nodeid:A,pubdate1:P,expdate:N}});this.pubexpArray[A]=P+"_"+N}else{var Q=(this.blockId).split("/");if(this.scope.mainobj.pubArray[Q[1]]){delete this.scope.mainobj.pubArray[Q[1]]}this.scope.mainobj.pubArray[Q[1]]=P+"_"+N}F.close()}}},{text:"Cancel",handler:function(){F.close()}}]}]}]});chk1.on("check",G);I.on("activate",D);Wtf.getCmp("expCheck").on("check",K);function K(N,M){if(M==true){Wtf.getCmp("ExpOnDate").enable();Wtf.getCmp("ExpAftDate").disable()}else{Wtf.getCmp("ExpAftDate").enable();Wtf.getCmp("ExpOnDate").disable()}}function D(){F.doLayout()}function G(N,M){if(M==true){Wtf.getCmp("ExpOnDate").disable();Wtf.getCmp("ExpAftDate").disable();Wtf.getCmp("expCheck").disable()}else{Wtf.getCmp("expCheck").enable();if(Wtf.getCmp("expCheck").checked==true){Wtf.getCmp("ExpOnDate").enable()}else{Wtf.getCmp("ExpAftDate").enable()}}}var F=new Wtf.Window({title:"Publish/Expiry Date",closable:true,iconCls:"winicon",modal:true,resizable:false,width:300,plain:true,items:[I]});F.show()},onTaskPaneToggle:function(A,B){if(B==false){Wtf.getCmp("east"+this.id).collapse()}else{Wtf.getCmp("east"+this.id).expand()}},onConLayoutToggle:function(A,B){if(B==false){Wtf.getCmp("west"+this.id).collapse()}else{Wtf.getCmp("west"+this.id).expand()}},ReflectOnTabChange:function(D,B){var A=this.mytree.getNodeById(B.id.substring(3));if(A!=null){A.select();if(this.mode==1){if(A.attributes.cls=="sectionclass"||A.attributes.cls=="fileclass"){this.txt.innerHTML="Mark As Completed";this.txt.onclick=this.markCompleted.createDelegate(this)}else{if(A.attributes.cls=="quizclass"){this.txt.innerHTML="Start Quiz";this.txt.onclick=this.startQuiz.createDelegate(this)}else{if(A.attributes.cls=="rquizclass"){this.txt.innerHTML="Start Random Quiz";this.txt.onclick=this.startRquiz.createDelegate(this)}}}}else{Wtf.getCmp("subtab3"+this.id).enable();if(B.ctCls=="filecls"){this.pubBtn1.disable()}else{this.pubBtn1.enable()}if(B.ctCls=="section"||B.ctCls=="fileclass"||B.ctCls=="rquizclass"){this.RightTabPanel.activate("subtab1"+this.id);Wtf.getCmp("subtab2"+this.id).disable()}else{if(B.ctCls=="quizclass"){var C=this.mytree.getSelectionModel().getSelectedNode().attributes.auth;if(C==loginid){Wtf.getCmp("subtab2"+this.id).enable();this.RightTabPanel.activate("subtab2"+this.id)}}}}if(A.attributes.cls=="sectionclass"&&A.attributes.lobject=="0"){this.saveBtn1.enable();this.saveBtn.enable()}else{this.saveBtn1.disable();this.saveBtn.disable()}}},setNodeIndex:function(A,C,D,B){this.treeNodelevel=B},callActivateTab:function(B,A){this.ActivateTab(A,B)},ActivateTab:function(B,D){if(this.mode==1){if(this.nodeInfo[B.attributes.id]!=null){var A=this.nodeInfo[B.attributes.id].split("_");this.conInfo.body.dom.innerHTML="<div class='infocon'><div class='info'><label class='nodeinfo'>Start Date : "+A[0]+"</label></div><div class='info'><label class='nodeinfo'>Last Accessed : "+A[1]+"</label></div><div class='info'><label class='nodeinfo'>Attempts : "+A[2]+"</label></div></div>"}else{this.conInfo.body.dom.innerHTML="<div class='infocon'><div class='info'><label class='nodeinfo'>Start Date : Not Attempted</label></div><div class='info'><label class='nodeinfo'>Last Accessed : Not Attempted</label></div><div class='info'><label class='nodeinfo'>Attempts : Not Attempted</label></div></div>"}}this.RightTabPanel.activate("subtab1"+this.id);var C=Wtf.getCmp("tab"+B.attributes.id);if(C!=null){this.tabPanelContainer.activate("tab"+B.attributes.id)}},showTab:function(B){var A=Wtf.getCmp("tab"+B);if(this.mytree.getNodeById(B).attributes.cls=="fileclass"){setDldUrl("fileDownload.jsp?courseid="+this.courseid+"&nodeid="+this.getObjId(B)+"&dtype=attachment&type=lms")}else{if(A){this.tabPanelContainer.activate("tab"+B)}}},ReflectTab:function(A,C,B){this.renStore=this.getStore();this.renStore.load({params:{flag:"7",nodeid:A.attributes.id,newtxt:C,courseid:this.courseid}});if(this.tabPanelContainer.findById("tab"+A.attributes.id)!=null){this.tabPanelContainer.findById("tab"+A.attributes.id).setTitle(C)}if(A.attributes.cls=="rootclass"){mainPanel.getActiveTab().setTitle(C)}},disableTabs:function(){if(this.tabPanelContainer.items.items.length==0){if(Wtf.getCmp("subtab2"+this.id)){Wtf.getCmp("subtab2"+this.id).disable()}if(Wtf.getCmp("subtab3"+this.id)){Wtf.getCmp("subtab3"+this.id).disable()}this.pubBtn1.enable();this.tabPanelContainer.ownerCt.doLayout()}},InsertSection:function(){if(this.mytree.getSelectionModel().getSelectedNode()!=null){var A=this.mytree.getSelectionModel().getSelectedNode();this.createSectionNode(A)}},InsertQuiz:function(){if(this.mytree.getSelectionModel().getSelectedNode()!=null){var A=this.mytree.getSelectionModel().getSelectedNode();this.createQuizNode(A)}},InsertFile:function(){if(this.mytree.getSelectionModel().getSelectedNode()!=null){var A=this.mytree.getSelectionModel().getSelectedNode();this.uploadfile(A)}},getChildNodes:function(A){this.arr_nodes[this.cnt]=A;this.cnt++;if(A.firstChild!=null){this.getChildNodes(A.firstChild)}if(A.nextSibling!=null){this.getChildNodes(A.nextSibling)}return this.arr_nodes},beforeTabRemove:function(A,B){var C=B.id.split("tab")[1];if(this.mode==1){if(Wtf.get("link"+C)!=null){this.openTabs.removeChild(document.getElementById("link"+C))}}if(B.closeflag==1){if(this.tabPanelContainer.items.items.length==1){this.mytree.getSelectionModel().select(this.mytree.getNodeById(C));this.saveBtn1.disable()}return true}else{if(B.ctCls=="section"&&Wtf.getCmp(B.id).editor){if(Wtf.getCmp(B.id).editor.saveflag==1){Wtf.MessageBox.show({title:"Save",msg:"Do you want to save the changes?",buttons:Wtf.MessageBox.YESNOCANCEL,animEl:"upwin",icon:Wtf.MessageBox.INFO,scope:this,fn:this.getChoice});return false}else{if(this.tabPanelContainer.items.items.length==1){this.mytree.getSelectionModel().select(this.mytree.getNodeById(C));this.saveBtn1.disable()}return true}}else{if(this.tabPanelContainer.items.items.length==1){this.mytree.getSelectionModel().select(this.mytree.getNodeById(C));this.saveBtn1.disable()}return true}}},getChoice:function(A){if(A=="yes"){this.saveContent();this.tabPanelContainer.getActiveTab().closeflag=1;this.tabPanelContainer.remove(this.tabPanelContainer.getActiveTab().id)}else{if(A=="no"){this.tabPanelContainer.getActiveTab().closeflag=1;this.tabPanelContainer.remove(this.tabPanelContainer.getActiveTab().id)}else{if(A=="cancel"){this.tabPanelContainer.getActiveTab().closeflag=0}}}},saveContent:function(){if(this.tabPanelContainer.getActiveTab()!=null){var B=this.tabPanelContainer.getActiveTab().id;if(Wtf.getCmp(B).editor.saveflag==1){Wtf.getCmp(B).loadMask.show();var C=Wtf.getCmp(B).editor.getValue();var D=this.tabPanelContainer.getActiveTab().id.substring(3);var A=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["courseid"])});A.load({params:{flag:"4",courseid:this.courseid,nodeid:D,content:C}});A.on("load",function(){var G=this.tabPanelContainer.items.items.length;if(G>0){var H=this.tabPanelContainer.getActiveTab().id;for(var I=0;I<G;I++){var F=this.tabPanelContainer.items.items[I].id;if(Wtf.getCmp(F)&&Wtf.getCmp(F).loadMask){Wtf.getCmp(F).loadMask.hide()}}}},this);A.on("loadexception",function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR);var G=this.tabPanelContainer.items.items.length;if(G>0){var H=this.tabPanelContainer.getActiveTab().id;for(var I=0;I<G;I++){var F=this.tabPanelContainer.items.items[I].id;if(Wtf.getCmp(F)&&Wtf.getCmp(F).loadMask){Wtf.getCmp(F).loadMask.hide()}}}},this);if(Wtf.getCmp(B).editor.saveflag==1){var E=this.tabPanelContainer.getActiveTab().title;this.tabPanelContainer.getActiveTab().setTitle(E.substring(0,E.length-1))}Wtf.getCmp(B).editor.saveflag=0}}},createObj:function(){this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,hideGroupedColumn:false});this.reader=new Wtf.data.JsonReader({totalProperty:"count",root:"data",fields:[{name:"nodeid",type:"string"},{name:"courseid",type:"string"},{name:"title",type:"string"},{name:"language",type:"string"},{name:"descgeneral",type:"string"},{name:"version",type:"string"},{name:"status",type:"string"},{name:"interactivitytype",type:"string"},{name:"resourcetype",type:"string"},{name:"interactivitylevel",type:"string"},{name:"userrole",type:"string"},{name:"agerange",type:"string"},{name:"difficulty",type:"string"},{name:"learningtime",type:"string"},{name:"descedu",type:"string"},{name:"cost",type:"string"},{name:"copyright",type:"string"},{name:"descrights",type:"string"},{name:"install",type:"string"},{name:"learningoutcome",type:"string"},{name:"tags",type:"string"},{name:"vno"},{name:"description",type:"string"}]});this.expander=new Wtf.grid.RowExpander({tpl:new Wtf.Template("<br>","<p><b>Description:</b> {description}</p>")});this.sm=new Wtf.grid.CheckboxSelectionModel();this.sm.on("selectionchange",function(A){if(A.getCount()>0){this.im.enable()}else{this.im.disable()}},this);this.ds=new Wtf.data.GroupingStore({url:"jspfiles/lms/metagrid.jsp",reader:this.reader,baseParams:{flag:5},sortInfo:{field:"courseid",direction:"DESC"}});this.cm=new Wtf.grid.ColumnModel([this.expander,this.sm,{header:"Title",dataIndex:"title",sortable:true,groupable:true,groupRenderer:nameRenderer},{header:"Version",dataIndex:"vno",sortable:true,groupable:true},{header:"Tags",dataIndex:"tags",sortable:true,groupable:true}]);this.editid="editLObj"+this.id;this.createid="createLObj"+this.id;this.cm.defaultSortable=true;this.locWin=new Wtf.Window({title:this.winTitle,closable:true,scope:this,modal:true,iconCls:"winicon",width:600,height:450,resizable:false,buttonAlign:"center",autoScroll:true,buttons:[this.im=new Wtf.Button({text:"Import Object",scope:this,disabled:true,id:this.createid,tooltip:{text:"Click to import learning object"},handler:function(){var D=this.sm.getSelections();if(D.length>0){var F="";for(var C=0;C<D.length;C++){F+=D[C].data.nodeid;if(C+1<D.length){F+="/"}}this.use=2;var B=this.root.childNodes.length;var A=this.root.childNodes;for(var E=0;E<B;E++){this.root.removeChild(A.shift())}this.loadNodes(F);this.locWin.close()}}}),{text:"Close",scope:this,handler:function(){this.locWin.close()}}],layout:"border",items:[{region:"north",border:false,height:75,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","Import Learning Object(s)","Select the learning object you want to import")},{region:"center",border:false,layout:"fit",items:[{layout:"border",border:false,autoWidth:true,items:[this.grid=new Wtf.grid.GridPanel({border:false,region:"center",store:this.ds,view:this.groupingView,cm:this.cm,sm:this.sm,plugins:this.expander,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading"},tbar:["Search by Tags: ",this.quickSearchTF=new Wtf.KWLTagSearch({field:"tags",width:200})]})]}],bbar:[this.pg=new Wtf.PagingSearchToolbar({pageSize:10,searchField:this.quickSearchTF,id:"paggintoolbar"+this.id,store:this.ds,scope:this,plugins:this.pP=new Wtf.common.pPageSize({id:"pPageSize_"+this.id})})]}]});this.locWin.show();this.ds.load({params:{start:0,limit:10}});this.grid.on("sortchange",function(A,B){this.grid.getStore().groupBy(B.field)},this);this.ds.on("load",this.handleStoreLoad,this);this.ds.on("datachanged",function(){var A=this.pP.combo.value;this.quickSearchTF.setPage(A)},this)},getStore:function(){this.store=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["content"])});return this.store},selectTab:function(A){var B=A.currentTarget.parentNode.id.split("link")[1];this.showTab(B)},handleStoreLoad:function(A,C,B){this.quickSearchTF.StorageChanged(A)},filecontentTab:function(B,A,F,C,D){var E=this.getObjId(A);Wtf.Ajax.request({method:"POST",url:"jspfiles/lms/CreateCourse.jsp",params:({flag:36,nodeid:E.substr(3,E.length)}),scope:this,success:function(I,H){var J=Wtf.decode(I.responseText);var G=document.createElement("div");G.id="file1div"+A;G.style.height="100%";G.style.overflow="hidden";var K=document.createElement("iframe");K.id="iframe1"+A;K.name="iframe1"+A;K.cls="ascls";K.width="100%";K.height="100%";K.autoScroll=true;K.frameborder="0";K.src="scorm/content/"+E.substr(3,E.length)+"/"+J.fname;G.appendChild(K);if(Wtf.getCmp(A)==null){this.tabPanelContainer.add(new Wtf.Panel({closable:true,ctCls:"filecls",id:A,title:F,frame:false,layout:"fit",items:[{border:false,frame:false,contentEl:G,autoScroll:true,layout:"fit",bodyStyle:"background-color: #FFFFFF;"}]}));this.tabPanelContainer.setActiveTab(A);this.tabPanelContainer.ownerCt.doLayout()}},failure:function(G,H){Wtf.Msg.alert("Error","Error connecting to server",function(I){},this)}})},changeColorBlue:function(A){A.target.style.color="blue"},changeColorBlack:function(A){A.target.style.color="black"},removeTab:function(A){this.tabPanelContainer.setActiveTab("tab"+A.attributes.id);this.tabPanelContainer.findById("tab"+A.attributes.id).closeflag=1;this.tabPanelContainer.remove("tab"+A.attributes.id)},handleSaveAll:function(){var A=false;var C=this.tabPanelContainer.items.items.length;if(C>0){var D=this.tabPanelContainer.getActiveTab().id;for(var E=0;E<C;E++){var B=this.tabPanelContainer.items.items[E].id;if(Wtf.getCmp(B).ctCls!="filecls"){Wtf.getCmp(B).loadMask.show()}var F=this.mytree.getNodeById(B.substring(3));if(this.tabPanelContainer.items.items[E].ctCls=="section"&&F.attributes.lobject!="1"){this.tabPanelContainer.setActiveTab(B);if(Wtf.getCmp(B).editor.saveflag==1){this.saveContent();A=true}}else{if(Wtf.getCmp(B).ctCls=="rquizclass"){if(Wtf.getCmp(B).save==0){Wtf.getCmp(B).rquizSave()}}}}this.tabPanelContainer.setActiveTab(D)}if(A==false){if(C>0){var D=this.tabPanelContainer.getActiveTab().id;for(var E=0;E<C;E++){var B=this.tabPanelContainer.items.items[E].id;if(Wtf.getCmp(B).ctCls!="filecls"){Wtf.getCmp(B).loadMask.hide()}}this.tabPanelContainer.setActiveTab(D)}}},pubresp:function(B,C,A){if(C[0].json.Success=="true"){Wtf.MessageBox.alert("Status","Content published Successfully")}else{if(C[0].json.Success=="false"){msgBoxShow(["Warning","Content can be published only if there are any changes in it"])}else{Wtf.MessageBox.alert("Status","Problem in publishing content")}}},showContHistory:function(A){this.histStore=new Wtf.data.Store({url:"jspfiles/lms/CreateCourse.jsp",reader:new Wtf.data.JsonReader({root:"data"},["verno","modified","author","vno"])});this.histStore.on("load",this.histResp,this);this.histStore.load({params:{flag:"22",courseid:A}});this.smodel=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.cmod=new Wtf.grid.ColumnModel([this.smodel,{header:"Version No",width:0.2,dataIndex:"verno"},{header:"Modified Date",width:0.3,dataIndex:"modified"},{header:"Changed By",width:0.5,dataIndex:"author"}]);this.smodel.on("selectionchange",function(){if(this.smodel.getCount()>0){Wtf.getCmp("actBtn").enable()}else{Wtf.getCmp("actBtn").disable()}},this);this.gridPanel=new Wtf.grid.GridPanel({border:false,cm:this.cmod,sm:this.smodel,store:this.histStore,viewConfig:{forceFit:true,autoFill:true},loadMask:{msg:"Loading Content List..."}});this.showHistory=new Wtf.Window({title:"Content's History",closable:true,modal:true,iconCls:"win",width:450,height:350,resizable:false,buttonAlign:"right",buttons:[{text:"Activate",scope:this,disabled:true,id:"actBtn",handler:function(){var B=this.smodel.getSelections()[0].data.verno;this.showHistory.close();this.actStore=new Wtf.data.Store({url:"jspfiles/lms/CreateCourse.jsp",reader:new Wtf.data.JsonReader({root:"data"},["success"])});this.actStore.on("load",this.actResp,this);this.actStore.load({params:{flag:"25",courseid:this.courseid,vno:B}})}},{text:"Cancel",scope:this,handler:function(){this.showHistory.close()}}],layout:"border",items:[{region:"center",border:false,layout:"fit",items:[new Wtf.Panel({layout:"border",items:[{region:"center",frame:true,layout:"fit",items:[this.gridPanel]}]})]}]});this.showHistory.show()},histResp:function(C,E,B){if(E[0]){var A=E[0].json.vno;var D=this.histStore.find("verno",A);this.smodel.selectRow(D)}},actResp:function(B,C,A){if(C[0].json.Success=="true"){Wtf.MessageBox.alert("Status","Content Activate Successfully")}else{Wtf.MessageBox.alert("Status","Problem in Activate content")}},combId:function(B,A){return B+"$"+A},getObjId:function(A){var B=A.split("$");return B[0]}});var feedbackvalue=null;var store1=null;var store2=null;var store3=null;function initlize(){store1=new Wtf.data.SimpleStore({fields:["abbr","state"],data:Wtf.form.ComboBox.states1});store2=new Wtf.data.SimpleStore({fields:["abbr","state"],data:Wtf.form.ComboBox.attempmts});store3=new Wtf.data.SimpleStore({fields:["abbr","state"],data:Wtf.form.ComboBox.diff})}function feedbackWindow(C){var B=C.split("/");var G=null;var H=null;if(B.length>=2){if(B[1]!="-1"){G=B[1]}}if(B.length>=3){if(B[1]!="-1"){H=B[2]}}var E=new Wtf.Panel({id:"feed",frame:true,layout:"form",border:false,layoutConfig:{labelSeparator:""},items:[new Wtf.form.FieldSet({height:115,labelWidth:0,layoutConfig:{labelSeparator:""},id:"corr",title:"Feedback for correct answer",items:[new Wtf.form.TextArea({height:80,allowBlank:false,id:"feedtxt1",width:350,value:G})]}),new Wtf.form.FieldSet({height:115,labelWidth:0,layoutConfig:{labelSeparator:""},id:"incorr",cls:"incorrfield",title:"Feedback for incorrect answer",items:[new Wtf.form.TextArea({id:"feedtxt2",allowBlank:false,height:80,width:350,value:H})]}),{}]});var D=new Wtf.Window({title:"Display this feedback",closable:true,modal:true,resizable:false,width:405,autoHeight:true,id:"getfeedback",items:[E],buttons:[{id:"okfeed",text:"Save",handler:F},{id:"cancelfeed",text:"Cancel",handler:I}]});D.show();var A=null;function F(){if(Wtf.getCmp("feedtxt1").isValid()&&Wtf.getCmp("feedtxt2").isValid()){G=Wtf.getCmp("feedtxt1").getValue();H=Wtf.getCmp("feedtxt2").getValue();A=G+"/"+H;D.close();feedsetvalue(A)}}function I(){D.close()}}function getWin(E,O,I,F,M,P,H,G,C,K){var A=new Wtf.Panel({border:false,id:"panel1"});var L=new Wtf.Window({title:"Question",iconCls:"winicon",closable:false,modal:true,resizable:false,shadow:false,plain:true,width:700,autoHeight:true,border:false,items:[A],buttons:[{text:"Save",id:H},{text:"Cancel",id:G}]});var N=getTitlePanel(E);var B=getQuesPanel(O,K,M,F);var D=getSetValpanel(I,F,M,P);Wtf.getCmp("panel1").add(N,B,D,C);Wtf.getCmp("panel1").doLayout();L.show();var Q=document.getElementById("picUpload2");var J=K.lastIndexOf("/")+1;Q.value=K.substr(J);Wtf.getCmp("points").on("invalid",invalidpoints);Wtf.getCmp("feedback").addListener("select",changevalue);Wtf.get("feedbackbut").addListener("click",function(){var R;if(M!=null){R=F.getAt(M).data["feedback"]}else{R="None"}getfeedback(R)});return L}function getTitlePanel(B){var A=new Wtf.Panel({frame:true,layout:"fit",border:false,html:"<div class = 'toppanel'>Question Type: "+B+"</div><div class = 'toppanel1'>Add your question here:</div>"});return A}function getQuesPanel(A,C,F,E){if(C==null){C=Wtf.getLmsImgPath+"question_icon.png"}var D=new Wtf.Panel({cls:"inner",border:false,frame:true,layout:"column",items:[{columnWidth:0.84,layout:"form",labelWidth:0,border:false,layoutConfig:{labelSeparator:""},items:[this.ques=new Wtf.form.TextArea({id:"ques",maxLength:1024,emptyText:A,ctCls:"questext",height:126,width:550})]},{columnWidth:0.16,layout:"form",border:false,items:[new Wtf.Panel({frame:true,width:105,height:100,html:"<img id='picUpload2' height=100px; width=100px; src="+C+" onclick=javascript:showUploadWin()></img>"}),new Wtf.Button({id:"reset",text:"Reset Picture",cls:"buttonReset",handler:function(){var G=document.getElementById("picUpload2");G.src="images/store/lms/question_icon.png";G.value="question_icon.png"}})]}]});if(F!=null){var B=E.getAt(F).data["question"];this.ques.value=B}return D}function getSetValpanel(H,D,J,K){var E="None";var G=null;if(J!=null){G=D.getAt(J).data["quesid"]}var A=null;initlize();this.points=new Wtf.form.NumberField({fieldLabel:"Points",emptyText:"10",width:55,minValue:1,maxValue:999,id:"points"});if(H=="1"){A=new Wtf.Panel({border:false,height:60,layout:"border",items:[{region:"north",height:23,layout:"form",labelWidth:43,items:[this.points]},{region:"center",height:30,layout:"form",layoutConfig:{labelSeparator:""},labelWidth:0,items:[new Wtf.form.Checkbox({boxLabel:"Shuffle Choice",id:"shuffle",cls:"shuffle1",checked:K})]}]})}else{if(H=="2"){A=new Wtf.Panel({border:false,height:60,layout:"border",items:[{region:"north",height:23,layout:"form",labelWidth:43,items:[this.points]},{region:"center",height:30,items:[new Wtf.Button({text:"Reset Answer",id:"reset",minWidth:40,cls:"dfbutton"}),new Wtf.Button({text:"Define Blank",minWidth:40,id:"blank",cls:"dfbutton"})]}]})}else{A=new Wtf.Panel({border:false,height:60,layout:"border",items:[{region:"center",height:23,layout:"form",labelWidth:43,items:[this.points]}]})}}this.qRes=Wtf.data.Record.create([{name:"tagid",type:"string"},{name:"tagname",type:"string"},{name:"check"}]);this.qtagRes=new Wtf.data.Store({url:Wtf.req.lms+"fetchTags.jsp",reader:new Wtf.data.JsonReader({root:"data",id:"res-reader"},this.qRes)});this.qtagCombo={store:qtagRes,displayField:"tagname",valueField:"tagid",triggerAction:"all",mode:"local"};this.qtagRes.load({params:{flag:0,nodeid:G}});var F=new Wtf.Panel({frame:true,border:false,layout:"column",items:[{columnWidth:1,border:false,layout:"column",items:[{columnWidth:0.39,layout:"form",labelWidth:150,border:false,layoutConfig:{labelSeparator:""},items:[this.attmp=new Wtf.form.ComboBox({fieldLabel:"No of attempts permitted:",id:"attempts",store:store2,width:90,editable:false,disabled:false,emptyText:"1",displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true}),this.feed=new Wtf.form.ComboBox({fieldLabel:"Feedback Type:",store:store1,emptyText:"None",width:90,editable:false,id:"feedback",displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true}),this.mtag=new Wtf.common.Select(Wtf.applyIf({id:"qTag",multiSelect:true,emptyText:"Click to select",width:90,fieldLabel:"Tags",forceSelection:true},this.qtagCombo))]},{columnWidth:0.08,layout:"form",labelWidth:90,border:false,bodyStyle:"padding: 30px 0 0 0",items:[new Wtf.Button({id:"feedbackbut",text:"Edit"}),{html:"<div  class='blank'></div>"}]},{columnWidth:0.25,layout:"form",labelWidth:100,border:false,layoutConfig:{labelSeparator:""},items:[this.tlimit=new Wtf.form.NumberField({fieldLabel:"Time Limit (secs):",emptyText:"No",width:55,minValue:10,maxValue:600,id:"timelimit",allowDecimals:false}),this.diff=new Wtf.form.ComboBox({fieldLabel:"Set Difficulty:",width:55,name:"diff",store:store3,editable:false,emptyText:"5",id:"difficulty",displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true}),new Wtf.Button({text:"New Tag",scope:this,handler:function(){this.new_tagWin=new Wtf.Window({height:100,title:"New Tag",modal:true,width:250,scope:this,resizable:false,bodyStyle:"margin: 10px 0 0 10px;float: right;",items:[this.tagField=new Wtf.form.TextField({width:210,scope:this,validator:this.alphaNumCheck,invalidText:"The value in this field is invalid. Only alphabets, numerals and space allowed."})],buttons:[{text:"OK",scope:this,handler:function(L,N){var M=this.tagField.getValue().trim();if(M.length>0&&this.tagField.isValid()){Wtf.Ajax.request({url:Wtf.req.lms+"fetchTags.jsp",method:"GET",params:({tag:M,flag:1}),scope:this,success:function(O,P){this.qtagRes.reload()},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}});this.new_tagWin.close()}}},{text:"Cancel",scope:this,handler:function(){this.new_tagWin.close()}}]});this.new_tagWin.show()}})]},{columnWidth:0.27,layout:"fit",labelWidth:43,border:false,items:[A]}]}]});if(J!=null){tl=D.getAt(J).data["timelimit"];if(tl!="No"){this.tlimit.value=tl}this.points.value=D.getAt(J).data["points"];this.diff.value=D.getAt(J).data["difficulty"];var C=(D.getAt(J).data["feedback"]).split("/");this.feed.value=C[0];if(this.feed.value!="None"){this.attmp.disable();Wtf.getCmp("feedbackbut").show()}else{Wtf.getCmp("feedbackbut").hide()}if(C.length>1){var B=C[1]+"/"+C[2];feedsetvalue(B)}var I=D.getAt(J).data["attempts"];if(I=="-1"){I="Unlimited"}this.attmp.value=I}else{Wtf.getCmp("feedbackbut").hide()}this.qtagRes.on("load",function(){var L=[];for(var M=0;M<this.qtagRes.getCount();M++){if(this.qtagRes.getAt(M).data["check"]==1){L.push(this.qtagRes.getAt(M).data["tagid"])}}this.mtag.setValue(L)},this);return F}function winClose(E,B,F,D,C){if(!C){rowid=E.getCount()-1;var A=E.getAt(rowid);E.remove(A);if(D){var H=D;var G=Wtf.getCmp("gridCompotab"+H);G.getfirstrow()}else{var H=B.tabPanelContainer.getActiveTab().id;var G=Wtf.getCmp("gridCompo"+H);G.getfirstrow()}}F.close()}function invalidpoints(){Wtf.MessageBox.alert("Status","Enter points  between 1 to 999 ");Wtf.getCmp("points").setValue("")}function invalidtime(){Wtf.MessageBox.alert("Status","Enter Time limit between 10 to 600 seconds");Wtf.getCmp("timelimit").setValue("")}function changevalue(C,B,A){if(A==1){Wtf.getCmp("attempts").setValue("1");Wtf.getCmp("attempts").disable();Wtf.getCmp("feedbackbut").show()}else{Wtf.getCmp("attempts").enable();Wtf.getCmp("feedbackbut").hide()}}function getfeedback(A){feedbackWindow(A)}function feedsetvalue(A){feedbackvalue=A}Wtf.form.ComboBox.states1=[["none","None"],["ques","Question Level"]];Wtf.form.ComboBox.attempmts=[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["u","Unlimited"]];Wtf.form.ComboBox.diff=[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]];function showUploadWin(){new Wtf.UploadWindow({}).show()}function Truefalseshowwin(S,M,A,K,P,B,H){feedbackvalue=null;var D="Enter your statement for True/False here.";var J=null;var N=null;var F=null;var L=Wtf.getLmsImgPath+"question_icon.png";var R=null;if(K!=null){J=M.getAt(K).data["quesid"];F=M.getAt(K).data["author"];L=Wtf.getLmsImgPath+M.getAt(K).data["pic"];N=(M.getAt(K).data["correctans"]).split("@")}var Q=new Wtf.Panel({autoHeight:true,frame:true,border:false,html:"<div class='mdiv'><div class='flabel'><div class='flabel'><label class='fcss'>Add your choice here:</label></div><div class='flabel'><label class='correct'>Correct</label><label class='choice'>Answers</label></div></div><div class='sdiv1'><div class='choicediv12'><label class='a1'>A</label><div class='chkdiv'><input type='checkbox' id='chk1' class='chk1'/></div><div class='txtouter'><label class='text1'>True</label></div><div class='picdiv'></div></div><div class='choicediv12'><label class='a1'>B</label><div class='chkdiv1'><input type='checkbox' id='chk2' class='chk1'/></div><div class='txtouter1'><label class='text1'>False</label></div><div class='picdiv1'></div></div></div></div>"});var I=getWin("True/False",D,"0",M,K,null,"saveTF","cancelTF",Q,L);Wtf.get("chk1").addListener("click",G);Wtf.get("chk2").addListener("click",E);Wtf.get("saveTF").addListener("click",O);Wtf.get("cancelTF").addListener("click",C);if(N!=null){if(N[0]=="1"){document.getElementById("chk1").checked=true}else{document.getElementById("chk2").checked=true}}function G(){var T=document.getElementById("chk2").checked;if(T==true){document.getElementById("chk2").checked=false}}function E(){var T=document.getElementById("chk1").checked;if(T==true){document.getElementById("chk1").checked=false}}function O(){var u=Wtf.getCmp("timelimit").getValue();if(u!=""&&(u<10||u>600)){Wtf.MessageBox.alert("Status","Enter Time limit between 10 to 600 seconds")}else{var f=document.getElementById("chk1").checked;var e=document.getElementById("chk2").checked;if(f==false&&e==false){Wtf.MessageBox.alert("Status","Tick Correct Choice")}else{var o;var Z=Wtf.get("ques").getValue();var V=Wtf.get("attempts").getValue();var W=Wtf.get("timelimit").getValue();var g=Wtf.get("points").getValue();var X=Wtf.get("feedback").getValue();var T=Wtf.getCmp("qTag").getValue();if(X=="Question Level"){if(feedbackvalue!=null){X=X+"/"+feedbackvalue}}if(f==true){o="1"}else{o="0"}if(J==null){J="temp"}if(F==null){F=""}var l=Wtf.get("difficulty").getValue();var U="1";if(P){var Y=P}else{var Y=S.mytree.getSelectionModel().getSelectedNode().attributes.id}var v=document.getElementById("picUpload2").value;var b=new A({type:"True/False",question:Z,feedback:X,attempts:V,points:g,difficulty:l,shuffle:"-",timelimit:W,del123:"Delete",correctans:o,quesid:J,pic:v,author:F});if(K!=null){rowid=K;var a=M.getAt(rowid);M.remove(a);M.insert(rowid,b);I.close();if(B){S.courseid="-1";Y="-1"}AjaxReqUpdate(U,Z,V,W,g,X,l,o,Y,J,M,rowid,v,S.courseid,T)}else{if(!B){rowid=M.getCount()-1;var a=M.getAt(rowid);M.remove(a)}M.add(b);rowid=M.getCount()-1;I.close();if(B!=1){var n;if(H){n=S.ownerCt.innerTabPanel.getActiveTab().id}else{n=S.tabPanelContainer.getActiveTab().id}var d=n;var c=Wtf.getCmp("gridCompo"+d);c.getfirstrow();Wtf.getCmp("previewquiz"+n).enable()}else{S.courseid="-1";Y="-1"}AjaxReq(U,Z,V,W,g,X,l,o,Y,M,rowid,v,S.courseid,T)}}}}function C(){winClose(M,S,I,P,B)}}function RankShowWin(T,N,A,K,O,B,F){feedbackvalue=null;var L=false;var U=0;var D="Rank the following.";var H=null;var C=null;var J=null;var E=null;var M=Wtf.getLmsImgPath+"question_icon.png";var S=null;if(K!=null){H=N.getAt(K).data["quesid"];E=N.getAt(K).data["author"];M=Wtf.getLmsImgPath+N.getAt(K).data["pic"];C=(N.getAt(K).data["correctans"]).split("@");J=(N.getAt(K).data["choice"]).split("/");var R=N.getAt(K).data["shuffle"];if(R=="Yes"){L=true}}var Q=new Wtf.Panel({layout:"fit",autoHeight:true,frame:true,border:false,html:"<div class='choicediv11'><label class='fcss'>Add your choice here:</label><br><div class='correct'>Answer</div><div class ='choice'></div></div><div class='maindiv'><div class = 'choicediv12'><div class='adiv'>A</div><div class='chkdiv'></div><div class='txtouter'><textarea id='a1' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>B</div><div class='chkdiv1'></div><div class='txtouter1'><textarea id='a2' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>C</div><div class='chkdiv'></div><div class='txtouter'><textarea id='a3' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>D</div><div class='chkdiv1'></div><div class='txtouter1'><textarea id='a4' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>E</div><div class='chkdiv'></div><div class='txtouter'><textarea id='a5' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>F</div><div class='chkdiv1'></div><div class='txtouter1'><textarea id='a6' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>G</div><div class='chkdiv'></div><div class='txtouter'><textarea id='a7' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>H</div><div class='chkdiv1'></div><div class='txtouter1'><textarea id='a8' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>I</div><div class='chkdiv'></div><div class='txtouter'><textarea id='a9' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>J</div><div class='chkdiv1'></div><div class='txtouter1'><textarea id='a10' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br>"});var G=getWin("Ranking",D,"1",N,K,L,"saveRK","cancelRK",Q,M);Wtf.get("saveRK").addListener("click",P);Wtf.get("cancelRK").addListener("click",V);if(J!=null){for(var I=1;I<J.length;I++){document.getElementById("a"+I).value=J[I-1]}}function P(){var AD=Wtf.getCmp("timelimit").getValue();if(AD!=""&&(AD<10||AD>600)){Wtf.MessageBox.alert("Status","Enter Time limit between 10 to 600 seconds")}else{var u="";var X="";for(var w=1;w<=10;w++){var AC=document.getElementById("a"+w);if(AC.value!=""){u+=AC.value+"/";X+=w+"@";U++}}if(U>=2){var f=Wtf.get("ques").getValue();var Z=Wtf.get("attempts").getValue();var b=Wtf.get("timelimit").getValue();var v=Wtf.get("points").getValue();var c=Wtf.get("feedback").getValue();var W=Wtf.getCmp("qTag").getValue();if(c=="Question Level"){if(feedbackvalue!=null){c=c+"/"+feedbackvalue}}if(H==null){H="temp"}if(E==null){E=""}var AA=Wtf.get("difficulty").getValue();if(O){var e=O}else{var e=T.mytree.getSelectionModel().getSelectedNode().attributes.id}var AE=document.getElementById("picUpload2").value;var Y="5";var d=null;if(document.getElementById("shuffle").checked){d="Yes"}else{d="No"}var l=new A({type:"Ranking",question:f,feedback:c,attempts:Z,points:v,difficulty:AA,shuffle:d,timelimit:b,del123:"Delete",correctans:X,choice:u,quesid:H,pic:AE,author:E});if(K!=null){rowid=K;var g=N.getAt(rowid);N.remove(g);N.insert(rowid,l);G.close();if(B){T.courseid="-1";e="-1"}AjaxReqMultUpdate(Y,f,Z,d,b,v,c,AA,u,e,H,N,rowid,AE,T.courseid,W)}else{if(!B){rowid=N.getCount()-1;var g=N.getAt(rowid);N.remove(g)}N.add(l);rowid=N.getCount()-1;G.close();if(B!=1){var AB;if(F){AB=T.ownerCt.innerTabPanel.getActiveTab().id}else{AB=T.tabPanelContainer.getActiveTab().id}var o=AB;var n=Wtf.getCmp("gridCompo"+o);n.getfirstrow();Wtf.getCmp("previewquiz"+AB).enable()}else{T.courseid="-1";e="-1"}AjaxReqMult(Y,f,Z,d,b,v,c,AA,u,e,N,rowid,AE,T.courseid,W)}}else{Wtf.MessageBox.alert("Status","Please select at least two options to rank")}}}function V(){winClose(N,T,G,O,B)}}function MultipleResponseShowWin(W,R,A,M,S,C,G){feedbackvalue=null;var E="Enter your question text here.";var N=false;var P=null;var D=null;var K=null;var F=null;var Q=Wtf.getLmsImgPath+"question_icon.png";var V=null;if(M!=null){Q=Wtf.getLmsImgPath+R.getAt(M).data["pic"];var U=R.getAt(M).data["shuffle"];K=R.getAt(M).data["quesid"];F=R.getAt(M).data["author"];P=(R.getAt(M).data["correctans"]).split("@");D=(R.getAt(M).data["choice"]).split("/");if(U=="Yes"){N=true}}var J=false,O=false;var T=new Wtf.Panel({layout:"fit",autoHeight:true,frame:true,border:false,html:"<div class='flabel'><label class='fcss'>Add your choice here:</label></div><label class='correct'>Correct</label><label class ='choice'>Choice</label></div><br><div class='maindiv'><div class='choicediv12'><div class='adiv'>A</div><div class='chkdiv'><input type='checkbox' id='chk1' class='chk1' name='chk1'/></div><div class='txtouter'><textarea id='a1' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>B</div><div class='chkdiv1'><input type='checkbox' id='chk2' class='chk1' name='chk1'/></div><div class='txtouter1'><textarea class='txt2'id='a2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>C</div><div class='chkdiv'><input type='checkbox' id='chk3' class='chk1' name='chk1'/></div><div class='txtouter'><textarea class='txt1'id='a3' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>D</div><div class='chkdiv1'><input type='checkbox' id='chk4' class='chk1' name='chk1'/></div><div class='txtouter1'><textarea class='txt2'id='a4' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>E</div><div class='chkdiv'><input type='checkbox' id='chk5' class='chk1' name='chk1'/></div><div class='txtouter'><textarea class='txt1'id='a5' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>F</div><div class='chkdiv1'><input type='checkbox' id='chk6' class='chk1' name='chk1'/></div><div class='txtouter1'><textarea class='txt2'id='a6' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>G</div><div class='chkdiv'><input type='checkbox' id='chk7' class='chk1' name='chk1'/></div><div class='txtouter'><textarea class='txt1'id='a7' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>H</div><div class='chkdiv1'><input type='checkbox' id='chk8' class='chk1' name='chk1'/></div><div class='txtouter1'><textarea id='a8' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>I</div><div class='chkdiv'><input type='checkbox' id='chk9' class='chk1' name='chk1'/></div><div class='txtouter'><textarea  id='a9'class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>J</div><div class='chkdiv1'><input type='checkbox' id='chk10' class='chk1' name='chk1'/></div><div class='txtouter1'><textarea id='a10' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div></div>"});var H=getWin("Multiple Response",E,"1",R,M,N,"saveMR","cancelMR",T,Q);Wtf.get("saveMR").addListener("click",I);Wtf.get("cancelMR").addListener("click",B);if(P!=null){for(var L=1;L<D.length;L++){document.getElementById("a"+L).value=D[L-1];if((P[L-1])=="1"){document.getElementById("chk"+L).checked=true}}}function I(){var AE=Wtf.getCmp("timelimit").getValue();if(AE!=""&&(AE<10||AE>600)){Wtf.MessageBox.alert("Status","Enter Time limit between 10 to 600 seconds")}else{var v="";var AB="";correctvalue=[];for(var AA=1;AA<=10;AA++){var l=document.getElementById("a"+AA);correctvalue[AA-1]=l.value;if(l.value!=""){v+=l.value+"/"}if(document.getElementById("chk"+AA).checked){J=true;O=true;AB+="1@";if(correctvalue[AA-1]==""){Wtf.MessageBox.alert("Status","Choice corresponding to correct cannot be empty");O=false}}else{if(l.value!=""){AB+="0@"}}}if(J==false){Wtf.MessageBox.alert("Status","Enter one Correct Choice")}for(var AA=1;AA<=10;AA++){var e=document.getElementById("a"+AA);if(e.value!=""){correctvalue[AA-1]=e.value}}if(O==true){var f=Wtf.get("ques").getValue();var Z=Wtf.get("attempts").getValue();var a=Wtf.get("timelimit").getValue();var w=Wtf.get("points").getValue();var AC=Wtf.get("difficulty").getValue();var X=Wtf.getCmp("qTag").getValue();if(S){var d=S}else{var d=W.mytree.getSelectionModel().getSelectedNode().attributes.id}var Y="6";var b=Wtf.get("feedback").getValue();if(b=="Question Level"){if(feedbackvalue!=null){b=b+"/"+feedbackvalue}}if(document.getElementById("shuffle").checked){var c="Yes"}else{var c="No"}if(K==null){K="temp"}if(F==null){F=""}var AF=document.getElementById("picUpload2").value;var n=new A({type:"Multiple Response",question:f,feedback:b,attempts:Z,points:w,difficulty:AC,shuffle:c,timelimit:a,del123:"Delete",correctans:AB,choice:v,quesid:K,pic:AF,author:F});v+=AB;if(M!=null){rowid=M;var g=R.getAt(rowid);R.remove(g);R.insert(rowid,n);H.close();if(C){W.courseid="-1";d="-1"}AjaxReqMultUpdate(Y,f,Z,c,a,w,b,AC,v,d,K,R,rowid,AF,W.courseid,X)}else{if(!C){rowid=R.getCount()-1;var g=R.getAt(rowid);R.remove(g)}R.add(n);rowid=R.getCount()-1;H.close();if(C!=1){var AD;if(G){AD=W.ownerCt.innerTabPanel.getActiveTab().id}else{AD=W.tabPanelContainer.getActiveTab().id}var u=AD;var o=Wtf.getCmp("gridCompo"+u);o.getfirstrow();Wtf.getCmp("previewquiz"+AD).enable()}else{W.courseid="-1";d="-1"}AjaxReqMult(Y,f,Z,c,a,w,b,AC,v,d,R,rowid,AF,W.courseid,X)}}}}function B(){winClose(R,W,H,S,C)}}function MatchingShowWin(U,N,A,J,O,B,F){feedbackvalue=null;var K=false;var D="Match the following.";var L=null;var C=null;var H=null;var E=null;var M=Wtf.getLmsImgPath+"question_icon.png";var T=null;if(J!=null){H=N.getAt(J).data["quesid"];E=N.getAt(J).data["author"];L=(N.getAt(J).data["correctans"]).split("@");C=(N.getAt(J).data["choice"]).split("/");M=Wtf.getLmsImgPath+N.getAt(J).data["pic"];var P=N.getAt(J).data["shuffle"];if(P=="Yes"){K=true}}var Q=new Wtf.Panel({layout:"fit",autoHeight:true,frame:true,border:false,html:"<div class = 'choicediv11'><label class='fcss'>Add your choice here:</label><br><label class='correct'>Answer</label><label class ='choice'>Choice Side</label><label class ='matching'>Matching Side</label></div><div class='maindiv'><div class='choicediv12'><div class='adiv'>A</div><div class='chkdiv'></div><div class='txtoutermatching'><textarea id='txtm1' class='txtmatch' rows='1' cols='27'></textarea></div><div class='txtoutermatching1'><textarea id='txtm2' class='txtmatch' rows='1' cols='27'></textarea></div><div class='matchpicdiv'></div></div><div class = 'choicediv12'><div class='adiv'>B</div><div class='chkdiv1'></div><div class='txtoutermatchingch'><textarea id='txtm3' class='txtmatchch' rows='1' cols='27'></textarea></div><div class='txtoutermatching1ch'><textarea id='txtm4' class='txtmatchch' rows='1' cols='27'></textarea></div><div class='matchpicdiv1'></div></div><div class = 'choicediv12'><div class='adiv'>C</div><div class='chkdiv'></div><div class='txtoutermatching'><textarea id='txtm5' class='txtmatch' rows='1' cols='27'></textarea></div><div class='txtoutermatching1'><textarea id='txtm6' class='txtmatch' rows='1' cols='27'></textarea></div><div class='matchpicdiv'></div></div><div class = 'choicediv12'><div class='adiv'>D</div><div class='chkdiv1'></div><div class='txtoutermatchingch'><textarea id='txtm7' class='txtmatchch' rows='1' cols='27'></textarea></div><div class='txtoutermatching1ch'><textarea id='txtm8' class='txtmatchch' rows='1' cols='27'></textarea></div><div class='matchpicdiv1'></div></div><div class = 'choicediv12'><div class='adiv'>E</div><div class='chkdiv'></div><div class='txtoutermatching'><textarea id='txtm9' class='txtmatch' rows='1' cols='27'></textarea></div><div class='txtoutermatching1'><textarea id='txtm10' class='txtmatch' rows='1' cols='27'></textarea></div><div class='matchpicdiv'></div></div><div class = 'choicediv12'><div class='adiv'>F</div><div class='chkdiv1'></div><div class='txtoutermatchingch'><textarea id='txtm11' class='txtmatchch' rows='1' cols='27'></textarea></div><div class='txtoutermatching1ch'><textarea id='txtm12' class='txtmatchch' rows='1' cols='27'></textarea></div><div class='matchpicdiv1'></div></div><div class = 'choicediv12'><div class='adiv'>G</div><div class='chkdiv'></div><div class='txtoutermatching'><textarea id='txtm13' class='txtmatch' rows='1' cols='27'></textarea></div><div class='txtoutermatching1'><textarea id='txtm14' class='txtmatch' rows='1' cols='27'></textarea></div><div class='matchpicdiv'></div></div><div class = 'choicediv12'><div class='adiv'>H</div><div class='chkdiv1'></div><div class='txtoutermatchingch'><textarea id='txtm15' class='txtmatchch' rows='1' cols='27'></textarea></div><div class='txtoutermatching1ch'><textarea id='txtm16' class='txtmatchch' rows='1' cols='27'></textarea></div><div class='matchpicdiv1'></div></div><div class = 'choicediv12'><div class='adiv'>I</div><div class='chkdiv'></div><div class='txtoutermatching'><textarea id='txtm17' class='txtmatch' rows='1' cols='27'></textarea></div><div class='txtoutermatching1'><textarea id='txtm18' class='txtmatch' rows='1' cols='27'></textarea></div><div class='matchpicdiv'></div></div><div class = 'choicediv12'><div class='adiv'>J</div><div class='chkdiv1'></div><div class='txtoutermatchingch'><textarea id='txtm19' class='txtmatchch' rows='1' cols='27'></textarea></div><div class='txtoutermatching1ch'><textarea id='txtm20' class='txtmatchch' rows='1' cols='27'></textarea></div><div class='matchpicdiv1'></div></div></div>"});var G=getWin("Matching",D,"1",N,J,K,"saveMH","cancelMH",Q,M);Wtf.get("saveMH").addListener("click",V);Wtf.get("cancelMH").addListener("click",S);var R=1;if(C!=null){for(var I=1;I<=C.length;I++){document.getElementById("txtm"+R).value=C[I-1];document.getElementById("txtm"+(R+1)).value=L[I-1];R=R+2}}function V(){var AH=Wtf.getCmp("timelimit").getValue();if(AH!=""&&(AH<10||AH>600)){Wtf.MessageBox.alert("Status","Enter Time limit between 10 to 600 seconds")}else{var AA="";var f="";var AF=true;var AG=0;for(var AB=1;AB<=20;){var g=document.getElementById("txtm"+AB).value;var W=document.getElementById("txtm"+(parseInt(AB)+1)).value;if(g!=""||W!=""){AG++;if(W==""){Wtf.MessageBox.alert("Status","Please complete all the choices");AF=false;break}else{if(g==""){Wtf.MessageBox.alert("Status","Please complete all the choices");AF=false;break}else{AA+=g+"/";f+=W+"@"}}}AB=AB+2}if(AF==true){if(AG>=2){var l=Wtf.get("ques").getValue();var Z=Wtf.get("attempts").getValue();var a=Wtf.get("timelimit").getValue();var AC=Wtf.get("points").getValue();var AD=Wtf.get("difficulty").getValue();var X=Wtf.getCmp("qTag").getValue();if(O){var e=O}else{var e=U.mytree.getSelectionModel().getSelectedNode().attributes.id}var Y="4";var d=Wtf.get("feedback").getValue();if(d=="Question Level"){if(feedbackvalue!=null){d=d+"/"+feedbackvalue}}if(H==null){H="temp"}if(E==null){E=""}var AI=document.getElementById("picUpload2").value;var b=null;if(document.getElementById("shuffle").checked){b="Yes"}else{b="No"}var o=new A({type:"Matching",question:l,feedback:d,attempts:Z,points:AC,difficulty:AD,shuffle:b,timelimit:a,del123:"Delete",choice:AA,correctans:f,quesid:H,pic:AI,author:E});AA+=f;if(J!=null){rowid=J;var n=N.getAt(rowid);N.remove(n);N.insert(rowid,o);G.close();if(B){U.courseid="-1";e="-1"}AjaxReqMultUpdate(Y,l,Z,b,a,AC,d,AD,AA,e,H,N,rowid,AI,U.courseid,X)}else{if(!B){rowid=N.getCount()-1;var n=N.getAt(rowid);N.remove(n)}N.add(o);rowid=N.getCount()-1;G.close();if(B!=1){var AE;if(F){AE=U.ownerCt.innerTabPanel.getActiveTab().id}else{AE=U.tabPanelContainer.getActiveTab().id}var w=AE;var u=Wtf.getCmp("gridCompo"+w);u.getfirstrow();Wtf.getCmp("previewquiz"+AE).enable()}else{U.courseid="-1";e="-1"}AjaxReqMult(Y,l,Z,b,a,AC,d,AD,AA,e,N,rowid,AI,U.courseid,X)}}else{Wtf.MessageBox.alert("Status","Please select at least two options for match")}}}}function S(){winClose(N,U,G,O,B)}}function FillBlankShowWin(a,U,D,R,W,F,K){var Z=0;feedbackvalue=null;var M=[];var S=0;var V=0;var H="Enter your question text here.";var G=null;var Q=null;var O=null;var I=null;var T=Wtf.getLmsImgPath+"question_icon.png";var Y=null;if(R!=null){H=U.getAt(R).data["question"];O=U.getAt(R).data["quesid"];I=U.getAt(R).data["author"];G=(U.getAt(R).data["correctans"]).split("@");Q=(U.getAt(R).data["choice"]).split("/");T=Wtf.getLmsImgPath+U.getAt(R).data["pic"]}var X=new Wtf.Panel({layout:"fit",autoHeight:true,frame:true,border:false,html:"<div class = 'choicediv11'><label class='fcss'>Add your choice here:</label><br><label class='Answers'>Answers</label></div><div class='maindiv'><div class='choicediv12'><div class='adiv'>A</div><div class='chkdiv'></div><div class='txtouter'><textarea class='txt1'id='a1' rows='1' cols='60' disabled='yes'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>B</div><div class='chkdiv1'></div><div class='txtouter1'><textarea class='txt2' id='a2' rows='1' cols='60' disabled='yes'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>C</div><div class='chkdiv'></div><div class='txtouter'><textarea class='txt1' id='a3' rows='1' cols='60' disabled='yes'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>D</div><div class='chkdiv1'></div><div class='txtouter1'><textarea class='txt2' id='a4' rows='1' cols='60' disabled='yes'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>E</div><div class='chkdiv'></div><div class='txtouter'><textarea class='txt1' id='a5' rows='1' cols='60' disabled='yes'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>F</div><div class='chkdiv1'></div><div class='txtouter1'><textarea class='txt2' id='a6' rows='1' cols='60' disabled='yes'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>G</div><div class='chkdiv'></div><div class='txtouter'><textarea class='txt1' id='a7' rows='1' cols='60' disabled='yes'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>H</div><div class='chkdiv1'></div><div class='txtouter1'><textarea class='txt2' id='a8' rows='1' cols='60' disabled='yes'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>I</div><div class='chkdiv'></div><div class='txtouter'><textarea class='txt1' id='a9' rows='1' cols='60' disabled='yes'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>J</div><div class='chkdiv1'></div><div class='txtouter1'><textarea class='txt2' id='a10' rows='1' cols='60' disabled='yes'></textarea></div><div class='picdiv1'></div></div></div>"});var L=getWin("Fill in the blank",H,"2",U,R,null,"saveF","cancelF",X,T);Wtf.get("ques").addListener("keydown",C);Wtf.get("ques").addListener("keypress",B);Wtf.get("ques").addListener("contextmenu",b);Wtf.get("saveF").addListener("click",E);Wtf.get("cancelF").addListener("click",N);Wtf.get("blank").addListener("click",J);Wtf.getCmp("reset").on("click",A);if(Q!=null){for(var P=1;P<Q.length;P++){document.getElementById("a"+P).value=Q[P-1]}}function b(c){c.preventDefault()}function B(g){if(g.getCharCode()==17||g.getCharCode()==40||g.getCharCode()==35||g.getCharCode()==36||g.getCharCode()==37||g.getCharCode()==39){}else{for(var l=0;l<M.length;){if(M[l].spos<=S&&S<=M[l].epos){g.preventDefault();break}else{if(g.getCharCode()!=8&&g.getCharCode()!=46){kdiff=V-S;if(kdiff==0){kdiff=1}for(var f=0;f<M.length;){if(S<=M[f].spos){A();break}else{f++}}}else{kdiff=S-V;if(kdiff==0){kdiff=1}for(var d=0;d<M.length;){if(S<=M[d].spos){A();break}else{d++}}}l++}}}}function C(g){var f=document.getElementById("ques");if(Wtf.isIE){var c=document.selection.createRange();var d=c.duplicate();d.moveToElementText(f);d.setEndPoint("EndToEnd",c);S=d.text.length-c.text.length;V=S+c.text.length}else{S=f.selectionStart;V=f.selectionEnd}}function A(){this.elValue=document.getElementById("ques").value+" ";for(var o=0;o<M.length;o++){var n="";var l=M[o].dfValue;var g=M[o].length;var d=0;while(d<g){d++;n+="_"}var f=new RegExp(n);this.elValue=(this.elValue).replace(f,l);var e=document.getElementById("a"+(o+1));e.value=""}M=[];Z=0;Wtf.getCmp("ques").setValue(this.elValue)}function J(){this.chk=1;var u=true;var l=true;this.el=document.getElementById("ques");var f=0;var n=0;if(Wtf.isIE){var v=document.selection.createRange();var g=v.duplicate();g.moveToElementText(this.el);g.setEndPoint("EndToEnd",v);f=g.text.length-v.text.length;n=f+v.text.length;this.el.selectionStart=f;this.el.selectionEnd=n}else{f=this.el.selectionStart;n=this.el.selectionEnd}if(n-f>0){for(var AD=0;AD<M.length;AD++){if(f=""||f==M[AD].spos||(f>M[AD].spos&&f<=M[AD].epos)||(n>M[AD].spos&&n<=M[AD].epos)){msgBoxShow(["Warning","Invalid Operation"]);u=false;l=false;break}}if(u&&Z<10){var e="obj"+Z;var o=new Object();var d=(this.el.value).substring(this.el.selectionStart,this.el.selectionEnd).trim();var AA=this.el.selectionStart;o.objId=e;o.dfValue=d;o.length=d.length;o.spos=AA;o.epos=AA+d.length;var AC=true;for(var AD=0;AD<M.length;AD++){if(M[AD].spos>AA){M.splice(AD,0,o);AC=false;break}}if(AC){M.push(o)}var s="";for(var AD=0;AD<o.length;AD++){s+="_"}var AB=(this.el.value).substring(0,this.el.selectionStart);var w=(this.el.value).substring(this.el.selectionEnd,(this.el.value).length);var AE=AB+s+w;Wtf.getCmp("ques").setValue(AE);for(var AD=1;AD<=10;AD++){var AF=document.getElementById("a"+AD);if(AF.value==""){break}else{AF.value=""}}for(var AD=0;AD<M.length;AD++){var AF=document.getElementById("a"+(AD+1));AF.value=M[AD].dfValue}Z++}else{if(l){msgBoxShow(["Error","You can not define blank more than 10."],Wtf.MessageBox.ERROR)}}}else{msgBoxShow(["Warning","Please select something."])}}function E(){var AI=Wtf.getCmp("timelimit").getValue();if(AI!=""&&(AI<10||AI>600)){Wtf.MessageBox.alert("Status","Enter Time limit between 10 to 600 seconds")}else{var AC="";var d="";var o=document.getElementById("a1");if(o.value==""){Wtf.MessageBox.alert("Status","Specify the blank/s")}else{for(var AE=1;AE<=10;AE++){var AH=document.getElementById("a"+AE);if(AH.value!=""){AC+=AH.value+"/";d+=AE+"@"}}var u=Wtf.get("ques").getValue();var f=Wtf.get("attempts").getValue();var g=Wtf.get("timelimit").getValue();var AD=Wtf.get("points").getValue();var AF=Wtf.get("difficulty").getValue();var c=Wtf.getCmp("qTag").getValue();if(W){var n=W}else{var n=a.mytree.getSelectionModel().getSelectedNode().attributes.id}var e="3";var l=Wtf.get("feedback").getValue();if(l=="Question Level"){if(feedbackvalue!=null){l=l+"/"+feedbackvalue}}if(O==null){O="temp"}if(I==null){I=""}var AJ=document.getElementById("picUpload2").value;var w=new D({type:"Fill in the Blanks",question:u,feedback:l,attempts:f,points:AD,difficulty:AF,shuffle:"-",timelimit:g,del123:"Delete",correctans:d,choice:AC,quesid:O,pic:AJ,author:I});if(R!=null){rowid=R;var v=U.getAt(rowid);U.remove(v);U.insert(rowid,w);L.close();if(F){a.courseid="-1";n="-1"}AjaxReqUpdate(e,u,f,g,AD,l,AF,AC,n,O,U,rowid,AJ,a.courseid,c)}else{if(!F){rowid=U.getCount()-1;var v=U.getAt(rowid);U.remove(v)}U.add(w);rowid=U.getCount()-1;L.close();if(F!=1){var AG;if(K){AG=a.ownerCt.innerTabPanel.getActiveTab().id}else{AG=a.tabPanelContainer.getActiveTab().id}var AB=AG;var AA=Wtf.getCmp("gridCompo"+AB);AA.getfirstrow();Wtf.getCmp("previewquiz"+AG).enable()}else{a.courseid="-1";n="-1"}AjaxReq(e,u,f,g,AD,l,AF,AC,n,U,rowid,AJ,a.courseid,c)}}}}function N(){winClose(U,a,L,W,F)}}function MultipleShowWin(Y,S,A,O,U,D,H){feedbackvalue=null;var F="Enter your question text here.";var P=false;var L=null;var T=null;var E=null;var G=null;var R=Wtf.getLmsImgPath+"question_icon.png";var X=null;if(O!=null){var W=S.getAt(O).data["shuffle"];L=S.getAt(O).data["quesid"];G=S.getAt(O).data["author"];T=(S.getAt(O).data["correctans"]).split("@");E=(S.getAt(O).data["choice"]).split("/");R=Wtf.getLmsImgPath+S.getAt(O).data["pic"];if(W=="Yes"){P=true}}var J,K=false,Q=false,Z,N=0;var V=new Wtf.Panel({layout:"fit",autoHeight:true,frame:true,border:false,html:"<div class = 'choicediv11'><label class='fcss'>Add your choice here:</label><br><label class='correct'>Correct</label><label class='choice'>Choice</label></div><div class='maindiv'><div class='choicediv12'><div class='adiv'>A</div><div class='chkdiv'><input type='checkbox' id='chk1' class='chk1' name='chk1'/></div><div class='txtouter'><textarea id='a1' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><div class = 'choicediv12'><div class='adiv'>B</div><div class='chkdiv1'><input type='checkbox' id='chk2' class='chk1' name='chk1'/></div><div class='txtouter1'><textarea id='a2' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><div class = 'choicediv12'><div class='adiv'>C</div><div class='chkdiv'><input type='checkbox' id='chk3' class='chk1' name='chk1'/></div><div class='txtouter'><textarea id='a3' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><div class = 'choicediv12'><div class='adiv'>D</div><div class='chkdiv1'><input type='checkbox' id='chk4' class='chk1' name='chk1'/></div><div class='txtouter1'><textarea id='a4' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>E</div><div class='chkdiv'><input type='checkbox' id='chk5' class='chk1' name='chk1'/></div><div class='txtouter'><textarea id='a5' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>F</div><div class='chkdiv1'><input type='checkbox' id='chk6' class='chk1' name='chk1'/></div><div class='txtouter1'><textarea id='a6' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>G</div><div class='chkdiv'><input type='checkbox' id='chk7' class='chk1' name='chk1'/></div><div class='txtouter'><textarea id='a7' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>H</div><div class='chkdiv1'><input type='checkbox' id='chk8' class='chk1' name='chk1'/></div><div class='txtouter1'><textarea id='a8' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div><br><div class = 'choicediv12'><div class='adiv'>I</div><div class='chkdiv'><input type='checkbox' id='chk9' class='chk1' name='chk1'/></div><div class='txtouter'><textarea id='a9' class='txt1' rows='1' cols='60'></textarea></div><div class='picdiv'></div></div><br><div class = 'choicediv12'><div class='adiv'>J</div><div class='chkdiv1'><input type='checkbox' id='chk10' class='chk1' name='chk1'/></div><div class='txtouter1'><textarea id='a10' class='txt2' rows='1' cols='60'></textarea></div><div class='picdiv1'></div></div></div>"});var I=getWin("Multiple Choice",F,"1",S,O,P,"saveMCQ","cancelMCQ",V,R);Wtf.get("saveMCQ").addListener("click",B);Wtf.get("cancelMCQ").addListener("click",C);if(T!=null){for(var M=1;M<E.length;M++){document.getElementById("a"+M).value=E[M-1];if(T[M-1]=="1"){document.getElementById("chk"+M).checked=true}}}function B(){var AH=Wtf.getCmp("timelimit").getValue();if(AH!=""&&(AH<10||AH>600)){Wtf.MessageBox.alert("Status","Enter Time limit between 10 to 600 seconds")}else{N=0;var b="";var AC="";J=[];for(var AE=1;AE<=10;AE++){var v=document.getElementById("a"+AE);J[AE-1]=v.value;if(v.value!=""){AC+=v.value+"/"}if(document.getElementById("chk"+AE).checked){N++;b+="1@";if(N>1){Q=false;K=false}else{K=true;Q=true}if(J[AE-1]==""){Wtf.MessageBox.alert("Status","Choice corresponding to correct cannot be empty");Q=false;break}}else{if(v.value!=""){b+="0@"}}}if(K==false){Wtf.MessageBox.alert("Status","Enter one Correct Choice")}for(var AE=1;AE<=10;AE++){var n=document.getElementById("a"+AE);if(n.value!=""){J[AE-1]=n.value}}if(Q==true){var o=Wtf.get("ques").getValue();var d=Wtf.get("attempts").getValue();var e=Wtf.get("timelimit").getValue();var AD=Wtf.get("points").getValue();var f=Wtf.get("feedback").getValue();var a=Wtf.getCmp("qTag").getValue();if(f=="Question Level"){if(feedbackvalue!=null){f=f+"/"+feedbackvalue}}var AF=Wtf.get("difficulty").getValue();if(U){var l=U}else{var l=Y.mytree.getSelectionModel().getSelectedNode().attributes.id}if(document.getElementById("shuffle").checked){var g="Yes"}else{var g="No"}if(L==null){L="temp"}if(G==null){G=""}var AI=document.getElementById("picUpload2").value;var w=new A({type:"Multiple Choice",question:o,feedback:f,attempts:d,points:AD,difficulty:AF,shuffle:g,timelimit:e,del123:"Delete",correctans:b,choice:AC,quesid:L,pic:AI,author:G});AC+=b+"/";var c="2";if(O!=null){rowid=O;var u=S.getAt(rowid);S.remove(u);S.insert(rowid,w);I.close();if(D){Y.courseid="-1";l="-1"}AjaxReqMultUpdate(c,o,d,g,e,AD,f,AF,AC,l,L,S,rowid,AI,Y.courseid,a)}else{if(!D){rowid=S.getCount()-1;var u=S.getAt(rowid);S.remove(u)}S.add(w);rowid=S.getCount()-1;I.close();if(D!=1){var AG;if(H){AG=Y.ownerCt.innerTabPanel.getActiveTab().id}else{AG=Y.tabPanelContainer.getActiveTab().id}var AB=AG;var AA=Wtf.getCmp("gridCompo"+AB);AA.getfirstrow();Wtf.getCmp("previewquiz"+AG).enable()}else{Y.courseid="-1";l="-1"}AjaxReqMult(c,o,d,g,e,AD,f,AF,AC,l,S,rowid,AI,Y.courseid,a)}}}}function C(){winClose(S,Y,I,U,D)}}function getQuizLayout(A){var B=new Wtf.Panel({id:"queslayout",layout:"fit",cls:"queslayout",border:false,html:"<div class = 'queslayouttitle'><strong>Apply Question Layout:</strong></div><div  class = 'layoutdiv'><div class='layHeader'><div class='font'>Question Type</div></div><div class='innerdiv' id='innerdiv'><div id='1'  class='imgdiv'  ><img src='images/lms/true.PNG' title='True False' onClick = 'AddTrueFalse(\""+A+"\")'></img></div><div id='2' class='imgdiv'><img src='images/lms/Mul.PNG' title='Multiple Choice' onClick = 'AddMulChoice(\""+A+"\")'></img></div><div id='3' class='imgdiv'><img src='images/lms/Fillblank.PNG' title='Fill in the Blank' onClick = 'AddFillBlank(\""+A+"\")'></img></div><div id='4' class='imgdiv'><img src='images/lms/Match.PNG' title='Matching' onClick = 'AddMatching(\""+A+"\")'></img></div><div id='5' class='imgdiv'><img src='images/lms/Rank.PNG' title='Ranking' onClick = 'AddRanking(\""+A+"\")'></img></div><div id='6' class='imgdiv'><img src='images/lms/MulRes.PNG' title='Multiple Response' onClick = 'AddMulRresponse(\""+A+"\")'></img></div></div></div>"});return B}function getCompObj(A){var B=Wtf.getCmp(A).tabPanelContainer.getActiveTab().id;var C=Wtf.getCmp("gridCompo"+B);return C}function AddTrueFalse(A){var D=getCompObj(A);var B=document.getElementById("cdiv");if(B!=null){var C=document.getElementById("innerdiv");C.removeChild(B)}D.createtruefalseques(D.dsstore)}function AddMulChoice(A){var D=getCompObj(A);var B=document.getElementById("cdiv");if(B!=null){var C=document.getElementById("innerdiv");C.removeChild(B)}D.createMulChoiceques(D.dsstore)}function AddFillBlank(A){var D=getCompObj(A);var B=document.getElementById("cdiv");if(B!=null){var C=document.getElementById("innerdiv");C.removeChild(B)}D.createFillBlankques(D.dsstore)}function AddMatching(A){var D=getCompObj(A);var B=document.getElementById("cdiv");if(B!=null){var C=document.getElementById("innerdiv");C.removeChild(B)}D.createMatchingques(D.dsstore)}function AddRanking(A){var D=getCompObj(A);var B=document.getElementById("cdiv");if(B!=null){var C=document.getElementById("innerdiv");C.removeChild(B)}D.createRankques(D.dsstore)}function AddMulRresponse(A){var D=getCompObj(A);var B=document.getElementById("cdiv");if(B!=null){var C=document.getElementById("innerdiv");C.removeChild(B)}D.MultipleResponseques(D.dsstore)}Wtf.EditorGridComp=function(C){Wtf.apply(this,C);this.id=C.id;this.comp=C.compId;if(this.flag){var A=this.flag}else{var A=this.comp.mytree.getSelectionModel().getSelectedNode().attributes.id}if(this.nodeVno){this.openMode=this.nodeVno}else{this.openMode=0}this.Task=Wtf.data.Record.create([{name:"taskid",type:"int"},{name:"type",type:"string",dataIndex:"type"},{name:"question",type:"string",dataIndex:"question"},{name:"feedback",type:"string",dataIndex:"feedback"},{name:"attempts",type:"int",dataIndex:"attempts"},{name:"points",type:"int",dataIndex:"points"},{name:"difficulty",type:"int",dataIndex:"difficulty"},{name:"shuffle",dataIndex:"shuffle"},{name:"timelimit",type:"int",dataIndex:"timelimit"},{name:"del123",dataIndex:"del"},{name:"quesid",dataIndex:"quesid",type:"string"},{name:"author",dataIndex:"author",type:"string"}]);this.dsstore=new Wtf.data.Store({url:Wtf.req.lms+"quiz.jsp",reader:new Wtf.data.JsonReader({root:"data"},["row","type","question","feedback","attempts","points","difficulty","shuffle","timelimit","del","quesid","choice","correctans","pic"])});this.dsstore.on("load",H,this);function H(N,O,L){var M=null;if(O[0].data.quesid!=""){if(this.nodeidObj){Wtf.getCmp("previewquiz"+this.combId).enable()}else{Wtf.getCmp("previewquiztab"+A).enable()}if(this.owner){this.getfirstrow()}}Wtf.getCmp(this.combId).loadQuiz.hide()}this.dsstore.load({params:{flag:"1",quiznode:A,mode:"0",pubmode:this.openMode,cid:this.comp.courseid}});var I=new Wtf.data.SimpleStore({fields:["abbr","state"],data:[["1","True/False"],["2","Multiple Choice"],["3","Fill in the Blank"],["4","Matching"],["5","Ranking"],["6","Multiple Response"]]});this.RootMenu=new Wtf.menu.Menu({shadow:false,id:"contextMenu",items:[{id:"insert",text:"Insert Option",scope:this,icon:"../images/s.gif",shadow:false,menu:[{id:"truefalse",text:"True / False ...",scope:this,icon:"../images/s.gif",handler:function(){Truefalseshowwin(this.comp,this.dsstore,this.Task,null,this.nodeidObj)}},{id:"mulchoice",text:"Multiple choice ...",scope:this,icon:"../images/s.gif",handler:function(){MultipleShowWin(this.comp,this.dsstore,this.Task,null,this.nodeidObj)}},{id:"fillblank",text:"Fill in the blanks ...",scope:this,icon:"../images/s.gif",handler:function(){FillBlankShowWin(this.comp,this.dsstore,this.Task,null,this.nodeidObj)}},{id:"matching",text:"Matching ...",scope:this,icon:"../images/s.gif",handler:function(){MatchingShowWin(this.comp,this.dsstore,this.Task,null,this.nodeidObj)}},{id:"ranking",text:"Ranking ...",scope:this,icon:"../images/s.gif",handler:function(){RankShowWin(this.comp,this.dsstore,this.Task,null,this.nodeidObj)}},{id:"mulresponse",text:"Multiple Response ...",scope:this,icon:"../images/s.gif",handler:function(){MultipleResponseShowWin(this.comp,this.dsstore,this.Task,null,this.nodeidObj)}}]},{id:"delete",text:"Delete Question",scope:this,icon:"images/cancel.png",shadow:false,handler:this.deletequestion}]});this.cmodel=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{header:"Type",width:0.15,dataIndex:"type",align:"left",editor:cb1=new Wtf.form.ComboBox({id:"combo"+this.id,store:I,displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,lazyRender:true,emptyText:"",editable:false})},{header:"Question",width:0.28,align:"left",dataIndex:"question"},{header:"Feedback",width:0.07,align:"center",dataIndex:"feedback"},{header:"Attempts",width:0.07,align:"center",dataIndex:"attempts"},{header:"Points",width:0.06,align:"center",dataIndex:"points"},{header:"Difficulty Level",width:0.12,align:"center",dataIndex:"difficulty"},{header:"Shuffle choices",width:0.12,align:"center",dataIndex:"shuffle"},{header:"Time Limit",width:0.08,align:"center",dataIndex:"timelimit"},{header:"",width:0.05,align:"center",renderer:K,dataIndex:"del"}]);this.cmodel.defaultSortable=true;function K(){return"<div id=img class=img></div>"}Wtf.EditorGridComp.superclass.constructor.call(this,{ds:this.dsstore,cm:this.cmodel,clicksToEdit:1,selModel:new Wtf.grid.RowSelectionModel(),viewConfig:{forceFit:true,autoFill:true}});if(this.owner){this.addListener("contextmenu",this.rightclick);this.on("rowdblclick",this.retriveinfo);this.on("cellclick",this.cellclicked);this.on("beforeedit",this.beforeEdit);this.getfirstrow()}else{this.cmodel.setEditable(1,false);this.cmodel.setHidden(9,true)}this.on("rowclick",this.setinfo);cb1=Wtf.getCmp("combo"+this.id);cb1.on("select",E);var F=this.Task;var G=this.dsstore;var J=this.comp;var B=this.nodeidObj;var D=this.innertab;function E(L){var M=L.getValue();switch(M){case"True/False":Truefalseshowwin(J,G,F,null,B,null,D);break;case"Multiple Choice":MultipleShowWin(J,G,F,null,B,null,D);break;case"Fill in the Blank":FillBlankShowWin(J,G,F,null,B,null,D);break;case"Matching":MatchingShowWin(J,G,F,null,B,null,D);break;case"Ranking":RankShowWin(J,G,F,null,B,null,D);break;case"Multiple Response":MultipleResponseShowWin(J,G,F,null,B,null,D);break}}};Wtf.extend(Wtf.EditorGridComp,Wtf.grid.EditorGridPanel,{getfirstrow:function(){var B=this.dsstore.getCount();var A=new this.Task({type:"",question:"",feedback:"",attempts:"",points:"",difficulty:"",shuffle:"",timelimit:"",del123:""});this.dsstore.insert(B,A)},beforeEdit:function(A){if(A.value!=""){A.cancel=true}},getStore:function(){return this.dsstore},createtruefalseques:function(A){Truefalseshowwin(this.comp,A,this.Task,null,this.nodeidObj)},createMulChoiceques:function(A){MultipleShowWin(this.comp,A,this.Task,null,this.nodeidObj)},createFillBlankques:function(A){FillBlankShowWin(this.comp,A,this.Task,null,this.nodeidObj)},createMatchingques:function(A){MatchingShowWin(this.comp,A,this.Task,null,this.nodeidObj)},createRankques:function(A){RankShowWin(this.comp,A,this.Task,null,this.nodeidObj)},MultipleResponseques:function(A){MultipleResponseShowWin(this.comp,A,this.Task,null,this.nodeidObj)},rightclick:function(A){A.preventDefault();this.RootMenu.showAt(A.getXY())},retriveinfo:function(A,C,B){type=this.dsstore.getAt(C).data["type"];switch(type){case"True/False":Truefalseshowwin(this.comp,this.dsstore,this.Task,C,this.nodeidObj);break;case"Multiple Choice":MultipleShowWin(this.comp,this.dsstore,this.Task,C,this.nodeidObj);break;case"Fill in the Blanks":FillBlankShowWin(this.comp,this.dsstore,this.Task,C,this.nodeidObj);break;case"Matching":MatchingShowWin(this.comp,this.dsstore,this.Task,C,this.nodeidObj);break;case"Ranking":RankShowWin(this.comp,this.dsstore,this.Task,C,this.nodeidObj);break;case"Multiple Response":MultipleResponseShowWin(this.comp,this.dsstore,this.Task,C,this.nodeidObj);break}},cellclicked:function(B,D,A,C){if(this.dsstore.getCount()!=D+1){if(A==9){this.deletequestion()}}},deletequestion:function(){dstore=this.dsstore;grid1=this;compId=this.comp;Wtf.MessageBox.confirm("Confirm","Are you sure you want to delete?",this.showResult,this)},showResult:function(H){var D;if(this.innertab){D=this.comp.ownerCt.innerTabPanel.getActiveTab().id}else{D=this.comp.tabPanelContainer.getActiveTab().id}if(H=="yes"){nodeid=(D).substring(3);courseid=this.comp.courseid;var A=dstore.getAt(rowid);var F=dstore.getAt(rowid).data["quesid"];dstore.remove(A);var E=document.getElementById("inner1"+D);for(var G=0;E.childNodes.length;){E.removeChild(E.childNodes[G])}var C="3";var B=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"quiz.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["Details"])});B.load({params:{flag:C,quesid:F,node:nodeid,cid:courseid}});grid1.getView().refresh();if(dstore.getCount()==1){Wtf.getCmp("previewquiz"+D).disable()}}},setinfo:function(I,M,J){rowid=M;type=this.dsstore.getAt(M).data["type"];feed=this.dsstore.getAt(M).data["feedback"];var N=this.dsstore.getAt(M).data["pic"];var K=Wtf.getLmsImgPath+N;if(!(feed=="None")){var C=feed.split("/");feed=C[0]}ques=this.dsstore.getAt(M).data["question"];points=this.dsstore.getAt(M).data["points"];timelimit=this.dsstore.getAt(M).data["timelimit"];diff=this.dsstore.getAt(M).data["difficulty"];var O;var B;if(this.innertab){B=this.comp.ownerCt.innerTabPanel.getActiveTab().id;O=document.getElementById("inner1"+B)}else{B=this.comp.tabPanelContainer.getActiveTab().id;O=document.getElementById("inner1"+B)}if(type!=""){O.innerHTML="<div class='flabel'><div  id = 'topdiv' class = 'title1'>"+type+"</div><div class = 'feed'><div class='fontstyleFeed'> Feedback:"+feed+"</div></div><br><div class='flabel'><div class='fontstyle1'> "+ques+"</div><div class='qpic'><img id='picUpload' src='"+K+"'></img></div></div><div><div class='fontstyle3'>Points:"+points+"</div><div class='fontstyle3'>Time Limit:"+timelimit+"</div><div class='fontstyle3'>Difficulty Level:"+diff+"</div></div></div><br><br>"}else{O.innerHTML=""}switch(type){case"True/False":var H=this.dsstore.getAt(M).data["correctans"];var Q=H.split("@");O.innerHTML+="<table class='ansshow' cellspacing=15><tr><td>Options</td><td>Correct</td><td>Answer</td></tr><tr><td>T</td><td><input type='checkbox' id='chk1"+B+"'  class='displaychk' name='chk1' DISABLED/></td><td>True</td></tr><td>F</td><td><input type='checkbox' id='chk2"+B+"'  class='displaychk' name='chk2' DISABLED/></td><td>False</td></tr></table>";if(Q[0]=="1"){document.getElementById("chk1"+B).checked=true;document.getElementById("chk1"+B).style.display="block"}else{document.getElementById("chk2"+B).checked=true;document.getElementById("chk2"+B).style.display="block"}break;case"Multiple Choice":var Q=this.dsstore.getAt(M).data["correctans"];var G=Q.split("@");var E=this.dsstore.getAt(M).data["choice"];var D=E.split("/");O.innerHTML+="<table class='ansshow' id='table1"+B+"' cellspacing=15 ><tr><td>Options</td><td>Correct</td><td>Answer</td></tr></table>";var F=document.getElementById("table1"+B);for(var L=1;L<D.length;L++){var A="<tr><td>"+String.fromCharCode(65+parseInt(L-1))+"</</td><td><input type='checkbox' id='chk"+L+B+"'  class='displaychk' name='chk1' DISABLED/></td><td>"+D[L-1]+"</td></tr>";Wtf.DomHelper.insertHtml("afterEnd",Wtf.DomQuery.select("table#table1"+B)[0].lastChild,A)}for(var L=1;L<D.length;L++){if(G[L-1]=="1"){document.getElementById("chk"+L+B).checked=true;document.getElementById("chk"+L+B).style.display="block"}}break;case"Fill in the Blanks":var E=this.dsstore.getAt(M).data["choice"];var Q=this.dsstore.getAt(M).data["correctans"];var G=Q.split("@");var D=E.split("/");O.innerHTML+="<table class='ansshow' id='table1"+B+"' cellspacing=15 ><tr><td></td><td>Answer</td></tr></table>";var F=document.getElementById("table1"+B);for(var L=1;L<D.length;L++){var A="<tr><td>"+String.fromCharCode(65+parseInt(L-1))+"</</td><td>"+D[L-1]+"</td></tr>";Wtf.DomHelper.insertHtml("afterEnd",Wtf.DomQuery.select("table#table1"+B)[0].lastChild,A)}break;case"Ranking":var Q=this.dsstore.getAt(M).data["correctans"];var E=this.dsstore.getAt(M).data["choice"];var G=Q.split("@");var D=E.split("/");O.innerHTML+="<table class='ansshow' id='table1"+B+"' cellspacing=15 ><tr><td></td><td>Answer</td></tr></table>";var F=document.getElementById("table1"+B);for(var L=1;L<D.length;L++){var A="<tr><td>"+String.fromCharCode(65+parseInt(L-1))+"</</td><td>"+D[L-1]+"</td></tr>";Wtf.DomHelper.insertHtml("afterEnd",Wtf.DomQuery.select("table#table1"+B)[0].lastChild,A)}break;case"Multiple Response":var Q=this.dsstore.getAt(M).data["correctans"];var P=Q.split("@");var E=this.dsstore.getAt(M).data["choice"];var D=E.split("/");O.innerHTML+="<table class='ansshow' id='table1"+B+"' cellspacing=15 ><td>Options</td><td>Correct</td><td>Answer</td></tr></table>";var F=document.getElementById("table1"+B);for(var L=1;L<D.length;L++){var A="<tr><td>"+String.fromCharCode(65+parseInt(L-1))+"</</td><td><input type='checkbox' id='chk"+L+B+"'  class='displaychk' name='chk1' DISABLED/></td><td>"+D[L-1]+"</td></tr>";Wtf.DomHelper.insertHtml("afterEnd",Wtf.DomQuery.select("table#table1"+B)[0].lastChild,A)}for(var L=1;L<P.length;L++){if(P[L-1]=="1"){document.getElementById("chk"+L+B).checked=true;document.getElementById("chk"+L+B).style.display="block"}}break;case"Matching":var Q=this.dsstore.getAt(M).data["correctans"];var P=Q.split("@");var E=this.dsstore.getAt(M).data["choice"];var D=E.split("/");O.innerHTML+="<table class='ansshow' id='table1"+B+"' cellspacing=15 ><td></td><td>Choice Side</td><td>Matching Side</td></tr></table>";var F=document.getElementById("table1"+B);for(var L=1;L<D.length;L++){var A="<tr><td>"+String.fromCharCode(65+parseInt(L-1))+"</</td><td>"+D[L-1]+"</td><td>"+P[L-1]+"</td></tr>";Wtf.DomHelper.insertHtml("afterEnd",Wtf.DomQuery.select("table#table1"+B)[0].lastChild,A)}break}}});Wtf.quizPanel=function(A){Wtf.apply(this,A);this.id=A.id;this.compId=A.compId;Wtf.quizPanel.superclass.constructor.call(this,A)};Wtf.extend(Wtf.quizPanel,Wtf.Panel,{onRender:function(A){var B=this.compId;Wtf.quizPanel.superclass.onRender.call(this,A);this.addEvents({"publishObject":true,"unlockObject":true});this.existingBttn=new Wtf.menu.Item({text:"Select from existing",icon:"images/s.gif",iconCls:"iconclass",scope:this,handler:function(){this.importWin()}});this.randomBttn=new Wtf.menu.Item({text:"Random questions",icon:"images/s.gif",iconCls:"iconclass",scope:this,handler:function(){this.randomWin()}});this.add(this.quizlayout=new Wtf.Panel({id:"pan1"+this.id,layout:"border",border:false,bodyStyle:"background:#dfe8f6;",bbar:[{id:"previewquiz"+this.id,text:"Preview",type:"submit",disabled:true,scope:this,handler:function(){var E=null;var G=null;if(this.nodeidObj){E="tab"+this.nodeidObj;G=this.nodeVno}else{G=0;E=this.id}var F=null;if(this.cid){F=this.cid}else{F=""}var D="0?"+E+"?simp?"+F+"?"+G;var C="";C+=escape(D);window.open("qpreview.html?"+C,"fs","fullscreen=yes","titlebar=no")}},new Wtf.Toolbar.Button({text:"Import Questions",hidden:(this.owner?false:true),menu:{items:[this.existingBttn,this.randomBttn]}}),{id:"publish"+this.id,text:"Publish",hidden:(Wtf.isContentDesigner()||!(this.owner)||(this.nodeidObj?false:true)),scope:this,handler:function(){var C=(this.id).substring(3);this.publish=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"metagrid.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["success"])});this.publish.on("load",this.pubresp,this);this.publish.load({params:{flag:"2",loid:C}})}},{text:"Unlock",hidden:!(this.owner)||(this.nodeidObj?false:true),scope:this,handler:function(){Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"GET",params:({objid:this.nodeidObj,flag:9}),scope:this,success:function(C,D){this.fireEvent("unlockObject");Wtf.MessageBox.show({title:"Success",msg:"Lock successfully released",buttons:Wtf.MessageBox.OK,fn:this.closeTab,scope:this,icon:Wtf.MessageBox.INFO})},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}}],items:[{region:"north",split:true,border:false,id:"northpanel"+this.id,height:250,layout:"fit",items:[this.grid=new Wtf.EditorGridComp({id:"gridCompo"+this.id,compId:this.compId,flag:this.flag,combId:this.id,border:false,nodeidObj:this.nodeidObj,innertab:this.innertab,nodeVno:this.nodeVno,stripeRows:true,collapsible:true,animCollapse:false,owner:this.owner})]},{region:"center",layout:"fit",autoScroll:true,bodyStyle:"background:white;",border:false,items:[new Wtf.Panel({id:"inner1"+this.id,border:false,split:true,layout:"fit",autoScroll:true})]}]}));this.mb=new Wtf.Window({height:100,title:"New Tag",modal:true,width:250,scope:this,resizable:false,bodyStyle:"margin: 10px 0 0 10px;float: right;",items:[this.tagField=new Wtf.form.TextField({width:210,scope:this,validator:this.alphaNumCheck,invalidText:"The value in this field is invalid. Only alphabets, numerals and space allowed."})],buttons:[{text:"OK",scope:this,handler:function(C,E){var D=this.tagField.getValue().trim();if(D.length>0&&this.tagField.isValid()){Wtf.Ajax.request({url:Wtf.req.lms+"fetchTags.jsp",method:"GET",params:({tag:D,flag:1}),scope:this,success:function(F,G){this.allResources.reload()},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}});this.mb.close()}}},{text:"Cancel",scope:this,handler:function(){this.mb.close()}}]});this.loadMask=new Wtf.LoadMask(this.el.dom,{msg:"Saving.."});this.loadQuiz=new Wtf.LoadMask(this.el.dom,{msg:"Loading..."});if(Wtf.isIE){this.addListener("activate",this.handleActivate,this)}},handleActivate:function(A){A.doLayout();var B=(Wtf.getCmp("northpanel"+this.id).getSize().height<200)?200:Wtf.getCmp("northpanel"+this.id).getSize().height;Wtf.getCmp("northpanel"+this.id).setHeight(B);A.doLayout()},closeTab:function(){this.ownerCt.remove(this)},showWin:function(A){var B=A.getValue();if(B==1){this.importWin()}else{this.randomWin()}},importWin:function(){this.iwin=new Wtf.Window({title:"Import from Question Bank",width:700,height:500,resizable:false,autoDestroy:true,modal:true,border:false,layout:"border",items:[{region:"north",height:70,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","Import from Question Bank","Import one or more questions from the question bank")},{region:"center",layout:"fit",border:false,items:[this.qbGrid=new Wtf.lms.qBankGrid({id:"this"+this.id,flag:1})]}],buttons:[{text:"Import",scope:this,handler:function(){var D=this.qbGrid.getStore();var B=this.qbGrid.getColModel();var G=this.qbGrid.getSelModel();var A=G.getSelections();var C="";var F;for(var E=0;E<A.length;E++){C+=A[E].data["quesid"]+","}if(C.length>0){C=C.substr(0,(C.length-1))}if(this.nodeidObj){F=this.nodeidObj}else{F=(this.id).substring(3)}Wtf.Ajax.request({url:Wtf.req.lms+"importQuestion.jsp",method:"POST",params:({idString:C,id:F}),scope:this,success:function(H,J){var I=this.grid.getStore();I.reload();this.iwin.close()},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}},{text:"Cancel",scope:this,handler:function(){this.iwin.close()}}]});this.iwin.show()},randomWin:function(){this.RES=Wtf.data.Record.create([{name:"tagid",type:"string"},{name:"tagname",type:"string"},{name:"check"}]);this.allResources=new Wtf.data.Store({url:Wtf.req.lms+"fetchTags.jsp",reader:new Wtf.data.JsonReader({root:"data",id:"res-reader"},this.RES)});this.MSComboconfig={store:this.allResources,displayField:"tagname",valueField:"tagid",triggerAction:"all",mode:"local"};this.rwin=new Wtf.Window({title:"Random Question",width:500,height:360,resizable:false,autoDestroy:true,modal:true,border:false,items:[{region:"north",height:75,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",border:false,html:getHeader("images/createuser.gif","Random Question","Choose the number of random questions you want to add to the quiz. You can also specify the difficulty range")},{region:"center",border:false,bodyStyle:"background:#f1f1f1;",height:300,items:[this.form1=new Wtf.FormPanel({url:Wtf.req.lms+"randomQuestion.jsp",waitMsgTarget:true,method:"POST",border:false,bodyStyle:"margin-top:20px;margin-left:35px;font-size:10px;",layout:"form",items:[this.nameField=new Wtf.form.NumberField({fieldLabel:"Number of questions*",name:"number",allowBlank:false,emptyText:10,labelWidth:180,scope:this,width:80,maxValue:100}),{xtype:"fieldset",title:"Difficulty",height:100,width:350,items:[this.minField=new Wtf.form.NumberField({fieldLabel:"Minimum*",emptyText:1,labelWidth:120,scope:this,width:80,name:"min",allowDecimals:false,allowNegative:false,allowBlank:false,maxValue:10,validator:function(B){var A=Wtf.getCmp("max").getValue();if(parseInt(B)<A){return true}else{return"Please specify a value less than the maximum value"}}}),this.maxField=new Wtf.form.NumberField({fieldLabel:"Maximum*",id:"max",emptyText:10,labelWidth:120,scope:this,width:80,name:"max",allowDecimals:false,allowNegative:false,allowBlank:false,maxValue:10})]},{layout:"column",border:false,items:[{width:280,border:false,layout:"form",items:[this.multi=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,fieldLabel:"Tags",forceSelection:true},this.MSComboconfig))]},{border:false,layout:"form",items:[{xtype:"button",text:"New Tag",scope:this,handler:function(){this.allResources.load({params:{flag:0}});this.mb.show()}}]}]}]})]}],buttons:[{text:"Import",scope:this,handler:function(){var A;if(this.nodeidObj){A=this.nodeidObj}else{A=this.id.substring(3)}this.form1.form.submit({waitMsg:"Loading...",scope:this,params:{id:A,tags:this.multi.getValue()},failure:function(C,B){Wtf.MessageBox.show({title:"Failure",msg:"Error connecting to server. Please try again.",buttons:Wtf.MessageBox.OK,scope:this,fn:function(){this.rwin.close()},icon:Wtf.MessageBox.INFO})},success:function(D,C){var B=Wtf.decode(C.response.responseText.trim());this.grid.getStore().reload();var E;if(B.number){rmsg=B.number+" Questions imported successfully."}else{if(B.number==0){rmsg="Questions are not available according to this criteria."}else{rmsg="Questions imported successfully."}}Wtf.MessageBox.show({title:"Success",msg:rmsg,buttons:Wtf.MessageBox.OK,scope:this,fn:function(){this.rwin.close()},icon:Wtf.MessageBox.INFO})}})}},{text:"Cancel",scope:this,handler:function(){this.rwin.close()}}]});this.rwin.show();this.allResources.load({params:{flag:0}})},pubresp:function(B,C,A){if(C[0].json.Success=="true"){this.fireEvent("publishObject");Wtf.MessageBox.alert("Status","Object published successfully")}else{if(C[0].json.Success=="false"){msgBoxShow(["Status","There is no change to publish this object."])}else{Wtf.MessageBox.alert("Status","Problem in publishing Object")}}}});var p=false;var last=false;var up,up1;var cmin1,csec1,cmin2=0,csec2=0;var q=0;var timervalue1,timervalue2;var timercheck;var t=0;var ds;var submitcount;var r=0;var score=0;function showpreview(D){ds=D;csec2=0;score=0;submitcount=0;cmin2=0;q=0;r=0;t=0;p=false;last=false;timervalue1=[];timervalue2=[];timercheck=[];var C,F;var B=new Wtf.Panel({id:"showpanel",layout:"fit"});var E=new Wtf.Panel({id:"timerp",cls:"timerp",layout:"fit"});F=document.documentElement.clientHeight;C=document.documentElement.clientWidth;var A=new Wtf.Panel({id:"winquespanel",bbar:[{id:"prevbut",iconCls:"prevbut",handler:prevclick},{id:"nextbut",iconCls:"nextbut",handler:nextclick},{id:"submit",text:"Submit",handler:submitclick},{id:"quit",iconCls:"closepic",handler:quitclick}],items:[E,B]});winpre=new Wtf.Window({frame:true,layout:"fit",closable:false,modal:true,resizable:false,width:C-10,height:F-10,id:"prwindow",items:[A]});winpre.show();Up();updatepanel(0)}function updatepanel(G){Wtf.getCmp("prevbut").disable();if((ds.getCount()-2)==G||last==true){Wtf.getCmp("nextbut").disable()}if(q==0||p==true){Wtf.getCmp("prevbut").disable()}else{if(Wtf.getCmp("prevbut").disable()){Wtf.getCmp("prevbut").enable()}}var I=ds.getAt(G).data["type"];if(I=="True/False"){var A=parseInt(G)+1;ques=ds.getAt(G).data["question"];var E=document.getElementById("showpanel");points=ds.getAt(G).data["points"];timelimit=ds.getAt(G).data["timelimit"];timercheck[G]=0;E.innerHTML="<br><div class='topshowpanel' >Mark true or false:</div><br><br><Div class='qfont'>Q.No."+A+" "+ques+"</Div><Div class='markssh'>Marks: "+points+"</Div><Div class='markssh'>Time Limit:"+timelimit+"</Div><br><Div class='markssh' id='timelimit1'></Div><br><br><br><div class='optdiv'><div style = 'float : left'><input type='checkbox' id='chk1' class='chk1' name='chk1' /></div><div id='ans1' style = 'padding-left:5px;padding-top:5px;'>True</div></div><br><br><br><div class='optdiv'><div style = 'float : left'><input type='checkbox' id='chk2' class='chk1' name='chk1'/></div><div id='ans2' style = 'padding-left:5px;padding-top:5px;'>False</div></div>";Up1(timelimit)}else{if(I=="Multiple Choice"){var A=parseInt(G)+1;ques=ds.getAt(G).data["question"];var E=document.getElementById("showpanel");points=ds.getAt(G).data["points"];timelimit=ds.getAt(G).data["timelimit"];var C=ds.getAt(G).data["choice"];var H=C.split("/");E.innerHTML="<br><div class='topshowpanel' >Mark the correct choice:</div><br><br><Div class='qfont'>Q.No."+A+" "+ques+"</Div><Div class='markssh'>Marks: "+points+"</Div><Div class='markssh'>Time Limit:"+timelimit+"</Div><br><Div class='markssh' id='timelimit1'></Div><br><br><br>";for(var F=0;F<H.length-1;F++){E.innerHTML+="<div class='optdiv'><div style = 'float : left'><input type='checkbox' id='chk"+F+"'  class='chk1' name='chk1' /></div><div id='ans"+F+"' style='padding-left:5px;padding-top:5px;'>"+H[F]+"</div></div><br><br><br>"}Up1(timelimit)}else{if(I=="Fill in the Blanks"){var A=parseInt(G)+1;ques=ds.getAt(G).data["question"];var E=document.getElementById("showpanel");points=ds.getAt(G).data["points"];timelimit=ds.getAt(G).data["timelimit"];var J=ds.getAt(G).data["choice"];var H=J.split("/");E.innerHTML="<br><div class='topshowpanel' >Fill in the blanks:</div><br><br><Div class='qfont'>Q.No."+A+" "+ques+"</Div><Div class='markssh'>Marks: "+points+"</Div><Div class='markssh'>Time Limit:"+timelimit+"</Div><br><Div class='markssh' id='timelimit1'></Div><br><br><br>";for(var F=0;F<H.length-1;F++){E.innerHTML+="<div class='optdiv'><input type='textbox' id='ans"+F+"' name='ans1'/></div><br><br>"}Up1(timelimit)}else{if(I=="Multiple Response"){var A=parseInt(G)+1;ques=ds.getAt(G).data["question"];var E=document.getElementById("showpanel");points=ds.getAt(G).data["points"];timelimit=ds.getAt(G).data["timelimit"];var C=ds.getAt(G).data["choice"];var H=C.split("/");E.innerHTML="<br><div class='topshowpanel' >Mark the correct choice(s):</div><br><br><Div class='qfont'>Q.No."+A+" "+ques+"</Div><Div class='markssh'>Marks: "+points+"</Div><Div class='markssh'>Time Limit:"+timelimit+"</Div><br><Div class='markssh' id='timelimit1'></Div><br><br><br>";for(var F=0;F<H.length-1;F++){E.innerHTML+="<div class='optdiv'><div style = 'float : left'><input type='checkbox' id='chk"+F+"' class='chk1' name='chk1' /></div><div style='padding-left:5px;padding-top:5px;'>"+H[F]+"</div></div><br><br><br>"}Up1(timelimit)}else{if(I=="Matching"){var A=parseInt(G)+1;ques=ds.getAt(G).data["question"];var E=document.getElementById("showpanel");points=ds.getAt(G).data["points"];timelimit=ds.getAt(G).data["timelimit"];var C=ds.getAt(G).data["choice"];var H=C.split("/");E.innerHTML="<br><div class='topshowpanel' >Match the following:Drag-drop to set appropriate choice(s)</div><br><br><Div class='qfont'>Q.No."+A+" "+ques+"</Div><Div class='markssh'>Marks: "+points+"</Div><Div class='markssh'>Time Limit:"+timelimit+"</Div><br><Div class='markssh' id='timelimit1'></Div><br><br><br>";for(var F=0;F<H.length-1;F++){E.innerHTML+="<Div><Div class='optdiv1'>"+F+"</Div><Div id='dz"+F+"' class='drdiv'>"+H[F]+"</Div><Div><br><br><br><br>"}E.innerHTML+="<Div class ='maindrdiv' id='maindrdiv'></Div>";var B=document.getElementById("maindrdiv");var J=ds.getAt(G).data["correctans"];var D=J.split("@");MakeDropZone("maindrdiv");for(var F=0;F<D.length-1;F++){B.innerHTML+="<Div class='drdiv1' id='ds"+F+"' >"+D[F]+"</Div><br><br><br>"}for(var F=0;F<D.length-1;F++){MakeDropZone("dz"+F);MakeDropSource("ds"+F)}Up1(timelimit)}else{if(I=="Ranking"){var A=parseInt(G)+1;ques=ds.getAt(G).data["question"];var E=document.getElementById("showpanel");points=ds.getAt(G).data["points"];timelimit=ds.getAt(G).data["timelimit"];var C=ds.getAt(G).data["choice"];var H=C.split("/");E.innerHTML="<br><div class='topshowpanel' >Rank the following:Drag-drop to set appropriate choice(s)</div><br><br><Div class='qfont'>Q.No."+A+" "+ques+"</Div><Div class='markssh'>Marks: "+points+"</Div><Div class='markssh'>Time Limit:"+timelimit+"</Div><br><Div class='markssh' id='timelimit1'></Div><br><br><br>";for(var F=0;F<H.length-1;F++){E.innerHTML+="<Div><Div class='optdiv1'>"+F+"</Div><Div id='dz"+F+"' class='rankdrdiv'>"+H[F]+"</Div><Div><br><br><br><br>"}E.innerHTML+="<Div class ='maindrdiv' id='maindrdiv'></Div>";var B=document.getElementById("maindrdiv");MakeDropZone("maindrdiv");for(var F=0;F<H.length-1;F++){r++;B.innerHTML+="<Div class='drdiv2' id='ds"+F+"' >"+r+"</Div><br><br><br>"}for(var F=0;F<H.length-1;F++){MakeDropZone("dz"+F);MakeDropSource("ds"+F)}Up1(timelimit)}}}}}}}function submitclick(){timercheck[q]=1;submitcount++;if(q==ds.getCount()-2){q=0;if(timercheck[q]==1){q++;while(!(timercheck[q]==0)){if(q==ds.getCount()-1){Wtf.getCmp("nextbut").disable();break}q++}}}else{q++}if(ds.getAt(q-1).data["type"]=="True/False"){var C=false;var K;var H=0;var Q=ds.getAt(q-1).data["correctans"];var G=ds.getAt(q-1).data["feedback"];var L=null;if(!(G=="None")){L=G.split("/")}var F=Q.split("@");if(F[0]=="1"){Q="True"}else{if(F[0]=="0"){Q="False"}}for(var N=1;N<=2;N++){if(document.getElementById("chk"+N).checked){H++;if(H>1){corcrectresult=false;break}else{K=document.getElementById("ans"+N).firstChild.nodeValue;corcrectresult=true}}}if(K==Q&&corcrectresult==true){if(!(G=="None")){getFeedback(L,1)}updateScore(q)}else{if(!(G=="None")){getFeedback(L,2)}}}else{if(ds.getAt(q-1).data["type"]=="Multiple Choice"){var C=false;var K;var H=0;var J=ds.getAt(q-1).data["choice"];var P=J.split("/");var Q=ds.getAt(q-1).data["correctans"];var F=Q.split("@");var G=ds.getAt(q-1).data["feedback"];var L=null;if(!(G=="None")){L=G.split("/")}for(var N=0;N<P.length-1;N++){if(document.getElementById("chk"+N).checked==true){H++;if(H>1){corcrectresult=false;break}else{K=N+1;corcrectresult=true}}}if(corcrectresult==true){for(var E=0;E<F.length-1;E++){if(F[E]=="1"){if((E+1)==K){if(!(G=="None")){getFeedback(L,1)}updateScore(q)}else{if(!(G=="None")){getFeedback(L,2)}}}}}}else{if(ds.getAt(q-1).data["type"]=="Fill in the Blanks"){var C=false;var K=[];var M=[];var H=0;var J=ds.getAt(q-1).data["choice"];var P=J.split("/");var Q=ds.getAt(q-1).data["correctans"];var A=Q.split("@");var G=ds.getAt(q-1).data["feedback"];var L=null;if(!(G=="None")){L=G.split("/")}for(var R=0;R<A.length-1;R++){var O=A[R];M[O-1]=P[R]}for(var N=0;N<M.length;N++){if(document.getElementById("ans"+N).value){K[H]=document.getElementById("ans"+N).value;H++}}for(var I=0;I<P.length-1;I++){if(M[I]==K[I]){C=true}else{C=false;break}}if(C==true){if(!(G=="None")){getFeedback(L,1)}updateScore(q)}else{if(!(G=="None")){getFeedback(L,2)}}}else{if(ds.getAt(q-1).data["type"]=="Multiple Response"){var C=false;var K=[];var J=ds.getAt(q-1).data["choice"];var P=J.split("/");var Q=ds.getAt(q-1).data["correctans"];var B=Q.split("@");var G=ds.getAt(q-1).data["feedback"];var L=null;if(!(G=="None")){L=G.split("/")}for(var N=0;N<P.length-1;N++){if(document.getElementById("chk"+N).checked){K[N]="1"}else{K[N]="0"}}for(var I=0;I<B.length-1;I++){if(B[I]==K[I]){C=true}else{C=false;break}}if(C==true){if(!(G=="None")){getFeedback(L,1)}updateScore(q)}else{if(!(G=="None")){getFeedback(L,2)}}}else{if(ds.getAt(q-1).data["type"]=="Ranking"){var C=false;var K=[];var H=0;var M=[];var J=ds.getAt(q-1).data["choice"];var Q=ds.getAt(q-1).data["correctans"];var P=Q.split("@");var D=J.split("/");var G=ds.getAt(q-1).data["feedback"];var L=null;if(!(G=="None")){L=G.split("/")}for(var R=0;R<P.length-1;R++){var O=P[R];M[O-1]=D[R]}for(var N=0;N<P.length-1;N++){K[parseInt(document.getElementById("dz"+N).lastChild.firstChild.nodeValue)-1]=P[N]}if(P.length-1==K.length){for(var I=0;I<P.length-1;I++){if(P[I]==K[I]){C=true}else{C=false;break}}}if(C==true){if(!(G=="None")){getFeedback(L,1)}updateScore(q)}else{if(!(G=="None")){getFeedback(L,2)}}}else{if(ds.getAt(q-1).data["type"]=="Matching"){var C=false;var K=[];var H=0;var Q=ds.getAt(q-1).data["correctans"];var P=Q.split("@");var G=ds.getAt(q-1).data["feedback"];var L=null;if(!(G=="None")){L=G.split("/")}for(var N=0;N<P.length-1;N++){K[N]=document.getElementById("dz"+N).lastChild.firstChild.nodeValue}if(P.length-1==K.length){for(var I=0;I<P.length-1;I++){if(P[I]==K[I]){C=true}else{C=false;break}}}if(C==true){if(!(G=="None")){getFeedback(L,1)}updateScore(q)}else{if(!(G=="None")){getFeedback(L,2)}}}}}}}}clearTimeout(up1);timervalue1[t]=csec2;timervalue2[t]=cmin2;t++;if(timervalue1[q]==null){csec2=0;cmin2=0}else{csec2=timervalue1[q];cmin2=timervalue2[q]}if(submitcount==ds.getCount()-1){q=0;Wtf.MessageBox.alert("Status","Your Score is: "+score);clearTimeout(up);winpre.close()}else{updatepanel(q)}}function getFeedback(B,A){if(B.length>1){Wtf.MessageBox.alert("Status",B[A])}}function updateScore(A){score+=parseInt(ds.getAt(A-1).data["points"])}function prevclick(){if(Wtf.getCmp("nextbut").disable()){Wtf.getCmp("nextbut").enable()}var A=q;if(timercheck[q-1]==1){q--;while(!(timercheck[q]==0)){q--;if(q<0){q=A;p=true;break}}}else{q--}clearTimeout(up1);timervalue1[t]=csec2;timervalue2[t]=cmin2;t--;csec2=timervalue1[q];cmin2=timervalue2[q];updatepanel(q)}function nextclick(){p=false;if(timercheck[q+1]==1){q++;while(!(timercheck[q]==0)){q++;if(q==ds.getCount()-1){Wtf.getCmp("nextbut").disable();break}}}else{q++}clearTimeout(up1);timervalue1[t]=csec2;timervalue2[t]=cmin2;t++;if(timervalue1[q]==null){csec2=0;cmin2=0}else{csec2=timervalue1[q];cmin2=timervalue2[q]}updatepanel(q)}function Up1(B){var A=document.getElementById("timelimit1");A.innerHTML=Display1(cmin2,csec2);up1=setTimeout("UpRepeat1(timelimit)",1000)}function UpRepeat1(B){csec2++;if(csec2==60){csec2=0;cmin2++}var A=document.getElementById("timelimit1");A.innerHTML=Display(cmin2,csec2);if(B==csec2){timercheck[q]=1;if(q==ds.getCount()-2){q=0;Wtf.getCmp("nextbut").enable()}submitcount++;if(submitcount==ds.getCount()-1){q=0;Wtf.MessageBox.alert("Status","Your Score is: ");clearTimeout(up);winpre.close()}else{nextclick()}}else{timercheck[q]=0;up1=setTimeout("UpRepeat1(timelimit)",1000)}}function Up(){cmin1=0;csec1=0;var A=document.getElementById("timerp");A.innerHTML=Display(cmin1,csec1);up=setTimeout("UpRepeat()",1000)}function UpRepeat(){csec1++;if(csec1==60){csec1=0;cmin1++}var A=document.getElementById("timerp");A.innerHTML=Display(cmin1,csec1);up=setTimeout("UpRepeat()",1000)}function Display(B,C){var A;if(B<=9){A=" 0"}else{A=" "}A+=B+":";if(C<=9){A+="0"+C}else{A+=C}return(A)}function Display1(B,C){var A;if(B<=9){A=" 0"}else{A=" "}A+=B+":";if(C<=9){A+="0"+C}else{A+=C}return(A)}function quitclick(){csec2=0;cmin2=0;clearTimeout(up);clearTimeout(up1);winpre.close()}var jg_ok,jg_ie,jg_fast,jg_dom,jg_moz;function _chkDHTM(A,B){A=document.body||null;jg_ie=A&&typeof A.insertAdjacentHTML!="undefined"&&document.createElement;jg_dom=(A&&!jg_ie&&typeof A.appendChild!="undefined"&&typeof document.createRange!="undefined"&&typeof (B=document.createRange()).setStartBefore!="undefined"&&typeof B.createContextualFragment!="undefined");jg_fast=jg_ie&&document.all&&!window.opera;jg_moz=jg_dom&&typeof A.style.MozOpacity!="undefined";jg_ok=!!(jg_ie||jg_dom)}function _pntCnvDom(){var A=this.wnd.document.createRange();A.setStartBefore(this.cnv);A=A.createContextualFragment(jg_fast?this._htmRpc():this.htm);if(this.cnv){this.cnv.appendChild(A)}this.htm=""}function _pntCnvIe(){if(this.cnv){this.cnv.insertAdjacentHTML("BeforeEnd",jg_fast?this._htmRpc():this.htm)}this.htm=""}function _pntDoc(){this.wnd.document.write(jg_fast?this._htmRpc():this.htm);this.htm=""}function _pntN(){}function _mkDiv(A,D,B,C){this.htm+='<div style="position:absolute ;left:'+A+"px;top:"+D+"px;width:"+B+"px;height:"+C+"px;clip:rect(0,"+B+"px,"+C+"px,0);background-color:"+this.color+(!jg_moz?";overflow:hidden":"")+';"></div>'}function _mkDivIe(A,D,B,C){this.htm+="%%"+this.color+";"+A+";"+D+";"+B+";"+C+";"}function _mkDivPrt(A,D,B,C){this.htm+='<div style="position:absolute;border-left:'+B+"px solid "+this.color+";left:"+A+"px;top:"+D+"px;width:0;height:"+C+"px;clip:rect(0,"+B+"px,"+C+"px,0);background-color:"+this.color+(!jg_moz?";overflow:hidden":"")+';"></div>'}var _regex=/%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;function _htmRpc(){return this.htm.replace(_regex,'<div style="overflow:hidden;position:absolute;background-color:$1;left:$2;top:$3;width:$4;height:$5"></div>\n')}function _htmPrtRpc(){return this.htm.replace(_regex,'<div style="overflow:hidden;position:absolute;background-color:$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n')}function _mkLin(E,M,B,K){if(E>B){var J=B;var G=K;B=E;K=M;E=J;M=G}var P=B-E,O=Math.abs(K-M),L=E,I=M,N=(M>K)?-1:1;if(P>=O){var A=O<<1,H=A-(P<<1),D=A-P,F=L;while(P>0){--P;++L;if(D>0){this._mkDiv(F,I,L-F,1);I+=N;D+=H;F=L}else{D+=A}}this._mkDiv(F,I,B-F+1,1)}else{var A=P<<1,H=A-(O<<1),D=A-O,C=I;if(K<=M){while(O>0){--O;if(D>0){this._mkDiv(L++,I,1,C-I+1);I+=N;D+=H;C=I}else{I+=N;D+=A}}this._mkDiv(B,K,1,C-K+1)}else{while(O>0){--O;I+=N;if(D>0){this._mkDiv(L++,C,1,I-C);D+=H;C=I}else{D+=A}}this._mkDiv(B,C,1,K-C+1)}}}function _mkLin2D(Q,B,P,A){if(Q>P){var F=P;var N=A;P=Q;A=B;Q=F;B=N}var J=P-Q,I=Math.abs(A-B),H=Q,G=B,M=(B>A)?-1:1;var K=this.stroke;if(J>=I){if(J>0&&K-3>0){var R=(K*J*Math.sqrt(1+I*I/(J*J))-J-(K>>1)*I)/J;R=(!(K-4)?Math.ceil(R):Math.round(R))+1}else{var R=K}var S=Math.ceil(K/2);var O=I<<1,E=O-(J<<1),L=O-J,D=H;while(J>0){--J;++H;if(L>0){this._mkDiv(D,G,H-D+S,R);G+=M;L+=E;D=H}else{L+=O}}this._mkDiv(D,G,P-D+S+1,R)}else{if(K-3>0){var R=(K*I*Math.sqrt(1+J*J/(I*I))-(K>>1)*J-I)/I;R=(!(K-4)?Math.ceil(R):Math.round(R))+1}else{var R=K}var S=Math.round(K/2);var O=J<<1,E=O-(I<<1),L=O-I,C=G;if(A<=B){++S;while(I>0){--I;if(L>0){this._mkDiv(H++,G,R,C-G+S);G+=M;L+=E;C=G}else{G+=M;L+=O}}this._mkDiv(P,A,R,C-A+S)}else{while(I>0){--I;G+=M;if(L>0){this._mkDiv(H++,C,R,G-C+S);L+=E;C=G}else{L+=O}}this._mkDiv(P,C,R,A-C+S+1)}}}function _mkLinDott(D,K,B,I){if(D>B){var H=B;var E=I;B=D;I=K;D=H;K=E}var O=B-D,N=Math.abs(I-K),J=D,G=K,M=(K>I)?-1:1,L=true;if(O>=N){var A=N<<1,F=A-(O<<1),C=A-O;while(O>0){--O;if(L){this._mkDiv(J,G,1,1)}L=!L;if(C>0){G+=M;C+=F}else{C+=A}++J}}else{var A=O<<1,F=A-(N<<1),C=A-N;while(N>0){--N;if(L){this._mkDiv(J,G,1,1)}L=!L;G+=M;if(C>0){++J;C+=F}else{C+=A}}}if(L){this._mkDiv(J,G,1,1)}}function _mkOv(E,N,R,P){var V=(++R)>>1,U=(++P)>>1,L=R&1,D=P&1,C=E+V,B=N+U,I=0,H=U,G=0,F=U,Q=(V*V)<<1,O=Q<<1,M=(U*U)<<1,K=M<<1,S=(Q>>1)*(1-(U<<1))+M,A=(M>>1)-Q*((U<<1)-1),J,T;while(H>0){if(S<0){S+=M*((I<<1)+3);A+=K*(++I)}else{if(A<0){S+=M*((I<<1)+3)-O*(H-1);A+=K*(++I)-Q*(((H--)<<1)-3);J=I-G;T=F-H;if((J&2)&&(T&2)){this._mkOvQds(C,B,I-2,H+2,1,1,L,D);this._mkOvQds(C,B,I-1,H+1,1,1,L,D)}else{this._mkOvQds(C,B,I-1,F,J,T,L,D)}G=I;F=H}else{A-=Q*((H<<1)-3);S-=O*(--H)}}}J=V-G+1;T=(F<<1)+D;H=B-F;this._mkDiv(C-V,H,J,T);this._mkDiv(C+G+L-1,H,J,T)}function _mkOv2D(E,H,A,B){var e=this.stroke;A+=e+1;B+=e+1;var AD=A>>1,AB=B>>1,AA=A&1,V=B&1,L=E+AD,K=H+AB,c=0,X=AB,S=(AD*AD)<<1,Q=S<<1,G=(AB*AB)<<1,D=G<<1,I=(S>>1)*(1-(AB<<1))+G,v=(G>>1)-S*((AB<<1)-1);if(e-4<0&&(!(e-2)||A-51>0&&B-51>0)){var O=0,N=AB,d,o,T;while(X>0){if(I<0){I+=G*((c<<1)+3);v+=D*(++c)}else{if(v<0){I+=G*((c<<1)+3)-Q*(X-1);v+=D*(++c)-S*(((X--)<<1)-3);d=c-O;o=N-X;if(d-1){T=d+1+(e&1);o=e}else{if(o-1){T=e;o+=1+(e&1)}else{T=o=e}}this._mkOvQds(L,K,c-1,N,T,o,AA,V);O=c;N=X}else{v-=S*((X<<1)-3);I-=Q*(--X)}}}this._mkDiv(L-AD,K-N,e,(N<<1)+V);this._mkDiv(L+AD+AA-e,K-N,e,(N<<1)+V)}else{var AE=(A-(e<<1))>>1,AC=(B-(e<<1))>>1,Y=0,W=AC,R=(AE*AE)<<1,P=R<<1,F=(AC*AC)<<1,C=F<<1,J=(R>>1)*(1-(AC<<1))+F,u=(F>>1)-R*((AC<<1)-1),Z=[],U=[],f=[];Z[0]=0;U[0]=AB;f[0]=AC-1;while(X>0){if(I<0){Z[Z.length]=c;U[U.length]=X;I+=G*((c<<1)+3);v+=D*(++c)}else{if(v<0){Z[Z.length]=c;I+=G*((c<<1)+3)-Q*(X-1);v+=D*(++c)-S*(((X--)<<1)-3);U[U.length]=X}else{v-=S*((X<<1)-3);I-=Q*(--X)}}if(W>0){if(J<0){J+=F*((Y<<1)+3);u+=C*(++Y);f[f.length]=W-1}else{if(u<0){J+=F*((Y<<1)+3)-P*(W-1);u+=C*(++Y)-R*(((W--)<<1)-3);f[f.length]=W-1}else{u-=R*((W<<1)-3);J-=P*(--W);f[f.length-1]--}}}}var O=-AA,N=AB,M=f[0],g=Z.length,d,o;for(var n=0;n<g;n++){if(typeof f[n]!="undefined"){if(f[n]<M||U[n]<N){c=Z[n];this._mkOvQds(L,K,c,N,c-O,N-M,AA,V);O=c;N=U[n];M=f[n]}}else{c=Z[n];this._mkDiv(L-c,K-N,1,(N<<1)+V);this._mkDiv(L+O+AA,K-N,1,(N<<1)+V);O=c;N=U[n]}}this._mkDiv(L-AD,K-N,1,(N<<1)+V);this._mkDiv(L+O+AA,K-N,1,(N<<1)+V)}}function _mkOvDott(E,L,Q,O){var T=(++Q)>>1,S=(++O)>>1,J=Q&1,D=O&1,H=D^1,C=E+T,B=L+S,G=0,F=S,P=(T*T)<<1,M=P<<1,K=(S*S)<<1,I=K<<1,R=(P>>1)*(1-(S<<1))+K,A=(K>>1)-P*((S<<1)-1),N=true;while(F>0){if(R<0){R+=K*((G<<1)+3);A+=I*(++G)}else{if(A<0){R+=K*((G<<1)+3)-M*(F-1);A+=I*(++G)-P*(((F--)<<1)-3)}else{A-=P*((F<<1)-3);R-=M*(--F)}}if(N&&F>=H){this._mkOvQds(C,B,G,F,1,1,J,D)}N=!N}}function _mkRect(A,E,B,D){var C=this.stroke;this._mkDiv(A,E,B,C);this._mkDiv(A+B,E,C,D);this._mkDiv(A,E+D,B+C,C);this._mkDiv(A,E+C,C,D-C)}function _mkRectDott(A,D,B,C){this.drawLine(A,D,A+B,D);this.drawLine(A+B,D,A+B,D+C);this.drawLine(A,D+C,A+B,D+C);this.drawLine(A,D,A,D+C)}function jsgFont(){this.PLAIN="font-weight:normal;";this.BOLD="font-weight:bold;";this.ITALIC="font-style:italic;";this.ITALIC_BOLD=this.ITALIC+this.BOLD;this.BOLD_ITALIC=this.ITALIC_BOLD}var Font=new jsgFont();function jsgStroke(){this.DOTTED=-1}var Stroke=new jsgStroke();function jsGraphics(A,B){this.setColor=function(C){this.color=C.toLowerCase()};this.setStroke=function(C){this.stroke=C;if(!(C+1)){this.drawLine=_mkLinDott;this._mkOv=_mkOvDott;this.drawRect=_mkRectDott}else{if(C-1>0){this.drawLine=_mkLin2D;this._mkOv=_mkOv2D;this.drawRect=_mkRect}else{this.drawLine=_mkLin;this._mkOv=_mkOv;this.drawRect=_mkRect}}};this.setPrintable=function(C){this.printable=C;if(jg_fast){this._mkDiv=_mkDivIe;this._htmRpc=C?_htmPrtRpc:_htmRpc}else{this._mkDiv=C?_mkDivPrt:_mkDiv}};this.setFont=function(D,E,C){this.ftFam=D;this.ftSz=E;this.ftSty=C||Font.PLAIN};this.drawPolyline=this.drawPolyLine=function(C,E){for(var D=C.length-1;D;){--D;this.drawLine(C[D],E[D],C[D+1],E[D+1])}};this.fillRect=function(C,F,D,E){this._mkDiv(C,F,D,E)};this.drawPolygon=function(C,D){this.drawPolyline(C,D);this.drawLine(C[C.length-1],D[C.length-1],C[0],D[0])};this.drawEllipse=this.drawOval=function(C,F,D,E){this._mkOv(C,F,D,E)};this.fillEllipse=this.fillOval=function(G,Q,L,U){var X=L>>1,W=U>>1,M=L&1,F=U&1,E=G+X,D=Q+W,J=0,I=W,H=W,S=(X*X)<<1,R=S<<1,O=(W*W)<<1,K=O<<1,T=(S>>1)*(1-(W<<1))+O,C=(O>>1)-S*((W<<1)-1),P,N,V;if(L){while(I>0){if(T<0){T+=O*((J<<1)+3);C+=K*(++J)}else{if(C<0){T+=O*((J<<1)+3)-R*(I-1);P=E-J;N=(J<<1)+M;C+=K*(++J)-S*(((I--)<<1)-3);V=H-I;this._mkDiv(P,D-H,N,V);this._mkDiv(P,D+I+F,N,V);H=I}else{C-=S*((I<<1)-3);T-=R*(--I)}}}}this._mkDiv(E-X,D-H,L,(H<<1)+F)};this.fillArc=function(E,g,Z,I,F,U){var f=Z>>1,e=I>>1,Q=(Z&1)|((I&1)<<16),G=E+f,D=g+e,O=0,M=e,K=O,J=M,V=(f*f)<<1,T=V<<1,R=(e*e)<<1,P=R<<1,X=(V>>1)*(1-(e<<1))+R,C=(R>>1)-V*((e<<1)-1),Y,N,L,d,c=(1<<(Math.floor((F%=360)/180)<<3))|(2<<(Math.floor((U%=360)/180)<<3))|((F>=U)<<16),H=new Array(e+1),W=new Array(e+1);F*=Math.PI/180;U*=Math.PI/180;Y=G+Math.round(f*Math.cos(F));N=D+Math.round(-e*Math.sin(F));_mkLinVirt(H,G,D,Y,N);L=G+Math.round(f*Math.cos(U));d=D+Math.round(-e*Math.sin(U));_mkLinVirt(W,G,D,L,d);while(M>0){if(X<0){X+=R*((O<<1)+3);C+=P*(++O)}else{if(C<0){X+=R*((O<<1)+3)-T*(M-1);K=O;C+=P*(++O)-V*(((M--)<<1)-3);this._mkArcDiv(K,M,J,G,D,Q,H,W,c);J=M}else{C-=V*((M<<1)-3);X-=T*(--M);if(M&&(H[M]!=H[M-1]||W[M]!=W[M-1])){this._mkArcDiv(O,M,J,G,D,Q,H,W,c);K=O;J=M}}}}this._mkArcDiv(O,0,J,G,D,Q,H,W,c);if(Q>>16){if(c>>16){var S=(N<=D||d>D)?(G-O):G;this._mkDiv(S,D,O+G-S+(Q&65535),1)}else{if((c&1)&&d>D){this._mkDiv(G-O,D,O,1)}}}};this.fillPolygon=function(I,H){var J;var O;var Q,M;var D,P;var C,N;var L,K;var E;var F=I.length;if(!F){return }Q=H[0];M=H[0];for(J=1;J<F;J++){if(H[J]<Q){Q=H[J]}if(H[J]>M){M=H[J]}}for(O=Q;O<=M;O++){var G=[];E=0;for(J=0;J<F;J++){if(!J){L=F-1;K=0}else{L=J-1;K=J}P=H[L];N=H[K];if(P<N){D=I[L];C=I[K]}else{if(P>N){N=H[L];P=H[K];C=I[L];D=I[K]}else{continue}}if((O>=P)&&(O<N)){G[E++]=Math.round((O-P)*(C-D)/(N-P)+D)}else{if((O==M)&&(O>P)&&(O<=N)){G[E++]=Math.round((O-P)*(C-D)/(N-P)+D)}}}G.sort(_CompInt);for(J=0;J<E;J+=2){this._mkDiv(G[J],O,G[J+1]-G[J]+1,1)}}};this.drawString=function(D,C,E){this.htm+='<div style="position:absolute;white-space:nowrap;left:'+C+"px;top:"+E+"px;font-family:"+this.ftFam+";font-size:"+this.ftSz+";color:"+this.color+";"+this.ftSty+'">'+D+"</div>"};this.drawStringRect=function(D,C,G,E,F){this.htm+='<div style="position:absolute;overflow:hidden;left:'+C+"px;top:"+G+"px;width:"+E+"px;text-align:"+F+";font-family:"+this.ftFam+";font-size:"+this.ftSz+";color:"+this.color+";"+this.ftSty+'">'+D+"</div>"};this.drawImage=function(G,C,H,E,F,D){this.htm+='<div style="position:absolute;left:'+C+"px;top:"+H+"px;width:"+E+"px;height:"+F+'px;"><img src="'+G+'" width="'+E+'" height="'+F+'"'+(D?(" "+D):"")+"></div>"};this.clear=function(){this.htm="";if(this.cnv){this.cnv.innerHTML=""}};this._mkOvQds=function(E,D,K,J,L,F,N,I){var G=E-K,C=E+K+N-L,M=D-J,H=D+J+I-F;if(C>G+L){this._mkDiv(C,M,L,F);this._mkDiv(C,H,L,F)}else{L=C-G+L}this._mkDiv(G,M,L,F);this._mkDiv(G,H,L,F)};this._mkArcDiv=function(O,N,D,H,G,E,L,K,Q){var C=H+O+(E&65535),M,I=D-N,J,F,P;if(!I){I=1}O=H-O;if(Q&16711680){M=G-N-I;if(Q&255){if(Q&2){J=Math.max(O,K[N]);P=C-J;if(P>0){this._mkDiv(J,M,P,I)}}if(Q&1){F=Math.min(C,L[N]);P=F-O;if(P>0){this._mkDiv(O,M,P,I)}}}else{this._mkDiv(O,M,C-O,I)}M=G+N+(E>>16);if(Q&65280){if(Q&256){J=Math.max(O,L[N]);P=C-J;if(P>0){this._mkDiv(J,M,P,I)}}if(Q&512){F=Math.min(C,K[N]);P=F-O;if(P>0){this._mkDiv(O,M,P,I)}}}else{this._mkDiv(O,M,C-O,I)}}else{if(Q&255){if(Q&2){J=Math.max(O,K[N])}else{J=O}if(Q&1){F=Math.min(C,L[N])}else{F=C}M=G-N-I;P=F-J;if(P>0){this._mkDiv(J,M,P,I)}}if(Q&65280){if(Q&256){J=Math.max(O,L[N])}else{J=O}if(Q&512){F=Math.min(C,K[N])}else{F=C}M=G+N+(E>>16);P=F-J;if(P>0){this._mkDiv(J,M,P,I)}}}};this.setStroke(1);this.setFont("verdana,geneva,helvetica,sans-serif","12px",Font.PLAIN);this.color="#000000";this.htm="";this.wnd=B||window;if(!jg_ok){_chkDHTM()}if(jg_ok){if(A){if(typeof (A)=="string"){this.cont=document.all?(this.wnd.document.all[A]||null):document.getElementById?(this.wnd.document.getElementById(A)||null):null}else{if(A==window.document){this.cont=document.getElementsByTagName("body")[0]}else{this.cont=A}}this.cnv=document.createElement("div");this.cont.appendChild(this.cnv);this.paint=jg_dom?_pntCnvDom:_pntCnvIe}else{this.paint=_pntDoc}}else{this.paint=_pntN}this.setPrintable(false)}function _mkLinVirt(M,E,K,C,J){var P=Math.abs(C-E),O=Math.abs(J-K),L=E,I=K,A=(E>C)?-1:1,N=(K>J)?-1:1,D,F=0;if(P>=O){var B=O<<1,H=B-(P<<1);D=B-P;while(P>0){--P;if(D>0){M[F++]=L;I+=N;D+=H}else{D+=B}L+=A}}else{var B=P<<1,H=B-(O<<1);D=B-O;while(O>0){--O;I+=N;M[F++]=L;if(D>0){L+=A;D+=H}else{D+=B}}}for(var G=M.length,F=G-F;F;){M[G-(F--)]=L}}function _CompInt(A,B){return(A-B)}Wtf.ux.WtfButton=function(A){Wtf.ux.WtfButton.superclass.constructor.call(this,A);this.addEvents({"mouseOver":true})};Wtf.extend(Wtf.ux.WtfButton,Wtf.Component,{width:60,height:60,imgWidth:60,imgHeight:60,draggable:true,initialized:false,initComponent:function(){Wtf.ux.WtfButton.superclass.initComponent.call(this)},onRender:function(){this.elDom=Wtf.get(this.renderTo).createChild({tag:"a",cls:"lmswtfbutton"});var B=Wtf.get(this.elDom.dom.appendChild(document.createElement("img")));var A=Wtf.get(this.elDom.dom.appendChild(document.createElement("span")));B.dom.src=this.imgSrc;B.dom.id=this.ID;B.dom.alt=this.caption;A.dom.innerHTML=this.caption;A.dom.className="labelLms";A.dom.id=this.IDM;Wtf.EventManager.addListener(B,"mouseover",this.handleMouseOver,this)},handleMouseOver:function(A){var B=this.ID.split("_")[0];if(B=="section"){this.text="Drag and drop Section on the layout panel"}else{if(B=="retry"){this.text="Just in case someone doesn't do well"}else{if(B=="assessment"){this.text="Drag and drop Assessment on the layout panel"}else{if(B=="exit"){this.text="You can always have multiple exits"}else{if(B=="note"){this.text="Drag and drop to add a Note on the layout panel"}}}}}this.fireEvent("mouseOver",this.ID,this.text)}});Wtf.reg("lmswtfbutton",Wtf.ux.WtfButton);pedagogyBlock=function(K,D,B,N,J,M,E,L,H,P,G,C){var O=P.split("/");this.dropComp=K;this.con=B;this.mainobj=C.mainobj;this.handleid=H;this.dragpanel=new Wtf.Panel({id:H,html:'<label id="lab'+O[1]+'" style="position:absolute;left:30%;top:40%;font-size:11px;font-weight:bolder;">'+L+"</label>"});this.wrapnorth=document.createElement("div");this.wrapnorth.className="wrapnorth";this.wrapnorth.id="top/"+O[1]+"_"+this.mainobj.id;this.wrapnorth.onmousedown=this.linkcursor.createDelegate(this);this.wrapnorth.onmouseup=this.linkfinish.createDelegate(this);this.north=document.createElement("div");this.north.className="north";this.wrapnorth.appendChild(this.north);this.wrapeast=document.createElement("div");this.wrapeast.className="wrapeast";this.wrapeast.id="eas/"+O[1]+"_"+this.mainobj.id;this.wrapeast.onmousedown=this.linkcursor.createDelegate(this);this.wrapeast.onmouseup=this.linkfinish.createDelegate(this);this.east=document.createElement("div");this.east.className="east";this.wrapeast.appendChild(this.east);this.wrapsouth=document.createElement("div");this.wrapsouth.className="wrapsouth";this.wrapsouth.id="sou/"+O[1]+"_"+this.mainobj.id;this.wrapsouth.onmousedown=this.linkcursor.createDelegate(this);this.wrapsouth.onmouseup=this.linkfinish.createDelegate(this);this.south=document.createElement("div");this.south.className="south";this.wrapsouth.appendChild(this.south);this.wrapwest=document.createElement("div");this.wrapwest.className="wrapwest";this.wrapwest.id="wes/"+O[1]+"_"+this.mainobj.id;this.wrapwest.onmousedown=this.linkcursor.createDelegate(this);this.wrapwest.onmouseup=this.linkfinish.createDelegate(this);this.west=document.createElement("div");this.west.className="west";this.wrapwest.appendChild(this.west);pedagogyBlock.superclass.constructor.call(this,{width:E,height:M,layout:"fit",frame:true,id:P,renderTo:B,baseCls:G,items:[this.dragpanel,this.wrapnorth,this.wrapsouth,this.wrapeast,this.wrapwest]});this.events={"panelDown":true,"addDRAG":true,"blockUp":true,"rightClick":true};this.setPosition(N,J);var A=P;var I=P.split("-");if(I[0]!="retry"&&I[0]!="exit"){var F=new Wtf.Resizable(A,{pinned:true,width:E,height:M,layout:"fit",preserveRatio:true,maxWidth:225,maxHeight:100,minHeight:50,minWidth:100,handles:"all",transparent:true,dynamic:true});F.on("resize",this.ResizePanel,this)}Wtf.get(A).addListener("mouseup",this.panelmouseup,this);Wtf.get(A).addListener("mousedown",this.panelmousedown,this);Wtf.get(A).on("contextmenu",this.sectionRightClick,this);this.handleid=H};Wtf.extend(pedagogyBlock,Wtf.Panel,{panelmousedown:function(A){Wtf.getCmp(this.id).fireEvent("blockDown",A,this.id)},panelmouseup:function(A){Wtf.getCmp(this.id).fireEvent("blockUp",A,this.id)},sectionRightClick:function(B){var A=Wtf.getCmp(this.id);Wtf.getCmp(this.id).fireEvent("rightClick",B,this.id)},ResizePanel:function(B,A,F,E){this.dragpanel.setWidth(A);this.dragpanel.setHeight(F);this.dropComp.flushLink(this.id);var D=this.mainobj.split;var C=(this.mainobj.nodeArray[B.el.id]).split(D);this.mainobj.nodeArray[B.el.id]=C[0]+D+C[1]+D+F+D+A+D+C[4]+D+C[5]+D+C[6]},linkcursor:function(C){var A=C||window.event;if(Wtf.isGecko){var B=A.target.id;if((B.match("wtf"))){B=Wtf.get(B).dom.parentNode.id}this.mainobj.fromdiv=B.split("_")[0]}else{var B=A.srcElement.id;if((B.match("wtf"))){B=Wtf.get(B).dom.parentNode.id}this.mainobj.fromdiv=B.split("_")[0]}this.mainobj.X1=A.clientX-Wtf.get(this.con).getLeft();this.mainobj.Y1=A.clientY-Wtf.get(this.con).getTop();this.mainobj.disableSelection(document.body)},linkfinish:function(C){var A=C||window.event;if(Wtf.isGecko){var B=A.target.id;if((B.match("wtf"))){B=Wtf.get(B).dom.parentNode.id}this.mainobj.todiv=B.split("_")[0]}else{var B=A.srcElement.id;if(B.match("wtf")){B=Wtf.get(B).dom.parentNode.id}this.mainobj.todiv=B.split("_")[0]}this.mainobj.X2=A.clientX-Wtf.get(this.con).getLeft();this.mainobj.Y2=A.clientY-Wtf.get(this.con).getTop()}});Wtf.createCourse=function(B){Wtf.apply(this,B);this.img1=document.createElement("img");this.img1.height=140;this.img1.width=150;this.img1.id="picUpload1";this.img1.src=Wtf.getLmsImgPath+"question_icon.png";this.img1.onclick=this.showUploadWin.createDelegate();this.mode=B.mode;this.user=B.user;if(this.mode==0){var A="Create"}else{this.courseid=B.courseid;A="Save"}this.PicPanel=new Wtf.Panel({frame:true,height:150,width:150,id:"picContainer",layout:"fit",contentEl:this.img1});this.Panel=new Wtf.Panel({frame:true,layout:"column",items:[{columnWidth:1,layout:"column",items:[{columnWidth:0.6,layout:"form",labelWidth:70,items:[this.title1=new Wtf.form.TextField({id:"conTitle",fieldLabel:"Title",width:175}),this.author=new Wtf.form.TextField({fieldLabel:"Author",disabled:true,width:175,value:username}),this.desc=new Wtf.form.TextArea({fieldLabel:"Description",width:175,height:100})]},{columnWidth:0.4,layout:"form",items:[this.PicPanel,{buttons:[{id:"createbttn",text:A,disabled:true,scope:this,handler:this.createCourse},{id:"cancelbttn",text:"Cancel",scope:this,handler:function(){this.close()}}]}]}]}]});Wtf.createCourse.superclass.constructor.call(this,{title:"Content Details",iconCls:"winicon",modal:true,closable:true,height:260,resizable:false,layout:"fit",width:460,plain:true});this.on("show",this.attachListener,this)};Wtf.extend(Wtf.createCourse,Wtf.Window,{onRender:function(A){Wtf.createCourse.superclass.onRender.call(this,A);this.add(this.Panel)},ToggleCreateBttn:function(B){if(B.getKey()==13){this.createCourse()}else{var C=this.title1.getValue();var A=Wtf.getCmp("createbttn");if(C==""){A.disable()}else{A.enable()}}},createCourse:function(D,C){var E=this.title1.getValue();if(E!=""){var B=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["courseid","modified"])});B.on("load",this.saveCourse,this);var A=document.getElementById("picUpload1").value;if(A==null){A="question_icon.png"}if(this.mode==0){B.load({params:{flag:"1",title:this.title1.getValue(),author:this.author.getValue(),description:this.desc.getValue(),tags:"",resmem:"",userid:loginid,moduleid:this.moduleid,imgpath:A}})}else{B.load({params:{flag:"11",courseid:this.courseid,title:this.title1.getValue(),description:this.desc.getValue(),tags:"",resmem:"",imgpath:A}})}this.close()}},saveCourse:function(G,E,B){if(this.mode==0){var H=E[0].json.courseid;var J=E[0].json.modified;var F=E[0].json.status;var K=E[0].json.permission;this.openContent(H);if(this.user!=1){var A=Wtf.getCmp("coursegrid");var C=Wtf.data.Record.create([{name:"coursename",type:"string",dataIndex:"coursename"},{name:"author",type:"string",dataIndex:"author"},{name:"modified",type:"string",dataIndex:"modified"},{name:"courseid",type:"string",dataIndex:"courseid"},{name:"status",type:"string",dataIndex:"status"},{name:"permission",type:"string",dataIndex:"permission"}]);var I=new C({coursename:this.title1.getValue(),author:this.author.getValue(),modified:J,courseid:H,status:F,permission:K});var D=A.getStore();D.add(I)}}else{if(E[0].json.success){this.root.setText(this.title1.getValue());msgBoxShow(["Course Details","Updated Successfully."],Wtf.MessageBox.INFO)}else{msgBoxShow(["Course Details","Error in Updating."],Wtf.MessageBox.ERROR)}}},openContent:function(B){var A="e"+B;this.openTab(A,Wtf.MyContentEditor,{layout:"fit",border:false,courseid:B,id:"e"+B,tabtitle:this.title1.getValue(),title:this.title1.getValue(),mode:0,use:1,closable:true})},openTab:function(D,B,A){var C=Wtf.getCmp(D);if(!C){C=new B(A);mainPanel.add(C);mainPanel.activate(C);mainPanel.doLayout()}mainPanel.setActiveTab(C)},showUploadWin:function(){new Wtf.UploadWindow({cid:"picUpload1"}).show()},attachListener:function(){this.title1.el.dom.focus();Wtf.EventManager.addListener(document.getElementById("conTitle").id,"keyup",this.ToggleCreateBttn,this)}});Wtf.viewContentList=function(A){Wtf.apply(this,A);this.addEvents({"myimport":true});if(this.mode==0){this.text1="Edit Content";this.text2="Select to Edit a content";this.btntxt="Edit"}else{if(this.mode==1){this.text1="View Content";this.text2="Select to view a content";this.btntxt="View"}else{if(this.mode==2){this.text1="Content List";this.text2="Select a content";this.btntxt="Select"}else{if(this.mode==3){this.text1="Delete Content";this.text2="Delete a content";this.btntxt="Delete"}}}}this.dstore=new Wtf.data.Store({url:Wtf.req.lms+"CreateCourse.jsp",reader:new Wtf.data.JsonReader({root:"data"},["courseid","coursename","versionid"])});this.dstore.load({params:{flag:"26",moduleid:this.moduleid,mode:this.mode}});this.sm=new Wtf.grid.CheckboxSelectionModel();this.cm=new Wtf.grid.ColumnModel([this.sm,{header:"Content Name",width:100,sortable:true,dataIndex:"coursename"}]);this.gridPanel=new Wtf.grid.GridPanel({border:false,cm:this.cm,sm:this.sm,store:this.dstore,singleSelect:true,viewConfig:{forceFit:true,autoFill:true},loadMask:{msg:"Loading Content List..."}});Wtf.viewContentList.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:300,modal:true,height:350,title:"Content List",layout:"border",items:[{region:"north",height:75,layout:"fit",border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif",this.text1,this.text2)},{region:"center",border:false,layout:"fit",items:[this.gridPanel]}],buttons:[{text:this.btntxt,scope:this,handler:function(){if(this.sm.hasSelection()){if(this.mode==2){this.fireEvent("myimport")}else{if(this.mode==3){Wtf.Ajax.request({method:"POST",url:"jspfiles/lms/CreateCourse.jsp",params:({flag:37,moduleid:this.moduleid,courseid:this.sm.getSelected().data["courseid"]}),scope:this,success:function(E,F){Wtf.Msg.alert("Success","Content deleted successfully.",function(G){},this)},failure:function(E,F){Wtf.Msg.alert("Error","Error connecting to server",function(G){},this)}})}else{var C=this.sm.getSelected().data["coursename"];var D=this.sm.getSelected().data["courseid"];var B=this.sm.getSelected().data["versionid"];this.openContent(D,C,this.mode,B)}}this.close()}}},{text:"Cancel",scope:this,handler:function(){this.close()}}]})};Wtf.extend(Wtf.viewContentList,Wtf.Window,{onRender:function(A){Wtf.viewContentList.superclass.onRender.call(this,A)},openContent:function(F,B,E,D){if(E==0){var C="e"+F;var A="editor"}else{var C=this.combId(F,D);var A="viewer"}this.openTab(C,Wtf.MyContentEditor,{layout:"fit",border:false,courseid:F,id:C,tabtitle:B,title:B,mode:this.mode,use:1,closable:true,iconCls:A,vid:D})},openTab:function(D,B,A){var C=Wtf.getCmp(D);if(!C){C=new B(A);mainPanel.add(C);mainPanel.activate(C);mainPanel.doLayout()}mainPanel.setActiveTab(C)},combId:function(B,A){return B+"$"+A}});function deleteUPG(A,B){Wtf.Msg.show({title:"Cofirm Delete",msg:"Are you sure you want to delete this User Profile Group?",buttons:Wtf.Msg.YESNO,fn:function(C,D){if(C=="yes"){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:16,groupid:A},success:function(E,F){if(Wtf.decode(E.responseText).data=="yes"){Wtf.getCmp("rolegrpgrid").getStore().reload()}else{if(Wtf.decode(E.responseText).data=="no"){Wtf.Msg.alert("Error","Unable to delete due to dependencies")}else{Wtf.Msg.alert("Error","Error connecting to server")}}},failure:function(E,G){var F=0},scope:this})}},icon:Wtf.MessageBox.QUESTION})}function copyUPG(B,C,A){this.rolecmWin=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{dataIndex:"roleid",hidden:true},{header:"Role",dataIndex:"rolename",editor:new Wtf.form.TextField({allowBlank:false,maxLength:100})}]);this.roleReaderWin=new Wtf.data.Record.create([{name:"roleid"},{name:"rolename"}]);this.roledsWin=new Wtf.data.Store({url:"jspfiles/admin/authorization.jsp",reader:new Wtf.data.JsonReader({root:"data"},this.roleReaderWin)});this.roledsWin.baseParams={action:18,grpid:B};this.roledsWin.load();this.cpWin=new Wtf.Window({title:"Copy User Profile Group",layout:"fit",iconCls:"winicon",modal:true,height:400,width:550,scope:this,buttons:[{text:"Copy",handler:function(){if(this.copyForm.form.isValid()){var E="";for(var D=0;D<this.roledsWin.getCount();D++){E+=Wtf.encode(this.roledsWin.getAt(D).data)+","}if(!Wtf.isEmpty(E)){E=E.substr(0,(E.length-1));E="["+E+"]"}Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:17,gid:B,gname:this.roleGrpText.getValue(),gdesc:this.roleGrpDesc.getValue(),json:E},success:function(F,G){Wtf.getCmp("rolegrpgrid").getStore().reload();this.cpWin.close()},scope:this})}},scope:this},{text:"Cancel",scope:this,handler:function(){this.cpWin.close()}}],items:[{layout:"border",items:[this.copyForm=new Wtf.form.FormPanel({region:"north",bodyStyle:"padding: 10px;",border:false,labelWidth:160,height:150,buttonAlign:"right",items:[this.roleGrpText=new Wtf.form.TextField({fieldLabel:"Group Name*",anchor:"95%",maxLength:150,allowBlank:false,value:"Copy of "+C,id:this.id+"rolegrpText"}),this.roleGrpDesc=new Wtf.form.TextArea({fieldLabel:"Description",value:A,maxValue:200,anchor:"95%"})]}),this.roleGrid=new Wtf.grid.EditorGridPanel({store:this.roledsWin,cm:this.rolecmWin,region:"center",loadMask:true,border:false,clicksToEdit:1,viewConfig:{forceFit:true}})]}]});this.cpWin.show()}Wtf.MainAuthPanel=function(A){Wtf.MainAuthPanel.superclass.constructor.call(this,A)};Wtf.extend(Wtf.MainAuthPanel,Wtf.Panel,{initComponent:function(){Wtf.MainAuthPanel.superclass.initComponent.call(this);this.rolegrRecord=Wtf.data.Record.create([{name:"groupid",type:"string"},{name:"groupname",type:"string"},{name:"description",type:"string"},{name:"del"},{name:"copy"}]);Wtf.ux.comboBoxRenderer=function(A){return function(C){var B=A.store.find(A.valueField,C);if(B==-1){return""}var D=A.store.getAt(B);return D.get(A.displayField)}};this.rolegrReader=new Wtf.data.JsonReader({root:"data"},this.rolegrRecord);this.rolegrStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/authorization.jsp?action=1"}),reader:this.rolegrReader});this.rolegrStore.on("load",this.afterComboLoad,this);this.rolegrComboItem=new Wtf.form.ComboBox({triggerAction:"all",store:this.rolegrStore,mode:"local",readOnly:true,displayField:"groupname",fieldLabel:"Select a Group*",allowBlank:false,valueField:"groupid",hiddenName:"groupid",emptyText:"Select a Group"});this.comboTypeStore=new Wtf.data.SimpleStore({fields:["abbr","type"],data:[["0","No Permission"],["1","View Permission"],["2","Edit Permission"]]});this.rolegrComboItem.on("select",this.groupComboValueChange,this)},onRender:function(A){Wtf.MainAuthPanel.superclass.onRender.call(this,A);this.rolegrStore.load()},afterComboLoad:function(){if(this.rolegrStore.getCount()>0){this.rolegrComboItem.setValue(this.rolegrStore.getAt(0).data["groupid"])}Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:0,groupid:this.rolegrComboItem.getValue()},success:function(response,e){this.addContentInPanel(eval("("+response.responseText.trim()+")"))},scope:this})},ajaxRequestAfterGrChange:function(){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:0,groupid:this.rolegrComboItem.getValue()},success:function(response,e){this.GroupingReportGrid.destroy();if(this.GroupingReportGrid.el){this.GroupingReportGrid.el.remove()}this.makeReportGrid(eval("("+response.responseText.trim()+")"));this.innerpanel.add(this.GroupingReportGrid);this.innerpanel.doLayout()},scope:this})},groupComboValueChange:function(C,A,B){this.ajaxRequestAfterGrChange()},makeReportGrid:function(A){this.simstore=new Wtf.data.GroupingStore({reader:this.createFields(A.columnheader),data:A.data,groupField:"Access-Rights-Set",sortInfo:{field:"permid",direction:"asc"}});this.cm=this.createColModel(A.columnheader);this.GroupingReportGrid=new Wtf.grid.EditorGridPanel({cm:this.cm,id:this.id+"GroupingReportGrid",ds:this.simstore,autoScroll:true,collapsible:true,layout:"fit",clicksToEdit:1,viewConfig:{forceFit:true,autoFill:true},view:new Wtf.grid.GroupingView({autoFill:true,groupTextTpl:'{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'})})},addContentInPanel:function(obj){this.makeReportGrid(obj);this.permGrpcm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{dataIndex:"permgrid",hidden:true},{header:"Access Rights Set",dataIndex:"Access-Rights-Set",editor:new Wtf.form.TextField({allowBlank:false,maxLength:100})}]);this.permGrpReader=new Wtf.data.Record.create([{name:"permgrid"},{name:"Access-Rights-Set"}]);this.permGrpds=new Wtf.data.Store({url:"jspfiles/admin/authorization.jsp?action=10",reader:new Wtf.data.JsonReader({root:"data"},this.permGrpReader)});this.permGrpds.load();this.permcm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{dataIndex:"permid",hidden:true},{header:"Task",dataIndex:"Tasks",editor:new Wtf.form.TextField({allowBlank:false,maxLength:200})}]);this.permReader=new Wtf.data.Record.create([{name:"permid"},{name:"Tasks"}]);this.permds=new Wtf.data.Store({url:"jspfiles/admin/authorization.jsp",reader:new Wtf.data.JsonReader({root:"data"},this.permReader)});this.rolecm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{dataIndex:"roleid",hidden:true},{header:"Role",dataIndex:"rolename",editor:new Wtf.form.TextField({allowBlank:false,maxLength:100})}]);this.roleReader=new Wtf.data.Record.create([{name:"roleid"},{name:"rolename"}]);this.roleds=new Wtf.data.Store({url:"jspfiles/admin/authorization.jsp",reader:new Wtf.data.JsonReader({root:"data"},this.roleReader)});if(!this.innerpanel){this.innerpanel=new Wtf.Panel({id:"InnAuthPanel"+this.tabid,border:false,layout:"fit",scope:this,tbar:["User Profile Group:",this.rolegrComboItem,{iconCls:"reportRefresh",handler:function(){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:0,groupid:this.rolegrComboItem.getValue()},success:function(response,e){this.GroupingReportGrid.destroy();this.GroupingReportGrid.el.remove();this.makeReportGrid(eval("("+response.responseText.trim()+")"));this.innerpanel.add(this.GroupingReportGrid);this.innerpanel.doLayout()},scope:this})},scope:this},{text:"Save Changes ",iconCls:"pwnd saveicon caltb",tooltip:"Save permission changes",id:this.id+"UpdateEventClick",scope:this,handler:this.savePermissions,ctCls:"fontstyle"}],items:[this.GroupingReportGrid],bbar:[{text:"Manage Access Rights Sets",tooltip:{title:"Access Rights Sets",text:"Click to manage Access Rights Sets"},handler:function(){this.permGroupWin=new Wtf.Window({id:"permgrp"+this.id,title:"Access Rights Sets",layout:"fit",iconCls:"winicon",modal:true,height:400,width:550,scope:this,items:[this.poppanel=new Wtf.Panel({id:"permgrppanel"+this.id,layout:"fit",cls:"backcolor",border:false,tbar:["-","New Access Rights Set: ",this.permGrpText=new Wtf.form.TextField({fieldLabel:"New Access Rights Set",anchor:"95%",maxLength:100,id:this.id+"permgrpText"}),"-",{text:"Add",tooltip:{title:"Add",text:"Click to add Access Rights Set"},handler:function(){this.addPermGroup()},scope:this},"-"],items:[this.addPermGrp=new Wtf.Panel({id:"addPermgrp"+this.id,layout:"fit",border:false,items:[this.permGrpGrid=new Wtf.grid.EditorGridPanel({id:"permgrpgrid"+this.id,store:this.permGrpds,cm:this.permGrpcm,border:false,clicksToEdit:1,viewConfig:{forceFit:true}})]})]})]});this.permGroupWin.show();this.permGroupWin.on("close",function(){this.ajaxRequestAfterGrChange()},this);this.permGrpGrid.on("afteredit",this.permGrpAfterEdit,this)},scope:this},{text:"Manage Tasks",tooltip:{title:"Task",text:"Click to manage task list"},handler:function(){this.permds.removeAll();this.permWin=new Wtf.Window({id:"perm"+this.id,title:"Tasks",layout:"fit",iconCls:"winicon",modal:true,height:400,width:550,scope:this,items:[this.poppanel=new Wtf.Panel({id:"permpanel"+this.id,layout:"fit",cls:"backcolor",border:false,tbar:["-","Access Rights Set: ",this.permGrpCombo=new Wtf.form.ComboBox({valueField:"permgrid",displayField:"Access-Rights-Set",id:this.id+"permgrpcmb",store:this.permGrpds,editable:false,typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,emptyText:"Select Access Rights Set"}),"-","New Task: ",this.permText=new Wtf.form.TextField({maxLength:100,id:this.id+"permText"}),"-",{text:"Add",tooltip:{title:"Add",text:"Click to add task in this set"},handler:function(){this.addPermissions()},scope:this},"-"],items:[this.addPerm=new Wtf.Panel({id:"addPerm"+this.id,layout:"fit",border:false,items:[this.permGrpGrid=new Wtf.grid.EditorGridPanel({id:"permgrid"+this.id,store:this.permds,cm:this.permcm,border:false,clicksToEdit:1,viewConfig:{forceFit:true}})]})]})]});this.permWin.show();this.permWin.on("close",function(){this.ajaxRequestAfterGrChange()},this);this.permGrpGrid.on("afteredit",this.permAfterEdit,this);this.permGrpCombo.on("select",function(cmb,rec,index){this.permds.baseParams={action:11,permid:rec.data.permgrid};this.permds.load()},this)},scope:this},{text:"Manage User Profile Groups",tooltip:{title:"User Profile Group",text:"Click to manage user profile groups"},handler:function(){this.roleGrpcm=new Wtf.grid.ColumnModel([{dataIndex:"groupid",hidden:true},{header:"User Profile Group",dataIndex:"groupname",editor:new Wtf.form.TextField({allowBlank:false,maxLength:100})},{header:"Description",dataIndex:"description",editor:new Wtf.form.TextField({allowBlank:false,maxLength:100})},{header:"Copy",dataIndex:"copy",width:50,align:"center",renderer:function(a,b,c,d,e,f){return"<a href='#' title='Copy' onclick='copyUPG(\""+c.get("groupid")+'", "'+c.get("groupname")+'", "'+c.get("description")+"\")'><div class='copyIcon' style='height:16px; width:20px;margin-left: auto;margin-right: auto;'></div></a>"}},{header:"Delete",dataIndex:"del",width:50,align:"center",renderer:function(a,b,c,d,e,f){return"<a href='#' title='Delete' onclick='deleteUPG(\""+c.get("groupid")+'", "'+this.id+"\")'><div class='pwnd deliconwt' style='height:16px; width:16px;margin-left: auto;margin-right: auto;'></div></a>"}}]);this.roleGroupWin=new Wtf.Window({id:"rolegrp"+this.id,title:"User Profile Group",layout:"fit",iconCls:"winicon",modal:true,height:500,width:610,minWidth:610,minHeight:450,scope:this,items:[this.pPanel=new Wtf.Panel({layout:"fit",border:false,items:this.inP=new Wtf.Panel({layout:"border",border:false,items:[{region:"north",border:false,height:90,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","User Profile Group","Create a new group by entering a name and description and clicking the Add button. Edit existing groups by clicking a cell.")},{region:"center",layout:"border",border:false,items:[this.top=new Wtf.form.FormPanel({region:"north",bodyStyle:"padding: 10px;",border:false,labelWidth:160,height:150,buttonAlign:"right",buttons:[{text:"Add",tooltip:{title:"Add",text:"Click to add User Profile Group"},handler:function(){this.addRoleGroup()},scope:this}],items:[this.roleGrpText=new Wtf.form.TextField({fieldLabel:"New User Profile Group*",anchor:"95%",maxLength:100,id:this.id+"rolegrpText"}),this.roleGrpDesc=new Wtf.form.TextArea({fieldLabel:"Description",maxValue:200,anchor:"95%"})]}),this.roleGrpGrid=new Wtf.grid.EditorGridPanel({id:"rolegrpgrid",region:"center",height:200,store:this.rolegrStore,cm:this.roleGrpcm,border:false,clicksToEdit:1,viewConfig:{forceFit:true}})]}]})})]});this.roleGroupWin.show();this.roleGroupWin.on("close",function(){this.roleGrpGrid.destroy();this.roleGroupWin.remove(this.roleGrpGrid,true);this.roleGroupWin.destroy();this.ajaxRequestAfterGrChange()},this);this.roleGrpGrid.on("afteredit",this.roleGrpAfterEdit,this)},scope:this},{text:"Manage Roles",tooltip:{title:"Role",text:"Click to manage Roles"},handler:function(){this.roleds.removeAll();this.roleWin=new Wtf.Window({id:"role"+this.id,title:"Roles",layout:"fit",modal:true,iconCls:"winicon",height:400,width:550,scope:this,closeAction:"hide",items:[this.poppanel=new Wtf.Panel({id:"rolepanel"+this.id,layout:"fit",cls:"backcolor",border:false,tbar:["-","User Profile Group: ",this.roleGrpCombo=new Wtf.form.ComboBox({valueField:"groupid",displayField:"groupname",id:this.id+"rolegrpcmb",store:this.rolegrStore,editable:false,typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,emptyText:"Select User Profile Group"}),"-","New Role: ",this.roleText=new Wtf.form.TextField({maxLength:100,id:this.id+"roleText"}),"-",{text:"Add",tooltip:{title:"Add",text:"Click to add new Role"},handler:function(){this.addRoles()},scope:this},"-"],items:[this.addRole=new Wtf.Panel({id:"addRole"+this.id,layout:"fit",border:false,items:[this.roleGrid=new Wtf.grid.EditorGridPanel({id:"rolegrid"+this.id,store:this.roleds,cm:this.rolecm,border:false,clicksToEdit:1,viewConfig:{forceFit:true}})]})]})]});this.roleWin.show();this.roleWin.on("close",function(){this.ajaxRequestAfterGrChange()},this);this.roleGrid.on("afteredit",this.roleAfterEdit,this);this.roleGrpCombo.on("select",function(cmb,rec,index){this.roleds.baseParams={action:9,grpid:rec.data.groupid};this.roleds.load()},this)},scope:this}]});this.add(this.innerpanel);this.innerpanel.doLayout();this.doLayout()}},permGrpAfterEdit:function(A){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:14,groupid:A.record.data.permgrid,groupname:A.value},success:function(B,C){},scope:this})},permAfterEdit:function(A){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:15,permid:A.record.data.permid,permname:A.value,groupid:this.permGrpCombo.getValue()},success:function(B,C){},scope:this})},roleGrpAfterEdit:function(A){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:4,groupid:A.record.data.groupid,data:A.value,column:A.field},success:function(B,C){},scope:this})},roleAfterEdit:function(A){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:8,roleid:A.record.data.roleid,rolename:A.value,roledesc:"",groupid:this.roleGrpCombo.getValue()},success:function(B,C){},scope:this})},addPermGroup:function(){if(this.permGrpText.getValue()){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:12,groupname:this.permGrpText.getValue()},success:function(A,B){this.permGrpds.reload()},scope:this});this.permGrpText.setValue("")}else{msgBoxShow(["Add Access Rights Set","Please enter some text"])}},addPermissions:function(){if(this.permGrpCombo.getValue()){if(this.permText.getValue()){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:13,permname:this.permText.getValue(),groupid:this.permGrpCombo.getValue()},success:function(A,B){this.permds.reload()},scope:this});this.permText.setValue("")}else{msgBoxShow(["Add Tasks","Please enter some text"])}}else{msgBoxShow(["Add Tasks","Select an Access Rights Set"])}},addRoleGroup:function(){if(this.roleGrpText.getValue()){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:2,groupname:this.roleGrpText.getValue(),groupdesc:this.roleGrpDesc.getValue()},success:function(A,B){this.rolegrStore.reload()},scope:this});this.roleGrpText.setValue("");this.roleGrpDesc.setValue("")}else{msgBoxShow(["Add User Profile Groups","Please enter a profile group name"])}},addRoles:function(){if(this.roleGrpCombo.getValue()){if(this.roleText.getValue()){Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:6,rolename:this.roleText.getValue(),roledesc:"",groupid:this.roleGrpCombo.getValue()},success:function(A,B){this.roleds.reload()},scope:this});this.roleText.setValue("")}else{msgBoxShow(["Add Roles","Please enter some text"])}}else{msgBoxShow(["Add Roles","Select a User Profile Group"])}},createFields:function(D){var A=[];for(var B=0;B<D.length;B++){var C={};C["name"]=D[B][0];C["type"]="string";C["mapping"]=D[B][0];A[A.length]=C}return(new Wtf.data.ArrayReader({},A))},createColModel:function(D){var E=[];E[E.length]=new Wtf.grid.RowNumberer();for(var B=0;B<D.length;B++){var C={};C["header"]=D[B][0];if(C["header"]=="permgrid"||C["header"]=="permid"||C["header"]=="Access-Rights-Set"){C["hidden"]=true}else{C["hidden"]=false;if(C["header"]!="Tasks"){this.comboType=new Wtf.form.ComboBox({id:"cmb"+this.id+C["header"],triggerAction:"all",store:this.comboTypeStore,mode:"local",displayField:"type",fieldLabel:"Select Permission Mode*",valueField:"abbr",hiddenName:"typem",emptyText:"Select type",allowBlank:false,editable:false});C["editor"]=this.comboType;C["renderer"]=Wtf.ux.comboBoxRenderer(this.comboType);C["id"]=D[B][1]}}C["dataIndex"]=D[B][0];C["width"]=70;C["sortable"]=false;E[E.length]=C}var A=new Wtf.grid.ColumnModel(E);return A},savePermissions:function(){var H="[";var I="[";var E;var J;var L;var A=0;var G=0;for(var D=5;D<this.cm.getColumnCount();D++){var C=this.cm.getColumnId(D);E=this.simstore.getAt(0);J=this.cm.getDataIndex(D);var B=0;var F=E.data["permgrid"];while(B<this.simstore.getCount()){E=this.simstore.getAt(B);if(F!=E.data["permgrid"]){var K=this.simstore.getAt(B-1);H+='{permgrid:"'+K.data["permgrid"]+'",roleid:"'+C+'",permvalview:"'+A+'",pervaledit:"'+G+'"},';A=0;G=0;L=E.data[J];if(L==1){A+=this.TwoPowerN(E.data["permid"])}if(L==2){G+=this.TwoPowerN(E.data["permid"])}F=E.data["permgrid"]}else{L=E.data[J];if(L==1){A+=this.TwoPowerN(E.data["permid"])}if(L==2){G+=this.TwoPowerN(E.data["permid"])}}B++}var K=this.simstore.getAt(B-1);H+='{permgrid:"'+K.data["permgrid"]+'",roleid:"'+C+'",permvalview:"'+A+'",pervaledit:"'+G+'"},';A=0;G=0}if(H.length>1){H=H.substr(0,H.length-1)+"]"}else{H+="]"}Wtf.Ajax.request({url:"jspfiles/admin/authorization.jsp",method:"POST",params:{action:"addpermval",data:H},success:function(M,N){},scope:this})},TwoPowerN:function(A){return Math.pow(2,A)}});Wtf.content.log.delMgmt=function(A){Wtf.apply(this,A);this.gvTR=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:true,hideGroupedColumn:false});if(!this.admin){this.cmTR=new Wtf.grid.ColumnModel([{header:"Course Material",dataIndex:"materialname",sortable:true,groupable:true},{header:"Dispatch Date",dataIndex:"senddate",sortable:true,groupable:true,renderer:this.fmtDate},{header:"Expected Delivery Date",dataIndex:"receivaldate",sortable:true,groupable:true,renderer:this.fmtDate},{header:"Delivery Date",dataIndex:"deliverydate",sortable:true,groupable:true,renderer:this.fmtDate},{header:"Status",dataIndex:"status",sortable:true,groupable:true,renderer:function(F,D,B,G,E,C){if(F==0){return"<lable style = 'color : blue;'>Confirmation Pending</lable>"}else{if(F==1){return"<lable style = 'color : green;'>Delivered</lable>"}else{if(F==2){return"<lable style = 'color : red;'>Not Delivered</lable>"}}}}}]);this.readerTR=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},[{name:"logisticsid"},{name:"materialname"},{name:"senddate"},{name:"receivaldate"},{name:"deliverydate"},{name:"status"}])}else{this.cmTR=new Wtf.grid.ColumnModel([{header:"Course Material",dataIndex:"materialname",sortable:true,groupable:true},{header:"Student's Name",dataIndex:"username",sortable:true,groupable:true},{header:"Dispatch Date",dataIndex:"senddate",sortable:true,groupable:true,renderer:this.fmtDate},{header:"Expected Delivery Date",dataIndex:"receivaldate",sortable:true,groupable:true,renderer:this.fmtDate},{header:"Delivery Date",dataIndex:"deliverydate",sortable:true,groupable:true,renderer:this.fmtDate},{header:"Status",dataIndex:"status",sortable:true,groupable:true,renderer:function(F,D,B,G,E,C){if(F==0){return"<lable style = 'color : blue;'>Confirmation Pending</lable>"}else{if(F==1){return"<lable style = 'color : green;'>Delivered</lable>"}else{if(F==2){return"<lable style = 'color : red;'>Not Received</lable>"}}}}}]);this.readerTR=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},[{name:"logisticsid"},{name:"materialname"},{name:"username"},{name:"senddate"},{name:"receivaldate"},{name:"deliverydate"},{name:"status"}])}this.dsTR=new Wtf.data.GroupingStore({url:"jspfiles/logistics/material.jsp",reader:this.readerTR});this.trGrid=new Wtf.grid.GridPanel({region:"center",store:this.dsTR,view:this.gvTR,cm:this.cmTR,view:this.gvTR,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading..."}});Wtf.content.log.delMgmt.superclass.constructor.call(this,{layout:"fit",items:this.trGrid,tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"materialname"})],bbar:[this.pg=new Wtf.PagingSearchToolbar({id:"pgTbar"+this.id,pageSize:20,searchField:this.quickPanelSearch,store:this.dsTR,plugins:this.pP=new Wtf.common.pPageSize({})}),"-",this.confirmBtn=new Wtf.Button({text:"Confirm Delivery",iconCls:"deliveryIcon",tooltip:"Confirm Delivery",scope:this,handler:this.confirmDel}),this.nonDelBtn=new Wtf.Button({text:"Notify Non-Delivery",iconCls:"materialIcon",tooltip:"Notify Non-Delivery",scope:this,handler:this.nonDelivery})]});if(this.admin){this.confirmBtn.hide();this.nonDelBtn.hide()}else{this.confirmBtn.disable();this.nonDelBtn.disable()}this.addEvents={"refreshdeliveryhomegrid":true};this.on("refreshdeliveryhomegrid",function(){this.dsTR.reload()});this.dsTR.on("load",this.handleStoreLoad,this);this.dsTR.on("datachanged",function(){var B=this.pP.combo.value;this.quickPanelSearch.setPage(B)},this);this.trGrid.on("rowclick",this.gridRowClick,this)};Wtf.extend(Wtf.content.log.delMgmt,Wtf.Panel,{onRender:function(A){Wtf.content.log.delMgmt.superclass.onRender.call(this,A);if(roleid==1){this.dsTR.baseParams={type:"getdeluser"};this.dsTR.load({params:{type:"getdeluser",start:0,limit:20}})}else{this.dsTR.baseParams={type:"getdel"};this.dsTR.load({params:{type:"getdel",start:0,limit:20}})}},fmtDate:function(A){return Wtf.modifyDateFmt(A,"Y-m-j",Wtf.getDateFormat())},handleStoreLoad:function(A,C,B){this.quickPanelSearch.StorageChanged(A)},confirmDel:function(B){var A=this.trGrid.getSelectionModel().getSelections();if(A.length!=1){Wtf.Msg.alert("Invalid Data","Please select a single record!");return false}else{this.modifyStatus("acceptmaterial",A[0].get("logisticsid"))}},nonDelivery:function(B){var A=this.trGrid.getSelectionModel().getSelections();if(A.length!=1){Wtf.Msg.alert("Invalid Data","Please select a single record!");return false}else{this.modifyStatus("notifynondelivery",A[0].get("logisticsid"))}},modifyStatus:function(C,B){var D=null;if(C=="notifynondelivery"){D="Are you sure you want to set the status to Not Delivered"}else{D="Are you sure you want to set the status to Delivered"}Wtf.MessageBox.show({title:"Set status",msg:D,buttons:Wtf.MessageBox.OKCANCEL,animEl:"upwin",scope:this,icon:Wtf.MessageBox.INFO,fn:A});function A(E){if(E=="ok"){Wtf.Ajax.requestEx({url:"jspfiles/logistics/material.jsp",params:{type:C,logisticsids:B},method:"POST"},this,function(G,F){this.fireEvent("refreshdeliveryhomegrid")},function(F,G){Wtf.Msg.alert("Error","Error in Connection")})}}},gridRowClick:function(D,B,C){var E=this.dsTR.getAt(B);var A=E.data["status"];if(A=="1"||A=="2"){this.confirmBtn.disable();this.nonDelBtn.disable()}else{this.confirmBtn.enable();this.nonDelBtn.enable()}}});Wtf.apply(Wtf.DataView.prototype,{deselect:function(B,A){if(this.isSelected(B)){var B=this.getNode(B);this.selected.removeElement(B);if(this.last==B.viewIndex){this.last=false}Wtf.fly(B).removeClass(this.selectedClass);if(!A){this.fireEvent("selectionchange",this,this.selected.elements)}}}});Wtf.common.Select=function(A){if(A.transform&&typeof A.multiSelect=="undefined"){var B=Wtf.getDom(A.transform);A.multiSelect=(Wtf.isIE?B.getAttributeNode("multiple").specified:B.hasAttribute("multiple"))}A.hideTrigger2=A.hideTrigger2||A.hideTrigger;Wtf.common.Select.superclass.constructor.call(this,A)};Wtf.extend(Wtf.common.Select,Wtf.form.ComboBox,{multiSelect:false,minLength:0,minLengthText:"Minimum {0} items required",maxLength:Number.MAX_VALUE,maxLengthText:"Maximum {0} items allowed",clearTrigger:true,history:false,historyMaxLength:0,separator:",",displaySeparator:",",valueArray:[],rawValueArray:[],initComponent:function(){this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",cn:[{tag:"img",cls:"x-form-trigger "+this.trigger1Class},{tag:"img",cls:"x-form-trigger "+this.trigger2Class}]};Wtf.common.Select.superclass.initComponent.call(this);if(this.multiSelect){this.typeAhead=false;this.editable=false;this.triggerAction="all";this.selectOnFocus=false}if(this.history){this.forceSelection=false}if(this.value){this.setValue(this.value)}},hideTrigger1:true,getTrigger:Wtf.form.TwinTriggerField.prototype.getTrigger,initTrigger:Wtf.form.TwinTriggerField.prototype.initTrigger,trigger1Class:"x-form-clear-trigger",trigger2Class:"x-form-arrow-trigger",onTrigger2Click:function(){this.onTriggerClick()},onTrigger1Click:function(){this.clearValue()},initList:function(){if(!this.list){var A="x-combo-list";this.list=new Wtf.Layer({shadow:this.shadow,cls:[A,this.listClass].join(" "),constrain:false});var B=this.listWidth||Math.max(this.wrap.getWidth(),this.minListWidth);this.list.setWidth(B);this.list.swallowEvent("mousewheel");this.assetHeight=0;if(this.title){this.header=this.list.createChild({cls:A+"-hd",html:this.title});this.assetHeight+=this.header.getHeight()}this.innerList=this.list.createChild({cls:A+"-inner"});this.innerList.on("mouseover",this.onViewOver,this);this.innerList.on("mousemove",this.onViewMove,this);this.innerList.setWidth(B-this.list.getFrameWidth("lr"));if(this.pageSize){this.footer=this.list.createChild({cls:A+"-ft"});this.pageTb=new Wtf.PagingToolbar({store:this.store,pageSize:this.pageSize,renderTo:this.footer});this.assetHeight+=this.footer.getHeight()}if(!this.tpl){this.tpl='<tpl for="."><div class="'+A+'-item">{'+this.displayField+"}</div></tpl>"}this.view=new Wtf.DataView({applyTo:this.innerList,tpl:this.tpl,singleSelect:true,multiSelect:this.multiSelect,simpleSelect:true,overClass:A+"-cursor",selectedClass:this.selectedClass,itemSelector:this.itemSelector||"."+A+"-item"});this.view.on("click",this.onViewClick,this);this.view.on("beforeClick",this.onViewBeforeClick,this);this.bindStore(this.store,true);if(this.valueArray.length){this.selectByValue(this.valueArray)}if(this.resizable){this.resizer=new Wtf.Resizable(this.list,{pinned:true,handles:"se"});this.resizer.on("resize",function(E,C,D){this.maxHeight=D-this.handleHeight-this.list.getFrameWidth("tb")-this.assetHeight;this.listWidth=C;this.innerList.setWidth(C-this.list.getFrameWidth("lr"));this.restrictHeight()},this);this[this.pageSize?"footer":"innerList"].setStyle("margin-bottom",this.handleHeight+"px")}}},initEvents:function(){Wtf.form.ComboBox.superclass.initEvents.call(this);this.keyNav=new Wtf.KeyNav(this.el,{"up":function(A){this.inKeyMode=true;this.hoverPrev()},"down":function(A){if(!this.isExpanded()){this.onTriggerClick()}else{this.inKeyMode=true;this.hoverNext()}},"enter":function(B){if(this.isExpanded()){this.inKeyMode=true;if(this.view.lastItem){var A=this.view.indexOf(this.view.lastItem);this.onViewBeforeClick(this.view,A,this.view.getNode(A),B);this.onViewClick(this.view,A,this.view.getNode(A),B)}}else{this.onSingleBlur()}return true},"esc":function(A){this.collapse()},"tab":function(A){this.collapse();return true},"home":function(A){this.hoverFirst();return false},"end":function(A){this.hoverLast();return false},scope:this,doRelay:function(C,B,A){if(A=="down"||this.scope.isExpanded()){return Wtf.KeyNav.prototype.doRelay.apply(this,arguments)}if(A=="enter"||this.scope.isExpanded()){return Wtf.KeyNav.prototype.doRelay.apply(this,arguments)}return true},forceKeyDown:true});this.queryDelay=Math.max(this.queryDelay||10,this.mode=="local"?10:250);this.dqTask=new Wtf.util.DelayedTask(this.initQuery,this);if(this.typeAhead){this.taTask=new Wtf.util.DelayedTask(this.onTypeAhead,this)}if(this.editable!==false){this.el.on("keyup",this.onKeyUp,this)}if(!this.multiSelect){if(this.forceSelection){this.on("blur",this.doForce,this)}this.on("focus",this.onSingleFocus,this);this.on("blur",this.onSingleBlur,this)}this.on("change",this.onChange,this)},doForce:function(){if(this.el.dom.value.length>0){if(this.el.dom.value==this.emptyText){this.clearValue()}else{if(!this.multiSelect){this.el.dom.value=this.lastSelectionText===undefined?"":this.lastSelectionText;this.applyEmptyText()}}}},onLoad:function(){if(!this.hasFocus){return }if(this.store.getCount()>0){this.expand();this.restrictHeight();if(this.lastQuery==this.allQuery){if(this.editable){this.el.dom.select()}this.selectByValue(this.value,true)}else{this.selectNext();if(this.typeAhead&&this.lastKey!=Wtf.EventObject.BACKSPACE&&this.lastKey!=Wtf.EventObject.DELETE){this.taTask.delay(this.typeAheadDelay)}}}else{this.onEmptyResults()}},onSelect:function(A,B){if(this.fireEvent("beforeselect",this,A,B)!==false){this.addValue(A.data[this.valueField||this.displayField]);this.fireEvent("select",this,A,B);if(!this.multiSelect){this.collapse()}}},onSingleFocus:function(){this.oldValue=this.getRawValue()},onSingleBlur:function(){var A=this.findRecord(this.displayField,this.getRawValue());if(A){this.select(this.store.indexOf(A));return }if(String(this.oldValue)!=String(this.getRawValue())){this.setValue(this.getRawValue());this.fireEvent("change",this,this.oldValue,this.getRawValue())}this.oldValue=String(this.getRawValue())},onChange:function(){if(!this.clearTrigger){return }if(this.getValue()!=""){this.triggers[0].show()}else{this.triggers[0].hide()}},collapse:function(){this.hoverOut();Wtf.common.Select.superclass.collapse.call(this)},expand:function(){Wtf.common.Select.superclass.expand.call(this);this.hoverFirst()},onViewOver:function(B,A){if(this.inKeyMode){return }},onViewBeforeClick:function(C,A,B,D){this.preClickSelections=this.view.getSelectedIndexes()},onViewClick:function(E,B,D,F){if(typeof B!="undefined"){var A=this.preClickSelections.indexOf(B);if(A!=-1&&this.multiSelect){this.removeValue(this.store.getAt(B).data[this.valueField||this.displayField]);if(this.inKeyMode){this.view.deselect(B,true)}this.hover(B,true)}else{var C=this.store.getAt(B);if(C){if(this.inKeyMode){this.view.select(B,true)}this.onSelect(C,B);this.hover(B,true)}}}if(E!==false){this.el.focus()}},addValue:function(B){if(!this.multiSelect){this.setValue(B);return }if(B instanceof Array){B=B[0]}B=String(B);if(this.valueArray.indexOf(B)==-1){var E=B;var C=this.findRecord(this.valueField||displayField,B);if(C){E=C.data[this.displayField];if(this.view){this.select(this.store.indexOf(C))}}else{if(this.forceSelection){return }}var A=Wtf.apply([],this.valueArray);A.push(B);var D=Wtf.apply([],this.rawValueArray);D.push(E);B=A.join(this.separator||",");E=D.join(this.displaySeparator||this.separator||",");this.commonChangeValue(B,E,A,D)}},removeValue:function(B){if(B instanceof Array){B=B[0]}B=String(B);if(this.valueArray.indexOf(B)!=-1){var E=B;var C=this.findRecord(this.valueField||displayField,B);if(C){E=C.data[this.displayField];if(this.view){this.deselect(this.store.indexOf(C))}}else{if(this.forceSelection){return }}var A=Wtf.apply([],this.valueArray);A.remove(B);var D=Wtf.apply([],this.rawValueArray);D.remove(E);B=A.join(this.separator||",");E=D.join(this.displaySeparator||this.separator||",");this.commonChangeValue(B,E,A,D)}},setValue:function(C){var B=[],H=[];if(!(C instanceof Array)){if(this.separator&&this.separator!==true){C=C.split(String(this.separator))}else{C=[C]}}else{if(!this.multiSelect){C=C.slice(0,1)}}for(var D=0,A=C.length;D<A;D++){var F=C[D];var G=F;if(this.valueField){var E=this.findRecord(this.valueField||this.displayField,F);if(E){G=E.data[this.displayField]}else{if(this.forceSelection){continue}}}B.push(F);H.push(G)}C=B.join(this.separator||",");G=H.join(this.displaySeparator||this.separator||",");this.commonChangeValue(C,G,B,H);if(this.history&&!this.multiSelect&&this.mode=="local"){this.addHistory(this.valueField?this.getValue():this.getRawValue())}if(this.view){this.view.clearSelections();this.selectByValue(this.valueArray)}},commonChangeValue:function(B,D,A,C){this.lastSelectionText=D;this.valueArray=A;this.rawValueArray=C;if(this.hiddenField){this.hiddenField.value=B}Wtf.form.ComboBox.superclass.setValue.call(this,D);this.value=B;if(this.oldValueArray!=this.valueArray){this.fireEvent("change",this,this.oldValueArray,this.valueArray)}this.oldValueArray=Wtf.apply([],this.valueArray)},validateValue:function(A){if(!Wtf.common.Select.superclass.validateValue.call(this,A)){return false}if(this.valueArray.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));return false}if(this.valueArray.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));return false}return true},clearValue:function(){this.commonChangeValue("","",[],[]);if(this.view){this.view.clearSelections()}Wtf.common.Select.superclass.clearValue.call(this)},reset:function(){if(this.view){this.view.clearSelections()}Wtf.common.Select.superclass.reset.call(this)},getValue:function(A){if(A){return typeof this.valueArray!="undefined"?this.valueArray:[]}return Wtf.common.Select.superclass.getValue.call(this)},getRawValue:function(A){if(A){return typeof this.rawValueArray!="undefined"?this.rawValueArray:[]}return Wtf.common.Select.superclass.getRawValue.call(this)},select:function(A,C){this.selectedIndex=A;if(!this.view){return }this.view.select(A,this.multiSelect);if(C!==false){var B=this.view.getNode(A);if(B){this.innerList.scrollChildIntoView(B,false)}}},deselect:function(A,C){this.selectedIndex=A;this.view.deselect(A,this.multiSelect);if(C!==false){var B=this.view.getNode(A);if(B){this.innerList.scrollChildIntoView(B,false)}}},selectByValue:function(C,G){this.hoverOut();if(C!==undefined&&C!==null){if(!(C instanceof Array)){C=[C]}var B=[];for(var D=0,A=C.length;D<A;D++){var F=C[D];var E=this.findRecord(this.valueField||this.displayField,F);if(E){this.select(this.store.indexOf(E),G);B.push(F)}}return B.join(",")}return false},selectFirst:function(){var A=this.store.getCount();if(A>0){this.select(0)}},selectLast:function(){var A=this.store.getCount();if(A>0){this.select(A)}},hover:function(A,D){if(!this.view){return }this.hoverOut();var C=this.view.getNode(A);this.view.lastItem=C;Wtf.fly(C).addClass(this.view.overClass);if(D!==false){var B=this.view.getNode(A);if(B){this.innerList.scrollChildIntoView(B,false)}}},hoverOut:function(){if(!this.view){return }if(this.view.lastItem){Wtf.fly(this.view.lastItem).removeClass(this.view.overClass);delete this.view.lastItem}},hoverNext:function(){if(!this.view){return }var B=this.store.getCount();if(B>0){if(!this.view.lastItem){this.hover(0)}else{var A=this.view.indexOf(this.view.lastItem);if(A<B-1){this.hover(A+1)}}}},hoverPrev:function(){if(!this.view){return }var B=this.store.getCount();if(B>0){if(!this.view.lastItem){this.hover(0)}else{var A=this.view.indexOf(this.view.lastItem);if(A!=0){this.hover(A-1)}}}},hoverFirst:function(){var A=this.store.getCount();if(A>0){this.hover(0)}},hoverLast:function(){var A=this.store.getCount();if(A>0){this.hover(A)}},addHistory:function(B){if(!B.length){return }var A=this.findRecord(this.valueField||this.displayField,B);if(A){this.store.remove(A)}else{var C={};if(this.valueField){C[this.valueField]=B}C[this.displayField]=B;A=new this.store.reader.recordType(C)}this.store.clearFilter();this.store.insert(0,A);this.pruneHistory()},pruneHistory:function(){if(this.historyMaxLength==0){return }if(this.store.getCount()>this.historyMaxLength){var C=this.store.getRange(this.historyMaxLength,this.store.getCount());for(var B=0,A=C.length;B<A;B++){this.store.remove(C[B])}}}});Wtf.reg("select",Wtf.common.Select);Wtf.lms.makeReq=function(A){Wtf.apply(this,A);this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.creatorRecord=Wtf.data.Record.create([{name:"user",type:"string"},{name:"id",type:"string"}]);this.creatorReader=new Wtf.data.JsonReader({root:"data"},this.creatorRecord);this.creatorStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/lms/contentrequest.jsp"}),reader:this.creatorReader});this.reader=new Wtf.data.JsonReader({root:"data",fields:[{name:"requestid",type:"string"},{name:"cname",type:"string"},{name:"reqdate",type:"string"},{name:"modify",type:"string"},{name:"status",type:"string"},{name:"inst",type:"string"},{name:"resp",type:"string"},{name:"user",type:"string"},{name:"resp1",type:"string"},{name:"respid",type:"string"},{name:"actStatus",type:"string"},{name:"ltype",type:"string"},{name:"toid",type:"string"}]});this.ds=new Wtf.data.GroupingStore({url:"jspfiles/lms/contentrequest.jsp",baseParams:{flag:3},reader:this.reader});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,hideGroupedColumn:false});this.expander=new Wtf.grid.RowExpander({tpl:new Wtf.Template("<br>","<p><b>Instruction:</b> {inst}</p>","<br>","<p><b>Response:</b> {resp}</p>","<br>","<p><b>Learning Object:</b> {resp1}</p>")});this.cm=new Wtf.grid.ColumnModel([this.expander,this.sm,{header:"Content Name",dataIndex:"cname",align:"left",width:0.5,sortable:true,groupable:true},{header:"Request sent to",dataIndex:"user",align:"center",width:0.1,sortable:true,groupable:true},{header:"Request Date",dataIndex:"reqdate",align:"center",width:0.15,sortable:true,groupable:true,renderer:function(B){return Wtf.modifyDateFmt(B,"Y-m-d g:i A",Wtf.getDateFormat())}},{header:"Modified Date",dataIndex:"modify",align:"center",width:0.15,sortable:true,groupable:true,renderer:function(B){return Wtf.modifyDateFmt(B,"Y-m-d g:i A",Wtf.getDateFormat())}},{header:"Status",dataIndex:"status",align:"center",width:0.1,sortable:true,groupable:true}]);this.cm.defaultSortable=true;Wtf.lms.makeReq.superclass.constructor.call(this,{layout:"fit",items:[{layout:"border",border:false,autoWidth:true,items:[this.grid=new Wtf.grid.GridPanel({border:false,region:"center",store:this.ds,cm:this.cm,plugins:this.expander,sm:this.sm,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading Request Status..."}})]}],bbar:[new Wtf.PagingToolbar({pageSize:15,id:"paggintoolbar"+this.id,store:this.ds,scope:this,plugins:new Wtf.common.pPageSize({id:"pPageSize_"+this.id}),items:["-",this.crtRequest=new Wtf.Toolbar.Button({text:"Create Request",scope:this,tooltip:{text:"Click to create request"},handler:this.createRequest}),this.resend=new Wtf.Toolbar.Button({text:"Request Amendment",scope:this,disabled:true,tooltip:{text:"Click to resend for ammendment"},handler:this.resendReq}),this.editObject=new Wtf.Toolbar.Button({text:"Publish Learning Objects",scope:this,disabled:true,tooltip:{text:"Click to edit objects"},handler:this.editObjectlist})]})]})};Wtf.extend(Wtf.lms.makeReq,Wtf.Panel,{editMeta:null,flag:false,onRender:function(A){Wtf.lms.makeReq.superclass.onRender.call(this,A);this.ds.load({params:{start:0,limit:15}});this.grid.on("sortchange",function(B,C){this.grid.getStore().groupBy(C.field)},this);this.sm.addListener("selectionchange",this.rowSelectionHandler,this);this.conType=new Wtf.data.SimpleStore({data:[["Quiz","1"],["Section","2"],["File","3"],["Url/Link","4"],["Random Quiz","3"]],fields:["type","id"],reader:new Wtf.data.ArrayReader({},[{name:"type"},{name:"id"}]),autoLoad:true})},createRequest:function(B){var A=true;if(this.crtRequest==B){A=false}this.reqReader=new Wtf.data.JsonReader({root:"data",fields:[{name:"objectid",type:"string"},{name:"objectname",type:"string"}]});this.reqsm=new Wtf.grid.CheckboxSelectionModel();this.reqcm=new Wtf.grid.ColumnModel([this.reqsm,{header:"Object Name",dataIndex:"objectname",align:"left",width:1,sortable:true,groupable:true}]);this.reqds=new Wtf.data.Store({url:"jspfiles/lms/catalog.jsp",baseParams:{flag:10},reader:this.reqReader});this.MSComboconfigWin={store:this.conType,displayField:"type",valueField:"type",triggerAction:"all",mode:"local"};this.typeWin=new Wtf.Window({title:A?"Amendment Request":"Content Request",closable:true,modal:true,iconCls:"win",width:500,height:A?310:455,scope:this,resizable:false,buttons:[{text:"Save",scope:this,handler:A?this.amendReq:this.sendRequest},{text:"Cancel",scope:this,handler:function(){this.typeWin.close()}}],items:[{region:"north",height:70,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("",A?"Request for Amendment":"Create Request for Content",A?"Send a request to a content designer to amend specified content.":"Send a request to a content designer to create specified content.")},{region:"center",bodyStyle:"background:#f1f1f1;",height:350,border:false,items:[this.reqform=new Wtf.form.FormPanel({waitMsgTarget:true,method:"POST",border:false,layout:"form",url:"jspfiles/lms/contentrequest.jsp",bodyStyle:"margin-top:20px;margin-left:35px;font-size:10px;",items:[this.nameField=new Wtf.form.TextField({fieldLabel:"Content Name*",name:"cname",value:A?B.cN:null,width:310,labelWidth:120,allowBlank:false}),{layout:"column",border:false,items:[{columnWidth:0.45,border:false,layout:"form",items:[this.ctype=new Wtf.common.Select(Wtf.applyIf({name:"type",multiSelect:true,fieldLabel:"Type*",width:90,forceSelection:true,allowBlank:false},this.MSComboconfigWin))]},{columnWidth:0.55,border:false,layout:"form",items:[this.creator=new Wtf.form.ComboBox({fieldLabel:"Assigned To*",name:"cname",mode:"local",width:110,triggerAction:"all",typeAhead:true,editable:false,blankText:"Select a content creator",store:this.creatorStore,displayField:"user",valueField:"id",allowBlank:false,msgTarget:"side"})]}]},{border:false,layout:"form",items:[this.desc=new Wtf.form.TextArea({fieldLabel:"Instructions",name:"inst",width:315,labelWidth:120,value:A?B.i:null,anchor:"95%",height:80}),{height:150,layout:"fit",bodyStyle:"padding: 0 30px 10px 0px;",border:false,items:A?null:[this.reqgrid=new Wtf.grid.GridPanel({store:this.reqds,autoScroll:true,cm:this.reqcm,sm:this.reqsm,width:315,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading Request Status..."}})]}]},new Wtf.form.Hidden({name:"cid",value:A?B.cid:""})]})]}]});this.typeWin.show();this.creatorStore.load({params:{flag:"1"}});if(A){this.ctype.setValue(B.ltype);this.nameField.disable();this.ctype.disable()}this.creatorStore.on("load",function(){this.creator.setValue(B.luser)},this);this.reqds.load()},amendReq:function(){this.reqform.form.submit({scope:this,params:{flag:"2",mid:this.moduleid,id:this.creator.getValue()},success:function(A,B){this.typeWin.close();this.ds.load()},failure:function(A,B){}})},sendRequest:function(){var C=this.reqsm.getSelections();var A="";for(var B=0;B<C.length;B++){A+="'"+C[B].data.objectid+"',"}if(A.length>1){A=A.substring(0,A.length-1)}this.reqform.form.submit({scope:this,params:{flag:"2",mid:this.moduleid,id:this.creator.getValue(),objs:A},success:function(D,E){this.typeWin.close();this.ds.load()},failure:function(D,E){}})},rowSelectionHandler:function(){var A=this.sm.getSelections();if(A.length>0){if(A[0].data.actStatus==2||A[0].data.actStatus==""||A[0].data.actStatus=="0"){this.editObject.disable()}else{this.editObject.enable();this.objid=A[0].data.respid}if(A[0].data.status=="Published"){this.resend.disable()}else{this.resend.enable()}}else{this.editObject.disable();this.resend.disable()}},editObjectlist:function(){this.respReader=new Wtf.data.JsonReader({root:"data",fields:[{name:"objectid",type:"string"},{name:"objectname",type:"string"},{name:"flag",type:"int"}]});this.respds=new Wtf.data.Store({url:"jspfiles/lms/contentrequest.jsp",baseParams:{flag:8,ids:this.objid},reader:this.respReader});this.respsm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.respsm.addListener("selectionchange",this.rowSelectionHandler1,this);this.respcm=new Wtf.grid.ColumnModel([this.respsm,{header:"objectid",hidden:true,dataIndex:"objectid"},{header:"objectid",hidden:true,dataIndex:"flag"},{header:"Object Name",dataIndex:"objectname",align:"left",width:1,sortable:true,groupable:true}]);this.actionWin=new Wtf.Window({title:"Response for requested content",closable:true,iconCls:"winicon",width:500,height:450,modal:true,scope:this,resizable:false,buttons:[{text:"View",id:"viewBtn",disabled:true,scope:this,handler:this.openObject},{text:"Cancel",scope:this,handler:function(){this.actionWin.close()}}],items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","Response for requested Content","The learning objects shown below have been created in response to your request.")},{region:"center",height:305,border:false,layout:"fit",bodyStyle:"background:#f1f1f1;padding:10px;",items:[this.respgrid=new Wtf.grid.GridPanel({region:"center",border:false,store:this.respds,autoScroll:true,cm:this.respcm,sm:this.respsm,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading Request Status..."}})]}]});this.actionWin.show();this.respds.load()},resendReq:function(){var A=this.sm.getSelections();this.reObj={cN:A[0].data.cname,a:A[0].data.user,i:A[0].data.inst,cid:A[0].data.requestid,ltype:A[0].data.ltype,luser:A[0].data.toid};this.createRequest(this.reObj)},rowSelectionHandler1:function(){var A=this.respsm.getSelections();if(A.length==1){Wtf.getCmp("viewBtn").enable()}else{Wtf.getCmp("viewBtn").disable()}},openObject:function(){var A=this.respsm.getSelections();var B=A[0].data.flag;this.objId=A[0].data.objectid;this.objName=A[0].data.objectname;this.actionWin.close();this.secid=this.objId;if(B==2){this.addQuiz(this.objId,this.objName)}else{if(B==3){this.addSection(this.objId,this.objName);this.secRead=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"CreateCourse.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["content"])});this.secRead.on("load",this.ReadFile,this);this.secRead.load({params:{flag:"5",nodeid:this.objId,courseid:"",mode:0}})}else{if(B==6){this.displayFile(this.objName,"tab"+this.objId,this.objName,"",this)}else{if(B==7){this.linkDs=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"catalog.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["filename","link","author"])});this.linkDs.load({params:{flag:5,nodeid:this.objId}});this.linkDs.on("load",this.openWindow,this)}else{if(B==8){this.addRquiz(this.objId,this.objName)}}}}}},addQuiz:function(B,A){var C=B;this.ownerCt.add(this.quiz=new Wtf.quizPanel({border:false,compId:this.ownerCt.ownerCt,flag:B,id:"tab"+C,nodeidObj:C,innertab:1,ctCls:"quizclass",title:"[Learning Object]: "+A,closable:true,layout:"fit",owner:true}));this.ownerCt.activate(this.quiz);this.ownerCt.ownerCt.doLayout()},addRquiz:function(B,A){var C;Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"GET",params:({objid:B,flag:8}),scope:this,success:function(D,E){C=true;this.opneRquiz(C,B,A)},failure:function(){C=false;Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})},opneRquiz:function(C,B,A){this.ownerCt.add(this.rquiz=new Wtf.randomQuiz({title:"[Learning Object]: "+A,id:"tab"+B,nodeidObj:B,closable:true,ctCls:"rquizclass",layout:"fit",nodeid:B,owner:C}));this.ownerCt.activate(this.rquiz);this.ownerCt.ownerCt.doLayout();this.rquiz.on("unlockObject",function(){this.ds.reload()},this)},addSection:function(B,A){this.ownerCt.add(this.section=new Wtf.MyEditor({border:false,id:"tab"+B,ctCls:"section",title:"[Learning Object]: "+A,closable:true,closeflag:0,nodeidObj:B,mycontenteditor:this.ownerCt.ownerCt,layout:"fit",mode:this.mode}));this.ownerCt.activate(this.section);this.ownerCt.doLayout()},ReadFile:function(C,D,B){content=(D[0].data.content);var A="tab"+this.secid;Wtf.getCmp(A).editor.setValue(content)},displayFile:function(C,A,G,D,E){var B=document.createElement("div");B.id="file1div"+A;B.style.height="100%";B.style.overflow="hidden";var F=document.createElement("iframe");F.id="iframe1"+A;F.name="iframe1"+A;F.cls="ascls";F.width="100%";F.height="100%";F.autoScroll=false;F.src="fileDownload.jsp?courseid=&nodeid="+A.substr(3,A.length)+"&dtype=inline&type=lms";B.appendChild(F);this.ownerCt.add(new Wtf.Panel({closable:true,id:"panel1"+A,objId:this.sm.getSelected().get("nodeid"),title:"[Learning Object]: "+G,ctCls:"fileclass",frame:false,layout:"fit",items:[{border:false,frame:false,contentEl:B,autoScroll:true,layout:"fit",bodyStyle:"background-color: #FFFFFF;"}],bbar:[{text:"Version History",scope:this,handler:this.activateVersion},{text:"Publish",scope:this,hidden:Wtf.isContentDesigner()?true:false,handler:function(){var I=(B.id).substring(11);this.publish=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"metagrid.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["success"])});var H=this.ownerCt.getActiveTab().id;this.publish.on("load",this.pubresp,this);this.publish.load({params:{flag:"7",loid:I}})}}]}));this.ownerCt.setActiveTab("panel1"+A);this.ownerCt.ownerCt.doLayout()},pubresp:function(B,C,A){if(C[0].json.Success=="true"){Wtf.MessageBox.alert("Status","Content published Successfully")}else{Wtf.MessageBox.alert("Status","Problem in publishing content")}},activateVersion:function(){var A=this.ownerCt.getActiveTab().objId;this.histStore=new Wtf.data.Store({url:"jspfiles/lms/metagrid.jsp",reader:new Wtf.data.JsonReader({root:"data"},["vno","modified","username","activeversion"])});this.histStore.on("load",this.histResp,this);this.histStore.load({params:{flag:"3",loid:A}});this.smodel=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.cmod=new Wtf.grid.ColumnModel([this.smodel,{header:"Version No",width:0.2,dataIndex:"vno"},{header:"Modified Date",width:0.3,dataIndex:"modified",renderer:function(B){return Wtf.modifyDateFmt(B,"Y-m-d g:i A",Wtf.getDateFormat())}},{header:"Changed By",width:0.5,dataIndex:"username"}]);this.gridPanel=new Wtf.grid.GridPanel({border:false,cm:this.cmod,sm:this.smodel,store:this.histStore,viewConfig:{forceFit:true,autoFill:true},loadMask:{msg:"Loading Content List..."}});this.showHistory=new Wtf.Window({title:"History",closable:true,modal:true,iconCls:"win",width:450,height:350,resizable:false,buttonAlign:"right",buttons:[{text:"Activate",scope:this,handler:function(){var B=this.ownerCt.getActiveTab().objId;var C=this.smodel.getSelections()[0].data.vno;this.showHistory.close();this.actStore=new Wtf.data.Store({url:"jspfiles/lms/metagrid.jsp",reader:new Wtf.data.JsonReader({root:"data"},["success"])});this.actStore.on("load",this.actResp,this);this.actStore.load({params:{flag:"4",loid:B,vno:C}})}},{text:"Cancel",scope:this,handler:function(){this.showHistory.close()}}],layout:"border",items:[{region:"center",border:false,layout:"fit",items:[new Wtf.Panel({layout:"border",items:[{region:"center",frame:true,layout:"fit",items:[this.gridPanel]}]})]}]});this.showHistory.show()},actResp:function(B,C,A){if(C[0].json.Success=="true"){Wtf.MessageBox.alert("Status","Content Activate Successfully")}else{Wtf.MessageBox.alert("Status","Problem in Activate content")}},histResp:function(C,E,B){var D;for(var A=0;A<E.length;A++){if(E[A].data.activeversion==1){D=E[A].data.vno;this.smodel.selectRow(A);break}}},openWindow:function(E,F,B){var D=F[0].data.filename;var A=F[0].data.link;var C=F[0].data.author;this.linkTab(D,A,loginid)},linkTab:function(C,A,B){if(loginid==B){this.linkWin=new Wtf.Window({title:"Task",closable:true,modal:true,iconCls:"win",width:370,height:250,scope:this,layout:"fit",bodyStyle:"padding:5px 5px 0",resizable:false,buttons:[{text:"OK",id:"leditBtn",scope:this,handler:function(){if(this.checkUp1.getValue()){var D=this.editlink.getValue();this.linkWin.close();Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"GET",params:({objid:this.objId,link:D,flag:4}),scope:this,success:function(E,F){this.ds.reload();msgBoxShow(["Success","Url Saved Successfully"],Wtf.MessageBox.INFO)},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}else{if(this.checkUp2.getValue()){this.linkWin.close();window.open(A)}else{if(this.checkUp3.getValue()){this.linkWin.close();this.publish=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"catalog.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["success"])});this.publish.on("load",this.publink,this);this.publish.load({params:{nodeid:this.objId,flag:6}})}else{if(this.checkUp4.getValue()){this.linkWin.close();this.activateVersion(this.objId)}}}}}},{text:"Close",scope:this,handler:function(){this.linkWin.close()}}],items:[new Wtf.form.FormPanel({border:false,bodyStyle:"margin: 20px",items:[this.editlink=new Wtf.form.TextField({fieldLabel:"Link/URL*",id:"url",name:"name",width:200,labelWidth:30,disabled:true,scope:this,allowBlank:false}),this.checkUp1=new Wtf.form.Radio({boxLabel:"Edit",id:"editRadio",fieldLabel:"Action*",name:"first",scope:this,allowBlank:false}),this.checkUp2=new Wtf.form.Radio({boxLabel:"View",name:"first",cls:"radiopad",scope:this,hideLabel:true,allowBlank:false}),this.checkUp3=new Wtf.form.Radio({boxLabel:"Publish",name:"first",cls:"radiopad",scope:this,hideLabel:true,allowBlank:false}),this.checkUp4=new Wtf.form.Radio({boxLabel:"Activate Version",name:"first",cls:"radiopad",scope:this,hideLabel:true,allowBlank:false})]})]});this.linkWin.show();this.checkUp1.addListener("check",this.radioChange1,this);this.checkUp2.addListener("check",this.radioChange1,this);this.checkUp3.addListener("check",this.radioChange1,this);this.checkUp4.addListener("check",this.radioChange1,this);Wtf.getCmp("url").setValue(A)}else{window.open(A)}},radioChange1:function(B,A){if(this.checkUp1.getValue()){this.editlink.enable();this.checkUp2.checked=false;this.checkUp3.checked=false;this.checkUp4.checked=false}else{this.editlink.disable();this.checkUp1.checked=false}},publink:function(B,C,A){if(C[0].json.Success=="true"){this.ds.reload();msgBoxShow(["Success","Object published successfully"],Wtf.MessageBox.INFO)}else{if(C[0].json.Success=="false"){msgBoxShow(["Warning","There is no change to publish this object."])}else{Wtf.MessageBox.alert("Status","Problem in publishing Object")}}}});Wtf.lms.appReq=function(A){Wtf.apply(this,A);this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.creatorRecord=Wtf.data.Record.create([{name:"user",type:"string"},{name:"id",type:"string"}]);this.creatorReader=new Wtf.data.JsonReader({root:"data"},this.creatorRecord);this.creatorStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/lms/contentrequest.jsp"}),reader:this.creatorReader});this.reader=new Wtf.data.JsonReader({root:"data",fields:[{name:"cname",type:"string"},{name:"reqdate",type:"string"},{name:"modify",type:"string"},{name:"status",type:"string"},{name:"id",type:"string"},{name:"inst",type:"string"},{name:"user",type:"string"},{name:"module",type:"string"},{name:"resp",type:"string"},{name:"actstatus",type:"int"},{name:"resp1",type:"string"}]});this.ds=new Wtf.data.GroupingStore({url:"jspfiles/lms/contentrequest.jsp",baseParams:{flag:4},reader:this.reader});this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,hideGroupedColumn:false});this.expander=new Wtf.grid.RowExpander({tpl:new Wtf.Template("<br>","<p><b>Instruction:</b> {inst}</p>","<br>","<p><b>Response:</b> {resp}</p>","<br>","<p><b>Learning Object:</b> {resp1}</p>")});this.cm=new Wtf.grid.ColumnModel([this.expander,this.sm,{header:"Content Name",dataIndex:"cname",align:"left",width:0.4,sortable:true,groupable:true},{header:"Module Name",dataIndex:"module",align:"left",width:0.1,sortable:true,groupable:true},{header:"Requested by",dataIndex:"user",align:"center",width:0.1,sortable:true,groupable:true},{header:"Request Date",dataIndex:"reqdate",align:"center",width:0.15,sortable:true,groupable:true,renderer:function(B){return Wtf.modifyDateFmt(B,"Y-m-d g:i A",Wtf.getDateFormat())}},{header:"Modified Date",dataIndex:"modify",align:"center",width:0.15,sortable:true,groupable:true,renderer:function(B){return Wtf.modifyDateFmt(B,"Y-m-d g:i A",Wtf.getDateFormat())}},{header:"Status",dataIndex:"status",align:"center",width:0.1,sortable:true,groupable:true}]);this.cm.defaultSortable=true;Wtf.lms.appReq.superclass.constructor.call(this,{layout:"fit",items:[{layout:"border",border:false,autoWidth:true,items:[this.grid=new Wtf.grid.GridPanel({border:false,region:"center",store:this.ds,cm:this.cm,plugins:this.expander,sm:this.sm,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading Request Status..."}})]}],bbar:[new Wtf.PagingToolbar({pageSize:15,id:"paggintoolbar"+this.id,store:this.ds,scope:this,plugins:new Wtf.common.pPageSize({id:"pPageSize_"+this.id}),items:["-",this.crtRequest=new Wtf.Toolbar.Button({text:"Acknowledge Request",scope:this,disabled:true,tooltip:{text:"Click to acknowledge request"},handler:this.approveRequest}),this.actRequst=new Wtf.Toolbar.Button({text:"Action Completed",scope:this,disabled:true,tooltip:{text:"Click to Complete due action"},handler:this.actionComplete})]})]})};Wtf.extend(Wtf.lms.appReq,Wtf.Panel,{editMeta:null,flag:false,onRender:function(A){Wtf.lms.appReq.superclass.onRender.call(this,A);this.addEvents({"ackReq":true});this.ds.load({params:{start:0,limit:15}});this.grid.on("sortchange",function(B,C){this.grid.getStore().groupBy(C.field)},this);this.sm.addListener("selectionchange",this.rowSelectionHandler,this);this.conType=new Wtf.data.SimpleStore({data:[["Quiz","1"],["Section","2"],["File","3"]],fields:["type","id"],reader:new Wtf.data.ArrayReader({},[{name:"type"},{name:"id"}]),autoLoad:true});this.creatorStore.load({params:{flag:"1"}})},approveRequest:function(){var B=this.sm.getSelections();var C="";for(var A=0;A<B.length;A++){C+=B[A].data.id+","}this.setStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/lms/contentrequest.jsp"}),reader:this.creatorReader});this.creatorStore.load({params:{flag:5,id:C}});this.ds.load();this.fireEvent("ackReq")},rowSelectionHandler:function(){var A=this.sm.getSelections();if(A.length==1){if(A[0].data.actstatus==2){this.crtRequest.disable();this.actRequst.disable()}else{if(A[0].data.actstatus==1){this.crtRequest.disable();this.actRequst.enable()}else{this.crtRequest.enable()}}}else{this.crtRequest.disable();this.actRequst.disable()}},actionComplete:function(){this.respReader=new Wtf.data.JsonReader({root:"data",fields:[{name:"objectid",type:"string"},{name:"objectname",type:"string"}]});this.respds=new Wtf.data.Store({url:"jspfiles/lms/contentrequest.jsp",baseParams:{flag:7},reader:this.respReader});this.respsm=new Wtf.grid.CheckboxSelectionModel();this.respcm=new Wtf.grid.ColumnModel([this.respsm,{header:"Object Name",dataIndex:"objectname",align:"left",width:1,sortable:true,groupable:true}]);this.actionWin=new Wtf.Window({title:"Response for requested content",closable:true,iconCls:"win",width:500,modal:true,height:450,scope:this,resizable:false,buttons:[{text:"Save",scope:this,handler:this.sendResp},{text:"Cancel",scope:this,handler:function(){this.actionWin.close()}}],items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","Response for requested Content","Choose the learning objects you have created in response to the request along with any comments or information on the objects.")},{region:"center",height:120,border:false,bodyStyle:"background:#f1f1f1;",items:[this.reqform=new Wtf.form.FormPanel({waitMsgTarget:true,method:"POST",border:false,labelAlign:"top",bodyStyle:"margin: 10px 10px 0 10px;font-size:10px;",items:[this.respArea=new Wtf.form.TextArea({xtype:"textarea",fieldLabel:"Response",name:"instruction",anchor:"99%",height:75,width:300})]})]},{region:"south",height:190,layout:"fit",bodyStyle:"padding: 0 10px 10px 10px;background:#f1f1f1;",border:false,items:[this.respgrid=new Wtf.grid.GridPanel({region:"center",store:this.respds,autoScroll:true,cm:this.respcm,sm:this.respsm,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading Request Status..."}})]}]});this.actionWin.show();this.respds.load()},sendResp:function(){var D=this.sm.getSelections();var F=D[0].data.id;var C=this.respsm.getSelections();var A="";var E="";for(var B=0;B<C.length;B++){A+="'"+C[B].data.objectid+"',";E+=(B+1)+": "+C[B].data.objectname+","}if(A.length>1){A=A.substring(0,A.length-1);E=E.substring(0,E.length-1);Wtf.Ajax.request({url:"jspfiles/lms/contentrequest.jsp",method:"POST",params:({flag:"6",id:F,objid:A,resp:this.respArea.getValue()})});this.actionWin.close();this.ds.load()}else{Wtf.Msg.alert("Error","Please select a learning object")}}});Wtf.lms.treeDragDrop=Wtf.extend(Wtf.Window,{leftTreeParam:"",rightTreeParam:"",leftRootName:"",nodeArray:new Array(),leftTree:null,rightTree:null,handleLoad:function(C,B,A){B.expand(true)},createLeftTree:function(){var B=Wtf.tree;this.leftTree=new B.TreePanel({region:"west",split:true,width:"50%",animate:true,autoScroll:true,loader:this.leftTreeLoader=new B.TreeLoader({dataUrl:"jspfiles/lms/catalog.jsp",baseParams:this.leftTreeParam,listeners:{scope:this,load:this.handleLoad}}),enableDrag:true,containerScroll:true,listeners:{scope:this,beforemovenode:function(D,H,F,G,E){var C=true;if(G.isRoot&&F.text!=this.leftRootName){C=false}return C}}});new B.TreeSorter(this.leftTree,{folderSort:true});var A=new B.AsyncTreeNode({text:this.leftRootName,draggable:false,id:this.sessionid,expandable:true});this.leftTree.setRootNode(A);A.expand();return this.leftTree},createRightTree:function(){var B=Wtf.tree;this.rightTree=new B.TreePanel({region:"center",split:true,width:"50%",animate:true,autoScroll:true,loader:this.rightTreeLoader=new Wtf.tree.TreeLoader({dataUrl:"jspfiles/lms/catalog.jsp",baseParams:this.rightTreeParam,listeners:{scope:this,load:this.handleLoad}}),containerScroll:true,enableDrop:true,dropConfig:{appendOnly:true},listeners:{scope:this,beforenodedrop:function(E){var F=E.target;var D=E.dropNode;var C=true;if(D.attributes.content){if(F.attributes.id!="current"){C=false}}return C},nodedrop:function(C){var D=C.dropNode;var F=C.target;var E={moduleid:this.moduleid,content:D.attributes.content,dropNodeid:D.attributes.id,coursename:D.attributes.text,leaf:D.attributes.leaf,dropNodeCourseid:D.attributes.courseid,dropNodeVersionid:D.attributes.versionid,targetNodeid:F.attributes.id,targetNodeText:F.attributes.text,targetNodeCourseid:F.attributes.courseid,targetNodeVersionid:F.attributes.versionid};this.nodeArray.push(E)}}});new B.TreeSorter(this.rightTree,{folderSort:true});var A=new B.AsyncTreeNode({text:this.rightRootName,draggable:false,id:"current"});this.rightTree.setRootNode(A);A.expand();return this.rightTree},restoreClick:function(){if(this.nodeArray.length>0){this.updateBtn.disable();Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"POST",params:{flag:21,data:JSON.stringify(this.nodeArray)},scope:this,success:function(A,B){this.resetClick();var C=Wtf.decode(A.responseText);if(C.success){msgBoxShow(["Success","Content restored successfully."],Wtf.MessageBox.INFO)}else{msgBoxShow(["Error","Content already exists in current session."],Wtf.MessageBox.ERROR)}},failure:function(){this.resetClick();msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}})}},resetClick:function(){this.nodeArray=new Array();this.rightTreeLoader.load(this.rightTree.getRootNode());this.leftTreeLoader.load(this.leftTree.getRootNode());this.updateBtn.enable()},createLayout:function(){this.leftTree=this.createLeftTree();this.rightTree=this.createRightTree();var A={border:false,layout:"border",closable:true,modal:true,iconCls:"winRestoreIcon",items:[{region:"north",height:75,border:false,layout:"fit",bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/archive.png","Restore Content(s)","Restore Content(s) for the selected Module")},this.leftTree,this.rightTree],bbar:["->",this.updateBtn=new Wtf.Toolbar.Button({text:"Restore",scope:this,handler:this.restoreClick}),this.resetBtn=new Wtf.Toolbar.Button({text:"Reset",scope:this,handler:this.resetClick}),this.closeBtn=new Wtf.Toolbar.Button({text:"Close",scope:this,handler:function(){this.close()}})]};return A},initComponent:function(){var A=this.createLayout();Wtf.apply(this,Wtf.apply(this.initialConfig,A));Wtf.lms.treeDragDrop.superclass.initComponent.apply(this,arguments)}});Wtf.lms.contentList=function(A){Wtf.apply(this,A);this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,hideGroupedColumn:true});this.reader=new Wtf.data.JsonReader({totalProperty:"count",root:"data",fields:[{name:"modulename",type:"string"},{name:"moduleid",type:"string"},{name:"sessionname",type:"string"},{name:"sessionid",type:"string"},{name:"courseid",type:"string"},{name:"coursename",type:"string"},{name:"vno",type:"int"},{name:"vid",type:"string"},{name:"author",type:"string"},{name:"authorid",type:"string"},{name:"contenturl",type:"string"},{name:"description",type:"string"}]});this.sm=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.ds=new Wtf.data.GroupingStore({url:"jspfiles/lms/catalog.jsp",reader:this.reader,baseParams:{flag:15},sortInfo:{field:"modulename",direction:"ASC"}});this.expander=new Wtf.grid.RowExpander({tpl:new Wtf.Template("<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Description:</b> {description}</p>")});this.cm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),this.expander,this.sm,{header:"Session Name",dataIndex:"sessionname",sortable:true,groupable:true,hidden:true},{header:"Module Name",dataIndex:"modulename",sortable:true,groupable:true},{header:"Title",dataIndex:"coursename",sortable:true,groupable:true},{header:"Author",dataIndex:"author",sortable:true,groupable:true},{header:"Version",dataIndex:"vno",sortable:true,groupable:true,renderer:function(F,C,B,G,E,D){if(parseInt(F)==0){return"Unpublished"}else{return F}}}]);this.programCombo=new Wtf.form.ComboBox({triggerAction:"all",store:new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),baseParams:{type:20},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"programid",type:"string"},{name:"programname",type:"string"}]))}),mode:"local",readOnly:true,listWidth:250,displayField:"programname",valueField:"programid",allowBlank:false,emptyText:"Select a programme..."});this.moduleCombo=new Wtf.form.ComboBox({triggerAction:"all",store:this.moduleStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),baseParams:{type:"getModulesByProgrammeSession"},reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"modulename",type:"string"},{name:"courseid",type:"string"},{name:"moduleid",type:"string"}])),sortInfo:{field:"modulename",direction:"ASC"},listeners:{scope:this,load:function(B){var D=new Wtf.data.Record.create(["moduleid","modulename"]);var C=new D({moduleid:"All",modulename:"All"});B.addSorted(C)}}}),mode:"local",listWidth:300,readOnly:true,displayField:"modulename",valueField:"moduleid",allowBlank:false,emptyText:"Select a Module..."});this.sessionCombo=new Wtf.form.ComboBox({triggerAction:"all",listeners:{scope:this,select:function(E,B,D){this.moduleCombo.setValue("");var C=this.programCombo.getValue();if(C){this.moduleStore.load({params:{data:JSON.stringify({programid:C,sessionid:E.getValue()})}})}}},store:new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),baseParams:{flag:"41"},autoLoad:true,reader:new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},new Wtf.data.Record.create([{name:"sessionid",type:"string"},{name:"sessionname",type:"string"}]))}),mode:"local",listWidth:300,readOnly:true,displayField:"sessionname",valueField:"sessionid",allowBlank:false,emptyText:"Select a Session..."});this.submit=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:this.handleSubmit});this.clearFilter=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:this.handleClear});this.cm.defaultSortable=true;Wtf.lms.contentList.superclass.constructor.call(this,{layout:"fit",items:[{layout:"border",border:false,autoWidth:true,tbar:["Programme:",this.programCombo,"-","Session:",this.sessionCombo,"-","Module:",this.moduleCombo,"-",this.submit,this.clearFilter],items:[this.grid=new Wtf.grid.GridPanel({border:false,region:"center",store:this.ds,view:this.groupingView,cm:this.cm,sm:this.sm,plugins:this.expander,trackMouseOver:true,viewConfig:{forceFit:true},loadMask:{msg:"Loading..."}})]}],bbar:[this.resBtn=new Wtf.Toolbar.Button({text:"Restore",scope:this,disabled:true,handler:this.restoreContent}),"-",this.viewArcCont=new Wtf.Toolbar.Button({text:"View Content",scope:this,disabled:true,handler:this.viewContent}),"-",this.clearHist=new Wtf.Toolbar.Button({text:"Clear Attempt History",scope:this,disabled:true,handler:this.clearAttempt})]});this.grid.on("rowdblclick",this.handleDblClick,this);this.sm.addListener("selectionchange",this.rowSelectionHandler,this)};Wtf.extend(Wtf.lms.contentList,Wtf.Panel,{handleClear:function(){this.programCombo.setValue("");this.sessionCombo.setValue("");this.moduleCombo.setValue("");this.ds.removeAll()},handleSubmit:function(){var B=this.programCombo.getValue();var C=this.moduleCombo.getValue();var A=this.sessionCombo.getValue();if(B&&C&&A){this.ds.load({params:{data:JSON.stringify({start:0,limit:15,programid:B,moduleid:C,sessionid:A})}})}},onRender:function(A){Wtf.lms.contentList.superclass.onRender.call(this,A);this.addEvents({"resContent":true});this.grid.on("sortchange",function(B,C){this.grid.getStore().groupBy(C.field)},this)},rowSelectionHandler:function(){var A=this.sm.getSelections();if(A.length>0){this.resBtn.enable();this.viewArcCont.enable();this.clearHist.enable()}else{this.resBtn.disable();this.viewArcCont.disable();this.clearHist.disable()}},restoreContent:function(){if(Wtf.getCmp("restoreWin"+this.id)){Wtf.getCmp("restoreWin"+this.id).destroy()}new Wtf.lms.treeDragDrop({title:"Restore",width:500,id:"restoreWin"+this.id,height:500,maximizable:true,moduleid:this.moduleid,sessionid:this.sm.getSelected().get("sessionid"),leftRootName:this.sm.getSelected().get("sessionname"),rightRootName:"Current Semester",leftTreeParam:{flag:19,mode:1,courseid:this.sm.getSelected().get("courseid"),userid:loginid},rightTreeParam:{flag:20,moduleid:this.moduleid}}).show()},viewContent:function(){var C=this.sm.getSelections();var D=C[0].data["courseid"];var A=C[0].data["vid"];var B=C[0].data["coursename"];this.openContent(D,B,1,A)},openContent:function(F,C,B,E){var D=F+E;var A="viewer";this.openTab(D,Wtf.MyContentEditor,{layout:"fit",border:false,courseid:F,id:D,tabtitle:C,title:C,mode:B,use:1,closable:true,iconCls:A,vid:E})},openTab:function(D,B,A){var C=Wtf.getCmp(D);if(!C){C=new B(A);mainPanel.add(C);mainPanel.activate(C);mainPanel.doLayout()}mainPanel.setActiveTab(C)},handleDblClick:function(C,F,D){var E=C.getStore().getAt(F).data["courseid"];var A=C.getStore().getAt(F).data["vid"];var B=C.getStore().getAt(F).data["coursename"];this.openContent(E,B,1,A)},clearAttempt:function(){var A=this.sm.getSelections();var B=A[0].data["courseid"];Wtf.Msg.show({msg:"Are you sure you want to clear attempts for selected content?",buttons:Wtf.Msg.YESNO,scope:this,fn:function(C){if(C=="yes"){this.clearHistory(B)}},icon:Wtf.MessageBox.QUESTION})},clearHistory:function(A){Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"GET",params:({flag:18,cid:A}),scope:this,success:function(B,C){if(B.responseText.trim()=="true"){msgBoxShow(["Attempt History","Attempts clear successfully."],Wtf.MessageBox.INFO)}else{msgBoxShow(["Attempt History","No attempt history for this user."],Wtf.MessageBox.INFO)}},failure:function(){msgBoxShow(["Error","Error occurred while connecting to the server."],Wtf.MessageBox.ERROR)}})}});Wtf.WtfCourseReg=function(A){Wtf.apply(this,A);this.createInstitutionWindow=null;this.sendForm=null;this.expander=new Wtf.grid.RowExpander({tpl:new Wtf.Template("<p>&nbsp;&nbsp;&nbsp;&nbsp;<b>Reason:</b> {reason}</p>","<p>&nbsp;&nbsp;&nbsp;&nbsp;<b>Comment:</b> {comment}</p>")});this.sm=new Wtf.grid.CheckboxSelectionModel();this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.cmodel1=new Wtf.grid.ColumnModel([new Wtf.KWLRowNumberer(),this.expander,this.sm,{header:"Student Name",width:150,dataIndex:"username"},{header:"Course Name",width:150,dataIndex:"modulename"},{header:"Course Code",width:150,dataIndex:"coursecode"},{header:"Session Name",width:150,dataIndex:"sessionname"},{header:"Program Name",width:150,dataIndex:"programname"},{header:"Sponsor",width:100,dataIndex:"sponsor"},{header:"Applied Date",width:100,dataIndex:"applieddate"},{header:"Withdrawal Applied Date",width:100,dataIndex:"appdate"},{header:"Status",width:100,dataIndex:"status"},{header:"Session Id",width:100,hidden:true,dataIndex:"sessionid"}]);this.cmodel1.defaultSortable=true;this.moduleRecord=Wtf.data.Record.create([{name:"username",type:"string"},{name:"modulename",type:"string"},{name:"coursecode",type:"string"},{name:"sessionname",type:"string"},{name:"programname",type:"string"},{name:"programtype",type:"string"},{name:"status",type:"string"},{name:"courseremark",type:"string"},{name:"statusid",type:"int"},{name:"userid",type:"string"},{name:"sessionid",type:"string"},{name:"moduleid",type:"string"},{name:"invoicenum",type:"string"},{name:"amount",type:"string"},{name:"feetype",type:"string"},{name:"gradtype",type:"string"},{name:"incaccid",type:"string"},{name:"expaccid",type:"string"},{name:"araccid",type:"string"},{name:"sponsor",type:"string"},{name:"sponsorcode",type:"string"},{name:"islocal",type:"string"},{name:"programid",type:"string"},{name:"paidamt",type:"string"},{name:"applieddate",type:"string"},{name:"sessionid",type:"string"},{name:"reason",type:"string"},{name:"comment",type:"string"},{name:"appdate",type:"string"}]);this.moduleReader=new Wtf.data.KwlJsonReader({root:"data",totalProperty:"count"},this.moduleRecord);this.moduleStore=new Wtf.data.GroupingStore({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newCourse.jsp"}),reader:this.moduleReader,sortInfo:{field:"username",direction:"ASC"},groupField:"username"});this.grid1=new Wtf.grid.GridPanel({ds:this.moduleStore,cm:this.cmodel1,sm:this.sm,plugins:this.expander,border:false,view:this.groupingView,trackMouseOver:true,loadMask:{msg:"Loading..."},viewConfig:{forceFit:true}});this.regBttn=new Wtf.Toolbar.Button({text:"Approve",tooltip:"Approve selected request",hidden:(isRoleGroup("4"))?false:true,id:"BtnNew"+this.id,scope:this,disabled:true});this.deferBttn=new Wtf.Toolbar.Button({text:"Accept payment",tooltip:"Accept payment for selected module",hidden:(isRoleGroup("3"))?false:true,id:"defNew"+this.id,scope:this,disabled:true});this.printBttn=new Wtf.Toolbar.Button({text:"Print Invoice",tooltip:"Print Invoice",hidden:(isRoleGroup("4"))?false:true,id:"printNew"+this.id,scope:this,disabled:true});this.markregBttn=new Wtf.Toolbar.Button({text:"Mark As Registered",tooltip:"Mark selected module as registered",hidden:(isRoleGroup("4"))?false:true,id:"markregNew"+this.id,scope:this,disabled:true});this.viewRemarkBttn=new Wtf.Toolbar.Button({text:"View Remark",tooltip:"View comment for selected students",id:"viewRemark"+this.id,hidden:(isRoleGroup("4"))?false:true,scope:this,disabled:true});this.cancelregBttn=new Wtf.Toolbar.Button({text:"Cancel Registration",tooltip:"Cancel registered for selected module",hidden:(isRoleGroup("4"))?false:true,id:"cancelreg"+this.id,scope:this,disabled:true});this.rejectBttn=new Wtf.Toolbar.Button({text:"Reject",tooltip:"Reject selected request",hidden:(isRoleGroup("4"))?false:true,id:"rejeNew"+this.id,scope:this,disabled:true});this.setmarkBttn=new Wtf.Toolbar.Button({text:"Set Marks",tooltip:"Set Marks For Exemption Exam",hidden:(isRoleGroup("4"))?false:true,id:"markNew"+this.id,scope:this,disabled:true});this.exportBttn=new Wtf.Toolbar.Button({text:"Export",tooltip:"Export this data",handler:function(){setDldUrl("fileDownload.jsp?&type=adminCourseReg&dtype=attachment")},scope:this});this.viewProfile=new Wtf.Toolbar.Button({text:"View Profile",tooltip:"View student profile",id:"profile"+this.id,scope:this,disabled:true,handler:function(){var C=this.grid1.getSelectionModel().getSelections()[0].data["userid"];var B=this.grid1.getSelectionModel().getSelections()[0].data["username"];mainPanel.loadTab("userProfile.html","mainuserProfile_"+C+"_disp",B,"navareadashboard",Wtf.etype.user)}});this.regBttn.on("click",this.handleRegister,this);this.deferBttn.on("click",this.handlePayFee,this);this.rejectBttn.on("click",this.handleReject,this);this.setmarkBttn.on("click",this.handleSetMarks,this);this.printBttn.on("click",this.handlePrintInvoice,this);this.markregBttn.on("click",this.handleMarkAsReg,this);this.viewRemarkBttn.on("click",this.handleViewRemark,this);this.cancelregBttn.on("click",this.cancelregisteredReq,this);Wtf.WtfCourseReg.superclass.constructor.call(this,{autoDestroy:true,border:false,layout:"fit",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"modulename"}),this.regBttn,this.rejectBttn,this.deferBttn,this.printBttn,this.markregBttn,this.viewRemarkBttn,this.cancelregBttn,this.exportBttn],bbar:this.pst=new Wtf.PagingSearchToolbar({pageSize:300,searchField:this.quickPanelSearch,store:this.moduleStore,displayInfo:true,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:this.pP=new Wtf.common.pPageSize({}),items:["-","Total Students:",this.totalStud=new Wtf.form.TextField({fieldLabel:"Total Students:",width:40,readOnly:true}),this.viewProfile]}),items:[this.grid1]});this.moduleStore.on("datachanged",function(){var B=this.pP.combo.value;this.quickPanelSearch.setPage(B)},this);this.on("render",this.handleRender,this);this.grid1.on("rowdblclick",this.handleExamDbClick,this);this.grid1.on("cellclick",this.clickHandle,this);this.moduleStore.on("load",this.handleStoreLoad,this)};Wtf.extend(Wtf.WtfCourseReg,Wtf.Panel,{handleRender:function(A){this.moduleStore.baseParams={type:"courselist"};this.moduleStore.load({params:{userid:loginid,start:0,limit:300}});this.grid1.on("sortchange",function(B,C){this.grid1.getStore().groupBy(C.field)},this)},handleExamDbClick:function(C,D,B){var E=this.moduleStore.getAt(D).data["userid"];var A=this.moduleStore.getAt(D).data["username"];mainPanel.loadTab("userProfile.html","mainuserProfile_"+E+"_disp",A,"navareadashboard",Wtf.etype.user)},handleMarkAsReg:function(){this.maskasRegSta=new Wtf.FormPanel({frame:true,method:"POST",fileUpload:true,waitMsgTarget:true,layout:"column",items:[{layout:"form",items:[new Wtf.form.TextArea({id:"reasonforreg",fieldLabel:"Comment",width:220,name:"reason"})]},{layout:"form",items:[{buttons:[{text:"Submit",type:"submit",scope:this,handler:this.submitregisteredReq},{text:"Cancel",scope:this,handler:function(){this.markregWindow.destroy()}}]}]}]});this.markregWindow=new Wtf.Window({iconCls:"winicon",resizable:false,id:"markregWin",width:430,height:165,title:"Update Status",scope:this,items:[this.maskasRegSta]});this.markregWindow.show();this.markregBttn.disable();this.viewRemarkBttn.disable();this.deferBttn.disable();this.printBttn.disable()},handleViewRemark:function(){if(this.grid1.getSelectionModel().getSelections().length==1){var A=this.sm.getSelected().get("courseremark");msgBoxShow(["Remark",A],Wtf.MessageBox.INFO)}else{msgBoxShow(["Error","Please Select only one record"],Wtf.MessageBox.ERROR)}},submitregisteredReq:function(){var E=Wtf.get("reasonforreg").getValue();this.markregWindow.destroy();this.grid1.loadMask.show();var B=this.sm.getSelections();var C="";var A="";for(var D=0;D<B.length;D++){C+=B[D].get("moduleid")+",";A+=B[D].get("sessionid")+","}C=C.substring(0,C.length-1);A=A.substring(0,A.length-1);Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.userid,moduleid:C,sessionid:A,type:"markasRegisteredExam",status:"1",reason:E,examtype:1},method:"POST"},this,function(F,G){this.grid1.loadMask.hide();msgBoxShow(["Update Status","Status updated Successfully"],Wtf.MessageBox.INFO);this.markregWindow.destroy();this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})},function(F,G){this.grid1.loadMask.hide();msgBoxShow(["ERROR","A problem occurred while updating status"],Wtf.MessageBox.ERROR);this.markregWindow.destroy()})},handleStoreLoad:function(A,D,B){this.quickPanelSearch.StorageChanged(A);var C=A.reader.jsonData.studCnt;if(!isNaN(C)){this.totalStud.setValue(C)}},clickHandle:function(B,H,C,G){var F=0;if(this.grid1.getSelectionModel().getSelections().length==1){this.viewProfile.enable()}else{this.viewProfile.disable()}if(this.grid1.getSelectionModel().getSelections().length>0){this.moduleid=this.moduleStore.getAt(H).data["moduleid"];this.programtype=this.moduleStore.getAt(H).data["programtype"];this.modulename=this.moduleStore.getAt(H).data["modulename"];this.userid=this.moduleStore.getAt(H).data["userid"];this.sponsorcode=this.moduleStore.getAt(H).data["sponsorcode"];F=this.moduleStore.getAt(H).data["paidamt"];var E=this.grid1.getSelectionModel().getSelections();var I=true;if(E.length>1&&this.moduleStore.getAt(H).data["sponsorcode"]!=""&&E[E.length-2].data["sponsorcode"]!=""){if(E[E.length-2].data["sponsorcode"]==this.moduleStore.getAt(H).data["sponsorcode"]&&E[E.length-2].data["status"]==this.moduleStore.getAt(H).data["status"]&&E[E.length-2].data["islocal"]==this.moduleStore.getAt(H).data["islocal"]){I=true}else{I=false}}else{if(E.length>1&&E[E.length-2].data["userid"]==this.moduleStore.getAt(H).data["userid"]){if(E[E.length-2].data["status"]!=this.moduleStore.getAt(H).data["status"]){I=false}}else{if(E.length>1&&E[E.length-2].data["userid"]!=this.moduleStore.getAt(H).data["userid"]){I=false}}}if(!I){var D=this.grid1.getSelectionModel().getSelections();this.grid1.getSelectionModel().clearSelections();this.deferBttn.disable();this.regBttn.disable();this.rejectBttn.disable();this.setmarkBttn.disable();this.printBttn.disable();this.markregBttn.disable();this.cancelregBttn.disable();this.viewRemarkBttn.disable();var A=[];A[0]=D[D.length-1];this.grid1.getSelectionModel().selectRecords(A)}this.status=this.moduleStore.getAt(H).data["status"];this.statusid=this.moduleStore.getAt(H).data["statusid"];if(this.status.substring(0,20)=="Waiting for approval"){this.regBttn.enable();this.rejectBttn.enable();this.printBttn.disable();this.deferBttn.disable();this.markregBttn.disable();this.viewRemarkBttn.disable();this.cancelregBttn.disable()}else{if((this.status.substring(0,24)=="Provisionally Registered")||(this.status.substring(0,14)=="Pre Registered")){this.deferBttn.enable();this.regBttn.disable();this.printBttn.enable();this.markregBttn.disable();this.viewRemarkBttn.enable();if(this.programtype=="1"){if(F=="0"){this.cancelregBttn.enable()}else{this.cancelregBttn.disable()}}else{if(this.programtype=="0"){this.cancelregBttn.disable()}}}else{if(this.status.substring(0,14)=="Accept payment"){this.deferBttn.enable();this.regBttn.disable();this.printBttn.enable();this.markregBttn.enable();this.viewRemarkBttn.enable();this.cancelregBttn.disable()}else{if(this.status=="Applied for registration after due date"){this.rejectBttn.enable();this.regBttn.disable();this.deferBttn.disable();this.printBttn.disable();this.setmarkBttn.disable();this.markregBttn.disable();this.viewRemarkBttn.disable();this.cancelregBttn.disable()}else{if(this.status=="Waiting for deferment confirmation"||this.status=="Waiting for exemption confirmation"||this.statusid=="11"||this.statusid=="12"||(this.statusid=="9"&&this.moduleStore.getAt(H).data["programtype"]=="1")){this.regBttn.enable();this.rejectBttn.enable();this.deferBttn.disable();this.printBttn.disable();this.setmarkBttn.disable();this.markregBttn.disable();this.viewRemarkBttn.disable();this.cancelregBttn.disable()}else{if(this.statusid=="15"){this.setmarkBttn.enable();this.regBttn.disable();this.deferBttn.disable();this.rejectBttn.disable();this.printBttn.disable();this.markregBttn.disable();this.viewRemarkBttn.disable();this.cancelregBttn.disable()}else{if(this.statusid=="10"){this.setmarkBttn.disable();this.regBttn.enable();this.deferBttn.disable();this.rejectBttn.enable();this.printBttn.disable();this.markregBttn.disable();this.viewRemarkBttn.disable();this.cancelregBttn.disable()}else{this.deferBttn.disable();this.regBttn.disable();this.printBttn.disable();this.rejectBttn.disable();this.setmarkBttn.disable();this.markregBttn.disable();this.viewRemarkBttn.disable();this.cancelregBttn.disable()}}}}}}}}else{this.deferBttn.disable();this.regBttn.disable();this.printBttn.disable();this.rejectBttn.disable();this.markregBttn.disable();this.viewRemarkBttn.disable();this.cancelregBttn.disable()}},cancelregisteredReq:function(){var selected=this.sm.getSelections();var moduleids="";var invoiceids="";for(var ctr=0;ctr<selected.length;ctr++){moduleids+=selected[ctr].get("moduleid")+","}moduleids=moduleids.substring(0,moduleids.length-1);for(var ctr=0;ctr<selected.length;ctr++){var flag=true;for(var ptr=0;ptr<ctr;ptr++){if(selected[ctr].get("invoicenum")==selected[ptr].get("invoicenum")){flag=false}}if(flag){invoiceids+=selected[ctr].get("invoicenum")+","}}Wtf.Msg.show({title:"Approve Request",msg:"Are you sure you want to cancel registration for selected module?",buttons:Wtf.Msg.YESNO,scope:this,fn:function(bttn){if(bttn=="yes"){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.userid,moduleid:moduleids,type:"cancelReg",examtype:1,invoiceid:invoiceids},method:"POST"},this,function(result,request){var respobj=eval("("+result+")");if(respobj!=null){if(respobj.success!=null){if(respobj.success){this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})}}if(respobj.msg!=null){msgBoxShow(["Update Status",respobj.msg],Wtf.MessageBox.INFO)}}},function(result,request){msgBoxShow(["ERROR","A problem occurred while updating status"],Wtf.MessageBox.ERROR)})}}})},displaySuccessMessage:function(B,A){msgBoxShow([B,A],Wtf.MessageBox.INFO)},displayFailureMessage:function(B,A){msgBoxShow([B,A],Wtf.MessageBox.ERROR)},handlePayFee:function(D,G){var J=new Date();var B=J.format("Y-m-d H:i:s");var H="PM"+J.format("y")+"/"+Math.floor(Math.random()*10001);var C=this.grid1.getSelectionModel().getSelections();var I=0;var F=0;if(C.length>0){F=C[0].get("araccid");I=C[0].get("sessionid")}var E="";for(var A=0;A<C.length;A++){E+=C[A].data["invoicenum"];if(A!=C.length-1){E+=","}}this.newInv=new Wtf.NewPayment1({id:"coursepayment"+this.id,resizable:false,width:650,paymentno:H,invoiceNum:E,height:500,modal:true,accountId:F,customerId:this.userid,sponsorCode:this.sponsorcode,islocal:C[0].data["islocal"]});this.newInv.show();this.newInv.on("closeform",function(M,L,K){if(K){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/admin/acastructure.jsp",params:{type:108,moduleid:this.sm.getSelected().get("moduleid"),userid:this.sm.getSelected().get("userid"),status:1,sessionid1:I}},this,function(O,N){this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})},function(O,N){})}else{this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})}},this)},handleSetMarks:function(){this.msgbox=new Wtf.Window({id:"msgbox"+this.id,title:"Set exemption exam marks",closable:true,border:false,modal:true,height:200,width:300,layout:"fit",resizable:false,items:[{border:false,layout:"border",items:[{region:"center",id:"center1"+this.id,border:false,height:20,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:13px 13px 0px 13px",html:"Select marks criteria for exemption examination"}]},{region:"south",id:"south1"+this.id,border:false,height:100,layout:"column",items:[{columnWidth:1,layout:"form",border:false,bodyStyle:"padding:2px 13px 0px 43px;",items:[this.check1=new Wtf.form.Radio({hideLabel:true,boxLabel:"Marks obtain above 70%",name:"chck"+this.id,id:"check1"+this.id}),this.creditHrs=new Wtf.form.TextField({fieldLabel:"Credit Hours*",allowBlank:false,name:"crhr",width:60,disabled:true}),this.check2=new Wtf.form.Radio({hideLabel:true,boxLabel:"Marks obtain below 70%",name:"chck"+this.id,id:"check2"+this.id})]}]}]}],buttonAlign:"center",buttons:[{text:"OK",handler:function(){var A;var B;if(!this.check1.checked&&!this.check2.checked){return }if(this.check1.checked){this.creditHrs.validate();if(!this.creditHrs.isValid()){return }A="6";B="Your type B exemption request has been granted"}if(this.check2.checked){A="-1";B="Your type B exemption request has been rejected since you are not eligible as your marks are below 70%"}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.userid,moduleid:this.moduleid,sessionid:this.sessionid,type:"usercourseexempt",status:A,msg:B},method:"POST"},this,function(D,C){msgBoxShow(["Update Status","Status updated Successfully"],Wtf.MessageBox.INFO);this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}});if(A=="6"){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.userid,moduleid:this.moduleid,type:"insertCreditHrForExempted",credithr:this.creditHrs.getValue()},method:"POST"},this,function(F,E){},function(F,E){})}},function(D,C){});Wtf.getCmp("msgbox"+this.id).close()},scope:this},{text:"Cancel",handler:function(){Wtf.getCmp("msgbox"+this.id).close()},scope:this}]}).show();this.check1.on("check",this.spechkchange,this);this.check2.on("check",this.spechkchange1,this);this.setmarkBttn.disable()},spechkchange:function(A,B){if(B){this.creditHrs.setDisabled(false)}else{this.creditHrs.setDisabled(true)}},spechkchange1:function(A,B){if(B){this.creditHrs.setDisabled(true)}else{this.creditHrs.setDisabled(false)}},handleReject:function(){if(this.statusid==9){var classtypeid="Course";var msg="Your request for course withdrawal rejected";var status="1";var reqfor="withdrawal";var selectedRecord=this.grid1.getSelectionModel().getSelections();var idstr="";for(var ctr=0;ctr<selectedRecord.length;ctr++){idstr+=selectedRecord[ctr].data["moduleid"];if(ctr!=selectedRecord.length-1){idstr+=","}}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.userid,moduleid:idstr,sessionid:this.sessionid,classtypeid:classtypeid,type:"updateUserTutStatus",status:status,reqfor:reqfor,msg:msg},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");if(retstatus.success=="true"){this.displaySuccessMessage("Update Status","Status updated Successfully")}else{if(retstatus.success=="false"){this.displayFailureMessage("Status","Error while updating status")}else{this.displayFailureMessage("Error",retstatus.success)}}this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})},function(result,req){this.displayFailureMessage("Status","Error while updating status")})}else{var idstr="";var sessionidstr="";var selectedRecord=this.grid1.getSelectionModel().getSelections();for(var ctr=0;ctr<selectedRecord.length;ctr++){idstr+=selectedRecord[ctr].data["moduleid"];sessionidstr+=selectedRecord[ctr].data["sessionid"];if(ctr!=selectedRecord.length-1){idstr+=",";sessionidstr+=","}}var status;var type="usercourseexempt";var msg;if(this.status=="Applied for registration after due date"){status="8";msg="Your request for course registration has been rejected due to due date."}else{if(this.statusid=="12"){status="13";msg="Your request for Type B exemption for course has been rejected."}else{if(this.statusid=="11"){status="-1";msg="Your request for Type A exemption for course has been rejected."}else{if(this.status=="Waiting for exemption confirmation"||this.status=="Waiting for deferment confirmation"||this.status.substring(0,20)=="Waiting for approval"){status="-1";if(this.status=="Waiting for exemption confirmation"){msg="Your request for examination exemption for course has been rejected"}else{if(this.status.substring(0,20)=="Waiting for approval"){msg="Your request for course registration has been rejected";status="8"}else{type="usercoursedefer";msg="Your request for course deferment has been rejected"}}}}}}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.userid,moduleid:idstr,sessionid:sessionidstr,type:type,status:status,msg:msg},method:"POST"},this,function(resp,req){msgBoxShow(["Update Status","Status updated Successfully"],Wtf.MessageBox.INFO);this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})},function(rep,req){})}this.rejectBttn.disable();this.regBttn.disable();this.grid1.getSelectionModel().clearSelections()},setcreditHrs:function(){var jsondata="{data:[";var selected=this.checksm.getSelections();for(var ctr=0;ctr<selected.length;ctr++){var ColumnList=new Array("facultyid");var ContentList=new Array(selected[ctr].get("facid"));jobj=Wtf.common.getJsonObjectForAccounting(ColumnList,ContentList);jsondata+=jobj}jsondata=jsondata.substring(0,jsondata.length-1);jsondata+="]}";Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/admin/acastructure.jsp",params:{type:68,moduleid:this.grid1.getSelectionModel().getSelected().get("moduleid"),sessionid:this.grid1.getSelectionModel().getSelected().get("sessionid"),credithrs:this.credithrs.getValue(),userid:this.grid1.getSelectionModel().getSelected().get("userid"),facultystr:jsondata}},this,function(response,option){this.credithrwin.close();var resp=eval("("+response+")");if(resp!=null){if(resp.amount!=null){this.grid1.getSelectionModel().getSelected().set("amount",resp.amount);this.genInvoice()}}},function(resp,req){})},handleRegister:function(A,B){if(this.statusid==0&&(this.grid1.getSelectionModel().getSelected().get("gradtype")=="2"||this.grid1.getSelectionModel().getSelected().get("gradtype")==3)){this.checksm=new Wtf.grid.CheckboxSelectionModel();this.facRecord=Wtf.data.Record.create([{name:"facid",type:"string"},{name:"facname",type:"string"}]);this.facReader=new Wtf.data.JsonReader({root:"data"},this.facRecord);this.facds=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/applications.jsp?task=getFaculty"}),reader:this.facReader});this.faccm=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),this.checksm,{dataIndex:"facname",header:"Faculty"}]);this.facultyGrid=new Wtf.grid.GridPanel({sm:this.checksm,ds:this.facds,cm:this.faccm,viewConfig:{autoFill:true,forceFit:true}});this.credithrwin=new Wtf.Window({width:400,height:500,layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:"<div style = 'width:100%;height:100%;position:relative;float:left;'><div style='float:left;height:100%;width:auto;position:relative;'><img src = 'images/upload52.gif' style = 'width:52px;height:52px;margin:5px 5px 5px 5px;'></img></div><div style='float:left;height:100%;width:80%;position:relative;'><div style='font-size:12px;font-style:bold;float:left;margin:20px 0px 0px 10px;width:100%;position:relative;'><b>Credit Hours</b></div><div style='font-size:10px;float:left;margin:15px 0px 0px 10px;width:100%;position:relative;'>Set Credit Hours.</div></div></div>"},{region:"center",border:false,layout:"border",items:[{region:"north",border:false,layout:"form",labelWidth:150,height:100,bodyStyle:"padding: 13px;",items:[this.compcredithrs=new Wtf.form.NumberField({fieldLabel:"Completed Credit Hours",width:150,readOnly:true}),this.credithrs=new Wtf.form.NumberField({fieldLabel:"Applied Credit Hours*",allowBlank:false,width:150}),this.totcredithrs=new Wtf.form.NumberField({fieldLabel:"Total Credit Hours",width:150,readOnly:true})]},{region:"center",border:false,layout:"fit",items:this.facultyGrid}]}],buttons:[{text:"Save",scope:this,handler:this.setcreditHrs},{text:"Cancel",scope:this,handler:function(){this.credithrwin.close()}}]});this.facds.load();this.facds.on("load",this.selectfaculty,this);this.credithrwin.show();this.credithrs.on("change",this.caltothrs,this)}else{this.genInvoice()}},caltothrs:function(){this.totcredithrs.setValue(parseFloat(this.compcredithrs.getValue())+parseFloat(this.credithrs.getValue()))},selectfaculty:function(){Wtf.Ajax.requestEx({url:"jspfiles/admin/acastructure.jsp",method:"POST",params:{type:74,userid:this.grid1.getSelectionModel().getSelected().get("userid"),moduleid:this.grid1.getSelectionModel().getSelected().get("moduleid")}},this,function(response,option){var resp=eval("("+response+")");var arr=[];var cmpcredit=0;if(resp!=null&&resp.data!=null){for(var ctr=0;ctr<resp.data.length;ctr++){if(resp.data[ctr].status==2){cmpcredit=cmpcredit+resp.data[ctr].appcredithrs}this.compcredithrs.setValue(resp.data[ctr].comCreHrs);this.credithrs.setValue(resp.data[ctr].credithrs);this.totcredithrs.setValue(resp.data[ctr].comCreHrs+parseFloat(resp.data[ctr].credithrs));var index=this.facds.find("facid",resp.data[ctr].facultyid);if(index>-1){arr.push(this.facds.getAt(index))}}this.checksm.selectRecords(arr)}},function(resp,req){})},onApproveExemp_Req:function(creditHrs){var type="coursereg";var idstr="";var SessionStr="";var dsNewInv=new Wtf.data.Store({});var feetypestr="";var selectedRecord=this.grid1.getSelectionModel().getSelections();var accountid=0;var incomeid=0;if(selectedRecord.length>0){accountid=selectedRecord[0].get("araccid");incomeid=selectedRecord[0].get("incaccid")}var totalAmt=0;var feetype=selectedRecord[0].data["feetype"];for(var i=0;i<selectedRecord.length;i++){feetypestr+=selectedRecord[i].data["feetype"].toString();if(i!=selectedRecord.length-1){feetypestr+=","}var newRec=new this.moduleRecord({code:"",name:selectedRecord[i].data["modulename"],id:(selectedRecord[i].data["gradtype"]==1)?selectedRecord[i].data["moduleid"]:selectedRecord[i].data["moduleid"]+"_"+selectedRecord[i].data["sessionid"],fee:selectedRecord[i].data["amount"],rid:selectedRecord[i].data["sessionid"]});totalAmt+=parseFloat(selectedRecord[i].data["amount"]);idstr+=selectedRecord[i].data["moduleid"];SessionStr+=selectedRecord[i].data["sessionid"];if(i!=selectedRecord.length-1){idstr+=","}dsNewInv.add(newRec)}if(totalAmt<=0){Wtf.Msg.show({title:"Approve Request",msg:"Fee amount for selected item is 0. Do you still want to continue?",buttons:Wtf.Msg.YESNO,fn:function(bttn){if(bttn=="yes"){Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{studentid:this.userid,moduleid:idstr,feetypeid:feetype,type:"examApprove"},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");if(retstatus.success){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/admin/acastructure.jsp",params:{type:108,moduleid:idstr,userid:this.userid,sessionid1:SessionStr,status:1}},this,function(rep,req){this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})},function(resp,req){});msgBoxShow(["Update Status","Status updated successfully"],Wtf.MessageBox.INFO)}else{msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)}},function(result,req){msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)})}},scope:this,animEl:"elId",icon:Wtf.MessageBox.QUESTION})}else{Wtf.Ajax.requestEx({url:"jspfiles/admin/acastructure.jsp",params:{userid:this.userid,moduleid:idstr,feetype:feetypestr,type:61},method:"POST"},this,function(response,option){var resp=eval("("+response+")");if(resp.data!=null){if(resp.data.length>0){recno=(selectedRecord.length>resp.data[0].moduleno)?resp.data[0].moduleno:selectedRecord.length;Wtf.Msg.show({title:"Scholarship",msg:"Scholarship applicable for "+recno+" modules. Do you want to apply Scholarship?",buttons:Wtf.Msg.YESNO,animEl:"elId",icon:Wtf.MessageBox.QUESTION,scope:this,fn:function(btn){if(btn=="yes"){if(resp.data[0].chargemode=="0"){totalAmt=totalAmt-(resp.data[0].amount*recno)}else{totalAmt=totalAmt-(parseFloat(selectedRecord[0].data["amount"])*recno*resp.data[0].amount/100)}}else{recno=0}var dat=new Date();if(totalAmt>0){this.newGenInv=new Wtf.NewGenInvoice({id:"coursepayfee"+this.id,width:500,height:400,resizable:false,layout:"fit",customerId:this.userid,amountDue:totalAmt,store:dsNewInv,accountid:accountid,incomeid:incomeid,type:type,feetypeid:feetype,moduleid:idstr,sessionid:this.sessionid,creditHrs:creditHrs});this.newGenInv.show();this.newGenInv.on("closeform",function(id){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/admin/acastructure.jsp",params:{type:108,moduleid:this.sm.getSelected().get("moduleid"),userid:this.sm.getSelected().get("userid"),sessionid1:this.sm.getSelected().get("sessionid"),status:2}},this,function(rep,req){this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})},function(resp,req){})},this)}if(recno>0){var idstr="";for(var ctr=0;ctr<recno;ctr++){idstr+=selectedRecord[ctr].data["moduleid"];if(ctr!=selectedRecord.length-1){idstr+=","}}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{studentid:this.userid,moduleid:idstr,type:"courseReg"},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");if(retstatus.success){Wtf.Ajax.requestEx({url:"jspfiles/admin/acastructure.jsp",params:{userid:this.userid,moduleid:idstr,feetype:feetypestr,type:62,moduleno:recno},method:"POST"},this,function(resp,req){},function(resp,req){});msgBoxShow(["Update Status","Status updated successfully"],Wtf.MessageBox.INFO);this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})}else{msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)}},function(result,req){msgBoxShow(["Status","Error while updating status"],Wtf.MessageBox.INFO)})}}})}else{this.newGenInv=new Wtf.NewGenInvoice({id:"coursepayfee"+this.id,width:500,height:400,resizable:false,layout:"fit",customerId:this.userid,amountDue:totalAmt,store:dsNewInv,accountid:accountid,incomeid:incomeid,type:type,feetypeid:feetype,moduleid:idstr,sessionid:this.sessionid,creditHrs:creditHrs});this.newGenInv.show();this.newGenInv.on("closeform",function(id){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/admin/acastructure.jsp",params:{type:108,moduleid:this.sm.getSelected().get("moduleid"),userid:this.sm.getSelected().get("userid"),sessionid1:this.sm.getSelected().get("sessionid"),status:2}},this,function(rep,req){this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})},function(resp,req){})},this)}}})}},setcreditHrsexmp:function(){this.newTaskWindow=new Wtf.Window({width:300,resizable:false,id:this.id+"TaskWin",modal:true,title:"Set Credit Hours",buttonAlign:"center",buttons:[{anchor:"90%",id:"save",text:"Submit",handler:function(){this.onApproveExemp_Req(this.creditHrsText.getValue());Wtf.getCmp(this.id+"TaskWin").close()},scope:this},{anchor:"90%",id:"close",text:"Cancel",handler:function(){Wtf.getCmp(this.id+"TaskWin").close()},scope:this}],items:[this.taskform=new Wtf.FormPanel({labelWidth:100,labelAlign:"left",border:false,bodyStyle:"padding:5px 5px 0",layout:"form",anchor:"100%",buttonAlign:"center",items:[this.creditHrsText=new Wtf.form.TextField({fieldLabel:"Enter Credit Hours*",allowBlank:false,name:"code",width:150})]})]}).show()},genInvoice:function(){if(this.statusid==0||this.statusid==5||this.statusid==12){if(this.statusid==5){this.setcreditHrsexmp()}else{if(this.statusid==12){this.setcreditHrsexmp()}else{if(this.programtype=="0"){this.setPlan()}else{this.onApproveExemp_Req(0)}}}}else{if(this.statusid==3||this.statusid==11){var status;var type;var selectedRecord=this.grid1.getSelectionModel().getSelections();var msg;type="usercoursedefer";if(this.statusid==3){status="4";msg="Your request for deferement has been accepted"}else{if(this.statusid==11){status="6";msg="Your request for type A exemption has been accepted"}}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.userid,moduleid:selectedRecord[0].data["moduleid"],sessionid:this.sessionid,type:type,status:status,msg:msg},method:"POST"},this,function(resp,req){msgBoxShow(["Update Status","Status updated Successfully"],Wtf.MessageBox.INFO);this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})},function(resp,req){})}else{if(this.statusid==9||this.statusid==10){var classtypeid="Course";var selectedRecord=this.grid1.getSelectionModel().getSelections();var idstr="";for(var ctr=0;ctr<selectedRecord.length;ctr++){idstr+=selectedRecord[ctr].data["moduleid"];if(ctr!=selectedRecord.length-1){idstr+=","}}Wtf.Ajax.requestEx({url:"jspfiles/newCourse.jsp",params:{userid:this.userid,moduleid:idstr,classtypeid:classtypeid,sessionid:this.sessionid,type:"updateUserTutStatus",status:17,reqfor:"",msg:""},method:"POST"},this,function(result,req){var retstatus=eval("("+result.trim()+")");if(retstatus.success=="true"){this.displaySuccessMessage("Update Status","Status updated Successfully")}else{if(retstatus.success=="false"){this.displayFailureMessage("Status","Error while updating status")}else{this.displayFailureMessage("Error",retstatus.success)}}this.moduleStore.load({params:{userid:loginid,start:this.pst.cursor,limit:this.pP.combo.value}})},function(result,req){this.displayFailureMessage("Status","Error while updating status")})}}}this.regBttn.disable();this.rejectBttn.disable();this.printBttn.disable()},handlePrintInvoice:function(B,D){var A=this.grid1.getSelectionModel().getSelections();var E="";for(var C=0;C<A.length;C++){E+=A[C].data["invoicenum"];if(C!=A.length-1){E+=","}}setDldUrl("PrintInvoice.jsp?&invoicenum="+A[0].data["invoicenum"]+"&flg=1");A[0].data["invoicenumexam"];this.deferBttn.disable();this.printBttn.disable()},setPlan:function(){var A=new Wtf.assignPlan({userid:this.sm.getSelected().get("userid"),programid:this.sm.getSelected().get("programid"),plansel:"",displansel:"",schplansel:"",flag:1,defaultplan:1});A.on("refreshgrid",function(B){this.sm.getSelected().set("amount",B);this.onApproveExemp_Req(0)},this)}});Wtf.assignPlan=function(A){Wtf.apply(this,A);this.planAdd=[];this.plandel=[];this.displanAdd=[];this.displandel=[];this.schplanAdd=[];this.schplandel=[];this.pRecord=Wtf.data.Record.create([{name:"code",type:"string"}]);this.pSM=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.pReader=new Wtf.data.KwlJsonReader({root:"data"},this.pRecord);this.pStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.pReader});this.pCM=new Wtf.grid.ColumnModel([this.pSM,{header:"Plan",dataIndex:"code"}]);this.pCM.defaultSortable=true;this.pGrid=new Wtf.grid.EditorGridPanel({ds:this.pStore,cm:this.pCM,sm:this.pSM,autoScroll:true,collapsible:true,layout:"fit",clicksToEdit:1,viewConfig:{forceFit:true,autoFill:true}});this.disRecord=Wtf.data.Record.create([{name:"code",type:"string"}]);this.disSM=new Wtf.grid.CheckboxSelectionModel({});this.disReader=new Wtf.data.KwlJsonReader({root:"data"},this.disRecord);this.disStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.pReader});this.disCM=new Wtf.grid.ColumnModel([this.disSM,{header:"Plan",dataIndex:"code"}]);this.disCM.defaultSortable=true;this.disGrid=new Wtf.grid.EditorGridPanel({ds:this.disStore,cm:this.disCM,sm:this.disSM,autoScroll:true,collapsible:true,layout:"fit",clicksToEdit:1,viewConfig:{forceFit:true,autoFill:true}});this.schRecord=Wtf.data.Record.create([{name:"code",type:"string"}]);this.schSM=new Wtf.grid.CheckboxSelectionModel({});this.schReader=new Wtf.data.KwlJsonReader({root:"data"},this.schRecord);this.schStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.schReader});this.schCM=new Wtf.grid.ColumnModel([this.schSM,{header:"Plan",dataIndex:"code"}]);this.schCM.defaultSortable=true;this.schGrid=new Wtf.grid.EditorGridPanel({ds:this.schStore,cm:this.schCM,sm:this.schSM,autoScroll:true,collapsible:true,layout:"fit",clicksToEdit:1,viewConfig:{forceFit:true,autoFill:true}});this.pStore.load({params:{type:46,userid:this.userid,programid:this.programid,flag:this.flag}});this.disStore.load({params:{type:47,userid:this.userid,programid:this.programid,flag:this.flag}});this.schStore.load({params:{type:51,userid:this.userid,programid:this.programid,flag:this.flag}});if(this.defaultplan==0){this.pStore.on("load",this.pStoreLoad,this);this.disStore.on("load",this.disStoreLoad,this);this.schStore.on("load",this.schStoreLoad,this)}else{if(this.defaultplan==1){this.planloadCount=0;this.pStore.on("load",function(){this.planloadCount++;if(this.planloadCount==3){this.pStoreLoad1()}},this);this.disStore.on("load",function(){this.planloadCount++;if(this.planloadCount==3){this.pStoreLoad1()}},this);this.schStore.on("load",function(){this.planloadCount++;if(this.planloadCount==3){this.pStoreLoad1()}},this)}}this.editWin=new Wtf.Window({title:"Select Plan",closable:true,modal:true,iconCls:"win",width:500,height:550,resizable:false,buttonAlign:"right",buttons:[{text:"Save",scope:this,handler:this.userPlanmap},{text:"Cancel",scope:this,handler:function(){this.editWin.close();this.planAdd=[];this.plandel=[];this.displanAdd=[];this.displandel=[];this.schplanAdd=[];this.schplandel=[];this.fireEvent("closewin")}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/upload52.gif","Select Plan","Select Plan for Student.")},{region:"center",border:false,layout:"fit",items:[{border:false,bodyStyle:"background:transparent;",layout:"border",labelWidth:50,items:[{title:"Base Plans",region:"north",layout:"fit",border:false,height:150,items:this.pGrid},{region:"center",layout:"border",border:false,items:[{title:"Discount Plans",region:"west",width:250,layout:"fit",border:false,items:this.disGrid},{title:"Scholarship Plans",region:"center",border:false,layout:"fit",items:this.schGrid}]}]}]}]});this.editWin.show();Wtf.assignPlan.superclass.constructor.call(this,A)};Wtf.extend(Wtf.assignPlan,Wtf.Panel,{onRender:function(A){Wtf.assignPlan.superclass.onRender.call(this,A);this.addEvents={"refreshgrid":true,"closewin":true}},pStoreLoad:function(){var A=[];for(var B=0;B<this.plansel.length;B++){A.push(this.pStore.getAt(this.pStore.find("code",this.plansel[B])))}this.pSM.selectRecords(A);this.pSM.on("rowselect",this.planSelected,this);this.pSM.on("rowdeselect",this.planDeSelected,this)},disStoreLoad:function(){var A=[];for(var B=0;B<this.displansel.length;B++){var D=this.displansel[B];var C=this.getIndex(D,this.disStore,"code");A.push(this.disStore.getAt(C))}this.disSM.selectRecords(A);this.disSM.on("rowselect",this.disSelected,this);this.disSM.on("rowdeselect",this.disDeSelected,this)},getIndex:function(D,A,B){for(var C=0;C<A.getCount();C++){if(A.getAt(C).get(B)==D){return C}}},schStoreLoad:function(){var A=[];for(var B=0;B<this.schplansel.length;B++){A.push(this.schStore.getAt(this.schStore.find("code",this.schplansel[B])))}this.schSM.selectRecords(A);this.schSM.on("rowselect",this.schSelected,this);this.schSM.on("rowdeselect",this.schDeSelected,this)},planSelected:function(B,A,C){if(this.plandel.indexOf(this.pStore.getAt(A).get("code"))>-1){this.plandel.remove(this.pStore.getAt(A).get("code"))}else{this.planAdd.push(this.pStore.getAt(A).get("code"));this.disSM.clearSelections();this.schSM.clearSelections();this.displanAdd=[];this.schplandel=[]}},planDeSelected:function(B,A,C){if(this.planAdd.indexOf(this.pStore.getAt(A).get("code"))>-1){this.planAdd.remove(this.pStore.getAt(A).get("code"))}else{this.plandel.push(this.pStore.getAt(A).get("code"))}},disSelected:function(B,A,C){if(this.displandel.indexOf(this.disStore.getAt(A).get("code"))>-1){this.displandel.remove(this.disStore.getAt(A).get("code"))}else{this.displanAdd.push(this.disStore.getAt(A).get("code"))}},disDeSelected:function(B,A,C){if(this.displanAdd.indexOf(this.disStore.getAt(A).get("code"))>-1){this.displanAdd.remove(this.disStore.getAt(A).get("code"))}else{this.displandel.push(this.disStore.getAt(A).get("code"))}},schSelected:function(B,A,C){if(this.schplandel.indexOf(this.schStore.getAt(A).get("code"))>-1){this.schplandel.remove(this.schStore.getAt(A).get("code"))}else{this.schplanAdd.push(this.schStore.getAt(A).get("code"))}},schDeSelected:function(B,A,C){if(this.schplanAdd.indexOf(this.schStore.getAt(A).get("code"))>-1){this.schplanAdd.remove(this.schStore.getAt(A).get("code"))}else{this.schplandel.push(this.schStore.getAt(A).get("code"))}},userPlanmap:function(){if(!this.pSM.hasSelection()){msgBoxShow(["Base Plan","Select a base plan"],Wtf.MessageBox.ERROR);return }Wtf.Ajax.requestEx({url:"jspfiles/admin/acastructure.jsp",method:"POST",params:{userid:this.userid,planAdd:this.planAdd.toString(),plandel:this.plandel.toString(),displanAdd:this.displanAdd.toString(),displandel:this.displandel.toString(),schplanAdd:this.schplanAdd.toString(),schplandel:this.schplandel.toString(),programid:this.programid,type:49,flag:this.flag}},this,function(response,option){var resp=eval("("+response+")");if(resp!=null&&resp.amount!=null){this.fireEvent("refreshgrid",resp.amount)}this.editWin.close();this.planAdd=[];this.plandel=[];this.displanAdd=[];this.displandel=[];this.schplanAdd=[];this.schplandel=[]},function(resp,req){})},pStoreLoad1:function(){Wtf.Ajax.request({url:"jspfiles/admin/acastructure.jsp",method:"POST",params:{userid:this.userid,type:96,programid:this.programid},scope:this,success:function(response,option){var resp=eval("("+response.responseText+")");var planSelected=[];var disSelected=[];var schSelected=[];for(var ctr=0;ctr<resp.data.length;ctr++){var selected=[];if(resp.data[ctr].type==0){planSelected.push(this.pStore.getAt(this.pStore.find("code",resp.data[ctr].code)))}else{if(resp.data[ctr].type==1){disSelected.push(this.disStore.getAt(this.disStore.find("code",resp.data[ctr].code)))}else{if(resp.data[ctr].type==2){schSelected.push(this.schStore.getAt(this.schStore.find("code",resp.data[ctr].code)))}}}}if(planSelected.length>0){this.pSM.selectRecords(planSelected)}if(disSelected.length>0){this.disSM.selectRecords(disSelected)}if(schSelected.length>0){this.schSM.selectRecords(schSelected)}this.planAdd=[];this.plandel=[];this.displanAdd=[];this.displandel=[];this.schplanAdd=[];this.schplandel=[];this.pSM.on("rowselect",this.planSelected,this);this.pSM.on("rowdeselect",this.planDeSelected,this);this.disSM.on("rowselect",this.disSelected,this);this.disSM.on("rowdeselect",this.disDeSelected,this);this.schSM.on("rowselect",this.schSelected,this);this.schSM.on("rowdeselect",this.schDeSelected,this)}})}});Wtf.randomQuiz=function(A){Wtf.apply(this,A);Wtf.randomQuiz.superclass.constructor.call(this,A);this.save=1};Wtf.extend(Wtf.randomQuiz,Wtf.Panel,{onRender:function(A){Wtf.randomQuiz.superclass.onRender.call(this,A);this.addEvents({"unlockObject":true,"publishRandomQuiz":true});this.dsstore=new Wtf.data.Store({url:Wtf.req.lms+"quiz.jsp",reader:new Wtf.data.JsonReader({root:"data"},["noq","mind","maxd","tags"])});this.RES=Wtf.data.Record.create([{name:"tagid",type:"string"},{name:"tagname",type:"string"},{name:"check"}]);this.allResources=new Wtf.data.Store({url:Wtf.req.lms+"fetchTags.jsp",reader:new Wtf.data.JsonReader({root:"data",id:"res-reader"},this.RES)});this.MSComboconfig={store:this.allResources,displayField:"tagname",valueField:"tagid",triggerAction:"all",mode:"local"};this.add(this.top=new Wtf.Panel({border:false,layout:"border",bodyStyle:"background:transparent;",items:[{region:"north",border:false,height:90,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","Random Question","Choose the number of random questions you want to add to the quiz. You can also specify the difficulty range")},{region:"center",layout:"fit",border:false,items:[this.form1=new Wtf.FormPanel({url:Wtf.req.lms+"quiz.jsp?flag=6",waitMsgTarget:true,method:"POST",border:false,layout:"fit",bodyStyle:"margin-top:20px;margin-left:35px;font-size:10px;",layout:"form",labelWidth:130,items:[this.nameField=new Wtf.form.NumberField({fieldLabel:"Number of questions*",name:"number",allowBlank:false,scope:this,width:165,maxValue:100}),this.minField=new Wtf.form.NumberField({fieldLabel:"Minimum Difficulty*",scope:this,width:165,name:"min",allowDecimals:false,allowNegative:false,allowBlank:false,maxValue:10}),this.maxField=new Wtf.form.NumberField({fieldLabel:"Maximum Difficulty*",scope:this,width:165,name:"max",allowDecimals:false,allowNegative:false,allowBlank:false,maxValue:10}),{layout:"column",border:false,items:[{columnWidth:1,border:false,layout:"form",items:[this.multi=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,fieldLabel:"Tags",forceSelection:true},this.MSComboconfig))]}]}]})]}],bbar:[{text:"Preview",scope:this,handler:function(){var E=null;var B=null;if(this.cid){E=this.cid}else{E=""}if(this.vid){B=this.vid}else{B=0}var D="0?tab"+this.nodeid+"?rand?"+E+"?"+B;var C="";C+=escape(D);window.open("qpreview.html?"+C,"fs","fullscreen=yes","titlebar=no")}},{id:"publish"+this.id,text:"Publish",hidden:(Wtf.isContentDesigner()||!(this.owner)||(this.nodeidObj?false:true)),scope:this,handler:function(){var B=(this.id).substring(3);this.publish=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:Wtf.req.lms+"catalog.jsp"}),reader:new Wtf.data.JsonReader({root:"data"},["success"])});this.publish.on("load",this.pubresp,this);this.publish.load({params:{flag:"7",loid:B}})}},{text:"Save",scope:this,hidden:!(this.owner)?true:false,handler:function(){this.rquizSave()}},{text:"Unlock",hidden:!(this.owner)||(this.nodeidObj?false:true),scope:this,handler:function(){Wtf.Ajax.request({url:Wtf.req.lms+"catalog.jsp",method:"GET",params:({objid:this.nodeid,flag:9}),scope:this,success:function(B,C){this.fireEvent("unlockObject");Wtf.MessageBox.show({title:"Success",msg:"Lock successfully released",buttons:Wtf.MessageBox.OK,fn:this.closeTab,scope:this,icon:Wtf.MessageBox.INFO})},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}}]}));this.allResources.load({params:{flag:0}});if(this.vid){this.dsstore.load({params:{flag:"10",nodeid:this.nodeid,vid:this.vid}})}else{this.dsstore.load({params:{flag:"7",nodeid:this.nodeid,cid:this.cid}})}this.dsstore.on("load",this.loadData,this);this.nameField.on("change",this.valueChange,this);this.minField.on("change",this.valueChange,this);this.maxField.on("change",this.valueChange,this);this.loadMask=new Wtf.LoadMask(this.el.dom,{msg:"Saving.."});this.loadrQuiz=new Wtf.LoadMask(this.el.dom,{msg:"Loading..."})},valueChange:function(){this.save=0},rquizSave:function(){var B=this.minField.getValue();var A=this.maxField.getValue();if(A<B){this.maxField.markInvalid("Please specify value greater than min difficulty")}else{var C;C=this.nodeid;var D=this.nameField.getValue();if(this.form1.form.isValid()){this.form1.form.submit({waitMsg:"Saving...",scope:this,params:{id:C,tags:this.multi.getValue(),min:this.minField.getValue(),max:this.maxField.getValue(),number:D,cid:this.cid},success:function(H,G){this.save=1;var F=Wtf.decode(G.response.responseText);var E;if(F.no<D){E=F.no+" Questions are available according to this criteria"}else{E="Questions are added successfully"}msgBoxShow(["Success",E],Wtf.MessageBox.INFO)},failure:function(F,E){msgBoxShow(["Failure","Error connecting to server. Please try again"],Wtf.MessageBox.INFO)}})}}},closeTab:function(){this.ownerCt.remove(this)},pubresp:function(B,C,A){if(C[0].json.Success=="true"){this.fireEvent("publishRandomQuiz");Wtf.MessageBox.alert("Status","Object published successfully")}else{if(C[0].json.Success=="false"){msgBoxShow(["Warning","There is no change to publish this object."])}else{Wtf.MessageBox.alert("Status","Problem in publishing Object")}}},loadData:function(D,F,B){this.loadrQuiz.hide();var E,H,C;var A=[];E=F[0].data.noq;H=F[0].data.mind;C=F[0].data.maxd;for(var G=1;G<F.length;G++){A.push(F[G].data.tags)}this.nameField.setValue(E);this.minField.setValue(H);this.maxField.setValue(C);this.multi.setValue(A);if(!this.owner){this.nameField.disable();this.minField.disable();this.maxField.disable();this.multi.disable()}}});Wtf.GroupHeaderGrid=function(A){this.config=A};Wtf.extend(Wtf.GroupHeaderGrid,Wtf.util.Observable,{init:function(A){Wtf.applyIf(A.colModel,this.config);Wtf.apply(A.getView(),this.viewConfig)},viewConfig:{initTemplates:function(){this.constructor.prototype.initTemplates.apply(this,arguments);var A=this.templates||{};if(!A.gcell){A.gcell=new Wtf.XTemplate('<td class="x-grid3-hd {cls} x-grid3-td-{id} ux-grid-hd-group-row-{row}" style="{style}">','<div {tooltip} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">','<tpl if="values.btn"><a class="x-grid3-hd-btn" href="#"></a></tpl>',"{value}</div>","</td>")}this.templates=A;this.hrowRe=new RegExp("ux-grid-hd-group-row-(\\d+)","")},renderHeaders:function(){var H=this.templates,D=[],K=this.cm,O=K.rows,I="width:"+this.getTotalWidth()+";";for(var N=0,J=O.length;N<J;N++){var A=O[N],M=[];for(var F=0,E=0,G=A.length;F<G;F++){var L=A[F];L.colspan=L.colspan||1;var B=this.getColumnId(L.dataIndex?K.findColumnIndex(L.dataIndex):E);var C=Wtf.GroupHeaderGrid.prototype.getGroupStyle.call(this,L,E);M[F]=H.gcell.apply({cls:L.header?"ux-grid-hd-group-cell":"ux-grid-hd-nogroup-cell",id:B,row:N,style:"width:"+C.width+";"+(C.hidden?"display:none;":"")+(L.align?"text-align:"+L.align+";":""),tooltip:L.tooltip?(Wtf.QuickTips.isEnabled()?"Wtf:qtip":"title")+'="'+L.tooltip+'"':"",istyle:L.align=="right"?"padding-right:16px":"",btn:this.grid.enableHdMenu&&L.header,value:L.header||"&nbsp;"});E+=L.colspan}D[N]=H.header.apply({tstyle:I,cells:M.join("")})}D.push(this.constructor.prototype.renderHeaders.apply(this,arguments));return D.join("")},onColumnWidthUpdated:function(){this.constructor.prototype.onColumnWidthUpdated.apply(this,arguments);Wtf.GroupHeaderGrid.prototype.updateGroupStyles.call(this)},onAllColumnWidthsUpdated:function(){this.constructor.prototype.onAllColumnWidthsUpdated.apply(this,arguments);Wtf.GroupHeaderGrid.prototype.updateGroupStyles.call(this)},onColumnHiddenUpdated:function(){this.constructor.prototype.onColumnHiddenUpdated.apply(this,arguments);Wtf.GroupHeaderGrid.prototype.updateGroupStyles.call(this)},getHeaderCell:function(A){return this.mainHd.query(this.cellSelector)[A]},findHeaderCell:function(A){return A?this.fly(A).findParent("td.x-grid3-hd",this.cellSelectorDepth):false},findHeaderIndex:function(B){var A=this.findHeaderCell(B);return A?this.getCellIndex(A):false},updateSortIcon:function(B,A){var D=this.sortClasses;var C=this.mainHd.select(this.cellSelector).removeClass(D);C.item(B).addClass(D[A=="DESC"?1:0])},beforeColMenuShow:function(){var K=this.cm,P=this.cm.rows;this.colMenu.removeAll();for(var D=0,I=K.getColumnCount();D<I;D++){var C=this.colMenu,M=K.getColumnHeader(D);if(K.config[D].fixed!==true&&K.config[D].hideable!==false){for(var O=0,J=P.length;O<J;O++){var B=P[O],L,E=0;for(var F=0,H=B.length;F<H;F++){L=B[F];if(D>=E&&D<E+L.colspan){break}E+=L.colspan}if(L&&L.header){if(K.hierarchicalColMenu){var G="group-"+O+"-"+E;var N=C.items.item(G);var A=N?N.menu:null;if(!A){A=new Wtf.menu.Menu({id:G});A.on("itemclick",this.handleHdMenuClick,this);C.add({id:G,text:L.header,menu:A})}C=A}else{M=L.header+" "+M}}}C.add(new Wtf.menu.CheckItem({id:"col-"+K.getColumnId(D),text:M,checked:!K.isHidden(D),hideOnClick:false,disabled:K.config[D].hideable===false}))}}},renderUI:function(){this.constructor.prototype.renderUI.apply(this,arguments);Wtf.apply(this.columnDrop,Wtf.GroupHeaderGrid.prototype.columnDropConfig)}},columnDropConfig:{getTargetFromEvent:function(B){var A=Wtf.lib.Event.getTarget(B);return this.view.findHeaderCell(A)},positionIndicator:function(B,E,D){var C=Wtf.GroupHeaderGrid.prototype.getDragDropData.call(this,B,E,D);if(C===false){return false}var A=C.px+this.proxyOffsets[0];this.proxyTop.setLeftTop(A,C.r.top+this.proxyOffsets[1]);this.proxyTop.show();this.proxyBottom.setLeftTop(A,C.r.bottom);this.proxyBottom.show();return C.pt},onNodeDrop:function(I,T,O,V){var N=V.header;if(N!=I){var Q=Wtf.GroupHeaderGrid.prototype.getDragDropData.call(this,N,I,O);if(Q===false){return false}var E=this.grid.colModel,S=Q.oldIndex<Q.newIndex,F=E.rows;for(var C=Q.row,J=F.length;C<J;C++){var G=F[C],M=G.length,U=0,K=1,W=M;for(var L=0,H=0;L<M;L++){var D=G[L];if(Q.oldIndex>=H&&Q.oldIndex<H+D.colspan){U=L}if(Q.oldIndex+Q.colspan-1>=H&&Q.oldIndex+Q.colspan-1<H+D.colspan){K=L-U+1}if(Q.newIndex>=H&&Q.newIndex<H+D.colspan){W=L}H+=D.colspan}var P=G.splice(U,K);F[C]=G.splice(0,W-(S?K:0)).concat(P).concat(G)}for(var R=0;R<Q.colspan;R++){var B=Q.oldIndex+(S?0:R),A=Q.newIndex+(S?-1:R);E.moveColumn(B,A);this.grid.fireEvent("columnmove",B,A)}return true}return false}},getGroupStyle:function(G,C){var E=0,F=true;for(var D=C,A=C+G.colspan;D<A;D++){if(!this.cm.isHidden(D)){var B=this.cm.getColumnWidth(D);if(typeof B=="number"){E+=B}F=false}}return{width:(Wtf.isBorderBox?E:Math.max(E-this.borderWidth,0))+"px",hidden:F}},updateGroupStyles:function(B){var G=this.mainHd.query(".x-grid3-header-offset > table"),E=this.getTotalWidth(),J=this.cm.rows;for(var I=0;I<G.length;I++){G[I].style.width=E;if(I<J.length){var H=G[I].firstChild.firstChild.childNodes;for(var D=0,C=0;D<H.length;D++){var F=J[I][D];if((typeof B!="number")||(B>=C&&B<C+F.colspan)){var A=Wtf.GroupHeaderGrid.prototype.getGroupStyle.call(this,F,C);H[D].style.width=A.width;H[D].style.display=A.hidden?"none":""}C+=F.colspan}}}},getGroupRowIndex:function(B){if(B){var A=B.className.match(this.hrowRe);if(A&&A[1]){return parseInt(A[1],10)}}return this.cm.rows.length},getGroupSpan:function(G,C){if(G<0){return{col:0,colspan:this.cm.getColumnCount()}}var E=this.cm.rows[G];if(E){for(var D=0,B=0,A=E.length;D<A;D++){var F=E[D];if(C>=B&&C<B+F.colspan){return{col:B,colspan:F.colspan}}B+=F.colspan}return{col:B,colspan:0}}return{col:C,colspan:1}},getDragDropData:function(E,D,F){if(E.parentNode!=D.parentNode){return false}var K=this.grid.colModel;var I=Wtf.lib.Event.getPageX(F);var A=Wtf.lib.Dom.getRegion(D.firstChild);var J,N;if((A.right-I)<=(A.right-A.left)/2){J=A.right+this.view.borderWidth;N="after"}else{J=A.left;N="before"}var H=this.view.getCellIndex(E);var L=this.view.getCellIndex(D);if(K.isFixed(L)){return false}var M=Wtf.GroupHeaderGrid.prototype.getGroupRowIndex.call(this.view,E);var B=Wtf.GroupHeaderGrid.prototype.getGroupSpan.call(this.view,M,H);var C=Wtf.GroupHeaderGrid.prototype.getGroupSpan.call(this.view,M,L);H=B.col;L=C.col+(N=="after"?C.colspan:0);if(L>=B.col&&L<=B.col+B.colspan){return false}var G=Wtf.GroupHeaderGrid.prototype.getGroupSpan.call(this.view,M-1,H);if(L<G.col||L>G.col+G.colspan){return false}return{r:A,px:J,pt:N,row:M,oldIndex:H,newIndex:L,colspan:B.colspan}}});Wtf.lms.WtfLmsModuleAttendanceList=function(A){Wtf.apply(this,A);this.fromDate=new Wtf.MonthField({hidden:this.hideDate});this.venueRecord=Wtf.data.Record.create([{name:"vname",type:"string"},{name:"id",type:"string"},{name:"timezone"}]);this.venueReader=new Wtf.data.JsonReader({root:"data"},this.venueRecord);this.venueStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/LacaStructure.jsp"}),reader:this.venueReader});this.venueCombo=new Wtf.form.ComboBox({id:"venuess"+this.id,store:this.venueStore,editable:false,displayField:"vname",mode:"local",triggerAction:"all",emptyText:"Select a venue...",fieldLabel:"Venue",name:"venueid",valueField:"id",width:125,listWidth:140,hidden:this.hideVenue});this.classTypeStore=new Wtf.data.Store({url:"jspfiles/newCourse.jsp",reader:new Wtf.data.JsonReader({fields:[{name:"typeid",type:"string"},{name:"classtype",type:"string"}],root:"data"})});this.ctypeCombo=new Wtf.form.ComboBox({id:"ctype"+this.id,store:this.classTypeStore,editable:false,valueField:"typeid",displayField:"classtype",mode:"local",triggerAction:"all",emptyText:"Select a type...",fieldLabel:"Classroom Type",name:"ctype",hidden:this.hideClass});this.facRecord=Wtf.data.Record.create([{name:"username",type:"string"},{name:"id",type:"string"}]);this.facReader=new Wtf.data.KwlJsonReader({root:"data"},this.facRecord);this.facStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/newClass.jsp"}),reader:this.facReader});this.facCombo=new Wtf.form.ComboBox({id:"facc11"+this.id,store:this.facStore,editable:false,displayField:"username",mode:"local",triggerAction:"all",emptyText:"Select faculty...",fieldLabel:"Faculty",name:"facid",width:145,listWidth:165,valueField:"id",disabled:this.hideFaculty,hidden:this.hideFaculty});this.submitBttn=new Wtf.Toolbar.Button({text:"Submit",scope:this,handler:function(){this.northP.remove(this.grid);this.loadMask.hide();this.loadGrid()}});this.clearBttn=new Wtf.Toolbar.Button({text:"Clear Filter",scope:this,handler:function(){this.fromDate.reset();this.venueCombo.reset();this.ctypeCombo.reset();this.facCombo.reset();this.northP.remove(this.grid)}});this.csv=new Wtf.Toolbar.Button({text:"Export",scope:this,handler:function(){if(this.ds.getCount()>0){var B=Wtf.urlEncode({mode:this.mode,moduleid:this.moduleid,date:(!this.hideDate)?this.fromDate.getValue().format("Y-m-d"):this.date,venueid:(!this.hideVenue)?this.venueCombo.getValue():this.venueid,classtype:(!this.hideClass)?this.ctypeCombo.getValue():this.classtype,facid:(!this.hideFaculty)?this.facCombo.getValue():this.faculty,classcount:this.classcount,type:"reports",dtype:"attachment",report:this.mode});setDldUrl("fileDownload.jsp?"+B)}}});this.print=new Wtf.Toolbar.Button({text:"Print",scope:this,handler:function(){var B=Wtf.urlEncode({mode:this.mode,moduleid:this.moduleid,date:(!this.hideDate)?this.fromDate.getValue().format("Y-m-d"):this.date,venueid:(!this.hideVenue)?this.venueCombo.getValue():this.venueid,classtype:(!this.hideClass)?this.ctypeCombo.getValue():this.classtype,facid:(!this.hideFaculty)?this.facCombo.getValue():this.faculty,classcount:this.classcount,fileName:"Student_Attendance_List.pdf"});setDldUrl("ReportsServlet.jsp?"+B)}});Wtf.lms.WtfLmsModuleAttendanceList.superclass.constructor.call(this,{layout:"fit",border:false,tbar:this.getTbar(),bbar:[this.print,"-",this.csv],items:[this.northP=new Wtf.Panel({border:false,layout:"fit"})]})};Wtf.extend(Wtf.lms.WtfLmsModuleAttendanceList,Wtf.Panel,{onRender:function(A){Wtf.lms.WtfLmsModuleAttendanceList.superclass.onRender.call(this,A);if(!this.hideVenue){this.venueStore.load({params:{flag:80,moduleid:this.moduleid}})}if(!this.hideClass){this.classTypeStore.load({params:{type:"programsessionclasstype",progid:this.programid}})}if(!this.hideFaculty){this.facStore.baseParams={type:"facvenue"};this.facStore.load({params:{moduleid:this.moduleid,userid:loginid}})}this.loadMask=new Wtf.LoadMask(this.id,{msg:"Loading..."})},getTbar:function(){var A=new Array();if(!this.hideDate){A.push("Month ");A.push(this.fromDate);A.push("-")}if(!this.hideClass){A.push("Class Type");A.push(this.ctypeCombo);A.push("-")}if(!this.hideFaculty){A.push("Faculty");A.push(this.facCombo);A.push("-")}if(!this.hideVenue){A.push("Venue");A.push(this.venueCombo);A.push("-")}A.push(this.submitBttn);A.push(this.clearBttn);return A},loadGrid:function(){Wtf.Ajax.requestEx({url:"jspfiles/reportNew.jsp",method:"POST",params:{mode:15,moduleid:this.moduleid,date:(!this.hideDate)?this.fromDate.getValue().format("Y-m-d"):this.date,venueid:(!this.hideVenue)?this.venueCombo.getValue():this.venueid,classtype:(!this.hideClass)?this.ctypeCombo.getValue():this.classtype,facid:(!this.hideFaculty)?this.facCombo.getValue():this.faculty,classcount:this.classcount}},this,function(request,response){if(request!=null&&request!=""){var resObj=eval("("+request.trim()+")");if(resObj){if(resObj.data!==undefined){var jreader=new Wtf.data.DynamicJsonReader({});jreader.readRecords(resObj.data);this.ds=new Wtf.data.Store({reader:jreader});this._reader=jreader;this.ds.recordType=jreader.recordType;this.ds.fields=jreader.recordType.prototype.fields;this.cm=new Wtf.grid.DynamicColumnModel5(this.ds);this.grid=new Wtf.grid.GridPanel({loadMask:this.loadMask,border:false,store:this.ds,enableColumnHide:false,enableColumnMove:false,cm:this.cm,sm:this.examSM,viewConfig:{autoFill:true}});this.northP.add(this.grid);this.ds.loadData(resObj.data)}this.doLayout();this.loadMask.hide()}}},function(resp,req){this.loadMask.hide()})}})