More work on the wiki view. Don't try to use it yet.
authorArt Cancro <ajc@citadel.org>
Sun, 22 Jan 2006 22:50:06 +0000 (22:50 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 22 Jan 2006 22:50:06 +0000 (22:50 +0000)
webcit/ChangeLog
webcit/roomops.c
webcit/webcit.h
webcit/wiki.c

index e21c168c60424defdc4e7428be60f2e896f4a73b..b8d51be6156722a6c1179b44616572ec66458574 100644 (file)
@@ -1,5 +1,8 @@
 $Id$
 
+Sun Jan 22 17:49:29 EST 2006 ajc
+* More work on the wiki view.  Don't try to use it yet.
+
 Fri Jan 20 16:39:04 EST 2006 ajc
 * Started writing wiki code.  It completely does not work.  :)
 
index e640d512a931d249c5fc2fc2146d723fcd98cda1..9573fc9b3860bc681a5593b38d2fd35fbb0fc88f 100644 (file)
@@ -518,13 +518,7 @@ void embed_room_banner(char *got, int navbar_style) {
                                        );
                                        break;
                                case VIEW_WIKI:
-                                       wprintf(
-                                               "<td><a href=\"display_enter\">"
-                                               "<img align=\"middle\" src=\"static/newmess3_24x.gif\" "
-                                               "border=\"0\"><span class=\"navbar_link\">"
-                                               "%s"
-                                               "</span></a></td>\n", _("Add new page")
-                                       );
+                                       /* Don't let users create unlinked pages. */
                                        break;
                                default:
                                        wprintf(
index 296cef73017acccb0204f80d9260f1975d08de0a..dba84007391eabd4a36fdc8a1ccd45ce3feee0b5 100644 (file)
 #define DEVELOPER_ID           0
 #define CLIENT_ID              4
 #define CLIENT_VERSION         671             /* This version of WebCit */
-#define MINIMUM_CIT_VERSION    670             /* min required Citadel ver. */
+#define MINIMUM_CIT_VERSION    671             /* min required Citadel ver. */
 #define DEFAULT_HOST           "localhost"     /* Default Citadel server */
 #define DEFAULT_PORT           "504"
 #define LB                     (1)             /* Internal escape chars */
index dd5f2138d92eb297a978dbee61d9e071c647dc9a..9d6a6b59b6da5979c89a50299f287bca4cdc7227 100644 (file)
@@ -43,23 +43,62 @@ void display_wiki_page(void)
 {
        char roomname[128];
        char pagename[128];
+       char errmsg[256];
+       long msgnum = (-1L);
 
        safestrncpy(roomname, bstr("room"), sizeof roomname);
        safestrncpy(pagename, bstr("page"), sizeof pagename);
        str_wiki_index(pagename);
 
-       wprintf("roomname=%s<br>pagename=%s<br>\n", roomname, pagename);
-
-       if (strcasecmp(roomname, WC->roomname)) {
+       /* If we're not in the correct room, try going there. */
+       if (strcasecmp(roomname, WC->wc_roomname)) {
                gotoroom(roomname);
        }
 
-       if (strcasecmp(roomname, WC->roomname)) {
-               /* can't find the room */
-               convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext);
+       /* 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) {
+               snprintf(errmsg, sizeof errmsg,
+                       _("'%s' is not a Wiki room."),
+                       roomname);
+               convenience_page("FF0000", _("Error"), errmsg);
+               return;
+       }
+
+       if (strlen(pagename) == 0) {
+               strcpy(pagename, "home");
+       }
+
+       /* Found it!  Now read it. */
+       msgnum = locate_message_by_uid(pagename);
+       if (msgnum >= 0L) {
+               output_headers(1, 1, 1, 0, 0, 0);
+               read_message(msgnum, 0, "");
+               wDumpContent(1);
+               return;
        }
 
        output_headers(1, 1, 1, 0, 0, 0);
+       wprintf("<br /><br />"
+               "<div align=\"center\">"
+               "<table border=\"0\" bgcolor=\"#ffffff\" cellpadding=\"10\">"
+               "<tr><td align=\"center\">"
+       );
+       wprintf("<br><b>");
+       wprintf(_("There is no page called '%s' here."), pagename);
+       wprintf("</b><br><br>");
+       wprintf("<a href=\"display_enter?wikipage=%s\">", pagename);
+       wprintf(_("Click here if you would like to create this page."));
+       wprintf("</a>");
+       wprintf("<br><br>");
+       wprintf("</td></tr></table></div>\n");
        wDumpContent(1);
 }