Merge branch 'MDL-37962_beep_24' of https://github.com/andyjdavis/moodle into MOODLE_24_STABLE

This commit is contained in:
Sam Hemelryk
2014-01-06 11:17:47 +13:00
6 changed files with 24 additions and 6 deletions
+1 -1
View File
@@ -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})';
+16 -3
View File
@@ -10354,15 +10354,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').
html_writer::start_tag('div', array('id'=>'newmessagelinks')).
html_writer::link($url, $strgomessage, array('id'=>'notificationyes')).'   '.
html_writer::link('', $strstaymessage, array('id'=>'notificationno')).
$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::end_tag('div');
html_writer::end_tag('div');
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -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');
+5
View File
@@ -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;
}