Browse Source

Feature #272 - Chat tool, frames: Adding html-instructions about encoding, language and text direction.

Ivan Tcholakov 15 years ago
parent
commit
a54339e297

+ 8 - 2
main/chat/chat.php

@@ -81,8 +81,14 @@ if (api_get_setting('show_navigation_menu') != 'false') {
 }
 $cidreq = $_GET['cidReq'];
 
-echo '<html><head>';
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.api_get_system_encoding().'" />';
+?>
+<!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(); ?>" />
+<?php
 echo'<title>'.get_lang('Chat').' - '.$mycourseid.' - '.api_get_setting('siteName').'</title>';
 
 if (empty($open_chat_window)) {

+ 4 - 4
main/chat/chat_chat.php

@@ -15,7 +15,6 @@ require_once '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'document.lib.php';
 require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
 require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
-//$course=api_get_course_id();
 
 $course = $_GET['cidReq'];
 $session_id = intval($_SESSION['id_session']);
@@ -53,7 +52,7 @@ if (!empty($course)) {
 
 		if (!api_is_anonymous()) {
 			@mkdir($chat_path, api_get_permissions_for_new_directories());
-			// save chat files document for group into item property
+			// Save chat files document for group into item property
 			if (!empty($group_id)) {
 				$doc_id = add_document($_course, $basepath_chat, 'folder', 0, 'chat_files');
 				$sql = "INSERT INTO $TABLEITEMPROPERTY (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility)
@@ -134,8 +133,8 @@ if (!empty($course)) {
 	}
 
 	echo '<div style="margin-left: 5px;">';
-	foreach ($content as & $thisLine) {
-		echo strip_tags(api_html_entity_decode($thisLine), '<br> <span> <b> <i> <img> <font>');
+	foreach ($content as & $this_line) {
+		echo strip_tags(api_html_entity_decode($this_line), '<br> <span> <b> <i> <img> <font>');
 	}
 	echo '</div>';
 
@@ -155,4 +154,5 @@ if (!empty($course)) {
 	$message = get_lang('CloseOtherSession');
 	Display :: display_error_message($message);
 }
+
 require 'footer_frame.inc.php';

+ 15 - 5
main/chat/chat_footer.php

@@ -5,7 +5,14 @@ require_once '../inc/global.inc.php';
 
 define('FRAME', 'footer');
 
-echo '<html><head><style>';
+?><!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)
@@ -32,9 +39,12 @@ if (!empty($mycourseid) && $mycourseid != -1) {
 		}
 	}
 }
-
-echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/default.css'.'";';
-
-echo '</style></head><body><br />';
+?>
+@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();

+ 4 - 4
main/chat/chat_message.php

@@ -93,7 +93,7 @@ if (!empty($course) && !empty($_user['user_id'])) {
 	}
 	$chat_path = $document_path.$basepath_chat.'/';
 
-	$TABLEITEMPROPERTY= Database::get_course_table(TABLE_ITEM_PROPERTY);
+	$TABLEITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
 
 	if (!is_dir($chat_path)) {
 		if (is_file($chat_path)) {
@@ -232,8 +232,8 @@ if (!empty($course) && !empty($_user['user_id'])) {
 
 				$chat_size = filesize($chat_path.$basename_chat.'.log.html');
 
-				update_existing_document($_course, $doc_id,$chat_size);
-				item_property_update_on_folder($_course,$basepath_chat, $_user['user_id']);
+				update_existing_document($_course, $doc_id, $chat_size);
+				item_property_update_on_folder($_course, $basepath_chat, $_user['user_id']);
 			}
 		}
 	}
@@ -246,7 +246,7 @@ if (!empty($course) && !empty($_user['user_id'])) {
         <textarea name="message" style="width: 320px; height: 35px" 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>
+        <button type="submit" value="<?php echo get_lang('Send'); ?>" class="background_submit"><?php echo get_lang('Send'); ?></button>
         </td>
 	</tr>
     <tr>

+ 4 - 4
main/chat/chat_whoisonline.php

@@ -45,7 +45,7 @@ if (!empty($course)) {
 	$isAllowed = !(empty($pseudo_user) || !$_cid);
 	$isMaster = (bool)$is_courseAdmin;
 
-	$date_inter = date('Y-m-d H:i:s', time()-120);
+	$date_inter = date('Y-m-d H:i:s', time() - 120);
 
 	$users = array();
 
@@ -84,15 +84,15 @@ if (!empty($course)) {
 			$users[$coaches['user_id']] = $coaches;
 		}
 
-		//if($coach = Database::fetch_array($result))
-			//$users[$coach['user_id']] = $coach;
+		//if ($coach = Database::fetch_array($result))
+		//	$users[$coach['user_id']] = $coach;
 	}
 
 	$user_id = $enreg['user_id'];
 	require 'header_frame.inc.php';
 	?>
 	<table border="0" cellpadding="0" cellspacing="0" width="100%" class="data_table">
-	<tr><th colspan="2"><?php echo get_lang("Connected"); ?></th></tr>
+	<tr><th colspan="2"><?php echo get_lang('Connected'); ?></th></tr>
 	<?php
 	foreach ($users as & $user) {
 		if (empty($session_id)) {