From: Art Cancro Date: Fri, 30 Oct 2009 19:45:08 +0000 (+0000) Subject: * Noticed something that was technically correct but confusing: when viewing a wiki... X-Git-Tag: v7.86~680 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=6f2aa1bead43018f84ed500033033fa3276779e3 * Noticed something that was technically correct but confusing: when viewing a wiki history, each line displayed the date and author of the diff, which is NOT the same thing as the date and author of the page you would get if you reverted to that version. Configured some off-by-one logic in the display code to compensate for this. As an added bonus, the last line, which simply displayed an empty message, has been replaced by a new first line, which displays the date and author of the current version. --- diff --git a/webcit/wiki.c b/webcit/wiki.c index 3ed3a4003..3e470fe8a 100644 --- a/webcit/wiki.c +++ b/webcit/wiki.c @@ -168,16 +168,12 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP) while(StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) { - StrBufExtract_token(rev_uuid, Buf, 0, '|'); rev_date = extract_long(ChrPtr(Buf), 1); webcit_fmt_date(rev_date_displayed, sizeof rev_date_displayed, rev_date, DATEFMT_FULL); StrBufExtract_token(author, Buf, 2, '|'); - StrBufExtract_token(node, Buf, 3, '|'); - wc_printf("", (row ? "#FFFFFF" : "#DDDDDD")); - row = 1 - row; + wc_printf("", ((row%2) ? "#FFFFFF" : "#DDDDDD")); wc_printf("%s", rev_date_displayed); - if (!strcasecmp(ChrPtr(node), (char *)WC->serv_info->serv_nodename)) { escputs(ChrPtr(author)); wc_printf(" @ "); @@ -190,18 +186,39 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP) escputs(ChrPtr(author)); wc_printf(""); } + wc_printf(""); + + if (row == 0) { + wc_printf("%s", + bstr("page"), + _("(show)") + ); + wc_printf("(%s)", _("Current version")); + } - wc_printf("%s", - bstr("page"), - ChrPtr(rev_uuid), - _("(show)") - ); - wc_printf("%s", - bstr("page"), - ChrPtr(rev_uuid), - _("(revert)") - ); + else { + wc_printf("%s", + bstr("page"), + ChrPtr(rev_uuid), + _("(show)") + ); + wc_printf("%s", + bstr("page"), + ChrPtr(rev_uuid), + _("(revert)") + ); + } wc_printf("\n"); + + /* Extract all fields except the author and date after displaying the row. This + * is deliberate, because the timestamp reflects when the diff was written, not + * when the version which it reflects was written. Similarly, the name associated + * with each diff is the author who created the newer version of the page that + * made the diff happen. + */ + StrBufExtract_token(rev_uuid, Buf, 0, '|'); + StrBufExtract_token(node, Buf, 3, '|'); + ++row; } wc_printf("\n");