]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12735 Make AJAX on by default, add option to disable AJAX course editing by defau...
authorskodak <skodak>
Wed, 26 Dec 2007 21:33:34 +0000 (21:33 +0000)
committerskodak <skodak>
Wed, 26 Dec 2007 21:33:34 +0000 (21:33 +0000)
admin/settings/appearance.php
course/view.php
lang/en_utf8/admin.php

index dcd4c4592267601a3149ea5f95d77eba22e1f1b5..cee6f4e62aced72ebc7e1d73b611ec8aa0a9911d 100644 (file)
@@ -78,7 +78,9 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
     $ADMIN->add('appearance', $temp);
 
     $temp = new admin_settingpage('ajax', get_string('ajaxuse'));
-    $temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 0));
+    $temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 1));
+    $temp->add(new admin_setting_configcheckbox('disablecourseajax', get_string('disablecourseajax', 'admin'), get_string('configdisablecourseajax', 'admin'),
+                                                isset($CFG->disablecourseajax) ? 1 : empty($CFG->enableajax)));
     $ADMIN->add('appearance', $temp);
 
     // link to tag management interface
index 6fa94bc1a7d8219c6dd1a99fd4ec885e1b43a748..43dac026e67821d3aafae516c7af668a08b532d2 100644 (file)
 
 
     // AJAX-capable course format?
-    $CFG->useajax = false; 
+    $useajax = false; 
     $ajaxformatfile = $CFG->dirroot.'/course/format/'.$course->format.'/ajax.php';
     $bodytags = '';
 
-    if (file_exists($ajaxformatfile)) {      // Needs to exist otherwise no AJAX by default
+    if (empty($CFG->disablecourseajax) and file_exists($ajaxformatfile)) {      // Needs to exist otherwise no AJAX by default
 
+        // TODO: stop abusing CFG global here
         $CFG->ajaxcapable = false;           // May be overridden later by ajaxformatfile
         $CFG->ajaxtestedbrowsers = array();  // May be overridden later by ajaxformatfile
 
                 // function is called, since that function needs to set some
                 // stuff in the javascriptportal object.
                 $COURSE->javascriptportal = new jsportal();
-                $CFG->useajax = true;
+                $useajax = true;
             }
         }
     }
 
-    $CFG->blocksdrag = $CFG->useajax;   // this will add a new class to the header so we can style differently
+    $CFG->blocksdrag = $useajax;   // this will add a new class to the header so we can style differently
 
 
     $PAGE->print_header(get_string('course').': %fullname%', NULL, '', $bodytags);
 
 
     // Use AJAX?
-    if ($CFG->useajax && has_capability('moodle/course:manageactivities', $context)) {
+    if ($useajax && has_capability('moodle/course:manageactivities', $context)) {
         // At the bottom because we want to process sections and activities
         // after the relevant html has been generated. We're forced to do this
         // because of the way in which lib/ajax/ajaxcourse.js is written.
index 003bbaa1568a720cac3fc115bbec5b4feca19f78..d0d274273a5b950b7a6458e68f6446d87d62217b 100644 (file)
@@ -96,6 +96,7 @@ $string['configeditorfontlist'] = 'Select the fonts that should appear in the ed
 $string['configeditordictionary'] = 'This value will be used if aspell doesn\'t have dictionary for users own language.';
 $string['configemoticons'] = 'Change the code on the left that relates to the name of the emoticon on the right.  To add new emoticons, add a code and a name, then add an image as name.gif in /pix/s.';
 $string['configenableajax'] = 'This setting allows you to control the use of AJAX (advanced client/server interfaces using Javascript) across the whole site.  With this setting enabled users can still make a choice in their profile, otherwise AJAX is disabled for everybody.';
+$string['configdisablecourseajax'] = 'Do not use AJAX when editing main course pages.';
 $string['configenablecourserequests'] = 'This will allow any user to request a course be created.';
 $string['configenableglobalsearch'] = 'This setting enables global text searching in resources and activities, it is not compatible with PHP 4.';
 $string['configenablegroupings'] = 'This setting enables groupings of groups.';
@@ -276,6 +277,7 @@ $string['deleteuser'] = 'Delete user';
 $string['density'] = 'Density';
 $string['denyemailaddresses'] = 'Denied email domains';
 $string['digestmailtime'] = 'Hour to send digest emails';
+$string['disablecourseajax'] = 'Disable AJAX course editing';
 $string['disableuserimages'] = 'Disable User Profile Images';
 $string['displayloginfailures'] = 'Display login failures to';
 $string['docroot'] = 'Moodle Docs document root';