comparison forum/Themes/default/SendTopic.template.php @ 76:e3e11437ecea website

Add forum code
author Chris Cannam
date Sun, 07 Jul 2013 11:25:48 +0200
parents
children
comparison
equal deleted inserted replaced
75:72f59aa7e503 76:e3e11437ecea
1 <?php
2 /**
3 * Simple Machines Forum (SMF)
4 *
5 * @package SMF
6 * @author Simple Machines
7 * @copyright 2011 Simple Machines
8 * @license http://www.simplemachines.org/about/smf/license.php BSD
9 *
10 * @version 2.0
11 */
12
13 //------------------------------------------------------------------------------
14 /* This template contains two humble sub templates - main. Its job is pretty
15 simple: it collects the information we need to actually send the topic.
16
17 The main sub template gets shown from:
18 '?action=emailuser;sa=sendtopic;topic=##.##'
19 And should submit to:
20 '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.' . $context['start']
21 It should send the following fields:
22 y_name: sender's name.
23 y_email: sender's email.
24 comment: any additional comment.
25 r_name: receiver's name.
26 r_email: receiver's email address.
27 send: this just needs to be set, as by the submit button.
28 sc: the session id, or $context['session_id'].
29
30 The report sub template gets shown from:
31 '?action=reporttm;topic=##.##;msg=##'
32 It should submit to:
33 '?action=reporttm;topic=' . $context['current_topic'] . '.' . $context['start']
34 It only needs to send the following fields:
35 comment: an additional comment to give the moderator.
36 sc: the session id, or $context['session_id'].
37 */
38
39 // This is where we get information about who they want to send the topic to, etc.
40 function template_main()
41 {
42 global $context, $settings, $options, $txt, $scripturl;
43
44 echo '
45 <div id="send_topic">
46 <form action="', $scripturl, '?action=emailuser;sa=sendtopic;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
47 <div class="cat_bar">
48 <h3 class="catbg">
49 <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/email_sm.gif" alt="" class="icon" />', $context['page_title'], '</span>
50 </h3>
51 </div>
52 <div class="windowbg2">
53 <span class="topslice"><span></span></span>
54 <div class="content">
55 <fieldset id="sender" class="send_topic">
56 <dl class="settings send_topic">
57 <dt>
58 <label for="y_name"><strong>', $txt['sendtopic_sender_name'], ':</strong></label>
59 </dt>
60 <dd>
61 <input type="text" id="y_name" name="y_name" size="30" maxlength="40" value="', $context['user']['name'], '" class="input_text" />
62 </dd>
63 <dt>
64 <label for="y_email"><strong>', $txt['sendtopic_sender_email'], ':</strong></label>
65 </dt>
66 <dd>
67 <input type="text" id="y_email" name="y_email" size="30" maxlength="50" value="', $context['user']['email'], '" class="input_text" />
68 </dd>
69 <dt>
70 <label for="comment"><strong>', $txt['sendtopic_comment'], ':</strong></label>
71 </dt>
72 <dd>
73 <input type="text" id="comment" name="comment" size="30" maxlength="100" class="input_text" />
74 </dd>
75 </dl>
76 </fieldset>
77 <fieldset id="recipient" class="send_topic">
78 <dl class="settings send_topic">
79 <dt>
80 <label for="r_name"><strong>', $txt['sendtopic_receiver_name'], ':</strong></label>
81 </dt>
82 <dd>
83 <input type="text" id="r_name" name="r_name" size="30" maxlength="40" class="input_text" />
84 </dd>
85 <dt>
86 <label for="r_email"><strong>', $txt['sendtopic_receiver_email'], ':</strong></label>
87 </dt>
88 <dd>
89 <input type="text" id="r_email" name="r_email" size="30" maxlength="50" class="input_text" />
90 </dd>
91 </dl>
92 </fieldset>
93 <div class="righttext">
94 <input type="submit" name="send" value="', $txt['sendtopic_send'], '" class="button_submit" />
95 </div>
96 </div>
97 <span class="botslice"><span></span></span>
98 </div>
99 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
100 </form>
101 </div>
102 <br class="clear" />';
103 }
104
105 // Send an email to a user!
106 function template_custom_email()
107 {
108 global $context, $settings, $options, $txt, $scripturl;
109
110 echo '
111 <div id="send_topic">
112 <form action="', $scripturl, '?action=emailuser;sa=email" method="post" accept-charset="', $context['character_set'], '">
113 <div class="cat_bar">
114 <h3 class="catbg">
115 <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/email_sm.gif" alt="" class="icon" />', $context['page_title'], '</span>
116 </h3>
117 </div>
118 <div class="windowbg">
119 <span class="topslice"><span></span></span>
120 <div class="content">
121 <dl class="settings send_mail">
122 <dt>
123 <strong>', $txt['sendtopic_receiver_name'], ':</strong>
124 </dt>
125 <dd>
126 ', $context['recipient']['link'], '
127 </dd>';
128
129 // Can the user see the persons email?
130 if ($context['can_view_receipient_email'])
131 echo '
132 <dt>
133 <strong>', $txt['sendtopic_receiver_email'], ':</strong>
134 </dt>
135 <dd>
136 ', $context['recipient']['email_link'], '
137 </dd>
138 </dl>
139 <hr />
140 <dl class="settings send_mail">';
141
142 // If it's a guest we need their details.
143 if ($context['user']['is_guest'])
144 echo '
145 <dt>
146 <label for="y_name"><strong>', $txt['sendtopic_sender_name'], ':</strong></label>
147 </dt>
148 <dd>
149 <input type="text" id="y_name" name="y_name" size="24" maxlength="40" value="', $context['user']['name'], '" class="input_text" />
150 </dd>
151 <dt>
152 <label for="y_email"><strong>', $txt['sendtopic_sender_email'], ':</strong></label><br />
153 <span class="smalltext">', $txt['send_email_disclosed'], '</span>
154 </dt>
155 <dd>
156 <input type="text" id="y_mail" name="y_email" size="24" maxlength="50" value="', $context['user']['email'], '" class="input_text" />
157 </dt>';
158 // Otherwise show the user that we know their email.
159 else
160 echo '
161 <dt>
162 <strong>', $txt['sendtopic_sender_email'], ':</strong><br />
163 <span class="smalltext">', $txt['send_email_disclosed'], '</span>
164 </dt>
165 <dd>
166 <em>', $context['user']['email'], '</em>
167 </dd>';
168
169 echo '
170 <dt>
171 <label for="email_subject"><strong>', $txt['send_email_subject'], ':</strong></label>
172 </dt>
173 <dd>
174 <input type="text" id="email_subject" name="email_subject" size="50" maxlength="100" class="input_text" />
175 </dd>
176 <dt>
177 <label for="email_body"><strong>', $txt['message'], ':</strong></label>
178 </dt>
179 <dd>
180 <textarea id="email_body" name="email_body" rows="10" cols="20" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 90%; min-width: 90%' : 'width: 90%') . ';"></textarea>
181 </dd>
182 </dl>
183 <div class="righttext">
184 <input type="submit" name="send" value="', $txt['sendtopic_send'], '" class="button_submit" />
185 </div>
186 </div>
187 <span class="botslice"><span></span></span>
188 </div>';
189
190 foreach ($context['form_hidden_vars'] as $key => $value)
191 echo '
192 <input type="hidden" name="', $key, '" value="', $value, '" />';
193
194 echo '
195 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
196 </form>
197 </div>
198 <br class="clear" />';
199 }
200
201 function template_report()
202 {
203 global $context, $settings, $options, $txt, $scripturl;
204
205 echo '
206 <div id="report_topic">
207 <form action="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
208 <input type="hidden" name="msg" value="' . $context['message_id'] . '" />
209 <div class="cat_bar">
210 <h3 class="catbg">', $txt['report_to_mod'], '</h3>
211 </div>
212 <div class="windowbg">
213 <span class="topslice"><span></span></span>
214 <div class="content">';
215
216 if (!empty($context['post_errors']))
217 {
218 echo '
219 <div class="errorbox">
220 <ul>';
221
222 foreach ($context['post_errors'] as $error)
223 echo '
224 <li class="error">', $error, '</li>';
225
226 echo '
227 </ul>
228 </div>';
229 }
230
231 echo '
232 <p>', $txt['report_to_mod_func'], '</p>
233 <br />
234 <dl class="settings" id="report_post">';
235
236 if ($context['user']['is_guest'])
237 {
238 echo '
239 <dt>
240 <label for="email_address">', $txt['email'], '</label>:
241 </dt>
242 <dd>
243 <input type="text" id="email_address" name="email" value="', $context['email_address'], '" size="25" maxlength="255" />
244 </dd>';
245 }
246
247 echo '
248 <dt>
249 <label for="report_comment">', $txt['enter_comment'], '</label>:
250 </dt>
251 <dd>
252 <input type="text" id="report_comment" name="comment" size="50" value="', $context['comment_body'], '" maxlength="255" />
253 </dd>';
254
255 if ($context['require_verification'])
256 {
257 echo '
258 <dt>
259 ', $txt['verification'], ':
260 </dt>
261 <dd>
262 ', template_control_verification($context['visual_verification_id'], 'all'), '
263 </dd>';
264 }
265
266 echo '
267 </dl>
268 <div class="righttext">
269 <input type="submit" name="submit" value="', $txt['rtm10'], '" style="margin-left: 1ex;" class="button_submit" />
270 </div>
271 </div>
272 <span class="botslice"><span></span></span>
273 </div>
274 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
275 </form>
276 </div>
277 <br class="clear" />';
278 }
279
280 ?>