source: schedule/function/SplitDelete.php@ 16458

Last change on this file since 16458 was 16422, checked in by tanio, 11 years ago
File size: 17.6 KB
Line 
1<script type="text/javascript">
2 $(document).ready(function(){
3 var timeValue;
4var meas;
5var meas2;
6 window.cnt=2;
7 var table = document.createElement("table");
8 table.setAttribute('id',"table2");
9 table.setAttribute('width','100%');
10 var tr = document.createElement('tr');
11 var td3=document.createElement('td');
12 td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
13 td3.appendChild(
14 input = document.createElement("input"),
15 input.setAttribute("type","time"),
16 input.setAttribute("id","Time1"),
17 input.setAttribute("max","24"),
18 input.setAttribute("min","1"),
19 input.setAttribute("required",true)
20
21 );
22 td3.appendChild(
23 button=document.createElement('input'),
24 button.setAttribute('type','button'),
25 button.setAttribute('value','[+]'),
26 button.setAttribute('id','btnAddTime'),
27 button.onclick=function(){
28 if($('#Time1').val() != ""){ timeValue = $('#Time1').val(); meas = "disabled"; meas2 = true; split1(); }else{ alert("please enter value for time to add measurement"); }
29
30
31 }
32 );
33 var td=document.createElement('td');
34 td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
35 td.appendChild(
36 sourcecbo= document.createElement('select'),
37 sourcecbo.setAttribute('id','source1'),
38<?php
39 $source=mysql_query("SELECT*FROM source");
40 while($rowsource=mysql_fetch_array($source))
41 {
42?>
43 sourcecbo.appendChild(
44 option=document.createElement('option'),
45
46 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
47 option.setAttribute('selected',true),
48
49 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
50
51
52 ),
53<?php
54 }
55?>
56 sourcecbo.setAttribute('id','source1')
57
58 );
59 var td1=document.createElement('td');
60 td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
61 td1.appendChild(
62 measurementcbo= document.createElement('select'),
63 measurementcbo.setAttribute('id','measurement1'),
64<?php
65 $measure=mysql_query("SELECT*FROM measurement");
66 while($rowmeasure=mysql_fetch_array($measure))
67 {
68?>
69 measurementcbo.appendChild(
70 option=document.createElement('option'),
71 option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
72 option.setAttribute('selected',true),
73 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
74 ),
75<?php
76 }
77?>
78 measurementcbo.setAttribute('id','measurement1')
79 );
80 td1.appendChild(
81 button=document.createElement('input'),
82 button.setAttribute('type','button'),
83 button.setAttribute('value','[+]'),
84 button.setAttribute('id','btnAddTime'),
85 button.onclick=function(){
86 if($('#Time1').val() != ""){ timeValue = $('#Time1').val(); meas = "hidden"; meas2 = true; split1(); }else{ alert("please enter value for time to add measurement"); }
87
88
89 }
90 );
91 var td2=document.createElement('td');
92 td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
93 td2.appendChild(
94 input = document.createElement('input'),
95 input.setAttribute('type','text'),
96 input.setAttribute('id','txtData1')
97
98
99 );
100 var td4=document.createElement('td');
101 td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
102 td4.appendChild(
103 button = document.createElement('input'),
104 button.setAttribute("type",'button'),
105 button.setAttribute('id','btnSplit'),
106 button.setAttribute('value','Split'),
107 button.onclick= function()
108 {
109 meas = "name"; meas2 = "time";
110 timeValue = "";
111 split1();
112
113
114 }
115 );
116 td4.appendChild(
117 button=document.createElement('input'),
118 button.setAttribute('type','button'),
119 button.setAttribute('value','Delete'),
120 button.setAttribute('id','btnDelete'),
121 button.onclick=function(){
122 $('#table2').remove();
123 }
124 );
125
126 tr.appendChild(td3);
127 tr.appendChild(td1);
128 tr.appendChild(td);
129
130 tr.appendChild(td2);
131 tr.appendChild(td4);
132 table.appendChild(tr);
133 $('#TableH1').append(table);
134
135
136 var table = document.createElement("table");
137 table.setAttribute('id',"table1");
138 table.setAttribute('width','100%');
139 var tr = document.createElement('tr');
140 tr.setAttribute('id','');
141 tr.setAttribute('class','');
142 var td3=document.createElement('td');
143 td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
144 td3.appendChild(
145 input = document.createElement("input"),
146 input.setAttribute("type","time"),
147 input.setAttribute("id","Time2"),
148 input.setAttribute("max","24"),
149 input.setAttribute("min","1"),
150 input.setAttribute("required",true)
151 );
152 td3.appendChild(
153 button=document.createElement('input'),
154 button.setAttribute('type','button'),
155 button.setAttribute('value','[+]'),
156 button.setAttribute('id','btnAddTime'),
157 button.onclick=function(){
158 if($('#Time2').val() != ""){ timeValue = $('#Time2').val(); meas = "disabled"; meas2 = true; split(); }else{ alert("please enter value for time to add measurement"); }
159
160
161 }
162 );
163 var td=document.createElement('td');
164 td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
165 td.appendChild(
166 sourcecbo= document.createElement('select'),
167 sourcecbo.setAttribute('id','source2'),
168<?php
169 $source=mysql_query("SELECT*FROM source");
170 while($rowsource=mysql_fetch_array($source))
171 {
172?>
173 sourcecbo.appendChild(
174 option=document.createElement('option'),
175 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
176 option.setAttribute('selected',true),
177 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
178
179 ),
180<?php
181 }
182 ?>
183 sourcecbo.setAttribute('id','source2')
184
185 );
186 var td1=document.createElement('td');
187 td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
188 td1.appendChild(
189 measurementcbo= document.createElement('select'),
190 measurementcbo.setAttribute('id','measurement2'),
191<?php
192 $measure=mysql_query("SELECT*FROM measurement");
193 while($rowmeasure=mysql_fetch_array($measure))
194 {
195?>
196 measurementcbo.appendChild(
197 option=document.createElement('option'),
198 option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
199 option.setAttribute('selected',true),
200 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
201 ),
202<?php
203 }
204?>
205 measurementcbo.setAttribute('id','measurement2')
206 );
207 td1.appendChild(
208 button=document.createElement('input'),
209 button.setAttribute('type','button'),
210 button.setAttribute('value','[+]'),
211 button.setAttribute('id','btnAddTime'),
212 button.onclick=function(){
213 if($('#Time2').val() != ""){ timeValue = $('#Time2').val(); meas = "hidden"; meas2 = true; split(); }else{ alert("please enter value for time to add measurement"); }
214
215
216 }
217 );
218 var td2=document.createElement('td');
219 td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
220 td2.appendChild(
221 input = document.createElement('input'),
222 input.setAttribute('type','text'),
223 input.setAttribute('id','txtData2')
224
225 );
226 var td4=document.createElement('td');
227 td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
228 td4.appendChild(
229 button = document.createElement('input'),
230 button.setAttribute("type",'button'),
231 button.setAttribute('id','btnSplit'),
232 button.setAttribute('value','Split'),
233 button.onclick= function()
234 {
235 meas = "name"; meas2 = "time";
236 timeValue = "";
237 split();
238
239 }
240 );
241 td4.appendChild(
242 button=document.createElement('input'),
243 button.setAttribute('type','button'),
244 button.setAttribute('value','Delete'),
245 button.setAttribute('id','btnDelete'),
246 button.onclick=function(){
247 $('#table1').remove();
248
249 }
250 );
251
252 tr.appendChild(td3);
253 tr.appendChild(td1);
254 tr.appendChild(td);
255
256 tr.appendChild(td2);
257 tr.appendChild(td4);
258 table.appendChild(tr);
259 $('#TableH').append(table);
260 var meas;
261 var timeValue;
262
263 function split()
264 {
265 if(cnt <= 10){
266 cnt++;
267 var table = document.createElement("table");
268 table.setAttribute('id',"table"+cnt);
269 table.setAttribute('width','100%');
270 var tr = document.createElement('tr');
271 tr.setAttribute('id','');
272 tr.setAttribute('class','');
273
274 var td3=document.createElement('td');
275 td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
276 td3.setAttribute('class','first');
277
278 td3.appendChild(
279 input = document.createElement("input"),
280 input.setAttribute("type","time"),
281 input.setAttribute("id","Time"+cnt),
282 input.setAttribute("max","24"),
283 input.setAttribute("min","1"),
284 input.setAttribute("required",true),
285 input.setAttribute(meas,meas2),
286 input.setAttribute("value",timeValue)
287
288 );
289 td3.appendChild(
290 button=document.createElement('input'),
291 button.setAttribute('type','button'),
292 button.setAttribute('value','[+]'),
293 button.setAttribute('id','btnAddTime'),
294 button.setAttribute(meas,meas2),
295 button.onclick=function(){
296 if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); meas = "disabled"; meas2 = true; split1(); }else{ alert("please enter value for time to add measurement"); }
297
298
299 }
300 );
301
302 var td=document.createElement('td');
303 td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
304 td.appendChild(
305 sourcecbo= document.createElement('select'),
306 sourcecbo.setAttribute('id','source'+cnt),
307<?php
308 $source=mysql_query("SELECT*FROM source");
309 while($rowsource=mysql_fetch_array($source))
310 {
311?>
312 sourcecbo.appendChild(
313 option=document.createElement('option'),
314 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
315 option.setAttribute('selected',true),
316 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
317
318 ),
319<?php
320 }
321 ?>
322 sourcecbo.setAttribute('id','source'+cnt)
323
324 );
325 var td1=document.createElement('td');
326 td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
327 td1.appendChild(
328 measurementcbo= document.createElement('select'),
329 measurementcbo.setAttribute('id','measurement'+cnt),
330<?php
331 $measure=mysql_query("SELECT*FROM measurement");
332 while($rowmeasure=mysql_fetch_array($measure))
333 {
334?>
335 measurementcbo.appendChild(
336 option=document.createElement('option'),
337 option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
338 option.setAttribute('selected',true),
339 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
340 ),
341<?php
342 }
343?>
344 measurementcbo.setAttribute('id','measurement'+cnt)
345 );
346 td1.appendChild(
347 button=document.createElement('input'),
348 button.setAttribute('type','button'),
349 button.setAttribute('value','[+]'),
350 button.setAttribute('id','btnAddTime'),
351 button.onclick=function(){
352
353 if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); meas = "hidden"; meas2 = true; split1(); }else{ alert("please enter value for time to add measurement"); }
354
355
356 }
357 );
358
359 var td2=document.createElement('td');
360 td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
361 td2.appendChild(
362 input = document.createElement('input'),
363 input.setAttribute('type','text'),
364 input.setAttribute('id','txtData'+cnt)
365
366 );
367 var td4=document.createElement('td');
368 td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
369 td4.appendChild(
370 button = document.createElement('input'),
371 button.setAttribute("type",'button'),
372 button.setAttribute('id','btnSplit'),
373 button.setAttribute('value','Split'),
374 button.onclick=function(){
375 timeValue = "";
376 meas = "name"; meas2 = "time";
377 split();
378 }
379 );
380 td4.appendChild(
381 button=document.createElement('input'),
382 button.setAttribute('type','button'),
383 button.setAttribute('value','Delete'),
384 button.setAttribute('id','btnDelete'),
385 button.onclick=function(){
386 $('#table'+cnt).remove();
387 cnt--;
388 }
389 );
390
391 tr.appendChild(td3);
392 tr.appendChild(td1);
393 tr.appendChild(td);
394
395 tr.appendChild(td2);
396 tr.appendChild(td4);
397 table.appendChild(tr);
398 $('#TableH').append(table);
399 }else{
400
401 alert(" only 10 sources are allowed! ");
402
403 }
404
405 }
406 function split1()
407 {
408 if(cnt <= 10){
409 cnt++;
410 var table = document.createElement("table");
411 table.setAttribute('id',"table"+cnt);
412 table.setAttribute('width','100%');
413 var tr = document.createElement('tr');
414 tr.setAttribute('id','');
415 tr.setAttribute('class','');
416
417 var td3=document.createElement('td');
418 td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
419 td3.setAttribute('class','first');
420 td3.appendChild(
421 input = document.createElement("input"),
422 input.setAttribute("type","time"),
423 input.setAttribute("id","Time"+cnt),
424 input.setAttribute("max","24"),
425 input.setAttribute("min","1"),
426 input.setAttribute("required",true),
427 input.setAttribute(meas,meas2),
428 input.setAttribute("value",timeValue)
429 );
430 td3.appendChild(
431 button=document.createElement('input'),
432 button.setAttribute('type','button'),
433 button.setAttribute('value','[+]'),
434 button.setAttribute('id','btnAddTime'),
435 button.setAttribute(meas,meas2),
436 button.onclick=function(){
437 if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); meas = "disabled"; meas2 = true; split1(); }else{ alert("please enter value for time to add measurement"); }
438
439
440 }
441 );
442
443 var td=document.createElement('td');
444 td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
445 td.appendChild(
446 sourcecbo= document.createElement('select'),
447 sourcecbo.setAttribute('id','source'+cnt),
448<?php
449 $source=mysql_query("SELECT*FROM source");
450 while($rowsource=mysql_fetch_array($source))
451 {
452?>
453 sourcecbo.appendChild(
454 option=document.createElement('option'),
455 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
456 option.setAttribute('selected',true),
457 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
458
459 ),
460<?php
461 }
462 ?>
463 sourcecbo.setAttribute('id','source'+cnt)
464
465 );
466 var td1=document.createElement('td');
467 td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
468
469 td1.appendChild(
470 measurementcbo= document.createElement('select'),
471 measurementcbo.setAttribute('id','measurement'+cnt),
472<?php
473 $measure=mysql_query("SELECT*FROM measurement");
474 while($rowmeasure=mysql_fetch_array($measure))
475 {
476?>
477 measurementcbo.appendChild(
478 option=document.createElement('option'),
479 option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
480 option.setAttribute('selected',true),
481 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
482 ),
483<?php
484 }
485?>
486 measurementcbo.setAttribute('id','measurement'+cnt)
487 );
488 td1.appendChild(
489 button=document.createElement('input'),
490 button.setAttribute('type','button'),
491 button.setAttribute('value','[+]'),
492 button.setAttribute('id','btnAddTime'),
493 button.onclick=function(){
494
495 if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); meas = "hidden"; meas2 = true; split1(); }else{ alert("please enter value for time to add measurement"); }
496
497
498 }
499 );
500
501 var td2=document.createElement('td');
502 td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
503 td2.appendChild(
504 input = document.createElement('input'),
505 input.setAttribute('type','text'),
506 input.setAttribute('id','txtData'+cnt)
507
508 );
509 var td4=document.createElement('td');
510 td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
511 td4.appendChild(
512 button = document.createElement('input'),
513 button.setAttribute("type",'button'),
514 button.setAttribute('id','btnSplit'),
515 button.setAttribute('value','Split'),
516 button.onclick=function(){
517 timeValue = "";
518 meas = "name"; meas2 = "time";
519 split1();
520 }
521 );
522 td4.appendChild(
523 button=document.createElement('input'),
524 button.setAttribute('type','button'),
525 button.setAttribute('value','Delete'),
526 button.setAttribute('id','btnDelete'),
527 button.onclick=function(){
528 $('#table'+cnt).remove();
529 cnt--;
530 });
531
532 tr.appendChild(td3);
533 tr.appendChild(td1);
534 tr.appendChild(td);
535
536 tr.appendChild(td2);
537 tr.appendChild(td4);
538 table.appendChild(tr);
539 $('#TableH1').append(table);
540 }else{
541
542 alert(" only 10 sources are allowed! ");
543 }
544 }
545
546 });
547 </script>
Note: See TracBrowser for help on using the repository browser.