1 | var xmlhttp;
|
---|
2 | if (window.XMLHttpRequest)
|
---|
3 | {// code for IE7+, Firefox, Chrome, Opera, Safari
|
---|
4 | xmlhttp=new XMLHttpRequest();
|
---|
5 | }
|
---|
6 | else
|
---|
7 | {// code for IE6, IE5
|
---|
8 | xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
---|
9 | }
|
---|
10 |
|
---|
11 | //function to get programs from the db
|
---|
12 | function get_progs(prog, selectsize, mode)
|
---|
13 | {
|
---|
14 | xmlhttp.open("GET","get_progs.php?fProgram="+prog+"&fSelectSize="+selectsize+"&fMode="+mode,false);
|
---|
15 | xmlhttp.send();
|
---|
16 | if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
---|
17 | {
|
---|
18 | document.getElementById('progfield').innerHTML = xmlhttp.responseText;
|
---|
19 | document.getElementById('keyfield').innerHTML = "";
|
---|
20 | if (document.getElementById('valuefield1'))
|
---|
21 | document.getElementById('valuefield1').innerHTML = "";
|
---|
22 | }
|
---|
23 | else
|
---|
24 | document.getElementById('progfield').innerHTML = "argh";
|
---|
25 | }
|
---|
26 |
|
---|
27 | //function to get keys from the db
|
---|
28 | function get_keys(prog, key, selectsize, mode)
|
---|
29 | {
|
---|
30 | xmlhttp.open("GET","get_keys.php?fProgram="+prog+"&fKey="+key+"&fSelectSize="+selectsize+"&fMode="+mode,false);
|
---|
31 | xmlhttp.send();
|
---|
32 | if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
---|
33 | {
|
---|
34 | document.getElementById('keyfield').innerHTML = xmlhttp.responseText;
|
---|
35 | if (document.getElementById('valuefield1'))
|
---|
36 | document.getElementById('valuefield1').innerHTML = "";
|
---|
37 | }
|
---|
38 | else
|
---|
39 | document.getElementById('keyfield').innerHTML = "argh";
|
---|
40 |
|
---|
41 | if(document.getElementById('addrowprog'))
|
---|
42 | document.getElementById('addrowprog').style.display = "";
|
---|
43 | }
|
---|
44 |
|
---|
45 | function get_statusdate(getvalcase, val)
|
---|
46 | {
|
---|
47 | if (!val)
|
---|
48 | {
|
---|
49 | radio=document.getElementsByName('dateformat'+getvalcase);
|
---|
50 | for (i=0; i< radio.length; i++)
|
---|
51 | if (radio[i].checked)
|
---|
52 | val=radio[i].value;
|
---|
53 | }
|
---|
54 | if (val=="pulldown")
|
---|
55 | {
|
---|
56 | year=document.getElementById('year'+getvalcase).value;
|
---|
57 | month=document.getElementById('month'+getvalcase).value;
|
---|
58 | day=document.getElementById('day'+getvalcase).value;
|
---|
59 | hour=document.getElementById('hour'+getvalcase).value;
|
---|
60 | min=document.getElementById('min'+getvalcase).value;
|
---|
61 | sec=document.getElementById('sec'+getvalcase).value;
|
---|
62 |
|
---|
63 | statusdate=(year =='empty'? '':year);
|
---|
64 | statusdate=statusdate+(month=='empty'? '':'-'+month);
|
---|
65 | statusdate=statusdate+(day =='empty'? '':'-'+day);
|
---|
66 | statusdate=statusdate+(hour =='empty'? '':' '+hour);
|
---|
67 | statusdate=statusdate+(min =='empty'? '':':'+min);
|
---|
68 | statusdate=statusdate+(sec =='empty'? '':':'+sec);
|
---|
69 | }
|
---|
70 | if (val=="textinput")
|
---|
71 | statusdate=document.getElementById('statusdate'+getvalcase).value;
|
---|
72 | return statusdate;
|
---|
73 | }
|
---|
74 |
|
---|
75 | //function to get values from the db
|
---|
76 | function get_values(getvalcase, prog, key, mode)
|
---|
77 | {
|
---|
78 | //in this case the given 'prog' and 'key' are ignored
|
---|
79 | if (parseInt(getvalcase)>1)
|
---|
80 | {
|
---|
81 | //get prog and key
|
---|
82 | progselect=document.getElementById("prog");
|
---|
83 | if (!progselect)
|
---|
84 | prog="all";
|
---|
85 | else
|
---|
86 | if (progselect.selectedIndex>=0)
|
---|
87 | prog=progselect.options[progselect.selectedIndex].value;
|
---|
88 | else
|
---|
89 | prog="all";
|
---|
90 | keyselect=document.getElementById("key");
|
---|
91 | if (!keyselect)
|
---|
92 | key="all";
|
---|
93 | else
|
---|
94 | if (keyselect.selectedIndex>=0)
|
---|
95 | key=keyselect.options[keyselect.selectedIndex].value;
|
---|
96 | else
|
---|
97 | key="all";
|
---|
98 | }
|
---|
99 | //if (mode=="view" && getvalcase==1)
|
---|
100 | // return;
|
---|
101 |
|
---|
102 | if ((getvalcase==2 || getvalcase==3) && document.getElementById('statusdate'+getvalcase))
|
---|
103 | {
|
---|
104 | statusdate=get_statusdate(getvalcase);
|
---|
105 | phpcall="get_values.php?fStatusDate="+statusdate+"&fGetValCase="+getvalcase+"&fKey="+key+"&fProgram="+prog;
|
---|
106 | }
|
---|
107 | else
|
---|
108 | phpcall="get_values.php?fGetValCase="+getvalcase+"&fKey="+key+"&fProgram="+prog;
|
---|
109 |
|
---|
110 | xmlhttp.open("GET",phpcall,false);
|
---|
111 | xmlhttp.send();
|
---|
112 | if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
---|
113 | document.getElementById('valuefield'+getvalcase).innerHTML = xmlhttp.responseText;
|
---|
114 | else
|
---|
115 | document.getElementById('valuefield'+getvalcase).innerHTML = "argh";
|
---|
116 |
|
---|
117 | if(document.getElementById('addrowkey'))
|
---|
118 | document.getElementById('addrowkey').style.display = "";
|
---|
119 | }
|
---|
120 |
|
---|
121 | function addRow(addcase, prog, key, key1, key2, type, min, max, descr)
|
---|
122 | {
|
---|
123 | if (!prog)
|
---|
124 | {
|
---|
125 | progselect=document.getElementById("prog");
|
---|
126 | if (progselect.selectedIndex>=0)
|
---|
127 | prog=progselect.options[progselect.selectedIndex].value;
|
---|
128 | else
|
---|
129 | prog='all';
|
---|
130 | }
|
---|
131 | if (!key)
|
---|
132 | {
|
---|
133 | keyselect=document.getElementById("key");
|
---|
134 | if (!keyselect)
|
---|
135 | key='all';
|
---|
136 | else
|
---|
137 | if (keyselect.selectedIndex>=0)
|
---|
138 | key=keyselect.options[keyselect.selectedIndex].value;
|
---|
139 | else
|
---|
140 | key='all';
|
---|
141 | }
|
---|
142 |
|
---|
143 | switch(addcase)
|
---|
144 | {
|
---|
145 | case 1:
|
---|
146 | get_keys(prog, key, "10", "edit");
|
---|
147 | case 2:
|
---|
148 | get_values(1, prog, key, "edit");
|
---|
149 | }
|
---|
150 |
|
---|
151 | if (prog=='all' && (addcase==3 || addcase==2))
|
---|
152 | addcase=1;
|
---|
153 | if (key=='all' && addcase==3)
|
---|
154 | addcase=2;
|
---|
155 |
|
---|
156 |
|
---|
157 | for (var i = 1 ; i <= document.getElementById('maxindex').innerHTML ; i++)
|
---|
158 | if(document.getElementById('action'+i))
|
---|
159 | document.getElementById('action'+i).innerHTML = "";
|
---|
160 | //document.getElementById('action'+i).style.display = "none";
|
---|
161 |
|
---|
162 | tabBody=document.getElementById("valtable1");
|
---|
163 | row=document.createElement("TR");
|
---|
164 | row.id='val0';
|
---|
165 | row.bgColor='#C8C8C8';
|
---|
166 | cell0 = document.createElement("TD");
|
---|
167 | cell1 = document.createElement("TD");
|
---|
168 | cell2 = document.createElement("TD");
|
---|
169 | cell3 = document.createElement("TD");
|
---|
170 | cell4 = document.createElement("TD");
|
---|
171 | cell5 = document.createElement("TD");
|
---|
172 | cell6 = document.createElement("TD");
|
---|
173 | cell7 = document.createElement("TD");
|
---|
174 | cell8 = document.createElement("TD");
|
---|
175 | cell9 = document.createElement("TD");
|
---|
176 | cell10 = document.createElement("TD");
|
---|
177 | cell11 = document.createElement("TD");
|
---|
178 | cell0.className="indices1";
|
---|
179 | cell6.className="validsince1";
|
---|
180 | cell11.className="user1";
|
---|
181 | var updcase;
|
---|
182 |
|
---|
183 | // addcase: three cases
|
---|
184 | // 1: add new prog+key, val=NULL
|
---|
185 | // 2: add new key, val=NULL, prog=selected
|
---|
186 | // 3: add new val, prog=selected, key=selected, type/min/max fixed
|
---|
187 |
|
---|
188 | //field descr
|
---|
189 | input4 = document.createElement("INPUT");
|
---|
190 | input4.style.width = 200;
|
---|
191 | input4.id = 'newdescr0';
|
---|
192 | switch(addcase)
|
---|
193 | {
|
---|
194 | case 1:
|
---|
195 | updcase=5;
|
---|
196 | //field for prog
|
---|
197 | input1 = document.createElement("INPUT");
|
---|
198 | input1.style.width = 80;
|
---|
199 | input1.id = 'prog0';
|
---|
200 | cell1.appendChild(input1);
|
---|
201 | //fields for keys
|
---|
202 | input2 = document.createElement("INPUT");
|
---|
203 | input2.style.width = 100;
|
---|
204 | input2.id = '1key0';
|
---|
205 | cell2.appendChild(input2);
|
---|
206 | input10 = document.createElement("INPUT");
|
---|
207 | input10.id = '2key0';
|
---|
208 | input10.style.width = 100;
|
---|
209 | cell10.appendChild(input10);
|
---|
210 | //field for val
|
---|
211 | cell3.id = 'newval0';
|
---|
212 | textnode3=document.createTextNode("NULL");
|
---|
213 | cell3.appendChild(textnode3);
|
---|
214 | //field type
|
---|
215 | select7 = document.createElement("select");
|
---|
216 | select7.id = 'newtype0';
|
---|
217 | select7.option = 'string';
|
---|
218 | option7a = document.createElement("option");
|
---|
219 | option7a.text = '-';
|
---|
220 | option7a.value = '';
|
---|
221 | select7.appendChild(option7a);
|
---|
222 | option7b = document.createElement("option");
|
---|
223 | option7b.id = 'int';
|
---|
224 | option7b.text = 'int';
|
---|
225 | option7b.value = 'int';
|
---|
226 | select7.appendChild(option7b);
|
---|
227 | option7c = document.createElement("option");
|
---|
228 | option7c.id = 'float';
|
---|
229 | option7c.text = 'float';
|
---|
230 | option7c.value = 'float';
|
---|
231 | select7.appendChild(option7c);
|
---|
232 | option7d = document.createElement("option");
|
---|
233 | option7d.id = 'string';
|
---|
234 | option7d.text = 'string';
|
---|
235 | option7d.value = 'string';
|
---|
236 | select7.appendChild(option7d);
|
---|
237 | option7e = document.createElement("option");
|
---|
238 | option7e.id = 'bool';
|
---|
239 | option7e.text = 'bool';
|
---|
240 | option7e.value = 'bool';
|
---|
241 | select7.appendChild(option7e);
|
---|
242 | cell7.appendChild(select7);
|
---|
243 | //field for min
|
---|
244 | input8 = document.createElement("INPUT");
|
---|
245 | input8.id = 'newmin0';
|
---|
246 | input8.style.width = 50;
|
---|
247 | cell8.appendChild(input8);
|
---|
248 | //field for max
|
---|
249 | input9 = document.createElement("INPUT");
|
---|
250 | input9.id = 'newmax0';
|
---|
251 | input9.style.width = 50;
|
---|
252 | cell9.appendChild(input9);
|
---|
253 | break;
|
---|
254 | case 2:
|
---|
255 | updcase=1;
|
---|
256 | //field for prog
|
---|
257 | cell1.id = 'prog0';
|
---|
258 | textnode1=document.createTextNode(prog);
|
---|
259 | cell1.appendChild(textnode1);
|
---|
260 | //field for key
|
---|
261 | input2 = document.createElement("INPUT");
|
---|
262 | input2.id = '1key0';
|
---|
263 | input2.style.width = 100;
|
---|
264 | if (key1)
|
---|
265 | input2.value = key1;
|
---|
266 | cell2.appendChild(input2);
|
---|
267 | input10 = document.createElement("INPUT");
|
---|
268 | input10.id = '2key0';
|
---|
269 | input10.style.width = 100;
|
---|
270 | if (key2)
|
---|
271 | input10.value = key2;
|
---|
272 | cell10.appendChild(input10);
|
---|
273 | //field for val
|
---|
274 | cell3.id = 'newval0';
|
---|
275 | textnode3=document.createTextNode("NULL");
|
---|
276 | cell3.appendChild(textnode3);
|
---|
277 | //field type
|
---|
278 | select7 = document.createElement("select");
|
---|
279 | select7.id = 'newtype0';
|
---|
280 | select7.option = 'string';
|
---|
281 | option7a = document.createElement("option");
|
---|
282 | option7a.text = '-';
|
---|
283 | option7a.value = '';
|
---|
284 | select7.appendChild(option7a);
|
---|
285 | option7b = document.createElement("option");
|
---|
286 | option7b.id = 'int';
|
---|
287 | option7b.text = 'int';
|
---|
288 | option7b.value = 'int';
|
---|
289 | select7.appendChild(option7b);
|
---|
290 | option7c = document.createElement("option");
|
---|
291 | option7c.id = 'float';
|
---|
292 | option7c.text = 'float';
|
---|
293 | option7c.value = 'float';
|
---|
294 | select7.appendChild(option7c);
|
---|
295 | option7d = document.createElement("option");
|
---|
296 | option7d.id = 'string';
|
---|
297 | option7d.text = 'string';
|
---|
298 | option7d.value = 'string';
|
---|
299 | select7.appendChild(option7d);
|
---|
300 | option7e = document.createElement("option");
|
---|
301 | option7e.id = 'bool';
|
---|
302 | option7e.text = 'bool';
|
---|
303 | option7e.value = 'bool';
|
---|
304 | select7.appendChild(option7e);
|
---|
305 | cell7.appendChild(select7);
|
---|
306 | //field for min
|
---|
307 | input8 = document.createElement("INPUT");
|
---|
308 | input8.id = 'newmin0';
|
---|
309 | input8.style.width = 50;
|
---|
310 | if (min)
|
---|
311 | input8.value = min;
|
---|
312 | cell8.appendChild(input8);
|
---|
313 | //field for max
|
---|
314 | input9 = document.createElement("INPUT");
|
---|
315 | input9.id = 'newmax0';
|
---|
316 | input9.style.width = 50;
|
---|
317 | if (max)
|
---|
318 | input9.value = max;
|
---|
319 | cell9.appendChild(input9);
|
---|
320 | //field for descr
|
---|
321 | if (descr)
|
---|
322 | input4.value = descr;
|
---|
323 | break;
|
---|
324 | case 3:
|
---|
325 | updcase=2;
|
---|
326 | //field for prog
|
---|
327 | cell1.id = 'prog0';
|
---|
328 | textnode1=document.createTextNode(prog);
|
---|
329 | cell1.appendChild(textnode1);
|
---|
330 | //field for key
|
---|
331 | cell2.id = '1key0';
|
---|
332 | textnode2=document.createTextNode(key1);
|
---|
333 | cell2.appendChild(textnode2);
|
---|
334 | cell10.id = '2key0';
|
---|
335 | textnode10=document.createTextNode(key2);
|
---|
336 | cell10.appendChild(textnode10);
|
---|
337 | //field for val
|
---|
338 | input3 = document.createElement("INPUT");
|
---|
339 | input3.style.width = 100;
|
---|
340 | input3.id = 'newval0';
|
---|
341 | cell3.appendChild(input3);
|
---|
342 | //field type
|
---|
343 | cell7.id = 'type0';
|
---|
344 | textnode7 = document.createTextNode(type);
|
---|
345 | cell7.appendChild(textnode7);
|
---|
346 | //field min
|
---|
347 | cell8.id = 'min0';
|
---|
348 | textnode8 = document.createTextNode(min);
|
---|
349 | cell8.appendChild(textnode8);
|
---|
350 | //field max
|
---|
351 | cell9.id = 'max0';
|
---|
352 | textnode9 = document.createTextNode(max);
|
---|
353 | cell9.appendChild(textnode9);
|
---|
354 | break;
|
---|
355 | default:
|
---|
356 | break;
|
---|
357 | }
|
---|
358 |
|
---|
359 | //rest of field descr
|
---|
360 | cell4.appendChild(input4);
|
---|
361 | //field action
|
---|
362 | input5a = document.createElement("input");
|
---|
363 | input5a.value = 'Add';
|
---|
364 | input5a.type = "button";
|
---|
365 | input5a.onclick = function () { UpdateRow(updcase, 0); onclick() }
|
---|
366 | cell5.appendChild(input5a);
|
---|
367 | input5b = document.createElement("input");
|
---|
368 | input5b.value = 'Cancel';
|
---|
369 | input5b.type = "button";
|
---|
370 | input5b.onclick = function () { CancelAddRow(prog, key); onclick() }
|
---|
371 | cell5.appendChild(input5b);
|
---|
372 |
|
---|
373 | row.appendChild(cell0);//index, counter
|
---|
374 | row.appendChild(cell6);//valid from
|
---|
375 | row.appendChild(cell1);//prog
|
---|
376 | row.appendChild(cell2);//key1
|
---|
377 | row.appendChild(cell10);//key2
|
---|
378 | row.appendChild(cell3);//value
|
---|
379 | row.appendChild(cell7);//type
|
---|
380 | row.appendChild(cell8);//min
|
---|
381 | row.appendChild(cell9);//max
|
---|
382 | row.appendChild(cell4);//descr
|
---|
383 | row.appendChild(cell5);//action
|
---|
384 | row.appendChild(cell11);//user
|
---|
385 | tabBody.appendChild(row);
|
---|
386 |
|
---|
387 | ShowHide('indices', 'sh_indices', 1)
|
---|
388 | ShowHide('validsince', 'sh_validsince', 1)
|
---|
389 | ShowHide('user', 'sh_user', 1)
|
---|
390 |
|
---|
391 | //disabeling all other edit/add buttons
|
---|
392 | // (to be removed later when solution for adding multiple new rows is found)
|
---|
393 | document.getElementById('addrowvals').style.display = "none";
|
---|
394 | document.getElementById('addrowvals2').style.display = "none";
|
---|
395 | document.getElementById('addrowkey').style.display = "none";
|
---|
396 | document.getElementById('addrowprog').style.display = "none";
|
---|
397 | }
|
---|
398 |
|
---|
399 | function CancelAddRow(prog, key)
|
---|
400 | {
|
---|
401 | //get select program and key
|
---|
402 | if (!prog)
|
---|
403 | {
|
---|
404 | progselect=document.getElementById("prog");
|
---|
405 | prog=progselect.options[progselect.selectedIndex].value;
|
---|
406 | }
|
---|
407 | if (!key)
|
---|
408 | {
|
---|
409 | keyselect=document.getElementById("key");
|
---|
410 | key=keyselect.options[keyselect.selectedIndex].value;
|
---|
411 | }
|
---|
412 | //reload the original content in case of cancel
|
---|
413 | get_values(1, prog, key, "edit");
|
---|
414 |
|
---|
415 | //disabeling all other edit/add buttons
|
---|
416 | // (to be removed later when solution for adding multiple new rows is found)
|
---|
417 | document.getElementById('addrowvals').style.display = "";
|
---|
418 | document.getElementById('addrowvals2').style.display = "";
|
---|
419 | document.getElementById('addrowkey').style.display = "";
|
---|
420 | document.getElementById('addrowprog').style.display = "";
|
---|
421 | }
|
---|
422 |
|
---|
423 | function CancelUpdate()
|
---|
424 | {
|
---|
425 | //get select program and key
|
---|
426 | document.getElementById('addrowprog').style.display = "";
|
---|
427 | progselect=document.getElementById("prog");
|
---|
428 | prog=progselect.options[progselect.selectedIndex].value;
|
---|
429 | keyselect=document.getElementById("key");
|
---|
430 | key=keyselect.options[keyselect.selectedIndex].value;
|
---|
431 | //reload the original table in case of cancel
|
---|
432 | get_values(1, prog, key, "edit");
|
---|
433 | }
|
---|
434 |
|
---|
435 | function EditRow(index)
|
---|
436 | {
|
---|
437 | //disabeling all other edit/add buttons
|
---|
438 | // (to be removed later when solution for adding multiple new rows is found)
|
---|
439 | for (var i = 1 ; i <= document.getElementById('maxindex').innerHTML ; i++)
|
---|
440 | if(document.getElementById('action'+i) && i!=index)
|
---|
441 | //document.getElementById('action'+i).style.display = "none";
|
---|
442 | document.getElementById('action'+i).innerHTML = "";
|
---|
443 | document.getElementById('addrowvals').style.display = "none";
|
---|
444 | document.getElementById('addrowvals2').style.display = "none";
|
---|
445 | document.getElementById('addrowkey').style.display = "none";
|
---|
446 | document.getElementById('addrowprog').style.display = "none";
|
---|
447 |
|
---|
448 | //get current values
|
---|
449 | oldval=document.getElementById('val'+index).innerHTML;
|
---|
450 | olddescr=document.getElementById('descr'+index).innerHTML;
|
---|
451 | oldtype=document.getElementById('type'+index).innerHTML;
|
---|
452 | // added to make min/max editable
|
---|
453 | oldmin=document.getElementById('min'+index).innerHTML;
|
---|
454 | oldmax=document.getElementById('max'+index).innerHTML;
|
---|
455 | if (!oldval)
|
---|
456 | delcase=6;
|
---|
457 | else
|
---|
458 | delcase=4;
|
---|
459 | //set field for value
|
---|
460 | if (oldtype=='bool')
|
---|
461 | {
|
---|
462 | if (oldval=='yes')
|
---|
463 | textval="<input name='boolbox' type='radio' id='newval"+index+"' value='yes' checked> yes";
|
---|
464 | else
|
---|
465 | textval="<input name='boolbox' type='radio' id='newval"+index+"' value='yes'> yes";
|
---|
466 | if (oldval=='no')
|
---|
467 | textval=textval+"<input name='boolbox' type='radio' id='newval"+index+"' value='no' checked> no"
|
---|
468 | else
|
---|
469 | textval=textval+"<input name='boolbox' type='radio' id='newval"+index+"' value='no'> no"
|
---|
470 | }
|
---|
471 | else
|
---|
472 | textval="<input align='right' id='newval"+index+"' value='"+oldval+"'>";
|
---|
473 | document.getElementById('val'+index).innerHTML = textval;
|
---|
474 | //set field for description
|
---|
475 | document.getElementById('descr'+index).innerHTML = "<input align='right' id='newdescr"+index+"' value='"+olddescr+"'>";
|
---|
476 | // added to make min/max editable
|
---|
477 | document.getElementById('min'+index).innerHTML = "<input align='right' id='newmin"+index+"' value='"+oldmin+"'>";
|
---|
478 | document.getElementById('max'+index).innerHTML = "<input align='right' id='newmax"+index+"' value='"+oldmax+"'>";
|
---|
479 | /*
|
---|
480 | //set field for type
|
---|
481 | typeselecttext="<select id='newtype"+index+"' value='"+oldtype+"'>"+"<option>-</option>";
|
---|
482 | if (oldtype=='int')
|
---|
483 | typeselecttext=typeselecttext+"<option selected>int</option>";
|
---|
484 | else
|
---|
485 | typeselecttext=typeselecttext+"<option>int</option>";
|
---|
486 | if (oldtype=='float')
|
---|
487 | typeselecttext=typeselecttext+"<option selected>float</option>";
|
---|
488 | else
|
---|
489 | typeselecttext=typeselecttext+"<option>float</option>";
|
---|
490 | if (oldtype=='string')
|
---|
491 | typeselecttext=typeselecttext+"<option selected>string</option>";
|
---|
492 | else
|
---|
493 | typeselecttext=typeselecttext+"<option>string</option>";
|
---|
494 | if (oldtype=='bool')
|
---|
495 | typeselecttext=typeselecttext+"<option selected>bool</option>";
|
---|
496 | else
|
---|
497 | typeselecttext=typeselecttext+"<option>bool</option>";
|
---|
498 | typeselecttext=typeselecttext+"</select>";
|
---|
499 | document.getElementById('type'+index).innerHTML = typeselecttext;
|
---|
500 | */
|
---|
501 |
|
---|
502 | //set field for action
|
---|
503 | actiontext="<input type='button' value='Update' onclick='UpdateRow(3,"+index+")'>";
|
---|
504 | notyetvalid=document.getElementById('notyetvalid'+index)
|
---|
505 | if (delcase!=6 || notyetvalid)
|
---|
506 | actiontext=actiontext+"<input type='button' value='Delete' onclick='UpdateRow("+delcase+","+index+")'>";
|
---|
507 | actiontext=actiontext+"<input type='button' value='Cancel' onclick='CancelUpdate()'>";
|
---|
508 | document.getElementById('action'+index).innerHTML =actiontext;
|
---|
509 | }
|
---|
510 |
|
---|
511 | function UpdateRow(updcase,index)
|
---|
512 | {
|
---|
513 | // five cases of update corresponds to
|
---|
514 | // 5: add new prog + key addcase 1
|
---|
515 | // 1: add new key addcase 2
|
---|
516 | // 2: add new val (for same key) addcase 3 -> same type,min,max
|
---|
517 | // 3: edit val -> same type,min,max
|
---|
518 | // 4: delete val (ie set to NULL) -> same type,min,max
|
---|
519 | // 6: delete new key (ie val still NULL) -> real delete
|
---|
520 | descr=document.getElementById('newdescr'+index).value;
|
---|
521 | origindex=0;
|
---|
522 | switch(updcase)
|
---|
523 | {
|
---|
524 | case 5:
|
---|
525 | prog=document.getElementById('prog'+index).value;
|
---|
526 | key1=document.getElementById('1key'+index).value;
|
---|
527 | key2=document.getElementById('2key'+index).value;
|
---|
528 | val=document.getElementById('newval'+index).innerHTML;
|
---|
529 | type=document.getElementById('newtype'+index).value;
|
---|
530 | min=document.getElementById('newmin'+index).value;
|
---|
531 | max=document.getElementById('newmax'+index).value;
|
---|
532 | break;
|
---|
533 | case 1:
|
---|
534 | //prog=document.getElementById('prog'+index).value;
|
---|
535 | prog=document.getElementById('prog'+index).innerHTML;
|
---|
536 | key1=document.getElementById('1key'+index).value;
|
---|
537 | key2=document.getElementById('2key'+index).value;
|
---|
538 | val=document.getElementById('newval'+index).innerHTML;
|
---|
539 | type=document.getElementById('newtype'+index).value;
|
---|
540 | min=document.getElementById('newmin'+index).value;
|
---|
541 | max=document.getElementById('newmax'+index).value;
|
---|
542 | break;
|
---|
543 | case 2:
|
---|
544 | //prog=document.getElementById('prog'+index).value;
|
---|
545 | prog=document.getElementById('prog'+index).innerHTML;
|
---|
546 | key1=document.getElementById('1key'+index).innerHTML;
|
---|
547 | key2=document.getElementById('2key'+index).innerHTML;
|
---|
548 | val=document.getElementById('newval'+index).value;
|
---|
549 | type=document.getElementById('type'+index).innerHTML;
|
---|
550 | min=document.getElementById('min'+index).innerHTML;
|
---|
551 | max=document.getElementById('max'+index).innerHTML;
|
---|
552 | break;
|
---|
553 | case 3:
|
---|
554 | prog=document.getElementById('prog'+index).innerHTML;
|
---|
555 | key1=document.getElementById('1key'+index).innerHTML;
|
---|
556 | key2=document.getElementById('2key'+index).innerHTML;
|
---|
557 | type=document.getElementById('type'+index).innerHTML;
|
---|
558 | // changed to make min/max editable
|
---|
559 | //min=document.getElementById('min'+index).innerHTML;
|
---|
560 | //max=document.getElementById('max'+index).innerHTML;
|
---|
561 | min=document.getElementById('newmin'+index).value;
|
---|
562 | max=document.getElementById('newmax'+index).value;
|
---|
563 | val="hallo";
|
---|
564 | if (type=="bool")
|
---|
565 | {
|
---|
566 | radio=document.getElementsByName('boolbox');
|
---|
567 | for (i=0; i< radio.length; i++)
|
---|
568 | if (radio[i].checked)
|
---|
569 | val=radio[i].value;
|
---|
570 | }
|
---|
571 | else
|
---|
572 | val=document.getElementById('newval'+index).value;
|
---|
573 | origindex=document.getElementById('1origindex'+index).innerHTML;
|
---|
574 | break;
|
---|
575 | case 4:
|
---|
576 | case 6:
|
---|
577 | answer = confirm("Do you really want to delete the value?");
|
---|
578 | if (!answer)
|
---|
579 | return;
|
---|
580 | prog=document.getElementById('prog'+index).innerHTML;
|
---|
581 | key1=document.getElementById('1key'+index).innerHTML;
|
---|
582 | key2=document.getElementById('2key'+index).innerHTML;
|
---|
583 | val=document.getElementById('newval'+index).value;
|
---|
584 | if (!val)
|
---|
585 | val="NULL";
|
---|
586 | type=document.getElementById('type'+index).innerHTML;
|
---|
587 | min=document.getElementById('min'+index).innerHTML;
|
---|
588 | max=document.getElementById('max'+index).innerHTML;
|
---|
589 | origindex=document.getElementById('1origindex'+index).innerHTML;
|
---|
590 | break;
|
---|
591 | }
|
---|
592 | if (!descr)
|
---|
593 | alert("Please insert description!");
|
---|
594 | if (!key1)
|
---|
595 | alert("Please insert key1!");
|
---|
596 | if (!val)
|
---|
597 | alert("Please insert value!");
|
---|
598 | if (!val || !descr || !key1)
|
---|
599 | return;
|
---|
600 | if (index==0)
|
---|
601 | index=-1;
|
---|
602 | if (!type && (updcase==2 || updcase==3 || updcase==4))
|
---|
603 | {
|
---|
604 | alert("Please select type!");
|
---|
605 | return;
|
---|
606 | }
|
---|
607 |
|
---|
608 | //check if value has correct type and is within ranges
|
---|
609 | // for string no check needed
|
---|
610 | if (updcase==3)
|
---|
611 | {
|
---|
612 | if (type=='int' && parseInt(val)!=val)
|
---|
613 | {
|
---|
614 | alert("Value is not a int.");
|
---|
615 | return;
|
---|
616 | }
|
---|
617 | if (type=='float' && parseFloat(val)!=val)
|
---|
618 | {
|
---|
619 | alert("Value is not a float.");
|
---|
620 | return;
|
---|
621 | }
|
---|
622 | if (type=='bool' && val!='yes' && val!='no')
|
---|
623 | {
|
---|
624 | alert("Value is neither 'yes' not 'no'.");
|
---|
625 | return;
|
---|
626 | }
|
---|
627 | // check ranges for int
|
---|
628 | if (max && type=='int' && parseInt(val)>parseInt(max))
|
---|
629 | {
|
---|
630 | alert("You cannot enter a value larger than "+max+".");
|
---|
631 | return;
|
---|
632 | }
|
---|
633 | if (min && type=='int' && parseInt(val)<parseInt(min))
|
---|
634 | {
|
---|
635 | alert("You cannot enter a value smaller than "+min+".");
|
---|
636 | return;
|
---|
637 | }
|
---|
638 | // check ranges for float
|
---|
639 | if (max && type=='float' && parseFloat(val)>parseFloat(max))
|
---|
640 | {
|
---|
641 | alert("You cannot enter a value larger than "+max+".");
|
---|
642 | return;
|
---|
643 | }
|
---|
644 | if (min && type=='float' && parseFloat(val)<parseFloat(min))
|
---|
645 | {
|
---|
646 | alert("You cannot enter a value smaller than "+min+".");
|
---|
647 | return;
|
---|
648 | }
|
---|
649 | }
|
---|
650 |
|
---|
651 | /*
|
---|
652 | if (!min && (type=='int' || type=='float'))
|
---|
653 | {
|
---|
654 | alert("Please insert minimum!");
|
---|
655 | return;
|
---|
656 | }
|
---|
657 | if (!max && (type=='int' || type=='float'))
|
---|
658 | {
|
---|
659 | alert("Please insert maximum!");
|
---|
660 | return;
|
---|
661 | }
|
---|
662 | */
|
---|
663 | //check if min/max have correct type
|
---|
664 | // for string no check needed
|
---|
665 | if (updcase==1 || updcase==5)
|
---|
666 | {
|
---|
667 | if (min && type=='int' && parseInt(min)!=min)
|
---|
668 | {
|
---|
669 | alert("Minimum is not a int.");
|
---|
670 | return;
|
---|
671 | }
|
---|
672 | if (max && type=='int' && parseInt(max)!=max)
|
---|
673 | {
|
---|
674 | alert("Maximum is not a int.");
|
---|
675 | return;
|
---|
676 | }
|
---|
677 | if (min && type=='float' && parseFloat(min)!=min)
|
---|
678 | {
|
---|
679 | alert("Minimum is not a float.");
|
---|
680 | return;
|
---|
681 | }
|
---|
682 | if (max && type=='float' && parseFloat(max)!=max)
|
---|
683 | {
|
---|
684 | alert("Maximum is not a float.");
|
---|
685 | return;
|
---|
686 | }
|
---|
687 | if (min && max && type=='float' && parseFloat(max)<parseFloat(min))
|
---|
688 | {
|
---|
689 | alert("Maximum cannot be smaller than minimum.");
|
---|
690 | return;
|
---|
691 | }
|
---|
692 | if (min && max && type=='int' && parseInt(max)<parseInt(min))
|
---|
693 | {
|
---|
694 | alert("Maximum cannot be smaller than minimum.");
|
---|
695 | return;
|
---|
696 | }
|
---|
697 | }
|
---|
698 |
|
---|
699 | phpcall="insert_po.php?fUpdCase="+updcase+"&fIndex="+index+"&fOriginalIndex="+origindex
|
---|
700 | +"&fProgram="+prog+"&fKey1="+key1+"&fKey2="+key2+"&fValue="+val+"&fDescription="+descr
|
---|
701 | +"&fType="+type+"&fMin="+min+"&fMax="+max;
|
---|
702 | //alert(phpcall);
|
---|
703 |
|
---|
704 | xmlhttp.open("GET", phpcall, false);
|
---|
705 | xmlhttp.send();
|
---|
706 |
|
---|
707 | // get somehow return value of inser_po.php
|
---|
708 | // to catch cases where insert was rejected due to no update
|
---|
709 | if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
---|
710 | {
|
---|
711 | if (xmlhttp.responseText=="no change")
|
---|
712 | {
|
---|
713 | alert("You didn't change anything.");
|
---|
714 | return;
|
---|
715 | }
|
---|
716 | if (xmlhttp.responseText=="key exists")
|
---|
717 | {
|
---|
718 | alert("This key already exists. You cannot insert it a second time.");
|
---|
719 | return;
|
---|
720 | }
|
---|
721 | if (xmlhttp.responseText=="prog exists")
|
---|
722 | {
|
---|
723 | alert("This program already exists. You cannot insert it a second time.");
|
---|
724 | return;
|
---|
725 | }
|
---|
726 | if (xmlhttp.responseText=="user empty")
|
---|
727 | {
|
---|
728 | alert("User name is missing. Please give a user name when logging in.");
|
---|
729 | return;
|
---|
730 | }
|
---|
731 | if (xmlhttp.responseText=="type empty")
|
---|
732 | {
|
---|
733 | alert("Type is missing. Please select a type.");
|
---|
734 | return;
|
---|
735 | }
|
---|
736 | alert(xmlhttp.responseText);
|
---|
737 | }
|
---|
738 | else
|
---|
739 | alert("Mist! "+xmlhttp.responseText);
|
---|
740 |
|
---|
741 | //reload the content of the page
|
---|
742 | progselect=document.getElementById("prog");
|
---|
743 | if (!progselect)
|
---|
744 | oldprog=prog;
|
---|
745 | else
|
---|
746 | if (progselect.selectedIndex>=0)
|
---|
747 | oldprog=progselect.options[progselect.selectedIndex].value;
|
---|
748 | else
|
---|
749 | oldprog=prog;
|
---|
750 | keyselect=document.getElementById("key");
|
---|
751 | if (!keyselect)
|
---|
752 | oldkey=key1+"."+key2;
|
---|
753 | else
|
---|
754 | if (keyselect.selectedIndex>=0)
|
---|
755 | oldkey=keyselect.options[keyselect.selectedIndex].value;
|
---|
756 | else
|
---|
757 | oldkey=key1+"."+key2;
|
---|
758 |
|
---|
759 | oldprog=prog;
|
---|
760 | oldkey=key1+"."+key2;
|
---|
761 | //reload progs and keys
|
---|
762 | get_progs(oldprog, "10", "edit");
|
---|
763 | get_keys(oldprog, oldkey, "10", "edit");
|
---|
764 | //reload values
|
---|
765 | xmlhttp.open("GET","get_values.php?fGetValCase=1&fKey="+oldkey+"&fProgram="+oldprog,false);
|
---|
766 | xmlhttp.send();
|
---|
767 | if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
---|
768 | document.getElementById('valuefield1').innerHTML = xmlhttp.responseText;
|
---|
769 | else
|
---|
770 | document.getElementById('valuefield1').innerHTML = "argh";
|
---|
771 | }
|
---|
772 |
|
---|
773 | function ShowCurrent()
|
---|
774 | {
|
---|
775 | for (var i = 1 ; i <= document.getElementById('maxindex').innerHTML ; i++)
|
---|
776 | if(document.getElementById('old'+i))
|
---|
777 | document.getElementById('old'+i).style.display = "none";
|
---|
778 | document.getElementById('showcurrent').style.display = "none";
|
---|
779 | document.getElementById('showcurrent2').style.display = "none";
|
---|
780 | document.getElementById('showall').style.display = "";
|
---|
781 | document.getElementById('showall2').style.display = "";
|
---|
782 | }
|
---|
783 |
|
---|
784 | function ShowAll()
|
---|
785 | {
|
---|
786 | for (var i = 1 ; i <= document.getElementById('maxindex').innerHTML ; i++)
|
---|
787 | if(document.getElementById('old'+i))
|
---|
788 | {
|
---|
789 | document.getElementById('old'+i).style.display = "";
|
---|
790 | document.getElementById('old'+i).style.color = "grey";
|
---|
791 | }
|
---|
792 | document.getElementById('showcurrent').style.display = "";
|
---|
793 | document.getElementById('showcurrent2').style.display = "";
|
---|
794 | document.getElementById('showall').style.display = "none";
|
---|
795 | document.getElementById('showall2').style.display = "none";
|
---|
796 | }
|
---|
797 |
|
---|
798 | function InsertRow(table, row)
|
---|
799 | {
|
---|
800 | var x=document.getElementById('valtable'+table).insertRow(row);
|
---|
801 | y=x.insertCell(0);
|
---|
802 | y.colSpan='5';
|
---|
803 | y.innerHTML=" ";
|
---|
804 | }
|
---|
805 |
|
---|
806 | function CompareValues()
|
---|
807 | {
|
---|
808 | counter=0;
|
---|
809 | maxindex2=document.getElementById('maxindex').innerHTML;
|
---|
810 | maxindex3=document.getElementById('maxindex3').innerHTML;
|
---|
811 | if (parseInt(maxindex2)>parseInt(maxindex3))
|
---|
812 | maxindex=maxindex2;
|
---|
813 | else
|
---|
814 | maxindex=maxindex3;
|
---|
815 |
|
---|
816 | for (var i = 1 ; i <= maxindex ; i++)
|
---|
817 | {
|
---|
818 | if (document.getElementById('2compare'+i))
|
---|
819 | {
|
---|
820 | counter++;
|
---|
821 | if (!document.getElementById('3compare'+i))
|
---|
822 | {
|
---|
823 | InsertRow(3,counter);
|
---|
824 | document.getElementById('2compare'+i).style.color='red';
|
---|
825 | }
|
---|
826 | else
|
---|
827 | {
|
---|
828 | val2=document.getElementById('2compare'+i).cells[5].innerHTML;
|
---|
829 | val3=document.getElementById('3compare'+i).cells[5].innerHTML;
|
---|
830 | if (val2!=val3)
|
---|
831 | {
|
---|
832 | document.getElementById('2compare'+i).style.color='blue';
|
---|
833 | document.getElementById('3compare'+i).style.color='blue';
|
---|
834 | }
|
---|
835 | }
|
---|
836 | }
|
---|
837 | else
|
---|
838 | if (document.getElementById('3compare'+i))
|
---|
839 | {
|
---|
840 | counter++;
|
---|
841 | InsertRow(2,counter);
|
---|
842 | document.getElementById('3compare'+i).style.color='green';
|
---|
843 | }
|
---|
844 | }
|
---|
845 | //document.getElementById('comparevals').style.display = "none";
|
---|
846 |
|
---|
847 | //reload all setting for show-menu
|
---|
848 | ShowHide('indices', 'sh_indices', 2)
|
---|
849 | ShowHide('indices', 'sh_indices', 3)
|
---|
850 | ShowHide('description', 'sh_descr', 2)
|
---|
851 | ShowHide('description', 'sh_descr', 3)
|
---|
852 | ShowHide('validsince', 'sh_validsince', 2)
|
---|
853 | ShowHide('validsince', 'sh_validsince', 3)
|
---|
854 | ShowHide('minimum', 'sh_min', 2)
|
---|
855 | ShowHide('minimum', 'sh_min', 3)
|
---|
856 | ShowHide('maximum', 'sh_max', 2)
|
---|
857 | ShowHide('maximum', 'sh_max', 3)
|
---|
858 | ShowHide('user', 'sh_user', 2)
|
---|
859 | ShowHide('user', 'sh_user', 3)
|
---|
860 | }
|
---|
861 |
|
---|
862 | function ShowHide(column, idname, getvalcase)
|
---|
863 | {
|
---|
864 | box=document.getElementById(idname+getvalcase);
|
---|
865 | text=box.checked? '':'none';
|
---|
866 |
|
---|
867 | for(var i=0;i<document.getElementsByTagName('*').length;i++)
|
---|
868 | if(document.getElementsByTagName('*')[i].className == column+getvalcase)
|
---|
869 | document.getElementsByTagName('*')[i].style.display = text;
|
---|
870 | }
|
---|
871 |
|
---|
872 | function ShowDateInput(idx)
|
---|
873 | {
|
---|
874 | document.getElementById('datepulldown'+idx).style.display = "none";
|
---|
875 | document.getElementById('dateinput'+idx).style.display = "inline";
|
---|
876 | set_statusdate(idx, get_statusdate(idx, 'pulldown'));
|
---|
877 | }
|
---|
878 |
|
---|
879 | function ShowDatePulldown(idx)
|
---|
880 | {
|
---|
881 | document.getElementById('datepulldown'+idx).style.display = "inline";
|
---|
882 | document.getElementById('dateinput'+idx).style.display = "none";
|
---|
883 | set_statusdate(idx, get_statusdate(idx, 'textinput'));
|
---|
884 | }
|
---|
885 |
|
---|
886 | function reset_dates(datename, dateval, dateval2, idx)
|
---|
887 | {
|
---|
888 | radio=document.getElementsByName('dateformat'+idx);
|
---|
889 | for (i=0; i< radio.length; i++)
|
---|
890 | if (radio[i].checked)
|
---|
891 | val=radio[i].value;
|
---|
892 | if (val=="pulldown")
|
---|
893 | {
|
---|
894 | //alert("reset:"+datename+"-"+dateval+"-"+dateval2+"-"+idx);
|
---|
895 | if (datename=="year")
|
---|
896 | {
|
---|
897 | get_dates("year", dateval, dateval2, idx);
|
---|
898 | get_dates("month", dateval, dateval2, idx);
|
---|
899 | }
|
---|
900 |
|
---|
901 | if (datename=="year" || datename=="month")
|
---|
902 | if (datename=="month")
|
---|
903 | get_dates("day", dateval, dateval2, idx);
|
---|
904 | else
|
---|
905 | get_dates("day", "empty", "empty", idx);
|
---|
906 |
|
---|
907 | if (datename=="year" || datename=="month" || datename=="day")
|
---|
908 | if (datename=="day")
|
---|
909 | get_dates("hour", dateval, dateval2, idx);
|
---|
910 | else
|
---|
911 | get_dates("hour", "empty", "empty", idx);
|
---|
912 |
|
---|
913 | if (datename=="year" || datename=="month" || datename=="day" || datename=="hour")
|
---|
914 | if (datename=="hour")
|
---|
915 | get_dates("min", dateval, dateval2, idx);
|
---|
916 | else
|
---|
917 | get_dates("min", "empty", "empty", idx);
|
---|
918 |
|
---|
919 | if (datename=="year" || datename=="month" || datename=="day" || datename=="hour" || datename=="min")
|
---|
920 | if (datename=="min")
|
---|
921 | get_dates("sec", dateval, dateval2, idx);
|
---|
922 | else
|
---|
923 | get_dates("sec", "empty", "empty", idx);
|
---|
924 | }
|
---|
925 | if (val=="textinput")
|
---|
926 | document.getElementById('statusdate'+idx).value="";
|
---|
927 | }
|
---|
928 |
|
---|
929 | function get_dates(datename, dateval, datevalprev, idx, reset)
|
---|
930 | {
|
---|
931 | //alert(datename+"_"+dateval+"_"+datevalprev+"_"+idx);
|
---|
932 | statusdate=get_statusdate(idx);
|
---|
933 | //if (datename=="year")
|
---|
934 | // statusdate="";
|
---|
935 | //alert(datename+" === "+statusdate+" --- "+datevalprev);
|
---|
936 | phpcall="get_date.php?fDateValue="+dateval+"&fDateValuePrev="+datevalprev+"&fDateName="+datename+"&fIdx="+idx+"&fStatusDate="+statusdate;
|
---|
937 | //phpcall="get_date.php?fDateValue="+dateval+"&fDateValuePrev="+statusdate+"&fDateName="+datename+"&fIdx="+idx;
|
---|
938 | //alert(phpcall);
|
---|
939 | xmlhttp.open("GET",phpcall,false);
|
---|
940 | xmlhttp.send();
|
---|
941 | if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
---|
942 | document.getElementById(datename+'select'+idx).innerHTML = xmlhttp.responseText;
|
---|
943 | else
|
---|
944 | document.getElementById(datename+'select'+idx).innerHTML = "argh";
|
---|
945 |
|
---|
946 | //to be able to do no reset in case when the function is called from reset_dates()
|
---|
947 | if (reset)
|
---|
948 | reset_dates(datename, "empty", "empty", idx);
|
---|
949 | }
|
---|
950 |
|
---|
951 | function set_statusdate(getvalcase, statusdate)
|
---|
952 | {
|
---|
953 | //get info whether to get statusdate from pulldown or input
|
---|
954 | radio=document.getElementsByName('dateformat'+getvalcase);
|
---|
955 | for (i=0; i< radio.length; i++)
|
---|
956 | if (radio[i].checked)
|
---|
957 | val=radio[i].value;
|
---|
958 |
|
---|
959 | if (val=="textinput")
|
---|
960 | {
|
---|
961 | document.getElementById('statusdate'+getvalcase).value=statusdate;
|
---|
962 | return
|
---|
963 | }
|
---|
964 |
|
---|
965 | //val=="pulldown"
|
---|
966 | //reset date pulldowns
|
---|
967 | get_dates("year", "empty", "empty", getvalcase, "yes");
|
---|
968 |
|
---|
969 | //whole string (YYYY-MM-DD hh:mm:ss)
|
---|
970 | if (statusdate=="")
|
---|
971 | return;
|
---|
972 |
|
---|
973 | dates=statusdate.split("-",3);
|
---|
974 | //years
|
---|
975 | if (!dates[0])
|
---|
976 | return;
|
---|
977 | get_dates("year", dates[0], dates[0], getvalcase);
|
---|
978 |
|
---|
979 | //months
|
---|
980 | if (!dates[1])
|
---|
981 | return;
|
---|
982 | get_dates("month", dates[1], dates[0], getvalcase);
|
---|
983 |
|
---|
984 | //rest of string (DD hh:mm:ss)
|
---|
985 | if (!dates[2])
|
---|
986 | return;
|
---|
987 |
|
---|
988 | rests=dates[2].split(" ",2);
|
---|
989 | //days
|
---|
990 | if (!rests[0])
|
---|
991 | return;
|
---|
992 | get_dates("day", rests[0], dates[1], getvalcase);
|
---|
993 |
|
---|
994 | //rest of string (hh:mm:ss)
|
---|
995 | if (!rests[1])
|
---|
996 | return;
|
---|
997 |
|
---|
998 | times=rests[1].split(":",3);
|
---|
999 | //hours
|
---|
1000 | if (!times[0])
|
---|
1001 | return;
|
---|
1002 | get_dates("hour", times[0], rests[0], getvalcase);
|
---|
1003 |
|
---|
1004 | //minutes
|
---|
1005 | if (!times[1])
|
---|
1006 | return;
|
---|
1007 | get_dates("min", times[1], times[0], getvalcase);
|
---|
1008 |
|
---|
1009 | //seconds
|
---|
1010 | if (!times[2])
|
---|
1011 | return;
|
---|
1012 | get_dates("sec", times[2], times[1], getvalcase);
|
---|
1013 | }
|
---|
1014 |
|
---|
1015 |
|
---|
1016 | function get_timestamp(getvalcase, direction)
|
---|
1017 | {
|
---|
1018 | statusdate=get_statusdate(getvalcase);
|
---|
1019 |
|
---|
1020 | // get next or previous timestamp
|
---|
1021 | xmlhttp.open("GET","get_timestamp.php?fStatusDate="+statusdate+"&fDirection="+direction,false);
|
---|
1022 | xmlhttp.send();
|
---|
1023 | if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
---|
1024 | newstatusdate = xmlhttp.responseText;
|
---|
1025 | else
|
---|
1026 | newstatusdate = "argh";
|
---|
1027 |
|
---|
1028 | set_statusdate(getvalcase, newstatusdate);
|
---|
1029 | }
|
---|
1030 |
|
---|
1031 | function show_viewinfo()
|
---|
1032 | {
|
---|
1033 | if (document.getElementById('showinfo').innerHTML=='Hide Info')
|
---|
1034 | {
|
---|
1035 | document.getElementById('viewinfo').style.display='none';
|
---|
1036 | document.getElementById('showinfo').innerHTML='Show Info';
|
---|
1037 | }
|
---|
1038 | else
|
---|
1039 | {
|
---|
1040 | document.getElementById('viewinfo').style.display='';
|
---|
1041 | document.getElementById('showinfo').innerHTML='Hide Info';
|
---|
1042 | }
|
---|
1043 |
|
---|
1044 | }
|
---|
1045 |
|
---|