Mercurial > hg > vamp-website
comparison forum/Themes/default/ManageSearch.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 function template_modify_weights() | |
14 { | |
15 global $context, $settings, $options, $scripturl, $txt, $modSettings; | |
16 | |
17 echo ' | |
18 <div id="admincenter"> | |
19 <form action="', $scripturl, '?action=admin;area=managesearch;sa=weights" method="post" accept-charset="', $context['character_set'], '"> | |
20 <div class="cat_bar"> | |
21 <h3 class="catbg">', $txt['search_weights'], '</h3> | |
22 </div> | |
23 <div class="windowbg"> | |
24 <span class="topslice"><span></span></span> | |
25 <div class="content"> | |
26 <dl class="settings"> | |
27 <dt class="large_caption"> | |
28 <a href="', $scripturl, '?action=helpadmin;help=search_weight_frequency" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> | |
29 ', $txt['search_weight_frequency'], ': | |
30 </dt> | |
31 <dd class="large_caption"> | |
32 <span class="search_weight"><input type="text" name="search_weight_frequency" id="weight1_val" value="', empty($modSettings['search_weight_frequency']) ? '0' : $modSettings['search_weight_frequency'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> | |
33 <span id="weight1" class="search_weight">', $context['relative_weights']['search_weight_frequency'], '%</span> | |
34 </dd> | |
35 <dt class="large_caption"> | |
36 <a href="', $scripturl, '?action=helpadmin;help=search_weight_age" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> | |
37 ', $txt['search_weight_age'], ': | |
38 </dt> | |
39 <dd class="large_caption"> | |
40 <span class="search_weight"><input type="text" name="search_weight_age" id="weight2_val" value="', empty($modSettings['search_weight_age']) ? '0' : $modSettings['search_weight_age'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> | |
41 <span id="weight2" class="search_weight">', $context['relative_weights']['search_weight_age'], '%</span> | |
42 </dd> | |
43 <dt class="large_caption"> | |
44 <a href="', $scripturl, '?action=helpadmin;help=search_weight_length" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> | |
45 ', $txt['search_weight_length'], ': | |
46 </dt> | |
47 <dd class="large_caption"> | |
48 <span class="search_weight"><input type="text" name="search_weight_length" id="weight3_val" value="', empty($modSettings['search_weight_length']) ? '0' : $modSettings['search_weight_length'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> | |
49 <span id="weight3" class="search_weight">', $context['relative_weights']['search_weight_length'], '%</span> | |
50 </dd> | |
51 <dt class="large_caption"> | |
52 <a href="', $scripturl, '?action=helpadmin;help=search_weight_subject" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> | |
53 ', $txt['search_weight_subject'], ': | |
54 </dt> | |
55 <dd class="large_caption"> | |
56 <span class="search_weight"><input type="text" name="search_weight_subject" id="weight4_val" value="', empty($modSettings['search_weight_subject']) ? '0' : $modSettings['search_weight_subject'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> | |
57 <span id="weight4" class="search_weight">', $context['relative_weights']['search_weight_subject'], '%</span> | |
58 </dd> | |
59 <dt class="large_caption"> | |
60 <a href="', $scripturl, '?action=helpadmin;help=search_weight_first_message" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> | |
61 ', $txt['search_weight_first_message'], ': | |
62 </dt> | |
63 <dd class="large_caption"> | |
64 <span class="search_weight"><input type="text" name="search_weight_first_message" id="weight5_val" value="', empty($modSettings['search_weight_first_message']) ? '0' : $modSettings['search_weight_first_message'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> | |
65 <span id="weight5" class="search_weight">', $context['relative_weights']['search_weight_first_message'], '%</span> | |
66 </dd> | |
67 <dt class="large_caption"> | |
68 <a href="', $scripturl, '?action=helpadmin;help=search_weight_frequency" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> | |
69 ', $txt['search_weight_sticky'], ': | |
70 </dt> | |
71 <dd class="large_caption"> | |
72 <span class="search_weight"><input type="text" name="search_weight_sticky" id="weight6_val" value="', empty($modSettings['search_weight_sticky']) ? '0' : $modSettings['search_weight_sticky'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> | |
73 <span id="weight6" class="search_weight">', $context['relative_weights']['search_weight_sticky'], '%</span> | |
74 </dd> | |
75 <dt class="large_caption"> | |
76 <strong>', $txt['search_weights_total'], '</strong> | |
77 </dt> | |
78 <dd class="large_caption"> | |
79 <span id="weighttotal" class="search_weight"><strong>', $context['relative_weights']['total'], '</strong></span> | |
80 <span class="search_weight"><strong>100%</strong></span> | |
81 </dd> | |
82 </dl> | |
83 <input type="submit" name="save" value="', $txt['search_weights_save'], '" class="button_submit floatright" /> | |
84 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /><br class="clear" /> | |
85 </div> | |
86 <span class="botslice"><span></span></span> | |
87 </div> | |
88 </form> | |
89 </div> | |
90 <br class="clear" /> | |
91 <script type="text/javascript"><!-- // --><![CDATA[ | |
92 function calculateNewValues() | |
93 { | |
94 var total = 0; | |
95 for (var i = 1; i <= 6; i++) | |
96 { | |
97 total += parseInt(document.getElementById(\'weight\' + i + \'_val\').value); | |
98 } | |
99 setInnerHTML(document.getElementById(\'weighttotal\'), total); | |
100 for (var i = 1; i <= 6; i++) | |
101 { | |
102 setInnerHTML(document.getElementById(\'weight\' + i), (Math.round(1000 * parseInt(document.getElementById(\'weight\' + i + \'_val\').value) / total) / 10) + \'%\'); | |
103 } | |
104 } | |
105 // ]]></script>'; | |
106 } | |
107 | |
108 function template_select_search_method() | |
109 { | |
110 global $context, $settings, $options, $scripturl, $txt, $modSettings; | |
111 | |
112 echo ' | |
113 <div id="admincenter"> | |
114 <form action="', $scripturl, '?action=admin;area=managesearch;sa=method" method="post" accept-charset="', $context['character_set'], '"> | |
115 <div class="cat_bar"> | |
116 <h3 class="catbg">', $txt['search_method'], '</h3> | |
117 </div> | |
118 <div class="information"> | |
119 <div class="smalltext" style="font-weight: normal;"><a href="', $scripturl, '?action=helpadmin;help=search_why_use_index" onclick="return reqWin(this.href);">', $txt['search_create_index_why'], '</a></div> | |
120 </div> | |
121 <div class="windowbg"> | |
122 <span class="topslice"><span></span></span> | |
123 <div class="content"> | |
124 <dl class="settings"> | |
125 | |
126 '; | |
127 if (!empty($context['table_info'])) | |
128 echo ' | |
129 <dt> | |
130 <strong>', $txt['search_method_messages_table_space'], ':</strong> | |
131 </dt> | |
132 <dd> | |
133 ', $context['table_info']['data_length'], ' | |
134 </dd> | |
135 <dt> | |
136 <strong>', $txt['search_method_messages_index_space'], ':</strong> | |
137 </dt> | |
138 <dd> | |
139 ', $context['table_info']['index_length'], ' | |
140 </dd>'; | |
141 echo ' | |
142 </dl> | |
143 ', $context['double_index'] ? '<div class="information"> | |
144 ' . $txt['search_double_index'] . '</div>' : '', ' | |
145 <fieldset class="search_settings floatleft"> | |
146 <legend>', $txt['search_index'], '</legend> | |
147 <dl> | |
148 <dt><input type="radio" name="search_index" value=""', empty($modSettings['search_index']) ? ' checked="checked"' : '', ' class="input_radio" /> | |
149 ', $txt['search_index_none'], ' | |
150 </dt>'; | |
151 | |
152 if ($context['supports_fulltext']) | |
153 { | |
154 echo ' | |
155 <dt> | |
156 <input type="radio" name="search_index" value="fulltext"', !empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext' ? ' checked="checked"' : '', empty($context['fulltext_index']) ? ' onclick="alert(\'' . $txt['search_method_fulltext_warning'] . '\'); selectRadioByName(this.form.search_index, \'fulltext\');"': '', ' class="input_radio" /> | |
157 ', $txt['search_method_fulltext_index'], ' | |
158 </dt> | |
159 <dd> | |
160 | |
161 <span class="smalltext">'; | |
162 if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) | |
163 echo ' | |
164 <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], '">', $txt['search_method_fulltext_create'], '</a>]'; | |
165 elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) | |
166 echo ' | |
167 <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create']; | |
168 else | |
169 echo ' | |
170 <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], '">', $txt['search_method_fulltext_remove'], '</a>]<br /> | |
171 <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length']; | |
172 echo ' | |
173 </span> | |
174 </dd>'; | |
175 } | |
176 | |
177 echo ' | |
178 <dt> | |
179 <input type="radio" name="search_index" value="custom"', !empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom' ? ' checked="checked"' : '', $context['custom_index'] ? '' : ' onclick="alert(\'' . $txt['search_index_custom_warning'] . '\'); selectRadioByName(this.form.search_method, \'1\');"', ' class="input_radio" /> | |
180 ', $txt['search_index_custom'], ' | |
181 </dt> | |
182 <dd> | |
183 <span class="smalltext">'; | |
184 if ($context['custom_index']) | |
185 echo ' | |
186 <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], '">', $txt['search_index_custom_remove'], '</a>]<br /> | |
187 <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; | |
188 elseif ($context['partial_custom_index']) | |
189 echo ' | |
190 <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], '">', $txt['search_index_custom_resume'], '</a>]<br /> | |
191 <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; | |
192 else | |
193 echo ' | |
194 <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]'; | |
195 echo ' | |
196 </span> | |
197 </dd>'; | |
198 | |
199 foreach ($context['search_apis'] as $api) | |
200 { | |
201 if (empty($api['label']) || $api['has_template']) | |
202 continue; | |
203 | |
204 echo ' | |
205 <dt> | |
206 <input type="radio" name="search_index" value="', $api['setting_index'], '"', !empty($modSettings['search_index']) && $modSettings['search_index'] == $api['setting_index'] ? ' checked="checked"' : '', ' class="input_radio" /> | |
207 ', $api['label'] ,' | |
208 </dt>'; | |
209 | |
210 if ($api['desc']) | |
211 echo ' | |
212 <dd> | |
213 <span class="smalltext">', $api['desc'], '</span> | |
214 </dd>'; | |
215 } | |
216 | |
217 echo ' | |
218 </dl> | |
219 </fieldset> | |
220 <fieldset class="search_settings floatright"> | |
221 <legend>', $txt['search_method'], '</legend> | |
222 <input type="checkbox" name="search_force_index" id="search_force_index_check" value="1"', empty($modSettings['search_force_index']) ? '' : ' checked="checked"', ' class="input_check" /><label for="search_force_index_check">', $txt['search_force_index'], '</label><br /> | |
223 <input type="checkbox" name="search_match_words" id="search_match_words_check" value="1"', empty($modSettings['search_match_words']) ? '' : ' checked="checked"', ' class="input_check" /><label for="search_match_words_check">', $txt['search_match_words'], '</label> | |
224 </fieldset> | |
225 <div class="clear"> | |
226 <input type="submit" name="save" value="', $txt['search_method_save'], '" class="button_submit floatright" /> | |
227 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> | |
228 </div> | |
229 </div> | |
230 <span class="botslice clear"><span></span></span> | |
231 </div> | |
232 </form> | |
233 </div> | |
234 <br class="clear" />'; | |
235 } | |
236 | |
237 function template_create_index() | |
238 { | |
239 global $context, $settings, $options, $scripturl, $txt; | |
240 | |
241 echo ' | |
242 <div id="admincenter"> | |
243 <form action="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;step=1" method="post" accept-charset="', $context['character_set'], '" name="create_index"> | |
244 <div class="cat_bar"> | |
245 <h3 class="catbg">', $txt['search_create_index'], '</h3> | |
246 </div> | |
247 <div class="windowbg"> | |
248 <span class="topslice"><span></span></span> | |
249 <div class="content"> | |
250 <dl class="settings"> | |
251 <dt> | |
252 <label for="predefine_select">', $txt['search_predefined'], ':</label> | |
253 </dt> | |
254 <dd> | |
255 <select name="bytes_per_word" id="predefine_select"> | |
256 <option value="2">', $txt['search_predefined_small'], '</option> | |
257 <option value="4" selected="selected">', $txt['search_predefined_moderate'], '</option> | |
258 <option value="5">', $txt['search_predefined_large'], '</option> | |
259 </select> | |
260 </dd> | |
261 </dl> | |
262 <input type="submit" name="save" value="', $txt['search_create_index_start'], '" class="button_submit" /> | |
263 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> | |
264 </div> | |
265 <span class="botslice"><span></span></span> | |
266 </div> | |
267 | |
268 </form> | |
269 </div> | |
270 <br class="clear" />'; | |
271 } | |
272 | |
273 function template_create_index_progress() | |
274 { | |
275 global $context, $settings, $options, $scripturl, $txt; | |
276 echo ' | |
277 <div id="admincenter"> | |
278 <form action="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;step=1" name="autoSubmit" method="post" accept-charset="', $context['character_set'], '"> | |
279 <div class="cat_bar"> | |
280 <h3 class="catbg">', $txt['search_create_index'], '</h3> | |
281 </div> | |
282 <div class="windowbg"> | |
283 <span class="topslice"><span></span></span> | |
284 <div class="content"> | |
285 <p> | |
286 ', $txt['search_create_index_not_ready'], ' | |
287 </p> | |
288 <p> | |
289 <strong>', $txt['search_create_index_progress'], ': ', $context['percentage'], '%</strong> | |
290 </p> | |
291 <input type="submit" name="b" value="', $txt['search_create_index_continue'], '" class="button_submit" /> | |
292 </div> | |
293 <span class="botslice"><span></span></span> | |
294 </div> | |
295 <input type="hidden" name="step" value="', $context['step'], '" /> | |
296 <input type="hidden" name="start" value="', $context['start'], '" /> | |
297 <input type="hidden" name="bytes_per_word" value="', $context['index_settings']['bytes_per_word'], '" /> | |
298 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> | |
299 </form> | |
300 </div> | |
301 <br class="clear" /> | |
302 <script type="text/javascript"><!-- // --><![CDATA[ | |
303 var countdown = 10; | |
304 doAutoSubmit(); | |
305 | |
306 function doAutoSubmit() | |
307 { | |
308 if (countdown == 0) | |
309 document.forms.autoSubmit.submit(); | |
310 else if (countdown == -1) | |
311 return; | |
312 | |
313 document.forms.autoSubmit.b.value = "', $txt['search_create_index_continue'], ' (" + countdown + ")"; | |
314 countdown--; | |
315 | |
316 setTimeout("doAutoSubmit();", 1000); | |
317 } | |
318 // ]]></script>'; | |
319 | |
320 } | |
321 | |
322 function template_create_index_done() | |
323 { | |
324 global $context, $settings, $options, $scripturl, $txt; | |
325 echo ' | |
326 <div id="admincenter"> | |
327 <div class="cat_bar"> | |
328 <h3 class="catbg">', $txt['search_create_index'], '</h3> | |
329 </div> | |
330 <div class="windowbg"> | |
331 <span class="topslice"><span></span></span> | |
332 <div class="content"> | |
333 <p>', $txt['search_create_index_done'], '</p> | |
334 <p> | |
335 <strong><a href="', $scripturl, '?action=admin;area=managesearch;sa=method">', $txt['search_create_index_done_link'], '</a></strong> | |
336 </p> | |
337 </div> | |
338 <span class="botslice"><span></span></span> | |
339 </div> | |
340 </div> | |
341 <br class="clear" />'; | |
342 } | |
343 | |
344 // Add or edit a search engine spider. | |
345 function template_spider_edit() | |
346 { | |
347 global $context, $settings, $options, $scripturl, $txt; | |
348 echo ' | |
349 <div id="admincenter"> | |
350 <form action="', $scripturl, '?action=admin;area=sengines;sa=editspiders;sid=', $context['spider']['id'], '" method="post" accept-charset="', $context['character_set'], '"> | |
351 <div class="cat_bar"> | |
352 <h3 class="catbg">', $context['page_title'], '</h3> | |
353 </div> | |
354 <div class="information"> | |
355 ', $txt['add_spider_desc'], ' | |
356 </div> | |
357 <div class="windowbg"> | |
358 <span class="topslice"><span></span></span> | |
359 <div class="content"> | |
360 <dl class="settings"> | |
361 <dt> | |
362 <strong>', $txt['spider_name'], ':</strong><br /> | |
363 <span class="smalltext">', $txt['spider_name_desc'], '</span> | |
364 </dt> | |
365 <dd> | |
366 <input type="text" name="spider_name" value="', $context['spider']['name'], '" class="input_text" /> | |
367 </dd> | |
368 <dt> | |
369 <strong>', $txt['spider_agent'], ':</strong><br /> | |
370 <span class="smalltext">', $txt['spider_agent_desc'], '</span> | |
371 </dt> | |
372 <dd> | |
373 <input type="text" name="spider_agent" value="', $context['spider']['agent'], '" class="input_text" /> | |
374 </dd> | |
375 <dt> | |
376 <strong>', $txt['spider_ip_info'], ':</strong><br /> | |
377 <span class="smalltext">', $txt['spider_ip_info_desc'], '</span> | |
378 </dt> | |
379 <dd> | |
380 <textarea name="spider_ip" rows="4" cols="20">', $context['spider']['ip_info'], '</textarea> | |
381 </dd> | |
382 </dl> | |
383 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> | |
384 <input type="submit" name="save" value="', $context['page_title'], '" class="button_submit" /> | |
385 </div> | |
386 <span class="botslice"><span></span></span> | |
387 </div> | |
388 </form> | |
389 </div> | |
390 <br class="clear" />'; | |
391 } | |
392 | |
393 // Show... spider... logs... | |
394 function template_show_spider_logs() | |
395 { | |
396 global $context, $txt, $settings, $scripturl; | |
397 | |
398 echo ' | |
399 <div id="admincenter">'; | |
400 | |
401 // Standard fields. | |
402 template_show_list('spider_logs'); | |
403 | |
404 echo ' | |
405 <br /> | |
406 <div class="cat_bar"> | |
407 <h3 class="catbg">', $txt['spider_logs_delete'], '</h3> | |
408 </div> | |
409 <form action="', $scripturl, '?action=admin;area=sengines;sa=logs;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '"> | |
410 <div class="windowbg"> | |
411 <span class="topslice"><span></span></span> | |
412 <div class="content"> | |
413 <p> | |
414 ', $txt['spider_logs_delete_older'], ' | |
415 <input type="text" name="older" id="older" value="7" size="3" class="input_text" /> | |
416 ', $txt['spider_logs_delete_day'], ' | |
417 </p> | |
418 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> | |
419 <input type="submit" name="delete_entries" value="', $txt['spider_logs_delete_submit'], '" onclick="if (document.getElementById(\'older\').value < 1 && !confirm(\'' . addcslashes($txt['spider_logs_delete_confirm'], "'") . '\')) return false; return true;" class="button_submit" /> | |
420 </div> | |
421 <span class="botslice"><span></span></span> | |
422 </div> | |
423 </form> | |
424 </div> | |
425 <br class="clear" />'; | |
426 } | |
427 | |
428 ?> |