3 {$div}
5 <!--
6 JS to reload the progress bars.
8 -->
9 {literal}
10 <script type="text/javascript">
12 /* Get request object handler for this type of browser
13 */
14 if (typeof XMLHttpRequest != 'undefined')
15 {
16 xmlHttpObject = new XMLHttpRequest();
17 }
18 if (!xmlHttpObject)
19 {
20 try
21 {
22 xmlHttpObject = new ActiveXObject("Msxml2.XMLHTTP");
23 }
24 catch(e)
25 {
26 try
27 {
28 xmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
29 }
30 catch(e)
31 {
32 xmlHttpObject = null;
33 }
34 }
35 }
37 var fai_status = new Array();
39 function loadContent()
40 {
41 var c = 0;
43 /* Create array of available progress images once
44 */
45 if(!fai_status.length){
46 for (var i = 0; i < document.images.length; i++) {
47 var img = document.images[i];
48 var id = img.id;
49 if(id.match(/^progress_/)){
50 var mac = id.replace(/^progress_/,'');
51 mac = mac.replace(/_/g,':');
52 fai_status[c] = new Object();
53 fai_status[c]['MAC'] = mac;
54 fai_status[c]['PROGRESS'] = -1;
55 c ++;
56 }
57 }
58 }
60 /* Create string of macs used as parameter for getFAIstatus.php
61 to retrieve all progress values.
62 */
63 var macs = "";
64 for (var i = 0; i < fai_status.length; i++) {
65 macs += fai_status[i]['MAC'] + ","
66 }
68 /* Send request
69 */
70 xmlHttpObject.open('get','getFAIstatus.php?mac=' + macs);
71 xmlHttpObject.onreadystatechange = handleContent;
72 xmlHttpObject.send(null);
73 return false;
74 }
77 function handleContent()
78 {
79 if (xmlHttpObject.readyState == 4)
80 {
81 /* Get text and split by newline
82 */
83 var text = xmlHttpObject.responseText;
84 var data = text.split("\n");
86 /* Walk through progress images and check if the
87 progress status has changed
88 */
89 for (var e = 0; e < fai_status.length; e++) {
91 /* Walk through returned values and parse out
92 mac and progress value */
93 var found = false;
95 /* Create object id out of mac address
96 12:34:56:12:34:56 => progress_12_34_56_12_34_56
97 */
98 var id = fai_status[e]["MAC"].replace(/:/g,"_");
99 id = "progress_" + id;
100 var img = document.getElementById(id);
102 /* Continue if there is no image object iwth this id
103 */
104 if(!img){
105 continue;
106 }
108 for (var i = 0; i < data.length; i++) {
109 var mac = data[i].replace(/\|.*$/,"");
110 var progress= data[i].replace(/^.*\|/,"");
112 /* Match mac returned by the support daemon and
113 the one out of our list */
114 if(fai_status[e]["MAC"] == mac){
115 found = true;
117 /* Check if progress has changed
118 */
119 if(fai_status[e]["PROGRESS"] != progress){
120 img.src = "progress.php?x=80&y=13&p=" + progress;
121 fai_status[e]["PROGRESS"] = progress;
122 }
123 break;
124 }
125 }
126 //document.getElementById("text1").value += "\n ";
128 /* There was no status send for the current mac.
129 This means it was removed from the queue.
130 */
131 if(!found){
132 document.location.reload();
133 }
134 }
135 timer=setTimeout('loadContent()',3000);
136 }
137 }
139 timer=setTimeout('loadContent()',3000);
140 </script>
141 {/literal}