Started building the easy rules editor
authorArt Cancro <ajc@citadel.org>
Wed, 8 Nov 2006 03:57:41 +0000 (03:57 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 8 Nov 2006 03:57:41 +0000 (03:57 +0000)
webcit/ical_dezonify.c
webcit/sieve.c
webcit/static/webcit.css
webcit/webcit.h

index c352edbc4e12706ed12e048255ab5f985001f66f..76c84b7941aba96499961bba84ed459d229723f3 100644 (file)
@@ -92,17 +92,17 @@ void ical_dezonify_backend(icalcomponent *cal,
                return;
        }
 
-       lprintf(9, "                * Was: %s\n", icaltime_as_ical_string(TheTime));
+       /* lprintf(9, "                * Was: %s\n", icaltime_as_ical_string(TheTime)); */
        if (TheTime.is_utc) {
-               lprintf(9, "                * This property is ALREADY UTC.\n");
+               /* lprintf(9, "                * This property is ALREADY UTC.\n"); */
        }
        else {
                /* Do the conversion. */
                if (t != NULL) {
-                       lprintf(9, "                * Timezone prop found.  Converting to UTC.\n");
+                       /* lprintf(9, "                * Timezone prop found.  Converting to UTC.\n"); */
                }
                else {
-                       lprintf(9, "                * Converting default timezone to UTC.\n");
+                       /* lprintf(9, "                * Converting default timezone to UTC.\n"); */
                }
 
                if (t == NULL) {
@@ -117,7 +117,7 @@ void ical_dezonify_backend(icalcomponent *cal,
        }
 
        icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);
-       lprintf(9, "                * Now: %s\n", icaltime_as_ical_string(TheTime));
+       /* lprintf(9, "                * Now: %s\n", icaltime_as_ical_string(TheTime)); */
 
        /* Now add the converted property back in. */
        if (icalproperty_isa(prop) == ICAL_DTSTART_PROPERTY) {
@@ -185,7 +185,7 @@ void ical_dezonify_recur(icalcomponent *cal, icalcomponent *rcal) {
 void ical_dezonify(icalcomponent *cal) {
        icalcomponent *vt = NULL;
 
-       lprintf(9, "ical_dezonify() started\n");
+       /* lprintf(9, "ical_dezonify() started\n"); */
 
        /* Convert all times to UTC */
        ical_dezonify_recur(cal, cal);
@@ -197,7 +197,7 @@ void ical_dezonify(icalcomponent *cal) {
                icalcomponent_free(vt);
        }
 
-       lprintf(9, "ical_dezonify() completed\n");
+       /* lprintf(9, "ical_dezonify() completed\n"); */
 }
 
 
index 299cdbd6093c493b32c97059631683cd9246a69f..56dc27a0cc9c4871b9772c1015d7004f0278ff2d 100644 (file)
@@ -9,6 +9,7 @@
 #include "webcit.h"
 
 #define MAX_SCRIPTS    100
+#define MAX_RULES      8
 
 /**
  * \brief view/edit sieve config
@@ -89,14 +90,9 @@ void display_sieve(void)
        wprintf(_("Leave it in my inbox without filtering"));
        wprintf("</option>\n");
 
-       /*
-        *      FIXME uncomment this when we write the rules editor
-        *
        wprintf("<option value=\"1\">");
        wprintf(_("Filter it according to rules selected below"));
        wprintf("</option>\n");
-        *
-        */
 
        wprintf("<option %s value=\"2\">", ((active_script >= 0) ? "selected" : ""));
        wprintf(_("Filter it through a manually edited script (advanced users only)"));
@@ -117,9 +113,7 @@ void display_sieve(void)
        /* The "webcit managed scripts" div */
 
        wprintf("<div id=\"sievediv1\" style=\"display:none\">\n");
-       wprintf("<div align=\"center\"><br /><br />");
-       wprintf("FIXME");
-       wprintf("<br /><br /></div>\n");
+       display_rules_editor_inner_div();
        wprintf("</div>\n");
 
        /* The "I'm smart and can write my own Sieve scripts" div */
@@ -374,4 +368,93 @@ void create_script(void) {
        display_add_remove_scripts(&buf[4]);
 }
 
+
+
+
+void display_rules_editor_inner_div(void) {
+       int i;
+
+
+       wprintf("<br />");
+       wprintf("<table class=\"mailbox_summary\" rules=rows cellpadding=2 style=\"width:100%%;-moz-user-select:none;\">");
+
+       for (i=0; i<MAX_RULES; ++i) {
+               
+               wprintf("<tr id=\"rule%d\">", i);
+
+               wprintf("<td>%d. %s</td>", i+1, _("If") );
+
+               wprintf("<td>");
+               wprintf("<select name=\"hfield%d\" size=1>", i);
+               wprintf("<option value=\"sender\">%s</option>", _("Sender"));
+               wprintf("<option value=\"recipient\">%s</option>", _("Recipient"));
+               wprintf("</select>");
+               wprintf("</td>");
+
+               wprintf("<td>");
+               wprintf("<select name=\"compare%d\" size=1>", i);
+               wprintf("<option value=\"match\">%s</option>", _("matches"));
+               wprintf("<option value=\"notmatch\">%s</option>", _("does not match"));
+               wprintf("</select>");
+               wprintf("</td>");
+
+               wprintf("<td>");
+               wprintf("<input type=\"text\" name=\"htext%d\">", i);
+               wprintf("</td>");
+
+               wprintf("<td>");
+               wprintf("<select name=\"action%d\" size=1>", i);
+               wprintf("<option value=\"fileinto\">%s</option>", _("file into"));
+               wprintf("<option value=\"redirect\">%s</option>", _("forward to"));
+               wprintf("<option value=\"reject\">%s</option>", _("reject"));
+               wprintf("</select>");
+               wprintf("</td>");
+
+               wprintf("<td>%s</td>", _("and then") );
+
+               wprintf("<td>");
+               wprintf("<select name=\"final%d\" size=1>", i);
+               wprintf("<option value=\"stop\">%s</option>", _("stop"));
+               wprintf("<option value=\"continue\">%s</option>", _("continue processing"));
+               wprintf("</select>");
+               wprintf("</td>");
+
+               wprintf("</tr>\n");
+
+       }
+
+       wprintf("</table>");
+
+
+
+/*
+
+Show/hide alternating rows.  This is obviously bogus, it's just there to test the show/hide logic.
+
+ */
+
+       wprintf("<script type=\"text/javascript\">                                      \n"
+               "                                                                       \n"
+               "function UpdateRules() {                                               \n"
+               "  for (i=0; i<%d; ++i) {                                               \n", MAX_RULES);
+       wprintf("   if ( (i % 2) == 0 )  {                                              \n"
+               "     $('rule' + i).style.display = 'block';                            \n"
+               "   }                                                                   \n"
+               "   else {                                                              \n"
+               "     $('rule' + i).style.display = 'none';                             \n"
+               "   }                                                                   \n"
+               "  }                                                                    \n"
+               "}                                                                      \n"
+               "                                                                       \n"
+               "UpdateRules();                                                         \n"
+               "</script>                                                              \n"
+       );
+
+}
+
+
+
+
+
+
 /*@}*/
index 113071a53ea1a97c4c49574b53ea882d1aa2d5dc..95a7c4e6a7b15182daffdc74605c7a2cbd1ca74e 100644 (file)
@@ -12,6 +12,7 @@ body {
        color: #000000;
        font-weight: normal;
        font-size: 10pt;
+       font-family: sans-serif;
 }
 
 #iconbar {
index a5294d8fa5b2975effa4aab9e5ba78a4fecb2dc1..856854d0415b035dd0cd91bf2a026aac30c84ed1 100644 (file)
@@ -626,6 +626,7 @@ void save_inetconf(void);
 void display_smtpqueue(void);
 void display_smtpqueue_inner_div(void);
 void display_sieve(void);
+void display_rules_editor_inner_div(void);
 void save_sieve(void);
 void display_add_remove_scripts(char *);
 void create_script(void);