-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPortalAdminPages.template.php
191 lines (167 loc) · 6.11 KB
/
PortalAdminPages.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
<?php
/**
* @package SimplePortal
*
* @author SimplePortal Team
* @copyright 2014 SimplePortal Team
* @license BSD 3-clause
*
* @version 2.4.2
*/
function template_pages_edit()
{
global $context, $scripturl, $txt;
// Previewing the page before submitting?
echo '
<div id="preview_section" class="forumposts"', !empty($context['SPortal']['preview']) ? '' : ' style="display: none;"', '>',
!empty($context['SPortal']['preview']) ? template_view_page() : '', '
</div>';
// If there were errors creating the page, show them.
template_show_error('pages_errors');
// Adding or editing a page
echo '
<div id="sp_edit_page">
<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=portalpages;sa=edit" method="post" accept-charset="UTF-8" onsubmit="submitonce(this);">
<h3 class="category_header">
', $context['SPortal']['is_new'] ? $txt['sp_admin_pages_add'] : $txt['sp_admin_pages_edit'], '
</h3>
<div class="windowbg">
<div class="editor_wrapper">
<dl class="sp_form">
<dt>
<label for="page_title">', $txt['sp_admin_pages_col_title'], ':</label>
</dt>
<dd>
<input type="text" name="title" id="page_title" value="', $context['SPortal']['page']['title'], '" class="input_text" />
</dd>
<dt>
<label for="page_namespace">', $txt['sp_admin_pages_col_namespace'], ':</label>
</dt>
<dd>
<input type="text" name="namespace" id="page_namespace" value="', $context['SPortal']['page']['page_id'], '" class="input_text" />
</dd>
<dt>
<label for="page_type">', $txt['sp_admin_pages_col_type'], ':</label>
</dt>
<dd>
<select name="type" id="page_type">';
$content_types = array('bbc', 'html', 'php');
foreach ($content_types as $type)
echo '
<option value="', $type, '"', $context['SPortal']['page']['type'] == $type ? ' selected="selected"' : '', '>', $txt['sp_pages_type_' . $type], '</option>';
echo '
</select>
</dd>
<dt>
<label for="page_permissions">', $txt['sp_admin_pages_col_permissions'], ':</label>
</dt>
<dd>
<select name="permissions" id="page_permissions">';
foreach ($context['SPortal']['page']['permission_profiles'] as $profile)
echo '
<option value="', $profile['id'], '"', $profile['id'] == $context['SPortal']['page']['permissions'] ? ' selected="selected"' : '', '>', $profile['label'], '</option>';
echo '
</select>
</dd>
<dt>
<label for="page_blocks">', $txt['sp_admin_pages_col_blocks'], ':</label>
</dt>
<dd>
<select name="blocks[]" id="page_blocks" size="7" multiple="multiple">';
foreach ($context['sides'] as $side => $label)
{
if (empty($context['page_blocks'][$side]))
continue;
echo '
<optgroup label="', $label, '">';
foreach ($context['page_blocks'][$side] as $block)
{
echo '
<option value="', $block['id'], '"', $block['shown'] ? ' selected="selected"' : '', '>', $block['label'], '</option>';
}
echo '
</optgroup>';
}
echo '
</select>
</dd>
<dt>
<label for="page_status">', $txt['sp_admin_pages_col_status'], ':</label>
</dt>
<dd>
<input type="checkbox" name="status" id="page_status" value="1"', $context['SPortal']['page']['status'] ? ' checked="checked"' : '', ' class="input_check" />
</dd>
<dt>
', $txt['sp_admin_pages_col_body'], ':
</dt>
<dd>
</dd>
</dl>
<div>', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '</div>
<input type="submit" name="submit" value="', $context['page_title'], '" class="right_submit" />
<input type="submit" name="preview" value="', $txt['sp_admin_pages_preview'], '" class="right_submit" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</div>
</div>';
$style_sections = array('title' => 'left', 'body' => 'right');
$style_types = array('default' => 'DefaultClass', 'class' => 'CustomClass', 'style' => 'CustomStyle');
$style_parameters = array(
'title' => array('category_header', 'secondary_header'),
'body' => array('windowbg', 'windowbg2', 'information', 'roundframe'),
);
echo '
<br />
<h3 class="category_header">
', $txt['sp_admin_pages_style'], '
</h3>
<div class="windowbg2">
<div class="sp_content_padding">';
foreach ($style_sections as $section => $float)
{
echo '
<dl id="sp_edit_style_', $section, '" class="sp_form sp_float_', $float, '">';
foreach ($style_types as $type => $label)
{
echo '
<dt>
', $txt['sp-blocks' . ucfirst($section) . $label], ':
</dt>
<dd>';
if ($type == 'default')
{
echo '
<select name="', $section, '_default_class" id="', $section, '_default_class">';
foreach ($style_parameters[$section] as $class)
echo '
<option value="', $class, '"', $context['SPortal']['page']['style'][$section . '_default_class'] == $class ? ' selected="selected"' : '', '>', $class, '</option>';
echo '
</select>';
}
else
echo '
<input type="text" name="', $section, '_custom_', $type, '" id="', $section, '_custom_', $type, '" value="', $context['SPortal']['page']['style'][$section . '_custom_' . $type], '" class="input_text" />';
echo '
</dd>';
}
echo '
<dt>
', $txt['sp-blocksNo' . ucfirst($section)], ':
</dt>
<dd>
<input type="checkbox" name="no_', $section, '" id="no_', $section, '" value="1"', !empty($context['SPortal']['page']['style']['no_' . $section]) ? ' checked="checked"' : '', ' onclick="check_style_options();" class="input_check" />
</dd>
</dl>';
}
echo '
<input type="submit" name="submit" value="', $context['page_title'], '" class="right_submit" />
<input type="submit" name="preview" value="', $txt['sp_admin_pages_preview'], '" class="right_submit" />
</div>
</div>
<input type="hidden" name="page_id" value="', $context['SPortal']['page']['id'], '" />
</form>
</div>
<script><!-- // --><![CDATA[
check_style_options();
sp_editor_change_type("page_type");
// ]]></script>';
}