From 27bce336d4dde403225ec0764ab42ea0d4996c80 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 27 Oct 2009 02:44:03 +0000 Subject: [PATCH] * Added some of the buttons needed for wiki revision management --- webcit/static/webcit.css | 2 +- webcit/wiki.c | 57 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/webcit/static/webcit.css b/webcit/static/webcit.css index b6e78b066..8763be3e1 100644 --- a/webcit/static/webcit.css +++ b/webcit/static/webcit.css @@ -50,7 +50,7 @@ body { font-weight: 400; } -#iconbar_container, .boxcontent,.service form div,table.altern .odd, #message_list, .message_content, #roomlist_div,.editednode,.mailbox_summary, .auth_validate, .event_background, .calendar_background, .calendar_view_background, .graphics_background, .messages_background, .paging_background, .preferences_background, .roomops_background, .sieve_background, .siteconfig_background, .smtpqueue_background, .tabs_background, .useredit_background, .userlist_background, .downloads_background, .vcard_edit_background, div.auto_complete, div.auto_complete ul, #summary_view { +#iconbar_container, .boxcontent,.service form div,table.altern .odd, #message_list, .message_content, #roomlist_div,.editednode,.mailbox_summary, .auth_validate, .event_background, .calendar_background, .calendar_view_background, .graphics_background, .messages_background, .paging_background, .preferences_background, .roomops_background, .sieve_background, .siteconfig_background, .smtpqueue_background, .tabs_background, .useredit_background, .userlist_background, .wiki_history_background .downloads_background, .vcard_edit_background, div.auto_complete, div.auto_complete ul, #summary_view { background-color: #FFF; color: #000; } diff --git a/webcit/wiki.c b/webcit/wiki.c index 87d8cf94e..0d94c7d85 100644 --- a/webcit/wiki.c +++ b/webcit/wiki.c @@ -109,6 +109,7 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP) const StrBuf *roomname; char pagename[128]; StrBuf *Buf; + int row = 0; roomname = sbstr("room"); safestrncpy(pagename, bstr("page"), sizeof pagename); @@ -133,9 +134,62 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP) Buf = NewStrBuf(); StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) == 1) { + + time_t rev_date; + char rev_date_displayed[64]; + StrBuf *rev_uuid = NewStrBuf(); + StrBuf *author = NewStrBuf(); + StrBuf *node = NewStrBuf(); + + wc_printf("
" + "" + ); + + wc_printf("", _("Date")); + wc_printf("", _("Author")); + while(StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) { - wc_printf("%s
\n", ChrPtr(Buf)); + + 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("", + bstr("page"), + ChrPtr(rev_uuid), + _("(show)") + ); + wc_printf("", + bstr("page"), + ChrPtr(rev_uuid), + _("(revert)") + ); + wc_printf("\n"); } + + wc_printf("
%s%s
%s", rev_date_displayed); + + if (!strcasecmp(ChrPtr(node), (char *)WC->serv_info->serv_nodename)) { + escputs(ChrPtr(author)); + wc_printf(" @ "); + escputs(ChrPtr(node)); + } + else { + wc_printf(""); + escputs(ChrPtr(author)); + wc_printf(""); + } + + wc_printf("%s%s
\n"); + FreeStrBuf(&author); + FreeStrBuf(&node); + FreeStrBuf(&rev_uuid); } else { wc_printf("%s", ChrPtr(Buf)); @@ -145,6 +199,7 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP) } + /* * Display the revision history for a wiki page */ -- 2.30.2