1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
2 | <html>
|
---|
3 | <head>
|
---|
4 | <link type="text/css" rel="stylesheet" href="Module/src/css/jscal2.css" />
|
---|
5 | <link type="text/css" rel="stylesheet" href="Module/src/css/border-radius.css" />
|
---|
6 |
|
---|
7 | <link id="skin-win2k" title="Win 2K" type="text/css" rel="alternate stylesheet" href="Module/src/css/win2k/win2k.css" />
|
---|
8 |
|
---|
9 | <!--<script src="js/highcharts.js"></script>
|
---|
10 | <script src="js/exporting.js"></script> -->
|
---|
11 |
|
---|
12 | <script src="Module/src/js/jscal2.js"></script>
|
---|
13 | <script src="Module/src/js/unicode-letter.js"></script>
|
---|
14 | <!--<script src="js/chart.js"></script> -->
|
---|
15 | <script src="Module/src/js/lang/en.js"></script>
|
---|
16 | <!-- <script src="js/xmlrequest.js"></script>
|
---|
17 | -->
|
---|
18 | <style type="text/css">
|
---|
19 | .highlight { color: #0f0 !important; font-weight: bold; }
|
---|
20 | .highlight2 { color: #0f0 !important; font-weight: bold; }
|
---|
21 | </style>
|
---|
22 |
|
---|
23 | </head>
|
---|
24 | <body style="background-color: #fff">
|
---|
25 |
|
---|
26 | <table>
|
---|
27 | <tr>
|
---|
28 | <td valign="top" style="width: 30em;">
|
---|
29 | <div id="cont"></div>
|
---|
30 | <script type="text/javascript">
|
---|
31 | var DATE_INFO = {
|
---|
32 | <?php
|
---|
33 | $sqlSched=mysql_query("SELECT*FROM schedule");
|
---|
34 | $SchedCnt=mysql_num_rows($sqlSched);
|
---|
35 | $src=1;
|
---|
36 | while($rowSched=mysql_fetch_array($sqlSched))
|
---|
37 | {
|
---|
38 | $timestamp=strtotime($rowSched['fStart']);
|
---|
39 | if($SchedCnt==$src)
|
---|
40 | {
|
---|
41 | echo date("Ymd",$timestamp);?>:{klass: "highlight"}<?php
|
---|
42 | }
|
---|
43 | else
|
---|
44 | {
|
---|
45 | echo date("Ymd",$timestamp);?>:{klass: "highlight"},<?php
|
---|
46 | }
|
---|
47 | $src++;
|
---|
48 | ?>
|
---|
49 |
|
---|
50 | <?php
|
---|
51 | }
|
---|
52 | ?>
|
---|
53 | };
|
---|
54 |
|
---|
55 | function getDateInfo(date, wantsClassName) {
|
---|
56 | var as_number = Calendar.dateToInt(date);
|
---|
57 | return DATE_INFO[as_number];
|
---|
58 | };
|
---|
59 | var CAL = Calendar.setup({
|
---|
60 | cont: "cont",
|
---|
61 | // weekNumbers: true,
|
---|
62 | selectionType: Calendar.SEL_MULTIPLE,
|
---|
63 | showTime: 24,
|
---|
64 | //fdow : 1,
|
---|
65 | dateInfo:getDateInfo
|
---|
66 | // titleFormat: "%B %Y"
|
---|
67 | })
|
---|
68 | </script>
|
---|
69 | </td>
|
---|
70 |
|
---|
71 | <tr>
|
---|
72 | <td>
|
---|
73 | <script type="text/javascript">
|
---|
74 | $(document).ready(function(){
|
---|
75 | //Graph();
|
---|
76 | var date= new Date();
|
---|
77 | var Year=date.getFullYear();
|
---|
78 | var Day=date.getDay();
|
---|
79 | var Month=date.getMonth();
|
---|
80 | <?php
|
---|
81 | $sqlSched1=mysql_query("SELECT*FROM schedule");
|
---|
82 | while($rowSched1=mysql_fetch_array($sqlSched1))
|
---|
83 | {
|
---|
84 |
|
---|
85 | $timestamp1=strtotime($rowSched1['fStart']);
|
---|
86 | ?>
|
---|
87 | if(Year+""+Day+""+Month==<?php echo date('Ydm',$timestamp1); ?>)
|
---|
88 | {
|
---|
89 | alert('wa');
|
---|
90 | }
|
---|
91 | <?php
|
---|
92 | }
|
---|
93 | ?>
|
---|
94 |
|
---|
95 | });
|
---|
96 | </script>
|
---|
97 | <script type="text/javascript">
|
---|
98 | var day;
|
---|
99 | var year;
|
---|
100 | var month;
|
---|
101 | function testData()
|
---|
102 | {
|
---|
103 | //calls the xml request in a loop based on the current sources
|
---|
104 | var source = ['Mrk 421','Mrk 501'];
|
---|
105 | for (i = 0; i<source.length; i++)
|
---|
106 | {
|
---|
107 | alert (source[i]);
|
---|
108 | testXMLData(i, source);
|
---|
109 | //$('#data').append('1st'+source);
|
---|
110 | }
|
---|
111 | }
|
---|
112 |
|
---|
113 | function testXMLData(index, source)
|
---|
114 | {
|
---|
115 | alert("test XML Data");
|
---|
116 | var testXML;
|
---|
117 | //$('#data').append(' xmlData pass'+source+" "+index);
|
---|
118 | testXML = new XMLHttpRequest();
|
---|
119 | //NOTE: previous errors on the request was caused by appending "http://www.fact-project.org"
|
---|
120 | testXML.open("GET","/smartfact/index.php?source="+escape(source[index])+"&time="+year+"-"+month+"-"+day,true);
|
---|
121 | dataSource = new Array();
|
---|
122 | testXML.onload=function()
|
---|
123 | {
|
---|
124 | if (testXML.status==200)
|
---|
125 | {
|
---|
126 | alert("request ok");
|
---|
127 | line=testXML.responseText.split('\n');
|
---|
128 | dataSource.push(line);
|
---|
129 | if (dataSource.length == source.length)
|
---|
130 | {
|
---|
131 | alert("new datasource");
|
---|
132 | displayXMLData(dataSource, source); //this will be called when the last data from the list is read
|
---|
133 | //$('#data').append('successfully load'+source +""+dataSource);
|
---|
134 | }
|
---|
135 | }
|
---|
136 | else
|
---|
137 | alert("status is " + testXML.status);
|
---|
138 |
|
---|
139 | };
|
---|
140 | testXML.send();
|
---|
141 | }
|
---|
142 |
|
---|
143 | function displayXMLData(dataSource, source)
|
---|
144 | {
|
---|
145 | //This function splits the lines of data per data source
|
---|
146 | var dataGraph = new Array(source.length);
|
---|
147 | for (i=0; i<source.length; i++)
|
---|
148 | {
|
---|
149 | dataGraph[i] = new Array(); //dataGraph contains the individual points for each source i
|
---|
150 | for(row=0;row<dataSource[i].length;row++)
|
---|
151 | {
|
---|
152 | rows=line[row].split(',');
|
---|
153 | dataGraph[i].push(rows[4]);
|
---|
154 | }
|
---|
155 | $('#data').append(i + ": " + source[i] + ' GRAPH DATA ' + dataGraph[i]);
|
---|
156 | }
|
---|
157 | }
|
---|
158 |
|
---|
159 | CAL.addEventListener("onSelect", function(){
|
---|
160 | day =this.selection.print("%d").join("\n");
|
---|
161 | month =this.selection.print("%m").join("\n");
|
---|
162 | year =this.selection.print("%Y").join("\n");
|
---|
163 | //document.getElementById('data').innerHTML="Calendar selected! ";
|
---|
164 | //displayXMLData();
|
---|
165 | alert("test data");
|
---|
166 | testData();
|
---|
167 |
|
---|
168 | });
|
---|
169 |
|
---|
170 |
|
---|
171 |
|
---|
172 | </script>
|
---|
173 | </td>
|
---|
174 | </tr>
|
---|
175 |
|
---|
176 | </table>
|
---|
177 | </td>
|
---|
178 | </tr>
|
---|
179 | </table>
|
---|
180 |
|
---|
181 | </body>
|
---|
182 | </html>
|
---|
183 |
|
---|
184 |
|
---|