<?php
/**
- *
- * Project Admin: Module of common functions
- *
- * SourceForge: Breaking Down the Barriers to Open Source Development
- * Copyright 1999-2001 (c) VA Linux Systems
- * http://sourceforge.net
- *
- * @version $Id$
- *
- */
+ * Project Admin: Module of common functions
+ *
+ * Portions Copyright 1999-2001 (c) VA Linux Systems
+ * The rest Copyright 2002-2004 (c) GForge Team
+ * http://gforge.org/
+ *
+ * This file is part of GForge.
+ *
+ * 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,
+ * 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
+ */
/*
*/
function project_admin_header($params) {
- global $DOCUMENT_ROOT,$group_id,$feedback;
+ global $group_id,$feedback,$HTML;
$params['toptab']='admin';
$params['group']=$group_id;
- site_project_header($params);
$project =& group_get_object($group_id);
- exit_assert_object($project,'Group');
-
- $perm =& $project->getPermission( session_get_user() );
- exit_assert_object($perm,'Permission');
-
- $is_admin=$perm->isAdmin();
-
- echo '
- <P><B>
- <A HREF="/project/admin/?group_id='.$group_id.'">Admin</A> | ';
-
- // We should show most of the admin menu only to the admins
- if ($is_admin) {
- echo '<A HREF="/project/admin/userperms.php?group_id='.$group_id.'">User Permissions</A> |
- <A HREF="/project/admin/editgroupinfo.php?group_id='.$group_id.'">Edit Public Info</A> |
- <A HREF="/project/admin/history.php?group_id='.$group_id.'">Project History</A> |
- <A HREF="/project/admin/vhost.php?group_id='.$group_id.'">VHOSTs</A> |
- <br>';
+ if (!$project || !is_object($project)) {
+ return;
}
- echo '
- <A HREF="/project/admin/editpackages.php?group_id='.$group_id.'">Edit/Release Files</A>';
-
- // We should show most of the admin menu only to the admins
- if ($is_admin) {
- echo '
- | <A HREF="/people/createjob.php?group_id='.$group_id.'">Post Jobs</A> |
- <A HREF="/people/?group_id='.$group_id.'">Edit Jobs</A> |
- <A HREF="/project/admin/editimages.php?group_id='.$group_id.'">Edit Multimedia Data</A> |
- <A HREF="/project/admin/database.php?group_id='.$group_id.'">Database Admin</A>
- </B>
- <P>';
+ $perm =& $project->getPermission( session_get_user() );
+ if (!$perm || !is_object($perm)) {
+ return;
}
-}
-
-/*
-
- Standard footer to be used on all /project/admin/* pages
-
-*/
-
-function project_admin_footer($params) {
- site_project_footer($params);
-}
-
-
-/*
-
- The following functions are for the FRS (File Release System)
-
-
-*/
-
-
-/*
-
- pop-up box of supported frs statuses
-
-*/
-
-function frs_show_status_popup ($name='status_id', $checked_val="xzxz") {
/*
- return a pop-up select box of statuses
+ Enforce Project Admin Perms
*/
- global $FRS_STATUS_RES;
- if (!isset($FRS_STATUS_RES)) {
- $FRS_STATUS_RES=db_query("SELECT * FROM frs_status");
+ if (!$perm->isAdmin()) {
+ exit_permission_denied();
}
- return html_build_select_box ($FRS_STATUS_RES,$name,$checked_val,false);
-}
-
-/*
-
- pop-up box of supported frs filetypes
-
-*/
-function frs_show_filetype_popup ($name='type_id', $checked_val="xzxz") {
- /*
- return a pop-up select box of the available filetypes
- */
- global $FRS_FILETYPE_RES;
- if (!isset($FRS_FILETYPE_RES)) {
- $FRS_FILETYPE_RES=db_query("SELECT * FROM frs_filetype");
+ site_project_header($params);
+
+ $labels = array();
+ $links = array();
+
+ //$labels[] = _('Admin');
+ $labels[] = _('Edit Public Info');
+ $labels[] = _('Project History');
+ if($GLOBALS['sys_use_people']) {
+ $labels[] = _('Post Jobs');
+ $labels[] = _('Edit Jobs');
}
- return html_build_select_box ($FRS_FILETYPE_RES,$name,$checked_val,true,'Must Choose One');
-}
-
-/*
-
- pop-up box of supported frs processor options
-
-*/
-
-function frs_show_processor_popup ($name='processor_id', $checked_val="xzxz") {
- /*
- return a pop-up select box of the available processors
- */
- global $FRS_PROCESSOR_RES;
- if (!isset($FRS_PROCESSOR_RES)) {
- $FRS_PROCESSOR_RES=db_query("SELECT * FROM frs_processor");
+ if($GLOBALS['sys_use_project_multimedia']) {
+ $labels[] = _('Edit Multimedia Data');
}
- return html_build_select_box ($FRS_PROCESSOR_RES,$name,$checked_val,true,'Must Choose One');
-}
-
-/*
-
- pop-up box of packages:releases for this group
-
-*/
-
-
-function frs_show_release_popup ($group_id, $name='release_id', $checked_val="xzxz") {
- /*
- return a pop-up select box of releases for the project
- */
- global $FRS_RELEASE_RES;
- if (!$group_id) {
- return 'ERROR - GROUP ID REQUIRED';
- } else {
- if (!isset($FRS_RELEASE_RES)) {
- $FRS_RELEASE_RES=db_query("SELECT frs_release.release_id,(frs_package.name || ' : ' || frs_release.name) ".
- "FROM frs_release,frs_package ".
- "WHERE frs_package.group_id='$group_id' ".
- "AND frs_release.package_id=frs_package.package_id");
- echo db_error();
- }
- return html_build_select_box ($FRS_RELEASE_RES,$name,$checked_val,false);
+ if($GLOBALS['sys_use_project_vhost']) {
+ $labels[] = _('VHOSTs');
+ }
+ if($GLOBALS['sys_use_project_database']) {
+ $labels[] = _('Database Admin');
}
+ $labels[] = _('Stats');
+ plugin_hook("quota_label_project_admin");
+
+ //$links[] = '/project/admin/?group_id='.$group_id;
+ $links[] = '/project/admin/editgroupinfo.php?group_id='.$group_id;
+ $links[] = '/project/admin/history.php?group_id='.$group_id;
+ if($GLOBALS['sys_use_people']) {
+ $links[] = '/people/createjob.php?group_id='.$group_id;
+ $links[] = '/people/?group_id='.$group_id;
+ }
+ if($GLOBALS['sys_use_project_multimedia']) {
+ $links[] = '/project/admin/editimages.php?group_id='.$group_id;
+ }
+ if($GLOBALS['sys_use_project_vhost']) {
+ $links[] = '/project/admin/vhost.php?group_id='.$group_id;
+ }
+ if($GLOBALS['sys_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());
}
/*
- pop-up box of packages for this group
+ Standard footer to be used on all /project/admin/* pages
*/
-function frs_show_package_popup ($group_id, $name='package_id', $checked_val="xzxz") {
- /*
- return a pop-up select box of packages for this project
- */
- global $FRS_PACKAGE_RES;
- if (!$group_id) {
- return 'ERROR - GROUP ID REQUIRED';
- } else {
- if (!isset($FRS_PACKAGE_RES)) {
- $FRS_PACKAGE_RES=db_query("SELECT package_id,name
- FROM frs_package WHERE group_id='$group_id'");
- echo db_error();
- }
- return html_build_select_box ($FRS_PACKAGE_RES,$name,$checked_val,false);
- }
+function project_admin_footer($params) {
+ site_project_footer($params);
}
/*
*/
function group_get_history ($group_id=false) {
- $sql="SELECT group_history.field_name,group_history.old_value,group_history.date,users.user_name ".
+ $sql="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='$group_id' ORDER BY group_history.date DESC";
+ "AND group_id='$group_id' ORDER BY group_history.adddate DESC";
return db_query($sql);
-}
+}
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
this group_id
*/
- global $sys_datefmt;
+
$result=group_get_history($group_id);
$rows=db_numrows($result);
if ($rows > 0) {
echo '
- <H3>Group Change History</H3>
- <P>';
+ <h3>'._('Group Change History').'</h3>
+ <p/>';
$title_arr=array();
- $title_arr[]='Field';
- $title_arr[]='Old Value';
- $title_arr[]='Date';
- $title_arr[]='By';
-
- echo html_build_list_table_top ($title_arr);
+ $title_arr[]=_('Field');
+ $title_arr[]=_('Old Value');
+ $title_arr[]=_('Date');
+ $title_arr[]=_('By');
+ echo $GLOBALS['HTML']->listTableTop ($title_arr);
for ($i=0; $i < $rows; $i++) {
$field=db_result($result, $i, 'field_name');
echo '
- <TR BGCOLOR="'. html_get_alt_row_color($i) .'"><TD>'.$field.'</TD><TD>';
+ <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.$field.'</td><td>';
- if ($field=='removed user') {
- echo user_getname(db_result($result, $i, 'old_value'));
+ if (is_numeric(db_result($result, $i, 'old_value'))) {
+ if (ereg("user|User", $field)) {
+ echo user_getname(db_result($result, $i, 'old_value'));
+ } else {
+ echo db_result($result, $i, 'old_value');
+ }
} else {
echo db_result($result, $i, 'old_value');
}
- echo '</TD>'.
- '<TD>'.date($sys_datefmt,db_result($result, $i, 'date')).'</TD>'.
- '<TD>'.db_result($result, $i, 'user_name').'</TD></TR>';
- }
-
- echo '
- </TABLE>';
-
+ 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();
+
} else {
echo '
- <H3>No Changes Have Been Made to This Group</H3>';
- }
-}
+ <h3>'._('No changes').'</h3>';
+ }
+}
/*
prdb_namespace_seek - check that a projects' potential db name hasn't
}
}
- return rnpw;
+ return $rnpw;
}
function permissions_blurb() {
- return '
- <B>NOTE:</B>
-
- <dl>
- <dt><B>Project Admins (bold)</B></dt>
- <dd>can access this page and other project administration pages</dd>
-
- <dt><B>Release Technicians</B></dt>
- <dd>can make the file releases (any project admin also a release technician)</dd>
- '.
-
- /*
- '<dt><B>CVS Admins</B></dt>
- <dd><!-- can --> <i>will</i> be able to access repository files directly (in addition to standard write access)</dd>
- '.
- */
-
- '<dt><B>Tool Technicians (T)</B></dt>
- <dd>can be assigned Bugs/Tasks/Patches</dd>
-
- <dt><B>Tool Admins (A)</B></dt>
- <dd>can make changes to Bugs/Tasks/Patches as well as use the /toolname/admin/ pages</dd>
-
- <dt><B>Tool No Permission (N/A)</B></dt>
- <dd>Developer doesn\'t have specific permission (currently
- equivalent to \'-\')</dd>
-
- <dt><B>Moderators</B> (forums)</dt>
- <dd>can delete messages from the project forums</dd>
-
- <dt><B>Editors</B> (doc. manager)</dt>
- <dd>can update/edit/remove documentation from the project.</dd>
- </dl>
- ';
+ return _('<strong>NOTE:</strong><dl><dt><strong>Project Admins (bold)</strong></dt><dd>can access this page and other project administration pages</dd><dt><strong>Release Technicians</strong></dt><dd>can make the file releases (any project admin also a release technician)</dd><dt><strong>Tool Technicians (T)</strong></dt><dd>can be assigned Bugs/Tasks/Patches</dd><dt><strong>Tool Admins (A)</strong></dt><dd>can make changes to Bugs/Tasks/Patches as well as use the /toolname/admin/ pages</dd><dt><strong>Tool No Permission (N/A)</strong></dt><dd>Developer doesn\'t have specific permission (currently equivalent to \'-\')</dd><dt><strong>Moderators</strong> (forums)</dt><dd>can delete messages from the project forums</dd><dt><strong>Editors</strong> (doc. manager)</dt><dd>can update/edit/remove documentation from the project.</dd></dl>');
}
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
?>