5 * Extends the basic Error class to add HTML functions
6 * for displaying all site dependent HTML, while allowing
7 * extendibility/overriding by themes via the Theme class.
9 * Make sure browser.php is included _before_ you create an instance of this object.
11 * Geoffrey Herteg, August 29, 2000
16 require_once ('www/search/include/SearchManager.class.php');
18 class Theme extends Error {
21 * The default main page content
23 var $rootindex = 'index_std.php';
26 * The root location of the theme
27 * @var string $themeroot
32 * The root location for images
34 * @var string $imgroot
37 var $imgroot = '/themes/gforge/images/';
45 * Layout() - Constructor
49 $this->themeroot=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'];
50 /* if images directory exists in theme, then use it as imgroot */
51 if (file_exists ($this->themeroot.'/images')){
52 $this->imgroot='/themes/'.$GLOBALS['sys_theme'].'/images/';
54 // Constructor for parent class...
55 if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
56 $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
63 * createLinkToUserHome() - Creates a link to a user's home page
65 * @param string The user's user_name
66 * @param string The user's realname
68 function createLinkToUserHome($user_name, $realname) {
69 return util_make_link ('/users/'.$user_name.'/',$realname);
73 * headerStart() - common code for all themes
75 * @param array Header parameters array
77 function headerStart($params) {
78 if (!$params['title']) {
79 $params['title'] = $GLOBALS['sys_name'];
81 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
83 print '<?xml version="1.0" encoding="utf-8"';
87 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
88 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
90 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
91 lang="<?php echo _('en') ?>">
94 <meta http-equiv="Content-Type"
95 content="text/html; charset=utf-8" />
96 <title><?php echo $params['title']; ?></title>
98 title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS"
99 href="<?php echo util_make_url ('/export/rss_sfnews.php'); ?>"
100 type="application/rss+xml" />
101 <link rel="alternate"
102 title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS 2.0"
103 href="<?php echo util_make_url ('/export/rss20_news.php'); ?>"
104 type="application/rss+xml" />
105 <link rel="alternate"
106 title="<?php echo $GLOBALS['sys_name']; ?> - New Projects RSS"
107 href="<?php echo util_make_url ('/export/rss_sfprojects.php'); ?>"
108 type="application/rss+xml" />
110 <?php if (isset($GLOBALS['group_id'])) {
111 $activity = '<link rel="alternate" title="'.$GLOBALS['sys_name'].' - New Activity RSS" href="'.
112 util_make_url ('/export/rss20_activity.php?group_id='.$GLOBALS['group_id']).
113 '" type="application/rss+xml"/>';
119 /* check if a personalized css stylesheet exist, if yes include only
121 new stylesheets should use the <themename>.css file
123 $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css';
124 if (file_exists($theme_cssfile)){
126 <link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css').'"/>';
130 <script language="JavaScript" type="text/javascript">
133 function admin_window(adminurl) {
134 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
137 function help_window(helpurl) {
138 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
141 <?php plugin_hook ("javascript",false) ; ?>
143 <?php plugin_hook ('cssfile',$this); ?>
150 function header($params) {
151 $this->headerStart($params); ?>
158 <h1><?php echo util_make_link ('/',_('Goto GForge')); ?></h1>
160 <div id="util"><?php if (session_loggedin()) {
161 echo util_make_link ('/account/logout.php',_('Log Out')); ?><br />
162 <?php echo util_make_link ('/account/',_('My Account')); ?><br />
165 echo util_make_link ('/account/login.php',_('Log In')); ?><br />
166 <?php echo util_make_link ('/account/register.php',_('New Account')); ?>
171 <div id="content"><br />
172 <?php echo $this->searchBox();
178 <div id="outertabscontainer">
179 <div id="outertabs-left"></div>
180 <div id="outertabs-content"><?php echo $this->outerTabs($params);
182 <div id="outertabs-right"></div>
187 if (isset($params['group']) && $params['group']) {
189 <div id="projecttabscontainer">
190 <div id="projecttabs-left"></div>
191 <div id="projecttabs-content"><?echo $this->projectTabs($params['toptab'],$params['group']);?>
193 <div id="projecttabs-right"></div>
200 <div id="gforge-content">
201 <div id="<?php echo "gforge-content-".$this->selected_id;
203 <fieldset><legend><?php
204 echo '<a href="'.$this->selected_dir.'">'.$this->selected_title.'</a>';
209 function footer($params){
210 echo '</fieldset></div></div>';
211 $this->footerEnd($params);
214 function footerEnd($params) { ?> <!-- PLEASE LEAVE "Powered By GForge" on your site -->
215 <div id="footer"><a href="http://gforge.org/"><img
216 src="<?php echo $GLOBALS['sys_urlprefix']; ?>/images/pow-gforge.png"
217 alt="Powered By GForge Collaborative Development Environment"
218 border="0" /></a></div>
220 global $sys_show_source;
221 if ($sys_show_source) {
222 echo util_make_link ('/source.php?file='.getStringFromServer('SCRIPT_NAME'),_('Show source'),array('class'=>'showsource'));
232 function getRootIndex() {
233 return $this->rootindex;
237 * boxTop() - Top HTML box
239 * @param string Box title
240 * @param bool Whether to echo or return the results
241 * @param string The box background color
243 function boxTop($title) {
245 <!-- Box Top Start -->
247 <table cellspacing="0" cellpadding="0" width="100%" border="0">
248 <tr class="tableheading">
249 <td valign="top" align="right" width="10"><img src="'.$this->imgroot.'clear.png" width="10" height="20" alt="" /></td>
250 <td width="100%"><span class="titlebar">'.$title.'</span></td>
251 <td valign="top" width="10"><img src="'.$this->imgroot.'clear.png" width="10" height="20" alt=""/></td>
255 <table cellspacing="2" cellpadding="2" width="100%" border="0" class="tablecontent">
259 <!-- Box Top End -->';
263 * boxMiddle() - Middle HTML box
265 * @param string Box title
266 * @param string The box background color
268 function boxMiddle($title) {
270 <!-- Box Middle Start -->
273 <tr class="tableheading">
274 <td colspan="2">'.$title.'</td>
276 <tr align="left" class="tablecontent">
278 <!-- Box Middle End -->';
282 * boxBottom() - Bottom HTML box
284 * @param bool Whether to echo or return the results
286 function boxBottom() {
288 <!-- Box Bottom Start -->
295 <!-- Box Bottom End -->';
299 * boxGetAltRowStyle() - Get an alternating row style for tables
301 * @param int Row number
303 function boxGetAltRowStyle($i) {
305 return ' class="altRowStyleEven"';
307 return ' class="altRowStyleOdd"';
312 * listTableTop() - Takes an array of titles and builds the first row of a new table.
314 * @param array The array of titles
315 * @param array The array of title links
317 function listTableTop ($title_arr,$links_arr=false,$cnt=0) {
321 $return='<div id="tabletop">';
324 $return='<div id="tabletop'.$cnt.'">';
330 $count=count($title_arr);
332 for ($i=0; $i<$count; $i++) {
334 <td><a href="'.$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
337 for ($i=0; $i<$count; $i++) {
339 <td>'.$title_arr[$i].'</td>';
342 return $return.'</tr></thead>';
347 function listTableBottom() {
355 function outerTabs($params) {
356 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
361 $TABS_TITLES[]=_('Home');
365 $TABS_TITLES[]=_('My Page');
366 if (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ) {
367 $selected=count($TABS_DIRS)-1;
370 if ($sys_use_trove) {
371 $thistab='softwaremap';
372 $TABS_IDS[]='softwaremap';
373 $TABS_DIRS[]='/'.$thistab.'/';
374 $TABS_TITLES[]=_('Project Tree');
375 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
376 $selected=count($TABS_DIRS)-1;
379 if ($sys_use_snippet) {
381 $TABS_IDS[]=$thistab;
382 $TABS_DIRS[]='/'.$thistab.'/';
383 $TABS_TITLES[]=_('Code Snippets');
384 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
385 $selected=count($TABS_DIRS)-1;
388 if ($sys_use_people) {
390 $TABS_IDS[]=$thistab;
391 $TABS_DIRS[]='/'.$thistab.'/';
392 $TABS_TITLES[]=_('Project Openings');
393 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
394 $selected=count($TABS_DIRS)-1;
398 $PLUGIN_TABS_DIRS = Array();
399 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
400 $hookParams['TITLES'] = &$TABS_TITLES;
401 plugin_hook ("outermenu", $hookParams) ;
402 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
404 if (user_ismember(1,'A')) {
406 $TABS_IDS[]=$thistab;
407 $TABS_DIRS[]='/'.$thistab.'/';
408 $TABS_TITLES[]=_('Admin');
409 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
410 $selected=count($TABS_DIRS)-1;
414 if (user_ismember($GLOBALS['sys_stats_group'])) {
415 $thistab='reporting';
416 $TABS_IDS[]=$thistab;
417 $TABS_DIRS[]='/'.$thistab.'/';
418 $TABS_TITLES[]=_('Reporting');
419 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
420 $selected=count($TABS_DIRS)-1;
424 if(isset($params['group']) && $params['group']) {
425 // get group info using the common result set
426 $project =& group_get_object($params['group']);
427 if ($project && is_object($project)) {
428 if ($project->isError()) {
430 } elseif (!$project->isProject()) {
433 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
434 $TABS_DIRS[]='/project/?group_id='. $params['group'];
436 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
438 $TABS_TITLES[]=$project->getPublicName();
439 $selected=count($TABS_DIRS)-1;
442 } elseif (count($PLUGIN_TABS_DIRS)>0) {
443 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
444 if (strstr($GLOBALS['REQUEST_URI'],$PLUGIN_TABS_DIRS_VALUE)) {
445 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
450 $c=(count($TABS_TITLES)-1);
451 if(isset($params['group']) && $params['group']) {
452 /* project is selected */
455 for ($i=0; $i<=$c; $i++) {
456 if ($selected == $i){
457 $this->selected_title = $TABS_TITLES[$i];
458 $this->selected_dir = $TABS_DIRS[$i];
459 $this->selected_id = $TABS_IDS[$i];
460 $return .= '<a id="gforge-selected" title="'.$TABS_TITLES[$i].'" href="'.$TABS_DIRS[$i].'" >'.$TABS_TITLES[$i].'</a> ';
463 $return .= '<a id="gforge-'.$TABS_IDS[$i].'" title="'.$TABS_TITLES[$i].'"
464 href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a> ';
467 if(isset($params['group']) && $params['group']) {
468 $return .= '<a id="gforge-selected" title="'.$TABS_TITLES[$i].'"
469 href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a> ';
470 $this->selected_title = $TABS_TITLES[$i];
476 * projectTabs() - Prints out the project tabs, contained here in case
477 * we want to allow it to be overriden
479 * @param string Is the tab currently selected
480 * @param string Is the group we should look up get title info
482 function projectTabs($toptab,$group) {
483 // get group info using the common result set
484 $project =& group_get_object($group);
485 if (!$project || !is_object($project)) {
488 if ($project->isError()) {
489 //wasn't found or some other problem
492 if (!$project->isProject()) {
496 // $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
497 // $TABS_TITLES[]=$project->getPublicName();
500 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
501 $TABS_DIRS[]='/project/?group_id='. $group;
503 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
505 $TABS_IDS[]='gforge-project-summary';
506 $TABS_TITLES[]=_('Summary');
507 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
509 if (user_ismember($group,'A')) {
511 $TABS_DIRS[]='/project/admin/?group_id='. $group;
512 $TABS_IDS[]='gforge-project-admin';
513 $TABS_TITLES[]=_('Admin');
514 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
517 /* $TABS_DIRS[]='http://'. $project->getHomePage();
518 $TABS_TITLES[]=_('Home Page');
521 $TABS_DIRS[]='/activity/?group_id='. $group;
522 $TABS_IDS[]='gforge-project-activity';
523 $TABS_TITLES[]=_('Activity');
524 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
527 if ($project->usesForum()) {
528 $TABS_DIRS[]='/forum/?group_id='.$group;
529 $TABS_IDS[]='gforge-project-forum';
530 $TABS_TITLES[]=_('Forums');
531 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
535 if ($project->usesTracker()) {
536 $TABS_DIRS[]='/tracker/?group_id='.$group;
537 $TABS_IDS[]='gforge-project-tracker';
538 $TABS_TITLES[]=_('Tracker');
539 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
540 ? $selected=(count($TABS_TITLES)-1) : '' );
544 if ($project->usesMail()) {
545 $TABS_DIRS[]='/mail/?group_id='.$group;
546 $TABS_IDS[]='gforge-project-mail';
547 $TABS_TITLES[]=_('Lists');
548 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
552 if ($project->usesPm()) {
553 $TABS_IDS[]='gforge-project-task';
554 $TABS_DIRS[]='/pm/?group_id='.$group;
555 $TABS_TITLES[]=_('Tasks');
556 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
560 if ($project->usesDocman()) {
561 $TABS_DIRS[]='/docman/?group_id='.$group;
562 $TABS_IDS[]='gforge-project-docman';
563 $TABS_TITLES[]=_('Docs');
564 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
568 if ($project->usesSurvey()) {
569 $TABS_DIRS[]='/survey/?group_id='.$group;
570 $TABS_IDS[]='gforge-project-survey';
571 $TABS_TITLES[]=_('Surveys');
572 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
576 if ($project->usesNews()) {
577 $TABS_IDS[]='gforge-project-news';
578 $TABS_DIRS[]='/news/?group_id='.$group;
579 $TABS_TITLES[]=_('News');
580 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
584 if ($project->usesSCM()) {
585 $TABS_IDS[]='gforge-project-scm';
586 $TABS_DIRS[]='/scm/?group_id='.$group;
587 $TABS_TITLES[]=_('SCM');
588 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
591 // groupmenu_after_scm hook
592 $hookParams['DIRS'] = &$TABS_DIRS;
593 $hookParams['TITLES'] = &$TABS_TITLES;
594 $hookParams['toptab'] = &$toptab;
595 $hookParams['selected'] = &$selected;
596 $hookParams['group_id'] = $group ;
598 plugin_hook ("groupmenu_scm", $hookParams) ;
601 if ($project->usesFRS()) {
602 $TABS_IDS[]='gforge-project-frs';
603 $TABS_DIRS[]='/frs/?group_id='.$group;
604 $TABS_TITLES[]=_('Files');
605 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
609 $hookParams['DIRS'] = &$TABS_DIRS;
610 $hookParams['TITLES'] = &$TABS_TITLES;
611 $hookParams['toptab'] = &$toptab;
612 $hookParams['selected'] = &$selected;
613 $hookParams['group'] = $group;
615 plugin_hook ("groupmenu", $hookParams) ;
618 $c=(count($TABS_TITLES)-1);
619 for ($i=0; $i<=$c; $i++) {
621 $this->selected_title = $TABS_TITLES[$i];
622 $this->selected_dir = $TABS_DIRS[$i];
623 $this->selected_id = $TABS_IDS[$i];
624 $return .= '<a id="gforge-project-selected" href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a> ';
628 if ($TABS_IDS[$i]==''){
629 $return .= '<a id="gforge-project-std" title="'.$TABS_TITLES[$i].'" href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a>';
633 $return .= '<a id="'.$TABS_IDS[$i].'" title="'.$TABS_TITLES[$i].'" href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a>';
642 function searchBox() {
643 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
645 if(get_magic_quotes_gpc()) {
646 $defaultWords = stripslashes($words);
648 $defaultWords = $words;
651 // if there is no search currently, set the default
652 if ( ! isset($type_of_search) ) {
657 <form action="/search/" method="get">';
661 SEARCH__PARAMETER_GROUP_ID => $group_id,
662 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
663 SEARCH__PARAMETER_FORUM_ID => $forum_id,
664 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
667 $searchManager =& getSearchManager();
668 $searchManager->setParametersValues($parameters);
669 $searchEngines =& $searchManager->getAvailableSearchEngines();
670 echo '<select name="type_of_search">';
671 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
672 $searchEngine =& $searchEngines[$i];
673 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
676 $parameters = $searchManager->getParameters();
677 foreach($parameters AS $name => $value) {
678 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
681 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
684 print '<input type="submit" name="Search" value="'._('Search').'" />';
687 if (isset($group_id)&& $group_id) {
688 echo util_make_link ('/search/advanced_search.php?group_id='.$group_id,_('Advanced search'),array('class'=>'lnkutility'));
694 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
695 // display the searchmask
697 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
698 <input type="hidden" name="search" value="1"/>
699 <input type="hidden" name="group_id" value="'.$group_id.'"/>
700 <div id="advancedsearchtext">
701 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
702 <input type="submit" name="submitbutton" value="'._('Search').'" />
703 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
704 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
706 print '<br/> '._('Select').' <a href="javascript:setCheckBoxes(\'\',true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a>';
708 print $this->createUnderSections($sectionsArray).'
712 //create javascript methods for select none/all
714 <script type="text/javascript">
715 <!-- method for disable/enable checkboxes
716 function setCheckBoxes(parent, checked) {
719 for (var i = 0; i < document.advancedsearch.elements.length; i++)
720 if (document.advancedsearch.elements[i].type == "checkbox")
721 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
722 document.advancedsearch.elements[i].checked = checked;
730 function createUnderSections($sectionsArray) {
732 foreach ($sectionsArray as $section) {
733 if(is_array($section)) {
734 $countLines += (3 + count ($section));
736 //2 lines one for section name and one for checkbox
740 $breakLimit = round($countLines/3);
741 $break = $breakLimit;
744 <div id="advancedsearch"><ul>';
745 foreach($sectionsArray as $key => $section) {
746 $oldcountlines = $countLines;
747 if (is_array($section)) {
748 $countLines += (3 + count ($section));
753 if ($countLines >= $break) {
754 //if the next block is so large that shifting it to the next column hits the breakpoint better
755 //the second part of statement (behind &&) proofs, that no 4th column is added
756 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
757 $break += $breakLimit;
761 $return .= '<li><fieldset><legend>'.$group_subsection_names[$key].'</legend>'
762 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
766 if (!is_array($section)) {
767 $return .= '<li><input type="checkbox" name="'.urlencode($key).'"';
768 if (isset($GLOBALS[urlencode($key)]))
769 $return .= ' checked="checked" ';
770 $return .= ' /></input>'.$group_subsection_names[$key].'</li>';
773 foreach($section as $underkey => $undersection) {
774 $return .= ' <li><input type="checkbox" name="'.urlencode($key.$underkey).'"';
775 if (isset($GLOBALS[urlencode($key.$underkey)]))
776 $return .= ' checked ';
777 $return .= '></input>'.$undersection.'</li>';
780 $return .= '</ul></div></fieldset></li>';
782 if ($countLines >= $break) {
783 if (($countLines - $break) < ($break - $countLines)) {
784 $break += $breakLimit;
788 $return.='</div></ul>';
793 * beginSubMenu() - Opening a submenu.
795 * @return string Html to start a submenu.
797 function beginSubMenu () {
804 * endSubMenu() - Closing a submenu.
806 * @return string Html to end a submenu.
808 function endSubMenu () {
809 $return = '</strong></p>';
814 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
816 * @param array The array of titles.
817 * @param array The array of title links.
818 * @return string Html to build a submenu.
820 function printSubMenu ($title_arr,$links_arr) {
821 $count=count($title_arr);
826 for ($i=0; $i<$count; $i++) {
828 <a href="'.$links_arr[$i].'">'.$title_arr[$i].'</a> | ';
831 <a href="'.$links_arr[$i].'">'.$title_arr[$i].'</a>';
836 * subMenu() - Takes two array of titles and links and build a menu.
838 * @param array The array of titles.
839 * @param array The array of title links.
840 * @return string Html to build a submenu.
842 function subMenu ($title_arr,$links_arr) {
843 $return = $this->beginSubMenu () ;
844 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
845 $return .= $this->endSubMenu () ;
850 * multiTableRow() - create a mutlilevel row in a table
852 * @param string the row attributes
853 * @param array the array of cell data, each element is an array,
854 * the first item being the text,
855 * the subsequent items are attributes (dont include
856 * the bgcolor for the title here, that will be
857 * handled by $istitle
858 * @param boolean is this row part of the title ?
861 function multiTableRow($row_attr, $cell_data, $istitle) {
865 $return .=' align="center" class="multiTableRowTitle"';
868 for ( $c = 0; $c < count($cell_data); $c++ ) {
870 for ( $a=1; $a < count($cell_data[$c]); $a++) {
871 $return .= $cell_data[$c][$a].' ';
875 $return .='<span class="multiTableRowTitle">';
877 $return .= $cell_data[$c][0];
891 * feedback() - returns the htmlized feedback string when an action is performed.
893 * @param string feedback string
894 * @return string htmlized feedback
896 function feedback($feedback) {
901 <span class="feedback">'.strip_tags($feedback, '<br>').'</span>';
906 * getThemeIdFromName()
908 * @param string the dirname of the theme
909 * @return integer the theme id
911 function getThemeIdFromName($dirname) {
912 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
913 return db_result($res,0,'theme_id');
916 function quickNav() {
917 if (!session_loggedin()) {
920 $res=db_query("SELECT * FROM groups NATURAL JOIN user_group WHERE user_id='".user_getid()."' ORDER BY group_name");
922 if (!$res || db_numrows($res) < 1) {
926 <form name="quicknavform" action="" >
927 <select name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">';
929 <option value="">Quick Jump To...</option>';
930 for ($i=0; $i<db_numrows($res); $i++) {
932 <option value="/projects/'.db_result($res,$i,'unix_group_name').'/">'.db_result($res,$i,'group_name').'</option>';
933 if (trim(db_result($res,$i,'admin_flags'))=='A') {
935 <option value="/project/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
938 if (db_result($res,$i,'use_tracker')) {
940 <option value="/tracker/?group_id='.db_result($res,$i,'group_id').'"> Tracker</option>';
941 if (db_result($res,$i,'admin_flags') || db_result($res,$i,'tracker_flags')) {
943 <option value="/tracker/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
947 if (db_result($res,$i,'use_pm')) {
949 <option value="/pm/?group_id='.db_result($res,$i,'group_id').'"> Task Manager</option>';
950 if (trim(db_result($res,$i,'admin_flags')) =='A' || db_result($res,$i,'project_flags')) {
952 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
956 if (db_result($res,$i,'use_frs')) {
958 <option value="/frs/?group_id='.db_result($res,$i,'group_id').'"> Files</option>';
959 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'release_flags')) {
961 <option value="/frs/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
965 if (db_result($res,$i,'use_scm')) {
967 <option value="/scm/?group_id='.db_result($res,$i,'group_id').'"> SCM</option>';
968 /*if (db_result($res,$i,'admin_flags') || db_result($res,$i,'project_flags')) {
970 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
974 if (db_result($res,$i,'use_forum')) {
976 <option value="/forum/?group_id='.db_result($res,$i,'group_id').'"> Forum</option>';
977 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'forum_flags')) {
979 <option value="/forum/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
983 if (db_result($res,$i,'use_mail')) {
985 <option value="/mail/?group_id='.db_result($res,$i,'group_id').'"> Lists</option>';
986 if (trim(db_result($res,$i,'admin_flags'))=='A') {
988 <option value="/mail/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
992 if (db_result($res,$i,'use_docman')) {
994 <option value="/docman/?group_id='.db_result($res,$i,'group_id').'"> Docs</option>';
995 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'doc_flags')) {
997 <option value="/docman/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1001 if (db_result($res,$i,'use_news')) {
1003 <option value="/news/?group_id='.db_result($res,$i,'group_id').'"> News</option>';
1004 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1006 <option value="/news/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1010 if (db_result($res,$i,'use_survey')) {
1012 <option value="/survey/?group_id='.db_result($res,$i,'group_id').'"> Surveys</option>';
1013 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1015 <option value="/survey/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1031 // c-file-style: "bsd"