Chris@76
|
1 <?php
|
Chris@76
|
2 /**
|
Chris@76
|
3 * Simple Machines Forum (SMF)
|
Chris@76
|
4 *
|
Chris@76
|
5 * @package SMF
|
Chris@76
|
6 * @author Simple Machines
|
Chris@76
|
7 * @copyright 2011 Simple Machines
|
Chris@76
|
8 * @license http://www.simplemachines.org/about/smf/license.php BSD
|
Chris@76
|
9 *
|
Chris@76
|
10 * @version 2.0
|
Chris@76
|
11 */
|
Chris@76
|
12
|
Chris@76
|
13 // This is the main sidebar for the personal messages section.
|
Chris@76
|
14 function template_pm_above()
|
Chris@76
|
15 {
|
Chris@76
|
16 global $context, $settings, $options, $txt;
|
Chris@76
|
17
|
Chris@76
|
18 echo '
|
Chris@76
|
19 <div id="personal_messages">';
|
Chris@76
|
20
|
Chris@76
|
21 // Show the capacity bar, if available.
|
Chris@76
|
22 if (!empty($context['limit_bar']))
|
Chris@76
|
23 echo '
|
Chris@76
|
24 <div class="title_bar">
|
Chris@76
|
25 <h3 class="titlebg">
|
Chris@76
|
26 <span class="floatleft">', $txt['pm_capacity'], ':</span>
|
Chris@76
|
27 <span class="floatleft capacity_bar">
|
Chris@76
|
28 <span class="', $context['limit_bar']['percent'] > 85 ? 'full' : ($context['limit_bar']['percent'] > 40 ? 'filled' : 'empty'), '" style="width: ', $context['limit_bar']['percent'] / 10, 'em;"></span>
|
Chris@76
|
29 </span>
|
Chris@76
|
30 <span class="floatright', $context['limit_bar']['percent'] > 90 ? ' alert' : '', '">', $context['limit_bar']['text'], '</span>
|
Chris@76
|
31 </h3>
|
Chris@76
|
32 </div>';
|
Chris@76
|
33
|
Chris@76
|
34 // Message sent? Show a small indication.
|
Chris@76
|
35 if (isset($context['pm_sent']))
|
Chris@76
|
36 echo '
|
Chris@76
|
37 <div class="windowbg" id="profile_success">
|
Chris@76
|
38 ', $txt['pm_sent'], '
|
Chris@76
|
39 </div>';
|
Chris@76
|
40 }
|
Chris@76
|
41
|
Chris@76
|
42 // Just the end of the index bar, nothing special.
|
Chris@76
|
43 function template_pm_below()
|
Chris@76
|
44 {
|
Chris@76
|
45 global $context, $settings, $options;
|
Chris@76
|
46
|
Chris@76
|
47 echo '
|
Chris@76
|
48 </div>';
|
Chris@76
|
49 }
|
Chris@76
|
50
|
Chris@76
|
51 function template_folder()
|
Chris@76
|
52 {
|
Chris@76
|
53 global $context, $settings, $options, $scripturl, $modSettings, $txt;
|
Chris@76
|
54
|
Chris@76
|
55 // The every helpful javascript!
|
Chris@76
|
56 echo '
|
Chris@76
|
57 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
58 var allLabels = {};
|
Chris@76
|
59 var currentLabels = {};
|
Chris@76
|
60 function loadLabelChoices()
|
Chris@76
|
61 {
|
Chris@76
|
62 var listing = document.forms.pmFolder.elements;
|
Chris@76
|
63 var theSelect = document.forms.pmFolder.pm_action;
|
Chris@76
|
64 var add, remove, toAdd = {length: 0}, toRemove = {length: 0};
|
Chris@76
|
65
|
Chris@76
|
66 if (theSelect.childNodes.length == 0)
|
Chris@76
|
67 return;';
|
Chris@76
|
68
|
Chris@76
|
69 // This is done this way for internationalization reasons.
|
Chris@76
|
70 echo '
|
Chris@76
|
71 if (!(\'-1\' in allLabels))
|
Chris@76
|
72 {
|
Chris@76
|
73 for (var o = 0; o < theSelect.options.length; o++)
|
Chris@76
|
74 if (theSelect.options[o].value.substr(0, 4) == "rem_")
|
Chris@76
|
75 allLabels[theSelect.options[o].value.substr(4)] = theSelect.options[o].text;
|
Chris@76
|
76 }
|
Chris@76
|
77
|
Chris@76
|
78 for (var i = 0; i < listing.length; i++)
|
Chris@76
|
79 {
|
Chris@76
|
80 if (listing[i].name != "pms[]" || !listing[i].checked)
|
Chris@76
|
81 continue;
|
Chris@76
|
82
|
Chris@76
|
83 var alreadyThere = [], x;
|
Chris@76
|
84 for (x in currentLabels[listing[i].value])
|
Chris@76
|
85 {
|
Chris@76
|
86 if (!(x in toRemove))
|
Chris@76
|
87 {
|
Chris@76
|
88 toRemove[x] = allLabels[x];
|
Chris@76
|
89 toRemove.length++;
|
Chris@76
|
90 }
|
Chris@76
|
91 alreadyThere[x] = allLabels[x];
|
Chris@76
|
92 }
|
Chris@76
|
93
|
Chris@76
|
94 for (x in allLabels)
|
Chris@76
|
95 {
|
Chris@76
|
96 if (!(x in alreadyThere))
|
Chris@76
|
97 {
|
Chris@76
|
98 toAdd[x] = allLabels[x];
|
Chris@76
|
99 toAdd.length++;
|
Chris@76
|
100 }
|
Chris@76
|
101 }
|
Chris@76
|
102 }
|
Chris@76
|
103
|
Chris@76
|
104 while (theSelect.options.length > 2)
|
Chris@76
|
105 theSelect.options[2] = null;
|
Chris@76
|
106
|
Chris@76
|
107 if (toAdd.length != 0)
|
Chris@76
|
108 {
|
Chris@76
|
109 theSelect.options[theSelect.options.length] = new Option("', $txt['pm_msg_label_apply'], '", "");
|
Chris@76
|
110 setInnerHTML(theSelect.options[theSelect.options.length - 1], "', $txt['pm_msg_label_apply'], '");
|
Chris@76
|
111 theSelect.options[theSelect.options.length - 1].disabled = true;
|
Chris@76
|
112
|
Chris@76
|
113 for (i in toAdd)
|
Chris@76
|
114 {
|
Chris@76
|
115 if (i != "length")
|
Chris@76
|
116 theSelect.options[theSelect.options.length] = new Option(toAdd[i], "add_" + i);
|
Chris@76
|
117 }
|
Chris@76
|
118 }
|
Chris@76
|
119
|
Chris@76
|
120 if (toRemove.length != 0)
|
Chris@76
|
121 {
|
Chris@76
|
122 theSelect.options[theSelect.options.length] = new Option("', $txt['pm_msg_label_remove'], '", "");
|
Chris@76
|
123 setInnerHTML(theSelect.options[theSelect.options.length - 1], "', $txt['pm_msg_label_remove'], '");
|
Chris@76
|
124 theSelect.options[theSelect.options.length - 1].disabled = true;
|
Chris@76
|
125
|
Chris@76
|
126 for (i in toRemove)
|
Chris@76
|
127 {
|
Chris@76
|
128 if (i != "length")
|
Chris@76
|
129 theSelect.options[theSelect.options.length] = new Option(toRemove[i], "rem_" + i);
|
Chris@76
|
130 }
|
Chris@76
|
131 }
|
Chris@76
|
132 }
|
Chris@76
|
133 // ]]></script>';
|
Chris@76
|
134
|
Chris@76
|
135 echo '
|
Chris@76
|
136 <form class="flow_hidden" action="', $scripturl, '?action=pm;sa=pmactions;', $context['display_mode'] == 2 ? 'conversation;' : '', 'f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', '" method="post" accept-charset="', $context['character_set'], '" name="pmFolder">';
|
Chris@76
|
137
|
Chris@76
|
138 // If we are not in single display mode show the subjects on the top!
|
Chris@76
|
139 if ($context['display_mode'] != 1)
|
Chris@76
|
140 {
|
Chris@76
|
141 template_subject_list();
|
Chris@76
|
142 echo '<div class="clear_right"><br /></div>';
|
Chris@76
|
143 }
|
Chris@76
|
144
|
Chris@76
|
145 // Got some messages to display?
|
Chris@76
|
146 if ($context['get_pmessage']('message', true))
|
Chris@76
|
147 {
|
Chris@76
|
148 // Show the helpful titlebar - generally.
|
Chris@76
|
149 if ($context['display_mode'] != 1)
|
Chris@76
|
150 echo '
|
Chris@76
|
151 <div class="cat_bar">
|
Chris@76
|
152 <h3 class="catbg">
|
Chris@76
|
153 <span id="author">', $txt['author'], '</span>
|
Chris@76
|
154 <span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span>
|
Chris@76
|
155 </h3>
|
Chris@76
|
156 </div>';
|
Chris@76
|
157
|
Chris@76
|
158 // Show a few buttons if we are in conversation mode and outputting the first message.
|
Chris@76
|
159 if ($context['display_mode'] == 2)
|
Chris@76
|
160 {
|
Chris@76
|
161 // Build the normal button array.
|
Chris@76
|
162 $conversation_buttons = array(
|
Chris@76
|
163 'reply' => array('text' => 'reply_to_all', 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=pm;sa=send;f=' . $context['folder'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';pmsg=' . $context['current_pm'] . ';u=all', 'active' => true),
|
Chris@76
|
164 'delete' => array('text' => 'delete_conversation', 'image' => 'delete.gif', 'lang' => true, 'url' => $scripturl . '?action=pm;sa=pmactions;pm_actions[' . $context['current_pm'] . ']=delete;conversation;f=' . $context['folder'] . ';start=' . $context['start'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';' . $context['session_var'] . '=' . $context['session_id'], 'custom' => 'onclick="return confirm(\'' . addslashes($txt['remove_message']) . '?\');"'),
|
Chris@76
|
165 );
|
Chris@76
|
166
|
Chris@76
|
167 // Show the conversation buttons.
|
Chris@76
|
168 echo '
|
Chris@76
|
169 <div class="pagesection">';
|
Chris@76
|
170
|
Chris@76
|
171 template_button_strip($conversation_buttons, 'right');
|
Chris@76
|
172
|
Chris@76
|
173 echo '
|
Chris@76
|
174 </div>';
|
Chris@76
|
175 }
|
Chris@76
|
176
|
Chris@76
|
177 while ($message = $context['get_pmessage']('message'))
|
Chris@76
|
178 {
|
Chris@76
|
179 $window_class = $message['alternate'] == 0 ? 'windowbg' : 'windowbg2';
|
Chris@76
|
180
|
Chris@76
|
181 echo '
|
Chris@76
|
182 <div class="', $window_class, ' clear">
|
Chris@76
|
183 <span class="topslice"><span></span></span>
|
Chris@76
|
184 <div class="poster">
|
Chris@76
|
185 <a id="msg', $message['id'], '"></a>
|
Chris@76
|
186 <h4>';
|
Chris@76
|
187
|
Chris@76
|
188 // Show online and offline buttons?
|
Chris@76
|
189 if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
|
Chris@76
|
190 echo '
|
Chris@76
|
191 <img src="', $message['member']['online']['image_href'], '" alt="', $message['member']['online']['text'], '" />';
|
Chris@76
|
192
|
Chris@76
|
193 echo '
|
Chris@76
|
194 ', $message['member']['link'], '
|
Chris@76
|
195 </h4>
|
Chris@76
|
196 <ul class="reset smalltext" id="msg_', $message['id'], '_extra_info">';
|
Chris@76
|
197
|
Chris@76
|
198 // Show the member's custom title, if they have one.
|
Chris@76
|
199 if (isset($message['member']['title']) && $message['member']['title'] != '')
|
Chris@76
|
200 echo '
|
Chris@76
|
201 <li class="title">', $message['member']['title'], '</li>';
|
Chris@76
|
202
|
Chris@76
|
203 // Show the member's primary group (like 'Administrator') if they have one.
|
Chris@76
|
204 if (isset($message['member']['group']) && $message['member']['group'] != '')
|
Chris@76
|
205 echo '
|
Chris@76
|
206 <li class="membergroup">', $message['member']['group'], '</li>';
|
Chris@76
|
207
|
Chris@76
|
208 // Don't show these things for guests.
|
Chris@76
|
209 if (!$message['member']['is_guest'])
|
Chris@76
|
210 {
|
Chris@76
|
211 // Show the post group if and only if they have no other group or the option is on, and they are in a post group.
|
Chris@76
|
212 if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
|
Chris@76
|
213 echo '
|
Chris@76
|
214 <li class="postgroup">', $message['member']['post_group'], '</li>';
|
Chris@76
|
215 echo '
|
Chris@76
|
216 <li class="stars">', $message['member']['group_stars'], '</li>';
|
Chris@76
|
217
|
Chris@76
|
218 // Show avatars, images, etc.?
|
Chris@76
|
219 if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
|
Chris@76
|
220 echo '
|
Chris@76
|
221 <li class="avatar">
|
Chris@76
|
222 <a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">
|
Chris@76
|
223 ', $message['member']['avatar']['image'], '
|
Chris@76
|
224 </a>
|
Chris@76
|
225 </li>';
|
Chris@76
|
226
|
Chris@76
|
227 // Show how many posts they have made.
|
Chris@76
|
228 if (!isset($context['disabled_fields']['posts']))
|
Chris@76
|
229 echo '
|
Chris@76
|
230 <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
|
Chris@76
|
231
|
Chris@76
|
232 // Is karma display enabled? Total or +/-?
|
Chris@76
|
233 if ($modSettings['karmaMode'] == '1')
|
Chris@76
|
234 echo '
|
Chris@76
|
235 <li class="karma">', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '</li>';
|
Chris@76
|
236 elseif ($modSettings['karmaMode'] == '2')
|
Chris@76
|
237 echo '
|
Chris@76
|
238 <li class="karma">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '</li>';
|
Chris@76
|
239
|
Chris@76
|
240 // Is this user allowed to modify this member's karma?
|
Chris@76
|
241 if ($message['member']['karma']['allow'])
|
Chris@76
|
242 echo '
|
Chris@76
|
243 <li class="karma_allow">
|
Chris@76
|
244 <a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pm=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a> <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pm=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a>
|
Chris@76
|
245 </li>';
|
Chris@76
|
246
|
Chris@76
|
247 // Show the member's gender icon?
|
Chris@76
|
248 if (!empty($settings['show_gender']) && $message['member']['gender']['image'] != '' && !isset($context['disabled_fields']['gender']))
|
Chris@76
|
249 echo '
|
Chris@76
|
250 <li class="gender">', $txt['gender'], ': ', $message['member']['gender']['image'], '</li>';
|
Chris@76
|
251
|
Chris@76
|
252 // Show their personal text?
|
Chris@76
|
253 if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
|
Chris@76
|
254 echo '
|
Chris@76
|
255 <li class="blurb">', $message['member']['blurb'], '</li>';
|
Chris@76
|
256
|
Chris@76
|
257 // Any custom fields to show as icons?
|
Chris@76
|
258 if (!empty($message['member']['custom_fields']))
|
Chris@76
|
259 {
|
Chris@76
|
260 $shown = false;
|
Chris@76
|
261 foreach ($message['member']['custom_fields'] as $custom)
|
Chris@76
|
262 {
|
Chris@76
|
263 if ($custom['placement'] != 1 || empty($custom['value']))
|
Chris@76
|
264 continue;
|
Chris@76
|
265 if (empty($shown))
|
Chris@76
|
266 {
|
Chris@76
|
267 $shown = true;
|
Chris@76
|
268 echo '
|
Chris@76
|
269 <li class="im_icons">
|
Chris@76
|
270 <ul>';
|
Chris@76
|
271 }
|
Chris@76
|
272 echo '
|
Chris@76
|
273 <li>', $custom['value'], '</li>';
|
Chris@76
|
274 }
|
Chris@76
|
275 if ($shown)
|
Chris@76
|
276 echo '
|
Chris@76
|
277 </ul>
|
Chris@76
|
278 </li>';
|
Chris@76
|
279 }
|
Chris@76
|
280
|
Chris@76
|
281 // This shows the popular messaging icons.
|
Chris@76
|
282 if ($message['member']['has_messenger'] && $message['member']['can_view_profile'])
|
Chris@76
|
283 echo '
|
Chris@76
|
284 <li class="im_icons">
|
Chris@76
|
285 <ul>', !isset($context['disabled_fields']['icq']) && !empty($message['member']['icq']['link']) ? '
|
Chris@76
|
286 <li>' . $message['member']['icq']['link'] . '</li>' : '', !isset($context['disabled_fields']['msn']) && !empty($message['member']['msn']['link']) ? '
|
Chris@76
|
287 <li>' . $message['member']['msn']['link'] . '</li>' : '', !isset($context['disabled_fields']['aim']) && !empty($message['member']['aim']['link']) ? '
|
Chris@76
|
288 <li>' . $message['member']['aim']['link'] . '</li>' : '', !isset($context['disabled_fields']['yim']) && !empty($message['member']['yim']['link']) ? '
|
Chris@76
|
289 <li>' . $message['member']['yim']['link'] . '</li>' : '', '
|
Chris@76
|
290 </ul>
|
Chris@76
|
291 </li>';
|
Chris@76
|
292
|
Chris@76
|
293 // Show the profile, website, email address, and personal message buttons.
|
Chris@76
|
294 if ($settings['show_profile_buttons'])
|
Chris@76
|
295 {
|
Chris@76
|
296 echo '
|
Chris@76
|
297 <li class="profile">
|
Chris@76
|
298 <ul>';
|
Chris@76
|
299
|
Chris@76
|
300 // Show the profile button
|
Chris@76
|
301 echo '
|
Chris@76
|
302 <li><a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.gif" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '" />' : $txt['view_profile']), '</a></li>';
|
Chris@76
|
303
|
Chris@76
|
304 // Don't show an icon if they haven't specified a website.
|
Chris@76
|
305 if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website']))
|
Chris@76
|
306 echo '
|
Chris@76
|
307 <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/www_sm.gif" alt="' . $message['member']['website']['title'] . '" />' : $txt['www']), '</a></li>';
|
Chris@76
|
308
|
Chris@76
|
309 // Don't show the email address if they want it hidden.
|
Chris@76
|
310 if (in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum')))
|
Chris@76
|
311 echo '
|
Chris@76
|
312 <li><a href="', $scripturl, '?action=emailuser;sa=email;uid=', $message['member']['id'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email']), '</a></li>';
|
Chris@76
|
313
|
Chris@76
|
314 // Since we know this person isn't a guest, you *can* message them.
|
Chris@76
|
315 if ($context['can_send_pm'])
|
Chris@76
|
316 echo '
|
Chris@76
|
317 <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '" />' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
|
Chris@76
|
318
|
Chris@76
|
319 echo '
|
Chris@76
|
320 </ul>
|
Chris@76
|
321 </li>';
|
Chris@76
|
322 }
|
Chris@76
|
323
|
Chris@76
|
324 // Any custom fields for standard placement?
|
Chris@76
|
325 if (!empty($message['member']['custom_fields']))
|
Chris@76
|
326 {
|
Chris@76
|
327 foreach ($message['member']['custom_fields'] as $custom)
|
Chris@76
|
328 if (empty($custom['placement']) || empty($custom['value']))
|
Chris@76
|
329 echo '
|
Chris@76
|
330 <li class="custom">', $custom['title'], ': ', $custom['value'], '</li>';
|
Chris@76
|
331 }
|
Chris@76
|
332
|
Chris@76
|
333 // Are we showing the warning status?
|
Chris@76
|
334 if ($message['member']['can_see_warning'])
|
Chris@76
|
335 echo '
|
Chris@76
|
336 <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<img src="', $settings['images_url'], '/warning_', $message['member']['warning_status'], '.gif" alt="', $txt['user_warn_' . $message['member']['warning_status']], '" />', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>';
|
Chris@76
|
337 }
|
Chris@76
|
338
|
Chris@76
|
339 // Done with the information about the poster... on to the post itself.
|
Chris@76
|
340 echo '
|
Chris@76
|
341 </ul>
|
Chris@76
|
342 </div>
|
Chris@76
|
343 <div class="postarea">
|
Chris@76
|
344 <div class="flow_hidden">
|
Chris@76
|
345 <div class="keyinfo">
|
Chris@76
|
346 <h5 id="subject_', $message['id'], '">
|
Chris@76
|
347 ', $message['subject'], '
|
Chris@76
|
348 </h5>';
|
Chris@76
|
349
|
Chris@76
|
350 // Show who the message was sent to.
|
Chris@76
|
351 echo '
|
Chris@76
|
352 <span class="smalltext">« <strong> ', $txt['sent_to'], ':</strong> ';
|
Chris@76
|
353
|
Chris@76
|
354 // People it was sent directly to....
|
Chris@76
|
355 if (!empty($message['recipients']['to']))
|
Chris@76
|
356 echo implode(', ', $message['recipients']['to']);
|
Chris@76
|
357 // Otherwise, we're just going to say "some people"...
|
Chris@76
|
358 elseif ($context['folder'] != 'sent')
|
Chris@76
|
359 echo '(', $txt['pm_undisclosed_recipients'], ')';
|
Chris@76
|
360
|
Chris@76
|
361 echo '
|
Chris@76
|
362 <strong> ', $txt['on'], ':</strong> ', $message['time'], ' »
|
Chris@76
|
363 </span>';
|
Chris@76
|
364
|
Chris@76
|
365 // If we're in the sent items, show who it was sent to besides the "To:" people.
|
Chris@76
|
366 if (!empty($message['recipients']['bcc']))
|
Chris@76
|
367 echo '
|
Chris@76
|
368 <br /><span class="smalltext">« <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' »</span>';
|
Chris@76
|
369
|
Chris@76
|
370 if (!empty($message['is_replied_to']))
|
Chris@76
|
371 echo '
|
Chris@76
|
372 <br /><span class="smalltext">« ', $txt['pm_is_replied_to'], ' »</span>';
|
Chris@76
|
373
|
Chris@76
|
374 echo '
|
Chris@76
|
375 </div>
|
Chris@76
|
376 <ul class="reset smalltext quickbuttons">';
|
Chris@76
|
377
|
Chris@76
|
378 // Show reply buttons if you have the permission to send PMs.
|
Chris@76
|
379 if ($context['can_send_pm'])
|
Chris@76
|
380 {
|
Chris@76
|
381 // You can't really reply if the member is gone.
|
Chris@76
|
382 if (!$message['member']['is_guest'])
|
Chris@76
|
383 {
|
Chris@76
|
384 // Is there than more than one recipient you can reply to?
|
Chris@76
|
385 if ($message['number_recipients'] > 1 && $context['display_mode'] != 2)
|
Chris@76
|
386 echo '
|
Chris@76
|
387 <li class="reply_all_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all">', $txt['reply_to_all'], '</a></li>';
|
Chris@76
|
388
|
Chris@76
|
389 echo '
|
Chris@76
|
390 <li class="reply_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $txt['reply'], '</a></li>
|
Chris@76
|
391 <li class="quote_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '">', $txt['quote'], '</a></li>';
|
Chris@76
|
392 }
|
Chris@76
|
393 // This is for "forwarding" - even if the member is gone.
|
Chris@76
|
394 else
|
Chris@76
|
395 echo '
|
Chris@76
|
396 <li class="forward_button"><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $txt['reply_quote'], '</a></li>';
|
Chris@76
|
397 }
|
Chris@76
|
398 echo '
|
Chris@76
|
399 <li class="remove_button"><a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions[', $message['id'], ']=delete;f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', addslashes($txt['remove_message']), '?\');">', $txt['delete'], '</a></li>';
|
Chris@76
|
400
|
Chris@76
|
401 if (empty($context['display_mode']))
|
Chris@76
|
402 echo '
|
Chris@76
|
403 <li class="inline_mod_check"><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;" class="input_check" /></li>';
|
Chris@76
|
404
|
Chris@76
|
405 echo '
|
Chris@76
|
406 </ul>
|
Chris@76
|
407 </div>
|
Chris@76
|
408 <div class="post">
|
Chris@76
|
409 <div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>
|
Chris@76
|
410 <div class="smalltext reportlinks">
|
Chris@76
|
411 ', (!empty($modSettings['enableReportPM']) && $context['folder'] != 'sent' ? '<div class="righttext"><a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '">' . $txt['pm_report_to_admin'] . '</a></div>' : '');
|
Chris@76
|
412
|
Chris@76
|
413 echo '
|
Chris@76
|
414 </div>';
|
Chris@76
|
415
|
Chris@76
|
416 // Are there any custom profile fields for above the signature?
|
Chris@76
|
417 if (!empty($message['member']['custom_fields']))
|
Chris@76
|
418 {
|
Chris@76
|
419 $shown = false;
|
Chris@76
|
420 foreach ($message['member']['custom_fields'] as $custom)
|
Chris@76
|
421 {
|
Chris@76
|
422 if ($custom['placement'] != 2 || empty($custom['value']))
|
Chris@76
|
423 continue;
|
Chris@76
|
424 if (!$shown)
|
Chris@76
|
425 {
|
Chris@76
|
426 $shown = true;
|
Chris@76
|
427 echo '
|
Chris@76
|
428 <div class="custom_fields_above_signature">
|
Chris@76
|
429 <ul class="reset nolist">';
|
Chris@76
|
430 }
|
Chris@76
|
431 echo '
|
Chris@76
|
432 <li>', $custom['value'], '</li>';
|
Chris@76
|
433 }
|
Chris@76
|
434 if ($shown)
|
Chris@76
|
435 echo '
|
Chris@76
|
436 </ul>
|
Chris@76
|
437 </div>';
|
Chris@76
|
438 }
|
Chris@76
|
439
|
Chris@76
|
440 // Show the member's signature?
|
Chris@76
|
441 if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
|
Chris@76
|
442 echo '
|
Chris@76
|
443 <div class="signature">', $message['member']['signature'], '</div>';
|
Chris@76
|
444
|
Chris@76
|
445 // Add an extra line at the bottom if we have labels enabled.
|
Chris@76
|
446 if ($context['folder'] != 'sent' && !empty($context['currently_using_labels']) && $context['display_mode'] != 2)
|
Chris@76
|
447 {
|
Chris@76
|
448 echo '
|
Chris@76
|
449 <div class="labels righttext">';
|
Chris@76
|
450 // Add the label drop down box.
|
Chris@76
|
451 if (!empty($context['currently_using_labels']))
|
Chris@76
|
452 {
|
Chris@76
|
453 echo '
|
Chris@76
|
454 <select name="pm_actions[', $message['id'], ']" onchange="if (this.options[this.selectedIndex].value) form.submit();">
|
Chris@76
|
455 <option value="">', $txt['pm_msg_label_title'], ':</option>
|
Chris@76
|
456 <option value="" disabled="disabled">---------------</option>';
|
Chris@76
|
457
|
Chris@76
|
458 // Are there any labels which can be added to this?
|
Chris@76
|
459 if (!$message['fully_labeled'])
|
Chris@76
|
460 {
|
Chris@76
|
461 echo '
|
Chris@76
|
462 <option value="" disabled="disabled">', $txt['pm_msg_label_apply'], ':</option>';
|
Chris@76
|
463 foreach ($context['labels'] as $label)
|
Chris@76
|
464 if (!isset($message['labels'][$label['id']]))
|
Chris@76
|
465 echo '
|
Chris@76
|
466 <option value="', $label['id'], '"> ', $label['name'], '</option>';
|
Chris@76
|
467 }
|
Chris@76
|
468 // ... and are there any that can be removed?
|
Chris@76
|
469 if (!empty($message['labels']) && (count($message['labels']) > 1 || !isset($message['labels'][-1])))
|
Chris@76
|
470 {
|
Chris@76
|
471 echo '
|
Chris@76
|
472 <option value="" disabled="disabled">', $txt['pm_msg_label_remove'], ':</option>';
|
Chris@76
|
473 foreach ($message['labels'] as $label)
|
Chris@76
|
474 echo '
|
Chris@76
|
475 <option value="', $label['id'], '"> ', $label['name'], '</option>';
|
Chris@76
|
476 }
|
Chris@76
|
477 echo '
|
Chris@76
|
478 </select>
|
Chris@76
|
479 <noscript>
|
Chris@76
|
480 <input type="submit" value="', $txt['pm_apply'], '" class="button_submit" />
|
Chris@76
|
481 </noscript>';
|
Chris@76
|
482 }
|
Chris@76
|
483 echo '
|
Chris@76
|
484 </div>';
|
Chris@76
|
485 }
|
Chris@76
|
486
|
Chris@76
|
487 echo '
|
Chris@76
|
488 </div>
|
Chris@76
|
489 <br class="clear" />
|
Chris@76
|
490 </div>
|
Chris@76
|
491 <div class="moderatorbar">
|
Chris@76
|
492 </div>
|
Chris@76
|
493 <span class="botslice"><span></span></span>
|
Chris@76
|
494 </div>';
|
Chris@76
|
495 }
|
Chris@76
|
496
|
Chris@76
|
497 if (empty($context['display_mode']))
|
Chris@76
|
498 echo '
|
Chris@76
|
499
|
Chris@76
|
500 <div class="pagesection">
|
Chris@76
|
501 <div class="floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>
|
Chris@76
|
502 <div class="floatright"><input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" style="font-weight: normal;" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button_submit" /></div>
|
Chris@76
|
503 </div>';
|
Chris@76
|
504
|
Chris@76
|
505 // Show a few buttons if we are in conversation mode and outputting the first message.
|
Chris@76
|
506 elseif ($context['display_mode'] == 2 && isset($conversation_buttons))
|
Chris@76
|
507 {
|
Chris@76
|
508 echo '
|
Chris@76
|
509
|
Chris@76
|
510 <div class="pagesection">';
|
Chris@76
|
511
|
Chris@76
|
512 template_button_strip($conversation_buttons, 'right');
|
Chris@76
|
513
|
Chris@76
|
514 echo '
|
Chris@76
|
515 </div>';
|
Chris@76
|
516 }
|
Chris@76
|
517
|
Chris@76
|
518 echo '
|
Chris@76
|
519 <br />';
|
Chris@76
|
520 }
|
Chris@76
|
521
|
Chris@76
|
522 // Individual messages = buttom list!
|
Chris@76
|
523 if ($context['display_mode'] == 1)
|
Chris@76
|
524 {
|
Chris@76
|
525 template_subject_list();
|
Chris@76
|
526 echo '<br />';
|
Chris@76
|
527 }
|
Chris@76
|
528
|
Chris@76
|
529 echo '
|
Chris@76
|
530 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
|
Chris@76
|
531 </form>';
|
Chris@76
|
532 }
|
Chris@76
|
533
|
Chris@76
|
534 // Just list all the personal message subjects - to make templates easier.
|
Chris@76
|
535 function template_subject_list()
|
Chris@76
|
536 {
|
Chris@76
|
537 global $context, $options, $settings, $modSettings, $txt, $scripturl;
|
Chris@76
|
538
|
Chris@76
|
539 echo '
|
Chris@76
|
540 <table width="100%" class="table_grid">
|
Chris@76
|
541 <thead>
|
Chris@76
|
542 <tr class="catbg">
|
Chris@76
|
543 <th align="center" width="4%" class="first_th">
|
Chris@76
|
544 <a href="', $scripturl, '?action=pm;view;f=', $context['folder'], ';start=', $context['start'], ';sort=', $context['sort_by'], ($context['sort_direction'] == 'up' ? '' : ';desc'), ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : ''), '"><img src="', $settings['images_url'], '/im_switch.gif" alt="', $txt['pm_change_view'], '" title="', $txt['pm_change_view'], '" width="16" height="16" /></a>
|
Chris@76
|
545 </th>
|
Chris@76
|
546 <th class="lefttext" width="22%">
|
Chris@76
|
547 <a href="', $scripturl, '?action=pm;f=', $context['folder'], ';start=', $context['start'], ';sort=date', $context['sort_by'] == 'date' && $context['sort_direction'] == 'up' ? ';desc' : '', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', '">', $txt['date'], $context['sort_by'] == 'date' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
|
Chris@76
|
548 </th>
|
Chris@76
|
549 <th class="lefttext" width="46%">
|
Chris@76
|
550 <a href="', $scripturl, '?action=pm;f=', $context['folder'], ';start=', $context['start'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
|
Chris@76
|
551 </th>
|
Chris@76
|
552 <th class="lefttext">
|
Chris@76
|
553 <a href="', $scripturl, '?action=pm;f=', $context['folder'], ';start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', '">', ($context['from_or_to'] == 'from' ? $txt['from'] : $txt['to']), $context['sort_by'] == 'name' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
|
Chris@76
|
554 </th>
|
Chris@76
|
555 <th align="center" width="4%" class="last_th">
|
Chris@76
|
556 <input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />
|
Chris@76
|
557 </th>
|
Chris@76
|
558 </tr>
|
Chris@76
|
559 </thead>
|
Chris@76
|
560 <tbody>';
|
Chris@76
|
561 if (!$context['show_delete'])
|
Chris@76
|
562 echo '
|
Chris@76
|
563 <tr class="windowbg2">
|
Chris@76
|
564 <td colspan="5">', $txt['msg_alert_none'], '</td>
|
Chris@76
|
565 </tr>';
|
Chris@76
|
566 $next_alternate = false;
|
Chris@76
|
567
|
Chris@76
|
568 while ($message = $context['get_pmessage']('subject'))
|
Chris@76
|
569 {
|
Chris@76
|
570 echo '
|
Chris@76
|
571 <tr class="', $next_alternate ? 'windowbg' : 'windowbg2', '">
|
Chris@76
|
572 <td align="center" width="4%">
|
Chris@76
|
573 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
574 currentLabels[', $message['id'], '] = {';
|
Chris@76
|
575
|
Chris@76
|
576 if (!empty($message['labels']))
|
Chris@76
|
577 {
|
Chris@76
|
578 $first = true;
|
Chris@76
|
579 foreach ($message['labels'] as $label)
|
Chris@76
|
580 {
|
Chris@76
|
581 echo $first ? '' : ',', '
|
Chris@76
|
582 "', $label['id'], '": "', $label['name'], '"';
|
Chris@76
|
583 $first = false;
|
Chris@76
|
584 }
|
Chris@76
|
585 }
|
Chris@76
|
586
|
Chris@76
|
587 echo '
|
Chris@76
|
588 };
|
Chris@76
|
589 // ]]></script>
|
Chris@76
|
590 ', $message['is_replied_to'] ? '<img src="' . $settings['images_url'] . '/icons/pm_replied.gif" style="margin-right: 4px;" alt="' . $txt['pm_replied'] . '" />' : '<img src="' . $settings['images_url'] . '/icons/pm_read.gif" style="margin-right: 4px;" alt="' . $txt['pm_read'] . '" />', '</td>
|
Chris@76
|
591 <td>', $message['time'], '</td>
|
Chris@76
|
592 <td>', ($context['display_mode'] != 0 && $context['current_pm'] == $message['id'] ? '<img src="' . $settings['images_url'] . '/selected.gif" alt="*" />' : ''), '<a href="', ($context['display_mode'] == 0 || $context['current_pm'] == $message['id'] ? '' : ($scripturl . '?action=pm;pmid=' . $message['id'] . ';kstart;f=' . $context['folder'] . ';start=' . $context['start'] . ';sort=' . $context['sort_by'] . ($context['sort_direction'] == 'up' ? ';' : ';desc') . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : ''))), '#msg', $message['id'], '">', $message['subject'], '</a>', $message['is_unread'] ? ' <img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" />' : '', '</td>
|
Chris@76
|
593 <td>', ($context['from_or_to'] == 'from' ? $message['member']['link'] : (empty($message['recipients']['to']) ? '' : implode(', ', $message['recipients']['to']))), '</td>
|
Chris@76
|
594 <td align="center" width="4%"><input type="checkbox" name="pms[]" id="deletelisting', $message['id'], '" value="', $message['id'], '"', $message['is_selected'] ? ' checked="checked"' : '', ' onclick="if (document.getElementById(\'deletedisplay', $message['id'], '\')) document.getElementById(\'deletedisplay', $message['id'], '\').checked = this.checked;" class="input_check" /></td>
|
Chris@76
|
595 </tr>';
|
Chris@76
|
596 $next_alternate = !$next_alternate;
|
Chris@76
|
597 }
|
Chris@76
|
598
|
Chris@76
|
599 echo '
|
Chris@76
|
600 </tbody>
|
Chris@76
|
601 </table>
|
Chris@76
|
602 <div class="pagesection">
|
Chris@76
|
603 <div class="floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>
|
Chris@76
|
604 <div class="floatright"> ';
|
Chris@76
|
605
|
Chris@76
|
606 if ($context['show_delete'])
|
Chris@76
|
607 {
|
Chris@76
|
608 if (!empty($context['currently_using_labels']) && $context['folder'] != 'sent')
|
Chris@76
|
609 {
|
Chris@76
|
610 echo '
|
Chris@76
|
611 <select name="pm_action" onchange="if (this.options[this.selectedIndex].value) this.form.submit();" onfocus="loadLabelChoices();">
|
Chris@76
|
612 <option value="">', $txt['pm_sel_label_title'], ':</option>
|
Chris@76
|
613 <option value="" disabled="disabled">---------------</option>';
|
Chris@76
|
614
|
Chris@76
|
615 echo '
|
Chris@76
|
616 <option value="" disabled="disabled">', $txt['pm_msg_label_apply'], ':</option>';
|
Chris@76
|
617 foreach ($context['labels'] as $label)
|
Chris@76
|
618 if ($label['id'] != $context['current_label_id'])
|
Chris@76
|
619 echo '
|
Chris@76
|
620 <option value="add_', $label['id'], '"> ', $label['name'], '</option>';
|
Chris@76
|
621 echo '
|
Chris@76
|
622 <option value="" disabled="disabled">', $txt['pm_msg_label_remove'], ':</option>';
|
Chris@76
|
623 foreach ($context['labels'] as $label)
|
Chris@76
|
624 echo '
|
Chris@76
|
625 <option value="rem_', $label['id'], '"> ', $label['name'], '</option>';
|
Chris@76
|
626 echo '
|
Chris@76
|
627 </select>
|
Chris@76
|
628 <noscript>
|
Chris@76
|
629 <input type="submit" value="', $txt['pm_apply'], '" class="button_submit" />
|
Chris@76
|
630 </noscript>';
|
Chris@76
|
631 }
|
Chris@76
|
632
|
Chris@76
|
633 echo '
|
Chris@76
|
634 <input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button_submit" />';
|
Chris@76
|
635 }
|
Chris@76
|
636
|
Chris@76
|
637 echo '
|
Chris@76
|
638 </div>
|
Chris@76
|
639 </div>';
|
Chris@76
|
640 }
|
Chris@76
|
641
|
Chris@76
|
642 function template_search()
|
Chris@76
|
643 {
|
Chris@76
|
644 global $context, $settings, $options, $scripturl, $modSettings, $txt;
|
Chris@76
|
645
|
Chris@76
|
646 echo '
|
Chris@76
|
647 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
648 function expandCollapseLabels()
|
Chris@76
|
649 {
|
Chris@76
|
650 var current = document.getElementById("searchLabelsExpand").style.display != "none";
|
Chris@76
|
651
|
Chris@76
|
652 document.getElementById("searchLabelsExpand").style.display = current ? "none" : "";
|
Chris@76
|
653 document.getElementById("expandLabelsIcon").src = smf_images_url + (current ? "/expand.gif" : "/collapse.gif");
|
Chris@76
|
654 }
|
Chris@76
|
655 // ]]></script>
|
Chris@76
|
656 <form action="', $scripturl, '?action=pm;sa=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform">
|
Chris@76
|
657 <div class="cat_bar">
|
Chris@76
|
658 <h3 class="catbg">', $txt['pm_search_title'], '</h3>
|
Chris@76
|
659 </div>';
|
Chris@76
|
660
|
Chris@76
|
661 if (!empty($context['search_errors']))
|
Chris@76
|
662 {
|
Chris@76
|
663 echo '
|
Chris@76
|
664 <div class="errorbox">
|
Chris@76
|
665 ', implode('<br />', $context['search_errors']['messages']), '
|
Chris@76
|
666 </div>';
|
Chris@76
|
667 }
|
Chris@76
|
668
|
Chris@76
|
669 if ($context['simple_search'])
|
Chris@76
|
670 {
|
Chris@76
|
671 echo '
|
Chris@76
|
672 <fieldset id="simple_search">
|
Chris@76
|
673 <span class="upperframe"><span></span></span>
|
Chris@76
|
674 <div class="roundframe">
|
Chris@76
|
675 <div id="search_term_input">
|
Chris@76
|
676 <strong>', $txt['pm_search_text'], ':</strong>
|
Chris@76
|
677 <input type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' size="40" class="input_text" />
|
Chris@76
|
678 <input type="submit" name="submit" value="', $txt['pm_search_go'], '" class="button_submit" />
|
Chris@76
|
679 </div>
|
Chris@76
|
680 <a href="', $scripturl, '?action=pm;sa=search;advanced" onclick="this.href += \';search=\' + escape(document.forms.searchform.search.value);">', $txt['pm_search_advanced'], '</a>
|
Chris@76
|
681 <input type="hidden" name="advanced" value="0" />
|
Chris@76
|
682 </div>
|
Chris@76
|
683 <span class="lowerframe"><span></span></span>
|
Chris@76
|
684 </fieldset>';
|
Chris@76
|
685 }
|
Chris@76
|
686
|
Chris@76
|
687 // Advanced search!
|
Chris@76
|
688 else
|
Chris@76
|
689 {
|
Chris@76
|
690 echo '
|
Chris@76
|
691 <fieldset id="advanced_search">
|
Chris@76
|
692 <span class="upperframe"><span></span></span>
|
Chris@76
|
693 <div class="roundframe">
|
Chris@76
|
694 <input type="hidden" name="advanced" value="1" />
|
Chris@76
|
695 <span class="enhanced">
|
Chris@76
|
696 <strong>', $txt['pm_search_text'], ':</strong>
|
Chris@76
|
697 <input type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' size="40" class="input_text" />
|
Chris@76
|
698 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
699 function initSearch()
|
Chris@76
|
700 {
|
Chris@76
|
701 if (document.forms.searchform.search.value.indexOf("%u") != -1)
|
Chris@76
|
702 document.forms.searchform.search.value = unescape(document.forms.searchform.search.value);
|
Chris@76
|
703 }
|
Chris@76
|
704 createEventListener(window);
|
Chris@76
|
705 window.addEventListener("load", initSearch, false);
|
Chris@76
|
706 // ]]></script>
|
Chris@76
|
707 <select name="searchtype">
|
Chris@76
|
708 <option value="1"', empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['pm_search_match_all'], '</option>
|
Chris@76
|
709 <option value="2"', !empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['pm_search_match_any'], '</option>
|
Chris@76
|
710 </select>
|
Chris@76
|
711 </span>
|
Chris@76
|
712 <dl id="search_options">
|
Chris@76
|
713 <dt>', $txt['pm_search_user'], ':</dt>
|
Chris@76
|
714 <dd><input type="text" name="userspec" value="', empty($context['search_params']['userspec']) ? '*' : $context['search_params']['userspec'], '" size="40" class="input_text" /></dd>
|
Chris@76
|
715 <dt>', $txt['pm_search_order'], ':</dt>
|
Chris@76
|
716 <dd>
|
Chris@76
|
717 <select name="sort">
|
Chris@76
|
718 <option value="relevance|desc">', $txt['pm_search_orderby_relevant_first'], '</option>
|
Chris@76
|
719 <option value="id_pm|desc">', $txt['pm_search_orderby_recent_first'], '</option>
|
Chris@76
|
720 <option value="id_pm|asc">', $txt['pm_search_orderby_old_first'], '</option>
|
Chris@76
|
721 </select>
|
Chris@76
|
722 </dd>
|
Chris@76
|
723 <dt class="options">', $txt['pm_search_options'], ':</dt>
|
Chris@76
|
724 <dd class="options">
|
Chris@76
|
725 <label for="show_complete"><input type="checkbox" name="show_complete" id="show_complete" value="1"', !empty($context['search_params']['show_complete']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['pm_search_show_complete'], '</label><br />
|
Chris@76
|
726 <label for="subject_only"><input type="checkbox" name="subject_only" id="subject_only" value="1"', !empty($context['search_params']['subject_only']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['pm_search_subject_only'], '</label>
|
Chris@76
|
727 </dd>
|
Chris@76
|
728 <dt class="between">', $txt['pm_search_post_age'], ':</dt>
|
Chris@76
|
729 <dd>', $txt['pm_search_between'], ' <input type="text" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="5" class="input_text" /> ', $txt['pm_search_between_and'], ' <input type="text" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="5" class="input_text" /> ', $txt['pm_search_between_days'], '</dd>
|
Chris@76
|
730 </dl>';
|
Chris@76
|
731 if (!$context['currently_using_labels'])
|
Chris@76
|
732 echo '
|
Chris@76
|
733 <input type="submit" name="submit" value="', $txt['pm_search_go'], '" class="button_submit floatright" />';
|
Chris@76
|
734 echo '
|
Chris@76
|
735 <br class="clear" />
|
Chris@76
|
736 </div>
|
Chris@76
|
737 <span class="lowerframe"><span></span></span>
|
Chris@76
|
738 </fieldset>';
|
Chris@76
|
739
|
Chris@76
|
740 // Do we have some labels setup? If so offer to search by them!
|
Chris@76
|
741 if ($context['currently_using_labels'])
|
Chris@76
|
742 {
|
Chris@76
|
743 echo '
|
Chris@76
|
744 <fieldset class="labels">
|
Chris@76
|
745 <span class="upperframe"><span></span></span>
|
Chris@76
|
746 <div class="roundframe">
|
Chris@76
|
747 <div class="title_bar">
|
Chris@76
|
748 <h4 class="titlebg">
|
Chris@76
|
749 <span class="ie6_header floatleft"><a href="javascript:void(0);" onclick="expandCollapseLabels(); return false;"><img src="', $settings['images_url'], '/expand.gif" id="expandLabelsIcon" alt="" /></a> <a href="javascript:void(0);" onclick="expandCollapseLabels(); return false;"><strong>', $txt['pm_search_choose_label'], '</strong></a></span>
|
Chris@76
|
750 </h4>
|
Chris@76
|
751 </div>
|
Chris@76
|
752 <ul id="searchLabelsExpand" class="reset" ', $context['check_all'] ? 'style="display: none;"' : '', '>';
|
Chris@76
|
753
|
Chris@76
|
754 foreach ($context['search_labels'] as $label)
|
Chris@76
|
755 echo '
|
Chris@76
|
756 <li>
|
Chris@76
|
757 <label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '" ', $label['checked'] ? 'checked="checked"' : '', ' class="input_check" />
|
Chris@76
|
758 ', $label['name'], '</label>
|
Chris@76
|
759 </li>';
|
Chris@76
|
760
|
Chris@76
|
761 echo '
|
Chris@76
|
762 </ul>
|
Chris@76
|
763 <p>
|
Chris@76
|
764 <span class="floatleft"><input type="checkbox" name="all" id="check_all" value="" ', $context['check_all'] ? 'checked="checked"' : '', ' onclick="invertAll(this, this.form, \'searchlabel\');" class="input_check" /><em> <label for="check_all">', $txt['check_all'], '</label></em></span>
|
Chris@76
|
765 <input type="submit" name="submit" value="', $txt['pm_search_go'], '" class="button_submit floatright" />
|
Chris@76
|
766 </p><br class="clear" />
|
Chris@76
|
767 </div>
|
Chris@76
|
768 <span class="lowerframe"><span></span></span>
|
Chris@76
|
769 </fieldset>';
|
Chris@76
|
770 }
|
Chris@76
|
771 }
|
Chris@76
|
772
|
Chris@76
|
773 echo '
|
Chris@76
|
774 </form>';
|
Chris@76
|
775 }
|
Chris@76
|
776
|
Chris@76
|
777 function template_search_results()
|
Chris@76
|
778 {
|
Chris@76
|
779 global $context, $settings, $options, $scripturl, $modSettings, $txt;
|
Chris@76
|
780
|
Chris@76
|
781 echo '
|
Chris@76
|
782 <div class="cat_bar">
|
Chris@76
|
783 <h3 class="catbg">', $txt['pm_search_results'], '</h3>
|
Chris@76
|
784 </div>
|
Chris@76
|
785 <div class="pagesection">
|
Chris@76
|
786 <strong>', $txt['pages'], ':</strong> ', $context['page_index'], '
|
Chris@76
|
787 </div>';
|
Chris@76
|
788
|
Chris@76
|
789 // complete results ?
|
Chris@76
|
790 if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
|
Chris@76
|
791 echo '
|
Chris@76
|
792 <table width="100%" class="table_grid">
|
Chris@76
|
793 <thead>
|
Chris@76
|
794 <tr class="catbg">
|
Chris@76
|
795 <th class="lefttext first_th" width="30%">', $txt['date'], '</th>
|
Chris@76
|
796 <th class="lefttext" width="50%">', $txt['subject'], '</th>
|
Chris@76
|
797 <th class="lefttext last_th" width="20%">', $txt['from'], '</th>
|
Chris@76
|
798 </tr>
|
Chris@76
|
799 </thead>
|
Chris@76
|
800 <tbody>';
|
Chris@76
|
801
|
Chris@76
|
802 $alternate = true;
|
Chris@76
|
803 // Print each message out...
|
Chris@76
|
804 foreach ($context['personal_messages'] as $message)
|
Chris@76
|
805 {
|
Chris@76
|
806 // We showing it all?
|
Chris@76
|
807 if (!empty($context['search_params']['show_complete']))
|
Chris@76
|
808 {
|
Chris@76
|
809 echo '
|
Chris@76
|
810 <div class="title_bar">
|
Chris@76
|
811 <h3 class="titlebg">
|
Chris@76
|
812 <span class="floatright">', $txt['search_on'], ': ', $message['time'], '</span>
|
Chris@76
|
813 <span class="floatleft">', $message['counter'], ' <a href="', $message['href'], '">', $message['subject'], '</a></span>
|
Chris@76
|
814 </h3>
|
Chris@76
|
815 </div>
|
Chris@76
|
816 <div class="cat_bar">
|
Chris@76
|
817 <h3 class="catbg">', $txt['from'], ': ', $message['member']['link'], ', ', $txt['to'], ': ';
|
Chris@76
|
818
|
Chris@76
|
819 // Show the recipients.
|
Chris@76
|
820 // !!! This doesn't deal with the sent item searching quite right for bcc.
|
Chris@76
|
821 if (!empty($message['recipients']['to']))
|
Chris@76
|
822 echo implode(', ', $message['recipients']['to']);
|
Chris@76
|
823 // Otherwise, we're just going to say "some people"...
|
Chris@76
|
824 elseif ($context['folder'] != 'sent')
|
Chris@76
|
825 echo '(', $txt['pm_undisclosed_recipients'], ')';
|
Chris@76
|
826
|
Chris@76
|
827 echo '
|
Chris@76
|
828 </h3>
|
Chris@76
|
829 </div>
|
Chris@76
|
830 <div class="windowbg', $alternate ? '2': '', '">
|
Chris@76
|
831 <span class="topslice"><span></span></span>
|
Chris@76
|
832 <div class="content">
|
Chris@76
|
833 ', $message['body'], '
|
Chris@76
|
834 <p class="pm_reply righttext middletext">';
|
Chris@76
|
835
|
Chris@76
|
836 if ($context['can_send_pm'])
|
Chris@76
|
837 {
|
Chris@76
|
838 $quote_button = create_button('quote.gif', 'reply_quote', 'reply_quote', 'align="middle"');
|
Chris@76
|
839 $reply_button = create_button('im_reply.gif', 'reply', 'reply', 'align="middle"');
|
Chris@76
|
840 // You can only reply if they are not a guest...
|
Chris@76
|
841 if (!$message['member']['is_guest'])
|
Chris@76
|
842 echo '
|
Chris@76
|
843 <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], '
|
Chris@76
|
844 <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator'];
|
Chris@76
|
845 // This is for "forwarding" - even if the member is gone.
|
Chris@76
|
846 else
|
Chris@76
|
847 echo '
|
Chris@76
|
848 <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator'];
|
Chris@76
|
849 }
|
Chris@76
|
850
|
Chris@76
|
851 echo '
|
Chris@76
|
852 </p>
|
Chris@76
|
853 </div>
|
Chris@76
|
854 <span class="botslice"><span></span></span>
|
Chris@76
|
855 </div>';
|
Chris@76
|
856 }
|
Chris@76
|
857 // Otherwise just a simple list!
|
Chris@76
|
858 else
|
Chris@76
|
859 {
|
Chris@76
|
860 // !!! No context at all of the search?
|
Chris@76
|
861 echo '
|
Chris@76
|
862 <tr class="', $alternate ? 'windowbg' : 'windowbg2', '" valign="top">
|
Chris@76
|
863 <td>', $message['time'], '</td>
|
Chris@76
|
864 <td>', $message['link'], '</td>
|
Chris@76
|
865 <td>', $message['member']['link'], '</td>
|
Chris@76
|
866 </tr>';
|
Chris@76
|
867 }
|
Chris@76
|
868
|
Chris@76
|
869 $alternate = !$alternate;
|
Chris@76
|
870 }
|
Chris@76
|
871
|
Chris@76
|
872 // Finish off the page...
|
Chris@76
|
873 if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
|
Chris@76
|
874 echo '
|
Chris@76
|
875 </tbody>
|
Chris@76
|
876 </table>';
|
Chris@76
|
877
|
Chris@76
|
878 // No results?
|
Chris@76
|
879 if (empty($context['personal_messages']))
|
Chris@76
|
880 echo '
|
Chris@76
|
881 <div class="windowbg">
|
Chris@76
|
882 <span class="topslice"><span></span></span>
|
Chris@76
|
883 <div class="content">
|
Chris@76
|
884 <p class="centertext">', $txt['pm_search_none_found'], '</p>
|
Chris@76
|
885 </div>
|
Chris@76
|
886 <span class="botslice"><span></span></span>
|
Chris@76
|
887 </div>';
|
Chris@76
|
888
|
Chris@76
|
889 echo '
|
Chris@76
|
890 <div class="pagesection">
|
Chris@76
|
891 <strong>', $txt['pages'], ':</strong> ', $context['page_index'], '
|
Chris@76
|
892 </div>';
|
Chris@76
|
893
|
Chris@76
|
894 }
|
Chris@76
|
895
|
Chris@76
|
896 function template_send()
|
Chris@76
|
897 {
|
Chris@76
|
898 global $context, $settings, $options, $scripturl, $modSettings, $txt;
|
Chris@76
|
899
|
Chris@76
|
900 // Show which messages were sent successfully and which failed.
|
Chris@76
|
901 if (!empty($context['send_log']))
|
Chris@76
|
902 {
|
Chris@76
|
903 echo '
|
Chris@76
|
904 <div class="cat_bar">
|
Chris@76
|
905 <h3 class="catbg">', $txt['pm_send_report'], '</h3>
|
Chris@76
|
906 </div>
|
Chris@76
|
907 <div class="windowbg">
|
Chris@76
|
908 <span class="topslice"><span></span></span>
|
Chris@76
|
909 <div class="content">';
|
Chris@76
|
910 if (!empty($context['send_log']['sent']))
|
Chris@76
|
911 foreach ($context['send_log']['sent'] as $log_entry)
|
Chris@76
|
912 echo '<span class="error">', $log_entry, '</span><br />';
|
Chris@76
|
913 if (!empty($context['send_log']['failed']))
|
Chris@76
|
914 foreach ($context['send_log']['failed'] as $log_entry)
|
Chris@76
|
915 echo '<span class="error">', $log_entry, '</span><br />';
|
Chris@76
|
916 echo '
|
Chris@76
|
917 </div>
|
Chris@76
|
918 <span class="botslice"><span></span></span>
|
Chris@76
|
919 </div>
|
Chris@76
|
920 <br />';
|
Chris@76
|
921 }
|
Chris@76
|
922
|
Chris@76
|
923 // Show the preview of the personal message.
|
Chris@76
|
924 if (isset($context['preview_message']))
|
Chris@76
|
925 echo '
|
Chris@76
|
926 <div class="cat_bar">
|
Chris@76
|
927 <h3 class="catbg">', $context['preview_subject'], '</h3>
|
Chris@76
|
928 </div>
|
Chris@76
|
929 <div class="windowbg">
|
Chris@76
|
930 <span class="topslice"><span></span></span>
|
Chris@76
|
931 <div class="content">
|
Chris@76
|
932 ', $context['preview_message'], '
|
Chris@76
|
933 </div>
|
Chris@76
|
934 <span class="botslice"><span></span></span>
|
Chris@76
|
935 </div>
|
Chris@76
|
936 <br />';
|
Chris@76
|
937
|
Chris@76
|
938 // Main message editing box.
|
Chris@76
|
939 echo '
|
Chris@76
|
940 <div class="cat_bar">
|
Chris@76
|
941 <h3 class="catbg">
|
Chris@76
|
942 <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/im_newmsg.gif" alt="', $txt['new_message'], '" title="', $txt['new_message'], '" /> ', $txt['new_message'], '</span>
|
Chris@76
|
943 </h3>
|
Chris@76
|
944 </div>';
|
Chris@76
|
945
|
Chris@76
|
946 echo '
|
Chris@76
|
947 <form action="', $scripturl, '?action=pm;sa=send2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'message\']);">
|
Chris@76
|
948 <div>
|
Chris@76
|
949 <span class="upperframe"><span></span></span>
|
Chris@76
|
950 <div class="roundframe"><br class="clear" />';
|
Chris@76
|
951
|
Chris@76
|
952 // If there were errors for sending the PM, show them.
|
Chris@76
|
953 if (!empty($context['post_error']['messages']))
|
Chris@76
|
954 {
|
Chris@76
|
955 echo '
|
Chris@76
|
956 <div class="errorbox">
|
Chris@76
|
957 <strong>', $txt['error_while_submitting'], '</strong>
|
Chris@76
|
958 <ul class="reset">';
|
Chris@76
|
959
|
Chris@76
|
960 foreach ($context['post_error']['messages'] as $error)
|
Chris@76
|
961 echo '
|
Chris@76
|
962 <li class="error">', $error, '</li>';
|
Chris@76
|
963
|
Chris@76
|
964 echo '
|
Chris@76
|
965 </ul>
|
Chris@76
|
966 </div>';
|
Chris@76
|
967 }
|
Chris@76
|
968
|
Chris@76
|
969 echo '
|
Chris@76
|
970 <dl id="post_header">';
|
Chris@76
|
971
|
Chris@76
|
972 // To and bcc. Include a button to search for members.
|
Chris@76
|
973 echo '
|
Chris@76
|
974 <dt>
|
Chris@76
|
975 <span', (isset($context['post_error']['no_to']) || isset($context['post_error']['bad_to']) ? ' class="error"' : ''), '>', $txt['pm_to'], ':</span>
|
Chris@76
|
976 </dt>';
|
Chris@76
|
977
|
Chris@76
|
978 // Autosuggest will be added by the JavaScript later on.
|
Chris@76
|
979 echo '
|
Chris@76
|
980 <dd id="pm_to" class="clear_right">
|
Chris@76
|
981 <input type="text" name="to" id="to_control" value="', $context['to_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />';
|
Chris@76
|
982
|
Chris@76
|
983 // A link to add BCC, only visible with JavaScript enabled.
|
Chris@76
|
984 echo '
|
Chris@76
|
985 <span class="smalltext" id="bcc_link_container" style="display: none;"></span>';
|
Chris@76
|
986
|
Chris@76
|
987 // A div that'll contain the items found by the autosuggest.
|
Chris@76
|
988 echo '
|
Chris@76
|
989 <div id="to_item_list_container"></div>';
|
Chris@76
|
990
|
Chris@76
|
991 echo '
|
Chris@76
|
992 </dd>';
|
Chris@76
|
993
|
Chris@76
|
994 // This BCC row will be hidden by default if JavaScript is enabled.
|
Chris@76
|
995 echo '
|
Chris@76
|
996 <dt class="clear_left" id="bcc_div">
|
Chris@76
|
997 <span', (isset($context['post_error']['no_to']) || isset($context['post_error']['bad_bcc']) ? ' class="error"' : ''), '>', $txt['pm_bcc'], ':</span>
|
Chris@76
|
998 </dt>
|
Chris@76
|
999 <dd id="bcc_div2">
|
Chris@76
|
1000 <input type="text" name="bcc" id="bcc_control" value="', $context['bcc_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />
|
Chris@76
|
1001 <div id="bcc_item_list_container"></div>
|
Chris@76
|
1002 </dd>';
|
Chris@76
|
1003
|
Chris@76
|
1004 // The subject of the PM.
|
Chris@76
|
1005 echo '
|
Chris@76
|
1006 <dt class="clear_left">
|
Chris@76
|
1007 <span', (isset($context['post_error']['no_subject']) ? ' class="error"' : ''), '>', $txt['subject'], ':</span>
|
Chris@76
|
1008 </dt>
|
Chris@76
|
1009 <dd id="pm_subject">
|
Chris@76
|
1010 <input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="60" maxlength="60" />
|
Chris@76
|
1011 </dd>
|
Chris@76
|
1012 </dl><hr class="clear" />';
|
Chris@76
|
1013
|
Chris@76
|
1014 // Showing BBC?
|
Chris@76
|
1015 if ($context['show_bbc'])
|
Chris@76
|
1016 {
|
Chris@76
|
1017 echo '
|
Chris@76
|
1018 <div id="bbcBox_message"></div>';
|
Chris@76
|
1019 }
|
Chris@76
|
1020
|
Chris@76
|
1021 // What about smileys?
|
Chris@76
|
1022 if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
|
Chris@76
|
1023 echo '
|
Chris@76
|
1024 <div id="smileyBox_message"></div>';
|
Chris@76
|
1025
|
Chris@76
|
1026 // Show BBC buttons, smileys and textbox.
|
Chris@76
|
1027 echo '
|
Chris@76
|
1028 ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
|
Chris@76
|
1029
|
Chris@76
|
1030 // Require an image to be typed to save spamming?
|
Chris@76
|
1031 if ($context['require_verification'])
|
Chris@76
|
1032 {
|
Chris@76
|
1033 echo '
|
Chris@76
|
1034 <div class="post_verification">
|
Chris@76
|
1035 <strong>', $txt['pm_visual_verification_label'], ':</strong>
|
Chris@76
|
1036 ', template_control_verification($context['visual_verification_id'], 'all'), '
|
Chris@76
|
1037 </div>';
|
Chris@76
|
1038 }
|
Chris@76
|
1039
|
Chris@76
|
1040 // Send, Preview, spellcheck buttons.
|
Chris@76
|
1041 echo '
|
Chris@76
|
1042 <p><label for="outbox"><input type="checkbox" name="outbox" id="outbox" value="1" tabindex="', $context['tabindex']++, '"', $context['copy_to_outbox'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['pm_save_outbox'], '</label></p>
|
Chris@76
|
1043 <p id="shortcuts" class="smalltext">
|
Chris@76
|
1044 ', $context['browser']['is_firefox'] ? $txt['shortcuts_firefox'] : $txt['shortcuts'], '
|
Chris@76
|
1045 </p>
|
Chris@76
|
1046 <p id="post_confirm_strip" class="righttext">
|
Chris@76
|
1047 ', template_control_richedit_buttons($context['post_box_name']), '
|
Chris@76
|
1048 </p>
|
Chris@76
|
1049 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
|
Chris@76
|
1050 <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
|
Chris@76
|
1051 <input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" />
|
Chris@76
|
1052 <input type="hidden" name="pm_head" value="', !empty($context['quoted_message']['pm_head']) ? $context['quoted_message']['pm_head'] : 0, '" />
|
Chris@76
|
1053 <input type="hidden" name="f" value="', isset($context['folder']) ? $context['folder'] : '', '" />
|
Chris@76
|
1054 <input type="hidden" name="l" value="', isset($context['current_label_id']) ? $context['current_label_id'] : -1, '" />
|
Chris@76
|
1055 <br class="clear" />
|
Chris@76
|
1056 </div>
|
Chris@76
|
1057 <span class="lowerframe"><span></span></span>
|
Chris@76
|
1058 </div>
|
Chris@76
|
1059 </form>';
|
Chris@76
|
1060
|
Chris@76
|
1061 // Show the message you're replying to.
|
Chris@76
|
1062 if ($context['reply'])
|
Chris@76
|
1063 echo '
|
Chris@76
|
1064 <br />
|
Chris@76
|
1065 <br />
|
Chris@76
|
1066 <div class="cat_bar">
|
Chris@76
|
1067 <h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3>
|
Chris@76
|
1068 </div>
|
Chris@76
|
1069 <div class="windowbg2">
|
Chris@76
|
1070 <span class="topslice"><span></span></span>
|
Chris@76
|
1071 <div class="content">
|
Chris@76
|
1072 <div class="clear">
|
Chris@76
|
1073 <span class="smalltext floatright">', $txt['on'], ': ', $context['quoted_message']['time'], '</span>
|
Chris@76
|
1074 <strong>', $txt['from'], ': ', $context['quoted_message']['member']['name'], '</strong>
|
Chris@76
|
1075 </div><hr />
|
Chris@76
|
1076 ', $context['quoted_message']['body'], '
|
Chris@76
|
1077 </div>
|
Chris@76
|
1078 <span class="botslice"><span></span></span>
|
Chris@76
|
1079 </div><br class="clear" />';
|
Chris@76
|
1080
|
Chris@76
|
1081 echo '
|
Chris@76
|
1082 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/PersonalMessage.js?fin20"></script>
|
Chris@76
|
1083 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
|
Chris@76
|
1084 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
1085 var oPersonalMessageSend = new smf_PersonalMessageSend({
|
Chris@76
|
1086 sSelf: \'oPersonalMessageSend\',
|
Chris@76
|
1087 sSessionId: \'', $context['session_id'], '\',
|
Chris@76
|
1088 sSessionVar: \'', $context['session_var'], '\',
|
Chris@76
|
1089 sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
|
Chris@76
|
1090 sToControlId: \'to_control\',
|
Chris@76
|
1091 aToRecipients: [';
|
Chris@76
|
1092 foreach ($context['recipients']['to'] as $i => $member)
|
Chris@76
|
1093 echo '
|
Chris@76
|
1094 {
|
Chris@76
|
1095 sItemId: ', JavaScriptEscape($member['id']), ',
|
Chris@76
|
1096 sItemName: ', JavaScriptEscape($member['name']), '
|
Chris@76
|
1097 }', $i == count($context['recipients']['to']) - 1 ? '' : ',';
|
Chris@76
|
1098
|
Chris@76
|
1099 echo '
|
Chris@76
|
1100 ],
|
Chris@76
|
1101 aBccRecipients: [';
|
Chris@76
|
1102 foreach ($context['recipients']['bcc'] as $i => $member)
|
Chris@76
|
1103 echo '
|
Chris@76
|
1104 {
|
Chris@76
|
1105 sItemId: ', JavaScriptEscape($member['id']), ',
|
Chris@76
|
1106 sItemName: ', JavaScriptEscape($member['name']), '
|
Chris@76
|
1107 }', $i == count($context['recipients']['bcc']) - 1 ? '' : ',';
|
Chris@76
|
1108
|
Chris@76
|
1109 echo '
|
Chris@76
|
1110 ],
|
Chris@76
|
1111 sBccControlId: \'bcc_control\',
|
Chris@76
|
1112 sBccDivId: \'bcc_div\',
|
Chris@76
|
1113 sBccDivId2: \'bcc_div2\',
|
Chris@76
|
1114 sBccLinkId: \'bcc_link\',
|
Chris@76
|
1115 sBccLinkContainerId: \'bcc_link_container\',
|
Chris@76
|
1116 bBccShowByDefault: ', empty($context['recipients']['bcc']) && empty($context['bcc_value']) ? 'false' : 'true', ',
|
Chris@76
|
1117 sShowBccLinkTemplate: ', JavaScriptEscape('
|
Chris@76
|
1118 <a href="#" id="bcc_link">' . $txt['make_bcc'] . '</a> <a href="' . $scripturl . '?action=helpadmin;help=pm_bcc" onclick="return reqWin(this.href);">(?)</a>'
|
Chris@76
|
1119 ), '
|
Chris@76
|
1120 });
|
Chris@76
|
1121 ';
|
Chris@76
|
1122
|
Chris@76
|
1123 echo '
|
Chris@76
|
1124 // ]]></script>';
|
Chris@76
|
1125 }
|
Chris@76
|
1126
|
Chris@76
|
1127 // This template asks the user whether they wish to empty out their folder/messages.
|
Chris@76
|
1128 function template_ask_delete()
|
Chris@76
|
1129 {
|
Chris@76
|
1130 global $context, $settings, $options, $scripturl, $modSettings, $txt;
|
Chris@76
|
1131
|
Chris@76
|
1132 echo '
|
Chris@76
|
1133 <div class="cat_bar">
|
Chris@76
|
1134 <h3 class="catbg">', ($context['delete_all'] ? $txt['delete_message'] : $txt['delete_all']), '</h3>
|
Chris@76
|
1135 </div>
|
Chris@76
|
1136 <div class="windowbg">
|
Chris@76
|
1137 <span class="topslice"><span></span></span>
|
Chris@76
|
1138 <div class="content">
|
Chris@76
|
1139 <p>', $txt['delete_all_confirm'], '</p><br />
|
Chris@76
|
1140 <strong><a href="', $scripturl, '?action=pm;sa=removeall2;f=', $context['folder'], ';', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="javascript:history.go(-1);">', $txt['no'], '</a></strong>
|
Chris@76
|
1141 </div>
|
Chris@76
|
1142 <span class="botslice"><span></span></span>
|
Chris@76
|
1143 </div>';
|
Chris@76
|
1144 }
|
Chris@76
|
1145
|
Chris@76
|
1146 // This template asks the user what messages they want to prune.
|
Chris@76
|
1147 function template_prune()
|
Chris@76
|
1148 {
|
Chris@76
|
1149 global $context, $settings, $options, $scripturl, $txt;
|
Chris@76
|
1150
|
Chris@76
|
1151 echo '
|
Chris@76
|
1152 <form action="', $scripturl, '?action=pm;sa=prune" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['pm_prune_warning'], '\');">
|
Chris@76
|
1153 <div class="cat_bar">
|
Chris@76
|
1154 <h3 class="catbg">', $txt['pm_prune'], '</h3>
|
Chris@76
|
1155 </div>
|
Chris@76
|
1156 <div class="windowbg">
|
Chris@76
|
1157 <span class="topslice"><span></span></span>
|
Chris@76
|
1158 <div class="content">
|
Chris@76
|
1159 <p>', $txt['pm_prune_desc1'], ' <input type="text" name="age" size="3" value="14" class="input_text" /> ', $txt['pm_prune_desc2'], '</p>
|
Chris@76
|
1160 <div class="righttext">
|
Chris@76
|
1161 <input type="submit" value="', $txt['delete'], '" class="button_submit" />
|
Chris@76
|
1162 </div>
|
Chris@76
|
1163 </div>
|
Chris@76
|
1164 <span class="botslice"><span></span></span>
|
Chris@76
|
1165 </div>
|
Chris@76
|
1166 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
|
Chris@76
|
1167 </form>';
|
Chris@76
|
1168 }
|
Chris@76
|
1169
|
Chris@76
|
1170 // Here we allow the user to setup labels, remove labels and change rules for labels (i.e, do quite a bit)
|
Chris@76
|
1171 function template_labels()
|
Chris@76
|
1172 {
|
Chris@76
|
1173 global $context, $settings, $options, $scripturl, $txt;
|
Chris@76
|
1174
|
Chris@76
|
1175 echo '
|
Chris@76
|
1176 <form action="', $scripturl, '?action=pm;sa=manlabels" method="post" accept-charset="', $context['character_set'], '">
|
Chris@76
|
1177 <div class="cat_bar">
|
Chris@76
|
1178 <h3 class="catbg">', $txt['pm_manage_labels'], '</h3>
|
Chris@76
|
1179 </div>
|
Chris@76
|
1180 <div class="description">
|
Chris@76
|
1181 ', $txt['pm_labels_desc'], '
|
Chris@76
|
1182 </div>
|
Chris@76
|
1183 <table width="100%" class="table_grid">
|
Chris@76
|
1184 <thead>
|
Chris@76
|
1185 <tr class="catbg">
|
Chris@76
|
1186 <th class="lefttext first_th">
|
Chris@76
|
1187 ', $txt['pm_label_name'], '
|
Chris@76
|
1188 </th>
|
Chris@76
|
1189 <th class="centertext last_th" width="4%">';
|
Chris@76
|
1190
|
Chris@76
|
1191 if (count($context['labels']) > 2)
|
Chris@76
|
1192 echo '
|
Chris@76
|
1193 <input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" />';
|
Chris@76
|
1194
|
Chris@76
|
1195 echo '
|
Chris@76
|
1196 </th>
|
Chris@76
|
1197 </tr>
|
Chris@76
|
1198 </thead>
|
Chris@76
|
1199 <tbody>';
|
Chris@76
|
1200 if (count($context['labels']) < 2)
|
Chris@76
|
1201 echo '
|
Chris@76
|
1202 <tr class="windowbg2">
|
Chris@76
|
1203 <td colspan="2" align="center">', $txt['pm_labels_no_exist'], '</td>
|
Chris@76
|
1204 </tr>';
|
Chris@76
|
1205 else
|
Chris@76
|
1206 {
|
Chris@76
|
1207 $alternate = true;
|
Chris@76
|
1208 foreach ($context['labels'] as $label)
|
Chris@76
|
1209 {
|
Chris@76
|
1210 if ($label['id'] == -1)
|
Chris@76
|
1211 continue;
|
Chris@76
|
1212
|
Chris@76
|
1213 echo '
|
Chris@76
|
1214 <tr class="', $alternate ? 'windowbg2' : 'windowbg', '">
|
Chris@76
|
1215 <td>
|
Chris@76
|
1216 <input type="text" name="label_name[', $label['id'], ']" value="', $label['name'], '" size="30" maxlength="30" class="input_text" />
|
Chris@76
|
1217 </td>
|
Chris@76
|
1218 <td width="4%" align="center"><input type="checkbox" class="input_check" name="delete_label[', $label['id'], ']" /></td>
|
Chris@76
|
1219 </tr>';
|
Chris@76
|
1220
|
Chris@76
|
1221 $alternate = !$alternate;
|
Chris@76
|
1222 }
|
Chris@76
|
1223 }
|
Chris@76
|
1224 echo '
|
Chris@76
|
1225 </tbody>
|
Chris@76
|
1226 </table>';
|
Chris@76
|
1227
|
Chris@76
|
1228 if (!count($context['labels']) < 2)
|
Chris@76
|
1229 echo '
|
Chris@76
|
1230 <div class="padding righttext">
|
Chris@76
|
1231 <input type="submit" name="save" value="', $txt['save'], '" class="button_submit" />
|
Chris@76
|
1232 <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" onclick="return confirm(\'', $txt['pm_labels_delete'], '\');" class="button_submit" />
|
Chris@76
|
1233 </div>';
|
Chris@76
|
1234
|
Chris@76
|
1235 echo '
|
Chris@76
|
1236 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
|
Chris@76
|
1237 </form>
|
Chris@76
|
1238 <form action="', $scripturl, '?action=pm;sa=manlabels" method="post" accept-charset="', $context['character_set'], '" style="margin-top: 1ex;">
|
Chris@76
|
1239 <div class="cat_bar">
|
Chris@76
|
1240 <h3 class="catbg">', $txt['pm_label_add_new'], '</h3>
|
Chris@76
|
1241 </div>
|
Chris@76
|
1242 <div class="windowbg">
|
Chris@76
|
1243 <span class="topslice"><span></span></span>
|
Chris@76
|
1244 <div class="content">
|
Chris@76
|
1245 <dl class="settings">
|
Chris@76
|
1246 <dt>
|
Chris@76
|
1247 <strong><label for="add_label">', $txt['pm_label_name'], '</label>:</strong>
|
Chris@76
|
1248 </dt>
|
Chris@76
|
1249 <dd>
|
Chris@76
|
1250 <input type="text" id="add_label" name="label" value="" size="30" maxlength="30" class="input_text" />
|
Chris@76
|
1251 </dd>
|
Chris@76
|
1252 </dl>
|
Chris@76
|
1253 <div class="righttext">
|
Chris@76
|
1254 <input type="submit" name="add" value="', $txt['pm_label_add_new'], '" class="button_submit" />
|
Chris@76
|
1255 </div>
|
Chris@76
|
1256 </div>
|
Chris@76
|
1257 <span class="botslice"><span></span></span>
|
Chris@76
|
1258 </div>
|
Chris@76
|
1259 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
|
Chris@76
|
1260 </form><br />';
|
Chris@76
|
1261 }
|
Chris@76
|
1262
|
Chris@76
|
1263 // Template for reporting a personal message.
|
Chris@76
|
1264 function template_report_message()
|
Chris@76
|
1265 {
|
Chris@76
|
1266 global $context, $settings, $options, $txt, $scripturl;
|
Chris@76
|
1267
|
Chris@76
|
1268 echo '
|
Chris@76
|
1269 <form action="', $scripturl, '?action=pm;sa=report;l=', $context['current_label_id'], '" method="post" accept-charset="', $context['character_set'], '">
|
Chris@76
|
1270 <input type="hidden" name="pmsg" value="', $context['pm_id'], '" />
|
Chris@76
|
1271 <div class="cat_bar">
|
Chris@76
|
1272 <h3 class="catbg">', $txt['pm_report_title'], '</h3>
|
Chris@76
|
1273 </div>
|
Chris@76
|
1274 <div class="description">
|
Chris@76
|
1275 ', $txt['pm_report_desc'], '
|
Chris@76
|
1276 </div>
|
Chris@76
|
1277 <div class="windowbg">
|
Chris@76
|
1278 <span class="topslice"><span></span></span>
|
Chris@76
|
1279 <div class="content">
|
Chris@76
|
1280 <dl class="settings">';
|
Chris@76
|
1281
|
Chris@76
|
1282 // If there is more than one admin on the forum, allow the user to choose the one they want to direct to.
|
Chris@76
|
1283 // !!! Why?
|
Chris@76
|
1284 if ($context['admin_count'] > 1)
|
Chris@76
|
1285 {
|
Chris@76
|
1286 echo '
|
Chris@76
|
1287 <dt>
|
Chris@76
|
1288 <strong>', $txt['pm_report_admins'], ':</strong>
|
Chris@76
|
1289 </dt>
|
Chris@76
|
1290 <dd>
|
Chris@76
|
1291 <select name="ID_ADMIN">
|
Chris@76
|
1292 <option value="0">', $txt['pm_report_all_admins'], '</option>';
|
Chris@76
|
1293 foreach ($context['admins'] as $id => $name)
|
Chris@76
|
1294 echo '
|
Chris@76
|
1295 <option value="', $id, '">', $name, '</option>';
|
Chris@76
|
1296 echo '
|
Chris@76
|
1297 </select>
|
Chris@76
|
1298 </dd>';
|
Chris@76
|
1299 }
|
Chris@76
|
1300
|
Chris@76
|
1301 echo '
|
Chris@76
|
1302 <dt>
|
Chris@76
|
1303 <strong>', $txt['pm_report_reason'], ':</strong>
|
Chris@76
|
1304 </dt>
|
Chris@76
|
1305 <dd>
|
Chris@76
|
1306 <textarea name="reason" rows="4" cols="70" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 80%; min-width: 80%' : 'width: 80%') . ';"></textarea>
|
Chris@76
|
1307 </dd>
|
Chris@76
|
1308 </dl>
|
Chris@76
|
1309 <div class="righttext">
|
Chris@76
|
1310 <input type="submit" name="report" value="', $txt['pm_report_message'], '" class="button_submit" />
|
Chris@76
|
1311 </div>
|
Chris@76
|
1312 </div>
|
Chris@76
|
1313 <span class="botslice"><span></span></span>
|
Chris@76
|
1314 </div>
|
Chris@76
|
1315 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
|
Chris@76
|
1316 </form>';
|
Chris@76
|
1317 }
|
Chris@76
|
1318
|
Chris@76
|
1319 // Little template just to say "Yep, it's been submitted"
|
Chris@76
|
1320 function template_report_message_complete()
|
Chris@76
|
1321 {
|
Chris@76
|
1322 global $context, $settings, $options, $txt, $scripturl;
|
Chris@76
|
1323
|
Chris@76
|
1324 echo '
|
Chris@76
|
1325 <div class="cat_bar">
|
Chris@76
|
1326 <h3 class="catbg">', $txt['pm_report_title'], '</h3>
|
Chris@76
|
1327 </div>
|
Chris@76
|
1328 <div class="windowbg">
|
Chris@76
|
1329 <span class="topslice"><span></span></span>
|
Chris@76
|
1330 <div class="content">
|
Chris@76
|
1331 <p>', $txt['pm_report_done'], '</p>
|
Chris@76
|
1332 <a href="', $scripturl, '?action=pm;l=', $context['current_label_id'], '">', $txt['pm_report_return'], '</a>
|
Chris@76
|
1333 </div>
|
Chris@76
|
1334 <span class="botslice"><span></span></span>
|
Chris@76
|
1335 </div>';
|
Chris@76
|
1336 }
|
Chris@76
|
1337
|
Chris@76
|
1338 // Manage rules.
|
Chris@76
|
1339 function template_rules()
|
Chris@76
|
1340 {
|
Chris@76
|
1341 global $context, $settings, $options, $txt, $scripturl;
|
Chris@76
|
1342
|
Chris@76
|
1343 echo '
|
Chris@76
|
1344 <form action="', $scripturl, '?action=pm;sa=manrules" method="post" accept-charset="', $context['character_set'], '" name="manRules" id="manrules">
|
Chris@76
|
1345 <div class="cat_bar">
|
Chris@76
|
1346 <h3 class="catbg">', $txt['pm_manage_rules'], '</h3>
|
Chris@76
|
1347 </div>
|
Chris@76
|
1348 <div class="description">
|
Chris@76
|
1349 ', $txt['pm_manage_rules_desc'], '
|
Chris@76
|
1350 </div>
|
Chris@76
|
1351 <table width="100%" class="table_grid">
|
Chris@76
|
1352 <thead>
|
Chris@76
|
1353 <tr class="catbg">
|
Chris@76
|
1354 <th class="lefttext first_th">
|
Chris@76
|
1355 ', $txt['pm_rule_title'], '
|
Chris@76
|
1356 </th>
|
Chris@76
|
1357 <th width="4%" class="centertext last_th">';
|
Chris@76
|
1358
|
Chris@76
|
1359 if (!empty($context['rules']))
|
Chris@76
|
1360 echo '
|
Chris@76
|
1361 <input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />';
|
Chris@76
|
1362
|
Chris@76
|
1363 echo '
|
Chris@76
|
1364 </th>
|
Chris@76
|
1365 </tr>
|
Chris@76
|
1366 </thead>
|
Chris@76
|
1367 <tbody>';
|
Chris@76
|
1368
|
Chris@76
|
1369 if (empty($context['rules']))
|
Chris@76
|
1370 echo '
|
Chris@76
|
1371 <tr class="windowbg2">
|
Chris@76
|
1372 <td colspan="2" align="center">
|
Chris@76
|
1373 ', $txt['pm_rules_none'], '
|
Chris@76
|
1374 </td>
|
Chris@76
|
1375 </tr>';
|
Chris@76
|
1376
|
Chris@76
|
1377 $alternate = false;
|
Chris@76
|
1378 foreach ($context['rules'] as $rule)
|
Chris@76
|
1379 {
|
Chris@76
|
1380 echo '
|
Chris@76
|
1381 <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
|
Chris@76
|
1382 <td>
|
Chris@76
|
1383 <a href="', $scripturl, '?action=pm;sa=manrules;add;rid=', $rule['id'], '">', $rule['name'], '</a>
|
Chris@76
|
1384 </td>
|
Chris@76
|
1385 <td width="4%" align="center">
|
Chris@76
|
1386 <input type="checkbox" name="delrule[', $rule['id'], ']" class="input_check" />
|
Chris@76
|
1387 </td>
|
Chris@76
|
1388 </tr>';
|
Chris@76
|
1389 $alternate = !$alternate;
|
Chris@76
|
1390 }
|
Chris@76
|
1391
|
Chris@76
|
1392 echo '
|
Chris@76
|
1393 </tbody>
|
Chris@76
|
1394 </table>
|
Chris@76
|
1395 <div class="righttext">
|
Chris@76
|
1396 [<a href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>]';
|
Chris@76
|
1397
|
Chris@76
|
1398 if (!empty($context['rules']))
|
Chris@76
|
1399 echo '
|
Chris@76
|
1400 [<a href="', $scripturl, '?action=pm;sa=manrules;apply;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['pm_js_apply_rules_confirm'], '\');">', $txt['pm_apply_rules'], '</a>]';
|
Chris@76
|
1401
|
Chris@76
|
1402 if (!empty($context['rules']))
|
Chris@76
|
1403 echo '
|
Chris@76
|
1404 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
|
Chris@76
|
1405 <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" onclick="return confirm(\'', $txt['pm_js_delete_rule_confirm'], '\');" class="button_submit smalltext" />';
|
Chris@76
|
1406
|
Chris@76
|
1407 echo '
|
Chris@76
|
1408 </div>
|
Chris@76
|
1409 </form>';
|
Chris@76
|
1410
|
Chris@76
|
1411 }
|
Chris@76
|
1412
|
Chris@76
|
1413 // Template for adding/editing a rule.
|
Chris@76
|
1414 function template_add_rule()
|
Chris@76
|
1415 {
|
Chris@76
|
1416 global $context, $settings, $options, $txt, $scripturl;
|
Chris@76
|
1417
|
Chris@76
|
1418 echo '
|
Chris@76
|
1419 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
1420 var criteriaNum = 0;
|
Chris@76
|
1421 var actionNum = 0;
|
Chris@76
|
1422 var groups = new Array()
|
Chris@76
|
1423 var labels = new Array()';
|
Chris@76
|
1424
|
Chris@76
|
1425 foreach ($context['groups'] as $id => $title)
|
Chris@76
|
1426 echo '
|
Chris@76
|
1427 groups[', $id, '] = "', addslashes($title), '";';
|
Chris@76
|
1428
|
Chris@76
|
1429 foreach ($context['labels'] as $label)
|
Chris@76
|
1430 if ($label['id'] != -1)
|
Chris@76
|
1431 echo '
|
Chris@76
|
1432 labels[', ($label['id'] + 1), '] = "', addslashes($label['name']), '";';
|
Chris@76
|
1433
|
Chris@76
|
1434 echo '
|
Chris@76
|
1435 function addCriteriaOption()
|
Chris@76
|
1436 {
|
Chris@76
|
1437 if (criteriaNum == 0)
|
Chris@76
|
1438 {
|
Chris@76
|
1439 for (var i = 0; i < document.forms.addrule.elements.length; i++)
|
Chris@76
|
1440 if (document.forms.addrule.elements[i].id.substr(0, 8) == "ruletype")
|
Chris@76
|
1441 criteriaNum++;
|
Chris@76
|
1442 }
|
Chris@76
|
1443 criteriaNum++
|
Chris@76
|
1444
|
Chris@76
|
1445 setOuterHTML(document.getElementById("criteriaAddHere"), \'<br /><select name="ruletype[\' + criteriaNum + \']" id="ruletype\' + criteriaNum + \'" onchange="updateRuleDef(\' + criteriaNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_criteria_pick']), ':<\' + \'/option><option value="mid">', addslashes($txt['pm_rule_mid']), '<\' + \'/option><option value="gid">', addslashes($txt['pm_rule_gid']), '<\' + \'/option><option value="sub">', addslashes($txt['pm_rule_sub']), '<\' + \'/option><option value="msg">', addslashes($txt['pm_rule_msg']), '<\' + \'/option><option value="bud">', addslashes($txt['pm_rule_bud']), '<\' + \'/option><\' + \'/select> <span id="defdiv\' + criteriaNum + \'" style="display: none;"><input type="text" name="ruledef[\' + criteriaNum + \']" id="ruledef\' + criteriaNum + \'" onkeyup="rebuildRuleDesc();" value="" class="input_text" /><\' + \'/span><span id="defseldiv\' + criteriaNum + \'" style="display: none;"><select name="ruledefgroup[\' + criteriaNum + \']" id="ruledefgroup\' + criteriaNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_group']), '<\' + \'/option>';
|
Chris@76
|
1446
|
Chris@76
|
1447 foreach ($context['groups'] as $id => $group)
|
Chris@76
|
1448 echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>';
|
Chris@76
|
1449
|
Chris@76
|
1450 echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\');
|
Chris@76
|
1451 }
|
Chris@76
|
1452
|
Chris@76
|
1453 function addActionOption()
|
Chris@76
|
1454 {
|
Chris@76
|
1455 if (actionNum == 0)
|
Chris@76
|
1456 {
|
Chris@76
|
1457 for (var i = 0; i < document.forms.addrule.elements.length; i++)
|
Chris@76
|
1458 if (document.forms.addrule.elements[i].id.substr(0, 7) == "acttype")
|
Chris@76
|
1459 actionNum++;
|
Chris@76
|
1460 }
|
Chris@76
|
1461 actionNum++
|
Chris@76
|
1462
|
Chris@76
|
1463 setOuterHTML(document.getElementById("actionAddHere"), \'<br /><select name="acttype[\' + actionNum + \']" id="acttype\' + actionNum + \'" onchange="updateActionDef(\' + actionNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_action']), ':<\' + \'/option><option value="lab">', addslashes($txt['pm_rule_label']), '<\' + \'/option><option value="del">', addslashes($txt['pm_rule_delete']), '<\' + \'/option><\' + \'/select> <span id="labdiv\' + actionNum + \'" style="display: none;"><select name="labdef[\' + actionNum + \']" id="labdef\' + actionNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_label']), '<\' + \'/option>';
|
Chris@76
|
1464
|
Chris@76
|
1465 foreach ($context['labels'] as $label)
|
Chris@76
|
1466 if ($label['id'] != -1)
|
Chris@76
|
1467 echo '<option value="', ($label['id'] + 1), '">', addslashes($label['name']), '<\' + \'/option>';
|
Chris@76
|
1468
|
Chris@76
|
1469 echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\');
|
Chris@76
|
1470 }
|
Chris@76
|
1471
|
Chris@76
|
1472 function updateRuleDef(optNum)
|
Chris@76
|
1473 {
|
Chris@76
|
1474 if (document.getElementById("ruletype" + optNum).value == "gid")
|
Chris@76
|
1475 {
|
Chris@76
|
1476 document.getElementById("defdiv" + optNum).style.display = "none";
|
Chris@76
|
1477 document.getElementById("defseldiv" + optNum).style.display = "";
|
Chris@76
|
1478 }
|
Chris@76
|
1479 else if (document.getElementById("ruletype" + optNum).value == "bud" || document.getElementById("ruletype" + optNum).value == "")
|
Chris@76
|
1480 {
|
Chris@76
|
1481 document.getElementById("defdiv" + optNum).style.display = "none";
|
Chris@76
|
1482 document.getElementById("defseldiv" + optNum).style.display = "none";
|
Chris@76
|
1483 }
|
Chris@76
|
1484 else
|
Chris@76
|
1485 {
|
Chris@76
|
1486 document.getElementById("defdiv" + optNum).style.display = "";
|
Chris@76
|
1487 document.getElementById("defseldiv" + optNum).style.display = "none";
|
Chris@76
|
1488 }
|
Chris@76
|
1489 }
|
Chris@76
|
1490
|
Chris@76
|
1491 function updateActionDef(optNum)
|
Chris@76
|
1492 {
|
Chris@76
|
1493 if (document.getElementById("acttype" + optNum).value == "lab")
|
Chris@76
|
1494 {
|
Chris@76
|
1495 document.getElementById("labdiv" + optNum).style.display = "";
|
Chris@76
|
1496 }
|
Chris@76
|
1497 else
|
Chris@76
|
1498 {
|
Chris@76
|
1499 document.getElementById("labdiv" + optNum).style.display = "none";
|
Chris@76
|
1500 }
|
Chris@76
|
1501 }
|
Chris@76
|
1502
|
Chris@76
|
1503 // Rebuild the rule description!
|
Chris@76
|
1504 function rebuildRuleDesc()
|
Chris@76
|
1505 {
|
Chris@76
|
1506 // Start with nothing.
|
Chris@76
|
1507 var text = "";
|
Chris@76
|
1508 var joinText = "";
|
Chris@76
|
1509 var actionText = "";
|
Chris@76
|
1510 var hadBuddy = false;
|
Chris@76
|
1511 var foundCriteria = false;
|
Chris@76
|
1512 var foundAction = false;
|
Chris@76
|
1513 var curNum, curVal, curDef;
|
Chris@76
|
1514
|
Chris@76
|
1515 for (var i = 0; i < document.forms.addrule.elements.length; i++)
|
Chris@76
|
1516 {
|
Chris@76
|
1517 if (document.forms.addrule.elements[i].id.substr(0, 8) == "ruletype")
|
Chris@76
|
1518 {
|
Chris@76
|
1519 if (foundCriteria)
|
Chris@76
|
1520 joinText = document.getElementById("logic").value == \'and\' ? ', JavaScriptEscape(' ' . $txt['pm_readable_and'] . ' '), ' : ', JavaScriptEscape(' ' . $txt['pm_readable_or'] . ' '), ';
|
Chris@76
|
1521 else
|
Chris@76
|
1522 joinText = \'\';
|
Chris@76
|
1523 foundCriteria = true;
|
Chris@76
|
1524
|
Chris@76
|
1525 curNum = document.forms.addrule.elements[i].id.match(/\d+/);
|
Chris@76
|
1526 curVal = document.forms.addrule.elements[i].value;
|
Chris@76
|
1527 if (curVal == "gid")
|
Chris@76
|
1528 curDef = document.getElementById("ruledefgroup" + curNum).value.php_htmlspecialchars();
|
Chris@76
|
1529 else if (curVal != "bud")
|
Chris@76
|
1530 curDef = document.getElementById("ruledef" + curNum).value.php_htmlspecialchars();
|
Chris@76
|
1531 else
|
Chris@76
|
1532 curDef = "";
|
Chris@76
|
1533
|
Chris@76
|
1534 // What type of test is this?
|
Chris@76
|
1535 if (curVal == "mid" && curDef)
|
Chris@76
|
1536 text += joinText + ', JavaScriptEscape($txt['pm_readable_member']), '.replace("{MEMBER}", curDef);
|
Chris@76
|
1537 else if (curVal == "gid" && curDef && groups[curDef])
|
Chris@76
|
1538 text += joinText + ', JavaScriptEscape($txt['pm_readable_group']), '.replace("{GROUP}", groups[curDef]);
|
Chris@76
|
1539 else if (curVal == "sub" && curDef)
|
Chris@76
|
1540 text += joinText + ', JavaScriptEscape($txt['pm_readable_subject']), '.replace("{SUBJECT}", curDef);
|
Chris@76
|
1541 else if (curVal == "msg" && curDef)
|
Chris@76
|
1542 text += joinText + ', JavaScriptEscape($txt['pm_readable_body']), '.replace("{BODY}", curDef);
|
Chris@76
|
1543 else if (curVal == "bud" && !hadBuddy)
|
Chris@76
|
1544 {
|
Chris@76
|
1545 text += joinText + ', JavaScriptEscape($txt['pm_readable_buddy']), ';
|
Chris@76
|
1546 hadBuddy = true;
|
Chris@76
|
1547 }
|
Chris@76
|
1548 }
|
Chris@76
|
1549 if (document.forms.addrule.elements[i].id.substr(0, 7) == "acttype")
|
Chris@76
|
1550 {
|
Chris@76
|
1551 if (foundAction)
|
Chris@76
|
1552 joinText = ', JavaScriptEscape(' ' . $txt['pm_readable_and'] . ' '), ';
|
Chris@76
|
1553 else
|
Chris@76
|
1554 joinText = "";
|
Chris@76
|
1555 foundAction = true;
|
Chris@76
|
1556
|
Chris@76
|
1557 curNum = document.forms.addrule.elements[i].id.match(/\d+/);
|
Chris@76
|
1558 curVal = document.forms.addrule.elements[i].value;
|
Chris@76
|
1559 if (curVal == "lab")
|
Chris@76
|
1560 curDef = document.getElementById("labdef" + curNum).value.php_htmlspecialchars();
|
Chris@76
|
1561 else
|
Chris@76
|
1562 curDef = "";
|
Chris@76
|
1563
|
Chris@76
|
1564 // Now pick the actions.
|
Chris@76
|
1565 if (curVal == "lab" && curDef && labels[curDef])
|
Chris@76
|
1566 actionText += joinText + ', JavaScriptEscape($txt['pm_readable_label']), '.replace("{LABEL}", labels[curDef]);
|
Chris@76
|
1567 else if (curVal == "del")
|
Chris@76
|
1568 actionText += joinText + ', JavaScriptEscape($txt['pm_readable_delete']), ';
|
Chris@76
|
1569 }
|
Chris@76
|
1570 }
|
Chris@76
|
1571
|
Chris@76
|
1572 // If still nothing make it default!
|
Chris@76
|
1573 if (text == "" || !foundCriteria)
|
Chris@76
|
1574 text = "', $txt['pm_rule_not_defined'], '";
|
Chris@76
|
1575 else
|
Chris@76
|
1576 {
|
Chris@76
|
1577 if (actionText != "")
|
Chris@76
|
1578 text += ', JavaScriptEscape(' ' . $txt['pm_readable_then'] . ' '), ' + actionText;
|
Chris@76
|
1579 text = ', JavaScriptEscape($txt['pm_readable_start']), ' + text + ', JavaScriptEscape($txt['pm_readable_end']), ';
|
Chris@76
|
1580 }
|
Chris@76
|
1581
|
Chris@76
|
1582 // Set the actual HTML!
|
Chris@76
|
1583 setInnerHTML(document.getElementById("ruletext"), text);
|
Chris@76
|
1584 }
|
Chris@76
|
1585 // ]]></script>';
|
Chris@76
|
1586
|
Chris@76
|
1587 echo '
|
Chris@76
|
1588 <form action="', $scripturl, '?action=pm;sa=manrules;save;rid=', $context['rid'], '" method="post" accept-charset="', $context['character_set'], '" name="addrule" id="addrule" class="flow_hidden">
|
Chris@76
|
1589 <div class="cat_bar">
|
Chris@76
|
1590 <h3 class="catbg">', $context['rid'] == 0 ? $txt['pm_add_rule'] : $txt['pm_edit_rule'], '</h3>
|
Chris@76
|
1591 </div>
|
Chris@76
|
1592 <div class="windowbg">
|
Chris@76
|
1593 <span class="topslice"><span></span></span>
|
Chris@76
|
1594 <div class="content">
|
Chris@76
|
1595 <dl class="addrules">
|
Chris@76
|
1596 <dt class="floatleft">
|
Chris@76
|
1597 <strong>', $txt['pm_rule_name'], ':</strong><br />
|
Chris@76
|
1598 <span class="smalltext">', $txt['pm_rule_name_desc'], '</span>
|
Chris@76
|
1599 </dt>
|
Chris@76
|
1600 <dd class="floatleft">
|
Chris@76
|
1601 <input type="text" name="rule_name" value="', empty($context['rule']['name']) ? $txt['pm_rule_name_default'] : $context['rule']['name'], '" size="50" class="input_text" />
|
Chris@76
|
1602 </dd>
|
Chris@76
|
1603 </dl>
|
Chris@76
|
1604 <fieldset>
|
Chris@76
|
1605 <legend>', $txt['pm_rule_criteria'], '</legend>';
|
Chris@76
|
1606
|
Chris@76
|
1607 // Add a dummy criteria to allow expansion for none js users.
|
Chris@76
|
1608 $context['rule']['criteria'][] = array('t' => '', 'v' => '');
|
Chris@76
|
1609
|
Chris@76
|
1610 // For each criteria print it out.
|
Chris@76
|
1611 $isFirst = true;
|
Chris@76
|
1612 foreach ($context['rule']['criteria'] as $k => $criteria)
|
Chris@76
|
1613 {
|
Chris@76
|
1614 if (!$isFirst && $criteria['t'] == '')
|
Chris@76
|
1615 echo '<div id="removeonjs1">';
|
Chris@76
|
1616 elseif (!$isFirst)
|
Chris@76
|
1617 echo '<br />';
|
Chris@76
|
1618
|
Chris@76
|
1619 echo '
|
Chris@76
|
1620 <select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();">
|
Chris@76
|
1621 <option value="">', $txt['pm_rule_criteria_pick'], ':</option>
|
Chris@76
|
1622 <option value="mid" ', $criteria['t'] == 'mid' ? 'selected="selected"' : '', '>', $txt['pm_rule_mid'], '</option>
|
Chris@76
|
1623 <option value="gid" ', $criteria['t'] == 'gid' ? 'selected="selected"' : '', '>', $txt['pm_rule_gid'], '</option>
|
Chris@76
|
1624 <option value="sub" ', $criteria['t'] == 'sub' ? 'selected="selected"' : '', '>', $txt['pm_rule_sub'], '</option>
|
Chris@76
|
1625 <option value="msg" ', $criteria['t'] == 'msg' ? 'selected="selected"' : '', '>', $txt['pm_rule_msg'], '</option>
|
Chris@76
|
1626 <option value="bud" ', $criteria['t'] == 'bud' ? 'selected="selected"' : '', '>', $txt['pm_rule_bud'], '</option>
|
Chris@76
|
1627 </select>
|
Chris@76
|
1628 <span id="defdiv', $k, '" ', !in_array($criteria['t'], array('gid', 'bud')) ? '' : 'style="display: none;"', '>
|
Chris@76
|
1629 <input type="text" name="ruledef[', $k, ']" id="ruledef', $k, '" onkeyup="rebuildRuleDesc();" value="', in_array($criteria['t'], array('mid', 'sub', 'msg')) ? $criteria['v'] : '', '" class="input_text" />
|
Chris@76
|
1630 </span>
|
Chris@76
|
1631 <span id="defseldiv', $k, '" ', $criteria['t'] == 'gid' ? '' : 'style="display: none;"', '>
|
Chris@76
|
1632 <select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();">
|
Chris@76
|
1633 <option value="">', $txt['pm_rule_sel_group'], '</option>';
|
Chris@76
|
1634
|
Chris@76
|
1635 foreach ($context['groups'] as $id => $group)
|
Chris@76
|
1636 echo '
|
Chris@76
|
1637 <option value="', $id, '" ', $criteria['t'] == 'gid' && $criteria['v'] == $id ? 'selected="selected"' : '', '>', $group, '</option>';
|
Chris@76
|
1638 echo '
|
Chris@76
|
1639 </select>
|
Chris@76
|
1640 </span>';
|
Chris@76
|
1641
|
Chris@76
|
1642 // If this is the dummy we add a means to hide for non js users.
|
Chris@76
|
1643 if ($isFirst)
|
Chris@76
|
1644 $isFirst = false;
|
Chris@76
|
1645 elseif ($criteria['t'] == '')
|
Chris@76
|
1646 echo '</div>';
|
Chris@76
|
1647 }
|
Chris@76
|
1648
|
Chris@76
|
1649 echo '
|
Chris@76
|
1650 <span id="criteriaAddHere"></span><br />
|
Chris@76
|
1651 <a href="#" onclick="addCriteriaOption(); return false;" id="addonjs1" style="display: none;">(', $txt['pm_rule_criteria_add'], ')</a>
|
Chris@76
|
1652 <br /><br />
|
Chris@76
|
1653 ', $txt['pm_rule_logic'], ':
|
Chris@76
|
1654 <select name="rule_logic" id="logic" onchange="rebuildRuleDesc();">
|
Chris@76
|
1655 <option value="and" ', $context['rule']['logic'] == 'and' ? 'selected="selected"' : '', '>', $txt['pm_rule_logic_and'], '</option>
|
Chris@76
|
1656 <option value="or" ', $context['rule']['logic'] == 'or' ? 'selected="selected"' : '', '>', $txt['pm_rule_logic_or'], '</option>
|
Chris@76
|
1657 </select>
|
Chris@76
|
1658 </fieldset>
|
Chris@76
|
1659 <fieldset>
|
Chris@76
|
1660 <legend>', $txt['pm_rule_actions'], '</legend>';
|
Chris@76
|
1661
|
Chris@76
|
1662 // As with criteria - add a dummy action for "expansion".
|
Chris@76
|
1663 $context['rule']['actions'][] = array('t' => '', 'v' => '');
|
Chris@76
|
1664
|
Chris@76
|
1665 // Print each action.
|
Chris@76
|
1666 $isFirst = true;
|
Chris@76
|
1667 foreach ($context['rule']['actions'] as $k => $action)
|
Chris@76
|
1668 {
|
Chris@76
|
1669 if (!$isFirst && $action['t'] == '')
|
Chris@76
|
1670 echo '<div id="removeonjs2">';
|
Chris@76
|
1671 elseif (!$isFirst)
|
Chris@76
|
1672 echo '<br />';
|
Chris@76
|
1673
|
Chris@76
|
1674 echo '
|
Chris@76
|
1675 <select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();">
|
Chris@76
|
1676 <option value="">', $txt['pm_rule_sel_action'] , ':</option>
|
Chris@76
|
1677 <option value="lab" ', $action['t'] == 'lab' ? 'selected="selected"' : '', '>', $txt['pm_rule_label'] , '</option>
|
Chris@76
|
1678 <option value="del" ', $action['t'] == 'del' ? 'selected="selected"' : '', '>', $txt['pm_rule_delete'] , '</option>
|
Chris@76
|
1679 </select>
|
Chris@76
|
1680 <span id="labdiv', $k, '">
|
Chris@76
|
1681 <select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();">
|
Chris@76
|
1682 <option value="">', $txt['pm_rule_sel_label'], '</option>';
|
Chris@76
|
1683 foreach ($context['labels'] as $label)
|
Chris@76
|
1684 if ($label['id'] != -1)
|
Chris@76
|
1685 echo '
|
Chris@76
|
1686 <option value="', ($label['id'] + 1), '" ', $action['t'] == 'lab' && $action['v'] == $label['id'] ? 'selected="selected"' : '', '>', $label['name'], '</option>';
|
Chris@76
|
1687
|
Chris@76
|
1688 echo '
|
Chris@76
|
1689 </select>
|
Chris@76
|
1690 </span>';
|
Chris@76
|
1691
|
Chris@76
|
1692 if ($isFirst)
|
Chris@76
|
1693 $isFirst = false;
|
Chris@76
|
1694 elseif ($action['t'] == '')
|
Chris@76
|
1695 echo '
|
Chris@76
|
1696 </div>';
|
Chris@76
|
1697 }
|
Chris@76
|
1698
|
Chris@76
|
1699 echo '
|
Chris@76
|
1700 <span id="actionAddHere"></span><br />
|
Chris@76
|
1701 <a href="#" onclick="addActionOption(); return false;" id="addonjs2" style="display: none;">(', $txt['pm_rule_add_action'], ')</a>
|
Chris@76
|
1702 </fieldset>
|
Chris@76
|
1703 </div>
|
Chris@76
|
1704 <span class="botslice"><span></span></span>
|
Chris@76
|
1705 </div><br class="clear" />
|
Chris@76
|
1706 <div class="cat_bar">
|
Chris@76
|
1707 <h3 class="catbg">', $txt['pm_rule_description'], '</h3>
|
Chris@76
|
1708 </div>
|
Chris@76
|
1709 <div class="information">
|
Chris@76
|
1710 <div id="ruletext">', $txt['pm_rule_js_disabled'], '</div>
|
Chris@76
|
1711 </div>
|
Chris@76
|
1712 <div class="righttext">
|
Chris@76
|
1713 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
|
Chris@76
|
1714 <input type="submit" name="save" value="', $txt['pm_rule_save'], '" class="button_submit" />
|
Chris@76
|
1715 </div>
|
Chris@76
|
1716 </form>';
|
Chris@76
|
1717
|
Chris@76
|
1718 // Now setup all the bits!
|
Chris@76
|
1719 echo '
|
Chris@76
|
1720 <script type="text/javascript"><!-- // --><![CDATA[';
|
Chris@76
|
1721
|
Chris@76
|
1722 foreach ($context['rule']['criteria'] as $k => $c)
|
Chris@76
|
1723 echo '
|
Chris@76
|
1724 updateRuleDef(', $k, ');';
|
Chris@76
|
1725
|
Chris@76
|
1726 foreach ($context['rule']['actions'] as $k => $c)
|
Chris@76
|
1727 echo '
|
Chris@76
|
1728 updateActionDef(', $k, ');';
|
Chris@76
|
1729
|
Chris@76
|
1730 echo '
|
Chris@76
|
1731 rebuildRuleDesc();';
|
Chris@76
|
1732
|
Chris@76
|
1733 // If this isn't a new rule and we have JS enabled remove the JS compatibility stuff.
|
Chris@76
|
1734 if ($context['rid'])
|
Chris@76
|
1735 echo '
|
Chris@76
|
1736 document.getElementById("removeonjs1").style.display = "none";
|
Chris@76
|
1737 document.getElementById("removeonjs2").style.display = "none";';
|
Chris@76
|
1738
|
Chris@76
|
1739 echo '
|
Chris@76
|
1740 document.getElementById("addonjs1").style.display = "";
|
Chris@76
|
1741 document.getElementById("addonjs2").style.display = "";';
|
Chris@76
|
1742
|
Chris@76
|
1743 echo '
|
Chris@76
|
1744 // ]]></script>';
|
Chris@76
|
1745 }
|
Chris@76
|
1746
|
Chris@76
|
1747 ?> |