From 7850588ab8c1485fe5bc8fdf2ac49bf351f293c2 Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 12 Dec 2006 22:06:37 +0000 Subject: [PATCH] MDL-7909 add optional id parameter to choose_from_menu() and print_textarea() + minor quoting improvement in choose_from_menu() --- lib/form/htmleditor.php | 5 +++-- lib/weblib.php | 28 +++++++++++++++++++--------- message/send.php | 2 +- mod/lesson/action/editpage.php | 14 +++++++------- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/lib/form/htmleditor.php b/lib/form/htmleditor.php index 442dbc619f..5d5e2f7f4c 100644 --- a/lib/form/htmleditor.php +++ b/lib/form/htmleditor.php @@ -43,7 +43,7 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{ function toHtml(){ if ($this->_options['canUseHtmlEditor'] && !$this->_flagFrozen){ ob_start(); - use_html_editor($this->getName()); + use_html_editor($this->getName(), '', $this->getAttribute('id')); $script=ob_get_clean(); } else { $script=''; @@ -60,7 +60,8 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{ $this->getName(), preg_replace("/(\r\n|\n|\r)/", ' ',$this->getValue()), $this->_options['course'], - true).$script; + true, + $this->getAttribute('id')).$script; } } //end func toHtml diff --git a/lib/weblib.php b/lib/weblib.php index 89573236a4..64b9e8c954 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -666,7 +666,7 @@ function close_window($delay=0) { * @todo Finish documenting this function */ function choose_from_menu ($options, $name, $selected='', $nothing='choose', $script='', - $nothingvalue='0', $return=false, $disabled=false, $tabindex=0) { + $nothingvalue='0', $return=false, $disabled=false, $tabindex=0, $id='') { if ($nothing == 'choose') { $nothing = get_string('choose') .'...'; @@ -681,10 +681,13 @@ function choose_from_menu ($options, $name, $selected='', $nothing='choose', $sc $attributes .= ' tabindex="'.$tabindex.'"'; } - $id = str_replace('[]', '', $name); // name may end in [], which would make an invalid id. e.g. numeric question type editing form. - $output = '' . "\n"; if ($nothing) { - $output .= '