Merge branch 'MDL-33099-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Dan Poltawski
2014-02-17 14:40:36 +08:00
16 changed files with 30 additions and 83 deletions
-1
View File
@@ -220,7 +220,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
$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);
+1 -4
View File
@@ -48,10 +48,7 @@ class block_course_overview_renderer extends plugin_renderer_base {
// 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);
+1 -5
View File
@@ -147,7 +147,6 @@ class format_legacy extends format_base {
*
* 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 @@ class format_legacy extends format_base {
if (isset($formatsupport->capable)) {
$ajaxsupport->capable = $formatsupport->capable;
}
if (is_array($formatsupport->testedbrowsers)) {
$ajaxsupport->testedbrowsers = $formatsupport->testedbrowsers;
}
}
return $ajaxsupport;
}
@@ -360,4 +356,4 @@ class format_legacy extends format_base {
}
return $this->update_format_options($data);
}
}
}
-2
View File
@@ -353,7 +353,6 @@ abstract class format_base {
*
* 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 @@ abstract class format_base {
// no support by default
$ajaxsupport = new stdClass();
$ajaxsupport->capable = false;
$ajaxsupport->testedbrowsers = array();
return $ajaxsupport;
}
-2
View File
@@ -115,14 +115,12 @@ class format_topics extends format_base {
*
* 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;
}
+3
View File
@@ -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.
-2
View File
@@ -122,14 +122,12 @@ class format_weeks extends format_base {
*
* 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;
}
-6
View File
@@ -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;
+2 -4
View File
@@ -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
+8 -23
View File
@@ -152,20 +152,11 @@ $currenttab = 'groups';
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 '<tr>'."\n";
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 '</table>'."\n";
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();
-2
View File
@@ -198,7 +198,6 @@ $string['configdoctonewwindow'] = 'If you enable this, then links to Moodle Docs
$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.';
@@ -461,7 +460,6 @@ $string['emoticons_desc'] = 'This form defines the emoticons (or smileys) used a
* 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';
-28
View File
@@ -40,34 +40,6 @@ function user_preference_allow_ajax_update($name, $paramtype) {
$USER->ajax_updatable_user_prefs[$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.
*
+12
View File
@@ -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;
}
+1
View File
@@ -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
+1 -1
View File
@@ -160,7 +160,7 @@ $PAGE->set_title($feedback->name);
//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',
+1 -3
View File
@@ -1002,9 +1002,7 @@ class rating_manager {
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;