Cleanup old constants.
This commit is contained in:
parent
6027a4fab0
commit
3e66655ee7
2 changed files with 8 additions and 40 deletions
|
|
@ -23,12 +23,6 @@ import frontend/[
|
||||||
|
|
||||||
from htmlgen import tr, th, td, span, input
|
from htmlgen import tr, th, td, span, input
|
||||||
|
|
||||||
const
|
|
||||||
unselectedThread = -1
|
|
||||||
|
|
||||||
ThreadsPerPage = 15
|
|
||||||
PostsPerPage = 10
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TCrud = enum crCreate, crRead, crUpdate, crDelete
|
TCrud = enum crCreate, crRead, crUpdate, crDelete
|
||||||
|
|
||||||
|
|
@ -63,10 +57,9 @@ proc loggedIn(c: TForumData): bool =
|
||||||
# --------------- HTML widgets ------------------------------------------------
|
# --------------- HTML widgets ------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
proc genThreadUrl(c: TForumData, postId = "", action = "", threadid = "", pageNum = ""): string =
|
proc genThreadUrl(c: TForumData, postId = "", action = "",
|
||||||
|
threadid = ""): string =
|
||||||
result = "/t/" & threadid
|
result = "/t/" & threadid
|
||||||
if pageNum != "":
|
|
||||||
result.add("/" & pageNum)
|
|
||||||
if action != "":
|
if action != "":
|
||||||
result.add("?action=" & action)
|
result.add("?action=" & action)
|
||||||
if postId != "":
|
if postId != "":
|
||||||
|
|
@ -1386,9 +1379,10 @@ routes:
|
||||||
var results: seq[SearchResult] = @[]
|
var results: seq[SearchResult] = @[]
|
||||||
|
|
||||||
const queryFT = "fts.sql".slurp.sql
|
const queryFT = "fts.sql".slurp.sql
|
||||||
|
const count = 40
|
||||||
let data = [
|
let data = [
|
||||||
q, q, $ThreadsPerPage, $0, q,
|
q, q, $count, $0, q,
|
||||||
q, $ThreadsPerPage, $0, q
|
q, $count, $0, q
|
||||||
]
|
]
|
||||||
for rowFT in fastRows(db, queryFT, data):
|
for rowFT in fastRows(db, queryFT, data):
|
||||||
var content = rowFT[3]
|
var content = rowFT[3]
|
||||||
|
|
@ -1410,27 +1404,3 @@ routes:
|
||||||
get re"/(.*)":
|
get re"/(.*)":
|
||||||
cond request.matches[0].splitFile.ext == ""
|
cond request.matches[0].splitFile.ext == ""
|
||||||
resp karaxHtml
|
resp karaxHtml
|
||||||
|
|
||||||
when false:
|
|
||||||
post "/search/?@page?":
|
|
||||||
cond isFTSAvailable
|
|
||||||
createTFD()
|
|
||||||
c.isThreadsList = true
|
|
||||||
c.noPagenumumNav = true
|
|
||||||
var count = 0
|
|
||||||
var q = @"q"
|
|
||||||
for i in 0 .. q.len-1:
|
|
||||||
if q[i].int < 32: q[i] = ' '
|
|
||||||
elif q[i] == '\'': q[i] = '"'
|
|
||||||
c.search = q.replace("\"",""")
|
|
||||||
if @"page".len > 0:
|
|
||||||
parseIntSafe(@"page", c.pageNum)
|
|
||||||
cond(c.pageNum > 0)
|
|
||||||
iterator searchResults(): db_sqlite.Row {.closure, tags: [ReadDbEffect].} =
|
|
||||||
const queryFT = "fts.sql".slurp.sql
|
|
||||||
for rowFT in fastRows(db, queryFT,
|
|
||||||
[q,q,$ThreadsPerPage,$c.pageNum,$ThreadsPerPage,q,
|
|
||||||
q,q,$ThreadsPerPage,$c.pageNum,$ThreadsPerPage,q]):
|
|
||||||
yield rowFT
|
|
||||||
# resp genMain(c, genSearchResults(c, searchResults, count),
|
|
||||||
# additionalHeaders = genRSSHeaders(c), showRssLinks = true)
|
|
||||||
|
|
@ -41,8 +41,7 @@
|
||||||
<entry>
|
<entry>
|
||||||
<title>${xmlEncode(!name)}</title>
|
<title>${xmlEncode(!name)}</title>
|
||||||
<id>urn:entry:${!threadid}</id>
|
<id>urn:entry:${!threadid}</id>
|
||||||
# let url = c.genThreadUrl(threadid = !threadid,
|
# let url = c.genThreadUrl(threadid = !threadid) &
|
||||||
# pageNum = $(ceil(parseInt(!postCount) / PostsPerPage).int)) &
|
|
||||||
# "#" & !postId
|
# "#" & !postId
|
||||||
<link rel="alternate" type="text/html"
|
<link rel="alternate" type="text/html"
|
||||||
href="${c.req.makeUri(url)}"/>
|
href="${c.req.makeUri(url)}"/>
|
||||||
|
|
@ -91,8 +90,7 @@ ${xmlEncode(rstToHtml(!postContent))}</content>
|
||||||
<entry>
|
<entry>
|
||||||
<title>${xmlEncode(!postHeader)}</title>
|
<title>${xmlEncode(!postHeader)}</title>
|
||||||
<id>urn:entry:${!postId}</id>
|
<id>urn:entry:${!postId}</id>
|
||||||
# let url = c.genThreadUrl(threadid = !postThread,
|
# let url = c.genThreadUrl(threadid = !postThread) &
|
||||||
# pageNum = $(ceil(parseInt(!postPosition) / PostsPerPage).int)) &
|
|
||||||
# "#" & !postId
|
# "#" & !postId
|
||||||
<link rel="alternate" type="text/html"
|
<link rel="alternate" type="text/html"
|
||||||
href="${c.req.makeUri(url)}"/>
|
href="${c.req.makeUri(url)}"/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue