Upgrades to tag tables
authormoodler <moodler>
Tue, 31 Jul 2007 07:34:03 +0000 (07:34 +0000)
committermoodler <moodler>
Tue, 31 Jul 2007 07:34:03 +0000 (07:34 +0000)
lib/db/access.php
lib/db/install.xml
lib/db/upgrade.php
version.php

index 6f58270c87eeba253245643480c4fb89b0cd42e6..84ef021aa5715c42a385ee45dc3628a8c2b5f726 100644 (file)
@@ -1050,6 +1050,28 @@ $moodle_capabilities = array(
             'editingteacher' => CAP_ALLOW,
             'admin' => CAP_ALLOW
         )
+    ),
+
+    'moodle/tag:create' => array(
+        'captype' => 'write',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'legacy' => array(
+            'student' => CAP_ALLOW,
+            'teacher' => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'admin' => CAP_ALLOW
+        )
+    ),
+    
+    'moodle/tag:edit' => array(
+        'captype' => 'write',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'legacy' => array(
+            'student' => CAP_ALLOW,
+            'teacher' => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'admin' => CAP_ALLOW
+        )
     )
 );
 
index 927b5f8e339b267e35a7d9b17e13ede91e59a09c..8e877dbac67a7b797b533fc38c5d5bd7437452d0 100644 (file)
         <KEY NAME="newgradeitem" TYPE="foreign" FIELDS="newgradeitem" REFTABLE="grade_import_newitem" REFFIELDS="id" PREVIOUS="itemid"/>
       </KEYS>
     </TABLE>
-    <TABLE NAME="tag" COMMENT="tag table" PREVIOUS="grade_import_values" NEXT="tag_correlation">
+    <TABLE NAME="tag" COMMENT="Tag table - this generic table will replace the old &quot;tags&quot; table." PREVIOUS="grade_import_values" NEXT="tag_correlation">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="userid"/>
         <FIELD NAME="userid" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
-        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="tagtype"/>
-        <FIELD NAME="tagtype" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="description"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="rawname"/>
+        <FIELD NAME="rawname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The raw, unnormalised name for the tag as entered by users" PREVIOUS="name" NEXT="tagtype"/>
+        <FIELD NAME="tagtype" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="rawname" NEXT="description"/>
         <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="tagtype" NEXT="descriptionformat"/>
         <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="flag"/>
         <FIELD NAME="flag" TYPE="int" LENGTH="4" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="a tag can be 'flagged' as inappropriate" PREVIOUS="descriptionformat" NEXT="timemodified"/>
       </SENTENCES>
     </STATEMENT>
   </STATEMENTS>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
index 5b73af570d3c6b24a013cce951f31cddc70369c3..57cacfc7a5ebe0e1b8a8c1c6d298708376c80bfa 100644 (file)
@@ -1520,6 +1520,19 @@ function xmldb_main_upgrade($oldversion=0) {
     }
 
 
+    if ($result && $oldversion < 2007073103) {
+
+    /// Define field rawname to be added to tag
+        $table = new XMLDBTable('tag');
+        $field = new XMLDBField('rawname');
+        $field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null, 'name');
+
+    /// Launch add field rawname
+        $result = $result && add_field($table, $field);
+    }
+
+
+
 /*
     /// drop old gradebook tables
     if ($result && $oldversion < 2007072209) {
index b3b5d141ce671e60722911c896160268f92c6872..33936ce87fc40acc36a6699b64c5b0f70e57e349 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2007073101;  // YYYYMMDD = date
+    $version = 2007073103;  // YYYYMMDD = date
                             //       XY = increments within a single day
 
     $release = '1.9 dev';   // Human-friendly version name