276 lines
10 KiB
Cheetah
276 lines
10 KiB
Cheetah
#? 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
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>${xmlEncode(title)}</title>
|
|
<link rel="stylesheet" href="${c.req.makeUri("css/style.css", absolute = false)}">
|
|
<link rel="shortcut icon" href="${c.req.makeUri("favicon.ico", absolute = false)}">${additional_headers}
|
|
<meta charset="UTF-8">
|
|
</head>
|
|
<body>
|
|
<!--- #head --->
|
|
#let frontQuery = c.req.makeUri("/")
|
|
<header id="head" class="forum">
|
|
<div class="wide-layout tall">
|
|
<div id="head-logo"></div>
|
|
<a id="head-logo-link" href="/"></a>
|
|
<nav id="head-links">
|
|
<a href="http://nim-lang.org/">home</a>
|
|
<a href="http://nim-lang.org/learn.html">learn</a>
|
|
<a href="http://nim-lang.org/documentation.html">docs</a>
|
|
<a href="http://nim-lang.org/download.html">download</a>
|
|
<a href="http://nim-lang.org/support.html">support</a>
|
|
<a href="${frontQuery}" class="active">forum</a>
|
|
<a href="http://nim-lang.org/question.html">faq</a>
|
|
</nav>
|
|
</div>
|
|
</header>
|
|
|
|
<!--- #body --->
|
|
<section id="body" class="forum">
|
|
<div id="body-border"></div>
|
|
<div id="body-border-left"></div>
|
|
<div id="body-border-right"></div>
|
|
<div id="body-border-bottom"></div>
|
|
<div id="glow-line"></div>
|
|
<div id="glow-line-bottom"></div>
|
|
<div class="talk-layout">
|
|
<article id="content">
|
|
${content}
|
|
#if c.isThreadsList:
|
|
<div id="talk-info">
|
|
<div class="info">
|
|
<div>
|
|
${c.genListOnline(stats)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
#if not c.noPagenumumNav:
|
|
<div id="talk-nav">
|
|
${genPagenumNav(c, stats)}
|
|
</div>
|
|
#end if
|
|
#elif hasReplyBtn(c):
|
|
<div id="talk-info">
|
|
<div class="info-post">
|
|
<div>
|
|
${genPagenumNav(c, stats)}
|
|
</div>
|
|
</div>
|
|
<div class="user-post">
|
|
#if c.loggedIn():
|
|
#let replyUri = c.req.makeUri(c.req.path & "?action=reply#reply")
|
|
<a href="$replyUri">
|
|
<div>
|
|
<span class="reply">Reply</span>
|
|
</div>
|
|
</a>
|
|
#end if
|
|
</div>
|
|
</div>
|
|
#end if
|
|
|
|
</article>
|
|
<div id="sidebar">
|
|
<div class="title">Search</div>
|
|
<div class="content">
|
|
#if isFTSAvailable:
|
|
<a href="/search-help" target="_blank" class="searchHelp">?</a>
|
|
<form method="post" action="/search" class="searchForm">
|
|
<input type="text" name="q" maxlength="255" value="${c.search}" title="Search this forum" />
|
|
<input type="submit" value="Search" class="button search">
|
|
</form>
|
|
#else:
|
|
<form method="get" action="http://www.google.com/search" target="_blank" class="searchForm">
|
|
<input type="text" name="q" maxlength="255" value="${c.search}" title="Search this forum" />
|
|
<input type="submit" value="Search" class="button search">
|
|
<input type="hidden" name="sitesearch" value="http://forum.nim-lang.org" />
|
|
</form>
|
|
#end if
|
|
</div>
|
|
#if c.loggedIn:
|
|
<div class="title">Your account</div>
|
|
<div class="content user">
|
|
#let profileUrl = c.req.makeUri("profile/", false) &
|
|
# xmlEncode(c.username)
|
|
<a href="$profileUrl" class="user">${c.username}</a>
|
|
<a href="$profileUrl" class="avatar">${genGravatar(c.email)}</a>
|
|
<a href="${frontQuery}newthread" class="button">New Thread</a>
|
|
<a href="$profileUrl" class="button">My Profile</a>
|
|
|
|
<a href="${frontQuery}logout" class="button logout">Logout</a>
|
|
|
|
</div>
|
|
#else:
|
|
<div class="title">Login</div>
|
|
<div class="content">
|
|
<form name="login" action="${frontQuery}dologin" method="POST">
|
|
<span>Username: </span><input type="text" name="name" />
|
|
<span>Password: </span><input type="password" name="password" />
|
|
<input type="submit" style="display: none;"
|
|
id="hdnLogin" value="Login" />
|
|
</form>
|
|
<a id="passreset" href=${c.req.makeUri("/resetPassword")}>Reset password</a>
|
|
#if c.errorMsg != "":
|
|
<span class="error">$c.errorMsg</span>
|
|
#end if
|
|
<a href="${frontQuery}register" class="button"
|
|
style="float: left;">Register</a>
|
|
<a href="#" onclick="document.forms['login'].submit()"
|
|
class="button">Login</a>
|
|
</div>
|
|
#end if
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!--- #foot --->
|
|
<footer id="foot" class="forum">
|
|
<div class="talk-layout tall">
|
|
<div id="foot-links">
|
|
<div>
|
|
<h4>Documentation</h4>
|
|
<a href="http://nim-lang.org/documentation.html">Stable Documentation</a>
|
|
<a href="https://github.com/nim-lang/nim/issues">Github Issues & Requests</a>
|
|
</div>
|
|
<div>
|
|
<h4>Community</h4>
|
|
<a href="http://forum.nim-lang.org">User Forum</a>
|
|
<a href="http://webchat.freenode.net/?channels=nim">Online IRC</a>
|
|
<a href="http://irclogs.nim-lang.org/">IRC Logs</a>
|
|
</div>
|
|
</div>
|
|
<div id="foot-legal">
|
|
<h4>Written in Nim - Powered by <a href="https://github.com/dom96/jester">Jester</a></h4>
|
|
Web Design by <a href="http://reign-studios.net/philipwitte/">Philip Witte</a> & <a href="http://picheta.me">Dominik Picheta</a><br>
|
|
Copyright © 2015 - <a href="https://nim-lang.org/araq/index.html">Andreas Rumpf</a> & <a href="https://github.com/nim-lang/nim/graphs/contributors">Contributors</a>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
<script>
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
|
|
ga('create', 'UA-58103537-1', 'auto');
|
|
ga('send', 'pageview');
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
#end proc
|
|
#
|
|
#proc genRSSHeaders(c: TForumData): string =
|
|
# result = ""
|
|
<link href="${c.req.makeUri("/threadActivity.xml")}" title="Thread activity"
|
|
type="application/atom+xml" rel="alternate">
|
|
<link href="${c.req.makeUri("/postActivity.xml")}" title="Post activity"
|
|
type="application/atom+xml" rel="alternate">
|
|
#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""")
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
<title>Nim forum thread activity</title>
|
|
<link href="${c.req.makeUri("/threadActivity.xml")}" rel="self" />
|
|
<link href="${frontQuery}" />
|
|
<id>${frontQuery}</id>
|
|
<updated>${recent}</updated>
|
|
# for row in rows(db, query, 10):
|
|
<entry>
|
|
<title>${xmlEncode(!name)}</title>
|
|
<id>urn:entry:${!threadid}</id>
|
|
# let url = c.genThreadUrl(threadid = !threadid,
|
|
# pageNum = $(ceil(parseInt(!postCount) / PostsPerPage).int)) &
|
|
# "#" & !postId
|
|
<link rel="alternate" type="text/html"
|
|
href="${c.req.makeUri(url)}"/>
|
|
<published>${!threadDate}</published>
|
|
<updated>${!threadDate}</updated>
|
|
<author><name>${xmlEncode(!postAuthor)}</name></author>
|
|
<content type="html"
|
|
>Posts ${!postCount}, ${xmlEncode(!postAuthor)} said:
|
|
<p>
|
|
${xmlEncode(rstToHtml(!postContent))}</content>
|
|
</entry>
|
|
# end for
|
|
</feed>
|
|
#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""")
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
<title>Nim forum post activity</title>
|
|
<link href="${c.req.makeUri("/postActivity.xml")}" rel="self" />
|
|
<link href="${frontQuery}" />
|
|
<id>${frontQuery}</id>
|
|
<updated>${recent}</updated>
|
|
# for row in rows(db, query, 10):
|
|
<entry>
|
|
<title>${xmlEncode(!postHeader)}</title>
|
|
<id>urn:entry:${!postId}</id>
|
|
# let url = c.genThreadUrl(threadid = !postThread,
|
|
# pageNum = $(ceil(parseInt(!postPosition) / PostsPerPage).int)) &
|
|
# "#" & !postId
|
|
<link rel="alternate" type="text/html"
|
|
href="${c.req.makeUri(url)}"/>
|
|
<published>${!postRssDate}</published>
|
|
<updated>${!postRssDate}</updated>
|
|
<author><name>${xmlEncode(!postAuthor)}</name></author>
|
|
<content type="html"
|
|
>On ${xmlEncode(!postHumanDate)}, ${xmlEncode(!postAuthor)} said:
|
|
<p>
|
|
${xmlEncode(rstToHtml(!postContent))}</content>
|
|
</entry>
|
|
# end for
|
|
</feed>
|
|
#end proc
|