]> git.mjollnir.org Git - moodle.git/commitdiff
Journal questions can now use HTML editor, plus new field 'introformat'
authormoodler <moodler>
Wed, 14 Jan 2004 02:24:42 +0000 (02:24 +0000)
committermoodler <moodler>
Wed, 14 Jan 2004 02:24:42 +0000 (02:24 +0000)
mod/journal/backuplib.php
mod/journal/db/mysql.php
mod/journal/db/mysql.sql
mod/journal/db/postgres7.php
mod/journal/db/postgres7.sql
mod/journal/edit.php
mod/journal/lib.php
mod/journal/mod.html
mod/journal/restorelib.php
mod/journal/version.php
mod/journal/view.php

index 321608fcd32ef26d6ed56e25277174f444f04ba1..bdc85c4a10b26481677d32e78b5100b58e6d37ca 100644 (file)
@@ -38,6 +38,7 @@
                 fwrite ($bf,full_tag("MODTYPE",4,false,"journal"));
                 fwrite ($bf,full_tag("NAME",4,false,$journal->name));
                 fwrite ($bf,full_tag("INTRO",4,false,$journal->intro));
+                fwrite ($bf,full_tag("INTROFORMAT",4,false,$journal->introformat));
                 fwrite ($bf,full_tag("DAYS",4,false,$journal->days));
                 fwrite ($bf,full_tag("ASSESSED",4,false,$journal->assessed));
                 fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$journal->timemodified));
index a79ac07bae34d64f626c0d3275afb2f8f27598e6..e82d4fc5dc36ca940209a5005e4a7abffddad88b 100644 (file)
@@ -42,6 +42,10 @@ function journal_upgrade($oldversion) {
             $result = false;
         }
     }
+
+    if ($oldversion < 2004011400) {
+        table_column("journal", "", "introformat", "integer", "2", "", "1", "not null", "intro");
+    }
     
     return $result;
 }
index 18aaa7cf77e6598f1837aa1395b4e73a65b5cbe8..e1c259aa4f24265b8d21341366eaf8a764822fe1 100755 (executable)
@@ -19,6 +19,7 @@ CREATE TABLE prefix_journal (
   course int(10) unsigned NOT NULL default '0',\r
   name varchar(255) default NULL,\r
   intro text,\r
+  introformat tinyint(2) NOT NULL default '0',\r
   days smallint(5) unsigned NOT NULL default '7',\r
   assessed int(10) NOT NULL default '0',\r
   timemodified int(10) unsigned NOT NULL default '0',\r
index 7791526f55ecdb34572884763f0f722b2a167199..58bf01b8763f8816f3e66c16fec79e78833b2c4c 100644 (file)
@@ -26,5 +26,9 @@ function journal_upgrade($oldversion) {
         }
     }
 
+    if ($oldversion < 2004011400) {
+        table_column("journal", "", "introformat", "integer", "2", "", "1", "not null", "intro");
+    }
+
     return $result;
 }
index 933d24263513c77a4d3f9d43e29c1490ff43b25f..8b5dbecc6b054bcb115765fba23d2aed59a18618 100755 (executable)
@@ -19,6 +19,7 @@ CREATE TABLE prefix_journal (
   course integer NOT NULL default '0',
   name varchar(255) default NULL,
   intro text,
+  introformat integer NOT NULL default '0',
   days integer NOT NULL default '7',
   assessed integer NOT NULL default '0',
   timemodified integer NOT NULL default '0'
index 1f296c6d0d685fa5decceff0a79e7d8b71f32d6e..548d5c0ed8fbebcfba306066e6961f400152cf49 100644 (file)
@@ -83,7 +83,7 @@
 
     echo "<center>\n";
 
-    print_simple_box( format_text($journal->intro) , "center");
+    print_simple_box( format_text($journal->intro, $journal->introformat) , "center");
 
     echo "<br />";
 
index 67b876753389a6ca4a2538d12f6dbcb00e1bed53..0d2494bb38570dca9e52b58f7c0598a6405030fc 100644 (file)
@@ -57,7 +57,7 @@ function journal_user_complete_index($course, $user, $journal, $journalopen, $he
     }
 
     print_simple_box_start("left", "90%");
-    echo format_text($journal->intro);
+    echo format_text($journal->intro,  $journal->introformat);
     print_simple_box_end();
     echo "<br clear=all />";
     echo "<br />";
index 4e86822954d10b7a6bde49698d5acd62ed03f802..2c9e3f8071bace3ac8c728c7d7f154766b8579b2 100644 (file)
@@ -1,4 +1,10 @@
 <?php
+    if ($usehtmleditor = can_use_richtext_editor()) {
+        $defaultformat = FORMAT_HTML;
+    } else {
+        $defaultformat = FORMAT_MOODLE;
+    }
+
     if (!isset($form->name)) {
         $form->name = "";
     }
         <input type="text" name="name" size=30 value="<?php p($form->name) ?>">
     </td>
 </tr>
+
 <tr valign=top>
     <td align=right><p><b><?php print_string("journalquestion", "journal") ?>:</b></p>
-    <font SIZE="1">
+    <font size="1">
      <?php
         helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
         echo "<br />";
         helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
         echo "<br />";
-        emoticonhelpbutton("form", "intro");
+        if ($usehtmleditor) {
+           helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
+        } else {
+           emoticonhelpbutton("form", "intro");
+        } 
       ?>
       <br />
     </font>
-    
-    </TD>
+    </td>
     <td>
-        <textarea name="intro" rows=15 cols=30 wrap="virtual"><?php p($form->intro) ?></textarea>
+    <?php
+       print_textarea($usehtmleditor, 20, 60, 680, 400, "intro", $form->intro);
+
+       echo "<p align=right>";
+       helpbutton("textformat", get_string("formattexttype"));
+       print_string("formattexttype");
+       echo ":&nbsp;";
+       if (!$form->introformat) {
+           $form->introformat = $defaultformat;
+       }
+       choose_from_menu(format_text_menu(), "introformat", $form->introformat, "");
+       echo "</p>";
+    ?>
     </td>
 </tr>
+
+
 <tr valign=top>
     <td align=right><p><b><?php print_string("grade") ?>:</b></p></td>
     <td>
 <input type="submit" name=cancel value="<?php print_string("cancel") ?>">
 </form>
 </center>
+
+
+<?php 
+   if ($usehtmleditor) { 
+       print_richedit_javascript("form", "intro", "yes");
+   }
+?>
+
index 9aa6f8edfa7decaefb30ed1769c42de3dcc3db11..7c3dca7e971433d036485597e68704b535dcf20d 100644 (file)
@@ -42,6 +42,7 @@
             $journal->course = $restore->course_id;
             $journal->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
             $journal->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
+            $journal->introformat = backup_todb($info['MOD']['#']['INTROFORMAT']['0']['#']);
             $journal->days = backup_todb($info['MOD']['#']['DAYS']['0']['#']);
             $journal->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);
             $journal->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
index 5ad15c41df92f478b95cc8f9dac34d640764f3cf..bc39e112a3ede64b5a06c047f2cdf0f68386091a 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2003081705;
+$module->version  = 2004011400;
 $module->cron     = 60;
 
 ?>
index 7e7982cd67d2367de95ede826ebaba9e65bf36be..2fbc904254c65ad673ca70668470a1b475e0874f 100644 (file)
@@ -45,7 +45,7 @@
 
     echo "<center>\n";
     
-    print_simple_box( text_to_html($journal->intro) , "center");
+    print_simple_box( text_to_html($journal->intro,  $journal->introformat) , "center");
 
     echo "<br \>";