*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2002-2004 (c) GForge Team
+ * Copyright 2011, Franck Villaume - Capgemini
+ * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
- * 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 License, or
- * (at your option) any later version.
+ * 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.
*
* 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 FusionForge; 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.
*/
-
/*
Standard header to be used on all /project/admin/* pages
*/
function project_admin_header($params) {
- global $group_id,$feedback,$HTML;
+ global $group_id, $feedback, $HTML;
- $params['toptab']='admin';
- $params['group']=$group_id;
+ $params['toptab'] = 'admin';
+ $params['group'] = $group_id;
- session_require_perm ('project_admin', $group_id) ;
+ session_require_perm('project_admin', $group_id);
- $project =& group_get_object($group_id);
+ $project = group_get_object($group_id);
if (!$project || !is_object($project)) {
return;
}
- site_project_header($params);
-
$labels = array();
$links = array();
-
- $labels[] = _('Project Info');
+ $attr_r = array();
+
+ $labels[] = _('Project Information');
+ $attr_r[] = array('class' => 'tabtitle', 'title' => _('General information about project. Tag, trove list, description.'));
+ $links[] = '/project/admin/?group_id='.$group_id;
+
$labels[] = _('Users and permissions');
+ $attr_r[] = array('class' => 'tabtitle', 'title' => _('Permissions management. Edit / Create roles. Assign new permissions to user. Add / Remove member.'));
+ $links[] = '/project/admin/users.php?group_id='.$group_id;
+
$labels[] = _('Tools');
+ $attr_r[] = array('class' => 'tabtitle', 'title' => _('Activate / Desactivate extensions like docman, forums, plugins.'));
+ $links[] = '/project/admin/tools.php?group_id='.$group_id;
+
$labels[] = _('Project History');
+ $attr_r[] = array('class' => 'tabtitle', 'title' => _('Show the significant change of your project.'));
+ $links[] = '/project/admin/history.php?group_id='.$group_id;
+
if(forge_get_config('use_people')) {
$labels[] = _('Post Jobs');
+ $attr_r[] = array('class' => 'tabtitle', 'title' => _('Hiring new people. Describe the job'));
+ $links[] = '/people/createjob.php?group_id='.$group_id;
$labels[] = _('Edit Jobs');
+ $attr_r[] = array('class' => 'tabtitle', 'title' => _('Edit already created available position in your project.'));
+ $links[] = '/people/?group_id='.$group_id;
}
+
if(forge_get_config('use_project_multimedia')) {
$labels[] = _('Edit Multimedia Data');
+ //TODO: set the title.
+ $attr_r[] = array('class' => 'tabtitle', 'title' => '');
+ $links[] = '/project/admin/editimages.php?group_id='.$group_id;
}
if(forge_get_config('use_project_vhost')) {
$labels[] = _('VHOSTs');
+ //TODO: set the title.
+ $attr_r[] = array('class' => 'tabtitle', 'title' => '');
+ $links[] = '/project/admin/vhost.php?group_id='.$group_id;
}
if(forge_get_config('use_project_database')) {
$labels[] = _('Database Admin');
+ //TODO: set the title.
+ $attr_r[] = array('class' => 'tabtitle', 'title' => '');
+ $links[] = '/project/admin/database.php?group_id='.$group_id;
}
if ($project->usesStats()) {
$labels[] = _('Stats');
+ //TODO: set the title.
+ $attr_r[] = array('class' => 'tabtitle', 'title' => '');
+ $links[] = '/project/stats/?group_id='.$group_id;
}
- plugin_hook("quota_label_project_admin");
-
- $links[] = '/project/admin/?group_id='.$group_id;
- $links[] = '/project/admin/users.php?group_id='.$group_id;
- $links[] = '/project/admin/tools.php?group_id='.$group_id;
- $links[] = '/project/admin/history.php?group_id='.$group_id;
- if(forge_get_config('use_people')) {
- $links[] = '/people/createjob.php?group_id='.$group_id;
- $links[] = '/people/?group_id='.$group_id;
- }
- if(forge_get_config('use_project_multimedia')) {
- $links[] = '/project/admin/editimages.php?group_id='.$group_id;
- }
- if(forge_get_config('use_project_vhost')) {
- $links[] = '/project/admin/vhost.php?group_id='.$group_id;
- }
- if(forge_get_config('use_project_database')) {
- $links[] = '/project/admin/database.php?group_id='.$group_id;
- }
- $links[] = '/project/stats/?group_id='.$group_id;
- plugin_hook("quota_link_project_admin");
-
- echo ($HTML->beginSubMenu());
- echo $HTML->printSubMenu($labels, $links);
- plugin_hook ("groupadminmenu", $params) ;
- echo ($HTML->endSubMenu());
+
+ $params['labels'] =& $labels;
+ $params['links'] =& $links;
+ $params['attr_r'] =& $attr_r;
+ plugin_hook("groupadminmenu", $params);
+ $params['submenu'] = $HTML->subMenu($params['labels'], $params['links'], $params['attr_r']);
+ site_project_header($params);
}
/*
*/
-function project_admin_footer($params) {
+function project_admin_footer($params=array()) {
site_project_footer($params);
}
*/
function group_get_history ($group_id=false) {
-return db_query_params("SELECT group_history.field_name,group_history.old_value,group_history.adddate,users.user_name
-FROM group_history,users
-WHERE group_history.mod_by=users.user_id
+ return db_query_params("SELECT group_history.field_name,group_history.old_value,group_history.adddate,users.user_name
+FROM group_history,users
+WHERE group_history.mod_by=users.user_id
AND group_id=$1 ORDER BY group_history.adddate DESC", array($group_id));
-}
-
+}
+
function group_add_history ($field_name,$old_value,$group_id) {
$group=group_get_object($group_id);
$group->addHistory($field_name,$old_value);
-}
+}
/*
*/
function show_grouphistory ($group_id) {
- /*
- show the group_history rows that are relevant to
+ /*
+ show the group_history rows that are relevant to
this group_id
*/
- echo '<h1>'._('Project History').'</h1>';
-
$result=group_get_history($group_id);
$rows=db_numrows($result);
-
+
if ($rows > 0) {
-
+
echo '<p>'._('This log will show who made significant changes to your project and when').'</p>';
$title_arr=array();
$title_arr[]=_('Old Value');
$title_arr[]=_('Date');
$title_arr[]=_('By');
-
+
echo $GLOBALS['HTML']->listTableTop ($title_arr);
- for ($i=0; $i < $rows; $i++) {
+ for ($i=0; $i < $rows; $i++) {
$field=db_result($result, $i, 'field_name');
echo '
<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.$field.'</td><td>';
-
+
if (is_numeric(db_result($result, $i, 'old_value'))) {
if (preg_match("/[Uu]ser/i", $field)) {
echo user_getname(db_result($result, $i, 'old_value'));
}
} else {
echo db_result($result, $i, 'old_value');
- }
+ }
echo '</td>'.
'<td>'.date(_('Y-m-d H:i'),db_result($result, $i, 'adddate')).'</td>'.
'<td>'.db_result($result, $i, 'user_name').'</td></tr>';
- }
+ }
echo $GLOBALS['HTML']->listTableBottom();
/*
prdb_namespace_seek - check that a projects' potential db name hasn't
- already been used. If it has - add a 1..20 to the end of it. If it
- iterates through twenty times and still fails - namespace depletion -
+ already been used. If it has - add a 1..20 to the end of it. If it
+ iterates through twenty times and still fails - namespace depletion -
throw an error.
*/
$curr_num = 1;
while ((db_numrows($res_dbl) > 0) && ($curr_num < 20)) {
-
+
$curr_num++;
$namecheck .= $namecheck.$curr_num;
-
+
$res_dbl = db_query_params($query, array($namecheck));
}
} //end prdb_namespace_seek()
function random_pwgen() {
-
- srand ( (double) microtime()*10000000);
- $rnpw = "";
-
- for ($i = 0; $i < 10; $i++) {
-
- $rn = rand(1,2);
-
- if ($rn == 1) {
- $rnpw .= rand(1,9);
- } else {
- $rnpw .= chr(rand(65,122));
- }
-
- }
- return $rnpw;
+ return (substr(strtr(base64_encode(util_randbytes(9)), '+', '.'),
+ 0, 10));
}
function permissions_blurb() {