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 $gfwww.'search/include/SearchManager.class.php';
17 require_once $gfcommon.'include/FusionForge.class.php';
19 class Theme extends Error {
22 * The default main page content
24 var $rootindex = 'index_std.php';
27 * The root location of the theme
28 * @var string $themeroot
33 * The root location for images
35 * @var string $imgroot
38 var $imgroot = '/themes/gforge/images/';
46 * Layout() - Constructor
50 $this->themeroot=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'];
51 /* if images directory exists in theme, then use it as imgroot */
52 if (file_exists ($this->themeroot.'/images')){
53 $this->imgroot='/themes/'.$GLOBALS['sys_theme'].'/images/';
55 // Constructor for parent class...
56 if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
57 $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
64 * headerStart() - common code for all themes
66 * @param array Header parameters array
68 function headerStart($params) {
69 if (!$params['title']) {
70 $params['title'] = $GLOBALS['sys_name'];
72 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
74 print '<?xml version="1.0" encoding="utf-8"';
78 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
79 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
81 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo _('en') ?>"
82 lang="<?php echo _('en') ?>">
85 <meta http-equiv="Content-Type"
86 content="text/html; charset=utf-8" />
87 <title><?php echo $params['title']; ?></title>
89 title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS"
90 href="<?php echo util_make_url ('/export/rss_sfnews.php'); ?>"
91 type="application/rss+xml" />
93 title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS 2.0"
94 href="<?php echo util_make_url ('/export/rss20_news.php'); ?>"
95 type="application/rss+xml" />
97 title="<?php echo $GLOBALS['sys_name']; ?> - New Projects RSS"
98 href="<?php echo util_make_url ('/export/rss_sfprojects.php'); ?>"
99 type="application/rss+xml" />
101 <?php if (isset($GLOBALS['group_id'])) {
102 $activity = '<link rel="alternate" title="'.$GLOBALS['sys_name'].' - New Activity RSS" href="'.
103 util_make_url ('/export/rss20_activity.php?group_id='.$GLOBALS['group_id']).
104 '" type="application/rss+xml"/>';
110 /* check if a personalized css stylesheet exist, if yes include only
112 new stylesheets should use the <themename>.css file
114 $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css';
115 if (file_exists($theme_cssfile)){
117 <link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css').'"/>';
121 <script language="JavaScript" type="text/javascript">
124 function admin_window(adminurl) {
125 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
128 function help_window(helpurl) {
129 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
132 <?php plugin_hook ("javascript",false) ; ?>
134 <?php plugin_hook ('cssfile',$this); ?>
141 function header($params) {
142 $this->headerStart($params); ?>
149 <h1><?php echo util_make_link ('/',_('Home')); ?></h1>
153 if (session_loggedin()) {
154 echo util_make_link ('/account/logout.php',_('Log Out'));
156 echo util_make_link ('/account/',_('My Account'));
159 echo util_make_link ('/account/login.php',_('Log In'));
161 if (!$GLOBALS['sys_user_reg_restricted']) {
162 echo util_make_link ('/account/register.php',_('New Account'));
169 <div id="headercontent"><br />
170 <?php echo $this->searchBox();
176 <div id="outertabscontainer">
177 <div id="outertabs-left"></div>
178 <div id="outertabs-content"><?php echo $this->outerTabs($params);
180 <div id="outertabs-right"></div>
185 if (isset($params['group']) && $params['group']) {
187 <div id="projecttabscontainer">
188 <div id="projecttabs-left"></div>
189 <div id="projecttabs-content"><?echo $this->projectTabs($params['toptab'],$params['group']);?>
191 <div id="projecttabs-right"></div>
198 <div id="gforge-content">
199 <div id="<?php echo "gforge-content-".$this->selected_id;
201 <fieldset><legend><?php
202 echo '<a href="'.$this->selected_dir.'">'.$this->selected_title.'</a>';
207 function footer($params){
208 echo '</fieldset></div></div>';
209 $this->footerEnd($params);
212 function footerEnd($params) { ?> <!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
213 <div id="footer"><a href="http://fusionforge.org/"><img
214 src="<?php echo util_make_url ('/images/pow-fusionforge.png'); ?>"
215 alt="Powered By FusionForge"
219 $forge = new FusionForge() ;
220 printf (_('This site is running %1$s version %2$s'),
221 $forge->software_name,
222 $forge->software_version) ;
226 global $sys_show_source;
227 if ($sys_show_source) {
228 echo util_make_link ('/source.php?file='.getStringFromServer('SCRIPT_NAME'),_('Show source'),array('class'=>'showsource'));
238 function getRootIndex() {
239 return $this->rootindex;
243 * boxTop() - Top HTML box
245 * @param string Box title
246 * @param bool Whether to echo or return the results
247 * @param string The box background color
249 function boxTop($title) {
251 <!-- Box Top Start -->
253 <table cellspacing="0" cellpadding="0" width="100%" border="0">
254 <tr class="tableheading">
255 <td valign="top" align="right" width="10"><img src="'.$this->imgroot.'clear.png'.'" width="10" height="20" alt="" /></td>
256 <td width="100%"><span class="titlebar">'.$title.'</span></td>
257 <td valign="top" width="10"><img src="'.$this->imgroot.'clear.png'.'" width="10" height="20" alt=""/></td>
261 <table cellspacing="2" cellpadding="2" width="100%" border="0" class="tablecontent">
265 <!-- Box Top End -->';
269 * boxMiddle() - Middle HTML box
271 * @param string Box title
272 * @param string The box background color
274 function boxMiddle($title) {
276 <!-- Box Middle Start -->
279 <tr class="tableheading">
280 <td colspan="2">'.$title.'</td>
282 <tr align="left" class="tablecontent">
284 <!-- Box Middle End -->';
288 * boxBottom() - Bottom HTML box
290 * @param bool Whether to echo or return the results
292 function boxBottom() {
294 <!-- Box Bottom Start -->
301 <!-- Box Bottom End -->';
305 * boxGetAltRowStyle() - Get an alternating row style for tables
307 * @param int Row number
309 function boxGetAltRowStyle($i) {
311 return ' class="altRowStyleEven"';
313 return ' class="altRowStyleOdd"';
318 * listTableTop() - Takes an array of titles and builds the first row of a new table.
320 * @param array The array of titles
321 * @param array The array of title links
323 function listTableTop ($title_arr,$links_arr=false,$cnt=0) {
327 $return='<div id="tabletop">';
330 $return='<div id="tabletop'.$cnt.'">';
336 $count=count($title_arr);
338 for ($i=0; $i<$count; $i++) {
340 <td><a href="'.$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
343 for ($i=0; $i<$count; $i++) {
345 <td>'.$title_arr[$i].'</td>';
348 return $return.'</tr></thead>';
353 function listTableBottom() {
361 function outerTabs($params) {
362 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
367 $TABS_TITLES[]=_('Home');
371 $TABS_TITLES[]=_('My Page');
372 if (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ) {
373 $selected=count($TABS_DIRS)-1;
376 if ($sys_use_trove) {
377 $thistab='softwaremap';
378 $TABS_IDS[]='softwaremap';
379 $TABS_DIRS[]='/'.$thistab.'/';
380 $TABS_TITLES[]=_('Project Tree');
381 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
382 $selected=count($TABS_DIRS)-1;
385 if ($sys_use_snippet) {
387 $TABS_IDS[]=$thistab;
388 $TABS_DIRS[]='/'.$thistab.'/';
389 $TABS_TITLES[]=_('Code Snippets');
390 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
391 $selected=count($TABS_DIRS)-1;
394 if ($sys_use_people) {
396 $TABS_IDS[]=$thistab;
397 $TABS_DIRS[]='/'.$thistab.'/';
398 $TABS_TITLES[]=_('Project Openings');
399 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
400 $selected=count($TABS_DIRS)-1;
404 $PLUGIN_TABS_DIRS = Array();
405 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
406 $hookParams['TITLES'] = &$TABS_TITLES;
407 plugin_hook ("outermenu", $hookParams) ;
408 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
410 if (user_ismember(1,'A')) {
412 $TABS_IDS[]=$thistab;
413 $TABS_DIRS[]='/'.$thistab.'/';
414 $TABS_TITLES[]=_('Admin');
415 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
416 $selected=count($TABS_DIRS)-1;
420 if (user_ismember($GLOBALS['sys_stats_group'])) {
421 $thistab='reporting';
422 $TABS_IDS[]=$thistab;
423 $TABS_DIRS[]='/'.$thistab.'/';
424 $TABS_TITLES[]=_('Reporting');
425 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
426 $selected=count($TABS_DIRS)-1;
430 if(isset($params['group']) && $params['group']) {
431 // get group info using the common result set
432 $project =& group_get_object($params['group']);
433 if ($project && is_object($project)) {
434 if ($project->isError()) {
436 } elseif (!$project->isProject()) {
439 $TABS_DIRS[]=util_make_url_g ($project->getUnixName(),$params['group']);
440 $TABS_TITLES[]=$project->getPublicName();
441 $selected=count($TABS_DIRS)-1;
444 } elseif (count($PLUGIN_TABS_DIRS)>0) {
445 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
446 if (strstr($GLOBALS['REQUEST_URI'],$PLUGIN_TABS_DIRS_VALUE)) {
447 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
452 $c=(count($TABS_TITLES)-1);
453 if(isset($params['group']) && $params['group']) {
454 /* project is selected */
457 for ($i=0; $i<=$c; $i++) {
458 if ($selected == $i){
459 $this->selected_title = $TABS_TITLES[$i];
460 $this->selected_dir = $TABS_DIRS[$i];
461 $this->selected_id = $TABS_IDS[$i];
462 @$return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>'gforge-selected','title'=>$TABS_TITLES[$i]));
465 @$return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>'gforge-'.$TABS_IDS[$i],'title'=>$TABS_TITLES[$i]));
468 if(isset($params['group']) && $params['group']) {
469 $return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>'gforge-selected','title'=>$TABS_TITLES[$i]));
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 .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>'gforge-project-selected'));
628 if (!isset($TABS_IDS[$i]) || $TABS_IDS[$i]==''){
629 $return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>'gforge-project-std','title'=>$TABS_TITLES[$i]));
633 $return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>$TABS_IDS[$i],'title'=>$TABS_TITLES[$i]));
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++) {
827 $return .= util_make_link ($links_arr[$i],$title_arr[$i]).' | ';
829 $return .= util_make_link ($links_arr[$i],$title_arr[$i]);
834 * subMenu() - Takes two array of titles and links and build a menu.
836 * @param array The array of titles.
837 * @param array The array of title links.
838 * @return string Html to build a submenu.
840 function subMenu ($title_arr,$links_arr) {
841 $return = $this->beginSubMenu () ;
842 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
843 $return .= $this->endSubMenu () ;
848 * multiTableRow() - create a mutlilevel row in a table
850 * @param string the row attributes
851 * @param array the array of cell data, each element is an array,
852 * the first item being the text,
853 * the subsequent items are attributes (dont include
854 * the bgcolor for the title here, that will be
855 * handled by $istitle
856 * @param boolean is this row part of the title ?
859 function multiTableRow($row_attr, $cell_data, $istitle) {
863 $return .=' align="center" class="multiTableRowTitle"';
866 for ( $c = 0; $c < count($cell_data); $c++ ) {
868 for ( $a=1; $a < count($cell_data[$c]); $a++) {
869 $return .= $cell_data[$c][$a].' ';
873 $return .='<span class="multiTableRowTitle">';
875 $return .= $cell_data[$c][0];
889 * feedback() - returns the htmlized feedback string when an action is performed.
891 * @param string feedback string
892 * @return string htmlized feedback
894 function feedback($feedback) {
899 <span class="feedback">'.strip_tags($feedback, '<br>').'</span>';
904 * getThemeIdFromName()
906 * @param string the dirname of the theme
907 * @return integer the theme id
909 function getThemeIdFromName($dirname) {
910 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
911 return db_result($res,0,'theme_id');
914 function quickNav() {
915 if (!session_loggedin()) {
918 $res=db_query("SELECT * FROM groups NATURAL JOIN user_group WHERE user_id='".user_getid()."' ORDER BY group_name");
920 if (!$res || db_numrows($res) < 1) {
924 <form name="quicknavform" action="" >
925 <select name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">';
927 <option value="">Quick Jump To...</option>';
928 for ($i=0; $i<db_numrows($res); $i++) {
930 <option value="/projects/'.db_result($res,$i,'unix_group_name').'/">'.db_result($res,$i,'group_name').'</option>';
931 if (trim(db_result($res,$i,'admin_flags'))=='A') {
933 <option value="/project/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
936 if (db_result($res,$i,'use_tracker')) {
938 <option value="/tracker/?group_id='.db_result($res,$i,'group_id').'"> Tracker</option>';
939 if (db_result($res,$i,'admin_flags') || db_result($res,$i,'artifact_flags')) {
941 <option value="/tracker/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
945 if (db_result($res,$i,'use_pm')) {
947 <option value="/pm/?group_id='.db_result($res,$i,'group_id').'"> Task Manager</option>';
948 if (trim(db_result($res,$i,'admin_flags')) =='A' || db_result($res,$i,'project_flags')) {
950 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
954 if (db_result($res,$i,'use_frs')) {
956 <option value="/frs/?group_id='.db_result($res,$i,'group_id').'"> Files</option>';
957 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'release_flags')) {
959 <option value="/frs/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
963 if (db_result($res,$i,'use_scm')) {
965 <option value="/scm/?group_id='.db_result($res,$i,'group_id').'"> SCM</option>';
966 /*if (db_result($res,$i,'admin_flags') || db_result($res,$i,'project_flags')) {
968 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
972 if (db_result($res,$i,'use_forum')) {
974 <option value="/forum/?group_id='.db_result($res,$i,'group_id').'"> Forum</option>';
975 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'forum_flags')) {
977 <option value="/forum/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
981 if (db_result($res,$i,'use_mail')) {
983 <option value="/mail/?group_id='.db_result($res,$i,'group_id').'"> Lists</option>';
984 if (trim(db_result($res,$i,'admin_flags'))=='A') {
986 <option value="/mail/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
990 if (db_result($res,$i,'use_docman')) {
992 <option value="/docman/?group_id='.db_result($res,$i,'group_id').'"> Docs</option>';
993 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'doc_flags')) {
995 <option value="/docman/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
999 if (db_result($res,$i,'use_news')) {
1001 <option value="/news/?group_id='.db_result($res,$i,'group_id').'"> News</option>';
1002 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1004 <option value="/news/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1008 if (db_result($res,$i,'use_survey')) {
1010 <option value="/survey/?group_id='.db_result($res,$i,'group_id').'"> Surveys</option>';
1011 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1013 <option value="/survey/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1029 // c-file-style: "bsd"