#? stdtmpl | standard #proc genMain(c: TForumData, content: string, title = "Nim Forum", # additional_headers = "", showRssLinks = false): string = # result = "" # var stats: TForumStats # if c.isThreadsList: stats = c.getStats(false) # else: # stats = c.getStats(true) # end if ${xmlEncode(title)} ${additional_headers} #let frontQuery = c.req.makeUri("/")
${content} #if c.isThreadsList:
${c.genListOnline(stats)}
#if not c.noPagenumumNav:
${genPagenumNav(c, stats)}
#end if #elif hasReplyBtn(c):
${genPagenumNav(c, stats)}
#if c.loggedIn(): #let replyUri = c.req.makeUri(c.req.path & "?action=reply#reply")
Reply
#end if
#end if
#end proc # #proc genRSSHeaders(c: TForumData): string = # result = "" #end proc # #proc genThreadsRSS(c: TForumData): string = # result = "" # const query = sql"""SELECT A.id, A.name, # strftime('%Y-%m-%dT%H:%M:%SZ', (A.modified)), # COUNT(B.id), C.name, B.content, B.id # FROM thread AS A, post AS B, person AS C # WHERE A.id = b.thread AND B.author = C.id # GROUP BY B.thread # ORDER BY modified DESC LIMIT ?""" # const threadId = 0 # const name = 1 # const threadDate = 2 # const postCount = 3 # const postAuthor = 4 # const postContent = 5 # const postId = 6 # let frontQuery = c.req.makeUri("/") # let recent = getValue(db, sql"""SELECT # strftime('%Y-%m-%dT%H:%M:%SZ', (modified)) FROM thread # ORDER BY modified DESC LIMIT 1""") Nim forum thread activity ${frontQuery} ${recent} # for row in rows(db, query, 10): ${xmlEncode(!name)} urn:entry:${!threadid} # let url = c.genThreadUrl(threadid = !threadid, # pageNum = $(ceil(parseInt(!postCount) / PostsPerPage).int)) & # "#" & !postId ${!threadDate} ${!threadDate} ${xmlEncode(!postAuthor)} Posts ${!postCount}, ${xmlEncode(!postAuthor)} said: <p> ${xmlEncode(rstToHtml(!postContent))} # end for #end proc # #proc genPostsRSS(c: TForumData): string = # result = "" # const query = sql"""SELECT A.id, B.name, A.content, A.thread, # A.header, strftime('%Y-%m-%dT%H:%M:%SZ', 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:%SZ', creation) FROM post # ORDER BY creation DESC LIMIT 1""") Nim 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} ${!postRssDate} ${xmlEncode(!postAuthor)} On ${xmlEncode(!postHumanDate)}, ${xmlEncode(!postAuthor)} said: <p> ${xmlEncode(rstToHtml(!postContent))} # end for #end proc