From 9dc1b3574fa517a9d3d91d020381e3567c45d0f3 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 24 Jan 2006 03:51:59 +0000 Subject: [PATCH] * Got a primitive version of the wiki system in place. Needs a lot of fine tuning but it basically works. --- webcit/ChangeLog | 4 ++++ webcit/messages.c | 22 +++++++++++++++++++--- webcit/roomops.c | 16 ++++++++++++---- webcit/webcit.h | 1 + webcit/wiki.c | 26 +++++++++++++++----------- 5 files changed, 51 insertions(+), 18 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index ff2b02f9d..7fabeaed4 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,5 +1,9 @@ $Id$ +Mon Jan 23 22:51:11 EST 2006 ajc +* Got a primitive version of the wiki system in place. Needs a lot of fine + tuning but it basically works. + Fri Jan 20 21:03:25 CET 2006 dothebart * finished doxygen style comments. diff --git a/webcit/messages.c b/webcit/messages.c index 23a1e2ef6..9dc54cfcd 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -2527,12 +2527,13 @@ void post_message(void) _("Automatically cancelled because you have already " "saved this message.")); } else { - sprintf(buf, "ENT0 1|%s|%d|4|%s|||%s|%s", + sprintf(buf, "ENT0 1|%s|%d|4|%s|||%s|%s|%s", bstr("recp"), is_anonymous, bstr("subject"), bstr("cc"), - bstr("bcc") + bstr("bcc"), + bstr("wikipage") ); serv_puts(buf); serv_getln(buf, sizeof buf); @@ -2575,6 +2576,7 @@ void display_enter(void) int recipient_bad = 0; int i; int is_anonymous = 0; + long existing_page = (-1L); if (strlen(bstr("force_room")) > 0) { gotoroom(bstr("force_room")); @@ -2638,7 +2640,8 @@ void display_enter(void) /** Now check our actual recipients if there are any */ if (recipient_required) { - sprintf(buf, "ENT0 0|%s|%d|0||||%s|%s", bstr("recp"), is_anonymous, bstr("cc"), bstr("bcc")); + sprintf(buf, "ENT0 0|%s|%d|0||||%s|%s|%s", bstr("recp"), is_anonymous, + bstr("cc"), bstr("bcc"), bstr("wikipage")); serv_puts(buf); serv_getln(buf, sizeof buf); @@ -2676,6 +2679,9 @@ void display_enter(void) "name=\"enterform\"" ">\n"); wprintf("\n", now); + if (WC->wc_view == VIEW_WIKI) { + wprintf("\n", bstr("wikipage")); + } wprintf("\""); wprintf("%s\n", buf); /** header bar */ @@ -2773,6 +2779,16 @@ void display_enter(void) wprintf("\n\n"); } + /** If we're editing a wiki page, insert the existing page here... */ + else if (WC->wc_view == VIEW_WIKI) { + safestrncpy(buf, bstr("wikipage"), sizeof buf); + str_wiki_index(buf); + existing_page = locate_message_by_uid(buf); + if (existing_page >= 0L) { + pullquote_message(existing_page, 1); + } + } + /** Insert our signature if appropriate... */ if ( (WC->is_mailbox) && (strcmp(bstr("sig_inserted"), "yes")) ) { get_preference("use_sig", buf, sizeof buf); diff --git a/webcit/roomops.c b/webcit/roomops.c index aa38db4db..68476bfb5 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -352,7 +352,7 @@ void embed_view_o_matic(void) { * \param navbar_style */ void embed_room_banner(char *got, int navbar_style) { - char fakegot[SIZ]; + char buf[256]; /** * We need to have the information returned by a GOTO server command. @@ -360,8 +360,8 @@ void embed_room_banner(char *got, int navbar_style) { */ if (got == NULL) { serv_printf("GOTO %s", WC->wc_roomname); - serv_getln(fakegot, sizeof fakegot); - got = fakegot; + serv_getln(buf, sizeof buf); + got = buf; } /** The browser needs some information for its own use */ @@ -538,7 +538,15 @@ void embed_room_banner(char *got, int navbar_style) { ); break; case VIEW_WIKI: - /* Don't let users create unlinked pages. */ + safestrncpy(buf, bstr("page"), sizeof buf); + str_wiki_index(buf); + wprintf( + "" + "" + "%s" + "\n", buf, _("Edit this page") + ); break; default: wprintf( diff --git a/webcit/webcit.h b/webcit/webcit.h index df8e2be11..93ec4e3d2 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -672,6 +672,7 @@ void httplang_to_locale(char *LocaleString); void tabbed_dialog(int num_tabs, char *tabnames[]); void begin_tab(int tabnum, int num_tabs); void end_tab(int tabnum, int num_tabs); +void str_wiki_index(char *s); void display_wiki_page(void); void embed_room_banner(char *, int); diff --git a/webcit/wiki.c b/webcit/wiki.c index 9d6a6b59b..852650cb6 100644 --- a/webcit/wiki.c +++ b/webcit/wiki.c @@ -50,18 +50,22 @@ void display_wiki_page(void) safestrncpy(pagename, bstr("page"), sizeof pagename); str_wiki_index(pagename); - /* If we're not in the correct room, try going there. */ - if (strcasecmp(roomname, WC->wc_roomname)) { - gotoroom(roomname); - } + if (strlen(roomname) > 0) { + + /* If we're not in the correct room, try going there. */ + if (strcasecmp(roomname, WC->wc_roomname)) { + gotoroom(roomname); + } + + /* If we're still not in the correct room, it doesn't exist. */ + if (strcasecmp(roomname, WC->wc_roomname)) { + snprintf(errmsg, sizeof errmsg, + _("There is no room called '%s'."), + roomname); + convenience_page("FF0000", _("Error"), errmsg); + return; + } - /* If we're still not in the correct room, it doesn't exist. */ - if (strcasecmp(roomname, WC->wc_roomname)) { - snprintf(errmsg, sizeof errmsg, - _("There is no room called '%s'."), - roomname); - convenience_page("FF0000", _("Error"), errmsg); - return; } if (WC->wc_view != VIEW_WIKI) { -- 2.30.2