diff --git a/forum.nim b/forum.nim index 29d9d36..3a9640e 100644 --- a/forum.nim +++ b/forum.nim @@ -652,6 +652,10 @@ get "/threadActivity.xml": c.isThreadsList = true resp genThreadsRSS(c), "application/atom+xml" +get "/postActivity.xml": + createTFD() + resp genPostsRSS(c), "application/atom+xml" + get "/t/@threadid/?@page?/?": createTFD() if @"page".len > 0: diff --git a/main.tmpl b/main.tmpl index 9a05826..34d93b6 100644 --- a/main.tmpl +++ b/main.tmpl @@ -65,7 +65,9 @@ # #proc genRSSHeaders(c: var TForumData): string = # result = "" - + #end proc # @@ -112,3 +114,50 @@ # end for #end proc +# +#proc genPostsRSS(c: var TForumData): string = +# result = "" +# const query = sql"""SELECT A.id, B.name, A.content, A.thread, +# A.header, strftime('%Y-%m-%dT%H:%M:%S', A.creation), +# A.creation, COUNT(C.id) +# FROM post AS A, person AS B, post AS C +# WHERE A.author = B.id AND A.thread = C.thread AND C.id <= A.id +# GROUP BY A.id +# ORDER BY A.creation DESC LIMIT ?""" +# const postId = 0 +# const postAuthor = 1 +# const postContent = 2 +# const postThread = 3 +# const postHeader = 4 +# const postRssDate = 5 +# const postHumanDate = 6 +# const postPosition = 7 +# let frontQuery = c.req.makeUri("/") +# let recent = GetValue(db, sql"""SELECT +# strftime('%Y-%m-%dT%H:%M:%S', creation) FROM post +# ORDER BY creation DESC LIMIT 1""") + + + Nimrod forum post activity + + + ${frontQuery} + ${recent} +# for row in Rows(db, query, 10): + + ${XMLencode(%postHeader)} + urn:entry:${%postId} + # let url = c.genThreadUrl(threadid = %postThread, + # pageNum = $(ceil(parseInt(%postPosition) / postsPerPage).int)) & + # "#" & %postId + + ${%postRssDate} + On ${XMLEncode(%postHumanDate)}, ${XMLEncode(%postAuthor)} said: + +${XMLEncode(%postContent)} + +# end for + +#end proc