}
function &group_get_object_by_publicname($groupname) {
- $res=db_query_params ('SELECT * FROM groups WHERE group_name ILIKE $1',
- array (htmlspecialchars ($groupname))) ;
+ $res=db_query_params ('SELECT * FROM groups WHERE lower(group_name) LIKE $1',
+ array (htmlspecialchars (strtolower ($groupname)))) ;
return group_get_object(db_result($res,0,'group_id'),$res);
}
*/
var $membersArr;
- /**
- * Permissions data row from db.
- *
- * @var array $perm_data_array.
- */
- var $perm_data_array;
-
/**
* Whether the use is an admin/super user of this project.
*
/**
* Associative array of data for plugins.
*
- * @var array $plugins_array.
+ * @var array $plugins_data.
+ */
+ var $plugins_data;
+
+
+ /**
+ * Associative array of data for the group menu.
+ *
+ * @var array $menu_data.
*/
- var $plugins_array;
+ var $menu_data;
/**
* Group - Group object constructor - use group_get_object() to instantiate.
* @param string The Unix name of the user.
* @param string The new group description.
* @param string The purpose of the group.
+ * @param bool Whether to send an email or not
*/
- function create(&$user, $group_name, $unix_name, $description, $purpose, $unix_box='shell1', $scm_box='cvs1', $is_public=1) {
+ function create(&$user, $group_name, $unix_name, $description, $purpose, $unix_box='shell1', $scm_box='cvs1', $is_public=1, $send_mail=true) {
// $user is ignored - anyone can create pending group
+ global $SYS;
if ($this->getID()!=0) {
$this->setError(_('Group::create: Group object already exists'));
return false;
} else if (!account_groupnamevalid($unix_name)) {
$this->setError(_('Invalid Unix name'));
return false;
+ } else if (!$SYS->sysUseUnixName($unix_name)) {
+ $this->setError(_('Unix name already taken'));
+ return false;
} else if (db_numrows(db_query_params('SELECT group_id FROM groups WHERE unix_group_name=$1',
array ($unix_name))) > 0) {
$this->setError(_('Unix name already taken'));
plugin_hook ("group_create", $hook_params);
db_commit();
- $this->sendNewProjectNotificationEmail();
+ if ($send_mail) {
+ $this->sendNewProjectNotificationEmail();
+ }
return true;
}
}
* @param string Machine on which group's home directory located.
* @param string Domain which serves group's WWW.
* @return status.
- * @access public.
+ * @access public
*/
function updateAdmin(&$user, $is_public, $type_id, $unix_box, $http_domain) {
$perm =& $this->getPermission($user);
* update - Update number of common properties.
*
* Unlike updateAdmin(), this function accessible to project admin.
+ *
+ * @param object User requesting operation (for access control).
+ * @param bool Whether group is publicly accessible (0/1).
+ * @param string Project's license (string ident).
+ * @param int Group type (1-project, 2-foundry).
+ * @param string Machine on which group's home directory located.
+ * @param string Domain which serves group's WWW.
+ * @return int status.
+ * @access public
*/
function update(&$user, $group_name,$homepage,$short_description,$use_mail,$use_survey,$use_forum,
- $use_pm,$use_pm_depend_box,$use_scm,$use_news,$use_docman,
- $new_doc_address,$send_all_docs,$logo_image_id,
- $use_ftp,$use_tracker,$use_frs,$use_stats,$is_public) {
+ $use_pm,$use_pm_depend_box,$use_scm,$use_news,$use_docman,
+ $new_doc_address,$send_all_docs,$logo_image_id,
+ $use_ftp,$use_tracker,$use_frs,$use_stats,$tags,$is_public) {
$perm =& $this->getPermission($user);
$send_all_docs=0;
}
+ $homepage = ltrim($homepage);
if (!$homepage) {
$homepage=$GLOBALS['sys_default_domain'].'/projects/'.$this->getUnixName().'/';
}
return false;
}
+ if ($this->setTags($tags) === false) {
+ db_rollback();
+ return false;
+ }
+
$hook_params = array ();
$hook_params['group'] = $this;
$hook_params['group_id'] = $this->getID();
* @param object User requesting operation (for access control).
* @param string Status value.
* @return boolean success.
- * @access public.
+ * @access public
*/
function setStatus(&$user, $status) {
global $SYS;
$allowed_status_changes = array(
'AH'=>1,'AD'=>1,'DA'=>1,'PA'=>1,'PD'=>1,
'IP'=>1,'HA'=>1,'HD'=>1
- );
+ );
// Check that status transition is valid
if ($this->getStatus() != $status
}
}
+ function setUsesSCM ($booleanparam) {
+ db_begin () ;
+ $booleanparam = $booleanparam ? 1 : 0 ;
+ $res = db_query_params ('UPDATE groups SET use_scm=$1 WHERE group_id=$2',
+ array ($booleanparam, $this->getID()));
+ if ($res) {
+ $this->data_array['use_scm']=$booleanparam;
+ db_commit () ;
+ } else {
+ db_rollback ();
+ return false;
+ }
+ }
+
/**
* enablePserver - whether or not this group has opted to enable Pserver.
*
return $this->data_array['homepage'];
}
+ /**
+ * getTags - Tags of this project.
+ *
+ * @return string List of tags.
+ */
+ function getTags() {
+ $sql = 'SELECT name FROM project_tags WHERE group_id = $1';
+ $res = db_query_params($sql, array($this->getID()));
+ return join(', ', util_result_column_to_array($res));
+ }
+
+ /**
+ * setTags - Set tags of this project.
+ *
+ * @return string database result.
+ */
+ function setTags($tags) {
+ db_begin();
+ $sql='DELETE FROM project_tags WHERE group_id=$1';
+ $res=db_query_params($sql, array($this->getID()));
+ if (!$res) {
+ $this->setError('Deleting old tags: '.db_error());
+ db_rollback();
+ return false;
+ }
+ $inserted = array();
+ $tags_array = split('[;,]', $tags);
+ foreach ($tags_array as $tag) {
+ $tag = stripslashes($tag);
+ $tag = preg_replace('/[\t\r\n]/', ' ', $tag);
+ // Allowed caracteres: [A-Z][a-z][0-9] -_&'#+.
+ if (preg_match('/[^[:alnum:]| |\-|_|\&|\'|#|\+|\.]/', $tag)) {
+ $this->setError(_('Bad tag name, you only can use the following characters: [A-Z][a-z][0-9]-_&\'#+. and space'));
+ db_rollback();
+ return false;
+ }
+ $tag = trim($tag);
+ $tag = addslashes($tag);
+ if ($tag == '' || array_search($tag, $inserted) !== false) continue;
+ $sql='INSERT INTO project_tags (group_id,name) VALUES ($1, $2)';
+ $res=db_query_params($sql, array($this->getID(), $tag));
+ if (!$res) {
+ $this->setError(_('Setting tags: ').db_error());
+ db_rollback();
+ return false;
+ }
+ $inserted[] = $tag;
+ }
+ db_commit();
+ return true;
+ }
+
/**
* getPermission - Return a Permission for this Group and the specified User.
*
$res = db_query_params ('DELETE FROM doc_groups WHERE group_id=$1',
array ($this->getID())) ;
//echo 'doc_groups'.db_error();
+
+ //
+ // Delete Tags
+ //
+ $res=db_query_params('DELETE FROM project_tags WHERE group_id=$1', array($this->getID()));
+
//
// Delete group history
//
/**
* addUser - controls adding a user to a group.
*
- * @param string Unix name of the user to add OR integer user_id.
+ * @param string Unix name of the user to add OR integer user_id.
* @param int The role_id this user should have.
* @return boolean success.
- * @access public.
+ * @access public
*/
function addUser($user_identifier,$role_id) {
global $SYS;
FROM project_task pt, project_group_list pgl, project_assigned_to pat
WHERE pt.group_project_id = pgl.group_project_id
AND pat.project_task_id=pt.project_task_id
- AND pt.status_id=1 AND pgl.group_id=$1,
+ AND pt.status_id=1 AND pgl.group_id=$1
AND pat.assigned_to_id=$2)
AND assigned_to_id=100',
array ($this->getID(),
db_rollback();
return false;
}
+
+ $hook_params['group'] = $this;
+ $hook_params['group_id'] = $this->getID();
+ $hook_params['user'] = &user_get_object($user_id);
+ $hook_params['user_id'] = $user_id;
+ plugin_hook ("group_removeuser", $hook_params);
+
//audit trail
$this->addHistory('Removed User',$user_id);
}
return false;
}
- $hook_params['group'] = $this;
- $hook_params['group_id'] = $this->getID();
- $hook_params['user'] = &user_get_object($user_id);
- $hook_params['user_id'] = $user_id;
- plugin_hook ("group_removeuser", $hook_params);
$this->addHistory('Updated User',$user_id);
return true;
* @param string The name of the field.
* @param string The Old Value for this $field_name.
* @return database result handle.
- * @access public.
+ * @access public
*/
function addHistory($field_name, $old_value) {
return db_query_params ('INSERT INTO group_history(group_id,field_name,old_value,mod_by,adddate)
* Setup unix accounts for group members. Can be called even
* if members are already active.
*
- * @access private.
+ * @access private
*/
function activateUsers() {
-
+
/*
- Activate member(s) of the project
+ Activate member(s) of the project
*/
$member_res = db_query_params ('SELECT user_id, role_id FROM user_group WHERE group_id=$1',
array ($this->getID())) ;
$rows = db_numrows($member_res);
-
+
if ($rows > 0) {
for ($i=0; $i<$rows; $i++) {
return false;
}
$f = new Forum($this);
- if (!$f->create(_('Developers'),_('Project Developer Discussion'),0,'',1,0)) {
+ if (!$f->create(_('Developers-Discussion'),_('Project Developer Discussion'),0,'',1,0)) {
$this->setError(sprintf (_('F%d: %s'), 3, $f->getErrorMessage()));
db_rollback();
setup_gettext_from_context();
// Set Default Roles
//
//
+
+ $admin_group = db_query_params ('SELECT user_id FROM user_group WHERE group_id=$1 AND admin_flags=$2',
+ array ($this->getID(),
+ 'A')) ;
+ if (db_numrows($admin_group) > 0) {
+ $idadmin_group = db_result($admin_group,0,'user_id');
+ } else {
+ $idadmin_group = $user->getID();
+ db_query_params ('INSERT INTO user_group (user_id, group_id, admin_flags) VALUES ($1, $2, $3)',
+ array ($idadmin_group,
+ $this->getID(),
+ 'A')) ;
+ }
+
$role = new Role($this);
$todo = array_keys($role->defaults);
for ($c=0; $c<count($todo); $c++) {
$role = new Role($this);
- if (!$role->createDefault($todo[$c])) {
+ if (! ($role_id = $role->createDefault($todo[$c]))) {
$this->setError(sprintf(_('R%d: %s'),$c,$role->getErrorMessage()));
db_rollback();
setup_gettext_from_context();
return false;
}
+ $role = new Role($this, $role_id);
+ if ($role->getVal('projectadmin',0)=='A') {
+ $role->setUser($idadmin_group);
+ }
}
- $admin_group = db_query_params ('SELECT user_id FROM user_group WHERE group_id=$1 AND admin_flags=$2',
- array ($this->getID(),
- 'A')) ;
- if (db_numrows($admin_group) > 0) {
- $idadmin_group = db_result($admin_group,0,'user_id');
- } else {
- $idadmin_group = 1;
- }
//
//
$this->sendApprovalEmail();
$this->addHistory('Approved', 'x');
- //plugin webcal
- //change assistant for webcal
-
+ //
+ // Plugin can make approve operation there
+ //
+ //
$params[0] = $idadmin_group ;
$params[1] = $this->getID();
- plugin_hook('change_cal_permission_default',$params);
+ plugin_hook('group_approve',$params);
return true;
}
* sendApprovalEmail - Send new project email.
*
* @return boolean success.
- * @access public.
+ * @access public
*/
function sendApprovalEmail() {
$res_admins = db_query_params ('
$admin =& user_get_object($row_admins['user_id']);
setup_gettext_for_user ($admin) ;
- $message=stripcslashes(sprintf(_('Your project registration for %4$s has been approved.
+ $message=sprintf(_('Your project registration for %4$s has been approved.
Project Full Name: %1$s
Project Unix Name: %2$s
$this->getPublicName(),
$this->getUnixName(),
util_make_url ('/project/admin/?group_id='.$this->getID()),
- $GLOBALS['sys_name']));
+ $GLOBALS['sys_name']);
util_send_message($row_admins['email'], sprintf(_('%1$s Project Approved'), $GLOBALS['sys_name']), $message);
* @param int The id of the response to use.
* @param string The rejection message.
* @return completion status.
- * @access public.
+ * @access public
*/
function sendRejectionEmail($response_id, $message="zxcv") {
$res_admins = db_query_params ('
$admin =& user_get_object($row_admins['user_id']);
setup_gettext_for_user ($admin) ;
- $response=stripcslashes(sprintf(_('Your project registration for %3$s has been denied.
+ $response=sprintf(_('Your project registration for %3$s has been denied.
Project Full Name: %1$s
Project Unix Name: %2$s
Reasons for negative decision:
-'), $this->getPublicName(), $this->getUnixName(), $GLOBALS['sys_name']));
+'), $this->getPublicName(), $this->getUnixName(), $GLOBALS['sys_name']);
// Check to see if they want to send a custom rejection response
if ($response_id == 0) {
- $response .= stripcslashes($message);
+ $response .= $message;
} else {
$response .= db_result (
db_query_params('SELECT response_text FROM canned_responses WHERE response_id=$1', array ($response_id)),
* submitted.
*
* @return boolean success.
- * @access public.
+ * @access public
*/
function sendNewProjectNotificationEmail() {
// Get the user who wants to register the project
$admin =& user_get_object(db_result($res,$i,'user_id'));
setup_gettext_for_user ($admin) ;
- $message=stripcslashes(sprintf(_('New %1$s Project Submitted
+ $message=sprintf(_('New %1$s Project Submitted
Project Full Name: %2$s
Submitted Description: %3$s
util_unconvert_htmlspecialchars($this->getRegistrationPurpose()),
util_make_url ('/admin/approve-pending.php'),
$submitter->getRealName(),
- $submitter->getUnixName()));
+ $submitter->getUnixName());
util_send_message($admin_email, sprintf(_('New %1$s Project Submitted'), $GLOBALS['sys_name']), $message);
setup_gettext_from_context();
}
$email = $submitter->getEmail() ;
setup_gettext_for_user ($submitter) ;
- $message=stripcslashes(sprintf(_('New %1$s Project Submitted
+ $message=sprintf(_('New %1$s Project Submitted
Project Full Name: %2$s
Submitted Description: %3$s
-The %1$s admin team will now examine your project submission. You will be notified of their decision.'), $GLOBALS['sys_name'], $this->getPublicName(), util_unconvert_htmlspecialchars($this->getRegistrationPurpose()), $GLOBALS['sys_default_domain']));
+The %1$s admin team will now examine your project submission. You will be notified of their decision.'), $GLOBALS['sys_name'], $this->getPublicName(), util_unconvert_htmlspecialchars($this->getRegistrationPurpose()), $GLOBALS['sys_default_domain']);
util_send_message($email, sprintf(_('New %1$s Project Submitted'), $GLOBALS['sys_name']), $message);
setup_gettext_from_context();
}
+ /**
+ * getRoles - Get the roles of the group.
+ *
+ * @return array of Role id of this group.
+ */
+ function getRolesId () {
+
+ $rolesId = Array();
+
+ $roles_group_res = db_query_params ('SELECT role_id FROM role WHERE group_id=$1',
+ array ($this->getID()));
+ if (!$roles_group_res) {
+ $this->setError('Error: Roles from group id '. $this->getID() . ' ' .db_error());
+ return false;
+ } else {
+ for ($i=0; $i<db_numrows($roles_group_res); $i++) {
+ $rolesId[$i] = db_result($roles_group_res,$i,'role_id');
+ }
+ }
+
+ return $rolesId;
+ }
+
+ /**
+ * getUnixStatus - Status of activation of unix account.
+ *
+ * @return char (N)one, (A)ctive, (S)uspended or (D)eleted
+ */
+ function getUnixStatus() {
+ return $this->data_array['unix_status'];
+ }
+
+ /**
+ * setUnixStatus - Sets status of activation of unix account.
+ *
+ * @param string The unix status.
+ * N no_unix_account
+ * A active
+ * S suspended
+ * D deleted
+ *
+ * @return boolean success.
+ */
+ function setUnixStatus($status) {
+ global $SYS;
+ db_begin();
+ $res = db_query_params ('UPDATE groups SET unix_status=$1 WHERE group_id=$2',
+ array ($status,
+ $this->getID())) ;
+
+ if (!$res) {
+ $this->setError(sprintf(_('ERROR - Could Not Update Group Unix Status: %s'),db_error()));
+ db_rollback();
+ return false;
+ } else {
+ if ($status == 'A') {
+ if (!$SYS->sysCheckCreateGroup($this->getID())) {
+ $this->setError($SYS->getErrorMessage());
+ db_rollback();
+ return false;
+ }
+ } else {
+ if ($SYS->sysCheckGroup($this->getID())) {
+ if (!$SYS->sysRemoveGroup($this->getID())) {
+ $this->setError($SYS->getErrorMessage());
+ db_rollback();
+ return false;
+ }
+ }
+ }
+
+ $this->data_array['unix_status']=$status;
+ db_commit();
+ return true;
+ }
+ }
+
+ /**
+ * getUsers - Get the users of a group
+ *
+ * @return array of user's objects.
+ */
+ function getUsers() {
+ $users = Array();
+
+ $users_group_res = db_query_params ('SELECT u.user_id FROM users u, user_group ug WHERE ug.group_id=$1 AND ug.user_id=u.user_id AND u.status=$2',
+ array ($this->getID(),
+ 'A'));
+ if (!$users_group_res) {
+ $this->setError('Error: Enable to get users from group '. $this->getID() . ' ' .db_error());
+ return false;
+ }
+
+ for ($i=0; $i<db_numrows($users_group_res); $i++) {
+ $users[$i] = new GFUser(db_result($users_group_res,$i,'user_id'),false);
+ }
+
+ return $users;
+ }
+
+ /**
+ * getMenu - get an array that contains data for the group menu
+ *
+ * @param string contains the name of the selected menu item
+ * @return array array containing:
+ * 'titles': array that stores the titles of the menu entries
+ * 'dirs': array that stores the URLs of the menu entries
+ * 'start': URL of the starting page of the project
+ * 'admindirs': array that stores the URLs of the admin pages
+ * for the menu entries, if accessible, false otherwise
+ * 'selected': number of the menu entry selected by $toptab
+ * 'last_toptab': required internally: stores the
+ * value of $toptab for the last call to getMenu()
+ */
+ function &getMenu($toptab = "") {
+ // rebuild menu if it has never been built before, or
+ // if the toptab was set differently
+ if (!isset($this->menu_data)
+ || ($toptab != "")
+ || ($toptab != $this->menu_data['last_toptab']))
+ {
+ $selected = 0;
+ $group = $this->getId();
+
+ $this->menu_data = array () ;
+ $this->menu_data['titles'] = array();
+ $this->menu_data['dirs'] = array();
+ $this->menu_data['admindirs'] = array();
+
+ // Summary
+ $this->menu_data['titles'][] = _('Summary');
+ if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
+ $dir = util_make_url ('/project/?group_id=' . $group);
+ } else {
+ $dir = util_make_url ('/projects/' . $this->getUnixName() .'/');
+ }
+ $this->menu_data['dirs'][] = $dir;
+ $this->menu_data['admindirs'][] = false;
+ if ($toptab == "home") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+ // setting 'start' allows to change the
+ // projects start page
+ $this->menu_data['start'] = $dir;
+
+ // Project Admin
+ $perm =& $this->getPermission( session_get_user() );
+ if ($perm->isAdmin()) {
+ $this->menu_data['titles'][] = _('Admin');
+ $this->menu_data['dirs'][] = util_make_url ('/project/admin/?group_id=' . $group);
+ $this->menu_data['admindirs'][] = false;
+ if ($toptab == "admin") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+ }
+
+ /* Homepage
+ // check for use_home_tab?
+ $TABS_DIRS[]='http://'. $this->getHomePage();
+ $TABS_TITLES[]=_('Home Page');
+ */
+
+ // Project Activity tab
+ $this->menu_data['titles'][] = _('Activity');
+ $this->menu_data['dirs'][] = util_make_url ('/activity/?group_id=' . $group);
+ $this->menu_data['admindirs'][] = false;
+ if ($toptab == "activity") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+
+ // Forums
+ if ($this->usesForum()) {
+ $this->menu_data['titles'][] = _('Forums');
+ $this->menu_data['dirs'][] = util_make_url ('/forum/?group_id=' . $group);
+ if ($perm->isAdmin() || $perm->isForumAdmin()) {
+ $this->menu_data['admindirs'][] = util_make_url('/forum/admin/?group_id='.$group);
+ } else {
+ $this->menu_data['admindirs'][] = false;
+ }
+ if ($toptab == "forums") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+ }
+
+ // Artifact Tracking
+ if ($this->usesTracker()) {
+ $this->menu_data['titles'][] = _('Tracker');
+ $this->menu_data['dirs'][] = util_make_url ('/tracker/?group_id=' . $group);
+ if ($perm->isAdmin() || $perm->isArtifactAdmin()) {
+ $this->menu_data['admindirs'][] = util_make_url('/tracker/admin/?group_id='.$group);
+ } else {
+ $this->menu_data['admindirs'][] = false;
+ }
+ if ($toptab == "tracker" ||
+ $toptab == "bugs" ||
+ $toptab == "support" ||
+ $toptab == "patch") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+ }
+
+
+ // Mailing Lists
+ if ($this->usesMail()) {
+ $this->menu_data['titles'][] = _('Lists');
+ $this->menu_data['dirs'][] = util_make_url ('/mail/?group_id=' . $group);
+ if ($perm->isAdmin()) {
+ $this->menu_data['admindirs'][] = util_make_url('/mail/admin/?group_id='.$group);
+ } else {
+ $this->menu_data['admindirs'][] = false;
+ }
+ if ($toptab == "mail") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+
+ }
+
+ // Project/Task Manager
+ if ($this->usesPm()) {
+ $this->menu_data['titles'][] = _('Tasks');
+ $this->menu_data['dirs'][] = util_make_url ('/pm/?group_id=' . $group);
+ if ($perm->isAdmin() || $perm->isPMAdmin()) {
+ $this->menu_data['admindirs'][] = util_make_url ('/pm/admin/?group_id='.$group);
+ } else {
+ $this->menu_data['admindirs'][] = false;
+ }
+ if ($toptab == "pm") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+
+ }
+
+ // Doc Manager
+ if ($this->usesDocman()) {
+ $this->menu_data['titles'][] = _('Docs');
+ $this->menu_data['dirs'][] = util_make_url ('/docman/?group_id=' . $group);
+ if ($perm->isAdmin() || $perm->isDocEditor()) {
+ $this->menu_data['admindirs'][] = util_make_url ('/docman/admin/?group_id='.$group);
+ } else {
+ $this->menu_data['admindirs'][] = false;
+ }
+ if ($toptab == "docman") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+
+ }
+
+ // Surveys
+ if ($this->usesSurvey()) {
+ $this->menu_data['titles'][] = _('Surveys');
+ $this->menu_data['dirs'][] = util_make_url ('/survey/?group_id=' . $group);
+ if ($perm->isAdmin()) {
+ $this->menu_data['admindirs'][] = util_make_url ('/survey/admin/?group_id='.$group);
+ } else {
+ $this->menu_data['admindirs'][] = false;
+ }
+ if ($toptab == "surveys") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+ }
+
+ // News
+ if ($this->usesNews()) {
+ $this->menu_data['titles'][] = _('News');
+ $this->menu_data['dirs'][] = util_make_url ('/news/?group_id=' . $group);
+ if ($perm->isAdmin()) {
+ $this->menu_data['admindirs'][] = util_make_url ('/news/admin/?group_id='.$group);
+ } else {
+ $this->menu_data['admindirs'][] = false;
+ }
+ if ($toptab == "news") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+ }
+
+ // SCM systems
+ if ($this->usesSCM()) {
+ $this->menu_data['titles'][] = _('SCM');
+ $this->menu_data['dirs'][] = util_make_url ('/scm/?group_id=' . $group);
+ // eval cvs_flags?
+ if ($perm->isAdmin()) {
+ $this->menu_data['admindirs'][] = util_make_url ('/scm/admin/?group_id='.$group);
+ } else {
+ $this->menu_data['admindirs'][] = false;
+ }
+ if ($toptab == "scm") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+ }
+ // groupmenu_after_scm hook
+ $hookParams = array();
+ $hookParams['group_id'] = $group ;
+ $hookParams['DIRS'] =& $this->menu_data['dirs'];
+ $hookParams['TITLES'] =& $this->menu_data['titles'];
+ $hookParams['toptab'] =& $toptab;
+ $hookParams['selected'] =& $selected;
+
+ plugin_hook ("groupmenu_scm", $hookParams) ;
+
+ // fill up admindirs
+ for ($i = 0;
+ $i < count($this->menu_data['dirs']) - count($this->menu_data['admindirs']);
+ $i++) {
+ $this->menu_data['admindirs'][] = false;
+ }
+
+ // Downloads
+ if ($this->usesFRS()) {
+ $this->menu_data['titles'][] = _('Files');
+ $this->menu_data['dirs'][] = util_make_url ('/frs/?group_id=' . $group);
+ if ($perm->isAdmin() || $perm->isReleaseTechnician()) {
+ $this->menu_data['admindirs'][] = util_make_url ('/frs/admin/?group_id='.$group);
+ } else {
+ $this->menu_data['admindirs'][] = false;
+ }
+ if ($toptab == "frs") {
+ $selected = (count($this->menu_data['dirs'])-1);
+ }
+ }
+
+ // groupmenu hook
+ $hookParams = array();
+ $hookParams['group'] = $group ;
+ $hookParams['DIRS'] =& $this->menu_data['dirs'];
+ $hookParams['TITLES'] =& $this->menu_data['titles'];
+ $hookParams['toptab'] =& $toptab;
+ $hookParams['selected'] =& $selected;
+
+ plugin_hook ("groupmenu", $hookParams) ;
+ // fill up admindirs
+ for ($i = 0;
+ $i < count($this->menu_data['dirs']) - count($this->menu_data['admindirs']);
+ $i++) {
+ $this->menu_data['admindirs'][] = false;
+ }
+
+ // store selected menu item (if any)
+ $this->menu_data['selected'] = $selected;
+ if ($toptab != "") {
+ $this->menu_data['last_toptab'] = $toptab;
+ }
+ }
+ return $this->menu_data ;
+ }
}
/**
}
}
-/**
- * getUnixStatus - Status of activation of unix account.
- *
- * @return char (N)one, (A)ctive, (S)uspended or (D)eleted
- */
-function getUnixStatus() {
- return $this->data_array['unix_status'];
-}
-
-/**
- * setUnixStatus - Sets status of activation of unix account.
- *
- * @param string The unix status.
- * N no_unix_account
- * A active
- * S suspended
- * D deleted
- *
- * @return boolean success.
- */
-function setUnixStatus($status) {
- global $SYS;
- db_begin();
- $res = db_query_params ('UPDATE groups SET unix_status=$1 WHERE group_id=$2',
- array ($status,
- $this->getID())) ;
-
- if (!$res) {
- $this->setError(sprintf(_('ERROR - Could Not Update Group Unix Status: %s'),db_error()));
- db_rollback();
- return false;
- } else {
- if ($status == 'A') {
- if (!$SYS->sysCheckCreateGroup($this->getID())) {
- $this->setError($SYS->getErrorMessage());
- db_rollback();
- return false;
- }
- } else {
- if ($SYS->sysCheckGroup($this->getID())) {
- if (!$SYS->sysRemoveGroup($this->getID())) {
- $this->setError($SYS->getErrorMessage());
- db_rollback();
- return false;
- }
- }
- }
-
- $this->data_array['unix_status']=$status;
- db_commit();
- return true;
- }
-}
// Local Variables:
// mode: php