header_frame.inc.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. /**
  11. * Code
  12. */
  13. if (!defined('FRAME')) {
  14. exit();
  15. }
  16. $bodyXtra = ' class="course_chat" dir="'.api_get_text_direction().'" ';
  17. if (FRAME == 'hidden') {
  18. $bodyXtra .= 'onload="javascript: updateChat(); updateConnected(); setTimeout(\'submitHiddenForm();\', 5000);"';
  19. // Change timeout to change refresh time of the chat window
  20. } elseif (FRAME == 'message') {
  21. $bodyXtra .= 'onload="javascript: eventMessage();"';
  22. }
  23. $mycourseid=api_get_cidreq();
  24. if (empty($mycourseid)) {
  25. // If it is not set $mycourse id we reload the chat_message window in order to hide the textarea to submit a message.
  26. echo '<script type="text/javascript" language="javascript">';
  27. echo "parent.chat_message.location.href='chat_whoisonline.php?".api_get_cidreq()."';";
  28. echo '</script>';
  29. }
  30. /*
  31. * Choose CSS style (platform's, user's, or course's)
  32. */
  33. $my_style = api_get_visual_theme();
  34. ?><!DOCTYPE html
  35. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  36. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  37. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?>" lang="<?php echo api_get_language_isocode(); ?>">
  38. <head>
  39. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>">
  40. <title>Chat</title>
  41. <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CSS_PATH).$my_style; ?>/default.css">
  42. <style>
  43. a{
  44. font-size: 12px;
  45. }
  46. .background_submit{
  47. background: url(../img/chat_little.gif) 2px 2px no-repeat;
  48. padding: 2px 1px 1px 20px;
  49. }
  50. TH{
  51. font-size: 12px;
  52. }
  53. </style>
  54. <script type="text/javascript" language="javascript">
  55. <!--
  56. function updateChat()
  57. {
  58. if ('<?php echo $chat_size_old; ?>' != '<?php echo $chat_size_new; ?>')
  59. {
  60. parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size_new.'&'.api_get_cidreq(); ?>#bottom';
  61. }
  62. }
  63. function updateConnected()
  64. {
  65. if ('<?php echo $connected_old; ?>' != '<?php echo $connected_new; ?>')
  66. {
  67. parent.chat_whoisonline.location.href='chat_whoisonline.php?size=<?php echo $connected_new; ?>';
  68. }
  69. }
  70. function submitHiddenForm()
  71. {
  72. document.formHidden.submit();
  73. }
  74. function eventMessage()
  75. {
  76. <?php if($chat_size): ?>
  77. parent.chat_hidden.document.formHidden.chat_size_old.value='<?php echo $chat_size; ?>';
  78. parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size.'&'.api_get_cidreq(); ?>#bottom';
  79. <?php endif; ?>
  80. document.formMessage.message.focus();
  81. }
  82. function send_message(evenement){
  83. for (prop in evenement)
  84. {
  85. if(prop == 'which') touche = evenement.which; else touche = evenement.keyCode;
  86. }
  87. if (touche == 13)
  88. {
  89. document.formMessage.submit();
  90. }
  91. }
  92. //-->
  93. </script>
  94. </head>
  95. <body <?php echo $bodyXtra; ?> >