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.php');
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) {
72 if (!$params['title']) {
73 $params['title'] = $GLOBALS['sys_name'];
75 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
77 print '<?xml version="1.0" encoding="utf-8"';
81 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
82 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
84 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo _('en') ?>">
87 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
88 <title><?php echo $params['title']; ?></title>
89 <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"/>
90 <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"/>
91 <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"/>
93 <?php if (isset($GLOBALS['group_id'])) {
94 $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"/>';
98 <?php $this->headerCSS(); ?>
100 <script language="JavaScript" type="text/javascript">
103 function admin_window(adminurl) {
104 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
107 function help_window(helpurl) {
108 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
111 <?php plugin_hook ("javascript",false) ; ?>
117 function headerCSS() {
118 /* check if a personalized css stylesheet exist, if yes include only
120 new stylesheets should use the <themename>.css file
122 $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css';
123 if (file_exists($theme_cssfile)){
125 <link rel="stylesheet" type="text/css" href="'.$GLOBALS['sys_urlprefix'].'/themes/'.$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css"/>';
127 /* if this is not our case, then include the compatibility stylesheet
128 that contains all removed styles from the code and check if a
129 custom stylesheet exists.
130 Used for compatibility with existing stylesheets
133 <link rel="stylesheet" type="text/css" href="'.$GLOBALS['sys_urlprefix'].'/themes/css/gforge-compat.css" />';
134 $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/theme.css';
135 if (file_exists($theme_cssfile)){
137 <link rel="stylesheet" type="text/css" href="'.$GLOBALS['sys_urlprefix'].'/themes/'.$GLOBALS['sys_theme'].'/css/theme.css" />';
140 plugin_hook ('cssfile',$this);
143 function header($params) {
144 $this->headerStart($params); ?>
147 $this->bodyHeader($params);
150 function bodyHeader($params){
153 <table border="0" width="100%" cellspacing="0" cellpadding="0" id="headertable">
156 <td><a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/"><?php echo html_image('logo.png',198,52,array('border'=>'0')); ?></a></td>
157 <td><?php echo $this->searchBox(); ?></td>
158 <td align="right"><?php
159 if (session_loggedin()) {
161 <a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/logout.php"><?php echo _('Log Out'); ?></a><br />
162 <a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/"><?php echo _('My Account'); ?></a>
166 <b><a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/login.php"><?php echo _('Log In'); ?></a></b><br />
167 <b><a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/register.php"><?php echo _('New Account'); ?></a></b>
170 echo $this->quickNav();
173 <td> </td>
178 <table border="0" width="100%" cellspacing="0" cellpadding="0">
184 <?php echo $this->outerTabs($params); ?>
191 <td align="left" class="toptab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft.png" height="9" width="9" alt="" /></td>
192 <td class="toptab" width="30"><img src="<?php echo $this->imgroot; ?>clear.png" width="30" height="1" alt="" /></td>
193 <td class="toptab"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
194 <td class="toptab" width="30"><img src="<?php echo $this->imgroot; ?>clear.png" width="30" height="1" alt="" /></td>
195 <td align="right" class="toptab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topright.png" height="9" width="9" alt="" /></td>
200 <!-- Outer body row -->
202 <td class="toptab"><img src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td>
203 <td valign="top" width="99%" class="toptab" colspan="3">
205 <!-- Inner Tabs / Shell -->
207 <table border="0" width="100%" cellspacing="0" cellpadding="0">
211 if (isset($params['group']) && $params['group']) {
219 echo $this->projectTabs($params['toptab'],$params['group']);
231 <td align="left" class="projecttab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft-inner.png" height="9" width="9" alt="" /></td>
232 <td class="projecttab" ><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
233 <td align="right" class="projecttab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topright-inner.png" height="9" width="9" alt="" /></td>
237 <td class="projecttab" ><img src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td>
238 <td valign="top" width="99%" class="projecttab">
244 function footer($params) {
248 <!-- end main body row -->
252 <td width="10" class="footer3" ><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
255 <td align="left" class="footer1" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomleft-inner.png" height="11" width="11" alt="" /></td>
256 <td class="footer3"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
257 <td align="right" class="footer1" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomright-inner.png" height="11" width="11" alt="" /></td>
261 <!-- end inner body row -->
264 <td width="10" class="footer2"><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
267 <td align="left" class="footer2" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomleft.png" height="9" width="9" alt="" /></td>
268 <td class="footer2" colspan="3"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
269 <td align="right" class="footer2" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomright.png" height="9" width="9" alt="" /></td>
273 $this->footerEnd($params);
276 function footerEnd($params) { ?>
278 <!-- PLEASE LEAVE "Powered By GForge" on your site -->
281 <a href="http://gforge.org/"><img src="/images/pow-gforge.png" alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
285 global $sys_show_source;
286 if ($sys_show_source) {
287 print '<a class="showsource" href="'.$GLOBALS['sys_urlprefix'].'/source.php?file=' . getStringFromServer('SCRIPT_NAME') . '"> '._('Show source').' </a>';
298 function getRootIndex() {
299 return $this->rootindex;
303 * boxTop() - Top HTML box
305 * @param string Box title
306 * @param bool Whether to echo or return the results
307 * @param string The box background color
309 function boxTop($title) {
311 <!-- Box Top Start -->
313 <table cellspacing="0" cellpadding="0" width="100%" border="0" style="background:url('.$this->imgroot.'vert-grad.png)">
315 <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>
316 <td width="100%" style="background:url('.$this->imgroot.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
317 <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>
321 <table cellspacing="2" cellpadding="2" width="100%" border="0">
325 <!-- Box Top End -->';
329 * boxMiddle() - Middle HTML box
331 * @param string Box title
332 * @param string The box background color
334 function boxMiddle($title) {
336 <!-- Box Middle Start -->
340 <td colspan="2" style="background:url('.$this->imgroot.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
344 <!-- Box Middle End -->';
348 * boxBottom() - Bottom HTML box
350 * @param bool Whether to echo or return the results
352 function boxBottom() {
354 <!-- Box Bottom Start -->
361 <!-- Box Bottom End -->';
365 * boxGetAltRowStyle() - Get an alternating row style for tables
367 * @param int Row number
369 function boxGetAltRowStyle($i) {
371 return ' class="altRowStyleEven"';
373 return ' class="altRowStyleOdd"';
378 * listTableTop() - Takes an array of titles and builds the first row of a new table.
380 * @param array The array of titles
381 * @param array The array of title links
383 function listTableTop ($title_arr,$links_arr=false) {
385 <table cellspacing="0" cellpadding="0" width="100%" border="0">
387 <!-- <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> -->
388 <td style="background:url('.$this->imgroot.'box-grad.png)">
389 <table width="100%" border="0" cellspacing="1" cellpadding="2" >
390 <tr class="tableheading">';
391 $count=count($title_arr);
393 for ($i=0; $i<$count; $i++) {
395 <td><a class="sortbutton" href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
398 for ($i=0; $i<$count; $i++) {
400 <td>'.$title_arr[$i].'</td>';
403 return $return.'</tr>';
406 function listTableBottom() {
407 return '</table></td>
408 <!-- <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> -->
412 function outerTabs($params) {
413 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
417 if ($sys_use_trove) {
418 $TABS_DIRS[]='/softwaremap/';
420 if ($sys_use_snippet) {
421 $TABS_DIRS[]='/snippet/';
423 if ($sys_use_people) {
424 $TABS_DIRS[]='/people/';
426 $TABS_TITLES[]=_('Home');
427 $TABS_TITLES[]=_('My Page');
428 if ($sys_use_trove) {
429 $TABS_TITLES[]=_('Project Tree');
431 if ($sys_use_snippet) {
432 $TABS_TITLES[]=_('Code Snippets');
434 if ($sys_use_people) {
435 $TABS_TITLES[]=_('Project Openings');
439 $PLUGIN_TABS_DIRS = Array();
440 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
441 $hookParams['TITLES'] = &$TABS_TITLES;
442 plugin_hook ("outermenu", $hookParams) ;
443 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
445 $user_is_super=false;
446 if (session_loggedin()) {
447 $projectmaster =& group_get_object(GROUP_IS_MASTER);
448 $projectstats =& group_get_object(GROUP_IS_STATS);
449 $permmaster =& $projectmaster->getPermission( session_get_user() );
450 $permstats =& $projectstats->getPermission( session_get_user() );
452 if ($permmaster->isAdmin()) {
454 $TABS_DIRS[]='/admin/';
455 $TABS_TITLES[]=_('Admin');
457 if ($permstats->isMember()) {
458 $TABS_DIRS[]='/reporting/';
459 $TABS_TITLES[]=_('Reporting');
462 if(isset($params['group']) && $params['group']) {
463 // get group info using the common result set
464 $project =& group_get_object($params['group']);
465 if ($project && is_object($project)) {
466 if ($project->isError()) {
468 } elseif (!$project->isProject()) {
471 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
472 $TABS_TITLES[]=$project->getPublicName();
473 $selected=count($TABS_DIRS)-1;
476 } elseif (strstr($GLOBALS['REQUEST_URI'],'/my/') ||
477 strstr($GLOBALS['REQUEST_URI'],'/account/') ||
478 strstr($GLOBALS['REQUEST_URI'],'/register/') ||
479 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
480 $selected=array_search("/my/", $TABS_DIRS);
481 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
482 $selected=array_search("/softwaremap/", $TABS_DIRS);
483 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
484 $selected=array_search("/snippet/", $TABS_DIRS);
485 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
486 $selected=array_search("/people/", $TABS_DIRS);
487 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
488 $selected=array_search('/reporting/',$TABS_DIRS);
489 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
490 $selected=array_search('/admin/',$TABS_DIRS);
491 } elseif (count($PLUGIN_TABS_DIRS)>0) {
492 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
493 if (strstr(getStringFromServer('REQUEST_URI'),$PLUGIN_TABS_DIRS_VALUE)) {
494 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
501 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,'','100%');
506 * projectTabs() - Prints out the project tabs, contained here in case
507 * we want to allow it to be overriden
509 * @param string Is the tab currently selected
510 * @param string Is the group we should look up get title info
512 function projectTabs($toptab,$group) {
513 // get group info using the common result set
514 $project =& group_get_object($group);
515 if (!$project || !is_object($project)) {
518 if ($project->isError()) {
519 //wasn't found or some other problem
522 if (!$project->isProject()) {
527 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
528 $TABS_TITLES[]=_('Summary');
529 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
532 $perm =& $project->getPermission( session_get_user() );
533 if ($perm->isAdmin()) {
534 $TABS_DIRS[]='/project/admin/?group_id='. $group;
535 $TABS_TITLES[]=_('Admin');
536 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
539 $TABS_DIRS[]='http://'. $project->getHomePage();
540 $TABS_TITLES[]=_('Home Page');
543 // Project Activity tab
545 $TABS_DIRS[]='/activity/?group_id='. $group;
546 $TABS_TITLES[]=_('Activity');
547 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
550 if ($project->usesForum()) {
551 $TABS_DIRS[]='/forum/?group_id='.$group;
552 $TABS_TITLES[]=_('Forums');
553 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
557 if ($project->usesTracker()) {
558 $TABS_DIRS[]='/tracker/?group_id='.$group;
559 $TABS_TITLES[]=_('Tracker');
560 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
561 ? $selected=(count($TABS_TITLES)-1) : '' );
565 if ($project->usesMail()) {
566 $TABS_DIRS[]='/mail/?group_id='.$group;
567 $TABS_TITLES[]=_('Lists');
568 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
572 if ($project->usesPm()) {
573 $TABS_DIRS[]='/pm/?group_id='.$group;
574 $TABS_TITLES[]=_('Tasks');
575 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
579 if ($project->usesDocman()) {
580 $TABS_DIRS[]='/docman/?group_id='.$group;
581 $TABS_TITLES[]=_('Docs');
582 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
586 if ($project->usesSurvey()) {
587 $TABS_DIRS[]='/survey/?group_id='.$group;
588 $TABS_TITLES[]=_('Surveys');
589 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
593 if ($project->usesNews()) {
594 $TABS_DIRS[]='/news/?group_id='.$group;
595 $TABS_TITLES[]=_('News');
596 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
600 if ($project->usesSCM()) {
601 $TABS_DIRS[]='/scm/?group_id='.$group;
602 $TABS_TITLES[]=_('SCM');
603 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
606 // groupmenu_after_scm hook
607 $hookParams['DIRS'] = &$TABS_DIRS;
608 $hookParams['TITLES'] = &$TABS_TITLES;
609 $hookParams['toptab'] = &$toptab;
610 $hookParams['selected'] = &$selected;
611 $hookParams['group_id'] = $group ;
613 plugin_hook ("groupmenu_scm", $hookParams) ;
616 if ($project->usesFRS()) {
617 $TABS_DIRS[]='/frs/?group_id='.$group;
618 $TABS_TITLES[]=_('Files');
619 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
623 $hookParams['DIRS'] = &$TABS_DIRS;
624 $hookParams['TITLES'] = &$TABS_TITLES;
625 $hookParams['toptab'] = &$toptab;
626 $hookParams['selected'] = &$selected;
627 $hookParams['group'] = $group;
629 plugin_hook ("groupmenu", $hookParams) ;
631 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
635 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
637 $count=count($TABS_DIRS);
638 $width=intval((100/$count));
646 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
654 for ($i=0; $i<$count; $i++) {
657 // this is the first tab, choose an image with end-name
660 $issel=($selected==$i);
661 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
662 // $rowspan=(($issel)?'rowspan="2" ' : '');
665 <td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgroot . 'theme-'.$inner.'-end-'.(($issel) ? '' : 'not').'selected.png)">'.
666 '<img src="'.$this->imgroot . 'clear.png" height="25" width="10" alt="" /></td>'.
667 '<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>';
668 } elseif ($i==$count-1) {
670 // this is the last tab, choose an image with name-end
672 $wassel=($selected==$i-1);
673 $issel=($selected==$i);
674 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
675 // $rowspan=(($issel)?'rowspan="2" ' : '');
677 // Build image between current and prior tab
680 <td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
681 '<img src="'.$this->imgroot . 'clear.png" height="2" width="20" alt="" /></td>'.
682 '<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>';
684 // Last graphic on right-side
687 <td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($issel) ? '' : 'not').'selected-end.png)">'.
688 '<img src="'.$this->imgroot . 'clear.png" height="2" width="10" alt="" /></td>';
694 $wassel=($selected==$i-1);
695 $issel=($selected==$i);
696 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
697 // $rowspan=(($issel)?'rowspan="2" ' : '');
699 // Build image between current and prior tab
702 <td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
703 '<img src="'.$this->imgroot . 'clear.png" height="2" width="20" alt="" /></td>'.
704 '<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>';
711 // Building a bottom row in this table, which will be darker
713 if ($selected == 0) {
715 $end_cols=((count($TABS_DIRS)*3)-3);
716 } elseif ($selected == (count($TABS_DIRS)-1)) {
717 $beg_cols=((count($TABS_DIRS)*3)-3);
720 $beg_cols=($selected*3);
721 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
725 $return .= '<td colspan="'.$beg_cols.'" height="1" class="notSelTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
727 $return .= '<td colspan="3" height="1" class="selTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
729 $return .= '<td colspan="'.$end_cols.'" height="1" class="notSelTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
741 function searchBox() {
742 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
744 if(get_magic_quotes_gpc()) {
745 $defaultWords = stripslashes($words);
747 $defaultWords = $words;
751 $defaultWords = htmlspecialchars($defaultWords);
753 // if there is no search currently, set the default
754 if ( ! isset($type_of_search) ) {
759 <form action="/search/" method="get">
760 <table border="0" cellpadding="0" cellspacing="0">
762 <div align="center" class="searchbox">';
764 SEARCH__PARAMETER_GROUP_ID => $group_id,
765 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
766 SEARCH__PARAMETER_FORUM_ID => $forum_id,
767 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
770 $searchManager =& getSearchManager();
771 $searchManager->setParametersValues($parameters);
772 $searchEngines =& $searchManager->getAvailableSearchEngines();
774 echo '<select name="type_of_search">';
775 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
776 $searchEngine =& $searchEngines[$i];
777 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
779 echo '</select></div>';
783 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
785 print '</td><td> ';
786 $parameters = $searchManager->getParameters();
787 foreach($parameters AS $name => $value) {
788 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
791 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
793 print '</td><td> </td><td>';
794 print '<input type="submit" name="Search" value="'._('Search').'" />';
797 if (isset($group_id) && $group_id) {
799 <td width="10"> </td>
800 <td><a class="lnkutility" href="'.$GLOBALS['sys_urlprefix'].'/search/advanced_search.php?group_id='.$group_id.'"> '._('Advanced search').'</a></td>';
802 print '</tr></table>';
807 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
808 // display the searchmask
810 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
811 <input type="hidden" name="search" value="1"/>
812 <input type="hidden" name="group_id" value="'.$group_id.'"/>
813 <div align="center"><br />
817 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
818 <input type="submit" name="submitbutton" value="'._('Search').'" />
823 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
826 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
829 </table><br /></div>'
830 .$this->createUnderSections($sectionsArray).'
834 //create javascript methods for select none/all
836 <script type="text/javascript">
837 <!-- method for disable/enable checkboxes
838 function setCheckBoxes(parent, checked) {
841 for (var i = 0; i < document.advancedsearch.elements.length; i++)
842 if (document.advancedsearch.elements[i].type == "checkbox")
843 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
844 document.advancedsearch.elements[i].checked = checked;
852 function createUnderSections($sectionsArray) {
854 foreach ($sectionsArray as $section) {
855 if(is_array($section)) {
856 $countLines += (3 + count ($section));
858 //2 lines one for section name and one for checkbox
862 $breakLimit = round($countLines/3);
863 $break = $breakLimit;
866 <table width="100%" border="0" cellspacing="0" cellpadding="1">
867 <tr class="tableheader">
869 <table width="100%" cellspacing="0" border="0">
870 <tr class="tablecontent">
871 <!--<td colspan="2">'._('Search in').':</td-->
872 <td align="right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
874 <tr height="20" class="tablecontent">
875 <td colspan="3"> </td>
877 <tr align="center" valign="top" class="tablecontent">
879 foreach($sectionsArray as $key => $section) {
880 $oldcountlines = $countLines;
881 if (is_array($section)) {
882 $countLines += (3 + count ($section));
887 if ($countLines >= $break) {
888 //if the next block is so large that shifting it to the next column hits the breakpoint better
889 //the second part of statement (behind &&) proofs, that no 4th column is added
890 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
891 $return .= '</td><td>';
892 $break += $breakLimit;
896 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0">
897 <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
900 <a href="#'.$key.'">'.$group_subsection_names[$key].'</a>'
903 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
906 <tr class="tablecontent">
909 if (!is_array($section)) {
910 $return .= ' <input type="checkbox" name="'.urlencode($key).'"';
911 if (isset($GLOBALS[urlencode($key)]))
912 $return .= ' checked="checked" ';
913 $return .= ' /></input>'.$group_subsection_names[$key].'<br />';
916 foreach($section as $underkey => $undersection) {
917 $return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
918 if (isset($GLOBALS[urlencode($key.$underkey)]))
919 $return .= ' checked ';
920 $return .= '></input>'.$undersection.'<br />';
926 </table></td></tr></table><br />';
928 if ($countLines >= $break) {
929 if (($countLines - $break) < ($break - $countLines)) {
930 $return .= '</td><td width="33%">';
931 $break += $breakLimit;
936 return $return.' </td>
938 </table></td></tr></table>';
942 * beginSubMenu() - Opening a submenu.
944 * @return string Html to start a submenu.
946 function beginSubMenu () {
953 * endSubMenu() - Closing a submenu.
955 * @return string Html to end a submenu.
957 function endSubMenu () {
958 $return = '</strong></p>';
963 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
965 * @param array The array of titles.
966 * @param array The array of title links.
967 * @return string Html to build a submenu.
969 function printSubMenu ($title_arr,$links_arr) {
970 $count=count($title_arr);
975 for ($i=0; $i<$count; $i++) {
977 <a href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a> | ';
980 <a href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a>';
985 * subMenu() - Takes two array of titles and links and build a menu.
987 * @param array The array of titles.
988 * @param array The array of title links.
989 * @return string Html to build a submenu.
991 function subMenu ($title_arr,$links_arr) {
992 $return = $this->beginSubMenu () ;
993 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
994 $return .= $this->endSubMenu () ;
999 * multiTableRow() - create a mutlilevel row in a table
1001 * @param string the row attributes
1002 * @param array the array of cell data, each element is an array,
1003 * the first item being the text,
1004 * the subsequent items are attributes (dont include
1005 * the bgcolor for the title here, that will be
1006 * handled by $istitle
1007 * @param boolean is this row part of the title ?
1010 function multiTableRow($row_attr, $cell_data, $istitle) {
1014 $return .=' align="center" class="multiTableRowTitle"';
1017 for ( $c = 0; $c < count($cell_data); $c++ ) {
1019 for ( $a=1; $a < count($cell_data[$c]); $a++) {
1020 $return .= $cell_data[$c][$a].' ';
1024 $return .='<span class="multiTableRowTitle">';
1026 $return .= $cell_data[$c][0];
1028 $return .='</span>';
1040 * feedback() - returns the htmlized feedback string when an action is performed.
1042 * @param string feedback string
1043 * @return string htmlized feedback
1045 function feedback($feedback) {
1050 <span class="feedback">'.strip_tags($feedback, '<br>').'</span>';
1055 * getThemeIdFromName()
1057 * @param string the dirname of the theme
1058 * @return integer the theme id
1060 function getThemeIdFromName($dirname) {
1061 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
1062 return db_result($res,0,'theme_id');
1065 function quickNav() {
1066 if (!session_loggedin()) {
1069 $res=db_query("SELECT * FROM groups NATURAL JOIN user_group WHERE user_id='".user_getid()."' ORDER BY group_name");
1071 if (!$res || db_numrows($res) < 1) {
1075 <form name="quicknavform">
1076 <select name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">';
1078 <option value="">Quick Jump To...</option>';
1079 for ($i=0; $i<db_numrows($res); $i++) {
1081 <option value="/projects/'.db_result($res,$i,'unix_group_name').'/">'.db_result($res,$i,'group_name').'</option>';
1082 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1084 <option value="/project/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1087 if (db_result($res,$i,'use_tracker')) {
1089 <option value="/tracker/?group_id='.db_result($res,$i,'group_id').'"> Tracker</option>';
1090 if (db_result($res,$i,'admin_flags') || db_result($res,$i,'tracker_flags')) {
1092 <option value="/tracker/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1096 if (db_result($res,$i,'use_pm')) {
1098 <option value="/pm/?group_id='.db_result($res,$i,'group_id').'"> Task Manager</option>';
1099 if (trim(db_result($res,$i,'admin_flags')) =='A' || db_result($res,$i,'project_flags')) {
1101 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1105 if (db_result($res,$i,'use_frs')) {
1107 <option value="/frs/?group_id='.db_result($res,$i,'group_id').'"> Files</option>';
1108 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'release_flags')) {
1110 <option value="/frs/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1114 if (db_result($res,$i,'use_scm')) {
1116 <option value="/scm/?group_id='.db_result($res,$i,'group_id').'"> SCM</option>';
1117 /*if (db_result($res,$i,'admin_flags') || db_result($res,$i,'project_flags')) {
1119 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1123 if (db_result($res,$i,'use_forum')) {
1125 <option value="/forum/?group_id='.db_result($res,$i,'group_id').'"> Forum</option>';
1126 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'forum_flags')) {
1128 <option value="/forum/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1132 if (db_result($res,$i,'use_mail')) {
1134 <option value="/mail/?group_id='.db_result($res,$i,'group_id').'"> Lists</option>';
1135 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1137 <option value="/mail/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1141 if (db_result($res,$i,'use_docman')) {
1143 <option value="/docman/?group_id='.db_result($res,$i,'group_id').'"> Docs</option>';
1144 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'doc_flags')) {
1146 <option value="/docman/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1150 if (db_result($res,$i,'use_news')) {
1152 <option value="/news/?group_id='.db_result($res,$i,'group_id').'"> News</option>';
1153 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1155 <option value="/news/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1159 if (db_result($res,$i,'use_survey')) {
1161 <option value="/survey/?group_id='.db_result($res,$i,'group_id').'"> Surveys</option>';
1162 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1164 <option value="/survey/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1180 // c-file-style: "bsd"