123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475 |
- <?php
- function template_control_richedit($editor_id, $smileyContainer = null, $bbcContainer = null)
- {
- global $context, $settings, $options, $txt, $modSettings, $scripturl, $boardurl;
- $editor_context = &$context['controls']['richedit'][$editor_id];
- echo '
- <div>
- <div style="width: 98.8%;">
- <div>
- <textarea class="editor" name="', $editor_id, '" id="', $editor_id, '" rows="', $editor_context['rows'], '" cols="600" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '" style="height: ', $editor_context['height'], '; ', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? 'border: 1px solid red;' : '', '">', $editor_context['value'], '</textarea>
- </div>
- <div id="', $editor_id, '_resizer" class="richedit_resize"></div>
- </div>
- </div>
- <input type="hidden" name="', $editor_id, '_mode" id="', $editor_id, '_mode" value="0" />
- <script type="text/javascript"><!-- // --><![CDATA[
- var bbc_quote_from = \'', $txt['quote_from'], '\'
- var bbc_quote = \'', $txt['quote'], '\'
- var bbc_search_on = \'', $txt['search_on'], '\';
- (function($) {
- var extensionMethods = {
- InsertText: function(text) {
- var bIsSource = this.inSourceMode();
- // @TODO make it put the quote close to the current selection
- // @TODO there must be a cleaner mode to get the proper text...
- if (!bIsSource)
- this.toggleTextMode();
- var current_value = this.getWysiwygEditorValue() + "\n" + text;
- this.setTextareaValue(current_value);
- if (!bIsSource)
- this.toggleTextMode();
- },
- getText: function() {
- var bIsSource = this.inSourceMode();
- // @TODO there must be a cleaner mode to get the proper text...
- if (!bIsSource)
- {
- this.toggleTextMode();
- this.toggleTextMode();
- }
- else
- this.toggleTextMode();
- var current_value = this.getWysiwygEditorValue();
- if (!bIsSource)
- {
- this.toggleTextMode();
- this.toggleTextMode();
- }
- return current_value;
- }
- };
- $.extend(true, $[\'sceditor\'].prototype, extensionMethods);
- })(jQuery);
- $(document).ready(function() {
- $("#', $editor_id, '").sceditorBBCodePlugin({
- style: "', $settings['default_theme_url'], '/css/jquery.sceditor.default.css",
- colors: "black,red,yellow,pink,green,orange,purple,blue,beige,brown,teal,navy,maroon,limegreen,white"';
-
- if ((!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) && !$editor_context['disable_smiley_box'] && $smileyContainer !== null)
- {
- echo ',
- emoticons:
- {';
- $countLocations = count($context['smileys']);
- foreach ($context['smileys'] as $location => $smileyRows)
- {
- $countLocations--;
- if ($location == 'postform')
- echo '
- dropdown:
- {';
- elseif ($location == 'popup')
- echo '
- more:
- {';
- $numRows = count($smileyRows);
- foreach ($smileyRows as $smileyRow)
- {
- foreach ($smileyRow['smileys'] as $smiley)
- {
- echo '
- ', JavaScriptEscape($smiley['code']), ': ', JavaScriptEscape(str_replace($boardurl . '/', '', $settings['smileys_url'] . '/' . $smiley['filename'])), empty($smiley['isLast']) ? ',' : '';
- }
- if (empty($smileyRow['isLast']) && $numRows != 1)
- echo ',
- \'\': \'\',';
- }
- echo '
- }', $countLocations != 0 ? ',' : '';
- }
- echo '
- }';
- }
-
- echo '
- });
- });
- // ]]></script>';
- }
- function template_control_richedit_buttons($editor_id)
- {
- global $context, $settings, $options, $txt, $modSettings, $scripturl;
- $editor_context = &$context['controls']['richedit'][$editor_id];
- echo '
- <input type="submit" value="', isset($editor_context['labels']['post_button']) ? $editor_context['labels']['post_button'] : $txt['post'], '" tabindex="', $context['tabindex']++, '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit" />';
- if ($editor_context['preview_type'])
- echo '
- <input type="submit" name="preview" value="', isset($editor_context['labels']['preview_button']) ? $editor_context['labels']['preview_button'] : $txt['preview'], '" tabindex="', $context['tabindex']++, '" onclick="', $editor_context['preview_type'] == 2 ? 'return event.ctrlKey || previewPost();' : 'return submitThisOnce(this);', '" accesskey="p" class="button_submit" />';
- if ($context['show_spellchecking'])
- echo '
- <input type="button" value="', $txt['spell_check'], '" tabindex="', $context['tabindex']++, '" onclick="oEditorHandle_', $editor_id, '.spellCheckStart();" class="button_submit" />';
- }
- function template_control_verification($verify_id, $display_type = 'all', $reset = false)
- {
- global $context, $settings, $options, $txt, $modSettings;
- $verify_context = &$context['controls']['verification'][$verify_id];
-
- if (empty($verify_context['tracking']) || $reset)
- $verify_context['tracking'] = 0;
-
- $total_items = count($verify_context['questions']) + ($verify_context['show_visual'] ? 1 : 0);
-
- if ($verify_context['tracking'] > $total_items)
- return false;
-
- for ($i = 0; $i < $total_items; $i++)
- {
-
- if ($display_type == 'single' && $verify_context['tracking'] != $i)
- continue;
- if ($display_type != 'single')
- echo '
- <div id="verification_control_', $i, '" class="verification_control">';
-
- if ($i == 0 && $verify_context['show_visual'])
- {
- if ($context['use_graphic_library'])
- echo '
- <img src="', $verify_context['image_href'], '" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '" />';
- else
- echo '
- <img src="', $verify_context['image_href'], ';letter=1" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_1" />
- <img src="', $verify_context['image_href'], ';letter=2" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_2" />
- <img src="', $verify_context['image_href'], ';letter=3" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_3" />
- <img src="', $verify_context['image_href'], ';letter=4" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_4" />
- <img src="', $verify_context['image_href'], ';letter=5" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_5" />
- <img src="', $verify_context['image_href'], ';letter=6" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_6" />';
- if (WIRELESS)
- echo '<br />
- <input type="text" name="', $verify_id, '_vv[code]" value="', !empty($verify_context['text_value']) ? $verify_context['text_value'] : '', '" size="30" tabindex="', $context['tabindex']++, '" class="input_text" />';
- else
- echo '
- <div class="smalltext" style="margin: 4px 0 8px 0;">
- <a href="', $verify_context['image_href'], ';sound" id="visual_verification_', $verify_id, '_sound" rel="nofollow">', $txt['visual_verification_sound'], '</a> / <a href="#visual_verification_', $verify_id, '_refresh" id="visual_verification_', $verify_id, '_refresh">', $txt['visual_verification_request_new'], '</a>', $display_type != 'quick_reply' ? '<br />' : '', '<br />
- ', $txt['visual_verification_description'], ':', $display_type != 'quick_reply' ? '<br />' : '', '
- <input type="text" name="', $verify_id, '_vv[code]" value="', !empty($verify_context['text_value']) ? $verify_context['text_value'] : '', '" size="30" tabindex="', $context['tabindex']++, '" class="input_text" />
- </div>';
- }
- else
- {
-
- $qIndex = $verify_context['show_visual'] ? $i - 1 : $i;
- echo '
- <div class="smalltext">
- ', $verify_context['questions'][$qIndex]['q'], ':<br />
- <input type="text" name="', $verify_id, '_vv[q][', $verify_context['questions'][$qIndex]['id'], ']" size="30" value="', $verify_context['questions'][$qIndex]['a'], '" ', $verify_context['questions'][$qIndex]['is_error'] ? 'style="border: 1px red solid;"' : '', ' tabindex="', $context['tabindex']++, '" class="input_text" />
- </div>';
- }
- if ($display_type != 'single')
- echo '
- </div>';
-
- if ($display_type == 'single' && $verify_context['tracking'] == $i)
- break;
- }
-
- $verify_context['tracking']++;
-
- if ($display_type == 'single')
- return true;
- }
- ?>
|