]> git.mjollnir.org Git - moodle.git/commitdiff
One less reserved word. glossary->comment is out!
authorstronk7 <stronk7>
Mon, 4 Sep 2006 20:37:27 +0000 (20:37 +0000)
committerstronk7 <stronk7>
Mon, 4 Sep 2006 20:37:27 +0000 (20:37 +0000)
mod/glossary/backuplib.php
mod/glossary/comment.php
mod/glossary/db/install.xml
mod/glossary/db/migrate2utf8.xml
mod/glossary/db/mysql.php
mod/glossary/db/mysql.sql
mod/glossary/db/postgres7.php
mod/glossary/db/postgres7.sql
mod/glossary/lib.php
mod/glossary/restorelib.php
mod/glossary/version.php

index 1b1d12726a5d3e6f69c8978edb59889574148460..8ad9dd81a3cf4baf8ca24530e11ddcdcd0504401 100644 (file)
 
                 fwrite ($bf,full_tag("ID",8,false,$comment->id));
                 fwrite ($bf,full_tag("USERID",8,false,$comment->userid));
-                fwrite ($bf,full_tag("COMMENT",8,false,$comment->comment));
+                fwrite ($bf,full_tag("ENTRYCOMMENT",8,false,$comment->entrycomment));
                 fwrite ($bf,full_tag("FORMAT",8,false,$comment->format));
                 fwrite ($bf,full_tag("TIMEMODIFIED",8,false,$comment->timemodified));
 
index 879eaad3961e121bfd33e907117bbe05e434ec31..ab6a0be206123e17407bd8b962c4d95c2915a92a 100644 (file)
             trusttext_after_edit($form->text, $context);
 
             $newentry->entryid = $entry->id;
-            $newentry->comment = $form->text;
+            $newentry->entrycomment = $form->text;
             $newentry->format = $form->format;
             $newentry->timemodified = time();
 
                 $defaultformat = FORMAT_MOODLE;
             }
             if (isset($comment) ) {
-                $form->text = $comment->comment;
+                $form->text = $comment->entrycomment;
                 $form->format = $comment->format;
             } else {
                 $form->text = '';
index f5cef913618a3426eef100068d06b4a7808e1589..5db7489b3057719ea6da5269a24d94dcbb09ec29 100644 (file)
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="entryid"/>
         <FIELD NAME="entryid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="userid"/>
-        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="entryid" NEXT="comment"/>
-        <FIELD NAME="comment" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="format"/>
-        <FIELD NAME="format" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="comment" NEXT="timemodified"/>
+        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="entryid" NEXT="entrycomment"/>
+        <FIELD NAME="entrycomment" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="format"/>
+        <FIELD NAME="format" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="entrycomment" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="format"/>
       </FIELDS>
       <KEYS>
       </SENTENCES>
     </STATEMENT>
   </STATEMENTS>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
index de2947a2fcc2d23cd74bff6b5bc8a646d8ef320e..807051ce8ed675936dfbde8a331ff76a88d201fc 100755 (executable)
@@ -46,7 +46,7 @@
     </TABLE>
     <TABLE name="glossary_comments">
       <FIELDS>
-        <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 gco.userid
            FROM {$CFG->prefix}glossary_comments gco
index 5274c55ca75a88db833afddef69f6c042e8b0eb7..11406096f5e130a20967387ca15f4c09d8f51cb1 100644 (file)
@@ -436,7 +436,11 @@ function glossary_upgrade($oldversion) {
         }
     }
 
-  return true;
+    if ($oldversion < 2006090400) {
+         table_column('glossary_comments', 'comment', 'entrycomment', 'text', '', '', '');
+    }
+
+    return true;
 }
 
 ?>
index 8ba1a25c093717c3c12ae187e8c0c21bbb6cd06a..a4c7bbf53a1f1583cb8cc9012abe605fc93f45ee 100644 (file)
@@ -107,7 +107,7 @@ CREATE TABLE prefix_glossary_comments (
      id int(10) unsigned NOT NULL auto_increment,
      entryid int(10) unsigned NOT NULL default '0',
      userid int(10) unsigned NOT NULL default '0',
-     comment text NOT NULL default '',
+     entrycomment text NOT NULL default '',
      format tinyint(2) unsigned NOT NULL default '0',
      timemodified int(10) unsigned NOT NULL default '0',
      PRIMARY KEY  (id),
index 7eb5baca520bf132794fb8659d3e0a616d8f1007..0e5296b1e3092c6cff7945fd863299b1d09846c3 100644 (file)
@@ -200,8 +200,11 @@ function glossary_upgrade($oldversion) {
         }
     }
 
+    if ($oldversion < 2006090400) {
+        table_column('glossary_comments', 'comment', 'entrycomment', 'text', '', '', '');
+    }
 
-  return true;
+    return true;
 }
 
 ?>
index 4d9fc9772e16822789ddd573ebdf6622b6550d03..2ae6bbd26abe4f23ee5b31dd5fb3593b9190951f 100644 (file)
@@ -117,7 +117,7 @@ CREATE TABLE prefix_glossary_comments (
      id SERIAL,
      entryid int4 NOT NULL default '0',
      userid int4 NOT NULL default '0',
-     comment text NOT NULL,
+     entrycomment text NOT NULL,
      format int2 NOT NULL default '0',
      timemodified int4 NOT NULL default '0',
      PRIMARY KEY  (id)
index 075f7e80dfea4bdf3c419b1975879f6f55372655..bdd3938c82dda7385f9645bee24533f69111c0d5 100644 (file)
@@ -1582,7 +1582,7 @@ function glossary_print_comment($course, $cm, $glossary, $entry, $comment) {
 
     $options = new object();
     $options->trusttext = true;
-    echo format_text($comment->comment, $comment->format, $options);
+    echo format_text($comment->entrycomment, $comment->format, $options);
 
     echo '<div class="icons commands">';
 
index fdb6925ca633d23f8c0adfa194eca2536037cf61..a3b58fe185a2967bbfa1ac522de034d4240f2ee8 100644 (file)
             //Now, build the GLOSSARY_COMMENTS record structure
             $comment->entryid = $new_entry_id;
             $comment->userid = backup_todb($com_info['#']['USERID']['0']['#']);
-            $comment->comment = backup_todb($com_info['#']['COMMENT']['0']['#']);
+            if (isset($com_info['#']['COMMENT']['0']['#'])) {
+                $comment->entrycomment = backup_todb($com_info['#']['COMMENT']['0']['#']);
+            } else {
+                $comment->entrycomment = backup_todb($com_info['#']['ENTRYCOMMENT']['0']['#']);
+            }
             $comment->timemodified = backup_todb($com_info['#']['TIMEMODIFIED']['0']['#']);
             $comment->format = backup_todb($com_info['#']['FORMAT']['0']['#']);
 
 
         $status = true;
 
-        //Convert glossary_comments->comment
-        if ($records = get_records_sql ("SELECT c.id, c.comment, c.format
+        //Convert glossary_comments->entrycomment
+        if ($records = get_records_sql ("SELECT c.id, c.entrycomment, c.format
                                          FROM {$CFG->prefix}glossary_comments c,
                                               {$CFG->prefix}glossary_entries e,
                                               {$CFG->prefix}glossary g,
                                                b.new_id = c.id")) {
             foreach ($records as $record) {
                 //Rebuild wiki links
-                $record->comment = restore_decode_wiki_content($record->comment, $restore);
+                $record->entrycomment = restore_decode_wiki_content($record->entrycomment, $restore);
                 //Convert to Markdown
                 $wtm = new WikiToMarkdown();
-                $record->comment = $wtm->convert($record->comment, $restore->course_id);
+                $record->entrycomment = $wtm->convert($record->entrycomment, $restore->course_id);
                 $record->format = FORMAT_MARKDOWN;
                 $status = update_record('glossary_comments', addslashes_object($record));
                 //Do some output
index 3237b2a4c57fb9f6d20c38f484b1ebb06d97f7d5..ec6ad12f409251ea07e394c0482220e7b9472d63 100644 (file)
@@ -5,7 +5,7 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2006082600;
+$module->version  = 2006090400;
 $module->requires = 2006082600;  // Requires this Moodle version
 $module->cron     = 0;           // Period for cron to check this module (secs)