more 'go=' links in wiki
[citadel.git] / webcit / wiki.c
index 186bd00ca1b8f73355e9b264da6a04e57588b116..47af67ec4170f276b06deb8cb6c30d14694c1c3b 100644 (file)
@@ -49,8 +49,6 @@ void display_wiki_page_backend(char *pagename, char *rev, int do_revert)
        long msgnum = (-1L);
        char buf[256];
 
-       str_wiki_index(pagename);
-
        if (WC->CurRoom.view != VIEW_WIKI) {
                wc_printf(_("'%s' is not a Wiki room."), ChrPtr(WC->CurRoom.name) );
                return;
@@ -60,7 +58,7 @@ void display_wiki_page_backend(char *pagename, char *rev, int do_revert)
                strcpy(pagename, "home");
        }
 
-       /* Found it!  Now read it. */
+       str_wiki_index(pagename);       /* convert index name to lowercase and numeric only */
 
        if ((rev != NULL) && (strlen(rev) > 0)) {
                /* read an older revision */
@@ -71,7 +69,7 @@ void display_wiki_page_backend(char *pagename, char *rev, int do_revert)
                }
        }
        else {
-               /* read the current revision? */
+               /* read the current revision */
                msgnum = locate_message_by_uid(pagename);
        }
 
@@ -165,19 +163,19 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP)
                        wc_printf("</td>");
 
                        if (row == 0) {
-                               wc_printf("<td><a href=\"wiki?page=%s\">%s</a></td>",
-                                       bstr("page"),
-                                       _("(show)")
-                               );
+                               wc_printf("<td><a href=\"wiki?page=%s", bstr("page"));
+                               wc_printf("?go="); urlescputs(ChrPtr(WC->CurRoom.name));
+                               wc_printf("\">%s</a></td>", _("(show)"));
                                wc_printf("<td>(%s)</td>", _("Current version"));
                        }
 
                        else {
-                               wc_printf("<td><a href=\"wiki?page=%s?rev=%s\">%s</a></td>",
+                               wc_printf("<td><a href=\"wiki?page=%s?rev=%s",
                                        bstr("page"),
-                                       ChrPtr(rev_uuid),
-                                       _("(show)")
+                                       ChrPtr(rev_uuid)
                                );
+                               wc_printf("?go="); urlescputs(ChrPtr(WC->CurRoom.name));
+                               wc_printf("\">%s</a></td>", _("(show)"));
                                wc_printf("<td><a href=\"javascript:GetLoggedInFirst(encodeURIComponent('wiki?page=%s?rev=%s?revert=1'))\">%s</a></td>",
                                        bstr("page"),
                                        ChrPtr(rev_uuid),