[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/mod/chat/gui_sockets/ -> chatinput.php (source)

   1  <?php  // $Id: chatinput.php,v 1.11.4.3 2008/10/08 06:41:55 dongsheng Exp $
   2  
   3      $nomoodlecookie = true;     // Session not needed!
   4  
   5      require('../../../config.php');
   6      require ('../lib.php');
   7  
   8      $chat_sid = required_param('chat_sid', PARAM_ALPHANUM);
   9  
  10      if (!$chatuser = get_record('chat_users', 'sid', $chat_sid)) {
  11          error('Not logged in!');
  12      }
  13  
  14      //Get the user theme
  15      $USER = get_record('user', 'id', $chatuser->userid);
  16  
  17      //Setup course, lang and theme
  18      course_setup($chatuser->course);
  19  
  20      ob_start();
  21      ?>
  22  <script type="text/javascript">
  23  scroll_active = true;
  24  function empty_field_and_submit() {
  25      var cf   = document.getElementById('sendform');
  26      var inpf = document.getElementById('inputform');
  27      cf.chat_msgidnr.value = parseInt(cf.chat_msgidnr.value) + 1;
  28      cf.chat_message.value = inpf.chat_message.value;
  29      inpf.chat_message.value='';
  30      cf.submit();
  31      inpf.chat_message.focus();
  32      return false;
  33  }
  34  function setfocus() {
  35      document.getElementsByName("chat_message")[0].focus(); 
  36  }
  37  </script>
  38      <?php
  39  
  40      $meta = ob_get_clean();
  41      // TODO: there will be two onload in body tag, does it matter?
  42      print_header('', '', '', 'inputform.chat_message', $meta, false, '&nbsp;', '', false, 'onload="setfocus();"');
  43  
  44  ?>
  45  
  46      <form action="../empty.php" method="get" target="empty" id="inputform"
  47            onsubmit="return empty_field_and_submit();">
  48          <input type="text" name="chat_message" size="60" value="" />
  49          <?php helpbutton("chatting", get_string("helpchatting", "chat"), "chat", true, false); ?>
  50      </form>
  51      
  52      <form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform">
  53          <input type="hidden" name="win" value="message" />
  54          <input type="hidden" name="chat_message" value="" />
  55          <input type="hidden" name="chat_msgidnr" value="0" />
  56          <input type="hidden" name="chat_sid" value="<?php echo $chat_sid ?>" />
  57      </form>
  58  <?php
  59      print_footer('empty');
  60  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7