Interactive interface for browsing global, full-resolution satellite imagery
DateWheels to wv.date.wheels
Mike McGanne4deece53212
diff --git a/Gruntfile.js b/Gruntfile.jsindex fc69f741e..06cf22b7c 100644--- a/Gruntfile.js+++ b/Gruntfile.js@@ -386,8 +386,7 @@ module.exports = function(grunt) {jshint: {main: [- "src/js/wv/**/*.js",- "src/js/wv.*.js",+ "src/js/**/wv.*.js","test/**/*.js",]},diff --git a/etc/deploy/wv.js.json b/etc/deploy/wv.js.jsonindex 24edc2029..3f41dfdd9 100644--- a/etc/deploy/wv.js.json+++ b/etc/deploy/wv.js.json@@ -108,7 +108,8 @@"src/js/Worldview/Widget/ActiveLayers.js","src/js/Worldview/Widget/AddLayers.js","src/js/date/wv.date.sliders.js",- "src/js/Worldview/Widget/DateWheels.js",+ "src/js/date/wv.date.label.js",+ "src/js/date/wv.date.wheels.js","src/js/Worldview/Widget/Map.js","src/js/Worldview/Widget/Palette.js","src/js/Worldview/Widget/WorldviewMap.js",diff --git a/src/index.html b/src/index.htmlindex 157ee70bf..0ec85a9f8 100644--- a/src/index.html+++ b/src/index.html@@ -218,7 +218,8 @@<!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/ActiveLayers.js"></script><!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/AddLayers.js"></script><!-- link.dev --> <script type="text/javascript" src="js/date/wv.date.sliders.js"></script>- <!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/DateWheels.js"></script>+ <!-- link.dev --> <script type="text/javascript" src="js/date/wv.date.label.js"></script>+ <!-- link.dev --> <script type="text/javascript" src="js/date/wv.date.wheels.js"></script><!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/Map.js"></script><!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/Palette.js"></script><!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/WorldviewMap.js"></script>@@ -257,7 +258,9 @@<div class="horizontalContainer"><div id="time">- <div id="timeds"></div>+ <div id="timeds">+ <div id="timedsdateHolder" class="dateHolder"></div>+ </div><div id="timemds"></div></div></div>diff --git a/src/js/Worldview/Widget/DateSlider.js b/src/js/Worldview/Widget/DateSlider.jsdeleted file mode 100644index 99a1eeed6..000000000--- a/src/js/Worldview/Widget/DateSlider.js+++ /dev/null@@ -1,780 +0,0 @@-/**- * A date selection object for a configurable period of days, containing thumnails of a sample data- * product image for each day- *- * @module Worldview.Widget- * @class DateSpan- * @constructor- * @this {dateSpan}- * @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 {String} [minDate] an ISO8601 formatted date string containing the minimum bound for the dateSpan- * @config {String} [maxDate] an ISO8601 formatted date string containing the maximum bound for the dateSpan- * @config {boolean} [hasThumbnail] whether the dateSpan has a thumbnail- * @config {String} [thumbSource] the address of a script producing thumbnails- * @config {String} [extent] the extent of the current map (bbox=w,s,e,n)- * @config {String} [product] the base product for the thumbnails- * @config {String} [startDate] an ISO8601 formatted date string containing the start date of the dateSpan- * @config {String} [selectedDate] an ISO8601 formatted date string containing the initially selected date- * @config {Number} [range] the total number of days displayed to the user- * @config {String} [anchorId] an HTML Element Id of the object to anchor the dateSpan with- * @config {boolean} [slideToSelect] whether the selection slider is visible or not- * @config {boolean} [isExpanded] whether the dateSpan thumbnails should be visible or not- * @augments Worldview.Widget.Component- *-*/-var Worldview = Worldview || {};-Worldview.Widget = Worldview.Widget || {};--Worldview.Widget.DateSlider = Worldview.Widget.DateSlider || function(models, config) {- var containerId = "timeds";- this.log = Logging.getLogger("Worldview.Widget.Date");- this.SLIDER_WIDTH = 1000;- this.DAY_IN_MS = 24*60*60*1000;- this.sliders = new Object();- this.sliders["Year"] = [];- for ( var year = 2000; year <= Worldview.now().getUTCFullYear(); year++ ) {- this.sliders["Year"].push(year);- }- this.sliders["Month"] = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];- this.sliders["Day"] = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];- this.months = [31,28,31,30,31,30,31,31,30,31,30,31];- this.monthNames = [ "January", "February", "March", "April", "May", "June",- "July", "August", "September", "October", "November",- "December" ];-- this.sliderContent = [];-- 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.dataSourceUrl === undefined){- config.dataSourceUrl = null;- }-- if(config.thumbSource === undefined){- config.thumbSource = null;- }-- if(config.extent === undefined){- config.extent = null;- }-- if(config.product === undefined){- config.product = null;- }-- if(config.endDate === undefined){- config.endDate = Worldview.today();- }- else{- config.endDate = new Date(config.endDate);- }-- if(config.startDate === undefined){- config.startDate = new Date(Date.UTC(2012, 4, 8, 0, 0, 0));- }- else{- config.startDate = new Date(config.startDate);- }-- if(config.range === undefined){- config.range = 7*this.DAY_IN_MS;- }-- if(config.slideToSelect === undefined){- config.slideToSelect = true;- }-- if(config.isCollapsed === undefined){- config.isCollapsed = false;//(config.thumbSource === null || config.hasThumbnail === false)? true: false;- }-- var self = this;- this.model = models.date;- this.model.events.on("select", function(date) {- self.value = date;- self.update();- });-- this.maps = [];- this.startDate = config.startDate;- this.endDate = config.endDate;- this.range = config.range; //in milliseconds- this.isCollapsed = config.isCollapsed;- this.slideToSelect = config.slideToSelect;- this.thumbSource = config.thumbSource;- this.hasThumbnail = config.hasThumbnail;- this.extent = config.extent;- this.product = config.product;- this.value = this.model.selected;- this.dataSourceUrl = config.dataSourceUrl;- this.statusStr = "";- this.init();-- $(window).bind("resize",{self:this},Worldview.Widget.DateSlider.refreshSliders);- this.update();-};--Worldview.Widget.DateSlider.prototype = new SOTE.widget.Component;--/**- * Displays the selectable dateSpan in HTML containing a thumbnail for each day in the span. If the date range contains- * more days than the visible day span, create horizontal scrolling capability. All callbacks should be set. The- * component UI should be rendered with controllers to call the events.- *- * @this {dateSpan}- * @requires Worldview.Widget.Map-*/-Worldview.Widget.DateSlider.prototype.init = function(){-- // inherit styles into the user-specified div- if ($(window).width() < 720) { //this is not the best way to do this- $("#timeds").css("display","none");- $("#timemds").css("display","block");- }- this.container.setAttribute("class","datespan");-- var dateHolder = document.createElement('div');- dateHolder.setAttribute('id',this.id+'dateHolder');- dateHolder.setAttribute('class','dateHolder');- dateHolder.innerHTML = 'Friday September 21, 2012';- this.container.appendChild(dateHolder);-- var ecbutton = document.createElement("a");- ecbutton.setAttribute("class","ecbutton collapse");- ecbutton.setAttribute("id",this.id+"ecbutton");- this.container.appendChild(ecbutton);-- this.createSlider("Year");- this.createSlider("Month");- this.createSlider("Day");-- this.setVisualDate();-- this.setValue(this.value.toISOString());-- $('#'+this.id+'ecbutton').bind("click",{self:this},Worldview.Widget.DateSlider.toggle);-- if(REGISTRY){- REGISTRY.register(this.id,this);- REGISTRY.markComponentReady(this.id);- }- else{- alert("No REGISTRY found! Cannot register AccordionPicker!");- }--};--Worldview.Widget.DateSlider.prototype.getToday = function() {- // If at the beginning of the day, wait on the previous day until GIBS- // catches up.- var today = Worldview.today();- var now = Worldview.now();- if ( now.getUTCHours() < Worldview.GIBS_HOUR_DELAY ) {- today.setUTCDate(today.getUTCDate() - 1);- return today;- } else {- return today;- }-};--Worldview.Widget.DateSlider.refreshSliders = function(e){- var self = e.data.self;- if ( $(window).width() < Worldview.TRANSITION_WIDTH ) {- $("#" + self.containerId).hide();- } else {- $("#" + self.containerId).show();- setTimeout(function() {- self.refreshSlider("Year");- self.refreshSlider("Month");- self.refreshSlider("Day");- },100);- }--};--Worldview.Widget.DateSlider.prototype.refreshSlider = function(type){- var labels = this.sliders[type];- var wwidth = $(window).width() - 10;-- if(labels != undefined){- var width = 50/labels.length;- width = width.toFixed(1);- var pwidth = width/100;- var pwwidth = Math.floor(pwidth*wwidth);- var spacer = 50/labels.length;- spacer = spacer.toFixed(1);- var pspacer = spacer/100;- var pwspacer = Math.floor(wwidth*pspacer/2);- var finalwidth = (pwwidth+pwspacer+pwspacer);- $('#'+this.id+'sliderLabel'+type).children().css('width',Math.floor(wwidth*pwidth) + "px");- $('#'+this.id+'sliderLabel'+type).children().css('margin-left',Math.floor(wwidth*pspacer/2) + "px");- $('#'+this.id+'sliderLabel'+type).children().css('margin-right',Math.floor(wwidth*pspacer/2) + "px");- $('#'+this.id+'slider'+type).siblings('.ui-slider').css('width',eval(finalwidth*labels.length)+"px");- }--};--Worldview.Widget.DateSlider.prototype.createSlider = function(type){- var slider = document.createElement('div');- slider.setAttribute('id',this.id+'sliderDiv'+type);- slider.setAttribute('class','sliderDiv'+type+' slider');- slider.innerHTML = '<input type="range" name="slider" id="'+this.id+'slider'+type+'" class="dateSpanSlider" value="'+this.SLIDER_WIDTH+'" min="0" max="'+this.SLIDER_WIDTH+'" step="1" />';- this.container.appendChild(slider);-- var width = 0;- var wwidth = $(window).width() - 10;- var labels = this.sliders[type];-- if(labels != undefined){- width = 50/labels.length;- width = width.toFixed(1);- var pwidth = width/100;- var pwwidth = Math.floor(pwidth*wwidth);- var spacer = 50/labels.length;- spacer = spacer.toFixed(1);- var pspacer = spacer/100;- var pwspacer = Math.floor(wwidth*pspacer/2);- var finalwidth = (pwwidth+pwspacer+pwspacer);- //if(type=='Month'){ width=60/labels.length; spacer=40/labels.length;}- var label = document.createElement('ul');- label.setAttribute('class','sliderLabel');- label.setAttribute('id',this.id+'sliderLabel'+type);- for(var i=0; i<labels.length; ++i){- var item = document.createElement('li');- item.setAttribute('id',this.id+type+'sliderItem'+i);- item.innerHTML = labels[i];- item.style.width = Math.floor(wwidth*pwidth) + "px";- item.style.marginLeft = Math.floor(wwidth*pspacer/2) + "px";- item.style.marginRight = Math.floor(wwidth*pspacer/2) + "px";- label.appendChild(item);- }- this.container.appendChild(label);- }-- var labelslength = labels.length;-- $('#'+this.id+'slider'+type).slider();- $('#'+this.id+'slider'+type).bind("change",{self:this,type:type},Worldview.Widget.DateSlider.handleSlide);- $('#'+this.id+'slider'+type).siblings('.ui-slider').css('width',eval(finalwidth*labels.length)+"px");- $('#'+this.id+'slider'+type).siblings('.ui-slider').bind("vmouseup",{self:this,type:type},Worldview.Widget.DateSlider.snap);- if(width!=0){$('.sliderDiv'+type+' a.ui-slider-handle').css('width',eval(width*1.1).toFixed(1)+"%");}- //this.widths[type] = width;--};--/**- * Fires an event to the registry when the state of the component is changed- *- * @this {DateSpan}- *-*/-Worldview.Widget.DateSlider.prototype.fire = function(){- $("#"+this.id).trigger("fire",this.value);--- if(REGISTRY){- REGISTRY.fire(this);- }- else{- alert("No REGISTRY found! Cannot fire to REGISTRY from AccordionPicker!");- }--};---Worldview.Widget.DateSlider.handleSlide = function(e,ui){- var value = e.target.value;- var type = e.data.type;- var self = e.data.self;- var oldDate = self.value;-- var numitems = self.sliders[type].length;-- var displacement = Math.floor(value*(numitems/self.SLIDER_WIDTH));-- if(self.sliders[type][displacement]){- var newDate = self.value.clone();- if(type == "Year"){- newDate.setUTCFullYear(self.sliders[type][displacement]);- }- else if (type == "Month"){- if(self.value.getUTCDate() > self.months[displacement]){- newDate.setUTCDate(self.months[displacement]);- newDate.setUTCMonth(displacement);- self.setValue(newDate.toISOString());- }- else{- newDate.setUTCMonth(displacement);- }- }- else if (type == "Day"){- if(self.sliders[type][displacement] <= self.months[self.value.getUTCMonth()]){- newDate.setUTCDate(self.sliders[type][displacement]);- }- else {- self.setValue(newDate.toISOString());- }- }-- if(newDate.getTime() < self.startDate.getTime()){- self.setValue(self.startDate.toISOString());- }- else if(newDate.getTime() > self.endDate.getTime()){- self.setValue(self.endDate.toISOString());- }- else {- self.value = newDate.clone();- }-- }- else {- if(displacement >= self.sliders[type].length){- self.setValue(self.value.toISOString());- }- else if(displacement < 0){- self.setValue(self.value.toISOString());- }- }- self.validate();- if ( oldDate.compareTo(self.value) !== 0 ) {- self.setValue(self.value.toISOStringDate());- self.fire();- self.setVisualDate();- }--/*- var x = (self.range - self.DAY_IN_MS) * (self.SLIDER_WIDTH-value)/self.SLIDER_WIDTH;-- var time = new Date(self.endDate.getTime() - x);- if(self.value.getTime() !== time.getTime()){- self.value = time.clone();- self.setVisualDate();- self.fire();- }*/---};--Worldview.Widget.DateSlider.toggle = function(e,ui){- var self = e.data.self;- if(self.isCollapsed){- $('.ecbutton').removeClass('expand').addClass('collapse');- $('.ecbutton').attr("title","Hide Date Slider");- $(".horizontalContainer").css("width","100%");-- //$('a.ui-slider-handle').css('top','-142px');- self.isCollapsed = false;- self.showSliders();- }- else{- $('.ecbutton').removeClass('collapse').addClass('expand');- $('.ecbutton').attr("title","Show Date Slider");- $(".horizontalContainer").css("width","auto");- //$('a.ui-slider-handle').css('top','-25px');- self.isCollapsed = true;- self.hideSliders();- }-};--Worldview.Widget.DateSlider.snap = function(e,ui){- var self = e.data.self;- var type = e.data.type;- var numitems = self.sliders[type].length;- var value = $("#"+self.id+"slider"+type).val();- //alert("value: " + value + "; numitems: " + numitems);- var displacement = Math.floor(value*(numitems/self.SLIDER_WIDTH));- var width = self.SLIDER_WIDTH/numitems;- var move = displacement*width + width/4 - width*.05;- move = move.toFixed(1);- //move = move * $(window).width();- $("#"+self.id+"slider"+type).val((move)).slider("refresh");- //alert(self.sliders[type][displacement]);- if(self.sliders[type][displacement]){- var newDate = self.value.clone();- if(type == "Year"){- newDate.setUTCFullYear(self.sliders[type][displacement]);- }- else if (type == "Month"){- if(self.value.getUTCDate() > self.months[displacement]){- newDate.setUTCDate(self.months[displacement]);- newDate.setUTCMonth(displacement);- self.setValue(newDate.toISOString());- }- else{- newDate.setUTCMonth(displacement);- }- }- else if (type == "Day"){- if(self.sliders[type][displacement] <= self.months[self.value.getUTCMonth()]){- newDate.setUTCDate(self.sliders[type][displacement]);- }- else {- newDate = this.value.clone();- self.setValue(newDate);- }- }--- if(newDate.getTime() < self.startDate.getTime()){- self.setValue(self.startDate.toISOString());- }- else if(newDate.getTime() > self.endDate.getTime()){- self.setValue(self.endDate.toISOString());- }- else {- self.value = newDate.clone();- }-- //self.setValue(SOTE.util.ISO8601StringFromDate(self.value));-- }- else {- if(displacement >= self.sliders[type].length){- self.setValue(self.value.toISOString());- }- else if(displacement < 0) {- self.setValue(self.value.toISOString());- }- }- self.validate();- self.setVisualDate();-- self.setValue(self.value.toISOStringDate());- /*var x = (self.range - (24*60*60*1000)) * (100-value)/100;- var time = new Date(self.endDate.getTime() - x);- time.setHours(12);- time.setMinutes(0);- time.setSeconds(0);-- self.setValue(SOTE.util.ISO8601StringFromDate(time));*/-};--Worldview.Widget.DateSlider.snapToTime = function(e,ui){- var self = e.data.self;- var time = e.data.time;- //time = new Date(time.getTime() - time.getTimezoneOffset()*60000);-- //self.setValue(SOTE.util.ISO8601StringFromDate(time));-};--Worldview.Widget.DateSlider.prototype.hideSliders = function(){- for(var i in this.sliders){- $("#"+this.id+"sliderDiv"+i).css('display','none');- }- $('.sliderLabel').css("display","none");-};--Worldview.Widget.DateSlider.prototype.showSliders = function(){- for(var i in this.sliders){- $("#"+this.id+"sliderDiv"+i).css('display','block');- }- $('.sliderLabel').css("display","block");-};--/**- * Sets the selected date in the dateSpan from the passed in date string (ISO8601 format), if valid- *- * @this {dateSpan}- * @param {String} value is the date to be set (i.e. [containerId]=[date])- * @returns {boolean} true or false depending on if the passed in date validates- *-*/-Worldview.Widget.DateSlider.prototype.setValue = function(value){- this.model.select(Date.parseISOString(value));-};--Worldview.Widget.DateSlider.prototype.update = function() {- var d = this.model.selected;- if(d.getTime() < this.startDate.getTime()) {- d = this.startDate;- }- if(d.getTime() <= this.endDate.getTime() &&- d.getTime() >= this.startDate.getTime()) {- var changed = false;- if ( this.value.compareTo(d) !== 0 ) {- changed = true;- }- this.value = d;- var values = new Object();- values["Year"] = this.sliders["Year"].indexOf(this.value.getUTCFullYear());- values["Month"] = this.value.getUTCMonth();- values["Day"] = this.sliders["Day"].indexOf(this.value.getUTCDate());-- for(var type in values){- var numitems = this.sliders[type].length;- var displacement = values[type];- var width = this.SLIDER_WIDTH/numitems;- var move = displacement*width + (width/4) - (width*.05);- move = move.toFixed(1);- $("#"+this.id+"slider"+type).val(move).slider("refresh");- }-- this.validate();- if ( changed ) {- this.setVisualDate();- this.fire();- }- }- else {- var thisDay = d.toISOStringDate();- var startDay = this.startDate.toISOStringDate();- var today = this.endDate.toISOStringDate();-- if ( d.getTime() < this.startDate.getTime() ) {- /*- SOTE.util.throwError("Data is not available for " + thisDay +- ". The day of " + startDay + " is the earliest available " +- "data at this time. The date has been adjusted to today.");- */- } else if ( d.getTime() >= this.endDate.getTime() ) {- SOTE.util.throwError("Data is not available for " + thisDay +- " yet. Try again later. The date has been adjusted to today.");- }- }-};--Worldview.Widget.DateSlider.prototype.setVisualDate = function(){- var dateString = this.value.toISOStringDate();- $('#'+this.id+'dateHolder').html(dateString);- //$("a.ui-slider-handle").html("<span class='sliderText'>"+dateString+"</span>");-};--/**- * Gets the currently selected date in ISO8601 format- *- * @this {dateSpan}- * @returns {String} a string representing the currently selected date in ISO8601 format ([containerId]=[selectedDate])- *-*/-Worldview.Widget.DateSlider.prototype.getValue = function(){- var datestring = this.value.toISOStringDate();- return ""+this.id +"="+datestring;-};--Worldview.Widget.DateSlider.prototype.get = function(){- var datestring = this.value.toISOStringDate();- return datestring;-};--/**- * Modify the component based on dependencies (i.e. total number of dates in span, start date of span, selected date, thumbnails)- *- * @this {dateSpan}- * @param {String} querystring contains all values of dependencies (from registry)- * @returns {boolean} true or false depending on if the selected date validates against the updated criteria- *-*/-Worldview.Widget.DateSlider.prototype.updateComponent = function(qs){-/* var bbox = SOTE.util.extractFromQuery('map',qs);- var products = SOTE.util.extractFromQuery('products',qs);- var a = products.split("~");- var activeProducts = new Array();-- var base = a[0].split(".");- var overlays = a[1].split(".");- for(var i=1; i<base.length; ++i){- activeProducts.push(base[i]);- }- for(var i=1; i<overlays.length; ++i){- activeProducts.push(overlays[i]);- }-- if(this.isCollapsed == false){- var numOfDays = this.range/24/60/60/1000;- var startDate = new Date(this.endDate.getTime() - this.range);- for(var i=0; i<numOfDays; i++){- var time = new Date(startDate.getTime() + (i+1)*24*60*60*1000);- var timeString = SOTE.util.ISO8601StringFromDate(time);- this.maps[i].updateComponent(qs);- this.maps[i].activateRelevantLayersDisableTheRest(activeProducts,timeString);- this.maps[i].setValue(bbox);- }- }- else {- this.cachedQs = qs;- }*/-};--/**- * Sets the selected date from the querystring, [containerId]=[selectedDate]- *- * @this {dateSpan}- * @param {String} qs contains the querystring (must contain [containerId]=[selectedDate] in the string)- * @returns {boolean} true or false depending on if the extracted date validates- *-*/-Worldview.Widget.DateSlider.prototype.loadFromQuery = function(qs){- return this.setValue(SOTE.util.extractFromQuery(this.id,qs));-};--/**- * Validates that the selected date is not null and within bounds- *- * @this {dateSpan}- * @returns {boolean} true or false depending on whether the date is not null and within bounds-*/-Worldview.Widget.DateSlider.prototype.validate = function(){- var curr = this.value.clone();- var startYear = this.startDate.getUTCFullYear();- var startMonth = this.startDate.getUTCMonth();- var startDay = this.startDate.getUTCDate();- var endYear = this.endDate.getUTCFullYear();- var endMonth = this.endDate.getUTCMonth();- var endDay = this.endDate.getUTCDate();- for(var type in this.sliders){- for(var i=0; i<this.sliders[type].length; ++i){- var descriptor = this.id+type+"sliderItem"+i;- if(type == "Year"){- if(this.sliders[type][i] < startYear || this.sliders[type][i] > endYear){- $("#"+descriptor).addClass("disabledItem");- }- else {- $("#"+descriptor).removeClass("disabledItem");- }- }- if(type == "Month"){- if( (curr.getUTCFullYear() == startYear && i < startMonth ) || (curr.getUTCFullYear() == endYear && i > endMonth) ){- $("#"+descriptor).addClass("disabledItem");- }- else {- $("#"+descriptor).removeClass("disabledItem");- }- }- if(type == "Day"){- if( (this.sliders[type][i] > this.months[curr.getUTCMonth()]) || (curr.getUTCFullYear() == startYear && curr.getUTCMonth() == startMonth && this.sliders[type][i] < startDay) || (curr.getUTCFullYear() == endYear && curr.getUTCMonth() == endMonth && this.sliders[type][i] > endDay) ){- $("#"+descriptor).addClass("disabledItem");- }- else {- $("#"+descriptor).removeClass("disabledItem");- }- }- }- }--};--/**- * Sets the data accessor that provides state change instructions given dependencies- *- * @this {dateSpan}- * @param {String} datasourceurl is the relative location of the data accessor- *-*/-Worldview.Widget.DateSlider.prototype.setDataSourceUrl = function(datasourceurl){- // Content-};--/**- * Gets the data accessor- *- * @this {dateSpan}- * @returns {String} the relative location of the accessor- *-*/-Worldview.Widget.DateSlider.prototype.getDataSourceUrl = function(){- // Content-};--/**- * Sets the status of the component- *- * @this {dateSpan}- * @param {String} s the current status of the component (user prompts, error messages)- *-*/-Worldview.Widget.DateSlider.prototype.setStatus = function(s){- // Content-};--/**- * Gets the status of the component- *- * @this {dateSpan}- * @returns {String} the current status of the component (user prompts, error messages)- *-*/-Worldview.Widget.DateSlider.prototype.getStatus = function(){- // Content-};--/**- * Makes the component UI invisible- *- * @this {dateSpan}- *-*/-Worldview.Widget.DateSlider.prototype.hide = function(){- $("#"+this.id).css("display","none");- $(".horizontalContainer").css("width","auto");-};--/**- * Makes the component UI visible- *- * @this {dateSpan}- *-*/-Worldview.Widget.DateSlider.prototype.show = function(){- $("#"+this.id).css("display","block");- $(".horizontalContainer").css("width","100%");-};--/**- * Expand the UI to show thumbnails- *- * @this {dateSpan}- *-*/-Worldview.Widget.DateSlider.prototype.expand = function(){- // Content-};--/**- * Collapse the UI (no thumbnails)- *- * @this {dateSpan}- *-*/-Worldview.Widget.DateSlider.prototype.collapse = function(){- // Content-};--Worldview.Widget.DateSlider.prototype.parse = function(queryString, object) {- var timeString = Worldview.extractFromQuery("time", queryString);- if ( !timeString ) {- object.time = Worldview.today();- } else {- try {- object.time = Date.parseISOString(timeString).clearUTCTime();- } catch ( error ) {- this.log.warn("Invalid time: " + timeString + ", reason: " +- error);- object.time = Worldview.today();- }- }-};--// Additional Functions-// setBounds, getAvailableDates, setStart, changeBaseProduct, setExtent---------diff --git a/src/js/Worldview/Widget/DateWheels.js b/src/js/Worldview/Widget/DateWheels.jsdeleted file mode 100644index ecd0a5b5a..000000000--- a/src/js/Worldview/Widget/DateWheels.js+++ /dev/null@@ -1,369 +0,0 @@-var Worldview = Worldview || {};-Worldview.Widget = Worldview.Widget || {};---/**- * A date selection object for a configurable period of days, containing thumnails of a sample data- * product image for each day- *- * @module SOTE.widget- * @class MobileDateSpan- * @constructor- * @this {dateSpan}- * @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 {String} [minDate] an ISO8601 formatted date string containing the minimum bound for the dateSpan- * @config {String} [maxDate] an ISO8601 formatted date string containing the maximum bound for the dateSpan- * @config {boolean} [hasThumbnail] whether the dateSpan has a thumbnail- * @config {String} [thumbSource] the address of a script producing thumbnails- * @config {String} [extent] the extent of the current map (bbox=w,s,e,n)- * @config {String} [product] the base product for the thumbnails- * @config {String} [startDate] an ISO8601 formatted date string containing the start date of the dateSpan- * @config {String} [selectedDate] an ISO8601 formatted date string containing the initially selected date- * @config {Number} [range] the total number of days displayed to the user- * @config {String} [anchorId] an HTML Element Id of the object to anchor the dateSpan with- * @config {boolean} [slideToSelect] whether the selection slider is visible or not- * @config {boolean} [isExpanded] whether the dateSpan thumbnails should be visible or not- * @augments SOTE.widget.Component- *-*/-Worldview.Widget.DateWheels = function(models, config){- this.log = Logging.getLogger("Worldview.Widget.DateWheels");- var containerId = "timemds";- 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;- this.MSEC_TO_MIN = 1000*60;-- //Define an object for holding configuration- if (config===undefined){- config={};- }-- if(config.dataSourceUrl === undefined){- config.dataSourceUrl = null;- }-- if(config.endDate === undefined){- config.endDate = Worldview.today();- }- else{- config.endDate = new Date(config.endDate);- }-- if(config.startDate === undefined){- config.startDate = new Date(Date.UTC(2012, 4, 8, 0, 0, 0));- }- else{- config.startDate = new Date(config.startDate);- }-- if(config.selected === undefined){- config.selected = this.getToday();- }-- if(config.isCollapsed === undefined){- config.isCollapsed = false;//(config.thumbSource === null || config.hasThumbnail === false)? true: false;- }--- this.model = models.date;- this.startDate = config.startDate;- this.endDate = config.endDate;- this.isCollapsed = config.isCollapsed;- this.value = config.selected;- this.dataSourceUrl = config.dataSourceUrl;- this.statusStr = "";- this.init();-- var self = this;- this.model.events.on("select", function() {- self.value = self.model.selected;- $("#linkmode").mobiscroll('setDate',self.UTCToLocal(self.model.selected),true);- });-- $(window).on("resize", function() {- if ( $(window).width() < Worldview.TRANSITION_WIDTH ) {- $("#" + self.containerId).show();- } else {- $("#" + self.containerId).hide();- }- });-};--Worldview.Widget.DateWheels.prototype = new SOTE.widget.Component;--/**- * Displays the selectable dateSpan in HTML containing a thumbnail for each day in the span. If the date range contains- * more days than the visible day span, create horizontal scrolling capability. All callbacks should be set. The- * component UI should be rendered with controllers to call the events.- *- * @this {dateSpan}- * @requires SOTE.widget.Map-*/-Worldview.Widget.DateWheels.prototype.init = function(){-- // inherit styles into the user-specified div- this.container.setAttribute("class","datespan");- this.container.innerHTML = '<input name="linkmode" id="linkmode" />';- var self = this;-- $("#linkmode").mobiscroll().date({display:"bottom",- onChange: function(valueText){- var d = Date.parseISOString(valueText);- self.setValue(d.toISOStringDate(),true);- self.fire();- },- onShow: function(){- $("#linkmode").css("display","none");- },- onClose: function(){- $("#linkmode").css("display","block");- },- dateFormat: 'yyyy-mm-dd',- minDate: self.UTCToLocal(self.startDate),- maxDate: self.UTCToLocal(self.endDate),- setText: 'OK'-- });- $("#linkmode").mobiscroll('setDate',this.UTCToLocal(this.value),true);-- $("#linkmode").bind("onselect",function(){- alert("fire");- self.fire();- });-- if(REGISTRY){- REGISTRY.register(this.id,this);- REGISTRY.markComponentReady(this.id);- }- else{- alert("No REGISTRY found! Cannot register MobileDateSpan!");- }--};--/* This function is adjusts the UTC time to local for interaction with the mobiscroll widget- * The mobiscroll widget shows the mobile slider and only supports local time- */-Worldview.Widget.DateWheels.prototype.UTCToLocal = function(d){- var timezoneOffset = d.getTimezoneOffset()*this.MSEC_TO_MIN;-- return new Date(d.getTime() + timezoneOffset);-};--Worldview.Widget.DateWheels.prototype.getToday = function() {- // If at the beginning of the day, wait on the previous day until GIBS- // catches up.- var today = Worldview.today();- var now = Worldview.now();- if ( now.getUTCHours() < Worldview.GIBS_HOUR_DELAY ) {- today.setUTCDate(today.getUTCDate() - 1);- return today;- } else {- return today;- }-};--/**- * Fires an event to the registry when the state of the component is changed- *- * @this {MobileDateSpan}- *-*/-Worldview.Widget.DateWheels.prototype.fire = function(){-- $("#"+this.id).trigger("fire",this.value);-- if(REGISTRY){- REGISTRY.fire(this);- }- else{- alert("No REGISTRY found! Cannot fire to REGISTRY from AccordionPicker!");- }--};--/**- * Sets the selected date in the dateSpan from the passed in date string (ISO8601 format), if valid- *- * @this {dateSpan}- * @param {String} value is the date to be set (i.e. [containerId]=[date])- * @returns {boolean} true or false depending on if the passed in date validates- *-*/-Worldview.Widget.DateWheels.prototype.setValue = function(value, noRender){- var d;- try {- var d = value ? Date.parseISOString(value)- : this.getToday();- var changed = false;- if ( this.value.compareTo(d) !== 0 )- changed = true;- } catch ( error ) {- this.log.warn("Invalid time: " + value + ", reason: " + error +- "; using today");- d = Worldview.today();- }- this.model.select(d);- //this.value = d;- /*- if(!noRender && changed){- $("#linkmode").mobiscroll('setDate',this.UTCToLocal(this.value),true);- }- */--};--/**- * Gets the currently selected date in ISO8601 format- *- * @this {dateSpan}- * @returns {String} a string representing the currently selected date in ISO8601 format ([containerId]=[selectedDate])- *-*/-Worldview.Widget.DateWheels.prototype.getValue = function(){- var datestring = this.value.toISOStringDate();- return ""+this.id +"="+datestring;-};--Worldview.Widget.DateWheels.prototype.get = function(){- var datestring = this.value.toISOStringDate();- return datestring;-};--/**- * Modify the component based on dependencies (i.e. total number of dates in span, start date of span, selected date, thumbnails)- *- * @this {dateSpan}- * @param {String} querystring contains all values of dependencies (from registry)- * @returns {boolean} true or false depending on if the selected date validates against the updated criteria- *-*/-Worldview.Widget.DateWheels.prototype.updateComponent = function(qs){--};--/**- * Sets the selected date from the querystring, [containerId]=[selectedDate]- *- * @this {dateSpan}- * @param {String} qs contains the querystring (must contain [containerId]=[selectedDate] in the string)- * @returns {boolean} true or false depending on if the extracted date validates- *-*/-Worldview.Widget.DateWheels.prototype.loadFromQuery = function(qs){- return this.setValue(SOTE.util.extractFromQuery(this.id,qs));-};--/**- * Validates that the selected date is not null and within bounds- *- * @this {dateSpan}- * @returns {boolean} true or false depending on whether the date is not null and within bounds-*/-Worldview.Widget.DateWheels.prototype.validate = function(){--};--/**- * Sets the data accessor that provides state change instructions given dependencies- *- * @this {dateSpan}- * @param {String} datasourceurl is the relative location of the data accessor- *-*/-Worldview.Widget.DateWheels.prototype.setDataSourceUrl = function(datasourceurl){- // Content-};--/**- * Gets the data accessor- *- * @this {dateSpan}- * @returns {String} the relative location of the accessor- *-*/-Worldview.Widget.DateWheels.prototype.getDataSourceUrl = function(){- // Content-};--/**- * Sets the status of the component- *- * @this {dateSpan}- * @param {String} s the current status of the component (user prompts, error messages)- *-*/-Worldview.Widget.DateWheels.prototype.setStatus = function(s){- // Content-};--/**- * Gets the status of the component- *- * @this {dateSpan}- * @returns {String} the current status of the component (user prompts, error messages)- *-*/-Worldview.Widget.DateWheels.prototype.getStatus = function(){- // Content-};--/**- * Makes the component UI invisible- *- * @this {dateSpan}- *-*/-Worldview.Widget.DateWheels.prototype.hide = function(){- $("#"+this.id).css("display","none");- $("#linkmode").mobiscroll('hide',true);-};--/**- * Makes the component UI visible- *- * @this {dateSpan}- *-*/-Worldview.Widget.DateWheels.prototype.show = function(){- $("#"+this.id).css("display","block");-};--/**- * Expand the UI to show thumbnails- *- * @this {dateSpan}- *-*/-Worldview.Widget.DateWheels.prototype.expand = function(){- // Content-};--/**- * Collapse the UI (no thumbnails)- *- * @this {dateSpan}- *-*/-Worldview.Widget.DateWheels.prototype.collapse = function(){- // Content-};--// Additional Functions-// setBounds, getAvailableDates, setStart, changeBaseProduct, setExtent---------diff --git a/src/js/date/wv.date.label.js b/src/js/date/wv.date.label.jsnew file mode 100644index 000000000..99052c6f8--- /dev/null+++ b/src/js/date/wv.date.label.js@@ -0,0 +1,43 @@+/*+ * NASA Worldview+ *+ * This code was originally developed at NASA/Goddard Space Flight Center for+ * the Earth Science Data and Information System (ESDIS) project.+ *+ * Copyright (C) 2013 - 2014 United States Government as represented by the+ * Administrator of the National Aeronautics and Space Administration.+ * All Rights Reserved.+ */++/**+ * @module wv.date+ */+var wv = wv || {};+wv.date = wv.date || {};++/**+ * Undocumented.+ *+ * @class wv.date.label+ */+wv.date.label = wv.date.label || function(models) {++ var id = "timedsdateHolder";+ var $container = $("#" + id);+ var model = models.date;++ var self = {};++ var init = function() {+ model.events.on("select", update);+ update();+ };++ var update = function() {+ $container.html(wv.util.toISOStringDate(model.selected));+ };++ init();+ return self;+};+diff --git a/src/js/date/wv.date.model.js b/src/js/date/wv.date.model.jsindex a6b9ac765..b50a76f54 100644--- a/src/js/date/wv.date.model.js+++ b/src/js/date/wv.date.model.js@@ -25,11 +25,15 @@ wv.date = wv.date || {};* @constructor* @param {String} config.defaults.archiveStartDate the earliest day in* the archive that has data in the form of ``YYYY-MM-DD``.+ * @param {Date} [spec.initial] initial date. If not specified,+ * UTC today is used.*/-wv.date.model = wv.date.model || function(config) {+wv.date.model = wv.date.model || function(config, spec) {++ config = config || {};+ spec = spec || {};- var config = config || {};var self = {};/**@@ -62,7 +66,8 @@ wv.date.model = wv.date.model || function(config) {if ( start ) {self.archiveStartDate = wv.util.parseDateUTC(start);}- self.select(wv.util.today());+ var initial = spec.initial || wv.util.today();+ self.select(initial);};/**diff --git a/src/js/date/wv.date.sliders.js b/src/js/date/wv.date.sliders.jsindex 97836ea7a..d44080a7e 100644--- a/src/js/date/wv.date.sliders.js+++ b/src/js/date/wv.date.sliders.js@@ -40,12 +40,12 @@ wv.date.sliders = wv.date.sliders || function(models, config) {self.isCollapsed = false;var init = function() {- sliders["Year"] = [];+ sliders.Year = [];var currentYear = wv.util.now().getUTCFullYear();- sliders["Year"] = _.range(2000, currentYear + 1);- sliders["Month"] = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug',+ sliders.Year = _.range(2000, currentYear + 1);+ sliders.Month = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];- sliders["Day"] = _.range(1, 31 + 1);+ sliders.Day = _.range(1, 31 + 1);$container = $(selector);render();@@ -63,11 +63,6 @@ wv.date.sliders = wv.date.sliders || function(models, config) {}$container.addClass("datespan");- var $dateHolder = $("<div></div>")- .attr("id", id + "dateHolder")- .addClass("dateHolder");- $container.append($dateHolder);-var $ecbutton = $("<a></a>").addClass("ecbutton").addClass("collapse")@@ -103,31 +98,29 @@ wv.date.sliders = wv.date.sliders || function(models, config) {var wwidth = $(window).width() - 10;var labels = sliders[type];- if ( labels != undefined ) {- width = 50/labels.length;- width = width.toFixed(1);- var pwidth = width/100;- var pwwidth = Math.floor(pwidth*wwidth);- var spacer = 50/labels.length;- spacer = spacer.toFixed(1);- var pspacer = spacer/100;- var pwspacer = Math.floor(wwidth*pspacer/2);- var finalwidth = (pwwidth+pwspacer+pwspacer);-- var $label = $("<ul></ul>")- .addClass("sliderLabel")- .attr("id", id + "sliderLabel" + type);- for ( var i = 0; i < labels.length; ++i ) {- var $item = $("<li></li>")- .attr("id", id + type + "sliderItem" + i)- .html(labels[i])- .css("width", Math.floor(wwidth*pwidth) + "px")- .css("margin-left", Math.floor(wwidth*pspacer/2) + "px")- .css("margin-right", Math.floor(wwidth*pspacer/2) + "px");- $label.append($item);- }- $container.append($label);+ width = 50/labels.length;+ width = width.toFixed(1);+ var pwidth = width/100;+ var pwwidth = Math.floor(pwidth*wwidth);+ var spacer = 50/labels.length;+ spacer = spacer.toFixed(1);+ var pspacer = spacer/100;+ var pwspacer = Math.floor(wwidth*pspacer/2);+ var finalwidth = (pwwidth+pwspacer+pwspacer);++ var $label = $("<ul></ul>")+ .addClass("sliderLabel")+ .attr("id", id + "sliderLabel" + type);+ for ( var i = 0; i < labels.length; ++i ) {+ var $item = $("<li></li>")+ .attr("id", id + type + "sliderItem" + i)+ .html(labels[i])+ .css("width", Math.floor(wwidth*pwidth) + "px")+ .css("margin-left", Math.floor(wwidth*pspacer/2) + "px")+ .css("margin-right", Math.floor(wwidth*pspacer/2) + "px");+ $label.append($item);}+ $container.append($label);var labelslength = labels.length;$('#' + id + 'slider' + type)@@ -140,7 +133,7 @@ wv.date.sliders = wv.date.sliders || function(models, config) {$('#' + id + 'slider' + type).siblings('.ui-slider').bind("vmouseup", { type:type }, snap);- if ( width != 0 ) {+ if ( width !== 0 ) {var handleWidth = (width * 1.1).toFixed(1);$('.sliderDiv'+type+' a.ui-slider-handle').css('width', handleWidth + "%");@@ -151,30 +144,28 @@ wv.date.sliders = wv.date.sliders || function(models, config) {var labels = sliders[type];var wwidth = $(window).width() - 10;- if ( labels != undefined ) {- var width = 50/labels.length;- width = width.toFixed(1);- var pwidth = width/100;- var pwwidth = Math.floor(pwidth*wwidth);- var spacer = 50/labels.length;- spacer = spacer.toFixed(1);- var pspacer = spacer/100;- var pwspacer = Math.floor(wwidth*pspacer/2);- var finalwidth = (pwwidth+pwspacer+pwspacer);- $('#' + id + 'sliderLabel' + type)- .children()- .css('width', Math.floor(wwidth*pwidth) + "px");- $('#' + id + 'sliderLabel' + type)- .children()- .css('margin-left', Math.floor(wwidth*pspacer/2) + "px");- $('#' + id + 'sliderLabel' + type)- .children()- .css('margin-right', Math.floor(wwidth*pspacer/2) + "px");- var handleWidth = finalwidth*labels.length;- $('#' + id + 'slider' + type)- .siblings('.ui-slider')- .css('width', handleWidth + "px");- }+ var width = 50/labels.length;+ width = width.toFixed(1);+ var pwidth = width/100;+ var pwwidth = Math.floor(pwidth*wwidth);+ var spacer = 50/labels.length;+ spacer = spacer.toFixed(1);+ var pspacer = spacer/100;+ var pwspacer = Math.floor(wwidth*pspacer/2);+ var finalwidth = (pwwidth+pwspacer+pwspacer);+ $('#' + id + 'sliderLabel' + type)+ .children()+ .css('width', Math.floor(wwidth*pwidth) + "px");+ $('#' + id + 'sliderLabel' + type)+ .children()+ .css('margin-left', Math.floor(wwidth*pspacer/2) + "px");+ $('#' + id + 'sliderLabel' + type)+ .children()+ .css('margin-right', Math.floor(wwidth*pspacer/2) + "px");+ var handleWidth = finalwidth*labels.length;+ $('#' + id + 'slider' + type)+ .siblings('.ui-slider')+ .css('width', handleWidth + "px");};var handleSlide = function(e, ui) {@@ -242,31 +233,25 @@ wv.date.sliders = wv.date.sliders || function(models, config) {validate();var value = model.selected;var values = {};- values["Year"] = sliders["Year"].indexOf(value.getUTCFullYear());- values["Month"] = value.getUTCMonth();- values["Day"] = sliders["Day"].indexOf(value.getUTCDate());+ values.Year = sliders.Year.indexOf(value.getUTCFullYear());+ values.Month = value.getUTCMonth();+ values.Day = sliders.Day.indexOf(value.getUTCDate());_.each(values, function(x, type) {var numitems = sliders[type].length;var displacement = values[type];var width = SLIDER_WIDTH / numitems;- var move = displacement * width + (width / 4) - (width * .05);+ var move = displacement * width + (width / 4) - (width * 0.05);move = move.toFixed(1);$("#" + id + "slider" + type).val(move).slider("refresh");});- setVisualDate();- };-- var setVisualDate = function() {- var dateString = model.selected.toISOString().split("T")[0];- $('#' + id + 'dateHolder').html(dateString);};var refreshSliders = function() {if ( wv.ui.mobile() ) {- $("#" + self.containerId).hide();+ $container.hide();} else {- $("#" + self.containerId).show();+ $container.show();setTimeout(function() {refreshSlider("Year");refreshSlider("Month");diff --git a/src/js/date/wv.date.wheels.js b/src/js/date/wv.date.wheels.jsnew file mode 100644index 000000000..3a0a9e4fb--- /dev/null+++ b/src/js/date/wv.date.wheels.js@@ -0,0 +1,87 @@+/*+ * NASA Worldview+ *+ * This code was originally developed at NASA/Goddard Space Flight Center for+ * the Earth Science Data and Information System (ESDIS) project.+ *+ * Copyright (C) 2013 - 2014 United States Government as represented by the+ * Administrator of the National Aeronautics and Space Administration.+ * All Rights Reserved.+ */++/**+ * @module wv.date+ */+var wv = wv || {};+wv.date = wv.date || {};++/**+ * Undocumented.+ *+ * @class wv.date.wheels+ */+wv.date.wheels = wv.date.wheels || function(models, config) {++ var id = "timemds";+ var $container = $("#" + id);+ var MSEC_TO_MIN = 1000*60;+ var model = models.date;++ var self = {};+ self.startDate = new Date(Date.UTC(2012, 4, 8));+ self.endDate = wv.util.today();+ self.isCollapsed = false;++ var init = function() {+ render();+ model.events.on("select", update);+ $(window).on("resize", resize);+ update();+ resize();+ };++ var render = function() {+ $container+ .addClass("datespan")+ .html("<input name='linkmode' id='linkmode' />");++ $("#linkmode").mobiscroll().date({+ display: "bottom",+ onChange: function(valueText) {+ var d = wv.util.parseDateUTC(valueText);+ model.select(d);+ },+ onShow: function(){+ $("#linkmode").css("display","none");+ },+ onClose: function(){+ $("#linkmode").css("display","block");+ },+ dateFormat: 'yyyy-mm-dd',+ minDate: UTCToLocal(self.startDate),+ maxDate: UTCToLocal(self.endDate),+ setText: 'OK'+ });+ $("#linkmode").mobiscroll('setDate', UTCToLocal(model.selected),true);+ };++ var UTCToLocal = function(d) {+ var timezoneOffset = d.getTimezoneOffset() * MSEC_TO_MIN;+ return new Date(d.getTime() + timezoneOffset);+ };++ var resize = function() {+ if ( wv.ui.mobile() ) {+ $container.show();+ } else {+ $container.hide();+ }+ };++ var update = function() {+ $("#linkmode").mobiscroll('setDate', UTCToLocal(model.selected), true);+ };++ init();+ return self;+};diff --git a/src/js/main.js b/src/js/main.jsindex 57917e2ff..cdc74a237 100644--- a/src/js/main.js+++ b/src/js/main.js@@ -99,7 +99,15 @@ $(function() {// Initialize "static" vars// Modelsvar models = {};- models.date = wv.date.model(config);++ // If at the beginning of the day, wait on the previous day until GIBS+ // catches up (about three hours)+ var initialDate = wv.util.today();+ if ( initialDate.getUTCHours() < 3 ) {+ initialDate.setUTCDate(initialDate.getUTCDate() - 1);+ }+ models.date = wv.date.model(config, { initial: initialDate });+var palettesModel = Worldview.Models.Palettes();models.palette = palettesModel;var projectionModel = Worldview.Models.Projection(config);@@ -140,7 +148,8 @@ $(function() {// Initialize "static" varsvar addLayers = Worldview.Widget.AddLayers(config, layersModel,projectionModel);ui.dateSliders = wv.date.sliders(models, config);- var dateWheels = new Worldview.Widget.DateWheels(models, config);+ ui.dateLabel = wv.date.label(models);+ ui.dateWheels = wv.date.wheels(models, config);var map = Worldview.Widget.WorldviewMap("map", config);var rubberBand = new SOTE.widget.RubberBand("camera", {icon: "images/camera.png",diff --git a/src/js/util/wv.util.js b/src/js/util/wv.util.jsindex 6d8b22dfe..754e7a0ba 100644--- a/src/js/util/wv.util.js+++ b/src/js/util/wv.util.js@@ -100,7 +100,7 @@ wv.util = (function(self) {/*** Parses a UTC ISO 8601 date.*- * @method parseDateISO+ * @method parseDateUTC* @static* @param str {string} Date to parse in the form of ``YYYY-MM-DD``.* @return {Date} converted string as a date object, throws an exception ifdiff --git a/test/date/wv.date.model-test.js b/test/date/wv.date.model-test.jsindex 2d511b414..c061f34e8 100644--- a/test/date/wv.date.model-test.js+++ b/test/date/wv.date.model-test.js@@ -32,6 +32,12 @@ buster.testCase("wv.date.model", {buster.assert.equals(date.selected.getUTCDate(), 15);},+ "Initializes with a specified date": function() {+ var initial = new Date(Date.UTC(2013, 0, 5));+ var date = wv.date.model(this.config, { initial: initial });+ buster.assert.equals(date.selected, initial);+ },+"Initializes with archive start date": function() {var date = wv.date.model(this.config);buster.assert.equals(date.archiveStartDate.getUTCFullYear(), 2013);