From: scyrma Date: Fri, 29 Aug 2008 09:54:44 +0000 (+0000) Subject: MDL-14741: clean up some old code. This needs to be confirmed backward-compatible. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=88c8d1619458bfbb9d51a8ad6e1d75c2f667fbf9;p=moodle.git MDL-14741: clean up some old code. This needs to be confirmed backward-compatible. --- diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index c71b5272e1..a0d3062ab9 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -1046,3 +1046,6 @@ function table_column($table, $oldfield, $field, $type='integer', $size='10', error('table_column() was removed, please use new ddl functions'); } +function use_html_editor($name='', $editorhidebuttons='', $id='') { + error('use_html_editor() not available anymore'); +} diff --git a/lib/form/htmleditor.php b/lib/form/htmleditor.php index 88d148864e..22e39f6e0f 100644 --- a/lib/form/htmleditor.php +++ b/lib/form/htmleditor.php @@ -77,7 +77,7 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{ $this->_options['height'], $this->getName(), preg_replace("/(\r\n|\n|\r)/", ' ',$this->getValue()), - $this->_options['course'], + 0, // unused anymore true, $this->getAttribute('id')); } diff --git a/lib/weblib.php b/lib/weblib.php index ab7ae009ff..cb2296498e 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -4809,19 +4809,17 @@ function print_recent_activity_note($time, $user, $text, $link, $return=false, $ * @param null $height (Deprecated) Height of the element; if a value is passe, the minimum value for $rows will be 10. Value is otherwise ignored. * @param string $name Name to use for the textarea element. * @param string $value Initial content to display in the textarea. - * @param int $courseid Course ID to pass to the file manager (defaults to global $COURSE->id). + * @param int $obsolete deprecated * @param bool $return If false, will output string. If true, will return string value. * @param string $id CSS ID to add to the textarea element. * @param string $editorclass CSS classes to add to the textarea element when using the htmleditor. Use 'form-textarea-simple' to get a basic editor. Defaults to 'form-textarea-advanced' (complete editor). If this is null or invalid, the htmleditor will not show for this field. */ -function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value='', $courseid=0, $return=false, $id='', $editorclass='form-textarea-advanced') { -/// $width and height are legacy fields and no longer used as pixels like they used to be. -/// However, you can set them to zero to override the mincols and minrows values below. +function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value='', $obsolete=0, $return=false, $id='', $editorclass='form-textarea-advanced') { + /// $width and height are legacy fields and no longer used as pixels like they used to be. + /// However, you can set them to zero to override the mincols and minrows values below. global $CFG, $COURSE, $HTTPSPAGEREQUIRED, $THEME; - //static $scriptcount = 0; // For loading the htmlarea script only once. - //var_dump(unserialize($COURSE->modinfo)); $mincols = 65; $minrows = 10; $str = ''; @@ -4830,38 +4828,12 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v $id = 'edit-'.$name; } - if ( empty($CFG->editorsrc) ) { // for backward compatibility. - if (empty($courseid)) { - $courseid = $COURSE->id; + if ( empty($CFG->editorsrc) && $usehtmleditor ) { // for backward compatibility. + if ($height && ($rows < $minrows)) { + $rows = $minrows; } - - if ($usehtmleditor) { - -// if (!empty($courseid) and has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $courseid))) { -// $httpsrequired = empty($HTTPSPAGEREQUIRED) ? '' : '&httpsrequired=1'; -// // needed for course file area browsing in image insert plugin -// $str .= ($scriptcount < 1) ? ''."\n" : ''; -// } else { -// $httpsrequired = empty($HTTPSPAGEREQUIRED) ? '' : '?httpsrequired=1'; -// $str .= ($scriptcount < 1) ? ''."\n" : ''; - -// } -// $str .= ($scriptcount < 1) ? ''."\n" : ''; -// $scriptcount++; - - if ($height) { // Usually with legacy calls - if ($rows < $minrows) { - $rows = $minrows; - } - } - if ($width) { // Usually with legacy calls - if ($cols < $mincols) { - $cols = $mincols; - } - } + if ($width && ($cols < $mincols)) { + $cols = $mincols; } } @@ -4909,103 +4881,6 @@ document.write(\''.addslashes_js(editorshortcutshelpbutton()).'\'); echo $str; } -/** - * Sets up the HTML editor on textareas in the current page. - * If a field name is provided, then it will only be - * applied to that field - otherwise it will be used - * on every textarea in the page. - * - * In most cases no arguments need to be supplied - * - * @param string $name Form element to replace with HTMl editor by name - */ -function use_html_editor($name='', $editorhidebuttons='', $id='') { - global $THEME; - - $editor = 'editor_'.md5($name); //name might contain illegal characters - if ($id === '') { - $id = 'edit-'.$name; - } - echo "\n".''."\n"; -} - -function print_editor_config($editorhidebuttons='', $return=false) { - global $CFG; - - $str = "config.pageStyle = \"body {"; - - if (!(empty($CFG->editorbackgroundcolor))) { - $str .= " background-color: $CFG->editorbackgroundcolor;"; - } - - if (!(empty($CFG->editorfontfamily))) { - $str .= " font-family: $CFG->editorfontfamily;"; - } - - if (!(empty($CFG->editorfontsize))) { - $str .= " font-size: $CFG->editorfontsize;"; - } - - $str .= " }\";\n"; - $str .= "config.killWordOnPaste = "; - $str .= (empty($CFG->editorkillword)) ? "false":"true"; - $str .= ';'."\n"; - $str .= 'config.fontname = {'."\n"; - - $fontlist = isset($CFG->editorfontlist) ? explode(';', $CFG->editorfontlist) : array(); - $i = 1; // Counter is used to get rid of the last comma. - - foreach ($fontlist as $fontline) { - if (!empty($fontline)) { - if ($i > 1) { - $str .= ','."\n"; - } - list($fontkey, $fontvalue) = split(':', $fontline); - $str .= '"'. $fontkey ."\":\t'". $fontvalue ."'"; - - $i++; - } - } - $str .= '};'; - - if (!empty($editorhidebuttons)) { - $str .= "\nconfig.hideSomeButtons(\" ". $editorhidebuttons ." \");\n"; - } else if (!empty($CFG->editorhidebuttons)) { - $str .= "\nconfig.hideSomeButtons(\" ". $CFG->editorhidebuttons ." \");\n"; - } - - if (!empty($CFG->editorspelling) && !empty($CFG->aspellpath)) { - $str .= print_speller_code($CFG->htmleditor, true); - } - - if ($return) { - return $str; - } - echo $str; -} - /** * Returns a turn edit on/off button for course in a self contained form. * Used to be an icon, but it's now a simple form button