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('common/include/constants.php');
17 require_once('www/search/include/SearchManager.class');
19 class Layout extends Error {
22 * 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
41 * Layout() - Constructor
45 $this->themeroot=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'];
46 /* if images directory exists in theme, then use it as imgroot */
47 if (file_exists ($this->themeroot.'/images')){
48 $this->imgroot=$GLOBALS['sys_urlprefix'].'/themes/'.$GLOBALS['sys_theme'].'/images/';
50 // Constructor for parent class...
51 if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
52 $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
57 * createLinkToUserHome() - Creates a link to a user's home page
59 * @param string The user's user_name
60 * @param string The user's realname
62 function createLinkToUserHome($user_name, $realname) {
63 return '<a href="'.$GLOBALS['sys_urlprefix'].'/users/'.$user_name.'/">'.$realname.'</a>';
67 * headerStart() - common code for all themes
69 * @param array Header parameters array
71 function headerStart($params) {
74 if (!$params['title']) {
75 $params['title'] = $GLOBALS['sys_name'];
77 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
79 print '<?xml version="1.0" encoding="' . $Language->getEncoding(). '"?>';
83 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
84 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
86 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo $Language->getLanguageCode(); ?>">
89 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $Language->getEncoding(); ?>" />
90 <title><?php echo $params['title']; ?></title>
91 <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/export/rss_sfnews.php" type="application/rss+xml"/>
92 <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS 2.0" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/export/rss20_news.php" type="application/rss+xml"/>
93 <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - New Projects RSS" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/export/rss_sfprojects.php" type="application/rss+xml"/>
95 <?php if (isset($GLOBALS['group_id'])) {
96 $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"/>';
100 <?php $this->headerCSS(); ?>
102 <script language="JavaScript" type="text/javascript">
105 function admin_window(adminurl) {
106 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
109 function help_window(helpurl) {
110 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
113 <?php plugin_hook ("javascript",false) ; ?>
119 function headerCSS() {
120 /* check if a personalized css stylesheet exist, if yes include only
122 new stylesheets should use the <themename>.css file
124 $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css';
125 if (file_exists($theme_cssfile)){
127 <link rel="stylesheet" type="text/css" href="'.$GLOBALS['sys_urlprefix'].'/themes/'.$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css"/>';
129 /* if this is not our case, then include the compatibility stylesheet
130 that contains all removed styles from the code and check if a
131 custom stylesheet exists.
132 Used for compatibility with existing stylesheets
135 <link rel="stylesheet" type="text/css" href="'.$GLOBALS['sys_urlprefix'].'/themes/css/gforge-compat.css" />';
136 $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/theme.css';
137 if (file_exists($theme_cssfile)){
139 <link rel="stylesheet" type="text/css" href="'.$GLOBALS['sys_urlprefix'].'/themes/'.$GLOBALS['sys_theme'].'/css/theme.css" />';
142 plugin_hook ('cssfile',$this);
145 function header($params) {
148 $this->headerStart($params); ?>
151 $this->bodyHeader($params);
154 function bodyHeader($params){
158 <table border="0" width="100%" cellspacing="0" cellpadding="0" id="headertable">
161 <td><a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/"><?php echo html_image('logo.png',198,52,array('border'=>'0')); ?></a></td>
162 <td><?php echo $this->searchBox(); ?></td>
163 <td align="right"><?php
164 if (session_loggedin()) {
166 <a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/logout.php"><?php echo _('Log Out'); ?></a><br />
167 <a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/"><?php echo _('My Account'); ?></a>
171 <b><a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/login.php"><?php echo _('Log In'); ?></a></b><br />
172 <b><a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/register.php"><?php echo _('New Account'); ?></a></b>
175 echo $this->quickNav();
178 <td> </td>
183 <table border="0" width="100%" cellspacing="0" cellpadding="0">
189 <?php echo $this->outerTabs($params); ?>
196 <td align="left" class="toptab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft.png" height="9" width="9" alt="" /></td>
197 <td class="toptab" width="30"><img src="<?php echo $this->imgroot; ?>clear.png" width="30" height="1" alt="" /></td>
198 <td class="toptab"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
199 <td class="toptab" width="30"><img src="<?php echo $this->imgroot; ?>clear.png" width="30" height="1" alt="" /></td>
200 <td align="right" class="toptab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topright.png" height="9" width="9" alt="" /></td>
205 <!-- Outer body row -->
207 <td class="toptab"><img src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td>
208 <td valign="top" width="99%" class="toptab" colspan="3">
210 <!-- Inner Tabs / Shell -->
212 <table border="0" width="100%" cellspacing="0" cellpadding="0">
216 if (isset($params['group']) && $params['group']) {
224 echo $this->projectTabs($params['toptab'],$params['group']);
236 <td align="left" class="projecttab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft-inner.png" height="9" width="9" alt="" /></td>
237 <td class="projecttab" ><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
238 <td align="right" class="projecttab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topright-inner.png" height="9" width="9" alt="" /></td>
242 <td class="projecttab" ><img src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td>
243 <td valign="top" width="99%" class="projecttab">
249 function footer($params) {
253 <!-- end main body row -->
257 <td width="10" class="footer3" ><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
260 <td align="left" class="footer1" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomleft-inner.png" height="11" width="11" alt="" /></td>
261 <td class="footer3"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
262 <td align="right" class="footer1" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomright-inner.png" height="11" width="11" alt="" /></td>
266 <!-- end inner body row -->
269 <td width="10" class="footer2"><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
272 <td align="left" class="footer2" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomleft.png" height="9" width="9" alt="" /></td>
273 <td class="footer2" colspan="3"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
274 <td align="right" class="footer2" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomright.png" height="9" width="9" alt="" /></td>
278 $this->footerEnd($params);
281 function footerEnd($params) { ?>
283 <!-- PLEASE LEAVE "Powered By GForge" on your site -->
286 <a href="http://gforge.org/"><img src="/images/pow-gforge.png" alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
290 global $sys_show_source;
292 if ($sys_show_source) {
293 print '<a class="showsource" href="'.$GLOBALS['sys_urlprefix'].'/source.php?file=' . getStringFromServer('SCRIPT_NAME') . '"> '._('Show source').' </a>';
304 function getRootIndex() {
305 return $this->rootindex;
309 * boxTop() - Top HTML box
311 * @param string Box title
312 * @param bool Whether to echo or return the results
313 * @param string The box background color
315 function boxTop($title) {
317 <!-- Box Top Start -->
319 <table cellspacing="0" cellpadding="0" width="100%" border="0" style="background:url('.$this->imgroot.'vert-grad.png)">
321 <td valign="top" align="right" width="10" style="background:url('.$this->imgroot.'box-topleft.png)"><img src="'.$this->imgroot.'clear.png" width="10" height="20" alt="" /></td>
322 <td width="100%" style="background:url('.$this->imgroot.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
323 <td valign="top" width="10" style="background:url('.$this->imgroot.'box-topright.png)"><img src="'.$this->imgroot.'clear.png" width="10" height="20" alt="" /></td>
327 <table cellspacing="2" cellpadding="2" width="100%" border="0">
331 <!-- Box Top End -->';
335 * boxMiddle() - Middle HTML box
337 * @param string Box title
338 * @param string The box background color
340 function boxMiddle($title) {
342 <!-- Box Middle Start -->
346 <td colspan="2" style="background:url('.$this->imgroot.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
350 <!-- Box Middle End -->';
354 * boxBottom() - Bottom HTML box
356 * @param bool Whether to echo or return the results
358 function boxBottom() {
360 <!-- Box Bottom Start -->
367 <!-- Box Bottom End -->';
371 * boxGetAltRowStyle() - Get an alternating row style for tables
373 * @param int Row number
375 function boxGetAltRowStyle($i) {
377 return ' class="altRowStyleEven"';
379 return ' class="altRowStyleOdd"';
384 * listTableTop() - Takes an array of titles and builds the first row of a new table.
386 * @param array The array of titles
387 * @param array The array of title links
389 function listTableTop ($title_arr,$links_arr=false) {
391 <table cellspacing="0" cellpadding="0" width="100%" border="0">
393 <!-- <td valign="top" align="right" width="10" style="background:url('.$this->imgroot.'box-grad.png)"><img src="'.$this->imgroot.'box-topleft.png" width="10" height="75" alt="" /></td> -->
394 <td style="background:url('.$this->imgroot.'box-grad.png)">
395 <table width="100%" border="0" cellspacing="1" cellpadding="2" >
396 <tr class="tableheading">';
397 $count=count($title_arr);
399 for ($i=0; $i<$count; $i++) {
401 <td><a class="sortbutton" href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
404 for ($i=0; $i<$count; $i++) {
406 <td>'.$title_arr[$i].'</td>';
409 return $return.'</tr>';
412 function listTableBottom() {
413 return '</table></td>
414 <!-- <td valign="top" align="right" width="10" style="background:url('.$this->imgroot.'box-grad.png)"><img src="'.$this->imgroot.'box-topright.png" width="10" height="75" alt="" /></td> -->
418 function outerTabs($params) {
419 global $Language,$sys_use_trove,$sys_use_snippet,$sys_use_people;
423 if ($sys_use_trove) {
424 $TABS_DIRS[]='/softwaremap/';
426 if ($sys_use_snippet) {
427 $TABS_DIRS[]='/snippet/';
429 if ($sys_use_people) {
430 $TABS_DIRS[]='/people/';
432 $TABS_TITLES[]=_('Home');
433 $TABS_TITLES[]=_('My Page');
434 if ($sys_use_trove) {
435 $TABS_TITLES[]=_('Project Tree');
437 if ($sys_use_snippet) {
438 $TABS_TITLES[]=_('Code Snippets');
440 if ($sys_use_people) {
441 $TABS_TITLES[]=_('Project Openings');
445 $PLUGIN_TABS_DIRS = Array();
446 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
447 $hookParams['TITLES'] = &$TABS_TITLES;
448 plugin_hook ("outermenu", $hookParams) ;
449 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
451 $user_is_super=false;
452 if (session_loggedin()) {
453 $projectmaster =& group_get_object(GROUP_IS_MASTER);
454 $projectstats =& group_get_object(GROUP_IS_STATS);
455 $permmaster =& $projectmaster->getPermission( session_get_user() );
456 $permstats =& $projectstats->getPermission( session_get_user() );
458 if ($permmaster->isAdmin()) {
460 $TABS_DIRS[]='/admin/';
461 $TABS_TITLES[]=_('Admin');
463 if ($permstats->isMember()) {
464 $TABS_DIRS[]='/reporting/';
465 $TABS_TITLES[]=_('Reporting');
468 if(isset($params['group']) && $params['group']) {
469 // get group info using the common result set
470 $project =& group_get_object($params['group']);
471 if ($project && is_object($project)) {
472 if ($project->isError()) {
474 } elseif (!$project->isProject()) {
477 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
478 $TABS_TITLES[]=$project->getPublicName();
479 $selected=count($TABS_DIRS)-1;
482 } elseif (strstr($GLOBALS['REQUEST_URI'],'/my/') ||
483 strstr($GLOBALS['REQUEST_URI'],'/account/') ||
484 strstr($GLOBALS['REQUEST_URI'],'/register/') ||
485 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
486 $selected=array_search("/my/", $TABS_DIRS);
487 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
488 $selected=array_search("/softwaremap/", $TABS_DIRS);
489 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
490 $selected=array_search("/snippet/", $TABS_DIRS);
491 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
492 $selected=array_search("/people/", $TABS_DIRS);
493 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
494 $selected=array_search('/reporting/',$TABS_DIRS);
495 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
496 $selected=array_search('/admin/',$TABS_DIRS);
497 } elseif (count($PLUGIN_TABS_DIRS)>0) {
498 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
499 if (strstr(getStringFromServer('REQUEST_URI'),$PLUGIN_TABS_DIRS_VALUE)) {
500 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
507 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,'','100%');
512 * projectTabs() - Prints out the project tabs, contained here in case
513 * we want to allow it to be overriden
515 * @param string Is the tab currently selected
516 * @param string Is the group we should look up get title info
518 function projectTabs($toptab,$group) {
522 // get group info using the common result set
523 $project =& group_get_object($group);
524 if (!$project || !is_object($project)) {
527 if ($project->isError()) {
528 //wasn't found or some other problem
531 if (!$project->isProject()) {
536 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
537 $TABS_TITLES[]=_('Summary');
538 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
541 $perm =& $project->getPermission( session_get_user() );
542 if ($perm->isAdmin()) {
543 $TABS_DIRS[]='/project/admin/?group_id='. $group;
544 $TABS_TITLES[]=_('Admin');
545 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
548 $TABS_DIRS[]='http://'. $project->getHomePage();
549 $TABS_TITLES[]=_('Home Page');
552 // Project Activity tab
554 $TABS_DIRS[]='/activity/?group_id='. $group;
555 $TABS_TITLES[]=_('Activity');
556 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
559 if ($project->usesForum()) {
560 $TABS_DIRS[]='/forum/?group_id='.$group;
561 $TABS_TITLES[]=_('Forums');
562 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
566 if ($project->usesTracker()) {
567 $TABS_DIRS[]='/tracker/?group_id='.$group;
568 $TABS_TITLES[]=_('Tracker');
569 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
570 ? $selected=(count($TABS_TITLES)-1) : '' );
574 if ($project->usesMail()) {
575 $TABS_DIRS[]='/mail/?group_id='.$group;
576 $TABS_TITLES[]=_('Lists');
577 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
581 if ($project->usesPm()) {
582 $TABS_DIRS[]='/pm/?group_id='.$group;
583 $TABS_TITLES[]=_('Tasks');
584 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
588 if ($project->usesDocman()) {
589 $TABS_DIRS[]='/docman/?group_id='.$group;
590 $TABS_TITLES[]=_('Docs');
591 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
595 if ($project->usesSurvey()) {
596 $TABS_DIRS[]='/survey/?group_id='.$group;
597 $TABS_TITLES[]=_('Surveys');
598 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
602 if ($project->usesNews()) {
603 $TABS_DIRS[]='/news/?group_id='.$group;
604 $TABS_TITLES[]=_('News');
605 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
609 if ($project->usesSCM()) {
610 $TABS_DIRS[]='/scm/?group_id='.$group;
611 $TABS_TITLES[]=_('SCM');
612 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
615 // groupmenu_after_scm hook
616 $hookParams['DIRS'] = &$TABS_DIRS;
617 $hookParams['TITLES'] = &$TABS_TITLES;
618 $hookParams['toptab'] = &$toptab;
619 $hookParams['selected'] = &$selected;
620 $hookParams['group_id'] = $group ;
622 plugin_hook ("groupmenu_scm", $hookParams) ;
625 if ($project->usesFRS()) {
626 $TABS_DIRS[]='/frs/?group_id='.$group;
627 $TABS_TITLES[]=_('Files');
628 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
632 $hookParams['DIRS'] = &$TABS_DIRS;
633 $hookParams['TITLES'] = &$TABS_TITLES;
634 $hookParams['toptab'] = &$toptab;
635 $hookParams['selected'] = &$selected;
636 $hookParams['group'] = $group;
638 plugin_hook ("groupmenu", $hookParams) ;
640 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
644 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
646 $count=count($TABS_DIRS);
647 $width=intval((100/$count));
655 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
663 for ($i=0; $i<$count; $i++) {
666 // this is the first tab, choose an image with end-name
669 $issel=($selected==$i);
670 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
671 // $rowspan=(($issel)?'rowspan="2" ' : '');
674 <td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgroot . 'theme-'.$inner.'-end-'.(($issel) ? '' : 'not').'selected.png)">'.
675 '<img src="'.$this->imgroot . 'clear.png" height="25" width="10" alt="" /></td>'.
676 '<td '.$rowspan.'style="background:url('.$this->imgroot . $bgimg.')" width="'.$width.'%" align="center"><a class="'. (($issel)?'tabsellink':'tablink') .'" href="'.$GLOBALS['sys_urlprefix'].$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a></td>';
677 } elseif ($i==$count-1) {
679 // this is the last tab, choose an image with name-end
681 $wassel=($selected==$i-1);
682 $issel=($selected==$i);
683 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
684 // $rowspan=(($issel)?'rowspan="2" ' : '');
686 // Build image between current and prior tab
689 <td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
690 '<img src="'.$this->imgroot . 'clear.png" height="2" width="20" alt="" /></td>'.
691 '<td '.$rowspan.'style="background:url('.$this->imgroot . $bgimg.')" width="'.$width.'%" align="center"><a class="'. (($issel)?'tabsellink':'tablink') .'" href="'.$GLOBALS['sys_urlprefix'].$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a></td>';
693 // Last graphic on right-side
696 <td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($issel) ? '' : 'not').'selected-end.png)">'.
697 '<img src="'.$this->imgroot . 'clear.png" height="2" width="10" alt="" /></td>';
703 $wassel=($selected==$i-1);
704 $issel=($selected==$i);
705 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
706 // $rowspan=(($issel)?'rowspan="2" ' : '');
708 // Build image between current and prior tab
711 <td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
712 '<img src="'.$this->imgroot . 'clear.png" height="2" width="20" alt="" /></td>'.
713 '<td '.$rowspan.'style="background:url('.$this->imgroot . $bgimg.')" width="'.$width.'%" align="center"><a class="'. (($issel)?'tabsellink':'tablink') .'" href="'.$GLOBALS['sys_urlprefix'].$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a></td>';
720 // Building a bottom row in this table, which will be darker
722 if ($selected == 0) {
724 $end_cols=((count($TABS_DIRS)*3)-3);
725 } elseif ($selected == (count($TABS_DIRS)-1)) {
726 $beg_cols=((count($TABS_DIRS)*3)-3);
729 $beg_cols=($selected*3);
730 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
734 $return .= '<td colspan="'.$beg_cols.'" height="1" class="notSelTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
736 $return .= '<td colspan="3" height="1" class="selTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
738 $return .= '<td colspan="'.$end_cols.'" height="1" class="notSelTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
750 function searchBox() {
751 global $Language,$words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
753 if(get_magic_quotes_gpc()) {
754 $defaultWords = stripslashes($words);
756 $defaultWords = $words;
759 // if there is no search currently, set the default
760 if ( ! isset($type_of_search) ) {
765 <form action="/search/" method="get">
766 <table border="0" cellpadding="0" cellspacing="0">
768 <div align="center" class="searchbox">';
770 SEARCH__PARAMETER_GROUP_ID => $group_id,
771 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
772 SEARCH__PARAMETER_FORUM_ID => $forum_id,
773 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
776 $searchManager =& getSearchManager();
777 $searchManager->setParametersValues($parameters);
778 $searchEngines =& $searchManager->getAvailableSearchEngines();
780 echo '<select name="type_of_search">';
781 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
782 $searchEngine =& $searchEngines[$i];
783 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
785 echo '</select></div>';
789 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
791 print '</td><td> ';
792 $parameters = $searchManager->getParameters();
793 foreach($parameters AS $name => $value) {
794 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
797 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
799 print '</td><td> </td><td>';
800 print '<input type="submit" name="Search" value="'._('Search').'" />';
803 if (isset($group_id)) {
805 <td width="10"> </td>
806 <td><a class="lnkutility" href="'.$GLOBALS['sys_urlprefix'].'/search/advanced_search.php?group_id='.$group_id.'"> '._('Advanced search').'</a></td>';
808 print '</tr></table>';
813 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
815 // display the searchmask
817 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
818 <input type="hidden" name="search" value="1"/>
819 <input type="hidden" name="group_id" value="'.$group_id.'"/>
820 <div align="center"><br />
824 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
825 <input type="submit" name="submitbutton" value="'._('Search').'" />
830 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
833 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
836 </table><br /></div>'
837 .$this->createUnderSections($sectionsArray).'
841 //create javascript methods for select none/all
843 <script type="text/javascript">
844 <!-- method for disable/enable checkboxes
845 function setCheckBoxes(parent, checked) {
848 for (var i = 0; i < document.advancedsearch.elements.length; i++)
849 if (document.advancedsearch.elements[i].type == "checkbox")
850 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
851 document.advancedsearch.elements[i].checked = checked;
859 function createUnderSections($sectionsArray) {
862 foreach ($sectionsArray as $section) {
863 if(is_array($section)) {
864 $countLines += (3 + count ($section));
866 //2 lines one for section name and one for checkbox
870 $breakLimit = round($countLines/3);
871 $break = $breakLimit;
874 <table width="100%" border="0" cellspacing="0" cellpadding="1">
875 <tr class="tableheader">
877 <table width="100%" cellspacing="0" border="0">
878 <tr class="tablecontent">
879 <!--<td colspan="2">'._('Search in').':</td-->
880 <td align="right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
882 <tr height="20" class="tablecontent">
883 <td colspan="3"> </td>
885 <tr align="center" valign="top" class="tablecontent">
887 foreach($sectionsArray as $key => $section) {
888 $oldcountlines = $countLines;
889 if (is_array($section)) {
890 $countLines += (3 + count ($section));
895 if ($countLines >= $break) {
896 //if the next block is so large that shifting it to the next column hits the breakpoint better
897 //the second part of statement (behind &&) proofs, that no 4th column is added
898 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
899 $return .= '</td><td>';
900 $break += $breakLimit;
904 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0">
905 <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
908 <a href="#'.$key.'">'.$Language->getText('group', $key).'</a>'
911 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
914 <tr class="tablecontent">
917 if (!is_array($section)) {
918 $return .= ' <input type="checkbox" name="'.urlencode($key).'"';
919 if (isset($GLOBALS[urlencode($key)]))
920 $return .= ' checked="checked" ';
921 $return .= ' /></input>'.$Language->getText('group', $key).'<br />';
924 foreach($section as $underkey => $undersection) {
925 $return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
926 if (isset($GLOBALS[urlencode($key.$underkey)]))
927 $return .= ' checked ';
928 $return .= '></input>'.$undersection.'<br />';
934 </table></td></tr></table><br />';
936 if ($countLines >= $break) {
937 if (($countLines - $break) < ($break - $countLines)) {
938 $return .= '</td><td width="33%">';
939 $break += $breakLimit;
944 return $return.' </td>
946 </table></td></tr></table>';
950 * beginSubMenu() - Opening a submenu.
952 * @return string Html to start a submenu.
954 function beginSubMenu () {
961 * endSubMenu() - Closing a submenu.
963 * @return string Html to end a submenu.
965 function endSubMenu () {
966 $return = '</strong></p>';
971 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
973 * @param array The array of titles.
974 * @param array The array of title links.
975 * @return string Html to build a submenu.
977 function printSubMenu ($title_arr,$links_arr) {
978 $count=count($title_arr);
983 for ($i=0; $i<$count; $i++) {
985 <a href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a> | ';
988 <a href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a>';
993 * subMenu() - Takes two array of titles and links and build a menu.
995 * @param array The array of titles.
996 * @param array The array of title links.
997 * @return string Html to build a submenu.
999 function subMenu ($title_arr,$links_arr) {
1000 $return = $this->beginSubMenu () ;
1001 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
1002 $return .= $this->endSubMenu () ;
1007 * multiTableRow() - create a mutlilevel row in a table
1009 * @param string the row attributes
1010 * @param array the array of cell data, each element is an array,
1011 * the first item being the text,
1012 * the subsequent items are attributes (dont include
1013 * the bgcolor for the title here, that will be
1014 * handled by $istitle
1015 * @param boolean is this row part of the title ?
1018 function multiTableRow($row_attr, $cell_data, $istitle) {
1022 $return .=' align="center" class="multiTableRowTitle"';
1025 for ( $c = 0; $c < count($cell_data); $c++ ) {
1027 for ( $a=1; $a < count($cell_data[$c]); $a++) {
1028 $return .= $cell_data[$c][$a].' ';
1032 $return .='<span class="multiTableRowTitle">';
1034 $return .= $cell_data[$c][0];
1036 $return .='</span>';
1048 * feedback() - returns the htmlized feedback string when an action is performed.
1050 * @param string feedback string
1051 * @return string htmlized feedback
1053 function feedback($feedback) {
1058 <span class="feedback">'.strip_tags($feedback, '<br>').'</span>';
1063 * getThemeIdFromName()
1065 * @param string the dirname of the theme
1066 * @return integer the theme id
1068 function getThemeIdFromName($dirname) {
1069 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
1070 return db_result($res,0,'theme_id');
1073 function quickNav() {
1074 if (!session_loggedin()) {
1077 $res=db_query("SELECT * FROM groups NATURAL JOIN user_group WHERE user_id='".user_getid()."' ORDER BY group_name");
1079 if (!$res || db_numrows($res) < 1) {
1083 <form name="quicknavform">
1084 <select name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">';
1086 <option value="">Quick Jump To...</option>';
1087 for ($i=0; $i<db_numrows($res); $i++) {
1089 <option value="/projects/'.db_result($res,$i,'unix_group_name').'/">'.db_result($res,$i,'group_name').'</option>';
1090 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1092 <option value="/project/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1095 if (db_result($res,$i,'use_tracker')) {
1097 <option value="/tracker/?group_id='.db_result($res,$i,'group_id').'"> Tracker</option>';
1098 if (db_result($res,$i,'admin_flags') || db_result($res,$i,'tracker_flags')) {
1100 <option value="/tracker/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1104 if (db_result($res,$i,'use_pm')) {
1106 <option value="/pm/?group_id='.db_result($res,$i,'group_id').'"> Task Manager</option>';
1107 if (trim(db_result($res,$i,'admin_flags')) =='A' || db_result($res,$i,'project_flags')) {
1109 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1113 if (db_result($res,$i,'use_frs')) {
1115 <option value="/frs/?group_id='.db_result($res,$i,'group_id').'"> Files</option>';
1116 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'release_flags')) {
1118 <option value="/frs/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1122 if (db_result($res,$i,'use_scm')) {
1124 <option value="/scm/?group_id='.db_result($res,$i,'group_id').'"> SCM</option>';
1125 /*if (db_result($res,$i,'admin_flags') || db_result($res,$i,'project_flags')) {
1127 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1131 if (db_result($res,$i,'use_forum')) {
1133 <option value="/forum/?group_id='.db_result($res,$i,'group_id').'"> Forum</option>';
1134 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'forum_flags')) {
1136 <option value="/forum/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1140 if (db_result($res,$i,'use_mail')) {
1142 <option value="/mail/?group_id='.db_result($res,$i,'group_id').'"> Lists</option>';
1143 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1145 <option value="/mail/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1149 if (db_result($res,$i,'use_docman')) {
1151 <option value="/docman/?group_id='.db_result($res,$i,'group_id').'"> Docs</option>';
1152 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'doc_flags')) {
1154 <option value="/docman/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1158 if (db_result($res,$i,'use_news')) {
1160 <option value="/news/?group_id='.db_result($res,$i,'group_id').'"> News</option>';
1161 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1163 <option value="/news/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1167 if (db_result($res,$i,'use_survey')) {
1169 <option value="/survey/?group_id='.db_result($res,$i,'group_id').'"> Surveys</option>';
1170 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1172 <option value="/survey/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1188 // c-file-style: "bsd"