]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18547 xmldb floats - recommend to switch to number fields when possible
authorstronk7 <stronk7>
Tue, 12 May 2009 08:32:16 +0000 (08:32 +0000)
committerstronk7 <stronk7>
Tue, 12 May 2009 08:32:16 +0000 (08:32 +0000)
admin/xmldb/actions/edit_field/edit_field.class.php
lang/en_utf8/xmldb.php

index 8c9d6d3522bad809d1c2bb5ad799fa346eb42f38..24791b0d86d5d2920d66703e461668d8fc054378 100644 (file)
@@ -39,6 +39,7 @@ class edit_field extends XMLDBAction {
     /// Get needed strings
         $this->loadStrings(array(
             'change' => 'xmldb',
+            'float2numbernote' => 'xmldb',
             'vieworiginal' => 'xmldb',
             'viewedited' => 'xmldb',
             'yes' => '',
@@ -97,8 +98,15 @@ class edit_field extends XMLDBAction {
         $dbdir =& $XMLDB->dbdirs[$dirpath];
         $origstructure =& $dbdir->xml_file->getStructure();
 
+        $o = ''; /// Output starts
+
+    /// If field is XMLDB_TYPE_FLOAT, comment about to migrate it to XMLDB_TYPE_NUMBER
+        if ($field->getType() == XMLDB_TYPE_FLOAT) {
+            $o .= '<p>' . $this->str['float2numbernote'] . '</p>';
+        }
+
     /// Add the main form
-        $o = '<form id="form" action="index.php" method="post">';
+        $o.= '<form id="form" action="index.php" method="post">';
         $o.= '    <div>';
         $o.= '    <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
         $o.= '    <input type="hidden" name ="table" value="' . $tableparam .'" />';
index 78124e866c47c6d0615172ca40329727f32b8e5a..406118ca1cd9ae062c0c8a48f1fbfed97ce15e47 100644 (file)
@@ -74,6 +74,7 @@ $string['fields'] = 'Fields';
 $string['fieldsusedinkey'] = 'This field is used as key.';
 $string['filenotwriteable'] = 'File not writeable';
 $string['fkviolationdetails'] = 'Foreign key $a->keyname on table $a->tablename is violated by $a->numviolations out of $a->numrows rows.';
+$string['float2numbernote'] = 'Notice: Although \"float\" fields are 100% supported by XMLDB, it\'s recommended to migrate to \"number\" fields instead.';
 $string['floatincorrectdecimals'] = 'Incorrect number of decimals for float field';
 $string['floatincorrectlength'] = 'Incorrect length for float field';
 $string['generate_documentation']='Documentation';