2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2006 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);
19 $dir_name = str_replace(array('.','..'), '', $_GET['mod_dir']);
23 if (isset($_GET['enabled']) && $_GET['enabled']) { $args .= 'enabled=1'; }
24 if (isset($_GET['disabled']) && $_GET['disabled']) { $args .= SEP.'disabled=1'; }
25 if (isset($_GET['missing']) && $_GET['missing']) { $args .= SEP.'missing=1'; }
26 if (isset($_GET['core']) && $_GET['core']) { $args .= SEP.'core=1'; }
27 if (isset($_GET['standard']) && $_GET['standard']) { $args .= SEP.'standard=1'; }
28 if (isset($_GET['extra']) && $_GET['extra']) { $args .= SEP.'extra=1'; }
30 if (isset($_GET['reset_filter'])) {
31 header('Location: '.$_SERVER['PHP_SELF']);
35 if (isset($_GET['mod_dir'], $_GET['enable'])) {
36 $module =& $moduleFactory->getModule($_GET['mod_dir']);
37 if (!$module->isEnabled() && !$module->isCore() && !$module->isMissing()) {
39 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
42 header('Location: '.$_SERVER['PHP_SELF'] . '?' . $args);
44 } else if (isset($_GET['mod_dir'], $_GET['disable'])) {
45 $module =& $moduleFactory->getModule($_GET['mod_dir']);
46 if ($module->isCore()) {
47 // core modules cannot be disabled!
48 $msg->addError('DISABLE_CORE_MODULE');
49 } else if ($module->isMissing()) {
50 $msg->addError('DISABLE_MISSING_MODULE');
51 } else if ($module->isEnabled()) {
53 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
55 header('Location: '.$_SERVER['PHP_SELF'] . '?' . $args);
57 } else if (isset($_GET['mod_dir'], $_GET['details'])) {
58 header('Location: details.php?mod='.$_GET['mod_dir'] . SEP . $args);
61 } else if (isset($_GET['disable']) || isset($_GET['enable']) || isset($_GET['details'])) {
62 $msg->addError('NO_ITEM_SELECTED');
63 header('Location: '.$_SERVER['PHP_SELF'] . '?' . $args);
67 require(AT_INCLUDE_PATH.'header.inc.php');
69 $module_status_bits = $module_type_bits = 0;
71 if (isset($_GET['enabled'])) { $module_status_bits += AT_MODULE_STATUS_ENABLED; }
72 if (isset($_GET['disabled'])) { $module_status_bits += AT_MODULE_STATUS_DISABLED; }
73 if (isset($_GET['missing'])) { $module_status_bits += AT_MODULE_STATUS_MISSING; }
75 if (isset($_GET['core'])) { $module_type_bits += AT_MODULE_TYPE_CORE; }
76 if (isset($_GET['standard'])) { $module_type_bits += AT_MODULE_TYPE_STANDARD; }
77 if (isset($_GET['extra'])) { $module_type_bits += AT_MODULE_TYPE_EXTRA; }
79 if ($module_status_bits == 0) {
80 $module_status_bits = AT_MODULE_STATUS_DISABLED | AT_MODULE_STATUS_ENABLED | AT_MODULE_STATUS_MISSING;
81 $_GET['enabled'] = $_GET['disabled'] = $_GET['missing'] = 1;
84 if ($module_type_bits == 0) {
85 $module_type_bits = AT_MODULE_TYPE_STANDARD + AT_MODULE_TYPE_EXTRA;
86 $_GET['standard'] = $_GET['extra'] = 1;
90 $module_list = $moduleFactory->getModules($module_status_bits, $module_type_bits, $sort = TRUE);
91 $keys = array_keys($module_list);
93 <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
94 <div class="input-form">
96 <h3><?php echo _AT('results_found', count($keys)); ?></h3>
100 <?php echo _AT('type'); ?><br />
101 <input type="checkbox" name="core" value="1" id="t0" <?php if (isset($_GET['core'])) { echo 'checked="checked"'; } ?> /><label for="t0"><?php echo _AT('core'); ?></label>
103 <input type="checkbox" name="standard" value="1" id="t1" <?php if (isset($_GET['standard'])) { echo 'checked="checked"'; } ?> /><label for="t1"><?php echo _AT('standard'); ?></label>
105 <input type="checkbox" name="extra" value="1" id="t2" <?php if (isset($_GET['extra'])) { echo 'checked="checked"'; } ?> /><label for="t2"><?php echo _AT('extra'); ?></label>
110 <?php echo _AT('status'); ?><br />
111 <input type="checkbox" name="enabled" value="1" id="s0" <?php if (isset($_GET['enabled'])) { echo 'checked="checked"'; } ?> /><label for="s0"><?php echo _AT('enabled'); ?></label>
113 <input type="checkbox" name="disabled" value="1" id="s1" <?php if (isset($_GET['disabled'])) { echo 'checked="checked"'; } ?> /><label for="s1"><?php echo _AT('disabled'); ?></label>
115 <input type="checkbox" name="missing" value="1" id="s2" <?php if (isset($_GET['missing'])) { echo 'checked="checked"'; } ?> /><label for="s2"><?php echo _AT('missing'); ?></label>
118 <div class="row buttons">
119 <input type="submit" name="filter" value="<?php echo _AT('filter'); ?>" />
120 <input type="submit" name="reset_filter" value="<?php echo _AT('reset_filter'); ?>" />
125 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get" name="form">
127 <input type="hidden" name="enabled" value="<?php echo (int) isset($_GET['enabled']); ?>" />
128 <input type="hidden" name="disabled" value="<?php echo (int) isset($_GET['disabled']); ?>" />
129 <input type="hidden" name="core" value="<?php echo (int) isset($_GET['core']); ?>" />
130 <input type="hidden" name="standard" value="<?php echo (int) isset($_GET['standard']); ?>" />
131 <input type="hidden" name="extra" value="<?php echo (int) isset($_GET['extra']); ?>" />
132 <input type="hidden" name="missing" value="<?php echo (int) isset($_GET['missing']); ?>" />
134 <table class="data" summary="" rules="cols">
141 <th scope="col"> </th>
142 <th scope="col"><?php echo _AT('module_name'); ?></th>
143 <th scope="col"><?php echo _AT('type'); ?></th>
144 <th scope="col"><?php echo _AT('status'); ?></th>
145 <th scope="col"><?php echo _AT('cron'); ?></th>
146 <th scope="col"><?php echo _AT('directory_name'); ?></th>
152 <input type="submit" name="details" value="<?php echo _AT('details'); ?>" />
153 <input type="submit" name="enable" value="<?php echo _AT('enable'); ?>" />
154 <input type="submit" name="disable" value="<?php echo _AT('disable'); ?>" />
159 <?php foreach($keys as $dir_name) : $module =& $module_list[$dir_name]; ?>
161 <tr onmousedown="document.form['t_<?php echo $dir_name; ?>'].checked = true; rowselect(this);" id="r_<?php echo $dir_name; ?>">
162 <td valign="top"><input type="radio" id="t_<?php echo $dir_name; ?>" name="mod_dir" value="<?php echo $dir_name; ?>" /></td>
163 <td nowrap="nowrap" valign="top"><label for="t_<?php echo $dir_name; ?>"><?php echo $module->getName(); ?></label></td>
164 <td valign="top"><?php
165 if ($module->isCore()) {
166 echo '<strong>'._AT('core').'</strong>';
167 } else if ($module->isStandard()) {
168 echo _AT('standard');
173 <td valign="top"><?php
174 if ($module->isEnabled()) {
176 } else if ($module->isMissing()) {
177 echo '<strong>'._AT('missing').'</strong>';
179 echo '<em>'._AT('disabled').'</em>';
182 <td valign="top" align="center">
183 <?php if ($module->getCronInterval()): ?>
184 <?php echo _AT('minutes', $module->getCronInterval()); ?>
189 <td valign="top"><code><?php echo $dir_name; ?>/</code></td>
192 <?php if (!$keys): ?>
194 <td colspan="6"><?php echo _AT('none_found'); ?></td>
201 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>