Changeset 16816


Ignore:
Timestamp:
06/12/13 18:32:34 (11 years ago)
Author:
tanio
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • schedule/function/SplitDelete.php

    r16738 r16816  
    11<script type="text/javascript">
    22 $(document).ready(function(){
    3  
     3 var name='';
     4var value='';
    45 var timeValue;
    56var meas;
    67var meas2;
    78var getTableId;
     9var is=0;
    810 window.cnt=0;
    911 
     
    7981                        button.setAttribute('value','[+]'),
    8082                        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;   
    8689
    8790                        timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
    88 
     91               
    8992                                                function pad(number, length) {
    9093                                   
     
    97100
    98101                                                }
    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");   }
    101125
    102126                               
     
    157181                        button.setAttribute('type','button'),
    158182                        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");   }
    162187
    163188                               
     
    181206                        button.setAttribute('id','btnSplit'),
    182207                        button.setAttribute('value','Split'),
     208                        button.setAttribute('name','#table'+cnt),
    183209                        button.onclick= function()
    184210                        {
    185211
    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                                 
    189224                        timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
    190 
     225                                        }
    191226                                                function pad(number, length) {
    192227                                   
     
    199234
    200235                                                };
    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"); }
    203243
    204244                                 
     
    253293                        button.setAttribute('value','[+]'),
    254294                        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;   
    257298
    258299                        timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
     
    267308                                                return str;
    268309
    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    });
     325getTableId =get;
     326name="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");   }
    270329
    271330                               
     
    321380                        button.setAttribute('value','[+]'),
    322381                        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");   }
    325385
    326386                               
     
    342402                        button.setAttribute('id','btnSplit'),
    343403                        button.setAttribute('value','Split'),
     404                        button.setAttribute('name','#table2'),
    344405                        button.onclick= function()
    345406                        {
    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                                 
    348416                        timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
    349 
     417                                        }
    350418                                                function pad(number, length) {
    351419                                   
     
    358426
    359427                                                }
    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");   }
    362431                                 
    363432                        }
     
    405474                        button.setAttribute('value','[+]'),
    406475                        button.setAttribute('id','btnAddTime'),
     476                        button.setAttribute('name','#table1'),
    407477                        button.onclick=function(){
    408478                        if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 01;   
     
    419489                                                return str;
    420490
    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    });
     507getTableId =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");   }
    422512
    423513                               
     
    473563                        button.setAttribute('value','[+]'),
    474564                        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");   }
    477568
    478569                               
     
    494585                        button.setAttribute('id','btnSplit'),
    495586                        button.setAttribute('value','Split'),
     587                        button.setAttribute('name','#table1'),
    496588                        button.onclick= function()
    497589                        {
    498590                                 if($('#Time2').val() != ""){  var splitting = $('#Time2').val().split(':'); var add = 30;   
    499591
     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                                 
    500601                        timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
    501 
     602                                        }
    502603                                                function pad(number, length) {
    503604                                   
     
    511612                                                }
    512613
    513                          meas = "name"; meas2 = "time"; getTableId = '#table1';   split();    }else{   alert("please enter value for time to add measurement");   }
     614
     615                                                name="name"; value=""; 
     616                                               
     617meas = "class"; meas2 = "time";
     618
     619                getTableId = $(this).attr('name'); 
     620                split2();    }else{   alert("please enter value for time to add measurement");   }
    514621                                 
    515622                        }
     
    539646        }
    540647        var meas;
    541                 var timeValue;
    542                 var pad;
     648        var timeValue;
     649        var pad;
    543650        if(cnt==0){  cnt=2; }   
    544         function split()
     651        function split2()
    545652        {
    546653       
     
    549656                        table.setAttribute('id',"table"+cnt);
    550657                        table.setAttribute('width','100%');
     658                        table.setAttribute(name,value);
    551659                var tr = document.createElement('tr');
    552660                        tr.setAttribute('id','');
     
    566674                                                input.setAttribute(meas,meas2),
    567675                                                input.setAttribute("value",timeValue)
     676                                       
    568677                                               
    569678                        );
     
    574683                        button.setAttribute('id','btnAddTime'),
    575684                        button.setAttribute(meas,meas2),
     685                        button.setAttribute('name','table'+cnt),
     686                       
    576687                        button.onclick=function(){
    577688                        if($('#Time'+cnt).val() != ""){var splitting = $('#Time'+cnt).val().split(':'); var add = 01;   
     
    588699                                                return str;
    589700
    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
     719name="name"; value=$(this).attr('name');
     720                                                meas = "class"; meas2 = "time";  getTableId = get;   split1();    }else{   alert("please enter value for time to add measurement");   }
    591721
    592722                               
     
    643773                        button.setAttribute('value','[+]'),
    644774                        button.setAttribute('id','btnAddTime'),
    645                         button.onclick=function(){
    646                        
     775                        button.setAttribute('name','#table'+cnt),
     776                        button.onclick=function(){
     777               
    647778                        if($('#Time'+cnt).val() != "")
    648779                        {
     780                                name = "name";
     781                                value = "table"+cnt;
    649782                                timeValue = $('#Time'+cnt).val();
    650783                                meas = "hidden";
    651784                                meas2 = true;
    652                                 getTableId = '#table'+cnt;
     785                                getTableId = $(this).attr('name');
    653786                                split1();   
    654787                        }
     
    677810                                button.setAttribute('id','btnSplit'),
    678811                                button.setAttribute('value','Split'),
     812                                button.setAttribute('name','#table'+cnt),
    679813                                button.onclick=function(){
    680814                                 if($('#Time'+cnt).val() != ""){  var splitting = $('#Time'+cnt).val().split(':'); var add = 30;   
    681815
     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                                 
    682825                        timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
    683 
     826                                        }
    684827                                                function pad(number, length) {
    685828                                   
     
    693836                                                }
    694837
    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");   }
    696843                                }
    697844                        );
     
    727874                        table.setAttribute('id',"table"+cnt);
    728875                        table.setAttribute('width','100%');
     876                        table.setAttribute(name,value);
    729877                var tr = document.createElement('tr');
    730878                        tr.setAttribute('id','');
     
    750898                        button.setAttribute('id','btnAddTime'),
    751899                        button.setAttribute(meas,meas2),
     900                        button.setAttribute('name','table'+cnt),
     901                       
    752902                        button.onclick=function(){
    753903                        if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 01;   
     
    764914                                                return str;
    765915
    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");   }
    767934
    768935                               
     
    820987                        button.setAttribute('value','[+]'),
    821988                        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");   }
    825994
    826995                               
     
    8431012                                button.setAttribute('id','btnSplit'),
    8441013                                button.setAttribute('value','Split'),
     1014                                button.setAttribute('name','#table'+cnt),
    8451015                                button.onclick=function(){
    8461016                                 if($('#Time'+cnt).val() != ""){  var splitting = $('#Time'+cnt).val().split(':'); var add = 30;   
    8471017
     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                                 
    8481027                        timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
    849 
     1028                                        }
    8501029                                                function pad(number, length) {
    8511030                                   
     
    8591038                                                }
    8601039                               
    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");   }
    8621041                                }
    8631042                        );
Note: See TracChangeset for help on using the changeset viewer.