header_frame.inc.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <?php // $Id: header_frame.inc.php,v 1.2 2005/05/01 11:49:16 darkden81 Exp $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Olivier Brouckaert
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. */
  19. /**
  20. ==============================================================================
  21. * Header of each frame of the Chat tool
  22. *
  23. * @author Olivier Brouckaert
  24. * @modified by Denes Nagy
  25. * @package dokeos.chat
  26. ==============================================================================
  27. */
  28. if(!defined('FRAME'))
  29. {
  30. exit();
  31. }
  32. $bodyXtra='';
  33. if(FRAME == 'hidden')
  34. {
  35. $bodyXtra='onload="javascript:updateChat(); updateConnected(); setTimeout(\'submitHiddenForm();\',5000);"';
  36. // change timeout to change refresh time of the chat window
  37. }
  38. elseif(FRAME == 'message')
  39. {
  40. $bodyXtra='onload="javascript:eventMessage();"';
  41. }
  42. /*
  43. * Choose CSS style (platform's, user's, or course's)
  44. */
  45. $platform_theme = api_get_setting('stylesheets'); // plataform's css
  46. $my_style=$platform_theme;
  47. if(api_get_setting('user_selected_theme') == 'true')
  48. {
  49. $useri = api_get_user_info();
  50. $user_theme = $useri['theme'];
  51. if(!empty($user_theme) && $user_theme != $my_style)
  52. {
  53. $my_style = $user_theme; // user's css
  54. }
  55. }
  56. $mycourseid = api_get_course_id();
  57. if (!empty($mycourseid) && $mycourseid != -1)
  58. {
  59. if (api_get_setting('allow_course_theme') == 'true')
  60. {
  61. $mycoursetheme=api_get_course_setting('course_theme');
  62. if (!empty($mycoursetheme) && $mycoursetheme!=-1)
  63. {
  64. if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
  65. {
  66. $my_style = $mycoursetheme; // course's css
  67. }
  68. }
  69. }
  70. }
  71. if (empty($mycourseid))
  72. {
  73. // if it is not set $mycourse id we reload the chat_message window in order to hide the
  74. // textarea to submit a message
  75. echo '<script type="text/javascript" language="javascript">';
  76. echo "parent.chat_message.location.href='chat_whoisonline.php?".api_get_cidreq()."';";
  77. echo '</script>';
  78. }
  79. ?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  80. <html>
  81. <head>
  82. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset;?>">
  83. <title>Chat</title>
  84. <link rel="stylesheet" type="text/css" href="../css/<?php echo $my_style; ?>/default.css">
  85. <style>
  86. a{
  87. font-size: 12px;
  88. }
  89. .background_submit{
  90. background: url(../img/chat_little.gif) 2px 2px no-repeat;
  91. padding: 2px 1px 1px 20px;
  92. }
  93. TH{
  94. font-size: 12px;
  95. }
  96. </style>
  97. <script type="text/javascript" language="javascript">
  98. <!--
  99. function updateChat()
  100. {
  101. if('<?php echo $chat_size_old; ?>' != '<?php echo $chat_size_new; ?>')
  102. {
  103. parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size_new.'&cidReq='.$_GET['cidReq']; ?>#bottom';
  104. }
  105. }
  106. function updateConnected()
  107. {
  108. if('<?php echo $connected_old; ?>' != '<?php echo $connected_new; ?>')
  109. {
  110. parent.chat_whoisonline.location.href='chat_whoisonline.php?size=<?php echo $connected_new; ?>';
  111. }
  112. }
  113. function submitHiddenForm()
  114. {
  115. document.formHidden.submit();
  116. }
  117. function eventMessage()
  118. {
  119. <?php if($chat_size): ?>
  120. parent.chat_hidden.document.formHidden.chat_size_old.value='<?php echo $chat_size; ?>';
  121. parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size.'&cidReq='.$_GET['cidReq']; ?>#bottom';
  122. <?php endif; ?>
  123. document.formMessage.message.focus();
  124. }
  125. function send_message(evenement){
  126. for (prop in evenement)
  127. {
  128. if(prop == 'which') touche = evenement.which; else touche = evenement.keyCode;
  129. }
  130. if (touche == 13)
  131. {
  132. document.formMessage.submit();
  133. }
  134. }
  135. //-->
  136. </script>
  137. </head>
  138. <body <?php echo $bodyXtra; ?> >