Changeset 16478 for schedule


Ignore:
Timestamp:
05/30/13 14:52:27 (11 years ago)
Author:
tanio
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • schedule/Module/calendar.php

    r16474 r16478  
    9494                                        </script>
    9595                <script type="text/javascript">//<![CDATA[
     96                                var index = 0;
     97                                var xmlhttp = new Array();
     98                                var source = ['Mrk 421','Mrk 501'];
    9699                 CAL.addEventListener("onSelect", function(){
    97100                                                        var day =this.selection.print("%d").join("\n");
    98101                                                        var month =this.selection.print("%m").join("\n");
    99102                                                        var year =this.selection.print("%Y").join("\n");                                 
    100                                                        
     103                                                        /*
    101104                                                        var xmlhttp;
    102105                                                        var source = ['Mrk 421','Mrk 501','Crab'];
     
    170173                                                                                               
    171174                                                });
    172                                                
     175                                                function getXML()
     176                                                {
     177                                                        if (window.XMLHttpRequest)
     178                                                                 {// code for IE7+, Firefox, Chrome, Opera, Safari
     179                                                                 xmlhttp.push(new XMLHttpRequest());
     180                                                                 }
     181                                                        else
     182                                                                 {// code for IE6, IE5
     183                                                                 xmlhttp.push(new ActiveXObject("Microsoft.XMLHTTP"));
     184                                                                 }
     185
     186                                                        index = xmlhttp.length - 1;
     187                                                }
     188
     189                                                function getXMLData()
     190                                                {
     191                                                        getXML();
     192                                                        xmlhttp[index].onreadystatechange=function()
     193                                                        {
     194                                                         if (xmlhttp[index].readyState==4 && xmlhttp.status==200)
     195                                                                {
     196                                                                sourceData[index]= new Array(); //--> remove this if you use sourceData[[]]
     197                                                                line=xmlhttp[index].responseText.split('\n');
     198                                                                        for(row=0;row<line.length;row++)
     199                                                                        {
     200                                                                        rows=line[row].split(',');
     201                                                                        sourceData[index].push(rows[4]);
     202                                                                        }
     203                                                                }
     204                                                        }
     205                                                        xmlhttp[index].open("GET","http://www.fact-project.org/smartfact/index.php?source="+escape(source[index])+"&time="+year+"-"+month+"-"+day,true);
     206
     207                                                        xmlhttp[index].send();
     208                                                }
     209
     210                                                function displayData() //--> you can use the content of this function in the event listener
     211                                                {
     212                                                        for (i=0; i<=source.length; i++)
     213                                                        {
     214                                                        getXMLData();
     215                                                        //display source data here sourceData[i]
     216                                                        }       
     217                                                }
    173218                                               
    174219                                                       
Note: See TracChangeset for help on using the changeset viewer.