|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @package ElkArte Forum |
|
5
|
|
|
* @copyright ElkArte Forum contributors |
|
6
|
|
|
* @license BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file) |
|
7
|
|
|
* |
|
8
|
|
|
* This file contains code covered by: |
|
9
|
|
|
* copyright: 2011 Simple Machines (http://www.simplemachines.org) |
|
10
|
|
|
* |
|
11
|
|
|
* @version 2.0 dev |
|
12
|
|
|
* |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Template for listing all the current categories and boards. |
|
17
|
|
|
*/ |
|
18
|
|
|
function template_manage_boards() |
|
19
|
|
|
{ |
|
20
|
|
|
global $context, $settings, $scripturl, $txt, $modSettings; |
|
21
|
|
|
|
|
22
|
|
|
// Table header. |
|
23
|
|
|
echo ' |
|
24
|
|
|
<div id="manage_boards"> |
|
25
|
|
|
<h2 class="category_header">', $txt['boardsEdit'], '</h2>'; |
|
26
|
|
|
|
|
27
|
|
|
if (!empty($context['move_board'])) |
|
28
|
|
|
echo ' |
|
29
|
|
|
<div class="information"> |
|
30
|
|
|
<p>', $context['move_title'], ' [<a href="', $scripturl, '?action=admin;area=manageboards">', $txt['mboards_cancel_moving'], '</a>]', '</p> |
|
31
|
|
|
</div>'; |
|
32
|
|
|
|
|
33
|
|
|
// No categories so show a label. |
|
34
|
|
|
if (empty($context['categories'])) |
|
35
|
|
|
echo ' |
|
36
|
|
|
<div class="content centertext"> |
|
37
|
|
|
', $txt['mboards_no_cats'], ' |
|
38
|
|
|
</div>'; |
|
39
|
|
|
|
|
40
|
|
|
// Loop through every category, listing the boards in each as we go. |
|
41
|
|
|
$sortables = array(); |
|
42
|
|
|
foreach ($context['categories'] as $category) |
|
43
|
|
|
{ |
|
44
|
|
|
$sortables[] = '#category_' . $category['id']; |
|
45
|
|
|
|
|
46
|
|
|
// Link to modify the category. |
|
47
|
|
|
echo ' |
|
48
|
|
|
<h2 class="category_header"> |
|
49
|
|
|
<a href="' . $scripturl . '?action=admin;area=manageboards;sa=cat;cat=' . $category['id'] . '">', $category['name'], '</a> |
|
50
|
|
|
<a href="' . $scripturl . '?action=admin;area=manageboards;sa=cat;cat=' . $category['id'] . '"><i class="icon icon-small i-pencil"></i>', $txt['catModify'], '</a> |
|
51
|
|
|
</h2>'; |
|
52
|
|
|
|
|
53
|
|
|
// Boards table header. |
|
54
|
|
|
echo ' |
|
55
|
|
|
<form action="', $scripturl, '?action=admin;area=manageboards;sa=newboard;cat=', $category['id'], '" method="post" accept-charset="UTF-8"> |
|
56
|
|
|
<div id="category_', $category['id'], '" class="content"> |
|
57
|
|
|
<ul class="nolist">'; |
|
58
|
|
|
|
|
59
|
|
|
if (!empty($category['move_link'])) |
|
60
|
|
|
echo ' |
|
61
|
|
|
<li><a href="', $category['move_link']['href'], '" title="', $category['move_link']['label'], '"><img src="', $settings['images_url'], '/smiley_select_spot.png" alt="', $category['move_link']['label'], '" /></a></li>'; |
|
62
|
|
|
|
|
63
|
|
|
$first = true; |
|
64
|
|
|
$depth = 0; |
|
65
|
|
|
|
|
66
|
|
|
// If there is nothing in a category, add a drop zone |
|
67
|
|
|
if (empty($category['boards'])) |
|
68
|
|
|
echo ' |
|
69
|
|
|
<li id="cbp_' . $category['id'] . ',-1,"></li>'; |
|
70
|
|
|
|
|
71
|
|
|
// List through every board in the category, printing its name and link to modify the board. |
|
72
|
|
|
foreach ($category['boards'] as $board) |
|
73
|
|
|
{ |
|
74
|
|
|
// Going in a level deeper (sub-board) |
|
75
|
|
|
if ($board['child_level'] > $depth) |
|
76
|
|
|
echo ' |
|
77
|
|
|
<ul class="nolist">'; |
|
78
|
|
|
// Backing up a level to a childs parent |
|
79
|
|
|
elseif ($board['child_level'] < $depth) |
|
80
|
|
|
{ |
|
81
|
|
|
for ($i = $board['child_level']; $i < $depth; $i++) |
|
82
|
|
|
echo |
|
83
|
|
|
' |
|
84
|
|
|
</li> |
|
85
|
|
|
</ul>'; |
|
86
|
|
|
} |
|
87
|
|
|
// Base node parent but not the first one |
|
88
|
|
|
elseif ($board['child_level'] == 0 && !$first) |
|
89
|
|
|
echo ' |
|
90
|
|
|
</li>'; |
|
91
|
|
|
|
|
92
|
|
|
echo ' |
|
93
|
|
|
<li id="cbp_' . $category['id'] . ',' . $board['id'] . '"', (!empty($modSettings['recycle_board']) && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] == $board['id'] ? 'class="recycle_board"' : ''), ' style="', $board['move'] ? ';color: red;' : '', '"> |
|
94
|
|
|
<span class="floatleft"><a href="', $scripturl, '?board=', $board['id'], '">', $board['name'], '</a>', !empty($modSettings['recycle_board']) && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] == $board['id'] ? ' <a href="' . $scripturl . '?action=admin;area=manageboards;sa=settings"><img src="' . $settings['images_url'] . '/post/recycled.png" alt="' . $txt['recycle_board'] . '" /></a></span>' : '</span>', ' |
|
95
|
|
|
<span class="floatright">', $context['can_manage_permissions'] ? '<span class="modify_boards"><a href="' . $scripturl . '?action=admin;area=permissions;sa=index;pid=' . $board['permission_profile'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['mboards_permissions'] . '</a></span>' : '', ' |
|
96
|
|
|
<span class="modify_boards"><a href="', $scripturl, '?action=admin;area=manageboards;move=', $board['id'], '">', $txt['mboards_move'], '</a></span> |
|
97
|
|
|
<span class="modify_boards"><a href="', $scripturl, '?action=admin;area=manageboards;sa=board;boardid=', $board['id'], '">', $txt['mboards_modify'], '</a></span></span><br style="clear: right;" />'; |
|
98
|
|
|
|
|
99
|
|
|
if (!empty($board['move_links'])) |
|
100
|
|
|
{ |
|
101
|
|
|
echo ' |
|
102
|
|
|
<li style="padding-', $context['right_to_left'] ? 'right' : 'left', ': ', 5 + 30 * $board['move_links'][0]['child_level'], 'px;">'; |
|
103
|
|
|
|
|
104
|
|
|
foreach ($board['move_links'] as $link) |
|
105
|
|
|
echo ' |
|
106
|
|
|
<a href="', $link['href'], '" class="move_links" title="', $link['label'], '"><img src="', $settings['images_url'], '/board_select_spot', $link['child_level'] > 0 ? '_child' : '', '.png" alt="', $link['label'], '" style="padding: 0px; margin: 0px;" /></a>'; |
|
107
|
|
|
|
|
108
|
|
|
echo ' |
|
109
|
|
|
</li>'; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
$depth = $board['child_level']; |
|
113
|
|
|
$first = false; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
// All done, backing up to a base node |
|
117
|
|
|
if (!$first) |
|
118
|
|
|
{ |
|
119
|
|
|
if ($depth > 0) |
|
120
|
|
|
{ |
|
121
|
|
|
for ($i = $depth; $i > 0; $i--) |
|
122
|
|
|
echo |
|
123
|
|
|
' |
|
124
|
|
|
</li> |
|
125
|
|
|
</ul>'; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
echo ' |
|
129
|
|
|
</li>'; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
// Button to add a new board. |
|
133
|
|
|
echo ' |
|
134
|
|
|
</ul> |
|
135
|
|
|
<br class="clear" /> |
|
136
|
|
|
<div class="submitbutton"> |
|
137
|
|
|
<input type="submit" value="', $txt['mboards_new_board'], '" /> |
|
138
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
|
139
|
|
|
</div> |
|
140
|
|
|
</div> |
|
141
|
|
|
</form>'; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
echo ' |
|
145
|
|
|
</div> |
|
146
|
|
|
<script> |
|
147
|
|
|
// Start by creating proper ids and ul childs for use |
|
148
|
|
|
setBoardIds(); |
|
149
|
|
|
|
|
150
|
|
|
// Set up our sortable call |
|
151
|
|
|
$().elkSortable({ |
|
152
|
|
|
sa: "boardorder", |
|
153
|
|
|
error: "' . $txt['admin_order_error'] . '", |
|
154
|
|
|
title: "' . $txt['admin_order_title'] . '", |
|
155
|
|
|
token: {token_var: "' . $context['admin-sort_token_var'] . '", token_id: "' . $context['admin-sort_token'] . '"}, |
|
156
|
|
|
tag: "' . implode(' ul,', $sortables) . ' ul", |
|
157
|
|
|
connect: ".nolist", |
|
158
|
|
|
containment: "document", |
|
159
|
|
|
href: "?action=admin;area=manageboards", |
|
160
|
|
|
placeholder: "ui-state-highlight", |
|
161
|
|
|
preprocess: "setBoardIds", |
|
162
|
|
|
axis: "", |
|
163
|
|
|
setorder: "inorder" |
|
164
|
|
|
}); |
|
165
|
|
|
</script>'; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* Template for editing/adding a category on the forum. |
|
170
|
|
|
*/ |
|
171
|
|
|
function template_modify_category() |
|
172
|
|
|
{ |
|
173
|
|
|
global $context, $scripturl, $txt; |
|
174
|
|
|
|
|
175
|
|
|
// Print table header. |
|
176
|
|
|
echo ' |
|
177
|
|
|
<div id="manage_boards"> |
|
178
|
|
|
<form action="', $scripturl, '?action=admin;area=manageboards;sa=cat2" method="post" accept-charset="UTF-8"> |
|
179
|
|
|
<input type="hidden" name="cat" value="', $context['category']['id'], '" /> |
|
180
|
|
|
<h2 class="category_header"> |
|
181
|
|
|
', isset($context['category']['is_new']) ? $txt['mboards_new_cat_name'] : $txt['catEdit'], ' |
|
182
|
|
|
</h2> |
|
183
|
|
|
<div class="content"> |
|
184
|
|
|
<dl class="settings">'; |
|
185
|
|
|
|
|
186
|
|
|
// If this isn't the only category, let the user choose where this category should be positioned down the boardindex. |
|
187
|
|
|
if (count($context['category_order']) > 1) |
|
188
|
|
|
{ |
|
189
|
|
|
echo ' |
|
190
|
|
|
<dt><label for="cat_order">', $txt['order'], ':</label></dt> |
|
191
|
|
|
<dd> |
|
192
|
|
|
<select id="cat_order" name="cat_order">'; |
|
193
|
|
|
|
|
194
|
|
|
// Print every existing category into a select box. |
|
195
|
|
|
foreach ($context['category_order'] as $order) |
|
196
|
|
|
echo ' |
|
197
|
|
|
<option', $order['selected'] ? ' selected="selected"' : '', ' value="', $order['id'], '">', $order['name'], '</option>'; |
|
198
|
|
|
|
|
199
|
|
|
echo ' |
|
200
|
|
|
</select> |
|
201
|
|
|
</dd>'; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
// Allow the user to edit the category name and/or choose whether you can collapse the category. |
|
205
|
|
|
echo ' |
|
206
|
|
|
<dt> |
|
207
|
|
|
<label for="cat_name">', $txt['full_name'], ':</label><br /> |
|
208
|
|
|
<span class="smalltext">', $txt['name_on_display'], '</span> |
|
209
|
|
|
</dt> |
|
210
|
|
|
<dd> |
|
211
|
|
|
<input type="text" id="cat_name" name="cat_name" value="', $context['category']['editable_name'], '" size="30" tabindex="', $context['tabindex']++, '" class="input_text" /> |
|
212
|
|
|
</dd> |
|
213
|
|
|
<dt> |
|
214
|
|
|
<strong>' . $txt['collapse_enable'] . '</strong><br /> |
|
215
|
|
|
<span class="smalltext">' . $txt['collapse_desc'] . '</span> |
|
216
|
|
|
</dt> |
|
217
|
|
|
<dd> |
|
218
|
|
|
<input type="checkbox" name="collapse"', $context['category']['can_collapse'] ? ' checked="checked"' : '', ' tabindex="', $context['tabindex']++, '" /> |
|
219
|
|
|
</dd>'; |
|
220
|
|
|
|
|
221
|
|
|
// Table footer. |
|
222
|
|
|
echo ' |
|
223
|
|
|
</dl> |
|
224
|
|
|
<div class="submitbutton">'; |
|
225
|
|
|
|
|
226
|
|
|
if (isset($context['category']['is_new'])) |
|
227
|
|
|
echo ' |
|
228
|
|
|
<input type="submit" name="add" value="', $txt['mboards_add_cat_button'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" />'; |
|
229
|
|
|
else |
|
230
|
|
|
echo ' |
|
231
|
|
|
<input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" /> |
|
232
|
|
|
<input type="submit" name="delete" value="', $txt['mboards_delete_cat'], '" />'; |
|
233
|
|
|
|
|
234
|
|
|
echo ' |
|
235
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />'; |
|
236
|
|
|
|
|
237
|
|
|
if (!empty($context['token_check'])) |
|
238
|
|
|
echo ' |
|
239
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />'; |
|
240
|
|
|
|
|
241
|
|
|
// If this category is empty we don't bother with the next confirmation screen. |
|
242
|
|
|
if ($context['category']['is_empty']) |
|
243
|
|
|
echo ' |
|
244
|
|
|
<input type="hidden" name="empty" value="1" />'; |
|
245
|
|
|
|
|
246
|
|
|
echo ' |
|
247
|
|
|
</div> |
|
248
|
|
|
</div> |
|
249
|
|
|
</form> |
|
250
|
|
|
</div>'; |
|
251
|
|
|
} |
|
252
|
|
|
|
|
253
|
|
|
/** |
|
254
|
|
|
* A template to confirm if a user wishes to delete a category - and whether they want to save the boards. |
|
255
|
|
|
*/ |
|
256
|
|
|
function template_confirm_category_delete() |
|
257
|
|
|
{ |
|
258
|
|
|
global $context, $scripturl, $txt; |
|
259
|
|
|
|
|
260
|
|
|
// Print table header. |
|
261
|
|
|
echo ' |
|
262
|
|
|
<div id="manage_boards"> |
|
263
|
|
|
<form action="', $scripturl, '?action=admin;area=manageboards;sa=cat2" method="post" accept-charset="UTF-8"> |
|
264
|
|
|
<input type="hidden" name="cat" value="', $context['category']['id'], '" /> |
|
265
|
|
|
<h2 class="category_header">', $txt['mboards_delete_cat'], '</h2> |
|
266
|
|
|
<div class="content"> |
|
267
|
|
|
<p>', $txt['mboards_delete_cat_contains'], ':</p> |
|
268
|
|
|
<ul>'; |
|
269
|
|
|
|
|
270
|
|
|
foreach ($context['category']['children'] as $child) |
|
271
|
|
|
echo ' |
|
272
|
|
|
<li>', $child, '</li>'; |
|
273
|
|
|
|
|
274
|
|
|
echo ' |
|
275
|
|
|
</ul> |
|
276
|
|
|
</div> |
|
277
|
|
|
<h2 class="category_header">', $txt['mboards_delete_what_do'], '</h2> |
|
278
|
|
|
<div class="content"> |
|
279
|
|
|
<p> |
|
280
|
|
|
<label for="delete_action0"><input type="radio" id="delete_action0" name="delete_action" value="0" checked="checked" />', $txt['mboards_delete_option1'], '</label><br /> |
|
281
|
|
|
<label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1" class="input_radio"', count($context['category_order']) == 1 ? ' disabled="disabled"' : '', ' />', $txt['mboards_delete_option2'], '</label>: |
|
282
|
|
|
<select name="cat_to" ', count($context['category_order']) == 1 ? 'disabled="disabled"' : '', '>'; |
|
283
|
|
|
|
|
284
|
|
|
foreach ($context['category_order'] as $cat) |
|
285
|
|
|
if ($cat['id'] != 0) |
|
286
|
|
|
echo ' |
|
287
|
|
|
<option value="', $cat['id'], '">', $cat['true_name'], '</option>'; |
|
288
|
|
|
|
|
289
|
|
|
echo ' |
|
290
|
|
|
</select> |
|
291
|
|
|
</p> |
|
292
|
|
|
<div class="submitbutton"> |
|
293
|
|
|
<input type="submit" name="delete" value="', $txt['mboards_delete_confirm'], '" onclick="return confirm(\'', $txt['catConfirm'], '\');" /> |
|
294
|
|
|
<input type="submit" name="cancel" value="', $txt['mboards_delete_cancel'], '" /> |
|
295
|
|
|
<input type="hidden" name="confirmation" value="1" /> |
|
296
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
|
297
|
|
|
</div>'; |
|
298
|
|
|
|
|
299
|
|
|
if (!empty($context['token_check'])) |
|
300
|
|
|
echo ' |
|
301
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />'; |
|
302
|
|
|
|
|
303
|
|
|
echo ' |
|
304
|
|
|
</div> |
|
305
|
|
|
</form> |
|
306
|
|
|
</div>'; |
|
307
|
|
|
} |
|
308
|
|
|
|
|
309
|
|
|
/** |
|
310
|
|
|
* Below is the template for adding/editing an board on the forum. |
|
311
|
|
|
*/ |
|
312
|
|
|
function template_modify_board() |
|
313
|
|
|
{ |
|
314
|
|
|
global $context, $scripturl, $txt, $modSettings; |
|
315
|
|
|
|
|
316
|
|
|
// The main table header. |
|
317
|
|
|
echo ' |
|
318
|
|
|
<div id="manage_boards"> |
|
319
|
|
|
<form action="', $scripturl, '?action=admin;area=manageboards;sa=board2" method="post" accept-charset="UTF-8"> |
|
320
|
|
|
<input type="hidden" name="boardid" value="', $context['board']['id'], '" /> |
|
321
|
|
|
<h2 class="category_header"> |
|
322
|
|
|
', isset($context['board']['is_new']) ? $txt['mboards_new_board_name'] : $txt['boardsEdit'], ' |
|
323
|
|
|
</h2> |
|
324
|
|
|
<div class="content"> |
|
325
|
|
|
<dl class="settings">'; |
|
326
|
|
|
|
|
327
|
|
|
// Option for choosing the category the board lives in. |
|
328
|
|
|
echo ' |
|
329
|
|
|
|
|
330
|
|
|
<dt> |
|
331
|
|
|
<label for="new_cat">', $txt['mboards_category'], ':</label> |
|
332
|
|
|
</dt> |
|
333
|
|
|
<dd> |
|
334
|
|
|
<select id="new_cat" name="new_cat" onchange="if (this.form.order) {this.form.order.disabled = this.options[this.selectedIndex].value != 0; this.form.board_order.disabled = this.options[this.selectedIndex].value != 0 || this.form.order.options[this.form.order.selectedIndex].value == \'\';}">'; |
|
335
|
|
|
|
|
336
|
|
|
foreach ($context['categories'] as $category) |
|
337
|
|
|
echo ' |
|
338
|
|
|
<option', $category['selected'] ? ' selected="selected"' : '', ' value="', $category['id'], '">', $category['name'], '</option>'; |
|
339
|
|
|
|
|
340
|
|
|
echo ' |
|
341
|
|
|
</select> |
|
342
|
|
|
</dd>'; |
|
343
|
|
|
|
|
344
|
|
|
// If this isn't the only board in this category let the user choose where the board is to live. |
|
345
|
|
|
if ((isset($context['board']['is_new']) && count($context['board_order']) > 0) || count($context['board_order']) > 1) |
|
346
|
|
|
{ |
|
347
|
|
|
echo ' |
|
348
|
|
|
<dt> |
|
349
|
|
|
<label for="order">', $txt['order'], ':</label> |
|
350
|
|
|
</dt> |
|
351
|
|
|
<dd>'; |
|
352
|
|
|
|
|
353
|
|
|
// The first select box gives the user the option to position it before, after or as a child of another board. |
|
354
|
|
|
echo ' |
|
355
|
|
|
<select id="order" name="placement" onchange="this.form.board_order.disabled = this.options[this.selectedIndex].value == \'\';"> |
|
356
|
|
|
', !isset($context['board']['is_new']) ? '<option value="">(' . $txt['mboards_unchanged'] . ')</option>' : '', ' |
|
357
|
|
|
<option value="after">' . $txt['mboards_order_after'] . '...</option> |
|
358
|
|
|
<option value="child">' . $txt['mboards_order_child_of'] . '...</option> |
|
359
|
|
|
<option value="before">' . $txt['mboards_order_before'] . '...</option> |
|
360
|
|
|
</select>'; |
|
361
|
|
|
|
|
362
|
|
|
// The second select box lists all the boards in the category. |
|
363
|
|
|
echo ' |
|
364
|
|
|
<select id="board_order" name="board_order" ', isset($context['board']['is_new']) ? '' : 'disabled="disabled"', '> |
|
365
|
|
|
', !isset($context['board']['is_new']) ? '<option value="">(' . $txt['mboards_unchanged'] . ')</option>' : ''; |
|
366
|
|
|
|
|
367
|
|
|
foreach ($context['board_order'] as $order) |
|
368
|
|
|
echo ' |
|
369
|
|
|
<option', $order['selected'] ? ' selected="selected"' : '', ' value="', $order['id'], '">', $order['name'], '</option>'; |
|
370
|
|
|
|
|
371
|
|
|
echo ' |
|
372
|
|
|
</select> |
|
373
|
|
|
</dd>'; |
|
374
|
|
|
} |
|
375
|
|
|
|
|
376
|
|
|
// Options for board name and description. |
|
377
|
|
|
echo ' |
|
378
|
|
|
<dt> |
|
379
|
|
|
<label for="board_name">', $txt['full_name'], ':</label><br /> |
|
380
|
|
|
<span class="smalltext">', $txt['name_on_display'], '</span> |
|
381
|
|
|
</dt> |
|
382
|
|
|
<dd> |
|
383
|
|
|
<input type="text" id="board_name" name="board_name" value="', $context['board']['name'], '" size="30" class="input_text" /> |
|
384
|
|
|
</dd> |
|
385
|
|
|
<dt> |
|
386
|
|
|
<label for="desc">', $txt['mboards_description'], ':</label><br /> |
|
387
|
|
|
<span class="smalltext">', $txt['mboards_description_desc'], '</span> |
|
388
|
|
|
</dt> |
|
389
|
|
|
<dd> |
|
390
|
|
|
<textarea id="desc" name="desc" rows="3" cols="35">', $context['board']['description'], '</textarea> |
|
391
|
|
|
</dd> |
|
392
|
|
|
<dt> |
|
393
|
|
|
<label for="profile">', $txt['permission_profile'], ':</label><br /> |
|
394
|
|
|
<span class="smalltext">', $context['can_manage_permissions'] ? sprintf($txt['permission_profile_desc'], $scripturl . '?action=admin;area=permissions;sa=profiles;' . $context['session_var'] . '=' . $context['session_id']) : strip_tags($txt['permission_profile_desc']), '</span> |
|
395
|
|
|
</dt> |
|
396
|
|
|
<dd> |
|
397
|
|
|
<select id="profile" name="profile">'; |
|
398
|
|
|
|
|
399
|
|
|
if (isset($context['board']['is_new'])) |
|
400
|
|
|
echo ' |
|
401
|
|
|
<option value="-1">[', $txt['permission_profile_inherit'], ']</option>'; |
|
402
|
|
|
|
|
403
|
|
|
foreach ($context['profiles'] as $id => $profile) |
|
404
|
|
|
echo ' |
|
405
|
|
|
<option value="', $id, '" ', $id == $context['board']['profile'] ? 'selected="selected"' : '', '>', $profile['name'], '</option>'; |
|
406
|
|
|
|
|
407
|
|
|
echo ' |
|
408
|
|
|
</select> |
|
409
|
|
|
</dd> |
|
410
|
|
|
<dt> |
|
411
|
|
|
<label>', $txt['mboards_groups'], ':</label><br /> |
|
412
|
|
|
<span class="smalltext">', empty($modSettings['deny_boards_access']) ? $txt['mboards_groups_desc'] : $txt['boardsaccess_option_desc'], '</span>'; |
|
413
|
|
|
|
|
414
|
|
|
echo ' |
|
415
|
|
|
</dt> |
|
416
|
|
|
<dd>'; |
|
417
|
|
|
|
|
418
|
|
|
if (!empty($modSettings['deny_boards_access'])) |
|
419
|
|
|
{ |
|
420
|
|
|
echo ' |
|
421
|
|
|
<table> |
|
422
|
|
|
<tr> |
|
423
|
|
|
<td></td> |
|
424
|
|
|
<th>', $txt['permissions_option_on'], '</th> |
|
425
|
|
|
<th>', $txt['permissions_option_off'], '</th> |
|
426
|
|
|
<th>', $txt['permissions_option_deny'], '</th> |
|
427
|
|
|
<th></th> |
|
428
|
|
|
</tr>'; |
|
429
|
|
|
} |
|
430
|
|
|
|
|
431
|
|
|
// List all the membergroups so the user can choose who may access this board. |
|
432
|
|
|
foreach ($context['groups'] as $group) |
|
433
|
|
|
{ |
|
434
|
|
|
if (empty($modSettings['deny_boards_access'])) |
|
435
|
|
|
{ |
|
436
|
|
|
echo ' |
|
437
|
|
|
<label for="groups_', $group['id'], '"> |
|
438
|
|
|
<input type="checkbox" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '"', $group['allow'] ? ' checked="checked"' : '', ' /> |
|
439
|
|
|
<span', $group['is_post_group'] ? ' class="post_group" title="' . $txt['mboards_groups_post_group'] . '"' : '', $group['id'] == 0 ? ' class="regular_members" title="' . $txt['mboards_groups_regular_members'] . '"' : '', '> |
|
440
|
|
|
', $group['name'], ' |
|
441
|
|
|
</span> |
|
442
|
|
|
</label> |
|
443
|
|
|
<br />'; |
|
444
|
|
|
} |
|
445
|
|
|
else |
|
446
|
|
|
{ |
|
447
|
|
|
echo ' |
|
448
|
|
|
<tr> |
|
449
|
|
|
<td> |
|
450
|
|
|
<span', $group['is_post_group'] ? ' class="post_group" title="' . $txt['mboards_groups_post_group'] . '"' : '', $group['id'] == 0 ? ' class="regular_members" title="' . $txt['mboards_groups_regular_members'] . '"' : '', '> |
|
451
|
|
|
', $group['name'], ' |
|
452
|
|
|
</span> |
|
453
|
|
|
</td> |
|
454
|
|
|
<td> |
|
455
|
|
|
<input type="radio" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '_a"', $group['allow'] ? ' checked="checked"' : '', ' /> |
|
456
|
|
|
</td> |
|
457
|
|
|
<td> |
|
458
|
|
|
<input type="radio" name="groups[', $group['id'], ']" value="ignore" id="groups_', $group['id'], '_x"', !$group['allow'] && !$group['deny'] ? ' checked="checked"' : '', ' /> |
|
459
|
|
|
</td> |
|
460
|
|
|
<td> |
|
461
|
|
|
<input type="radio" name="groups[', $group['id'], ']" value="deny" id="groups_', $group['id'], '_d"', $group['deny'] ? ' checked="checked"' : '', ' /> |
|
462
|
|
|
</td> |
|
463
|
|
|
<td></td> |
|
464
|
|
|
</tr>'; |
|
465
|
|
|
} |
|
466
|
|
|
} |
|
467
|
|
|
|
|
468
|
|
|
if (empty($modSettings['deny_boards_access'])) |
|
469
|
|
|
{ |
|
470
|
|
|
echo ' |
|
471
|
|
|
<span class="select_all_box"> |
|
472
|
|
|
<em><label for="check_all">', $txt['check_all'], '</label></em> <input type="checkbox" id="check_all" onclick="invertAll(this, this.form, \'groups[\');" /> |
|
473
|
|
|
</span> |
|
474
|
|
|
<br /> |
|
475
|
|
|
<br /> |
|
476
|
|
|
</dd>'; |
|
477
|
|
|
} |
|
478
|
|
|
else |
|
479
|
|
|
{ |
|
480
|
|
|
echo ' |
|
481
|
|
|
<tr class="select_all_box"> |
|
482
|
|
|
<td> |
|
483
|
|
|
</td> |
|
484
|
|
|
<td> |
|
485
|
|
|
<input type="radio" name="select_all" onclick="selectAllRadio(this, this.form, \'groups\', \'allow\');" /> |
|
486
|
|
|
</td> |
|
487
|
|
|
<td> |
|
488
|
|
|
<input type="radio" name="select_all" onclick="selectAllRadio(this, this.form, \'groups\', \'ignore\');" /> |
|
489
|
|
|
</td> |
|
490
|
|
|
<td> |
|
491
|
|
|
<input type="radio" name="select_all" onclick="selectAllRadio(this, this.form, \'groups\', \'deny\');" /> |
|
492
|
|
|
</td> |
|
493
|
|
|
<td> |
|
494
|
|
|
<em>', $txt['check_all'], '</em> |
|
495
|
|
|
</td> |
|
496
|
|
|
</tr> |
|
497
|
|
|
</table> |
|
498
|
|
|
</dd>'; |
|
499
|
|
|
} |
|
500
|
|
|
|
|
501
|
|
|
// Options to choose moderators, specify as announcement board and choose whether to count posts here. |
|
502
|
|
|
echo ' |
|
503
|
|
|
<dt> |
|
504
|
|
|
<label for="moderators">', $txt['mboards_moderators'], ':</label><br /> |
|
505
|
|
|
<span class="smalltext">', $txt['mboards_moderators_desc'], '</span><br /> |
|
506
|
|
|
</dt> |
|
507
|
|
|
<dd> |
|
508
|
|
|
<input type="text" name="moderators" id="moderators" value="', $context['board']['moderator_list'], '" size="30" class="input_text" /> |
|
509
|
|
|
<div id="moderator_container"></div> |
|
510
|
|
|
</dd> |
|
511
|
|
|
</dl> |
|
512
|
|
|
<hr />'; |
|
513
|
|
|
|
|
514
|
|
|
// Add a select all box for the allowed groups section |
|
515
|
|
|
theme()->addInlineJavascript(' |
|
516
|
|
|
$(function() { |
|
517
|
|
|
$(".select_all_box").each(function () { |
|
518
|
|
|
$(this).removeClass(\'select_all_box\'); |
|
519
|
|
|
}); |
|
520
|
|
|
});', true); |
|
521
|
|
|
|
|
522
|
|
|
if (empty($context['board']['is_recycle']) && empty($context['board']['topics'])) |
|
523
|
|
|
echo ' |
|
524
|
|
|
<dl class="settings"> |
|
525
|
|
|
<dt> |
|
526
|
|
|
<label for="redirect_enable">', $txt['mboards_redirect'], ':</label><br /> |
|
527
|
|
|
<span class="smalltext">', $txt['mboards_redirect_desc'], '</span><br /> |
|
528
|
|
|
</dt> |
|
529
|
|
|
<dd> |
|
530
|
|
|
<input type="checkbox" id="redirect_enable" name="redirect_enable"', $context['board']['redirect'] != '' ? ' checked="checked"' : '', ' onclick="refreshOptions();" /> |
|
531
|
|
|
</dd> |
|
532
|
|
|
</dl>'; |
|
533
|
|
|
|
|
534
|
|
|
if (!empty($context['board']['is_recycle'])) |
|
535
|
|
|
echo ' |
|
536
|
|
|
<div class="infobox">', $txt['mboards_redirect_disabled_recycle'], '<br />', $txt['mboards_recycle_disabled_delete'], '</div>'; |
|
537
|
|
|
|
|
538
|
|
|
if (empty($context['board']['is_recycle']) && !empty($context['board']['topics'])) |
|
539
|
|
|
echo ' |
|
540
|
|
|
<div class="infobox"> |
|
541
|
|
|
<strong>', $txt['mboards_redirect'], '</strong><br /> |
|
542
|
|
|
', $txt['mboards_redirect_disabled'], ' |
|
543
|
|
|
</div>'; |
|
544
|
|
|
|
|
545
|
|
|
if (!$context['board']['topics'] && empty($context['board']['is_recycle'])) |
|
546
|
|
|
{ |
|
547
|
|
|
echo ' |
|
548
|
|
|
<div id="redirect_address_div"> |
|
549
|
|
|
<dl class="settings"> |
|
550
|
|
|
<dt> |
|
551
|
|
|
<label for="redirect_address">', $txt['mboards_redirect_url'], ':</label><br /> |
|
552
|
|
|
<span class="smalltext">', $txt['mboards_redirect_url_desc'], '</span><br /> |
|
553
|
|
|
</dt> |
|
554
|
|
|
<dd> |
|
555
|
|
|
<input type="text" id="redirect_address" name="redirect_address" value="', $context['board']['redirect'], '" size="40" class="input_text" /> |
|
556
|
|
|
</dd> |
|
557
|
|
|
</dl> |
|
558
|
|
|
</div>'; |
|
559
|
|
|
|
|
560
|
|
|
if ($context['board']['redirect']) |
|
561
|
|
|
echo ' |
|
562
|
|
|
<div id="reset_redirect_div"> |
|
563
|
|
|
<dl class="settings"> |
|
564
|
|
|
<dt> |
|
565
|
|
|
<label for="reset_redirect">', $txt['mboards_redirect_reset'], ':</label><br /> |
|
566
|
|
|
<span class="smalltext">', $txt['mboards_redirect_reset_desc'], '</span><br /> |
|
567
|
|
|
</dt> |
|
568
|
|
|
<dd> |
|
569
|
|
|
<input type="checkbox" id="reset_redirect" name="reset_redirect" /> |
|
570
|
|
|
<em>(', sprintf($txt['mboards_current_redirects'], $context['board']['posts']), ')</em> |
|
571
|
|
|
</dd> |
|
572
|
|
|
</dl> |
|
573
|
|
|
</div>'; |
|
574
|
|
|
} |
|
575
|
|
|
|
|
576
|
|
|
echo ' |
|
577
|
|
|
<div id="count_posts_div"> |
|
578
|
|
|
<dl class="settings"> |
|
579
|
|
|
<dt> |
|
580
|
|
|
<label for="count">', $txt['mboards_count_posts'], ':</label><br /> |
|
581
|
|
|
<span class="smalltext">', $txt['mboards_count_posts_desc'], '</span><br /> |
|
582
|
|
|
</dt> |
|
583
|
|
|
<dd> |
|
584
|
|
|
<input type="checkbox" id="count" name="count" ', $context['board']['count_posts'] ? ' checked="checked"' : '', ' /> |
|
585
|
|
|
</dd> |
|
586
|
|
|
</dl> |
|
587
|
|
|
</div>'; |
|
588
|
|
|
|
|
589
|
|
|
// Here the user can choose to force this board to use a theme other than the default theme for the forum. |
|
590
|
|
|
echo ' |
|
591
|
|
|
<div id="board_theme_div"> |
|
592
|
|
|
<dl class="settings"> |
|
593
|
|
|
<dt> |
|
594
|
|
|
<label for="boardtheme">', $txt['mboards_theme'], ':</label><br /> |
|
595
|
|
|
<span class="smalltext">', $txt['mboards_theme_desc'], '</span><br /> |
|
596
|
|
|
</dt> |
|
597
|
|
|
<dd> |
|
598
|
|
|
<select name="boardtheme" id="boardtheme" onchange="refreshOptions();"> |
|
599
|
|
|
<option value="0"', $context['board']['theme'] == 0 ? ' selected="selected"' : '', '>', $txt['mboards_theme_default'], '</option>'; |
|
600
|
|
|
|
|
601
|
|
|
foreach ($context['themes'] as $theme) |
|
602
|
|
|
echo ' |
|
603
|
|
|
<option value="', $theme['id'], '"', $context['board']['theme'] == $theme['id'] ? ' selected="selected"' : '', '>', $theme['name'], '</option>'; |
|
604
|
|
|
|
|
605
|
|
|
echo ' |
|
606
|
|
|
</select> |
|
607
|
|
|
</dd> |
|
608
|
|
|
</dl> |
|
609
|
|
|
</div> |
|
610
|
|
|
<div id="override_theme_div"> |
|
611
|
|
|
<dl class="settings"> |
|
612
|
|
|
<dt> |
|
613
|
|
|
<label for="override_theme">', $txt['mboards_override_theme'], ':</label><br /> |
|
614
|
|
|
<span class="smalltext">', $txt['mboards_override_theme_desc'], '</span><br /> |
|
615
|
|
|
</dt> |
|
616
|
|
|
<dd> |
|
617
|
|
|
<input type="checkbox" id="override_theme" name="override_theme"', $context['board']['override_theme'] ? ' checked="checked"' : '', ' /> |
|
618
|
|
|
</dd> |
|
619
|
|
|
</dl> |
|
620
|
|
|
</div>'; |
|
621
|
|
|
|
|
622
|
|
|
echo ' |
|
623
|
|
|
<div class="submitbutton"> |
|
624
|
|
|
<input type="hidden" name="rid" value="', $context['redirect_location'], '" /> |
|
625
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
|
626
|
|
|
<input type="hidden" name="', $context['admin-be-' . $context['board']['id'] . '_token_var'], '" value="', $context['admin-be-' . $context['board']['id'] . '_token'], '" />'; |
|
627
|
|
|
|
|
628
|
|
|
// If this board has no children don't bother with the next confirmation screen. |
|
629
|
|
|
if ($context['board']['no_children']) |
|
630
|
|
|
echo ' |
|
631
|
|
|
<input type="hidden" name="no_children" value="1" />'; |
|
632
|
|
|
|
|
633
|
|
|
if (isset($context['board']['is_new'])) |
|
634
|
|
|
echo ' |
|
635
|
|
|
<input type="hidden" name="cur_cat" value="', $context['board']['category'], '" /> |
|
636
|
|
|
<input type="submit" name="add" value="', $txt['mboards_new_board'], '" onclick="return !isEmptyText(this.form.board_name);" />'; |
|
637
|
|
|
else |
|
638
|
|
|
echo ' |
|
639
|
|
|
<input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.board_name);" />'; |
|
640
|
|
|
|
|
641
|
|
|
if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle'])) |
|
642
|
|
|
echo ' |
|
643
|
|
|
<input type="submit" name="delete" value="', $txt['mboards_delete_board'], '" onclick="return confirm(\'', $txt['boardConfirm'], '\');" />'; |
|
644
|
|
|
|
|
645
|
|
|
echo ' |
|
646
|
|
|
</div> |
|
647
|
|
|
</div> |
|
648
|
|
|
</form> |
|
649
|
|
|
</div>'; |
|
650
|
|
|
|
|
651
|
|
|
$js = ' |
|
652
|
|
|
new smc_AutoSuggest({ |
|
653
|
|
|
sSessionId: elk_session_id, |
|
654
|
|
|
sSessionVar: elk_session_var, |
|
655
|
|
|
sSuggestId: \'moderators\', |
|
656
|
|
|
sControlId: \'moderators\', |
|
657
|
|
|
sSearchType: \'member\', |
|
658
|
|
|
bItemList: true, |
|
659
|
|
|
sPostName: \'moderator_list\', |
|
660
|
|
|
sURLMask: \'action=profile;u=%item_id%\', |
|
661
|
|
|
sTextDeleteItem: ' . JavaScriptEscape($txt['autosuggest_delete_item']) . ', |
|
662
|
|
|
sItemListContainerId: \'moderator_container\', |
|
663
|
|
|
aListItems: ['; |
|
664
|
|
|
|
|
665
|
|
|
foreach ($context['board']['moderators'] as $id_member => $member_name) |
|
666
|
|
|
$js .= ' |
|
667
|
|
|
{ |
|
668
|
|
|
sItemId: ' . JavaScriptEscape($id_member) . ', |
|
669
|
|
|
sItemName: ' . JavaScriptEscape($member_name) . ' |
|
670
|
|
|
}' . ($id_member == $context['board']['last_moderator_id'] ? '' : ','); |
|
671
|
|
|
|
|
672
|
|
|
$js .= ' |
|
673
|
|
|
] |
|
674
|
|
|
});'; |
|
675
|
|
|
|
|
676
|
|
|
theme()->addInlineJavascript($js, true); |
|
677
|
|
|
|
|
678
|
|
|
// Javascript for deciding what to show. |
|
679
|
|
|
echo ' |
|
680
|
|
|
<script> |
|
681
|
|
|
function refreshOptions() |
|
682
|
|
|
{ |
|
683
|
|
|
var redirect = document.getElementById("redirect_enable"), |
|
684
|
|
|
redirectEnabled = redirect ? redirect.checked : false, |
|
685
|
|
|
nonDefaultTheme = document.getElementById("boardtheme").value!=0; |
|
686
|
|
|
|
|
687
|
|
|
// What to show? |
|
688
|
|
|
document.getElementById("override_theme_div").style.display = redirectEnabled || !nonDefaultTheme ? "none" : ""; |
|
689
|
|
|
document.getElementById("board_theme_div").style.display = redirectEnabled ? "none" : ""; |
|
690
|
|
|
document.getElementById("count_posts_div").style.display = redirectEnabled ? "none" : "";'; |
|
691
|
|
|
|
|
692
|
|
|
if (!$context['board']['topics'] && empty($context['board']['is_recycle'])) |
|
693
|
|
|
{ |
|
694
|
|
|
echo ' |
|
695
|
|
|
document.getElementById("redirect_address_div").style.display = redirectEnabled ? "" : "none";'; |
|
696
|
|
|
|
|
697
|
|
|
if ($context['board']['redirect']) |
|
698
|
|
|
echo ' |
|
699
|
|
|
document.getElementById("reset_redirect_div").style.display = redirectEnabled ? "" : "none";'; |
|
700
|
|
|
} |
|
701
|
|
|
|
|
702
|
|
|
echo ' |
|
703
|
|
|
} |
|
704
|
|
|
|
|
705
|
|
|
refreshOptions(); |
|
706
|
|
|
</script>'; |
|
707
|
|
|
} |
|
708
|
|
|
|
|
709
|
|
|
/** |
|
710
|
|
|
* A template used when a user is deleting a board with sub-boards in it - to see what they want to do with them. |
|
711
|
|
|
*/ |
|
712
|
|
|
function template_confirm_board_delete() |
|
713
|
|
|
{ |
|
714
|
|
|
global $context, $scripturl, $txt; |
|
715
|
|
|
|
|
716
|
|
|
// Print table header. |
|
717
|
|
|
echo ' |
|
718
|
|
|
<div id="manage_boards"> |
|
719
|
|
|
<form action="', $scripturl, '?action=admin;area=manageboards;sa=board2" method="post" accept-charset="UTF-8"> |
|
720
|
|
|
<input type="hidden" name="boardid" value="', $context['board']['id'], '" /> |
|
721
|
|
|
<h2 class="category_header">', $txt['mboards_delete_board'], '</h2> |
|
722
|
|
|
<div class="content"> |
|
723
|
|
|
<p>', $txt['mboards_delete_board_contains'], '</p> |
|
724
|
|
|
<ul>'; |
|
725
|
|
|
|
|
726
|
|
|
foreach ($context['children'] as $child) |
|
727
|
|
|
echo ' |
|
728
|
|
|
<li>', $child['node']['name'], '</li>'; |
|
729
|
|
|
|
|
730
|
|
|
echo ' |
|
731
|
|
|
</ul> |
|
732
|
|
|
</div> |
|
733
|
|
|
<h2 class="category_header">', $txt['mboards_delete_what_do'], '</h2> |
|
734
|
|
|
<div class="content"> |
|
735
|
|
|
<p> |
|
736
|
|
|
<label for="delete_action0"><input type="radio" id="delete_action0" name="delete_action" value="0" checked="checked" />', $txt['mboards_delete_board_option1'], '</label><br /> |
|
737
|
|
|
<label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1" class="input_radio"', empty($context['can_move_children']) ? ' disabled="disabled"' : '', ' />', $txt['mboards_delete_board_option2'], '</label>: |
|
738
|
|
|
<select name="board_to" ', empty($context['can_move_children']) ? 'disabled="disabled"' : '', '>'; |
|
739
|
|
|
|
|
740
|
|
|
foreach ($context['board_order'] as $board) |
|
741
|
|
|
if ($board['id'] != $context['board']['id'] && empty($board['is_child'])) |
|
742
|
|
|
echo ' |
|
743
|
|
|
<option value="', $board['id'], '">', $board['name'], '</option>'; |
|
744
|
|
|
|
|
745
|
|
|
echo ' |
|
746
|
|
|
</select> |
|
747
|
|
|
</p> |
|
748
|
|
|
<div class="submitbutton"> |
|
749
|
|
|
<input type="submit" name="delete" value="', $txt['mboards_delete_confirm'], '" /> |
|
750
|
|
|
<input type="submit" name="cancel" value="', $txt['mboards_delete_cancel'], '" /> |
|
751
|
|
|
<input type="hidden" name="confirmation" value="1" /> |
|
752
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
|
753
|
|
|
<input type="hidden" name="', $context['admin-be-' . $context['board']['id'] . '_token_var'], '" value="', $context['admin-be-' . $context['board']['id'] . '_token'], '" /> |
|
754
|
|
|
</div> |
|
755
|
|
|
</div> |
|
756
|
|
|
</form> |
|
757
|
|
|
</div>'; |
|
758
|
|
|
} |
|
759
|
|
|
|