Parent: [c49454] (diff)

Child: [5b76a7] (diff)

Download this file

lib.html    180 lines (169 with data), 6.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
<py:def function="threads_table(threads)">
<input py:for="i,thread in enumerate(threads)"
type="hidden" name="thread-${i}.id" value="$thread._id"/>
<table id="threads">
<thead>
<tr>
<th>Topics</th>
<th>Replies</th>
<th>Views</th>
<th>Last Post</th>
<th>Subscribed</th>
</tr>
</thead>
<tbody>
<py:for each="i, thread in enumerate(threads)">
${thread_row(i, thread)}
</py:for>
</tbody>
</table>
</py:def>
<py:def function="forums_table(parent_id)">
<input py:for="i,forum in enumerate(c.app.subforums_of(parent_id))"
type="hidden" name="forum-${i}.shortname" value="$forum.shortname"/>
<table id="forums">
<thead>
<tr>
<th/>
<th>Forum</th><th>Topics</th><th>Posts</th><th>Last Post</th><th>Subscribed</th>
</tr>
</thead>
<tbody>
<py:for each="i, forum in enumerate(c.app.subforums_of(parent_id))">
${forum_row(i, forum)}
</py:for>
</tbody>
</table>
</py:def>
<py:def function="forum_row(i, forum)">
<tr>
<td>[icon]</td>
<td>
<a href="${forum.url()}">$forum.name</a>($forum.shortname)<br/>
${Markup(g.markdown.convert(forum.description))}
<py:if test="forum.subforums">
<b>Subforums:</b>
<span py:for="i, sf in enumerate(forum.subforums)">
<py:if test="i != 0">, </py:if>
<a href="${sf.url()}">$sf.name</a>
</span>
</py:if>
</td>
<td>${forum.num_topics}</td>
<td>${forum.num_posts}</td>
<td>${post_summary(forum.last_post)}</td>
<td>${checkbox('forum-%s.subscribed' % i, None, forum.subscription())}
</td>
</tr>
</py:def>
<py:def function="forum_admin_row(i, forum)">
<tr>
<td>[icon]</td>
<td>
<div class="editable viewing">
<div class="viewer"><a href="${forum.url()}">$forum.name</a>($forum.shortname)</div>
<div class="editor">
${text_field('forum-%s.name' % i, 'Forum Name', forum.name)}
</div>
</div>
<div class="editable viewing">
<div class="viewer">${Markup(g.markdown.convert(forum.description))}</div>
<div class="editor">
${text_area('forum-%s.description' % i, 'Description', forum.description)}
</div>
</div>
<py:if test="forum.subforums">
<b>Subforums:</b>
<span py:for="i, sf in enumerate(forum.subforums)">
<py:if test="i != 0">, </py:if>
<a href="${sf.url()}">$sf.name</a>
</span>
</py:if>
</td>
<td>${forum.num_topics}</td>
<td>${forum.num_posts}</td>
<td>${post_summary(forum.last_post)}</td>
<td>
${submit_button('Delete', 'forum-%s.delete' % i)}
</td>
</tr>
</py:def>
<py:def function="display_comment(comment)">
<div id="comment-${comment._id}"
style="padding-left: 10px; border-left: 1px solid grey">
Posted by <em>${comment.author().display_name}</em> at ${comment.timestamp}
<a py:if="c.user._id and comment.author_id==c.user._id"
href="comments/$comment._id/delete">[X]</a>
<br/>
<p py:content="comment.text"/>
<div class="reply">
<h3>Reply</h3>
<form class="hidden" method="post" action="comments/$comment._id/reply">
<textarea rows="4" cols="60" name="text"></textarea><br/>
<input type="submit"/>
</form>
</div>
<py:for each="cc in comment.replies()">
${display_comment(cc)}
</py:for>
</div>
</py:def>
<py:def function="thread_row(i, thread)">
<tr>
<td><a href="${thread.url()}">$thread.subject</a></td>
<td>$thread.num_replies</td>
<td>$thread.num_views</td>
<td>${post_summary(thread.last_post)}</td>
<td>${checkbox('thread-%s.subscribed' % i, None, thread.subscription())}</td>
</tr>
</py:def>
<py:def function="post_summary(post)">
<span py:if="post">
by <a href="${post.author().url()}">${post.author().display_name}</a>
${h.ago(post.timestamp)}
</span>
</py:def>
<py:def function="page_nav(offset,total,pagesize)"
py:with="cur_page=offset / pagesize; num_pages=total/pagesize">
<p>Page ${1 + cur_page} of ${1 + num_pages}</p>
<a href=".">&lt;&lt;</a>
<a href="?offset=${offset - pagesize}">&lt;</a>
<a href="?offset=${offset + pagesize}">&gt;</a>
<a href="?offset=${total - pagesize}">&gt;&gt;</a>
</py:def>
<py:def function="display_post(post)">
<div id="post-${post._id}" class="title-pane">
<div class="title">
<strong>$post.subject</strong>
by <a href="${post.author().url()}">${post.author().display_name}</a>
${h.ago(post.timestamp)}
</div>
<div class="content">
<a py:if="c.user._id and post.author_id==c.user._id"
href="${post.url()}delete">[Delete]</a>
<br/>
${Markup(g.markdown.convert(post.text))}
<div style="padding-left: 10px; border-left: 1px solid grey">
<div class="reply title-pane closed">
<div class="title">Reply to ${post.author().display_name}</div>
<div class="content">
<form method="post" action="${post.url() + 'reply'}">
${text_field('subject', 'Subject', post.reply_subject())}
${text_area('text', 'Content', post.reply_text())}
${submit_button('Send Reply')}
</form>
</div>
</div>
<!--
<py:for each="cc in post.replies()">
${display_post(cc)}
</py:for>
-->
</div>
</div>
</div>
</py:def>
</html>