From: vyshane Date: Tue, 14 Mar 2006 08:32:14 +0000 (+0000) Subject: Made textarea field use use_html_editor() and print_editor_config() from X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c969c28772005c4a38ea198f703a5ca1ed8fb375;p=moodle.git Made textarea field use use_html_editor() and print_editor_config() from /lib/weblib.php. Removed these functions from /lib/mod/field/textarea/field.class.php. Will commit updates to these functions to Moodle 1.5 Stable. Database module will only be compatible with the latest Moodle 1.5 Stable and onwards. --- diff --git a/mod/data/templates.php b/mod/data/templates.php index 1124160090..19df48b98d 100755 --- a/mod/data/templates.php +++ b/mod/data/templates.php @@ -72,15 +72,22 @@ $strdata = get_string('modulenameplural','data'); + // For the javascript for inserting template tags: initialise the default textarea to + // 'edit_template' - it is always present in all different possible views. + $bodytag = 'onload="'; + $bodytag .= 'currEditor = edit_template; '; + $bodytag .= 'currTextarea = document.tempform.template;'; + $bodytag .= '" '; + print_header_simple($data->name, '', "$strdata -> $data->name", - '', '', true, '', navmenu($course, $cm), '', ''); + '', '', true, '', navmenu($course, $cm), '', $bodytag); print_heading(format_string($data->name)); - ///processing submitted data, i.e updating form + /// Processing submitted data, i.e updating form. if (($mytemplate = data_submitted($CFG->wwwroot.'/mod/data/templates.php')) && confirm_sesskey()){ - //generate default template + // Generate default template. if (!empty($mytemplate->defaultform)){ data_generate_default_form($data->id, $mode); } @@ -103,7 +110,7 @@ $newtemplate->listtemplatefooter = $mytemplate->listtemplatefooter; } - //check for multiple tags, only need to check for add template + // Check for multiple tags, only need to check for add template. if ($mode != 'addtemplate' or data_tags_check($data->id, $newtemplate->{$mode})){ update_record('data',$newtemplate); } @@ -111,17 +118,17 @@ } } -/// Print the tabs +/// Print the tabs. $currenttab = 'templates'; include('tabs.php'); -/// Print the browsing interface +/// Print the browsing interface. echo '
'.get_string('header'.$mode,'data').'

'; echo '
'; echo ''; - //print button to autogen all forms, if all templates are empty + // Print button to autogen all forms, if all templates are empty $data = get_record('data', 'id', $d); //reload because of possible updates so far! @@ -130,49 +137,70 @@ } print_simple_box_start('center','80%'); - echo '
'; + echo ''; + - ///add all the available fields for this data +/// Add the HTML editor(s). + echo ''; + echo ''; + echo ''; + echo ''; + } + + // Print the main template. + // Add all the available fields for this data. + echo ''; + + echo ''; + echo ''; + if ($mode == 'listtemplate'){ + echo ''; + echo ''; + echo ''; + echo ''; } - echo ''; echo '
'; + $usehtmleditor = can_use_html_editor(); + if ($mode == 'listtemplate'){ + // Print the list template header. + echo '
 '; + echo '
'.get_string('header','data').'
'; + print_textarea($usehtmleditor, 10, 72, 0, 0, 'listtemplateheader', $data->listtemplateheader); + echo '
'; echo get_string('availabletags','data'); helpbutton('tags', get_string('tags','data'), 'data'); - echo '
'; echo ''; - - ///add the HTML editor(s) - echo ''; - $usehtmleditor = can_use_html_editor(); - if ($mode == 'listtemplate'){ - echo '
'.get_string('header','data').'
'; - print_textarea($usehtmleditor, 10, 72, 0, 0, 'listtemplateheader', $data->listtemplateheader); - } + echo '
'; if ($mode == 'listtemplate'){ - echo '
'.get_string('multientry','data').'
'; + echo '
'.get_string('multientry','data').'
'; } print_textarea($usehtmleditor, 20, 72, 0, 0, 'template', $data->{$mode}); + echo '
 '; echo '
'.get_string('footer','data').'
'; print_textarea($usehtmleditor, 10, 72, 0, 0, 'listtemplatefooter', $data->listtemplatefooter); + echo '
'; echo ' '; @@ -181,6 +209,8 @@ } echo '
'; + + print_simple_box_end(); echo ''; if ($usehtmleditor) { @@ -192,7 +222,5 @@ } /// Finish the page - print_footer($course); - -?> +?> \ No newline at end of file