1 <style type="text/css">
3 border-width: 1px 1px 1px 1px;
5 border-style: solid solid solid solid;
6 border-color: black black black black;
7 border-collapse: collapse;
8 background-color: white;
11 border-width: 1px 1px 1px 1px;
12 padding: 4px 4px 4px 4px;
13 border-style: solid solid solid solid;
14 border-color: gray gray gray gray;
15 background-color: white;
18 border-width: 1px 1px 1px 1px;
19 padding: 4px 4px 4px 4px;
20 border-style: solid solid solid solid;
21 border-color: gray gray gray gray;
22 background-color: white;
25 <div class='titlediv'>
26 <h1 class='newstitle'> __Jobs overview__ (<TMPL_VAR label>)</h1>
29 <table class='sample' id='report'>
36 <script type="text/javascript" language="JavaScript">
38 var table = document.getElementById('report');
40 var tr; var td; var img; var infos;
41 var all = new Array();
48 dates['<TMPL_VAR date>']='<TMPL_VAR num>';
49 infos['<TMPL_VAR date>'] = new Array('<TMPL_VAR num>', '<TMPL_VAR status>',
50 '<TMPL_VAR joberrors>', '<TMPL_VAR title>');
52 all.push({ name: "<TMPL_VAR name>", values: infos});
55 //infos = new Array();
56 //infos['2007-10-01'] = new Array(1, 'T', 8, '2007-10-01');
57 //infos['2007-10-02'] = new Array(2, 'T', 8, '2007-10-02');
58 //infos['2007-10-05'] = new Array(3, 'R', 8, '2007-10-05');
60 //all.push({ name: "zog", values: infos});
62 function init_tab() // initialize the table
65 var step = new Array();
66 // common steps in milliseconds
67 step['day'] = 86400000;
68 step['week'] = 604800000;
69 step['month'] = 2678400000;
73 // javascript can't do foreach $j (sort keys %dates)
74 var keys = new Array();
75 for (var j in dates) {
81 j = keys[j]; // get real key
82 if (!last_date) { // do it once
83 last_date = new Date(j.substr(0, 10));
86 var current_date = new Date(j.substr(0, 10));
88 // Try to find days where we have nothing reported
89 if (step['<TMPL_VAR type>']) {
90 last_date.setTime( last_date.getTime() + step['<TMPL_VAR type>'] * 1.25);
91 while ( last_date < current_date ) {
92 // Insert gap between current_date and last_date
93 last_date.setTime( last_date.getTime() + step['<TMPL_VAR type>']);
94 var t=document.createElement("TD");
95 t.setAttribute("id", "day" + i++); // should not be used
96 t.appendChild(document.createTextNode('?'));
97 document.getElementById("days").appendChild(t);
100 last_date = current_date;
101 var t=document.createElement("TD");
102 t.setAttribute("id", "day" + i);
104 dates_pos[j]=i++; // position in the tab
105 document.getElementById("days").appendChild(t);
109 function add_client(name, infos)
111 tr=document.createElement("TR"); // client row
112 table.appendChild(tr);
114 td=document.createElement("TD"); // client name
116 a=document.createElement("A");
117 a.setAttribute("href", "?action=<TMPL_VAR action>" + name);
118 a.appendChild(document.createTextNode(name));
122 for (var j in infos) { // one img for each days
123 while (cur_pos <= dates_pos[j]) { // create empty blocks
124 td=document.createElement("TD");
128 if (nodate[j] == 1) { // put the date in the first row if empty
129 var t = document.getElementById("day" + dates_pos[j]);
130 t.appendChild(document.createTextNode(infos[j][0]));
133 // a=document.createElement("A"); // create a link to action=job
134 // a.setAttribute('href', "?action=job;client_group=" + name);
135 img=document.createElement("IMG");
136 img.setAttribute("src", bweb_get_job_img(infos[j][1],infos[j][2], 'B'));
137 img.setAttribute("title", infos[j][3]);
138 // a.appendChild(img);
145 for(var i=0; i<all.length; i++) {
147 add_client(elt['name'], elt['values']);