Merge branch 'MOODLE_33_STABLE' into install_33_STABLE
This commit is contained in:
@@ -53,7 +53,7 @@ Options:
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8_general_ci
|
||||
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
|
||||
";
|
||||
|
||||
if (!empty($options['collation'])) {
|
||||
@@ -145,9 +145,22 @@ if (!empty($options['collation'])) {
|
||||
$skipped++;
|
||||
|
||||
} else {
|
||||
$DB->change_database_structure("ALTER TABLE $table->name DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation");
|
||||
echo "CONVERTED\n";
|
||||
$converted++;
|
||||
try {
|
||||
$DB->change_database_structure("ALTER TABLE $table->name CONVERT TO CHARACTER SET $charset COLLATE $collation");
|
||||
echo "CONVERTED\n";
|
||||
$converted++;
|
||||
} catch (ddl_exception $e) {
|
||||
$result = mysql_set_row_format($table->name, $charset, $collation, $engine);
|
||||
if ($result) {
|
||||
echo "CONVERTED\n";
|
||||
$converted++;
|
||||
} else {
|
||||
// We don't know what the problem is. Stop the conversion.
|
||||
cli_error("Error: Tried to convert $table->name, but there was a problem. Please check the details of this
|
||||
table and try again.");
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SHOW FULL COLUMNS FROM $table->name WHERE collation IS NOT NULL";
|
||||
@@ -290,3 +303,26 @@ function mysql_get_column_collations($tablename) {
|
||||
$rs->close();
|
||||
return $collations;
|
||||
}
|
||||
|
||||
function mysql_set_row_format($tablename, $charset, $collation, $engine) {
|
||||
global $DB;
|
||||
|
||||
$sql = "SELECT row_format
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE table_schema = DATABASE() AND table_name = ?";
|
||||
$rs = $DB->get_record_sql($sql, array($tablename));
|
||||
if ($rs) {
|
||||
if ($rs->row_format == 'Compact' || $rs->row_format == 'Redundant') {
|
||||
$rowformat = $DB->get_row_format_sql($engine, $collation);
|
||||
// Try to convert to compressed format and then try updating the collation again.
|
||||
$DB->change_database_structure("ALTER TABLE $tablename $rowformat");
|
||||
$DB->change_database_structure("ALTER TABLE $tablename CONVERT TO CHARACTER SET $charset COLLATE $collation");
|
||||
} else {
|
||||
// Row format may not be the problem. Can not diagnose problem. Send fail reply.
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ class site_registration_form extends moodleform {
|
||||
}
|
||||
$language = get_config('hub', 'site_language_' . $cleanhuburl);
|
||||
if ($language === false) {
|
||||
$language = current_language();
|
||||
$language = explode('_', current_language())[0];
|
||||
}
|
||||
$geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl);
|
||||
$contactable = get_config('hub', 'site_contactable_' . $cleanhuburl);
|
||||
|
||||
@@ -193,8 +193,8 @@ function print_report_tree($contextid, $contexts, $systemcontext, $fullname, $al
|
||||
$strgoto = get_string('gotoassignroles', 'core_role', $a);
|
||||
$strcheck = get_string('checkuserspermissionshere', 'core_role', $a);
|
||||
}
|
||||
echo ' <a title="' . $strgoto . '" href="' . $raurl . '">' . $OUTPUT->pix_icon('t/edit', 'core', $stredit) . '</a> ';
|
||||
echo ' <a title="' . $strcheck . '" href="' . $churl . '">' . $OUTPUT->pix_icon('t/preview', 'core', $strcheckpermissions) . '</a> ';
|
||||
echo ' <a title="' . $strgoto . '" href="' . $raurl . '">' . $OUTPUT->pix_icon('t/edit', $stredit) . '</a> ';
|
||||
echo ' <a title="' . $strcheck . '" href="' . $churl . '">' . $OUTPUT->pix_icon('t/preview', $strcheckpermissions) . '</a> ';
|
||||
echo "</p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ if (empty($CFG->langotherroot)) {
|
||||
$mode = optional_param('mode', 0, PARAM_INT); // action
|
||||
$pack = optional_param_array('pack', array(), PARAM_SAFEDIR); // pack to install
|
||||
$uninstalllang = optional_param_array('uninstalllang', array(), PARAM_LANG);// installed pack to uninstall
|
||||
$confirmtounistall = optional_param('confirmtouninstall', '', PARAM_ALPHAEXT); // uninstallation confirmation
|
||||
$confirmtounistall = optional_param('confirmtouninstall', '', PARAM_SAFEPATH); // uninstallation confirmation
|
||||
$purgecaches = optional_param('purgecaches', false, PARAM_BOOL); // explicit caches reset
|
||||
|
||||
if ($purgecaches) {
|
||||
@@ -74,7 +74,7 @@ if ($mode == DELETION_OF_SELECTED_LANG and (!empty($uninstalllang) or !empty($co
|
||||
// Actually deleting languages, languages to delete are passed as GET parameter as string
|
||||
// ...need to populate them to array.
|
||||
if (empty($uninstalllang)) {
|
||||
$uninstalllang = explode('-', $confirmtounistall);
|
||||
$uninstalllang = explode('/', $confirmtounistall);
|
||||
}
|
||||
|
||||
if (in_array('en', $uninstalllang)) {
|
||||
@@ -84,8 +84,10 @@ if ($mode == DELETION_OF_SELECTED_LANG and (!empty($uninstalllang) or !empty($co
|
||||
} else if (empty($confirmtounistall) and confirm_sesskey()) { // User chose langs to be deleted, show confirmation.
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->confirm(get_string('uninstallconfirm', 'tool_langimport', implode(', ', $uninstalllang)),
|
||||
'index.php?mode='.DELETION_OF_SELECTED_LANG.'&confirmtouninstall='.implode('-', $uninstalllang),
|
||||
'index.php');
|
||||
new moodle_url($PAGE->url, array(
|
||||
'mode' => DELETION_OF_SELECTED_LANG,
|
||||
'confirmtouninstall' => implode('/', $uninstalllang),
|
||||
)), $PAGE->url);
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
|
||||
|
||||
@@ -84,8 +84,7 @@ abstract class restore_tool_log_logstore_subplugin extends restore_subplugin {
|
||||
}
|
||||
}
|
||||
|
||||
// Roll dates.
|
||||
$data->timecreated = $this->apply_date_offset($data->timecreated);
|
||||
// There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961.
|
||||
|
||||
// Revert other to its original php way.
|
||||
$data->other = unserialize(base64_decode($data->other));
|
||||
|
||||
@@ -81,10 +81,11 @@
|
||||
{{/config}}
|
||||
</div>
|
||||
|
||||
<div data-region="footer" class="pull-xs-right">
|
||||
<div data-region="footer" class="pull-xs-right m-t-1">
|
||||
{{#config}}
|
||||
<input type="button" class="btn btn-primary" data-action="save" value="{{#str}}savechanges{{/str}}"/>
|
||||
{{/config}}
|
||||
<input type="button" class="btn btn-secondary" data-action="cancel" value="{{#str}}cancel{{/str}}"/>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
@@ -3083,7 +3083,8 @@ class restore_course_logs_structure_step extends restore_structure_step {
|
||||
|
||||
$data = (object)($data);
|
||||
|
||||
$data->time = $this->apply_date_offset($data->time);
|
||||
// There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961.
|
||||
|
||||
$data->userid = $this->get_mappingid('user', $data->userid);
|
||||
$data->course = $this->get_courseid();
|
||||
$data->cmid = 0;
|
||||
@@ -3130,7 +3131,8 @@ class restore_activity_logs_structure_step extends restore_course_logs_structure
|
||||
|
||||
$data = (object)($data);
|
||||
|
||||
$data->time = $this->apply_date_offset($data->time);
|
||||
// There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961.
|
||||
|
||||
$data->userid = $this->get_mappingid('user', $data->userid);
|
||||
$data->course = $this->get_courseid();
|
||||
$data->cmid = $this->task->get_moduleid();
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
define(["jquery","core/ajax","core/custom_interaction_events"],function(a,b,c){var d=function(d){c.define(d,[c.events.activate]),d.on(c.events.activate,"[data-toggle='tab']",function(c){var d=a(c.currentTarget).data("tabname");"function"==typeof window.history.pushState&&window.history.pushState(null,null,"?myoverviewtab="+d);var e={methodname:"core_user_update_user_preferences",args:{preferences:[{type:"block_myoverview_last_tab",value:d}]}};b.call([e])[0].fail(Notification.exception)})};return{registerEventListeners:d}});
|
||||
define(["jquery","core/ajax","core/custom_interaction_events","core/notification"],function(a,b,c,d){var e=function(e){c.define(e,[c.events.activate]),e.on(c.events.activate,"[data-toggle='tab']",function(c){var e=a(c.currentTarget).data("tabname");"function"==typeof window.history.pushState&&window.history.pushState(null,null,"?myoverviewtab="+e);var f={methodname:"core_user_update_user_preferences",args:{preferences:[{type:"block_myoverview_last_tab",value:e}]}};b.call([f])[0].fail(d.exception)})};return{registerEventListeners:e}});
|
||||
@@ -21,7 +21,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define(['jquery', 'core/ajax', 'core/custom_interaction_events'], function($, Ajax, CustomEvents) {
|
||||
define(['jquery', 'core/ajax', 'core/custom_interaction_events',
|
||||
'core/notification'], function($, Ajax, CustomEvents, Notification) {
|
||||
|
||||
/**
|
||||
* Registers an event that saves the user's tab preference when switching between them.
|
||||
|
||||
@@ -1 +1 @@
|
||||
define(["jquery"],function(a){function b(d,e){var f=a("<ul></ul>");f.attr("role","group"),f.attr("aria-hidden",!0),a.each(e,function(d,e){if("object"==typeof e){var g=a("<li></li>"),h=a("<p></p>"),i=e.id||e.key+"_tree_item",j=null,k=!(!e.expandable&&!e.haschildren);if(h.addClass("tree_item"),h.attr("id",i),h.attr("role","treeitem"),h.attr("tabindex","-1"),e.requiresajaxloading&&(h.attr("data-requires-ajax",!0),h.attr("data-node-id",e.id),h.attr("data-node-key",e.key),h.attr("data-node-type",e.type)),k&&(g.addClass("collapsed contains_branch"),h.attr("aria-expanded",!1),h.addClass("branch")),!e.icon||k&&e.type!==c.ACTIVITY&&e.type!==c.RESOURCE||(g.addClass("item_with_icon"),h.addClass("hasicon"),j=a("<img/>"),j.attr("alt",e.icon.alt),j.attr("title",e.icon.title),j.attr("src",M.util.image_url(e.icon.pix,e.icon.component)),a.each(e.icon.classes,function(a,b){j.addClass(b)})),e.link){var l=a('<a title="'+e.title+'" href="'+e.link+'"></a>');j?(l.append(j),l.append('<span class="item-content-wrap">'+e.name+"</span>")):l.append(e.name),e.hidden&&l.addClass("dimmed"),h.append(l)}else{var m=a("<span></span>");j?(m.append(j),m.append('<span class="item-content-wrap">'+e.name+"</span>")):m.append(e.name),e.hidden&&m.addClass("dimmed"),h.append(m)}g.append(h),f.append(g),e.children&&e.children.length?b(h,e.children):k&&!e.requiresajaxloading&&(g.removeClass("contains_branch"),h.addClass("emptybranch"))}}),d.parent().append(f);var g=d.attr("id")+"_group";f.attr("id",g),d.attr("aria-owns",g),d.attr("role","treeitem")}var c={ACTIVITY:40,RESOURCE:50};return{render:function(a,c){if(c.children&&c.children.length){b(a,c.children);var d=a.children("[role='treeitem']").first(),e=a.find("#"+d.attr("aria-owns"));d.attr("aria-expanded",!0),e.attr("aria-hidden",!1)}else a.parent().hasClass("contains_branch")&&(a.parent().removeClass("contains_branch"),a.addClass("emptybranch"))}}});
|
||||
define(["jquery","core/templates","core/notification","core/url"],function(a,b,c,d){function e(g,h){var i=a("<ul></ul>");i.attr("role","group"),i.attr("aria-hidden",!0),a.each(h,function(g,h){if("object"==typeof h){var j=a("<li></li>"),k=a("<p></p>"),l=h.id||h.key+"_tree_item",m=null,n=!(!h.expandable&&!h.haschildren);k.addClass("tree_item"),k.attr("id",l),k.attr("role","treeitem"),k.attr("tabindex","-1"),h.requiresajaxloading&&(k.attr("data-requires-ajax",!0),k.attr("data-node-id",h.id),k.attr("data-node-key",h.key),k.attr("data-node-type",h.type)),n&&(j.addClass("collapsed contains_branch"),k.attr("aria-expanded",!1),k.addClass("branch"));var o=null;if(h.link){var p=a('<a title="'+h.title+'" href="'+h.link+'"></a>');o=p,p.append('<span class="item-content-wrap">'+h.name+"</span>"),h.hidden&&p.addClass("dimmed"),k.append(p)}else{var q=a("<span></span>");o=q,q.append('<span class="item-content-wrap">'+h.name+"</span>"),h.hidden&&q.addClass("dimmed"),k.append(q)}!h.icon||n&&h.type!==f.ACTIVITY&&h.type!==f.RESOURCE||(j.addClass("item_with_icon"),k.addClass("hasicon"),h.type===f.ACTIVITY||h.type===f.RESOURCE?(m=a("<img/>"),m.attr("alt",h.icon.alt),m.attr("title",h.icon.title),m.attr("src",d.imageUrl(h.icon.pix,h.icon.component)),a.each(h.icon.classes,function(a,b){m.addClass(b)}),o.prepend(m)):("moodle"==h.icon.component&&(h.icon.component="core"),b.renderPix(h.icon.pix,h.icon.component,h.icon.title).then(function(a){o.prepend(a)})["catch"](c.exception))),j.append(k),i.append(j),h.children&&h.children.length?e(k,h.children):n&&!h.requiresajaxloading&&(j.removeClass("contains_branch"),k.addClass("emptybranch"))}}),g.parent().append(i);var j=g.attr("id")+"_group";i.attr("id",j),g.attr("aria-owns",j),g.attr("role","treeitem")}var f={ACTIVITY:40,RESOURCE:50};return{render:function(a,b){if(b.children&&b.children.length){e(a,b.children);var c=a.children("[role='treeitem']").first(),d=a.find("#"+c.attr("aria-owns"));c.attr("aria-expanded",!0),d.attr("aria-hidden",!1)}else a.parent().hasClass("contains_branch")&&(a.parent().removeClass("contains_branch"),a.addClass("emptybranch"))}}});
|
||||
@@ -22,7 +22,7 @@
|
||||
* @copyright 2015 John Okely <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['jquery'], function($) {
|
||||
define(['jquery', 'core/templates', 'core/notification', 'core/url'], function($, Templates, Notification, Url) {
|
||||
|
||||
// Mappings for the different types of nodes coming from the navigation.
|
||||
// Copied from lib/navigationlib.php navigation_node constants.
|
||||
@@ -75,28 +75,12 @@ define(['jquery'], function($) {
|
||||
p.addClass('branch');
|
||||
}
|
||||
|
||||
if (node.icon && (!isBranch || node.type === NODETYPE.ACTIVITY || node.type === NODETYPE.RESOURCE)) {
|
||||
li.addClass('item_with_icon');
|
||||
p.addClass('hasicon');
|
||||
|
||||
icon = $('<img/>');
|
||||
icon.attr('alt', node.icon.alt);
|
||||
icon.attr('title', node.icon.title);
|
||||
icon.attr('src', M.util.image_url(node.icon.pix, node.icon.component));
|
||||
$.each(node.icon.classes, function(index, className) {
|
||||
icon.addClass(className);
|
||||
});
|
||||
}
|
||||
|
||||
var eleToAddIcon = null;
|
||||
if (node.link) {
|
||||
var link = $('<a title="' + node.title + '" href="' + node.link + '"></a>');
|
||||
|
||||
if (icon) {
|
||||
link.append(icon);
|
||||
link.append('<span class="item-content-wrap">' + node.name + '</span>');
|
||||
} else {
|
||||
link.append(node.name);
|
||||
}
|
||||
eleToAddIcon = link;
|
||||
link.append('<span class="item-content-wrap">' + node.name + '</span>');
|
||||
|
||||
if (node.hidden) {
|
||||
link.addClass('dimmed');
|
||||
@@ -106,12 +90,8 @@ define(['jquery'], function($) {
|
||||
} else {
|
||||
var span = $('<span></span>');
|
||||
|
||||
if (icon) {
|
||||
span.append(icon);
|
||||
span.append('<span class="item-content-wrap">' + node.name + '</span>');
|
||||
} else {
|
||||
span.append(node.name);
|
||||
}
|
||||
eleToAddIcon = span;
|
||||
span.append('<span class="item-content-wrap">' + node.name + '</span>');
|
||||
|
||||
if (node.hidden) {
|
||||
span.addClass('dimmed');
|
||||
@@ -120,6 +100,31 @@ define(['jquery'], function($) {
|
||||
p.append(span);
|
||||
}
|
||||
|
||||
if (node.icon && (!isBranch || node.type === NODETYPE.ACTIVITY || node.type === NODETYPE.RESOURCE)) {
|
||||
li.addClass('item_with_icon');
|
||||
p.addClass('hasicon');
|
||||
|
||||
if (node.type === NODETYPE.ACTIVITY || node.type === NODETYPE.RESOURCE) {
|
||||
icon = $('<img/>');
|
||||
icon.attr('alt', node.icon.alt);
|
||||
icon.attr('title', node.icon.title);
|
||||
icon.attr('src', Url.imageUrl(node.icon.pix, node.icon.component));
|
||||
$.each(node.icon.classes, function(index, className) {
|
||||
icon.addClass(className);
|
||||
});
|
||||
eleToAddIcon.prepend(icon);
|
||||
} else {
|
||||
if (node.icon.component == 'moodle') {
|
||||
node.icon.component = 'core';
|
||||
}
|
||||
Templates.renderPix(node.icon.pix, node.icon.component, node.icon.title).then(function(html) {
|
||||
// Prepend.
|
||||
eleToAddIcon.prepend(html);
|
||||
return;
|
||||
}).catch(Notification.exception);
|
||||
}
|
||||
}
|
||||
|
||||
li.append(p);
|
||||
ul.append(li);
|
||||
|
||||
|
||||
@@ -71,6 +71,6 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
.block_navigation .block_tree [aria-hidden="true"] {
|
||||
.block_navigation .block_tree [aria-hidden="true"]:not(.icon) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
.block_settings .block_tree [aria-hidden="true"] {
|
||||
.block_settings .block_tree [aria-hidden="true"]:not(.icon) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,11 +71,6 @@ class container {
|
||||
*/
|
||||
protected static $eventretrievalstrategy;
|
||||
|
||||
/**
|
||||
* @var array A list of callbacks to use.
|
||||
*/
|
||||
protected static $callbacks = array();
|
||||
|
||||
/**
|
||||
* @var \stdClass[] An array of cached courses to use with the event factory.
|
||||
*/
|
||||
@@ -91,16 +86,6 @@ class container {
|
||||
*/
|
||||
private static function init() {
|
||||
if (empty(self::$eventfactory)) {
|
||||
// When testing the container's components, we need to make sure
|
||||
// the callback implementations in modules are not executed, since
|
||||
// we cannot control their output from PHPUnit. To do this we have
|
||||
// a set of 'testing' callbacks that the factory can use. This way
|
||||
// we know exactly how the factory behaves when being tested.
|
||||
$getcallback = function($which) {
|
||||
return self::$callbacks[PHPUNIT_TEST ? 'testing' : 'production'][$which];
|
||||
};
|
||||
|
||||
self::initcallbacks();
|
||||
self::$actionfactory = new action_factory();
|
||||
self::$eventmapper = new event_mapper(
|
||||
// The event mapper we return from here needs to know how to
|
||||
@@ -129,8 +114,8 @@ class container {
|
||||
);
|
||||
|
||||
self::$eventfactory = new event_factory(
|
||||
$getcallback('action'),
|
||||
$getcallback('visibility'),
|
||||
[self::class, 'apply_component_provide_event_action'],
|
||||
[self::class, 'apply_component_is_event_visible'],
|
||||
function ($dbrow) {
|
||||
// At present we only have a bail-out check for events in course modules.
|
||||
if (empty($dbrow->modulename)) {
|
||||
@@ -183,6 +168,19 @@ class container {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all static caches, called between tests.
|
||||
*/
|
||||
public static function reset_caches() {
|
||||
self::$eventfactory = null;
|
||||
self::$eventmapper = null;
|
||||
self::$eventvault = null;
|
||||
self::$actionfactory = null;
|
||||
self::$eventretrievalstrategy = null;
|
||||
self::$coursecache = [];
|
||||
self::$modulecache = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the event factory.
|
||||
*
|
||||
@@ -214,88 +212,74 @@ class container {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialises the callbacks.
|
||||
* Calls callback 'core_calendar_provide_event_action' from the component responsible for the event
|
||||
*
|
||||
* There are two sets here, one is used during PHPUnit runs.
|
||||
* See the comment at the start of the init method for more
|
||||
* detail.
|
||||
* If no callback is present or callback returns null, there is no action on the event
|
||||
* and it will not be displayed on the dashboard.
|
||||
*
|
||||
* @param event_interface $event
|
||||
* @return action_event|event_interface
|
||||
*/
|
||||
private static function initcallbacks() {
|
||||
self::$callbacks = array(
|
||||
'testing' => array(
|
||||
// Always return an action event.
|
||||
'action' => function (event_interface $event) {
|
||||
return new action_event(
|
||||
$event,
|
||||
new \core_calendar\local\event\value_objects\action(
|
||||
'test',
|
||||
new \moodle_url('http://example.com'),
|
||||
420,
|
||||
true
|
||||
));
|
||||
},
|
||||
// Always be visible.
|
||||
'visibility' => function (event_interface $event) {
|
||||
return true;
|
||||
}
|
||||
),
|
||||
'production' => array(
|
||||
// This function has type event_interface -> event_interface.
|
||||
// This is enforced by the event_factory.
|
||||
'action' => function (event_interface $event) {
|
||||
// Callbacks will get supplied a "legacy" version
|
||||
// of the event class.
|
||||
$mapper = self::$eventmapper;
|
||||
$action = null;
|
||||
if ($event->get_course_module()) {
|
||||
// TODO MDL-58866 Only activity modules currently support this callback.
|
||||
// Any other event will not be displayed on the dashboard.
|
||||
$action = component_callback(
|
||||
'mod_' . $event->get_course_module()->get('modname'),
|
||||
'core_calendar_provide_event_action',
|
||||
[
|
||||
$mapper->from_event_to_legacy_event($event),
|
||||
self::$actionfactory
|
||||
]
|
||||
);
|
||||
}
|
||||
public static function apply_component_provide_event_action(event_interface $event) {
|
||||
// Callbacks will get supplied a "legacy" version
|
||||
// of the event class.
|
||||
$mapper = self::$eventmapper;
|
||||
$action = null;
|
||||
if ($event->get_course_module()) {
|
||||
// TODO MDL-58866 Only activity modules currently support this callback.
|
||||
// Any other event will not be displayed on the dashboard.
|
||||
$action = component_callback(
|
||||
'mod_' . $event->get_course_module()->get('modname'),
|
||||
'core_calendar_provide_event_action',
|
||||
[
|
||||
$mapper->from_event_to_legacy_event($event),
|
||||
self::$actionfactory
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// If we get an action back, return an action event, otherwise
|
||||
// continue piping through the original event.
|
||||
//
|
||||
// If a module does not implement the callback, component_callback
|
||||
// returns null.
|
||||
return $action ? new action_event($event, $action) : $event;
|
||||
},
|
||||
// This function has type event_interface -> bool.
|
||||
// This is enforced by the event_factory.
|
||||
'visibility' => function (event_interface $event) {
|
||||
$mapper = self::$eventmapper;
|
||||
$eventvisible = null;
|
||||
if ($event->get_course_module()) {
|
||||
// TODO MDL-58866 Only activity modules currently support this callback.
|
||||
$eventvisible = component_callback(
|
||||
'mod_' . $event->get_course_module()->get('modname'),
|
||||
'core_calendar_is_event_visible',
|
||||
[
|
||||
$mapper->from_event_to_legacy_event($event)
|
||||
]
|
||||
);
|
||||
}
|
||||
// If we get an action back, return an action event, otherwise
|
||||
// continue piping through the original event.
|
||||
//
|
||||
// If a module does not implement the callback, component_callback
|
||||
// returns null.
|
||||
return $action ? new action_event($event, $action) : $event;
|
||||
}
|
||||
|
||||
// Do not display the event if there is nothing to action.
|
||||
if ($event instanceof action_event_interface && $event->get_action()->get_item_count() === 0) {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Calls callback 'core_calendar_is_event_visible' from the component responsible for the event
|
||||
*
|
||||
* The visibility callback is optional, if not present it is assumed as visible.
|
||||
* If it is an actionable event but the get_item_count() returns 0 the visibility
|
||||
* is set to false.
|
||||
*
|
||||
* @param event_interface $event
|
||||
* @return bool
|
||||
*/
|
||||
public static function apply_component_is_event_visible(event_interface $event) {
|
||||
$mapper = self::$eventmapper;
|
||||
$eventvisible = null;
|
||||
if ($event->get_course_module()) {
|
||||
// TODO MDL-58866 Only activity modules currently support this callback.
|
||||
$eventvisible = component_callback(
|
||||
'mod_' . $event->get_course_module()->get('modname'),
|
||||
'core_calendar_is_event_visible',
|
||||
[
|
||||
$mapper->from_event_to_legacy_event($event)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Module does not implement the callback, event should be visible.
|
||||
if (is_null($eventvisible)) {
|
||||
return true;
|
||||
}
|
||||
// Do not display the event if there is nothing to action.
|
||||
if ($event instanceof action_event_interface && $event->get_action()->get_item_count() === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $eventvisible ? true : false;
|
||||
}
|
||||
),
|
||||
);
|
||||
// Module does not implement the callback, event should be visible.
|
||||
if (is_null($eventvisible)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $eventvisible ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,13 +674,15 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
|
||||
*/
|
||||
public function test_get_calendar_events_override() {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
$teacher = $this->getDataGenerator()->create_user();
|
||||
$anotheruser = $this->getDataGenerator()->create_user();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$generator = $this->getDataGenerator()->get_plugin_generator('mod_assign');
|
||||
$moduleinstance = $generator->create_instance(['course' => $course->id]);
|
||||
|
||||
$this->getDataGenerator()->enrol_user($user->id, $course->id);
|
||||
$this->getDataGenerator()->enrol_user($user->id, $course->id, 'student');
|
||||
$this->getDataGenerator()->enrol_user($user2->id, $course->id, 'student');
|
||||
$this->getDataGenerator()->enrol_user($teacher->id, $course->id, 'editingteacher');
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
@@ -692,11 +694,12 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
|
||||
];
|
||||
|
||||
$now = time();
|
||||
// Create two events - one for everybody in the course and one only for the first student.
|
||||
$event1 = $this->create_calendar_event('Base event', 0, 'due', 0, $now + DAYSECS, $params + ['courseid' => $course->id]);
|
||||
$event2 = $this->create_calendar_event('User event', $user->id, 'due', 0, $now + 2*DAYSECS, $params + ['courseid' => 0]);
|
||||
|
||||
// Retrieve course events for teacher - only one "Base event" is returned.
|
||||
$this->setUser($teacher);
|
||||
// Retrieve course events for the second student - only one "Base event" is returned.
|
||||
$this->setUser($user2);
|
||||
$paramevents = array('courseids' => array($course->id));
|
||||
$options = array ('siteevents' => true, 'userevents' => true);
|
||||
$events = core_calendar_external::get_calendar_events($paramevents, $options);
|
||||
@@ -705,7 +708,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
|
||||
$this->assertEquals(0, count($events['warnings']));
|
||||
$this->assertEquals('Base event', $events['events'][0]['name']);
|
||||
|
||||
// Retrieve events for user - both events are returned.
|
||||
// Retrieve events for the first student - both events are returned.
|
||||
$this->setUser($user);
|
||||
$events = core_calendar_external::get_calendar_events($paramevents, $options);
|
||||
$events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
|
||||
|
||||
@@ -559,7 +559,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
|
||||
// so there is definitely something to print.
|
||||
$formattedinfo = \core_availability\info::format_info(
|
||||
$section->availableinfo, $section->course);
|
||||
$o .= $this->courserenderer->availability_info($formattedinfo);
|
||||
$o .= $this->courserenderer->availability_info($formattedinfo, 'isrestricted');
|
||||
}
|
||||
} else if ($canviewhidden && !empty($CFG->enableavailability)) {
|
||||
// Check if there is an availability restriction.
|
||||
@@ -568,7 +568,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
|
||||
if ($fullinfo) {
|
||||
$formattedinfo = \core_availability\info::format_info(
|
||||
$fullinfo, $section->course);
|
||||
$o .= $this->courserenderer->availability_info($formattedinfo);
|
||||
$o .= $this->courserenderer->availability_info($formattedinfo, 'isrestricted isfullinfo');
|
||||
}
|
||||
}
|
||||
return $o;
|
||||
|
||||
+20
-3
@@ -728,7 +728,24 @@ class core_course_renderer extends plugin_renderer_base {
|
||||
* @return string
|
||||
*/
|
||||
public function availability_info($text, $additionalclasses = '') {
|
||||
|
||||
$data = ['text' => $text, 'classes' => $additionalclasses];
|
||||
$additionalclasses = array_filter(explode(' ', $additionalclasses));
|
||||
|
||||
if (in_array('ishidden', $additionalclasses)) {
|
||||
$data['ishidden'] = 1;
|
||||
|
||||
} else if (in_array('isstealth', $additionalclasses)) {
|
||||
$data['isstealth'] = 1;
|
||||
|
||||
} else if (in_array('isrestricted', $additionalclasses)) {
|
||||
$data['isrestricted'] = 1;
|
||||
|
||||
if (in_array('isfullinfo', $additionalclasses)) {
|
||||
$data['isfullinfo'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render_from_template('core/availability_info', $data);
|
||||
}
|
||||
|
||||
@@ -752,7 +769,7 @@ class core_course_renderer extends plugin_renderer_base {
|
||||
if (!empty($mod->availableinfo)) {
|
||||
$formattedinfo = \core_availability\info::format_info(
|
||||
$mod->availableinfo, $mod->get_course());
|
||||
$output = $this->availability_info($formattedinfo);
|
||||
$output = $this->availability_info($formattedinfo, 'isrestricted');
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
@@ -775,9 +792,9 @@ class core_course_renderer extends plugin_renderer_base {
|
||||
// Display information about conditional availability.
|
||||
// Don't add availability information if user is not editing and activity is hidden.
|
||||
if ($mod->visible || $this->page->user_is_editing()) {
|
||||
$hidinfoclass = '';
|
||||
$hidinfoclass = 'isrestricted isfullinfo';
|
||||
if (!$mod->visible) {
|
||||
$hidinfoclass = 'hide';
|
||||
$hidinfoclass .= ' hide';
|
||||
}
|
||||
$ci = new \core_availability\info_module($mod);
|
||||
$fullinfo = $ci->get_full_information();
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
define(["jquery","core/config"],function(a,b){var c=function(a){var b,c,d=this,e=null,f=0;for(f=0;f<d.length;f++){if(b=d[f],c=a[f],"undefined"==typeof c){e=new Error("missing response");break}if(c.error!==!1){e=c.exception;break}b.deferred.resolve(c.data)}if(null!==e)for(;f<d.length;f++)b=d[f],b.deferred.reject(e)},d=function(a,b){var c=this,d=0;for(d=0;d<c.length;d++){var e=c[d];e.deferred.reject(b)}};return{call:function(e,f,g){var h,i=[],j=[],k=[],l="";for("undefined"==typeof g&&(g=!0),"undefined"==typeof f&&(f=!0),h=0;h<e.length;h++){var m=e[h];i.push({index:h,methodname:m.methodname,args:m.args}),m.deferred=a.Deferred(),j.push(m.deferred.promise()),"undefined"!=typeof m.done&&m.deferred.done(m.done),"undefined"!=typeof m.fail&&m.deferred.fail(m.fail),m.index=h,k.push(m.methodname)}l=k.length<=5?k.sort().join():k.length+"-method-calls",i=JSON.stringify(i);var n={type:"POST",data:i,context:e,dataType:"json",processData:!1,async:f,contentType:"application/json"},o="service.php";g||(o="service-nologin.php");var p=b.wwwroot+"/lib/ajax/"+o+"?sesskey="+b.sesskey+"&info="+l;return f?a.ajax(p,n).done(c).fail(d):(n.success=c,n.error=d,a.ajax(p,n)),j}}});
|
||||
define(["jquery","core/config","core/log"],function(a,b,c){var d=!1,e=function(a){var b,c,d=this,e=null,f=0;for(f=0;f<d.length;f++){if(b=d[f],c=a[f],"undefined"==typeof c){e=new Error("missing response");break}if(c.error!==!1){e=c.exception;break}b.deferred.resolve(c.data)}if(null!==e)for(;f<d.length;f++)b=d[f],b.deferred.reject(e)},f=function(a,b){var e=this,f=0;for(f=0;f<e.length;f++){var g=e[f];d?c.error("Page unload: "+b):g.deferred.reject(b)}};return{call:function(c,g,h){a(window).bind("beforeunload",function(){d=!0});var i,j=[],k=[],l=[],m="";for("undefined"==typeof h&&(h=!0),"undefined"==typeof g&&(g=!0),i=0;i<c.length;i++){var n=c[i];j.push({index:i,methodname:n.methodname,args:n.args}),n.deferred=a.Deferred(),k.push(n.deferred.promise()),"undefined"!=typeof n.done&&n.deferred.done(n.done),"undefined"!=typeof n.fail&&n.deferred.fail(n.fail),n.index=i,l.push(n.methodname)}m=l.length<=5?l.sort().join():l.length+"-method-calls",j=JSON.stringify(j);var o={type:"POST",data:j,context:c,dataType:"json",processData:!1,async:g,contentType:"application/json"},p="service.php";h||(p="service-nologin.php");var q=b.wwwroot+"/lib/ajax/"+p+"?sesskey="+b.sesskey+"&info="+m;return g?a.ajax(q,o).done(e).fail(f):(o.success=e,o.error=f,a.ajax(q,o)),k}}});
|
||||
+13
-2
@@ -25,7 +25,10 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since 2.9
|
||||
*/
|
||||
define(['jquery', 'core/config'], function($, config) {
|
||||
define(['jquery', 'core/config', 'core/log'], function($, config, Log) {
|
||||
|
||||
// Keeps track of when the user leaves the page so we know not to show an error.
|
||||
var unloading = false;
|
||||
|
||||
/**
|
||||
* Success handler. Called when the ajax call succeeds. Checks each response and
|
||||
@@ -87,7 +90,12 @@ define(['jquery', 'core/config'], function($, config) {
|
||||
for (i = 0; i < requests.length; i++) {
|
||||
var request = requests[i];
|
||||
|
||||
request.deferred.reject(textStatus);
|
||||
if (unloading) {
|
||||
// No need to trigger an error because we are already navigating.
|
||||
Log.error("Page unload: " + textStatus);
|
||||
} else {
|
||||
request.deferred.reject(textStatus);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -109,6 +117,9 @@ define(['jquery', 'core/config'], function($, config) {
|
||||
* @return {Promise[]} Array of promises that will be resolved when the ajax call returns.
|
||||
*/
|
||||
call: function(requests, async, loginrequired) {
|
||||
$(window).bind('beforeunload', function() {
|
||||
unloading = true;
|
||||
});
|
||||
var ajaxRequestData = [],
|
||||
i,
|
||||
promises = [],
|
||||
|
||||
@@ -247,7 +247,7 @@ class icon_system_fontawesome extends icon_system_font {
|
||||
'core:i/mnethost' => 'fa-external-link',
|
||||
'core:i/moodle_host' => 'fa-graduation-cap',
|
||||
'core:i/move_2d' => 'fa-arrows',
|
||||
'core:i/navigationitem' => 'fa-angle-right',
|
||||
'core:i/navigationitem' => 'fa-fw',
|
||||
'core:i/ne_red_mark' => 'fa-remove',
|
||||
'core:i/new' => 'fa-plus',
|
||||
'core:i/news' => 'fa-newspaper-o',
|
||||
@@ -280,7 +280,7 @@ class icon_system_fontawesome extends icon_system_font {
|
||||
'core:i/scales' => 'fa-balance-scale',
|
||||
'core:i/scheduled' => 'fa-calendar-check-o',
|
||||
'core:i/search' => 'fa-search',
|
||||
'core:i/settings' => 'fa-cogs',
|
||||
'core:i/settings' => 'fa-cog',
|
||||
'core:i/show' => 'fa-eye-slash',
|
||||
'core:i/siteevent' => 'fa-share-alt',
|
||||
'core:i/star-rating' => 'fa-star',
|
||||
@@ -309,7 +309,7 @@ class icon_system_fontawesome extends icon_system_font {
|
||||
'core:t/block' => 'fa-ban',
|
||||
'core:t/block_to_dock_rtl' => 'fa-chevron-right',
|
||||
'core:t/block_to_dock' => 'fa-chevron-left',
|
||||
'core:t/calc_off' => 'fa-times fa-cross',
|
||||
'core:t/calc_off' => 'fa-calculator', // TODO: Change to better icon once we have stacked icon support or more icons.
|
||||
'core:t/calc' => 'fa-calculator',
|
||||
'core:t/check' => 'fa-check',
|
||||
'core:t/cohort' => 'fa-users',
|
||||
|
||||
@@ -37,7 +37,7 @@ class repository extends base {
|
||||
*/
|
||||
public static function get_enabled_plugins() {
|
||||
global $DB;
|
||||
return $DB->get_records_menu('repository', array('visible'=>1), 'type ASC', 'type, type AS val');
|
||||
return $DB->get_records_menu('repository', null, 'type ASC', 'type, type AS val');
|
||||
}
|
||||
|
||||
public function get_settings_section_name() {
|
||||
|
||||
@@ -423,6 +423,21 @@ class completion_info {
|
||||
// Load criteria from database
|
||||
$records = (array)$DB->get_records('course_completion_criteria', $params);
|
||||
|
||||
// Order records so activities are in the same order as they appear on the course view page.
|
||||
if ($records) {
|
||||
$activitiesorder = array_keys(get_fast_modinfo($this->course)->get_cms());
|
||||
usort($records, function ($a, $b) use ($activitiesorder) {
|
||||
$aidx = ($a->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) ?
|
||||
array_search($a->moduleinstance, $activitiesorder) : false;
|
||||
$bidx = ($b->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) ?
|
||||
array_search($b->moduleinstance, $activitiesorder) : false;
|
||||
if ($aidx === false || $bidx === false || $aidx == $bidx) {
|
||||
return 0;
|
||||
}
|
||||
return ($aidx < $bidx) ? -1 : 1;
|
||||
});
|
||||
}
|
||||
|
||||
// Build array of criteria objects
|
||||
$this->criteria = array();
|
||||
foreach ($records as $record) {
|
||||
|
||||
@@ -662,6 +662,7 @@ class zip_archive extends file_archive {
|
||||
case 'ISO-8859-6': $encoding = 'CP720'; break;
|
||||
case 'ISO-8859-7': $encoding = 'CP737'; break;
|
||||
case 'ISO-8859-8': $encoding = 'CP862'; break;
|
||||
case 'WINDOWS-1251': $encoding = 'CP866'; break;
|
||||
case 'EUC-JP':
|
||||
case 'UTF-8':
|
||||
if ($winchar = get_string('localewincharset', 'langconfig')) {
|
||||
|
||||
@@ -229,6 +229,11 @@ class phpunit_util extends testing_util {
|
||||
// Reset internal users.
|
||||
core_user::reset_internal_users();
|
||||
|
||||
// Clear static caches in calendar container.
|
||||
if (class_exists('\core_calendar\local\event\container', false)) {
|
||||
core_calendar\local\event\container::reset_caches();
|
||||
}
|
||||
|
||||
//TODO MDL-25290: add more resets here and probably refactor them to new core function
|
||||
|
||||
// Reset course and module caches.
|
||||
|
||||
+1
-1
@@ -1545,7 +1545,7 @@ class table_sql extends flexible_table {
|
||||
* Of course you can use sub-queries, JOINS etc. by putting them in the
|
||||
* appropriate clause of the query.
|
||||
*/
|
||||
function set_sql($fields, $from, $where, array $params = NULL) {
|
||||
function set_sql($fields, $from, $where, array $params = array()) {
|
||||
$this->sql = new stdClass();
|
||||
$this->sql->fields = $fields;
|
||||
$this->sql->from = $from;
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ Y.extend(Confirmation, Y.Base, {
|
||||
_uninstall: function(e, langCodes) {
|
||||
Y.config.win.location.href = this.get('uninstallUrl') + '?mode=4' +
|
||||
'&sesskey=' + M.cfg.sesskey +
|
||||
'&confirmtouninstall=' + langCodes.join('-');
|
||||
'&confirmtouninstall=' + langCodes.join('/');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-core-languninstallconfirm",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}var r={UNINSTALLBUTTON:"#languninstallbutton",UNINSTALLSELECT:"#menuuninstalllang option",ENGLISHOPTION:"#menuuninstalllang option[value='en']"};n.NAME=t,n.ATTRS={uninstallUrl:{validator:e.Lang.isString}},e.extend(n,e.Base,{initializer:function(){e.one(r.UNINSTALLBUTTON).on("click",this._confirm,this)},_confirm:function(t){t.preventDefault();var n=[],i=[];e.all(r.UNINSTALLSELECT).each(function(e){e.get("selected")&&(n.push(e.getAttribute("value")),i.push(e.get("text")))});if(n.length===0){(new M.core.alert({message:M.util.get_string("selectlangs","tool_langimport")})).show();return}if(n.indexOf("en")>-1){e.one(r.ENGLISHOPTION).set("selected",!1),(new M.core.alert({message:M.util.get_string("noenglishuninstall","tool_langimport")})).show();return}var s={modal:!0,visible:!1,centered:!0,title:M.util.get_string("uninstall","tool_langimport"),question:M.util.get_string("uninstallconfirm","tool_langimport",i.join(", "))};(new M.core.confirm(s)).show().on("complete-yes",this._uninstall,this,n)},_uninstall:function(t,n){e.config.win.location.href=this.get("uninstallUrl")+"?mode=4"+"&sesskey="+M.cfg.sesskey+"&confirmtouninstall="+n.join("-")}}),e.namespace("M.core.languninstallconfirm").Confirmation=n,e.namespace("M.core.languninstallconfirm").init=function(e){return new n(e)}},"@VERSION@",{requires:["base","node","moodle-core-notification-confirm","moodle-core-notification-alert"]});
|
||||
YUI.add("moodle-core-languninstallconfirm",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}var r={UNINSTALLBUTTON:"#languninstallbutton",UNINSTALLSELECT:"#menuuninstalllang option",ENGLISHOPTION:"#menuuninstalllang option[value='en']"};n.NAME=t,n.ATTRS={uninstallUrl:{validator:e.Lang.isString}},e.extend(n,e.Base,{initializer:function(){e.one(r.UNINSTALLBUTTON).on("click",this._confirm,this)},_confirm:function(t){t.preventDefault();var n=[],i=[];e.all(r.UNINSTALLSELECT).each(function(e){e.get("selected")&&(n.push(e.getAttribute("value")),i.push(e.get("text")))});if(n.length===0){(new M.core.alert({message:M.util.get_string("selectlangs","tool_langimport")})).show();return}if(n.indexOf("en")>-1){e.one(r.ENGLISHOPTION).set("selected",!1),(new M.core.alert({message:M.util.get_string("noenglishuninstall","tool_langimport")})).show();return}var s={modal:!0,visible:!1,centered:!0,title:M.util.get_string("uninstall","tool_langimport"),question:M.util.get_string("uninstallconfirm","tool_langimport",i.join(", "))};(new M.core.confirm(s)).show().on("complete-yes",this._uninstall,this,n)},_uninstall:function(t,n){e.config.win.location.href=this.get("uninstallUrl")+"?mode=4"+"&sesskey="+M.cfg.sesskey+"&confirmtouninstall="+n.join("/")}}),e.namespace("M.core.languninstallconfirm").Confirmation=n,e.namespace("M.core.languninstallconfirm").init=function(e){return new n(e)}},"@VERSION@",{requires:["base","node","moodle-core-notification-confirm","moodle-core-notification-alert"]});
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ Y.extend(Confirmation, Y.Base, {
|
||||
_uninstall: function(e, langCodes) {
|
||||
Y.config.win.location.href = this.get('uninstallUrl') + '?mode=4' +
|
||||
'&sesskey=' + M.cfg.sesskey +
|
||||
'&confirmtouninstall=' + langCodes.join('-');
|
||||
'&confirmtouninstall=' + langCodes.join('/');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -96,7 +96,7 @@ Y.extend(Confirmation, Y.Base, {
|
||||
_uninstall: function(e, langCodes) {
|
||||
Y.config.win.location.href = this.get('uninstallUrl') + '?mode=4' +
|
||||
'&sesskey=' + M.cfg.sesskey +
|
||||
'&confirmtouninstall=' + langCodes.join('-');
|
||||
'&confirmtouninstall=' + langCodes.join('/');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
define(["jquery","core/event"],function(a,b){var c,d=function(d){c=d,e(null,a("body")),b.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,e)})},e=function(b,d){var e=".mediaplugin_videojs";d.find(e).addBack(e).find("audio, video").each(function(){var b=a(this).attr("id"),d=a(this).data("setup"),e=["media_videojs/video-lazy"];d.techOrder&&d.techOrder.indexOf("youtube")!==-1&&e.push("media_videojs/Youtube-lazy"),require(e,function(a){c&&(c(a),c=null),a(b,d)})})};return{setUp:d}});
|
||||
define(["jquery","core/event"],function(a,b){var c,d=function(d){c=d,e(null,a("body")),b.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,e)})},e=function(b,d){var e=".mediaplugin_videojs";d.find(e).addBack(e).find("audio, video").each(function(){var b=a(this).attr("id"),d=a(this).data("setup-lazy"),e=["media_videojs/video-lazy"];d.techOrder&&d.techOrder.indexOf("youtube")!==-1&&e.push("media_videojs/Youtube-lazy"),require(e,function(a){c&&(c(a),c=null),a(b,d)})})};return{setUp:d}});
|
||||
@@ -62,7 +62,7 @@ define(['jquery', 'core/event'], function($, Event) {
|
||||
.addBack(selector)
|
||||
.find('audio, video').each(function() {
|
||||
var id = $(this).attr('id'),
|
||||
config = $(this).data('setup'),
|
||||
config = $(this).data('setup-lazy'),
|
||||
modules = ['media_videojs/video-lazy'];
|
||||
|
||||
if (config.techOrder && config.techOrder.indexOf('youtube') !== -1) {
|
||||
|
||||
@@ -129,8 +129,13 @@ class media_videojs_plugin extends core_media_player_native {
|
||||
}
|
||||
|
||||
// Attributes for the video/audio tag.
|
||||
// We use data-setup-lazy as the attribute name for the config instead of
|
||||
// data-setup because data-setup will cause video.js to load the player as soon as the library is loaded,
|
||||
// which is BEFORE we have a chance to load any additional libraries (youtube).
|
||||
// The data-setup-lazy is just a tag name that video.js does not recognise so we can manually initialise
|
||||
// it when we are sure the dependencies are loaded.
|
||||
$attributes = [
|
||||
'data-setup' => '{' . join(', ', $datasetup) . '}',
|
||||
'data-setup-lazy' => '{' . join(', ', $datasetup) . '}',
|
||||
'id' => 'id_videojs_' . uniqid(),
|
||||
'class' => get_config('media_videojs', $isaudio ? 'audiocssclass' : 'videocssclass')
|
||||
];
|
||||
|
||||
@@ -230,7 +230,7 @@ class media_videojs_testcase extends advanced_testcase {
|
||||
|
||||
protected function youtube_plugin_engaged($t) {
|
||||
$this->assertContains('mediaplugin_videojs', $t);
|
||||
$this->assertContains('data-setup="{"techOrder": ["youtube"]', $t);
|
||||
$this->assertContains('data-setup-lazy="{"techOrder": ["youtube"]', $t);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
define(["jquery","core/ajax","core/notification","core/log"],function(a,b,c,d){var e=function(a){"undefined"==typeof a.limit&&(a.limit=0),"undefined"==typeof a.offset&&(a.offset=0),a.limitfrom=a.offset,a.limitnum=a.limit,delete a.limit,delete a.offset;var d={methodname:"core_message_data_for_messagearea_conversations",args:a},e=b.call([d])[0];return e.fail(c.exception),e},f=function(a){var c={methodname:"core_message_get_unread_conversations_count",args:a},e=b.call([c])[0];return e.fail(function(a){d.error("Could not retrieve unread message count: "+a.message)}),e},g=function(a){var d={methodname:"core_message_mark_all_messages_as_read",args:a},e=b.call([d])[0];return e.fail(c.exception),e};return{query:e,countUnreadConversations:f,markAllAsRead:g}});
|
||||
define(["jquery","core/ajax","core/notification"],function(a,b,c){var d=function(a){"undefined"==typeof a.limit&&(a.limit=0),"undefined"==typeof a.offset&&(a.offset=0),a.limitfrom=a.offset,a.limitnum=a.limit,delete a.limit,delete a.offset;var d={methodname:"core_message_data_for_messagearea_conversations",args:a},e=b.call([d])[0];return e.fail(c.exception),e},e=function(a){var d={methodname:"core_message_get_unread_conversations_count",args:a},e=b.call([d])[0];return e.fail(c.exception),e},f=function(a){var d={methodname:"core_message_mark_all_messages_as_read",args:a},e=b.call([d])[0];return e.fail(c.exception),e};return{query:d,countUnreadConversations:e,markAllAsRead:f}});
|
||||
@@ -22,7 +22,7 @@
|
||||
* @copyright 2016 Ryan Wyllie <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['jquery', 'core/ajax', 'core/notification', 'core/log'], function($, Ajax, Notification, Log) {
|
||||
define(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notification) {
|
||||
/**
|
||||
* Retrieve a list of messages from the server.
|
||||
*
|
||||
@@ -72,9 +72,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/log'], function($, Aja
|
||||
|
||||
var promise = Ajax.call([request])[0];
|
||||
|
||||
promise.fail(function(e) {
|
||||
Log.error('Could not retrieve unread message count: ' + e.message);
|
||||
});
|
||||
promise.fail(Notification.exception);
|
||||
|
||||
return promise;
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
define(["core/ajax","core/notification","core/log"],function(a,b,c){var d=function(c){"undefined"==typeof c.limit&&(c.limit=20),"undefined"==typeof c.offset&&(c.offset=0);var d={methodname:"message_popup_get_popup_notifications",args:c},e=a.call([d])[0];return e.fail(b.exception),e},e=function(b){var d={methodname:"message_popup_get_unread_popup_notification_count",args:b},e=a.call([d])[0];return e.fail(function(a){c.error("Could not retrieve notifications count: "+a.message)}),e},f=function(c){var d={methodname:"core_message_mark_all_notifications_as_read",args:c},e=a.call([d])[0];return e.fail(b.exception),e},g=function(c,d){var e={messageid:c};d&&(e.timeread=d);var f={methodname:"core_message_mark_message_read",args:e},g=a.call([f])[0];return g.fail(b.exception),g};return{query:d,countUnread:e,markAllAsRead:f,markAsRead:g}});
|
||||
define(["core/ajax","core/notification"],function(a,b){var c=function(c){"undefined"==typeof c.limit&&(c.limit=20),"undefined"==typeof c.offset&&(c.offset=0);var d={methodname:"message_popup_get_popup_notifications",args:c},e=a.call([d])[0];return e.fail(b.exception),e},d=function(c){var d={methodname:"message_popup_get_unread_popup_notification_count",args:c},e=a.call([d])[0];return e.fail(b.exception),e},e=function(c){var d={methodname:"core_message_mark_all_notifications_as_read",args:c},e=a.call([d])[0];return e.fail(b.exception),e},f=function(c,d){var e={messageid:c};d&&(e.timeread=d);var f={methodname:"core_message_mark_message_read",args:e},g=a.call([f])[0];return g.fail(b.exception),g};return{query:c,countUnread:d,markAllAsRead:e,markAsRead:f}});
|
||||
@@ -22,7 +22,7 @@
|
||||
* @copyright 2016 Ryan Wyllie <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['core/ajax', 'core/notification', 'core/log'], function(Ajax, Notification, Log) {
|
||||
define(['core/ajax', 'core/notification'], function(Ajax, Notification) {
|
||||
/**
|
||||
* Retrieve a list of notifications from the server.
|
||||
*
|
||||
@@ -64,9 +64,7 @@ define(['core/ajax', 'core/notification', 'core/log'], function(Ajax, Notificati
|
||||
|
||||
var promise = Ajax.call([request])[0];
|
||||
|
||||
promise.fail(function(e) {
|
||||
Log.error('Could not retrieve notifications count: ' + e.message);
|
||||
});
|
||||
promise.fail(Notification.exception);
|
||||
|
||||
return promise;
|
||||
};
|
||||
|
||||
@@ -206,3 +206,45 @@ $doughnut-fill-colour: $brand-warning;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show expand collapse with font-awesome.
|
||||
.block_settings .block_tree [aria-expanded="true"],
|
||||
.block_settings .block_tree [aria-expanded="true"].emptybranch,
|
||||
.block_settings .block_tree [aria-expanded="false"],
|
||||
.block_navigation .block_tree [aria-expanded="true"],
|
||||
.block_navigation .block_tree [aria-expanded="true"].emptybranch,
|
||||
.block_navigation .block_tree [aria-expanded="false"] {
|
||||
background-image: none;
|
||||
}
|
||||
.block_settings .block_tree [aria-expanded="true"]:before,
|
||||
.block_navigation .block_tree [aria-expanded="true"]:before {
|
||||
content: $fa-var-angle-down;
|
||||
margin-right: 0;
|
||||
font-size: 16px;
|
||||
@extend .fa;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.block_settings .block_tree [aria-expanded="false"]:before,
|
||||
.block_navigation .block_tree [aria-expanded="false"]:before {
|
||||
content: $fa-var-angle-right;
|
||||
font-size: 16px;
|
||||
margin-right: 0;
|
||||
@extend .fa;
|
||||
width: 16px;
|
||||
}
|
||||
.dir-rtl {
|
||||
.block_settings .block_tree [aria-expanded="false"]:before,
|
||||
.block_navigation .block_tree [aria-expanded="false"]:before {
|
||||
content: $fa-var-angle-left;
|
||||
}
|
||||
}
|
||||
|
||||
.block_navigation .block_tree p.hasicon,
|
||||
.block_settings .block_tree p.hasicon {
|
||||
text-indent: -3px;
|
||||
|
||||
.icon {
|
||||
margin-right: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,47 @@
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
Availability info.
|
||||
@template core/availability_info
|
||||
|
||||
Renders the availability info on the course outline page.
|
||||
|
||||
Availability info can be displayed for activity modules or whole course
|
||||
sections. Activity modules can be either hidden from students, or available
|
||||
but not shown on course page (stealth), or the access can be restricted by
|
||||
configured conditions. Sections can be hidden.
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* classes String list of CSS classes for the wrapping element
|
||||
* text HTML formatted text with the actual availability information
|
||||
* ishidden Boolean flag indiciating that the item is hidden from students
|
||||
* isstealth Boolean flag indicating that the item is in stealth mode
|
||||
* isrestricted Boolean flag indicating that restricted access conditions apply
|
||||
* isfullinfo Boolean flag indicating that the full list of restricted
|
||||
access conditions is displayed (aka teacher's view).
|
||||
|
||||
Example context (json):
|
||||
{ "classes": "", "text": "This activity is not available" }
|
||||
{
|
||||
"classes": "",
|
||||
"text": "Not available unless: <ul><li>It is on or after <strong>8 June 2012</strong></li></ul>",
|
||||
"ishidden": 0,
|
||||
"isstealth": 0,
|
||||
"isrestricted": 1,
|
||||
"isfullinfo": 1
|
||||
}
|
||||
}}
|
||||
{{#text}}
|
||||
<div class="availabilityinfo {{classes}}">
|
||||
{{^isrestricted}}
|
||||
<span class="tag tag-info">{{{text}}}</span>
|
||||
{{/isrestricted}}
|
||||
{{#isrestricted}}
|
||||
<span class="tag tag-info">{{#str}}restricted, core{{/str}}</span> {{{text}}}
|
||||
{{/isrestricted}}
|
||||
</div>
|
||||
{{/text}}
|
||||
|
||||
@@ -53,6 +53,15 @@
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
p {
|
||||
&.hasicon {
|
||||
img {
|
||||
&.icon {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.footer {
|
||||
margin-bottom: 4px;
|
||||
|
||||
@@ -37,6 +37,7 @@ div[data-flexitour="step-background-fader"],
|
||||
span[data-flexitour="container"] {
|
||||
div[data-role="flexitour-step"] {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
border-radius: 6px;
|
||||
border: 1px solid rgba(0, 0, 0, .2);
|
||||
box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
|
||||
|
||||
@@ -15873,6 +15873,9 @@ body {
|
||||
margin-left: 5px;
|
||||
display: inline;
|
||||
}
|
||||
.block .content p.hasicon img.icon {
|
||||
padding-right: 0;
|
||||
}
|
||||
.block .footer {
|
||||
margin-bottom: 4px;
|
||||
display: block;
|
||||
@@ -19334,6 +19337,7 @@ div[data-flexitour="step-background-fader"],
|
||||
}
|
||||
span[data-flexitour="container"] div[data-role="flexitour-step"] {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
border-radius: 6px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
||||
|
||||
@@ -24,27 +24,33 @@
|
||||
}}
|
||||
|
||||
<div id="block-myoverview-{{uniqid}}" class="block-myoverview" data-region="myoverview">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="#myoverview_timeline_view" role="tab" data-toggle="tab">
|
||||
<ul id="block-myoverview-view-choices-{{uniqid}}" class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item {{#viewingtimeline}}active{{/viewingtimeline}}">
|
||||
<a class="nav-link" href="#myoverview_timeline_view" role="tab" data-toggle="tab" data-tabname="timeline">
|
||||
{{#str}} timeline, block_myoverview {{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#myoverview_courses_view" role="tab" data-toggle="tab">
|
||||
<li class="nav-item {{#viewingcourses}}active{{/viewingcourses}}">
|
||||
<a class="nav-link" href="#myoverview_courses_view" role="tab" data-toggle="tab" data-tabname="courses">
|
||||
{{#str}} courses {{/str}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane fade in active" id="myoverview_timeline_view">
|
||||
<div role="tabpanel" class="tab-pane fade {{#viewingtimeline}}in active{{/viewingtimeline}}" id="myoverview_timeline_view">
|
||||
{{> block_myoverview/timeline-view }}
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane fade" id="myoverview_courses_view">
|
||||
<div role="tabpanel" class="tab-pane fade {{#viewingcourses}}in active{{/viewingcourses}}" id="myoverview_courses_view">
|
||||
{{#coursesview}}
|
||||
{{> block_myoverview/courses-view }}
|
||||
{{/coursesview}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{#js}}
|
||||
require(['jquery', 'block_myoverview/tab_preferences'], function($, TabPreferences) {
|
||||
var root = $('#block-myoverview-view-choices-{{uniqid}}');
|
||||
TabPreferences.registerEventListeners(root);
|
||||
});
|
||||
{{/js}}
|
||||
|
||||
@@ -15,13 +15,47 @@
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
Availability info.
|
||||
@template core/availability_info
|
||||
|
||||
Renders the availability info on the course outline page.
|
||||
|
||||
Availability info can be displayed for activity modules or whole course
|
||||
sections. Activity modules can be either hidden from students, or available
|
||||
but not shown on course page (stealth), or the access can be restricted by
|
||||
configured conditions. Sections can be hidden.
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* classes String list of CSS classes for the wrapping element
|
||||
* text HTML formatted text with the actual availability information
|
||||
* ishidden Boolean flag indiciating that the item is hidden from students
|
||||
* isstealth Boolean flag indicating that the item is in stealth mode
|
||||
* isrestricted Boolean flag indicating that restricted access conditions apply
|
||||
* isfullinfo Boolean flag indicating that the full list of restricted
|
||||
access conditions is displayed (aka teacher's view).
|
||||
|
||||
Example context (json):
|
||||
{ "classes": "", "text": "This activity is not available" }
|
||||
{
|
||||
"classes": "",
|
||||
"text": "Not available unless: <ul><li>It is on or after <strong>8 June 2012</strong></li></ul>",
|
||||
"ishidden": 0,
|
||||
"isstealth": 0,
|
||||
"isrestricted": 1,
|
||||
"isfullinfo": 1
|
||||
}
|
||||
}}
|
||||
{{#text}}
|
||||
<div class="availabilityinfo {{classes}}">
|
||||
{{^isrestricted}}
|
||||
<span class="label label-info">{{{text}}}</span>
|
||||
{{/isrestricted}}
|
||||
{{#isrestricted}}
|
||||
<span class="label label-info">{{#str}}restricted, core{{/str}}</span> {{{text}}}
|
||||
{{/isrestricted}}
|
||||
</div>
|
||||
{{/text}}
|
||||
|
||||
+2
-2
@@ -29,11 +29,11 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2017051500.08; // 20170515 = branching date YYYYMMDD - do not modify!
|
||||
$version = 2017051500.09; // 20170515 = branching date YYYYMMDD - do not modify!
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
$release = '3.3+ (Build: 20170616)'; // Human-friendly version name
|
||||
$release = '3.3+ (Build: 20170622)'; // Human-friendly version name
|
||||
|
||||
$branch = '33'; // This version's branch.
|
||||
$maturity = MATURITY_STABLE; // This version's maturity level.
|
||||
|
||||
Reference in New Issue
Block a user