Browse Source

improve chat presentation and kill frameset

Juan Carlos Raña 15 years ago
parent
commit
621d59578a
3 changed files with 49 additions and 112 deletions
  1. 46 61
      main/chat/chat.php
  2. 0 50
      main/chat/chat_footer.php
  3. 3 1
      main/chat/chat_message.php

+ 46 - 61
main/chat/chat.php

@@ -1,17 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-/**
- *	Frameset of the Chat tool
- *
- *	@author Olivier Brouckaert
- *	@package chamilo.chat
- */
-
 $language_file = array('chat');
 
 require_once '../inc/global.inc.php';
-
+require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
+$this_section = SECTION_COURSES;
 $nameTools = get_lang('ToolChat');
 
 if ($_GET["origin"] != 'whoisonline') {
@@ -54,38 +48,6 @@ if (!empty($mycourseid) && $mycourseid != -1) {
 	}
 	$open_chat_window = api_get_course_setting('allow_open_chat_window');
 }
-if (api_get_setting('show_navigation_menu') != 'false') {
-	$footer_size = 20;
-} else {	
-	$top_size = 135;
-	switch($my_style) {	
-		case 'chamilo_red' :
-		case 'chamilo_green' :	
-		case 'chamilo' :
-			$top_size = 185;
-			$footer_size = 48;
-		break;
-		case 'dokeos_classic' :
-		case 'chamilo_classic' :
-			$footer_size = 48;
-			break;
-		case 'academica' :
-			$footer_size = 140;
-			break;
-		case 'silver_line' :
-			$footer_size = 60;
-			break;
-		case 'baby_orange' :
-			$footer_size = 120;
-			break;
-		case 'public_admin' :
-			$footer_size =90;
-			break;
-		default :
-			$footer_size = 48;
-			break;
-	}
-}
 
 $cidreq = Security::remove_XSS($_GET['cidReq']);
 
@@ -99,29 +61,52 @@ $cidreq = Security::remove_XSS($_GET['cidReq']);
 <?php
 echo'<title>'.get_lang('Chat').' - '.$mycourseid.' - '.api_get_setting('siteName').'</title>';
 
-if (empty($open_chat_window)) {
-	echo'<frameset rows="'.$top_size.',*,'.$footer_size.'" border="0" frameborder="0" framespacing="1">';
-	echo '<frame src="chat_banner.php?cidReq='.$cidreq.'" name="chat_banner" scrolling="no">';
-}
+// If it is a group chat then the breadcrumbs.
+if ($_SESSION['_gid'] OR $_GET['group_id']) {
+
+	if (isset($_SESSION['_gid'])) {
+		$_clean['group_id'] = (int)$_SESSION['_gid'];
+	}
+	if (isset($_GET['group_id'])) {
+		$_clean['group_id'] = (int)Database::escape_string($_GET['group_id']);
+	}
+
+	$group_properties  = GroupManager :: get_group_properties($_clean['group_id']);
+	$interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
+	$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')');
+	$noPHP_SELF = true;
+	$shortBanner = false;
+	$add_group_to_title = ' ('.$group_properties['name'].')';
+	$groupfilter = 'group_id="'.$_clean['group_id'].'"';
+
+	// Ensure this tool in groups whe it's private or deactivated
+	/*if ($group_properties['chat_state'] == 0) {
+		echo api_not_allowed();
+	} elseif ($group_properties['chat_state'] == 2) {
+ 		if (!api_is_allowed_to_edit(false,true) and !GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid'])) {
+			echo api_not_allowed();
+		}
+	}*/
 
-if (api_get_setting('show_navigation_menu') == 'false' || !empty($open_chat_window)) {
-	echo '<frameset cols="165,*,0" border="1" frameborder="1" framespacing="1">';
 } else {
-	echo '<frameset cols="165,*,200" border="1" frameborder="1" framespacing="1">';
+	$groupfilter = 'group_id=0';
 }
-echo '<frame src="chat_whoisonline.php?cidReq='.$cidreq.'" name="chat_whoisonline" scrolling="auto">';
-echo'<frameset rows="25,15" border="1" frameborder="1" framespacing="1">';
-echo '<frame src="chat_chat.php?origin='.Security::remove_XSS($_GET['origin']).'&target='.Security::remove_XSS($_GET['target']).'&amp;cidReq='.$cidreq.'" name="chat_chat" scrolling="auto">';
-echo '<frame src="chat_message.php?cidReq='.$cidreq.'" name="chat_message" scrolling="no">';
-echo '</frameset>';
-echo '<frame src="chat_hidden.php?cidReq='.$cidreq.'" name="chat_hidden" >';
-echo'</frameset>';
-
-if (api_get_setting('show_navigation_menu') == 'false') {
-	if (empty($open_chat_window)) {
-		echo '<frame src="chat_footer.php?cidReq='.$cidreq.'" name="chat_footer" scrolling="no">';
-		echo '</frameset>';
-	}
+
+//$is_allowed_to_edit = api_is_allowed_to_edit(false, true);
+
+
+if (empty($open_chat_window)) {
+Display::display_header($tool_name, 'Chat');
 }
-echo'<noframes></noframes>';
+	
+
+echo '<iframe src="chat_whoisonline.php?cidReq='.$cidreq.'" name="chat_whoisonline" scrolling="auto" style="height:320px; width:19%; border: 0px none; float:left"></iframe>';
+echo '<iframe src="chat_chat.php?origin='.Security::remove_XSS($_GET['origin']).'&target='.Security::remove_XSS($_GET['target']).'&amp;cidReq='.$cidreq.'" name="chat_chat" scrolling="auto" height="240" style="width:80%; border: 0px none; float:right"></iframe>';
+echo '<iframe src="chat_message.php?cidReq='.$cidreq.'" name="chat_message" scrolling="no" height="80" style="width:80%; border: 0px none; float:right"></iframe>';
+echo '<iframe src="chat_hidden.php?cidReq='.$cidreq.'" name="chat_hidden" height="0" style="border: 0px none"></iframe>';
+
+if (empty($open_chat_window)) {
+Display::display_footer();
+}
+
 echo '</html>';

+ 0 - 50
main/chat/chat_footer.php

@@ -1,50 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-require_once '../inc/global.inc.php';
-
-define('FRAME', 'footer');
-
-?><!DOCTYPE html
-     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?>" lang="<?php echo api_get_language_isocode(); ?>">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
-<style>
-<?php
-
-/*
- * Choose CSS style (platform's, user's, or course's)
- */
-
-$platform_theme = api_get_setting('stylesheets'); 	// plataform's css
-$my_style = $platform_theme;
-if (api_get_setting('user_selected_theme') == 'true') {
-	$useri = api_get_user_info();
-	$user_theme = $useri['theme'];
-	if (!empty($user_theme) && $user_theme != $my_style) {
-		$my_style = $user_theme;					// user's css
-	}
-}
-
-$mycourseid = api_get_course_id();
-if (!empty($mycourseid) && $mycourseid != -1) {
-	if (api_get_setting('allow_course_theme') == 'true') {
-		$mycoursetheme = api_get_course_setting('course_theme');
-		if (!empty($mycoursetheme) && $mycoursetheme != -1) {
-			if (!empty($mycoursetheme) && $mycoursetheme != $my_style) {
-				$my_style = $mycoursetheme;			// course's css
-			}
-		}
-	}
-}
-?>
-@import "<?php echo api_get_path(WEB_CSS_PATH).$my_style.'/default.css'; ?>";
-</style>
-</head>
-<body dir="<?php echo api_get_text_direction(); ?>">
-<br />
-<?php
-
-Display::display_footer();

+ 3 - 1
main/chat/chat_message.php

@@ -244,7 +244,9 @@ if (!empty($course) && !empty($_user['user_id'])) {
 	<table border="0" cellpadding="5" cellspacing="0" width="100%">
 	<tr>
         <td width="320" valign="middle">
-        <textarea name="message" style="width: 500px; height: 35px" onkeydown="send_message(event);" onclick="javascript: insert_smile(this);"></textarea>
+           
+		<?php $talkboxsize=(api_get_course_setting('allow_open_chat_window')) ? 'width: 350px; height: 35px' : 'width: 450px; height: 35px'; ?>           
+        <textarea name="message" style=" <?php echo $talkboxsize; ?>" onkeydown="send_message(event);" onclick="javascript: insert_smile(this);"></textarea>
         </td>
         <td>
         <button type="submit" value="<?php echo get_lang('Send'); ?>" class="background_submit"><?php echo get_lang('Send'); ?></button>