]> code.citadel.org Git - citadel.git/blobdiff - webcit/blogview_renderer.c
move blog templates into their own directory
[citadel.git] / webcit / blogview_renderer.c
index 83a8359882bc309437dcb55d0fb50e9c1e2762f4..2254b9c0526c01f49c7b6cbb04e25200c371ec41 100644 (file)
@@ -69,7 +69,7 @@ void blogpost_render(struct blogpost *bp, int with_comments)
                for (i=1; i<bp->num_msgs; ++i) {
                        read_message(WC->WBuf, HKEY("view_blog_comment"), bp->msgs[i], NULL, &Mime);
                }
-               do_template("blog_comment_box");
+               do_template("view_blog_comment_box");
        }
 
        else {
@@ -294,7 +294,23 @@ int blogview_render(SharedMessageStatus *Stat, void **ViewSpecific, long oper)
 
                /* Now go through the list and render what we've got */
                for (i=start_here; i<num_blogposts; ++i) {
-                       blogpost_render(blogposts[i], with_comments);
+                       if ((i > 0) && (i == start_here)) {
+                               int j = i - maxp;
+                               if (j < 0) j = 0;
+                               wc_printf("<div class=\"newer_blog_posts\"><a href=\"readfwd?go=");
+                               urlescputs(ChrPtr(WC->CurRoom.name));
+                               wc_printf("?firstp=%d?maxp=%d\">", blogposts[j]->top_level_id, maxp);
+                               wc_printf("%s →</a></div>\n", _("Newer posts"));
+                       }
+                       if (i < (start_here + maxp)) {
+                               blogpost_render(blogposts[i], with_comments);
+                       }
+                       else if (i == (start_here + maxp)) {
+                               wc_printf("<div class=\"older_blog_posts\"><a href=\"readfwd?go=");
+                               urlescputs(ChrPtr(WC->CurRoom.name));
+                               wc_printf("?firstp=%d?maxp=%d\">", blogposts[i]->top_level_id, maxp);
+                               wc_printf("← %s</a></div>\n", _("Older posts"));
+                       }
                }
 
                /* Done.  We are only freeing the array of pointers; the data itself