mirror of
https://github.com/moodle/moodle.git
synced 2025-04-17 22:45:54 +02:00
Merge branch 'MDL-61388-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
64a00dffbd
@ -1951,12 +1951,23 @@ class core_renderer extends renderer_base {
|
||||
throw new coding_exception('The cancel param to $OUTPUT->confirm() must be either a URL (string/moodle_url) or a single_button instance.');
|
||||
}
|
||||
|
||||
$output = $this->box_start('generalbox modal modal-dialog modal-in-page show', 'notice');
|
||||
$attributes = [
|
||||
'role'=>'alertdialog',
|
||||
'aria-labelledby'=>'modal-header',
|
||||
'aria-describedby'=>'modal-body',
|
||||
'aria-modal'=>'true'
|
||||
];
|
||||
|
||||
$output = $this->box_start('generalbox modal modal-dialog modal-in-page show', 'notice', $attributes);
|
||||
$output .= $this->box_start('modal-content', 'modal-content');
|
||||
$output .= $this->box_start('modal-header p-x-1', 'modal-header');
|
||||
$output .= html_writer::tag('h4', get_string('confirm'));
|
||||
$output .= $this->box_end();
|
||||
$output .= $this->box_start('modal-body', 'modal-body');
|
||||
$attributes = [
|
||||
'role'=>'alert',
|
||||
'data-aria-autofocus'=>'true'
|
||||
];
|
||||
$output .= $this->box_start('modal-body', 'modal-body', $attributes);
|
||||
$output .= html_writer::tag('p', $message);
|
||||
$output .= $this->box_end();
|
||||
$output .= $this->box_start('modal-footer', 'modal-footer');
|
||||
|
@ -148,6 +148,7 @@ $string['discussionnowsubscribed'] = '{$a->name} will be notified of new posts i
|
||||
$string['discussionpin'] = 'Pin';
|
||||
$string['discussionpinned'] = 'Pinned';
|
||||
$string['discussionpinned_help'] = 'Pinned discussions will appear at the top of a forum.';
|
||||
$string['discussionsplit'] = 'Discussion has been split';
|
||||
$string['discussionsubscribestop'] = 'I don\'t want to be notified of new posts in this discussion';
|
||||
$string['discussionsubscribestart'] = 'Send me notifications of new posts in this discussion';
|
||||
$string['discussionsubscription'] = 'Discussion subscription';
|
||||
|
@ -349,7 +349,13 @@ if (!empty($forum)) { // User is starting a new discussion in a forum.
|
||||
$event->add_record_snapshot('forum_discussions', $discussion);
|
||||
$event->trigger();
|
||||
|
||||
redirect(new moodle_url('/mod/forum/view.php', ['f' => $discussion->forum]));
|
||||
$message = get_string('eventdiscussiondeleted', 'forum');
|
||||
redirect(
|
||||
new moodle_url('/mod/forum/view.php', ['f' => $discussion->forum]),
|
||||
$message,
|
||||
null,
|
||||
\core\output\notification::NOTIFY_SUCCESS
|
||||
);
|
||||
|
||||
} else if (forum_delete_post($post, has_capability('mod/forum:deleteanypost', $modcontext),
|
||||
$course, $cm, $forum)) {
|
||||
@ -363,7 +369,13 @@ if (!empty($forum)) { // User is starting a new discussion in a forum.
|
||||
$discussionurl = new moodle_url("/mod/forum/discuss.php", array('d' => $discussion->id));
|
||||
}
|
||||
|
||||
redirect(forum_go_back_to($discussionurl));
|
||||
$message = get_string('eventpostdeleted', 'forum');
|
||||
redirect(
|
||||
forum_go_back_to($discussionurl),
|
||||
$message,
|
||||
null,
|
||||
\core\output\notification::NOTIFY_SUCCESS
|
||||
);
|
||||
} else {
|
||||
print_error('errorwhiledelete', 'forum');
|
||||
}
|
||||
@ -506,8 +518,13 @@ if (!empty($forum)) { // User is starting a new discussion in a forum.
|
||||
$event->add_record_snapshot('forum_discussions', $discussion);
|
||||
$event->trigger();
|
||||
|
||||
redirect(forum_go_back_to(new moodle_url("/mod/forum/discuss.php", array('d' => $newid))));
|
||||
|
||||
$message = get_string('discussionsplit', 'forum');
|
||||
redirect(
|
||||
forum_go_back_to(new moodle_url("/mod/forum/discuss.php", array('d' => $newid))),
|
||||
$message,
|
||||
null,
|
||||
\core\output\notification::NOTIFY_SUCCESS
|
||||
);
|
||||
} else {
|
||||
// Display the prune form.
|
||||
$course = $DB->get_record('course', array('id' => $forum->course));
|
||||
|
2
theme/boost/amd/build/aria.min.js
vendored
2
theme/boost/amd/build/aria.min.js
vendored
@ -1 +1 @@
|
||||
define(["jquery"],function(a){return{init:function(){var b=!1,c=function(){b=!0},d=function(){var a=b;return b=!1,a};a('[data-toggle="dropdown"]').keydown(function(b){var d,e=b.which||b.keyCode;38==e&&c(),27==e&&(d=a(b.target).attr("aria-expanded"),b.preventDefault(),"false"==d&&a(b.target).click()),32!=e&&13!=e||(b.preventDefault(),a(b.target).click())});var e=function(b){var c=function(){a(this).focus()}.bind(b);setTimeout(c,50)};a(".dropdown").on("shown.bs.dropdown",function(b){var c=a(b.target).find('[role="menu"]'),f=!1,g=!1;c&&(f=a(c).find('[role="menuitem"]')),f&&f.length>0&&(g=d()?f[f.length-1]:f[0]),g&&e(g)}),a('.dropdown [role="menu"] [role="menuitem"]').keypress(function(b){var c,d,f=String.fromCharCode(b.which||b.keyCode),g=a(b.target).closest('[role="menu"]'),h=0,i=!1;if(g&&(i=a(g).find('[role="menuitem"]')))for(f=f.toLowerCase(),h=0;h<i.length;h++)if(c=a(i[h]),d=c.text().trim().toLowerCase(),0==d.indexOf(f)){e(c);break}}),a('.dropdown [role="menu"] [role="menuitem"]').keydown(function(b){var c=b.which||b.keyCode,d=!1,f=a(b.target).closest('[role="menu"]'),g=0,h=!1;if(f&&(h=a(f).find('[role="menuitem"]'))){if(40==c){for(g=0;g<h.length-1;g++)if(h[g]==b.target){d=h[g+1];break}d||(d=h[0])}else if(38==c){for(g=1;g<h.length;g++)if(h[g]==b.target){d=h[g-1];break}d||(d=h[h.length-1])}else 36==c?d=h[0]:35==c&&(d=h[h.length-1]);d&&(b.preventDefault(),e(d))}}),a(".dropdown").on("hidden.bs.dropdown",function(b){var c=a(b.target).find('[data-toggle="dropdown"]');c&&e(c)})}}});
|
||||
define(["jquery"],function(a){return{init:function(){var b=!1,c=function(){b=!0},d=function(){var a=b;return b=!1,a};a('[data-toggle="dropdown"]').keydown(function(b){var d,e=b.which||b.keyCode;38==e&&c(),27==e&&(d=a(b.target).attr("aria-expanded"),b.preventDefault(),"false"==d&&a(b.target).click()),32!=e&&13!=e||(b.preventDefault(),a(b.target).click())});var e=function(b){var c=function(){a(this).focus()}.bind(b);setTimeout(c,50)};a(".dropdown").on("shown.bs.dropdown",function(b){var c=a(b.target).find('[role="menu"]'),f=!1,g=!1;c&&(f=a(c).find('[role="menuitem"]')),f&&f.length>0&&(g=d()?f[f.length-1]:f[0]),g&&e(g)}),a('.dropdown [role="menu"] [role="menuitem"]').keypress(function(b){var c,d,f=String.fromCharCode(b.which||b.keyCode),g=a(b.target).closest('[role="menu"]'),h=0,i=!1;if(g&&(i=a(g).find('[role="menuitem"]')))for(f=f.toLowerCase(),h=0;h<i.length;h++)if(c=a(i[h]),d=c.text().trim().toLowerCase(),0==d.indexOf(f)){e(c);break}}),a('.dropdown [role="menu"] [role="menuitem"]').keydown(function(b){var c=b.which||b.keyCode,d=!1,f=a(b.target).closest('[role="menu"]'),g=0,h=!1;if(f&&(h=a(f).find('[role="menuitem"]'))){if(40==c){for(g=0;g<h.length-1;g++)if(h[g]==b.target){d=h[g+1];break}d||(d=h[0])}else if(38==c){for(g=1;g<h.length;g++)if(h[g]==b.target){d=h[g-1];break}d||(d=h[h.length-1])}else 36==c?d=h[0]:35==c&&(d=h[h.length-1]);d&&(b.preventDefault(),e(d))}}),a(".dropdown").on("hidden.bs.dropdown",function(b){var c=a(b.target).find('[data-toggle="dropdown"]');c&&e(c)}),a(function(){window.setTimeout(function(){var b=a('[role="alert"][data-aria-autofocus="true"]');b.length>0&&(a(b[0]).attr("tabindex","0"),a(b[0]).focus())},300)})}}});
|
@ -183,6 +183,17 @@ define(['jquery'], function($) {
|
||||
shiftFocus(trigger);
|
||||
}
|
||||
});
|
||||
|
||||
// After page load, focus on any element with special autofocus attribute.
|
||||
$(function() {
|
||||
window.setTimeout(function() {
|
||||
var alerts = $('[role="alert"][data-aria-autofocus="true"]');
|
||||
if (alerts.length > 0) {
|
||||
$(alerts[0]).attr('tabindex', '0');
|
||||
$(alerts[0]).focus();
|
||||
}
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -40,7 +40,7 @@
|
||||
<hr>
|
||||
</div>
|
||||
{{#error}}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<div class="alert alert-danger" role="alert" data-aria-autofocus="true">
|
||||
{{{error}}}
|
||||
</div>
|
||||
{{/error}}
|
||||
|
@ -112,7 +112,7 @@
|
||||
{{#error}}
|
||||
<div class="loginerrors mt-3">
|
||||
<a href="#" id="loginerrormessage" class="accesshide">{{error}}</a>
|
||||
<div class="alert alert-danger" role="alert">{{error}}</div>
|
||||
<div class="alert alert-danger" role="alert" data-aria-autofocus="true">{{error}}</div>
|
||||
</div>
|
||||
{{/error}}
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
|
||||
}}
|
||||
<div class="alert alert-danger alert-block fade in {{ extraclasses }}" {{!
|
||||
}}{{# announce }} role="alert"{{/ announce }}{{!
|
||||
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
|
||||
}}>
|
||||
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">×</button>{{/ closebutton }}
|
||||
{{{ message }}}
|
||||
|
@ -37,7 +37,7 @@
|
||||
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
|
||||
}}
|
||||
<div class="alert alert-info alert-block fade in {{ extraclasses }}" {{!
|
||||
}}{{# announce }} role="alert"{{/ announce }}{{!
|
||||
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
|
||||
}}>
|
||||
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">×</button>{{/ closebutton }}
|
||||
{{{ message }}}
|
||||
|
@ -37,7 +37,7 @@
|
||||
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
|
||||
}}
|
||||
<div class="alert alert-success alert-block fade in {{ extraclasses }}" {{!
|
||||
}}{{# announce }} role="alert"{{/ announce }}{{!
|
||||
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
|
||||
}}>
|
||||
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">×</button>{{/ closebutton }}
|
||||
{{{ message }}}
|
||||
|
@ -37,8 +37,8 @@
|
||||
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
|
||||
}}
|
||||
<div class="alert alert-warning alert-block fade in {{ extraclasses }}" {{!
|
||||
}}{{# announce }} role="alert"{{/ announce }}{{!
|
||||
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
|
||||
}}>
|
||||
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">×</button>{{/ closebutton }}
|
||||
{{{ message }}}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user