* Added some of the buttons needed for wiki revision management
authorArt Cancro <ajc@citadel.org>
Tue, 27 Oct 2009 02:44:03 +0000 (02:44 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 27 Oct 2009 02:44:03 +0000 (02:44 +0000)
webcit/static/webcit.css
webcit/wiki.c

index b6e78b0660c5c005e5061ea067c3c194a0699368..8763be3e185f13f3dd946ed0029f64fde6d1faa4 100644 (file)
@@ -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;
 }
index 87d8cf94e3023f652ef4cf3f71ebf4ef979c723d..0d94c7d854c3e84c5b62d6a7eaa1631c2fe74ad7 100644 (file)
@@ -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("<div class=\"fix_scrollbar_bug\">"
+                       "<table class=\"wiki_history_background\">"
+               );
+
+               wc_printf("<th>%s</th>", _("Date"));
+               wc_printf("<th>%s</th>", _("Author"));
+
                while(StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
-                       wc_printf("<tt>%s</tt><br>\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("<tr bgcolor=\"%s\">", (row ? "#FFFFFF" : "#DDDDDD"));
+                       row = 1 - row;
+                       wc_printf("<td>%s</td><td>", rev_date_displayed);
+
+                       if (!strcasecmp(ChrPtr(node), (char *)WC->serv_info->serv_nodename)) {
+                               escputs(ChrPtr(author));
+                               wc_printf(" @ ");
+                               escputs(ChrPtr(node));
+                       }
+                       else {
+                               wc_printf("<a href=\"showuser?who=");
+                               urlescputs(ChrPtr(author));
+                               wc_printf("\">");
+                               escputs(ChrPtr(author));
+                               wc_printf("</a>");
+                       }
+
+                       wc_printf("</td><td><a href=\"wiki?page=%s?rev=%s\">%s</a></td>",
+                               bstr("page"),
+                               ChrPtr(rev_uuid),
+                               _("(show)")
+                       );
+                       wc_printf("</td><td><a href=\"wiki_revert?page=%s?rev=%s\">%s</a></td>",
+                               bstr("page"),
+                               ChrPtr(rev_uuid),
+                               _("(revert)")
+                       );
+                       wc_printf("</tr>\n");
                }
+
+               wc_printf("</table>\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
  */