add sound notification chat

1.9.x
aragonc 12 years ago
parent aeb312bbf8
commit 815a4f5bf5
  1. 2
      main/chat/chat.php
  2. 10
      main/chat/chat_message.php
  3. 32
      main/chat/header_frame.inc.php
  4. BIN
      main/chat/sound/sonido_notificacion.mp3
  5. BIN
      main/chat/sound/sonido_notificacion.ogg
  6. BIN
      main/chat/sound/sonido_notificacion.wav

@ -79,7 +79,7 @@ if (empty($open_chat_window)) {
echo '<div class="page-chat">'; echo '<div class="page-chat">';
echo '<iframe src="chat_whoisonline.php?cidReq='.$cidreq.'" name="chat_whoisonline" scrolling="no" style="height:500px; width:35%; border: 0px none; float:left"></iframe>'; echo '<iframe src="chat_whoisonline.php?cidReq='.$cidreq.'" name="chat_whoisonline" scrolling="no" style="height:500px; width:35%; border: 0px none; float:left"></iframe>';
echo '<iframe src="chat_chat.php?origin='.$origin.'&target='.$target.'&amp;cidReq='.$cidreq.'" name="chat_chat" scrolling="auto" height="380" style="width:65%; border: 0px none; float:right"></iframe>'; echo '<iframe src="chat_chat.php?origin='.$origin.'&target='.$target.'&amp;cidReq='.$cidreq.'" name="chat_chat" id="chat_chat" scrolling="auto" height="380" style="width:65%; border: 0px none; float:right"></iframe>';
echo '<iframe src="chat_message.php?cidReq='.$cidreq.'" name="chat_message" scrolling="no" height="180" style="width:65%; border: 0px none; float:right"></iframe>'; echo '<iframe src="chat_message.php?cidReq='.$cidreq.'" name="chat_message" scrolling="no" height="180" style="width:65%; border: 0px none; float:right"></iframe>';
echo '<iframe src="chat_hidden.php?cidReq='.$cidreq.'" name="chat_hidden" height="0" style="border: 0px none"></iframe>'; echo '<iframe src="chat_hidden.php?cidReq='.$cidreq.'" name="chat_hidden" height="0" style="border: 0px none"></iframe>';
echo '</div>'; echo '</div>';

@ -48,6 +48,7 @@ function close_chat_window() {
chat_window.opener = top.window.self; chat_window.opener = top.window.self;
chat_window.top.close(); chat_window.top.close();
} }
</script> </script>
<?php <?php
@ -246,10 +247,10 @@ if (!empty($course) && !empty($_user['user_id'])) {
<tr> <tr>
<td width="320" valign="middle"> <td width="320" valign="middle">
<?php $talkboxsize=(api_get_course_setting('allow_open_chat_window')) ? 'width: 350px; height: 80px' : 'width: 450px; height: 35px'; ?> <?php $talkboxsize=(api_get_course_setting('allow_open_chat_window')) ? 'width: 350px; height: 80px' : 'width: 450px; height: 35px'; ?>
<textarea class="message-text" name="message" style=" <?php echo $talkboxsize; ?>" onkeydown="send_message(event);" onclick="javascript: insert_smile(this);"></textarea> <textarea id="message" class="message-text" name="message" style=" <?php echo $talkboxsize; ?>" onkeydown="send_message(event);" onclick="javascript: insert_smile(this);"></textarea>
</td> </td>
<td> <td>
<button type="submit" value="<?php echo get_lang('Send'); ?>" class="btn-enviar"><?php echo get_lang('Send'); ?></button> <button id="send" type="submit" value="<?php echo get_lang('Send'); ?>" class="btn-enviar"><?php echo get_lang('Send'); ?></button>
</td> </td>
</tr> </tr>
</table> </table>
@ -286,6 +287,11 @@ if (!empty($course) && !empty($_user['user_id'])) {
?> ?>
</div> </div>
</form> </form>
<audio id="audio">
<source type="audio/wav" src="sound/sonido_notificacion.wav"></source>
<source type="audio/ogg" src="sound/sonido_notificacion.ogg"></source>
<source type="audio/mpeg" src="sound/sonido_notificacion.mp3"></source>
</audio>
<?php <?php
} }
require 'footer_frame.inc.php'; require 'footer_frame.inc.php';

@ -69,26 +69,32 @@ header('Content-Type: text/html; charset='.api_get_system_encoding());
$(document).ready(function(){ $(document).ready(function(){
$('#user-online-scroll').tinyscrollbar(); $('#user-online-scroll').tinyscrollbar();
}); });
</script> //Sound send message
<style> $(document).ready(function(){
a { $("#message").keypress(function(event){
font-size: 12px; if (event.which == 13) {
} $("#audio")[0].play();
.background_submit {
background: url(../img/chat_little.gif) 2px 2px no-repeat;
padding: 2px 1px 1px 20px;
}
th {
font-size: 12px;
} }
</style> });
<script> });
$(document).ready(function(){
$("#send").on("click",function(){
$("#audio")[0].play();
});
});
</script>
<script type="text/javascript">
function updateChat() function updateChat()
{ {
if ('<?php echo $chat_size_old; ?>' != '<?php echo $chat_size_new; ?>') { if ('<?php echo $chat_size_old; ?>' != '<?php echo $chat_size_new; ?>') {
parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size_new.'&'.api_get_cidreq(); ?>#bottom'; parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size_new.'&'.api_get_cidreq(); ?>#bottom';
} }
} }
//$(window).load(function(updateChat){
// $("#audio")[0].play();
//});
function updateConnected() function updateConnected()
{ {

Loading…
Cancel
Save