', $html); // quickfix to stop this box appearing before doc.ready
}
}
$params['switcheditor'] = isset($params['switcheditor']) ? $params['switcheditor'] : 'y';
$smarty->assign('comments', $params['comments']); // 3 probably removable assigns
$smarty->assign('switcheditor', $params['switcheditor']);
$smarty->assign('toolbar_section', $params['section']);
if ($prefs['feature_ajax'] == 'y' && $prefs['ajax_autosave'] == 'y' && $params['_simple'] == 'n' && $params['autosave'] == 'y') {
// retrieve autosaved content
$smarty->loadPlugin('smarty_block_self_link');
$auto_save_referrer = TikiLib::lib('autosave')->ensureReferrer();
if (empty($_REQUEST['autosave'])) {
$_REQUEST['autosave'] = 'n';
}
if (TikiLib::lib('autosave')->has_autosave($as_id, $auto_save_referrer)) {
// and $params['preview'] == 0 - why not?
$auto_saved = str_replace("\n", "\r\n", TikiLib::lib('autosave')->get_autosave($as_id, $auto_save_referrer));
if (strcmp($auto_saved, $content) === 0) {
$auto_saved = '';
}
if (empty($auto_saved) || (isset($_REQUEST['mode_wysiwyg']) && $_REQUEST['mode_wysiwyg'] === 'y')) {
// switching modes, ignore auto save
TikiLib::lib('autosave')->remove_save($as_id, $auto_save_referrer);
} else {
$msg = '
' . tra('There is an autosaved draft of your recent edits, to use it instead ') . ' ' .
'' . tra('If you want the original instead of the autosaved draft of your edits') . ' ' .
smarty_block_self_link([ '_ajax' => 'n', '_onclick' => 'toggle_autosaved(\'' . $as_id . '\',\'' . $auto_save_referrer . '\');return false;'], tra('click here'), $smarty) . "
";
$remrepeat = false;
$auto_save_warning = smarty_block_remarksbox([ 'type' => 'info', 'title' => tra('AutoSave')], $msg, $smarty, $remrepeat) . "\n";
}
}
$headerlib->add_jq_onready("register_id('$as_id','" . addcslashes($auto_save_referrer, "'") . "');");
$headerlib->add_js("var autoSaveId = '" . addcslashes($auto_save_referrer, "'") . "';");
}
if ($prefs['feature_notify_users_mention'] === 'y' && $prefs['feature_tag_users'] === 'y') {
$headerlib->add_jsfile('lib/jquery_tiki/user_mentions.js');
$headerlib->add_jq_onready("$('#$as_id').userMentions();");
}
if ($params['_wysiwyg'] == 'y' && $params['_simple'] == 'n') {
// TODO cope with wysiwyg and simple
$wysiwyglib = TikiLib::lib('wysiwyg');
if (! isset($params['name'])) {
$params['name'] = 'edit';
}
$ckoptions = $wysiwyglib->setUpEditor($params['_is_html'], $as_id, $params, $auto_save_referrer);
$html .= '
';
$html .= '