forked from elkarte/Elkarte
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Recent.template.php
336 lines (297 loc) · 15.5 KB
/
Recent.template.php
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<?php
/**
* @name ElkArte Forum
* @copyright ElkArte Forum contributors
* @license BSD http://opensource.org/licenses/BSD-3-Clause
*
* This software is a derived product, based on:
*
* Simple Machines Forum (SMF)
* copyright: 2011 Simple Machines (http://www.simplemachines.org)
* license: BSD, See included LICENSE.TXT for terms and conditions.
*
* @version 1.0 Alpha
*/
/**
* Recent posts page.
*/
function template_main()
{
global $context, $settings, $txt, $scripturl;
template_pagesection(false, false, 'go_down');
echo '
<div id="recentposts" class="forumposts">';
//template_pagesection(false, false, 'go_down');
echo '
<h3 class="catbg">
<img src="', $settings['images_url'], '/post/xx.png" alt="" class="icon" />',$txt['recent_posts'],'
</h3>';
//template_pagesection(false, false, 'go_down');
// @todo - I'm sure markup could be cleaned up a bit more here. CSS needs a bit of a tweak too.
foreach ($context['posts'] as $post)
{
echo '
<div class="', $post['alternate'] == 0 ? 'windowbg' : 'windowbg2', ' core_posts">
<div class="content">
<div class="counter">', $post['counter'], '</div>
<div class="topic_details">
<h5>', $post['board']['link'], ' / ', $post['link'], '</h5>
<span class="smalltext">', $txt['last_post'], ' ', $txt['by'], ' <strong>', $post['poster']['link'], ' </strong> - ', $post['time'], '</span>
</div>
<div class="inner">', $post['message'], '</div>';
if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
echo '
<ul class="quickbuttons">';
// If they *can* reply?
if ($post['can_reply'])
echo '
<li class="listlevel1"><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '" class="linklevel1 reply_button"><span>', $txt['reply'], '</span></a></li>';
// If they *can* quote?
if ($post['can_quote'])
echo '
<li class="listlevel1"><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '" class="linklevel1 quote_button"><span>', $txt['quote'], '</span></a></li>';
// Can we request notification of topics?
if ($post['can_mark_notify'])
echo '
<li class="listlevel1"><a href="', $scripturl, '?action=notify;topic=', $post['topic'], '.', $post['start'], '" class="linklevel1 notify_button"><span>', $txt['notify'], '</span></a></li>';
// How about... even... remove it entirely?!
if ($post['can_delete'])
echo '
<li class="listlevel1"><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';recent;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_message'], '?\');" class="linklevel1 remove_button"><span>', $txt['remove'], '</span></a></li>';
if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
echo '
</ul>';
echo '
</div>
</div>';
}
//template_pagesection();
echo '
</div>';
template_pagesection();
}
/**
* Unread posts page.
*/
function template_unread()
{
global $context, $settings, $txt, $scripturl, $modSettings;
if (!empty($context['topics']))
{
template_pagesection('recent_buttons', 'right', 'go_down');
if ($context['showCheckboxes'])
echo '
<form action="', $scripturl, '?action=quickmod" method="post" accept-charset="UTF-8" name="quickModForm" id="quickModForm" style="margin: 0;">
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
<input type="hidden" name="qaction" value="markread" />
<input type="hidden" name="redirect_url" value="action=unread', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '" />';
// [WIP] There is trial code here to hide the topic icon column. Colspan can be cleaned up later.
echo '
<h2 class="category_header" id="unread_header">
', $context['showing_all_topics'] ? $txt['unread_topics_all'] : $txt['unread_topics_visit'], '
</h2>
<ul class="topic_listing" id="unread">
<li class="topic_sorting_row">
<h3>
Sort by: <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
/ <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
/ <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
</h3>';
// Show a "select all" box for quick moderation?
if ($context['showCheckboxes'])
echo '
<p>
<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" />
</p>';
echo '
</li>';
foreach ($context['topics'] as $topic)
{
// Calculate the color class of the topic.
$color_class = '';
if ($topic['is_sticky'] && $topic['is_locked'])
$color_class = 'locked_row sticky_row';
// Sticky topics should get a different color, too.
elseif ($topic['is_sticky'])
$color_class = 'sticky_row';
// Locked topics get special treatment as well.
elseif ($topic['is_locked'])
$color_class = 'locked_row';
// Last, but not least: regular topics.
else
$color_class = 'basic_row';
echo '
<li class="', $color_class, '">
<div class="topic_info">
<p class="topic_icons">
<img src="', $topic['first_post']['icon_url'], '" alt="" /><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="fred" />
</p>
<div class="topic_name">';
echo '
<a href="', $topic['new_href'], '" id="newicon', $topic['first_post']['id'], '"><span class="new_posts">' . $txt['new'] . '</span></a>
<h4>
', $topic['is_sticky'] ? '<strong>' : '', '<span class="preview" title="', $topic[(!empty($settings['message_index_preview']) && $settings['message_index_preview_first'] == 2 ? 'last_post' : 'first_post')]['preview'], '"><span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span></span>', $topic['is_sticky'] ? '</strong>' : '', '
</h4>
</div>
<p class="topic_starter">
', $txt['started_by'], ' ', $topic['first_post']['member']['link'], '
<span class="small_pagelinks" id="pages' . $topic['first_post']['id'] . '">', $topic['pages'], '</span>
</p>
</div>
<div class="topic_latest">
<p class="topic_stats">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</p>
<p class="topic_lastpost">
<a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.png" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a>
', $topic['last_post']['time'], '<br />
', $txt['by'], ' ', $topic['last_post']['member']['link'], '
</p>
</div>';
if ($context['showCheckboxes'])
echo '
<p class="topic_moderation" >
<input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />
</p>';
echo '
</li>';
}
echo '
</ul>';
template_pagesection('recent_buttons', 'right');
if ($context['showCheckboxes'])
echo '
</form>';
}
else
echo '
<h2 class="category_header">
', $context['showing_all_topics'] ? $txt['msg_alert_none'] : $txt['unread_topics_visit_none'], '
</h2>';
echo '
<div id="topic_icons" class="description">
<p class="floatleft">', !empty($modSettings['enableParticipation']) && $context['user']['is_logged'] ? '
<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="" class="centericon" /> ' . $txt['participation_caption'] : '<img src="' . $settings['images_url'] . '/post/xx.png" alt="" class="centericon" /> ' . $txt['normal_topic'], '<br />
'. ($modSettings['pollMode'] == '1' ? '<img src="' . $settings['images_url'] . '/topic/normal_poll.png" alt="" class="centericon" /> ' . $txt['poll'] : '') . '
</p>
<p>
<img src="' . $settings['images_url'] . '/icons/quick_lock.png" alt="" class="centericon" /> ' . $txt['locked_topic'] . '<br />' . ($modSettings['enableStickyTopics'] == '1' ? '
<img src="' . $settings['images_url'] . '/icons/quick_sticky.png" alt="" class="centericon" /> ' . $txt['sticky_topic'] . '<br />' : '') . '
</p>
</div>';
}
/**
* Interface to show unread replies to your posts.
*/
function template_replies()
{
global $context, $settings, $txt, $scripturl, $modSettings;
if (!empty($context['topics']))
{
template_pagesection('recent_buttons', 'right', 'go_down');
if ($context['showCheckboxes'])
echo '
<form action="', $scripturl, '?action=quickmod" method="post" accept-charset="UTF-8" name="quickModForm" id="quickModForm" style="margin: 0;">
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
<input type="hidden" name="qaction" value="markread" />
<input type="hidden" name="redirect_url" value="action=unreadreplies', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '" />';
// [WIP] There is trial code here to hide the topic icon column. Colspan can be cleaned up later.
echo '
<h2 class="category_header" id="unread_header">
', $txt['unread_replies'], '
</h2>
<ul class="topic_listing" id="unread">
<li class="topic_sorting_row">
<h3>
Sort by: <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=subject', $context['sort_by'] === 'subject' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] === 'subject' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
/ <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] === 'replies' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] === 'replies' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
/ <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] === 'last_post' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] === 'last_post' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
</h3>';
// Show a "select all" box for quick moderation?
if ($context['showCheckboxes'])
echo '
<p>
<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" />
</p>';
echo '
</li>';
foreach ($context['topics'] as $topic)
{
// Calculate the color class of the topic.
$color_class = '';
if ($topic['is_sticky'] && $topic['is_locked'])
$color_class = 'locked_row sticky_row';
// Sticky topics should get a different color, too.
elseif ($topic['is_sticky'])
$color_class = 'sticky_row';
// Locked topics get special treatment as well.
elseif ($topic['is_locked'])
$color_class = 'locked_row';
// Last, but not least: regular topics.
else
$color_class = 'basic_row';
echo '
<li class="', $color_class, '">
<div class="topic_info">
<p class="topic_icons">
<img src="', $topic['first_post']['icon_url'], '" alt="" /><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="fred" />
</p>
<div class="topic_name">';
// [WIP] MEthinks the orange icons look better if they aren't all over the page.
echo '
<a href="', $topic['new_href'], '" id="newicon', $topic['first_post']['id'], '"><span class="new_posts">' . $txt['new'] . '</span></a>
<h4>
', $topic['is_sticky'] ? '<strong>' : '', '<span title="', $topic[(!empty($settings['message_index_preview']) && $settings['message_index_preview_first'] == 2 ? 'last_post' : 'first_post')]['preview'], '"><span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span></span>', $topic['is_sticky'] ? '</strong>' : '', '
</h4>
</div>
<p class="topic_starter">
', $topic['first_post']['started_by'], '
<span class="small_pagelinks" id="pages' . $topic['first_post']['id'] . '">', $topic['pages'], '</span>
</p>
</div>
<div class="topic_latest">
<p class="topic_stats">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</p>
<p class="topic_lastpost">
<a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.png" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a>
', $topic['last_post']['time'], '<br />
', $txt['by'], ' ', $topic['last_post']['member']['link'], '
</p>
</div>';
if ($context['showCheckboxes'])
echo '
<p class="topic_moderation">
<input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />
</p>';
echo '
</li>';
}
echo '
</ul>';
template_pagesection('recent_buttons', 'right');
if ($context['showCheckboxes'])
echo '
</form>';
}
else
echo '
<h2 class="category_header">
', $context['showing_all_topics'] ? $txt['msg_alert_none'] : $txt['unread_topics_visit_none'], '
</h2>';
echo '
<div id="topic_icons" class="description">
<p class="floatleft">', !empty($modSettings['enableParticipation']) && $context['user']['is_logged'] ? '
<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="" class="centericon" /> ' . $txt['participation_caption'] : '<img src="' . $settings['images_url'] . '/post/xx.png" alt="" class="centericon" /> ' . $txt['normal_topic'], '<br />
'. ($modSettings['pollMode'] == '1' ? '<img src="' . $settings['images_url'] . '/topic/normal_poll.png" alt="" class="centericon" /> ' . $txt['poll'] : '') . '
</p>
<p>
<img src="' . $settings['images_url'] . '/icons/quick_lock.png" alt="" class="centericon" /> ' . $txt['locked_topic'] . '<br />' . ($modSettings['enableStickyTopics'] == '1' ? '
<img src="' . $settings['images_url'] . '/icons/quick_sticky.png" alt="" class="centericon" /> ' . $txt['sticky_topic'] . '<br />' : '') . '
</p>
</div>';
}