From 4e70de294b112aa8dd2c29ac026162eae4a1883f Mon Sep 17 00:00:00 2001
From: "ghendricks%novell.com"
Date: Tue, 23 Dec 2008 20:02:12 +0000
Subject: [PATCH] Double escaped URL components
git-svn-id: svn://10.0.0.236/trunk@255627 18797224-902f-48f8-a5cc-f745e15eee43
---
mozilla/webtools/testopia/testopia/js/util.js | 2 +-
mozilla/webtools/testopia/testopia/testopia.all.js | 2 +-
mozilla/webtools/testopia/testopia/testopia.all.ycomp.js | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mozilla/webtools/testopia/testopia/js/util.js b/mozilla/webtools/testopia/testopia/js/util.js
index 3bec5435f93..bf13a7ce78f 100755
--- a/mozilla/webtools/testopia/testopia/js/util.js
+++ b/mozilla/webtools/testopia/testopia/js/util.js
@@ -1546,7 +1546,7 @@ linkPopup = function(params){
plain: true,
shadow: false,
items: [new Ext.form.TextField({
- value: encodeURI(l.protocol + '//' + l.host + pathprefix + '/' + file + '?' + jsonToSearch(params,'',['ctype'])),
+ value: l.protocol + '//' + l.host + pathprefix + '/' + file + '?' + jsonToSearch(params,'',['ctype']),
width: 287
})]
});
diff --git a/mozilla/webtools/testopia/testopia/testopia.all.js b/mozilla/webtools/testopia/testopia/testopia.all.js
index d3739031cf0..0e996c5c164 100644
--- a/mozilla/webtools/testopia/testopia/testopia.all.js
+++ b/mozilla/webtools/testopia/testopia/testopia.all.js
@@ -1588,7 +1588,7 @@ linkPopup = function(params){
plain: true,
shadow: false,
items: [new Ext.form.TextField({
- value: encodeURI(l.protocol + '//' + l.host + pathprefix + '/' + file + '?' + jsonToSearch(params,'',['ctype'])),
+ value: l.protocol + '//' + l.host + pathprefix + '/' + file + '?' + jsonToSearch(params,'',['ctype']),
width: 287
})]
});
diff --git a/mozilla/webtools/testopia/testopia/testopia.all.ycomp.js b/mozilla/webtools/testopia/testopia/testopia.all.ycomp.js
index b7be4cc2bd8..43e0dc50d77 100644
--- a/mozilla/webtools/testopia/testopia/testopia.all.ycomp.js
+++ b/mozilla/webtools/testopia/testopia/testopia.all.ycomp.js
@@ -1 +1 @@
-ATTACHMENT_DELETE_WARNING="You are about to remove the selected attachments. This cannot be undone. Continue?";CASE_CATEGORY_DELETE_WARNING="You are about to delete the selected test case category. Are you sure you want to continue?";CASE_DELETE_WARNING="You are about to delete the selected test cases including all children and history. This action cannot be undone. Are you sure you want to continue?";PLAN_DELETE_WARNING="You are about to delete the selected test plans including all children and history. This action cannot be undone. Are you sure you want to continue?";RUN_DELETE_WARNING="You are about to delete the selected test runs including all children and history. This action cannot be undone. Are you sure you want to continue?";CASERUN_DELETE_WARNING="You are about to remove the selected test cases from this run including all history. This action cannot be undone. Are you sure you want to continue?";ENVIRONMENT_DELETE_WARNING="You are about to delete the selected test environment including associated test case data. This action cannot be undone. Are you sure you want to continue?";Ext.state.Manager.setProvider(new Ext.state.CookieProvider({expires:new Date(new Date().getTime()+(1000*60*60*24*30))}));Ext.data.Connection.timeout=120000;Ext.Updater.defaults.timeout=120000;Ext.Ajax.timeout=120000;var Testopia={};Testopia.Util={};Testopia.Environment={};Ext.grid.CheckColumn=function(A){Ext.apply(this,A);if(!this.id){this.id=Ext.id()}this.renderer=this.renderer.createDelegate(this)};Ext.grid.CheckColumn.prototype={init:function(A){this.grid=A;this.grid.on("render",function(){var B=this.grid.getView();B.mainBody.on("mousedown",this.onMouseDown,this)},this)},onMouseDown:function(D,C){if(C.className&&C.className.indexOf("x-grid3-cc-"+this.id)!=-1){D.stopEvent();var B=this.grid.getView().findRowIndex(C);var A=this.grid.store.getAt(B);A.set(this.dataIndex,!A.data[this.dataIndex])}},renderer:function(B,C,A){C.css+=" x-grid3-check-col-td";return'
'}};TestopiaUtil=function(){this.statusIcon=function(B){return''};this.caseLink=function(G,B,F,C,D,E){if(E.isTreport===true){return''+G+""}return''+G+""};this.runLink=function(G,B,F,C,D,E){if(E.isTreport===true){return''+G+""}return''+G+""};this.planLink=function(G,B,F,C,D,E){if(E.isTreport===true){return''+G+""}return''+G+""};this.bugLink=function(G,B,F,C,D,E){if(E.isTreport===true){return''+G+""}return''+G+""};this.newRunPopup=function(C){var B=new Ext.Window({id:"newRun-win",closable:true,width:Ext.getBody().getViewSize().width-150,height:Ext.getBody().getViewSize().height-150,plain:true,shadow:false,layout:"fit",items:[new NewRunForm(C)]});B.show(this)};this.newCaseForm=function(E,C,B){var D=new Ext.Window({id:"newcase-win",closable:true,width:Ext.getBody().getViewSize().width-150,height:Ext.getBody().getViewSize().height-150,plain:true,shadow:false,layout:"fit",items:[new NewCaseForm(E,C,B)]});D.show(this)};this.addCaseToRunPopup=function(C){var B=new Ext.Window({id:"add_case_to_run_win",closable:true,width:Ext.getBody().getViewSize().width-150,height:Ext.getBody().getViewSize().height-150,plain:true,shadow:false,layout:"fit",items:[new AddCaseToRunForm(C)]});B.show(this)};this.newPlanPopup=function(B){var C=new Ext.Window({id:"newplan-win",closable:true,width:800,height:550,plain:true,shadow:false,layout:"fit",items:[new NewPlanForm(B)]});C.show(this)};addOption=function(B,C){try{B.add(C,null)}catch(D){B.add(C,B.length)}};lsearch=function(D,B){if(typeof B!="object"){if(B==D){return true}return false}for(var C in B){if(B[C]==D){return true}}return false};this.addOption=addOption;var A=function(H,C){var E=searchToJson(window.location.search);if(C){E.product=C}for(var D in H.selectTypes){if(typeof H.selectTypes[D]!="function"){try{document.getElementById(H.selectTypes[D]).options.length=0;for(var B in H[H.selectTypes[D]]){if(typeof H[H.selectTypes[D]][B]!="function"){var G=new Option(H[H.selectTypes[D]][B],H[H.selectTypes[D]][B],false,lsearch(H[H.selectTypes[D]][B],E[H.selectTypes[D]]));addOption(document.getElementById(H.selectTypes[D]),G)}}document.getElementById(H.selectTypes[D]).disabled=false;document.getElementById(H.selectTypes[D])}catch(F){}}}};this.fillSelects=A;this.onProductSelection=function(B){var E=[];for(var C=0;C
','
',"
");UserLookup=function(A){UserLookup.superclass.constructor.call(this,{id:A.id||"user_lookup",store:new Ext.data.JsonStore({url:"tr_quicksearch.cgi",baseParams:{action:"getuser"},root:"users",totalProperty:"total",id:"login",fields:[{name:"login",mapping:"id"},{name:"name",mapping:"name"}]}),listeners:{valid:function(B){B.value=B.getRawValue()},beforequery:function(C){if(A.multistring){var B=C.query.match(/(^.*),(.*)/);if(B){C.combo.multivalue=B[1];C.query=B[2]}}},select:function(E,D,C){if(A.multistring){var B=E.multivalue||"";B=B?B+", "+D.get("login"):D.get("login");E.setValue(B)}}},queryParam:"search",loadingText:"Looking up users...",displayField:"login",valueField:"login",typeAhead:true,hideTrigger:true,minListWidth:300,forceSelection:false,emptyText:"Type a username...",pageSize:20,tpl:'
{name}
{login}
'});Ext.apply(this,A)};Ext.extend(UserLookup,Ext.form.ComboBox);TagLookup=function(A){TagLookup.superclass.constructor.call(this,{id:A.id||"tag_lookup",store:new Ext.data.JsonStore({url:"tr_quicksearch.cgi",baseParams:{action:"gettag"},root:"tags",totalProperty:"total",fields:[{name:"id",mapping:"tag_id"},{name:"name",mapping:"tag_name"}]}),queryParam:"search",loadingText:"Looking up tags...",displayField:"name",valueField:"id",typeAhead:false,hiddenName:"tag",hideTrigger:true,minListWidth:300,minChars:2,width:150,editable:true,forceSelection:false,emptyText:"Type a tagname...",listeners:{specialkey:function(B,C){if(C.getKey()==C.ENTER){Ext.getCmp("tag_add_btn").fireEvent("click")}}}});Ext.apply(this,A)};Ext.extend(TagLookup,Ext.form.ComboBox);BuildCombo=function(A){BuildCombo.superclass.constructor.call(this,{id:A.id||"build_combo",store:A.transform?false:new BuildStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up builds...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Builds..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(BuildCombo,Ext.form.ComboBox);CaseCategoryCombo=function(A){CaseCategoryCombo.superclass.constructor.call(this,{id:A.id||"case_category_combo",store:A.transform?false:new CaseCategoryStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up categories...",displayField:"name",valueField:"category_id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(CaseCategoryCombo,Ext.form.ComboBox);EnvironmentCombo=function(A){if(A.params){A.params.viewall=1}EnvironmentCombo.superclass.constructor.call(this,{id:A.id||"environment_combo",store:A.transform?false:new EnvironmentStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up environments...",displayField:"name",valueField:"environment_id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Environments..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(EnvironmentCombo,Ext.form.ComboBox);ProductCombo=function(A){ProductCombo.superclass.constructor.call(this,{id:A.id||"product_combo",store:A.transform?false:new ProductStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up products...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(ProductCombo,Ext.form.ComboBox);ProductVersionCombo=function(A){ProductVersionCombo.superclass.constructor.call(this,{id:A.id||"product_version_combo",store:A.transform?false:new ProductVersionStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up versions...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(ProductVersionCombo,Ext.form.ComboBox);CaseRunStatusCombo=function(A){CaseRunStatusCombo.superclass.constructor.call(this,{id:A.id||"case_run_status_combo",store:A.transform?false:new CaseRunStatusStore(A.mode=="local"?true:false),loadingText:"Looking up statuses...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(CaseRunStatusCombo,Ext.form.ComboBox);CaseStatusCombo=function(A){CaseStatusCombo.superclass.constructor.call(this,{id:A.id||"case_status_combo",store:A.transform?false:new CaseStatusStore(A.mode=="local"?true:false),loadingText:"Looking up statuses...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:100,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(CaseStatusCombo,Ext.form.ComboBox);ComponentCombo=function(A){ComponentCombo.superclass.constructor.call(this,{id:A.id||"component_combo",store:A.transform?false:new ComponentStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up Components...",displayField:"name",valueField:"id",editable:false,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(ComponentCombo,Ext.form.ComboBox);MilestoneCombo=function(A){MilestoneCombo.superclass.constructor.call(this,{id:A.id||"milestone_combo",store:A.transform?false:new MilestoneStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up milestones...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(MilestoneCombo,Ext.form.ComboBox);PlanTypesCombo=function(A){PlanTypesCombo.superclass.constructor.call(this,{id:A.id||"plan_type_combo",store:A.transform?false:new PlanTypesStore(A.mode=="local"?true:false),loadingText:"Looking up types...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(PlanTypesCombo,Ext.form.ComboBox);PriorityCombo=function(A){PriorityCombo.superclass.constructor.call(this,{id:A.id||"priority_combo",store:A.transform?false:new PriorityStore(A.mode=="local"?true:false),loadingText:"Looking up priorities...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:100,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(PriorityCombo,Ext.form.ComboBox);RunProgress=function(A){RunProgress.superclass.constructor.call(this,A)};Ext.extend(RunProgress,Ext.ProgressBar,{onRender:function(C,A){Ext.ProgressBar.superclass.onRender.call(this,C,A);var B=new Ext.Template('
','
','','','','
',"
","
",'
',"
","
","
","
");if(A){this.el=B.insertBefore(A,{cls:this.baseCls},true)}else{this.el=B.append(C,{cls:this.baseCls},true)}if(this.id){this.el.dom.id=this.id}this.progressBar=Ext.get(this.el.dom.firstChild);this.gbar=Ext.get(this.progressBar.dom.firstChild);this.rbar=Ext.get(this.gbar.dom.nextSibling);this.obar=Ext.get(this.rbar.dom.nextSibling);if(this.textEl){this.textEl=Ext.get(this.textEl);delete this.textTopEl}else{this.textTopEl=Ext.get(this.progressBar.dom.childNodes[3]);var D=Ext.get(this.progressBar.dom.childNodes[4]);this.textTopEl.setStyle("z-index",99).addClass("x-hidden");this.textEl=new Ext.CompositeElement([this.textTopEl.dom.firstChild,D.dom.firstChild]);this.textEl.setWidth(this.progressBar.offsetWidth)}if(this.gvalue||this.rvalue||this.ovalue){this.updateProgress(this.gvalue,this.rvalue,this.ovalue,this.text)}else{this.updateText(this.text)}this.setSize(this.width||"auto","auto");this.progressBar.setHeight(this.progressBar.offsetHeight)},updateProgress:function(C,B,D,G){this.gvalue=C||0;this.rvalue=B||0;this.ovalue=D||0;if(G){this.updateText(G)}var F=Math.floor(C*this.el.dom.firstChild.offsetWidth);var E=Math.floor(B*this.el.dom.firstChild.offsetWidth);var A=Math.floor(D*this.el.dom.firstChild.offsetWidth);this.gbar.setWidth(F);this.rbar.setWidth(E);this.obar.setWidth(A);return this},setSize:function(A,B){Ext.ProgressBar.superclass.setSize.call(this,A,B);if(this.textTopEl){this.textEl.setSize(this.el.dom.offsetWidth,this.el.dom.offsetHeight)}return this}});DocCompareToolbar=function(B,C){var A=new Ext.data.JsonStore({url:"tr_history.cgi",baseParams:{action:"getdocversions",object:B,object_id:C},root:"list",fields:[{name:"id",mapping:"id"},{name:"name",mapping:"name"}]});this.toolbar=new Ext.Toolbar({id:"doc_compare_tbar",items:[new Ext.Toolbar.Fill(),new Ext.form.ComboBox({id:"doc_view",store:A,displayField:"name",valueField:"id",width:50,triggerAction:"all"}),{xtype:"button",id:"doc_view_btn",text:"View Version",handler:function(){var D=Ext.getCmp("object_panel").add({title:"Version "+Ext.getCmp("doc_view").getValue(),closable:true,autoScroll:true});D.show();D.load({url:"tr_history.cgi",params:{action:"showdoc",object:B,object_id:C,version:Ext.getCmp("doc_view").getValue()},failure:testopiaError})}}]});return this.toolbar};HistoryGrid=function(A,B){this.store=new Ext.data.JsonStore({url:"tr_history.cgi",baseParams:{action:"show",object:A,object_id:B},root:"list",fields:[{name:"what",mapping:"what"},{name:"who",mapping:"who"},{name:"oldvalue",mapping:"oldvalue"},{name:"newvalue",mapping:"newvalue"},{name:"when",mapping:"changed"}]});this.columns=[{header:"What",width:150,dataIndex:"what",sortable:true},{header:"Who",width:180,sortable:true,dataIndex:"who"},{header:"When",width:150,sortable:true,dataIndex:"when"},{header:"Old",width:180,sortable:true,dataIndex:"oldvalue"},{id:"new",header:"New",width:180,sortable:true,dataIndex:"newvalue"}];HistoryGrid.superclass.constructor.call(this,{title:"Change History",id:"history-grid",layout:"fit",loadMask:{msg:"Loading History..."},autoExpandColumn:"new",autoScroll:true,sm:new Ext.grid.RowSelectionModel({singleSelect:false})});this.on("rowcontextmenu",this.onContextClick,this);this.on("activate",this.onActivate,this)};Ext.extend(HistoryGrid,Ext.grid.GridPanel,{onActivate:function(){if(!this.store.getCount()){this.store.load()}},onContextClick:function(B,A,C){if(!this.menu){this.menu=new Ext.menu.Menu({id:"history-ctx-menu",items:[{text:"Refresh",icon:"testopia/img/refresh.png",iconCls:"img_button_16x",handler:function(){B.store.reload()}}]})}C.stopEvent();this.menu.showAt(C.getXY())}});Ext.override(Ext.form.Field,{fireKey:function(A){if(((Ext.isIE&&A.type=="keydown")||A.type=="keypress")&&A.isSpecialKey()){this.fireEvent("specialkey",this,A)}else{this.fireEvent(A.type,this,A)}},initEvents:function(){this.el.on("focus",this.onFocus,this);this.el.on("blur",this.onBlur,this);this.el.on("keydown",this.fireKey,this);this.el.on("keypress",this.fireKey,this);this.el.on("keyup",this.fireKey,this);this.originalValue=this.getValue()}});var TestopiaPager=function(D,B){this.type=D;function G(){this.updateInfo()}function F(){this.cursor=0;this.afterTextEl.el.innerHTML=String.format(this.afterPageText,1);this.field.dom.value=1;this.updateInfo()}var E=new Ext.form.ComboBox({store:new Ext.data.SimpleStore({fields:["value","name"],id:0,data:[[25,25],[50,50],[100,100],[500,500]],autoLoad:true}),id:D+"_page_sizer",mode:"local",displayField:"name",valueField:"value",triggerAction:"all",editable:false,width:50});E.on("select",function(J,I,H){this.pageSize=I.get("value");Ext.state.Manager.set("TESTOPIA_DEFAULT_PAGE_SIZE",I.get("value"));B.baseParams.limit=I.get("value");B.load({params:{start:0},callback:G.createDelegate(this)})},this);this.sizer=E;var A=new Ext.Button({text:"View All",enableToggle:true});A.on("toggle",function(H,I){if(I){this.pageSize=0;B.load({params:{viewall:1},callback:F.createDelegate(this)})}else{this.pageSize=E.getValue();B.load({params:{start:0,limit:E.getValue()}})}},this);var C=new Ext.form.TextField({allowBlank:true,id:D+"_paging_filter",selectOnFocus:true});C.on("specialkey",function(L,M){var I=M.getKey();if(I==M.ENTER){var N={start:0,limit:E.getValue()};var J=this.getValue();var H=J.match(/(^.*?):/);if(H){H=H[1];var K=Testopia.Util.trim(J.substr(J.indexOf(":")+1,J.length));if(H.match(/^start/i)){H="start_date"}if(H.match(/^stop/i)){H="stop_date"}if(H.match(/^manager/i)){H="manager"}switch(H){case"status":if(D=="case"){H="case_status"}else{if(D=="caserun"){H="case_run_status"}else{H="run_status";if(K.match(/running/i)){K=0}else{K=1}}}break;case"tester":H="default_tester";break;case"plan":H="plan_id";break;case"case":H="case_id";break;case"run":H="run_id";break;case"product_version":H="default_product_version";break}N[H]=K;N[H+"_type"]="substring"}else{if(D=="case"||D=="run"){N.summary=this.getValue();N.summary_type="allwordssubst"}else{if(D=="caserun"){N.case_summary=this.getValue();N.case_summary_type="allwordssubst"}else{N.name=this.getValue();N.name_type="allwordssubst"}}}B.load({params:N})}if((I==M.BACKSPACE||I==M.DELETE)&&this.getValue().length===0){B.load({params:{start:0,limit:E.getValue()}})}});E.on("render",function(){var H=new Ext.ToolTip({target:D+"_paging_filter",title:"Quick Search Filter",hideDelay:"500",html:"Enter column and search term separated by ':' Example: priority: P3"})});TestopiaPager.superclass.constructor.call(this,{id:D+"_pager",pageSize:Ext.state.Manager.get("TESTOPIA_DEFAULT_PAGE_SIZE",25),displayInfo:true,displayMsg:"Displaying test "+D+"s {0} - {1} of {2}",emptyMsg:"No test "+D+"s were found",store:B,items:[new Ext.menu.TextItem("Filter: "),C,new Ext.Toolbar.Spacer("_"),new Ext.Toolbar.Separator(),new Ext.menu.TextItem("View "),new Ext.Toolbar.Spacer("_"),E,new Ext.Toolbar.Spacer("_"),A,new Ext.Toolbar.Spacer("_"),new ToolbarText({text:"(FILTERED)",hidden:true,id:"filtered_txt",style:"font-weight:bold;color:red"})]});this.on("render",this.setPager,this);this.cursor=0};Ext.extend(TestopiaPager,Ext.PagingToolbar,{setPager:function(){Ext.getCmp(this.type+"_page_sizer").setValue(Ext.state.Manager.get("TESTOPIA_DEFAULT_PAGE_SIZE",25))}});var ToolbarText=function(A){ToolbarText.superclass.constructor.call(this,{id:A.id,text:A.text,style:A.style,hidden:A.hidden})};Ext.extend(ToolbarText,Ext.menu.BaseItem,{hideOnClick:false,itemCls:"x-menu-text",onRender:function(){var A=document.createElement("span");A.className=this.itemCls;A.innerHTML=this.text;this.el=A;Ext.menu.TextItem.superclass.onRender.apply(this,arguments)}});DashboardPanel=function(A){DashboardPanel.superclass.constructor.call(this,{title:A.title||"Dashboard",layout:"fit",closable:A.closable||false,id:A.id||"dashboardpanel",tbar:[{xtype:"button",text:"Add Custom Panel",handler:function(B,C){Ext.Msg.prompt("Enter URL","",function(E,G){if(E=="ok"){var D=G+"&noheader=1";Testopia.Search.dashboard_urls.push(D);var F=new Ext.ux.Portlet({title:"Custom",closable:true,autoScroll:true,tools:PortalTools,url:D});Ext.getCmp("dashboard_leftcol").add(F);Ext.getCmp("dashboard_leftcol").doLayout();F.load({url:D,scripts:false})}})}},new Ext.Toolbar.Fill()],items:[{xtype:"portal",margins:"35 5 5 0",items:[{columnWidth:0.5,baseCls:"x-plain",bodyStyle:"padding:10px 10px 10px 10px",id:A.lc||"dashboard_leftcol",items:[{title:" ",hidden:true}]},{columnWidth:0.5,baseCls:"x-plain",bodyStyle:"padding:10px 10px 10px 10px",id:A.rc||"dashboard_rightcol",items:[{title:" ",hidden:true}]}]}]});this.on("activate",this.onActivate,this)};Ext.extend(DashboardPanel,Ext.Panel,{onActivate:function(A){A.doLayout()}});TestopiaUpdateMultiple=function(B,D,A){var C=new Ext.form.BasicForm("testopia_helper_frm",{});D.ctype="json";D.action="update";C.submit({url:"tr_list_"+B+"s.cgi",params:D,success:function(G,E){if(B=="caserun"){Ext.getCmp("run_progress").updateProgress(E.result.passed,E.result.failed,E.result.blocked,E.result.complete)}TestopiaUtil.notify.msg("Test "+B+"s updated","The selected {0}s were updated successfully",B);if(A.selectedRows){A.store.baseParams.addcases=A.selectedRows.join(",");Ext.getCmp("filtered_txt").show()}try{Ext.getCmp("case_details_panel").store.reload()}catch(F){}A.store.reload({callback:function(){if(A.selectedRows){var K=A.getSelectionModel();var J=[];for(var I=0;I=0){J.push(H)}}K.selectRows(J);if(K.getCount()<1){Ext.getCmp("case_details_panel").disable()}}}})},failure:function(F,E){testopiaError(F,E);A.store.reload({callback:function(){if(A.selectedRows){A.getSelectionModel().selectRows(A.selectedRows)}}})}})};TestopiaComboRenderer=function(B,F,E,A,C,D){f=this.getColumnModel().getCellEditor(C,A).field;record=f.store.getById(B);if(record){return record.data[f.displayField]}else{return B}};testopiaError=function(C,A){C.el.unmask();var B;if(A.response.status&&A.response.status!=200){B={title:"System Error!",msg:A.response.responseText,buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR,minWidth:400}}else{B={title:"An Error Has Occurred",msg:A.result.message,buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR,minWidth:400}}Ext.Msg.show(B)};testopiaLoadError=function(){Ext.Msg.show({title:"An Error Has Occurred",msg:"There was an error loading the data",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})};getSelectedObjects=function(C,F){var E=C.getSelectionModel().getSelections();var A=[];var D;for(var B=0;B")}else{if(B=="custom"){D=E;E={report:true};A=1}else{if(B=="caserun"){E.current_tab="case_run"}else{E.current_tab=B}if(E.report){D="tr_"+B+"_reports.cgi?";A=1}else{D="tr_list_"+B+"s.cgi?";A=0}D=D+jsonToSearch(E,"",["ctype"])}}var C=new Ext.form.BasicForm("testopia_helper_frm",{});Ext.Msg.prompt("Save As","",function(F,G){if(F=="ok"){C.submit({url:"tr_query.cgi",params:{action:"save_query",query_name:G,query_part:D,type:A},success:function(){if(Ext.getCmp("searches_grid")){Ext.getCmp("searches_grid").store.load()}if(Ext.getCmp("reports_grid")){Ext.getCmp("reports_grid").store.load()}if(Ext.getCmp("dashboard_grid")){Ext.getCmp("dashboard_grid").store.load()}TestopiaUtil.notify.msg("Saved","Your search or report was saved.")},failure:testopiaError})}})};linkPopup=function(E){if(E.current_tab=="case_run"){E.current_tab="caserun"}var B;if(E.report==1){B="tr_"+E.current_tab+"_reports.cgi"}else{B="tr_list_"+E.current_tab+"s.cgi"}var A=window.location;var C=A.pathname.match(/(.*)[\/\\]([^\/\\]+\.\w+)$/);C=C[1];var D=new Ext.Window({width:300,plain:true,shadow:false,items:[new Ext.form.TextField({value:encodeURI(A.protocol+"//"+A.host+C+"/"+B+"?"+jsonToSearch(E,"",["ctype"])),width:287})]});D.show()};searchToJson=function(A){A=A.replace(/.*\//,"");var H={};var G=A.split("?",2);var D=G[0];var C=G[1]?G[1]:D;var E=C.split("&");for(var B=0;B','
"}),new Ext.Toolbar.Spacer(),new Ext.Toolbar.Separator(),new Ext.Toolbar.Spacer(),C,new Ext.Toolbar.Spacer(),H,new Ext.Toolbar.Spacer(),new Ext.Toolbar.Separator(),new Ext.Toolbar.Spacer(),new Ext.Toolbar.Fill(),{xtype:"button",id:"add_case_to_run_btn",tooltip:"Add cases to this run",icon:"testopia/img/add.png",iconCls:"img_button_16x",handler:function(){I.addCaseToRunPopup(D)}},{xtype:"button",id:"new_case_to_run_btn",tooltip:"Create a new case and add it to this run",icon:"testopia/img/new.png",iconCls:"img_button_16x",handler:function(){I.newCaseForm(D.plan_id,D.product_id,D.run_id)}},{xtype:"button",template:button_16x_tmpl,id:"caserun_grid_edit_btn",icon:"testopia/img/edit.png",iconCls:"img_button_16x",tooltip:"Edit Selected Test Case",handler:function(){editFirstSelection(Ext.getCmp("caserun_grid"))}},{xtype:"button",template:button_16x_tmpl,id:"caserun_grid_delete_btn",icon:"testopia/img/delete.png",iconCls:"img_button_16x",tooltip:"Remove Selected Test Cases from This Run",handler:this.deleteList.createDelegate(this)},new RunProgress({id:"run_progress",text:"0%",width:100})]});CaseRunGrid.superclass.constructor.call(this,{region:"center",id:"caserun_grid",border:false,bodyBorder:false,height:"400",stripeRows:true,split:true,enableDragDrop:true,loadMask:{msg:"Loading Test Cases..."},autoExpandColumn:"case_summary",autoScroll:true,sm:new Ext.grid.RowSelectionModel({singleSelect:false,listeners:{rowdeselect:function(N,M,L){if(N.getCount()<1){Ext.getCmp("case_details_panel").disable();Ext.getCmp("tb_build").disable();Ext.getCmp("tb_environment").disable();Ext.getCmp("update_bugs").disable();var J=this.grid.getTopToolbar().items.items;for(var K=0;K1){return }Ext.getCmp("case_bugs_panel").tcid=M.get("case_id");Ext.getCmp("case_comps_panel").tcid=M.get("case_id");Ext.getCmp("attachments_panel").object=M.data;Ext.getCmp("case_details_panel").caserun_id=M.get("caserun_id");Ext.getCmp("casetagsgrid").obj_id=M.get("case_id");var L=Ext.getCmp("caserun_center_region").getActiveTab();Ext.getCmp(L.id).fireEvent("activate");if(Ext.getCmp("case_bugs_panel")){Ext.getCmp("case_bugs_panel").case_id=M.get("case_id")}if(Ext.getCmp("case_bugs_panel")){Ext.getCmp("case_bugs_panel").case_id=M.get("case_id")}Ext.getCmp("case_details_panel").store.load({params:{caserun_id:M.get("caserun_id"),action:"gettext"}});F=O}}}),viewConfig:{forceFit:true,enableRowBody:true,getRowClass:function(J,M,L,K){L.body="
";return"x-grid3-row-expanded"}}});this.on("rowcontextmenu",this.onContextClick,this);this.on("afteredit",this.onGridEdit,this);this.on("activate",this.onActivate,this)};Ext.extend(CaseRunGrid,Ext.grid.EditorGridPanel,{onContextClick:function(B,A,C){B.selindex=A;if(!this.menu){this.menu=new Ext.menu.Menu({id:"caserun-ctx-menu",items:[{text:"Change",icon:"testopia/img/edit.png",iconCls:"img_button_16x",menu:{items:[{text:"Build",handler:function(){var D=new Ext.Window({title:"Edit Build",id:"status-win",plain:true,shadow:false,width:320,height:150,layout:"form",bodyStyle:"padding: 5px",items:[new BuildCombo({params:{product_id:B.run.plan.product_id,activeonly:1},fieldLabel:"Build",id:"multi_build"}),new Ext.form.Checkbox({fieldLabel:"Apply to all cases in this run",id:"build_applyall"})],buttons:[{text:"Submit",handler:function(){params={run_id:B.run.run_id,applyall:Ext.getCmp("build_applyall").getValue(),build_id:Ext.getCmp("multi_build").getValue(),ids:getSelectedObjects(B,"caserun_id")};TestopiaUpdateMultiple("caserun",params,B);D.close()}},{text:"Close",handler:function(){D.close()}}]});D.show(this)}},{text:"Environment",handler:function(){var D=new Ext.Window({title:"Edit Environment",id:"status-win",plain:true,shadow:false,width:320,height:150,layout:"form",bodyStyle:"padding: 5px",items:[new EnvironmentCombo({params:{product_id:B.run.plan.product_id,isactive:1},fieldLabel:"Environment",id:"multi_env"}),new Ext.form.Checkbox({fieldLabel:"Apply to all cases in this run",id:"env_applyall"})],buttons:[{text:"Submit",handler:function(){params={run_id:B.run.run_id,applyall:Ext.getCmp("env_applyall").getValue(),env_id:Ext.getCmp("multi_env").getValue(),ids:getSelectedObjects(B,"caserun_id")};TestopiaUpdateMultiple("caserun",params,B);D.close()}},{text:"Close",handler:function(){D.close()}}]});D.show(this)}},{text:"Priority",handler:function(){var D=new Ext.Window({title:"Edit Priority",id:"priority-win",plain:true,shadow:false,width:320,height:150,layout:"form",bodyStyle:"padding: 5px",items:[new PriorityCombo({fieldLabel:"Priority",id:"multi_priority"})],buttons:[{text:"Submit",handler:function(){params={run_id:B.run.run_id,priority:Ext.getCmp("multi_priority").getValue(),ids:getSelectedObjects(B,"case_id")};TestopiaUpdateMultiple("case",params,B);D.close()}},{text:"Close",handler:function(){D.close()}}]});D.show(this)}},{text:"Category",handler:function(){var D=new Ext.Window({title:"Edit Category",id:"status-win",plain:true,shadow:false,width:300,height:150,items:[new CaseCategoryCombo({fieldLabel:"Category",params:{product_id:run.product_id}})],buttons:[{text:"Submit",handler:function(){TestopiaUpdateMultiple("case",{category:Ext.getCmp("case_category_combo").getValue(),ids:getSelectedObjects(B,"case_id")},B);D.close()}},{text:"Close",handler:function(){D.close()}}]});D.show(this)}},{text:"Assignee",handler:function(){var D=new Ext.Window({title:"Edit Assignee",id:"status-win",plain:true,shadow:false,width:320,height:150,layout:"form",bodyStyle:"padding: 5px",items:[new UserLookup({fieldLabel:"Assignee",id:"multi_assignee"}),new Ext.form.Checkbox({fieldLabel:"Apply to all cases in this run",id:"assignee_applyall"})],buttons:[{text:"Submit",handler:function(){params={run_id:B.run.run_id,applyall:Ext.getCmp("assignee_applyall").getValue(),assignee:Ext.getCmp("multi_assignee").getValue(),ids:getSelectedObjects(B,"caserun_id")};TestopiaUpdateMultiple("caserun",params,B);D.close()}},{text:"Close",handler:function(){D.close()}}]});D.show(this)}}]}},{text:"Remove Selected Cases",icon:"testopia/img/delete.png",iconCls:"img_button_16x",handler:this.deleteList.createDelegate(this)},{text:"Add or Remove Tags",handler:function(){TagsUpdate("case",B)}},{text:"New Test Run",id:"addRun",handler:function(){window.location="tr_new_run.cgi?plan_id="+run.plan_id}},{text:"Clone Run with Selected Cases",handler:function(){RunClonePopup(B.run.product_id,B.run.run_id,getSelectedObjects(B,"case_id"))}},{text:"Copy or Link Selected Test Cases to Plan(s)... ",handler:function(){var D=B.getSelectionModel().getSelected();caseClonePopup(B.run.product_id,getSelectedObjects(B,"case_id"))}},{text:"Add Selected Test Cases to Run... ",handler:function(){Ext.Msg.prompt("Add to runs","",function(D,E){if(D=="ok"){TestopiaUpdateMultiple("case",{addruns:E,ids:getSelectedObjects(B,"case_id")},B)}})}},{text:"Refresh List",icon:"testopia/img/refresh.png",iconCls:"img_button_16x",handler:function(){B.store.reload()}},{text:"View Test Case in a New Window",handler:function(){window.open("tr_show_case.cgi?case_id="+B.store.getAt(B.selindex).get("case_id"))}},{text:"List These Test Cases in a New Window",handler:function(){var D=Ext.getCmp("caserun_search").form.getValues();if(D){window.open("tr_list_cases.cgi?"+jsonToSearch(D,"",["current_tab"])+"&isactive=1")}else{window.open("tr_list_cases.cgi?run_id="+B.store.getAt(B.selindex).get("run_id"))}}}]})}C.stopEvent();if(B.getSelectionModel().getCount()<1){B.getSelectionModel().selectRow(A)}this.menu.showAt(C.getXY())},onGridEdit:function(B){var A={caserun_id:B.record.get("caserun_id")};var C=this.store;switch(B.field){case"sortkey":A.action="update_sortkey";A.sortkey=B.value;break;case"build":A.action="update_build";A.build_id=B.value;break;case"environment":A.action="update_environment";A.caserun_env=B.value;break;case"assignee":A.action="update_assignee";A.assignee=B.value;break;case"priority":A.action="update_priority";A.priority=B.value;break;case"category":A.action="update_scategory";A.category=B.value;break}this.form.submit({url:"tr_caserun.cgi",params:A,success:function(E,D){if(D.result.caserun){var F=B.grid.store.reader.readRecords({Result:[D.result.caserun]}).records[0];B.grid.store.insert(B.row,F);C.commitChanges();B.grid.store.remove(B.record);B.grid.getSelectionModel().selectRow(B.row)}else{C.commitChanges()}},failure:function(E,D){testopiaError(E,D);C.rejectChanges()}})},deleteList:function(){var A=this;if(A.getSelectionModel().getCount()<1){return }Ext.Msg.show({title:"Confirm Delete?",msg:CASERUN_DELETE_WARNING,buttons:Ext.Msg.YESNO,animEl:"caserun-delete-btn",icon:Ext.MessageBox.QUESTION,fn:function(C){if(C=="yes"){var B=new Ext.form.BasicForm("testopia_helper_frm");B.submit({url:"tr_list_caseruns.cgi",params:{caserun_ids:getSelectedObjects(A,"caserun_id"),action:"delete",ctype:"json"},success:function(D){Ext.Msg.show({msg:"Test cases removed",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO});A.store.reload()},failure:function(E,D){testopiaError(E,D);A.store.reload()}})}}})},onActivate:function(A){if(!this.store.getCount()){this.store.load()}}});CaseRun=function(){var B=new TestopiaUtil();this.caserun_id;this.store=new Ext.data.Store({url:"tr_caserun.cgi",baseParams:{action:"gettext"},reader:new Ext.data.XmlReader({record:"casetext",id:"case_id"},[{name:"action",mapping:"action"},{name:"results",mapping:"effect"},{name:"setup",mapping:"setup"},{name:"breakdown",mapping:"breakdown"},{name:"case_id",mapping:"case_id"},{name:"summary",mapping:"summary"},{name:"notes",mapping:"notes"}])});var A=this.store;A.on("load",function(D,E){Ext.getCmp("action_editor").setValue(E[0].get("action"));Ext.getCmp("effect_editor").setValue(E[0].get("results"));Ext.getCmp("setup_editor").setValue(E[0].get("setup"));Ext.getCmp("breakdown_editor").setValue(E[0].get("breakdown"));Ext.getCmp("summary_tb").items.items[0].destroy();Ext.getCmp("summary_tb").add(new Ext.Toolbar.TextItem("Case "+E[0].get("case_id")+" - "+E[0].get("summary")))});appendNote=function(){var D=new Ext.form.BasicForm("testopia_helper_frm",{});D.submit({url:"tr_list_caseruns.cgi",params:{action:"update",note:Ext.getCmp("caserun_append_note_fld").getValue(),ids:getSelectedObjects(Ext.getCmp("caserun_grid"),"caserun_id")},success:function(){Ext.getCmp("caserun_append_note_fld").reset();A.reload()},failure:testopiaError})};processText=function(){var D=new Ext.form.BasicForm("testopia_helper_frm",{});var E={};E.tcsetup=Ext.getCmp("setup_editor").getValue();E.tcbreakdown=Ext.getCmp("breakdown_editor").getValue();E.tcaction=Ext.getCmp("action_editor").getValue();E.tceffect=Ext.getCmp("effect_editor").getValue();E.case_id=Ext.getCmp("caserun_grid").getSelectionModel().getSelected().get("case_id");E.action="update_doc";D.submit({url:"tr_process_case.cgi",params:E,success:function(){TestopiaUtil.notify.msg("Test case updated","Test Case {0} was updated successfully","Document")},failure:testopiaError})};var C=new Ext.Toolbar({id:"summary_tb",items:[new Ext.Toolbar.TextItem("")]});CaseRun.superclass.constructor.call(this,{id:"case_details_panel",layout:"fit",region:"south",split:true,border:false,style:"padding-bottom: 10px",bodyBorder:false,collapsible:true,height:330,items:[{xtype:"tabpanel",bodyBorder:false,activeTab:0,id:"caserun_center_region",title:"Details",tbar:C,items:[{layout:"column",title:"Action / Expected Results",id:"action_panel",items:[{columnWidth:0.5,layout:"fit",items:{title:"Action",height:Ext.state.Manager.get("bigtext_height",230),id:"cr_action_panel",bodyBorder:false,border:false,layout:"fit",autoScroll:true,items:[{id:"action_editor",xtype:"htmleditor"}]}},{columnWidth:0.5,layout:"fit",items:{title:"Expected Results",height:Ext.state.Manager.get("bigtext_height",230),id:"cr_results_panel",bodyBorder:false,border:false,autoScroll:true,layout:"fit",items:[{id:"effect_editor",xtype:"htmleditor"}]}}],buttons:[{text:"Update Action/Results",handler:processText.createDelegate(this)}]},{layout:"column",title:"Set Up / Break Down",items:[{columnWidth:0.5,layout:"fit",items:{title:"Setup",height:Ext.state.Manager.get("bigtext_height",230),id:"cr_setup_panel",bodyBorder:false,autoScroll:true,border:false,layout:"fit",items:[{id:"setup_editor",xtype:"htmleditor"}]}},{columnWidth:0.5,layout:"fit",items:{title:"Breakdown",height:Ext.state.Manager.get("bigtext_height",230),id:"cr_breakdown_panel",bodyBorder:false,autoScroll:true,border:false,layout:"fit",items:[{id:"breakdown_editor",xtype:"htmleditor"}]}}],buttons:[{text:"Update Setup/Breakdown",handler:processText.createDelegate(this)}]},{title:"Notes",id:"caserun_notes_panel",border:false,bodyBorder:false,autoScroll:true,layout:"fit",items:[{xtype:"dataview",bodyBorder:false,store:A,itemSelector:"div.breakdowndiv",loadingText:"Loading...",tpl:new Ext.XTemplate('','
";K=K+"";return K}}];this.form=new Ext.form.BasicForm("testopia_helper_frm",{});this.bbar=new TestopiaPager("run",this.store);RunGrid.superclass.constructor.call(this,{title:"Test Runs",id:B.id||"run_grid",loadMask:{msg:"Loading Test Runs..."},autoExpandColumn:"run_summary",autoScroll:true,sm:new Ext.grid.RowSelectionModel({singleSelect:false,listeners:{rowselect:function(J,H,I){Ext.getCmp("new_case_to_run_button").enable();Ext.getCmp("delete_run_list_btn").enable();Ext.getCmp("edit_run_list_btn").enable()},rowdeselect:function(J,H,I){if(J.getCount()<1){Ext.getCmp("new_case_to_run_button").disable();Ext.getCmp("delete_run_list_btn").disable();Ext.getCmp("edit_run_list_btn").disable()}}}}),viewConfig:{forceFit:true},tbar:[{xtype:"button",text:"Add Test Cases to Selected Runs",id:"new_case_to_run_button",disabled:true,handler:function(){var H=Ext.getCmp(B.id||"run_grid").getSelectionModel().getSelected();D.addCaseToRunPopup(H)}},new Ext.Toolbar.Fill(),{xtype:"button",id:"save_run_list_btn",icon:"testopia/img/save.png",iconCls:"img_button_16x",tooltip:"Save this search",handler:function(H,I){saveSearch("run",Ext.getCmp(B.id||"run_grid").store.baseParams)}},{xtype:"button",id:"link_run_list_btn",icon:"testopia/img/link.png",iconCls:"img_button_16x",tooltip:"Create a link to this list",handler:function(H,I){linkPopup(Ext.getCmp(B.id||"run_grid").store.baseParams)}},{xtype:"button",id:"edit_run_list_btn",icon:"testopia/img/edit.png",iconCls:"img_button_16x",disabled:true,tooltip:"Edit Selected Test Run",handler:function(){editFirstSelection(Ext.getCmp(B.id||"run_grid"))}},{xtype:"button",id:"add_run_list_btn",icon:"testopia/img/new.png",iconCls:"img_button_16x",tooltip:"Create a New Test Run",handler:function(){try{if(plan){D.newRunPopup(plan)}}catch(H){window.location="tr_new_run.cgi"}}},{xtype:"button",id:"delete_run_list_btn",icon:"testopia/img/delete.png",iconCls:"img_button_16x",disabled:true,tooltip:"Delete Selected Test Runs",handler:this.deleteList.createDelegate(this)}]});Ext.apply(this,B);this.on("rowcontextmenu",this.onContextClick,this);this.on("afteredit",this.onGridEdit,this);this.on("activate",this.onActivate,this)};Ext.extend(RunGrid,Ext.grid.EditorGridPanel,{onContextClick:function(B,A,C){B.selindex=A;if(!this.menu){this.menu=new Ext.menu.Menu({id:"run-ctx-menu",items:[{text:"Reports",menu:{items:[{text:"New Run Status Report",handler:function(){Ext.getCmp("object_panel").setActiveTab("dashboardpanel");var D=new Ext.ux.Portlet({title:"Status Report",closable:true,autoScroll:true,tools:PortalTools});D.url="tr_run_reports.cgi?type=status&run_ids="+getSelectedObjects(B,"run_id");Testopia.Search.dashboard_urls.push(D.url);Ext.getCmp("dashboard_leftcol").add(D);Ext.getCmp("dashboard_leftcol").doLayout();D.load({url:D.url})}},{text:"New Run Completion Report",handler:function(){Ext.getCmp("object_panel").setActiveTab("dashboardpanel");var D=new Ext.ux.Portlet({title:"Completion Report",closable:true,autoScroll:true,tools:PortalTools});D.url="tr_run_reports.cgi?type=completion&run_ids="+getSelectedObjects(B,"run_id");Testopia.Search.dashboard_urls.push(D.url);Ext.getCmp("dashboard_leftcol").add(D);Ext.getCmp("dashboard_leftcol").doLayout();D.load({url:D.url})}},{text:"New Run Execution Report",handler:function(){var D=new Ext.Window({title:"Select a date range",id:"run_execution_win",layout:"fit",split:true,plain:true,shadow:false,width:350,height:150,items:[new Ext.FormPanel({labelWidth:"40",bodyStyle:"padding: 5px",items:[{xtype:"datefield",id:"execution_start_date",fieldLabel:"Start Date",name:"chfieldfrom"},{xtype:"datefield",fieldLabel:"Stop Date",id:"execution_stop_date",emptyText:"Now",name:"chfieldto"},new UserLookup({id:"exec_tester",fieldLabel:"Tester (optional)"})]})],buttons:[{text:"Submit",handler:function(){Ext.getCmp("object_panel").setActiveTab("dashboardpanel");var E=new Ext.ux.Portlet({title:"Execution Report",closable:true,autoScroll:true,tools:PortalTools});E.url="tr_run_reports.cgi?type=execution&run_ids="+getSelectedObjects(B,"run_id")+"&chfieldfrom="+Ext.getCmp("execution_start_date").getValue()+"&chfieldto="+Ext.getCmp("execution_stop_date").getValue()+"&tester="+Ext.getCmp("exec_tester").getValue();Testopia.Search.dashboard_urls.push(E.url);Ext.getCmp("dashboard_leftcol").add(E);Ext.getCmp("dashboard_leftcol").doLayout();E.load({url:E.url});D.close()}},{text:"Cancel",handler:function(){D.close()}}]});D.show()}},{text:"New Priority Breakdown Report",handler:function(){Ext.getCmp("object_panel").setActiveTab("dashboardpanel");var D=new Ext.ux.Portlet({title:"Status Report",closable:true,autoScroll:true,tools:PortalTools});D.url="tr_run_reports.cgi?type=priority&run_ids="+getSelectedObjects(B,"run_id");Testopia.Search.dashboard_urls.push(D.url);Ext.getCmp("dashboard_leftcol").add(D);Ext.getCmp("dashboard_leftcol").doLayout();D.load({url:D.url})}},{text:"New Run Bug Report",handler:function(){Ext.getCmp("object_panel").setActiveTab("dashboardpanel");var D=new Ext.ux.Portlet({title:"Bug Report",closable:true,autoScroll:true,tools:PortalTools});D.url="tr_run_reports.cgi?type=bug_grid&run_ids="+getSelectedObjects(B,"run_id")+"&noheader=1";Testopia.Search.dashboard_urls.push(D.url);Ext.getCmp("dashboard_leftcol").add(D);Ext.getCmp("dashboard_leftcol").doLayout();D.load({scripts:true,url:D.url})}}]}},{text:"Edit",menu:{items:[{text:"Manager",handler:function(){var D=new Ext.Window({title:"Change Run Manager",id:"run_manager_win",layout:"fit",split:true,plain:true,shadow:false,width:350,height:150,items:[new Ext.FormPanel({labelWidth:"40",bodyStyle:"padding: 5px",items:[new UserLookup({id:"manager_update",fieldLabel:"Run Manager"})]})],buttons:[{text:"Update Manager",handler:function(){TestopiaUpdateMultiple("run",{manager:Ext.getCmp("manager_update").getValue(),ids:getSelectedObjects(B,"run_id")},B);D.close()}},{text:"Cancel",handler:function(){D.close()}}]});D.show()}},{text:"Tags",handler:function(){TagsUpdate("run",B)}},{text:"Targets",handler:function(){var D=new Ext.Window({title:"Change Run Targets",id:"run_target_win",layout:"fit",split:true,plain:true,shadow:false,width:350,height:150,items:[new Ext.FormPanel({bodyStyle:"padding: 5px",items:[new Ext.form.NumberField({maxValue:100,minValue:0,id:"target_completion",allowBlank:true,fieldLabel:"Target Completion Rate",hiddenName:"target_completion",listeners:{valid:function(E){Ext.getCmp("target_pass").maxValue=E.getValue()}}}),new Ext.form.NumberField({maxValue:100,minValue:0,allowBlank:true,id:"target_pass",fieldLabel:"Target Pass Rate",hiddenName:"target_pass"})]})],buttons:[{text:"Update Targets",handler:function(){TestopiaUpdateMultiple("run",{target_pass:Ext.getCmp("target_pass").getValue(),target_completion:Ext.getCmp("target_completion").getValue(),ids:getSelectedObjects(B,"run_id")},B);D.close()}},{text:"Cancel",handler:function(){D.close()}}]});D.show()}}]}},{text:"Clone Selected Test Runs",icon:"testopia/img/copy.png",iconCls:"img_button_16x",handler:function(){RunClonePopup(B.getSelectionModel().getSelected().get("product_id"),getSelectedObjects(B,"run_id"))}},{text:"Delete Selected Test Runs",icon:"testopia/img/delete.png",iconCls:"img_button_16x",handler:this.deleteList.createDelegate(this)},{text:"Refresh List",icon:"testopia/img/refresh.png",iconCls:"img_button_16x",handler:function(){B.store.reload()}},{text:"View Test Run in a New Window",handler:function(){window.open("tr_show_run.cgi?run_id="+B.store.getAt(B.selindex).get("run_id"))}},{text:"View Run's Test Cases in a New Window",handler:function(){window.open("tr_list_cases.cgi?run_id="+B.store.getAt(B.selindex).get("run_id"))}}]})}C.stopEvent();if(B.getSelectionModel().getCount()<1){B.getSelectionModel().selectRow(A)}this.menu.showAt(C.getXY())},onGridEdit:function(B){var A={action:"edit",run_id:B.record.get("run_id")};var C=this.store;switch(B.field){case"product_version":A.run_product_version=B.value;break;case"manager":A.manager=B.value;break;case"build":A.build=B.value;break;case"environment":A.environment=B.value;break;case"summary":A.summary=B.value;break}this.form.submit({url:"tr_process_run.cgi",params:A,success:function(E,D){C.commitChanges()},failure:function(E,D){testopiaError(E,D);C.rejectChanges()}})},deleteList:function(){var A=this;Ext.Msg.show({title:"Confirm Delete?",msg:RUN_DELETE_WARNING,buttons:Ext.Msg.YESNO,animEl:"run-delete-btn",icon:Ext.MessageBox.QUESTION,fn:function(C){if(C=="yes"){var B=new Ext.form.BasicForm("testopia_helper_frm");B.submit({url:"tr_list_runs.cgi",params:{run_ids:getSelectedObjects(A,"run_id"),action:"delete"},success:function(D){Ext.Msg.show({msg:"Test runs deleted",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO});A.store.reload()},failure:function(E,D){testopiaError(E,D);A.store.reload()}})}}})},onActivate:function(A){if(!this.store.getCount()){this.store.load()}}});var NewRunForm=function(A){if(A.data){A=A.data}var B=new CaseGrid({plan_id:A.plan_id,case_status:"CONFIRMED"},{title:"Select From Existing Cases",region:"center",id:"newrun_casegrid",height:500});this.casegrid=B;B.on("render",function(D){for(var C=0;CProduct Version",hiddenName:"prod_version",mode:"local",forceSelection:true,allowBlank:false,typeAhead:true,params:{product_id:A.product_id}}),new UserLookup({id:"new_run_manager",hiddenName:"manager",fieldLabel:"Run Manager",allowBlank:false}),new Ext.form.NumberField({maxValue:100,minValue:0,allowBlank:true,id:"target_completion",fieldLabel:"Target Completion Rate",hiddenName:"target_completion",listeners:{valid:function(C){Ext.getCmp("target_pass").maxValue=C.getValue()}}})]},{columnWidth:0.5,layout:"form",items:[new BuildCombo({fieldLabel:"Build",hiddenName:"build",mode:"local",forceSelection:false,allowBlank:false,typeAhead:true,params:{product_id:A.product_id},emptyText:"Select or type a new name"}),new EnvironmentCombo({fieldLabel:"Environment",hiddenName:"environment",mode:"local",forceSelection:false,allowBlank:false,typeAhead:true,params:{product_id:A.product_id},emptyText:"Select or type a new name"}),new Ext.form.NumberField({maxValue:100,minValue:0,allowBlank:true,id:"target_pass",fieldLabel:"Target Pass Rate",hiddenName:"target_pass"})]}]},{xtype:"textfield",fieldLabel:"Summary",layout:"fit",id:"run_summary",name:"summary",anchor:"100%",width:600,allowBlank:false},{xtype:"hidden",name:"plan_id",value:A.plan_id},{layout:"fit",fieldLabel:"Notes",id:"notes",xtype:"textarea",width:600,height:80}]}],buttons:[{text:"Create New Case",handler:function(){var C=new TestopiaUtil();C.newCaseForm(A.plan_id,A.product_id)}},{text:"Submit",handler:function(){if(!Ext.getCmp("newrunsouth").getForm().isValid()){return }var C={action:"add"};if(Ext.getCmp("selectall").getValue()){C.getall=Ext.getCmp("selectall").getValue()?1:0}else{C.case_ids=getSelectedObjects(B,"case_id")}if(!Ext.getCmp("build_combo").getValue()){C.new_build=Ext.getCmp("build_combo").getRawValue()}if(!Ext.getCmp("environment_combo").getValue()){C.new_env=Ext.getCmp("environment_combo").getRawValue()}Ext.getCmp("newrunsouth").getForm().submit({params:C,success:function(D,E){Ext.Msg.show({title:"Test Run Created",msg:"Test run "+E.result.run_id+" Created. Would you like to go there now?",buttons:Ext.Msg.YESNO,icon:Ext.MessageBox.QUESTION,fn:function(F){if(F=="yes"){window.location="tr_show_run.cgi?run_id="+E.result.run_id}}});if(Ext.getCmp("plan_run_grid")){Ext.getCmp("plan_run_grid").store.reload()}},failure:testopiaError})}},{text:"Cancel",type:"reset",id:"nrf_cancel_btn",handler:function(){Ext.getCmp("newrunsouth").getForm().reset();try{Ext.getCmp("newRun-win").close()}catch(C){window.location="tr_show_product.cgi"}}}]});this.on("render",function(){B.store.load();Ext.getCmp("new_run_manager").setValue(Testopia_user.login)})};Ext.extend(NewRunForm,Ext.Panel);RunClonePanel=function(D,H,B){var E=new PlanGrid({product_id:D},{id:"run_clone_plan_grid"});var C=new ProductVersionCombo({id:"run_clone_version_chooser",mode:"local",hiddenName:"new_run_prod_version",fieldLabel:"Product Version",params:{product_id:D}});var G=new BuildCombo({fieldLabel:"Select a Build",id:"run_clone_build_chooser",mode:"local",hiddenName:"new_run_build",params:{product_id:D},validator:function(I){var J=1;return false}});var A=new EnvironmentCombo({fieldLabel:"Select an Environment",id:"run_clone_environment_chooser",mode:"local",hiddenName:"new_run_env",params:{product_id:D}});function F(){var I=Ext.getCmp("run_clone_frm").getForm();I.baseParams={};if(Ext.getCmp("copy_cases_radio_group").getGroupValue()=="copy_filtered_cases"){I.baseParams=Ext.getCmp("caserun_search").form.getValues()}else{if(Ext.getCmp("copy_cases_radio_group").getGroupValue()=="copy_selected_cases"){I.baseParams.case_list=getSelectedObjects(Ext.getCmp("caserun_grid"),"caserun_id")}}I.baseParams.action="clone";I.baseParams.ids=H;I.baseParams.new_run_build=G.getValue();I.baseParams.new_run_environment=A.getValue();I.baseParams.plan_ids=getSelectedObjects(E,"plan_id");var J=I.getValues();if(I.isValid()){I.submit({success:function(L,K){var M;if(K.result.runlist.length==1){M=K.result.failures.length>0?"Test cases "+K.result.failures.join(",")+" were not included. They are either DISABLED or PROPOSED. ":"";Ext.Msg.show({title:"Run Copied",msg:M+"Run "+K.result.runlist[0]+" Created. Would you like to go there now?",buttons:Ext.Msg.YESNO,icon:Ext.MessageBox.QUESTION,fn:function(N){if(N=="yes"){window.location="tr_show_run.cgi?run_id="+K.result.runlist[0]}}})}else{M=K.result.failures.length>0?"Test cases "+K.result.failures.join(",")+" were not included. They are either DISABLED or PROPOSED. ":"";Ext.Msg.show({title:"Test Run Copied",msg:M+"Test runs "+K.result.runlist.join(",")+' Copied successfully. View as List',buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO})}},failure:testopiaError})}}RunClonePanel.superclass.constructor.call(this,{id:"run_clone_form",border:false,width:600,layout:"border",items:[{region:"north",layout:"fit",border:false,height:300,items:[E]},{region:"center",xtype:"form",url:"tr_list_runs.cgi",title:"Clone Options",autoScroll:true,id:"run_clone_frm",border:false,frame:true,bodyStyle:"padding: 10px",labelWidth:160,height:350,items:[{layout:"table",border:false,autoScroll:true,layoutConfig:{columns:2,width:"100%"},items:[{colspan:2,layout:"form",border:false,items:[{id:"run_clone_name",xtype:"textfield",fieldLabel:"New Run Summary",name:"new_run_summary",width:500}]},{layout:"form",border:false,items:[C,G,A]},{layout:"form",border:false,items:[{xtype:"checkbox",name:"copy_tags",checked:true,boxLabel:"Copy Run Tags",hideLabel:true},{xtype:"hidden",id:"run_clone_product_id",name:"product_id",value:D}]},{colspan:2,layout:"form",border:false,items:[{xtype:"checkbox",name:"keep_run_manager",checked:false,boxLabel:"Maintain original manager (unchecking will make me the manager of the new run)",hideLabel:true},{xtype:"fieldset",autoHeight:true,checkboxToggle:true,checkboxName:"copy_cases",id:"run_copy_cases",title:"Copy Test Cases",collapsed:B?false:true,items:[{xtype:"radio",name:"copy_cases_options",id:"copy_cases_radio_group",inputValue:"copy_all_cases",checked:true,boxLabel:"Include all CONFIRMED cases in selected run(s)",hideLabel:true},{xtype:"radio",name:"copy_cases_options",inputValue:"copy_filtered_cases",boxLabel:"Only include cases that match the selected filter",hideLabel:true},{xtype:"radio",name:"copy_cases_options",inputValue:"copy_selected_cases",boxLabel:"Only include cases that are currently selected",checked:B?true:false,hideLabel:true},{xtype:"checkbox",name:"keep_indexes",checked:true,boxLabel:"Copy Case Indexes",hideLabel:true},{xtype:"checkbox",name:"keep_statuses",boxLabel:"Maintain status of copied cases (unchecking will set case copies to IDLE (Not Run))",hideLabel:true}]}]}]}]}],buttons:[{text:"Submit",handler:F.createDelegate(this)},{text:"Cancel",handler:function(){Ext.getCmp("run-clone-win").close()}}]})};Ext.extend(RunClonePanel,Ext.Panel);RunClonePopup=function(D,G,A){var F=new Ext.Window({id:"run-clone-win",closable:true,width:800,height:600,plain:true,shadow:false,layout:"fit",items:[new RunClonePanel(D,G,A)]});var H=Ext.getCmp("run_clone_plan_grid");Ext.apply(H,{title:"Select plans to clone runs to"});F.show(this);var B=H.getTopToolbar().items.items;for(var C=0;C 1 ? "Items" : "Item"]})'});this.columns=[{header:"Run",dataIndex:"run_id",sortable:true,hideable:true,groupRenderer:function(C){return C},renderer:A.runLink},{header:"Case",dataIndex:"case_id",sortable:true,hideable:true,groupRenderer:function(C){return C},renderer:A.caseLink},{header:"Bug",dataIndex:"bug_id",sortable:true,hideable:true,groupRenderer:function(C){return C},renderer:A.bugLink},{header:"Bug Status",dataIndex:"bug_status",sortable:true,hideable:true},{header:"Case Status",dataIndex:"case_status",sortable:true,hideable:true},{header:"Severity",dataIndex:"severity",sortable:true,hideable:true}];Testopia.BugReport.superclass.constructor.call(this,{sm:new Ext.grid.RowSelectionModel(),layout:"fit",height:250,autoScroll:true})};Ext.extend(Testopia.BugReport,Ext.grid.GridPanel);BuildGrid=function(A){this.product_id=A;this.store=new BuildStore({},false);var B=new MilestoneCombo({hiddenField:"milestone",mode:"remote",params:{product_id:A}});this.columns=[{header:"Name",width:80,sortable:true,dataIndex:"name",editor:new Ext.grid.GridEditor(new Ext.form.TextField({value:"name",allowBlank:false}),{completeOnEnter:true,listeners:{beforecomplete:function(D,C){if(!D.getValue()){return false}}}})},{header:"Milestone",width:120,sortable:true,dataIndex:"milestone",editor:new Ext.grid.GridEditor(B,{listeners:{startedit:function(){var C=Ext.getCmp("products_pane").getSelectionModel().getSelectedNode().id;if(B.store.baseParams.product_id!=C){B.store.baseParams.product_id=C;B.store.load()}}}})},{header:"Description",width:120,editor:new Ext.grid.GridEditor(new Ext.form.TextField()),sortable:true,dataIndex:"description"},new Ext.grid.CheckColumn({header:"Active",dataIndex:"isactive",editor:new Ext.grid.GridEditor(new Ext.form.Checkbox({value:"isactive"})),width:25})];this.form=new Ext.form.BasicForm("testopia_helper_frm");BuildGrid.superclass.constructor.call(this,{title:"Builds",id:"build_grid",loadMask:{msg:"Loading Builds..."},autoExpandColumn:"build_name",autoScroll:true,sm:new Ext.grid.RowSelectionModel({singleSelect:true}),viewConfig:{forceFit:true},tbar:[new Ext.Toolbar.Fill(),{xtype:"button",id:"edit_build_btn",icon:"testopia/img/edit.png",iconCls:"img_button_16x",tooltip:"Edit Selected Build",handler:function(){editFirstSelection(Ext.getCmp("build_grid"))}},{xtype:"button",template:button_16x_tmpl,id:"add_build_btn",icon:"testopia/img/add.png",iconCls:"img_button_16x",tooltip:"Add a new Build",handler:this.newRecord}]});this.on("rowcontextmenu",this.onContextClick,this);this.on("activate",this.onActivate,this);this.on("afteredit",this.onGridEdit,this)};Ext.extend(BuildGrid,Ext.grid.EditorGridPanel,{newRecord:function(){NewBuild=Ext.data.Record.create([{name:"name",type:"string"},{name:"milestone"},{name:"description",type:"string"},{name:"isactive",type:"bool"}]);var A=new NewBuild({name:"",milestone:Ext.getCmp("products_pane").getSelectionModel().getSelectedNode().attributes.attributes.defaultmilestone,description:"",isactive:true});var B=Ext.getCmp("build_grid");B.store.insert(0,A);B.startEditing(0,0)},onContextClick:function(B,A,C){B.getSelectionModel().selectRow(A);if(!this.menu){this.menu=new Ext.menu.Menu({id:"build-ctx-menu",items:[{text:"Reports",menu:{items:[{text:"New Completion Report",handler:function(){Ext.getCmp("object_panel").setActiveTab("dashboardpanel");var D=new Ext.ux.Portlet({title:"Build Completion Report",closable:true,autoScroll:true,tools:PortalTools});D.url="tr_builds.cgi?action=report&product_id="+B.product_id+"&build_ids="+getSelectedObjects(B,"id");Testopia.Search.dashboard_urls.push(D.url);Ext.getCmp("dashboard_leftcol").add(D);Ext.getCmp("dashboard_leftcol").doLayout();D.load({url:D.url})}}]}},{text:"Add a Build",icon:"testopia/img/add.png",iconCls:"img_button_16x",handler:this.newRecord},{text:"Edit This Build",icon:"testopia/img/edit.png",iconCls:"img_button_16x",handler:function(){editFirstSelection(B)}},{text:"Refresh",icon:"testopia/img/refresh.png",iconCls:"img_button_16x",handler:function(){B.store.reload()}}]})}C.stopEvent();this.menu.showAt(C.getXY())},onGridEdit:function(D){var B=D.record.get("id");var A={product_id:this.product_id,build_id:B};var C=this.store;if(B){A.action="edit";switch(D.field){case"name":A.name=D.value;break;case"description":A.description=D.value;break;case"isactive":A.isactive=D.value;break;case"milestone":A.milestone=D.value;break}}else{A.action="add";A.name=D.value;A.milestone=Ext.getCmp("products_pane").getSelectionModel().getSelectedNode().attributes.attributes.defaultmilestone;A.isactive=1}this.form.submit({url:"tr_builds.cgi",params:A,success:function(F,E){if(E.result.build_id){D.record.set("id",E.result.build_id)}C.commitChanges()},failure:function(F,E){testopiaError(F,E);C.rejectChanges()}})},onActivate:function(A){if(!this.product_id){Ext.Msg.alert("Error","Please select a product.");Ext.getCmp("edit_build_btn").disable();Ext.getCmp("add_build_btn").disable();return }else{if(!this.store.getCount()){this.store.load({params:{product_id:this.product_id}})}}}});CaseCategoryGrid=function(A){this.product_id=A;this.store=new CaseCategoryStore({},false);var B=this.store;this.columns=[{header:"Name",width:120,sortable:true,dataIndex:"name",editor:new Ext.grid.GridEditor(new Ext.form.TextField({value:"name",allowBlank:false}),{completeOnEnter:true,listeners:{beforecomplete:function(D,C){if(!D.getValue()){return false}}}})},{header:"Description",width:120,id:"category_desc_column",editor:new Ext.grid.GridEditor(new Ext.form.TextField({value:"description"})),sortable:true,dataIndex:"description"}];this.form=new Ext.form.BasicForm("testopia_helper_frm",{});CaseCategoryGrid.superclass.constructor.call(this,{title:"Categories",id:"category_grid",loadMask:{msg:"Loading Categories..."},autoExpandColumn:"category_desc_column",autoScroll:true,enableColumnHide:true,sm:new Ext.grid.RowSelectionModel({singleSelect:true}),viewConfig:{forceFit:true},tbar:[new Ext.Toolbar.Fill(),{xtype:"button",id:"edit_category_btn",icon:"testopia/img/edit.png",iconCls:"img_button_16x",tooltip:"Edit Selected Category",handler:function(){editFirstSelection(Ext.getCmp("category_grid"))}},{xtype:"button",template:button_16x_tmpl,id:"add_category_btn",icon:"testopia/img/add.png",iconCls:"img_button_16x",tooltip:"Add a new Category",handler:this.newRecord},{xtype:"button",template:button_16x_tmpl,icon:"testopia/img/delete.png",iconCls:"img_button_16x",tooltip:"Delete this Category",handler:function(){var C=Ext.getCmp("category_grid").getSelectionModel().getSelected();if(!C){Ext.MessageBox.alert("Message","Please select at least one Category to delete")}else{confirmCaseCategoryDelete(A)}}}]});this.on("rowcontextmenu",this.onContextClick,this);this.on("activate",this.onActivate,this);this.on("afteredit",this.onGridEdit,this)};Ext.extend(CaseCategoryGrid,Ext.grid.EditorGridPanel,{newRecord:function(){NewCategory=Ext.data.Record.create([{name:"name",type:"string"},{name:"description",type:"string"}]);var A=new NewCategory({name:"",description:""});var B=Ext.getCmp("category_grid");B.store.insert(0,A);B.startEditing(0,0)},onContextClick:function(B,A,C){B.getSelectionModel().selectRow(A);if(!this.menu){this.menu=new Ext.menu.Menu({id:"category-ctx-menu",items:[{text:"Add a Category",icon:"testopia/img/add.png",iconCls:"img_button_16x",handler:this.newRecord},{text:"Edit This Category",icon:"testopia/img/edit.png",iconCls:"img_button_16x",handler:function(){editFirstSelection(B)}},{text:"Refresh",icon:"testopia/img/refresh.png",iconCls:"img_button_16x",handler:function(){B.store.reload()}}]})}C.stopEvent();this.menu.showAt(C.getXY())},onGridEdit:function(D){var B=D.record.get("category_id");var A={product_id:this.product_id,category_id:B};var C=this.store;if(B){A.action="edit";switch(D.field){case"name":A.name=D.value;break;case"description":A.description=D.value;break}}else{A.action="add";A.name=D.value}this.form.submit({url:"tr_categories.cgi",params:A,success:function(F,E){if(E.result.category_id){D.record.set("category_id",E.result.category_id)}C.commitChanges()},failure:function(F,E){testopiaError(F,E);C.rejectChanges()}})},onActivate:function(A){if(!this.product_id){Ext.Msg.alert("Error","Please select a product.");Ext.getCmp("edit_category_btn").disable();Ext.getCmp("add_category_btn").disable();return }else{if(!this.store.getCount()){this.store.load({params:{product_id:this.product_id}})}}}});confirmCaseCategoryDelete=function(){if(!Ext.getCmp("category_grid").getSelectionModel().getSelected().get("category_id")){Ext.getCmp("category_grid").store.reload();return }Ext.Msg.show({title:"Confirm Delete?",msg:CASE_CATEGORY_DELETE_WARNING,buttons:Ext.Msg.YESNO,animEl:"casecategory-delete-btn",icon:Ext.MessageBox.QUESTION,fn:function(B){if(B=="yes"){var A=new Ext.form.BasicForm("testopia_helper_frm");A.submit({url:"tr_categories.cgi",params:{category_id:Ext.getCmp("category_grid").getSelectionModel().getSelected().get("category_id"),action:"delete",product_id:Ext.getCmp("category_grid").product_id},success:function(C){Ext.Msg.show({msg:"Test case category deleted",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO});Ext.getCmp("category_grid").store.reload()},failure:testopiaError})}}})};EnvironmentGrid=function(E,A){this.params=E;this.product_id=E.product_id;function B(F){return''+F+""}function D(F){return''+F+""}this.store=new EnvironmentStore(E,false);var C=this.store;this.columns=[{header:"ID",width:30,dataIndex:"environment_id",sortable:true,renderer:B,hideable:false},{header:"Environment Name",width:110,dataIndex:"name",id:"env_name_col",sortable:true,editor:new Ext.grid.GridEditor(new Ext.form.TextField({allowBlank:false}),{id:"env_name_edt"})},{header:"Product Name",width:150,dataIndex:"product",sortable:true,hidden:true},{header:"Run Count",width:30,dataIndex:"run_count",sortable:false},new Ext.grid.CheckColumn({sortable:true,header:"Active",dataIndex:"isactive",editor:new Ext.grid.GridEditor(new Ext.form.Checkbox({value:"isactive"})),width:25})];this.form=new Ext.form.BasicForm("testopia_helper_frm",{});this.bbar=new TestopiaPager("environment",this.store);EnvironmentGrid.superclass.constructor.call(this,{title:"Environments",id:"environment-grid",loadMask:{msg:"Loading Environments..."},autoExpandColumn:"env_name_col",autoScroll:true,sm:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{rowselect:function(H,F,G){Ext.getCmp("delete_env_list_btn").enable();Ext.getCmp("clone_env_list_btn").enable()},rowdeselect:function(H,F,G){if(H.getCount()<1){Ext.getCmp("delete_env_list_btn").disable();Ext.getCmp("clone_env_list_btn").disable()}}}}),viewConfig:{forceFit:true},tbar:[{xtype:"button",text:"Import",handler:this.importEnv.createDelegate(this)},new Ext.Toolbar.Fill(),{xtype:"button",id:"add_env_list_btn",template:button_16x_tmpl,icon:"testopia/img/add.png",iconCls:"img_button_16x",tooltip:"Add an Environment",handler:this.createEnv.createDelegate(this,["","add"])},{xtype:"button",id:"clone_env_list_btn",template:button_16x_tmpl,disabled:true,icon:"testopia/img/copy.png",iconCls:"img_button_16x",tooltip:"Clone this Environment",handler:this.cloneEnv.createDelegate(this)},{xtype:"button",id:"delete_env_list_btn",template:button_16x_tmpl,disabled:true,icon:"testopia/img/delete.png",iconCls:"img_button_16x",tooltip:"Delete this Environment",handler:this.deleteEnv.createDelegate(this)}]});Ext.apply(this,A);this.on("rowcontextmenu",this.onContextClick,this);this.on("afteredit",this.onGridEdit,this);this.on("activate",this.onActivate,this)};Ext.extend(EnvironmentGrid,Ext.grid.EditorGridPanel,{onContextClick:function(B,A,C){if(!this.menu){this.menu=new Ext.menu.Menu({id:"run-ctx-menu",items:[{text:"Create a new environment",handler:function(){window.location="tr_new_environment.cgi"}},{text:"Delete Environments",handler:this.deleteEnv.createDelegate(this)},{text:"Refresh List",icon:"testopia/img/refresh.png",iconCls:"img_button_16x",handler:function(){B.store.reload()}}]})}C.stopEvent();if(B.getSelectionModel().getCount()<1){B.getSelectionModel().selectRow(A)}this.menu.showAt(C.getXY())},onGridEdit:function(C){var A={env_id:C.record.get("environment_id")};var B=this.store;switch(C.field){case"name":A.action="rename";A.name=C.value;break;case"isactive":A.action="toggle";break}this.form.submit({url:"tr_environments.cgi",params:A,success:function(E,D){B.commitChanges()},failure:function(E,D){testopiaError(E,D);B.rejectChanges()}})},deleteEnv:function(){var A=this;Ext.Msg.show({title:"Confirm Delete?",msg:ENVIRONMENT_DELETE_WARNING,buttons:Ext.Msg.YESNO,animEl:"case-delete-btn",icon:Ext.MessageBox.QUESTION,fn:function(B){if(B=="yes"){form=new Ext.form.BasicForm("testopia_helper_frm",{});form.submit({url:"tr_environments.cgi",params:{env_id:A.getSelectionModel().getSelected().get("environment_id"),action:"delete"},success:function(){Ext.Msg.show({msg:"Test environment deleted",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO});A.store.reload()},failure:function(D,C){testopiaError(D,C);A.store.reload()}})}}})},createEnv:function(A,C,E){var B=this;C=C||"add";var D=new Ext.Window({id:"create-env-win",title:"Environment XML Import",closable:true,width:400,height:230,plain:true,shadow:false,layout:"fit",items:[{xtype:"form",url:"tr_environments.cgi",bodyStyle:"padding: 10px",id:"env_create_frm",items:[{xtype:"field",fieldLabel:"Name",inputType:"text",name:"name",value:A!=""?"Copy of "+A:"",allowBlank:false},new ProductCombo({mode:"local",fieldLabel:"Product",value:B.product_id,hiddenName:"product_id"}),{xtype:"hidden",name:"action",value:C},{xtype:"hidden",name:"env_id",value:E}],buttons:[{text:"Create",handler:function(){Ext.getCmp("env_create_frm").getForm().submit({success:function(F,G){Ext.Msg.show({title:"Test Environment Created",msg:"Test environment "+G.result.id+" Created. Would you like to go there now?",buttons:Ext.Msg.YESNO,icon:Ext.MessageBox.QUESTION,fn:function(H){if(H=="yes"){window.location="tr_environments.cgi?env_id="+G.result.id}else{B.store.reload()}}});Ext.getCmp("create-env-win").close()},failure:testopiaError})}},{text:"Cancel",handler:function(){Ext.getCmp("create-env-win").close()}}]}]});D.show(this)},cloneEnv:function(){this.createEnv(this.getSelectionModel().getSelected().get("name"),"clone",this.getSelectionModel().getSelected().get("environment_id"))},importEnv:function(){grid=this;var A=new Ext.Window({id:"import-env-win",title:"Environment XML Import",closable:true,width:400,height:130,plain:true,shadow:false,layout:"fit",items:[{xtype:"form",url:"tr_import_environment.cgi",bodyStyle:"padding: 10px",id:"env_xml_import_frm",fileUpload:true,items:[{xtype:"field",fieldLabel:"XML",inputType:"file",name:"xml",allowBlank:false}],buttons:[{text:"Import",handler:function(){Ext.getCmp("env_xml_import_frm").getForm().submit();Ext.getCmp("import-env-win").close();grid.store.reload()}},{text:"Cancel",handler:function(){Ext.getCmp("import-env-win").close()}}]}]});A.show(this)},onActivate:function(A){if(!this.store.getCount()){this.store.load()}}});Testopia.Search={};Testopia.Search.dashboard_urls=[];Testopia.Search.fillInForm=function(C,F,A){var E=document.getElementById(C+"_search_form");for(var B=0;B");var D;for(var F in H){if(typeof H[F]!="string"){continue}var B=searchToJson(H[F]);var J;typeof B.qname=="object"?J=B.qname[0]:J=B.qname;D=new Ext.ux.Portlet({title:J||" ",id:"search"+A.get("name")+F,closable:true,autoScroll:true,tools:PortalTools,url:H[F]});Ext.getCmp(I).add(D);Ext.getCmp(I).doLayout();I=I=="lc_"+A.get("name")?"rc_"+A.get("name"):"lc_"+A.get("name");D.load({scripts:true,url:H[F]})}}else{var E=searchToJson(A.get("query"));var C=E.current_tab;switch(C){case"plan":Ext.getCmp("object_panel").add(new PlanGrid(E,G));break;case"run":Ext.getCmp("object_panel").add(new RunGrid(E,G));break;case"case":Ext.getCmp("object_panel").add(new CaseGrid(E,G));break;default:Ext.Msg.show({title:"No Type Found",msg:"There must have been a problem saving this search. I can't find a type",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR});return }Ext.getCmp("object_panel").activate("search"+A.get("name"))}}});PortalTools=[{id:"gear",handler:function(D,C,A){var B=new Ext.form.BasicForm("testopia_helper_frm",{});this.menu=new Ext.menu.Menu({id:"portal_tools_menu",items:[{text:"Save",handler:function(){Ext.Msg.prompt("Save Report As","",function(E,F){if(E=="ok"){B.submit({url:"tr_query.cgi",params:{action:"save_query",query_name:F,query_part:A.url,type:1},success:function(){Ext.getCmp("reports_grid").store.load();A.title=F},failure:testopiaError})}})}},{text:"Refresh",icon:"testopia/img/refresh.png",iconCls:"img_button_16x",handler:function(){A.load({url:A.url})}},{text:"Link to this report",handler:function(){var H;if(A.url.match(/^http/)){H=A.url;H=H.replace(/\&noheader=1/gi,"")}else{var E=window.location;var F=E.pathname.match(/(.*)[\/\\]([^\/\\]+\.\w+)$/);F=F[1];H=E.protocol+"//"+E.host+F+"/"+A.url;H=H.replace(/\&noheader=1/gi,"")}var G=new Ext.Window({width:300,plain:true,shadow:false,items:[new Ext.form.TextField({value:H,width:287})]});G.show()}},{text:"Delete",handler:function(){Ext.Msg.show({title:"Confirm Delete?",icon:Ext.MessageBox.QUESTION,msg:"Are you sure you want to delete this report?",buttons:Ext.Msg.YESNO,fn:function(E,F){if(E=="yes"){B.submit({url:"tr_query.cgi",params:{action:"delete_query",query_name:A.title},success:function(){Ext.getCmp("reports_grid").store.load();A.ownerCt.remove(A,true)},failure:testopiaError})}}})}}]});D.stopEvent();this.menu.showAt(D.getXY())}},{id:"close",handler:function(C,B,A){A.ownerCt.remove(A,true)}}];Testopia.Tags={};Testopia.Tags.renderer=function(C,H,G,A,D,F,E,B){return'
'+C+"
"};Testopia.Tags.list=function(D,E,A){var B={title:"Tag Results: "+A,closable:true,id:A+"search"+E,autoScroll:true};var C={product_id:E,tags:A};var F;if(D=="case"){F=new CaseGrid(C,B)}else{if(D=="plan"){F=new PlanGrid(C,B)}else{if(D=="run"){F=new RunGrid(C,B)}}}Ext.getCmp("object_panel").add(F);Ext.getCmp("object_panel").activate(A+"search"+E)};TestopiaObjectTags=function(D,A){this.orig_id=A;this.obj_id=A;this.store=new Ext.data.JsonStore({url:"tr_tags.cgi",baseParams:{action:"gettags",type:D},root:"tags",id:"tag_id",fields:[{name:"tag_id",mapping:"tag_id"},{name:"tag_name",mapping:"tag_name"},{name:"run_count",mapping:"run_count"},{name:"case_count",mapping:"case_count"},{name:"plan_count",mapping:"plan_count"}]});var C=this.store;this.remove=function(){var F=new Ext.form.BasicForm("testopia_helper_frm",{});F.submit({url:"tr_tags.cgi",params:{action:"removetag",type:D,id:this.obj_id,tag:getSelectedObjects(Ext.getCmp(D+"tagsgrid"),"tag_name")},success:function(){C.reload()},failure:testopiaError})};this.add=function(){var F=new Ext.form.BasicForm("testopia_helper_frm",{});F.submit({url:"tr_tags.cgi",params:{action:"addtag",type:D,id:this.obj_id,tag:Ext.getCmp(D+"tag_lookup").getRawValue()},success:function(){C.reload()},failure:testopiaError})};this.columns=[{dataIndex:"tag_id",hidden:true,hideable:false},{header:"Name",width:150,dataIndex:"tag_name",id:"tag_name",sortable:true,hideable:false},{header:"Cases",width:35,dataIndex:"case_count",sortable:true,hidden:true,renderer:Testopia.Tags.renderer.createDelegate(this,["case"],true)},{header:"Runs",width:35,dataIndex:"run_count",sortable:true,hidden:true,renderer:Testopia.Tags.renderer.createDelegate(this,["run"],true)},{header:"Plans",width:35,dataIndex:"plan_count",sortable:true,hidden:true,renderer:Testopia.Tags.renderer.createDelegate(this,["plan"],true)}];var B=new Ext.Button({id:"tag_add_btn",icon:"testopia/img/add.png",iconCls:"img_button_16x",handler:this.add.createDelegate(this)});var E=new Ext.Button({icon:"testopia/img/delete.png",iconCls:"img_button_16x",handler:this.remove.createDelegate(this)});TestopiaObjectTags.superclass.constructor.call(this,{title:"Tags",split:true,region:"east",layout:"fit",width:200,autoExpandColumn:"tag_name",collapsible:true,id:D+"tagsgrid",loadMask:{msg:"Loading "+D+" tags..."},autoScroll:true,sm:new Ext.grid.RowSelectionModel({singleSelect:false}),viewConfig:{forceFit:true},tbar:[new TagLookup({id:D+"tag_lookup"}),B,E]});this.on("rowcontextmenu",this.onContextClick,this);this.on("activate",this.onActivate,this)};Ext.extend(TestopiaObjectTags,Ext.grid.GridPanel,{onContextClick:function(B,A,C){if(!this.menu){this.menu=new Ext.menu.Menu({id:"tags-ctx-menu",items:[{text:"Remove Selected Tags",icon:"testopia/img/delete.png",iconCls:"img_button_16x",handler:this.remove},{text:"Refresh List",icon:"testopia/img/refresh.png",iconCls:"img_button_16x",handler:function(){B.store.reload()}}]})}C.stopEvent();if(B.getSelectionModel().getCount()<1){B.getSelectionModel().selectRow(A)}this.menu.showAt(C.getXY())},onActivate:function(A){if(!this.store.getCount()||this.orig_id!=this.obj_id){this.store.load({params:{id:this.obj_id}})}}});TestopiaProductTags=function(F,C,A){var E;this.product_id=A;this.store=new Ext.data.JsonStore({url:"tr_tags.cgi",baseParams:{action:"gettags",type:C},root:"tags",id:"tag_id",fields:[{name:"tag_id",mapping:"tag_id"},{name:"tag_name",mapping:"tag_name"},{name:"run_count",mapping:"run_count"},{name:"case_count",mapping:"case_count"},{name:"plan_count",mapping:"plan_count"}]});var D=this.store;this.columns=[{header:"ID",dataIndex:"tag_id",hidden:true},{header:"Name",width:150,dataIndex:"tag_name",id:"tag_name",sortable:true},{header:"Cases",width:35,dataIndex:"case_count",sortable:true,renderer:Testopia.Tags.renderer.createDelegate(this,["case",A],true)},{header:"Runs",width:35,dataIndex:"run_count",sortable:true,renderer:Testopia.Tags.renderer.createDelegate(this,["run",A],true)},{header:"Plans",width:35,dataIndex:"plan_count",sortable:true,renderer:Testopia.Tags.renderer.createDelegate(this,["plan",A],true)}];var B=new Ext.form.TextField({allowBlank:true,id:"rungrid-filter",selectOnFocus:true});TestopiaProductTags.superclass.constructor.call(this,{title:F,id:C+"tags",loadMask:{msg:"Loading "+F+" ..."},autoExpandColumn:"tag_name",autoScroll:true,sm:new Ext.grid.RowSelectionModel({singleSelect:false}),viewConfig:{forceFit:true}});this.on("rowcontextmenu",this.onContextClick,this);this.on("activate",this.onActivate,this)};Ext.extend(TestopiaProductTags,Ext.grid.GridPanel,{onContextClick:function(B,A,C){if(!this.menu){this.menu=new Ext.menu.Menu({id:"tags-ctx-menu",items:[{text:"Refresh",icon:"testopia/img/refresh.png",iconCls:"img_button_16x",handler:function(){ds.reload()}}]})}C.stopEvent();this.menu.showAt(C.getXY())},onActivate:function(A){if(!this.store.getCount()){this.store.load({params:{product_id:this.product_id}})}}});TagsUpdate=function(B,A){function C(H,G,E){var F=new Ext.form.BasicForm("testopia_helper_frm",{});F.submit({url:"tr_tags.cgi",params:{action:H,tag:G,type:B,id:getSelectedObjects(E,B+"_id")},success:function(){},failure:testopiaError})}var D=new Ext.Window({title:"Add or Remove Tags",id:"tags_edit_win",layout:"fit",split:true,plain:true,shadow:false,width:350,height:150,items:[new Ext.FormPanel({labelWidth:"40",bodyStyle:"padding: 5px",items:[new TagLookup({fieldLabel:"Tags"})]})],buttons:[{text:"Add Tag",handler:function(){C("addtag",Ext.getCmp("tag_lookup").getRawValue(),A);D.close()}},{text:"Remove Tag",handler:function(){C("removetag",Ext.getCmp("tag_lookup").getRawValue(),A);D.close()}},{text:"Close",handler:function(){D.close()}}]});D.show()};
\ No newline at end of file
+ATTACHMENT_DELETE_WARNING="You are about to remove the selected attachments. This cannot be undone. Continue?";CASE_CATEGORY_DELETE_WARNING="You are about to delete the selected test case category. Are you sure you want to continue?";CASE_DELETE_WARNING="You are about to delete the selected test cases including all children and history. This action cannot be undone. Are you sure you want to continue?";PLAN_DELETE_WARNING="You are about to delete the selected test plans including all children and history. This action cannot be undone. Are you sure you want to continue?";RUN_DELETE_WARNING="You are about to delete the selected test runs including all children and history. This action cannot be undone. Are you sure you want to continue?";CASERUN_DELETE_WARNING="You are about to remove the selected test cases from this run including all history. This action cannot be undone. Are you sure you want to continue?";ENVIRONMENT_DELETE_WARNING="You are about to delete the selected test environment including associated test case data. This action cannot be undone. Are you sure you want to continue?";Ext.state.Manager.setProvider(new Ext.state.CookieProvider({expires:new Date(new Date().getTime()+(1000*60*60*24*30))}));Ext.data.Connection.timeout=120000;Ext.Updater.defaults.timeout=120000;Ext.Ajax.timeout=120000;var Testopia={};Testopia.Util={};Testopia.Environment={};Ext.grid.CheckColumn=function(A){Ext.apply(this,A);if(!this.id){this.id=Ext.id()}this.renderer=this.renderer.createDelegate(this)};Ext.grid.CheckColumn.prototype={init:function(A){this.grid=A;this.grid.on("render",function(){var B=this.grid.getView();B.mainBody.on("mousedown",this.onMouseDown,this)},this)},onMouseDown:function(D,C){if(C.className&&C.className.indexOf("x-grid3-cc-"+this.id)!=-1){D.stopEvent();var B=this.grid.getView().findRowIndex(C);var A=this.grid.store.getAt(B);A.set(this.dataIndex,!A.data[this.dataIndex])}},renderer:function(B,C,A){C.css+=" x-grid3-check-col-td";return'
'}};TestopiaUtil=function(){this.statusIcon=function(B){return''};this.caseLink=function(G,B,F,C,D,E){if(E.isTreport===true){return''+G+""}return''+G+""};this.runLink=function(G,B,F,C,D,E){if(E.isTreport===true){return''+G+""}return''+G+""};this.planLink=function(G,B,F,C,D,E){if(E.isTreport===true){return''+G+""}return''+G+""};this.bugLink=function(G,B,F,C,D,E){if(E.isTreport===true){return''+G+""}return''+G+""};this.newRunPopup=function(C){var B=new Ext.Window({id:"newRun-win",closable:true,width:Ext.getBody().getViewSize().width-150,height:Ext.getBody().getViewSize().height-150,plain:true,shadow:false,layout:"fit",items:[new NewRunForm(C)]});B.show(this)};this.newCaseForm=function(E,C,B){var D=new Ext.Window({id:"newcase-win",closable:true,width:Ext.getBody().getViewSize().width-150,height:Ext.getBody().getViewSize().height-150,plain:true,shadow:false,layout:"fit",items:[new NewCaseForm(E,C,B)]});D.show(this)};this.addCaseToRunPopup=function(C){var B=new Ext.Window({id:"add_case_to_run_win",closable:true,width:Ext.getBody().getViewSize().width-150,height:Ext.getBody().getViewSize().height-150,plain:true,shadow:false,layout:"fit",items:[new AddCaseToRunForm(C)]});B.show(this)};this.newPlanPopup=function(B){var C=new Ext.Window({id:"newplan-win",closable:true,width:800,height:550,plain:true,shadow:false,layout:"fit",items:[new NewPlanForm(B)]});C.show(this)};addOption=function(B,C){try{B.add(C,null)}catch(D){B.add(C,B.length)}};lsearch=function(D,B){if(typeof B!="object"){if(B==D){return true}return false}for(var C in B){if(B[C]==D){return true}}return false};this.addOption=addOption;var A=function(H,C){var E=searchToJson(window.location.search);if(C){E.product=C}for(var D in H.selectTypes){if(typeof H.selectTypes[D]!="function"){try{document.getElementById(H.selectTypes[D]).options.length=0;for(var B in H[H.selectTypes[D]]){if(typeof H[H.selectTypes[D]][B]!="function"){var G=new Option(H[H.selectTypes[D]][B],H[H.selectTypes[D]][B],false,lsearch(H[H.selectTypes[D]][B],E[H.selectTypes[D]]));addOption(document.getElementById(H.selectTypes[D]),G)}}document.getElementById(H.selectTypes[D]).disabled=false;document.getElementById(H.selectTypes[D])}catch(F){}}}};this.fillSelects=A;this.onProductSelection=function(B){var E=[];for(var C=0;C
','
',"
");UserLookup=function(A){UserLookup.superclass.constructor.call(this,{id:A.id||"user_lookup",store:new Ext.data.JsonStore({url:"tr_quicksearch.cgi",baseParams:{action:"getuser"},root:"users",totalProperty:"total",id:"login",fields:[{name:"login",mapping:"id"},{name:"name",mapping:"name"}]}),listeners:{valid:function(B){B.value=B.getRawValue()},beforequery:function(C){if(A.multistring){var B=C.query.match(/(^.*),(.*)/);if(B){C.combo.multivalue=B[1];C.query=B[2]}}},select:function(E,D,C){if(A.multistring){var B=E.multivalue||"";B=B?B+", "+D.get("login"):D.get("login");E.setValue(B)}}},queryParam:"search",loadingText:"Looking up users...",displayField:"login",valueField:"login",typeAhead:true,hideTrigger:true,minListWidth:300,forceSelection:false,emptyText:"Type a username...",pageSize:20,tpl:'
{name}
{login}
'});Ext.apply(this,A)};Ext.extend(UserLookup,Ext.form.ComboBox);TagLookup=function(A){TagLookup.superclass.constructor.call(this,{id:A.id||"tag_lookup",store:new Ext.data.JsonStore({url:"tr_quicksearch.cgi",baseParams:{action:"gettag"},root:"tags",totalProperty:"total",fields:[{name:"id",mapping:"tag_id"},{name:"name",mapping:"tag_name"}]}),queryParam:"search",loadingText:"Looking up tags...",displayField:"name",valueField:"id",typeAhead:false,hiddenName:"tag",hideTrigger:true,minListWidth:300,minChars:2,width:150,editable:true,forceSelection:false,emptyText:"Type a tagname...",listeners:{specialkey:function(B,C){if(C.getKey()==C.ENTER){Ext.getCmp("tag_add_btn").fireEvent("click")}}}});Ext.apply(this,A)};Ext.extend(TagLookup,Ext.form.ComboBox);BuildCombo=function(A){BuildCombo.superclass.constructor.call(this,{id:A.id||"build_combo",store:A.transform?false:new BuildStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up builds...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Builds..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(BuildCombo,Ext.form.ComboBox);CaseCategoryCombo=function(A){CaseCategoryCombo.superclass.constructor.call(this,{id:A.id||"case_category_combo",store:A.transform?false:new CaseCategoryStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up categories...",displayField:"name",valueField:"category_id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(CaseCategoryCombo,Ext.form.ComboBox);EnvironmentCombo=function(A){if(A.params){A.params.viewall=1}EnvironmentCombo.superclass.constructor.call(this,{id:A.id||"environment_combo",store:A.transform?false:new EnvironmentStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up environments...",displayField:"name",valueField:"environment_id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Environments..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(EnvironmentCombo,Ext.form.ComboBox);ProductCombo=function(A){ProductCombo.superclass.constructor.call(this,{id:A.id||"product_combo",store:A.transform?false:new ProductStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up products...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(ProductCombo,Ext.form.ComboBox);ProductVersionCombo=function(A){ProductVersionCombo.superclass.constructor.call(this,{id:A.id||"product_version_combo",store:A.transform?false:new ProductVersionStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up versions...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(ProductVersionCombo,Ext.form.ComboBox);CaseRunStatusCombo=function(A){CaseRunStatusCombo.superclass.constructor.call(this,{id:A.id||"case_run_status_combo",store:A.transform?false:new CaseRunStatusStore(A.mode=="local"?true:false),loadingText:"Looking up statuses...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(CaseRunStatusCombo,Ext.form.ComboBox);CaseStatusCombo=function(A){CaseStatusCombo.superclass.constructor.call(this,{id:A.id||"case_status_combo",store:A.transform?false:new CaseStatusStore(A.mode=="local"?true:false),loadingText:"Looking up statuses...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:100,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(CaseStatusCombo,Ext.form.ComboBox);ComponentCombo=function(A){ComponentCombo.superclass.constructor.call(this,{id:A.id||"component_combo",store:A.transform?false:new ComponentStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up Components...",displayField:"name",valueField:"id",editable:false,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(ComponentCombo,Ext.form.ComboBox);MilestoneCombo=function(A){MilestoneCombo.superclass.constructor.call(this,{id:A.id||"milestone_combo",store:A.transform?false:new MilestoneStore(A.params,A.mode=="local"?true:false),loadingText:"Looking up milestones...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(MilestoneCombo,Ext.form.ComboBox);PlanTypesCombo=function(A){PlanTypesCombo.superclass.constructor.call(this,{id:A.id||"plan_type_combo",store:A.transform?false:new PlanTypesStore(A.mode=="local"?true:false),loadingText:"Looking up types...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:300,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(PlanTypesCombo,Ext.form.ComboBox);PriorityCombo=function(A){PriorityCombo.superclass.constructor.call(this,{id:A.id||"priority_combo",store:A.transform?false:new PriorityStore(A.mode=="local"?true:false),loadingText:"Looking up priorities...",displayField:"name",valueField:"id",typeAhead:true,triggerAction:"all",minListWidth:100,forceSelection:true,transform:A.transform,emptyText:"Please select..."});Ext.apply(this,A);this.store.on("load",function(){if(A.value){this.setValue(A.value)}},this)};Ext.extend(PriorityCombo,Ext.form.ComboBox);RunProgress=function(A){RunProgress.superclass.constructor.call(this,A)};Ext.extend(RunProgress,Ext.ProgressBar,{onRender:function(C,A){Ext.ProgressBar.superclass.onRender.call(this,C,A);var B=new Ext.Template('
','
','','','','
',"
","
",'
',"
","
","
","
");if(A){this.el=B.insertBefore(A,{cls:this.baseCls},true)}else{this.el=B.append(C,{cls:this.baseCls},true)}if(this.id){this.el.dom.id=this.id}this.progressBar=Ext.get(this.el.dom.firstChild);this.gbar=Ext.get(this.progressBar.dom.firstChild);this.rbar=Ext.get(this.gbar.dom.nextSibling);this.obar=Ext.get(this.rbar.dom.nextSibling);if(this.textEl){this.textEl=Ext.get(this.textEl);delete this.textTopEl}else{this.textTopEl=Ext.get(this.progressBar.dom.childNodes[3]);var D=Ext.get(this.progressBar.dom.childNodes[4]);this.textTopEl.setStyle("z-index",99).addClass("x-hidden");this.textEl=new Ext.CompositeElement([this.textTopEl.dom.firstChild,D.dom.firstChild]);this.textEl.setWidth(this.progressBar.offsetWidth)}if(this.gvalue||this.rvalue||this.ovalue){this.updateProgress(this.gvalue,this.rvalue,this.ovalue,this.text)}else{this.updateText(this.text)}this.setSize(this.width||"auto","auto");this.progressBar.setHeight(this.progressBar.offsetHeight)},updateProgress:function(C,B,D,G){this.gvalue=C||0;this.rvalue=B||0;this.ovalue=D||0;if(G){this.updateText(G)}var F=Math.floor(C*this.el.dom.firstChild.offsetWidth);var E=Math.floor(B*this.el.dom.firstChild.offsetWidth);var A=Math.floor(D*this.el.dom.firstChild.offsetWidth);this.gbar.setWidth(F);this.rbar.setWidth(E);this.obar.setWidth(A);return this},setSize:function(A,B){Ext.ProgressBar.superclass.setSize.call(this,A,B);if(this.textTopEl){this.textEl.setSize(this.el.dom.offsetWidth,this.el.dom.offsetHeight)}return this}});DocCompareToolbar=function(B,C){var A=new Ext.data.JsonStore({url:"tr_history.cgi",baseParams:{action:"getdocversions",object:B,object_id:C},root:"list",fields:[{name:"id",mapping:"id"},{name:"name",mapping:"name"}]});this.toolbar=new Ext.Toolbar({id:"doc_compare_tbar",items:[new Ext.Toolbar.Fill(),new Ext.form.ComboBox({id:"doc_view",store:A,displayField:"name",valueField:"id",width:50,triggerAction:"all"}),{xtype:"button",id:"doc_view_btn",text:"View Version",handler:function(){var D=Ext.getCmp("object_panel").add({title:"Version "+Ext.getCmp("doc_view").getValue(),closable:true,autoScroll:true});D.show();D.load({url:"tr_history.cgi",params:{action:"showdoc",object:B,object_id:C,version:Ext.getCmp("doc_view").getValue()},failure:testopiaError})}}]});return this.toolbar};HistoryGrid=function(A,B){this.store=new Ext.data.JsonStore({url:"tr_history.cgi",baseParams:{action:"show",object:A,object_id:B},root:"list",fields:[{name:"what",mapping:"what"},{name:"who",mapping:"who"},{name:"oldvalue",mapping:"oldvalue"},{name:"newvalue",mapping:"newvalue"},{name:"when",mapping:"changed"}]});this.columns=[{header:"What",width:150,dataIndex:"what",sortable:true},{header:"Who",width:180,sortable:true,dataIndex:"who"},{header:"When",width:150,sortable:true,dataIndex:"when"},{header:"Old",width:180,sortable:true,dataIndex:"oldvalue"},{id:"new",header:"New",width:180,sortable:true,dataIndex:"newvalue"}];HistoryGrid.superclass.constructor.call(this,{title:"Change History",id:"history-grid",layout:"fit",loadMask:{msg:"Loading History..."},autoExpandColumn:"new",autoScroll:true,sm:new Ext.grid.RowSelectionModel({singleSelect:false})});this.on("rowcontextmenu",this.onContextClick,this);this.on("activate",this.onActivate,this)};Ext.extend(HistoryGrid,Ext.grid.GridPanel,{onActivate:function(){if(!this.store.getCount()){this.store.load()}},onContextClick:function(B,A,C){if(!this.menu){this.menu=new Ext.menu.Menu({id:"history-ctx-menu",items:[{text:"Refresh",icon:"testopia/img/refresh.png",iconCls:"img_button_16x",handler:function(){B.store.reload()}}]})}C.stopEvent();this.menu.showAt(C.getXY())}});Ext.override(Ext.form.Field,{fireKey:function(A){if(((Ext.isIE&&A.type=="keydown")||A.type=="keypress")&&A.isSpecialKey()){this.fireEvent("specialkey",this,A)}else{this.fireEvent(A.type,this,A)}},initEvents:function(){this.el.on("focus",this.onFocus,this);this.el.on("blur",this.onBlur,this);this.el.on("keydown",this.fireKey,this);this.el.on("keypress",this.fireKey,this);this.el.on("keyup",this.fireKey,this);this.originalValue=this.getValue()}});var TestopiaPager=function(D,B){this.type=D;function G(){this.updateInfo()}function F(){this.cursor=0;this.afterTextEl.el.innerHTML=String.format(this.afterPageText,1);this.field.dom.value=1;this.updateInfo()}var E=new Ext.form.ComboBox({store:new Ext.data.SimpleStore({fields:["value","name"],id:0,data:[[25,25],[50,50],[100,100],[500,500]],autoLoad:true}),id:D+"_page_sizer",mode:"local",displayField:"name",valueField:"value",triggerAction:"all",editable:false,width:50});E.on("select",function(J,I,H){this.pageSize=I.get("value");Ext.state.Manager.set("TESTOPIA_DEFAULT_PAGE_SIZE",I.get("value"));B.baseParams.limit=I.get("value");B.load({params:{start:0},callback:G.createDelegate(this)})},this);this.sizer=E;var A=new Ext.Button({text:"View All",enableToggle:true});A.on("toggle",function(H,I){if(I){this.pageSize=0;B.load({params:{viewall:1},callback:F.createDelegate(this)})}else{this.pageSize=E.getValue();B.load({params:{start:0,limit:E.getValue()}})}},this);var C=new Ext.form.TextField({allowBlank:true,id:D+"_paging_filter",selectOnFocus:true});C.on("specialkey",function(L,M){var I=M.getKey();if(I==M.ENTER){var N={start:0,limit:E.getValue()};var J=this.getValue();var H=J.match(/(^.*?):/);if(H){H=H[1];var K=Testopia.Util.trim(J.substr(J.indexOf(":")+1,J.length));if(H.match(/^start/i)){H="start_date"}if(H.match(/^stop/i)){H="stop_date"}if(H.match(/^manager/i)){H="manager"}switch(H){case"status":if(D=="case"){H="case_status"}else{if(D=="caserun"){H="case_run_status"}else{H="run_status";if(K.match(/running/i)){K=0}else{K=1}}}break;case"tester":H="default_tester";break;case"plan":H="plan_id";break;case"case":H="case_id";break;case"run":H="run_id";break;case"product_version":H="default_product_version";break}N[H]=K;N[H+"_type"]="substring"}else{if(D=="case"||D=="run"){N.summary=this.getValue();N.summary_type="allwordssubst"}else{if(D=="caserun"){N.case_summary=this.getValue();N.case_summary_type="allwordssubst"}else{N.name=this.getValue();N.name_type="allwordssubst"}}}B.load({params:N})}if((I==M.BACKSPACE||I==M.DELETE)&&this.getValue().length===0){B.load({params:{start:0,limit:E.getValue()}})}});E.on("render",function(){var H=new Ext.ToolTip({target:D+"_paging_filter",title:"Quick Search Filter",hideDelay:"500",html:"Enter column and search term separated by ':' Example: priority: P3"})});TestopiaPager.superclass.constructor.call(this,{id:D+"_pager",pageSize:Ext.state.Manager.get("TESTOPIA_DEFAULT_PAGE_SIZE",25),displayInfo:true,displayMsg:"Displaying test "+D+"s {0} - {1} of {2}",emptyMsg:"No test "+D+"s were found",store:B,items:[new Ext.menu.TextItem("Filter: "),C,new Ext.Toolbar.Spacer("_"),new Ext.Toolbar.Separator(),new Ext.menu.TextItem("View "),new Ext.Toolbar.Spacer("_"),E,new Ext.Toolbar.Spacer("_"),A,new Ext.Toolbar.Spacer("_"),new ToolbarText({text:"(FILTERED)",hidden:true,id:"filtered_txt",style:"font-weight:bold;color:red"})]});this.on("render",this.setPager,this);this.cursor=0};Ext.extend(TestopiaPager,Ext.PagingToolbar,{setPager:function(){Ext.getCmp(this.type+"_page_sizer").setValue(Ext.state.Manager.get("TESTOPIA_DEFAULT_PAGE_SIZE",25))}});var ToolbarText=function(A){ToolbarText.superclass.constructor.call(this,{id:A.id,text:A.text,style:A.style,hidden:A.hidden})};Ext.extend(ToolbarText,Ext.menu.BaseItem,{hideOnClick:false,itemCls:"x-menu-text",onRender:function(){var A=document.createElement("span");A.className=this.itemCls;A.innerHTML=this.text;this.el=A;Ext.menu.TextItem.superclass.onRender.apply(this,arguments)}});DashboardPanel=function(A){DashboardPanel.superclass.constructor.call(this,{title:A.title||"Dashboard",layout:"fit",closable:A.closable||false,id:A.id||"dashboardpanel",tbar:[{xtype:"button",text:"Add Custom Panel",handler:function(B,C){Ext.Msg.prompt("Enter URL","",function(E,G){if(E=="ok"){var D=G+"&noheader=1";Testopia.Search.dashboard_urls.push(D);var F=new Ext.ux.Portlet({title:"Custom",closable:true,autoScroll:true,tools:PortalTools,url:D});Ext.getCmp("dashboard_leftcol").add(F);Ext.getCmp("dashboard_leftcol").doLayout();F.load({url:D,scripts:false})}})}},new Ext.Toolbar.Fill()],items:[{xtype:"portal",margins:"35 5 5 0",items:[{columnWidth:0.5,baseCls:"x-plain",bodyStyle:"padding:10px 10px 10px 10px",id:A.lc||"dashboard_leftcol",items:[{title:" ",hidden:true}]},{columnWidth:0.5,baseCls:"x-plain",bodyStyle:"padding:10px 10px 10px 10px",id:A.rc||"dashboard_rightcol",items:[{title:" ",hidden:true}]}]}]});this.on("activate",this.onActivate,this)};Ext.extend(DashboardPanel,Ext.Panel,{onActivate:function(A){A.doLayout()}});TestopiaUpdateMultiple=function(B,D,A){var C=new Ext.form.BasicForm("testopia_helper_frm",{});D.ctype="json";D.action="update";C.submit({url:"tr_list_"+B+"s.cgi",params:D,success:function(G,E){if(B=="caserun"){Ext.getCmp("run_progress").updateProgress(E.result.passed,E.result.failed,E.result.blocked,E.result.complete)}TestopiaUtil.notify.msg("Test "+B+"s updated","The selected {0}s were updated successfully",B);if(A.selectedRows){A.store.baseParams.addcases=A.selectedRows.join(",");Ext.getCmp("filtered_txt").show()}try{Ext.getCmp("case_details_panel").store.reload()}catch(F){}A.store.reload({callback:function(){if(A.selectedRows){var K=A.getSelectionModel();var J=[];for(var I=0;I=0){J.push(H)}}K.selectRows(J);if(K.getCount()<1){Ext.getCmp("case_details_panel").disable()}}}})},failure:function(F,E){testopiaError(F,E);A.store.reload({callback:function(){if(A.selectedRows){A.getSelectionModel().selectRows(A.selectedRows)}}})}})};TestopiaComboRenderer=function(B,F,E,A,C,D){f=this.getColumnModel().getCellEditor(C,A).field;record=f.store.getById(B);if(record){return record.data[f.displayField]}else{return B}};testopiaError=function(C,A){C.el.unmask();var B;if(A.response.status&&A.response.status!=200){B={title:"System Error!",msg:A.response.responseText,buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR,minWidth:400}}else{B={title:"An Error Has Occurred",msg:A.result.message,buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR,minWidth:400}}Ext.Msg.show(B)};testopiaLoadError=function(){Ext.Msg.show({title:"An Error Has Occurred",msg:"There was an error loading the data",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})};getSelectedObjects=function(C,F){var E=C.getSelectionModel().getSelections();var A=[];var D;for(var B=0;B")}else{if(B=="custom"){D=E;E={report:true};A=1}else{if(B=="caserun"){E.current_tab="case_run"}else{E.current_tab=B}if(E.report){D="tr_"+B+"_reports.cgi?";A=1}else{D="tr_list_"+B+"s.cgi?";A=0}D=D+jsonToSearch(E,"",["ctype"])}}var C=new Ext.form.BasicForm("testopia_helper_frm",{});Ext.Msg.prompt("Save As","",function(F,G){if(F=="ok"){C.submit({url:"tr_query.cgi",params:{action:"save_query",query_name:G,query_part:D,type:A},success:function(){if(Ext.getCmp("searches_grid")){Ext.getCmp("searches_grid").store.load()}if(Ext.getCmp("reports_grid")){Ext.getCmp("reports_grid").store.load()}if(Ext.getCmp("dashboard_grid")){Ext.getCmp("dashboard_grid").store.load()}TestopiaUtil.notify.msg("Saved","Your search or report was saved.")},failure:testopiaError})}})};linkPopup=function(E){if(E.current_tab=="case_run"){E.current_tab="caserun"}var B;if(E.report==1){B="tr_"+E.current_tab+"_reports.cgi"}else{B="tr_list_"+E.current_tab+"s.cgi"}var A=window.location;var C=A.pathname.match(/(.*)[\/\\]([^\/\\]+\.\w+)$/);C=C[1];var D=new Ext.Window({width:300,plain:true,shadow:false,items:[new Ext.form.TextField({value:A.protocol+"//"+A.host+C+"/"+B+"?"+jsonToSearch(E,"",["ctype"]),width:287})]});D.show()};searchToJson=function(A){A=A.replace(/.*\//,"");var H={};var G=A.split("?",2);var D=G[0];var C=G[1]?G[1]:D;var E=C.split("&");for(var B=0;B','