Skip to content
Permalink
Browse files

MDL-37962 core_message:reimplemented the beep on new message function…

…ality from 1.9
  • Loading branch information...
andyjdavis committed Feb 22, 2013
1 parent a31e811 commit 9279cae63b02df86663906e9833813bad9f01380
Showing with 23 additions and 5 deletions.
  1. +1 −1 lang/en/message.php
  2. +15 −2 lib/moodlelib.php
  3. BIN message/bell.mp3
  4. BIN message/bell.ogg
  5. +2 −2 message/edit.php
  6. +5 −0 message/renderer.php
@@ -32,7 +32,7 @@
$string['allstudents'] = 'All messages between students in course';
$string['allusers'] = 'All messages from all users';
$string['backupmessageshelp'] = 'If enabled, then instant messages will be included in SITE automated backups';
$string['beepnewmessage'] = 'Beep on new message';
$string['beepnewmessage'] = 'Beep when popup notification is displayed';
$string['blockcontact'] = 'Block contact';
$string['blockedmessages'] = '{$a} message(s) to/from blocked users';
$string['blockedusers'] = 'Blocked users ({$a})';
@@ -10259,15 +10259,28 @@ function message_popup_window() {
$strgomessage = get_string('gotomessages', 'message');
$strstaymessage = get_string('ignore', 'admin');
$notificationsound = null;
$beep = get_user_preferences('message_beepnewmessage', '');
if (!empty($beep)) {
// Browsers will work down this list until they find something they support.
$sourcetags = html_writer::empty_tag('source', array('src' => $CFG->wwwroot.'/message/bell.wav', 'type' => 'audio/wav'));
$sourcetags .= html_writer::empty_tag('source', array('src' => $CFG->wwwroot.'/message/bell.ogg', 'type' => 'audio/ogg'));
$sourcetags .= html_writer::empty_tag('source', array('src' => $CFG->wwwroot.'/message/bell.mp3', 'type' => 'audio/mpeg'));
$sourcetags .= html_writer::empty_tag('embed', array('src' => $CFG->wwwroot.'/message/bell.wav', 'autostart' => 'true', 'hidden' => 'true'));
$notificationsound = html_writer::tag('audio', $sourcetags, array('preload' => 'auto', 'autoplay' => 'autoplay'));
}
$url = $CFG->wwwroot.'/message/index.php';
$content = html_writer::start_tag('div', array('id' => 'newmessageoverlay', 'class' => 'mdl-align')).
html_writer::start_tag('div', array('id' => 'newmessagetext')).
$strmessages.
html_writer::end_tag('div').
$notificationsound.
html_writer::start_tag('div', array('id' => 'newmessagelinks')).
html_writer::link($url, $strgomessage, array('id' => 'notificationyes')).'   '.
html_writer::link('', $strstaymessage, array('id' => 'notificationno')).
html_writer::link($url, $strgomessage, array('id' => 'notificationyes')).'   '.
html_writer::link('', $strstaymessage, array('id' => 'notificationno')).
html_writer::end_tag('div');
html_writer::end_tag('div');
BIN +5.3 KB message/bell.mp3
Binary file not shown.
BIN +4.75 KB message/bell.ogg
Binary file not shown.
@@ -117,7 +117,7 @@
//process general messaging preferences
$preferences['message_blocknoncontacts'] = !empty($form->blocknoncontacts)?1:0;
//$preferences['message_beepnewmessage'] = !empty($form->beepnewmessage)?1:0;
$preferences['message_beepnewmessage'] = !empty($form->beepnewmessage)?1:0;
// Save all the new preferences to the database
if (!set_user_preferences($preferences, $user->id)) {
@@ -155,7 +155,7 @@
//load general messaging preferences
$preferences->blocknoncontacts = get_user_preferences( 'message_blocknoncontacts', '', $user->id);
//$preferences->beepnewmessage = get_user_preferences( 'message_beepnewmessage', '', $user->id);
$preferences->beepnewmessage = get_user_preferences( 'message_beepnewmessage', '', $user->id);
/// Display page header
$strmessaging = get_string('messaging', 'message');
@@ -352,6 +352,10 @@ public function manage_messagingoptions($processors, $providers, $preferences, $
$output .= html_writer::start_tag('fieldset', array('id' => 'messageprocessor_general', 'class' => 'clearfix'));
$output .= html_writer::nonempty_tag('legend', get_string('generalsettings','admin'), array('class' => 'ftoggler'));
$output .= html_writer::start_tag('div');
$output .= html_writer::checkbox('beepnewmessage', 1, $preferences->beepnewmessage, get_string('beepnewmessage', 'message'));
$output .= html_writer::end_tag('div');
$output .= html_writer::start_tag('div');
$output .= html_writer::checkbox('blocknoncontacts', 1, $preferences->blocknoncontacts, get_string('blocknoncontacts', 'message'));
$output .= html_writer::end_tag('div');
@@ -364,6 +368,7 @@ public function manage_messagingoptions($processors, $providers, $preferences, $
$output .= html_writer::start_tag('div', array('class' => 'mdl-align'));
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('updatemyprofile'), 'class' => 'form-submit'));
$output .= html_writer::end_tag('div');
$output .= html_writer::end_tag('form');
return $output;
}

0 comments on commit 9279cae

Please sign in to comment.
You can’t perform that action at this time.