-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeobricks_ui_download_trmm.js
71 lines (54 loc) · 2.2 KB
/
geobricks_ui_download_trmm.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
define(['jquery',
'mustache',
'text!geobricks_ui_download_trmm/html/templates.html',
'i18n!geobricks_ui_download_trmm/nls/translate',
'sweet-alert',
'bootstrap'], function ($, Mustache, templates, translate) {
'use strict';
function UI_TRMM() {
this.CONFIG = {
lang: 'en',
url_browse: 'http://localhost:5555/browse/trmm/',
url_download: 'http://localhost:5555/download/modis/',
url_countries: 'http://localhost:5555/browse/modis/countries/',
placeholder_id: 'placeholder',
url_browse_modis: 'http://localhost:5555/browse/modis/'
};
}
/**
* This is the entry method to configure the module.
*
* @param config Custom configuration in JSON format to extend the default settings.
*/
UI_TRMM.prototype.init = function(config) {
/* Extend default configuration. */
this.CONFIG = $.extend(true, {}, this.CONFIG, config);
/* Fix the language, if needed. */
this.CONFIG.lang = this.CONFIG.lang != null ? this.CONFIG.lang : 'en';
/* Render the main structure. */
var template = $(templates).filter('#main_structure').html();
var view = {
years: translate.years,
months: translate.months,
days: translate.days,
please_select: translate.please_select
};
var render = Mustache.render(template, view);
$('#' + this.CONFIG.placeholder_id).html(render);
/* Cache JQuery selectors. */
this.year_selector = $('#year_selector');
this.month_selector = $('#month_selector');
this.day_selector = $('#day_selector');
/* Initiate Chosen drop-downs. */
this.year_selector.chosen({disable_search_threshold: 10});
this.month_selector.chosen({disable_search_threshold: 10});
this.day_selector.chosen({disable_search_threshold: 10});
/* Populate countries. */
//this.populate_countries();
/* Populate drop-downs. **/
//this.populate_products();
};
UI_TRMM.prototype.download = function() {
};
return new UI_TRMM();
});