Skip to content
Browse files

Moved the object code out into a function print_textarea

  • Loading branch information...
1 parent aed0b71 commit e1947876ec80edc4e2f3244cdc6a251db78f2360 moodler committed Oct 12, 2002
Showing with 22 additions and 20 deletions.
  1. +19 −0 lib/moodlelib.php
  2. +2 −12 mod/forum/post.html
  3. +1 −8 mod/journal/edit.html
View
19 lib/moodlelib.php
@@ -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;
View
14 mod/forum/post.html
@@ -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;
View
9 mod/journal/edit.html
@@ -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"));

0 comments on commit e194787

Please sign in to comment.
Something went wrong with that request. Please try again.