MDL-52954 assign: Rebuild the assignment single grade page.

This commit is contained in:
Damyon Wiese 2016-02-01 16:13:46 +08:00
parent 2a3647bae5
commit bb690849c9
86 changed files with 4593 additions and 279 deletions

File diff suppressed because one or more lines are too long

1
lib/amd/build/tooltip.min.js vendored Normal file
View file

@ -0,0 +1 @@
define(["jquery"],function(a){var b=function(b){this._regionSelector=b,a(this._regionSelector).each(function(b,c){var d=a(c).attr("aria-describedby");if(d){var e=document.getElementById(d);if(e){var f="tooltip"==a(e).attr("role");f&&(a(e).hide(),a(c).attr("tabindex","0")),a(c).on("focus",this._handleFocus.bind(this)),a(c).on("mouseover",this._handleMouseOver.bind(this)),a(c).on("mouseout",this._handleMouseOut.bind(this)),a(c).on("blur",this._handleBlur.bind(this)),a(c).on("keydown",this._handleKeyDown.bind(this))}}}.bind(this))};return b.prototype._regionSelector=null,b.prototype._showTooltip=function(b){var c=a(b.target),d=c.attr("aria-describedby");if(d){var e=a(document.getElementById(d));if(e.show(),e.attr("aria-hidden","false"),!e.is(".tooltip")){var f=a('<div class="tooltip-inner"></div>');f.append(e.contents()),e.append(f),e.addClass("tooltip"),e.addClass("bottom"),e.append('<div class="tooltip-arrow"></div>')}var g=c.offset();g.top+=c.height()+10,a(e).offset(g)}},b.prototype._hideTooltip=function(b){var c=a(b.target),d=c.attr("aria-describedby");if(d){var e=document.getElementById(d);a(e).hide(),a(e).attr("aria-hidden","true")}},b.prototype._handleFocus=function(a){this._showTooltip(a)},b.prototype._handleKeyDown=function(a){27==a.which&&this._hideTooltip(a)},b.prototype._handleMouseOver=function(a){this._showTooltip(a)},b.prototype._handleMouseOut=function(b){var c=a(b.target);c.is(":focus")||this._hideTooltip(b)},b.prototype._handleBlur=function(a){this._hideTooltip(a)},b});

View file

@ -775,8 +775,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
throttleTimeout = window.setTimeout(handler.bind(this, e), 300);
};
// Trigger an ajax update after the text field value changes.
inputElement.on("input keypress", throttledHandler);
inputElement.on("input", throttledHandler);
var arrowElement = $(document.getElementById(state.downArrowId));
arrowElement.on("click", handler);
});

133
lib/amd/src/tooltip.js Normal file
View file

@ -0,0 +1,133 @@
define(['jquery'], function($) {
/**
* Tooltip class.
*
* @param {String} selector The css selector for the node(s) to enhance with tooltips.
*/
var Tooltip = function(selector) {
// Tooltip code matches: http://www.w3.org/WAI/PF/aria-practices/#tooltip
this._regionSelector = selector;
// For each node matching the selector - find an aria-describedby attribute pointing to an role="tooltip" element.
$(this._regionSelector).each(function(index, element) {
var tooltipId = $(element).attr('aria-describedby');
if (tooltipId) {
var tooltipele = document.getElementById(tooltipId);
if (tooltipele) {
var correctRole = $(tooltipele).attr('role') == 'tooltip';
if (correctRole) {
$(tooltipele).hide();
// Ensure the trigger for the tooltip is keyboard focusable.
$(element).attr('tabindex', '0');
}
// Attach listeners.
$(element).on('focus', this._handleFocus.bind(this));
$(element).on('mouseover', this._handleMouseOver.bind(this));
$(element).on('mouseout', this._handleMouseOut.bind(this));
$(element).on('blur', this._handleBlur.bind(this));
$(element).on('keydown', this._handleKeyDown.bind(this));
}
}
}.bind(this));
};
/** @type {String} Selector for the page region containing the user navigation. */
Tooltip.prototype._regionSelector = null;
/**
* Find the tooltip referred to by this element and show it.
*
* @param {Event} e
*/
Tooltip.prototype._showTooltip = function(e) {
var triggerElement = $(e.target);
var tooltipId = triggerElement.attr('aria-describedby');
if (tooltipId) {
var tooltipele = $(document.getElementById(tooltipId));
tooltipele.show();
tooltipele.attr('aria-hidden', 'false');
if (!tooltipele.is('.tooltip')) {
// Change the markup to a bootstrap tooltip.
var inner = $('<div class="tooltip-inner"></div>');
inner.append(tooltipele.contents());
tooltipele.append(inner);
tooltipele.addClass('tooltip');
tooltipele.addClass('bottom');
tooltipele.append('<div class="tooltip-arrow"></div>');
}
var pos = triggerElement.offset();
pos.top += triggerElement.height() + 10;
$(tooltipele).offset(pos);
}
};
/**
* Find the tooltip referred to by this element and hide it.
*
* @param {Event} e
*/
Tooltip.prototype._hideTooltip = function(e) {
var triggerElement = $(e.target);
var tooltipId = triggerElement.attr('aria-describedby');
if (tooltipId) {
var tooltipele = document.getElementById(tooltipId);
$(tooltipele).hide();
$(tooltipele).attr('aria-hidden', 'true');
}
};
/**
* Listener for focus events.
* @param {Event} e
*/
Tooltip.prototype._handleFocus = function(e) {
this._showTooltip(e);
};
/**
* Listener for keydown events.
* @param {Event} e
*/
Tooltip.prototype._handleKeyDown = function(e) {
if (e.which == 27) {
this._hideTooltip(e);
}
};
/**
* Listener for mouseover events.
* @param {Event} e
*/
Tooltip.prototype._handleMouseOver = function(e) {
this._showTooltip(e);
};
/**
* Listener for mouseout events.
* @param {Event} e
*/
Tooltip.prototype._handleMouseOut = function(e) {
var triggerElement = $(e.target);
if (!triggerElement.is(":focus")) {
this._hideTooltip(e);
}
};
/**
* Listener for blur events.
* @param {Event} e
*/
Tooltip.prototype._handleBlur = function(e) {
this._hideTooltip(e);
};
return Tooltip;
});

View file

@ -428,6 +428,7 @@ $functions = array(
'classpath' => 'user/externallib.php',
'description' => 'Retrieve users information for a specified unique field - If you want to do a user search, use core_user_get_users()',
'type' => 'read',
'ajax' => true,
'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
),

View file

@ -53,6 +53,9 @@ class file_storage {
private $dirpermissions;
/** @var int Permissions for new files */
private $filepermissions;
/** @var array List of formats supported by unoconv */
private $unoconvformats;
/**
* Constructor - do not use directly use {@link get_file_storage()} call instead.
@ -206,7 +209,7 @@ class file_storage {
$this->unoconvformats = array_unique($this->unoconvformats);
}
$sanitized = trim(strtolower($format));
$sanitized = trim(core_text::strtolower($format));
return in_array($sanitized, $this->unoconvformats);
}
@ -226,7 +229,7 @@ class file_storage {
return false;
}
$fileextension = strtolower(pathinfo($file->get_filename(), PATHINFO_EXTENSION));
$fileextension = core_text::strtolower(pathinfo($file->get_filename(), PATHINFO_EXTENSION));
if (!self::is_format_supported_by_unoconv($fileextension)) {
return false;
}
@ -260,7 +263,6 @@ class file_storage {
$output = null;
$currentdir = getcwd();
chdir($tmp);
$result = exec('env 1>&2', $output);
$result = exec($cmd, $output);
chdir($currentdir);
if (!file_exists($newtmpfile)) {

View file

@ -278,7 +278,7 @@ abstract class moodleform {
*/
function _process_submission($method) {
$submission = array();
if (!empty($this->_ajaxformdata) && defined('AJAX_SCRIPT')) {
if (!empty($this->_ajaxformdata)) {
$submission = $this->_ajaxformdata;
} else if ($method == 'post') {
if (!empty($_POST)) {

View file

@ -42,7 +42,10 @@ information provided here is intended especially for developers.
- upgrade_course_modules_sequences()
- upgrade_grade_item_fix_sortorder()
- upgrade_availability_item()
* A new parameter $ajaxformdata was added to the constructor for moodleform. When building a
moodleform in a webservice or ajax script (for example using the new fragments API) we
cannot allow the moodleform to parse it's own data from _GET and _POST - we must pass it as
an array.
* Plugins can extend the navigation for user by declaring the following callback:
<frankenstyle>_extend_navigation_user(navigation_node $parentnode, stdClass $user,
context_user $context, stdClass $course,