header_frame.inc.php 2.8 KB

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