[ Index ]

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

title

Body

[close]

/mod/resource/type/file/ -> localpath.php (source)

   1  <?php    // $Id: localpath.php,v 1.5.4.2 2008/09/26 05:15:45 tjhunt Exp $
   2  
   3      require('../../../../config.php');
   4      require ('../../lib.php');
   5  
   6      $pathname = optional_param('pathname', '');
   7  
   8      if ($pathname) {
   9          if (confirm_sesskey()) {
  10              set_user_preference('resource_localpath', $pathname);
  11          }
  12          ?>
  13          <script type="text/javascript">
  14          //<![CDATA[
  15          window.close();
  16          //]]>
  17          </script>
  18          <?php
  19          exit;
  20      }
  21  
  22      print_header(get_string('localfilechoose', 'resource'));
  23  
  24      print_simple_box(get_string('localfilepath', 'resource', $CFG->wwwroot.'/user/edit.php?course='.SITEID), 'center');
  25  
  26      ?>
  27      <script type="text/javascript">
  28      //<![CDATA[
  29      function set_value(txt) {
  30          if (txt.indexOf('/') > -1) {
  31              txt = txt.substring(0,txt.lastIndexOf('/'));
  32          } else if (txt.indexOf('\\') > -1) {
  33              txt = txt.substring(0,txt.lastIndexOf('\\'));
  34          }
  35          getElementById('myform').pathname.value = txt;
  36          getElementById('myform').submit();
  37      }
  38      //]]>
  39      </script>
  40      
  41      <br />
  42      <div align="center" class="form">
  43      <form id="myform" action="localpath.php" method="post">
  44      <fieldset class="invisiblefieldset">
  45      <input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>">
  46      <input type="hidden" name="pathname" value="" />
  47      <input type="file" size="60" name="myfile" /><br />
  48      <input type="button" value="<?php print_string('localfileselect','resource') ?>" 
  49             onClick="return set_value(getElementById('myform').myfile.value)">
  50      <input type="button" value="<?php print_string('cancel') ?>" 
  51             onClick="window.close()">
  52      </fieldset>
  53      </form>
  54      </div>
  55  <?php
  56      print_footer('empty');
  57  ?>


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