Changeset 16816 for schedule/function
- Timestamp:
- 06/12/13 18:32:34 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/function/SplitDelete.php
r16738 r16816 1 1 <script type="text/javascript"> 2 2 $(document).ready(function(){ 3 3 var name=''; 4 var value=''; 4 5 var timeValue; 5 6 var meas; 6 7 var meas2; 7 8 var getTableId; 9 var is=0; 8 10 window.cnt=0; 9 11 … … 79 81 button.setAttribute('value','[+]'), 80 82 button.setAttribute('id','btnAddTime'), 81 button.onclick=function(){ 82 83 84 85 if($('#Time1').val() != ""){ var splitting = $('#Time1').val().split(':'); var add = 01; 83 button.setAttribute('name','table'+cnt), 84 button.onclick=function(){ 85 86 87 88 if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 01; 86 89 87 90 timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; 88 91 89 92 function pad(number, length) { 90 93 … … 97 100 98 101 } 99 100 meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); } 102 var s = 0; var get; 103 var nn; 104 nn = $(this).attr('name'); 105 $("table").each(function() { 106 if($(this).attr("name")==nn){ 107 108 get = "#"+$(this).attr("id"); 109 //get = $(this).attr("name"); 110 s =1; 111 }else{ 112 if(s==0){ 113 get = '#table'+cnt; 114 } 115 } 116 }); 117 118 119 120 getTableId =get; 121 122 123 name="name"; value=""; meas = "name"; meas2 = "time"; //getTableId = $(this).attr('name'); 124 split1(); }else{ alert("please enter value for time to add measurement"); } 101 125 102 126 … … 157 181 button.setAttribute('type','button'), 158 182 button.setAttribute('value','[+]'), 159 button.setAttribute('id','btnAddTime'), 160 button.onclick=function(){ 161 if($('#Time1').val() != ""){ timeValue = $('#Time1').val(); meas = "hidden"; meas2 = true; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); } 183 button.setAttribute('id','btnAddTime'+cnt), 184 button.setAttribute('name','table'+cnt), 185 button.onclick=function(){ 186 if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); name="name"; value=$(this).attr('name'); meas = "hidden"; meas2 = true; is=1; getTableId = $(this).attr('name'); split1(); }else{ alert("please enter value for time to add measurement"); } 162 187 163 188 … … 181 206 button.setAttribute('id','btnSplit'), 182 207 button.setAttribute('value','Split'), 208 button.setAttribute('name','#table'+cnt), 183 209 button.onclick= function() 184 210 { 185 211 186 if($('#Time1').val() != ""){ var splitting = $('#Time1').val().split(':'); var add = 30; 187 188 212 if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 30; 213 214 215 var limit = 60; 216 var adds =0; 217 adds = (Number(splitting[1]) + Number(add)); 218 if(adds >= limit){ 219 adds = Number(adds) - Number(limit); 220 timeValue =pad(Number(splitting[0])+1,2)+':'+ pad(adds,2); 221 222 }else{ 223 189 224 timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2); 190 225 } 191 226 function pad(number, length) { 192 227 … … 199 234 200 235 }; 201 202 meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); } 236 237 238 name="name"; value=""; 239 meas = "name"; meas2 = "time"; 240 getTableId = $(this).attr('name'); 241 split1(); 242 }else{ alert("please enter value for time to add measurement"); } 203 243 204 244 … … 253 293 button.setAttribute('value','[+]'), 254 294 button.setAttribute('id','btnAddTime'), 255 button.onclick=function(){ 256 if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 01; 295 button.setAttribute('name','#table2'), 296 button.onclick=function(){ 297 if($('#Time1').val() != ""){ var splitting = $('#Time1').val().split(':'); var add = 01; 257 298 258 299 timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; … … 267 308 return str; 268 309 269 }; meas = "name"; meas2 = "time"; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); } 310 }; 311 312 var s = 0; var get; 313 314 $("table").each(function() { 315 if($(this).attr("name")=='table2'){ 316 get = "#"+$(this).attr("id"); 317 318 s =1; 319 }else{ 320 if(s==0){ 321 get = '#table'+cnt; 322 } 323 } 324 }); 325 getTableId =get; 326 name="name"; value=""; 327 name="name"; value=""; meas = "class"; meas2 = "time"; //getTableId = $(this).attr('name'); 328 split2(); }else{ alert("please enter value for time to add measurement"); } 270 329 271 330 … … 321 380 button.setAttribute('value','[+]'), 322 381 button.setAttribute('id','btnAddTime'), 323 button.onclick=function(){ 324 if($('#Time2').val() != ""){ timeValue = $('#Time2').val(); meas = "hidden"; meas2 = true; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); } 382 button.setAttribute('name','#table2'), 383 button.onclick=function(){ 384 if($('#Time1').val() != ""){ timeValue = $('#Time1').val(); name="name"; value="table2"; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); } 325 385 326 386 … … 342 402 button.setAttribute('id','btnSplit'), 343 403 button.setAttribute('value','Split'), 404 button.setAttribute('name','#table2'), 344 405 button.onclick= function() 345 406 { 346 if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 30; 347 407 if($('#Time1').val() != ""){ var splitting = $('#Time1').val().split(':'); var add = 30; var limit = 60; 408 var adds =0; 409 adds = (Number(splitting[1]) + Number(add)); 410 if(adds >= limit){ 411 adds = Number(adds) - Number(limit); 412 timeValue =pad(Number(splitting[0])+1,2)+':'+ pad(adds,2); 413 414 }else{ 415 348 416 timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2); 349 417 } 350 418 function pad(number, length) { 351 419 … … 358 426 359 427 } 360 361 meas = "name"; meas2 = "time"; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); } 428 429 meas = "name"; meas2 = "time"; getTableId = $(this).attr('name'); 430 split2(); }else{ alert("please enter value for time to add measurement"); } 362 431 363 432 } … … 405 474 button.setAttribute('value','[+]'), 406 475 button.setAttribute('id','btnAddTime'), 476 button.setAttribute('name','#table1'), 407 477 button.onclick=function(){ 408 478 if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 01; … … 419 489 return str; 420 490 421 }; meas = "name"; meas2 = "time"; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); } 491 }; 492 493 494 var s = 0; var get; 495 496 $("table").each(function() { 497 if($(this).attr("name")=='table1'){ 498 get = "#"+$(this).attr("id"); 499 500 s =1; 501 }else{ 502 if(s==0){ 503 get = '#table'+cnt; 504 } 505 } 506 }); 507 getTableId =get; 508 509 510 name="name"; value=""; meas = "class"; meas2 = "time"; //getTableId = $(this).attr('name'); 511 split2(); }else{ alert("please enter value for time to add measurement"); } 422 512 423 513 … … 473 563 button.setAttribute('value','[+]'), 474 564 button.setAttribute('id','btnAddTime'), 475 button.onclick=function(){ 476 if($('#Time2').val() != ""){ timeValue = $('#Time2').val(); meas = "hidden"; meas2 = true; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); } 565 button.setAttribute('name','#table1'), 566 button.onclick=function(){ 567 if($('#Time2').val() != ""){ timeValue = $('#Time2').val(); name="name"; value="table1"; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); } 477 568 478 569 … … 494 585 button.setAttribute('id','btnSplit'), 495 586 button.setAttribute('value','Split'), 587 button.setAttribute('name','#table1'), 496 588 button.onclick= function() 497 589 { 498 590 if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 30; 499 591 592 var limit = 60; 593 var adds =0; 594 adds = (Number(splitting[1]) + Number(add)); 595 if(adds >= limit){ 596 adds = Number(adds) - Number(limit); 597 timeValue =pad(Number(splitting[0])+1,2)+':'+ pad(adds,2); 598 599 }else{ 600 500 601 timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2); 501 602 } 502 603 function pad(number, length) { 503 604 … … 511 612 } 512 613 513 meas = "name"; meas2 = "time"; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); } 614 615 name="name"; value=""; 616 617 meas = "class"; meas2 = "time"; 618 619 getTableId = $(this).attr('name'); 620 split2(); }else{ alert("please enter value for time to add measurement"); } 514 621 515 622 } … … 539 646 } 540 647 var meas; 541 542 648 var timeValue; 649 var pad; 543 650 if(cnt==0){ cnt=2; } 544 function split ()651 function split2() 545 652 { 546 653 … … 549 656 table.setAttribute('id',"table"+cnt); 550 657 table.setAttribute('width','100%'); 658 table.setAttribute(name,value); 551 659 var tr = document.createElement('tr'); 552 660 tr.setAttribute('id',''); … … 566 674 input.setAttribute(meas,meas2), 567 675 input.setAttribute("value",timeValue) 676 568 677 569 678 ); … … 574 683 button.setAttribute('id','btnAddTime'), 575 684 button.setAttribute(meas,meas2), 685 button.setAttribute('name','table'+cnt), 686 576 687 button.onclick=function(){ 577 688 if($('#Time'+cnt).val() != ""){var splitting = $('#Time'+cnt).val().split(':'); var add = 01; … … 588 699 return str; 589 700 590 } meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); } 701 } 702 703 var s = 0; var get; 704 var nn; 705 nn = $(this).attr('name'); 706 $("table").each(function() { 707 if($(this).attr("name")==nn){ 708 709 get = "#"+$(this).attr("id"); 710 //get = $(this).attr("name"); 711 s =1; 712 }else{ 713 if(s==0){ 714 get = '#table'+cnt; 715 } 716 } 717 }); 718 719 name="name"; value=$(this).attr('name'); 720 meas = "class"; meas2 = "time"; getTableId = get; split1(); }else{ alert("please enter value for time to add measurement"); } 591 721 592 722 … … 643 773 button.setAttribute('value','[+]'), 644 774 button.setAttribute('id','btnAddTime'), 645 button.onclick=function(){ 646 775 button.setAttribute('name','#table'+cnt), 776 button.onclick=function(){ 777 647 778 if($('#Time'+cnt).val() != "") 648 779 { 780 name = "name"; 781 value = "table"+cnt; 649 782 timeValue = $('#Time'+cnt).val(); 650 783 meas = "hidden"; 651 784 meas2 = true; 652 getTableId = '#table'+cnt;785 getTableId = $(this).attr('name'); 653 786 split1(); 654 787 } … … 677 810 button.setAttribute('id','btnSplit'), 678 811 button.setAttribute('value','Split'), 812 button.setAttribute('name','#table'+cnt), 679 813 button.onclick=function(){ 680 814 if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 30; 681 815 816 var limit = 60; 817 var adds =0; 818 adds = (Number(splitting[1]) + Number(add)); 819 if(adds >= limit){ 820 adds = Number(adds) - Number(limit); 821 timeValue =pad(Number(splitting[0])+1,2)+':'+ pad(adds,2); 822 823 }else{ 824 682 825 timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2); 683 826 } 684 827 function pad(number, length) { 685 828 … … 693 836 } 694 837 695 meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split(); }else{ alert("please enter value for time to add measurement"); } 838 meas = "class"; meas2 = "time"; 839 840 841 getTableId = $(this).attr('name'); 842 split2(); }else{ alert("please enter value for time to add measurement"); } 696 843 } 697 844 ); … … 727 874 table.setAttribute('id',"table"+cnt); 728 875 table.setAttribute('width','100%'); 876 table.setAttribute(name,value); 729 877 var tr = document.createElement('tr'); 730 878 tr.setAttribute('id',''); … … 750 898 button.setAttribute('id','btnAddTime'), 751 899 button.setAttribute(meas,meas2), 900 button.setAttribute('name','table'+cnt), 901 752 902 button.onclick=function(){ 753 903 if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 01; … … 764 914 return str; 765 915 766 } meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); } 916 } 917 var s = 0; var get; 918 var nn; 919 nn = $(this).attr('name'); 920 $("table").each(function() { 921 if($(this).attr("name")==nn){ 922 923 get = "#"+$(this).attr("id"); 924 //get = $(this).attr("name"); 925 s =1; 926 }else{ 927 if(s==0){ 928 get = '#table'+cnt; 929 } 930 } 931 }); 932 933 name="name"; value=""; meas = "class"; meas2 = "time"; getTableId = get; split1(); }else{ alert("please enter value for time to add measurement"); } 767 934 768 935 … … 820 987 button.setAttribute('value','[+]'), 821 988 button.setAttribute('id','btnAddTime'), 822 button.onclick=function(){ 823 824 if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); meas = "hidden"; meas2 = true; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); } 989 button.setAttribute('name','#table'+cnt), 990 button.onclick=function(){ 991 992 if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); 993 name = "name"; value = $(this).attr('name'); meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split1(); }else{ alert("please enter value for time to add measurement"); } 825 994 826 995 … … 843 1012 button.setAttribute('id','btnSplit'), 844 1013 button.setAttribute('value','Split'), 1014 button.setAttribute('name','#table'+cnt), 845 1015 button.onclick=function(){ 846 1016 if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 30; 847 1017 1018 var limit = 60; 1019 var adds =0; 1020 adds = (Number(splitting[1]) + Number(add)); 1021 if(adds >= limit){ 1022 adds = Number(adds) - Number(limit); 1023 timeValue =pad(Number(splitting[0])+1,2)+':'+ pad(adds,2); 1024 1025 }else{ 1026 848 1027 timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2); 849 1028 } 850 1029 function pad(number, length) { 851 1030 … … 859 1038 } 860 1039 861 meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split(); }else{ alert("please enter value for time to add measurement"); }1040 meas = "name"; meas2 = "time"; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); } 862 1041 } 863 1042 );
Note:
See TracChangeset
for help on using the changeset viewer.