Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / mod / resource / type / file / localpath.php
blobef691baa9dbc09cddc90295d90e658b68056e6d3
1 <?php // $Id$
3 require('../../../../config.php');
4 require('../../lib.php');
6 $pathname = optional_param('pathname', '');
8 if ($pathname) {
9 if (confirm_sesskey()) {
10 set_user_preference('resource_localpath', $pathname);
13 <script type="text/javascript">
14 //<![CDATA[
15 window.close();
16 //]]>
17 </script>
18 <?php
19 exit;
22 print_header(get_string('localfilechoose', 'resource'));
24 print_simple_box(get_string('localfilepath', 'resource', $CFG->wwwroot.'/user/edit.php?course='.SITEID), 'center');
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('\\'));
35 getElementById('myform').pathname.value = txt;
36 getElementById('myform').submit();
38 //]]>
39 </script>
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 </form>
53 </fieldset>
54 </div>
55 <?php
56 print_footer('empty');