3 * mods/scorm_packages/import.php
5 * This file is part of ATutor, see http://www.atutor.ca
7 * Copyright (C) 2005 Matthai Kurian
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.
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.
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.
24 define('AT_INCLUDE_PATH', '../../include/');
25 require_once(AT_INCLUDE_PATH.'vitals.inc.php');
27 authenticate(AT_PRIV_PACKAGES);
28 define ('PACKAGE_TYPES', 'scorm-1.2');
30 if (isset ($_POST['type'])){
31 $_POST['type'] = $addslashes($_POST['type']);
33 if($_POST['type']!= PACKAGE_TYPES){
34 $error = 'IMPORT_FAILED';
35 $msg->addError($error);
38 if(!$msg->containsErrors()){
39 if (isset ($_POST['type']) ) {
40 require ($_POST['type'] . '/import.php');
44 require(AT_INCLUDE_PATH.'header.inc.php');
50 <div class="input-form">
51 <fieldset class="group_form"><legend class="group_form"><?php echo _AT('import_package'); ?></legend>
52 <form name="form1" method="post"
53 action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data"
54 onsubmit="openWindow('<?php echo AT_BASE_HREF; ?>tools/prog.php');">
56 <?php echo _AT('package_type_info')?>
58 <label for="type"><?php echo _AT('package_type')?></label>
63 $ptypes = explode (',', PACKAGE_TYPES);
64 foreach ($ptypes as $type) {
65 echo '<option value="' . $type . '">' . $type . '</option>';
71 <?php echo _AT('package_upload_file_info')?>
73 <label for="to_file"><?php echo _AT('package_upload_file'); ?></label>
75 <input type="file" name="file" id="to_file" />
78 <?php echo _AT('package_upload_url_info')?>
81 <?php echo _AT('package_upload_url'); ?>
83 <input type="text" name="url" value="http://" size="40" id="to_url" />
86 <div class="row buttons">
87 <input type="submit" name="submit" onClick="setClickSource('submit');" value="<?php echo _AT('import'); ?>" />
88 <input type="submit" name="cancel" onClick="setClickSource('cancel');" value="<?php echo _AT('cancel'); ?>" />
94 <script language="javascript" type="text/javascript">
97 function setClickSource(name) {
101 function openWindow(page) {
102 if (but_src != "cancel") {
103 newWindow = window.open(page, "progWin",
104 "width=400,height=200,toolbar=no,location=no"
111 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>