5 * \defgroup Sieve view/edit sieve config
6 * \ingroup WebcitDisplayItems
11 #define MAX_SCRIPTS 100
13 #define RULES_SCRIPT "__WebCit_Generated_Script__"
16 * \brief view/edit sieve config
18 void display_sieve(void)
20 char script_names[MAX_SCRIPTS][64];
22 int active_script = (-1);
25 int rules_script_is_active = 0;
28 memset(script_names, 0, sizeof script_names);
30 serv_puts("MSIV listscripts");
31 serv_getln(buf, sizeof(buf));
32 if (buf[0] == '1') while (serv_getln(buf, sizeof(buf)), strcmp(buf, "000")) {
33 if (num_scripts < MAX_SCRIPTS) {
34 extract_token(script_names[num_scripts], buf, 0, '|', 64);
35 if (extract_int(buf, 1) > 0) {
36 active_script = num_scripts;
37 if (!strcasecmp(script_names[num_scripts], RULES_SCRIPT)) {
38 rules_script_is_active = 1;
45 output_headers(1, 1, 2, 0, 0, 0);
47 wprintf("<script type=\"text/javascript\"> \n"
49 "var previously_active_script; \n"
51 "function ToggleSievePanels() { \n"
52 " d = ($('sieveform').bigaction.options[$('sieveform').bigaction.selectedIndex].value); \n"
53 " for (i=0; i<3; ++i) { \n"
55 " $('sievediv' + i).style.display = 'block'; \n"
58 " $('sievediv' + i).style.display = 'none'; \n"
63 "function ToggleScriptPanels() { \n"
64 " d = ($('sieveform').active_script.options[$('sieveform').active_script.selectedIndex].value); \n"
65 " if ($('script_' + previously_active_script)) { \n"
66 " $('script_' + previously_active_script).style.display = 'none'; \n"
68 " $('script_' + d).style.display = 'block'; \n"
69 " previously_active_script = d; \n"
75 wprintf("<div id=\"banner\">\n");
76 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
77 wprintf("<SPAN CLASS=\"titlebar\">"
78 "<img src=\"static/advanpage2_48x.gif\">");
79 wprintf(_("View/edit server-side mail filters"));
81 wprintf("</TD></TR></TABLE>\n");
82 wprintf("</div>\n<div id=\"content\">\n");
84 wprintf("<div class=\"fix_scrollbar_bug\">"
85 "<table border=0 width=100%% bgcolor=\"#FFFFFF\">"
86 "<tr><td valign=top>\n");
89 wprintf("<form id=\"sieveform\" method=\"post\" action=\"save_sieve\">\n");
91 wprintf(_("When new mail arrives: "));
92 wprintf("<select name=\"bigaction\" size=1 onChange=\"ToggleSievePanels();\">\n");
94 wprintf("<option %s value=\"0\">", ((active_script < 0) ? "selected" : ""));
95 wprintf(_("Leave it in my inbox without filtering"));
96 wprintf("</option>\n");
98 wprintf("<option %s value=\"1\">", ((rules_script_is_active) ? "selected" : ""));
99 wprintf(_("Filter it according to rules selected below"));
100 wprintf("</option>\n");
102 wprintf("<option %s value=\"2\">",
103 (((active_script >= 0) && (!rules_script_is_active)) ? "selected" : ""));
104 wprintf(_("Filter it through a manually edited script (advanced users only)"));
105 wprintf("</option>\n");
107 wprintf("</select>");
111 /* The "no filtering" div */
113 wprintf("<div id=\"sievediv0\" style=\"display:none\">\n");
114 wprintf("<div align=\"center\"><br /><br />");
115 wprintf(_("Your incoming mail will not be filtered through any scripts."));
116 wprintf("<br /><br /></div>\n");
119 /* The "webcit managed scripts" div */
121 wprintf("<div id=\"sievediv1\" style=\"display:none\">\n");
122 display_rules_editor_inner_div();
125 /* The "I'm smart and can write my own Sieve scripts" div */
127 wprintf("<div id=\"sievediv2\" style=\"display:none\">\n");
129 if (num_scripts > 0) {
130 wprintf(_("The currently active script is: "));
131 wprintf("<select name=\"active_script\" size=1 onChange=\"ToggleScriptPanels();\">\n");
132 for (i=0; i<num_scripts; ++i) {
133 if (strcasecmp(script_names[i], RULES_SCRIPT)) {
134 wprintf("<option %s value=\"%s\">%s</option>\n",
135 ((active_script == i) ? "selected" : ""),
141 wprintf("</select>\n");
144 wprintf(" ");
145 wprintf("<a href=\"display_add_remove_scripts\">%s</a>\n", _("Add or delete scripts"));
149 if (num_scripts > 0) {
150 for (i=0; i<num_scripts; ++i) {
151 if (strcasecmp(script_names[i], RULES_SCRIPT)) {
152 wprintf("<div id=\"script_%s\" style=\"display:none\">\n", script_names[i]);
153 wprintf("<textarea name=\"text_%s\" wrap=soft rows=20 cols=80 width=80>\n",
155 serv_printf("MSIV getscript|%s", script_names[i]);
156 serv_getln(buf, sizeof buf);
157 if (buf[0] == '1') while(serv_getln(buf, sizeof (buf)), strcmp(buf, "000")) {
158 wprintf("%s\n", buf);
160 wprintf("</textarea>\n");
166 wprintf("<script type=\"text/javascript\"> \n"
167 "ToggleScriptPanels(); \n"
174 /* The rest of this is common for all panels... */
176 wprintf("<div align=\"center\"><br>");
177 wprintf("<input type=\"submit\" name=\"save_button\" value=\"%s\">", _("Save changes"));
179 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">\n", _("Cancel"));
180 wprintf("</div></form>\n");
182 wprintf("</td></tr></table></div>\n");
184 wprintf("<script type=\"text/javascript\"> \n"
185 "ToggleSievePanels(); \n"
196 * \brief Translate the fields from the rule editor into something we can save...
198 void parse_fields_from_rule_editor(void) {
216 char encoded_rule[4096];
218 serv_printf("MSIV putscript|%s|", RULES_SCRIPT);
219 serv_getln(buf, sizeof buf);
224 serv_puts("# THIS SCRIPT WAS AUTOMATICALLY GENERATED BY WEBCIT.");
226 serv_puts("# Do not attempt to manually edit it. If you do so,");
227 serv_puts("# your changes will be overwritten the next time WebCit");
228 serv_puts("# saves its mail filtering rule set. If you really want");
229 serv_puts("# to use these rules as the basis for another script,");
230 serv_puts("# copy them to another script and save that instead.");
233 for (i=0; i<MAX_RULES; ++i) {
237 sprintf(fname, "active%d", i);
238 active = !strcasecmp(bstr(fname), "on") ;
240 sprintf(fname, "hfield%d", i);
241 safestrncpy(hfield, bstr(fname), sizeof hfield);
243 sprintf(fname, "compare%d", i);
244 safestrncpy(compare, bstr(fname), sizeof compare);
246 sprintf(fname, "htext%d", i);
247 safestrncpy(htext, bstr(fname), sizeof htext);
249 sprintf(fname, "sizecomp%d", i);
250 safestrncpy(sizecomp, bstr(fname), sizeof sizecomp);
252 sprintf(fname, "sizeval%d", i);
253 sizeval = atoi(bstr(fname));
255 sprintf(fname, "action%d", i);
256 safestrncpy(action, bstr(fname), sizeof action);
258 sprintf(fname, "fileinto%d", i);
259 safestrncpy(fileinto, bstr(fname), sizeof fileinto);
261 sprintf(fname, "redirect%d", i);
262 safestrncpy(redirect, bstr(fname), sizeof redirect);
264 sprintf(fname, "automsg%d", i);
265 safestrncpy(automsg, bstr(fname), sizeof automsg);
267 sprintf(fname, "final%d", i);
268 safestrncpy(final, bstr(fname), sizeof final);
270 snprintf(rule, sizeof rule, "%d|%s|%s|%s|%s|%d|%s|%s|%s|%s|%s",
271 active, hfield, compare, htext, sizecomp, sizeval, action, fileinto,
272 redirect, automsg, final
275 CtdlEncodeBase64(encoded_rule, rule, strlen(rule)+1, 0);
276 serv_printf("# WEBCIT_RULE|%d|%s|", i, encoded_rule);
278 /* FIXME: this is where we need to generate Sieve code based on the rule */
290 * \brief save sieve config
292 void save_sieve(void) {
294 char script_names[MAX_SCRIPTS][64];
296 int active_script = (-1);
301 if (strlen(bstr("save_button")) == 0) {
302 strcpy(WC->ImportantMessage,
303 _("Cancelled. Changes were not saved."));
308 parse_fields_from_rule_editor();
310 serv_puts("MSIV listscripts");
311 serv_getln(buf, sizeof(buf));
312 if (buf[0] == '1') while (serv_getln(buf, sizeof(buf)), strcmp(buf, "000")) {
313 if (num_scripts < MAX_SCRIPTS) {
314 extract_token(script_names[num_scripts], buf, 0, '|', 64);
315 if (extract_int(buf, 1) > 0) {
316 active_script = num_scripts;
322 bigaction = atoi(bstr("bigaction"));
324 if (bigaction == 0) {
325 serv_puts("MSIV setactive||");
326 serv_getln(buf, sizeof buf);
329 else if (bigaction == 1) {
330 serv_printf("MSIV setactive|%s|", RULES_SCRIPT);
331 serv_getln(buf, sizeof buf);
334 else if (bigaction == 2) {
335 serv_printf("MSIV setactive|%s|", bstr("active_script"));
336 serv_getln(buf, sizeof buf);
339 if (num_scripts > 0) {
340 for (i=0; i<num_scripts; ++i) {
342 * We only want to save the scripts from the "manually edited scripts"
343 * screen. The script that WebCit generates from its ruleset will be
344 * auto-generated by parse_fields_from_rule_editor() and saved there.
346 if (strcasecmp(script_names[i], RULES_SCRIPT)) {
347 serv_printf("MSIV putscript|%s|", script_names[i]);
348 serv_getln(buf, sizeof buf);
350 snprintf(this_name, sizeof this_name, "text_%s", script_names[i]);
351 striplt(bstr(this_name));
352 serv_printf("%s", bstr(this_name));
359 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
366 * \brief show a list of available scripts to add/remove them
368 void display_add_remove_scripts(char *message)
371 char script_name[256];
373 output_headers(1, 1, 2, 0, 0, 0);
374 wprintf("<div id=\"banner\">\n");
375 wprintf("<table width=100%% border=0 bgcolor=#444455><tr>"
377 "<span class=\"titlebar\">"
378 "<img src=\"static/advanpage2_48x.gif\">");
379 wprintf(_("Add or delete scripts"));
380 wprintf("</span></td></tr></table>\n"
381 "</div>\n<div id=\"content\">\n"
384 if (message != NULL) wprintf(message);
386 wprintf("<table border=0 cellspacing=10><tr valign=top><td>\n");
388 svprintf("BOXTITLE", WCS_STRING, _("Add a new script"));
389 do_template("beginbox");
391 wprintf(_("To create a new script, enter the desired "
392 "script name in the box below and click 'Create'."));
393 wprintf("<br /><br />");
395 wprintf("<center><form method=\"POST\" action=\"create_script\">\n");
396 wprintf(_("Script name: "));
397 wprintf("<input type=\"text\" name=\"script_name\"><br />\n"
398 "<input type=\"submit\" name=\"create_button\" value=\"%s\">"
399 "</form></center>\n", _("Create"));
401 do_template("endbox");
403 svprintf("BOXTITLE", WCS_STRING, _("Edit scripts"));
404 do_template("beginbox");
405 wprintf("<br /><div align=center><a href=\"display_sieve\">%s</a><br /><br />\n",
406 _("Return to the script editing screen")
408 do_template("endbox");
410 wprintf("</td><td>");
412 svprintf("BOXTITLE", WCS_STRING, _("Delete scripts"));
413 do_template("beginbox");
415 wprintf(_("To delete an existing script, select the script "
416 "name from the list and click 'Delete'."));
417 wprintf("<br /><br />");
420 "<form method=\"POST\" action=\"delete_script\">\n");
421 wprintf("<select name=\"script_name\" size=10 style=\"width:100%%\">\n");
423 serv_puts("MSIV listscripts");
424 serv_getln(buf, sizeof buf);
426 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
427 extract_token(script_name, buf, 0, '|', sizeof script_name);
428 if ( (extract_int(buf, 1) == 0) && (strcasecmp(script_name, RULES_SCRIPT)) ) {
430 escputs(script_name);
431 wprintf("</option>\n");
435 wprintf("</select><br />\n");
437 wprintf("<input type=\"submit\" name=\"delete_button\" value=\"%s\" "
438 "onClick=\"return confirm('%s');\">", _("Delete script"), _("Delete this script?"));
439 wprintf("</form></center>\n");
440 do_template("endbox");
442 wprintf("</td></tr></table>\n");
450 * \brief delete a script
452 void delete_script(void) {
455 serv_printf("MSIV deletescript|%s", bstr("script_name"));
456 serv_getln(buf, sizeof buf);
457 display_add_remove_scripts(&buf[4]);
463 * \brief create a new script
464 * take the web environment script name and create it on the citadel server
466 void create_script(void) {
469 serv_printf("MSIV getscript|%s", bstr("script_name"));
470 serv_getln(buf, sizeof buf);
472 while (serv_getln(buf, sizeof(buf)), strcmp(buf, "000")) {
475 display_add_remove_scripts(_("A script by that name already exists."));
479 serv_printf("MSIV putscript|%s", bstr("script_name"));
480 serv_getln(buf, sizeof buf);
484 display_add_remove_scripts(_("A new script has been created. Return to the script editing screen to edit and activate it."));
488 display_add_remove_scripts(&buf[4]);
494 void display_rules_editor_inner_div(void) {
497 char rules[MAX_RULES][2048];
502 int num_roomnames = 0;
503 int num_roomnames_alloc = 0;
518 memset(rules, 0, sizeof rules);
519 serv_printf("MSIV getscript|%s", RULES_SCRIPT);
520 serv_getln(buf, sizeof buf);
521 if (buf[0] == '1') while(serv_getln(buf, sizeof (buf)), strcmp(buf, "000")) {
522 if (!strncasecmp(buf, "# WEBCIT_RULE|", 14)) {
523 j = extract_int(buf, 1);
524 remove_token(buf, 0, '|');
525 remove_token(buf, 0, '|');
526 CtdlDecodeBase64(rules[j], buf, strlen(buf));
530 /* load the roomnames */
532 serv_getln(buf, sizeof buf);
534 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
536 if (num_roomnames > num_roomnames_alloc) {
537 num_roomnames_alloc += 250;
538 rooms = realloc(rooms, (num_roomnames_alloc * 128));
540 extract_token(rooms[num_roomnames-1].name, buf, 0, '|', 128);
546 * This script should get called by every onChange event...
549 wprintf("<script type=\"text/javascript\"> \n"
551 "var highest_active_rule = (-1); \n"
553 "function UpdateRules() { \n"
554 " for (i=0; i<%d; ++i) { \n", MAX_RULES);
555 wprintf(" d = ($('movedown'+i)); \n"
556 " if (i < highest_active_rule) { \n"
557 " d.style.display = 'block'; \n"
560 " d.style.display = 'none'; \n"
562 " d = ($('hfield'+i).options[$('hfield'+i).selectedIndex].value); \n"
563 " if (d == 'all') { \n"
564 " $('div_size'+i).style.display = 'none'; \n"
565 " $('div_compare'+i).style.display = 'none'; \n"
566 " $('div_nocompare'+i).style.display = 'block'; \n"
568 " else if (d == 'size') { \n"
569 " $('div_size'+i).style.display = 'block'; \n"
570 " $('div_compare'+i).style.display = 'none'; \n"
571 " $('div_nocompare'+i).style.display = 'none'; \n"
574 " $('div_size'+i).style.display = 'none'; \n"
575 " $('div_compare'+i).style.display = 'block'; \n"
576 " $('div_nocompare'+i).style.display = 'none'; \n"
578 " d = ($('action'+i).options[$('action'+i).selectedIndex].value); \n"
579 " if (d == 'fileinto') { \n"
580 " $('div_fileinto'+i).style.display = 'block'; \n"
581 " $('div_redirect'+i).style.display = 'none'; \n"
582 " $('div_automsg'+i).style.display = 'none'; \n"
583 " } else if (d == 'redirect') { \n"
584 " $('div_fileinto'+i).style.display = 'none'; \n"
585 " $('div_redirect'+i).style.display = 'block'; \n"
586 " $('div_automsg'+i).style.display = 'none'; \n"
587 " } else if ((d == 'reject') || (d == 'vacation')) { \n"
588 " $('div_fileinto'+i).style.display = 'none'; \n"
589 " $('div_redirect'+i).style.display = 'none'; \n"
590 " $('div_automsg'+i).style.display = 'block'; \n"
592 " $('div_fileinto'+i).style.display = 'none'; \n"
593 " $('div_redirect'+i).style.display = 'none'; \n"
594 " $('div_automsg'+i).style.display = 'none'; \n"
596 " if (highest_active_rule < %d) { \n", MAX_RULES-1 );
597 wprintf(" $('div_addrule').style.display = 'block'; \n"
599 " $('div_addrule').style.display = 'none'; \n"
604 * Show only the active rows...
606 wprintf(" highest_active_rule = (-1); \n");
607 wprintf(" for (i=0; i<%d; ++i) { \n", MAX_RULES);
608 wprintf(" if ($('active'+i).checked) { \n"
609 " $('rule' + i).style.display = 'block'; \n"
610 " highest_active_rule = i; \n"
613 " $('rule' + i).style.display = 'none'; \n"
618 * Add a rule (really, just un-hide it)
620 "function AddRule() { \n"
621 " highest_active_rule = highest_active_rule + 1; \n"
622 " $('active'+highest_active_rule).checked = true; \n"
628 "function SwapRules(ra, rb) { \n"
630 " var things = new Array(); \n"
631 " things[0] = 'hfield'; \n"
632 " things[1] = 'compare'; \n"
633 " things[2] = 'htext'; \n"
634 " things[3] = 'action'; \n"
635 " things[4] = 'fileinto'; \n"
636 " things[5] = 'redirect'; \n"
637 " things[6] = 'final'; \n"
638 " things[7] = 'sizecomp'; \n"
639 " things[8] = 'sizeval'; \n"
640 " things[9] = 'automsg'; \n"
642 " for (i=0; i<=9; ++i) { \n"
643 " tempval=$(things[i]+ra).value; \n"
644 " $(things[i]+ra).value = $(things[i]+rb).value; \n"
645 " $(things[i]+rb).value = tempval; \n"
649 * Delete a rule (percolate the deleted rule out to the end, then deactivate it)
651 "function DeleteRule(rd) { \n"
652 " for (i=rd; i<highest_active_rule; ++i) { \n"
653 " SwapRules(i, (i+1)); \n"
655 " $('active'+highest_active_rule).checked = false; \n"
663 wprintf("<table cellpadding=2 width=100%%>");
665 for (i=0; i<MAX_RULES; ++i) {
667 /* Grab our existing values to populate */
668 active = extract_int(rules[i], 0);
669 extract_token(hfield, rules[i], 1, '|', sizeof hfield);
670 extract_token(compare, rules[i], 2, '|', sizeof compare);
671 extract_token(htext, rules[i], 3, '|', sizeof htext);
672 extract_token(sizecomp, rules[i], 4, '|', sizeof sizecomp);
673 sizeval = extract_int(rules[i], 5);
674 extract_token(action, rules[i], 6, '|', sizeof action);
675 extract_token(fileinto, rules[i], 7, '|', sizeof fileinto);
676 extract_token(redirect, rules[i], 8, '|', sizeof redirect);
677 extract_token(automsg, rules[i], 9, '|', sizeof automsg);
678 extract_token(final, rules[i], 10, '|', sizeof final);
680 /* now generate the table row */
682 wprintf("<tr id=\"rule%d\" bgcolor=\"#%s\">",
684 ((i%2) ? "DDDDDD" : "FFFFFF")
687 wprintf("<td width=5%% align=\"center\">");
689 wprintf("<div style=\"display:none\">");
690 wprintf("<input type=\"checkbox\" name=\"active%d\" id=\"active%d\" %s>",
692 (active ? "checked" : "")
696 if (i>0) wprintf("<a href=\"javascript:SwapRules(%d,%d);UpdateRules();\">"
697 "<img border=\"0\" src=\"static/up_pointer.gif\" "
698 "title=\"%s\"/></a>",
699 i-1, i, _("Move rule up") );
701 wprintf("<a href=\"javascript:SwapRules(%d,%d);UpdateRules();\">"
702 "<img id=\"movedown%d\" border=\"0\" src=\"static/down_pointer.gif\" "
703 "title=\"%s\"/></a>",
704 i, i+1, i, _("Move rule down") );
706 wprintf("<a href=\"javascript:DeleteRule(%d);UpdateRules();\">"
707 "<img id=\"delete%d\" border=\"0\" src=\"static/delete.gif\" "
708 "title=\"%s\"/></a>",
709 i, i, _("Delete rule") );
713 wprintf("<td width=5%% align=\"center\">");
714 wprintf("<font size=+2>%d</font>", i+1);
717 wprintf("<td width=20%%>%s ", _("If") );
719 char *hfield_values[14][2] = {
720 { "from", _("From") },
721 { "tocc", _("To or Cc") },
722 { "subject", _("Subject") },
723 { "replyto", _("Reply-to") },
724 { "sender", _("Sender") },
725 { "resentfrom", _("Resent-From") },
726 { "resentto", _("Resent-To") },
727 { "envfrom", _("Envelope From") },
728 { "envto", _("Envelope To") },
729 { "xmailer", _("X-Mailer") },
730 { "xspamflag", _("X-Spam-Flag") },
731 { "xspamstatus", _("X-Spam-Status") },
732 { "size", _("Message size") },
736 wprintf("<select id=\"hfield%d\" name=\"hfield%d\" size=1 onChange=\"UpdateRules();\">",
738 for (j=0; j<14; ++j) {
739 wprintf("<option %s value=\"%s\">%s</option>",
740 ( (!strcasecmp(hfield, hfield_values[j][0])) ? "selected" : ""),
746 wprintf("</select>");
749 wprintf("<td width=20%%>");
751 char *compare_values[4][2] = {
752 { "contains", _("contains") },
753 { "notcontains", _("does not contain") },
755 { "isnot", _("is not") }
758 wprintf("<div id=\"div_compare%d\">", i);
759 wprintf("<select id=\"compare%d\" name=\"compare%d\" size=1 onChange=\"UpdateRules();\">",
761 for (j=0; j<4; ++j) {
762 wprintf("<option %s value=\"%s\">%s</option>",
763 ( (!strcasecmp(compare, compare_values[j][0])) ? "selected" : ""),
764 compare_values[j][0],
768 wprintf("</select>");
770 wprintf("<input type=\"text\" id=\"htext%d\" name=\"htext%d\" value=\"", i, i);
772 wprintf("\"></div>");
774 wprintf("<div id=\"div_nocompare%d\">", i);
775 wprintf("%s", _("(All messages)"));
778 char *sizecomp_values[2][2] = {
779 { "larger", _("is larger than") },
780 { "smaller", _("is smaller than") }
783 wprintf("<div id=\"div_size%d\">", i);
784 wprintf("<select id=\"sizecomp%d\" name=\"sizecomp%d\" size=1 onChange=\"UpdateRules();\">",
786 for (j=0; j<2; ++j) {
787 wprintf("<option %s value=\"%s\">%s</option>",
788 ( (!strcasecmp(sizecomp, sizecomp_values[j][0])) ? "selected" : ""),
789 sizecomp_values[j][0],
790 sizecomp_values[j][1]
793 wprintf("</select>");
795 wprintf("<input type=\"text\" id=\"sizeval%d\" name=\"sizeval%d\" value=\"%d\">",
802 wprintf("<td width=20%%>");
803 wprintf("<select id=\"action%d\" name=\"action%d\" size=1 onChange=\"UpdateRules();\">",
805 wprintf("<option value=\"keep\">%s</option>", _("Keep"));
806 wprintf("<option value=\"discard\">%s</option>", _("Discard silently"));
807 wprintf("<option value=\"reject\">%s</option>", _("Reject"));
808 wprintf("<option value=\"fileinto\">%s</option>", _("Move message to"));
809 wprintf("<option value=\"redirect\">%s</option>", _("Forward to"));
810 wprintf("<option value=\"vacation\">%s</option>", _("Vacation"));
811 wprintf("</select>");
813 wprintf("<div id=\"div_fileinto%d\">", i);
814 wprintf("<select name=\"fileinto%d\" id=\"fileinto%d\">", i, i);
815 for (j=0; j<num_roomnames; ++j) {
817 if (!strcasecmp(rooms[j].name, "Mail")) {
818 wprintf("selected ");
821 urlescputs(rooms[j].name);
823 escputs(rooms[j].name);
824 wprintf("</option>\n");
826 wprintf("</select>\n");
829 wprintf("<div id=\"div_redirect%d\">", i);
830 wprintf("<input type=\"text\" id=\"redirect%d\" name=\"redirect%d\">", i, i);
833 wprintf("<div id=\"div_automsg%d\">", i);
834 wprintf(_("Message:"));
836 wprintf("<textarea name=\"automsg%d\" id=\"automsg%d\" wrap=soft rows=5>\n", i, i);
837 wprintf("</textarea>");
844 wprintf("<td width=10%% align=\"center\">%s</td>", _("and then") );
846 wprintf("<td width=20%%>");
847 wprintf("<select name=\"final%d\" id=\"final%d\" size=1 onChange=\"UpdateRules();\">",
849 wprintf("<option value=\"continue\">%s</option>", _("continue processing"));
850 wprintf("<option value=\"stop\">%s</option>", _("stop"));
851 wprintf("</select>");
859 wprintf("<div id=\"div_addrule\"><a href=\"javascript:AddRule();\">Add rule</a><br /></div>\n");
861 wprintf("<script type=\"text/javascript\"> \n");
862 wprintf("UpdateRules(); \n");
863 wprintf("</script> \n");