Browse files

Addng two new options to the custom profile fields:

1. Force unique - force the field data to be unique
2. Signup - display the field on the signup page
MDL-9702
  • Loading branch information...
1 parent f4a9c8b commit 9aaa214e0c2d0c8445ce06ba36a4a939b592b5f6 ikawhero committed May 11, 2007
Showing with 26 additions and 4 deletions.
  1. +5 −3 lib/db/install.xml
  2. +20 −0 lib/db/upgrade.php
  3. +1 −1 version.php
View
8 lib/db/install.xml
@@ -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"
>
@@ -978,8 +978,10 @@
<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"/>
View
20 lib/db/upgrade.php
@@ -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;
}
View
2 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 = 2007050901; // YYYYMMDD = date
+ $version = 2007051100; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.9 dev'; // Human-friendly version name

0 comments on commit 9aaa214

Please sign in to comment.