Merge branch 'MDL-32908' of git://github.com/danpoltawski/moodle
authorSam Hemelryk <sam@moodle.com>
Tue, 19 Jun 2012 22:31:52 +0000 (10:31 +1200)
committerSam Hemelryk <sam@moodle.com>
Tue, 19 Jun 2012 22:31:52 +0000 (10:31 +1200)
admin/tool/uploaduser/index.php
admin/tool/uploaduser/user_form.php
backup/moodle2/backup_stepslib.php
lang/en/moodle.php
lib/ajax/ajaxlib.php
lib/ajax/tests/ajaxlib_test.php
lib/db/install.xml [changed mode: 0644->0755]
lib/db/upgrade.php
user/editlib.php
version.php

index 9787ebb..ec692e2 100644 (file)
@@ -86,7 +86,7 @@ $today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today),
 // array of all valid fields for validation
 $STD_FIELDS = array('id', 'firstname', 'lastname', 'username', 'email',
         'city', 'country', 'lang', 'timezone', 'mailformat',
-        'maildisplay', 'maildigest', 'htmleditor', 'ajax', 'autosubscribe',
+        'maildisplay', 'maildigest', 'htmleditor', 'autosubscribe',
         'institution', 'department', 'idnumber', 'skype',
         'msn', 'aim', 'yahoo', 'icq', 'phone1', 'phone2', 'address',
         'url', 'description', 'descriptionformat', 'password',
index 7fb74b0..7e7d790 100644 (file)
@@ -248,15 +248,6 @@ class admin_uploaduser_form2 extends moodleform {
             $mform->setType('htmleditor', PARAM_INT);
         }
 
-        if (empty($CFG->enableajax)) {
-            $mform->addElement('static', 'ajax', get_string('ajaxuse'), get_string('ajaxno'));
-        } else {
-            $choices = array( 0 => get_string('ajaxno'), 1 => get_string('ajaxyes'));
-            $mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
-            $mform->setDefault('ajax', 1);
-        }
-        $mform->setAdvanced('ajax');
-
         $mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
         $mform->setType('city', PARAM_MULTILANG);
         if (empty($CFG->defaultcity)) {
index a2fa948..6b35dff 100644 (file)
@@ -1069,7 +1069,7 @@ class backup_users_structure_step extends backup_structure_step {
             'lang', 'theme', 'timezone', 'firstaccess',
             'lastaccess', 'lastlogin', 'currentlogin',
             'mailformat', 'maildigest', 'maildisplay', 'htmleditor',
-            'ajax', 'autosubscribe', 'trackforums', 'timecreated',
+            'autosubscribe', 'trackforums', 'timecreated',
             'timemodified', 'trustbitmask', 'screenreader');
 
         // Then, the fields potentially needing anonymization
index d0b5f9d..4b2b34d 100644 (file)
@@ -114,9 +114,7 @@ $string['advancedfilter'] = 'Advanced search';
 $string['advancedsettings'] = 'Advanced settings';
 $string['again'] = 'again';
 $string['aimid'] = 'AIM ID';
-$string['ajaxno'] = 'No: use basic web features';
 $string['ajaxuse'] = 'AJAX and Javascript';
-$string['ajaxyes'] = 'Yes: use advanced web features';
 $string['all'] = 'All';
 $string['allactions'] = 'All actions';
 $string['allactivities'] = 'All activities';
index 098c496..72eba29 100644 (file)
@@ -49,7 +49,7 @@ function user_preference_allow_ajax_update($name, $paramtype) {
  * @return bool
  */
 function ajaxenabled(array $browsers = null) {
-    global $CFG, $USER;
+    global $CFG;
 
     if (!empty($browsers)) {
         $valid = false;
@@ -77,9 +77,9 @@ function ajaxenabled(array $browsers = null) {
         return false;
     }
 
-    if (!empty($CFG->enableajax) && (!empty($USER->ajax) || !isloggedin())) {
+    if (!empty($CFG->enableajax)) {
         return true;
     } else {
         return false;
     }
-}
\ No newline at end of file
+}
index 844fc5d..7bdb28d 100644 (file)
@@ -65,12 +65,11 @@ class ajax_testcase extends advanced_testcase {
      * Uses the array of user agents to test ajax_lib::ajaxenabled
      */
     function test_ajaxenabled() {
-        global $CFG, $USER;
+        global $CFG;
 
         $this->resetAfterTest(true);
 
         $CFG->enableajax = 1;
-        $USER->ajax      = 1;
 
         // Should be true
         $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Firefox']['2.0']['Windows XP'];
old mode 100644 (file)
new mode 100755 (executable)
index 2cbd0e9..db749f3
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20120531" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20120618" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <FIELD NAME="mailformat" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="descriptionformat" NEXT="maildigest"/>
         <FIELD NAME="maildigest" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="mailformat" NEXT="maildisplay"/>
         <FIELD NAME="maildisplay" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="2" SEQUENCE="false" PREVIOUS="maildigest" NEXT="htmleditor"/>
-        <FIELD NAME="htmleditor" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="maildisplay" NEXT="ajax"/>
-        <FIELD NAME="ajax" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="htmleditor" NEXT="autosubscribe"/>
-        <FIELD NAME="autosubscribe" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="ajax" NEXT="trackforums"/>
+        <FIELD NAME="htmleditor" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="maildisplay" NEXT="autosubscribe"/>
+        <FIELD NAME="autosubscribe" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="htmleditor" NEXT="trackforums"/>
         <FIELD NAME="trackforums" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="autosubscribe" NEXT="timecreated"/>
         <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="trackforums" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timecreated" NEXT="trustbitmask"/>
       </KEYS>
     </TABLE>
   </TABLES>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
index f0c8ba1..09f3896 100644 (file)
@@ -830,5 +830,21 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2012060600.04);
     }
 
+    if ($oldversion < 2012061800.01) {
+
+        // Define field screenreader to be dropped from user
+        $table = new xmldb_table('user');
+        $field = new xmldb_field('ajax');
+
+        // Conditionally launch drop field screenreader
+        if ($dbman->field_exists($table, $field)) {
+            $dbman->drop_field($table, $field);
+        }
+
+        // Main savepoint reached
+        upgrade_main_savepoint(true, 2012061800.01);
+    }
+
+
     return true;
 }
index 8110f61..0d54299 100644 (file)
@@ -196,16 +196,6 @@ function useredit_shared_definition(&$mform, $editoroptions = null) {
         $mform->setType('htmleditor', PARAM_INT);
     }
 
-    if (empty($CFG->enableajax)) {
-        $mform->addElement('static', 'ajaxdisabled', get_string('ajaxuse'), get_string('ajaxno'));
-    } else {
-        $choices = array();
-        $choices['0'] = get_string('ajaxno');
-        $choices['1'] = get_string('ajaxyes');
-        $mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
-        $mform->setDefault('ajax', 1);
-    }
-
     $choices = array();
     $choices['0'] = get_string('screenreaderno');
     $choices['1'] = get_string('screenreaderyes');
index 2d8e83a..864c4f6 100644 (file)
@@ -30,7 +30,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 
-$version  = 2012061800.00;              // YYYYMMDD      = weekly release date of this DEV branch
+$version  = 2012061800.01;              // YYYYMMDD      = weekly release date of this DEV branch
                                         //         RR    = release increments - 00 in DEV branches
                                         //           .XX = incremental changes