- Timestamp:
- Jun 6, 2011, 11:25:40 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/static/heatmap_extensions_test.js
r9225 r9229 18 18 if (req.status == 200) { 19 19 if (callback) { 20 if (filter) callback(filter, field, req.responseText); 21 else callback(req.responseText); 20 callback(req.responseText); 22 21 } 23 22 } … … 63 62 var layername = '<input type="text" id="lname" name="lname" size="10"/> Layername<br />'; 64 63 var colour = '<input type="text" id="colour" name="colour" size="10"/> Colour<br />'; 65 var user = '<select id="user" style="width:104px" onchange=update_ dataset()><option></option></select> User<br />';66 var dataset = '<select id="dataset" style="width:104px" ><option></option></select> Dataset<br />';67 var node = '<select id="node" style="width:104px" ><option></option></select> Node<br />';64 var user = '<select id="user" style="width:104px" onchange=update_filters(this.id)><option></option></select> User<br />'; 65 var dataset = '<select id="dataset" style="width:104px" onchange=update_filters(this.id)><option></option></select> Dataset<br />'; 66 var node = '<select id="node" style="width:104px" onchange=update_filters(this.id)><option></option></select> Node<br />'; 68 67 var enc = '<select id="enc" style="width:104px"><option></option></select> Encryption<br />'; 69 var date = '<select id="date" style="width:104px" ><option></option></select> Date<br />';68 var date = '<select id="date" style="width:104px" onchange=update_filters(this.id)><option></option></select> Date<br />'; 70 69 71 70 // Write form to document 72 document.getElementById('filter_list').innerHTML+=(formstart + user + dataset + node + enc + date+ colour + layername + formend);71 document.getElementById('filter_list').innerHTML+=(formstart + date + user + dataset + node + enc + colour + layername + formend); 73 72 74 73 // Request JSON with filter values 75 74 var url = "/website/foofilter"; 76 var ajax = new AjaxRequest(url, set_ user);75 var ajax = new AjaxRequest(url, set_filters); 77 76 ajax.doGet(); 78 77 } 79 78 80 function set_ user(responseText) {79 function set_filters(responseText) { 81 80 json=eval('(' + responseText + ')'); 82 var options = '<option value="All">All</option>'; 81 var user = '<option value="empty"></option>'; 82 var dataset = '<option value="empty"></option>'; 83 var date = '<option value="empty"></option>'; 83 84 for (var i=0; i<json.length; i++){ 84 options += '<option>' + json[i].gebruiker + '</option>'; 85 } 86 document.getElementById('user').innerHTML=options; 87 88 update_dataset(); 89 } 90 91 92 function update_dataset(){ 93 var options = ''; 94 var user_value = $('#user option:selected').text(); 95 96 for (var i=0; i<json.length; i++){ 85 user += '<option value="user">' + json[i].gebruiker + '</option>'; 97 86 for (m in json[i].meetrondje){ 98 if (user_value != 'All'){ 99 if (json[i].gebruiker == user_value){ 100 options += '<option>' + json[i].meetrondje[m].naam + '</option>'; 101 } 102 else{ 103 continue; 104 } 105 } 106 else{ 107 options += '<option>' + json[i].meetrondje[m].naam + '</option>'; 108 } 87 dataset += '<option value="dataset">' + json[i].meetrondje[m].naam + '</option>'; 88 date += '<option value="date">' + json[i].meetrondje[m].datum + '</option>'; 109 89 } 110 90 } 111 document.getElementById('dataset').innerHTML=options; 91 document.getElementById('user').innerHTML=user; 92 document.getElementById('dataset').innerHTML=dataset; 93 document.getElementById('date').innerHTML=date; 112 94 } 113 95 114 96 115 97 116 function update_filters(id){ 117 var filtervalue = id.options[id.selectedIndex].value; 118 var d = document.getElementById('dataset'); 119 var ds = d.options[id.selectedIndex].value; 98 99 function update_filters(filter_id){ 100 var user_text = $('#user option:selected').text(); 101 var user_val = $('#user option:selected').val(); 102 var dataset_text = $('#dataset option:selected').text(); 103 var user = '<option value="empty"></option>'; 104 var dataset = '<option value="empty"></option>'; 105 106 if (filter_id=='user'){ 107 if (!user_text){ 108 for (var i=0; i<json.length; i++){ 109 for (m in json[i].meetrondje){ 110 dataset += '<option value="dataset">' + json[i].meetrondje[m].naam + '</option>'; 111 } 112 } 113 } 114 else{ 115 for (var i=0; i<json.length; i++){ 116 for (m in json[i].meetrondje){ 117 if (json[i].gebruiker == user_text){ 118 dataset += '<option value="dataset">' + json[i].meetrondje[m].naam + '</option>'; 119 } 120 } 121 } 122 } 123 document.getElementById('dataset').innerHTML=dataset; 124 } 120 125 } 126 127 128 121 129 122 130 … … 131 139 var lname = encodeURIComponent(document.getElementById("lname").value); 132 140 133 if ((user != '') && (user != 'All')){user='&meetrondje__gebruiker__naam='+user;} 134 else {user='';} 141 if (user != ''){user='&meetrondje__gebruiker__naam='+user;} 135 142 if (dataset != ''){dataset='&meetrondje__naam='+dataset;} 136 143 if (wlnode != ''){wlnode='&accespoint__ssid='+wlnode;} … … 159 166 map.addLayer(filterlayer); 160 167 } 161 162
Note:
See TracChangeset
for help on using the changeset viewer.