Javascript multi-pane select for Sieve edit screen
[citadel.git] / webcit / sieve.c
1 /* 
2  * $Id: $
3  */
4 /**
5  * \defgroup Sieve view/edit sieve config
6  * \ingroup WebcitDisplayItems
7  */
8 /*@{*/
9 #include "webcit.h"
10
11
12 /**
13  * \brief view/edit sieve config
14  */
15 void display_sieve(void)
16 {
17         output_headers(1, 1, 2, 0, 0, 0);
18
19         wprintf("<script type=\"text/javascript\">                                      \n"
20                 "function ToggleSievePanels() {                                         \n"
21                 " d = ($('sieveform').bigaction.options[$('sieveform').bigaction.selectedIndex].value); \n"
22                 " for (i=0; i<3; ++i) {                                                 \n"
23                 "  if (i == d) {                                                        \n"
24                 "   $('sievediv' + i).style.display = 'block';                          \n"
25                 "  }                                                                    \n"
26                 "  else {                                                               \n"
27                 "   $('sievediv' + i).style.display = 'none';                           \n"
28                 "  }                                                                    \n"
29                 " }                                                                     \n"
30                 "}                                                                      \n"
31                 "</script>                                                              \n"
32         );
33
34         wprintf("<div id=\"banner\">\n");
35         wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
36         wprintf("<SPAN CLASS=\"titlebar\">");
37         wprintf(_("View/edit server-side mail filters"));
38         wprintf("</SPAN>\n");
39         wprintf("</TD></TR></TABLE>\n");
40         wprintf("</div>\n<div id=\"content\">\n");
41
42         wprintf("<div class=\"fix_scrollbar_bug\">"
43                 "<table border=0 width=100%% bgcolor=\"#FFFFFF\">"
44                 "<tr><td valign=top>\n");
45
46
47         wprintf("<form id=\"sieveform\" method=\"post\" action=\"save_sieve\">\n");
48
49         wprintf(_("When new mail arrives: "));
50         wprintf("<select name=\"bigaction\" size=1 onChange=\"ToggleSievePanels();\">\n");
51
52         wprintf("<option value=\"0\">");
53         wprintf(_("Leave it in my inbox without filtering"));
54         wprintf("</option>\n");
55
56         wprintf("<option value=\"1\">");
57         wprintf(_("Filter it according to rules selected below"));
58         wprintf("</option>\n");
59
60         wprintf("<option value=\"2\">");
61         wprintf(_("Filter it through a manually edited script (advanced users only)"));
62         wprintf("</option>\n");
63
64         wprintf("</select>");
65
66
67
68         /* The "no filtering" div */
69
70         wprintf("<div id=\"sievediv0\" style=\"display:none\">\n");
71         wprintf("<div align=\"center\"><br /><br />");
72         wprintf(_("Your incoming mail will not be filtered through any scripts."));
73         wprintf("<br /><br /></div>\n");
74         wprintf("</div>\n");
75
76         /* The "webcit managed scripts" div */
77
78         wprintf("<div id=\"sievediv1\" style=\"display:none\">\n");
79         wprintf("<div align=\"center\"><br /><br />");
80         wprintf("FIXME div 1 isn't finished yet");
81         wprintf("<br /><br /></div>\n");
82         wprintf("</div>\n");
83
84
85         /* The "I'm smart and can write my own Sieve scripts" div */
86
87         wprintf("<div id=\"sievediv2\" style=\"display:none\">\n");
88         wprintf("<div align=\"center\"><br /><br />");
89         wprintf("FIXME div 2 isn't finished yet");
90         wprintf("<br /><br /></div>\n");
91         wprintf("</div>\n");
92
93
94
95         /* The rest of this is common for all panels... */
96
97         wprintf("<div align=\"center\"><br>");
98         wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Save changes"));
99         wprintf("&nbsp;");
100         wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">\n", _("Cancel"));
101         wprintf("</div></form>\n");
102
103         wprintf("</td></tr></table></div>\n");
104
105         wprintf("<script type=\"text/javascript\">      \n"
106                 "ToggleSievePanels();                   \n"
107                 "</script>                              \n"
108         );
109
110         wDumpContent(1);
111
112 }
113
114
115
116
117 /*@}*/