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 $gfcommon.'include/constants.php';
17 require_once $gfcommon.'include/FusionForge.class.php';
18 require_once $gfwww.'search/include/SearchManager.class.php';
20 class Layout extends Error {
23 * The default main page content */
24 var $rootindex = 'index_std.php';
27 * The root location of the theme
28 * @var string $themeroot
33 * The root location for images
35 * @var string $imgroot
42 * Layout() - Constructor
46 $this->themeroot=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'];
47 /* if images directory exists in theme, then use it as imgroot */
48 if (file_exists ($this->themeroot.'/images')){
49 $this->imgroot=util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/images/');
51 // Constructor for parent class...
52 if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
53 $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
58 * headerStart() - common code for all themes
60 * @param array Header parameters array
62 function headerStart($params) {
63 if (!$params['title']) {
64 $params['title'] = $GLOBALS['sys_name'];
66 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
68 print '<?xml version="1.0" encoding="utf-8"';
72 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
73 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
75 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo _('en') ?>" lang="<?php echo _('en') ?>">
78 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
79 <title><?php echo $params['title']; ?></title>
80 <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS" href="<?php echo util_make_url ('/export/rss_sfnews.php'); ?>" type="application/rss+xml"/>
81 <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS 2.0" href="<?php echo util_make_url ('/export/rss20_news.php'); ?>" type="application/rss+xml"/>
82 <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - New Projects RSS" href="<?php echo util_make_url ('/export/rss_sfprojects.php'); ?>" type="application/rss+xml"/>
84 <?php if (isset($GLOBALS['group_id'])) {
85 $activity = '<link rel="alternate" title="' . $GLOBALS['sys_name'] . ' - New Activity RSS" href="'. util_make_url ('/export/rss20_activity.php?group_id='.$GLOBALS['group_id']).'" type="application/rss+xml"/>';
89 <?php $this->headerCSS(); ?>
91 <script language="JavaScript" type="text/javascript">
94 function admin_window(adminurl) {
95 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
98 function help_window(helpurl) {
99 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
102 <?php plugin_hook ("javascript",false) ; ?>
108 function headerCSS() {
109 /* check if a personalized css stylesheet exist, if yes include only
111 new stylesheets should use the <themename>.css file
113 $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css';
114 if (file_exists($theme_cssfile)){
116 <link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css').'"/>';
118 /* if this is not our case, then include the compatibility stylesheet
119 that contains all removed styles from the code and check if a
120 custom stylesheet exists.
121 Used for compatibility with existing stylesheets
124 <link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/css/gforge-compat.css').'" />';
125 $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/theme.css';
126 if (file_exists($theme_cssfile)){
128 <link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/css/theme.css').'" />';
131 plugin_hook ('cssfile',$this);
134 function header($params) {
135 $this->headerStart($params); ?>
138 $this->bodyHeader($params);
141 function bodyHeader($params){
144 <table border="0" width="100%" cellspacing="0" cellpadding="0" id="headertable">
147 <td><a href="<?php echo util_make_url (''); ?>/"><?php echo html_image('logo.png',198,52,array('border'=>'0')); ?></a></td>
148 <td><?php echo $this->searchBox(); ?></td>
149 <td align="right"><?php
150 if (session_loggedin()) {
151 echo util_make_link ('/account/logout.php',_('Log Out'),array('class'=>'lnkutility'));
152 echo util_make_link ('/account/',_('My Account'),array('class'=>'lnkutility'));
154 echo util_make_link ('/account/login.php',_('Log In'),array('class'=>'lnkutility'));
155 if (!$GLOBALS['sys_user_reg_restricted']) {
156 echo util_make_link ('/account/register.php',_('New Account'),array('class'=>'lnkutility'));
160 $params['template'] = ' {menu}';
161 plugin_hook ('headermenu', $params);
163 echo $this->quickNav();
166 <td> </td>
171 <table border="0" width="100%" cellspacing="0" cellpadding="0">
177 <?php echo $this->outerTabs($params); ?>
184 <td align="left" class="toptab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft.png" height="9" width="9" alt="" /></td>
185 <td class="toptab" width="30"><img src="<?php echo $this->imgroot; ?>clear.png" width="30" height="1" alt="" /></td>
186 <td class="toptab"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
187 <td class="toptab" width="30"><img src="<?php echo $this->imgroot; ?>clear.png" width="30" height="1" alt="" /></td>
188 <td align="right" class="toptab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topright.png" height="9" width="9" alt="" /></td>
193 <!-- Outer body row -->
195 <td class="toptab"><img src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td>
196 <td valign="top" width="99%" class="toptab" colspan="3">
198 <!-- Inner Tabs / Shell -->
200 <table border="0" width="100%" cellspacing="0" cellpadding="0">
204 if (isset($params['group']) && $params['group']) {
212 echo $this->projectTabs($params['toptab'],$params['group']);
224 <td align="left" class="projecttab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft-inner.png" height="9" width="9" alt="" /></td>
225 <td class="projecttab" ><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
226 <td align="right" class="projecttab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topright-inner.png" height="9" width="9" alt="" /></td>
230 <td class="projecttab" ><img src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td>
231 <td valign="top" width="99%" class="projecttab">
237 function footer($params) {
241 <!-- end main body row -->
245 <td width="10" class="footer3" ><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
248 <td align="left" class="footer1" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomleft-inner.png" height="11" width="11" alt="" /></td>
249 <td class="footer3"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
250 <td align="right" class="footer1" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomright-inner.png" height="11" width="11" alt="" /></td>
254 <!-- end inner body row -->
257 <td width="10" class="footer2"><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
260 <td align="left" class="footer2" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomleft.png" height="9" width="9" alt="" /></td>
261 <td class="footer2" colspan="3"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
262 <td align="right" class="footer2" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomright.png" height="9" width="9" alt="" /></td>
266 $this->footerEnd($params);
269 function footerEnd($params) { ?>
271 <!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
274 <a href="http://fusionforge.org/"><img src="/images/pow-gforge.png" alt="Powered By FusionForge" border="0" /></a>
277 $forge = FusionForge() ;
278 printf (_('This site is running %1$s version %2$d'),
279 $forge->software_name,
280 $forge->software_version) ;
285 global $sys_show_source;
286 if ($sys_show_source) {
287 echo util_make_link ('/source.php?file='.getStringFromServer('SCRIPT_NAME'),_('Show source'),array('class'=>'showsource'));
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++) {
394 $return .= '<td>'.util_make_link ($links_arr[$i],$title_arr[$i],array('class'=>'sortbutton')).'</td>';
397 for ($i=0; $i<$count; $i++) {
399 <td>'.$title_arr[$i].'</td>';
402 return $return.'</tr>';
405 function listTableBottom() {
406 return '</table></td>
407 <!-- <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> -->
411 function outerTabs($params) {
412 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
416 if ($sys_use_trove) {
417 $TABS_DIRS[]='/softwaremap/';
419 if ($sys_use_snippet) {
420 $TABS_DIRS[]='/snippet/';
422 if ($sys_use_people) {
423 $TABS_DIRS[]='/people/';
425 $TABS_TITLES[]=_('Home');
426 $TABS_TITLES[]=_('My Page');
427 if ($sys_use_trove) {
428 $TABS_TITLES[]=_('Project Tree');
430 if ($sys_use_snippet) {
431 $TABS_TITLES[]=_('Code Snippets');
433 if ($sys_use_people) {
434 $TABS_TITLES[]=_('Project Openings');
438 $PLUGIN_TABS_DIRS = Array();
439 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
440 $hookParams['TITLES'] = &$TABS_TITLES;
441 plugin_hook ("outermenu", $hookParams) ;
442 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
444 $user_is_super=false;
445 if (session_loggedin()) {
446 $projectmaster =& group_get_object(GROUP_IS_MASTER);
447 $projectstats =& group_get_object(GROUP_IS_STATS);
448 $permmaster =& $projectmaster->getPermission( session_get_user() );
449 $permstats =& $projectstats->getPermission( session_get_user() );
451 if ($permmaster->isAdmin()) {
453 $TABS_DIRS[]='/admin/';
454 $TABS_TITLES[]=_('Admin');
456 if ($permstats->isMember()) {
457 $TABS_DIRS[]='/reporting/';
458 $TABS_TITLES[]=_('Reporting');
461 if(isset($params['group']) && $params['group']) {
462 // get group info using the common result set
463 $project =& group_get_object($params['group']);
464 if ($project && is_object($project)) {
465 if ($project->isError()) {
467 } elseif (!$project->isProject()) {
470 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
471 $TABS_DIRS[]='/project/?group_id'.$project->getId();
473 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
475 $TABS_TITLES[]=$project->getPublicName();
476 $selected=count($TABS_DIRS)-1;
479 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/my/') ||
480 strstr(getStringFromServer('REQUEST_URI'),'/account/') ||
481 strstr(getStringFromServer('REQUEST_URI'),'/register/') ||
482 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
483 $selected=array_search("/my/", $TABS_DIRS);
484 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
485 $selected=array_search("/softwaremap/", $TABS_DIRS);
486 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
487 $selected=array_search("/snippet/", $TABS_DIRS);
488 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
489 $selected=array_search("/people/", $TABS_DIRS);
490 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
491 $selected=array_search('/reporting/',$TABS_DIRS);
492 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
493 $selected=array_search('/admin/',$TABS_DIRS);
494 } elseif (count($PLUGIN_TABS_DIRS)>0) {
495 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
496 if (strstr(getStringFromServer('REQUEST_URI'),$PLUGIN_TABS_DIRS_VALUE)) {
497 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
504 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,'','100%');
509 * projectTabs() - Prints out the project tabs, contained here in case
510 * we want to allow it to be overriden
512 * @param string Is the tab currently selected
513 * @param string Is the group we should look up get title info
515 function projectTabs($toptab,$group) {
516 // get group info using the common result set
517 $project =& group_get_object($group);
518 if (!$project || !is_object($project)) {
521 if ($project->isError()) {
522 //wasn't found or some other problem
525 if (!$project->isProject()) {
530 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
531 $TABS_DIRS[]='/project/?group_id='. $project->getId();
533 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
535 $TABS_TITLES[]=_('Summary');
536 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
539 $perm =& $project->getPermission( session_get_user() );
540 if ($perm->isAdmin()) {
541 $TABS_DIRS[]='/project/admin/?group_id='. $group;
542 $TABS_TITLES[]=_('Admin');
543 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
546 $TABS_DIRS[]='http://'. $project->getHomePage();
547 $TABS_TITLES[]=_('Home Page');
550 // Project Activity tab
552 $TABS_DIRS[]='/activity/?group_id='. $group;
553 $TABS_TITLES[]=_('Activity');
554 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
557 if ($project->usesForum()) {
558 $TABS_DIRS[]='/forum/?group_id='.$group;
559 $TABS_TITLES[]=_('Forums');
560 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
564 if ($project->usesTracker()) {
565 $TABS_DIRS[]='/tracker/?group_id='.$group;
566 $TABS_TITLES[]=_('Tracker');
567 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
568 ? $selected=(count($TABS_TITLES)-1) : '' );
572 if ($project->usesMail()) {
573 $TABS_DIRS[]='/mail/?group_id='.$group;
574 $TABS_TITLES[]=_('Lists');
575 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
579 if ($project->usesPm()) {
580 $TABS_DIRS[]='/pm/?group_id='.$group;
581 $TABS_TITLES[]=_('Tasks');
582 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
586 if ($project->usesDocman()) {
587 $TABS_DIRS[]='/docman/?group_id='.$group;
588 $TABS_TITLES[]=_('Docs');
589 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
593 if ($project->usesSurvey()) {
594 $TABS_DIRS[]='/survey/?group_id='.$group;
595 $TABS_TITLES[]=_('Surveys');
596 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
600 if ($project->usesNews()) {
601 $TABS_DIRS[]='/news/?group_id='.$group;
602 $TABS_TITLES[]=_('News');
603 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
607 if ($project->usesSCM()) {
608 $TABS_DIRS[]='/scm/?group_id='.$group;
609 $TABS_TITLES[]=_('SCM');
610 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
613 // groupmenu_after_scm hook
614 $hookParams['DIRS'] = &$TABS_DIRS;
615 $hookParams['TITLES'] = &$TABS_TITLES;
616 $hookParams['toptab'] = &$toptab;
617 $hookParams['selected'] = &$selected;
618 $hookParams['group_id'] = $group ;
620 plugin_hook ("groupmenu_scm", $hookParams) ;
623 if ($project->usesFRS()) {
624 $TABS_DIRS[]='/frs/?group_id='.$group;
625 $TABS_TITLES[]=_('Files');
626 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
630 $hookParams['DIRS'] = &$TABS_DIRS;
631 $hookParams['TITLES'] = &$TABS_TITLES;
632 $hookParams['toptab'] = &$toptab;
633 $hookParams['selected'] = &$selected;
634 $hookParams['group'] = $group;
636 plugin_hook ("groupmenu", $hookParams) ;
638 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
642 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
644 $count=count($TABS_DIRS);
645 $width=intval((100/$count));
653 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
661 for ($i=0; $i<$count; $i++) {
664 // this is the first tab, choose an image with end-name
667 $issel=($selected==$i);
668 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
669 // $rowspan=(($issel)?'rowspan="2" ' : '');
672 <td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgroot . 'theme-'.$inner.'-end-'.(($issel) ? '' : 'not').'selected.png)">'.
673 '<img src="'.$this->imgroot . 'clear.png" height="25" width="10" alt="" /></td>'.
674 '<td '.$rowspan.'style="background:url('.$this->imgroot . $bgimg.')" width="'.$width.'%" align="center">'.util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('class'=>(($issel)?'tabsellink':'tablink'))).'</td>';
675 } elseif ($i==$count-1) {
677 // this is the last tab, choose an image with name-end
679 $wassel=($selected==$i-1);
680 $issel=($selected==$i);
681 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
682 // $rowspan=(($issel)?'rowspan="2" ' : '');
684 // Build image between current and prior tab
687 <td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
688 '<img src="'.$this->imgroot . 'clear.png" height="2" width="20" alt="" /></td>'.
689 '<td '.$rowspan.'style="background:url('.$this->imgroot . $bgimg.')" width="'.$width.'%" align="center">'.util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('class'=>(($issel)?'tabsellink':'tablink'))).'</td>';
691 // Last graphic on right-side
694 <td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($issel) ? '' : 'not').'selected-end.png)">'.
695 '<img src="'.$this->imgroot . 'clear.png" height="2" width="10" alt="" /></td>';
701 $wassel=($selected==$i-1);
702 $issel=($selected==$i);
703 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
704 // $rowspan=(($issel)?'rowspan="2" ' : '');
706 // Build image between current and prior tab
709 <td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
710 '<img src="'.$this->imgroot . 'clear.png" height="2" width="20" alt="" /></td>'.
711 '<td '.$rowspan.'style="background:url('.$this->imgroot . $bgimg.')" width="'.$width.'%" align="center">'.util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('class'=>(($issel)?'tabsellink':'tablink'))).'</td>';
718 // Building a bottom row in this table, which will be darker
720 if ($selected == 0) {
722 $end_cols=((count($TABS_DIRS)*3)-3);
723 } elseif ($selected == (count($TABS_DIRS)-1)) {
724 $beg_cols=((count($TABS_DIRS)*3)-3);
727 $beg_cols=($selected*3);
728 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
732 $return .= '<td colspan="'.$beg_cols.'" height="1" class="notSelTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
734 $return .= '<td colspan="3" height="1" class="selTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
736 $return .= '<td colspan="'.$end_cols.'" height="1" class="notSelTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
748 function searchBox() {
749 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
751 if(get_magic_quotes_gpc()) {
752 $defaultWords = stripslashes($words);
754 $defaultWords = $words;
758 $defaultWords = htmlspecialchars($defaultWords);
760 // if there is no search currently, set the default
761 if ( ! isset($type_of_search) ) {
766 <form action="/search/" method="get">
767 <table border="0" cellpadding="0" cellspacing="0">
769 <div align="center" class="searchbox">';
771 SEARCH__PARAMETER_GROUP_ID => $group_id,
772 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
773 SEARCH__PARAMETER_FORUM_ID => $forum_id,
774 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
777 $searchManager =& getSearchManager();
778 $searchManager->setParametersValues($parameters);
779 $searchEngines =& $searchManager->getAvailableSearchEngines();
781 echo '<select name="type_of_search">';
782 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
783 $searchEngine =& $searchEngines[$i];
784 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
786 echo '</select></div>';
790 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
792 print '</td><td> ';
793 $parameters = $searchManager->getParameters();
794 foreach($parameters AS $name => $value) {
795 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
798 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
800 print '</td><td> </td><td>';
801 print '<input type="submit" name="Search" value="'._('Search').'" />';
804 if (isset($group_id) && $group_id) {
806 <td width="10"> </td>
807 <td>'.util_make_link ('/search/advanced_search.php?group_id='.$group_id,_('Advanced search'),array('class'=>'lnkutility')).'</td>';
809 print '</tr></table>';
814 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) {
861 foreach ($sectionsArray as $section) {
862 if(is_array($section)) {
863 $countLines += (3 + count ($section));
865 //2 lines one for section name and one for checkbox
869 $breakLimit = round($countLines/3);
870 $break = $breakLimit;
873 <table width="100%" border="0" cellspacing="0" cellpadding="1">
874 <tr class="tableheader">
876 <table width="100%" cellspacing="0" border="0">
877 <tr class="tablecontent">
878 <!--<td colspan="2">'._('Search in').':</td-->
879 <td align="right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
881 <tr height="20" class="tablecontent">
882 <td colspan="3"> </td>
884 <tr align="center" valign="top" class="tablecontent">
886 foreach($sectionsArray as $key => $section) {
887 $oldcountlines = $countLines;
888 if (is_array($section)) {
889 $countLines += (3 + count ($section));
894 if ($countLines >= $break) {
895 //if the next block is so large that shifting it to the next column hits the breakpoint better
896 //the second part of statement (behind &&) proofs, that no 4th column is added
897 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
898 $return .= '</td><td>';
899 $break += $breakLimit;
903 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0">
904 <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
907 <a href="#'.$key.'">'.$group_subsection_names[$key].'</a>'
910 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
913 <tr class="tablecontent">
916 if (!is_array($section)) {
917 $return .= ' <input type="checkbox" name="'.urlencode($key).'"';
918 if (isset($GLOBALS[urlencode($key)]))
919 $return .= ' checked="checked" ';
920 $return .= ' /></input>'.$group_subsection_names[$key].'<br />';
923 foreach($section as $underkey => $undersection) {
924 $return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
925 if (isset($GLOBALS[urlencode($key.$underkey)]))
926 $return .= ' checked ';
927 $return .= '></input>'.$undersection.'<br />';
933 </table></td></tr></table><br />';
935 if ($countLines >= $break) {
936 if (($countLines - $break) < ($break - $countLines)) {
937 $return .= '</td><td width="33%">';
938 $break += $breakLimit;
943 return $return.' </td>
945 </table></td></tr></table>';
949 * beginSubMenu() - Opening a submenu.
951 * @return string Html to start a submenu.
953 function beginSubMenu () {
960 * endSubMenu() - Closing a submenu.
962 * @return string Html to end a submenu.
964 function endSubMenu () {
965 $return = '</strong></p>';
970 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
972 * @param array The array of titles.
973 * @param array The array of title links.
974 * @return string Html to build a submenu.
976 function printSubMenu ($title_arr,$links_arr) {
977 $count=count($title_arr);
981 for ($i=0; $i<$count; $i++) {
982 $return .= util_make_link ($links_arr[$i],$title_arr[$i]).' | ';
984 $return .= util_make_link ($links_arr[$i],$title_arr[$i]);
989 * subMenu() - Takes two array of titles and links and build a menu.
991 * @param array The array of titles.
992 * @param array The array of title links.
993 * @return string Html to build a submenu.
995 function subMenu ($title_arr,$links_arr) {
996 $return = $this->beginSubMenu () ;
997 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
998 $return .= $this->endSubMenu () ;
1003 * multiTableRow() - create a mutlilevel row in a table
1005 * @param string the row attributes
1006 * @param array the array of cell data, each element is an array,
1007 * the first item being the text,
1008 * the subsequent items are attributes (dont include
1009 * the bgcolor for the title here, that will be
1010 * handled by $istitle
1011 * @param boolean is this row part of the title ?
1014 function multiTableRow($row_attr, $cell_data, $istitle) {
1018 $return .=' align="center" class="multiTableRowTitle"';
1021 for ( $c = 0; $c < count($cell_data); $c++ ) {
1023 for ( $a=1; $a < count($cell_data[$c]); $a++) {
1024 $return .= $cell_data[$c][$a].' ';
1028 $return .='<span class="multiTableRowTitle">';
1030 $return .= $cell_data[$c][0];
1032 $return .='</span>';
1044 * feedback() - returns the htmlized feedback string when an action is performed.
1046 * @param string feedback string
1047 * @return string htmlized feedback
1049 function feedback($feedback) {
1054 <span class="feedback">'.strip_tags($feedback, '<br>').'</span>';
1059 * getThemeIdFromName()
1061 * @param string the dirname of the theme
1062 * @return integer the theme id
1064 function getThemeIdFromName($dirname) {
1065 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
1066 return db_result($res,0,'theme_id');
1069 function quickNav() {
1070 if (!session_loggedin()) {
1073 $res=db_query("SELECT * FROM groups NATURAL JOIN user_group WHERE user_id='".user_getid()."' ORDER BY group_name");
1075 if (!$res || db_numrows($res) < 1) {
1079 <form name="quicknavform">
1080 <select name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">';
1082 <option value="">'._('Quick Jump To...').'</option>';
1083 for ($i=0; $i<db_numrows($res); $i++) {
1085 <option value="'.util_make_url_g (db_result($res,$i,'unix_group_name'),db_result($res,$i,'group_id')).'">'.db_result($res,$i,'group_name').'</option>';
1086 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1088 <option value="'.util_make_url ('/project/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
1091 if (db_result($res,$i,'use_tracker')) {
1093 <option value="'.util_make_url ('/tracker/?group_id='.db_result($res,$i,'group_id')).'"> Tracker</option>';
1094 if (db_result($res,$i,'admin_flags') || db_result($res,$i,'artifact_flags')) {
1096 <option value="'.util_make_url ('/tracker/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
1100 if (db_result($res,$i,'use_pm')) {
1102 <option value="'.util_make_url ('/pm/?group_id='.db_result($res,$i,'group_id')).'"> Task Manager</option>';
1103 if (trim(db_result($res,$i,'admin_flags')) =='A' || db_result($res,$i,'project_flags')) {
1105 <option value="'.util_make_url ('/pm/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
1109 if (db_result($res,$i,'use_frs')) {
1111 <option value="'.util_make_url('/frs/?group_id='.db_result($res,$i,'group_id')).'"> Files</option>';
1112 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'release_flags')) {
1114 <option value="'.util_make_url('/frs/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
1118 if (db_result($res,$i,'use_scm')) {
1120 <option value="'.util_make_url('/scm/?group_id='.db_result($res,$i,'group_id')).'"> SCM</option>';
1121 /*if (db_result($res,$i,'admin_flags') || db_result($res,$i,'project_flags')) {
1123 <option value="'.util_make_url('/pm/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
1127 if (db_result($res,$i,'use_forum')) {
1129 <option value="'.util_make_url('/forum/?group_id='.db_result($res,$i,'group_id')).'"> Forum</option>';
1130 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'forum_flags')) {
1132 <option value="'.util_make_url('/forum/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
1136 if (db_result($res,$i,'use_mail')) {
1138 <option value="'.util_make_url('/mail/?group_id='.db_result($res,$i,'group_id')).'"> Lists</option>';
1139 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1141 <option value="'.util_make_url('/mail/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
1145 if (db_result($res,$i,'use_docman')) {
1147 <option value="'.util_make_url('/docman/?group_id='.db_result($res,$i,'group_id')).'"> Docs</option>';
1148 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'doc_flags')) {
1150 <option value="'.util_make_url('/docman/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
1154 if (db_result($res,$i,'use_news')) {
1156 <option value="'.util_make_url('/news/?group_id='.db_result($res,$i,'group_id')).'"> News</option>';
1157 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1159 <option value="'.util_make_url('/news/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
1163 if (db_result($res,$i,'use_survey')) {
1165 <option value="'.util_make_url('/survey/?group_id='.db_result($res,$i,'group_id')).'"> Surveys</option>';
1166 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1168 <option value="'.util_make_url('/survey/admin/?group_id='.db_result($res,$i,'group_id')).'"> Admin</option>';
1184 // c-file-style: "bsd"