Changeset 9815
- Timestamp:
- Dec 23, 2011, 7:40:11 AM (13 years ago)
- Location:
- src/django_gheat/wlheatmap
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/wlheatmap/static/heatmap_extensions.js
r9813 r9815 224 224 userlist.push(json.gebruiker); 225 225 $.each(json.meetrondje, function(m, meetrondje){ 226 $("#select_dataset").append($("<option/>").attr({"class":json.gebruiker, "value": json.gebruiker + "-" +meetrondje.naam}).text(meetrondje.naam));226 $("#select_dataset").append($("<option/>").attr({"class":json.gebruiker, "value": meetrondje.naam}).text(meetrondje.naam)); 227 227 $.each(meetrondje.nodes, function(n, nodes){ 228 $("#select_node").append($("<option/>").attr({"class":json.gebruiker + " -" + meetrondje.naam, "value":nodes}).text(nodes));228 $("#select_node").append($("<option/>").attr({"class":json.gebruiker + "\\" + meetrondje.naam, "value":nodes}).text(nodes)); 229 229 if(jQuery.inArray(nodes, nodelist)<0){ 230 230 nodelist.push(nodes); … … 235 235 // Initiate the chain 236 236 $("#select_dataset").chained("#select_user"); 237 $("#select_node").chained("#select_ dataset");237 $("#select_node").chained("#select_user, #select_dataset"); 238 238 } 239 239 ); … … 258 258 $("#select_node").change(function(){ 259 259 update_lname(); 260 update_raw_filter(); 261 }); 262 $("#select_nodetype").change(function(){ 260 263 update_raw_filter(); 261 264 }); … … 333 336 334 337 function get_raw_filter() { 335 user = $('#select_user option:selected').text(); 336 dataset = $('#select_dataset option:selected').text(); 337 wlnode = $('#select_node option:selected').text(); 338 var query_array = []; 339 340 /* Values to be used to create the filter */ 341 user = $('#select_user option:selected').val(); 342 dataset = $('#select_dataset option:selected').val(); 343 wlnode = $('#select_node option:selected').val(); 344 nodetype = $('#select_nodetype option:selected').val(); 338 345 start_date = $('#start_date').val(); 339 346 end_date = $('#end_date').val(); 340 347 colour = $("#colour").val(); 341 348 349 // some checks if values are correct, and adding them to parts of the link 350 if (user != 'all') { 351 query_array.push('meetrondje__gebruiker__naam=' + user); 352 } 353 if (dataset != 'all') { 354 query_array.push('meetrondje__naam=' + dataset); 355 } 356 if (wlnode != 'all') { 357 query_array.push('accespoint__ssid=' + wlnode); 358 } 359 if (nodetype) { 360 query_array.push(nodetype); 361 } 362 363 if (start_date){ 364 sd_d=start_date.substr(0,2); 365 sd_m=start_date.substr(3,2); 366 sd_y=start_date.substr(6,4); 367 query_array.push('meetrondje__datum__gte=' + sd_y +'-'+ sd_m +'-'+ sd_d); 368 } 369 if (end_date){ 370 ed_d=end_date.substr(0,2); 371 ed_m=end_date.substr(3,2); 372 ed_y=end_date.substr(6,4); 373 query_array.push('meetrondje__datum__lte=' + ed_y +'-'+ ed_m +'-'+ ed_d); 374 } 375 376 var min = $("#select_sig_slider").slider("values")[0]; 377 var max = $("#select_sig_slider").slider("values")[1]; 378 query_array.push('signaal__gte=' + min); 379 query_array.push('signaal__lte=' + max); 380 342 381 /** 343 382 * On HEX to RGB: 344 383 * http://stackoverflow.com/questions/5798868/need-some-tips-with-how-to-convert-a-hexadecimal-color-value-to-a-rgb-one/5798900#5798900 384 * If no colour is defined, use a random colour 345 385 */ 346 colour = parseInt((colour.substr(1, 2)),16) + ',' + parseInt((colour.substr(3, 2)),16) + ',' + parseInt((colour.substr(5, 2)),16); 347 348 // some checks if values are correct, and adding them to parts of the link 349 if (user == 'all') { 350 user = ''; 386 if (colour){ 387 colour = [parseInt((colour.substr(1, 2)),16), parseInt((colour.substr(3, 2)),16), parseInt((colour.substr(5, 2)),16)]; 351 388 } else { 352 user='&meetrondje__gebruiker__naam='+user; 353 } 354 if (dataset == 'all') { 355 dataset = ''; 356 } else { 357 dataset='&meetrondje__naam='+dataset; 358 } 359 if (wlnode == 'all'){ 360 wlnode=''; 361 } else { 362 wlnode='&accespoint__ssid='+wlnode; 363 } 364 if (start_date && end_date){ 365 sd_d=start_date.substr(0,2); 366 sd_m=start_date.substr(3,2); 367 sd_y=start_date.substr(6,4); 368 369 ed_d=end_date.substr(0,2); 370 ed_m=end_date.substr(3,2); 371 ed_y=end_date.substr(6,4); 372 373 start_date='&meetrondje__datum__gte=' + sd_y +'-'+ sd_m +'-'+ sd_d; 374 end_date='&meetrondje__datum__lte=' + ed_y +'-'+ ed_m +'-'+ ed_d; 375 } 376 if (start_date && !end_date){ 377 sd_d=start_date.substr(0,2); 378 sd_m=start_date.substr(3,2); 379 sd_y=start_date.substr(6,4); 380 start_date='&meetrondje__datum__gte=' + sd_y +'-'+ sd_m +'-'+ sd_d; 381 end_date=''; 382 } 383 if (!start_date && end_date){ 384 ed_d=end_date.substr(0,2); 385 ed_m=end_date.substr(3,2); 386 ed_y=end_date.substr(6,4); 387 start_date=''; 388 end_date='&meetrondje__datum__lte=' + ed_y +'-'+ ed_m +'-'+ ed_d; 389 } 390 if (colour != 'NaN,NaN,NaN'){ 391 colour=colour; 392 } else { 393 colour = Math.floor(Math.random()*256)+','+Math.floor (Math.random()*256)+','+Math.floor(Math.random()*256); 394 } 395 396 var min = $("#select_sig_slider").slider("values")[0]; 397 var max = $("#select_sig_slider").slider("values")[1]; 398 signal = '&signaal__gte=' + min + '&signaal__lte=' + max; 399 400 var raw_filter = "colour=" + colour + user + dataset + wlnode + start_date + end_date + signal 389 colour = [Math.floor(Math.random()*256), Math.floor (Math.random()*256), Math.floor(Math.random()*256)]; 390 } 391 query_array.push('colour=' + colour.join(',')); 392 393 /* Return final result */ 394 var raw_filter = query_array.filter(function() {return true;}).sort().join('&'); 401 395 return raw_filter; 402 396 } … … 458 452 } 459 453 var pl = map.getControlsByClass('OpenLayers.Control.Permalink'); 460 pl.updateLink ();454 pl.updateLink; 461 455 }); -
src/django_gheat/wlheatmap/templates/home.html
r9779 r9815 46 46 <select id="select_dataset" style="width:104px"></select> Dataset<br /> 47 47 <select id="select_node" style="width:104px"></select> Node<br /> 48 <select id="select_nodetype" style="width:104px"> 49 <option value="accespoint__ssid__icontains=ap-WirelessLeiden">WL Nodes</option> 50 <option value="accespoint__ssid__icontains=WirelessLeiden">WL Nodes & WL InterLinks</option> 51 <option value="">Alle AccessPoints (ook niet WL)</option> 52 </select> Type<br /> 48 53 <font id='select_sig_value'>Signal strength: 0 - 100</font> 49 54 <div id="select_sig_slider">
Note:
See TracChangeset
for help on using the changeset viewer.