2 <script type="text/javascript">
5 * This script should get called by every onChange event...
9 var highest_active_rule = (-1);
11 function UpdateRules() {
13 * Show only the active rows... /// TODO 255-> we need no limit anymore.
15 highest_active_rule = (-1);
16 for (i=0; i< 50; ++i) {
17 if ($('active'+i).checked) {
18 $('rule' + i).style.display = 'block';
19 highest_active_rule = i;
22 $('rule' + i).style.display = 'none';
27 * Show only the fields relevant to the rules...
29 for (i=0; i<=highest_active_rule; ++i) {
30 d = ($('movedown'+i));
31 if (i < highest_active_rule) {
32 d.style.display = 'block';
35 d.style.display = 'none';
37 d = ($('hfield'+i).options[$('hfield'+i).selectedIndex].value);
39 $('div_size'+i).style.display = 'none';
40 $('div_compare'+i).style.display = 'none';
41 $('div_nocompare'+i).style.display = 'block';
43 else if (d == 'size') {
44 $('div_size'+i).style.display = 'block';
45 $('div_compare'+i).style.display = 'none';
46 $('div_nocompare'+i).style.display = 'none';
49 $('div_size'+i).style.display = 'none';
50 $('div_compare'+i).style.display = 'block';
51 $('div_nocompare'+i).style.display = 'none';
53 d = ($('action'+i).options[$('action'+i).selectedIndex].value);
54 if (d == 'fileinto') {
55 $('div_fileinto'+i).style.display = 'block';
56 $('div_redirect'+i).style.display = 'none';
57 $('div_automsg'+i).style.display = 'none';
58 } else if (d == 'redirect') {
59 $('div_fileinto'+i).style.display = 'none';
60 $('div_redirect'+i).style.display = 'block';
61 $('div_automsg'+i).style.display = 'none';
62 } else if ((d == 'reject') || (d == 'vacation')) {
63 $('div_fileinto'+i).style.display = 'none';
64 $('div_redirect'+i).style.display = 'none';
65 $('div_automsg'+i).style.display = 'block';
67 $('div_fileinto'+i).style.display = 'none';
68 $('div_redirect'+i).style.display = 'none';
69 $('div_automsg'+i).style.display = 'none';
70 }/* TODO: we don't have any limits anymore */
71 if (highest_active_rule < 49) {
72 $('div_addrule').style.display = 'block';
74 $('div_addrule').style.display = 'none';
80 * Add a rule (really, just un-hide it)
83 highest_active_rule = highest_active_rule + 1;
84 $('active'+highest_active_rule).checked = true;
91 function SwapRules(ra, rb) {
93 var things = new Array();
95 things[1] = 'compare';
98 things[4] = 'fileinto';
99 things[5] = 'redirect';
101 things[7] = 'sizecomp';
102 things[8] = 'sizeval';
103 things[9] = 'automsg';
105 for (i=0; i<=9; ++i) {
106 tempval=$(things[i]+ra).value;
107 $(things[i]+ra).value = $(things[i]+rb).value;
108 $(things[i]+rb).value = tempval;
113 * Delete a rule (percolate the deleted rule out to the end, then deactivate it)
115 function DeleteRule(rd) {
116 for (j=rd; j<=highest_active_rule; ++j) {
119 $('active'+highest_active_rule).checked = false;