3 * Site Admin page for approving/rejecting new projects
5 * Copyright 1999-2001 (c) VA Linux Systems
7 * This file is part of GForge.
9 * GForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * GForge 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 GForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 // Show no more pending projects per page than specified here
28 require_once('../env.inc.php');
29 require_once $gfwww.'include/pre.php';
30 require_once $gfcommon.'include/account.php';
31 require_once $gfcommon.'include/license.php';
32 require_once $gfwww.'include/canned_responses.php';
33 require_once $gfwww.'admin/admin_utils.php';
34 require_once $gfwww.'project/admin/project_admin_utils.php';
35 require_once $gfcommon.'tracker/ArtifactTypes.class.php';
36 require_once $gfcommon.'forum/Forum.class.php';
38 session_require(array('group'=>'1','admin_flags'=>'A'));
40 function activate_group($group_id) {
43 $group =& group_get_object($group_id);
45 if (!$group || !is_object($group)) {
46 $feedback .= _('Error creating group object').'<br />';
48 } else if ($group->isError()) {
49 $feedback .= $group->getErrorMessage().'<br />';
54 if ($group->approve(session_get_user())) {
55 $feedback .= sprintf(_('Approving Group: %1$s'), $group->getUnixName()).'<br />';
57 $feedback .= sprintf(_('Error when approving Group: %1$s'), $group->getUnixName()).'<br />';
58 $feedback .= $group->getErrorMessage().'<br />';
62 $hook_params = array () ;
63 $hook_params['group_id'] = $group_id ;
64 plugin_hook ("group_approved", $hook_params) ;
68 plugin_hook('add_cal_group',$group_id);
73 $action = getStringFromRequest('action');
74 if ($action=='activate') {
75 $group_id = getIntFromRequest('group_id');
76 $list_of_groups = getStringFromRequest('list_of_groups');
78 $groups=explode(',', $list_of_groups);
79 array_walk($groups, 'activate_group');
82 plugin_hook('add_cal_group',$group_id);
84 } else if ($action=='delete') {
85 $group_id = getIntFromRequest('group_id');
86 $response_id = getIntFromRequest('response_id');
87 $add_to_can = getStringFromRequest('add_to_can');
88 $response_text = getStringFromRequest('response_text');
89 $response_title = getStringFromRequest('response_title');
92 plugin_hook('del_cal_group',$group_id);
94 $group =& group_get_object($group_id);
95 if (!$group || !is_object($group)) {
96 exit_error('Error','Could Not Get Group');
97 } elseif ($group->isError()) {
98 exit_error('Error',$group->getErrorMessage());
101 if (!$group->setStatus(session_get_user(), 'D')) {
103 _('Error during group rejection'),
104 $this->getErrorMessage()
108 $group->addHistory('rejected', 'x');
110 // Determine whether to send a canned or custom rejection letter and send it
111 if( $response_id == 100 ) {
113 $group->sendRejectionEmail(0, $response_text);
116 add_canned_response($response_title, $response_text);
121 $group->sendRejectionEmail($response_id);
127 site_admin_header(array('title'=>_('Approving Pending Projects')));
129 // get current information
130 $res_grp = db_query_params("SELECT * FROM groups WHERE status='P'", array(), $LIMIT);
132 $rows = db_numrows($res_grp);
135 print "<h1>"._('None Found'). "</h1>";
136 print "<p>"._('No Pending Projects to Approve')."</p>";
137 site_admin_footer(array());
141 if ($rows > $LIMIT) {
142 print "<p>"._('Pending projects:'). "$LIMIT+ ($LIMIT shown)</p>";
144 print "<p>"._('Pending projects:'). "$rows</p>";
147 while ($row_grp = db_fetch_array($res_grp)) {
150 <h2><?php echo $row_grp['group_name']; ?></h2>
153 <h3><?php echo util_make_link ('/admin/groupedit.php?group_id='.$row_grp['group_id'],_('[Edit Project Details]')); ?></h3>
156 <h3><?php echo util_make_link ('/project/admin/?group_id='.$row_grp['group_id'],_('Project Admin')); ?></h3>
159 <h3><?php echo util_make_link ('/admin/userlist.php?group_id='.$row_grp['group_id'],_('[View/Edit Project Members]')); ?></h3>
163 <form name="approve.<?php echo $row_grp['unix_group_name'] ?>" action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
164 <input type="hidden" name="action" value="activate" />
165 <input type="hidden" name="list_of_groups" value="<?php print $row_grp['group_id']; ?>" />
166 <input type="submit" name="submit" value="<?php echo _('Approve'); ?>" />
170 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
171 <input type="hidden" name="action" value="delete" />
172 <input type="hidden" name="group_id" value="<?php print $row_grp['group_id']; ?>" />
173 <?php echo _('Canned responses'); ?><br />
174 <?php print get_canned_responses(); ?> <a href="responses_admin.php"><?php echo _('(manage responses)'); ?></a>
176 <?php echo _('Custom response title and text'); ?><br />
177 <input type="text" name="response_title" size="30" maxlength="25" /><br />
178 <textarea name="response_text" rows="10" cols="50"></textarea>
179 <input type="checkbox" name="add_to_can" value="<?php echo _('yes'); ?>" /><?php echo _('Add this custom response to canned responses') ;?>
181 <input type="submit" name="submit" value="<?php echo _('Reject'); ?>" />
187 <strong><?php echo _('License:')." "; print license_getname($row_grp['license']); ?></strong>
190 global $sys_use_shell;
191 if ($sys_use_shell) {
193 <br /><strong><?php echo _('Home Box:')." "; print $row_grp['unix_box']; ?></strong>
195 } //end of sys_use_shell
197 <br /><strong><?php echo _('HTTP Domain:')." "; print $row_grp['http_domain']; ?></strong>
203 // ########################## OTHER INFO
205 print "<p><strong>" ._('Other Information')."</strong></p>";
206 print "<p>" ._('Unix Group Name:'). " ".$row_grp['unix_group_name']."</p>";
208 print "<p>" ._('Submitted Description:'). "</p><blockquote>".$row_grp['register_purpose']."</blockquote>";
210 if ($row_grp['license']=="other") {
211 print "<p>" ._('License Other:'). "</p><blockquote>".$row_grp['license_other']."</blockquote>";
214 if (isset($row_grp['status_comment'])) {
215 print "<p>" ._('Pending reason:'). "</p><span class=\"important\">".$row_grp['status_comment']."</span>";
218 $res = db_query_params("SELECT u.user_id
219 FROM users u, user_group ug
220 WHERE ug.group_id=$1 AND u.user_id=ug.user_id;", array($row_grp['group_id']));
222 if (db_numrows($res) >= 1) {
223 $submitter =& user_get_object(db_result($res,0,'user_id'));
226 .sprintf(_('Submitted by %1$s (%2$s)'), $submitter->getRealName(), $submitter->getUnixName())
230 echo "<p> </p><hr /><p> </p>";
234 //list of group_id's of pending projects
235 $arr=util_result_column_to_array($res_grp,0);
236 $group_list=implode($arr,',');
240 <form action="'.getStringFromServer('PHP_SELF').'" method="post">
241 <input type="hidden" name="action" value="activate" />
242 <input type="hidden" name="list_of_groups" value="'.$group_list.'" />
243 <input type="submit" name="submit" value="'._('Approve All On This Page').'" />
247 site_admin_footer(array());
251 // c-file-style: "bsd"