From a00d51fb7d3cdb0b6545fc2248e698955ed77af7 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 16 Nov 2006 17:45:05 +0000 Subject: [PATCH] Begin reloading the form from saved rules --- webcit/sieve.c | 59 +++++++++++++++++++++++++++++++++++++++++-------- webcit/webcit.c | 2 ++ 2 files changed, 52 insertions(+), 9 deletions(-) diff --git a/webcit/sieve.c b/webcit/sieve.c index 4cf8afdb3..4d60d02af 100644 --- a/webcit/sieve.c +++ b/webcit/sieve.c @@ -235,7 +235,7 @@ void parse_fields_from_rule_editor(void) { strcpy(rule, ""); sprintf(fname, "active%d", i); - active = atoi(bstr(fname)); + active = !strcasecmp(bstr(fname), "on") ; sprintf(fname, "hfield%d", i); safestrncpy(hfield, bstr(fname), sizeof hfield); @@ -493,7 +493,8 @@ void create_script(void) { void display_rules_editor_inner_div(void) { int i, j; - char buf[256]; + char buf[4096]; + char rules[MAX_RULES][2048]; struct { char name[128]; @@ -501,6 +502,30 @@ void display_rules_editor_inner_div(void) { int num_roomnames = 0; int num_roomnames_alloc = 0; + int active; + char hfield[256]; + char compare[32]; + char htext[256]; + char sizecomp[32]; + int sizeval; + char action[32]; + char fileinto[128]; + char redirect[256]; + char automsg[1024]; + char final[32]; + + /* load the rules */ + memset(rules, 0, sizeof rules); + serv_printf("MSIV getscript|%s", RULES_SCRIPT); + serv_getln(buf, sizeof buf); + if (buf[0] == '1') while(serv_getln(buf, sizeof (buf)), strcmp(buf, "000")) { + if (!strncasecmp(buf, "# WEBCIT_RULE|", 14)) { + j = extract_int(buf, 1); + remove_token(buf, 0, '|'); + remove_token(buf, 0, '|'); + CtdlDecodeBase64(rules[j], buf, strlen(buf)); + } + } /* load the roomnames */ serv_puts("LKRA"); @@ -621,8 +646,7 @@ void display_rules_editor_inner_div(void) { " } \n" "} \n" /* - * Delete a rule (percolate the deleted rule out to the end, - * and then decrement highest_active_rule) + * Delete a rule (percolate the deleted rule out to the end, then deactivate it) */ "function DeleteRule(rd) { \n" " for (i=rd; i"); for (i=0; i", i, ((i%2) ? "DDDDDD" : "FFFFFF") @@ -648,7 +687,10 @@ void display_rules_editor_inner_div(void) { wprintf(""); wprintf("
"); - wprintf("", i); + wprintf("", + i, i, + (active ? "checked" : "") + ); wprintf("
"); if (i>0) wprintf("" @@ -783,10 +825,9 @@ void display_rules_editor_inner_div(void) { wprintf(""); wprintf("\n"); - wprintf(" \n" - ); + wprintf(" \n"); free(rooms); } diff --git a/webcit/webcit.c b/webcit/webcit.c index b8b90b1c9..d61a66a14 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -102,6 +102,8 @@ void addurls(char *url) unescape_input(u->url_data); up = ptr; ++up; + + /* lprintf(9, "%s = %s\n", u->url_key, u->url_data); */ } } -- 2.39.2