*/
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.
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 ;
+ }
}
/**
* for displaying all site dependent HTML, while allowing
* extendibility/overriding by themes via the Theme class.
*
- * Make sure browser.php is included _before_ you create an instance of this object.
+ * Make sure browser.php is included _before_ you create an instance
+ * of this object.
*
* Geoffrey Herteg, August 29, 2000
*
* Layout() - Constructor
*/
function Layout() {
-
- $this->themeroot=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'];
+ // determine rootindex
+ if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
+ $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
+ else
+ $this->rootindex = $GLOBALS['gfwww'].'index_std.php';
+
+ // determine themeroot
+ $this->themeroot = $GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'];
/* if images directory exists in theme, then use it as imgroot */
if (file_exists ($this->themeroot.'/images')){
- $this->imgroot=util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/images/');
+ $this->imgroot = util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/images/');
}
- // Constructor for parent class...
- if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
- $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
+
$this->Error();
}
this stylesheet
new stylesheets should use the <themename>.css file
*/
- $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css';
+ $theme_cssfile = $this->themeroot . '/css/'.$GLOBALS['sys_theme'].'.css';
if (file_exists($theme_cssfile)){
echo '
<link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css').'"/>';
*/
echo '
<link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/css/gforge-compat.css').'" />';
- $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/theme.css';
+ $theme_cssfile = $this->themeroot . '/css/theme.css';
if (file_exists($theme_cssfile)){
echo '
<link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/css/theme.css').'" />';
}
+ /**
+ * quicknav() - Prints out the quicknav menu, contained
+ * here in case we want to allow it to be
+ * overridden.
+ *
+ */
+ function quickNav() {
+ if (!session_loggedin()) {
+ return '';
+ } else {
+ // get all projects that the user belongs to
+ $res = db_query_params ('SELECT group_id FROM groups JOIN user_group USING (group_id) WHERE user_group.user_id=$1 AND groups.status=$2 ORDER BY group_name',
+ array (user_getid(),
+ 'A'));
+ echo db_error();
+ if (!$res || db_numrows($res) < 1) {
+ return '';
+ } else {
+ $ret = '
+ <form class="ff" name="quicknavform">
+ <select class="ff" name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">
+ <option class="ff" value="">'._('Quick Jump To...').'</option>';
+
+ for ($i = 0; $i < db_numrows($res); $i++) {
+ $group_id = db_result($res, $i, 'group_id');
+ $project =& group_get_object($group_id);
+ if (!$project || !is_object($project)) {
+ return;
+ }
+ if ($project->isError()) {
+ //wasn't found or some other problem
+ return;
+ }
+ if (!$project->isProject()) {
+ return;
+ }
+
+ $menu = $project->getMenu();
+ $ret .= '
+ <option class="ff" value="' . $menu['start'] . '">'
+ . $project->getPublicName() .'</option>';
+
+ for ($j = 0; $j < count($menu['dirs']); $j++) {
+ $ret .= '
+ <option class="ff" value="' . $menu['dirs'][$j] .'"> '
+ . $menu['titles'][$j] . '</option>';
+ if ($menu['admindirs'][$j]) {
+ $ret .= '
+ <option class="ff" value="' . $menu['admindirs'][$j]
+ . '"> '
+ . _('Admin') . '</option>';
+ }
+ }
+ }
+ $ret .= '
+ </select>
+ </form>';
+ }
+ }
+ return $ret;
+ }
+
/**
* projectTabs() - Prints out the project tabs, contained here in case
* we want to allow it to be overriden
* @param string Is the tab currently selected
* @param string Is the group we should look up get title info
*/
- function projectTabs($toptab,$group) {
+ function projectTabs($toptab, $group) {
// get group info using the common result set
$project =& group_get_object($group);
if (!$project || !is_object($project)) {
return;
}
- // Summary
- if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
- $TABS_DIRS[]=util_make_url ('/project/?group_id=' . $project->getId());
- } else {
- $TABS_DIRS[]=util_make_url ('/projects/' . $project->getUnixName() .'/');
- }
- $TABS_TITLES[]=_('Summary');
- (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
-
- // Project Admin
- $perm =& $project->getPermission( session_get_user() );
- if ($perm->isAdmin()) {
- $TABS_DIRS[]=util_make_url ('/project/admin/?group_id=' . $group);
- $TABS_TITLES[]=_('Admin');
- (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
- /* Homepage
- $TABS_DIRS[]='http://'. $project->getHomePage();
- $TABS_TITLES[]=_('Home Page');
- */
-
- // Project Activity tab
-
- $TABS_DIRS[]=util_make_url ('/activity/?group_id=' . $group);
- $TABS_TITLES[]=_('Activity');
- (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
-
- // Forums
- if ($project->usesForum()) {
- $TABS_DIRS[]=util_make_url ('/forum/?group_id='.$group);
- $TABS_TITLES[]=_('Forums');
- (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Artifact Tracking
- if ($project->usesTracker()) {
- $TABS_DIRS[]=util_make_url ('/tracker/?group_id='.$group);
- $TABS_TITLES[]=_('Tracker');
- (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
- ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Mailing Lists
- if ($project->usesMail()) {
- $TABS_DIRS[]=util_make_url ('/mail/?group_id='.$group);
- $TABS_TITLES[]=_('Lists');
- (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Project Manager
- if ($project->usesPm()) {
- $TABS_DIRS[]=util_make_url ('/pm/?group_id='.$group);
- $TABS_TITLES[]=_('Tasks');
- (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Doc Manager
- if ($project->usesDocman()) {
- $TABS_DIRS[]=util_make_url ('/docman/?group_id='.$group);
- $TABS_TITLES[]=_('Docs');
- (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Surveys
- if ($project->usesSurvey()) {
- $TABS_DIRS[]=util_make_url ('/survey/?group_id='.$group);
- $TABS_TITLES[]=_('Surveys');
- (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- //newsbytes
- if ($project->usesNews()) {
- $TABS_DIRS[]=util_make_url ('/news/?group_id='.$group);
- $TABS_TITLES[]=_('News');
- (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // SCM systems
- if ($project->usesSCM()) {
- $TABS_DIRS[]=util_make_url ('/scm/?group_id='.$group);
- $TABS_TITLES[]=_('SCM');
- (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // groupmenu_after_scm hook
- $hookParams['DIRS'] = &$TABS_DIRS;
- $hookParams['TITLES'] = &$TABS_TITLES;
- $hookParams['toptab'] = &$toptab;
- $hookParams['selected'] = &$selected;
- $hookParams['group_id'] = $group ;
-
- plugin_hook ("groupmenu_scm", $hookParams) ;
-
- // Downloads
- if ($project->usesFRS()) {
- $TABS_DIRS[]=util_make_url ('/frs/?group_id='.$group);
- $TABS_TITLES[]=_('Files');
- (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // groupmenu hook
- $hookParams['DIRS'] = &$TABS_DIRS;
- $hookParams['TITLES'] = &$TABS_TITLES;
- $hookParams['toptab'] = &$toptab;
- $hookParams['selected'] = &$selected;
- $hookParams['group'] = $group;
-
- plugin_hook ("groupmenu", $hookParams) ;
-
- echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
+ $menu = $project->getMenu($toptab);
+ echo $this->tabGenerator($menu['dirs'], $menu['titles'], true, $menu['selected'], 'white', '100%');
}
function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='white',$total_width='100%') {
return db_result($res,0,'theme_id');
}
- function quickNav() {
- if (!session_loggedin()) {
- return '';
- } else {
- $res = db_query_params ('SELECT * FROM groups JOIN user_group USING (group_id) WHERE user_group.user_id=$1 AND groups.status=$2 ORDER BY group_name',
- array (user_getid(),
- 'A'));
- echo db_error();
- if (!$res || db_numrows($res) < 1) {
- return '';
- } else {
- $ret = '
- <form class="ff" name="quicknavform">
- <select class="ff" name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">';
- $ret .= '
- <option class="ff" value="">'._('Quick Jump To...').'</option>';
- for ($i=0; $i<db_numrows($res); $i++) {
- $ret .= '
- <option class="ff" value="'.util_make_url_g (db_result($res,$i,'unix_group_name'),db_result($res,$i,'group_id')).'">'.db_result($res,$i,'group_name').'</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A') {
- $ret .= '
- <option class="ff" value="'.util_make_url ('/project/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
- }
- //tracker
- if (db_result($res,$i,'use_tracker')) {
- $ret .= '
- <option class="ff" value="'.util_make_url ('/tracker/?group_id='.db_result($res,$i,'group_id')).'"> Tracker</option>';
- if (db_result($res,$i,'admin_flags') || db_result($res,$i,'artifact_flags')) {
- $ret .= '
- <option class="ff" value="'.util_make_url ('/tracker/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
- }
- }
- //task mgr
- if (db_result($res,$i,'use_pm')) {
- $ret .= '
- <option class="ff" value="'.util_make_url ('/pm/?group_id='.db_result($res,$i,'group_id')).'"> Task Manager</option>';
- if (trim(db_result($res,$i,'admin_flags')) =='A' || db_result($res,$i,'project_flags')) {
- $ret .= '
- <option class="ff" value="'.util_make_url ('/pm/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
- }
- }
- //FRS
- if (db_result($res,$i,'use_frs')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/frs/?group_id='.db_result($res,$i,'group_id')).'"> Files</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'release_flags')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/frs/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
- }
- }
- //SCM
- if (db_result($res,$i,'use_scm')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/scm/?group_id='.db_result($res,$i,'group_id')).'"> SCM</option>';
- /*if (db_result($res,$i,'admin_flags') || db_result($res,$i,'project_flags')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/pm/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
- } */
- }
- //forum
- if (db_result($res,$i,'use_forum')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/forum/?group_id='.db_result($res,$i,'group_id')).'"> Forum</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'forum_flags')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/forum/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
- }
- }
- //mail
- if (db_result($res,$i,'use_mail')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/mail/?group_id='.db_result($res,$i,'group_id')).'"> Lists</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A') {
- $ret .= '
- <option class="ff" value="'.util_make_url('/mail/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
- }
- }
- //doc
- if (db_result($res,$i,'use_docman')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/docman/?group_id='.db_result($res,$i,'group_id')).'"> Docs</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'doc_flags')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/docman/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
- }
- }
- //news
- if (db_result($res,$i,'use_news')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/news/?group_id='.db_result($res,$i,'group_id')).'"> News</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A') {
- $ret .= '
- <option class="ff" value="'.util_make_url('/news/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
- }
- }
- //survey
- if (db_result($res,$i,'use_survey')) {
- $ret .= '
- <option class="ff" value="'.util_make_url('/survey/?group_id='.db_result($res,$i,'group_id')).'"> Surveys</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A') {
- $ret .= '
- <option class="ff" value="'.util_make_url('/survey/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
- }
- }
- }
- $ret .= '
- </select>
- </form>';
- }
- }
- return $ret;
- }
function confirmBox($msg, $params, $buttons, $image='*none*') {
if ($image == '*none*') {
// Parent constructor
$this->Layout();
- $this->imgroot = THEME_DIR.'/images/';
$this->COLOR_CONTENT_BACK= '#ffffff';
$this->COLOR_LTBACK1= '#eeeeef';
$this->COLOR_LTBACK2= '#fafafa';
$this->FONTSIZE_SMALLER='x-small';
$this->FONTSIZE_SMALLEST='xx-small';
$this->FONTSIZE_HTMLBOX_TITLE = 'small';
- $this->bgpri = array();
- }
-
- /**
- * Layout() - Constructor
- */
- function Layout() {
- GLOBAL $bgpri;
- // Constructor for parent class...
- if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
- $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
- else
- $this->rootindex = $GLOBALS['gfwww'].'index_std.php';
-
- $this->Error();
-
- /*
- Set up the priority color array one time only
- */
- $bgpri[1] = '#dadada';
- $bgpri[2] = '#dacaca';
- $bgpri[3] = '#dababa';
- $bgpri[4] = '#daaaaa';
- $bgpri[5] = '#da8a8a';
-
- //determine font for this platform
- if (browser_is_windows() && browser_is_ie()) {
-
- //ie needs smaller fonts
- $this->FONTSIZE='x-small';
- $this->FONTSIZE_SMALLER='xx-small';
- $this->FONTSIZE_SMALLEST='7pt';
-
- } else if (browser_is_windows()) {
-
- //netscape on wintel
- $this->FONTSIZE='small';
- $this->FONTSIZE_SMALLER='x-small';
- $this->FONTSIZE_SMALLEST='x-small';
-
- } else if (browser_is_mac()){
-
- //mac users need bigger fonts
- $this->FONTSIZE='medium';
- $this->FONTSIZE_SMALLER='small';
- $this->FONTSIZE_SMALLEST='x-small';
-
- } else {
-
- //linux and other users
- $this->FONTSIZE='small';
- $this->FONTSIZE_SMALLER='x-small';
- $this->FONTSIZE_SMALLEST='xx-small';
-
- }
-
- $this->FONTSIZE_HTMLBOX_TITLE = $this->FONTSIZE;
}
/**
}
- /**
- * projectTabs() - Prints out the project tabs, contained here in case
- * we want to allow it to be overriden
- *
- * @param string Is the tab currently selected
- * @param string Is the group we should look up get title info
- */
- function projectTabs($toptab,$group) {
- // get group info using the common result set
- $project =& group_get_object($group);
- if (!$project || !is_object($project)) {
- return;
- }
- if ($project->isError()) {
- //wasn't found or some other problem
- return;
- }
- if (!$project->isProject()) {
- return;
- }
-
- // Summary
- if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
- $TABS_DIRS[]=util_make_url ('/project/?group_id='. $group);
- } else {
- $TABS_DIRS[]=util_make_url ('/projects/'. $project->getUnixName() .'/');
- }
- $TABS_TITLES[]=_('Summary');
- (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
-
- // Project Admin
- $perm =& $project->getPermission( session_get_user() );
- if ($perm->isAdmin()) {
- $TABS_DIRS[]=util_make_url ('/project/admin/?group_id='. $group);
- $TABS_TITLES[]=_('Admin');
- (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
- /* Homepage
- $TABS_DIRS[]=util_make_url ('http://'. $project->getHomePage());
- $TABS_TITLES[]=_('Home Page');
- */
-
- // Project Activity tab
- $TABS_DIRS[]=util_make_url ('/activity/?group_id='. $group);
- $TABS_TITLES[]=_('Activity');
- (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
-
- // Forums
- if ($project->usesForum()) {
- $TABS_DIRS[]=util_make_url ('/forum/?group_id='.$group);
- $TABS_TITLES[]=_('Forums');
- (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Artifact Tracking
- if ($project->usesTracker()) {
- $TABS_DIRS[]=util_make_url ('/tracker/?group_id='.$group);
- $TABS_TITLES[]=_('Tracker');
- (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
- ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Mailing Lists
- if ($project->usesMail()) {
- $TABS_DIRS[]=util_make_url ('/mail/?group_id='.$group);
- $TABS_TITLES[]=_('Lists');
- (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Project Manager
- if ($project->usesPm()) {
- $TABS_DIRS[]=util_make_url ('/pm/?group_id='.$group);
- $TABS_TITLES[]=_('Tasks');
- (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Doc Manager
- if ($project->usesDocman()) {
- $TABS_DIRS[]=util_make_url ('/docman/?group_id='.$group);
- $TABS_TITLES[]=_('Docs');
- (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Surveys
- if ($project->usesSurvey()) {
- $TABS_DIRS[]=util_make_url ('/survey/?group_id='.$group);
- $TABS_TITLES[]=_('Surveys');
- (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- //newsbytes
- if ($project->usesNews()) {
- $TABS_DIRS[]=util_make_url ('/news/?group_id='.$group);
- $TABS_TITLES[]=_('News');
- (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // SCM systems
- if ($project->usesSCM()) {
- $TABS_DIRS[]=util_make_url ('/scm/?group_id='.$group);
- $TABS_TITLES[]=_('SCM');
- (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // groupmenu_after_scm hook
- $hookParams['DIRS'] = &$TABS_DIRS;
- $hookParams['TITLES'] = &$TABS_TITLES;
- $hookParams['toptab'] = &$toptab;
- $hookParams['selected'] = &$selected;
- $hookParams['group_id'] = $group ;
-
- plugin_hook ("groupmenu_scm", $hookParams) ;
-
- // Downloads
- if ($project->usesFRS()) {
- $TABS_DIRS[]=util_make_url ('/frs/?group_id='.$group);
- $TABS_TITLES[]=_('Files');
- (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // groupmenu hook
- $hookParams['DIRS'] = &$TABS_DIRS;
- $hookParams['TITLES'] = &$TABS_TITLES;
- $hookParams['toptab'] = &$toptab;
- $hookParams['selected'] = &$selected;
- $hookParams['group'] = $group;
-
- plugin_hook ("groupmenu", $hookParams) ;
-
- echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
-
- }
function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
$count=count($TABS_DIRS);