Commit a0424281 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Use web.php's tinyMCE init for blog posts

parent e57daf72
......@@ -676,35 +676,6 @@ function blogpostExecCommandHandler(editor_id, elm, command, user_interface, val
EOF;
// Override the default Mahara tinyMCE.init(); Add an image button and
// the execcommand_callback.
$content_css = json_encode(theme_get_url('style/tinymce.css'));
$language = substr(current_language(), 0, 2);
$wwwroot = json_encode(get_config('wwwroot'));
$tinymceinit = <<<EOF
<script type="text/javascript">
tinyMCE.init({
mode: "textareas",
editor_selector: 'wysiwyg',
button_tile_map: true,
language: '{$language}',
theme: "advanced",
plugins: "table,emotions,iespell,inlinepopups,paste",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,forecolor,backcolor,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,hr,emotions,iespell,cleanup,separator,link,unlink,image,separator,code",
theme_advanced_buttons2 : "bullist,numlist,separator,tablecontrols,separator,cut,copy,paste,pasteword",
theme_advanced_buttons3 : "fontselect,separator,fontsizeselect,separator,formatselect",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "center",
content_css : {$content_css},
execcommand_callback : "blogpostExecCommandHandler",
document_base_url: {$wwwroot},
relative_urls: false
});
</script>
EOF;
$draftform = pieform(array(
'name' => 'draftpost',
'plugintype' => 'artefact',
......@@ -724,8 +695,8 @@ $draftform = pieform(array(
$smarty = smarty(array('tablerenderer', 'artefact/file/js/file.js'),
array(), array(), array('tinymceinit' => $tinymceinit));
$smarty = smarty(array('tablerenderer', 'artefact/file/js/file.js', 'tinymce'),
array(), array(), array('tinymcecommandcallback' => 'blogpostExecCommandHandler'));
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->assign_by_ref('textinputform', $textinputform);
$smarty->assign_by_ref('draftform', $draftform);
......
......@@ -116,15 +116,15 @@ function &smarty($javascript = array(), $headers = array(), $pagestrings = array
if (!$found_tinymce) {
$found_tinymce = $check[$key];
$javascript_array[] = $jsroot . 'tinymce/tiny_mce.js';
if (isset($extraconfig['tinymceinit'])) {
$headers[] = $extraconfig['tinymceinit'];
$content_css = json_encode(theme_get_url('style/tinymce.css'));
$language = substr(current_language(), 0, 2);
$execcommand = '';
if (isset($extraconfig['tinymcecommandcallback'])) {
$execcommand = 'execcommand_callback: "' . $extraconfig['tinymcecommandcallback'] . '",';
}
else {
$content_css = json_encode(theme_get_url('style/tinymce.css'));
$language = substr(current_language(), 0, 2);
if ($check[$key] == 'tinymce') {
$tinymce_config = <<<EOF
if ($check[$key] == 'tinymce') {
$tinymce_config = <<<EOF
editor_selector: 'wysiwyg',
theme: "advanced",
plugins: "table,emotions,iespell,inlinepopups,paste",
......@@ -135,9 +135,9 @@ function &smarty($javascript = array(), $headers = array(), $pagestrings = array
theme_advanced_toolbar_align : "center",
width: '512',
EOF;
}
else {
$tinymce_config = <<<EOF
}
else {
$tinymce_config = <<<EOF
editor_selector: 'tinywysiwyg',
theme: "advanced",
plugins: "fullscreen",
......@@ -155,14 +155,15 @@ EOF;
theme_advanced_buttons3 : "fontselect,separator,fontsizeselect,separator,formatselect"
},
EOF;
}
}
$headers[] = <<<EOF
$headers[] = <<<EOF
<script type="text/javascript">
tinyMCE.init({
mode: "textareas",
button_tile_map: true,
{$tinymce_config}
{$execcommand}
language: '{$language}',
content_css : {$content_css},
document_base_url: {$jswwwroot},
......@@ -171,7 +172,6 @@ tinyMCE.init({
</script>
EOF;
}
unset($check[$key]);
}
else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment