1 | |
---|
2 | function showElement(id) { |
---|
3 | try { |
---|
4 | if (typeof Effect != "undefined" && typeof Effect.Appear != "undefined") { |
---|
5 | if ($(id) && Element.visible(id) == false) |
---|
6 | Effect.Appear(id,{duration:0.4,queue:'end'}); |
---|
7 | } else { |
---|
8 | var el = document.getElementById(id) |
---|
9 | if (el && el.style.display == 'none') { |
---|
10 | el.style.display = 'block'; |
---|
11 | } |
---|
12 | } |
---|
13 | } catch (err) {alert(err)} |
---|
14 | return false; |
---|
15 | } |
---|
16 | |
---|
17 | function hideElement(id) { |
---|
18 | if (typeof Effect != "undefined" && typeof Effect.Fade != "undefined") { |
---|
19 | if ($(id) && Element.visible(id)) |
---|
20 | Effect.Fade(id,{duration:0.4,queue:'end'}); |
---|
21 | } else { |
---|
22 | var el = document.getElementById(id) |
---|
23 | if (el && el.style.display != 'none') { |
---|
24 | el.style.display = 'none'; |
---|
25 | } |
---|
26 | } |
---|
27 | return false; |
---|
28 | } |
---|
29 | |
---|
30 | function clearFilterPane(id) { |
---|
31 | var form = document.getElementById(id) |
---|
32 | |
---|
33 | for (var i = 0; i < form.elements.length; i++) { |
---|
34 | var el = form.elements[i] |
---|
35 | if (el.type == 'select-one') { |
---|
36 | el.selectedIndex = 0 |
---|
37 | } else if (el.type == 'text' || el.type == 'textarea') { |
---|
38 | form.elements[i].value = '' |
---|
39 | } |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | function filterOpChange(id, controlId) { |
---|
44 | // id should be of the form op.propertyName |
---|
45 | if (id.slice(0, 10) == 'filter.op.') { |
---|
46 | var prop = id.substring(10) |
---|
47 | var el = document.getElementById(id) |
---|
48 | var selection = el.options[el.selectedIndex] |
---|
49 | if (el) { |
---|
50 | if (el.type == 'select-one') { |
---|
51 | if (selection.value == 'Between') { |
---|
52 | showElement('between-span-'+prop) |
---|
53 | } else { |
---|
54 | hideElement('between-span-'+prop) |
---|
55 | } |
---|
56 | } |
---|
57 | |
---|
58 | var containerName = prop+'-container' |
---|
59 | if (selection.value == 'IsNull' || selection.value == 'IsNotNull') { |
---|
60 | hideElement(controlId); |
---|
61 | // Take care of date picker fields we created. |
---|
62 | if (document.getElementById(containerName)) hideElement(containerName) |
---|
63 | } else { |
---|
64 | showElement(controlId); |
---|
65 | // Take care of date picker fields. |
---|
66 | if (document.getElementById(containerName)) showElement(containerName) |
---|
67 | } |
---|
68 | } |
---|
69 | } |
---|
70 | } |
---|
71 | |
---|
72 | function selectDefaultOperator(id) { |
---|
73 | var dropdown = document.getElementById(id) |
---|
74 | if (dropdown && dropdown.selectedIndex <= 0) { |
---|
75 | dropdown.selectedIndex = 1 |
---|
76 | } |
---|
77 | } |
---|