Changeset 16953 for schedule/function
- Timestamp:
- 07/11/13 02:36:51 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/function/SplitDelete.php
r16951 r16953 1 1 <?php include '../include/factdb.php'; ?> 2 2 <script language="javascript"> 3 3 var timeval = 0; 4 var name = ""; 5 var hid = ""; 6 var opt = ""; 4 7 window.cnt=0; 5 8 function clearNode(node){ … … 26 29 input_data.setAttribute("max","24"), 27 30 input_data.setAttribute("min","1"), 28 input_data.setAttribute("required",true) 31 input_data.setAttribute("required",true), 32 input_data.setAttribute("hidden",true), 33 input_data.setAttribute("value",timeval) 29 34 ); 30 35 var newtd_c2 = document.createElement("td"); … … 33 38 newtd_c2.appendChild( 34 39 selection = document.createElement("select"), 35 36 <?php 37 38 $select = mysql_query("SELECT * FROM source"); 39 40 while($rowsource = mysql_fetch_array($select)){ 41 42 ?> 43 selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))), 44 <?php } ?> 40 <?php 41 $selectm = mysql_query("SELECT * FROM measurement"); 42 while($rowmeasure = mysql_fetch_array($selectm)){ 43 44 ?> 45 selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))), 46 <?php } ?> 47 48 45 49 46 50 selection.setAttribute('id','source') 47 51 ); 52 newtd_c2.appendChild( 53 input_data = document.createElement("input"), 54 input_data.setAttribute("class","button"), 55 input_data.setAttribute("type","button"), 56 input_data.setAttribute("value","+"), 57 input_data.onclick = function(){ var val; $('div#Data .dataTable #Time').each(function(){ 58 val = $(this).val(); 59 60 }); 61 timeval = val; return addRow(table); } 62 ); 48 63 var newtd_c3 = document.createElement("td"); 49 64 newtd_c3.setAttribute("width","88"); … … 51 66 newtd_c3.appendChild( 52 67 selection = document.createElement("select"), 53 selection.appendChild(option = document.createElement("option"),option.setAttribute("select","Source 1"),option.appendChild(document.createTextNode("Source 1"))), 54 68 <?php 69 70 $select = mysql_query("SELECT * FROM source"); 71 72 while($rowsource = mysql_fetch_array($select)){ 73 74 ?> 75 selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))), 76 <?php } ?> 55 77 selection.setAttribute('id','measurement') 56 78 ); … … 70 92 input_data = document.createElement("input"), 71 93 input_data.setAttribute("type","button"), 72 input_data.setAttribute("value","Delete Main"), 73 input_data.onclick = function(){ return clearNode(newdiv); } 74 ); 75 newtd_c5.appendChild( 76 input_data = document.createElement("input"), 77 input_data.setAttribute("type","button"), 78 input_data.setAttribute("value","+"), 79 input_data.onclick = function(){ return addRow(newtable); } 80 ); 94 input_data.setAttribute("class","button"), 95 input_data.setAttribute("value","Delete"), 96 input_data.onclick = function(){ return clearNode(newtr); } 97 ); 98 81 99 82 100 newtr.appendChild(newtd_c1); … … 87 105 88 106 89 targetView.appendChild(newtr);107 $(targetView).append(newtr); 90 108 } 91 109 function deleteRow(tableID){ … … 115 133 var targetView = document.getElementById("Data"); 116 134 // CREATE ELEMENT 135 117 136 var newdiv = document.createElement("div"); 118 137 newdiv.setAttribute("style","margin:30px 0;"); … … 137 156 input_data.setAttribute("min","1"), 138 157 input_data.setAttribute("required",true) 158 139 159 ); 140 160 var newtd_c2 = document.createElement("td"); … … 143 163 newtd_c2.appendChild( 144 164 selection = document.createElement("select"), 145 146 <?php 147 148 $select = mysql_query("SELECT * FROM source"); 149 150 while($rowsource = mysql_fetch_array($select)){ 151 152 ?> 153 selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))), 154 <?php } ?> 165 <?php 166 $selectm = mysql_query("SELECT * FROM measurement"); 167 while($rowmeasure = mysql_fetch_array($selectm)){ 168 169 ?> 170 selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))), 171 <?php } ?> 172 155 173 156 174 selection.setAttribute('id','source') 157 175 ); 176 newtd_c2.appendChild( 177 input_data = document.createElement("input"), 178 input_data.setAttribute("class","button"), 179 input_data.setAttribute("type","button"), 180 input_data.setAttribute("value","+"), 181 input_data.onclick = function(){ var val; $('div#Data .dataTable #Time').each(function(){ 182 val = $(this).val(); 183 184 }); 185 timeval = val; 186 return addRow(newtable);} 187 ); 158 188 var newtd_c3 = document.createElement("td"); 159 189 newtd_c3.setAttribute("width","88"); … … 161 191 newtd_c3.appendChild( 162 192 selection = document.createElement("select"), 163 164 <?php 165 $selectm = mysql_query("SELECT * FROM measurement"); 166 while($rowmeasure = mysql_fetch_array($selectm)){ 167 168 ?> 169 selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))), 170 <?php } ?> 193 <?php 194 195 $select = mysql_query("SELECT * FROM source"); 196 197 while($rowsource = mysql_fetch_array($select)){ 198 199 ?> 200 selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))), 201 <?php } ?> 202 171 203 selection.setAttribute('id','measurement') 172 204 ); … … 186 218 input_data = document.createElement("input"), 187 219 input_data.setAttribute("type","button"), 220 input_data.setAttribute("class","button"), 188 221 input_data.setAttribute("value","Delete Main"), 189 222 input_data.onclick = function(){ return clearNode(newdiv); } 190 223 ); 191 newtd_c5.appendChild( 192 input_data = document.createElement("input"), 193 input_data.setAttribute("type","button"), 194 input_data.setAttribute("value","+"), 195 input_data.onclick = function(){ return addRow(newtable); } 196 ); 224 197 225 198 226 newtr.appendChild(newtd_c1); … … 243 271 var newtable = document.createElement("table"); 244 272 newtable.setAttribute("class","dataTable"); 273 newtable.setAttribute("id","dataTable"+cnt); 245 274 newtable.setAttribute("width","100%"); 246 275 newtable.setAttribute("border","1"); … … 268 297 newtd_c2.appendChild( 269 298 selection = document.createElement("select"), 270 271 <?php 299 <?php 300 $selectm = mysql_query("SELECT * FROM measurement"); 301 while($rowmeasure = mysql_fetch_array($selectm)){ 302 303 ?> 304 selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))), 305 <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} } ?> 306 307 308 selection.setAttribute('id','source') 309 ); 310 newtd_c2.appendChild( 311 input_data = document.createElement("input"), 312 input_data.setAttribute("class","button"), 313 input_data.setAttribute("type","button"), 314 input_data.setAttribute("value","+"), 315 input_data.setAttribute("name","dataTable"+cnt), 316 input_data.onclick = function(){ var val; $('div#Data .dataTable #Time').each(function(){ 317 val = $(this).val(); 318 319 }); 320 timeval = val; //alert(); 321 return addRow("#"+$(this).attr('name')); } 322 ); 323 var newtd_c3 = document.createElement("td"); 324 newtd_c3.setAttribute("width","88"); 325 newtd_c3.setAttribute("align","center"); 326 newtd_c3.appendChild( 327 selection = document.createElement("select"), 328 329 <?php 272 330 273 331 $select = mysql_query("SELECT * FROM source"); … … 280 338 281 339 <?php } ?> 282 283 selection.setAttribute('id','source')284 );285 var newtd_c3 = document.createElement("td");286 newtd_c3.setAttribute("width","88");287 newtd_c3.setAttribute("align","center");288 newtd_c3.appendChild(289 selection = document.createElement("select"),290 291 <?php292 $selectm = mysql_query("SELECT * FROM measurement");293 while($rowmeasure = mysql_fetch_array($selectm)){294 295 ?>296 selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))),297 <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} } ?>298 340 selection.setAttribute('id','measurement') 299 341 ); … … 314 356 input_data = document.createElement("input"), 315 357 input_data.setAttribute("type","button"), 358 input_data.setAttribute("class","button"), 316 359 input_data.setAttribute("value","Delete Main"), 317 360 input_data.onclick = function(){ return clearNode(newdiv); } 318 361 ); 319 newtd_c5.appendChild( 320 input_data = document.createElement("input"), 321 input_data.setAttribute("type","button"), 322 input_data.setAttribute("value","+"), 323 input_data.onclick = function(){ return addRow(newtable); } 324 ); 362 325 363 326 364 newtr.appendChild(newtd_c1); … … 383 421 newtd_c2.appendChild( 384 422 selection = document.createElement("select"), 385 386 <?php 387 388 $select = mysql_query("SELECT * FROM source"); 389 390 while($rowsource = mysql_fetch_array($select)){ 391 392 ?> 393 selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))), 394 <?php } ?> 423 <?php 424 $selectm = mysql_query("SELECT * FROM measurement"); 425 while($rowmeasure = mysql_fetch_array($selectm)){ 426 427 ?> 428 selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))), 429 <?php } ?> 430 395 431 396 432 selection.setAttribute('id','source') 397 433 ); 434 newtd_c2.appendChild( 435 input_data = document.createElement("input"), 436 input_data.setAttribute("class","button"), 437 input_data.setAttribute("type","button"), 438 input_data.setAttribute("value","+"), 439 input_data.onclick = function(){ var val; $('div#Data .dataTable #Time').each(function(){ 440 val = $(this).val(); 441 442 }); 443 timeval = val; return addRow(newtable);} 444 ); 398 445 var newtd_c3 = document.createElement("td"); 399 446 newtd_c3.setAttribute("width","88"); … … 401 448 newtd_c3.appendChild( 402 449 selection = document.createElement("select"), 403 404 <?php 405 $selectm = mysql_query("SELECT * FROM measurement"); 406 while($rowmeasure = mysql_fetch_array($selectm)){ 407 408 ?> 409 selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))), 410 <?php } ?> 450 <?php 451 452 $select = mysql_query("SELECT * FROM source"); 453 454 while($rowsource = mysql_fetch_array($select)){ 455 456 ?> 457 selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))), 458 <?php } ?> 459 411 460 selection.setAttribute('id','measurement') 412 461 ); … … 426 475 input_data = document.createElement("input"), 427 476 input_data.setAttribute("type","button"), 477 input_data.setAttribute("class","button"), 428 478 input_data.setAttribute("value","Delete Main"), 429 479 input_data.onclick = function(){ return clearNode(newdiv); } 430 480 ); 431 newtd_c5.appendChild( 432 input_data = document.createElement("input"), 433 input_data.setAttribute("type","button"), 434 input_data.setAttribute("value","+"), 435 input_data.onclick = function(){ return addRow(newtable); } 436 ); 481 437 482 438 483 newtr.appendChild(newtd_c1);
Note:
See TracChangeset
for help on using the changeset viewer.