Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
a0424281
Commit
a0424281
authored
Jan 29, 2008
by
Richard Mansfield
Browse files
Use web.php's tinyMCE init for blog posts
parent
e57daf72
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/blog/post.php
View file @
a0424281
...
...
@@ -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
(
'tinymce
init'
=>
$tinymceinit
));
$smarty
=
smarty
(
array
(
'tablerenderer'
,
'artefact/file/js/file.js'
,
'tinymce'
),
array
(),
array
(),
array
(
'tinymce
commandcallback'
=>
'blogpostExecCommandHandler'
));
$smarty
->
assign
(
'INLINEJAVASCRIPT'
,
$javascript
);
$smarty
->
assign_by_ref
(
'textinputform'
,
$textinputform
);
$smarty
->
assign_by_ref
(
'draftform'
,
$draftform
);
...
...
htdocs/lib/web.php
View file @
a0424281
...
...
@@ -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
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment