updating and tidy code, as well free notification sound #7147

1.9.x
aragonc 11 years ago
parent 47141cdc46
commit d6670a738b
  1. 23
      main/chat/chat_message.php
  2. 24
      main/chat/chat_whoisonline.php
  3. 6
      main/chat/footer_frame.inc.php
  4. 118
      main/chat/header_frame.inc.php
  5. BIN
      main/chat/sound/notification.mp3
  6. BIN
      main/chat/sound/notification.ogg
  7. BIN
      main/chat/sound/notification.wav
  8. BIN
      main/chat/sound/sonido_notificacion.mp3
  9. BIN
      main/chat/sound/sonido_notificacion.ogg
  10. BIN
      main/chat/sound/sonido_notificacion.wav
  11. 16
      main/css/chat.css
  12. BIN
      main/css/lp_section.png

@ -215,21 +215,15 @@ if (!empty($course) && !empty($_user['user_id'])) {
$fp = fopen($chat_path.$basename_chat.'.log.html', 'a');
// view user picture
$user_image = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
$user_photo = $user_image['dir'].'medium_'.$user_image['file'];
$file_photo = '<img class="chat-image" src="'.$user_photo.'"/>';
$userImage = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
$userPhoto = $userImage['dir'].'medium_'.$userImage['file'];
$filePhoto = '<img class="chat-image" src="'.$userPhoto.'"/>';
if ($isMaster) {
// $photo = '<img src="'.api_get_path(WEB_IMG_PATH).'teachers.gif" alt="'.get_lang('Teacher').'" width="11" height="11" align="top" title="'.get_lang('Teacher').'" />';
fputs($fp, '<div class="message-teacher"><div class="content-message"><div>'.$message.'</div><div class="message-date">'.$timeNow.'</div></div><div class="icon-message"></div>'.$file_photo.'</div>'."\n");
//fputs($fp, '<span style="color:#999; font-size: smaller;">['.$timeNow.']</span>'.$file_photo.' <span id="chat_login_name"><b>'.api_get_person_name($firstname, $lastname).'</b></span> : <i>'.$message.'</i><br />'."\n");
fputs($fp, '<div class="message-teacher"><div class="content-message"><div>'.$message.'</div><div class="message-date">'.$timeNow.'</div></div><div class="icon-message"></div>'.$filePhoto.'</div>'."\n");
} else {
// $photo = '<img src="'.api_get_path(WEB_IMG_PATH).'students.gif" alt="'.get_lang('Student').'" width="11" height="11" align="top" title="'.get_lang('Student').'" />';
//fputs($fp, '<span style="color:#999; font-size: smaller;">['.$timeNow.']</span>'.$file_photo.' <b>'.api_get_person_name($firstname, $lastname).'</b> : <i>'.$message.'</i><br />'."\n");
fputs($fp, '<div class="message-student">'.$file_photo.'<div class="icon-message"></div><div class="content-message"><div>'.$message.'</div><div class="message-date">'.$timeNow.'</div></div></div>'."\n");
fputs($fp, '<div class="message-student">'.$filePhoto.'<div class="icon-message"></div><div class="content-message"><div>'.$message.'</div><div class="message-date">'.$timeNow.'</div></div></div>'."\n");
}
fclose($fp);
$chat_size = filesize($chat_path.$basename_chat.'.log.html');
@ -250,7 +244,7 @@ if (!empty($course) && !empty($_user['user_id'])) {
<textarea id="message" class="message-text" name="message" style=" <?php echo $talkboxsize; ?>" onkeydown="send_message(event);" onclick="javascript: insert_smile(this);"></textarea>
</td>
<td>
<button id="send" 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-send"><?php echo get_lang('Send'); ?></button>
</td>
</tr>
</table>
@ -287,11 +281,6 @@ if (!empty($course) && !empty($_user['user_id'])) {
?>
</div>
</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
}
require 'footer_frame.inc.php';

@ -109,11 +109,10 @@ if (!empty($course)) {
?>
<div class="user-connected">
<div id="user-online-scroll" class="user-online">
<div class="title"><?php echo get_lang('Users'); ?> <?php echo get_lang('Connected'); ?></div>
<div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>
<div class="viewport"><div id="hidden" class="overview">
<ul class="perfil list-group">
<ul class="profile list-group">
<?php
foreach ($users as & $user) {
if (empty($session_id)) {
@ -121,19 +120,24 @@ if (!empty($course)) {
} else {
$status = CourseManager::is_course_teacher($user['user_id'], $_SESSION['_course']['id']) ? 1 : 5;
}
$user_image = UserManager::get_user_picture_path_by_id($user['user_id'], 'web', false, true);
$file_url = $user_image['dir'].'medium_'.$user_image['file'];
$email_url = $user['email'];
$url_user_profile=api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user['user_id'].'&';
$userImage = UserManager::get_user_picture_path_by_id($user['user_id'], 'web', false, true);
$fileUrl = $userImage['dir'].'medium_'.$userImage['file'];
$email = $user['email'];
$url_user_profile=api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user['user_id'].'&';
?>
<li class="list-group-item">
<img src="<?php echo $file_url;?>" border="0" width="50" alt="" class="user-image-chat" />
<img src="<?php echo $fileUrl;?>" border="0" width="50" alt="" class="user-image-chat" />
<div class="user-name">
<a href="<?php echo $url_user_profile; ?>" target="_blank"><?php echo api_get_person_name($user['firstname'], $user['lastname']); ?></a>
<?php if ($status == 1) echo Display::return_icon('teachers.gif', get_lang('Teacher'), array('height' => '18')).' '; else echo Display::return_icon('students.gif', get_lang('Student'), array('height' => '18')); ?>
<?php
if ($status == 1) {
echo Display::return_icon('teachers.gif', get_lang('Teacher'), array('height' => '18'));
}else{
echo Display::return_icon('students.gif', get_lang('Student'), array('height' => '18'));
}
?>
</div>
<div class="user-email"><?php echo $email_url; ?></div>
<div class="user-email"><?php echo $email; ?></div>
</li>
<?php } unset($users); ?>
</ul>

@ -9,9 +9,9 @@
*/
?>
<audio id="audio">
<source src="sound/sonido_notificacion.wav" type="audio/wav"></source>
<source src="sound/sonido_notificacion.ogg" type="audio/ogg"></source>
<source src="sound/sonido_notificacion.mp3" type="audio/mpeg"></source>
<source src="<?php echo api_get_path(WEB_PATH);?>main/chat/sound/notification.wav" type="audio/wav"></source>
<source src="<?php echo api_get_path(WEB_PATH);?>main/chat/sound/notification.ogg" type="audio/ogg"></source>
<source src="<?php echo api_get_path(WEB_PATH);?>main/chat/sound/notification.mp3" type="audio/mpeg"></source>
</audio>
</body>
</html>

@ -18,7 +18,7 @@ $bodyXtra = ' class="course_chat" dir="'.api_get_text_direction().'" ';
if (FRAME == 'hidden') {
$bodyXtra .= 'onload="javascript: updateChat(); updateConnected(); setTimeout(\'submitHiddenForm();\', 5000);"';
// Change timeout to change refresh time of the chat window
// Change timeout to change refresh time of the chat window
} elseif (FRAME == 'message') {
$bodyXtra .= 'onload="javascript: eventMessage();"';
}
@ -45,91 +45,53 @@ header('Content-Type: text/html; charset='.api_get_system_encoding());
?><!DOCTYPE html>
<html>
<head>
<meta charset="<?php echo api_get_system_encoding(); ?>" />
<title>Chat</title>
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CSS_PATH); ?>chat.css">
<?php echo api_get_js('jquery.min.js'); ?>
<?php echo api_get_js('jquery.tinyscrollbar.js'); ?>
<script type="text/javascript">
/*$(document).ready(function() {
var posicion = $("#clear-chat").offset();
var margenSuperior = 15;
$(window).scroll(function() {
if ($(window).scrollTop() > posicion.top) {
$("#clear-chat").stop().animate({
marginTop: $(window).scrollTop() - posicion.top + margenSuperior
});
} else {
$("#clear-chat").stop().animate({
marginTop: 0
});
};
});
});*/
$(document).ready(function(){
$('#user-online-scroll').tinyscrollbar();
});
//Sound send message
/*$(document).ready(function(){
$("#message").keypress(function(event){
if (event.which == 13) {
$("#audio")[0].play();
}
});
});
$(document).ready(function(){
$("#send").on("click",function(){
$("#audio")[0].play();
});
});*/
</script>
<meta charset="<?php echo api_get_system_encoding(); ?>" />
<title>Chat</title>
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CSS_PATH); ?>chat.css">
<?php echo api_get_js('jquery.min.js'); ?>
<?php echo api_get_js('jquery.tinyscrollbar.js'); ?>
<script type="text/javascript">
function play_notification() {
document.getElementById('audio').play();
}
function updateChat()
{
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';
play_notification();
}
}
function updateConnected()
{
$(document).ready(function(){
$('#user-online-scroll').tinyscrollbar();
});
if ('<?php echo $connected_old; ?>' != '<?php echo $connected_new; ?>')
{
parent.chat_whoisonline.location.href='chat_whoisonline.php?size=<?php echo $connected_new; ?>';
function play_notification() {
document.getElementById('audio').play();
}
}
function submitHiddenForm()
{
document.formHidden.submit();
}
function updateChat(){
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';
play_notification();
}
}
function eventMessage()
{
<?php if (isset($chat_size) && $chat_size): ?>
parent.chat_hidden.document.formHidden.chat_size_old.value='<?php echo $chat_size; ?>';
parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size.'&'.api_get_cidreq(); ?>#bottom';
<?php endif; ?>
document.formMessage.message.focus();
function updateConnected(){
if ('<?php echo $connected_old; ?>' != '<?php echo $connected_new; ?>'){
parent.chat_whoisonline.location.href='chat_whoisonline.php?size=<?php echo $connected_new; ?>';
}
}
}
function submitHiddenForm(){
document.formHidden.submit();
}
function send_message(evenement) {
for (prop in evenement) {
if(prop == 'which') touche = evenement.which; else touche = evenement.keyCode;
}
function eventMessage(){
<?php if (isset($chat_size) && $chat_size): ?>
parent.chat_hidden.document.formHidden.chat_size_old.value='<?php echo $chat_size; ?>';
parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size.'&'.api_get_cidreq(); ?>#bottom';
<?php endif; ?>
document.formMessage.message.focus();
}
if (touche == 13) {
document.formMessage.submit();
}
}
function send_message(evenement) {
for (prop in evenement) {
if(prop == 'which') touche = evenement.which; else touche = evenement.keyCode;
}
if (touche == 13) {
document.formMessage.submit();
}
}
</script>
</head>
<body <?php echo $bodyXtra; ?> >

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -135,15 +135,15 @@ textarea {
text-align: left;
margin-top: 10px;
}
.user-online .perfil{
.user-online .profile{
list-style: none;
padding: 0;
margin:0;
}
.user-online .perfil li{
.user-online .profile li{
margin-bottom: 5px;
}
.user-online .perfil li a{
.user-online .profile li a{
color: #fff;
text-decoration: none;
}
@ -206,7 +206,7 @@ li.list-group-item:hover a{
#user-online-scroll .disable { display: none; }
.noSelect { user-select: none; -o-user-select: none; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; }
.btn-enviar {
.btn-send {
background: #fc585d; /* Old browsers */
background: -moz-linear-gradient(top, #fc585d 0%, #fd3746 99%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fc585d), color-stop(99%,#fd3746)); /* Chrome,Safari4+ */
@ -232,15 +232,15 @@ li.list-group-item:hover a{
text-align:center;
cursor: pointer;
}
.btn-enviar:hover {
.btn-send:hover {
opacity: 0.8;
}.btn-enviar:active {
}.btn-send:active {
position:relative;
top:1px;
}
.emoticons-chat img{
width: 24px;
border: none;
width: 24px;
border: none;
}
.message-form-chat{
margin-top: 20px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Loading…
Cancel
Save