<?php // // get the Group object // $group =& group_get_object($group_id); if (!$group || !is_object($group) || $group->isError()) { exit_no_group(); } $atf = new ArtifactTypeFactory($group); if (!$group || !is_object($group) || $group->isError()) { exit_error('Error', 'Could Not Get ArtifactTypeFactory'); } $at_arr =& $atf->getArtifactTypes(); //required params for site_project_header(); $params['group'] = $group_id; $params['toptab'] = 'tracker'; echo site_project_header($params); $perm =& $group->getPermission(session_get_user()); if ($perm->isArtifactAdmin()) { $menu_text = array(); $menu_links = array(); $menu_text[] = _('Admin'); $menu_links[] = '/tracker/admin/?group_id=' . $group_id; echo $HTML->subMenu($menu_text, $menu_links); } if (!$at_arr || count($at_arr) < 1) { echo "<h1>" . _('No Accessible Trackers Found') . "</h1>"; echo "<p><strong>" . sprintf(_('No trackers have been set up, or you cannot view them.<p><span class="important">The Admin for this project will have to set up data types using the %1$s admin page %2$s</span>'), '<a href="' . util_make_url('/tracker/admin/?group_id=' . $group_id) . '">', '</a>') . "</strong>"; } else { echo '<p>' . _('Choose a tracker and you can browse/edit/add items to it.') . '<p>';
private function getTrackersV3ForProject(Project $project) { if ($project->usesService('tracker')) { require_once 'common/tracker/ArtifactTypeFactory.class.php'; $atf = new ArtifactTypeFactory($project); return $atf->getArtifactTypes(); } return null; }
private function getTrackersv3ForProject(Project $project) { $artifact_type_factory = new ArtifactTypeFactory($project); return $artifact_type_factory->getArtifactTypes(); }
/** * Remove a user from a project * * @param Integer $groupId Project id * @param Integer $userId User id * @param Boolean $adminAction Default value set to true, manage the displayed message according to the person that asked for the action (admin/self remove) */ function account_remove_user_from_group($groupId, $userId, $adminAction = true) { $pm = ProjectManager::instance(); $res = db_query("DELETE FROM user_group WHERE group_id='{$groupId}' AND user_id='{$userId}' AND admin_flags <> 'A'"); if (!$res || db_affected_rows($res) < 1) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('project_admin_index', 'user_not_removed')); } else { // Raise an event $em = EventManager::instance(); $em->processEvent('project_admin_remove_user', array('group_id' => $groupId, 'user_id' => $userId)); // // get the Group object // $group = $pm->getProject($groupId); if (!$group || !is_object($group) || $group->isError()) { exit_no_group(); } $atf = new ArtifactTypeFactory($group); if (!$group || !is_object($group) || $group->isError()) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('project_admin_index', 'not_get_atf')); } // Get the artfact type list $at_arr = $atf->getArtifactTypes(); if ($at_arr && count($at_arr) > 0) { for ($j = 0; $j < count($at_arr); $j++) { if (!$at_arr[$j]->deleteUser($userId)) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('project_admin_index', 'del_tracker_perm_fail', $at_arr[$j]->getName())); } } } // Remove user from ugroups attached to this project if (!ugroup_delete_user_from_project_ugroups($groupId, $userId)) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('project_admin_index', 'del_user_from_ug_fail')); } $name = user_getname($userId); if ($adminAction) { $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('project_admin_index', 'user_removed') . ' (' . $name . ')'); } else { $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('project_admin_index', 'self_user_remove') . ' (' . $group->getPublicName() . ')'); } group_add_history('removed_user', user_getname($userId) . " ({$userId})", $groupId); return true; } return false; }
function delete($sure, $really_sure, $really_really_sure) { if (!$sure || !$really_sure || !$really_really_sure) { $this->setMissingParamsError(); return false; } if ($this->getID() == $GLOBALS['sys_news_group'] || $this->getID() == 1 || $this->getID() == $GLOBALS['sys_stats_group'] || $this->getID() == $GLOBALS['sys_peer_rating_group']) { $this->setError(_('Cannot Delete System Group')); return false; } $perm =& $this->getPermission(session_get_user()); if (!$perm || !is_object($perm)) { $this->setPermissionDeniedError(); return false; } elseif ($perm->isError()) { $this->setPermissionDeniedError(); return false; } elseif (!$perm->isSuperUser()) { $this->setPermissionDeniedError(); return false; } db_begin(); // // Remove all the members // $members =& $this->getMembers(); for ($i = 0; $i < count($members); $i++) { $this->removeUser($members[$i]->getID()); } // // Delete Trackers // $atf = new ArtifactTypeFactory($this); $at_arr =& $atf->getArtifactTypes(); for ($i = 0; $i < count($at_arr); $i++) { if (!is_object($at_arr[$i])) { printf(_("Not Object: ArtifactType: %d"), $i); continue; } $at_arr[$i]->delete(1, 1); } // // Delete Forums // $ff = new ForumFactory($this); $f_arr =& $ff->getForums(); for ($i = 0; $i < count($f_arr); $i++) { if (!is_object($f_arr[$i])) { printf(_("Not Object: Forum: %d"), $i); continue; } $f_arr[$i]->delete(1, 1); //echo 'ForumFactory'.db_error(); } // // Delete Subprojects // $pgf = new ProjectGroupFactory($this); $pg_arr =& $pgf->getProjectGroups(); for ($i = 0; $i < count($pg_arr); $i++) { if (!is_object($pg_arr[$i])) { printf(_("Not Object: ProjectGroup: %d"), $i); continue; } $pg_arr[$i]->delete(1, 1); //echo 'ProjectGroupFactory'.db_error(); } // // Delete FRS Packages // //$frspf = new FRSPackageFactory($this); $res = db_query("SELECT * FROM frs_package WHERE group_id='" . $this->getID() . "'"); //echo 'frs_package'.db_error(); //$frsp_arr =& $frspf->getPackages(); while ($arr = db_fetch_array($res)) { //if (!is_object($pg_arr[$i])) { // echo "Not Object: ProjectGroup: ".$i; // continue; //} $frsp = new FRSPackage($this, $arr['package_id'], $arr); $frsp->delete(1, 1); } // // Delete news // $news_group =& group_get_object($GLOBALS['sys_news_group']); $res = db_query("SELECT forum_id FROM news_bytes WHERE group_id='" . $this->getID() . "'"); for ($i = 0; $i < db_numrows($res); $i++) { $Forum = new Forum($news_group, db_result($res, $i, 'forum_id')); if (!$Forum->delete(1, 1)) { printf(_("Could Not Delete News Forum: %d"), $Forum->getID()); } } $res = db_query("DELETE FROM news_bytes WHERE group_id='" . $this->getID() . "'"); // // Delete docs // $res = db_query("DELETE FROM doc_data WHERE group_id='" . $this->getID() . "'"); //echo 'doc_data'.db_error(); $res = db_query("DELETE FROM doc_groups WHERE group_id='" . $this->getID() . "'"); //echo 'doc_groups'.db_error(); // // Delete group history // $res = db_query("DELETE FROM group_history WHERE group_id='" . $this->getID() . "'"); //echo 'group_history'.db_error(); // // Delete group plugins // $res = db_query("DELETE FROM group_plugin WHERE group_id='" . $this->getID() . "'"); //echo 'group_plugin'.db_error(); // // Delete group cvs stats // $res = db_query("DELETE FROM stats_cvs_group WHERE group_id='" . $this->getID() . "'"); //echo 'stats_cvs_group'.db_error(); // // Delete Surveys // $sf = new SurveyFactory($this); $s_arr =& $sf->getSurveys(); for ($i = 0; $i < count($s_arr); $i++) { if (!is_object($s_arr[$i])) { printf(_("Not Object: Survey: %d"), $i); continue; } $s_arr[$i]->delete(); //echo 'SurveyFactory'.db_error(); } // // Delete SurveyQuestions // $sqf = new SurveyQuestionFactory($this); $sq_arr =& $sqf->getSurveyQuestions(); for ($i = 0; $i < count($sq_arr); $i++) { if (!is_object($sq_arr[$i])) { printf(_("Not Object: SurveyQuestion: %d"), $i); continue; } $sq_arr[$i]->delete(); //echo 'SurveyQuestionFactory'.db_error(); } // // Delete Mailing List Factory // $mlf = new MailingListFactory($this); $ml_arr =& $mlf->getMailingLists(); for ($i = 0; $i < count($ml_arr); $i++) { if (!is_object($ml_arr[$i])) { printf(_("Not Object: MailingList: %d"), $i); continue; } if (!$ml_arr[$i]->delete(1, 1)) { $this->setError(_('Could not properly delete the mailing list')); } //echo 'MailingListFactory'.db_error(); } // // Delete trove // $res = db_query("DELETE FROM trove_group_link WHERE group_id='" . $this->getID() . "'"); $res = db_query("DELETE FROM trove_agg WHERE group_id='" . $this->getID() . "'"); // // Delete counters // $res = db_query("DELETE FROM project_sums_agg WHERE group_id='" . $this->getID() . "'"); //echo 'project_sums_agg'.db_error(); $res = db_query("INSERT INTO deleted_groups (\n\t\tunix_group_name,delete_date,isdeleted) VALUES \n\t\t('" . $this->getUnixName() . "','" . time() . "','0')"); //echo 'InsertIntoDeleteQueue'.db_error(); $res = db_query("DELETE FROM groups WHERE group_id='" . $this->getID() . "'"); //echo 'DeleteGroup'.db_error(); db_commit(); if (!$res) { return false; } $hook_params = array(); $hook_params['group'] = $this; $hook_params['group_id'] = $this->getID(); plugin_hook("group_delete", $hook_params); if (isset($GLOBALS['sys_upload_dir']) && $this->getUnixName()) { exec('/bin/rm -rf ' . $GLOBALS['sys_upload_dir'] . '/' . $this->getUnixName() . '/'); } if (isset($GLOBALS['sys_ftp_upload_dir']) && $this->getUnixName()) { exec('/bin/rm -rf ' . $GLOBALS['sys_ftp_upload_dir'] . '/' . $this->getUnixName() . '/'); } // // Delete reporting // $res = db_query("DELETE FROM rep_group_act_weekly WHERE group_id='" . $this->getID() . "'"); //echo 'rep_group_act_weekly'.db_error(); $res = db_query("DELETE FROM rep_group_act_monthly WHERE group_id='" . $this->getID() . "'"); //echo 'rep_group_act_monthly'.db_error(); $res = db_query("DELETE FROM rep_group_act_daily WHERE group_id='" . $this->getID() . "'"); //echo 'rep_group_act_daily'.db_error(); unset($this->data_array); return true; }
function getContent() { $request =& HTTPRequest::instance(); $group_id = $request->get('group_id'); $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); if ($project->usesHomePage()) { print "<A "; if (substr($project->getHomePage(), 0, 1) != "/") { // Absolute link -> open new window on click print "target=_blank "; } print 'href="' . $project->getHomePage() . '">'; html_image("ic/home16b.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'homepage'))); print ' ' . $GLOBALS['Language']->getText('include_project_home', 'proj_home') . '</A>'; } // ################## forums if ($project->usesForum()) { print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getForumPage() . '">'; html_image("ic/notes16.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'public_forums'))); print ' ' . $GLOBALS['Language']->getText('include_project_home', 'public_forums') . '</A>'; $res_count = db_query("SELECT count(forum.msg_id) AS count FROM forum,forum_group_list WHERE " . "forum_group_list.group_id={$group_id} AND forum.group_forum_id=forum_group_list.group_forum_id " . "AND forum_group_list.is_public=1"); $row_count = db_fetch_array($res_count); $pos = strpos($project->getForumPage(), '/forum/'); if ($pos === 0) { print ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'msg', $row_count['count']) . ' '; $res_count = db_query("SELECT count(*) AS count FROM forum_group_list WHERE group_id={$group_id} " . "AND is_public=1"); $row_count = db_fetch_array($res_count); print $GLOBALS['Language']->getText('include_project_home', 'forums', $row_count['count']) . " )\n"; } /* $sql="SELECT * FROM forum_group_list WHERE group_id='$group_id' AND is_public=1"; $res2 = db_query ($sql); $rows = db_numrows($res2); for ($j = 0; $j < $rows; $j++) { echo '<BR> - <A HREF="forum.php?forum_id='.db_result($res2, $j, 'group_forum_id').'&et=0">'. db_result($res2, $j, 'forum_name').'</A> '; //message count echo '('.db_result(db_query("SELECT count(*) FROM forum WHERE group_forum_id='".db_result($res2, $j, 'group_forum_id')."'"),0,0).' msgs)'; } */ } // ##################### Doc Manager (only for Active) if ($project->usesDocman()) { print ' <HR SIZE="1" width="99%" NoShade> <A href="/docman/?group_id=' . $group_id . '">'; html_image("ic/docman16b.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'doc'))); print ' ' . $GLOBALS['Language']->getText('include_project_home', 'doc_man') . '</A>'; /* $res_count = db_query("SELECT count(*) AS count FROM support WHERE group_id=$group_id"); $row_count = db_fetch_array($res_count); $res_count = db_query("SELECT count(*) AS count FROM support WHERE group_id=$group_id AND support_status_id='1'"); $row_count2 = db_fetch_array($res_count); print " ( <B>$row_count2[count]</B>"; print " open requests, <B>$row_count[count]</B> total )"; */ } // ##################### Mailing lists (only for Active) if ($project->usesMail()) { print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getMailPage() . '">'; html_image("ic/mail16b.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'mail_lists'))); print ' ' . $GLOBALS['Language']->getText('include_project_home', 'mail_lists') . '</A>'; $res_count = db_query("SELECT count(*) AS count FROM mail_group_list WHERE group_id={$group_id} AND is_public=1"); $row_count = db_fetch_array($res_count); print ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'public_mail_lists', $row_count['count']) . ' )'; } // ######################### Wiki (only for Active) if ($project->usesWiki()) { print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getWikiPage() . '">'; html_image("ic/wiki.png", array('width' => '18', 'height' => '12', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'wiki'))); print ' ' . $GLOBALS['Language']->getText('include_project_home', 'wiki') . '</A>'; $wiki = new Wiki($group_id); $pos = strpos($project->getWikiPage(), '/wiki/'); if ($pos === 0) { echo ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'nb_wiki_pages', $wiki->getProjectPageCount()) . ' )'; } } // ######################### Surveys (only for Active) if ($project->usesSurvey()) { print '<HR SIZE="1" width="99%" NoShade><A href="/survey/?group_id=' . $group_id . '">'; html_image("ic/survey16b.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'surveys'))); print ' ' . $GLOBALS['Language']->getText('include_project_home', 'surveys') . '</A>'; $sql = "SELECT count(*) from surveys where group_id='{$group_id}' AND is_active='1'"; $result = db_query($sql); echo ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'nb_surveys', db_result($result, 0, 0)) . ' )'; } // ######################### CVS (only for Active) if ($project->usesCVS()) { print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getCvsPage() . '">'; html_image("ic/cvs16b.png", array('width' => '20', 'height' => '20', 'alt' => 'CVS')); print ' ' . $GLOBALS['Language']->getText('include_project_home', 'cvs_repo') . '</A>'; // LJ Cvs checkouts added $sql = "SELECT SUM(cvs_commits) AS commits, SUM(cvs_adds) AS adds, SUM(cvs_checkouts) AS checkouts from stats_project where group_id='{$group_id}'"; $result = db_query($sql); $cvs_commit_num = db_result($result, 0, 0); $cvs_add_num = db_result($result, 0, 1); $cvs_co_num = db_result($result, 0, 2); if (!$cvs_commit_num) { $cvs_commit_num = 0; } if (!$cvs_add_num) { $cvs_add_num = 0; } if (!$cvs_co_num) { $cvs_co_num = 0; } $uri = session_make_url('/cvs/viewvc.php/?root=' . $project->getUnixName(false) . '&roottype=cvs'); echo ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'commits', $cvs_commit_num) . ', ' . $GLOBALS['Language']->getText('include_project_home', 'adds', $cvs_add_num) . ', ' . $GLOBALS['Language']->getText('include_project_home', 'co', $cvs_co_num) . ' )'; if ($cvs_commit_num || $cvs_add_num || $cvs_co_num) { echo '<br> - <a href="' . $uri . '">' . $GLOBALS['Language']->getText('include_project_home', 'browse_cvs') . '</a>'; } } // ######################### Subversion (only for Active) if ($project->usesService('svn')) { print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getSvnPage() . '">'; html_image("ic/svn16b.png", array('width' => '20', 'height' => '20', 'alt' => 'Subversion')); print ' ' . $GLOBALS['Language']->getText('include_project_home', 'svn_repo') . '</A>'; $sql = "SELECT SUM(svn_access_count) AS accesses from group_svn_full_history where group_id='{$group_id}'"; $result = db_query($sql); $svn_accesses = db_result($result, 0, 0); if (!$svn_accesses) { $svn_accesses = 0; } echo ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'accesses', $svn_accesses) . ' )'; if ($svn_accesses) { $uri = session_make_url('/svn/viewvc.php/?root=' . $project->getUnixName(false) . '&roottype=svn'); echo '<br> - <a href="' . $uri . '">' . $GLOBALS['Language']->getText('include_project_home', 'browse_svn') . '</a>'; } } // ######################### File Releases (only for Active) if ($project->usesFile()) { echo $project->services['file']->getPublicArea(); } // ######################### Trackers (only for Active) if ($project->usesTracker()) { print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getTrackerPage() . '">'; html_image("ic/tracker20w.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'trackers'))); print ' ' . $GLOBALS['Language']->getText('include_project_home', 'trackers') . '</A>'; // // get the Group object // $pm = ProjectManager::instance(); $group = $pm->getProject($group_id); if (!$group || !is_object($group) || $group->isError()) { exit_no_group(); } $atf = new ArtifactTypeFactory($group); if (!$group || !is_object($group) || $group->isError()) { exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('include_project_home', 'no_arttypefact')); } // Get the artfact type list $at_arr = $atf->getArtifactTypes(); if (!$at_arr || count($at_arr) < 1) { echo '<br><i>' . $GLOBALS['Language']->getText('include_project_home', 'no_trackers_accessible') . '</i>'; } else { for ($j = 0; $j < count($at_arr); $j++) { if ($at_arr[$j]->userCanView()) { echo '<br><i>- <a href="/tracker/?atid=' . $at_arr[$j]->getID() . '&group_id=' . $group_id . '&func=browse">' . $at_arr[$j]->getName() . '</a></i>'; } } } } // ######################## AnonFTP (only for Active) if ($project->isActive()) { print '<HR SIZE="1" width="99%" NoShade>'; list($host, $port) = explode(':', $GLOBALS['sys_default_domain']); if ($GLOBALS['sys_disable_subdomains']) { $ftp_subdomain = ""; } else { $ftp_subdomain = $project->getUnixName() . "."; } print "<A href=\"ftp://" . $ftp_subdomain . $host . "/pub/" . $project->getUnixName(false) . "/\">"; // keep the first occurence in lower case print html_image("ic/ftp16b.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'anon_ftp_space'))); print $GLOBALS['Language']->getText('include_project_home', 'anon_ftp_space') . '</A>'; } // ######################## Plugins $areas = array(); $params = array('project' => &$project, 'areas' => &$areas); $em =& EventManager::instance(); $em->processEvent(Event::SERVICE_PUBLIC_AREAS, $params); foreach ($areas as $area) { print '<HR SIZE="1" width="99%" NoShade>'; print $area; } }