-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PersonalMessage.template.php
1993 lines (1732 loc) · 71.2 KB
/
PersonalMessage.template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Simple Machines Forum (SMF)
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2022 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.1.3
*/
/**
* This is for stuff above the menu in the personal messages section
*/
function template_pm_above()
{
global $context, $txt;
echo '
<div id="personal_messages">';
// Show the capacity bar, if available.
if (!empty($context['limit_bar']))
echo '
<div class="cat_bar">
<h3 class="catbg">
<span class="floatleft">', $txt['pm_capacity'], ':</span>
<span class="floatleft capacity_bar">
<span class="', $context['limit_bar']['percent'] > 85 ? 'full' : ($context['limit_bar']['percent'] > 40 ? 'filled' : 'empty'), '" style="width: ', $context['limit_bar']['percent'] / 10, 'em;"></span>
</span>
<span class="floatright', $context['limit_bar']['percent'] > 90 ? ' alert' : '', '">', $context['limit_bar']['text'], '</span>
</h3>
</div>';
// Message sent? Show a small indication.
if (isset($context['pm_sent']))
echo '
<div class="infobox">
', $txt['pm_sent'], '
</div>';
}
/**
* Just the end of the index bar, nothing special.
*/
function template_pm_below()
{
echo '
</div><!-- #personal_messages -->';
}
/**
* Displays a popup with information about your personal messages
*/
function template_pm_popup()
{
global $context, $txt, $scripturl;
// Unlike almost every other template, this is designed to be included into the HTML directly via $().load()
echo '
<div class="pm_bar">
<div class="pm_sending block">
', $context['can_send_pm'] ? '<a href="' . $scripturl . '?action=pm;sa=send">' . $txt['pm_new_short'] . '</a>' : '', '
', $context['can_draft'] ? ' | <a href="' . $scripturl . '?action=pm;sa=showpmdrafts">' . $txt['pm_drafts_short'] . '</a>' : '', '
<a href="', $scripturl, '?action=pm;sa=settings" class="floatright">', $txt['pm_settings_short'], '</a>
</div>
<div class="pm_mailbox centertext">
<a href="', $scripturl, '?action=pm" class="button">', $txt['inbox'], '</a>
<a href="', $scripturl, '?action=pm;f=sent" class="button">', $txt['sent_items'], '</a>
</div>
</div>
<div class="pm_unread">';
if (empty($context['unread_pms']))
echo '
<div class="no_unread">', $txt['pm_no_unread'], '</div>';
else
{
foreach ($context['unread_pms'] as $id_pm => $pm_details)
echo '
<div class="unread_notify">
<div class="unread_notify_image">
', !empty($pm_details['member']) ? $pm_details['member']['avatar']['image'] : '', '
</div>
<div class="details">
<div class="subject">', $pm_details['pm_link'], '</div>
<div class="sender">
', $pm_details['replied_to_you'] ? '<span class="main_icons replied centericon" style="margin-right: 4px" title="' . $txt['pm_you_were_replied_to'] . '"></span>' : '<span class="main_icons im_off centericon" style="margin-right: 4px" title="' . $txt['pm_was_sent_to_you'] . '"></span>',
!empty($pm_details['member']) ? $pm_details['member']['link'] : $pm_details['member_from'], ' - ', $pm_details['time'], '
</div>
</div>
</div>';
}
echo '
</div><!-- #pm_unread -->';
}
/**
* Shows a particular folder (eg inbox or outbox), all the PMs in it, etc.
*/
function template_folder()
{
global $context, $scripturl, $txt;
// The every helpful javascript!
echo '
<script>
var allLabels = {};
var currentLabels = {};
function loadLabelChoices()
{
var listing = document.forms.pmFolder.elements;
var theSelect = document.forms.pmFolder.pm_action;
var add, remove, toAdd = {length: 0}, toRemove = {length: 0};
if (theSelect.childNodes.length == 0)
return;
// This is done this way for internationalization reasons.
if (!(\'-1\' in allLabels))
{
for (var o = 0; o < theSelect.options.length; o++)
if (theSelect.options[o].value.substr(0, 4) == "rem_")
allLabels[theSelect.options[o].value.substr(4)] = theSelect.options[o].text;
}
for (var i = 0; i < listing.length; i++)
{
if (listing[i].name != "pms[]" || !listing[i].checked)
continue;
var alreadyThere = [], x;
for (x in currentLabels[listing[i].value])
{
if (!(x in toRemove))
{
toRemove[x] = allLabels[x];
toRemove.length++;
}
alreadyThere[x] = allLabels[x];
}
for (x in allLabels)
{
if (!(x in alreadyThere))
{
toAdd[x] = allLabels[x];
toAdd.length++;
}
}
}
while (theSelect.options.length > 2)
theSelect.options[2] = null;
if (toAdd.length != 0)
{
theSelect.options[theSelect.options.length] = new Option("', $txt['pm_msg_label_apply'], '", "");
setInnerHTML(theSelect.options[theSelect.options.length - 1], "', $txt['pm_msg_label_apply'], '");
theSelect.options[theSelect.options.length - 1].disabled = true;
for (i in toAdd)
{
if (i != "length")
theSelect.options[theSelect.options.length] = new Option(toAdd[i], "add_" + i);
}
}
if (toRemove.length != 0)
{
theSelect.options[theSelect.options.length] = new Option("', $txt['pm_msg_label_remove'], '", "");
setInnerHTML(theSelect.options[theSelect.options.length - 1], "', $txt['pm_msg_label_remove'], '");
theSelect.options[theSelect.options.length - 1].disabled = true;
for (i in toRemove)
{
if (i != "length")
theSelect.options[theSelect.options.length] = new Option(toRemove[i], "rem_" + i);
}
}
}
</script>';
echo '
<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" id="pmFolder">';
// If we are not in single display mode show the subjects on the top!
if ($context['display_mode'] != 1)
{
template_subject_list();
echo '
<div class="clear_right"><br></div>';
}
// Got some messages to display?
if ($context['get_pmessage']('message', true))
{
// Show a few buttons if we are in conversation mode and outputting the first message.
if ($context['display_mode'] == 2)
{
// This bit uses info set in template_subject_list, so it's wrapped
// in an if just in case a mod or custom theme breaks it.
if (!empty($context['current_pm_subject']))
{
echo '
<div class="cat_bar">
<h3 class="catbg">
<span>', $txt['conversation'], '</span>
</h3>
</div>
<div class="roundframe">
<div class="display_title">', $context['current_pm_subject'], '</div>
<p>', $txt['started_by'], ' ', $context['current_pm_author'], ', ', $context['current_pm_time'], '</p>';
}
else
{
echo '
<div class="roundframe">';
}
// Show the conversation buttons.
template_button_strip($context['conversation_buttons'], 'right');
echo '
</div>';
}
while ($message = $context['get_pmessage']('message'))
template_single_pm($message);
if (empty($context['display_mode']))
echo '
<div class="pagesection">
<div class="pagelinks">', $context['page_index'], '</div>
<div class="floatright">
<input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button">
</div>
</div>';
// Show a few buttons if we are in conversation mode and outputting the first message.
elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons']))
{
echo '
<div class="pagesection">';
template_button_strip($context['conversation_buttons'], 'right');
echo '
</div>';
}
echo '
<br>';
}
// Individual messages = buttom list!
if ($context['display_mode'] == 1)
{
template_subject_list();
echo '<br>';
}
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
</form>';
}
/**
* Template for displaying a single personal message.
*
* @param array $message An array of information about the message to display.
*/
function template_single_pm($message)
{
global $context, $scripturl, $txt, $settings, $options, $modSettings;
echo '
<div class="windowbg" id="msg', $message['id'],'">
<div class="post_wrapper">
<div class="poster">';
// Are there any custom fields above the member name?
if (!empty($message['custom_fields']['above_member']))
{
echo '
<div class="custom_fields_above_member">
<ul class="nolist">';
foreach ($message['custom_fields']['above_member'] as $custom)
echo '
<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
echo '
</ul>
</div>';
}
// Show the user's avatar.
if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
echo '
<span class="avatar">
<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a>
</span>';
echo '
<h4>';
// Show online and offline buttons?
if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
echo '
<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>';
// Custom fields BEFORE the username?
if (!empty($message['custom_fields']['before_member']))
foreach ($message['custom_fields']['before_member'] as $custom)
echo '
<span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>';
// Show a link to the member's profile.
echo '
', $message['member']['link'];
// Custom fields AFTER the username?
if (!empty($message['custom_fields']['after_member']))
foreach ($message['custom_fields']['after_member'] as $custom)
echo '
<span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>';
echo '
</h4>';
echo '
<ul class="user_info">';
// Show the member's custom title, if they have one.
if (isset($message['member']['title']) && $message['member']['title'] != '')
echo '
<li class="title">', $message['member']['title'], '</li>';
// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
<li class="membergroup">', $message['member']['group'], '</li>';
// Are there any custom fields below the avatar?
if (!empty($message['custom_fields']['below_avatar']))
foreach ($message['custom_fields']['below_avatar'] as $custom)
echo '
<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
// Show the post group icons
echo '
<li class="icons">', $message['member']['group_icons'], '</li>';
// 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.
if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
echo '
<li class="postgroup">', $message['member']['post_group'], '</li>';
// Show how many posts they have made.
if (!isset($context['disabled_fields']['posts']))
echo '
<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
// Show their personal text?
if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '')
echo '
<li class="blurb">', $message['member']['blurb'], '</li>';
// Any custom fields to show as icons?
if (!empty($message['custom_fields']['icons']))
{
echo '
<li class="im_icons">
<ol>';
foreach ($message['custom_fields']['icons'] as $custom)
echo '
<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
echo '
</ol>
</li>';
}
// Show the IP to this user for this post - because you can moderate?
if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip']))
echo '
<li class="poster_ip">
<a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a>
</li>';
// Or, should we show it because this is you?
elseif ($message['can_see_ip'])
echo '
<li class="poster_ip">
<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a>
</li>';
// Okay, you are logged in, then we can show something about why IPs are logged...
else
echo '
<li class="poster_ip">
<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a>
</li>';
// Show the profile, website, email address, and personal message buttons.
if ($message['member']['show_profile_buttons'])
{
echo '
<li class="profile">
<ol class="profile_icons">';
// Show the profile button
if ($message['member']['can_view_profile'])
echo '
<li><a href="', $message['member']['href'], '" title="' . $txt['view_profile'] . '">', ($settings['use_image_buttons'] ? '<span class="main_icons members"></span>' : $txt['view_profile']), '</a></li>';
// Don't show an icon if they haven't specified a website.
if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website']))
echo '
<li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="main_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
// Don't show the email address if they want it hidden.
if ($message['member']['show_email'])
echo '
<li><a href="mailto:', $message['member']['email'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="main_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>';
// Since we know this person isn't a guest, you *can* message them.
if ($context['can_send_pm'] && $message['member']['id'] != 0)
echo '
<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'] ? '<span class="main_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
echo '
</ol>
</li>';
}
// Any custom fields for standard placement?
if (!empty($message['custom_fields']['standard']))
foreach ($message['custom_fields']['standard'] as $custom)
echo '
<li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>';
// Are we showing the warning status?
if ($message['member']['can_see_warning'])
echo '
<li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="main_icons warning_', $message['member']['warning_status'], '"></span>', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>';
// Are there any custom fields to show at the bottom of the poster info?
if (!empty($message['custom_fields']['bottom_poster']))
foreach ($message['custom_fields']['bottom_poster'] as $custom)
echo '
<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
}
// Done with the information about the poster... on to the post itself.
echo '
</ul>
</div><!-- .poster -->
<div class="postarea">
<div class="keyinfo">
<div id="subject_', $message['id'], '" class="subject_title">
<h5>', $message['subject'], '</h5>
</div>
<div class="postinfo">';
// Show who the message was sent to.
echo '
<span class="smalltext"><strong> ', $txt['sent_to'], ':</strong> ';
// People it was sent directly to....
if (!empty($message['recipients']['to']))
echo implode(', ', $message['recipients']['to']);
// Otherwise, we're just going to say "some people"...
elseif ($context['folder'] != 'sent')
echo '(', $txt['pm_undisclosed_recipients'], ')';
echo '
<strong> ', $txt['on'], ':</strong> ', $message['time'], '
</span>';
// If we're in the sent items, show who it was sent to besides the "To:" people.
if (!empty($message['recipients']['bcc']))
echo '
<span class="smalltext"><strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' </span>';
if (!empty($message['is_replied_to']))
echo '
<span class="smalltext">', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' </span>';
echo '
</div><!-- .postinfo -->
</div><!-- .keyinfo -->
<div class="post">
<div class="inner" id="msg_', $message['id'], '"', '>
', $message['body'], '
</div>
</div><!-- .post -->
<div class="under_message">';
// Add an extra line at the bottom if we have labels enabled.
if ($context['folder'] != 'sent' && !empty($context['currently_using_labels']) && $context['display_mode'] != 2)
{
echo '
<div class="labels floatleft">';
// Add the label drop down box.
if (!empty($context['currently_using_labels']))
{
echo '
<select name="pm_actions[', $message['id'], ']" onchange="if (this.options[this.selectedIndex].value) form.submit();">
<option value="">', $txt['pm_msg_label_title'], ':</option>
<option value="" disabled>---------------</option>';
// Are there any labels which can be added to this?
if (!$message['fully_labeled'])
{
echo '
<option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>';
foreach ($context['labels'] as $label)
if (!isset($message['labels'][$label['id']]))
echo '
<option value="', $label['id'], '">', $label['name'], '</option>';
}
// ... and are there any that can be removed?
if (!empty($message['labels']) && (count($message['labels']) > 1 || !isset($message['labels'][-1])))
{
echo '
<option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>';
foreach ($message['labels'] as $label)
echo '
<option value="', $label['id'], '"> ', $label['name'], '</option>';
}
echo '
</select>
<noscript>
<input type="submit" value="', $txt['pm_apply'], '" class="button">
</noscript>';
}
echo '
</div><!-- .labels -->';
}
// Message options
template_quickbuttons($message['quickbuttons'], 'pm');
echo '
</div><!-- .under_message -->
</div><!-- .postarea -->
<div class="moderatorbar">';
// Are there any custom profile fields for above the signature?
if (!empty($message['custom_fields']['above_signature']))
{
echo '
<div class="custom_fields_above_signature">
<ul class="nolist">';
foreach ($message['custom_fields']['above_signature'] as $custom)
echo '
<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
echo '
</ul>
</div>';
}
// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
echo '
<div class="signature">
', $message['member']['signature'], '
</div>';
// Are there any custom profile fields for below the signature?
if (!empty($message['custom_fields']['below_signature']))
{
echo '
<div class="custom_fields_below_signature">
<ul class="nolist">';
foreach ($message['custom_fields']['below_signature'] as $custom)
echo '
<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
echo '
</ul>
</div>';
}
echo '
</div><!-- .moderatorbar -->
</div><!-- .post_wrapper -->
</div><!-- .windowbg -->';
}
/**
* Just list all the personal message subjects - to make templates easier.
*/
function template_subject_list()
{
global $context, $settings, $txt, $scripturl;
echo '
<div class="cat_bar">
<h3 class="catbg">
', $context['folder'] == 'sent' ? $txt['sent_items'] : $context['current_label'], '
</h3>
</div>
<table class="table_grid">
<thead>
<tr class="title_bar">
<th class="centercol table_icon pm_icon">
<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'] : ''), '"> <span class="main_icons switch" title="', $txt['pm_change_view'], '"></span></a>
</th>
<th class="lefttext quarter_table pm_time">
<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' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a>
</th>
<th class="lefttext half_table pm_subject">
<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' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a>
</th>
<th class="lefttext pm_from_to">
<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['pm_to']), $context['sort_by'] == 'name' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a>
</th>
<th class="centercol table_icon pm_moderation">
<input type="checkbox" onclick="invertAll(this, this.form);">
</th>
</tr>
</thead>
<tbody>';
if (!$context['show_delete'])
echo '
<tr class="windowbg">
<td colspan="5">', $txt['pm_alert_none'], '</td>
</tr>';
while ($message = $context['get_pmessage']('subject'))
{
// Used for giving extra info in conversation view
if ($context['current_pm'] == $message['id'])
{
$context['current_pm_subject'] = $message['subject'];
$context['current_pm_time'] = $message['time'];
$context['current_pm_author'] = $message['member']['link'];
}
echo '
<tr class="windowbg', $message['is_unread'] ? ' unread_pm' : '', '">
<td class="table_icon pm_icon">
<script>
currentLabels[', $message['id'], '] = {';
if (!empty($message['labels']))
{
$first = true;
foreach ($message['labels'] as $label)
{
echo $first ? '' : ',', '
"', $label['id'], '": "', $label['name'], '"';
$first = false;
}
}
echo '
};
</script>
', $message['is_replied_to'] ? '<span class="main_icons replied" title="' . $txt['pm_replied'] . '"></span>' : '<span class="main_icons im_off" title="' . $txt['pm_read'] . '"></span>', '
</td>
<td class="pm_time">', $message['time'], '</td>
<td class="pm_subject">
', ($context['display_mode'] != 0 && $context['current_pm'] == $message['id'] ? '<img src="' . $settings['images_url'] . '/selected.png" 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'], $message['is_unread'] ? ' <span class="new_posts">' . $txt['new'] . '</span>' : '', '</a>
<span class="pm_inline_time"><span class="main_icons ', ($context['from_or_to'] == 'to' && count($message['recipients']['to']) > 1) ? 'people' : 'members', '"></span> ', ($context['from_or_to'] == 'from' ? $message['member']['link'] : (empty($message['recipients']['to']) ? '' : implode(', ', $message['recipients']['to']))), ' <span class="main_icons time_online"></span> ', $message['time'], '</span>
</td>
<td class="pm_from_to">
', ($context['from_or_to'] == 'from' ? $message['member']['link'] : (empty($message['recipients']['to']) ? '' : implode(', ', $message['recipients']['to']))), '
</td>
<td class="centercol table_icon pm_moderation">
<input type="checkbox" name="pms[]" id="deletelisting', $message['id'], '" value="', $message['id'], '"', $message['is_selected'] ? ' checked' : '', ' onclick="if (document.getElementById(\'deletedisplay', $message['id'], '\')) document.getElementById(\'deletedisplay', $message['id'], '\').checked = this.checked;">
</td>
</tr>';
}
echo '
</tbody>
</table>
<div class="pagesection">
<div class="pagelinks">', $context['page_index'], '</div>
<div class="floatright"> ';
if ($context['show_delete'])
{
if (!empty($context['currently_using_labels']) && $context['folder'] != 'sent')
{
echo '
<select name="pm_action" onchange="if (this.options[this.selectedIndex].value) this.form.submit();" onfocus="loadLabelChoices();">
<option value="">', $txt['pm_sel_label_title'], ':</option>
<option value="" disabled>---------------</option>
<option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>';
foreach ($context['labels'] as $label)
{
if ($label['id'] != $context['current_label_id'])
echo '
<option value="add_', $label['id'], '"> ', $label['name'], '</option>';
}
echo '
<option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>';
foreach ($context['labels'] as $label)
echo '
<option value="rem_', $label['id'], '"> ', $label['name'], '</option>';
echo '
</select>
<noscript>
<input type="submit" value="', $txt['pm_apply'], '" class="button">
</noscript>';
}
echo '
<input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button">';
}
echo '
</div><!-- .floatright -->
</div><!-- .pagesection -->';
}
/**
* The form for the PM search feature
*/
function template_search()
{
global $context, $scripturl, $txt;
if (!empty($context['search_errors']))
echo '
<div class="errorbox">
', implode('<br>', $context['search_errors']['messages']), '
</div>';
echo '
<form action="', $scripturl, '?action=pm;sa=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform">
<div class="cat_bar">
<h3 class="catbg">', $txt['pm_search_title'], '</h3>
</div>
<div id="advanced_search" class="roundframe">
<input type="hidden" name="advanced" value="1">
<dl id="search_options" class="settings">
<dt>
<strong><label for="searchfor">', $txt['pm_search_text'], ':</label></strong>
</dt>
<dd>
<input type="search" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' size="40">
<script>
createEventListener(window);
window.addEventListener("load", initSearch, false);
</script>
</dd>
<dt>
<label for="searchtype">', $txt['search_match'], ':</label>
</dt>
<dd>
<select name="searchtype">
<option value="1"', empty($context['search_params']['searchtype']) ? ' selected' : '', '>', $txt['pm_search_match_all'], '</option>
<option value="2"', !empty($context['search_params']['searchtype']) ? ' selected' : '', '>', $txt['pm_search_match_any'], '</option>
</select>
</dd>
<dt>
<label for="userspec">', $txt['pm_search_user'], ':</label>
</dt>
<dd>
<input type="text" name="userspec" value="', empty($context['search_params']['userspec']) ? '*' : $context['search_params']['userspec'], '" size="40">
</dd>
<dt>
<label for="sort">', $txt['pm_search_order'], ':</label>
</dt>
<dd>
<select name="sort">
<option value="relevance|desc">', $txt['pm_search_orderby_relevant_first'], '</option>
<option value="id_pm|desc">', $txt['pm_search_orderby_recent_first'], '</option>
<option value="id_pm|asc">', $txt['pm_search_orderby_old_first'], '</option>
</select>
</dd>
<dt class="options">
', $txt['pm_search_options'], ':
</dt>
<dd class="options">
<label for="show_complete">
<input type="checkbox" name="show_complete" id="show_complete" value="1"', !empty($context['search_params']['show_complete']) ? ' checked' : '', '> ', $txt['pm_search_show_complete'], '
</label><br>
<label for="subject_only">
<input type="checkbox" name="subject_only" id="subject_only" value="1"', !empty($context['search_params']['subject_only']) ? ' checked' : '', '> ', $txt['pm_search_subject_only'], '
</label>
</dd>
<dt class="between">
', $txt['pm_search_post_age'], ':
</dt>
<dd>
', $txt['pm_search_between'], '
<input type="number" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="5" min="0" max="9999">
', $txt['pm_search_between_and'], '
<input type="number" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="5" min="0" max="9999">
', $txt['pm_search_between_days'], '
</dd>
</dl>';
if (!$context['currently_using_labels'])
echo '
<input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button floatright">';
echo '
</div><!-- .roundframe -->';
// Do we have some labels setup? If so offer to search by them!
if ($context['currently_using_labels'])
{
echo '
<fieldset class="labels">
<div class="roundframe alt">
<div class="title_bar">
<h3 class="titlebg">
<span id="advanced_panel_toggle" class="toggle_up floatright" style="display: none;"></span><a href="#" id="advanced_panel_link">', $txt['pm_search_choose_label'], '</a>
</h3>
</div>
<div id="advanced_panel_div">
<ul id="search_labels">';
foreach ($context['search_labels'] as $label)
echo '
<li>
<label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', '>
', $label['name'], '</label>
</li>';
echo '
</ul>
</div>
<br class="clear">
<div class="padding">
<input type="checkbox" name="all" id="check_all" value=""', $context['check_all'] ? ' checked' : '', ' onclick="invertAll(this, this.form, \'searchlabel\');">
<label for="check_all"><em>', $txt['check_all'], '</em></label>
<input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button floatright">
</div class="padding">
</div><!-- .roundframe -->
</fieldset>';
// Some javascript for the advanced toggling
echo '
<script>
var oAdvancedPanelToggle = new smc_Toggle({
bToggleEnabled: true,
bCurrentlyCollapsed: true,
aSwappableContainers: [
\'advanced_panel_div\'
],
aSwapImages: [
{
sId: \'advanced_panel_toggle\',
altExpanded: ', JavaScriptEscape($txt['hide']), ',
altCollapsed: ', JavaScriptEscape($txt['show']), '
}
],
aSwapLinks: [
{
sId: \'advanced_panel_link\',
msgExpanded: ', JavaScriptEscape($txt['pm_search_choose_label']), ',
msgCollapsed: ', JavaScriptEscape($txt['pm_search_choose_label']), '
}
]
});
</script>';
}
echo '
</form>';
}
/**
* Displays results from a PM search
*/
function template_search_results()
{
global $context, $txt;
echo '
<div class="cat_bar">
<h3 class="catbg">', $txt['pm_search_results'], '</h3>
</div>
<div class="roundframe noup">
', sprintf($txt['pm_search_results_info'], $context['num_results'], sentence_list($context['search_in'])), '
</div>
<div class="pagesection">
<div class="pagelinks">', $context['page_index'], '</div>
</div>';
// Complete results?
if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
echo '
<table class="table_grid">
<thead>
<tr class="title_bar">
<th class="lefttext quarter_table">', $txt['date'], '</th>
<th class="lefttext half_table">', $txt['subject'], '</th>
<th class="lefttext quarter_table">', $txt['from'], '</th>
</tr>
</thead>
<tbody>';
// Print each message out...
foreach ($context['personal_messages'] as $message)
{
// Are we showing it all?
if (!empty($context['search_params']['show_complete']))
template_single_pm($message);
// Otherwise just a simple list!
// @todo No context at all of the search?
else
echo '
<tr class="windowbg">
<td>', $message['time'], '</td>
<td>', $message['link'], '</td>
<td>', $message['member']['link'], '</td>
</tr>';
}
// Finish off the page...
if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
echo '
</tbody>
</table>';
// No results?
if (empty($context['personal_messages']))
echo '
<div class="windowbg">
<p class="centertext">', $txt['pm_search_none_found'], '</p>
</div>';
echo '
<div class="pagesection">
<div class="pagelinks">', $context['page_index'], '</div>
</div>';
}
/**
* The form for sending a new PM
*/
function template_send()
{
global $context, $options, $scripturl, $modSettings, $txt;
// Show which messages were sent successfully and which failed.
if (!empty($context['send_log']))
{
echo '
<div class="cat_bar">
<h3 class="catbg">', $txt['pm_send_report'], '</h3>
</div>
<div class="windowbg noup">';
if (!empty($context['send_log']['sent']))
foreach ($context['send_log']['sent'] as $log_entry)
echo '
<span class="error">', $log_entry, '</span><br>';
if (!empty($context['send_log']['failed']))
foreach ($context['send_log']['failed'] as $log_entry)
echo '
<span class="error">', $log_entry, '</span><br>';
echo '
</div>
<br>';
}
// Show the preview of the personal message.
echo '
<div id="preview_section"', isset($context['preview_message']) ? '' : ' class="hidden"', '>
<div class="cat_bar">
<h3 class="catbg">
<span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
</h3>
</div>
<div class="windowbg noup">