MDL-27171 forum: refactor forum settings
[moodle.git] / message / module.js
CommitLineData
8a811c56 1M.core_message = M.core_message || {};
5f3bf83f 2
e44bc5a1 3M.core_message.init_focus = function(Y, eid) {
5f3bf83f 4 document.getElementById(eid).focus();
1d236fef 5};
5f3bf83f 6
5f3bf83f
PS
7M.core_message.init_refresh_page = function(Y, delay, url) {
8 var delay_callback = function() {
9 document.location.replace(url);
1d236fef 10 };
5f3bf83f 11 setTimeout(delay_callback, delay);
1d236fef 12};
c8621a02 13
c8621a02
AD
14M.core_message.combinedsearchgotfocus = function(e) {
15 if (e.target.get('value')==this.defaultsearchterm) {
16 e.target.select();
17 }
1d236fef 18};
b32778c4
AD
19
20M.core_message.init_notification = function(Y, title, content, url) {
21 Y.use('overlay', function() {
22 var o = new Y.Overlay({
23 headerContent : title,
8a811c56 24 bodyContent : content
b32778c4
AD
25 });
26 o.render(Y.one(document.body));
78e873c8 27
8a811c56
AD
28 if (Y.UA.ie > 0 && Y.UA.ie < 7) {
29 // Adjust for IE 6 (can't handle fixed pos)
30 //align the bottom right corner of the overlay with the bottom right of the viewport
31 o.set("align", {
32 points:[Y.WidgetPositionAlign.BR, Y.WidgetPositionAlign.BR]
33 });
1d236fef 34 }
78e873c8
AD
35
36 Y.one('#notificationyes').on('click', function(e) {
b32778c4
AD
37 window.location.href = url;
38 }, o);
78e873c8
AD
39 Y.one('#notificationno').on('click', function(e) {
40 o.hide();
41 e.preventDefault();
42 return false;
43 }, o);
b32778c4 44 });
1d236fef 45};