messaging MDL-22320 added curly brackets to make weird looking php look less weird
[moodle.git] / message / module.js
CommitLineData
5f3bf83f
PS
1M.core_message = {};
2
e44bc5a1 3M.core_message.init_focus = function(Y, eid) {
5f3bf83f
PS
4 document.getElementById(eid).focus();
5}
6
7M.core_message.init_refresh_parent_frame = function(Y, msgcount, msg) {
5f3bf83f
PS
8 var add_message = function (messagestr) {
9 var messageblock = parent.messages.document.getElementById('messages');
10 var message = document.createElement('div');
11 message.innerHTML = messagestr;
12 messageblock.appendChild(message);
13 }
14
15 if (msgcount>0) {
16 for (var i=0; i < msgcount; i++) {
17 add_message(msg[i])
18 }
19 }
20 parent.messages.scroll(1,5000000);
21 parent.send.focus();
22}
23
24M.core_message.init_refresh_page = function(Y, delay, url) {
25 var delay_callback = function() {
26 document.location.replace(url);
27 }
28 setTimeout(delay_callback, delay);
29}
c8621a02
AD
30
31M.core_message.init_search_page = function(Y, defaultsearchterm) {
32 this.Y = Y;
33 this.defaultsearchterm = defaultsearchterm;
34
35 var combinedsearchbox = this.Y.one('#combinedsearch');
36 combinedsearchbox.on('focus', this.combinedsearchgotfocus, this);
37}
38
39
40M.core_message.combinedsearchgotfocus = function(e) {
41 if (e.target.get('value')==this.defaultsearchterm) {
42 e.target.select();
43 }
44}