source: schedule/Module/control.php@ 17555

Last change on this file since 17555 was 17555, checked in by tose, 11 years ago
Modifications on the disabling/enabling of controls
File size: 32.4 KB
Line 
1<script>
2'use strict';
3var ctr;
4var transPrevNight = 1;
5
6 function clearNode(node){
7 var child = node.childNodes[0];
8 while(child != null)
9 {
10 node.removeChild(child);
11 child = node.childNodes[0];
12 }
13 }
14
15 function addRow(table){
16 var targetView = table;
17 var cctr=$('.dataTable tr').length;
18 ctr=cctr+1;
19 var input_data;
20 var select;
21 var option;
22 var selection;
23 // CREATE ELEMENT
24 var newtr = document.createElement("tr");
25 newtr.setAttribute("class","tr");
26 newtr.setAttribute("width", "100%");
27 var newtd_c1 = document.createElement("td");
28 //newtd_c1.setAttribute("width","120");
29 newtd_c1.setAttribute("align","center");
30 newtd_c1.appendChild(
31 input_data = document.createElement("input"),
32 input_data.setAttribute("type","time"),
33 input_data.setAttribute("size","10"),
34 input_data.setAttribute("autofocus","true"),
35 input_data.setAttribute("hidden","true")
36 );
37 var newtd_c2 = document.createElement("td");
38 newtd_c2.setAttribute("width","20%");
39 newtd_c2.setAttribute("align","center");
40 newtd_c2.appendChild(
41 select = document.createElement("select"),
42 select.setAttribute("style", "width=100px"),
43 select.setAttribute("class","measure"),
44 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
45 type:"post",
46 url:"Transaction/measurement.php",
47 success:function(data){
48 var obj=$.parseJSON(data);
49 $.each(obj,function(){
50 select.appendChild(
51 option = document.createElement("option"),
52 option.setAttribute('value',this['fMeasurementKey']),
53 option.appendChild(document.createTextNode(this['fMeasurement']))
54 )
55 })
56 }
57 }) // End of retrieving
58 );
59 newtd_c2.setAttribute("align","center");
60 newtd_c2.appendChild(
61 input_data = document.createElement("input"),
62 input_data.setAttribute("type","button"),
63 input_data.setAttribute("value","+"),
64 input_data.onclick = function(){ return addRow(newtr);
65 ctr++;
66 }
67 );
68 var newtd_c3 = document.createElement("td");
69 newtd_c3.setAttribute("width","20%");
70 newtd_c3.setAttribute("align","center");
71 newtd_c3.appendChild(
72 selection = document.createElement("select"),
73 selection.setAttribute("style", "width=100px"),
74 selection.setAttribute("class","source"),
75 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
76 type:"post",
77 url:"Transaction/source.php",
78 success:function(data)
79 {
80 var obj = $.parseJSON(data);
81 selection.appendChild(
82 option = document.createElement('option'),
83 option.setAttribute('value', 0),
84 option.appendChild(document.createTextNode("---"))
85 );
86 $.each(obj,function(){
87 selection.appendChild(
88 option=document.createElement('option'),
89 option.setAttribute('value',this['fSourceKEY']),
90 option.appendChild(document.createTextNode(this['fSourceName']))
91 )
92 });
93 }
94 }) // End of retrieving
95 );
96 var newtd_c4 = document.createElement("td");
97 newtd_c4.setAttribute("width","50%");
98 newtd_c4.setAttribute("align","center");
99 newtd_c4.appendChild(
100 input_data = document.createElement("input"),
101 input_data.setAttribute("type","text"),
102 input_data.setAttribute("class","selected"),
103 input_data.setAttribute("size","50"),
104 input_data.setAttribute("placeholder","Value")
105 );
106 var newtd_c5 = document.createElement("td");
107 newtd_c5.setAttribute("align","center");
108 newtd_c5.setAttribute("width", "10%");
109 newtd_c5.appendChild(
110 input_data = document.createElement("input"),
111 input_data.setAttribute("type","button"),
112 input_data.setAttribute("value","Delete"),
113 input_data.onclick = function(){ return clearNode(newtr); }
114 );
115
116 newtr.appendChild(newtd_c2);
117 newtr.appendChild(newtd_c3);
118 newtr.appendChild(newtd_c4);
119 newtr.appendChild(newtd_c5);
120
121 $(targetView).after(newtr);
122 }
123<?php
124$cnt=0;
125$pastdate = 'false';
126$day=0;
127if(isset($_GET['days']))
128{
129 $day = $_GET['days'];
130?> addRowClone(); <?php
131}
132else
133{
134 $day =date("Y-m-d");
135}
136if(isset($_GET['prev']))
137{
138 $prevday = $_GET['prev'];
139}
140else
141{
142 $prevday = 'false';
143}
144
145/*$prev = mysql_query("SELECT date(fStart) AS PrevDate FROM schedule WHERE (date(fStart) < '2014-01-26') ORDER BY date(fStart) DESC LIMIT 1");
146$prevnight = mysql_fetch_array($prev);
147 if(mysql_num_rows($prevnight) > 0) {
148 $prevday = date('Y-m-d', $prevnight['PrevDate']);
149 } else {
150 $prevday = date ('Y-m-d');
151 }
152$prevday = date('Y-m-d', strtotime($day .' -1 day'));
153$prev_time = array();*/
154?>
155
156function addRowCloneNew(nextrow){
157 var targetView = document.getElementById("Data");
158targetView.setAttribute("width", "100%");
159 // CREATE ELEMENT
160 // COUNT LIST
161 var list = $(".datalisting").length;
162 var newlist = list+1;
163 var cctr=$('.dataTable tr').length;
164 ctr=cctr+1;
165 var input_data;
166 var select;
167 var option;
168 var selection;
169 var newdiv = document.createElement("div");
170 newdiv.setAttribute("id","list_"+newlist);
171 newdiv.setAttribute("class","datalisting");
172 newdiv.setAttribute("style","margin:5px 0;");
173 newdiv.setAttribute("width", "100%");
174 var newtable = document.createElement("table");
175 newtable.setAttribute("class","dataTable");
176 newtable.setAttribute("width","100%");
177 newtable.setAttribute("border","1");
178 newtable.setAttribute("cellspacing","0");
179 newtable.setAttribute("cellpadding","0");
180 var newInnertable = document.createElement("table");
181 newInnertable.setAttribute("class","dataTable");
182 newInnertable.setAttribute("width","100%");
183 newInnertable.setAttribute("border","1");
184 newInnertable.setAttribute("cellspacing","0");
185 newInnertable.setAttribute("cellpadding","0");
186
187 var newtr = document.createElement("tr");
188 newtr.setAttribute('class','tr');
189 newtr.setAttribute("width", "100%");
190 var newtd_c1 = document.createElement("td");
191 newtd_c1.setAttribute("width","15%");
192 newtd_c1.setAttribute("align","center");
193 newtd_c1.setAttribute("valign", "top");
194 newtd_c1.appendChild(
195 input_data = document.createElement("input"),
196 input_data.setAttribute("type","time"),
197 input_data.setAttribute("class","time"),
198 //input_data.setAttribute("width", "50%"),
199 input_data.setAttribute("size","5"),
200 input_data.setAttribute("autofocus","true")
201 );
202 newtd_c1.appendChild(
203 input_data = document.createElement("input"),
204 input_data.setAttribute("type","button"),
205 input_data.setAttribute("value","+"),
206 input_data.onclick = function(){
207 addRowCloneNew("list_"+newlist);
208 }
209 );
210 var newtd_c2 = document.createElement("td");
211
212 newtd_c2.setAttribute("width","20%");
213 newtd_c2.setAttribute("align","center");
214 newtd_c2.appendChild(
215 select = document.createElement("select"),
216 select.setAttribute("class","measure"),
217 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
218 type:"post",
219 url:"Transaction/measurement.php",
220 success:function(data){
221 var obj=$.parseJSON(data);
222 $.each(obj,function(){
223 select.appendChild(
224 option = document.createElement("option"),
225 option.setAttribute('value',this['fMeasurementKey']),
226 option.appendChild(document.createTextNode(this['fMeasurement']))
227 )
228 })
229
230 }
231 }) // End of retrieving
232
233 );
234 newtd_c2.appendChild(
235 input_data = document.createElement("input"),
236 input_data.setAttribute("type","button"),
237 input_data.setAttribute("value","+"),
238 input_data.onclick = function(){
239 return addRow(newtr);
240 ctr++;
241 });
242 var newtd_c3 = document.createElement("td");
243 newtd_c3.setAttribute("width","20%");
244 newtd_c3.setAttribute("align","center");
245 newtd_c3.appendChild(
246 selection = document.createElement("select"),
247 selection.setAttribute("class","source"),
248 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
249 type:"post",
250 url:"Transaction/source.php",
251 success:function(data)
252 {
253 var obj = $.parseJSON(data);
254 selection.appendChild(
255 option = document.createElement('option'),
256 option.setAttribute('value', 0),
257 option.appendChild(document.createTextNode("---"))
258 );
259 $.each(obj,function(){
260 selection.appendChild(
261 option=document.createElement('option'),
262 option.setAttribute('value',this['fSourceKEY']),
263 option.appendChild(document.createTextNode(this['fSourceName']))
264 )
265 });
266 }
267 }) // End of retrieving
268 );
269 var newtd_c4 = document.createElement("td");
270 newtd_c4.setAttribute("width","50%");
271 newtd_c4.setAttribute("align","center");
272 newtd_c4.appendChild(
273 input_data = document.createElement("input"),
274 input_data.setAttribute("type","text"),
275 input_data.setAttribute("class","selected"),
276 //input_data.setAttribute("width", "100%"),
277 input_data.setAttribute("size","50"),
278 input_data.setAttribute("placeholder","Value")
279 );
280 var newtd_c5 = document.createElement("td");
281 newtd_c5.setAttribute("width", "10%");
282 newtd_c5.setAttribute("align","center");
283 newtd_c5.appendChild(
284 input_data = document.createElement("input"),
285 input_data.setAttribute("type","button"),
286 input_data.setAttribute("value","Delete"),
287 input_data.onclick = function(){ return clearNode(newtr);
288 }
289 );
290 newtr.appendChild(newtd_c2);
291 newtr.appendChild(newtd_c3);
292 newtr.appendChild(newtd_c4);
293 newtr.appendChild(newtd_c5);
294 newInnertable.appendChild(newtr);
295 var newtd_c6 = document.createElement("td");
296 newtd_c6.appendChild(newInnertable);
297
298 var newtd_c7 = document.createElement("td");
299 newtd_c7.setAttribute("width", "10%");
300 newtd_c7.setAttribute("align","center");
301 newtd_c7.setAttribute("valign", "top");
302 newtd_c7.appendChild(
303 input_data = document.createElement("input"),
304 input_data.setAttribute("type","button"),
305 input_data.setAttribute("value","Delete Main"),
306 input_data.onclick = function(){ return clearNode(newdiv); }
307 );
308
309 var newOutertr = document.createElement("tr");
310
311 newtable.appendChild(newtd_c1);
312 newtable.appendChild(newtd_c6);
313 newtable.appendChild(newtd_c7);
314
315 newdiv.appendChild(newtable);
316 if(nextrow != null){
317 var doc = document.getElementById(nextrow);
318 $(doc).after(newdiv);
319 }else{
320 targetView.appendChild(newdiv);
321 }
322}
323
324function addRowClone(nextrow){
325<?php
326$fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) = '$day' ORDER BY fScheduleID ASC, fMeasurementID ASC") or die(mysql_error());
327$observationsTime = mysql_query("SELECT DISTINCT fStart FROM schedule WHERE date(fStart) = '$day' ORDER BY fScheduleID ASC");
328$cnt3=0;
329$cnt2=0;
330$cnt4 = 0;
331$cnt5 = 0;
332$cnt = 0;
333$cntrow = 0;
334$pastdate = 'false';
335$pasttime = 'true';
336date_default_timezone_set("UTC");
337 while($times = mysql_fetch_array($observationsTime))
338 {
339 $timestamp=strtotime($times['fStart']);
340 $testdate = date('Y-m-d H:i:s', $times['fStart']);
341 $testing = date('Y-m-d H:i', $timestamp);
342 $curSchedId = $times['fScheduleID'];
343 $actualtime = date('Y-m-d H:i:s', $timestamp);
344 if($prevday == 'false') {
345 if(strtotime(date('Y-m-d H:i', $timestamp)) < strtotime(date('Y-m-d H:i', time()))) {
346 $pastdate = 'true';
347 }
348 else {
349 $pastdate = 'false';
350 }
351 }
352
353 if(strtotime(date('Y-m-d', $timestamp)) == strtotime(date('Y-m-d', time()))) {
354 $fetch_next = mysql_query("SELECT DISTINCT fStart FROM schedule WHERE (fStart > '$testing' AND date(fStart) = '$day') ORDER BY fScheduleID ASC LIMIT 1");
355 $next_data = mysql_fetch_array($fetch_next);
356 if ($pasttime == 'true') {
357 if (mysql_num_rows($fetch_next) > 0) {
358 $next_date = strtotime($next_data['fStart']);
359 $test = date('H:i', $next_date);
360 if(strtotime(date('H:i', $next_date)) < strtotime(date('H:i', time()))) {
361 $pasttime = 'true';
362 } else {
363 $pasttime = 'false';
364 }
365 } else {
366 $pasttime = 'false';
367 }
368 }
369 if((strtotime(date('Hi', $timestamp)) >= strtotime('0000')) && (strtotime(date('Hi', $timestamp)) <= strtotime('0800'))) {
370 $pastdate = 'false';
371 }
372 }
373 else {
374 $pasttime = 'false';
375 }
376
377 $date_time = date('H:i', $timestamp);
378 $prev_time[$cnt3]= $date_time;
379
380 ?>
381
382 $('#save').attr('value','UPDATE');
383 var targetView = document.getElementById("Data");
384 // CREATE ELEMENT
385 // COUNT LIST
386 var list = $(".datalisting").length;
387 var newlist = list+1;
388 <?php $cnt++;?>
389
390 var cctr=$('.dataTable tr').length;
391 ctr=cctr+1;
392 var select;
393 var input_data;
394 var option;
395 var selection;
396
397 var newdiv<?php echo $cnt; ?> = document.createElement("div");
398 newdiv<?php echo $cnt; ?>.setAttribute("id", "list_<?php echo $cnt; ?>");
399 newdiv<?php echo $cnt; ?>.setAttribute("class","datalisting");
400 newdiv<?php echo $cnt; ?>.setAttribute("style","margin:5px 0;");
401
402 var newtable = document.createElement("table");
403 newtable.setAttribute("class","dataTable");
404 newtable.setAttribute("width","100%");
405 newtable.setAttribute("border","1");
406 newtable.setAttribute("cellspacing","0");
407 newtable.setAttribute("cellpadding","0");
408
409
410 var newInnertable = document.createElement("table");
411 newInnertable.setAttribute("class","dataTable");
412 newInnertable.setAttribute("width","100%");
413 newInnertable.setAttribute("border","1");
414
415 newInnertable.setAttribute("cellspacing","0");
416 newInnertable.setAttribute("cellpadding","0");
417
418 var newtd_c1 = document.createElement("td");
419 newtd_c1.setAttribute("width","15%");
420 newtd_c1.setAttribute("align","center");
421 newtd_c1.setAttribute("valign", "top");
422 <?php if ($pastdate == 'true') { ?>
423 newtd_c1.appendChild(
424 input_data = document.createElement("input"),
425 input_data.setAttribute("type","time"),
426 input_data.setAttribute("class","time"),
427 input_data.setAttribute("size","5"),
428 input_data.setAttribute("value","<?php echo $date_time; ?>"),
429 input_data.setAttribute("autofocus","true"),
430 input_data.setAttribute("disabled", "disabled")
431 );
432 <?php } else { ?>
433 newtd_c1.appendChild(
434 input_data = document.createElement("input"),
435 input_data.setAttribute("type","time"),
436 input_data.setAttribute("class","time"),
437 input_data.setAttribute("size","5"),
438 input_data.setAttribute("value","<?php echo $date_time; ?>"),
439 input_data.setAttribute("autofocus","true")
440 );
441 <?php }
442 if($pasttime == 'true') { ?>
443 newtd_c1.appendChild(
444 input_data = document.createElement("input"),
445 input_data.setAttribute("type","button"),
446 input_data.setAttribute("value","+"),
447 input_data.setAttribute("disabled", "disabled"),
448 input_data.onclick = function(){
449 addRowCloneNew("list_<?php echo $cnt; ?>");
450 }
451 );
452 <?php } else { if ($pastdate == 'true') { ?>
453 newtd_c1.appendChild(
454 input_data = document.createElement("input"),
455 input_data.setAttribute("type","button"),
456 input_data.setAttribute("value","+"),
457 input_data.setAttribute("disabled", "disabled"),
458 input_data.onclick = function(){
459 addRowCloneNew("list_<?php echo $cnt; ?>");
460 }
461 );
462 <?php } else { ?>
463 newtd_c1.appendChild(
464 input_data = document.createElement("input"),
465 input_data.setAttribute("type","button"),
466 input_data.setAttribute("value","+"),
467 input_data.onclick = function(){
468 addRowCloneNew("list_<?php echo $cnt; ?>");
469 }
470 );
471 <?php }}
472 $observations = mysql_query("SELECT * FROM schedule WHERE fStart = '$actualtime'");
473
474 while($rows = mysql_fetch_array($observations))
475 {
476 $cntrow++;
477 ?>
478
479 var newtr<?php echo $cntrow; ?> = document.createElement("tr");
480 newtr<?php echo $cntrow; ?>.setAttribute('class','tr');
481
482 <?php if ($pastdate == 'true') { ?>
483 var newtd_c2 = document.createElement("td");
484 newtd_c2.setAttribute("width","20%");
485 newtd_c2.setAttribute("align","center");
486 <?php
487 $cur_measurement = $rows[fMeasurementTypeKey];
488 $selectm = mysql_query("SELECT * FROM measurement WHERE fMeasurementKey = '$cur_measurement'");
489 $rowmeasure = mysql_fetch_array($selectm);
490 ?>
491 newtd_c2.appendChild(
492 selection = document.createElement("select"),
493 selection.appendChild(
494 option = document.createElement("option"),
495 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>")),
496 option.setAttribute("value", "<?php echo $rowmeasure['fMeasurementKey']; ?>"),
497 option.setAttribute('selected', true)
498 ),
499 selection.setAttribute('id', 'measure'),
500 selection.setAttribute('class','measure'),
501 selection.setAttribute('disabled', 'disabled'),
502 selection.setAttribute("style", "width:100px")
503 );
504 newtd_c2.appendChild(
505 input_data = document.createElement("input"),
506 input_data.setAttribute("type","button"),
507 input_data.setAttribute("value","+"),
508 input_data.setAttribute("disabled", "disabled"),
509 input_data.onclick = function(){
510 return addRow(newtr<?php echo $cntrow; ?>);
511 ctr++;
512 });
513
514 var newtd_c3 = document.createElement("td");
515 newtd_c3.setAttribute("width","20%");
516 newtd_c3.setAttribute("align","center");
517 <?php
518 $cur_source = $rows['fSourceKey'];
519 $select = mysql_query("SELECT * FROM source WHERE fSourceKey = '$cur_source'");
520 if(mysql_num_rows($select)<1) {
521 $sourcename = '---';
522 $sourcekey = 0;
523 }
524 else {
525 $rowsource = mysql_fetch_array($select);
526 $sourcename = $rowsource['fSourceName'];
527 $sourcekey = $rowsource['fSourceKey'];
528 }?>
529 newtd_c3.appendChild(
530 selection = document.createElement("select"),
531 selection.appendChild(
532 option = document.createElement("option"),
533 option.appendChild(document.createTextNode("<?php echo $sourcename; ?>")),
534 option.setAttribute("value", "<?php echo $sourcekey; ?>"),
535 option.setAttribute('selected', true)
536 ),
537 selection.setAttribute('id', 'source'),
538 selection.setAttribute('class','source'),
539 selection.setAttribute('disabled', 'disabled'),
540 selection.setAttribute("style", "width:120px")
541
542 );
543
544 var newtd_c4 = document.createElement("td");
545 newtd_c4.setAttribute("width","50%");
546 newtd_c4.setAttribute("align","center");
547 newtd_c4.appendChild(
548 input_data = document.createElement("input"),
549 input_data.setAttribute("type","text"),
550 input_data.setAttribute("class","selected"),
551 input_data.setAttribute("size","50"),
552 input_data.setAttribute("value","<?php echo $rows['fData']; ?>"),
553 input_data.setAttribute("placeholder","Value"),
554 input_data.setAttribute("disabled", "disabled")
555 );
556
557 var newtd_c5 = document.createElement("td");
558 newtd_c5.setAttribute("width", "10%");
559 newtd_c5.setAttribute("align","center");
560 newtd_c5.appendChild(
561 input_data = document.createElement("input"),
562 input_data.setAttribute("type","button"),
563 input_data.setAttribute("value","Delete"),
564 input_data.setAttribute("disabled", "disabled"),
565 input_data.onclick = function(){
566 return clearNode(newtr<?php echo $cntrow; ?>);
567 }
568 );
569 <?php } else { ?>
570 var newtd_c2 = document.createElement("td");
571 newtd_c2.setAttribute("width","20%");
572 newtd_c2.setAttribute("align","center");
573 newtd_c2.appendChild(
574 selection = document.createElement("select"),
575 <?php
576 $selectm = mysql_query("SELECT * FROM measurement");
577 while($rowmeasure = mysql_fetch_array($selectm))
578 {
579 ?>
580 selection.appendChild(
581 option = document.createElement("option"),
582 option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),
583 <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} ?>
584 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
585 ),
586 <?php
587 }
588 ?>
589 selection.setAttribute('id','measure'),
590 selection.setAttribute('class','measure'),
591 selection.setAttribute("style", "width=100px")
592 );
593 newtd_c2.appendChild(
594 input_data = document.createElement("input"),
595 input_data.setAttribute("type","button"),
596 input_data.setAttribute("value","+"),
597 input_data.onclick = function(){
598 return addRow(newtr<?php echo $cntrow; ?>);
599 ctr++;
600 });
601
602 var newtd_c3 = document.createElement("td");
603 newtd_c3.setAttribute("width","20%");
604 newtd_c3.setAttribute("align","center");
605 newtd_c3.appendChild(
606 selection = document.createElement("select"),
607 selection.appendChild(
608 option = document.createElement("option"),
609 option.setAttribute('value', 0),
610 <?php
611 if($rows['fSourceKey'] == 0) { echo "option.setAttribute('selected', true),"; }?>
612 option.appendChild(document.createTextNode("---"))),
613 <?php
614 $select = mysql_query("SELECT * FROM source");
615
616 while($rowsource = mysql_fetch_array($select))
617 {
618 ?>
619 selection.appendChild(
620 option = document.createElement("option"),
621 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
622 <?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){
623 echo "option.setAttribute('selected',true),";
624 }?>
625 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
626 ),
627 <?php
628 }
629 ?>
630 selection.setAttribute('id','source'), // End of retrieving
631 selection.setAttribute('class','source'),
632 selection.setAttribute("style", "width=100px")// End of retrieving
633 );
634
635 var newtd_c4 = document.createElement("td");
636 newtd_c4.setAttribute("width","50%");
637 newtd_c4.setAttribute("align","center");
638 newtd_c4.appendChild(
639 input_data = document.createElement("input"),
640 input_data.setAttribute("type","text"),
641 input_data.setAttribute("class","selected"),
642 input_data.setAttribute("size","50"),
643 input_data.setAttribute("value","<?php echo $rows['fData']; ?>"),
644 input_data.setAttribute("placeholder","Value")
645 );
646
647 var newtd_c5 = document.createElement("td");
648 newtd_c5.setAttribute("width", "10%");
649 newtd_c5.setAttribute("align","center");
650 newtd_c5.appendChild(
651 input_data = document.createElement("input"),
652 input_data.setAttribute("type","button"),
653 input_data.setAttribute("value","Delete"),
654 input_data.onclick = function(){ return clearNode(newtr<?php echo $cntrow; ?>);
655
656 }
657 );
658 <?php } ?>
659 newtr<?php echo $cntrow; ?>.appendChild(newtd_c2);
660 newtr<?php echo $cntrow; ?>.appendChild(newtd_c3);
661 newtr<?php echo $cntrow; ?>.appendChild(newtd_c4);
662 newtr<?php echo $cntrow; ?>.appendChild(newtd_c5);
663 newInnertable.appendChild(newtr<?php echo $cntrow; ?>);
664
665 <?php
666
667 $prevtimestamp = $timestamp;
668 }
669 ?>
670
671 var newtd_c6 = document.createElement("td");
672 newtd_c6.appendChild(newInnertable);
673
674 var newtd_c7 = document.createElement("td");
675 newtd_c7.setAttribute("width", "10%");
676 newtd_c7.setAttribute("align","center");
677 newtd_c7.setAttribute("valign", "top");
678 <?php if ($pastdate == 'true') { ?>
679 newtd_c7.appendChild(
680 input_data = document.createElement("input"),
681 input_data.setAttribute("type","button"),
682 input_data.setAttribute("value","Delete Main"),
683 input_data.setAttribute("disabled", "disabled"),
684 input_data.onclick = function(){ return clearNode(newdiv<?php echo $cnt; ?>); }
685 );
686 <?php } else { ?>
687 newtd_c7.appendChild(
688 input_data = document.createElement("input"),
689 input_data.setAttribute("type","button"),
690 input_data.setAttribute("value","Delete Main"),
691 input_data.onclick = function(){ return clearNode(newdiv<?php echo $cnt; ?>); }
692 );
693 <?php } ?>
694
695 var newOutertr = document.createElement("tr");
696
697 newtable.appendChild(newtd_c1);
698 newtable.appendChild(newtd_c6);
699 newtable.appendChild(newtd_c7);
700
701 newdiv<?php echo $cnt; ?>.appendChild(newtable);
702 if(nextrow != null){
703 var doc = document.getElementById(nextrow);
704 $(doc).after(newdiv<?php echo $cnt;?>);
705 }else{
706 targetView.appendChild(newdiv<?php echo $cnt;?>);
707 }
708 <?php
709}
710if(mysql_num_rows($fetch)<1)
711{
712 if(strtotime(Date('Y-m-d', strtotime($day))) >= strtotime(Date('Y-m-d'))) {
713?>
714 $('#save').attr('value','SAVE');
715 addRowCloneNew();
716 $('#LoadPrev').removeAttr("disabled");
717 $('#save').removeAttr("disabled");
718<?php
719 }
720 else {?>
721 $('#LoadPrev').attr('disabled', 'disabled');
722 $('#save').attr('disabled', 'disabled');
723<?php }
724}
725?>
726}
727</script>
728
Note: See TracBrowser for help on using the repository browser.