]> code.citadel.org Git - citadel.git/commitdiff
* In message summary, replace 'Del' links with checkboxes
authorArt Cancro <ajc@citadel.org>
Tue, 7 May 2002 03:57:30 +0000 (03:57 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 7 May 2002 03:57:30 +0000 (03:57 +0000)
webcit/ChangeLog
webcit/messages.c
webcit/tools.c
webcit/webcit.c
webcit/webcit.h

index 22bd953397fbb067699bf0c9b3298aa3f0365795..58dceeb6591fb8920d594bfbaaae4f75481173ff 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 323.29  2002/05/07 03:57:29  ajc
+* In message summary, replace 'Del' links with checkboxes
+
 Revision 323.28  2002/05/05 03:28:15  ajc
 * Shuffled around the room banner a bit
 
@@ -800,4 +803,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
index e33d7c6c206f3fdb79edb62fee39e0e5b391dc89..e949d12a5ea1a0e540e9ad83361dd97896a500ee 100644 (file)
@@ -467,12 +467,9 @@ void summarize_message(long msgnum) {
        wprintf(" </TD><TD>");
        escputs(summ.date);
        wprintf(" </TD>");
-       wprintf("<TD BGCOLOR=\"AAAADD\">"
-               "<A HREF=\"/delete_msg"
-               "&msgid=%ld\""
-               "onClick=\"return confirm('Delete this message?');\""
-               "><FONT SIZE=-1>Del</FONT></A>"
-               " </TD>\n", msgnum);
+       wprintf("<TD>"
+               "<INPUT TYPE=\"checkbox\" NAME=\"msg_%ld\" VALUE=\"yes\">"
+               "</TD>\n");
 
        return;
 }
@@ -567,7 +564,9 @@ void readloop(char *oper)
        }
 
        if (is_summary) {
-               wprintf("<TABLE border=0 width=100%%>\n"
+               wprintf("<FORM METHOD=\"POST\" ACTION=\"/do_stuff_to_msgs\">\n"
+                       "<TABLE border=0 cellspacing=0 "
+                       "cellpadding=0 width=100%%>\n"
                        "<TR>"
                        "<TD><I>Subject</I></TD>"
                        "<TD><I>Sender</I></TD>"
@@ -624,25 +623,30 @@ void readloop(char *oper)
                        "<TD ALIGN=RIGHT><FONT SIZE=+1>",
                        lowest_displayed, nummsgs);
 
-                       if (pn_previous > 0L) {
-                               wprintf("<A HREF=\"/%s"
-                                       "?startmsg=%ld"
-                                       "&maxmsgs=1"
-                                       "&summary=0\">"
-                                       "Previous</A> \n",
-                                               oper,
-                                               pn_previous );
-                       }
+               if (is_summary) {
+                       wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" "
+                               "VALUE=\"Delete selected\">\n");
+               }
 
-                       if (pn_next > 0L) {
-                               wprintf("<A HREF=\"/%s"
-                                       "?startmsg=%ld"
-                                       "&maxmsgs=1"
-                                       "&summary=0\">"
-                                       "Next</A> \n",
-                                               oper,
-                                               pn_next );
-                       }
+               if (pn_previous > 0L) {
+                       wprintf("<A HREF=\"/%s"
+                               "?startmsg=%ld"
+                               "&maxmsgs=1"
+                               "&summary=0\">"
+                               "Previous</A> \n",
+                                       oper,
+                                       pn_previous );
+               }
+
+               if (pn_next > 0L) {
+                       wprintf("<A HREF=\"/%s"
+                               "?startmsg=%ld"
+                               "&maxmsgs=1"
+                               "&summary=0\">"
+                               "Next</A> \n",
+                                       oper,
+                                       pn_next );
+               }
 
                wprintf("<A HREF=\"/%s?startmsg=%ld"
                        "&maxmsgs=999999&summary=1\">"
@@ -666,6 +670,12 @@ void readloop(char *oper)
                        "<TD ALIGN=RIGHT><FONT SIZE=+1>",
                        lowest_displayed, highest_displayed, nummsgs);
 
+               if (is_summary) {
+                       wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" "
+                               "VALUE=\"Delete selected\">\n");
+               }
+
+
                for (b=0; b<nummsgs; b = b + maxmsgs) {
                lo = b+1;
                hi = b+maxmsgs+1;
@@ -703,6 +713,7 @@ void readloop(char *oper)
 
                wprintf("</TD></TR></TABLE></CENTER>\n");
        }
+       if (is_summary) wprintf("</FORM>\n");
 
 DONE:  wDumpContent(1);
 }
@@ -914,7 +925,7 @@ void move_msg(void)
                serv_gets(buf);
                wprintf("<EM>%s</EM><BR>\n", &buf[4]);
        } else {
-               wprintf("<EM>Message not deleted.</EM><BR>\n");
+               wprintf("<EM>Message not moved.</EM><BR>\n");
        }
 
        wDumpContent(1);
@@ -922,3 +933,47 @@ void move_msg(void)
 
 
 
+void do_stuff_to_msgs(void) {
+       char buf[SIZ];
+       char sc[SIZ];
+
+       struct stuff_t {
+               struct stuff_t *next;
+               long msgnum;
+       };
+
+       struct stuff_t *stuff = NULL;
+       struct stuff_t *ptr;
+
+
+       serv_puts("MSGS ALL");
+       serv_gets(buf);
+
+       if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) {
+               ptr = malloc(sizeof(struct stuff_t));
+               ptr->msgnum = atol(buf);
+               ptr->next = stuff;
+               stuff = ptr;
+       }
+
+       strcpy(sc, bstr("sc"));
+
+       while (stuff != NULL) {
+
+               sprintf(buf, "msg_%ld", stuff->msgnum);
+               if (!strcasecmp(bstr(buf), "yes")) {
+
+                       if (!strcasecmp(sc, "Delete selected")) {
+                               serv_printf("DELE %ld", stuff->msgnum);
+                               serv_gets(buf);
+                       }
+
+               }
+
+               ptr = stuff->next;
+               free(stuff);
+               stuff = ptr;
+       }
+
+       readloop("readfwd");
+}
index d9711573379a08e7abb1ee7d76d49427b0f61c93..3d0080630bda47adf7dd35502f4b0fe9ae2557b2 100644 (file)
@@ -193,15 +193,19 @@ char ch;
  */
 void fmt_date(char *buf, time_t thetime) {
        struct tm *tm;
+       int hour;
 
        strcpy(buf, "");
        tm = localtime(&thetime);
+       hour = tm->tm_hour;
+       if (hour == 0) hour = 12;
+       else if (hour > 12) hour = hour - 12;
 
        sprintf(buf, "%s %d %d %2d:%02d%s",
                ascmonths[tm->tm_mon],
                tm->tm_mday,
                tm->tm_year + 1900,
-               ( (tm->tm_hour > 12) ? (tm->tm_hour - 12) : (tm->tm_hour) ),
+               hour,
                tm->tm_min,
                ( (tm->tm_hour > 12) ? "pm" : "am" )
        );
index 36bf6e217b0904e703f9bb3ed9a6faf23748b043..b93114efa15f158bae90d23a6619afc0cc4ac477 100644 (file)
@@ -1047,6 +1047,8 @@ void session_loop(struct httprequest *req)
                change_view();
        } else if (!strcasecmp(action, "folders")) {
                folders();
+       } else if (!strcasecmp(action, "do_stuff_to_msgs")) {
+               do_stuff_to_msgs();
        } else if (!strcasecmp(action, "diagnostics")) {
                output_headers(1);
 
index bfa74fab9004092cdf0957fba2ab4ab5594cf77e..e0c2556e5ea1909af865c38b5ab0d6e86615c0e3 100644 (file)
@@ -299,3 +299,4 @@ void create_user(void);
 void edituser(void);
 void change_view(void);
 void folders(void);
+void do_stuff_to_msgs(void);