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(B,A){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(E,D){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(L,K){var G=Wtf.decode(L);if(G["res"]==0){this.ds.reload()}else{var I=G["res"];var F=I.split(",");var H="";for(var J=0;J<F.length;J++){H+=F[J]+"<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(C,D,A){var B=Wtf.getCmp(C);if(!B){B=new D(A);this.ownerCt.add(B);this.ownerCt.doLayout()}this.ownerCt.setActiveTab(B);B.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,E,G,C,B){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(H,G){var I=Wtf.decode(H.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(F,E){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(C,D,A){var B=Wtf.getCmp(C);if(!B){B=new D(A);this.ownerCt.add(B);this.ownerCt.doLayout()}this.ownerCt.setActiveTab(B)},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)}})