tuning but it basically works.
$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.
_("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);
int recipient_bad = 0;
int i;
int is_anonymous = 0;
+ long existing_page = (-1L);
if (strlen(bstr("force_room")) > 0) {
gotoroom(bstr("force_room"));
/** 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);
"name=\"enterform\""
">\n");
wprintf("<input type=\"hidden\" name=\"postseq\" value=\"%ld\">\n", now);
+ if (WC->wc_view == VIEW_WIKI) {
+ wprintf("<input type=\"hidden\" name=\"wikipage\" value=\"%s\">\n", bstr("wikipage"));
+ }
wprintf("<img src=\"static/newmess3_24x.gif\" align=middle alt=\" \">");
wprintf("%s\n", buf); /** header bar */
wprintf("</blockquote>\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);
* \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.
*/
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 */
);
break;
case VIEW_WIKI:
- /* Don't let users create unlinked pages. */
+ safestrncpy(buf, bstr("page"), sizeof buf);
+ str_wiki_index(buf);
+ wprintf(
+ "<td><a href=\"display_enter?wikipage=%s\">"
+ "<img align=\"middle\" src=\"static/newmess3_24x.gif\" "
+ "border=\"0\"><span class=\"navbar_link\">"
+ "%s"
+ "</span></a></td>\n", buf, _("Edit this page")
+ );
break;
default:
wprintf(
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);
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) {