3 * Site Admin page for approving/rejecting new projects
5 * Copyright 1999-2001 (c) VA Linux Systems
9 * This file is part of GForge.
11 * GForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * GForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with GForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 // Show no more pending projects per page than specified here
30 require_once('../env.inc.php');
31 require_once('pre.php');
32 require_once('common/include/account.php');
33 require_once('common/include/license.php');
34 require_once('www/include/canned_responses.php');
35 require_once('www/admin/admin_utils.php');
36 require_once('www/project/admin/project_admin_utils.php');
37 require_once('common/tracker/ArtifactTypes.class');
38 require_once('common/forum/Forum.class');
40 session_require(array('group'=>'1','admin_flags'=>'A'));
42 function activate_group($group_id) {
46 $group =& group_get_object($group_id);
48 if (!$group || !is_object($group)) {
49 $feedback .= $Language->getText('admin_approve_pending','error_creating_group').'<br />';
51 } else if ($group->isError()) {
52 $feedback .= $group->getErrorMessage().'<br />';
56 $feedback .= $Language->getText('admin_approve_pending','approving_group'). $group->getUnixName().'<br />';
58 if (!$group->approve(session_get_user())) {
59 $feedback .= $group->getErrorMessage().'<br />';
63 $hook_params = array () ;
64 $hook_params['group_id'] = $group_id ;
65 plugin_hook ("group_approved", $hook_params) ;
69 plugin_hook('add_cal_group',$group_id);
74 $action = getStringFromRequest('action');
75 if ($action=='activate') {
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 $Language->getText('admin_approve_pending','error_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'=>$Language->getText('admin_approve_pending','approving_pending_projects')));
129 // get current information
130 $res_grp = db_query("SELECT * FROM groups WHERE status='P'", $LIMIT);
132 $rows = db_numrows($res_grp);
135 print "<h1>".$Language->getText('admin_approve_pending','none_found'). "</h1>";
136 print "<p>".$Language->getText('admin_approve_pending','no_pending_projects_to_approve')."</p>";
137 site_admin_footer(array());
141 if ($rows > $LIMIT) {
142 print "<p>".$Language->getText('admin_approve_pending','pending_projects'). "$LIMIT+ ($LIMIT shown)</p>";
144 print "<p>".$Language->getText('admin_approve_pending','pending_projects'). "$rows</p>";
147 while ($row_grp = db_fetch_array($res_grp)) {
150 <h2><?php echo $row_grp['group_name']; ?></h2>
153 <h3><a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/admin/groupedit.php?group_id=<?php echo $row_grp['group_id']; ?>"><?php echo $Language->getText('admin_approve_pending','edit_project_details'); ?></a></h3>
156 <h3><a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/project/admin/?group_id=<?php echo $row_grp['group_id']; ?>"><?php echo $Language->getText('admin_approve_pending','project_admin'); ?></a></h3>
159 <h3><a href="userlist.php?group_id=<?php print $row_grp['group_id']; ?>"><?php echo $Language->getText('admin_approve_pending','view_edit_project_members'); ?></a></h3>
163 <form 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 $Language->getText('admin_approve_pending','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 $Language->getText('admin_approve_pending','canned_responses'); ?><br />
174 <?php print get_canned_responses(); ?> <a href="responses_admin.php"><?php echo $Language->getText('admin_approve_pending','manage_responses'); ?></a>
176 <?php echo $Language->getText('admin_approve_pending','custom_response_title'); ?><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 $Language->getText('admin','yes'); ?>" /><?php echo $Language->getText('admin_approve_pending','add_this_custom_response') ;?>
181 <input type="submit" name="submit" value="<?php echo $Language->getText('admin','reject'); ?>" />
187 <strong><?php echo $Language->getText('admin','license')." "; print license_getname($row_grp['license']); ?></strong>
190 global $sys_use_shell;
191 if ($sys_use_shell) {
193 <br /><strong><?php echo $Language->getText('admin_approve_pending','home_box')." "; print $row_grp['unix_box']; ?></strong>
195 } //end of sys_use_shell
197 <br /><strong><?php echo $Language->getText('admin','http_domain')." "; print $row_grp['http_domain']; ?></strong>
203 // ########################## OTHER INFO
205 print "<p><strong>" .$Language->getText('admin_approve_pending','other_information')."</strong></p>";
206 print "<p>" .$Language->getText('admin_approve_pending','unix_group_name'). " ".$row_grp['unix_group_name']."</p>";
208 print "<p>" .$Language->getText('admin_approve_pending','submitted_description'). "</p><blockquote>".$row_grp['register_purpose']."</blockquote>";
210 if ($row_grp['license']=="other") {
211 print "<p>" .$Language->getText('admin','license_other'). "</p><blockquote>".$row_grp['license_other']."</blockquote>";
214 if ($row_grp['status_comment']) {
215 print "<p>" .$Language->getText('admin_approve_pending','pending_reason'). "</p><span class=\"important\">".$row_grp['status_comment']."</span>";
218 echo "<p> </p><hr /><p> </p>";
222 //list of group_id's of pending projects
223 $arr=util_result_column_to_array($res_grp,0);
224 $group_list=implode($arr,',');
228 <form action="'.getStringFromServer('PHP_SELF').'" method="post">
229 <input type="hidden" name="action" value="activate" />
230 <input type="hidden" name="list_of_groups" value="'.$group_list.'" />
231 <input type="submit" name="submit" value="'.$Language->getText('admin_approve_pending','approve_all_on_this_page').'" />
235 site_admin_footer(array());