1 // Copyright (C) 2006 Eric Bollengier
2 // All rights reserved.
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 var even_cell_color = "#FFFFFF";
19 var odd_cell_color = "#EEEEEE";
20 var header_color = "#E1E0DA";
21 var rows_per_page = 20;
22 var up_icon = "/bweb/up.gif";
23 var down_icon = "/bweb/down.gif";
24 var prev_icon = "/bweb/left.gif";
25 var next_icon = "/bweb/right.gif";
26 var rew_icon = "/bweb/first.gif";
27 var fwd_icon = "/bweb/last.gif";
30 'C': 'created but not yet running',
33 'T': 'terminated normally',
34 'E': 'Job terminated in error',
35 'e': 'Non-fatal error',
37 'D': 'Verify differences',
38 'A': 'canceled by user',
39 'F': 'waiting on File daemon',
40 'S': 'waiting on the Storage daemon',
41 'm': 'waiting for new media',
42 'M': 'waiting for Mount',
43 's': 'Waiting for storage resource',
44 'j': 'Waiting for job resource',
45 'c': 'Waiting for Client resource',
46 'd': 'Waiting for maximum jobs',
47 't': 'Waiting for start time',
48 'p': 'Waiting for higher priority jobs to finish'
53 'I': 'Incr (since last backup)',
54 'D': 'Diff (since last full backup)',
55 'C': 'verify from catalog',
56 'V': 'verify save (init DB)',
57 'O': 'verify Volume to catalog entries',
58 'd': 'verify Disk attributes to catalog',
59 'A': 'verify data on volume',
64 var refresh_time = 60000;
66 function bweb_refresh() {
69 function bweb_add_refresh(){
70 window.setInterval("bweb_refresh()",refresh_time);
74 // percent_display("row2", [ { nb: 1, name: "Full" },
75 // { nb: 2, name: "Error" },
76 // { nb: 5, name: "Append" },
77 // { nb: 2, name: "Purged" },
78 // {} # last element must be {}
81 function percent_get_img(type)
83 var img=document.createElement('img');
85 img.className="pSlice" + type ;
87 img.className="pSlice";
89 img.src="/bweb/pix.png";
94 var percent_display_nb_slice = 20;
95 var percent_usage_nb_slice = 5;
97 function percent_display(hash_values, parent)
99 var nb_elt=percent_display_nb_slice;
103 parent = document.createElement('DIV');
106 if (typeof parent != "object") {
107 parent = document.getElementById(parent);
111 alert("E : display_percent(): Can't find parent " + parent);
115 hash_values.pop(); // drop last element {}
117 var nb_displayed = 0;
120 for(var i=0;i<hash_values.length;i++) {
121 nb_max += hash_values[i]['nb'];
124 for(var i=0;i<hash_values.length;i++) {
125 var elt = hash_values[i];
126 var cur_nb = (elt['nb'] * nb_elt)/nb_max;
127 var cur_name = elt['name'];
128 cur_name.replace(/-/,"_");
130 tips = tips + " " + elt['nb'] + " " + cur_name;
132 while ((nb_displayed < nb_elt) && (cur_nb >=1)) {
136 var img= percent_get_img(cur_name);
137 parent.appendChild(img);
141 while (nb_displayed < nb_elt) {
143 var img= percent_get_img();
144 parent.appendChild(img);
152 function percent_usage(value, parent)
154 var nb_elt=percent_usage_nb_slice;
158 parent = document.createElement('DIV');
161 if (typeof parent != "object") {
162 parent = document.getElementById(parent);
166 alert("E : display_percent(): Can't find parent " + parent);
173 } else if (value <= 40) {
175 } else if (value <= 75) {
177 } else if (value <= 85) {
183 var nb = parseInt(value*nb_elt/100, 10);
184 parent.title = parseInt(value*100,10)/100 + "% used (approximate)";
186 for(var i=0; i<nb; i++) {
187 var img= percent_get_img(type);
188 parent.appendChild(img);
191 for(nb;nb < nb_elt;nb++) {
192 var img= percent_get_img("Empty");
193 parent.appendChild(img);
199 function search_media()
201 var what = document.getElementById('searchbox').value;
203 document.search.action.value='media';
204 document.search.re_media.value=what;
205 document.search.submit();
209 function search_client()
211 var what = document.getElementById('searchbox').value;
213 document.search.action.value='client';
214 document.search.re_client.value=what;
215 document.search.submit();
219 sfHover = function() {
220 var sfEls = document.getElementById("menu").getElementsByTagName("LI");
221 for (var i=0; i<sfEls.length; i++) {
222 sfEls[i].onmouseover=function() {
223 this.className+=" sfhover";
225 sfEls[i].onmouseout=function() {
226 this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
231 if (window.attachEvent) window.attachEvent("onload", sfHover);