Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-33099 Javascript: Deprecate the ajaxenabled function

  • Loading branch information...
commit af64bc6179bd258d9f085b0d16250f4d82d2c230 1 parent 692d247
@andrewnicols andrewnicols authored
View
1  admin/settings/appearance.php
@@ -217,7 +217,6 @@
$ADMIN->add('appearance', $temp);
$temp = new admin_settingpage('ajax', new lang_string('ajaxuse'));
- $temp->add(new admin_setting_configcheckbox('enableajax', new lang_string('enableajax', 'admin'), new lang_string('configenableajax', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('useexternalyui', new lang_string('useexternalyui', 'admin'), new lang_string('configuseexternalyui', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('yuicomboloading', new lang_string('yuicomboloading', 'admin'), new lang_string('configyuicomboloading', 'admin'), 1));
$setting = new admin_setting_configcheckbox('cachejs', new lang_string('cachejs', 'admin'), new lang_string('cachejs_help', 'admin'), 1);
View
5 blocks/course_overview/renderer.php
@@ -48,10 +48,7 @@ public function course_overview($courses, $overviews) {
// Intialise string/icon etc if user is editing and courses > 1
if ($this->page->user_is_editing() && (count($courses) > 1)) {
$userediting = true;
- // If ajaxenabled then include DND JS and replace link with move image.
- if (ajaxenabled()) {
- $this->page->requires->js_init_call('M.block_course_overview.add_handles');
- }
+ $this->page->requires->js_init_call('M.block_course_overview.add_handles');
// Check if course is moving
$ismovingcourse = optional_param('movecourse', FALSE, PARAM_BOOL);
View
6 course/format/formatlegacy.php
@@ -147,7 +147,6 @@ public function get_view_url($section, $options = array()) {
*
* The returned object's property (boolean)capable indicates that
* the course format supports Moodle course ajax features.
- * The property (array)testedbrowsers can be used as a parameter for {@link ajaxenabled()}.
*
* @return stdClass
*/
@@ -162,9 +161,6 @@ public function supports_ajax() {
if (isset($formatsupport->capable)) {
$ajaxsupport->capable = $formatsupport->capable;
}
- if (is_array($formatsupport->testedbrowsers)) {
- $ajaxsupport->testedbrowsers = $formatsupport->testedbrowsers;
- }
}
return $ajaxsupport;
}
@@ -360,4 +356,4 @@ public function update_course_format_options($data, $oldcourse = null) {
}
return $this->update_format_options($data);
}
-}
+}
View
2  course/format/lib.php
@@ -353,7 +353,6 @@ public function get_section_name($section) {
*
* The returned object's property (boolean)capable indicates that
* the course format supports Moodle course ajax features.
- * The property (array)testedbrowsers can be used as a parameter for {@link ajaxenabled()}.
*
* @return stdClass
*/
@@ -361,7 +360,6 @@ public function supports_ajax() {
// no support by default
$ajaxsupport = new stdClass();
$ajaxsupport->capable = false;
- $ajaxsupport->testedbrowsers = array();
return $ajaxsupport;
}
View
2  course/format/topics/lib.php
@@ -115,14 +115,12 @@ public function get_view_url($section, $options = array()) {
*
* The returned object's property (boolean)capable indicates that
* the course format supports Moodle course ajax features.
- * The property (array)testedbrowsers can be used as a parameter for {@link ajaxenabled()}.
*
* @return stdClass
*/
public function supports_ajax() {
$ajaxsupport = new stdClass();
$ajaxsupport->capable = true;
- $ajaxsupport->testedbrowsers = array('MSIE' => 6.0, 'Gecko' => 20061111, 'Safari' => 531, 'Chrome' => 6.0);
return $ajaxsupport;
}
View
3  course/format/upgrade.txt
@@ -2,6 +2,9 @@ This files describes API changes for course formats
Overview of this plugin type at http://docs.moodle.org/dev/Course_formats
+=== 2.7 ===
+* The ->testedbrowsers array no longer needs to be defined in supports_ajax().
+
=== 2.6 ===
* core_course_renderer::course_section_cm_edit_actions has two new optional arguments and now uses and action_menu component.
View
2  course/format/weeks/lib.php
@@ -122,14 +122,12 @@ public function get_view_url($section, $options = array()) {
*
* The returned object's property (boolean)capable indicates that
* the course format supports Moodle course ajax features.
- * The property (array)testedbrowsers can be used as a parameter for {@link ajaxenabled()}.
*
* @return stdClass
*/
public function supports_ajax() {
$ajaxsupport = new stdClass();
$ajaxsupport->capable = true;
- $ajaxsupport->testedbrowsers = array('MSIE' => 6.0, 'Gecko' => 20061111, 'Safari' => 531, 'Chrome' => 6.0);
return $ajaxsupport;
}
View
6 course/lib.php
@@ -2333,7 +2333,6 @@ function course_format_uses_sections($format) {
*
* The returned object's property (boolean)capable indicates that
* the course format supports Moodle course ajax features.
- * The property (array)testedbrowsers can be used as a parameter for {@see ajaxenabled()}.
*
* @param string $format
* @return stdClass
@@ -3119,11 +3118,6 @@ function course_page_type_list($pagetype, $parentcontext, $currentcontext) {
function course_ajax_enabled($course) {
global $CFG, $PAGE, $SITE;
- // Ajax must be enabled globally
- if (!$CFG->enableajax) {
- return false;
- }
-
// The user must be editing for AJAX to be included
if (!$PAGE->user_is_editing()) {
return false;
View
2  course/renderer.php
@@ -1503,7 +1503,7 @@ protected function coursecat_subcategories(coursecat_helper $chelper, $coursecat
protected function coursecat_include_js() {
global $CFG;
static $jsloaded = false;
- if (!$jsloaded && $CFG->enableajax) {
+ if (!$jsloaded) {
// We must only load this module once.
$this->page->requires->yui_module('moodle-course-categoryexpander',
'Y.Moodle.course.categoryexpander.init');
View
6 course/view.php
@@ -219,10 +219,8 @@
redirect($CFG->wwwroot .'/');
}
- $ajaxenabled = ajaxenabled();
-
$completion = new completion_info($course);
- if ($completion->is_enabled() && $ajaxenabled) {
+ if ($completion->is_enabled()) {
$PAGE->requires->string_for_js('completion-title-manual-y', 'completion');
$PAGE->requires->string_for_js('completion-title-manual-n', 'completion');
$PAGE->requires->string_for_js('completion-alt-manual-y', 'completion');
@@ -251,7 +249,7 @@
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
- if ($completion->is_enabled() && $ajaxenabled) {
+ if ($completion->is_enabled()) {
// This value tracks whether there has been a dynamic change to the page.
// It is used so that if a user does this - (a) set some tickmarks, (b)
// go to another page, (c) clicks Back button - the page will
View
31 group/index.php
@@ -152,20 +152,11 @@
require('tabs.php');
$disabled = 'disabled="disabled"';
-$ajaxenabled = ajaxenabled();
-if ($ajaxenabled) {
- // Some buttons are enabled if single group selected
- $showaddmembersform_disabled = $singlegroup ? '' : $disabled;
- $showeditgroupsettingsform_disabled = $singlegroup ? '' : $disabled;
- $deletegroup_disabled = count($groupids)>0 ? '' : $disabled;
-} else {
- // Do not disable buttons. The buttons work based on the selected group,
- // which you can change without reloading the page, so it is not appropriate
- // to disable them if no group is selected.
- $showaddmembersform_disabled = '';
- $showeditgroupsettingsform_disabled = '';
- $deletegroup_disabled = '';
-}
+
+// Some buttons are enabled if single group selected.
+$showaddmembersform_disabled = $singlegroup ? '' : $disabled;
+$showeditgroupsettingsform_disabled = $singlegroup ? '' : $disabled;
+$deletegroup_disabled = count($groupids) > 0 ? '' : $disabled;
echo $OUTPUT->heading(format_string($course->shortname, true, array('context' => $context)) .' '.$strgroups, 3);
echo '<form id="groupeditform" action="index.php" method="post">'."\n";
@@ -179,11 +170,7 @@
echo "<td>\n";
echo '<p><label for="groups"><span id="groupslabel">'.get_string('groups').':</span><span id="thegrouping">&nbsp;</span></label></p>'."\n";
-if ($ajaxenabled) { // TODO: move this to JS init!
- $onchange = 'M.core_group.membersCombo.refreshMembers();';
-} else {
- $onchange = '';
-}
+$onchange = 'M.core_group.membersCombo.refreshMembers();';
echo '<select name="groups[]" multiple="multiple" id="groups" size="15" class="select" onchange="'.$onchange.'"'."\n";
echo ' onclick="window.status=this.selectedIndex==-1 ? \'\' : this.options[this.selectedIndex].title;" onmouseout="window.status=\'\';">'."\n";
@@ -276,10 +263,8 @@
echo '</div>'."\n";
echo '</form>'."\n";
-if ($ajaxenabled) {
- $PAGE->requires->js_init_call('M.core_group.init_index', array($CFG->wwwroot, $courseid));
- $PAGE->requires->js_init_call('M.core_group.groupslist', array($preventgroupremoval));
-}
+$PAGE->requires->js_init_call('M.core_group.init_index', array($CFG->wwwroot, $courseid));
+$PAGE->requires->js_init_call('M.core_group.groupslist', array($preventgroupremoval));
echo $OUTPUT->footer();
View
2  lang/en/admin.php
@@ -197,7 +197,6 @@
$string['configeditordictionary'] = 'This value will be used if aspell doesn\'t have dictionary for users own language.';
$string['configeditorfontlist'] = 'Select the fonts that should appear in the editor\'s drop-down list.';
$string['configemailchangeconfirmation'] = 'Require an email confirmation step when users change their email address in their profile.';
-$string['configenableajax'] = 'This setting controls the use of AJAX across the site. AJAX is required for certain functionality such as drag and drop.';
$string['configenablecalendarexport'] = 'Enable exporting or subscribing to calendars.';
$string['configenablecomments'] = 'Enable comments';
$string['configenablecourserequests'] = 'This will allow any user to request a course be created.';
@@ -459,7 +458,6 @@
* Alternative text (optional) - String identifier and component of the alternative text of the emoticon.';
$string['emoticonsreset'] = 'Reset emoticons setting to default values';
$string['emptysettingvalue'] = 'Empty';
-$string['enableajax'] = 'Enable AJAX';
$string['enableblogs'] = 'Enable blogs';
$string['enablecalendarexport'] = 'Enable calendar export';
$string['enablecomments'] = 'Enable comments';
View
28 lib/ajax/ajaxlib.php
@@ -41,34 +41,6 @@ function user_preference_allow_ajax_update($name, $paramtype) {
}
/**
- * Returns whether ajax is enabled/allowed or not.
- * @param array $browsers optional list of alowed browsers, empty means use default list
- * @return bool
- */
-function ajaxenabled(array $browsers = null) {
- global $CFG;
-
- if (!empty($browsers)) {
- $valid = false;
- foreach ($browsers as $brand => $version) {
- if (core_useragent::check_browser_version($brand, $version)) {
- $valid = true;
- }
- }
-
- if (!$valid) {
- return false;
- }
- }
-
- if (!empty($CFG->enableajax)) {
- return true;
- } else {
- return false;
- }
-}
-
-/**
* Starts capturing output whilst processing an AJAX request.
*
* This should be used in combination with ajax_check_captured_output to
View
12 lib/deprecatedlib.php
@@ -4266,3 +4266,15 @@ function can_use_html_editor() {
debugging('can_use_html_editor has been deprecated please update your code to assume it returns true.', DEBUG_DEVELOPER);
return true;
}
+
+/**
+ * Returns whether ajax is enabled/allowed or not.
+ * @param array $browsers optional list of alowed browsers, empty means use default list
+ * @return bool
+ * @deprecated since 2.7 MDL-33099 - please do not use this function any more.
+ * @todo MDL-44088 This will be removed in Moodle 2.9.
+ */
+function ajaxenabled(array $browsers = null) {
+ debugging('ajaxenabled() is deprecated.', DEBUG_DEVELOPER);
+ return true;
+}
View
1  lib/upgrade.txt
@@ -17,6 +17,7 @@ DEPRECATIONS:
* The constants FRONTPAGECOURSELIST, FRONTPAGETOPICONLY & FRONTPAGECOURSELIMIT have been removed.
* Various cm_info methods have been deprecated in favour of their read-only properties (get_url(), get_content(), get_extra_classes(),
get_on_click(), get_custom_data(), get_after_link, get_after_edit_icons)
+* The ajaxenabled function has been deprecated and always returns true. All code should be fully functional in Javascript.
YUI:
* The lightbox attribute for moodle-core-notification-dialogue has been
View
2  mod/feedback/edit.php
@@ -160,7 +160,7 @@
//Adding the javascript module for the items dragdrop.
if (count($feedbackitems) > 1) {
- if ($do_show == 'edit' and $CFG->enableajax) {
+ if ($do_show == 'edit') {
$PAGE->requires->strings_for_js(array(
'pluginname',
'move_item',
View
4 rating/lib.php
@@ -1002,9 +1002,7 @@ public function initialise_rating_javascript(moodle_page $page) {
return true;
}
- if (!empty($CFG->enableajax)) {
- $page->requires->js_init_call('M.core_rating.init');
- }
+ $page->requires->js_init_call('M.core_rating.init');
$done = true;
return true;
Please sign in to comment.
Something went wrong with that request. Please try again.