[svn r17115] -a user can have multiple open chat rooms with different courses

-mode open in a new window: self-close window when there isn't an user login
-some cosmetic fix
skala
Juan Carlos Raña 17 years ago
parent 207b69afea
commit f105f3ad90
  1. 4
      main/chat/chat.php
  2. 27
      main/chat/chat_message.php
  3. 4
      main/course_home/activity.php
  4. 8
      main/inc/tool_navigation_menu.inc.php

@ -1,4 +1,4 @@
<?php // $Id: chat.php 17084 2008-12-06 16:44:47Z herodoto $
<?php // $Id: chat.php 17115 2008-12-08 19:05:18Z herodoto $
/*
==============================================================================
Dokeos - elearning and course management software
@ -114,7 +114,7 @@ if ($open_chat_window==false)
echo'<frameset rows="135,*,'.$footer_size.'" border="0" frameborder="0" framespacing="1">';
echo '<frame src="chat_banner.php?cidReq='.$cidreq.'" name="chat_banner" scrolling="no">';
}
echo '<frameset cols="200,*,0" border="1" frameborder="1" framespacing="1">';
echo '<frameset cols="150,*,0" border="1" frameborder="1" framespacing="1">';
echo '<frame src="chat_whoisonline.php?cidReq='.$cidreq.'" name="chat_whoisonline" scrolling="auto">';
echo'<frameset rows="50,15" border="1" frameborder="1" framespacing="1">';
echo '<frame src="chat_chat.php?origin='.$_GET["origin"].'&target='.$_GET["target"].'&amp;cidReq='.$cidreq.'" name="chat_chat" scrolling="auto">';

@ -45,7 +45,7 @@ api_protect_course_script();
$course=api_get_course_id();
/////
// Juan Carlos Raña insert smileys
// Juan Carlos Raña insert smileys and self-closing window
////
?>
<script language="javascript" type="text/javascript">
@ -65,11 +65,26 @@ function insert(text) {
chat.focus(smile)
}
function close_chat_window() {
var chat_window = top.window.self;
chat_window.opener = top.window.self;
chat_window.top.close();
}
</script>
<?php
// mode open in a new window: close the window when there isn't an user login
if(empty($_user['user_id']))
{
echo '<script languaje="javascript"> close_chat_window() </script>';
}
// if we have the session set up
if (!empty($course))
if (!empty($course) && !empty($_user['user_id']))
{
include_once(api_get_path(LIBRARY_PATH).'document.lib.php');
include_once(api_get_path(LIBRARY_PATH).'text.lib.php');
@ -234,13 +249,13 @@ if (!empty($course))
if($isMaster)
{
$photo= '<img src="'.api_get_path(WEB_IMG_PATH).'teachers.gif" alt="'.$firstname.' '.$lastname.'" width="11" height="11" align="top" title="'.$firstname.' '.$lastname.'" />';
fputs($fp,'<font color="#CCCCCC" size="-2">['.$timeNow.']</font>'.$photo.' <span id="chat_login_name"><b>'.$firstname.' '.$lastname.'</b></span> : <i>'.$message.'</i><br>'."\n");
fputs($fp,'<span style="color:#CCCCCC; font-size: smaller;">['.$timeNow.']</span>'.$photo.' <span id="chat_login_name"><b>'.$firstname.' '.$lastname.'</b></span> : <i>'.$message.'</i><br>'."\n");
}
else
{
$photo= '<img src="'.api_get_path(WEB_IMG_PATH).'students.gif" alt="'.$firstname.' '.$lastname.'" width="11" height="11" align="top" title="'.$firstname.' '.$lastname.'" />';
fputs($fp,'<font color="#CCCCCC" size="-2">['.$timeNow.']</font>'.$photo.' <b>'.$firstname.' '.$lastname.'</b> : <i>'.$message.'</i><br>'."\n");
fputs($fp,'<span style="color:#CCCCCC; font-size: smaller;">['.$timeNow.']</span>'.$photo.' <b>'.$firstname.' '.$lastname.'</b> : <i>'.$message.'</i><br>'."\n");
}
fclose($fp);
@ -256,8 +271,8 @@ if (!empty($course))
<input type="hidden" name="sent" value="1">
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td width="420" valign="middle">
<textarea name="message" style="width: 420px; height: 35px" onkeydown="send_message(event);" onclick="javascript:insert_smile(this);"></textarea>
<td width="320" valign="middle">
<textarea name="message" style="width: 320px; height: 35px" onkeydown="send_message(event);" onclick="javascript:insert_smile(this);"></textarea>
</td>
<td>
<input type="submit" value="<?php echo get_lang("Send"); ?>" class="background_submit">

@ -297,7 +297,9 @@ function show_tools_category($course_tool_category)
}
if(strpos($toolsRow['name'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true)
{
$toollink = "\t" . '<a ' . $class . ' href="#" onclick="window.open(\'' . htmlspecialchars($toolsRow['link']) . '\',\'window_chat\',config=\'height=\'+480+\', width=\'+725+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '">';
$toollink = "\t" . '<a ' . $class . ' href="#" onclick="window.open(\'' . htmlspecialchars($toolsRow['link']) . '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '">';
}
else
{

@ -1,5 +1,5 @@
<?php
// $Id: tool_navigation_menu.inc.php 17084 2008-12-06 16:44:47Z herodoto $
// $Id: tool_navigation_menu.inc.php 17115 2008-12-08 19:05:18Z herodoto $
/*
==============================================================================
Dokeos - elearning and course management software
@ -201,8 +201,8 @@ function show_navigation_menu()
if (strpos($navigation_item['link'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true)
{
echo '<a href="#" onclick="window.open(\''.$navigation_item['link'].'\',\'window_chat\',config=\'height=\'+480+\', width=\'+725+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
}
echo '<a href="#" onclick="window.open(\''.$navigation_item['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
}
else
{
echo '<a href="'.$navigation_item['link'].'"';
@ -254,7 +254,7 @@ function show_navigation_tool_shortcuts($orientation = SHORTCUTS_HORIZONTAL)
if (strpos($navigation_item['link'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true)
{
echo '<a href="#" onclick="window.open(\''.$navigation_item['link'].'\',\'window_chat\',config=\'height=\'+480+\', width=\'+725+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
echo '<a href="#" onclick="window.open(\''.$navigation_item['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
}
else
{

Loading…
Cancel
Save