/**
 * @name      Dismissible Notices
 * @copyright Dismissible Notices contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * @version 0.0.1
 *
 */
function template_notices_above()
{
    global $context, $txt, $scripturl;
    echo '
	<noscript>
		<div id="notices">';
    foreach ($context['notices'] as $notice) {
        addInlineJavascript('
		setTimeout(function() {
			$' . ($notice['positioning']['element'] !== 'global' && !empty($notice['positioning']['element_name']) ? '(".' . $notice['positioning']['element_name'] . '")' : '') . '.notify({
				title: ' . JavaScriptEscape($notice['body']) . ',
				button: ' . JavaScriptEscape($txt['dismiss_notice_dismis']) . ',
				cancel: ' . JavaScriptEscape($txt['dismiss_notice_cancel']) . ',
				id: ' . JavaScriptEscape($notice['id_notice']) . '
			}, {
				style: \'default\',
				className:  ' . javaScriptEscape($notice['class']) . ',
				autoHide: ' . ($context['user']['is_guest'] ? 'true' : 'false') . ',
				position: ' . javaScriptEscape(dismissnotices_translate_positions($notice['positioning']['position'])) . ',
				clickToHide: false
			});
		}, 500);', true);
        echo '
			<div class="' . $notice['class'] . '">
				' . $notice['body'] . '<br />
				<a href="' . $scripturl . '?action=dismissnotice;url=' . urlencode($_SERVER['REQUEST_URL']) . $txt['dismiss_notice_dismis'] . '">X</a>,
			</div>';
    }
    echo '
		</div>
	</noscript>';
}
Esempio n. 2
0
    /**
     * Creates the javascript code for localization of the editor (SCEditor)
     */
    public function action_sceditor()
    {
        global $txt, $editortxt;
        $this->_prepareLocale('Editor');
        // If we don't have any locale better avoid broken js
        if (empty($txt['lang_locale']) || empty($editortxt)) {
            die;
        }
        $this->_file_data = '(function ($) {
		\'use strict\';

		$.sceditor.locale[' . javaScriptEscape($txt['lang_locale']) . '] = {';
        foreach ($editortxt as $key => $val) {
            $this->_file_data .= '
			' . javaScriptEscape($key) . ': ' . javaScriptEscape($val) . ',';
        }
        $this->_file_data .= '
			dateFormat: "day.month.year"
		}
	})(jQuery);';
        $this->_sendFile();
    }
Esempio n. 3
0
    /**
     * Let the administrator(s) edit the news items for the forum.
     *
     * What it does:
     * - It writes an entry into the moderation log.
     * - This function uses the edit_news administration area.
     * - Called by ?action=admin;area=news.
     * - Requires the edit_news permission.
     * - Can be accessed with ?action=admin;sa=editnews.
     */
    public function action_editnews()
    {
        global $txt, $modSettings, $context, $scripturl;
        require_once SUBSDIR . '/Post.subs.php';
        // The 'remove selected' button was pressed.
        if (!empty($_POST['delete_selection']) && !empty($_POST['remove'])) {
            checkSession();
            // Store the news temporarily in this array.
            $temp_news = explode("\n", $modSettings['news']);
            // Remove the items that were selected.
            foreach ($temp_news as $i => $news) {
                if (in_array($i, $_POST['remove'])) {
                    unset($temp_news[$i]);
                }
            }
            // Update the database.
            updateSettings(array('news' => implode("\n", $temp_news)));
            logAction('news');
        } elseif (!empty($_POST['save_items'])) {
            checkSession();
            foreach ($_POST['news'] as $i => $news) {
                if (trim($news) == '') {
                    unset($_POST['news'][$i]);
                } else {
                    $_POST['news'][$i] = Util::htmlspecialchars($_POST['news'][$i], ENT_QUOTES);
                    preparsecode($_POST['news'][$i]);
                }
            }
            // Send the new news to the database.
            updateSettings(array('news' => implode("\n", $_POST['news'])));
            // Log this into the moderation log.
            logAction('news');
        }
        // We're going to want this for making our list.
        require_once SUBSDIR . '/GenericList.class.php';
        require_once SUBSDIR . '/News.subs.php';
        $context['page_title'] = $txt['admin_edit_news'];
        // Use the standard templates for showing this.
        $listOptions = array('id' => 'news_lists', 'get_items' => array('function' => 'getNews'), 'columns' => array('news' => array('header' => array('value' => $txt['admin_edit_news']), 'data' => array('function' => create_function('$news', '
							return \'<textarea class="" id="data_\' . $news[\'id\'] . \'" rows="3" name="news[]">\' . $news[\'unparsed\'] . \'</textarea>
								<br />
								<div id="preview_\' . $news[\'id\'] . \'"></div>\';
						'), 'class' => 'newsarea')), 'preview' => array('header' => array('value' => $txt['preview']), 'data' => array('function' => create_function('$news', '
							return \'<div id="box_preview_\' . $news[\'id\'] . \'">\' . $news[\'parsed\'] . \'</div>\';
						'), 'class' => 'newspreview')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />', 'class' => 'centertext'), 'data' => array('function' => create_function('$news', '
							if (is_numeric($news[\'id\']))
								return \'<input type="checkbox" name="remove[]" value="\' . $news[\'id\'] . \'" class="input_check" />\';
							else
								return \'\';
						'), 'class' => 'centertext'))), 'form' => array('href' => $scripturl . '?action=admin;area=news;sa=editnews', 'hidden_fields' => array($context['session_var'] => $context['session_id'])), 'additional_rows' => array(array('position' => 'bottom_of_list', 'class' => 'submitbutton', 'value' => '
					<input type="submit" name="save_items" value="' . $txt['save'] . '" class="right_submit" />
					<input type="submit" name="delete_selection" value="' . $txt['editnews_remove_selected'] . '" onclick="return confirm(\'' . $txt['editnews_remove_confirm'] . '\');" class="right_submit" />
					<span id="moreNewsItems_link" style="display: none;">
						<a class="linkbutton" href="javascript:void(0);" onclick="addAnotherNews(); return false;">' . $txt['editnews_clickadd'] . '</a>
					</span>')), 'javascript' => '
			document.getElementById(\'list_news_lists_last\').style.display = "none";
			document.getElementById("moreNewsItems_link").style.display = "";
			var last_preview = 0;
			var txt_preview = ' . javaScriptEscape($txt['preview']) . ';
			var txt_news_error_no_news = ' . javaScriptEscape($txt['news_error_no_news']) . ';

			$(document).ready(function () {
				$("div[id ^= \'preview_\']").each(function () {
					var preview_id = $(this).attr(\'id\').split(\'_\')[1];
					if (last_preview < preview_id)
						last_preview = preview_id;
					make_preview_btn(preview_id);
				});
			});
		');
        // Create the request list.
        createList($listOptions);
        $context['sub_template'] = 'show_list';
        $context['default_list'] = 'news_lists';
    }
Esempio n. 4
0
/**
 * Creates a box that can be used for richedit stuff like BBC, Smileys etc.
 * @param array $editorOptions
 */
function create_control_richedit($editorOptions)
{
    global $txt, $modSettings, $options, $smcFunc;
    global $context, $settings, $user_info, $sourcedir, $scripturl;
    // Load the Post language file... for the moment at least.
    loadLanguage('Post');
    // Every control must have a ID!
    assert(isset($editorOptions['id']));
    assert(isset($editorOptions['value']));
    // Is this the first richedit - if so we need to ensure some template stuff is initialised.
    if (empty($context['controls']['richedit'])) {
        // Some general stuff.
        $settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set'];
        // This really has some WYSIWYG stuff.
        loadTemplate('GenericControls', 'jquery.sceditor');
        // JS makes the editor go round
        loadJavascriptFile('editor.js', array('default_theme' => true), 'smf_editor');
        loadJavascriptFile('jquery.sceditor.js', array('default_theme' => true));
        loadJavascriptFile('jquery.sceditor.bbcode.js', array('default_theme' => true));
        addInlineJavascript('
		var smf_smileys_url = \'' . $settings['smileys_url'] . '\';
		var bbc_quote_from = \'' . addcslashes($txt['quote_from'], "'") . '\';
		var bbc_quote = \'' . addcslashes($txt['quote'], "'") . '\';
		var bbc_search_on = \'' . addcslashes($txt['search_on'], "'") . '\';');
        // editor language file
        if (!empty($txt['lang_locale']) && $txt['lang_locale'] != 'en_US') {
            loadJavascriptFile($scripturl . '?action=loadeditorlocale', array(), 'sceditor_language');
        }
        $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');
        if ($context['show_spellchecking']) {
            loadJavascriptFile('spellcheck.js', array('default_theme' => true));
            // Some hidden information is needed in order to make the spell checking work.
            if (!isset($_REQUEST['xml'])) {
                $context['insert_after_template'] .= '
		<form name="spell_form" id="spell_form" method="post" accept-charset="' . $context['character_set'] . '" target="spellWindow" action="' . $scripturl . '?action=spellcheck">
			<input type="hidden" name="spellstring" value="" />
		</form>';
            }
        }
    }
    // Start off the editor...
    $context['controls']['richedit'][$editorOptions['id']] = array('id' => $editorOptions['id'], 'value' => $editorOptions['value'], 'rich_value' => $editorOptions['value'], 'rich_active' => empty($modSettings['disable_wysiwyg']) && (!empty($options['wysiwyg_default']) || !empty($editorOptions['force_rich']) || !empty($_REQUEST[$editorOptions['id'] . '_mode'])), 'disable_smiley_box' => !empty($editorOptions['disable_smiley_box']), 'columns' => isset($editorOptions['columns']) ? $editorOptions['columns'] : 60, 'rows' => isset($editorOptions['rows']) ? $editorOptions['rows'] : 18, 'width' => isset($editorOptions['width']) ? $editorOptions['width'] : '70%', 'height' => isset($editorOptions['height']) ? $editorOptions['height'] : '250px', 'form' => isset($editorOptions['form']) ? $editorOptions['form'] : 'postmodify', 'bbc_level' => !empty($editorOptions['bbc_level']) ? $editorOptions['bbc_level'] : 'full', 'preview_type' => isset($editorOptions['preview_type']) ? (int) $editorOptions['preview_type'] : 1, 'labels' => !empty($editorOptions['labels']) ? $editorOptions['labels'] : array(), 'locale' => !empty($txt['lang_locale']) && substr($txt['lang_locale'], 0, 5) != 'en_US' ? $txt['lang_locale'] : '');
    // Switch between default images and back... mostly in case you don't have an PersonalMessage template, but do have a Post template.
    if (isset($settings['use_default_images']) && $settings['use_default_images'] == 'defaults' && isset($settings['default_template'])) {
        $temp1 = $settings['theme_url'];
        $settings['theme_url'] = $settings['default_theme_url'];
        $temp2 = $settings['images_url'];
        $settings['images_url'] = $settings['default_images_url'];
        $temp3 = $settings['theme_dir'];
        $settings['theme_dir'] = $settings['default_theme_dir'];
    }
    if (empty($context['bbc_tags'])) {
        // The below array makes it dead easy to add images to this control. Add it to the array and everything else is done for you!
        /*
        	array(
        		'image' => 'bold',
        		'code' => 'b',
        		'before' => '[b]',
        		'after' => '[/b]',
        		'description' => $txt['bold'],
        	),
        */
        $context['bbc_tags'] = array();
        $context['bbc_tags'][] = array(array('code' => 'bold', 'description' => $txt['bold']), array('code' => 'italic', 'description' => $txt['italic']), array('code' => 'underline', 'description' => $txt['underline']), array('code' => 'strike', 'description' => $txt['strike']), array(), array('code' => 'pre', 'description' => $txt['preformatted']), array('code' => 'left', 'description' => $txt['left_align']), array('code' => 'center', 'description' => $txt['center']), array('code' => 'right', 'description' => $txt['right_align']));
        $context['bbc_tags'][] = array(array('code' => 'flash', 'description' => $txt['flash']), array('code' => 'image', 'description' => $txt['image']), array('code' => 'link', 'description' => $txt['hyperlink']), array('code' => 'email', 'description' => $txt['insert_email']), array('code' => 'ftp', 'description' => $txt['ftp']), array(), array('code' => 'glow', 'description' => $txt['glow']), array('code' => 'shadow', 'description' => $txt['shadow']), array('code' => 'move', 'description' => $txt['marquee']), array(), array('code' => 'superscript', 'description' => $txt['superscript']), array('code' => 'subscript', 'description' => $txt['subscript']), array('code' => 'tt', 'description' => $txt['teletype']), array(), array('code' => 'table', 'description' => $txt['table']), array('code' => 'code', 'description' => $txt['bbc_code']), array('code' => 'quote', 'description' => $txt['bbc_quote']), array(), array('code' => 'bulletlist', 'description' => $txt['list_unordered']), array('code' => 'orderedlist', 'description' => $txt['list_ordered']), array('code' => 'horizontalrule', 'description' => $txt['horizontal_rule']));
        // Allow mods to modify BBC buttons.
        call_integration_hook('integrate_bbc_buttons');
        // Show the toggle?
        if (empty($modSettings['disable_wysiwyg'])) {
            $context['bbc_tags'][count($context['bbc_tags']) - 1][] = array();
            $context['bbc_tags'][count($context['bbc_tags']) - 1][] = array('code' => 'unformat', 'description' => $txt['unformat_text']);
            $context['bbc_tags'][count($context['bbc_tags']) - 1][] = array('code' => 'toggle', 'description' => $txt['toggle_view']);
        }
        // Generate a list of buttons that shouldn't be shown - this should be the fastest way to do this.
        $disabled_tags = array();
        if (!empty($modSettings['disabledBBC'])) {
            $disabled_tags = explode(',', $modSettings['disabledBBC']);
        }
        if (empty($modSettings['enableEmbeddedFlash'])) {
            $disabled_tags[] = 'flash';
        }
        foreach ($disabled_tags as $tag) {
            if ($tag == 'list') {
                $context['disabled_tags']['bulletlist'] = true;
                $context['disabled_tags']['orderedlist'] = true;
            } elseif ($tag == 'b') {
                $context['disabled_tags']['bold'] = true;
            } elseif ($tag == 'i') {
                $context['disabled_tags']['italic'] = true;
            } elseif ($tag == 'i') {
                $context['disabled_tags']['underline'] = true;
            } elseif ($tag == 'i') {
                $context['disabled_tags']['strike'] = true;
            } elseif ($tag == 'img') {
                $context['disabled_tags']['image'] = true;
            } elseif ($tag == 'url') {
                $context['disabled_tags']['link'] = true;
            } elseif ($tag == 'sup') {
                $context['disabled_tags']['superscript'] = true;
            } elseif ($tag == 'sub') {
                $context['disabled_tags']['subscript'] = true;
            } elseif ($tag == 'hr') {
                $context['disabled_tags']['horizontalrule'] = true;
            }
            $context['disabled_tags'][trim($tag)] = true;
        }
        $bbcodes_styles = '';
        $context['bbcodes_handlers'] = '';
        $context['bbc_toolbar'] = array();
        foreach ($context['bbc_tags'] as $row => $tagRow) {
            if (!isset($context['bbc_toolbar'][$row])) {
                $context['bbc_toolbar'][$row] = array();
            }
            $tagsRow = array();
            foreach ($tagRow as $tag) {
                if (!empty($tag)) {
                    if (empty($context['disabled_tags'][$tag['code']])) {
                        $tagsRow[] = $tag['code'];
                        if (isset($tag['image'])) {
                            $bbcodes_styles .= '
			.sceditor-button-' . $tag['code'] . ' div {
				background: url(\'' . $settings['default_theme_url'] . '/images/bbc/' . $tag['image'] . '.png\');
			}';
                        }
                        if (isset($tag['before'])) {
                            $context['bbcodes_handlers'] = '
				$.sceditor.setCommand(
					' . javaScriptEscape($tag['code']) . ',
					function () {
						this.wysiwygEditorInsertHtml(' . javaScriptEscape($tag['before']) . (isset($tag['after']) ? ', ' . javaScriptEscape($tag['after']) : '') . ');
					},
					' . javaScriptEscape($tag['description']) . ',
					null,
					[' . javaScriptEscape($tag['before']) . (isset($tag['after']) ? ', ' . javaScriptEscape($tag['after']) : '') . ']
				);';
                        }
                    }
                } else {
                    $context['bbc_toolbar'][$row][] = implode(',', $tagsRow);
                    $tagsRow = array();
                }
            }
            if ($row == 0) {
                $context['bbc_toolbar'][$row][] = implode(',', $tagsRow);
                $tagsRow = array();
                if (!isset($context['disabled_tags']['font'])) {
                    $tagsRow[] = 'font';
                }
                if (!isset($context['disabled_tags']['size'])) {
                    $tagsRow[] = 'size';
                }
                if (!isset($context['disabled_tags']['color'])) {
                    $tagsRow[] = 'color';
                }
            } elseif ($row == 1 && empty($modSettings['disable_wysiwyg'])) {
                $tmp = array();
                $tagsRow[] = 'removeformat';
                $tagsRow[] = 'source';
                if (!empty($tmp)) {
                    $tagsRow[] = '|' . implode(',', $tmp);
                }
            }
            if (!empty($tagsRow)) {
                $context['bbc_toolbar'][$row][] = implode(',', $tagsRow);
            }
        }
        if (!empty($bbcodes_styles)) {
            $context['html_headers'] .= '
		<style type="text/css">' . $bbcodes_styles . '
		</style>';
        }
    }
    // Initialize smiley array... if not loaded before.
    if (empty($context['smileys']) && empty($editorOptions['disable_smiley_box'])) {
        $context['smileys'] = array('postform' => array(), 'popup' => array());
        // Load smileys - don't bother to run a query if we're not using the database's ones anyhow.
        if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none') {
            $context['smileys']['postform'][] = array('smileys' => array(array('code' => ':)', 'filename' => 'smiley.gif', 'description' => $txt['icon_smiley']), array('code' => ';)', 'filename' => 'wink.gif', 'description' => $txt['icon_wink']), array('code' => ':D', 'filename' => 'cheesy.gif', 'description' => $txt['icon_cheesy']), array('code' => ';D', 'filename' => 'grin.gif', 'description' => $txt['icon_grin']), array('code' => '>:(', 'filename' => 'angry.gif', 'description' => $txt['icon_angry']), array('code' => ':(', 'filename' => 'sad.gif', 'description' => $txt['icon_sad']), array('code' => ':o', 'filename' => 'shocked.gif', 'description' => $txt['icon_shocked']), array('code' => '8)', 'filename' => 'cool.gif', 'description' => $txt['icon_cool']), array('code' => '???', 'filename' => 'huh.gif', 'description' => $txt['icon_huh']), array('code' => '::)', 'filename' => 'rolleyes.gif', 'description' => $txt['icon_rolleyes']), array('code' => ':P', 'filename' => 'tongue.gif', 'description' => $txt['icon_tongue']), array('code' => ':-[', 'filename' => 'embarrassed.gif', 'description' => $txt['icon_embarrassed']), array('code' => ':-X', 'filename' => 'lipsrsealed.gif', 'description' => $txt['icon_lips']), array('code' => ':-\\', 'filename' => 'undecided.gif', 'description' => $txt['icon_undecided']), array('code' => ':-*', 'filename' => 'kiss.gif', 'description' => $txt['icon_kiss']), array('code' => ':\'(', 'filename' => 'cry.gif', 'description' => $txt['icon_cry'], 'isLast' => true)), 'isLast' => true);
        } elseif ($user_info['smiley_set'] != 'none') {
            if (($temp = cache_get_data('posting_smileys', 480)) == null) {
                $request = $smcFunc['db_query']('', '
					SELECT code, filename, description, smiley_row, hidden
					FROM {db_prefix}smileys
					WHERE hidden IN (0, 2)
					ORDER BY smiley_row, smiley_order', array());
                while ($row = $smcFunc['db_fetch_assoc']($request)) {
                    $row['filename'] = htmlspecialchars($row['filename']);
                    $row['description'] = htmlspecialchars($row['description']);
                    $context['smileys'][empty($row['hidden']) ? 'postform' : 'popup'][$row['smiley_row']]['smileys'][] = $row;
                }
                $smcFunc['db_free_result']($request);
                foreach ($context['smileys'] as $section => $smileyRows) {
                    foreach ($smileyRows as $rowIndex => $smileys) {
                        $context['smileys'][$section][$rowIndex]['smileys'][count($smileys['smileys']) - 1]['isLast'] = true;
                    }
                    if (!empty($smileyRows)) {
                        $context['smileys'][$section][count($smileyRows) - 1]['isLast'] = true;
                    }
                }
                cache_put_data('posting_smileys', $context['smileys'], 480);
            } else {
                $context['smileys'] = $temp;
            }
        }
    }
    // Set a flag so the sub template knows what to do...
    $context['show_bbc'] = !empty($modSettings['enableBBC']) && !empty($settings['show_bbc']);
    // Switch the URLs back... now we're back to whatever the main sub template is.  (like folder in PersonalMessage.)
    if (isset($settings['use_default_images']) && $settings['use_default_images'] == 'defaults' && isset($settings['default_template'])) {
        $settings['theme_url'] = $temp1;
        $settings['images_url'] = $temp2;
        $settings['theme_dir'] = $temp3;
    }
}
Esempio n. 5
0
/**
 * Let the administrator(s) edit the news items for the forum.
 * It writes an entry into the moderation log.
 * This function uses the edit_news administration area.
 * Called by ?action=admin;area=news.
 * Requires the edit_news permission.
 * Can be accessed with ?action=admin;sa=editnews.
 *
 * @uses ManageNews template, edit_news sub template.
 */
function EditNews()
{
    global $txt, $modSettings, $context, $sourcedir, $user_info, $scripturl;
    global $smcFunc;
    require_once $sourcedir . '/Subs-Post.php';
    // The 'remove selected' button was pressed.
    if (!empty($_POST['delete_selection']) && !empty($_POST['remove'])) {
        checkSession();
        // Store the news temporarily in this array.
        $temp_news = explode("\n", $modSettings['news']);
        // Remove the items that were selected.
        foreach ($temp_news as $i => $news) {
            if (in_array($i, $_POST['remove'])) {
                unset($temp_news[$i]);
            }
        }
        // Update the database.
        updateSettings(array('news' => implode("\n", $temp_news)));
        logAction('news');
    } elseif (!empty($_POST['save_items'])) {
        checkSession();
        foreach ($_POST['news'] as $i => $news) {
            if (trim($news) == '') {
                unset($_POST['news'][$i]);
            } else {
                $_POST['news'][$i] = $smcFunc['htmlspecialchars']($_POST['news'][$i], ENT_QUOTES);
                preparsecode($_POST['news'][$i]);
            }
        }
        // Send the new news to the database.
        updateSettings(array('news' => implode("\n", $_POST['news'])));
        // Log this into the moderation log.
        logAction('news');
    }
    // We're going to want this for making our list.
    require_once $sourcedir . '/Subs-List.php';
    $context['page_title'] = $txt['admin_edit_news'];
    // Use the standard templates for showing this.
    $listOptions = array('id' => 'news_lists', 'get_items' => array('function' => 'list_getNews'), 'columns' => array('news' => array('header' => array('value' => $txt['admin_edit_news']), 'data' => array('function' => create_function('$news', '

						if (is_numeric($news[\'id\']))
							return \'<textarea id="data_\' . $news[\'id\'] . \'" rows="3" cols="50" name="news[]" style="\' . (isBrowser(\'is_ie8\') ? \'width: 635px; max-width: 85%; min-width: 85%\' : \'width 100%;margin 0 5em\') . \';">\' . $news[\'unparsed\'] . \'</textarea>
							<br />
							<div class="floatleft" id="preview_\' . $news[\'id\'] . \'"></div>\';
						else
							return $news[\'unparsed\'];
					'), 'style' => 'width: 50%;')), 'preview' => array('header' => array('value' => $txt['preview']), 'data' => array('function' => create_function('$news', '

						return \'<div id="box_preview_\' . $news[\'id\'] . \'" style="overflow: auto; width: 100%; height: 10ex;">\' . $news[\'parsed\'] . \'</div>\';
					'), 'style' => 'width: 45%;')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('function' => create_function('$news', '

						if (is_numeric($news[\'id\']))
							return \'<input type="checkbox" name="remove[]" value="\' . $news[\'id\'] . \'" class="input_check" />\';
						else
							return \'\';
					'), 'style' => 'text-align: center'))), 'form' => array('href' => $scripturl . '?action=admin;area=news;sa=editnews', 'hidden_fields' => array($context['session_var'] => $context['session_id'])), 'additional_rows' => array(array('position' => 'bottom_of_list', 'value' => '
				<span id="moreNewsItems_link" class="floatleft" style="display: none;">
					<a class="button_link" href="javascript:void(0);" onclick="addNewsItem(); return false;">' . $txt['editnews_clickadd'] . '</a>
				</span>
				<input type="submit" name="save_items" value="' . $txt['save'] . '" class="button_submit" />
				<input type="submit" name="delete_selection" value="' . $txt['editnews_remove_selected'] . '" onclick="return confirm(\'' . $txt['editnews_remove_confirm'] . '\');" class="button_submit" />')), 'javascript' => '
					document.getElementById(\'list_news_lists_last\').style.display = "none";
					document.getElementById("moreNewsItems_link").style.display = "";
					var last_preview = 0;

					$(document).ready(function () {
						$("div[id ^= \'preview_\']").each(function () {
							var preview_id = $(this).attr(\'id\').split(\'_\')[1];
							if (last_preview < preview_id)
								last_preview = preview_id;
							make_preview_btn(preview_id);
						});
					});

					function make_preview_btn (preview_id)
					{
						$("#preview_" + preview_id).addClass("button_link");
						$("#preview_" + preview_id).text(\'' . $txt['preview'] . '\').click(function () {
							$.ajax({
								type: "POST",
								url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
								data: {item: "newspreview", news: $("#data_" + preview_id).val()},
								context: document.body,
								success: function(request){
									if ($(request).find("error").text() == \'\')
										$(document).find("#box_preview_" + preview_id).html($(request).text());
									else
										$(document).find("#box_preview_" + preview_id).text(\'' . $txt['news_error_no_news'] . '\');
								},
							});
						});
					}

					function addNewsItem ()
					{
						last_preview++;
						$("#list_news_lists_last").before(' . javaScriptEscape('
						<tr class="windowbg') . ' + (last_preview % 2 == 0 ? \'\' : \'2\') + ' . javaScriptEscape('">
							<td style="width: 50%;">
									<textarea id="data_') . ' + last_preview + ' . javaScriptEscape('" rows="3" cols="65" name="news[]" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 85%; min-width: 85%' : 'width: 95%') . ';"></textarea>
									<br />
									<div class="floatleft" id="preview_') . ' + last_preview + ' . javaScriptEscape('"></div>
							</td>
							<td style="width: 45%;">
								<div id="box_preview_') . ' + last_preview + ' . javaScriptEscape('" style="overflow: auto; width: 100%; height: 10ex;"></div>
							</td>
							<td></td>
						</tr>') . ');
						make_preview_btn(last_preview);
					}');
    // Create the request list.
    createList($listOptions);
    $context['sub_template'] = 'show_list';
    $context['default_list'] = 'news_lists';
}