|
1 | | -( function( $, vv, time ) { |
| 1 | +( function( $, vv, TimeValue ) { |
2 | 2 | 'use strict'; |
3 | 3 |
|
4 | | - var Time = time.Time, |
5 | | - timeSettings = time.settings; |
6 | | - |
7 | 4 | var PARENT = vv.experts.StringValue; |
8 | 5 |
|
9 | 6 | /** |
|
38 | 35 | $.proxy( this._onRotatorChange, this ), |
39 | 36 | function() { |
40 | 37 | var value = self.viewState().value(); |
41 | | - return value && value.getValue().precision(); |
| 38 | + return value && value.getOption( 'precision' ); |
42 | 39 | } |
43 | 40 | ); |
44 | 41 |
|
|
53 | 50 | $.proxy( this._onRotatorChange, this ), |
54 | 51 | function() { |
55 | 52 | var value = self.viewState().value(); |
56 | | - return value && value.getValue().calendar(); |
| 53 | + return value && value.getOption( 'calendarModel' ); |
57 | 54 | } |
58 | 55 | ); |
59 | 56 |
|
|
64 | 61 | new vv.ExpertExtender.CalendarHint( |
65 | 62 | this._messageProvider, |
66 | 63 | function() { |
67 | | - var value = self.viewState().value(); |
68 | | - return value && value.getValue(); |
| 64 | + return self.viewState().value(); |
69 | 65 | }, |
70 | 66 | function( value ) { |
71 | 67 | // FIXME: Do not use private function: |
|
143 | 139 | valueCharacteristics: function() { |
144 | 140 | var options = {}, |
145 | 141 | precision = this.precisionRotator && this.precisionRotator.getValue() || null, |
146 | | - calendarname = this.calendarRotator && this.calendarRotator.getValue() || null; |
| 142 | + calendarUri = this.calendarRotator && this.calendarRotator.getValue() || null; |
147 | 143 |
|
148 | 144 | if( precision !== null ) { |
149 | 145 | options.precision = precision; |
150 | 146 | } |
151 | | - if( calendarname !== null ) { |
152 | | - options.calendar = calendarNameToUri( calendarname ); |
| 147 | + if( calendarUri !== null ) { |
| 148 | + options.calendar = calendarUri; |
153 | 149 | } |
154 | 150 |
|
155 | 151 | return options; |
|
162 | 158 | * @return {Object[]} [{ value: <{number}>, label: <{string}>}, ...] |
163 | 159 | */ |
164 | 160 | function getPrecisionValues() { |
165 | | - var precisionValues = []; |
166 | | - $.each( timeSettings.precisiontexts, function( i, text ) { |
167 | | - if( i <= Time.PRECISION.DAY ) { |
| 161 | + var precisionValues = [], |
| 162 | + dayPrecision = TimeValue.getPrecisionById( 'DAY' ); |
| 163 | + $.each( TimeValue.PRECISIONS, function( precisionValue, precision ) { |
| 164 | + if( precisionValue <= dayPrecision ) { |
168 | 165 | // TODO: Remove this check as soon as time values are supported. |
169 | | - precisionValues.unshift( { value: i, label: text } ); |
| 166 | + precisionValues.unshift( { value: precisionValue, label: precision.text } ); |
170 | 167 | } |
171 | 168 | } ); |
172 | 169 | return precisionValues; |
|
180 | 177 | */ |
181 | 178 | function getCalendarValues( messageProvider ) { |
182 | 179 | var calendarValues = []; |
183 | | - $.each( timeSettings.calendarnames, function( calendarKey, calendarTerms ) { |
| 180 | + $.each( TimeValue.CALENDARS, function( key, uri ) { |
184 | 181 | var label = messageProvider.getMessage( |
185 | | - 'valueview-expert-timevalue-calendar-' + calendarTerms[0].toLowerCase() |
186 | | - ) || calendarTerms[0]; |
187 | | - calendarValues.push( { value: calendarTerms[0], label: label } ); |
| 182 | + 'valueview-expert-timevalue-calendar-' + key.toLowerCase() |
| 183 | + ) || key.toLowerCase(); |
| 184 | + calendarValues.push( { value: uri, label: label } ); |
188 | 185 | } ); |
189 | 186 | return calendarValues; |
190 | 187 | } |
191 | 188 |
|
192 | | - /** |
193 | | - * @ignore |
194 | | - * |
195 | | - * @param {string} calendarname |
196 | | - * @return {string} |
197 | | - */ |
198 | | - function calendarNameToUri( calendarname ) { |
199 | | - return new Time( { calendarname: calendarname, precision: 0, year: 0 } ).calendarURI(); |
200 | | - } |
201 | | - |
202 | | -}( jQuery, jQuery.valueview, time ) ); |
| 189 | +}( jQuery, jQuery.valueview, dataValues.TimeValue ) ); |
0 commit comments