Moved the object code out into a function print_textarea

This commit is contained in:
moodler
2002-10-12 07:23:16 +00:00
parent aed0b713fe
commit e1947876ec
3 changed files with 22 additions and 20 deletions
+19
View File
@@ -314,6 +314,25 @@ function print_editing_switch($courseid) {
}
}
function print_textarea($richedit, $rows, $cols, $width, $height, $name, $value="") {
global $CFG, $THEME;
if ($richedit) {
echo "<object id=richedit style=\"BACKGROUND-COLOR: buttonface\"";
echo " data=\"$CFG->wwwroot/lib/rte/richedit.html\"";
echo " width=\"$width\" height=\"$height\" ";
echo " type=\"text/x-scriptlet\" VIEWASTEXT></object>";
echo "<TEXTAREA style=\"display:none\" NAME=\"$name\" ROWS=1 COLS=1>";
p($value);
echo "</TEXTAREA>";
} else {
echo "<TEXTAREA name=\"$name\" rows=\"$rows\" cols=\"$cols\" wrap=virtual>";
p($value);
echo "</TEXTAREA>";
}
}
function update_course_icon($courseid) {
global $CFG, $USER;
+2 -12
View File
@@ -18,15 +18,7 @@
<? } ?>
</TD>
<td>
<? if ($usehtmleditor) { ?>
<object id="richedit" style="BACKGROUND-COLOR: buttonface" data="../../lib/rte/richedit.html"
width="595" height="400" type="text/x-scriptlet" VIEWASTEXT>
</object>
<TEXTAREA style="display:none" NAME="message" ROWS=1 COLS=50><? p($post->message) ?></TEXTAREA>
<? } else { ?>
<TEXTAREA name=message rows=15 cols=50 wrap="virtual"><? p($post->message) ?></TEXTAREA>
<? } ?>
<? print_textarea($usehtmleditor, 15, 50, 595, 400, "message", $post->message); ?>
</td>
<td rowspan=2>
<FONT SIZE=1>
@@ -38,9 +30,7 @@
<tr valign=top>
<td align=right><P><B><? print_string("formattexttype"); ?>:</B></P></TD>
<td>
<?PHP
$POST_FORMATS = format_text_menu();
choose_from_menu($POST_FORMATS, "format", $post->format, ""); ?>
<? choose_from_menu(format_text_menu(), "format", $post->format, ""); ?>
</td>
<td>
&nbsp;
+1 -8
View File
@@ -1,12 +1,5 @@
<FORM name="theform" method="post" <?=$onsubmit ?> action="edit.php">
<? if ($usehtmleditor) { ?>
<object id="richedit" style="BACKGROUND-COLOR: buttonface" data="../../lib/rte/richedit.html"
width="595" height="400" type="text/x-scriptlet" VIEWASTEXT>
</object>
<TEXTAREA style="display:none" NAME="text" ROWS=1 COLS=50><? p($entry->text) ?></TEXTAREA>
<? } else { ?>
<TEXTAREA NAME=text COLS=60 ROWS=20 WRAP="virtual"><? p($entry->text) ?></TEXTAREA>
<? } ?>
<? print_textarea($usehtmleditor, 20, 60, 595, 400, "text", $entry->text); ?>
<? if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"));