5 * Copyright 2004 (c) Roland Mas, Tim Perdue GForge LLC
6 * http://fusionforge.org
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge 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 along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once '../../env.inc.php';
25 require_once $gfcommon.'include/pre.php';
26 require_once $gfwww.'scm/include/scm_utils.php';
27 require_once $gfcommon.'scm/SCMFactory.class.php';
29 $group_id = getIntFromRequest('group_id');
32 session_require_perm('project_admin', $group_id);
34 if (getStringFromRequest('submit')) {
35 $hook_params = array();
36 $hook_params['group_id'] = $group_id;
39 $scmvars = array_keys(_getRequestArray());
40 foreach (_getRequestArray() as $key => $value) {
41 foreach ($scm_list as $scm) {
42 if ($key == strstr($key, $scm . "_")) {
43 $hook_params[$key] = $value;
46 if ($key == strstr($key, "scm_")) {
47 $hook_params[$key] = $value;
48 } elseif ($key == 'scmradio') {
53 $SCMFactory = new SCMFactory();
54 $scm_plugins = $SCMFactory->getSCMs();
56 if (in_array($scmradio, $scm_plugins)) {
57 $group =& group_get_object($group_id);
59 foreach ($scm_plugins as $plugin) {
60 $myPlugin = plugin_get_object($plugin);
61 if ($scmradio == $myPlugin->name) {
62 $group->setPluginUse($myPlugin->name, 1);
64 $group->setPluginUse($myPlugin->name, 0);
69 plugin_hook("scm_admin_update", $hook_params);
72 scm_header(array('title'=>_('SCM Repository'),'group'=>$group_id));
74 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>">
77 $hook_params = array () ;
78 $hook_params['group_id'] = $group_id ;
79 $group =& group_get_object($group_id);
81 $SCMFactory = new SCMFactory();
82 $scm_plugins = $SCMFactory->getSCMs();
83 if (count($scm_plugins) != 0) {
84 if (count($scm_plugins) == 1) {
85 $myPlugin = plugin_get_object($scm_plugins[0]);
86 echo '<input type="hidden" name="scmradio" value="'.$myPlugin->name.'" />' ;
88 echo '<p>'._('Note: Changing the repository does not delete the previous repository. It only affects the information displayed under the SCM tab.').'</p>';
89 echo '<table><tbody><tr><td><strong>'._('SCM Repository').'</strong></td>';
91 foreach ($scm_plugins as $plugin) {
92 $myPlugin = plugin_get_object($plugin);
93 echo '<td><input type="radio" name="scmradio" ';
94 echo 'value="'.$myPlugin->name.'"';
95 if ($group->usesPlugin($myPlugin->name)) {
96 $scm = $myPlugin->name;
97 echo ' checked="checked"';
99 echo ' />'.$myPlugin->text.'</td>';
101 echo '</tr></tbody></table>'."\n";
104 echo '<p class="error_msg">'._('Error - Site has SCM but no plugins registered').'</p>';
107 (isset($scm)) ? $hook_params['scm_plugin'] = $scm : $hook_params['scm_plugin'] = 0;
108 plugin_hook("scm_admin_page", $hook_params);
110 <input type="hidden" name="group_id" value="<?php echo $group_id; ?>" />
111 <input type="submit" name="submit" value="<?php echo _('Update'); ?>" />
119 // c-file-style: "bsd"