5 * Copyright 2004 (c) Roland Mas, GForge LLC
7 * @author Tim Perdue tim@gforge.org
10 * This file is part of GForge.
12 * GForge is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * GForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with GForge; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 require_once('../../env.inc.php');
28 require_once $gfwww.'include/pre.php';
29 require_once $gfwww.'scm/include/scm_utils.php';
30 require_once $gfcommon.'scm/SCMFactory.class.php';
34 $group_id = getIntFromRequest('group_id');
37 session_require_perm ('project_admin', $group_id) ;
39 scm_header(array('title'=>_('SCM Repository'),'group'=>$group_id));
41 if (getStringFromRequest('submit')) {
42 $hook_params = array ();
43 $hook_params['group_id'] = $group_id;
46 $scmvars = array_keys (_getRequestArray());
47 foreach (_getRequestArray() as $key => $value) {
48 foreach ($scm_list as $scm) {
49 if ($key == strstr($key, $scm . "_")) {
50 $hook_params[$key] = $value;
53 if ($key == strstr($key, "scm_")) {
54 $hook_params[$key] = $value;
55 } elseif ($key == 'scmradio') {
60 $SCMFactory = new SCMFactory();
61 $scm_plugins = $SCMFactory->getSCMs();
63 if (in_array($scmradio, $scm_plugins)) {
64 $group =& group_get_object($group_id);
66 foreach ($scm_plugins as $plugin) {
67 $myPlugin = plugin_get_object($plugin);
68 if ($scmradio == $myPlugin->name) {
69 $group->setPluginUse($myPlugin->name, 1);
71 $group->setPluginUse($myPlugin->name, 0);
76 plugin_hook ("scm_admin_update", $hook_params);
80 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>">
83 $hook_params = array () ;
84 $hook_params['group_id'] = $group_id ;
85 $group =& group_get_object($group_id);
87 $SCMFactory = new SCMFactory();
88 $scm_plugins = $SCMFactory->getSCMs();
89 if (count($scm_plugins) != 0) {
90 if (count($scm_plugins) > 1) {
91 echo '<p>'._('Note: Changing the repository does not delete the previous repository. It only affects the information displayed under the SCM tab.').'</p>';
92 echo '<table><tbody><tr><td><strong>'._('SCM Repository').'</strong></td>';
94 foreach ($scm_plugins as $plugin) {
95 $myPlugin = plugin_get_object($plugin);
96 echo '<td><input type="radio" name="scmradio" ';
97 echo 'value="'.$myPlugin->name.'"';
98 if ($group->usesPlugin($myPlugin->name)) {
99 $scm = $myPlugin->name;
100 echo ' checked="checked"';
102 echo '>'.$myPlugin->text.'</td>';
104 echo '</tr></tbody></table>'."\n";
107 echo '<p>'._('Error - Site has SCM but no plugins registered').'</p>';
110 plugin_hook ("scm_admin_page", $hook_params) ;
112 <input type="hidden" name="group_id" value="<?php echo $group_id; ?>" />
113 <input type="submit" name="submit" value="<?php echo _('Update'); ?>" />
121 // c-file-style: "bsd"