tagging as ATutor 1.5.4-release
[atutor.git] / tools / packages / import.php
1 <?php
2 /*
3  * tools/packages/import.php
4  *
5  * This file is part of ATutor, see http://www.atutor.ca
6  * 
7  * Copyright (C) 2005  Matthai Kurian 
8  * 
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  * 
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  */
23
24 define('AT_INCLUDE_PATH', '../../include/');
25 require_once(AT_INCLUDE_PATH.'vitals.inc.php');
26
27 define ('PACKAGE_TYPES', 'scorm-1.2');
28
29 if (isset ($_POST['type'])) {
30         require ($_POST['type'] . '/import.php');
31 }
32
33 require(AT_INCLUDE_PATH.'header.inc.php');
34
35 ?>
36
37 <div class="input-form">
38 <form name="form1" method="post"
39       action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data"
40       onsubmit="openWindow('<?php echo AT_BASE_HREF; ?>tools/prog.php');">
41
42         <?php echo _AT('package_type_info')?>
43         <div class="row">
44         <label for="type"><?php echo _AT('package_type')?></label>
45         <br />
46         <select name="type">
47
48         <?php
49         $ptypes = explode (',', PACKAGE_TYPES);
50         foreach ($ptypes as $type) {
51                 echo '<option value="' . $type . '">' . $type . '</option>';
52         }
53         ?>
54         </select>
55         </div>
56
57         <?php echo _AT('package_upload_file_info')?>
58         <div class="row">
59         <label for="to_file"><?php echo _AT('package_upload_file'); ?></label>
60         <br />
61         <input type="file" name="file" id="to_file" />
62         </div>
63
64         <?php echo _AT('package_upload_url_info')?>
65         <div class="row">
66         <label for="to_url">
67         <?php echo _AT('package_upload_url'); ?>
68         </label><br />
69         <input type="text" name="url" value="http://" size="40" id="to_url" />
70         </div>
71
72         <div class="row buttons">
73         <input type="submit" name="submit" onClick="setClickSource('submit');" value="<?php echo _AT('import'); ?>" />
74         <input type="submit" name="cancel" onClick="setClickSource('cancel');" value="<?php echo _AT('cancel'); ?>" />
75         </div>
76
77
78 </form>
79 </div>
80 <script language="javascript" type="text/javascript">
81
82 var but_src;
83 function setClickSource(name) {
84         but_src = name;
85 }
86
87 function openWindow(page) {
88         if (but_src != "cancel") {
89                 newWindow = window.open(page, "progWin",
90                         "width=400,height=200,toolbar=no,location=no"
91                 );
92                 newWindow.focus();
93         }
94 }
95 </script>
96
97 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>