MDL-14741: use the default html editor, as chosen in the admin settings

This commit is contained in:
scyrma 2008-06-05 09:36:55 +00:00
parent c7b4be096a
commit b26be9a9cd
3 changed files with 37 additions and 4 deletions

View File

@ -61,9 +61,8 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
function toHtml(){
if ($this->_canUseHtmlEditor && !$this->_flagFrozen){
ob_start();
use_html_editor($this->getName(), '', $this->getAttribute('id'));
$script=ob_get_clean();
global $htmlEditorObject;
$script = $htmlEditorObject->activateEditor($this->getName(), $this->getAttribute('id'));
} else {
$script='';
}
@ -96,4 +95,4 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
return $html . $this->_getPersistantData();
} //end func getFrozenHtml
}
?>
?>

View File

@ -6131,6 +6131,33 @@ function ini_get_bool($ini_get_arg) {
return false;
}
/**
* Get the list of available HTML editors
*/
function get_available_html_editors() {
global $CFG;
static $editors = null;
if ($editors != null) {
return $editors;
}
$editors = array();
$dir = opendir($CFG->libdir .'/editor');
while (($file = readdir($dir)) !== false) {
if ($file != '.' and $file != '..') {
$path_file = $CFG->libdir ."/editor/{$file}";
if (is_dir($path_file) and file_exists($path_file .'.js.php')) {
$editors[] = $file;
}
}
}
closedir($dir);
return $editors;
}
/**
* Determines if the HTML editor is enabled.
*

View File

@ -2557,11 +2557,18 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
$bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
require_once($CFG->libdir .'/editor/htmlEditor.class.php');
global $htmlEditorObject;
$htmlEditorObject = new htmlEditor();
$htmlEditor = $htmlEditorObject->configure();
ob_start();
include($CFG->header);
$output = ob_get_contents();
ob_end_clean();
$output = str_replace('</head>', "\n\n$htmlEditor\n\n</head>", $output);
// container debugging info
$THEME->open_header_containers = open_containers();