Skip to content

Commit a31dd70

Browse files
committed
Fixig the support for no-alphanumerical characters in collection ids.
1 parent 0613e91 commit a31dd70

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

app/scripts/util.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@
2525
// THE SOFTWARE.
2626
//-------------------------------------------------------------------------------
2727

28+
strHash = function(s) {
29+
var h = 0, i, l = s.length;
30+
for (i = 0; i < l; ++i) {
31+
h = ((h << 5) - h) + s.charCodeAt(i);
32+
h &= 0x7fffffff ; // mask to non-negative signed 32bit integer
33+
}
34+
h = Number(h).toString(16);
35+
while (h.length < 8) { h = "0" + h; }
36+
return h;
37+
};
38+
2839

2940
var padLeft = function(str, pad, size) {
3041
while (str.length < size) {

app/scripts/views/TimeSliderView.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,35 +103,35 @@
103103
switch (product.get("timeSliderProtocol")){
104104
case "WMS":
105105
this.slider.addDataset({
106-
id: product.get('view').id,
106+
id: "id"+strHash(product.get('view').id),
107107
color: product.get('color'),
108108
data: new TimeSlider.Plugin.WMS({
109109
url: product.get('view').urls[0],
110110
eoid: product.get('view').id,
111-
dataset: product.get('view').id
111+
dataset: "id"+strHash(product.get('view').id)
112112
})
113113
});
114114
break;
115115
case "EOWCS":
116116
this.slider.addDataset({
117-
id: product.get('download').id,
117+
id: "id"+strHash(product.get('download').id),
118118
color: product.get('color'),
119119
data: new TimeSlider.Plugin.EOWCS({
120120
url: product.get('download').url,
121121
eoid: product.get('download').id,
122-
dataset: product.get('download').id
122+
dataset: "id"+strHash(product.get('download').id)
123123
})
124124
});
125125
break;
126126
case "WPS":
127127
var extent = Communicator.reqres.request('map:get:extent');
128128
this.slider.addDataset({
129-
id: product.get('view').id,
129+
id: "id"+strHash(product.get('download').id),
130130
color: product.get('color'),
131131
data: new TimeSlider.Plugin.WPS({
132132
url: product.get('download').url,
133133
eoid: product.get('download').id,
134-
dataset: product.get('view').id ,
134+
dataset: "id"+strHash(product.get('download').id),
135135
bbox: [extent.left, extent.bottom, extent.right, extent.top]
136136
})
137137
});
@@ -178,4 +178,4 @@
178178
});
179179
return {'TimeSliderView':TimeSliderView};
180180
});
181-
}).call( this );
181+
}).call( this );

0 commit comments

Comments
 (0)