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 '<a href="'.$GLOBALS['sys_urlprefix'].'/users/'.$user_name.'/">'.$realname.'</a>';
73 * headerStart() - common code for all themes
75 * @param array Header parameters array
77 function headerStart($params) {
80 if (!$params['title']) {
81 $params['title'] = $GLOBALS['sys_name'];
83 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
85 print '<?xml version="1.0" encoding="utf-8"';
89 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
90 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
92 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
93 lang="<?php echo _('en') ?>">
96 <meta http-equiv="Content-Type"
97 content="text/html; charset=utf-8" />
98 <title><?php echo $params['title']; ?></title>
100 title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS"
101 href="<?php echo $GLOBALS['sys_urlprefix']; ?>/export/rss_sfnews.php"
102 type="application/rss+xml" />
103 <link rel="alternate"
104 title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS 2.0"
105 href="<?php echo $GLOBALS['sys_urlprefix']; ?>/export/rss20_news.php"
106 type="application/rss+xml" />
107 <link rel="alternate"
108 title="<?php echo $GLOBALS['sys_name']; ?> - New Projects RSS"
109 href="<?php echo $GLOBALS['sys_urlprefix']; ?>/export/rss_sfprojects.php"
110 type="application/rss+xml" />
112 <?php if (isset($GLOBALS['group_id'])) {
113 $activity = '<link rel="alternate" title="'.$GLOBALS['sys_name'].' - New Activity RSS" href="'.$GLOBALS['sys_urlprefix'].'/export/rss20_activity.php?group_id='.$GLOBALS['group_id'].'" 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="'.$GLOBALS['sys_urlprefix'].'/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><a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/">Goto GForge</a></h1>
159 <!--<a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/"><img src="<?php echo $GLOBALS['sys_urlprefix']; ?>/themes/gforge-simple-theme/images/logo.png" border="0" margin="0" padding="0" valign="top"/></a>-->
161 <div id="util"><?php if (session_loggedin()) {
163 href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/logout.php"><?php echo _('Log Out'); ?></a><br />
164 <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/"><?php echo _('My Account'); ?></a><br />
168 ?> <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/login.php"><?php echo _('Log In'); ?></a><br />
169 <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/register.php"><?php echo _('New Account'); ?></a>
174 <div id="content"><br />
175 <?php echo $this->searchBox();
181 <div id="outertabscontainer">
182 <div id="outertabs-left"></div>
183 <div id="outertabs-content"><?php echo $this->outerTabs($params);
185 <div id="outertabs-right"></div>
190 if (isset($params['group']) && $params['group']) {
192 <div id="projecttabscontainer">
193 <div id="projecttabs-left"></div>
194 <div id="projecttabs-content"><?echo $this->projectTabs($params['toptab'],$params['group']);?>
196 <div id="projecttabs-right"></div>
203 <div id="gforge-content">
204 <div id="<?php echo "gforge-content-".$this->selected_id;
206 <fieldset><legend><?php
207 echo '<a href="'.$this->selected_dir.'">'.$this->selected_title.'</a>';
212 function footer($params){
213 echo '</fieldset></div></div>';
214 $this->footerEnd($params);
217 function footerEnd($params) { ?> <!-- PLEASE LEAVE "Powered By GForge" on your site -->
218 <div id="footer"><a href="http://gforge.org/"><img
219 src="<?php echo $GLOBALS['sys_urlprefix']; ?>/images/pow-gforge.png"
220 alt="Powered By GForge Collaborative Development Environment"
221 border="0" /></a></div>
223 global $sys_show_source;
224 if ($sys_show_source) {
225 print '<a class="showsource" href="'.$GLOBALS['sys_urlprefix'].'/source.php?file=' . getStringFromServer('SCRIPT_NAME') . '"> '._('Show source').' </a>';
235 function getRootIndex() {
236 return $this->rootindex;
240 * boxTop() - Top HTML box
242 * @param string Box title
243 * @param bool Whether to echo or return the results
244 * @param string The box background color
246 function boxTop($title) {
248 <!-- Box Top Start -->
250 <table cellspacing="0" cellpadding="0" width="100%" border="0">
251 <tr class="tableheading">
252 <td valign="top" align="right" width="10"><img src="'.$this->imgroot.'clear.png" width="10" height="20" alt="" /></td>
253 <td width="100%"><span class="titlebar">'.$title.'</span></td>
254 <td valign="top" width="10"><img src="'.$this->imgroot.'clear.png" width="10" height="20" alt=""/></td>
258 <table cellspacing="2" cellpadding="2" width="100%" border="0" class="tablecontent">
262 <!-- Box Top End -->';
266 * boxMiddle() - Middle HTML box
268 * @param string Box title
269 * @param string The box background color
271 function boxMiddle($title) {
273 <!-- Box Middle Start -->
276 <tr class="tableheading">
277 <td colspan="2">'.$title.'</td>
279 <tr align="left" class="tablecontent">
281 <!-- Box Middle End -->';
285 * boxBottom() - Bottom HTML box
287 * @param bool Whether to echo or return the results
289 function boxBottom() {
291 <!-- Box Bottom Start -->
298 <!-- Box Bottom End -->';
302 * boxGetAltRowStyle() - Get an alternating row style for tables
304 * @param int Row number
306 function boxGetAltRowStyle($i) {
308 return ' class="altRowStyleEven"';
310 return ' class="altRowStyleOdd"';
315 * listTableTop() - Takes an array of titles and builds the first row of a new table.
317 * @param array The array of titles
318 * @param array The array of title links
320 function listTableTop ($title_arr,$links_arr=false,$cnt=0) {
324 $return='<div id="tabletop">';
327 $return='<div id="tabletop'.$cnt.'">';
333 $count=count($title_arr);
335 for ($i=0; $i<$count; $i++) {
337 <td><a href="'.$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
340 for ($i=0; $i<$count; $i++) {
342 <td>'.$title_arr[$i].'</td>';
345 return $return.'</tr></thead>';
350 function listTableBottom() {
358 function outerTabs($params) {
359 global $Language,$sys_use_trove,$sys_use_snippet,$sys_use_people;
364 $TABS_TITLES[]=_('Home');
368 $TABS_TITLES[]=_('My Page');
369 if (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ) {
370 $selected=count($TABS_DIRS)-1;
373 if ($sys_use_trove) {
374 $thistab='softwaremap';
375 $TABS_IDS[]='softwaremap';
376 $TABS_DIRS[]='/'.$thistab.'/';
377 $TABS_TITLES[]=_('Project Tree');
378 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
379 $selected=count($TABS_DIRS)-1;
382 if ($sys_use_snippet) {
384 $TABS_IDS[]=$thistab;
385 $TABS_DIRS[]='/'.$thistab.'/';
386 $TABS_TITLES[]=_('Code Snippets');
387 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
388 $selected=count($TABS_DIRS)-1;
391 if ($sys_use_people) {
393 $TABS_IDS[]=$thistab;
394 $TABS_DIRS[]='/'.$thistab.'/';
395 $TABS_TITLES[]=_('Project Openings');
396 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
397 $selected=count($TABS_DIRS)-1;
401 $PLUGIN_TABS_DIRS = Array();
402 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
403 $hookParams['TITLES'] = &$TABS_TITLES;
404 plugin_hook ("outermenu", $hookParams) ;
405 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
407 if (user_ismember(1,'A')) {
409 $TABS_IDS[]=$thistab;
410 $TABS_DIRS[]='/'.$thistab.'/';
411 $TABS_TITLES[]=$Language->getText('menu',$thistab);
412 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
413 $selected=count($TABS_DIRS)-1;
417 if (user_ismember($GLOBALS['sys_stats_group'])) {
418 $thistab='reporting';
419 $TABS_IDS[]=$thistab;
420 $TABS_DIRS[]='/'.$thistab.'/';
421 $TABS_TITLES[]=$Language->getText('menu',$thistab);
422 if (strstr(getStringFromServer('REQUEST_URI'),$thistab)){
423 $selected=count($TABS_DIRS)-1;
427 if(isset($params['group']) && $params['group']) {
428 // get group info using the common result set
429 $project =& group_get_object($params['group']);
430 if ($project && is_object($project)) {
431 if ($project->isError()) {
433 } elseif (!$project->isProject()) {
436 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
437 $TABS_TITLES[]=$project->getPublicName();
438 $selected=count($TABS_DIRS)-1;
441 } elseif (count($PLUGIN_TABS_DIRS)>0) {
442 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
443 if (strstr($GLOBALS['REQUEST_URI'],$PLUGIN_TABS_DIRS_VALUE)) {
444 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
449 $c=(count($TABS_TITLES)-1);
450 if(isset($params['group']) && $params['group']) {
451 /* project is selected */
454 for ($i=0; $i<=$c; $i++) {
455 if ($selected == $i){
456 $this->selected_title = $TABS_TITLES[$i];
457 $this->selected_dir = $TABS_DIRS[$i];
458 $this->selected_id = $TABS_IDS[$i];
459 $return .= '<a id="gforge-selected" title="'.$TABS_TITLES[$i].'" href="'.$TABS_DIRS[$i].'" >'.$TABS_TITLES[$i].'</a> ';
462 $return .= '<a id="gforge-'.$TABS_IDS[$i].'" title="'.$TABS_TITLES[$i].'"
463 href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a> ';
466 if(isset($params['group']) && $params['group']) {
467 $return .= '<a id="gforge-selected" title="'.$TABS_TITLES[$i].'"
468 href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a> ';
469 $this->selected_title = $TABS_TITLES[$i];
475 * projectTabs() - Prints out the project tabs, contained here in case
476 * we want to allow it to be overriden
478 * @param string Is the tab currently selected
479 * @param string Is the group we should look up get title info
481 function projectTabs($toptab,$group) {
482 // get group info using the common result set
483 $project =& group_get_object($group);
484 if (!$project || !is_object($project)) {
487 if ($project->isError()) {
488 //wasn't found or some other problem
491 if (!$project->isProject()) {
495 // $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
496 // $TABS_TITLES[]=$project->getPublicName();
499 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
500 $TABS_IDS[]='gforge-project-summary';
501 $TABS_TITLES[]=_('Summary');
502 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
504 if (user_ismember($group,'A')) {
506 $TABS_DIRS[]='/project/admin/?group_id='. $group;
507 $TABS_IDS[]='gforge-project-admin';
508 $TABS_TITLES[]=_('Admin');
509 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
512 /* $TABS_DIRS[]='http://'. $project->getHomePage();
513 $TABS_TITLES[]=_('Home Page');
516 $TABS_DIRS[]='/activity/?group_id='. $group;
517 $TABS_IDS[]='gforge-project-activity';
518 $TABS_TITLES[]=_('Activity');
519 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
522 if ($project->usesForum()) {
523 $TABS_DIRS[]='/forum/?group_id='.$group;
524 $TABS_IDS[]='gforge-project-forum';
525 $TABS_TITLES[]=_('Forums');
526 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
530 if ($project->usesTracker()) {
531 $TABS_DIRS[]='/tracker/?group_id='.$group;
532 $TABS_IDS[]='gforge-project-tracker';
533 $TABS_TITLES[]=_('Tracker');
534 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
535 ? $selected=(count($TABS_TITLES)-1) : '' );
539 if ($project->usesMail()) {
540 $TABS_DIRS[]='/mail/?group_id='.$group;
541 $TABS_IDS[]='gforge-project-mail';
542 $TABS_TITLES[]=_('Lists');
543 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
547 if ($project->usesPm()) {
548 $TABS_IDS[]='gforge-project-task';
549 $TABS_DIRS[]='/pm/?group_id='.$group;
550 $TABS_TITLES[]=_('Tasks');
551 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
555 if ($project->usesDocman()) {
556 $TABS_DIRS[]='/docman/?group_id='.$group;
557 $TABS_IDS[]='gforge-project-docman';
558 $TABS_TITLES[]=_('Docs');
559 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
563 if ($project->usesSurvey()) {
564 $TABS_DIRS[]='/survey/?group_id='.$group;
565 $TABS_IDS[]='gforge-project-survey';
566 $TABS_TITLES[]=_('Surveys');
567 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
571 if ($project->usesNews()) {
572 $TABS_IDS[]='gforge-project-news';
573 $TABS_DIRS[]='/news/?group_id='.$group;
574 $TABS_TITLES[]=_('News');
575 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
579 if ($project->usesSCM()) {
580 $TABS_IDS[]='gforge-project-scm';
581 $TABS_DIRS[]='/scm/?group_id='.$group;
582 $TABS_TITLES[]=_('SCM');
583 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
586 // groupmenu_after_scm hook
587 $hookParams['DIRS'] = &$TABS_DIRS;
588 $hookParams['TITLES'] = &$TABS_TITLES;
589 $hookParams['toptab'] = &$toptab;
590 $hookParams['selected'] = &$selected;
591 $hookParams['group_id'] = $group ;
593 plugin_hook ("groupmenu_scm", $hookParams) ;
596 if ($project->usesFRS()) {
597 $TABS_IDS[]='gforge-project-frs';
598 $TABS_DIRS[]='/frs/?group_id='.$group;
599 $TABS_TITLES[]=_('Files');
600 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
604 $hookParams['DIRS'] = &$TABS_DIRS;
605 $hookParams['TITLES'] = &$TABS_TITLES;
606 $hookParams['toptab'] = &$toptab;
607 $hookParams['selected'] = &$selected;
608 $hookParams['group'] = $group;
610 plugin_hook ("groupmenu", $hookParams) ;
613 $c=(count($TABS_TITLES)-1);
614 for ($i=0; $i<=$c; $i++) {
616 $this->selected_title = $TABS_TITLES[$i];
617 $this->selected_dir = $TABS_DIRS[$i];
618 $this->selected_id = $TABS_IDS[$i];
619 $return .= '<a id="gforge-project-selected" href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a> ';
623 if ($TABS_IDS[$i]==''){
624 $return .= '<a id="gforge-project-std" title="'.$TABS_TITLES[$i].'" href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a>';
628 $return .= '<a id="'.$TABS_IDS[$i].'" title="'.$TABS_TITLES[$i].'" href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a>';
637 function searchBox() {
638 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
640 if(get_magic_quotes_gpc()) {
641 $defaultWords = stripslashes($words);
643 $defaultWords = $words;
646 // if there is no search currently, set the default
647 if ( ! isset($type_of_search) ) {
652 <form action="/search/" method="get">';
656 SEARCH__PARAMETER_GROUP_ID => $group_id,
657 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
658 SEARCH__PARAMETER_FORUM_ID => $forum_id,
659 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
662 $searchManager =& getSearchManager();
663 $searchManager->setParametersValues($parameters);
664 $searchEngines =& $searchManager->getAvailableSearchEngines();
665 echo '<select name="type_of_search">';
666 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
667 $searchEngine =& $searchEngines[$i];
668 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
671 $parameters = $searchManager->getParameters();
672 foreach($parameters AS $name => $value) {
673 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
676 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
679 print '<input type="submit" name="Search" value="'._('Search').'" />';
682 if (isset($group_id)&& $group_id) {
685 <a class="lnkutility" href="'.$GLOBALS['sys_urlprefix'].'/search/advanced_search.php?group_id='.$group_id.'"> '._('Advanced search').'</a>';
691 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
692 // display the searchmask
694 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
695 <input type="hidden" name="search" value="1"/>
696 <input type="hidden" name="group_id" value="'.$group_id.'"/>
697 <div id="advancedsearchtext">
698 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
699 <input type="submit" name="submitbutton" value="'._('Search').'" />
700 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
701 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
703 print '<br/> '._('Select').' <a href="javascript:setCheckBoxes(\'\',true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a>';
705 print $this->createUnderSections($sectionsArray).'
709 //create javascript methods for select none/all
711 <script type="text/javascript">
712 <!-- method for disable/enable checkboxes
713 function setCheckBoxes(parent, checked) {
716 for (var i = 0; i < document.advancedsearch.elements.length; i++)
717 if (document.advancedsearch.elements[i].type == "checkbox")
718 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
719 document.advancedsearch.elements[i].checked = checked;
727 function createUnderSections($sectionsArray) {
730 foreach ($sectionsArray as $section) {
731 if(is_array($section)) {
732 $countLines += (3 + count ($section));
734 //2 lines one for section name and one for checkbox
738 $breakLimit = round($countLines/3);
739 $break = $breakLimit;
742 <div id="advancedsearch"><ul>';
743 foreach($sectionsArray as $key => $section) {
744 $oldcountlines = $countLines;
745 if (is_array($section)) {
746 $countLines += (3 + count ($section));
751 if ($countLines >= $break) {
752 //if the next block is so large that shifting it to the next column hits the breakpoint better
753 //the second part of statement (behind &&) proofs, that no 4th column is added
754 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
755 $break += $breakLimit;
759 $return .= '<li><fieldset><legend>'.$Language->getText('group', $key).'</legend>'
760 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
764 if (!is_array($section)) {
765 $return .= '<li><input type="checkbox" name="'.urlencode($key).'"';
766 if (isset($GLOBALS[urlencode($key)]))
767 $return .= ' checked="checked" ';
768 $return .= ' /></input>'.$Language->getText('group', $key).'</li>';
771 foreach($section as $underkey => $undersection) {
772 $return .= ' <li><input type="checkbox" name="'.urlencode($key.$underkey).'"';
773 if (isset($GLOBALS[urlencode($key.$underkey)]))
774 $return .= ' checked ';
775 $return .= '></input>'.$undersection.'</li>';
778 $return .= '</ul></div></fieldset></li>';
780 if ($countLines >= $break) {
781 if (($countLines - $break) < ($break - $countLines)) {
782 $break += $breakLimit;
786 $return.='</div></ul>';
791 * beginSubMenu() - Opening a submenu.
793 * @return string Html to start a submenu.
795 function beginSubMenu () {
802 * endSubMenu() - Closing a submenu.
804 * @return string Html to end a submenu.
806 function endSubMenu () {
807 $return = '</strong></p>';
812 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
814 * @param array The array of titles.
815 * @param array The array of title links.
816 * @return string Html to build a submenu.
818 function printSubMenu ($title_arr,$links_arr) {
819 $count=count($title_arr);
824 for ($i=0; $i<$count; $i++) {
826 <a href="'.$links_arr[$i].'">'.$title_arr[$i].'</a> | ';
829 <a href="'.$links_arr[$i].'">'.$title_arr[$i].'</a>';
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,'tracker_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"