1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-17 14:35:29 +02:00

MDL-43267 Javascript: Improve accessibility of keyboard move

Change the keyboard move descriptions to allow for more detailed
descriptions such as:
* "After 'X'"; or
* "To top of section 'Y'"
This commit is contained in:
Andrew Nicols 2014-01-30 00:32:25 +08:00
parent 974c2cdc03
commit 34bcc6a95c
10 changed files with 120 additions and 12 deletions

@ -3238,11 +3238,15 @@ function include_course_ajax($course, $usedmodules = array(), $enabledmodules =
'clicktochangeinbrackets',
'markthistopic',
'markedthistopic',
'move',
'movesection',
'movecoursemodule',
'movecoursesection',
'movecontent',
'tocontent',
'emptydragdropregion'
'emptydragdropregion',
'afterresource',
'aftersection',
'totopofsection',
), 'moodle');
// Include section-specific strings for formats which support sections.

@ -303,7 +303,16 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, {
this.groups = ['resource'];
this.samenodeclass = CSS.ACTIVITY;
this.parentnodeclass = CSS.SECTION;
this.resourcedraghandle = this.get_drag_handle(M.str.moodle.move, CSS.EDITINGMOVE, CSS.ICONCLASS, true);
this.resourcedraghandle = this.get_drag_handle(M.util.get_string('movecoursemodule', 'moodle'), CSS.EDITINGMOVE, CSS.ICONCLASS, true);
this.samenodelabel = {
identifier: 'afterresource',
component: 'moodle'
};
this.parentnodelabel = {
identifier: 'totopofsection',
component: 'moodle'
};
// Go through all sections
var sectionlistselector = M.course.format.get_section_selector(Y);

File diff suppressed because one or more lines are too long

@ -299,7 +299,16 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, {
this.groups = ['resource'];
this.samenodeclass = CSS.ACTIVITY;
this.parentnodeclass = CSS.SECTION;
this.resourcedraghandle = this.get_drag_handle(M.str.moodle.move, CSS.EDITINGMOVE, CSS.ICONCLASS, true);
this.resourcedraghandle = this.get_drag_handle(M.util.get_string('movecoursemodule', 'moodle'), CSS.EDITINGMOVE, CSS.ICONCLASS, true);
this.samenodelabel = {
identifier: 'afterresource',
component: 'moodle'
};
this.parentnodelabel = {
identifier: 'totopofsection',
component: 'moodle'
};
// Go through all sections
var sectionlistselector = M.course.format.get_section_selector(Y);

@ -14,7 +14,16 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, {
this.groups = ['resource'];
this.samenodeclass = CSS.ACTIVITY;
this.parentnodeclass = CSS.SECTION;
this.resourcedraghandle = this.get_drag_handle(M.str.moodle.move, CSS.EDITINGMOVE, CSS.ICONCLASS, true);
this.resourcedraghandle = this.get_drag_handle(M.util.get_string('movecoursemodule', 'moodle'), CSS.EDITINGMOVE, CSS.ICONCLASS, true);
this.samenodelabel = {
identifier: 'afterresource',
component: 'moodle'
};
this.parentnodelabel = {
identifier: 'totopofsection',
component: 'moodle'
};
// Go through all sections
var sectionlistselector = M.course.format.get_section_selector(Y);

@ -115,6 +115,8 @@ $string['administratorsandteachers'] = 'Administrators and teachers';
$string['advanced'] = 'Advanced';
$string['advancedfilter'] = 'Advanced search';
$string['advancedsettings'] = 'Advanced settings';
$string['afterresource'] = 'After resource "{$a}"';
$string['aftersection'] = 'After section "{$a}"';
$string['again'] = 'again';
$string['aimid'] = 'AIM ID';
$string['ajaxuse'] = 'AJAX and Javascript';
@ -1165,6 +1167,8 @@ $string['moreinformation'] = 'More information about this error';
$string['moreprofileinfoneeded'] = 'Please tell us more about yourself';
$string['mostrecently'] = 'most recently';
$string['move'] = 'Move';
$string['movecoursemodule'] = 'Move resource';
$string['movecoursesection'] = 'Move section';
$string['movecontent'] = 'Move {$a}';
$string['movecategorycontentto'] = 'Move into';
$string['movecategorysuccess'] = 'Successfully moved category \'{$a->moved}\' into category \'{$a->to}\'';
@ -1820,6 +1824,7 @@ $string['topicoutline'] = 'Topic outline';
$string['topicshow'] = 'Show this topic to {$a}';
$string['topichide'] = 'Hide this topic from {$a}';
$string['total'] = 'Total';
$string['totopofsection'] = 'To the top of section "{$a}"';
$string['trackforums'] = 'Forum tracking';
$string['trackforumsno'] = 'No: don\'t keep track of posts I have seen';
$string['trackforumsyes'] = 'Yes: highlight new posts for me';

@ -64,6 +64,24 @@ Y.extend(DRAGDROP, Y.Base, {
*/
parentnodeclass: null,
/**
* The label to use with keyboard drag/drop to describe items of the same Node.
*
* @property samenodelabel
* @type Object
* @default null
*/
samenodelabel : null,
/**
* The label to use with keyboard drag/drop to describe items of the parent Node.
*
* @property samenodelabel
* @type Object
* @default null
*/
parentnodelabel : null,
/**
* The groups for this instance.
*
@ -397,7 +415,13 @@ Y.extend(DRAGDROP, Y.Base, {
listlink = Y.Node.create('<a></a>');
nodetitle = this.find_element_text(labelroot);
listitemtext = M.util.get_string('tocontent', 'moodle', nodetitle);
if (this.samenodelabel && node.hasClass(this.samenodeclass)) {
listitemtext = M.util.get_string(this.samenodelabel.identifier, this.samenodelabel.component, nodetitle);
} else if (this.parentnodelabel && node.hasClass(this.parentnodeclass)) {
listitemtext = M.util.get_string(this.parentnodelabel.identifier, this.parentnodelabel.component, nodetitle);
} else {
listitemtext = M.util.get_string('tocontent', 'moodle', nodetitle);
}
listlink.setContent(listitemtext);
// Add a data attribute so we can get the real drop target.

File diff suppressed because one or more lines are too long

@ -64,6 +64,24 @@ Y.extend(DRAGDROP, Y.Base, {
*/
parentnodeclass: null,
/**
* The label to use with keyboard drag/drop to describe items of the same Node.
*
* @property samenodelabel
* @type Object
* @default null
*/
samenodelabel : null,
/**
* The label to use with keyboard drag/drop to describe items of the parent Node.
*
* @property samenodelabel
* @type Object
* @default null
*/
parentnodelabel : null,
/**
* The groups for this instance.
*
@ -397,7 +415,13 @@ Y.extend(DRAGDROP, Y.Base, {
listlink = Y.Node.create('<a></a>');
nodetitle = this.find_element_text(labelroot);
listitemtext = M.util.get_string('tocontent', 'moodle', nodetitle);
if (this.samenodelabel && node.hasClass(this.samenodeclass)) {
listitemtext = M.util.get_string(this.samenodelabel.identifier, this.samenodelabel.component, nodetitle);
} else if (this.parentnodelabel && node.hasClass(this.parentnodeclass)) {
listitemtext = M.util.get_string(this.parentnodelabel.identifier, this.parentnodelabel.component, nodetitle);
} else {
listitemtext = M.util.get_string('tocontent', 'moodle', nodetitle);
}
listlink.setContent(listitemtext);
// Add a data attribute so we can get the real drop target.

@ -62,6 +62,24 @@ Y.extend(DRAGDROP, Y.Base, {
*/
parentnodeclass: null,
/**
* The label to use with keyboard drag/drop to describe items of the same Node.
*
* @property samenodelabel
* @type Object
* @default null
*/
samenodelabel : null,
/**
* The label to use with keyboard drag/drop to describe items of the parent Node.
*
* @property samenodelabel
* @type Object
* @default null
*/
parentnodelabel : null,
/**
* The groups for this instance.
*
@ -395,7 +413,13 @@ Y.extend(DRAGDROP, Y.Base, {
listlink = Y.Node.create('<a></a>');
nodetitle = this.find_element_text(labelroot);
listitemtext = M.util.get_string('tocontent', 'moodle', nodetitle);
if (this.samenodelabel && node.hasClass(this.samenodeclass)) {
listitemtext = M.util.get_string(this.samenodelabel.identifier, this.samenodelabel.component, nodetitle);
} else if (this.parentnodelabel && node.hasClass(this.parentnodeclass)) {
listitemtext = M.util.get_string(this.parentnodelabel.identifier, this.parentnodelabel.component, nodetitle);
} else {
listitemtext = M.util.get_string('tocontent', 'moodle', nodetitle);
}
listlink.setContent(listitemtext);
// Add a data attribute so we can get the real drop target.