function ViewMap(){this.setupHandler={};this.updateHandler={};this.extUpdateCallback={}}function ViewMap_simpleContentHandler(d,a){if(a==null){return}var b=document.getElementById(d);if(d=="DisplayView"){koioslayout.findById("main").unhideTabStripItem("details-tab");koioslayout.findById("main").setActiveTab("details-tab")}}ViewMap.prototype.simpleContentHandler=ViewMap_simpleContentHandler;function ViewMap_addInitHandler(b,a){this.setupHandler[b]=a}ViewMap.prototype.addInitHandler=ViewMap_addInitHandler;function ViewMap_initialize(b,a){if(b!=null){if(this.setupHandler[b]!=null){this.setupHandler[b](a)}else{this.simpleContentHandler(b,a)}}}ViewMap.prototype.initialize=ViewMap_initialize;function ViewMap_addUpdateHandler(b,a){this.updateHandler[b]=a}ViewMap.prototype.addUpdateHandler=ViewMap_addUpdateHandler;function ViewMap_update(b,a){if(b!=null){if(this.updateHandler[b]!=null){this.updateHandler[b](a)}else{this.simpleContentHandler(b,a)}}}ViewMap.prototype.update=ViewMap_update;function ViewMap_addExtUpdateCallback(b,a){this.extUpdateCallback[b]=a}ViewMap.prototype.addExtUpdateCallback=ViewMap_addExtUpdateCallback;function ViewMap_extUpdate(b,a){if(b!=null){if(this.extUpdateCallback[b]==null){this.extUpdateCallback[b]=new function(){}}Ext.get(b).update(a.getSimpleDatum(),true,this.extUpdateCallback[b])}}ViewMap.prototype.extUpdate=ViewMap_extUpdate;var ZeusViewMap=new ViewMap();function so_clearInnerHTML(a){while(a.firstChild){a.removeChild(a.firstChild)}}function callback(a){showExtMessageBox(INFO,"Loaded from file: "+a,"","")}function displayMessage(a){showExtMessageBox(INFO,a,"","")}var specialWindow=new Object();function createWindowView(a,b){if(specialWindow[a]!=null){specialWindow[a].focus()}else{specialWindow[a]=window.open(b,a,"scrollbars=yes,height=480,width=640");function c(){specialWindow[a]=null}specialWindow[a].onClose=c}}function EventCallback(d){if(d!=null&&typeof d=="object"){var a=d.events;for(var e in a){var c=a[e];var b=new ContentBean(c.content);if(c.eventType==INITIALIZE_EXT||c.eventType==UPDATE_EXT){ZeusViewMap.extUpdate(e,b)}else{if(c.eventType==INITIALIZE){ZeusViewMap.initialize(e,b)}else{if(c.eventType==UPDATE){ZeusViewMap.update(e,b)}else{if(c.eventType==ERROR_ACTION){removeLoading();showExtMessageBox(ERROR,"Error:"+b.getSimpleDatum(),"GCP Zeus: Error reported from server (event type is an error)",b.getSimpleDatum()+".\n\n You may provide more details on actions and queries made on the website. \n\n However you may send this email as is.")}else{ZeusViewMap.simpleContentHandler(e,b)}}}}}}else{showExtMessageBox(ERROR,"Problem getting data from server.","GCP Zeus: Problem getting data from server.","You may provide more details on actions and queries made on the website. "+ +"\n\nHowever you may send this email as is.")}}function objectEval(text){text=text.replace(/\n/g," ");text=text.replace(/\r/g," ");if(text.match(/^\s*\{.*\}\s*$/)){text="["+text+"][0]"}return eval(text)}var koioslayout=null;var germplasm_tabs_layout=null;var study_tabs_layout=null;var load_mask_indicator=Ext.isGecko;function prepare_help_tab(){if(about_url!=null){var a=document.getElementById("about_div");if(a!=null){a.innerHTML='<iframe src="'+about_url+'" marginheight="0" marginwidth="0" scrolling="no" frameborder="no" width="800px" height="1200px"> Your browser does not support frames. <a href="'+about_url+'" target="_blank">Click here</a> to view the page.</iframe>'}}if(faqs_url!=null){var b=document.getElementById("faqs_div");if(b!=null){b.innerHTML='<iframe src="'+faqs_url+'" marginheight="0" marginwidth="0" scrolling="no" frameborder="no" width="800px" height="1200px"> Your browser does not support frames. <a href="'+faqs_url+'" target="_blank">Click here</a> to view the page.</iframe>'}}}Ext.onReady(function(){var j;j={xtype:"tabpanel",id:"germplasm-main",title:"Germplasm Details",contentEl:"germplasm-main-div",margins:"0 5 5 5",activeTab:0,autoScroll:false,defaults:{plain:true,enableTabScroll:true,autoScroll:true,width:getWindowWidth()*0.8,height:getWindowHeight()*0.85},items:[{id:"germplasm-details-tab",contentEl:"germplasmDetailsTab",title:"Germplasm Details"},{id:"germplasm-studylist-tab",contentEl:"germplasmStudyListTab",title:"Germplasm Studies List"},{xtype:"tabpanel",plain:true,id:"germplasm-pedigree-main",title:"Germplasm Pedigrees",margins:"0 5 5 5"}]};var e={xtype:"tabpanel",id:"study-main",title:"Study Details",margins:"0 5 5 5",activeTab:0,autoScroll:false,defaults:{plain:true,enableTabScroll:true,autoScroll:true,width:getWindowWidth()*0.8,height:getWindowHeight()*0.9},items:[{id:"study-tab",contentEl:"studyTab",title:"Study Query"},{id:"study-obs-tab",contentEl:"studySimpleTableTab",title:"Study Observation Units",height:1100,autoWidth:true,autoScroll:true}]};var l={xtype:"tabpanel",id:"mutant-main",title:"Browse IR64 Mutants",margins:"0 5 5 5",activeTab:0,autoScroll:false,defaults:{plain:true,enableTabScroll:true,autoScroll:true,width:getWindowWidth()*0.9,height:getWindowHeight()*0.9},items:[{id:"phenotype-catalog-tab",contentEl:"phenotypeCatalogTab",title:"Query Mutants"},{id:"query-mutant-results-tab",contentEl:"queryMutantResultsTab",title:"Mutants List"}]};var c={xtype:"tabpanel",id:"trait-main",title:"Trait",margins:"0 5 5 5",activeTab:0,autoScroll:false,defaults:{plain:true,enableTabScroll:true,autoScroll:false,width:getWindowWidth()*0.8,height:getWindowHeight()*0.9},items:[{id:"trait-studylist-tab",contentEl:"traitStudyListTab",title:"Traits-Studies List"}]};var a={xtype:"tabpanel",margins:"0 5 5 5",title:"Help",id:"help-tab",activeTab:0,autoScroll:false,items:[{id:"about-tab",title:"About",contentEl:"about_div"},{id:"help-faqs-tab",title:"FAQs",contentEl:"faqs_div"}]};var f=[{id:"simplequery-tab",contentEl:"simpleQueryTab",title:"Query"},{xtype:"tabpanel",plain:true,id:"results-tab-main",title:"Results",activeTab:0,autoScroll:false,defaults:{plain:true,enableTabScroll:true,autoScroll:false,closable:true,height:getWindowHeight()*0.95,width:getWindowWidth()*0.8}},{id:"details-tab",contentEl:"detailsTab",title:"Details"},{id:"germplasmlist-tab",contentEl:"germplasmListTab",title:"Browse Germplasm Sets"},{title:"Browse Studies",id:"studyBrowser-tab",contentEl:"studyBrowserTab"},l,j,e,c,{id:"synopsis-tab",contentEl:"synopsisTab",title:"History"},a];koioslayout=new Ext.Viewport({hideBorders:true,items:[new Ext.TabPanel({region:"center",id:"main",autoScroll:false,deferredRender:false,layoutOnTabChange:true,enableTabScroll:true,width:getWindowWidth()*0.97,height:getWindowHeight()*0.97,defaults:{plain:true,enableTabScroll:true,autoScroll:false,height:getWindowHeight()*0.94},items:f})]});var h=koioslayout.findById("main");var g=koioslayout.findById("germplasm-main");var b=koioslayout.findById("study-main");var k=koioslayout.findById("trait-main");h.setActiveTab("simplequery-tab");h.hideTabStripItem("study-main");if((CurrentCropName=="wheat")||(CurrentCropName=="maize")){h.hideTabStripItem("mutant-main")}if((CurrentCropName.indexOf("iwis")!=-1)||(CurrentCropName.indexOf("imis")!=-1)){h.hideTabStripItem("mutant-main")}var d=koioslayout.findById("results-tab-main");d.setWidth(getWindowWidth()*0.94);d.setWidth(getWindowHeight()*0.95);h.hideTabStripItem("synopsis-tab");h.hideTabStripItem("results-tab-main");h.hideTabStripItem("details-tab");h.hideTabStripItem("germplasm-main");h.hideTabStripItem("trait-main");h.hideTabStripItem("simplequery-tab");h.hideTabStripItem("germplasmlist-tab");h.hideTabStripItem("studyBrowser-tab");g.hideTabStripItem("germplasm-details-tab");g.hideTabStripItem("germplasm-pedigree-main");g.hideTabStripItem("germplasm-studylist-tab");prepare_help_tab()});function showTab(b){var a=koioslayout.findById("main");if(b=="studyTab"){var a=koioslayout.findById("main");a.unhideTabStripItem("study-main");a.setActiveTab("study-main")}else{if(b=="mutant-main"){a.unhideTabStripItem("mutant-main");a.setActiveTab("mutant-main")}}}function ContentBean(a){if(a!=null){this.uniqueIdentifier=a.uniqueIdentifier;this.name=a.name;this.type=a.type;this.simpleDatum=a.simpleDatum;this.stringMap=a.stringMap;this.contentBeanMap=a.contentBeanMap;this.contentBeanList=a.contentBeanList}}new ContentBean();ContentBean.prototype.UNKNOWN=0;ContentBean.prototype.SIMPLE=1;ContentBean.prototype.STRING_MAP=2;ContentBean.prototype.CONTENT_BEAN_MAP=4;ContentBean.prototype.CONTENT_BEAN_SET=8;function ContentBean_setUniqueIdentifier(a){this.uniqueIdentifier=a}ContentBean.prototype.setUniqueIdentifier=ContentBean_setUniqueIdentifier;function ContentBean_getUniqueIdentifier(){return this.uniqueIdentifier}ContentBean.prototype.getUniqueIdentifier=ContentBean_getUniqueIdentifier;function ContentBean_setName(a){this.name=a}ContentBean.prototype.setName=ContentBean_setName;function ContentBean_getName(){return this.name}ContentBean.prototype.getName=ContentBean_getName;function ContentBean_getType(){return this.type}ContentBean.prototype.getType=ContentBean_getType;function ContentBean_setSimpleDatum(a){this.type|=this.SIMPLE;this.simpleDatum=a}ContentBean.prototype.setSimpleDatum=ContentBean_setSimpleDatum;function ContentBean_getSimpleDatum(){return this.simpleDatum}ContentBean.prototype.getSimpleDatum=ContentBean_getSimpleDatum;function ContentBean_setStringMap(a){this.type|=this.STRING_MAP;this.stringMap=a}ContentBean.prototype.setStringMap=ContentBean_setStringMap;function ContentBean_getStringMap(){return this.stringMap}ContentBean.prototype.getStringMap=ContentBean_getStringMap;function ContentBean_setContentBeanMap(a){this.type|=this.CONTENT_BEAN_MAP;this.contentBeanMap=a}ContentBean.prototype.setContentBeanMap=ContentBean_setContentBeanMap;function ContentBean_getContentBeanMap(){return this.contentBeanMap}ContentBean.prototype.getContentBeanMap=ContentBean_getContentBeanMap;function ContentBean_setContentBeanSet(a){this.type|=this.CONTENT_BEAN_SET;this.contentBeanSet=a}ContentBean.prototype.setContentBeanSet=ContentBean_setContentBeanSet;function ContentBean_getContentBeanSet(){return this.contentBeanSet}ContentBean.prototype.getContentBeanSet=ContentBean_getContentBeanSet;function SynopsisTableEntry(a){this.queryId=a;this.query="";this.dataSource="";this.dataSourceHits=""}function SynopsisTableEntries_addEntry(a){this.entries[this.entries.length]=a}function SynopsisTableEntries_deleteEntries(c){var f=0,b=0,d=0;var a=new Array();for(var e=0;e<this.entries.length;e++){if(e==c[b]){b++}else{a[d]=this.entries[e];d++}}this.entries=a}function SynopsisTableEntries(){this.entries=new Array();this.addEntry=SynopsisTableEntries_addEntry;this.deleteEntries=SynopsisTableEntries_deleteEntries}function dataSourceName(b){var a=b.split("_");return a[1]}function IdentifiersTableEntry(c,a,b){this.dataSource=c;this.identifierName=a;this.uniqueIdentifier=b}function IdentifiersTableEntries_addEntry(a){this.entries[this.entries.length]=a}function IdentifiersTableEntries_clearAll(){this.entries=new Array()}function IdentifiersTableEntries(){this.entries=new Array();this.addEntry=IdentifiersTableEntries_addEntry;this.clearAll=IdentifiersTableEntries_clearAll}var winHeight;var winWidth;function getWindowHeight(){if(typeof(window.innerHeight)=="number"){winHeight=window.innerHeight}else{if(typeof(window.innerHeight)=="undefined"){winHeight=document.body.clientHeight}}if(winHeight==0){winHeight=document.documentElement.clientHeight}if(winHeight==0){winHeight=600}return winHeight}function getWindowWidth(){if(typeof(window.innerHeight)=="number"){winWidth=window.innerWidth}else{if(typeof(window.innerHeight)=="undefined"){winWidth=document.body.clientWidth}}if(winWidth==0){winWidth=document.documentElement.clientWidth}if(winWidth==0){winWidth=600}return winWidth}function setStatusMessage(d,c){if((d=="submitStatus")&&(c=="&nbsp;")){var b=document.getElementById(d);if(b!=null){b.innerHTML=c}}else{var a=document.getElementById(d);if(a){a.innerHTML=c}}}function clearStatusMessage(b){var a=document.getElementById(b);if(a){a.innerHTML="&nbsp;"}}function setProcessStatus(a){setStatusMessage(a,"<img src='javascript/lib/ext2.1/img/loading.gif' alt='' />&nbsp;processing...")}function setProcessStatusWithCancel(b){var a=document.getElementById(b);if(a){a.innerHTML="<img src='javascript/lib/ext2.1/img/loading.gif' alt='' />&nbsp;processing...<input class='x-btn id='cancel_button' type='button' onClick='cancelQueryProcess();setProcessStatusToCancelled("+b+")' value='cancel query'>"}}function setProcessStatusToCancelled(b){var a=document.getElementById(b);if(a){a.innerHTML="<b>transaction cancelled.</b>"}}function createSpan(a){var b=document.createElement("span")}function showExtMessageBox(a,c,b,d){var e=Ext.MessageBox.ERROR;if(a==ERROR){e=Ext.MessageBox.ERROR;Ext.Msg.show({title:a,width:400,msg:c+". You may contact the <a href='mailto:"+website_admin_email+"?subject="+b+"&body="+d+"'>website administrator</a>",buttons:Ext.MessageBox.OK,icon:e})}else{if(a==INFO){e=Ext.MessageBox.INFO;Ext.Msg.alert("",c)}}}var ua=navigator.userAgent.toLowerCase();var isIE=((ua.indexOf("msie")!=-1)&&(ua.indexOf("opera")==-1)&&(ua.indexOf("webtv")==-1));function Toggle(b){var c=document.getElementById(b);var a=document.getElementById(b+"_alt");if(c){if(c.style.display=="block"){c.style.display="none";a.style.display="block"}else{c.style.display="block";a.style.display="none"}}}function removeLoading(){var b=Ext.get("loading");var a=Ext.get("loading-mask");if(a){if(b){a.shift({xy:b.getXY(),width:b.getWidth(),height:b.getHeight(),remove:true,opacity:0.3,easing:"bounceOut",callback:function(){b.fadeOut({duration:0.2,remove:true})}})}}}function requestFailed(b,a,c){Ext.MessageBox.alert("Error Message","Please contact support with the following: Status: "+a.status+", Status Text: "+a.statusText)}function copyText(c){if(window.clipboardData){window.clipboardData.setData("Text",""+c)}else{if(window.netscape){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");var b=Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);b.copyString(c)}catch(a){return showExtMessageBox(INFO,"Your browser needs to be tuned to support 'copy to clipboard' feature (set signed.applets.codebase_principal_support to true). "+ +"\nPlease contact your IT helpdesk. "+sText,"","")}}else{return showExtMessageBox(INFO,"Your browser does not support copying to clipboard."+sText,"","")}}}function LSID(e){var b=e.split(":");var d=b[0];var a=d.toLowerCase();var c=b[1];var f=c.toLowerCase();if(a!="urn"||f!="lsid"){throw new Error("LSID '"+e+"' is invalid?")}this.authority=b[2];this.nameSpace=b[3];this.objectId=b[4];this.version=b[5]}var reqXML;function LoadXMLDoc(a){if(window.XMLHttpRequest){reqXML=new XMLHttpRequest();reqXML.onreadystatechange=BuildXMLResults;reqXML.open("GET",a,true);reqXML.send(null)}else{if(window.ActiveXObject){reqXML=new ActiveXObject("Microsoft.XMLHTTP");if(reqXML){reqXML.onreadystatechange=BuildXMLResults;reqXML.open("GET",a,true);reqXML.send()}}else{showExtMessageBox(INFO,"This website requires the use of newer browser versions that support AJAX.","","")}}}function BuildXMLResults(){if(reqXML.readyState==4){if(reqXML.status==200){if(reqXML.responseText.indexOf("Session Updated - Server Time:")!=-1){window.status=reqXML.responseText;SetTimer()}else{showExtMessageBox(INFO,"Your user session has expired. Cache was reset.","","")}}else{}}}function ConfirmUpdate(){if(confirm("Your session is about to expire. Press 'OK' to renew your session.")){LoadXMLDoc("sessionUpdater.jsp")}}function AutoRenewSession(){Workbench.action(GLOBAL_CONFIGURATION,RENEW_USER_SESSION,{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback);LoadXMLDoc("sessionUpdater.jsp")}var timerObj;function SetTimer(){var a=50;timerObj=setTimeout("AutoRenewSession()",1000*60*a)}SetTimer();Array.prototype.contains=function(a){return this.indexOf(a)!==-1};Ext.namespace("Ext.ux");Ext.ux.DDView=function(b){if(!b.itemSelector){var a=b.tpl;if(this.classRe.test(a)){b.tpl=a.replace(this.classRe,"class=$1x-combo-list-item $2$1")}else{b.tpl=a.replace(this.tagRe,'$1 class="x-combo-list-item" $2')}b.itemSelector=".x-combo-list-item"}Ext.ux.DDView.superclass.constructor.call(this,Ext.apply(b,{border:false}))};Ext.extend(Ext.ux.DDView,Ext.DataView,{dragDisabled:false,sortDir:"ASC",isFormField:true,classRe:/class=(['"])(.*)\1/,tagRe:/(<\w*)(.*?>)/,reset:Ext.emptyFn,clearInvalid:Ext.form.Field.prototype.clearInvalid,msgTarget:"qtip",afterRender:function(){Ext.ux.DDView.superclass.afterRender.call(this);if(this.dragGroup){this.setDraggable(this.dragGroup.split(","))}if(this.dropGroup){this.setDroppable(this.dropGroup.split(","))}if(this.deletable){this.setDeletable()}this.isDirtyFlag=false;this.addEvents("drop")},validate:function(){return true},onDestroy:function(){this.purgeListeners();this.getEl().removeAllListeners();this.getEl().remove();if(this.dragZone){Ext.dd.ScrollManager.unregister(this.dragZone.el);if(this.dragZone.destroy){this.dragZone.destroy();this.dragZone.proxy.el.destroy()}}if(this.dropZone){Ext.dd.ScrollManager.unregister(this.dropZone.el);if(this.dropZone.destroy){this.dropZone.destroy()}}Ext.ux.DDView.superclass.onDestroy.call(this)},getName:function(){return this.name},setValue:function(a){if(!this.store){throw"DDView.setValue(). DDView must be constructed with a valid Store"}var b={};b[this.store.reader.meta.root]=a?[].concat(a):[];this.store.proxy=new Ext.data.MemoryProxy(b);this.store.load()},getValue:function(){var a="(";this.store.each(function(b){a+=b.id+","});return a.substr(0,a.length-1)+")"},getIds:function(){var b=0,a=new Array(this.store.getCount());this.store.each(function(c){a[b++]=c.id});return a},isDirty:function(){return this.isDirtyFlag},getTargetFromEvent:function(b){var a=b.getTarget();while((a!==null)&&(a.parentNode!=this.el.dom)){a=a.parentNode}if(!a){a=this.el.dom.lastChild||this.el.dom}return a},getDragData:function(d){var c=this.findItemFromChild(d.getTarget());if(c){if(!this.isSelected(c)){delete this.ignoreNextClick;this.onItemClick(c,this.indexOf(c),d);this.ignoreNextClick=true}var b={sourceView:this,viewNodes:[],records:[],copy:this.copy||(this.allowCopy&&d.ctrlKey)};if(this.getSelectionCount()==1){var a=this.getSelectedIndexes()[0];var f=this.getNode(a);b.viewNodes.push(b.ddel=f);b.records.push(this.store.getAt(a));b.repairXY=Ext.fly(f).getXY()}else{b.ddel=document.createElement("div");b.ddel.className="multi-proxy";this.collectSelection(b)}return b}return false},getRepairXY:function(a){return this.dragData.repairXY},collectSelection:function(b){b.repairXY=Ext.fly(this.getSelectedNodes()[0]).getXY();if(this.preserveSelectionOrder===true){Ext.each(this.getSelectedIndexes(),function(c){var e=this.getNode(c);var d=e.cloneNode(true);d.id=Ext.id();b.ddel.appendChild(d);b.records.push(this.store.getAt(c));b.viewNodes.push(e)},this)}else{var a=0;this.store.each(function(d){if(this.isSelected(a)){var e=this.getNode(a);var c=e.cloneNode(true);c.id=Ext.id();b.ddel.appendChild(c);b.records.push(this.store.getAt(a));b.viewNodes.push(e)}a++},this)}},setDraggable:function(a){if(a instanceof Array){Ext.each(a,this.setDraggable,this);return}if(this.dragZone){this.dragZone.addToGroup(a)}else{this.dragZone=new Ext.dd.DragZone(this.getEl(),{containerScroll:true,ddGroup:a});if(!this.multiSelect){this.singleSelect=true}this.dragZone.getDragData=this.getDragData.createDelegate(this);this.dragZone.getRepairXY=this.getRepairXY;this.dragZone.onEndDrag=this.onEndDrag}},setDroppable:function(a){if(a instanceof Array){Ext.each(a,this.setDroppable,this);return}if(this.dropZone){this.dropZone.addToGroup(a)}else{this.dropZone=new Ext.dd.DropZone(this.getEl(),{owningView:this,containerScroll:true,ddGroup:a});this.dropZone.getTargetFromEvent=this.getTargetFromEvent.createDelegate(this);this.dropZone.onNodeEnter=this.onNodeEnter.createDelegate(this);this.dropZone.onNodeOver=this.onNodeOver.createDelegate(this);this.dropZone.onNodeOut=this.onNodeOut.createDelegate(this);this.dropZone.onNodeDrop=this.onNodeDrop.createDelegate(this)}},getDropPoint:function(g,k,d){if(k==this.el.dom){return"above"}var f=Ext.lib.Dom.getY(k),a=f+k.offsetHeight;var j=f+(a-f)/2;var h=Ext.lib.Event.getPageY(g);if(h<=j){return"above"}else{return"below"}},isValidDropPoint:function(b,e,a){if(this.dragDisabled){return false}if(!a.viewNodes||(a.viewNodes.length!=1)){return true}var c=a.viewNodes[0];if(c==e){return false}if((b=="below")&&(e.nextSibling==c)){return false}if((b=="above")&&(e.previousSibling==c)){return false}return true},onNodeEnter:function(d,a,c,b){if(this.highlightColor&&(b.sourceView!=this)){this.el.highlight(this.highlightColor)}return false},onNodeOver:function(h,a,g,d){var b=this.dropNotAllowed;var f=this.getDropPoint(g,h,a);if(this.isValidDropPoint(f,h,d)){if(this.appendOnly||this.sortField){return"x-tree-drop-ok-below"}if(f){var c;if(f=="above"){b=h.previousSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-above";c="x-view-drag-insert-above"}else{b=h.nextSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-below";c="x-view-drag-insert-below"}if(this.lastInsertClass!=c){Ext.fly(h).replaceClass(this.lastInsertClass,c);this.lastInsertClass=c}}}return b},onNodeOut:function(d,a,c,b){this.removeDropIndicators(d)},onNodeDrop:function(c,k,h,f){if(this.dragDisabled){return false}if(this.fireEvent("drop",this,c,k,h,f)===false){return false}var l=this.getDropPoint(h,c,k);var d=(this.appendOnly||(c==this.el.dom))?this.store.getCount():c.viewIndex;if(l=="below"){d++}if(f.sourceView==this){if(l=="below"){if(f.viewNodes[0]==c){f.viewNodes.shift()}}else{if(f.viewNodes[f.viewNodes.length-1]==c){f.viewNodes.pop()}}if(!f.viewNodes.length){return false}if(d>this.store.indexOf(f.records[0])){d--}}if(f.node instanceof Ext.tree.TreeNode){var a=f.node.getOwnerTree().recordFromNode(f.node);if(a){f.records=[a]}}if(!f.records){alert("Programming problem. Drag data contained no Records");return false}for(var g=0;g<f.records.length;g++){var a=f.records[g];var b=this.store.getById(a.id);if(b&&(k!=this.dragZone)){if(!this.allowDup&&!this.allowTrash){Ext.fly(this.getNode(this.store.indexOf(b))).frame("red",1);return true}var j=new Ext.data.Record();a.id=j.id;delete j}if(f.copy){this.store.insert(d++,a.copy())}else{if(f.sourceView){f.sourceView.isDirtyFlag=true;f.sourceView.store.remove(a)}if(!this.allowTrash){this.store.insert(d++,a)}}if(this.sortField){this.store.sort(this.sortField,this.sortDir)}this.isDirtyFlag=true}this.dragZone.cachedTarget=null;return true},onEndDrag:function(a,b){var c=Ext.get(this.dragData.ddel);if(c&&c.hasClass("multi-proxy")){c.remove()}},removeDropIndicators:function(a){if(a){Ext.fly(a).removeClass(["x-view-drag-insert-above","x-view-drag-insert-left","x-view-drag-insert-right","x-view-drag-insert-below"]);this.lastInsertClass="_noclass"}},setDeletable:function(a){if(!this.singleSelect&&!this.multiSelect){this.singleSelect=true}var b=this.getContextMenu();this.contextMenu.on("itemclick",function(c){switch(c.id){case"delete":this.remove(this.getSelectedIndexes());break}},this);this.contextMenu.add({icon:a||AU.resolveUrl("/images/delete.gif"),id:"delete",text:AU.getMessage("deleteItem")})},getContextMenu:function(){if(!this.contextMenu){this.contextMenu=new Ext.menu.Menu({id:this.id+"-contextmenu"});this.el.on("contextmenu",this.showContextMenu,this)}return this.contextMenu},disableContextMenu:function(){if(this.contextMenu){this.el.un("contextmenu",this.showContextMenu,this)}},showContextMenu:function(b,a){a=this.findItemFromChild(b.getTarget());if(a){b.stopEvent();this.select(this.getNode(a),this.multiSelect&&b.ctrlKey,true);this.contextMenu.showAt(b.getXY())}},remove:function(b){b=[].concat(b);for(var a=0;a<b.length;a++){var c=this.store.getAt(b[a]);this.store.remove(c)}},onDblClick:function(f){var d=this.findItemFromChild(f.getTarget());if(d){if(this.fireEvent("dblclick",this,this.indexOf(d),d,f)===false){return false}if(this.dragGroup){var a=Ext.dd.DragDropMgr.getRelated(this.dragZone,true);while(a.contains(this.dropZone)){a.remove(this.dropZone)}if((a.length==1)&&(a[0].owningView)){this.dragZone.cachedTarget=null;var b=Ext.get(a[0].getEl());var c=b.getBox(true);a[0].onNodeDrop(b.dom,{target:b.dom,xy:[c.x,c.y+c.height-1]},null,this.getDragData(f))}}}},onItemClick:function(b,a,c){if(this.ignoreNextClick){delete this.ignoreNextClick;return}if(this.fireEvent("beforeclick",this,a,b,c)===false){return false}if(this.multiSelect||this.singleSelect){if(this.multiSelect&&c.shiftKey&&this.lastSelection){this.select(this.getNodes(this.indexOf(this.lastSelection),a),false)}else{if(this.isSelected(b)&&c.ctrlKey){this.deselect(b)}else{this.deselect(b);this.select(b,this.multiSelect&&c.ctrlKey);this.lastSelection=b}}c.preventDefault()}return true}});Ext.ux.Multiselect=Ext.extend(Ext.form.Field,{store:null,dataFields:[],data:[],width:100,height:100,displayField:0,valueField:1,allowBlank:true,minLength:0,maxLength:Number.MAX_VALUE,blankText:Ext.form.TextField.prototype.blankText,minLengthText:"Minimum {0} item(s) required",maxLengthText:"Maximum {0} item(s) allowed",copy:false,allowDup:false,allowTrash:false,legend:null,focusClass:undefined,delimiter:",",view:null,dragGroup:null,dropGroup:null,tbar:null,appendOnly:false,sortField:null,sortDir:"ASC",defaultAutoCreate:{tag:"div"},initComponent:function(){Ext.ux.Multiselect.superclass.initComponent.call(this);this.addEvents({dblclick:true,click:true,change:true,drop:true})},onRender:function(e,b){var a,c,d;Ext.ux.Multiselect.superclass.onRender.call(this,e,b);c="ux-mselect";a=new Ext.form.FieldSet({renderTo:this.el,title:this.legend,height:this.height,width:this.width,style:"padding:1px;",tbar:this.tbar});if(!this.legend){a.el.down("."+a.headerCls).remove()}a.body.addClass(c);d='<tpl for="."><div class="'+c+"-item";if(Ext.isIE||Ext.isIE7){d+='" unselectable=on'}else{d+=' x-unselectable"'}d+=">{"+this.displayField+"}</div></tpl>";if(!this.store){this.store=new Ext.data.SimpleStore({fields:this.dataFields,data:this.data})}this.view=new Ext.ux.DDView({multiSelect:true,store:this.store,selectedClass:c+"-selected",tpl:d,allowDup:this.allowDup,copy:this.copy,allowTrash:this.allowTrash,dragGroup:this.dragGroup,dropGroup:this.dropGroup,itemSelector:"."+c+"-item",isFormField:false,applyTo:a.body,appendOnly:this.appendOnly,sortField:this.sortField,sortDir:this.sortDir});this.view.on("click",this.onViewClick,this);this.view.on("beforeClick",this.onViewBeforeClick,this);this.view.on("dblclick",this.onViewDblClick,this);this.view.on("drop",function(h,l,g,k,j){return this.fireEvent("drop",h,l,g,k,j)},this);this.hiddenName=this.name;var f={tag:"input",type:"hidden",value:"",name:this.name};if(this.isFormField){this.hiddenField=this.el.createChild(f)}else{this.hiddenField=Ext.get(document.body).createChild(f)}a.doLayout()},initValue:Ext.emptyFn,onViewClick:function(d,b,c,f){var a=this.preClickSelections.indexOf(b);if(a!=-1){this.preClickSelections.splice(a,1);this.view.clearSelections(true);this.view.select(this.preClickSelections)}this.fireEvent("change",this,this.getValue(),this.hiddenField.dom.value);this.hiddenField.dom.value=this.getValue();this.fireEvent("click",this,f);this.validate()},onViewBeforeClick:function(c,a,b,d){this.preClickSelections=this.view.getSelectedIndexes();if(this.disabled){return false}},onViewDblClick:function(c,a,b,d){return this.fireEvent("dblclick",c,a,b,d)},getValue:function(a){var d=[];var c=this.view.getSelectedIndexes();if(c.length==0){return""}for(var b=0;b<c.length;b++){d.push(this.store.getAt(c[b]).get(((a!=null)?a:this.valueField)))}return d.join(this.delimiter)},setValue:function(a){var b;var d=[];this.view.clearSelections();this.hiddenField.dom.value="";if(!a||(a=="")){return}if(!(a instanceof Array)){a=a.split(this.delimiter)}for(var c=0;c<a.length;c++){b=this.view.store.indexOf(this.view.store.query(this.valueField,new RegExp("^"+a[c]+"$","i")).itemAt(0));d.push(b)}this.view.select(d);this.hiddenField.dom.value=this.getValue();this.validate()},reset:function(){this.setValue("")},getRawValue:function(a){var b=this.getValue(a);if(b.length){b=b.split(this.delimiter)}else{b=[]}return b},setRawValue:function(a){setValue(a)},validateValue:function(a){if(a.length<1){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}if(a.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));return false}if(a.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));return false}return true},onDestroy:function(){if(this.view){this.view.destroy()}if(this.hiddenField){this.hiddenField.remove()}Ext.ux.Multiselect.superclass.onDestroy.call(this)},onEnable:function(){this.el.unmask()},onDisable:function(){this.el.mask()}});Ext.reg("multiselect",Ext.ux.Multiselect);Ext.ux.ItemSelector=Ext.extend(Ext.form.Field,{msWidth:200,msHeight:300,hideNavIcons:false,imagePath:"",iconUp:"up2.gif",iconDown:"down2.gif",iconLeft:"left2.gif",iconRight:"right2.gif",iconTop:"top2.gif",iconBottom:"bottom2.gif",drawUpIcon:true,drawDownIcon:true,drawLeftIcon:true,drawRightIcon:true,drawTopIcon:true,drawBotIcon:true,fromStore:null,toStore:null,fromData:null,toData:null,displayField:0,valueField:1,switchToFrom:false,allowDup:false,focusClass:undefined,delimiter:",",readOnly:false,toLegend:null,fromLegend:null,toSortField:null,fromSortField:null,toSortDir:"ASC",fromSortDir:"ASC",toTBar:null,fromTBar:null,bodyStyle:null,border:false,defaultAutoCreate:{tag:"div"},initComponent:function(){Ext.ux.ItemSelector.superclass.initComponent.call(this);this.addEvents({rowdblclick:true,change:true})},onRender:function(d,a){Ext.ux.ItemSelector.superclass.onRender.call(this,d,a);this.fromMultiselect=new Ext.ux.Multiselect({legend:this.fromLegend,delimiter:this.delimiter,allowDup:this.allowDup,copy:this.allowDup,allowTrash:this.allowDup,dragGroup:this.readOnly?null:"drop2-"+this.el.dom.id,dropGroup:this.readOnly?null:"drop2-"+this.el.dom.id+",drop1-"+this.el.dom.id,width:this.msWidth,height:this.msHeight,dataFields:this.dataFields,data:this.fromData,displayField:this.displayField,valueField:this.valueField,store:this.fromStore,isFormField:false,tbar:this.fromTBar,appendOnly:true,sortField:this.fromSortField,sortDir:this.fromSortDir});this.fromMultiselect.on("dblclick",this.onRowDblClick,this);if(!this.toStore){this.toStore=new Ext.data.SimpleStore({fields:this.dataFields,data:this.toData})}this.toStore.on("add",this.valueChanged,this);this.toStore.on("remove",this.valueChanged,this);this.toStore.on("load",this.valueChanged,this);this.toMultiselect=new Ext.ux.Multiselect({legend:this.toLegend,delimiter:this.delimiter,allowDup:this.allowDup,dragGroup:this.readOnly?null:"drop1-"+this.el.dom.id,dropGroup:this.readOnly?null:"drop2-"+this.el.dom.id+",drop1-"+this.el.dom.id,width:this.msWidth,height:this.msHeight,displayField:this.displayField,valueField:this.valueField,store:this.toStore,isFormField:false,tbar:this.toTBar,sortField:this.toSortField,sortDir:this.toSortDir});this.toMultiselect.on("dblclick",this.onRowDblClick,this);var g=new Ext.Panel({bodyStyle:this.bodyStyle,border:this.border,layout:"table",layoutConfig:{columns:3}});g.add(this.switchToFrom?this.toMultiselect:this.fromMultiselect);var c=new Ext.Panel({header:false});g.add(c);g.add(this.switchToFrom?this.fromMultiselect:this.toMultiselect);g.render(this.el);c.el.down("."+c.bwrapCls).remove();if(this.imagePath!=""&&this.imagePath.charAt(this.imagePath.length-1)!="/"){this.imagePath+="/"}this.iconUp=this.imagePath+(this.iconUp||"up2.gif");this.iconDown=this.imagePath+(this.iconDown||"down2.gif");this.iconLeft=this.imagePath+(this.iconLeft||"left2.gif");this.iconRight=this.imagePath+(this.iconRight||"right2.gif");this.iconTop=this.imagePath+(this.iconTop||"top2.gif");this.iconBottom=this.imagePath+(this.iconBottom||"bottom2.gif");var f=c.getEl();if(!this.toSortField){this.toTopIcon=f.createChild({tag:"img",src:this.iconTop,style:{cursor:"pointer",margin:"2px"}});f.createChild({tag:"br"});this.upIcon=f.createChild({tag:"img",src:this.iconUp,style:{cursor:"pointer",margin:"2px"}});f.createChild({tag:"br"})}this.addIcon=f.createChild({tag:"img",src:this.switchToFrom?this.iconLeft:this.iconRight,style:{cursor:"pointer",margin:"2px"}});f.createChild({tag:"br"});this.removeIcon=f.createChild({tag:"img",src:this.switchToFrom?this.iconRight:this.iconLeft,style:{cursor:"pointer",margin:"2px"}});f.createChild({tag:"br"});if(!this.toSortField){this.downIcon=f.createChild({tag:"img",src:this.iconDown,style:{cursor:"pointer",margin:"2px"}});f.createChild({tag:"br"});this.toBottomIcon=f.createChild({tag:"img",src:this.iconBottom,style:{cursor:"pointer",margin:"2px"}})}if(!this.readOnly){if(!this.toSortField){this.toTopIcon.on("click",this.toTop,this);this.upIcon.on("click",this.up,this);this.downIcon.on("click",this.down,this);this.toBottomIcon.on("click",this.toBottom,this)}this.addIcon.on("click",this.fromTo,this);this.removeIcon.on("click",this.toFrom,this)}if(!this.drawUpIcon||this.hideNavIcons){this.upIcon.dom.style.display="none"}if(!this.drawDownIcon||this.hideNavIcons){this.downIcon.dom.style.display="none"}if(!this.drawLeftIcon||this.hideNavIcons){this.addIcon.dom.style.display="none"}if(!this.drawRightIcon||this.hideNavIcons){this.removeIcon.dom.style.display="none"}if(!this.drawTopIcon||this.hideNavIcons){this.toTopIcon.dom.style.display="none"}if(!this.drawBotIcon||this.hideNavIcons){this.toBottomIcon.dom.style.display="none"}var b=g.body.first();this.el.setWidth(g.body.first().getWidth());g.body.removeClass();this.hiddenName=this.name;var e={tag:"input",type:"hidden",value:"",name:this.name};this.hiddenField=this.el.createChild(e);this.valueChanged(this.toStore)},initValue:Ext.emptyFn,toTop:function(){if(this.disabled){return}var c=this.toMultiselect.view.getSelectedIndexes();var a=[];if(c.length>0){c.sort();for(var b=0;b<c.length;b++){record=this.toMultiselect.view.store.getAt(c[b]);a.push(record)}c=[];for(var b=a.length-1;b>-1;b--){record=a[b];this.toMultiselect.view.store.remove(record);this.toMultiselect.view.store.insert(0,record);c.push(((a.length-1)-b))}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(c)},toBottom:function(){if(this.disabled){return}var c=this.toMultiselect.view.getSelectedIndexes();var a=[];if(c.length>0){c.sort();for(var b=0;b<c.length;b++){record=this.toMultiselect.view.store.getAt(c[b]);a.push(record)}c=[];for(var b=0;b<a.length;b++){record=a[b];this.toMultiselect.view.store.remove(record);this.toMultiselect.view.store.add(record);c.push((this.toMultiselect.view.store.getCount())-(a.length-b))}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(c)},up:function(){if(this.disabled){return}var a=null;var c=this.toMultiselect.view.getSelectedIndexes();c.sort();var d=[];if(c.length>0){for(var b=0;b<c.length;b++){a=this.toMultiselect.view.store.getAt(c[b]);if((c[b]-1)>=0){this.toMultiselect.view.store.remove(a);this.toMultiselect.view.store.insert(c[b]-1,a);d.push(c[b]-1)}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(d)}},down:function(){if(this.disabled){return}var a=null;var c=this.toMultiselect.view.getSelectedIndexes();c.sort();c.reverse();var d=[];if(c.length>0){for(var b=0;b<c.length;b++){a=this.toMultiselect.view.store.getAt(c[b]);if((c[b]+1)<this.toMultiselect.view.store.getCount()){this.toMultiselect.view.store.remove(a);this.toMultiselect.view.store.insert(c[b]+1,a);d.push(c[b]+1)}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(d)}},fromTo:function(){if(this.disabled){return}var d=this.fromMultiselect.view.getSelectedIndexes();var b=[];if(d.length>0){for(var c=0;c<d.length;c++){record=this.fromMultiselect.view.store.getAt(d[c]);b.push(record)}if(!this.allowDup){d=[]}for(var c=0;c<b.length;c++){record=b[c];if(this.allowDup){var a=new Ext.data.Record();record.id=a.id;delete a;this.toMultiselect.view.store.add(record)}else{this.fromMultiselect.view.store.remove(record);this.toMultiselect.view.store.add(record);d.push((this.toMultiselect.view.store.getCount()-1))}}}this.toMultiselect.view.refresh();this.fromMultiselect.view.refresh();if(this.toSortField){this.toMultiselect.store.sort(this.toSortField,this.toSortDir)}if(this.allowDup){this.fromMultiselect.view.select(d)}else{this.toMultiselect.view.select(d)}},toFrom:function(){if(this.disabled){return}var c=this.toMultiselect.view.getSelectedIndexes();var a=[];if(c.length>0){for(var b=0;b<c.length;b++){record=this.toMultiselect.view.store.getAt(c[b]);a.push(record)}c=[];for(var b=0;b<a.length;b++){record=a[b];this.toMultiselect.view.store.remove(record);if(!this.allowDup){this.fromMultiselect.view.store.add(record);c.push((this.fromMultiselect.view.store.getCount()-1))}}}this.fromMultiselect.view.refresh();this.toMultiselect.view.refresh();if(this.fromSortField){this.fromMultiselect.store.sort(this.fromSortField,this.fromSortDir)}this.fromMultiselect.view.select(c)},valueChanged:function(c){var a=null;var b=[];for(var d=0;d<c.getCount();d++){a=c.getAt(d);b.push(a.get(this.valueField))}this.hiddenField.dom.value=b.join(this.delimiter);this.fireEvent("change",this,this.getValue(),this.hiddenField.dom.value)},getValue:function(){return this.hiddenField.dom.value},onRowDblClick:function(c,a,b,d){return this.fireEvent("rowdblclick",c,a,b,d)},reset:function(){range=this.toMultiselect.store.getRange();this.toMultiselect.store.removeAll();if(!this.allowDup){this.fromMultiselect.store.add(range);this.fromMultiselect.store.sort(this.displayField,"ASC")}this.valueChanged(this.toMultiselect.store)},onDestroy:function(){if(this.fromMultiselect){this.fromMultiselect.destroy()}if(this.toMultiselect){this.toMultiselect.destroy()}Ext.ux.ItemSelector.superclass.onDestroy.call(this)},onEnable:function(){this.fromMultiselect.enable();this.toMultiselect.enable()},onDisable:function(){this.fromMultiselect.disable();this.toMultiselect.disable()}});Ext.reg("itemselector",Ext.ux.ItemSelector);Ext.ux.PanPanel=Ext.extend(Ext.Panel,{constructor:function(a){a.autoScroll=false;Ext.ux.PanPanel.superclass.constructor.apply(this,arguments)},onRender:function(){Ext.ux.PanPanel.superclass.onRender.apply(this,arguments);this.body.appendChild(this.client);this.client=Ext.get(this.client);this.client.on("mousedown",this.onMouseDown,this);this.client.setStyle("cursor","move")},onMouseDown:function(a){a.stopEvent();this.mouseX=a.getPageX();this.mouseY=a.getPageY();Ext.getBody().on("mousemove",this.onMouseMove,this);Ext.getDoc().on("mouseup",this.onMouseUp,this)},onMouseMove:function(d){d.stopEvent();var a=d.getPageX();var f=d.getPageY();if(d.within(this.body)){var c=a-this.mouseX;var b=f-this.mouseY;this.body.dom.scrollLeft-=c;this.body.dom.scrollTop-=b}this.mouseX=a;this.mouseY=f},onMouseUp:function(a){Ext.getBody().un("mousemove",this.onMouseMove,this);Ext.getDoc().un("mouseup",this.onMouseUp,this)}});Ext.tree.ColumnTree=Ext.extend(Ext.tree.TreePanel,{lines:false,borderWidth:Ext.isBorderBox?0:2,cls:"x-column-tree",onRender:function(){Ext.tree.ColumnTree.superclass.onRender.apply(this,arguments);this.headers=this.body.createChild({cls:"x-tree-headers"},this.innerCt.dom);var e=this.columns,f;var b=0;for(var d=0,a=e.length;d<a;d++){f=e[d];b+=f.width;this.headers.createChild({cls:"x-tree-hd "+(f.cls?f.cls+"-hd":""),cn:{cls:"x-tree-hd-text",html:f.header},style:"width:"+(f.width-this.borderWidth)+"px;"})}this.headers.createChild({cls:"x-clear"});this.headers.setWidth(b);this.innerCt.setWidth(b)}});Ext.tree.ColumnNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{focus:Ext.emptyFn,renderElements:function(d,m,h,o){this.indentMarkup=d.parentNode?d.parentNode.ui.getChildIndent():"";var p=d.getOwnerTree();var l=p.columns;var k=p.borderWidth;var j=l[0];var b=['<li class="x-tree-node"><div ext:tree-node-id="',d.id,'" class="x-tree-node-el x-tree-node-leaf ',m.cls,'">','<div class="x-tree-col" style="width:',j.width-k,'px;">','<span class="x-tree-node-indent">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,'" class="x-tree-ec-icon x-tree-elbow">','<img src="',m.icon||this.emptyIcon,'" class="x-tree-node-icon',(m.icon?" x-tree-node-inline-icon":""),(m.iconCls?" "+m.iconCls:""),'" unselectable="on">','<a hidefocus="on" class="x-tree-node-anchor" href="',m.href?m.href:"#",'" tabIndex="1" ',m.hrefTarget?' target="'+m.hrefTarget+'"':"",">",'<span unselectable="on">',d.text||(j.renderer?j.renderer(m[j.dataIndex],d,m):m[j.dataIndex]),"</span></a>","</div>"];for(var e=1,g=l.length;e<g;e++){j=l[e];b.push('<div class="x-tree-col ',(j.cls?j.cls:""),'" style="width:',j.width-k,'px;">','<div class="x-tree-col-text">',(j.renderer?j.renderer(m[j.dataIndex],d,m):m[j.dataIndex]),"</div>","</div>")}b.push('<div class="x-clear"></div></div>','<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>");if(o!==true&&d.nextSibling&&d.nextSibling.ui.getEl()){this.wrap=Ext.DomHelper.insertHtml("beforeBegin",d.nextSibling.ui.getEl(),b.join(""))}else{this.wrap=Ext.DomHelper.insertHtml("beforeEnd",h,b.join(""))}this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var f=this.elNode.firstChild.childNodes;this.indentNode=f[0];this.ecNode=f[1];this.iconNode=f[2];this.anchor=f[3];this.textNode=f[3].firstChild}});function getTraitsAssociatedStudies(a){Workbench.action(PHENOTYPE_DATACONSUMER,"InitStudyAssociatedWithTraits",{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName,FromGUITraitUID:a},EventCallback)}var SynopsisRecord=null;var synopsis_dummy_data=null;var SynopsisDataStore=null;var SynopsisGrid=null;var SynopsisGridRenderer=null;var dialog_opened=false;function refreshSynopsis(a){Workbench.action(SYNOPSIS_DATACONSUMER,REFRESH_SYNOPSIS_TABLE,{resultId:a,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function manuallyRefreshSynopsis(){var a="-1";Workbench.action(SYNOPSIS_DATACONSUMER,REFRESH_SYNOPSIS_TABLE,{resultId:a,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function onItemClick(a){}processSynopsis.queryId="";processSynopsis.dataSourceHits="";showResultList.getResultListTimer=null;showResultList.waiting="false";var synopsisTableEntries=new SynopsisTableEntries();var identifiersTableEntries=new IdentifiersTableEntries();var synopsisRefreshTimer=null;function retrieveResults(g){var j=g.ResultList;var d=j.queryBeanMap;if(processSynopsis.dataSourceHits!=0){var c=1;for(var h in d){var f=d[h];var e=f.stringMap;for(var a in e){if(c<21){c++}}}}}function showResultList(b){var a=b.Status;if(a.simpleDatum=="Complete"){clearInterval(showResultList.getResultListTimer);showResultList.waiting="false";retrieveResults(b)}else{if(showResultList.waiting=="false"){showResultList.waiting="true";showResultList.getResultListTimer=setInterval("callGetResultList()",3000)}}}function processSynopsis(){var d=SynopsisGrid.getSelectionModel().getSelections();if(d==null){showExtMessageBox(INFO,"No synopsis entry selected","","")}else{var b=d.length;if(b>1){showExtMessageBox(INFO,"Please select only one entry","","")}else{var a=d[0];if(a==null){showExtMessageBox(INFO,"No synopsis entry selected","","")}else{processSynopsis.queryId=a.get("id");processSynopsis.query_full=a.get("query_full");processSynopsis.search_string=a.get("search_string");processSynopsis.dataSourceHits=a.get("hits");processSynopsis.dataSource=a.get("datasource");processSynopsis.dataSourceuid=a.get("datasourceuid");processSynopsis.dataType=a.get("datatype");processSynopsis.list_id=a.get("list_id");showResultList.offsetDisplayed=0;showResultList.displaySize=20;showResultList.endIndex=20;if(processSynopsis.dataSourceHits<showResultList.displaySize){showResultList.endIndex=processSynopsis.dataSourceHits-1}else{showResultList.endIndex=showResultList.displaySize-1}var c={QueryID:processSynopsis.queryId,ListUID:processSynopsis.list_id,QueryFull:processSynopsis.query_full,SearchString:processSynopsis.search_string,DataSourceName:processSynopsis.dataSource,DataSourceUID:processSynopsis.dataSourceuid,DataType:processSynopsis.dataType,Hits:processSynopsis.dataSourceHits,OffsetDisplayed:showResultList.offsetDisplayed,EndIndex:showResultList.endIndex,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName};if(processSynopsis.dataSourceHits==0){}else{Workbench.action(RESULT_DATACONSUMER,RESULT_LIST_TABLE_INIT,c,EventCallback)}}}}}function joinSynopsisEntries(d){var b="";var j="";if(d==SYNOPSIS_GET_UNION){b="join by union operation."}else{if(d==SYNOPSIS_GET_INTERSECTION){b="join by intersection operation."}else{if(d==SYNOPSIS_GET_DIFFERENCE){b="get the difference."}}}var c=SynopsisGrid.getSelectionModel().getSelections();var h="";if(c==null){showExtMessageBox(INFO,"Please choose the query entries from \nthe synopsis table that you would like to join by\n"+b,"","")}else{var f=c.length;if(f<2){showExtMessageBox(INFO,"Please choose the query entries from \nthe synopsis table that you would like to join by\n"+b,"","")}else{for(var e=0;e<f;e++){var g=c[e];if(e!=0){h=h+","}h=h+g.get("id")}var a={QueryIDs:h,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName};Workbench.action(SYNOPSIS_DATACONSUMER,d,a,EventCallback)}}}function getUnionOfSelectedSynopsisEntries(a){joinSynopsisEntries(SYNOPSIS_GET_UNION)}function getIntersectionOfSelectedSynopsisEntries(a){joinSynopsisEntries(SYNOPSIS_GET_INTERSECTION)}function getDifferenceOfSelectedSynopsisEntries(a){joinSynopsisEntries(SYNOPSIS_GET_DIFFERENCE)}var result_list_new_set_record=null;var result_list_new_set_cm=null;var result_list_new_set_ds=null;var result_list_new_set_grid=null;var result_list_new_set_form=null;var new_set_lsids=[];var new_set_names=[];function clearStudyWindow(){var a=document.getElementById("study_list_indicator");if(a){a.innerHTML=""}a=document.getElementById("study_list");if(a){a.innerHTML=""}a=document.getElementById("StudyListView");if(a){a.innerHTML=""}a=document.getElementById("StudyDataSetListView");if(a){a.innerHTML=""}}function getDetails(b,a){if(b==GERMPLASM_DATATYPE_NAME){getObjectDetails(a)}else{if(b==GERMPLASM_STUDY_DATATYPE_NAME){clearStudyWindow();retrieveDataSetList(STUDY_WINDOW_DATASET_UPDATE,a)}else{if(b==STUDY_DATATYPE_NAME){clearStudyWindow();retrieveDataSetList(STUDY_WINDOW_DATASET_UPDATE,a)}}}}function getDetails(c,b,a){if(c==GERMPLASM_DATATYPE_NAME){getObjectDetails(b,a)}else{if(c==GERMPLASM_STUDY_DATATYPE_NAME){clearStudyWindow();retrieveDataSetList(STUDY_WINDOW_DATASET_UPDATE,b,a)}else{if(c==STUDY_DATATYPE_NAME){clearStudyWindow();retrieveDataSetList(STUDY_WINDOW_DATASET_UPDATE,b,a)}}}}function getAssociatedStudies(b,a){if(b==GERMPLASM_DATATYPE_NAME){getStudies(a)}else{if(b==FEATURE_TYPE_AS_ONTOLOGY_DATATYPE_NAME){getTraitsAssociatedStudies(a)}}}function getObjectDetails(g,c){var j=koioslayout.findById("main");var h=koioslayout.findById("germplasm-main");if(document.getElementById("germplasmTab"+g)){if(lsid_query_indicator){j.setActiveTab("germplasm-"+g)}else{koioslayout.findById('main').setActiveTab('germplasm-main');h.setActiveTab("germplasm-"+g)}}else{var f=document.getElementById("germplasm-main-div");if(lsid_query_indicator){}else{}var k=document.createElement("div");k.setAttribute("id","germplasmTab"+g);f.appendChild(k);setProcessStatus("germplasmTab"+g);var a="";if(g.indexOf("urn")==-1){a=g}else{var d=g.split(":");a=d[4]}if(c=="undefined"){c=""}if(c==null){c=""}var e=c;if(c.length>15){e=c.substring(0,15)+"..."}var b;if(c==""){b={id:"germplasm-"+g,contentEl:"germplasmTab"+g,title:"Germplasm ID "+a,closable:true,autoScroll:true}}else{b={id:"germplasm-"+g,contentEl:"germplasmTab"+g,title:e+" (GID "+a+")",closable:true,autoScroll:true}}if(lsid_query_indicator){if(c==""){j.insert(0,b)}else{j.insert(1,b)}j.setActiveTab("germplasm-"+g)}else{j.unhideTabStripItem("germplasm-main");j.setActiveTab("germplasm-main");h.add(b);h.setActiveTab("germplasm-"+g)}Workbench.action(GERMPLASM_DATACONSUMER,GERMPLASM_DETAILS_RETRIEVAL,{SearchString:g,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}}function getStudies(a){getObjectDetails(a)}function findStudiesByGermplasm(b){var a="";for(i=0;i<new_set_lsids.length;i++){if(i==0){a=new_set_lsids[i]}else{a=a.concat(","+new_set_lsids[i])}}Workbench.action(GERMPLASM_DATACONSUMER,"GermplasmStudyListRetrievalFromSet",{GermplasmSetMembersStr:a,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback);setProcessStatus("find_studies_from_set_indicator")}function result_list_create_new_set2(a){}function result_list_create_new_set_init(){if(result_list_new_set_grid==null){result_list_new_set_record=Ext.data.Record.create([{name:"id",type:"int"},{name:"gid",type:"string"},{name:"g_name",type:"string"}]);result_list_new_set_cm=new Ext.grid.ColumnModel([{header:"#",dataIndex:"id",sortable:true,width:25,renderer:function(c,g,e,h,d,f){return""+(h+1)}},{header:"Name",dataIndex:"g_name",sortable:true,width:150}]);result_list_new_set_ds=new Ext.data.Store({proxy:new Ext.data.MemoryProxy(),reader:new Ext.data.ArrayReader({},result_list_new_set_record)});var b=new Ext.Button({text:"Save Set",tooltip:"Creates a new set and refreshes the synopsis table",pressed:false,disabled:false,cls:"x-btn-text-icon details",icon:"images/disk.png",handler:result_list_create_new_set2});var a=new Ext.Button({text:"Find Studies",tooltip:"Retrieves studies conducted on the germplasms in this set",pressed:false,disabled:false,cls:"x-btn-text-icon details",icon:"images/find.png",handler:findStudiesByGermplasm});result_list_new_set_grid=new Ext.grid.GridPanel({ds:result_list_new_set_ds,cm:result_list_new_set_cm,enableColLock:false,loadMask:load_mask_indicator,view:new Ext.grid.GridView(),height:150,layout:"fit",el:"result_list_new_set",tbar:new Ext.Toolbar({items:[b,"-",a],renderTo:"createNewSetToolbar"})});result_list_new_set_form=new Ext.FormPanel({labelWidth:75,frame:false,bodyStyle:"padding:5px 5px 0;background-color:white;border:none;",autoHeight:true,autoWidth:true,autoScroll:true,items:[{xtype:"fieldset",title:"Show/Hide Set",collapsible:true,autoHeight:true,width:650,layout:"form",bodyStyle:"border:none",contentEl:"result_list_new_set_with_toolbar"}]});result_list_new_set_grid.render()}result_list_new_set_form.render("result_list_create_new_set_form")}function result_list_create_new_set(d){result_list_create_new_set_init();var f=grid2.getSelectionModel().getSelections();if(f!=null){for(i=0;i<f.length;i++){var b=f[i];var c=b.get("Obj_id");var e=b.get("Name");if(new_set_lsids.indexOf(c)==-1){new_set_lsids.push(c);var a=new result_list_new_set_record({g_name:e});result_list_new_set_ds.add(a)}if(new_set_names.indexOf(e)==-1){new_set_names.push(e)}}}}var JSGlobalEntryPointMap=[];var constraintOptionsMap=[];var entrypoint_sample_map=[];var queryConstraintSelect;var selectedQueryConstraint;var constraintSelect;var selectedQueryConstraintOption;var searchStringElem;var searchString;function initializeQueryView(){Workbench.action(QUERY_DATACONSUMER,QUERY_WINDOW_INITIALIZATION,{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function SetQueryConstraints(e){var d=document.getElementById("QueryConstraintOptionsSelect");var c;for(c=d.length-1;c>=0;c--){d.remove(c)}var b=new Array();b=JSGlobalEntryPointMap[e];for(constraintOptiontemp in b){if(constraintOptiontemp=="remove"){}else{if(constraintOptiontemp=="contains"){}else{if(constraintOptiontemp=="indexOf"){}else{if(constraintOptiontemp=="clone"){}else{if(constraintOptiontemp=="removeValue"){}else{if(constraintOptiontemp=="getLastItem"){}else{if(constraintOptiontemp=="forEach"){}else{if(constraintOptiontemp=="count"){}else{if(constraintOptiontemp=="each"){}else{if(constraintOptiontemp=="eachSlice"){}else{if(constraintOptiontemp=="all"){}else{if(constraintOptiontemp=="any"){}else{if(constraintOptiontemp=="collect"){}else{if(constraintOptiontemp=="detect"){}else{if(constraintOptiontemp=="findAll"){}else{if(constraintOptiontemp=="grep"){}else{if(constraintOptiontemp=="include"){}else{if(constraintOptiontemp=="inGroupsOf"){}else{if(constraintOptiontemp=="inject"){}else{if(constraintOptiontemp=="invoke"){}else{if(constraintOptiontemp=="max"){}else{if(constraintOptiontemp=="min"){}else{if(constraintOptiontemp=="partition"){}else{if(constraintOptiontemp=="pluck"){}else{if(constraintOptiontemp=="reject"){}else{if(constraintOptiontemp=="sortBy"){}else{if(constraintOptiontemp=="toArray"){}else{if(constraintOptiontemp=="zip"){}else{if(constraintOptiontemp=="size"){}else{if(constraintOptiontemp=="inspect"){}else{if(constraintOptiontemp=="find"){}else{if(constraintOptiontemp=="select"){}else{if(constraintOptiontemp=="member"){}else{if(constraintOptiontemp=="entries"){}else{if(constraintOptiontemp=="_reverse"){}else{if(constraintOptiontemp=="_each"){}else{if(constraintOptiontemp=="clear"){}else{if(constraintOptiontemp=="first"){}else{if(constraintOptiontemp=="last"){}else{if(constraintOptiontemp=="compact"){}else{if(constraintOptiontemp=="flatten"){}else{if(constraintOptiontemp=="without"){}else{if(constraintOptiontemp=="uniq"){}else{if(constraintOptiontemp=="intersect"){}else{if(constraintOptiontemp=="toJSON"){}else{if(constraintOptiontemp=="remove"){}else{if(constraintOptiontemp=="clear"){}else{if(constraintOptiontemp=="lastIndexOf"){}else{if(constraintOptiontemp=="reduce"){}else{if(constraintOptiontemp=="some"){}else{if(constraintOptiontemp=="every"){}else{if(constraintOptiontemp=="filter"){}else{if(constraintOptiontemp=="map"){}else{if(constraintOptiontemp.indexOf("function")!=-1){}else{var f=document.createElement("option");f.text=b[constraintOptiontemp];f.value=constraintOptiontemp;try{d.add(f,null)}catch(a){d.add(f)}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}d.focus();d.selectedIndex=0;SetSampleText()}function SetQueryConstraintOption(c){var d=document.getElementById("QueryConstraintOptionsSelect");var a=d.length;for(var b=0;b<a;b++){if(d[b].value==c){d.selectedIndex=b;break}}}function handleSimpleQueryKeyEvent(b){var a=document.getElementById("searchString");a.onkeyup=function(d){var c=0;if(!d){var d=window.event}if(d.keyCode){c=d.keyCode}else{if(d.which){c=d.which}}if(c==13){processQuery()}}}function SetDefaultEntryPoint(e,d){var b=document.getElementById("QueryConstraintsSelect");var a=b.length;for(var c=0;c<a;c++){if(b[c].value==e){b.selectedIndex=c;break}}SetQueryConstraints(e);SetQueryConstraintOption(d)}function SetSampleText(a){var b=document.getElementById("QuerySampleTextView")}function SetSampleText(){var e=document.getElementById("QuerySampleTextView");var c=document.getElementById("QueryConstraintsSelect");var a=document.getElementById("QueryConstraintOptionsSelect");var d=c[c.selectedIndex].value+"|"+a[a.selectedIndex].value;var b=entrypoint_sample_map[d];if(b==""){e.innerHTML=""}else{e.innerHTML="<b><i>Example:</i></b> "+entrypoint_sample_map[d]}}function invokeQuery(c,b,a){Workbench.action(QUERY_DATACONSUMER,PROCESS_QUERY,{SearchString:c,QueryCurrentEntryPointKey:b,QueryEntryPointConstraintKey:a,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function setProcessStatusToCancelled(c){var b=document.getElementById("result_processing_indicator"+c);if(b){b.innerHTML="<b>transaction cancelled.</b>"}var a=SynopsisDataStore.getCount();for(i=0;i<a;i++){var d=SynopsisDataStore.getAt(i).get("id");if(d==c){SynopsisDataStore.getAt(i).set("hits","cancelled")}}}function getQueryFilterStringToDisplay(c,b,a){var e="";if(c==""){e="none"}else{var d="";if(a.indexOf("by")==0){d=a.substr(2)}if(c.indexOf("%")==-1){e=b+"("+d+") equals "+c}else{e=b+"("+d+") like "+c}}return e}function showResultsTab(f){var c="resultTabFor"+f;var b="resultTab"+f;var e="results-tab-main";var d=koioslayout.findById("main");var h=document.getElementById("resultTabs");var g=document.getElementById(b);if(g==null){var a=document.createElement("div");a.setAttribute("id",b);h.appendChild(a)}}function createNewResultsTab(c,b,l,m){var g="results-tab-main";var q=koioslayout.findById("main");q.unhideTabStripItem(g);var d="resultTabFor"+c;var r="resultTab"+c;var n="";if((b=="")||(b=="%")){var p=l;if(l=="Germplasm"){p="Germplasms"}else{if(l=="Study"){p="Studies"}else{if(l=="GermplasmStudy"){p="Germplasm Studies"}else{if(l=="Trait"){p="Traits"}else{if(l=="Mutant"){p="Mutants"}else{if(l=="GenomicFeatureDetector"){p="Mutants"}else{if(l=="Allele"){p="Alleles"}else{if(l=="DetectedVariant"){p="Alleles"}}}}}}}}n="All "+p}else{n=b}var j=q.findById(g);var a=q.findById(d);if(a!=null){j.setActiveTab(d)}else{var k="result_processing_indicator"+c;var f="resultPanel"+c+"Content";var e=getQueryFilterStringToDisplay(b,l,m);var o={id:d,contentEl:r,title:n,closable:true,width:getWindowWidth()*0.94,height:getWindowHeight()*0.95,html:"<br><b>DataType:</b> "+l+"&nbsp;&nbsp;<b>Query Filter:</b> "+e+"<div id="+k+"></div><div id="+f+"></div><br>"};j.add(o);j.setActiveTab(d);var h=document.getElementById(k);if(h){h.innerHTML="<img src='javascript/lib/ext2.1/img/loading.gif' alt='' />&nbsp;processing...<input class='x-btn' id='cancel_button' type='button' onClick='cancelQueryProcess();setProcessStatusToCancelled("+c+");' value='cancel query'>"}}q.setActiveTab(g)}function invokeCreateNewResultTab(c,b,a){Workbench.action(QUERY_DATACONSUMER,INIT_NEW_RESULTS_TAB,{SearchString:c,QueryCurrentEntryPointKey:b,QueryEntryPointConstraintKey:a,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function processQuery(){queryConstraintSelect=document.getElementById("QueryConstraintsSelect");selectedQueryConstraint=queryConstraintSelect[queryConstraintSelect.selectedIndex].value;constraintSelect=document.getElementById("QueryConstraintOptionsSelect");selectedQueryConstraintOption=constraintSelect[constraintSelect.selectedIndex].value;searchStringElem=document.getElementById("searchString");searchString=searchStringElem.value;invokeCreateNewResultTab(searchString,selectedQueryConstraint,selectedQueryConstraintOption);invokeQuery(searchString,selectedQueryConstraint,selectedQueryConstraintOption)}function cancelQueryProcess(){Workbench.action(QUERY_DATACONSUMER,CANCEL_QUERY,{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function browse_all_germplasms(){selectedQueryConstraint="Germplasm";selectedQueryConstraintOption="byPreferredName";searchString="%";invokeCreateNewResultTab(searchString,selectedQueryConstraint,selectedQueryConstraintOption);invokeQuery(searchString,selectedQueryConstraint,selectedQueryConstraintOption)}function browse_all_germplasmsets(){koioslayout.findById("main").unhideTabStripItem("germplasmlist-tab");koioslayout.findById("main").setActiveTab("germplasmlist-tab")}function browse_all_studies(){koioslayout.findById("main").unhideTabStripItem("studyBrowser-tab");koioslayout.findById("main").setActiveTab("studyBrowser-tab")}function browse_all_traits(){selectedQueryConstraint="Trait";selectedQueryConstraintOption="byName";searchString="%";invokeCreateNewResultTab(searchString,selectedQueryConstraint,selectedQueryConstraintOption);invokeQuery(searchString,selectedQueryConstraint,selectedQueryConstraintOption)}function show_mutants_view(){koioslayout.findById("main").unhideTabStripItem("mutant-main");koioslayout.findById("main").setActiveTab("mutant-main");koioslayout.findById("mutant-main").setActiveTab("phenotype-catalog-tab")}function getStudyByName(a){selectedQueryConstraint="Study";selectedQueryConstraintOption="byName";searchString=a;invokeCreateNewResultTab(searchString,selectedQueryConstraint,selectedQueryConstraintOption);invokeQuery(searchString,selectedQueryConstraint,selectedQueryConstraintOption)}function getGermplasmByName(a){selectedQueryConstraint="Germplasm";selectedQueryConstraintOption="byAlternateName";searchString=a;invokeCreateNewResultTab(searchString,selectedQueryConstraint,selectedQueryConstraintOption);invokeQuery(searchString,selectedQueryConstraint,selectedQueryConstraintOption)}function getGermplasmByCountry(a){selectedQueryConstraint="Germplasm";selectedQueryConstraintOption="byCountry";searchString=a;invokeCreateNewResultTab(searchString,selectedQueryConstraint,selectedQueryConstraintOption);invokeQuery(searchString,selectedQueryConstraint,selectedQueryConstraintOption)}function getTraitByName(a){selectedQueryConstraint="Trait";selectedQueryConstraintOption="byName";searchString=a;invokeCreateNewResultTab(searchString,selectedQueryConstraint,selectedQueryConstraintOption);invokeQuery(searchString,selectedQueryConstraint,selectedQueryConstraintOption)}function getStudiesAssociatedWithTraits(a){Workbench.action(PHENOTYPE_DATACONSUMER,"InitStudyAssociatedWithTraits",{FromGUITraitUID:a,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function initializePhenotypeCatalog(){if(CurrentCropName=="rice"){Workbench.action(PHENOTYPE_DATACONSUMER,PHENOTYPE_WINDOW_CATALOG_INITIALIZATION,{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName,CurrentPlantOntologyTermNodeUID:"0"},EventCallback)}}function findmutant(c,e,a,h,g,f,b,d){setProcessStatus("mutant_search_indicator");Workbench.action(PHENOTYPE_DATACONSUMER,"GetMutants",{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName,FromGuiOntologyUID:c,FromGuiSearchType:e,FromGuiPOUID:a,FromGuiPOName:h,FromGuiAttrUID:g,FromGuiAttrName:f,FromGuiPhenUID:b,FromGuiPhenName:d},EventCallback)}var MutantResultListDataStore=null;function mutantSaveAsCSV(){var b=MutantResultListDataStore.getTotalCount();var a=null;if(b>1500){a=window.confirm("Are you sure you want to load ALL "+b+" data? This may take minutes to generate all data.")}else{a=window.confirm("Are you sure you want to load ALL "+b+" data?")}if(a){Workbench.action(PHENOTYPE_DATACONSUMER,EXPORT_MUTANT_LIST,{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName,ContextPath:context_path,RealPath:real_path},EventCallback)}}var study_filter_win;var panel_for_study_filter;var selectedEffectId="";var selectedStudyId="";var selectedFactors=[];var selectedVariates=[];var selectedEffectId_previous="";var factorLevelIndicator=[];var selectedLevelNumbers=[];var selectedLevelNumbersAll=[];var labelIds=[];var studyListDataSetRecord;var studyListDataSetCm;var studyListDataSetDs;var studyListDataGrid;var columnHeadersData=[];var copyDs;var studyList;var FactorGrid;var studyListRecord;var studyListStore;var effectsList;var effectsListRecord;var effectsListStore;var linkButton;var selectedFactorIdForRow="";var selectedFactorNameForRow="";var selectedFactorIdForColumn="";var selectedLevelNumbersForRows=[];var selectedLevelNumbersForColumns=[];var selectedFactorValuesForColumns=[];var selectedFactorValuesForRows=[];var selectedVariateIdForMatrix="";function initializeStudyBrowserView(){Workbench.action(STUDY_DATACONSUMER,INITIALIZE_STUDY_FOLDERS,{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function initializeStudyView(){Workbench.action(STUDY_DATACONSUMER,STUDY_WINDOW_INITIALIZATION,{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function loadStudy(a){Workbench.action(STUDY_DATACONSUMER,SEARCH_STUDY_BY_UID,{SelectedStudyUID:a,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback);retrieveDataSetList(STUDY_WINDOW_DATASET_UPDATE,a,null)}function datasetSelected(){var c=0;var a=effectsList.getStore().getCount();if(a==1){selectedEffectId=effectsList.getStore().getAt(0).get("eid");c=1}else{var d=effectsList.getSelectionModel().getSelections();var b;for(b=0;b<d.length;b++){selectedEffectId=d[b].get("eid");c++}if(selectedEffectId==""){for(b=0;b<d.length;b++){if(d[b].get("ename").indexOf("GID")!=-1){selectedEffectId=d[b].get("eid")}}}}return c}function studySelected(){var a;var b=0;if(studyList){var c=studyList.getSelectionModel().getSelections();for(a=0;a<c.length;a++){selectedStudyId=c[a].get("sid");b++}}return b}function submitDataSetInfo(j){selectedEffectId="";var h=datasetSelected();if(h==0){showExtMessageBox(INFO,"Please select a study and study data set entry","","")}else{var e=studySelected();var l="";var c="";var n="";var f=$("StudyResultViewSelector").value;if((f=="SimpleTableView")&&(f=="ShowFilterSimpleTableView")){n="SimpleTableView"}else{n="MatrixView"}n="SimpleTableView";if(!j){setProcessStatus("dataset_indicator");if(selectedEffectId_previous!=selectedEffectId){selectedFactors=[];selectedLevelNumbers=[];selectedLevelNumbersAll=[];selectedVariates=[];labelIds=[];factorLevelIndicator=[];if(document.getElementById("StudyDataSetFilterWindow")){var m=document.getElementById("StudyDataSetFilterWindow");m.innerHTML=""}}}else{setProcessStatus("dataset_indicator2");if(selectedFactors.length==0){l=""}else{for(var g=0;g<selectedFactors.length;g++){if(g==0){l=selectedFactors[g]}else{l=l.concat(","+selectedFactors[g])}}}if(selectedVariates.length==0){c=""}else{for(var g=0;g<selectedVariates.length;g++){if(g==0){c=selectedVariates[g]}else{c=c.concat(","+selectedVariates[g])}}}}selectedEffectId_previous=selectedEffectId;if((j)&&(c=="")&&(l=="")){setStatusMessage("dataset_indicator2","&nbsp;");showExtMessageBox(INFO,"Nothing to display. Select at least one factor or variate.","","")}else{var b="";if(factorLevelIndicator.length==0){b=""}else{for(var g=0;g<factorLevelIndicator.length;g++){if(g==0){b=factorLevelIndicator[g]}else{b=b.concat(","+factorLevelIndicator[g])}}}var a="";if(selectedLevelNumbers.length==0){a=""}else{for(var g=0;g<selectedLevelNumbers.length;g++){if(g==0){a=selectedLevelNumbers[g]}else{a=a.concat(","+selectedLevelNumbers[g])}}}var d="";if(selectedLevelNumbersAll.length==0){d=""}else{for(var g=0;g<selectedLevelNumbersAll.length;g++){if(g==0){d=selectedLevelNumbersAll[g]}else{d=d.concat(","+selectedLevelNumbersAll[g])}}}var k="";if(labelIds.length==0){k=""}else{for(var g=0;g<labelIds.length;g++){if(g==0){k=labelIds[g]}else{k=k.concat(","+labelIds[g])}}}Workbench.action(STUDY_DATACONSUMER,"InitializeStudyDetailsView",{SelectedStudyUID:selectedStudyId,SelectedStudyResultView:n,SelectedEffectId:selectedEffectId,FilterIndicator:j,SelectedFactorIds:l,SelectedVariateIds:c,FactorFilteredLevelIndicator:b,SelectedLevelNumbers:a,SelectedLevelNumbersAll:d,LabelIds:k,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}}}function initializeTabularDataGrid(){var b="";if(selectedLevelNumbersForRows.length==0){b=""}else{for(var d=0;d<selectedLevelNumbersForRows.length;d++){if(d==0){b=selectedLevelNumbersForRows[d]}else{b=b.concat(","+selectedLevelNumbersForRows[d])}}}var c="";if(selectedLevelNumbersForColumns.length==0){c=""}else{for(var d=0;d<selectedLevelNumbersForColumns.length;d++){if(d==0){c=selectedLevelNumbersForColumns[d]}else{c=c.concat(","+selectedLevelNumbersForColumns[d])}}}var a="";if(selectedFactorValuesForColumns.length==0){a=""}else{for(var d=0;d<selectedFactorValuesForColumns.length;d++){if(d==0){a=selectedFactorValuesForColumns[d]}else{a=a.concat(","+selectedFactorValuesForColumns[d])}}}var f="";if(selectedFactorValuesForRows.length==0){f=""}else{for(var d=0;d<selectedFactorValuesForRows.length;d++){if(d==0){f=selectedFactorValuesForRows[d]}else{f=f.concat(","+selectedFactorValuesForRows[d])}}}var e=koioslayout.findById("study-main");e.add({id:"matrix-tab",contentEl:"StudyMatrixTab",title:"Study Matrix",height:700,autoScroll:true});Workbench.action(STUDY_DATACONSUMER,"InitializeStudyMatrixView",{SelectedFactorIdForRow:selectedFactorIdForRow,SelectedFactorNameForRow:selectedFactorNameForRow,SelectedFactorIdForColumn:selectedFactorIdForColumn,SelectedLevelNumbersForRows:b,SelectedLevelNumbersForColumns:c,SelectedFactorValuesForRows:f,SelectedFactorValuesForColumns:a,SelectedVariateIdForMatrix:selectedVariateIdForMatrix,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function setMatrixColumnContent(a){selectedVariateIdForMatrix=a}function showFilterView(){setProcessStatus("dataset_filter_indicator");selectedFactors=[];selectedVariates=[];selectedEffectId_previous="";factorLevelIndicator=[];selectedLevelNumbers=[];labelIds=[];panel_for_study_filter=new Ext.Panel({frame:false,border:false,region:"center",margins:"3 3 3 0",collapsible:false,header:false,contentEl:"StudyDataSetFilterWindow",autoScroll:true,autoHeight:true});study_filter_win=new Ext.Window({closable:true,width:600,height:450,closeAction:"hide",collapsible:true,hideBorders:true,minimizable:true,maximizable:true,plain:true,layout:"border",autoScroll:true,items:[panel_for_study_filter]});Workbench.action(STUDY_DATACONSUMER,"StudyWindowEffectFilterUpdate",{SelectedEffectId:selectedEffectId,SelectedStudyUID:selectedStudyId,FilterIndicator:true,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function showMatrixFilterView(){setProcessStatus("dataset_filter_indicator");Workbench.action(STUDY_DATACONSUMER,"StudyWindowMatrixFilterUpdate",{SelectedStudyResultView:"MatrixView",SelectedEffectId:selectedEffectId,SelectedStudyUID:selectedStudyId,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function handleChoice(){var a=$("StudyResultViewSelector").value;studySelected();var c=datasetSelected();var b=koioslayout.findById("study-main");if(c==0){showExtMessageBox(INFO,"Please select a study/study data set entry","","")}else{if(a=="SimpleTableView"){submitDataSetInfo(false)}if(a=="ShowFilterSimpleTableView"){showFilterView()}if(a=="MatrixFilterView"){koioslayout.findById("study-main").add({id:"matrixfilter-tab",contentEl:"StudyDataSetMatrixFilterTab",title:"Study Matrix Filter",height:800,autoScroll:true});b.hideTabStripItem("matrixfilter-tab");showMatrixFilterView()}}}function convertToTabDelim(){var c=studyListDataSetDs.getTotalCount();var b=null;if(c>1500){b=window.confirm("Are you sure you want to load ALL "+c+" data? This may take minutes to generate all data.")}else{b=window.confirm("Are you sure you want to load ALL "+c+" data?")}if(b){var a=document.getElementById("StudyDataSetList");Workbench.action(STUDY_DATACONSUMER,STUDY_EXPORT_DATASET,{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName,ContextPath:context_path,RealPath:real_path},EventCallback)}}function progressTheBar(b,a,c,d){a=b/(d);c=a*100;c=c.toPrecision(3);myLoadBar.updateText("Saving "+c+"% of "+d+".");myLoadBar.updateProgress(a)}function checkFactor(e,a,c){var d=document.getElementById(e);if(d.checked==true){var b=selectedFactors.indexOf(c);if(b==-1){selectedFactors.push(c)}}else{var b=selectedFactors.indexOf(c);if(b!=-1){selectedFactors.splice(b,1)}}}function checkVariate(e,a,b){var c=document.getElementById(e);if(c.checked==true){var d=selectedVariates.indexOf(b);if(d==-1){selectedVariates.push(b)}}else{var d=selectedVariates.indexOf(b);if(d!=-1){selectedVariates.splice(d,1)}}}function RefreshfactorValuesAndRelatedOpenLables(d,c,b,e){var a=document.getElementById(c+"_dummy2");if(a){reloadFactorValues(d,c,b,e)}}function reloadFactorValues(e,d,c,h){var f=document.getElementById(e+"Div");f.innerHTML="Loading...";datasetSelected();studySelected();var g="";if(selectedLevelNumbers.length==0){g=""}else{for(var b=0;b<selectedLevelNumbers.length;b++){if(b==0){g=selectedLevelNumbers[b]}else{g=g.concat(","+selectedLevelNumbers[b])}}}var a="";if(labelIds.length==0){a=""}else{for(var b=0;b<labelIds.length;b++){if(b==0){a=labelIds[b]}else{a=a.concat(","+labelIds[b])}}}Workbench.action(STUDY_DATACONSUMER,"StudyWindowEffectFilterValuesUpdate",{SelectedStudyResultView:"ShowFilterSimpleTableView",SelectedEffectId:selectedEffectId,SelectedStudyUID:selectedStudyId,SelectedFactorId:d,SelectedFactorCombinedId:e,LabelIds:a,SelectedLevelNumbers:g,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function ShowHidefactorValues(h,l,d,b){Toggle(h+"Block");var e=document.getElementById(h+"Block");if(e){if(e.style.display=="block"){var j=false;var f=document.getElementById(l+"_dummy2");if(f){for(var g=0;g<labelIds.length;g++){if(labelIds[g]==l){j=true;break}}}if((f)&&(!j)){}else{var c=document.getElementById(h+"Div");c.innerHTML="Loading...";datasetSelected();studySelected();var a="";if(selectedLevelNumbers.length==0){a=""}else{for(var g=0;g<selectedLevelNumbers.length;g++){if(g==0){a=selectedLevelNumbers[g]}else{a=a.concat(","+selectedLevelNumbers[g])}}}var k="";if(labelIds.length==0){k=""}else{for(var g=0;g<labelIds.length;g++){if(g==0){k=labelIds[g]}else{k=k.concat(","+labelIds[g])}}}Workbench.action(STUDY_DATACONSUMER,"StudyWindowEffectFilterValuesUpdate",{SelectedStudyResultView:"ShowFilterSimpleTableView",SelectedEffectId:selectedEffectId,SelectedStudyUID:selectedStudyId,SelectedFactorId:l,SelectedFactorCombinedId:h,LabelIds:k,SelectedLevelNumbers:a,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}}}}function getSelectedValues(a){alert(a)}function retrieveDataSetList(c,b,a){setProcessStatus("dataset_list_indicator");selectedStudyId=b;koioslayout.findById("main").unhideTabStripItem("study-main");koioslayout.findById("main").setActiveTab("study-main");koioslayout.findById("study-main").unhideTabStripItem("study-tab");koioslayout.findById("study-main").setActiveTab("study-tab");var d="";Workbench.action(STUDY_DATACONSUMER,c,{SelectedStudyUID:b,SelectedStudyName:a,SelectedStudyDescription:d,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function retrieveDataSetList(d,c,a,b,f,e){setProcessStatus("dataset_list_indicator");selectedStudyId=c;koioslayout.findById("main").unhideTabStripItem("study-main");koioslayout.findById("main").setActiveTab("study-main");koioslayout.findById("study-main").unhideTabStripItem("study-tab");koioslayout.findById("study-main").setActiveTab("study-tab");Workbench.action(STUDY_DATACONSUMER,d,{SelectedStudyUID:c,SelectedStudyName:a,SelectedGermplasmUID:b,SelectedGermplasmName:f,SelectedViewOption:e,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function clearStudyGrid(c){var b=document.getElementById("searchStudyByName");if(b!=null){b.value=c}var a=document.getElementById("study_list");if(a!=null){a.innerHTML="&nbsp;"}var d=document.getElementById("StudyListView");if(d!=null){d.innerHTML="&nbsp;"}}function clearDataSetGrid(){var a=document.getElementById("effects_list");if(a!=null){a.innerHTML="&nbsp;"}}function showFactorValues(b,a){if(a){setProcessStatus("row_headers_loading_status")}else{setProcessStatus("col_headers_loading_status")}Workbench.action(STUDY_DATACONSUMER,"StudyWindowEffectFilterValuesUpdate",{SelectedStudyResultView:"MatrixView",SelectedEffectId:selectedEffectId,SelectedStudyUID:selectedStudyId,SelectedFactorId:b,TypeFlag:a,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function showStudiesHelpWindow(){Workbench.action(STUDY_DATACONSUMER,"StudyWindowHelp",{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function ToggleStudyTraits(a){Toggle(a)}var germplasm_set_ds=null;var germplasm_set_grid=null;var germplasmSampleTextMap=[];var pedigree_win;var germplasm_set_studies_count="0";var load_germplasm_pedigree_by_url_param_init="false";var germplasm_list_form;var germplasm_list_members_grid;var germplasm_list_members_paging_tb;var germplasm_list_members_record;var germplasm_list_members_cm;var germplasm_list_members_ds;var alternative_names_grid;var germplasm_record;var cm;var germplasm_ds;var germplasm_attr_record;var germplasm_attr_cm;var germplasm_attr_ds;var germplasm_attributes_grid;var germplasm_study_record;var germplasm_study_cm;var germplasm_study_ds;var germplasm_studies_grid;var germplasm_details_form;if(valid_query_indicator){if(lsid_val.indexOf("Germplasm")!=-1){load_germplasm_pedigree_by_url_param_init="true"}}function initializeGermplasmListView(){Workbench.action(GERMPLASM_DATACONSUMER,GERMPLASM_LIST_WINDOW_INITIALIZATION,{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function setGermplasmQueryConstraint(g,c){Workbench.action(GERMPLASM_DATACONSUMER,g,{ConstraintUID:c,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback);var b=document.getElementById("germplasm_search_button");var a=document.getElementById("searchString");if(c=="Germplasm.byCountry"){a.value="feature not available";b.disabled=true;a.disabled=true}else{a.value="";b.disabled=false;a.disabled=false}var e=document.getElementById("GermplasmQuerySampleTextView");e.innerHTML="";if(germplasmSampleTextMap!=null){for(var d=0;d<germplasmSampleTextMap.length;d++){var f=germplasmSampleTextMap[d];if(c==f.usecase_id){e.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;<font size='1'>Example:&nbsp;&nbsp;"+f.sample_text+"</font>"}}}}function loadGrameneLink(b){var a=window.open(b,"Gramene","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=800,height=800");a.focus()}function loadPedigree(a,b,c){setProcessStatus("pedigree_indicator");Workbench.action(GERMPLASM_DATACONSUMER,INIT_GERMPLASM_PEDIGREE,{FromGUIGermplasmLSID:a,FromGUIGermplasmUID:b,FromGUIDatasourceUID:c,PedigreeViewerBaseURL:pedigree_base_url,ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName,ContextPath:context_path},EventCallback)}function getStudyDetails(a,b,d,c){retrieveDataSetList(STUDY_WINDOW_DATASET_UPDATE,a,b,d,c)}function getStudyDetails(a,b){selectedStudyId=b;getDetails(GERMPLASM_STUDY_DATATYPE_NAME,b,a)}function getStudyEvalData(a,b,d,c,e){retrieveDataSetList(STUDY_WINDOW_GET_EVALUATION_DATA,b,a,d,c,e)}function getGermplasmListAssociatedStudies(){if(germplasm_set_studies_count!="0"){Workbench.action(GERMPLASM_DATACONSUMER,GET_STUDIES_ASSOCIATED_WITH_GERMPLASM_SET_MEMBERS,{ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}}function ExportMemberGermplasms(){Workbench.action(GERMPLASM_DATACONSUMER,"GermplasmSetDownloadAllGermplams",{RealPath:real_path,DownloadAllMemberGermplasms:"true",ContextType:CROP_CONTEXT_TYPE,ContextValue:CurrentCropName},EventCallback)}function tabPedigree(d,b,a){if(document.getElementById("germplasm-pedigree-"+b)){var c=koioslayout.findById("germplasm-main");if(lsid_query_indicator){c.setActiveTab(document.getElementById("germplasm-pedigree-"+b).id)}else{c.setActiveTab("germplasm-pedigree-main");var e=c.findById("germplasm-pedigree-main");e.setActiveTab(document.getElementById("germplasm-pedigree-"+b).id)}}else{loadPedigree(d,b,a)}};
