]> git.mjollnir.org Git - moodle.git/commitdiff
Last reserved word is out now!
authorstronk7 <stronk7>
Thu, 21 Sep 2006 09:54:00 +0000 (09:54 +0000)
committerstronk7 <stronk7>
Thu, 21 Sep 2006 09:54:00 +0000 (09:54 +0000)
journal_entries->comment to entrycomment

Only 2 tables have reserved names but they aren't
a problem if we force $CFG->prefix always

12 files changed:
mod/journal/backuplib.php
mod/journal/db/install.xml
mod/journal/db/migrate2utf8.xml
mod/journal/db/mysql.php
mod/journal/db/mysql.sql
mod/journal/db/postgres7.php
mod/journal/db/postgres7.sql
mod/journal/lib.php
mod/journal/report.php
mod/journal/restorelib.php
mod/journal/version.php
mod/journal/view.php

index 91c402f0a09582344f6478509f597c19332dd5d9..bf47f88fc1dea76edbbe7a0274c7ec94a52eae9a 100644 (file)
@@ -94,7 +94,7 @@
                 fwrite ($bf,full_tag("TEXT",6,false,$jou_ent->text));
                 fwrite ($bf,full_tag("FORMAT",6,false,$jou_ent->format));
                 fwrite ($bf,full_tag("RATING",6,false,$jou_ent->rating));
-                fwrite ($bf,full_tag("COMMENT",6,false,$jou_ent->comment));
+                fwrite ($bf,full_tag("ENTRYCOMMENT",6,false,$jou_ent->entrycomment));
                 fwrite ($bf,full_tag("TEACHER",6,false,$jou_ent->teacher));
                 fwrite ($bf,full_tag("TIMEMARKED",6,false,$jou_ent->timemarked));
                 fwrite ($bf,full_tag("MAILED",6,false,$jou_ent->mailed));
index 050743fdd95f257696c9192c56ba5682626e013c..72396f350f630b5e8f4b02cf059edaecf9b91eca 100644 (file)
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/journal/db" VERSION="20060811" COMMENT="XMLDB file for Moodle mod/journal">
+<XMLDB PATH="mod/journal/db" VERSION="20060921" COMMENT="XMLDB file for Moodle mod/journal"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
+>
   <TABLES>
     <TABLE NAME="journal" COMMENT="data for each journal" NEXT="journal_entries">
       <FIELDS>
@@ -27,9 +30,9 @@
         <FIELD NAME="modified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="text"/>
         <FIELD NAME="text" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="modified" NEXT="format"/>
         <FIELD NAME="format" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="text" NEXT="rating"/>
-        <FIELD NAME="rating" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="format" NEXT="comment"/>
-        <FIELD NAME="comment" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="rating" NEXT="teacher"/>
-        <FIELD NAME="teacher" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="comment" NEXT="timemarked"/>
+        <FIELD NAME="rating" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="format" NEXT="entrycomment"/>
+        <FIELD NAME="entrycomment" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="rating" NEXT="teacher"/>
+        <FIELD NAME="teacher" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="entrycomment" NEXT="timemarked"/>
         <FIELD NAME="timemarked" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="teacher" NEXT="mailed"/>
         <FIELD NAME="mailed" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timemarked"/>
       </FIELDS>
index 2ea54faf6cde1683266f8fdd4314b635b779ce9e..5759a4e1f7bf563edc023e5bd52250203702df7c 100755 (executable)
@@ -16,7 +16,7 @@
                  AND je.id = RECORDID
           </SQL_DETECT_COURSE>
         </FIELD>
-        <FIELD name="comment" method="PLAIN_SQL_UPDATE" type="text" length="0">
+        <FIELD name="entrycomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
           <SQL_DETECT_USER>
            SELECT je.userid
            FROM {$CFG->prefix}journal_entries je
index 76683c57aca04ec38e1def32d03ecccf76a5fe23..caf7cd2767b05b0f46bc063b81918e470ebd7730 100644 (file)
@@ -76,6 +76,11 @@ function journal_upgrade($oldversion) {
         execute_sql("UPDATE {$CFG->prefix}journal SET intro='' WHERE intro IS NULL");
         table_column('journal','intro','intro','text','','','','not null');
     }
+
+    if ($oldversion < 2006092100) {
+        table_column('journal_entries', 'comment', 'entrycomment', 'text', '', '', '');
+    }
+
     return $result;
 }
 
index c542919f7516715341362eed5c1ffbebf64cad84..af95f2149e0e7caf84648adc021cdb2285434f20 100755 (executable)
@@ -40,7 +40,7 @@ CREATE TABLE prefix_journal_entries (
   text text NOT NULL default '',
   format tinyint(2) NOT NULL default '0',
   rating int(10) default '0',
-  comment text default '',
+  entrycomment text default '',
   teacher int(10) unsigned NOT NULL default '0',
   timemarked int(10) unsigned NOT NULL default '0',
   mailed int(1) unsigned NOT NULL default '0',
index 11fda37df4223d557e7211dcb52e80a5fd3e9517..ddb2ae43142cfdce446ebc35b73cb66e4ee60800 100644 (file)
@@ -52,5 +52,9 @@ function journal_upgrade($oldversion) {
         $wtm->update( 'journal_entries', 'text', 'format', $sql );
     }
 
+    if ($oldversion < 2006092100) {
+        table_column('journal_entries', 'comment', 'entrycomment', 'text', '', '', '');
+    } 
+
     return $result;
 }
index f9e2c75c01693dcf29523cc9c7dbba6330afb266..5eeb51baf5b32e63cc55f1a2e49e0d88b0d08f1b 100755 (executable)
@@ -41,7 +41,7 @@ CREATE TABLE prefix_journal_entries (
   text text NOT NULL default '',
   format integer NOT NULL default '0',
   rating integer default '0',
-  comment text,
+  entrycomment text,
   teacher integer NOT NULL default '0',
   timemarked integer NOT NULL default '0',
   mailed integer NOT NULL default '0'
index f433f551747602f8eeb0fa1d5723849fd2f190ea..c1056b44b37f2ddd6feb9940949eeec8352e3d57 100644 (file)
@@ -453,7 +453,7 @@ function journal_print_user_entry($course, $user, $entry, $teachers, $grades) {
             echo "&nbsp;&nbsp;<font size=\"1\">".userdate($entry->timemarked)."</font>";
         }
         echo "<br /><textarea name=\"c$entry->id\" rows=\"12\" cols=\"60\" wrap=\"virtual\">";
-        p($entry->comment);
+        p($entry->entrycomment);
         echo "</textarea><br />";
         echo "</td></tr>";
     }
@@ -541,7 +541,7 @@ function journal_print_feedback($course, $entry, $grades) {
     }
     echo '</div>';
 
-    echo format_text($entry->comment);
+    echo format_text($entry->entrycomment);
     echo '</td></tr></table>';
 }
 
index b3477af9476a304d806d91894df9ec87f633ee58..47f7179b4282b4bc15143e0333e2ea2930f0df9f 100644 (file)
@@ -70,9 +70,9 @@
         foreach ($feedback as $num => $vals) {
             $entry = $entrybyentry[$num];
             // Only update entries where feedback has actually changed.
-            if (($vals['r'] <> $entry->rating) || ($vals['c'] <> addslashes($entry->comment))) {
+            if (($vals['r'] <> $entry->rating) || ($vals['c'] <> addslashes($entry->entrycomment))) {
                 $newentry->rating     = $vals['r'];
-                $newentry->comment    = $vals['c'];
+                $newentry->entrycomment    = $vals['c'];
                 $newentry->teacher    = $USER->id;
                 $newentry->timemarked = $timenow;
                 $newentry->mailed     = 0;           // Make sure mail goes out (again, even)
@@ -83,7 +83,7 @@
                     $count++;
                 }
                 $entrybyuser[$entry->userid]->rating     = $vals['r'];
-                $entrybyuser[$entry->userid]->comment    = $vals['c'];
+                $entrybyuser[$entry->userid]->entrycomment    = $vals['c'];
                 $entrybyuser[$entry->userid]->teacher    = $USER->id;
                 $entrybyuser[$entry->userid]->timemarked = $timenow;
             }
index da1a426194caf1083bc994c52cee7fb5b4bfbb8a..a3e082f2d1fd9c89dd951f9c7e17845a5f0cb708 100644 (file)
             $entry->text = backup_todb($entry_info['#']['TEXT']['0']['#']);
             $entry->format = backup_todb($entry_info['#']['FORMAT']['0']['#']);
             $entry->rating = backup_todb($entry_info['#']['RATING']['0']['#']);
-            $entry->comment = backup_todb($entry_info['#']['COMMENT']['0']['#']);
+            if (isset(backup_todb($entry_info['#']['COMMENT']['0']['#']))) {
+                $entry->entrycomment = backup_todb($entry_info['#']['COMMENT']['0']['#']);
+            } else {
+                $entry->entrycomment = backup_todb($entry_info['#']['ENTRYCOMMENT']['0']['#']);
+            }
             $entry->teacher = backup_todb($entry_info['#']['TEACHER']['0']['#']);
             $entry->timemarked = backup_todb($entry_info['#']['TIMEMARKED']['0']['#']);
             $date = usergetdate($entry->timemarked);
index a0ad66ace075f0715070c400e2b2076fb0cbab8a..037698974e16a2c733ea4ecf23f047a212a68d9c 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2006091201;
+$module->version  = 2006092100;
 $module->requires = 2006080900;  // Requires this Moodle version
 $module->cron     = 60;
 
index 43cccf8b7dd8794d8596cc0925c0198c45b16c64..aafb523c6fd3348d68a7ce86da64709371c9f795 100644 (file)
             echo userdate($timefinish).'</div>';
         }
 
-        if ($entry->comment or $entry->rating) {
+        if ($entry->entrycomment or $entry->rating) {
             $grades = make_grades_menu($journal->assessed);
             print_heading(get_string('feedback'));
             journal_print_feedback($course, $entry, $grades);