Changeset 16899 for schedule/function


Ignore:
Timestamp:
06/25/13 02:46:53 (11 years ago)
Author:
tanio
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • schedule/function/SplitDelete.php

    r16895 r16899  
    213213                table.setAttribute('id',"table2");
    214214                table.setAttribute('width','100%');
     215                table.setAttribute('name','#table2');
    215216        var tr = document.createElement('tr');
    216217                tr.setAttribute('id','');
     
    224225                                        input.setAttribute("max","24"),
    225226                                        input.setAttribute("min","1"),
    226                                         input.setAttribute("required",true)
     227                                        input.setAttribute("required",true),
     228                                        input.onkeyup = function(){
     229                                       
     230                                       
     231                                       
     232                       
     233                                                                if($('div#TableHolder #table2 #Time').val() <= 0  || $('div#TableHolder #table1 #Time').val() <=0){
     234                                                               
     235                                                               
     236                                                                }else{
     237                                                                        if($('div#TableHolder #table1 #Time').val() <= $('div#TableHolder #table2 #Time').val()){
     238                                                                        alert('2nd row must be greater than 1st');
     239                                                                        }
     240                                                                }
     241                                                       
     242                                                 
     243                                       
     244                                       
     245                                               
     246                                       
     247                                                                        }
     248                                       
     249                                       
    227250                );
    228251                        td3.appendChild(
     
    233256                        button.setAttribute('name','#table2'),
    234257                        button.onclick=function(){
    235 var aa;
     258                                        var aa;
    236259                        $('div#TableHolder #table2 #Time').each(function(){
    237260                                        aa = $(this).val();
    238261                                        });
     262                                       
    239263                        if(aa != ""){ var splitting =aa.split(':'); var add = 01;   
    240264
     
    254278                                                var s = 0; var  get;
    255279                                               
    256 $("table").each(function() {
    257                                 if($(this).attr("name")=='#table2'){
    258                                 get = "#"+$(this).attr("id");
    259                                
    260                                                 s =1;
    261                                 }else{
    262                                 if(s==0){
    263                                 get = '#table'+cnt;
    264                                 }
    265                                 }
    266     });
     280                                $("table").each(function() { if($(this).attr("name")=='#table2'){ get = "#"+$(this).attr("id"); s =1; }else{ if(s==0){ get = '#table'+cnt; }
     281                                }
     282                                });
    267283getTableId =get;
    268 name="name"; value="";
    269                                                 name="name"; value="";  meas = "class"; meas2 = "time";  //getTableId = $(this).attr('name');
     284name="name"; value = '#table2';
     285                                                  meas = "class"; meas2 = "time";  //getTableId = $(this).attr('name');
    270286                                                split2();    }else{   alert("please enter value for time to add measurement");   }
    271287
     
    381397                                        input.setAttribute("max","24"),
    382398                                        input.setAttribute("min","1"),
    383                                         input.setAttribute("required",true)
     399                                        input.setAttribute("required",true),
     400                                        input.onkeyup = function(){
     401                                       
     402                                       
     403                                       
     404                                                       
     405                       
     406                                                                if($('div#TableHolder #table2 #Time').val() <= 0  || $('div#TableHolder #table1 #Time').val() <=0){
     407                                                               
     408                                                               
     409                                                                }else{
     410                                                                        if($('div#TableHolder #table1 #Time').val() <= $('div#TableHolder #table2 #Time').val()){
     411                                                                        alert(' row must be greater than previous');
     412                                                                        return false;
     413                                                                        }
     414                                                                }
     415                                                       
     416                                                 
     417                                       
     418                                       
     419                                               
     420                                       
     421                                                                        }
    384422                );
    385423                        td3.appendChild(
     
    391429                        button.onclick=function(){
    392430                        var aa;
    393                         $('div#TableHolder #table2 #Time').each(function(){
     431                        $('div#TableHolder #table1 #Time').each(function(){
    394432                                        aa = $(this).val();
    395433                                        });
    396                         if(aa !='') { var splitting  =aa.split(':'); var add = 01;   
     434                        if(aa !='') { var splitting =aa.split(':'); var add = 01;   
    397435
    398436                        timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
     
    413451                                               
    414452$("table").each(function() {
    415                                 if($(this).attr("name")=='#table2'){
     453                                if($(this).attr("name")=='#table1'){
    416454                                get = "#"+$(this).attr("id");
    417455                               
     
    419457                                }else{
    420458                                if(s==0){
    421                                 get = '#table'+cnt;
     459                                get = '#table1';
    422460                                }
    423461                                }
    424462    });
    425463getTableId =get;
    426 name="name"; value="";
    427                                                
    428 name="name"; value="";  meas = "class"; meas2 = "time";  //getTableId = $(this).attr('name');
     464name="name"; value = '#table1';
     465                                               
     466  meas = "class"; meas2 = "time";  //getTableId = $(this).attr('name');
    429467split2();    }else{   alert("please enter value for time to add measurement");   }
    430468
     
    483521                        button.setAttribute('name','#table1'),
    484522                        button.onclick=function(){
     523                        var aa;
    485524                        $('div#TableHolder #table1 #Time').each(function(){
    486525                                        aa = $(this).val();
     
    532571        function split2()
    533572        {
    534        
     573
    535574                cnt++;
    536575                var div= document.createElement("div");
     
    553592                                                input.setAttribute("id","Time"),
    554593                                                input.setAttribute("max","24"),
    555                                                 input.setAttribute("min","1"),
     594                                                input.setAttribute("min",'1'),
    556595                                                input.setAttribute("required",true),
    557596                                                input.setAttribute(meas,meas2),
     
    573612                                        aa = $(this).val();
    574613                                        });
     614                                        bb =  $(this).closest('table').attr('name');
    575615                        if(aa != ""){var splitting = aa.split(':'); var add = 01;   
    576616
     
    591631                                        var s = 0; var  get;
    592632                                                var nn;
    593                                                 nn = $(this).attr('name');
     633                                                nn = bb;
    594634                                $("table").each(function() {
    595635                                if($(this).attr("name")==nn){
     
    605645                                });
    606646
    607 name="name"; value=$(this).attr('name');
     647name="name"; value = bb;
    608648meas = "class"; meas2 = "time";  getTableId = get;   split1();    }else{   alert("please enter value for time to add measurement");   }
    609649
     
    664704                        button.onclick=function(){
    665705                var aa;
     706                var bb;
    666707                        $('div#TableHolder #table'+cnt+' #Time').each(function(){
    667708                                        aa = $(this).val();
    668709                                        });
     710                bb =  $(this).closest('table').attr('name');
    669711                        if(aa != "")
    670712                        {
    671713                                name = "name";
    672                                 value = "#table"+cnt;
     714                                value = bb;
     715                        //      alert('2'+bb);
    673716                                timeValue = aa;
    674717                                meas = "hidden";
     
    723766        function split1()
    724767        {
    725        
     768
    726769                cnt++;
    727770                var div= document.createElement("div");
     
    743786                                                input.setAttribute("id","Time"),
    744787                                                input.setAttribute("max","24"),
    745                                                 input.setAttribute("min","1"),
     788                                                input.setAttribute("min",'1'),
    746789                                                input.setAttribute("required",true),
    747790                                                input.setAttribute(meas,meas2),
    748791                                                input.setAttribute("value",timeValue)
     792                                               
    749793                        );
    750794                                td3.appendChild(
     
    761805                                        aa = $(this).val();
    762806                                        });
     807                                        bb =  $(this).closest('table').attr('name');
    763808                        if(aa != ""){ var splitting = aa.split(':'); var add = 01;   
    764809
     
    777822                                                var s = 0; var  get;
    778823                                                var nn;
    779                                                 nn = $(this).attr('name');
     824                                                nn = bb;
    780825                                $("table").each(function() {
    781826                                if($(this).attr("name")==nn){
     
    791836                                });
    792837
    793                                 name="name"; value="";          meas = "class"; meas2 = "time";   getTableId = get; split1();    }else{   alert("please enter value for time to add measurement");   }
     838                                name="name"; value=bb;          meas = "class"; meas2 = "time";   getTableId = get; split1();    }else{   alert("please enter value for time to add measurement");   }
    794839
    795840                               
     
    850895                        button.onclick=function(){
    851896               
    852                         if($('#Time').val() != ""){ timeValue = $('#Time').val();                               
    853                         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");   }
    854 
    855                                
     897                        var aa;
     898                var bb;
     899                        $('div#TableHolder #table'+cnt+' #Time').each(function(){
     900                                        aa = $(this).val();
     901                                        });
     902                       
     903                                                bb =  $(this).closest('table').attr('name');
     904                                       
     905                        if(aa != "")
     906                        {
     907                                name = "name";
     908                                value = bb;
     909                                //alert(value);
     910                                timeValue = aa;
     911                                meas = "hidden";
     912                                meas2 = true;
     913                                getTableId = $(this).attr('name');
     914                                split1();   
     915                        }
     916                        else
     917                        {
     918                                alert("please enter value for time to add measurement");   
     919                        }
    856920                        }
    857921                );
     
    889953        }
    890954       
     955        //$('div#TableHolder #table'+cnt+' #Time')
     956       
     957       
     958                // $('div#TableHolder table #Time').keyup(function(){
     959                       
     960                // if($('div#TableHolder #table2 #Time').val() <= 0  || $('div#TableHolder #table1 #Time').val() <=0){
     961               
     962               
     963                // }else{
     964                        // if($('div#TableHolder #table1 #Time').val() <= $('div#TableHolder #table2 #Time').val()){
     965                        // alert(cnt);
     966                        // }
     967                // }
     968                // });
     969 
     970       
     971       
     972       
     973       
    891974 });
    892975 </script>
Note: See TracChangeset for help on using the changeset viewer.