Interactive interface for browsing global, full-resolution satellite imagery
WV-446
Joshia92de34f93e7
diff --git a/src/css/products.css b/src/css/products.cssindex dcc2d055a..7a63fd863 100644--- a/src/css/products.css+++ b/src/css/products.css@@ -74,6 +74,40 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b3ffffff', e}+.dynamic {+ display:inline !important;+ font-size:inherit;+ border-radius:5px;+ background: #1BA1E2;+ padding: 2px;+ text-align: center;+ margin-left:5px !important;+}++.cats {+ float: right;+ margin-right:20px;+}++.action {+ display:block;+ width: 98%;+ height: 44px;+ margin: 5px auto;+ border: none;+ color: #fff;+ font-size:14px;+ background: #83c783; /* Old browsers */+ background: -moz-linear-gradient(top, #83c783 0%, #52b152 33%, #00a81c 83%, #149600 100%); /* FF3.6+ */+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#83c783), color-stop(33%,#52b152), color-stop(83%,#00a81c), color-stop(100%,#149600)); /* Chrome,Safari4+ */+ background: -webkit-linear-gradient(top, #83c783 0%,#52b152 33%,#00a81c 83%,#149600 100%); /* Chrome10+,Safari5.1+ */+ background: -o-linear-gradient(top, #83c783 0%,#52b152 33%,#00a81c 83%,#149600 100%); /* Opera 11.10+ */+ background: -ms-linear-gradient(top, #83c783 0%,#52b152 33%,#00a81c 83%,#149600 100%); /* IE10+ */+ background: linear-gradient(to bottom, #83c783 0%,#52b152 33%,#00a81c 83%,#149600 100%); /* W3C */+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#83c783', endColorstr='#149600',GradientType=0 ); /* IE6-9 */++}+.productsIcon {width: 20px;height: 20px;@@ -84,6 +118,10 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b3ffffff', emargin-right: 10px;}+.content {+ height:100%;+}+@media screen and (max-device-height: 720px) and (orientation: landscape){div.olControlMousePosition, div.olControlScaleLineCustom {display:none !important;}}diff --git a/src/css/selector.css b/src/css/selector.cssindex c2c49f99d..3d8cdf496 100644--- a/src/css/selector.css+++ b/src/css/selector.css@@ -19,12 +19,12 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b3ffffff', e.selector h3 {display:inline-block; float: left; color:#333333; font-size: 0.9em; border:none; text-decoration:none; }.selector div,.selector ul {display:block; overflow:hidden;margin:0 auto; width:100%;}-.selector li.selectorItem {padding:6px 0px; width:96%; margin: 5px 2% 0 2%; display:block; float:left; overflow:hidden;+.selector li.item {padding:6px 0px; width:96%; margin: 5px 2% 0 2%; display:block; float:left; overflow:hidden;color:#000; background: rgba(238,238,238,0.85);}-.selector li.selectorItem input {float:right;}-.selector li.selectorItem h4 {font-size:0.85em; color:#000;padding: 0 3px;}-.selector li.selectorItem p {padding: 0 3px; font-size:0.78em; color: #222;}-.selector ul.category { outline:none !important; float:left; overflow:auto;}+.selector li.item input {float:right;}+.selector li.item h4 {font-size:0.85em; color:#000;padding: 0 3px;}+.selector li.item p {padding: 0 3px; font-size:0.78em; color: #222;}+.selector ul.selectorboxcategory { outline:none !important; float:left; overflow:auto;}.selector h3.head {display:block; float: left; color:#fff; width:100%; border:none; text-decoration:none; background: none; padding: 1px 3px; margin:10px 0 0 2%; }.selector a.flowbutton {text-decoration:none; display:inline-block; float: left; color:#ffffff; font-size: 1.4em; border:none; padding:6px 0; margin-top:20px; margin-left:5px;}.selector ul li div {padding:0 !important;}diff --git a/src/index.html b/src/index.htmlindex c74f70327..c3d6eb798 100644--- a/src/index.html+++ b/src/index.html@@ -127,6 +127,7 @@<!-- link.dev --> <script type="text/javascript" src="js/accordionPicker.js"></script><!-- link.dev --> <script type="text/javascript" src="js/list.js"></script><!-- link.dev --> <script type="text/javascript" src="js/bank.js"></script>+ <!-- link.dev --> <script type="text/javascript" src="js/download.js"></script><!-- link.dev --> <script type="text/javascript" src="js/switch.js"></script><!-- link.dev --> <script type="text/javascript" src="js/selector.js"></script><!-- link.dev --> <script type="text/javascript" src="js/products.js"></script>diff --git a/src/js/bank.js b/src/js/bank.jsindex 30b014a51..ca392093b 100644--- a/src/js/bank.js+++ b/src/js/bank.js@@ -105,7 +105,8 @@ SOTE.widget.Bank.handleMetaSuccess = function(data,status,xhr,args){}if(! (data[i][j].value in dupes) ){- self.data[data[i][j].category].items.push({label:data[i][j].label,sublabel:data[i][j].sublabel,value:data[i][j].value});+ var categories = {"All":1};+ self.data[data[i][j].category].items.push({label:data[i][j].label,sublabel:data[i][j].sublabel,value:data[i][j].value,categories:categories});dupes[data[i][j].value] = 1;}}@@ -180,10 +181,17 @@ SOTE.widget.Bank.prototype.render = function(){this.list = new SOTE.widget.List(this.id,{data: this.data,- selected: this.selected[this.state]+ selected: this.selected[this.state],+ hide: true,+ close: true,+ filter: true,+ search: false,+ sortable: true,+ onchange: SOTE.widget.Bank.handleFire,+ args: this});- $("#"+this.id).bind("listchange", {self:this}, SOTE.widget.Bank.handleFire);+ //$("#"+this.id).bind("listchange", {self:this}, SOTE.widget.Bank.handleFire);/*var m = this.meta[myVal];@@ -208,8 +216,7 @@ SOTE.widget.Bank.prototype.render = function(){};-SOTE.widget.Bank.handleFire = function(e){- var self = e.data.self;+SOTE.widget.Bank.handleFire = function(self){self.fire();};diff --git a/src/js/download.js b/src/js/download.jsnew file mode 100644index 000000000..f4d745f19--- /dev/null+++ b/src/js/download.js@@ -0,0 +1,397 @@+SOTE.namespace("SOTE.widget.Download");++SOTE.widget.Download.prototype = new SOTE.widget.Component;++/**+ * A selection device classifying radio buttons/checkboxes into categories that are displayed in Accordion form.+ * Radio buttons allow single selection accross categories. Checkboxes allow multiple selections accross categories.+ * Radio selections cannot span multiple categories.+ *+ * @module SOTE.widget+ * @class Download+ * @constructor+ * @this {Download}+ * @param {String} containerId is the container id of the div in which to render the object+ * @param {Object} [config] is a hash allowing configuration of this component+ * @config {Object[]} [items] a JS Array of JS Objects: items.category[i..n].key, items.category[i..n].value+ * , items.category[i..n].action, items.type[i..n] representing the available options+ * @config {String} [selected] the key of the initially selected option(s)+ * @augments SOTE.widget.Component+ *+*/+SOTE.widget.Download = function(containerId, config){+ this.log = Logging.getLogger("Worldview.Widget.Download");+ this.VALID_PROJECTIONS = ["geographic", "arctic", "antarctic"];+ this.hidden = {};++ //Get the ID of the container element+ this.container=document.getElementById(containerId);+ if (this.container==null){+ this.setStatus("Error: element '"+containerId+"' not found!",true);+ return;+ }+ this.id = containerId;+ //Store the container's ID+ this.containerId=containerId;++ //Define an object for holding configuration+ if (config===undefined){+ config={};+ }++ if(config.title === undefined){+ config.title = "My Download";+ }++ if(config.categories === undefined){+ config.categories = ["Category 1","Category 2"];+ }++ if(config.callback === undefined){+ config.callback = null;+ }++ if(config.state === undefined || config.state === ""){+ config.state = "geographic";+ }+++ this.state = config.state;+ this.selected = config.selected;++ this.dataSourceUrl = config.dataSourceUrl;++ this.title = config.title;+ this.callback = config.callback;+ this.selector = config.selector;+ this.data = new Object;+ this.buildMetaDone = false;+ this.categories = config.categories;+ this.initRenderComplete = false;+ this.dataSourceUrl = config.dataSourceUrl;+ this.statusStr = "";+ this.config = config.config;+ this.paletteWidget = config.paletteWidget;+ this.queryString = "";+ this.noFireVal = null;+ this.init();++};++SOTE.widget.Download.prototype.buildMeta = function(cb,val){+ this.buildMetaDone = false;+ var data = this.config.ap_products[this.state];+ SOTE.widget.Download.handleMetaSuccess(data, null, null, {+ self: this,+ callback: cb,+ val: val+ });++};++SOTE.widget.Download.handleMetaSuccess = function(data,status,xhr,args){+ var self = args.self;+ var dupes = new Object;+ var count = 0;++ for(var i in data){+ if(i != "palettes") {++ for(var j=0; j<data[i].length; j++){+ data[i][j].product = "Product1";+ if(!self.data[data[i][j].product]){+ self.data[data[i][j].product] = new Object;+ self.data[data[i][j].product].title = data[i][j].product;//self.categories[count++];+ self.data[data[i][j].product].items = [];+ }++ if(! (data[i][j].value in dupes) ){+ var categories = {"All":1};+ self.data[data[i][j].product].items.push({label:data[i][j].label,sublabel:data[i][j].sublabel,value:data[i][j].value,categories:categories});+ dupes[data[i][j].value] = 1;+ }+ }+ }+ }++ if(args.callback){+ args.callback({self:self,val:args.val});+ }+ else{+ self.render();+ self.fire();+ }+ self.buildMetaDone = true;+};++/**+ * Displays all options in HTML in an Accordion format (see JQuery UI Accordion) with the selected states being indicated+ * by radio button and checkbox selection. All callbacks should be set. The component UI should be rendered+ * with controllers to call the events.+ *+ *+ * @this {Download}+ *+*/+SOTE.widget.Download.prototype.init = function(){++ this.buildMeta();++ if(REGISTRY){+ REGISTRY.register(this.id,this);+ }+ else{+ alert("No REGISTRY found! Cannot register Download!");+ }+++};++/**+ * Renders the UI accordion from this.items+ *+ *+ * @this {Download}+ *+*/+SOTE.widget.Download.prototype.render = function(){++ $(this.container).empty();++ var tabs_height = $(".ui-tabs-nav").outerHeight(true);+ $('#'+this.id).addClass('bank');+ $('#'+this.id).height($('#'+this.id).parent().outerHeight() - tabs_height);++ this.list = new SOTE.widget.List(this.id,{+ data: this.data,+ selected: this.selected[this.state],+ close: true,+ filter: true,+ search: false,+ action: {text: "Download (~0GB)", callback: SOTE.widget.Download.handleAction},+ selectableCategories: {callback: SOTE.widget.Download.handleCategoryChange, defaultText: "0 selected"},+ onchange: SOTE.widget.Download.handleFire,+ args: this+ });++ // this.list.setActionText("Download (~8.7GB)");+ // this.list.setCategoryText ("Product1", "3 selected");++ // Mark the component as ready in the registry if called via init()+ if ((this.initRenderComplete === false) && REGISTRY) {+ this.initRenderComplete = true;+ REGISTRY.markComponentReady(this.id);+ }++};++SOTE.widget.Download.handleAction = function(self){+ // Result of action button being clicked+};++SOTE.widget.Download.handleCategoryChange = function(category, self){+ // Result of category change click here+};++SOTE.widget.Download.handleFire = function(self){+ self.fire();+};++/**+ * Fires an event to the registry when the state of the component is changed+ *+ * @this {Download}+ *+*/+SOTE.widget.Download.prototype.fire = function(){+ $("#"+this.id).trigger("fire");++ if(REGISTRY){+ REGISTRY.fire(this,this.noFireVal);+ this.noFireVal = null;+ }+ else{+ alert("No REGISTRY found! Cannot fire to REGISTRY from Download!");+ }++};++/**+ * Sets the selected option(s) in the Download from the passed in value(s), if valid+ * [containerId]=[options] (options is a dot delimited string with the first item containing+ * a single select item, and the remaining items containing the multi-select items).+ *+ * @this {Download}+ * @param {String} value is a dot delimited string of the key(s) of the option(s) to be set as selected+ * @returns {boolean} true or false depending on if the new value(s) validates+ *+*/+SOTE.widget.Download.prototype.setValue = function(valString, selector){+ this.list.setValue(valString, selector);+};++SOTE.widget.Download.prototype.currCount = function(){+ return this.list.count;+};++/**+ * Gets the currently selected option(s) [containerId]=[options]+ *+ * @this {Download}+ * @returns {String} [container]=[options], options being a dot delimited string+ * representing the key(s) of the currently selected option(s)+ *+*/+SOTE.widget.Download.prototype.getValue = function(){++ return this.id + "=" + this.list.getValue();+};++SOTE.widget.Download.prototype.value = function(){++ return this.list.getValue();+};++/**+ * Change the component based on dependencies (i.e. Available Options, Selected)+ *+ * @this {Download}+ * @param {String} querystring contains all values of dependencies (from registry)+ * @returns {boolean} true or false depending on if the selected value still validats with criteria change+ *+*/+SOTE.widget.Download.prototype.updateComponent = function(querystring){+ var qs = (querystring === undefined)? "":querystring;+ SOTE.widget.Download.handleUpdateSuccess(this,qs);+};++/**+ * Static function to handle a successful retrieval from the data accessor+ *+ * @this {Download}+ * @param {Object,String,Object,Object} data is the data passed back from the call, status is the response status, xhr is the applicable xmlhttprequest object, args are the custom arguments passed+ *+*/+SOTE.widget.Download.handleUpdateSuccess = function(self,qs){++};++/**+ * Static function to handle a failed retrieval from the data accessor+ *+ * @this {Download}+ * @param {Object,String,String,Object} xhr is the applicable xmlhttprequest object, status is the response status, error is the thrown error, args are the custom arguments passed+ *+*/+SOTE.widget.Download.handleUpdateFailure = function(xhr,status,error,args){+ alert("Failed to load data accessor: " + error);+};+++/**+ * Sets the selected option(s) from the query string [containerId]=[options]+ *+ * @this {Download}+ * @param {String} qs contains the querystring+ * @returns {boolean} true or false depending on whether the new option validates+ *+*/+SOTE.widget.Download.prototype.loadFromQuery = function(qs){+ var newState = SOTE.util.extractFromQuery("switch",qs);++ if (newState === "" ) {+ newState = "geographic";+ }+ if(this.state != newState){+ this.state = newState;+ this.updateComponent(qs);+ }+ else {+ SOTE.widget.Download.loadValue({+ self: this,+ val: SOTE.util.extractFromQuery(this.id, qs)+ });+ }+};++SOTE.widget.Download.prototype.sleep = function(v){+ setTimeout(SOTE.widget.Download.loadValue,100,{self:this,val:v});+};++SOTE.widget.Download.loadValue = function(args){+ if(args.self.buildMetaDone == true) {+ // If products are not specified, use the defaults+ if ( args.val.length === 0 ) {+ args.self.setValue(args.self.selected[args.self.state]);+ } else {+ args.self.setValue(args.val);+ }+ }+ else {+ args.self.sleep(args.val);+ }+};++/**+ * Validates that the selected option(s) is not null, only one radio button is selected cross category+ * and all options are within the scope of available options+ *+ * @this {Download}+ * @returns {boolean} true or false depending on whether the selected option(s) meet the validation criteria+*/+SOTE.widget.Download.prototype.validate = function(){++ var isValid = true;+ return isValid;++};++SOTE.widget.Download.prototype.setHeight = function(height){+ $("#"+this.id).css("height",height+"px");+ SOTE.widget.Download.adjustCategoryHeights({self:this});+};++/**+ * Sets the data accessor that provides state change instructions given dependencies+ *+ * @this {Download}+ * @param {String} datasourceurl is the relative location of the data accessor+ *+*/+SOTE.widget.Download.prototype.setDataSourceUrl = function(dataSourceUrl){+ this.dataSourceUrl = dataSourceUrl;+};++/**+ * Gets the data accessor+ *+ * @this {Download}+ * @returns {String} the relative location of the accessor+ *+*/+SOTE.widget.Download.prototype.getDataSourceUrl = function(){+ return this.dataSourceUrl;+};++/**+ * Sets the status of the component+ *+ * @this {Download}+ * @param {String} s the current status of the component (user prompts, error messages)+ *+*/+SOTE.widget.Download.prototype.setStatus = function(s){+ this.statusStr = s;+};++/**+ * Gets the status of the component+ *+ * @this {Download}+ * @returns {String} the current status of the component (user prompts, error messages)+ *+*/+SOTE.widget.Download.prototype.getStatus = function(){+ return this.statusStr;+};+diff --git a/src/js/list.js b/src/js/list.jsindex 9398f3d68..76bebe18d 100644--- a/src/js/list.js+++ b/src/js/list.js@@ -44,13 +44,51 @@ SOTE.widget.List = function(containerId, config){if(config.data === undefined){SOTE.util.throwError("List data is not defined.");}++ if(config.search == undefined){+ config.search = false;+ config.selectedCategory = 'All';+ }++ if(config.search && config.category == undefined){+ config.selectedCategory = 'All';+ }++ if(config.filter == undefined){+ config.filter = false;+ }++ if(config.customClasses == undefined){+ config.customClasses = '';+ }++ if(config.sortable == undefined){+ config.sortable = false;+ }++ this.customClasses = config.customClasses;this.hidden = new Object;this.values = new Object;+ this.keyword = '';+ this.search = config.search;+ this.filter = config.filter;+ this.hide = config.hide;+ this.close = config.close;+ this.checkbox = config.checkbox;+ this.selectedCategory = config.defaultCategory;+ this.selectableCategories = config.selectableCategories;+ this.action = config.action;+ this.categories = config.categories;+ this.sortable = config.sortable;+ this.callback = config.onchange;+ this.args = config.args;+this.data = config.data;- this.selected = this.unserialize(config.selected);- this.selected = this.selected[1];++ this.selected = this.unserialize(config.selected);+ this.selected = this.selected[1];this.init();@@ -72,7 +110,8 @@ SOTE.widget.List.prototype.init = function(){};SOTE.widget.List.prototype.trigger = function(){- $("#"+this.id).trigger("listchange");+ //$("#"+this.id).trigger("listchange");+ this.callback(this.args);};/**@@ -89,50 +128,169 @@ SOTE.widget.List.prototype.render = function(){// setNotification: id,txt- $(this.container).empty().addClass('list');+++ // Clear div++ $(this.container).empty().addClass(this.id+'list');++ // If action is enabled, render an action button++ if(this.action){+ var $actionButton = $("<input type='button' class='action' value='"+this.action.text+"' id='"+this.id+"action' />");+ $(this.container).append($actionButton);+ $("#"+this.id+"action").on('click',{self:this},SOTE.widget.List.act);+ }++ // If search is enabled, render the search box and category box++ if(this.search){+ var $facetedSearch = $("<div class='facetedSearch' id='"+this.id+"facetedSearch'></div>");+ var $select = $("<select class='select' id='"+this.id+"select'></select");++ for (var c in this.categories){+ if(c != 'palettes'){+ $select.append($("<option value='"+c+"'>"+c+"</option>"));+ }+ }++ $facetedSearch.append($select);+ $facetedSearch.append($("<input type='text' name='search' class='search' autocomplete='off' placeholder='ex. modis, terra, fire' id='"+this.id+"search'/>"));++ $(this.container).append($facetedSearch);++ // Set events to capture data from search and category fields++ $("#"+this.id+"select").on('change',{self:this,select:true},SOTE.widget.List.setCategory);+ $('#'+this.id+"select").val("All");+ $("#"+this.id+"search").on('keyup',{self:this,select:false},SOTE.widget.List.search);+ }++ // Creating main content block++ $(this.container).append($("<div id='"+this.id+"content' class='content "+this.customClasses+"'></div>"));+ this.update();+++};++SOTE.widget.List.prototype.update = function(){++ $content = $("#" + this.id + "content").empty();++ // If search is enabled and a keyword exists, break keyword down into words array++ keywords = [];+ if(this.search){+ this.keyword = this.keyword.replace(/[\(\)\"\'!\$\%\&\?\+\*\\\@\=]/g,"");+ var keywords = this.keyword.split(/\s/);+ }++ // Traverse data by category (i.e. baselayers, overlays)for(var key in this.data){++ // Category header (i.e. "Base Layers")+var title = this.data[key].title;-- $(this.container).append($("<h3 class='head'></h3>").html(title));- $category = $("<ul id='"+key+"'></ul>").addClass('category');+ var $header = $("<h3 class='head'></h3>").html(title);++ if(this.selectableCategories){+ $header.append($("<div id='"+key+"dynamictext' class='dynamic'>"+this.selectableCategories.defaultText+"</div>"));+ $header.append($("<input type='radio' name='cats' class='cats "+this.id+"cats' value='"+key+"' />"));+ $("#"+this.id).undelegate("."+this.id+"cats" ,'click');+ $("#"+this.id).delegate("."+this.id+"cats" ,'click',{self:this},SOTE.widget.List.handleCategorySelection);+ }++ $content.append($header);++ $category = $("<ul id='"+this.id+key+"'></ul>").addClass(this.id+'category');+this.values[key] = new Object;+ // For all items in category (i.e. for all items in baselayers)+for(var i=0; i<this.data[key].items.length; ++i){var item = this.data[key].items[i];var label = item.label;var fLabel = item.label.replace(" ","-").toLowerCase();- if(item.value in this.selected) {-+ if(item.value in this.selected){this.values[key][item.value] = 1;-- $item = $("<li id='"+key+"-"+item.value+"' class='item'></li>");- $item.append("<a><img class='close bank-item-img' id='close"+key+"-"+item.value.replace(/:/g,"colon")+"' title='Remove Layer' src='images/close-red-x.png' /></a>");- if (item.value in this.hidden){- $item.append("<a class='hdanchor'><img class='hide bank-item-img' title='Show Layer' id='hide"+key+"-"+item.value.replace(/:/g,"colon")+"' src='images/invisible.png' /></a>");+ }+ // If only showing a subset of items (i.e. only show items that are in selected)++ if(!this.filter || item.value in this.selected) {++ // Do keyword search if the keyword is not empty++ if(this.search && !this.keyword.match(/^\s*$/)){+ var count = 0;+ for(var j=0; j<keywords.length; ++j){+ var myVal = new RegExp(keywords[j]);+ if(item.label.toUpperCase().match(myVal) || item.sublabel.toUpperCase().match(myVal) || item.tags && item.tags.toUpperCase().match(myVal)) {+ count++;+ }+ }}else {- $item.append("<a class='hdanchor'><img class='hide bank-item-img' title='Hide Layer' id='hide"+key+"-"+item.value.replace(/:/g,"colon")+"' src='images/visible.png' /></a>");+ count = keywords.length;+ }++ // If the the item is not in the selected category, regardless of a keyword match, don't show it++ if(item.categories && !(this.selectedCategory in item.categories)){+ count = -1;}- $item.append("<h4>"+label+"</h4>");- $item.append("<p>"+item.sublabel+"</p>");- $category.append($item);-+ // If search is selected, see if the item matched all words in the keywords list, if so, display+ // If search is not selected, display all items++ if(!this.search || (keywords && count == keywords.length)){++ $item = $("<li id='"+key+"-"+item.value+"' class='item'></li>");++ if(this.close){+ $item.append("<a><img class='close bank-item-img' id='close"+key+"-"+item.value.replace(/:/g,"colon")+"' title='Remove Layer' src='images/close-red-x.png' /></a>");+ }++ if(this.hide){+ if (item.value in this.hidden){+ $item.append("<a class='hdanchor'><img class='hide bank-item-img' title='Show Layer' id='hide"+key+"-"+item.value.replace(/:/g,"colon")+"' src='images/invisible.png' /></a>");+ }+ else {+ $item.append("<a class='hdanchor'><img class='hide bank-item-img' title='Hide Layer' id='hide"+key+"-"+item.value.replace(/:/g,"colon")+"' src='images/visible.png' /></a>");+ }+ }++ if(this.checkbox){+ var checked = (item.value in this.selected)? "checked":"";+ $item.append("<input type='checkbox' class='check' id='"+item.value.replace(/:/g,"colon")+"' value='"+item.value+"' "+checked+"/>");+ }+ $item.append("<h4>"+label+"</h4>");+ $item.append("<p>"+item.sublabel+"</p>");++ $category.append($item);+ }}}- $(this.container).append($category);+ // Append the category (heading + items) to the content div++ $content.append($category);}++ // Append show/hide/checkbox events if this.hide = true / this.close = true / this.checkbox = true$("#"+this.id).undelegate(".close" ,'click');$("#"+this.id).undelegate(".hide" ,'click');+ $("#"+this.id).undelegate(".check" ,'click');$("#"+this.id).delegate(".close" ,'click',{self:this},SOTE.widget.List.removeItem);$("#"+this.id).delegate(".hide" ,'click',{self:this},SOTE.widget.List.hideItem);- $( ".category" ).sortable({items: "li:not(.head)"});+ $("#"+this.id).delegate(".check" ,'click',{self:this},SOTE.widget.List.toggleValue);+if($(window).width() > 720){@@ -140,55 +298,119 @@ SOTE.widget.List.prototype.render = function(){var api = this.jsp.data('jsp');if(api) api.destroy();}- this.jsp = $( "." + this.id + "category" ).jScrollPane({autoReinitialise: false, verticalGutter:0});+ this.jsp = $( "."+this.id+"category" ).jScrollPane({autoReinitialise: false, verticalGutter:0});}- $( "." + this.id + "category li" ).disableSelection();- $( ".category" ).bind('sortstart',{self:this},SOTE.widget.List.initiateSort);- $( ".category" ).bind('sortstop',{self:this},SOTE.widget.List.handleSort);+ if(this.sortable){+ $( "."+this.id+"category" ).sortable({items: "li:not(.head)"});+ $( "."+this.id+"category" ).bind('sortstart',{self:this},SOTE.widget.List.initiateSort);+ $( "."+this.id+"category" ).bind('sortstop',{self:this},SOTE.widget.List.handleSort);+ }- setTimeout(SOTE.widget.List.adjustCategoryHeights,1,{self:this});-+ setTimeout(SOTE.widget.List.adjustCategoryHeights,1,{self:this});};+SOTE.widget.List.act = function(e){+ var self = e.data.self;+ self.action.callback(self.args);+};++SOTE.widget.List.handleCategorySelection = function(e){+ var self = e.data.self;+ self.selectableCategories.callback(e.target.value,self);+};++SOTE.widget.List.setCategory = function(e){+ e.data.self.selectedCategory = e.target.value;+ $("#"+e.data.self.id+"search").keyup();+};++SOTE.widget.List.search = function(e){+ var self = e.data.self;+ var val = e.target.value.toUpperCase();+ self.keyword = val;+ self.update();+};++SOTE.widget.List.toggleValue = function(e){+ var self = e.data.self;+ var targetEl = e.target;+ var category = $(e.target).parents('.'+self.id+'category').attr("id");+ category = category.replace(self.id,"");+ var value = $(e.target).attr("value");+ value = value.replace(/colon/,":");+ var checked = (targetEl.checked);++ if(!self.values[category]){+ self.values[category] = new Object();+ }+ if(checked !== undefined && checked){+ self.values[category][value] = 1;+ }+ else{+ delete self.values[category][value];+ }++ self.trigger();+};++SOTE.widget.List.prototype.setActionText = function(newText){+ $("#"+this.id+"action").value = newText;+};++SOTE.widget.List.prototype.setCategoryText = function(category,newText){+ $("#"+category+"dynamictext").html = newText;+};++SOTE.widget.List.adjustCategoryHeights = function(args){var self = args.self;var heights = new Array;- var container_height = $("#"+self.id).outerHeight(true);+ var facets_height = (self.search)? $("#"+self.id+"facetedSearch").outerHeight(true): 0;+ var actions_height = (self.action)? $("#"+self.id+"action").outerHeight(true): 0;++ var container_height = $("#"+self.id).outerHeight(true) - facets_height - actions_height;+ $('#'+self.id+"content").height(container_height);var labelHeight = 0;- $('#'+self.id+' .head').each(function(){+ $('#'+self.id+'content .head').each(function(){labelHeight += $(this).outerHeight(true);});container_height -= labelHeight;- for(var key in self.values){+ for(var key in self.data){var actual_height = 0;var count = 0;- $('#' + key + ' li').each(function(){+ $('#' + self.id + key + ' li').each(function(){actual_height += $(this).outerHeight(true);count++;});- heights.push({name:key,height:actual_height,count:count});+ heights.push({name:self.id+key,height:actual_height,count:count});}- if(heights[0].height + heights[1].height > container_height){- if(heights[0].height > container_height/2) {- heights[0].height = container_height/2;- }-- heights[1].height = container_height - heights[0].height;-- }+ if(heights.length > 1){+ if(heights[0].height + heights[1].height > container_height){+ if(heights[0].height > container_height/2) {+ heights[0].height = container_height/2;+ }- $("#" + heights[0].name).css("height",heights[0].height+"px");- $("#" + heights[1].name).css("height",heights[1].height+"px");+ heights[1].height = container_height - heights[0].height;+ }++ $("#" + heights[0].name).css("height",heights[0].height+"px");+ $("#" + heights[1].name).css("height",heights[1].height+"px");++ }+ else {+ heights[0].height = container_height;+ $("#" + heights[0].name).css("height",heights[0].height+"px");+ }SOTE.widget.List.reinitializeScrollbars(self);};SOTE.widget.List.reinitializeScrollbars = function(self) {- var pane = $(".category").each(function(){+ var pane = $("."+self.id+"category").each(function(){var api = $(this).data('jsp');if(api) api.reinitialise();});@@ -210,7 +432,8 @@ SOTE.widget.List.handleSort = function(e,ui){var vals = id.split("-");var val = vals.splice(0,1);val = vals.join("-");- self.values[key][val] = 1;+ if(!self.filter || val in self.selected)+ self.values[key][val] = 1;});}self.trigger();@@ -291,7 +514,8 @@ SOTE.widget.List.prototype.getValue = function(){SOTE.widget.List.prototype.serialize = function(values){var categories = [];-+ if(!values)+ return "";for(var category in values){var catStr = [category];for(var item in values[category]){@@ -316,7 +540,7 @@ SOTE.widget.List.prototype.unserialize = function(string, selector){for(var i=0; i<categories.length; i++){var items = categories[i].split(/[\.,]/);- unserialized[items[0]] = new Array;+ unserialized[items[0]] = new Object;for(var j=1; j<items.length; j++){if(hideIndicator.test(items[j])){items[j] = items[j].replace(/!/g, "");@@ -328,7 +552,7 @@ SOTE.widget.List.prototype.unserialize = function(string, selector){}}- unserialized[items[0]].push(items[j]);+ unserialized[items[0]][items[j]] = 1;values[items[j]] = 1;this.count++;}diff --git a/src/js/products.js b/src/js/products.jsindex 2f2813b46..6aa9b41e0 100644--- a/src/js/products.js+++ b/src/js/products.js@@ -136,7 +136,7 @@ SOTE.widget.Products.prototype.render = function(){"<a class='addlayerstab tab' href='#selectorbox'></a>" +"</li>" +"<li class='layerPicker third'>" +- "<a class='tab' href='#dataDownload'></a>" ++ "<a class='tab' href='#ddownload'></a>" +"</li>";this.container.appendChild(tabs);SOTE.widget.Products.change({data: {self: this}}, {index: 0});@@ -161,7 +161,7 @@ SOTE.widget.Products.prototype.render = function(){this.container.appendChild(selectorbox);var downloadBox = document.createElement("div");- downloadBox.setAttribute("id", "dataDownload");+ downloadBox.setAttribute("id", "ddownload");this.container.appendChild(downloadBox);//this.container.appendChild(productContainer);@@ -192,6 +192,16 @@ SOTE.widget.Products.prototype.render = function(){},config: this.config});+ this.d = new SOTE.widget.Download("ddownload", {+ dataSourceUrl: "ap_products.php",+ categories: ["Base Layers","Overlays"],+ selected: {+ antarctic: "baselayers,!MODIS_Aqua_CorrectedReflectance_TrueColor,MODIS_Terra_CorrectedReflectance_TrueColor~overlays,antarctic_coastlines",+ arctic:"baselayers,!MODIS_Aqua_CorrectedReflectance_TrueColor,MODIS_Terra_CorrectedReflectance_TrueColor~overlays,arctic_coastlines",+ geographic:"baselayers,!MODIS_Aqua_CorrectedReflectance_TrueColor,MODIS_Terra_CorrectedReflectance_TrueColor~overlays,sedac_bound"+ },+ config: this.config+ });//$('#'+this.id+"prods").on("tabsshow",SOTE.widget.Products.change);$('.accordionToggler').bind('click',{self:this},SOTE.widget.Products.toggle);diff --git a/src/js/selector.js b/src/js/selector.jsindex fb585296a..767f047ef 100644--- a/src/js/selector.js+++ b/src/js/selector.js@@ -46,10 +46,12 @@ SOTE.widget.Selector = function(containerId, config){this.state = config.state;this.selected = config.selected;- this.values = this.unserialize(this.selected[this.state]);+ //this.values = this.unserialize(this.selected[this.state]);this.meta = new Object;+ this.data = new Object;this.categories = config.categories;+ this.cats = new Object;this.initRenderComplete = false;this.dataSourceUrl = config.dataSourceUrl;this.config = config.config;@@ -57,7 +59,7 @@ SOTE.widget.Selector = function(containerId, config){this.init();//this.updateComponent(this.id+"=baselayers.MODIS_Terra_CorrectedReflectance_TrueColor-overlays.fires48.AIRS_Dust_Score.OMI_Aerosol_Index")-}+};/*** Displays all options in HTML in an Accordion format (see JQuery UI Accordion) with the selected states being indicated@@ -91,10 +93,38 @@ SOTE.widget.Selector.prototype.loadData = function(){SOTE.widget.Selector.handleLoadSuccess = function(data,status,xhr,args){var self = args.self;- self.data = data;+ var dupes = new Object;+ var count = 0;++ for(var i in data){+ self.cats[i] = 1;+ if(i != "palettes") {++ for(var j=0; j<data[i].length; j++){+ if(!self.data[data[i][j].category]){+ self.data[data[i][j].category] = new Object;+ self.data[data[i][j].category].title = self.categories[count++];+ self.data[data[i][j].category].items = [];+ }++ if(! (data[i][j].value in dupes) ){+ var categories = new Object;+ categories[i] = 1;+ self.data[data[i][j].category].items.push({label:data[i][j].label,sublabel:data[i][j].sublabel,value:data[i][j].value,categories:categories});+ dupes[data[i][j].value] = self.data[data[i][j].category].items.length - 1;+ }+ else {+ var tmp = dupes[data[i][j].value];+ var items = self.data[data[i][j].category].items;+ items[tmp].categories[i]=1;+ }+ }+ }+ }+self.render();-}+};/*** Renders the UI accordion from this.items@@ -112,19 +142,21 @@ SOTE.widget.Selector.prototype.render = function(){$('#'+this.id).height($('#'+this.id).parent().outerHeight() - tabs_height);- var catList = document.createElement("ul");- catList.setAttribute("class","toplevel");--//<div id="selectorbox"><h1>Choose Your Interest Area</h1><ul><li><a>Text 1</a></li></ul><a>Skip this step</a></div>- var titleContainer = document.createElement("div");- var title = document.createElement("h2");- title.innerHTML = "Choose Your Interest Area";- titleContainer.appendChild(title);- this.container.appendChild(titleContainer);- var count = 0;-- SOTE.widget.Selector.loadCategory({ data: {self:this,category:"All"}, back: false });+ this.list = new SOTE.widget.List(this.id,{+ data: this.data,+ selected: this.selected[this.state],+ hide: false,+ checkbox: true,+ close: false,+ filter: false,+ search: true,+ defaultCategory: "All",+ categories: this.cats,+ onchange: SOTE.widget.Selector.handleFire,+ args: this+ });+ //$("#"+this.id).bind("listchange", {self:this}, SOTE.widget.Selector.handleFire);// Mark the component as ready in the registry if called via init()if ((this.initRenderComplete === false) && REGISTRY) {@@ -136,375 +168,13 @@ SOTE.widget.Selector.prototype.render = function(){};-SOTE.widget.Selector.prototype.resize = function (){- var tabs_height = $(".ui-tabs-nav").outerHeight(true);- $('#'+this.id).height($('#'+this.id).parent().outerHeight() - tabs_height);- setTimeout(SOTE.widget.Selector.adjustCategoryHeights,1,{self:this});-};--SOTE.widget.Selector.callRender = function (e){- e.data.self.openCat = null;- e.data.self.render();-};--SOTE.widget.Selector.prototype.reloadCategory = function(){- var e = new Object;- e.data = new Object;- e.data.self = this;- e.data.category = this.openCat;- SOTE.widget.Selector.loadCategory(e);-};--SOTE.widget.Selector.loadCategory = function(e){-- var self = e.data.self;- var cat = e.data.category;- self.openCat = cat;- var back = false;--- var categories = new Object;- //self.container.innerHTML = "";- $("#"+self.id).empty();-- var form = document.createElement("div");- form.setAttribute("class","facetedSearch");- form.setAttribute("id",self.id+"facetedSearch");-- var select = document.createElement("select");- select.setAttribute("id",self.id+"select");- select.setAttribute("class","select");- for (var c in self.data){- if(c != 'palettes'){- var opt = document.createElement("option");- opt.setAttribute("value",c);- opt.text = c;- select.add(opt);- }- }-- form.appendChild(select);--- var search = document.createElement("input");- search.setAttribute("type","text");- search.setAttribute("name","search");- search.setAttribute("id",self.id+"search");- search.setAttribute("class","search");- search.setAttribute("placeholder","ex. modis, terra, fire");- search.setAttribute("autocomplete","off");-- form.appendChild(search);-- var content = document.createElement("div");- content.setAttribute("id",self.id+"content");-- var categoryTitles = [];-- for(var i=0; i<self.categories.length; i++){- var formattedCategoryName = self.categories[i].replace(/\s/g, "");--- var categoryTitle = document.createElement("h3");- categoryTitle.setAttribute("class","head");- categoryTitle.innerHTML = self.categories[i];- categoryTitles.push(categoryTitle);-- categories[formattedCategoryName.toLowerCase()] = document.createElement("ul");- categories[formattedCategoryName.toLowerCase()].setAttribute("id",self.id + formattedCategoryName.toLowerCase());- categories[formattedCategoryName.toLowerCase()].setAttribute("class",self.id + "category category scroll-pane");-- }--- for(var i=0; i< self.data[cat].length; i++){- var item = self.data[cat][i];- var subItem = document.createElement("li");- subItem.setAttribute("class","selectorItem item");- var itemHead = document.createElement("h4");- var formatted = item.value.replace(/:/g,"colon");- itemHead.innerHTML = item.label;- var itemP = document.createElement("p");- itemP.innerHTML = item.sublabel;- var itemInput = document.createElement("input");- if(item.type === "single"){- itemInput.setAttribute("type","checkbox");- itemInput.setAttribute("name",cat);- }- else {- itemInput.setAttribute("type","checkbox");- }- itemInput.setAttribute("id",formatted);- itemInput.setAttribute("value",item.value);- subItem.appendChild(itemInput);- subItem.appendChild(itemHead);- subItem.appendChild(itemP);-- categories[item.category].appendChild(subItem);- $("#"+self.id).undelegate("#" + formatted,'click');- $("#"+self.id).delegate("#" + formatted,'click',{self:self},SOTE.widget.Selector.toggleValue);- }-- for(var i=0; i<self.categories.length; i++){- var formattedCategoryName = self.categories[i].replace(/\s/g, "");- var catContainer = document.createElement("div");- catContainer.setAttribute("id",self.id+formattedCategoryName);- catContainer.setAttribute("class","categoryContainer");- catContainer.appendChild(categoryTitles[i]);- catContainer.appendChild(categories[formattedCategoryName.toLowerCase()]);- content.appendChild(catContainer);- }-- self.container.appendChild(form);- self.container.appendChild(content);- //self.renderCanvases(cat);- if(back){- var subBack = document.createElement("a");- subBack.setAttribute("id","subback");- subBack.setAttribute("class","flowbutton");- subBack.setAttribute("href","javascript:void(0);");- subBack.innerHTML = "<< <b>go back</b> and reselect my interest area";- self.container.appendChild(subBack);- $("#"+self.id).undelegate("#" + "subback",'click');- $("#"+self.id).delegate("#" + "subback",'click',{self:self},SOTE.widget.Selector.callRender);- }-- //$("#"+self.id+"search").undelegate('keypress');- $("#"+self.id+"select").on('change',{self:self,select:true},SOTE.widget.Selector.selectCat);- $('#'+self.id+"select").val("All");-- $("#"+self.id+"search").on('keyup',{self:self,select:false},SOTE.widget.Selector.search);-- if($(window).width() > 720){- if(self.jsp){- var api = self.jsp.data('jsp');- if(api) {api.destroy()};- }- self.jsp = $( ".category" ).jScrollPane({autoReinitialise: false, verticalGutter:0});- }- setTimeout(SOTE.widget.Selector.adjustCategoryHeights,1,{self:self});-- self.adjustSelected();---};--SOTE.widget.Selector.reinitializeScrollbars = function(o) {- var pane = $(".category").each(function(){- var api = $(this).data('jsp');- if(api) api.reinitialise();- });-};--SOTE.widget.Selector.selectCat = function(e){- e.data.self.openCat = e.target.value;- $("#"+e.data.self.id+"search").keyup();-};--SOTE.widget.Selector.search = function(e){- var self = e.data.self;- var cat = self.openCat;- var val = e.target.value.toUpperCase();- val = val.replace(/[\(\)\"\'!\$\%\&\?\+\*\\\@\=]/g,"");- var valArr = val.split(/\s/);- //var re = new RegExp(val);- var content = document.getElementById(self.id+"content");- content.innerHTML = "";-- var categories = new Object;-- var categoryTitles = [];-- for(var i=0; i<self.categories.length; i++){- var formattedCategoryName = self.categories[i].replace(/\s/g, "");--- var categoryTitle = document.createElement("h3");- categoryTitle.setAttribute("class","head");- categoryTitle.innerHTML = self.categories[i];- categoryTitles.push(categoryTitle);-- categories[formattedCategoryName.toLowerCase()] = document.createElement("ul");- categories[formattedCategoryName.toLowerCase()].setAttribute("id",self.id + formattedCategoryName.toLowerCase());- categories[formattedCategoryName.toLowerCase()].setAttribute("class",self.id + "category category scroll-pane");-- }--- for(var i=0; i< self.data[cat].length; i++){- var item = self.data[cat][i];-- //var matched = false;- var count = 0;- for(var j=0; j<valArr.length; ++j){- var myVal = new RegExp(valArr[j]);- if(item.label.toUpperCase().match(myVal) || item.sublabel.toUpperCase().match(myVal) || item.tags && item.tags.toUpperCase().match(myVal)) {- count++;- }- }-- if(count == valArr.length) { //item.label.toUpperCase().match(val) || item.sublabel.toUpperCase().match(val)){-- var subItem = document.createElement("li");- subItem.setAttribute("class","selectorItem item");- var itemHead = document.createElement("h4");- var formatted = item.value.replace(/:/g,"colon");- itemHead.innerHTML = item.label;- var itemP = document.createElement("p");- itemP.innerHTML = item.sublabel;- var itemInput = document.createElement("input");- if(item.type === "single"){- itemInput.setAttribute("type","checkbox");- itemInput.setAttribute("name",cat);- }- else {- itemInput.setAttribute("type","checkbox");- }- itemInput.setAttribute("class","css-checkbox");- itemInput.setAttribute("id",formatted);- itemInput.setAttribute("value",item.value);- subItem.appendChild(itemInput);- subItem.appendChild(itemHead);- subItem.appendChild(itemP);-- categories[item.category].appendChild(subItem);- //ul.appendChild(subItem);- $("#"+self.id).undelegate("#" + formatted,'click');- $("#"+self.id).delegate("#" + formatted,'click',{self:self},SOTE.widget.Selector.toggleValue);- }- }-- for(var i=0; i<self.categories.length; i++){- var formattedCategoryName = self.categories[i].replace(/\s/g, "");- var catContainer = document.createElement("div");- catContainer.setAttribute("id",self.id+formattedCategoryName);- catContainer.setAttribute("class","categoryContainer");- catContainer.appendChild(categoryTitles[i]);- catContainer.appendChild(categories[formattedCategoryName.toLowerCase()]);- content.appendChild(catContainer);- }-- if($(window).width() > 720){- if(self.jsp){- var api = self.jsp.data('jsp');- if(api) api.destroy();- }- self.jsp = $( ".category" ).jScrollPane({autoReinitialise: false, verticalGutter:0});- }- setTimeout(SOTE.widget.Selector.adjustCategoryHeights,1,{self:self});-- self.adjustSelected();-- //content.appendChild(ul);--};--SOTE.widget.Selector.prototype.renderCanvases = function(cat){- for(var i=0; i< this.data[cat].length; i++){- var item = this.data[cat][i];- if(this.data.palettes[item.value]){- var p = this.data.palettes[item.value];- var width = 100/p.palette.length;- var canvas = document.getElementById("canvas"+this.id+item.value);- var context = canvas.getContext('2d');- for(var k=0; k<p.palette.length; ++k){- context.fillStyle = "rgba("+ p.palette[k] +")";- context.fillRect (width*k,0,width,14);- }- }- }--};--SOTE.widget.Selector.adjustCategoryHeights = function(args){- var self = args.self;- var heights = new Array;- var facets_height = $("#"+self.id+"facetedSearch").outerHeight(true);- var container_height = $("#"+self.id).outerHeight() - facets_height;- $('#'+self.id+"content").height(container_height);- var labelHeight = 0;- $('#'+self.id+'content .head').each(function(){- labelHeight += $(this).outerHeight(true);- });- container_height -= labelHeight;- //console.log("This.id: " + container_height);- for(var i=0; i<self.categories.length; i++){- var formattedCategoryName = self.categories[i].replace(/\s/g, "");- var actual_height = 0;- var count = 0;- $('#' + self.id + formattedCategoryName.toLowerCase() + ' li').each(function(){- //console.log(document.getElementById(", " + $(this).outerHeight()));- actual_height += $(this).outerHeight();- count++;- });-- heights.push({name:self.id + formattedCategoryName.toLowerCase(),height:actual_height,count:count});- }-- if(heights[0].height + heights[1].height > container_height){- if(heights[0].height > container_height/2) {- heights[0].height = container_height/2;- }-- heights[1].height = container_height - heights[0].height;-- }-- $("#" + heights[0].name).css("height",heights[0].height+"px");- $("#" + heights[1].name).css("height",heights[1].height+"px");-- SOTE.widget.Selector.reinitializeScrollbars({self:self});--};--SOTE.widget.Selector.prototype.adjustSelected = function(){- var inputs = document.getElementsByTagName("input");- for(var i=0; i<inputs.length; i++){- inputs[i].checked = "";- }- for(var j=0; j<this.categories.length; j++){- var formatted = this.categories[j].replace(/\s/g, "");- formatted = formatted.toLowerCase();- if(this.values[formatted]){- for(var k=0; k < this.values[formatted].length; k++){- var val = this.values[formatted][k].value.replace(/:/g,"colon");- var el = document.getElementById(val);- if(el)- el.checked = "checked";- }- }- }-};--SOTE.widget.Selector.toggleValue = function(e){- var self = e.data.self;- var targetEl = e.target;- var category = $("#"+targetEl.id).parents('.category').attr("id");- category = category.replace(self.id,"");- var value = $("#"+targetEl.id).attr("value");- value = value.replace(/colon/,":");- var checked = $("#"+targetEl.id).attr("checked");-- if(!self.values[category]){- self.values[category] = new Array();- }- if(checked !== undefined && checked == "checked"){- self.removeItem(category,value);- self.values[category].unshift({"value":value});- }- else{- self.removeItem(category,value);- }-+SOTE.widget.Selector.handleFire = function(self){self.fire();};-SOTE.widget.Selector.prototype.removeItem = function(cat,val){- for(var i=0; i<this.values[cat].length; i++){- if(this.values[cat][i].value == val){- this.values[cat].splice(i,1);- }- }+SOTE.widget.Selector.prototype.resize = function (){+ var tabs_height = $(".ui-tabs-nav").outerHeight(true);+ $('#'+this.id).height($('#'+this.id).parent().outerHeight() - tabs_height);};/**@@ -534,10 +204,7 @@ SOTE.widget.Selector.prototype.fire = function(){**/SOTE.widget.Selector.prototype.setValue = function(valString){-- this.values = this.unserialize(valString);- return this.validate();-+ this.list.setValue(valString);};/**@@ -548,48 +215,10 @@ SOTE.widget.Selector.prototype.setValue = function(valString){* representing the key(s) of the currently selected option(s)**/-SOTE.widget.Selector.prototype.getValue = function(){-- var value = this.serialize(this.values);- return this.id + "=" + value;+SOTE.widget.Selector.prototype.getValue = function(){+ return this.id + "=" + this.list.getValue();};-SOTE.widget.Selector.prototype.serialize = function(values){- var serialized = "";- for(var i=0; i<this.categories.length; i++){- if(i > 0){- serialized += "~";- }- var formatted = this.categories[i].replace(/\s/g, "");- formatted = formatted.toLowerCase();-- serialized += formatted;- if(values[formatted]){- for(var j=0; j<values[formatted].length; j++){- serialized += "," + values[formatted][j].value;- }- }- }- return serialized;-};--SOTE.widget.Selector.prototype.unserialize = function(string){- var unserialized = new Object;- var hideIndicator = /^!/;- var categories = string.split("~");- for(var i=0; i<categories.length; i++){- var items = categories[i].split(/[\.,]/);- unserialized[items[0]] = new Array;- for(var j=1; j<items.length; j++){- if(hideIndicator.test(items[j])){- items[j] = items[j].replace(/!/g,"");- }- unserialized[items[0]].push({"value":items[j]});- }-- }- return unserialized;-};/*** Change the component based on dependencies (i.e. Available Options, Selected)@@ -623,10 +252,7 @@ SOTE.widget.Selector.handleUpdateSuccess = function(self,qs){data.selected = (data.selected === undefined || data.selected === "")? SOTE.util.extractFromQuery(args.self.id,args.self.getValue()):data.selected;*/if(SOTE.util.extractFromQuery("switch",qs) == self.state){var vals = SOTE.util.extractFromQuery("products",qs);- self.values = self.unserialize(vals);- if(self.openCat !== undefined && self.openCat !== null){- self.adjustSelected();- }+ self.values = self.setValue(vals);}else {self.state = SOTE.util.extractFromQuery("switch",qs);