Code

Fixed post handling.
[gosa.git] / gosa-plugins / goto / addons / goto / deploy-list.tpl
1 <div id="mainlist">
2   <div class="mainlist-header">
3    <p>{$HEADLINE}&nbsp;{$SIZELIMIT}</p>
4    <div class="mainlist-nav">
5     <table summary="{$HEADLINE}">
6      <tr>
7       <td>{$RELOAD}</td>
8       <td class="left-border">{$ACTIONS}</td>
9      </tr>
10     </table>
11    </div>
12   </div>
14   {$LIST}
15 </div>
17 <div class="clear"></div>
20 <input type="hidden" name="ignore">
23 <!--
24 JS to reload the progress bars.
26 -->
27 {literal}
28 <script type="text/javascript">
30 /* Get request object handler for this type of browser 
31  */
32 if (typeof XMLHttpRequest != 'undefined')
33 {
34     xmlHttpObject = new XMLHttpRequest();
35 }
36 if (!xmlHttpObject)
37 {
38     try
39     {
40         xmlHttpObject = new ActiveXObject("Msxml2.XMLHTTP");
41     }
42     catch(e)
43     {
44         try
45         {
46             xmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
47         }
48         catch(e)
49         {
50             xmlHttpObject = null;
51         }
52     }
53 }
55 var fai_status = new Array();
57 function loadContent()
58 {
59         var c = 0;
61         /* Create array of available progress images once 
62          */
63         if(!fai_status.length){
64                 var progressBars= Form.getElements("mainform");
65                 progressBars.each(function(progressBar) {
66                         if(progressBar.id.match(/^progress_/)){
67                                 var mac = id.replace(/^progress_/,'');
68                                 mac = mac.replace(/_/g,':');
69                                 fai_status[c] = new Object();
70                                 fai_status[c]['MAC']  = mac;
71                                 fai_status[c]['PROGRESS'] = -1;
72                                 c ++;
73                         }
74                 }
75         }
77         /* Create string of macs used as parameter for getFAIstatus.php
78                 to retrieve all progress values.
79      */
80         var macs = "";
81         for (var i = 0; i < fai_status.length; i++) {
82                 macs += fai_status[i]['MAC'] + ","
83         }
85         /* Send request 
86      */
87     xmlHttpObject.open('get','getFAIstatus.php?mac=' + macs);
88     xmlHttpObject.onreadystatechange = handleContent;
89     xmlHttpObject.send(null);
90     return false;
91 }
94 function handleContent()
95 {
96     if (xmlHttpObject.readyState == 4)
97     {
98                 /* Get text and split by newline 
99          */
100         var text = xmlHttpObject.responseText;
101                 var data = text.split("\n");
103                 /* Walk through progress images and check if the 
104                    progress status has changed 
105                  */
106                 for (var e = 0; e < fai_status.length; e++) {
107                 
108                         /* Walk through returned values and parse out 
109                            mac and progress value */
110                         var found       = false;
112                         /* Create object id out of mac address 12:34:56:12:34:56 => progress_12_34_56_12_34_56 */
113                         var id          = fai_status[e]["MAC"].replace(/:/g,"_"); 
114                         id = "progress_" + id;
115                         var progressBar = document.getElementById(id);
117                         /* Continue if there is no image object iwth this id */
118                         if(!progressBar){
119                                 continue;
120                         }
122                         for (var i = 0; i < data.length; i++) {
123                                 var mac         = data[i].replace(/\|.*$/,"");
124                                 var progress= data[i].replace(/^.*\|/,"");
126                                 /* Match mac returned by the support daemon and 
127                                         the one out of our list */
128                                 if(fai_status[e]["MAC"] == mac){
129                                         found = true;   
131                                         /* Check if progress has changed 
132                                          */     
133                                         if(fai_status[e]["PROGRESS"] != progress){
134                                                 var woffset= Math.floor(0.85 * (100-progress));
136                                                 progressBar.setStyle({
137                                                    -moz-box-shadow: "0 0 2px rgba(255, 255, 255, 0.4) inset, 0 4px 6px rgba(255, 255, 255, 0.4) inset, 0 10px 0 -2px rgba(255, 255, 255, 0.2) inset, -" + woffset + "px 0 0 -2px rgba(255, 255, 255, 0.2) inset, -" + (woffset+1) + "px 0 0 -2px rgba(0, 0, 0, 0.6) inset, 0pt 11px 8px rgba(0, 0, 0, 0.3) inset, 0pt 1px 0px rgba(0, 0, 0, 0.2)",
138                                                    -webkit-box-shadow: "0 0 2px rgba(255, 255, 255, 0.4) inset, 0 4px 6px rgba(255, 255, 255, 0.4) inset, 0 10px 0 -2px rgba(255, 255, 255, 0.2) inset, -" + woffset + "px 0 0 -2px rgba(255, 255, 255, 0.2) inset, -" + (woffset+1) + "px 0 0 -2px rgba(0, 0, 0, 0.6) inset, 0pt 11px 8px rgba(0, 0, 0, 0.3) inset, 0pt 1px 0px rgba(0, 0, 0, 0.2)",
139                                                    box-shadow: "0 0 2px rgba(255, 255, 255, 0.4) inset, 0 4px 6px rgba(255, 255, 255, 0.4) inset, 0 10px 0 -2px rgba(255, 255, 255, 0.2) inset, -" + woffset + "px 0 0 -2px rgba(255, 255, 255, 0.2) inset, -" + (woffset+1) + "px 0 0 -2px rgba(0, 0, 0, 0.6) inset, 0pt 11px 8px rgba(0, 0, 0, 0.3) inset, 0pt 1px 0px rgba(0, 0, 0, 0.2)"
140                                                 });
141                                                 fai_status[e]["PROGRESS"] = progress;
143                                         }
144                                         break;
145                                 }
146                         }
147                         //document.getElementById("text1").value += "\n ";
149                         /* There was no status send for the current mac. 
150                            This means it was removed from the queue.
151                          */
152                         if(!found){
153                                 document.mainform.submit();                             
154                         }
155                 }
156                 timer=setTimeout('loadContent()',3000);
157     }
160 timer=setTimeout('loadContent()',3000);
161 </script>
162 {/literal}