From 79642064123c54585791ff666d70fad2af8a420c Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 31 Jul 2007 05:59:32 +0000 Subject: [PATCH] Added tables for new tags --- admin/settings/security.php | 2 +- lib/db/access.php | 10 ++++++ lib/db/install.xml | 49 +++++++++++++++++++++++++-- lib/db/upgrade.php | 67 +++++++++++++++++++++++++++++++++++++ version.php | 2 +- 5 files changed, 126 insertions(+), 4 deletions(-) diff --git a/admin/settings/security.php b/admin/settings/security.php index 792607453d..65aff67896 100644 --- a/admin/settings/security.php +++ b/admin/settings/security.php @@ -37,7 +37,7 @@ $temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', ' 2 => get_string('groupblogs','blog'), 1 => get_string('personalblogs','blog'), 0 => get_string('disableblogs','blog')))); - +$temp->add(new admin_setting_configcheckbox('usetags', get_string('usetags','admin'),get_string('configusetags', 'admin'),'1')); $temp->add(new admin_setting_configcheckbox('cronclionly', get_string('cronclionly', 'admin'), get_string('configcronclionly', 'admin'), 0)); $temp->add(new admin_setting_configpasswordunmask('cronremotepassword', get_string('cronremotepassword', 'admin'), get_string('configcronremotepassword', 'admin'), '', PARAM_RAW)); diff --git a/lib/db/access.php b/lib/db/access.php index 17f9c80b9f..6f58270c87 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -1041,6 +1041,16 @@ $moodle_capabilities = array( 'admin' => CAP_ALLOW ) ), + + 'moodle/tag:manage' => array( + 'captype' => 'write', + 'contextlevel' => CONTEXT_SYSTEM, + 'legacy' => array( + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ) + ) ); ?> diff --git a/lib/db/install.xml b/lib/db/install.xml index bc5efc71c2..927b5f8e33 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1579,7 +1579,7 @@ - +
@@ -1595,6 +1595,51 @@
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + +
@@ -1624,4 +1669,4 @@ - + \ No newline at end of file diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 5431f01bf3..5b73af570d 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1453,6 +1453,73 @@ function xmldb_main_upgrade($oldversion=0) { $result = $result && create_table($table); } + + if ($result && $oldversion < 2007073101) { // Add new tag tables + + /// Define table tag to be created + $table = new XMLDBTable('tag'); + + /// Adding fields to table tag + $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '11', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); + $table->addFieldInfo('userid', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, null, null, null); + $table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null); + $table->addFieldInfo('tagtype', XMLDB_TYPE_CHAR, '255', null, null, null, null, null, null); + $table->addFieldInfo('description', XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null); + $table->addFieldInfo('descriptionformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null, null, null); + $table->addFieldInfo('flag', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, null, null, '0'); + $table->addFieldInfo('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null); + + /// Adding keys to table tag + $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); + + /// Adding indexes to table tag + $table->addIndexInfo('name', XMLDB_INDEX_UNIQUE, array('name')); + + /// Launch create table for tag + $result = $result && create_table($table); + + + + /// Define table tag_correlation to be created + $table = new XMLDBTable('tag_correlation'); + + /// Adding fields to table tag_correlation + $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '11', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); + $table->addFieldInfo('tagid', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, null, null, null); + $table->addFieldInfo('correlatedtags', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null); + + /// Adding keys to table tag_correlation + $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); + + /// Adding indexes to table tag_correlation + $table->addIndexInfo('tagid', XMLDB_INDEX_UNIQUE, array('tagid')); + + /// Launch create table for tag_correlation + $result = $result && create_table($table); + + + + /// Define table tag_instance to be created + $table = new XMLDBTable('tag_instance'); + + /// Adding fields to table tag_instance + $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '11', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); + $table->addFieldInfo('tagid', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, null, null, null); + $table->addFieldInfo('itemtype', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null); + $table->addFieldInfo('itemid', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, null, null, null); + + /// Adding keys to table tag_instance + $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); + + /// Adding indexes to table tag_instance + $table->addIndexInfo('tagiditem', XMLDB_INDEX_NOTUNIQUE, array('tagid', 'itemtype', 'itemid')); + + /// Launch create table for tag_instance + $result = $result && create_table($table); + + } + + /* /// drop old gradebook tables if ($result && $oldversion < 2007072209) { diff --git a/version.php b/version.php index b4801acd54..b3b5d141ce 100644 --- a/version.php +++ b/version.php @@ -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 = 2007073100; // YYYYMMDD = date + $version = 2007073101; // YYYYMMDD = date // XY = increments within a single day $release = '1.9 dev'; // Human-friendly version name -- 2.39.5