mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
MDL-37962 core_message:reimplemented the beep on new message functionality from 1.9
This commit is contained in:
parent
a31e811563
commit
9279cae63b
@ -32,7 +32,7 @@ $string['allmine'] = 'All messages to me or from me';
|
||||
$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
message/bell.mp3
Normal file
BIN
message/bell.mp3
Normal file
Binary file not shown.
BIN
message/bell.ogg
Normal file
BIN
message/bell.ogg
Normal file
Binary file not shown.
@ -117,7 +117,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
|
||||
//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 @@ foreach ($processors as $processor) {
|
||||
|
||||
//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 @@ class core_message_renderer extends plugin_renderer_base {
|
||||
$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 @@ class core_message_renderer extends plugin_renderer_base {
|
||||
$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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user