]> git.mjollnir.org Git - moodle.git/commitdiff
Addng two new options to the custom profile fields:
authorikawhero <ikawhero>
Fri, 11 May 2007 12:16:44 +0000 (12:16 +0000)
committerikawhero <ikawhero>
Fri, 11 May 2007 12:16:44 +0000 (12:16 +0000)
1. Force unique - force the field data to be unique
2. Signup - display the field on the signup page
MDL-9702

lib/db/install.xml
lib/db/upgrade.php
version.php

index 08c2384af1375b5ca8b859c160384d30ea5b0baa..43a03719bbd9112a61ae714f41ddf4ca5da8039e 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20070509" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20070511" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="order within the category" PREVIOUS="categoryid" NEXT="required"/>
         <FIELD NAME="required" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Field required" PREVIOUS="sortorder" NEXT="locked"/>
         <FIELD NAME="locked" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Field locked" PREVIOUS="required" NEXT="visible"/>
-        <FIELD NAME="visible" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Visibility: private, public, hidden" PREVIOUS="locked" NEXT="defaultdata"/>
-        <FIELD NAME="defaultdata" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="Default value for this field" PREVIOUS="visible" NEXT="param1"/>
+        <FIELD NAME="visible" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Visibility: private, public, hidden" PREVIOUS="locked" NEXT="forceunique"/>
+        <FIELD NAME="forceunique" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="should the field contain unique data" PREVIOUS="visible" NEXT="signup"/>
+        <FIELD NAME="signup" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="display field on signup page" PREVIOUS="forceunique" NEXT="defaultdata"/>
+        <FIELD NAME="defaultdata" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="Default value for this field" PREVIOUS="signup" NEXT="param1"/>
         <FIELD NAME="param1" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="General parameter field" PREVIOUS="defaultdata" NEXT="param2"/>
         <FIELD NAME="param2" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="General parameter field" PREVIOUS="param1" NEXT="param3"/>
         <FIELD NAME="param3" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="General parameter field" PREVIOUS="param2" NEXT="param4"/>
index d2b272336d5d9bbe5898068c3229703f1668b9f0..b25d330e66712ee35bf7724a6b08989f3b1ffbee 100644 (file)
@@ -1251,6 +1251,26 @@ function xmldb_main_upgrade($oldversion=0) {
         $result = $result && add_key($table, $key);
     
     }
+
+    if ($result && $oldversion < 2007051100) {
+
+    /// Define field forceunique to be added to user_info_field
+        $table = new XMLDBTable('user_info_field');
+        $field = new XMLDBField('forceunique');
+        $field->setAttributes(XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'visible');
+
+    /// Launch add field forceunique
+        $result = $result && add_field($table, $field);
+
+    /// Define field signup to be added to user_info_field
+        $table = new XMLDBTable('user_info_field');
+        $field = new XMLDBField('signup');
+        $field->setAttributes(XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'forceunique');
+
+    /// Launch add field signup
+        $result = $result && add_field($table, $field);
+    }
+    
     return $result; 
 }
 
index 2ff2158502141ad4cbcb6f68bd0bd24ab519470c..b4532b92ed38a412910182d4f288f4cefb1fabb3 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 = 2007050901;  // YYYYMMDD = date
+   $version = 2007051100;  // YYYYMMDD = date
                            //       XY = increments within a single day
 
    $release = '1.9 dev';    // Human-friendly version name