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';
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 * headerStart() - common code for all themes
65 * @param array Header parameters array
67 function headerStart($params) {
68 if (!$params['title']) {
69 $params['title'] = $GLOBALS['sys_name'];
71 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
73 print '<?xml version="1.0" encoding="utf-8"';
77 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
78 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
80 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo _('en') ?>"
81 lang="<?php echo _('en') ?>">
84 <meta http-equiv="Content-Type"
85 content="text/html; charset=utf-8" />
86 <title><?php echo $params['title']; ?></title>
88 title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS"
89 href="<?php echo util_make_url ('/export/rss_sfnews.php'); ?>"
90 type="application/rss+xml" />
92 title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS 2.0"
93 href="<?php echo util_make_url ('/export/rss20_news.php'); ?>"
94 type="application/rss+xml" />
96 title="<?php echo $GLOBALS['sys_name']; ?> - New Projects RSS"
97 href="<?php echo util_make_url ('/export/rss_sfprojects.php'); ?>"
98 type="application/rss+xml" />
100 <?php if (isset($GLOBALS['group_id'])) {
101 $activity = '<link rel="alternate" title="'.$GLOBALS['sys_name'].' - New Activity RSS" href="'.
102 util_make_url ('/export/rss20_activity.php?group_id='.$GLOBALS['group_id']).
103 '" type="application/rss+xml"/>';
109 /* check if a personalized css stylesheet exist, if yes include only
111 new stylesheets should use the <themename>.css file
113 $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css';
114 if (file_exists($theme_cssfile)){
116 <link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css').'"/>';
120 <script language="JavaScript" type="text/javascript">
123 function admin_window(adminurl) {
124 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
127 function help_window(helpurl) {
128 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
131 <?php plugin_hook ("javascript",false) ; ?>
133 <?php plugin_hook ('cssfile',$this); ?>
140 function header($params) {
141 $this->headerStart($params); ?>
148 <h1><?php echo util_make_link ('/',_('Home')); ?></h1>
152 if (session_loggedin()) {
153 echo util_make_link ('/account/logout.php',_('Log Out'));
155 echo util_make_link ('/account/',_('My Account'));
158 echo util_make_link ('/account/login.php',_('Log In'));
160 if (!$GLOBALS['sys_user_reg_restricted']) {
161 echo util_make_link ('/account/register.php',_('New Account'));
168 <div id="headercontent"><br />
169 <?php echo $this->searchBox();
175 <div id="outertabscontainer">
176 <div id="outertabs-left"></div>
177 <div id="outertabs-content"><?php echo $this->outerTabs($params);
179 <div id="outertabs-right"></div>
184 if (isset($params['group']) && $params['group']) {
186 <div id="projecttabscontainer">
187 <div id="projecttabs-left"></div>
188 <div id="projecttabs-content"><?echo $this->projectTabs($params['toptab'],$params['group']);?>
190 <div id="projecttabs-right"></div>
197 <div id="gforge-content">
198 <div id="<?php echo "gforge-content-".$this->selected_id;
200 <fieldset><legend><?php
201 echo '<a href="'.$this->selected_dir.'">'.$this->selected_title.'</a>';
206 function footer($params){
207 echo '</fieldset></div></div>';
208 $this->footerEnd($params);
211 function footerEnd($params) { ?> <!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
212 <div id="footer"><a href="http://fusionforge.org/"><img
213 src="<?php echo util_make_url ('/images/pow-fusionforge.png'); ?>"
214 alt="Powered By FusionForge"
218 global $sys_show_source;
219 if ($sys_show_source) {
220 echo util_make_link ('/source.php?file='.getStringFromServer('SCRIPT_NAME'),_('Show source'),array('class'=>'showsource'));
230 function getRootIndex() {
231 return $this->rootindex;
235 * boxTop() - Top HTML box
237 * @param string Box title
238 * @param bool Whether to echo or return the results
239 * @param string The box background color
241 function boxTop($title) {
243 <!-- Box Top Start -->
245 <table cellspacing="0" cellpadding="0" width="100%" border="0">
246 <tr class="tableheading">
247 <td valign="top" align="right" width="10"><img src="'.$this->imgroot.'clear.png'.'" width="10" height="20" alt="" /></td>
248 <td width="100%"><span class="titlebar">'.$title.'</span></td>
249 <td valign="top" width="10"><img src="'.$this->imgroot.'clear.png'.'" width="10" height="20" alt=""/></td>
253 <table cellspacing="2" cellpadding="2" width="100%" border="0" class="tablecontent">
257 <!-- Box Top End -->';
261 * boxMiddle() - Middle HTML box
263 * @param string Box title
264 * @param string The box background color
266 function boxMiddle($title) {
268 <!-- Box Middle Start -->
271 <tr class="tableheading">
272 <td colspan="2">'.$title.'</td>
274 <tr align="left" class="tablecontent">
276 <!-- Box Middle End -->';
280 * boxBottom() - Bottom HTML box
282 * @param bool Whether to echo or return the results
284 function boxBottom() {
286 <!-- Box Bottom Start -->
293 <!-- Box Bottom End -->';
297 * boxGetAltRowStyle() - Get an alternating row style for tables
299 * @param int Row number
301 function boxGetAltRowStyle($i) {
303 return ' class="altRowStyleEven"';
305 return ' class="altRowStyleOdd"';
310 * listTableTop() - Takes an array of titles and builds the first row of a new table.
312 * @param array The array of titles
313 * @param array The array of title links
315 function listTableTop ($title_arr,$links_arr=false,$cnt=0) {
319 $return='<div id="tabletop">';
322 $return='<div id="tabletop'.$cnt.'">';
328 $count=count($title_arr);
330 for ($i=0; $i<$count; $i++) {
332 <td><a href="'.$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
335 for ($i=0; $i<$count; $i++) {
337 <td>'.$title_arr[$i].'</td>';
340 return $return.'</tr></thead>';
345 function listTableBottom() {
353 function outerTabs($params) {
354 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
359 $TABS_TITLES[]=_('Home');
363 $TABS_TITLES[]=_('My Page');
364 if (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ) {
365 $selected=count($TABS_DIRS)-1;
368 if ($sys_use_trove) {
369 $thistab='softwaremap';
370 $TABS_IDS[]='softwaremap';
371 $TABS_DIRS[]='/'.$thistab.'/';
372 $TABS_TITLES[]=_('Project Tree');
373 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
374 $selected=count($TABS_DIRS)-1;
377 if ($sys_use_snippet) {
379 $TABS_IDS[]=$thistab;
380 $TABS_DIRS[]='/'.$thistab.'/';
381 $TABS_TITLES[]=_('Code Snippets');
382 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
383 $selected=count($TABS_DIRS)-1;
386 if ($sys_use_people) {
388 $TABS_IDS[]=$thistab;
389 $TABS_DIRS[]='/'.$thistab.'/';
390 $TABS_TITLES[]=_('Project Openings');
391 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
392 $selected=count($TABS_DIRS)-1;
396 $PLUGIN_TABS_DIRS = Array();
397 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
398 $hookParams['TITLES'] = &$TABS_TITLES;
399 plugin_hook ("outermenu", $hookParams) ;
400 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
402 if (user_ismember(1,'A')) {
404 $TABS_IDS[]=$thistab;
405 $TABS_DIRS[]='/'.$thistab.'/';
406 $TABS_TITLES[]=_('Admin');
407 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
408 $selected=count($TABS_DIRS)-1;
412 if (user_ismember($GLOBALS['sys_stats_group'])) {
413 $thistab='reporting';
414 $TABS_IDS[]=$thistab;
415 $TABS_DIRS[]='/'.$thistab.'/';
416 $TABS_TITLES[]=_('Reporting');
417 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
418 $selected=count($TABS_DIRS)-1;
422 if(isset($params['group']) && $params['group']) {
423 // get group info using the common result set
424 $project =& group_get_object($params['group']);
425 if ($project && is_object($project)) {
426 if ($project->isError()) {
428 } elseif (!$project->isProject()) {
431 $TABS_DIRS[]=util_make_url_g ($project->getUnixName(),$params['group']);
432 $TABS_TITLES[]=$project->getPublicName();
433 $selected=count($TABS_DIRS)-1;
436 } elseif (count($PLUGIN_TABS_DIRS)>0) {
437 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
438 if (strstr($GLOBALS['REQUEST_URI'],$PLUGIN_TABS_DIRS_VALUE)) {
439 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
444 $c=(count($TABS_TITLES)-1);
445 if(isset($params['group']) && $params['group']) {
446 /* project is selected */
449 for ($i=0; $i<=$c; $i++) {
450 if ($selected == $i){
451 $this->selected_title = $TABS_TITLES[$i];
452 $this->selected_dir = $TABS_DIRS[$i];
453 $this->selected_id = $TABS_IDS[$i];
454 @$return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>'gforge-selected','title'=>$TABS_TITLES[$i]));
457 @$return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>'gforge-'.$TABS_IDS[$i],'title'=>$TABS_TITLES[$i]));
460 if(isset($params['group']) && $params['group']) {
461 $return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>'gforge-selected','title'=>$TABS_TITLES[$i]));
462 $this->selected_title = $TABS_TITLES[$i];
468 * projectTabs() - Prints out the project tabs, contained here in case
469 * we want to allow it to be overriden
471 * @param string Is the tab currently selected
472 * @param string Is the group we should look up get title info
474 function projectTabs($toptab,$group) {
475 // get group info using the common result set
476 $project =& group_get_object($group);
477 if (!$project || !is_object($project)) {
480 if ($project->isError()) {
481 //wasn't found or some other problem
484 if (!$project->isProject()) {
488 // $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
489 // $TABS_TITLES[]=$project->getPublicName();
492 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
493 $TABS_DIRS[]='/project/?group_id='.$group;
495 $TABS_DIRS[]='/projects/'.$project->getUnixName();
497 $TABS_IDS[]='gforge-project-summary';
498 $TABS_TITLES[]=_('Summary');
499 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
501 if (user_ismember($group,'A')) {
503 $TABS_DIRS[]='/project/admin/?group_id='. $group;
504 $TABS_IDS[]='gforge-project-admin';
505 $TABS_TITLES[]=_('Admin');
506 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
509 /* $TABS_DIRS[]='http://'. $project->getHomePage();
510 $TABS_TITLES[]=_('Home Page');
513 $TABS_DIRS[]='/activity/?group_id='. $group;
514 $TABS_IDS[]='gforge-project-activity';
515 $TABS_TITLES[]=_('Activity');
516 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
519 if ($project->usesForum()) {
520 $TABS_DIRS[]='/forum/?group_id='.$group;
521 $TABS_IDS[]='gforge-project-forum';
522 $TABS_TITLES[]=_('Forums');
523 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
527 if ($project->usesTracker()) {
528 $TABS_DIRS[]='/tracker/?group_id='.$group;
529 $TABS_IDS[]='gforge-project-tracker';
530 $TABS_TITLES[]=_('Tracker');
531 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
532 ? $selected=(count($TABS_TITLES)-1) : '' );
536 if ($project->usesMail()) {
537 $TABS_DIRS[]='/mail/?group_id='.$group;
538 $TABS_IDS[]='gforge-project-mail';
539 $TABS_TITLES[]=_('Lists');
540 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
544 if ($project->usesPm()) {
545 $TABS_IDS[]='gforge-project-task';
546 $TABS_DIRS[]='/pm/?group_id='.$group;
547 $TABS_TITLES[]=_('Tasks');
548 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
552 if ($project->usesDocman()) {
553 $TABS_DIRS[]='/docman/?group_id='.$group;
554 $TABS_IDS[]='gforge-project-docman';
555 $TABS_TITLES[]=_('Docs');
556 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
560 if ($project->usesSurvey()) {
561 $TABS_DIRS[]='/survey/?group_id='.$group;
562 $TABS_IDS[]='gforge-project-survey';
563 $TABS_TITLES[]=_('Surveys');
564 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
568 if ($project->usesNews()) {
569 $TABS_IDS[]='gforge-project-news';
570 $TABS_DIRS[]='/news/?group_id='.$group;
571 $TABS_TITLES[]=_('News');
572 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
576 if ($project->usesSCM()) {
577 $TABS_IDS[]='gforge-project-scm';
578 $TABS_DIRS[]='/scm/?group_id='.$group;
579 $TABS_TITLES[]=_('SCM');
580 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
583 // groupmenu_after_scm hook
584 $hookParams['DIRS'] = &$TABS_DIRS;
585 $hookParams['TITLES'] = &$TABS_TITLES;
586 $hookParams['toptab'] = &$toptab;
587 $hookParams['selected'] = &$selected;
588 $hookParams['group_id'] = $group ;
590 plugin_hook ("groupmenu_scm", $hookParams) ;
593 if ($project->usesFRS()) {
594 $TABS_IDS[]='gforge-project-frs';
595 $TABS_DIRS[]='/frs/?group_id='.$group;
596 $TABS_TITLES[]=_('Files');
597 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
601 $hookParams['DIRS'] = &$TABS_DIRS;
602 $hookParams['TITLES'] = &$TABS_TITLES;
603 $hookParams['toptab'] = &$toptab;
604 $hookParams['selected'] = &$selected;
605 $hookParams['group'] = $group;
607 plugin_hook ("groupmenu", $hookParams) ;
610 $c=(count($TABS_TITLES)-1);
611 for ($i=0; $i<=$c; $i++) {
613 $this->selected_title = $TABS_TITLES[$i];
614 $this->selected_dir = $TABS_DIRS[$i];
615 //$this->selected_id = $TABS_IDS[$i];
616 $return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>'gforge-project-selected'));
620 if (!isset($TABS_IDS[$i]) || $TABS_IDS[$i]==''){
621 $return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>'gforge-project-std','title'=>$TABS_TITLES[$i]));
625 $return .= util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('id'=>$TABS_IDS[$i],'title'=>$TABS_TITLES[$i]));
634 function searchBox() {
635 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
637 if(get_magic_quotes_gpc()) {
638 $defaultWords = stripslashes($words);
640 $defaultWords = $words;
643 // if there is no search currently, set the default
644 if ( ! isset($type_of_search) ) {
649 <form action="/search/" method="get">';
653 SEARCH__PARAMETER_GROUP_ID => $group_id,
654 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
655 SEARCH__PARAMETER_FORUM_ID => $forum_id,
656 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
659 $searchManager =& getSearchManager();
660 $searchManager->setParametersValues($parameters);
661 $searchEngines =& $searchManager->getAvailableSearchEngines();
662 echo '<select name="type_of_search">';
663 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
664 $searchEngine =& $searchEngines[$i];
665 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
668 $parameters = $searchManager->getParameters();
669 foreach($parameters AS $name => $value) {
670 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
673 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
676 print '<input type="submit" name="Search" value="'._('Search').'" />';
679 if (isset($group_id)&& $group_id) {
680 echo util_make_link ('/search/advanced_search.php?group_id='.$group_id,_('Advanced search'),array('class'=>'lnkutility'));
686 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
687 // display the searchmask
689 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
690 <input type="hidden" name="search" value="1"/>
691 <input type="hidden" name="group_id" value="'.$group_id.'"/>
692 <div id="advancedsearchtext">
693 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
694 <input type="submit" name="submitbutton" value="'._('Search').'" />
695 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
696 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
698 print '<br/> '._('Select').' <a href="javascript:setCheckBoxes(\'\',true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a>';
700 print $this->createUnderSections($sectionsArray).'
704 //create javascript methods for select none/all
706 <script type="text/javascript">
707 <!-- method for disable/enable checkboxes
708 function setCheckBoxes(parent, checked) {
711 for (var i = 0; i < document.advancedsearch.elements.length; i++)
712 if (document.advancedsearch.elements[i].type == "checkbox")
713 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
714 document.advancedsearch.elements[i].checked = checked;
722 function createUnderSections($sectionsArray) {
724 foreach ($sectionsArray as $section) {
725 if(is_array($section)) {
726 $countLines += (3 + count ($section));
728 //2 lines one for section name and one for checkbox
732 $breakLimit = round($countLines/3);
733 $break = $breakLimit;
736 <div id="advancedsearch"><ul>';
737 foreach($sectionsArray as $key => $section) {
738 $oldcountlines = $countLines;
739 if (is_array($section)) {
740 $countLines += (3 + count ($section));
745 if ($countLines >= $break) {
746 //if the next block is so large that shifting it to the next column hits the breakpoint better
747 //the second part of statement (behind &&) proofs, that no 4th column is added
748 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
749 $break += $breakLimit;
753 $return .= '<li><fieldset><legend>'.$group_subsection_names[$key].'</legend>'
754 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
758 if (!is_array($section)) {
759 $return .= '<li><input type="checkbox" name="'.urlencode($key).'"';
760 if (isset($GLOBALS[urlencode($key)]))
761 $return .= ' checked="checked" ';
762 $return .= ' /></input>'.$group_subsection_names[$key].'</li>';
765 foreach($section as $underkey => $undersection) {
766 $return .= ' <li><input type="checkbox" name="'.urlencode($key.$underkey).'"';
767 if (isset($GLOBALS[urlencode($key.$underkey)]))
768 $return .= ' checked ';
769 $return .= '></input>'.$undersection.'</li>';
772 $return .= '</ul></div></fieldset></li>';
774 if ($countLines >= $break) {
775 if (($countLines - $break) < ($break - $countLines)) {
776 $break += $breakLimit;
780 $return.='</div></ul>';
785 * beginSubMenu() - Opening a submenu.
787 * @return string Html to start a submenu.
789 function beginSubMenu () {
796 * endSubMenu() - Closing a submenu.
798 * @return string Html to end a submenu.
800 function endSubMenu () {
801 $return = '</strong></p>';
806 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
808 * @param array The array of titles.
809 * @param array The array of title links.
810 * @return string Html to build a submenu.
812 function printSubMenu ($title_arr,$links_arr) {
813 $count=count($title_arr);
818 for ($i=0; $i<$count; $i++) {
819 $return .= util_make_link ($links_arr[$i],$title_arr[$i]).' | ';
821 $return .= util_make_link ($links_arr[$i],$title_arr[$i]);
826 * subMenu() - Takes two array of titles and links and build a menu.
828 * @param array The array of titles.
829 * @param array The array of title links.
830 * @return string Html to build a submenu.
832 function subMenu ($title_arr,$links_arr) {
833 $return = $this->beginSubMenu () ;
834 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
835 $return .= $this->endSubMenu () ;
840 * multiTableRow() - create a mutlilevel row in a table
842 * @param string the row attributes
843 * @param array the array of cell data, each element is an array,
844 * the first item being the text,
845 * the subsequent items are attributes (dont include
846 * the bgcolor for the title here, that will be
847 * handled by $istitle
848 * @param boolean is this row part of the title ?
851 function multiTableRow($row_attr, $cell_data, $istitle) {
855 $return .=' align="center" class="multiTableRowTitle"';
858 for ( $c = 0; $c < count($cell_data); $c++ ) {
860 for ( $a=1; $a < count($cell_data[$c]); $a++) {
861 $return .= $cell_data[$c][$a].' ';
865 $return .='<span class="multiTableRowTitle">';
867 $return .= $cell_data[$c][0];
881 * feedback() - returns the htmlized feedback string when an action is performed.
883 * @param string feedback string
884 * @return string htmlized feedback
886 function feedback($feedback) {
891 <span class="feedback">'.strip_tags($feedback, '<br>').'</span>';
896 * getThemeIdFromName()
898 * @param string the dirname of the theme
899 * @return integer the theme id
901 function getThemeIdFromName($dirname) {
902 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
903 return db_result($res,0,'theme_id');
906 function quickNav() {
907 if (!session_loggedin()) {
910 $res=db_query("SELECT * FROM groups NATURAL JOIN user_group WHERE user_id='".user_getid()."' ORDER BY group_name");
912 if (!$res || db_numrows($res) < 1) {
916 <form name="quicknavform" action="" >
917 <select name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">';
919 <option value="">Quick Jump To...</option>';
920 for ($i=0; $i<db_numrows($res); $i++) {
922 <option value="/projects/'.db_result($res,$i,'unix_group_name').'/">'.db_result($res,$i,'group_name').'</option>';
923 if (trim(db_result($res,$i,'admin_flags'))=='A') {
925 <option value="/project/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
928 if (db_result($res,$i,'use_tracker')) {
930 <option value="/tracker/?group_id='.db_result($res,$i,'group_id').'"> Tracker</option>';
931 if (db_result($res,$i,'admin_flags') || db_result($res,$i,'artifact_flags')) {
933 <option value="/tracker/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
937 if (db_result($res,$i,'use_pm')) {
939 <option value="/pm/?group_id='.db_result($res,$i,'group_id').'"> Task Manager</option>';
940 if (trim(db_result($res,$i,'admin_flags')) =='A' || db_result($res,$i,'project_flags')) {
942 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
946 if (db_result($res,$i,'use_frs')) {
948 <option value="/frs/?group_id='.db_result($res,$i,'group_id').'"> Files</option>';
949 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'release_flags')) {
951 <option value="/frs/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
955 if (db_result($res,$i,'use_scm')) {
957 <option value="/scm/?group_id='.db_result($res,$i,'group_id').'"> SCM</option>';
958 /*if (db_result($res,$i,'admin_flags') || db_result($res,$i,'project_flags')) {
960 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
964 if (db_result($res,$i,'use_forum')) {
966 <option value="/forum/?group_id='.db_result($res,$i,'group_id').'"> Forum</option>';
967 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'forum_flags')) {
969 <option value="/forum/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
973 if (db_result($res,$i,'use_mail')) {
975 <option value="/mail/?group_id='.db_result($res,$i,'group_id').'"> Lists</option>';
976 if (trim(db_result($res,$i,'admin_flags'))=='A') {
978 <option value="/mail/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
982 if (db_result($res,$i,'use_docman')) {
984 <option value="/docman/?group_id='.db_result($res,$i,'group_id').'"> Docs</option>';
985 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'doc_flags')) {
987 <option value="/docman/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
991 if (db_result($res,$i,'use_news')) {
993 <option value="/news/?group_id='.db_result($res,$i,'group_id').'"> News</option>';
994 if (trim(db_result($res,$i,'admin_flags'))=='A') {
996 <option value="/news/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1000 if (db_result($res,$i,'use_survey')) {
1002 <option value="/survey/?group_id='.db_result($res,$i,'group_id').'"> Surveys</option>';
1003 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1005 <option value="/survey/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1021 // c-file-style: "bsd"