* Site Admin page for approving/rejecting new projects
*
* Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 (c) Franck Villaume - Capgemini
+ * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
*
- * This file is part of GForge.
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
*
- * GForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once('../env.inc.php');
require_once $gfcommon.'include/pre.php';
require_once $gfcommon.'include/account.php';
-require_once $gfcommon.'include/license.php';
require_once $gfwww.'include/canned_responses.php';
require_once $gfwww.'admin/admin_utils.php';
require_once $gfwww.'project/admin/project_admin_utils.php';
function activate_group($group_id) {
global $feedback;
+ global $error_msg;
- $group =& group_get_object($group_id);
+ $group = group_get_object($group_id);
if (!$group || !is_object($group)) {
- $feedback .= _('Error creating group object').'<br />';
+ $error_msg .= _('Error creating group object');
return false;
} else if ($group->isError()) {
- $feedback .= $group->getErrorMessage().'<br />';
+ $error_msg .= $group->getErrorMessage();
return false;
}
-
if ($group->approve(session_get_user())) {
- $feedback .= sprintf(_('Approving Group: %1$s'), $group->getUnixName()).'<br />';
+ $feedback .= sprintf(_('Approving Project: %1$s'), $group->getUnixName()).'<br />';
} else {
- $feedback .= sprintf(_('Error when approving Group: %1$s'), $group->getUnixName()).'<br />';
- $feedback .= $group->getErrorMessage().'<br />';
+ $error_msg .= sprintf(_('Error when approving Project: %1$s'), $group->getUnixName()).'<br />';
+ $error_msg .= $group->getErrorMessage();
return false;
}
- $hook_params = array () ;
- $hook_params['group_id'] = $group_id ;
- plugin_hook ("group_approved", $hook_params) ;
-
- //plugin webcalendar
- //create webcal group
- plugin_hook('add_cal_group',$group_id);
-
return true;
}
$action = getStringFromRequest('action');
-if ($action=='activate') {
+if ($action == 'activate') {
$group_id = getIntFromRequest('group_id');
$list_of_groups = getStringFromRequest('list_of_groups');
- $groups=explode(',', $list_of_groups);
+ $groups = explode(',', $list_of_groups);
array_walk($groups, 'activate_group');
- //plugin webcalendar
- //create webcal group
- plugin_hook('add_cal_group',$group_id);
-} else if ($action=='delete') {
+} else if ($action == 'delete') {
$group_id = getIntFromRequest('group_id');
$response_id = getIntFromRequest('response_id');
$add_to_can = getStringFromRequest('add_to_can');
$response_text = getStringFromRequest('response_text');
$response_title = getStringFromRequest('response_title');
- //plugin webcalendar
- //create webcal group
- plugin_hook('del_cal_group',$group_id);
-
- $group =& group_get_object($group_id);
+
+ $group = group_get_object($group_id);
if (!$group || !is_object($group)) {
- exit_error('Error','Could Not Get Group');
+ exit_no_group();
} elseif ($group->isError()) {
- exit_error('Error',$group->getErrorMessage());
+ exit_error($group->getErrorMessage(), 'admin');
}
if (!$group->setStatus(session_get_user(), 'D')) {
- exit_error(
- _('Error during group rejection'),
- $this->getErrorMessage()
- );
+ exit_error(_('Error during group rejection: ').$this->getErrorMessage(), 'admin');
}
$group->addHistory('rejected', 'x');
// Determine whether to send a canned or custom rejection letter and send it
- if( $response_id == 100 ) {
+ if($response_id == 100) {
$group->sendRejectionEmail(0, $response_text);
}
}
-
-site_admin_header(array('title'=>_('Approving Pending Projects')));
+site_admin_header(array('title'=>_('Approving Pending Projects')), 'approve_projects');
// get current information
-$res_grp = db_query_params("SELECT * FROM groups WHERE status='P'", array(), $LIMIT);
+$res_grp = db_query_params("SELECT * FROM groups WHERE status='P' AND is_template!=1", array(), $LIMIT);
$rows = db_numrows($res_grp);
if ($rows < 1) {
- print "<h1>"._('None Found'). "</h1>";
- print "<p>"._('No Pending Projects to Approve')."</p>";
+ print '<p class="information">'._('No Pending Projects to Approve').'</p>';
site_admin_footer(array());
exit;
}
if ($rows > $LIMIT) {
- print "<p>"._('Pending projects:'). "$LIMIT+ ($LIMIT shown)</p>";
+ print '<p>'. _('Pending projects:'). " $LIMIT+ ($LIMIT shown)</p>";
} else {
- print "<p>"._('Pending projects:'). "$rows</p>";
+ print '<p>'. _('Pending projects:'). " $rows</p>";
}
while ($row_grp = db_fetch_array($res_grp)) {
?>
- <h2><?php echo $row_grp['group_name']; ?></h2>
+ <hr />
+ <h2><?php echo _('Pending') . ': <i>'. $row_grp['group_name'] . '</i>'; ?></h2>
<p />
- <h3><?php echo util_make_link ('/admin/groupedit.php?group_id='.$row_grp['group_id'],_('[Edit Project Details]')); ?></h3>
+ <h3><?php echo _('Pre-approval modifications :'); ?></h3>
- <p />
- <h3><?php echo util_make_link ('/project/admin/?group_id='.$row_grp['group_id'],_('Project Admin')); ?></h3>
+ <p><?php echo util_make_link ('/admin/groupedit.php?group_id='.$row_grp['group_id'],_('[Edit Project Details]'));
+ echo _(' or ');
+ echo util_make_link ('/project/admin/?group_id='.$row_grp['group_id'],_('[Project Admin]'));
+ echo _(' or ');
+ echo util_make_link ('/admin/userlist.php?group_id='.$row_grp['group_id'],_('[View/Edit Project Members]')); ?></p>
<p />
- <h3><?php echo util_make_link ('/admin/userlist.php?group_id='.$row_grp['group_id'],_('[View/Edit Project Members]')); ?></h3>
+ <h3><?php echo _('Decision :'); ?></h3>
+ <table><tr class="bottom"><td>
- <p />
- <table><tr><td>
<form name="approve.<?php echo $row_grp['unix_group_name'] ?>" action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
<input type="hidden" name="action" value="activate" />
<input type="hidden" name="list_of_groups" value="<?php print $row_grp['group_id']; ?>" />
<input type="submit" name="submit" value="<?php echo _('Approve'); ?>" />
</form>
- </td></tr>
- <tr><td>
+
+ </td><td><?php echo _(' or '); ?>
+ </td><td>
+
<form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="group_id" value="<?php print $row_grp['group_id']; ?>" />
- <?php echo _('Canned responses'); ?><br />
+ <?php echo _('Rejection canned responses'); ?><br />
<?php print get_canned_responses(); ?> <a href="responses_admin.php"><?php echo _('(manage responses)'); ?></a>
- <br /><br />
+ <br />
<?php echo _('Custom response title and text'); ?><br />
<input type="text" name="response_title" size="30" maxlength="25" /><br />
- <textarea name="response_text" rows="10" cols="50"></textarea>
+ <textarea name="response_text" rows="5" cols="50"></textarea><br />
<input type="checkbox" name="add_to_can" value="<?php echo _('yes'); ?>" /><?php echo _('Add this custom response to canned responses') ;?>
<br />
<input type="submit" name="submit" value="<?php echo _('Reject'); ?>" />
</form>
+
</td></tr>
</table>
- <p>
- <strong><?php echo _('License:')." "; print license_getname($row_grp['license']); ?></strong>
+ <h3><?php echo _('Project details :'); ?></h3>
+ <table>
+ <tr class="top"><td>
<?php
if (forge_get_config('use_shell')) {
- ?>
- <br /><strong><?php echo _('Home Box:')." "; print $row_grp['unix_box']; ?></strong>
+ ?>
+ <strong><?php echo _('Home Box:')."</strong></td><td>"; print $row_grp['unix_box']; ?></tr>
<?php
} //end of sys_use_shell
- ?>
- <br /><strong><?php echo _('HTTP Domain:')." "; print $row_grp['http_domain']; ?></strong>
+ ?>
+ <tr><td><strong><?php echo _('HTTP Domain:')."</strong></td><td>"; print $row_grp['http_domain']; ?></td>
+
+ </tr>
- <br />
- </p>
<?php
// ########################## OTHER INFO
- print "<p><strong>" ._('Other Information')."</strong></p>";
- print "<p>" ._('Unix Group Name:'). " ".$row_grp['unix_group_name']."</p>";
+// print "<p><strong>" ._('Other Information')."</strong></p>";
+ print "<tr><td>" ._('Unix Project Name:'). "</td><td>".$row_grp['unix_group_name']."</td></tr>";
+
+ print "<tr><td>" ._('Submitted Description:'). "</td><td><blockquote>".$row_grp['short_description']."</blockquote></td></tr>";
- print "<p>" ._('Submitted Description:'). "</p><blockquote>".$row_grp['register_purpose']."</blockquote>";
+ print "<tr><td>" ._('Purpose of submission:'). "</td><td><blockquote>".$row_grp['register_purpose']."</blockquote></td></tr>";
if ($row_grp['license']=="other") {
- print "<p>" ._('License Other:'). "</p><blockquote>".$row_grp['license_other']."</blockquote>";
+ print "<tr><td>" ._('License Other:'). "</td><td><blockquote>".$row_grp['license_other']."</blockquote></td></tr>";
}
if (isset($row_grp['status_comment'])) {
- print "<p>" ._('Pending reason:'). "</p><span class=\"important\">".$row_grp['status_comment']."</span>";
+ print "<tr><td>" ._('Pending reason:'). "</td><td><span class=\"important\">".$row_grp['status_comment']."</span></td></tr>";
}
- $res = db_query_params("SELECT u.user_id
- FROM users u, user_group ug
- WHERE ug.group_id=$1 AND u.user_id=ug.user_id;", array($row_grp['group_id']));
-
- if (db_numrows($res) >= 1) {
- $submitter =& user_get_object(db_result($res,0,'user_id'));
-
- echo '<p>'
- .sprintf(_('Submitted by %1$s (%2$s)'), $submitter->getRealName(), $submitter->getUnixName())
- .'</p>' ;
+ $submitter = NULL ;
+ $project = group_get_object ($row_grp['group_id']) ;
+ foreach (get_group_join_requests ($project) as $gjr) {
+ $submitter = user_get_object($gjr->getUserID()) ;
+ echo '<tr><td>'
+ ._('Submitted by') .'</td><td>'. make_user_link($submitter->getUnixName(),$submitter->getRealName())
+ .'</td></tr>';
}
-
- echo "<p> </p><hr /><p> </p>";
+ if ($row_grp['built_from_template']) {
+ $templateproject = group_get_object ($row_grp['built_from_template']) ;
+ print "<tr><td>" . _('Based on template project') . '</td><td>'. $templateproject->getPublicName() .' ('. $templateproject->getUnixName().")</td></tr>";
+ }
+
+ echo "</table><hr />";
}
//list of group_id's of pending projects
-$arr=util_result_column_to_array($res_grp,0);
-$group_list=implode($arr,',');
+$arr = util_result_column_to_array($res_grp, 0);
+$group_list = implode($arr, ',');
echo '
- <div align="center">
<form action="'.getStringFromServer('PHP_SELF').'" method="post">
+ <p class="align-center">
<input type="hidden" name="action" value="activate" />
<input type="hidden" name="list_of_groups" value="'.$group_list.'" />
<input type="submit" name="submit" value="'._('Approve All On This Page').'" />
- </form></div>
+ </p>
+ </form>
';
site_admin_footer(array());