]> git.mjollnir.org Git - moodle.git/commitdiff
Moved the object code out into a function print_textarea
authormoodler <moodler>
Sat, 12 Oct 2002 07:23:16 +0000 (07:23 +0000)
committermoodler <moodler>
Sat, 12 Oct 2002 07:23:16 +0000 (07:23 +0000)
lib/moodlelib.php
mod/forum/post.html
mod/journal/edit.html

index ea013a4d14193e5e9e67f1f8ab98e610b41f14b2..1faf0ba8237e079fc405b0f99ea925d7561f5480 100644 (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;
 
index ca32b430bbbd5916c65621857334c1bec4fe10b1..765a41fef35505d12861399bc6cf6859022812ca 100644 (file)
      <? } ?>
     </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;
index 8a1e62af6da2eb55fb3028a1cd43d56a03f9f8f5..6b76d8ad5976414e02223137db7526514e4a356b 100644 (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"));