2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto */
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. */
12 /************************************************************************/
15 define('AT_INCLUDE_PATH', '../../include/');
16 require (AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
18 require(AT_INCLUDE_PATH.'classes/Module/ModuleListParser.class.php');
20 if (isset($_POST["cancel"]))
22 header('Location: '.AT_BASE_HREF.'admin/modules/install_modules.php');
26 // check the connection to server update.atutor.ca
27 $update_server = "update.atutor.ca";
28 $connection_test_file = "http://" . $update_server . '/index.php';
29 $connection = @file_get_contents($connection_test_file);
33 $infos = array('CANNOT_CONNECT_SERVER', $update_server);
34 $msg->addError($infos);
36 require(AT_INCLUDE_PATH.'header.inc.php');
38 require(AT_INCLUDE_PATH.'footer.inc.php');
42 if (isset($_GET["id"])) $id = intval($_GET["id"]);
43 else if (isset($_POST["id"])) $id = intval($_POST["id"]);
46 $module_folder = "http://" . $update_server . '/modules/';
48 $module_list_xml = @file_get_contents($module_folder . 'module_list.xml');
52 $moduleListParser = new ModuleListParser();
53 $moduleListParser->parse($module_list_xml);
54 $module_list_array = $moduleListParser->getParsedArray();
56 // end of get module list
58 $module_content_folder = AT_CONTENT_DIR . "module";
60 //debug($_POST["vid"]);
63 if (isset($_POST["download"]) && !isset($_POST["vid"]))
65 $msg->addError('NO_ITEM_SELECTED');
67 else if ($_POST['download'])
69 $vid = intval($_POST['vid']);
70 $file_content = @file_get_contents($module_folder . $module_list_array[$id]['history'][$vid]['location'].$module_list_array[$id]['history'][$vid]['filename']);
74 $msg->addError('FILE_NOT_EXIST');
78 header('Content-Type: application/x-zip');
79 header('Content-transfer-encoding: binary');
80 header('Content-Disposition: attachment; filename="'.htmlspecialchars($module_list_array[$id]['history'][$vid]['filename']).'"');
82 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
83 header('Pragma: public');
84 header('Content-Length: '.strlen($file_content));
91 require (AT_INCLUDE_PATH.'header.inc.php');
96 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
97 <div class="input-form">
101 <input type="hidden" name="id" value="<?php echo $id; ?>" />
102 <table class="data" summary="" style="width: 100%" rules="cols">
105 <th scope="col"> </th>
106 <th scope="col"><?php echo _AT('version');?></th>
107 <th scope="col"><?php echo _AT('publish_date');?></th>
108 <th scope="col"><?php echo _AT('state');?></th>
109 <th scope="col"><?php echo _AT('maintainers');?></th>
110 <th scope="col"><?php echo _AT('notes');?></th>
117 <input type="submit" name="download" value="<?php echo _AT('download'); ?>" />
118 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
125 $num_of_versions = count($module_list_array[$id]['history']);
127 if ($num_of_versions == 0)
134 echo _AT('none_found');
143 // display version list
144 if(is_array($module_list_array[$id]['history']))
146 for ($i=0; $i < $num_of_versions; $i++)
149 <tr onmousedown="document.form['m<?php echo $i; ?>'].checked = true; rowselect(this);" id="r_<?php echo $i; ?>">
150 <td><input type="radio" name="vid" value="<?php echo $i; ?>" id="m<?php echo $i; ?>" /></td>
151 <td><label for="m<?php echo $i; ?>"><?php echo $module_list_array[$id]["name"] . ' ' .$module_list_array[$id]['history'][$i]["version"]; ?></label></td>
152 <td><?php echo $module_list_array[$id]['history'][$i]["date"]; ?></td>
153 <td><?php echo $module_list_array[$id]['history'][$i]["state"]; ?></td>
154 <td><?php echo $module_list_array[$id]['history'][$i]["maintainer"]; ?></td>
155 <td><?php echo $module_list_array[$id]['history'][$i]["notes"]; ?></td>
173 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>