header_frame.inc.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Header of each frame of the Chat tool
  5. *
  6. * @author Olivier Brouckaert
  7. * @modified by Denes Nagy
  8. * @package chamilo.chat
  9. */
  10. if (!defined('FRAME')) {
  11. exit();
  12. }
  13. $bodyXtra = 'dir="'.api_get_text_direction().'" ';
  14. if (FRAME == 'hidden') {
  15. $bodyXtra .= 'onload="javascript: updateChat(); updateConnected(); setTimeout(\'submitHiddenForm();\', 5000);"';
  16. // Change timeout to change refresh time of the chat window
  17. } elseif (FRAME == 'message') {
  18. $bodyXtra .= 'onload="javascript: eventMessage();"';
  19. }
  20. /*
  21. * Choose CSS style (platform's, user's, or course's)
  22. */
  23. $platform_theme = api_get_setting('stylesheets'); // plataform's css
  24. $my_style = $platform_theme;
  25. if (api_get_setting('user_selected_theme') == 'true') {
  26. $useri = api_get_user_info();
  27. $user_theme = $useri['theme'];
  28. if (!empty($user_theme) && $user_theme != $my_style) {
  29. $my_style = $user_theme; // user's css
  30. }
  31. }
  32. $mycourseid = api_get_course_id();
  33. if (!empty($mycourseid) && $mycourseid != -1) {
  34. if (api_get_setting('allow_course_theme') == 'true') {
  35. $mycoursetheme = api_get_course_setting('course_theme');
  36. if (!empty($mycoursetheme) && $mycoursetheme != -1) {
  37. if (!empty($mycoursetheme) && $mycoursetheme != $my_style) {
  38. $my_style = $mycoursetheme; // course's css
  39. }
  40. }
  41. }
  42. }
  43. if (empty($mycourseid)) {
  44. // If it is not set $mycourse id we reload the chat_message window in order to hide the textarea to submit a message.
  45. echo '<script type="text/javascript" language="javascript">';
  46. echo "parent.chat_message.location.href='chat_whoisonline.php?".api_get_cidreq()."';";
  47. echo '</script>';
  48. }
  49. ?><!DOCTYPE html
  50. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  51. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  52. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?>" lang="<?php echo api_get_language_isocode(); ?>">
  53. <head>
  54. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>">
  55. <title>Chat</title>
  56. <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CSS_PATH).$my_style; ?>/default.css">
  57. <style>
  58. a{
  59. font-size: 12px;
  60. }
  61. .background_submit{
  62. background: url(../img/chat_little.gif) 2px 2px no-repeat;
  63. padding: 2px 1px 1px 20px;
  64. }
  65. TH{
  66. font-size: 12px;
  67. }
  68. </style>
  69. <script type="text/javascript" language="javascript">
  70. <!--
  71. function updateChat()
  72. {
  73. if ('<?php echo $chat_size_old; ?>' != '<?php echo $chat_size_new; ?>')
  74. {
  75. parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size_new.'&cidReq='.$_GET['cidReq']; ?>#bottom';
  76. }
  77. }
  78. function updateConnected()
  79. {
  80. if ('<?php echo $connected_old; ?>' != '<?php echo $connected_new; ?>')
  81. {
  82. parent.chat_whoisonline.location.href='chat_whoisonline.php?size=<?php echo $connected_new; ?>';
  83. }
  84. }
  85. function submitHiddenForm()
  86. {
  87. document.formHidden.submit();
  88. }
  89. function eventMessage()
  90. {
  91. <?php if($chat_size): ?>
  92. parent.chat_hidden.document.formHidden.chat_size_old.value='<?php echo $chat_size; ?>';
  93. parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size.'&cidReq='.$_GET['cidReq']; ?>#bottom';
  94. <?php endif; ?>
  95. document.formMessage.message.focus();
  96. }
  97. function send_message(evenement){
  98. for (prop in evenement)
  99. {
  100. if(prop == 'which') touche = evenement.which; else touche = evenement.keyCode;
  101. }
  102. if (touche == 13)
  103. {
  104. document.formMessage.submit();
  105. }
  106. }
  107. //-->
  108. </script>
  109. </head>
  110. <body <?php echo $bodyXtra; ?> >