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) {
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) {
146 $this->headerStart($params); ?>
149 $this->bodyHeader($params);
152 function bodyHeader($params){
155 <table border="0" width="100%" cellspacing="0" cellpadding="0" id="headertable">
158 <td><a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/"><?php echo html_image('logo.png',198,52,array('border'=>'0')); ?></a></td>
159 <td><?php echo $this->searchBox(); ?></td>
160 <td align="right"><?php
161 if (session_loggedin()) {
163 <a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/logout.php"><?php echo _('Log Out'); ?></a><br />
164 <a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/"><?php echo _('My Account'); ?></a>
168 <b><a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/login.php"><?php echo _('Log In'); ?></a></b><br />
169 <b><a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/register.php"><?php echo _('New Account'); ?></a></b>
172 echo $this->quickNav();
175 <td> </td>
180 <table border="0" width="100%" cellspacing="0" cellpadding="0">
186 <?php echo $this->outerTabs($params); ?>
193 <td align="left" class="toptab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft.png" height="9" width="9" alt="" /></td>
194 <td class="toptab" width="30"><img src="<?php echo $this->imgroot; ?>clear.png" width="30" height="1" alt="" /></td>
195 <td class="toptab"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
196 <td class="toptab" width="30"><img src="<?php echo $this->imgroot; ?>clear.png" width="30" height="1" alt="" /></td>
197 <td align="right" class="toptab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topright.png" height="9" width="9" alt="" /></td>
202 <!-- Outer body row -->
204 <td class="toptab"><img src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td>
205 <td valign="top" width="99%" class="toptab" colspan="3">
207 <!-- Inner Tabs / Shell -->
209 <table border="0" width="100%" cellspacing="0" cellpadding="0">
213 if (isset($params['group']) && $params['group']) {
221 echo $this->projectTabs($params['toptab'],$params['group']);
233 <td align="left" class="projecttab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft-inner.png" height="9" width="9" alt="" /></td>
234 <td class="projecttab" ><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
235 <td align="right" class="projecttab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topright-inner.png" height="9" width="9" alt="" /></td>
239 <td class="projecttab" ><img src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td>
240 <td valign="top" width="99%" class="projecttab">
246 function footer($params) {
250 <!-- end main body row -->
254 <td width="10" class="footer3" ><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
257 <td align="left" class="footer1" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomleft-inner.png" height="11" width="11" alt="" /></td>
258 <td class="footer3"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
259 <td align="right" class="footer1" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomright-inner.png" height="11" width="11" alt="" /></td>
263 <!-- end inner body row -->
266 <td width="10" class="footer2"><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
269 <td align="left" class="footer2" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomleft.png" height="9" width="9" alt="" /></td>
270 <td class="footer2" colspan="3"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
271 <td align="right" class="footer2" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomright.png" height="9" width="9" alt="" /></td>
275 $this->footerEnd($params);
278 function footerEnd($params) { ?>
280 <!-- PLEASE LEAVE "Powered By GForge" on your site -->
283 <a href="http://gforge.org/"><img src="/images/pow-gforge.png" alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
287 global $sys_show_source;
288 if ($sys_show_source) {
289 print '<a class="showsource" href="'.$GLOBALS['sys_urlprefix'].'/source.php?file=' . getStringFromServer('SCRIPT_NAME') . '"> '._('Show source').' </a>';
300 function getRootIndex() {
301 return $this->rootindex;
305 * boxTop() - Top HTML box
307 * @param string Box title
308 * @param bool Whether to echo or return the results
309 * @param string The box background color
311 function boxTop($title) {
313 <!-- Box Top Start -->
315 <table cellspacing="0" cellpadding="0" width="100%" border="0" style="background:url('.$this->imgroot.'vert-grad.png)">
317 <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>
318 <td width="100%" style="background:url('.$this->imgroot.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
319 <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>
323 <table cellspacing="2" cellpadding="2" width="100%" border="0">
327 <!-- Box Top End -->';
331 * boxMiddle() - Middle HTML box
333 * @param string Box title
334 * @param string The box background color
336 function boxMiddle($title) {
338 <!-- Box Middle Start -->
342 <td colspan="2" style="background:url('.$this->imgroot.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
346 <!-- Box Middle End -->';
350 * boxBottom() - Bottom HTML box
352 * @param bool Whether to echo or return the results
354 function boxBottom() {
356 <!-- Box Bottom Start -->
363 <!-- Box Bottom End -->';
367 * boxGetAltRowStyle() - Get an alternating row style for tables
369 * @param int Row number
371 function boxGetAltRowStyle($i) {
373 return ' class="altRowStyleEven"';
375 return ' class="altRowStyleOdd"';
380 * listTableTop() - Takes an array of titles and builds the first row of a new table.
382 * @param array The array of titles
383 * @param array The array of title links
385 function listTableTop ($title_arr,$links_arr=false) {
387 <table cellspacing="0" cellpadding="0" width="100%" border="0">
389 <!-- <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> -->
390 <td style="background:url('.$this->imgroot.'box-grad.png)">
391 <table width="100%" border="0" cellspacing="1" cellpadding="2" >
392 <tr class="tableheading">';
393 $count=count($title_arr);
395 for ($i=0; $i<$count; $i++) {
397 <td><a class="sortbutton" href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
400 for ($i=0; $i<$count; $i++) {
402 <td>'.$title_arr[$i].'</td>';
405 return $return.'</tr>';
408 function listTableBottom() {
409 return '</table></td>
410 <!-- <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> -->
414 function outerTabs($params) {
415 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
419 if ($sys_use_trove) {
420 $TABS_DIRS[]='/softwaremap/';
422 if ($sys_use_snippet) {
423 $TABS_DIRS[]='/snippet/';
425 if ($sys_use_people) {
426 $TABS_DIRS[]='/people/';
428 $TABS_TITLES[]=_('Home');
429 $TABS_TITLES[]=_('My Page');
430 if ($sys_use_trove) {
431 $TABS_TITLES[]=_('Project Tree');
433 if ($sys_use_snippet) {
434 $TABS_TITLES[]=_('Code Snippets');
436 if ($sys_use_people) {
437 $TABS_TITLES[]=_('Project Openings');
441 $PLUGIN_TABS_DIRS = Array();
442 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
443 $hookParams['TITLES'] = &$TABS_TITLES;
444 plugin_hook ("outermenu", $hookParams) ;
445 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
447 $user_is_super=false;
448 if (session_loggedin()) {
449 $projectmaster =& group_get_object(GROUP_IS_MASTER);
450 $projectstats =& group_get_object(GROUP_IS_STATS);
451 $permmaster =& $projectmaster->getPermission( session_get_user() );
452 $permstats =& $projectstats->getPermission( session_get_user() );
454 if ($permmaster->isAdmin()) {
456 $TABS_DIRS[]='/admin/';
457 $TABS_TITLES[]=_('Admin');
459 if ($permstats->isMember()) {
460 $TABS_DIRS[]='/reporting/';
461 $TABS_TITLES[]=_('Reporting');
464 if(isset($params['group']) && $params['group']) {
465 // get group info using the common result set
466 $project =& group_get_object($params['group']);
467 if ($project && is_object($project)) {
468 if ($project->isError()) {
470 } elseif (!$project->isProject()) {
473 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
474 $TABS_TITLES[]=$project->getPublicName();
475 $selected=count($TABS_DIRS)-1;
478 } elseif (strstr($GLOBALS['REQUEST_URI'],'/my/') ||
479 strstr($GLOBALS['REQUEST_URI'],'/account/') ||
480 strstr($GLOBALS['REQUEST_URI'],'/register/') ||
481 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
482 $selected=array_search("/my/", $TABS_DIRS);
483 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
484 $selected=array_search("/softwaremap/", $TABS_DIRS);
485 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
486 $selected=array_search("/snippet/", $TABS_DIRS);
487 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
488 $selected=array_search("/people/", $TABS_DIRS);
489 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
490 $selected=array_search('/reporting/',$TABS_DIRS);
491 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
492 $selected=array_search('/admin/',$TABS_DIRS);
493 } elseif (count($PLUGIN_TABS_DIRS)>0) {
494 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
495 if (strstr(getStringFromServer('REQUEST_URI'),$PLUGIN_TABS_DIRS_VALUE)) {
496 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
503 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,'','100%');
508 * projectTabs() - Prints out the project tabs, contained here in case
509 * we want to allow it to be overriden
511 * @param string Is the tab currently selected
512 * @param string Is the group we should look up get title info
514 function projectTabs($toptab,$group) {
515 // get group info using the common result set
516 $project =& group_get_object($group);
517 if (!$project || !is_object($project)) {
520 if ($project->isError()) {
521 //wasn't found or some other problem
524 if (!$project->isProject()) {
529 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
530 $TABS_TITLES[]=_('Summary');
531 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
534 $perm =& $project->getPermission( session_get_user() );
535 if ($perm->isAdmin()) {
536 $TABS_DIRS[]='/project/admin/?group_id='. $group;
537 $TABS_TITLES[]=_('Admin');
538 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
541 $TABS_DIRS[]='http://'. $project->getHomePage();
542 $TABS_TITLES[]=_('Home Page');
545 // Project Activity tab
547 $TABS_DIRS[]='/activity/?group_id='. $group;
548 $TABS_TITLES[]=_('Activity');
549 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
552 if ($project->usesForum()) {
553 $TABS_DIRS[]='/forum/?group_id='.$group;
554 $TABS_TITLES[]=_('Forums');
555 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
559 if ($project->usesTracker()) {
560 $TABS_DIRS[]='/tracker/?group_id='.$group;
561 $TABS_TITLES[]=_('Tracker');
562 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
563 ? $selected=(count($TABS_TITLES)-1) : '' );
567 if ($project->usesMail()) {
568 $TABS_DIRS[]='/mail/?group_id='.$group;
569 $TABS_TITLES[]=_('Lists');
570 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
574 if ($project->usesPm()) {
575 $TABS_DIRS[]='/pm/?group_id='.$group;
576 $TABS_TITLES[]=_('Tasks');
577 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
581 if ($project->usesDocman()) {
582 $TABS_DIRS[]='/docman/?group_id='.$group;
583 $TABS_TITLES[]=_('Docs');
584 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
588 if ($project->usesSurvey()) {
589 $TABS_DIRS[]='/survey/?group_id='.$group;
590 $TABS_TITLES[]=_('Surveys');
591 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
595 if ($project->usesNews()) {
596 $TABS_DIRS[]='/news/?group_id='.$group;
597 $TABS_TITLES[]=_('News');
598 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
602 if ($project->usesSCM()) {
603 $TABS_DIRS[]='/scm/?group_id='.$group;
604 $TABS_TITLES[]=_('SCM');
605 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
608 // groupmenu_after_scm hook
609 $hookParams['DIRS'] = &$TABS_DIRS;
610 $hookParams['TITLES'] = &$TABS_TITLES;
611 $hookParams['toptab'] = &$toptab;
612 $hookParams['selected'] = &$selected;
613 $hookParams['group_id'] = $group ;
615 plugin_hook ("groupmenu_scm", $hookParams) ;
618 if ($project->usesFRS()) {
619 $TABS_DIRS[]='/frs/?group_id='.$group;
620 $TABS_TITLES[]=_('Files');
621 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
625 $hookParams['DIRS'] = &$TABS_DIRS;
626 $hookParams['TITLES'] = &$TABS_TITLES;
627 $hookParams['toptab'] = &$toptab;
628 $hookParams['selected'] = &$selected;
629 $hookParams['group'] = $group;
631 plugin_hook ("groupmenu", $hookParams) ;
633 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
637 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
639 $count=count($TABS_DIRS);
640 $width=intval((100/$count));
648 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
656 for ($i=0; $i<$count; $i++) {
659 // this is the first tab, choose an image with end-name
662 $issel=($selected==$i);
663 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
664 // $rowspan=(($issel)?'rowspan="2" ' : '');
667 <td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgroot . 'theme-'.$inner.'-end-'.(($issel) ? '' : 'not').'selected.png)">'.
668 '<img src="'.$this->imgroot . 'clear.png" height="25" width="10" alt="" /></td>'.
669 '<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>';
670 } elseif ($i==$count-1) {
672 // this is the last tab, choose an image with name-end
674 $wassel=($selected==$i-1);
675 $issel=($selected==$i);
676 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
677 // $rowspan=(($issel)?'rowspan="2" ' : '');
679 // Build image between current and prior tab
682 <td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
683 '<img src="'.$this->imgroot . 'clear.png" height="2" width="20" alt="" /></td>'.
684 '<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>';
686 // Last graphic on right-side
689 <td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($issel) ? '' : 'not').'selected-end.png)">'.
690 '<img src="'.$this->imgroot . 'clear.png" height="2" width="10" alt="" /></td>';
696 $wassel=($selected==$i-1);
697 $issel=($selected==$i);
698 $bgimg=(($issel)?'theme-'.$inner.'-selected-bg.png':'theme-'.$inner.'-notselected-bg.png');
699 // $rowspan=(($issel)?'rowspan="2" ' : '');
701 // Build image between current and prior tab
704 <td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
705 '<img src="'.$this->imgroot . 'clear.png" height="2" width="20" alt="" /></td>'.
706 '<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>';
713 // Building a bottom row in this table, which will be darker
715 if ($selected == 0) {
717 $end_cols=((count($TABS_DIRS)*3)-3);
718 } elseif ($selected == (count($TABS_DIRS)-1)) {
719 $beg_cols=((count($TABS_DIRS)*3)-3);
722 $beg_cols=($selected*3);
723 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
727 $return .= '<td colspan="'.$beg_cols.'" height="1" class="notSelTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
729 $return .= '<td colspan="3" height="1" class="selTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
731 $return .= '<td colspan="'.$end_cols.'" height="1" class="notSelTab"><img src="'.$this->imgroot.'clear.png" height="1" width="10" alt="" /></td>';
743 function searchBox() {
744 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
746 if(get_magic_quotes_gpc()) {
747 $defaultWords = stripslashes($words);
749 $defaultWords = $words;
752 // if there is no search currently, set the default
753 if ( ! isset($type_of_search) ) {
758 <form action="/search/" method="get">
759 <table border="0" cellpadding="0" cellspacing="0">
761 <div align="center" class="searchbox">';
763 SEARCH__PARAMETER_GROUP_ID => $group_id,
764 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
765 SEARCH__PARAMETER_FORUM_ID => $forum_id,
766 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
769 $searchManager =& getSearchManager();
770 $searchManager->setParametersValues($parameters);
771 $searchEngines =& $searchManager->getAvailableSearchEngines();
773 echo '<select name="type_of_search">';
774 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
775 $searchEngine =& $searchEngines[$i];
776 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
778 echo '</select></div>';
782 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
784 print '</td><td> ';
785 $parameters = $searchManager->getParameters();
786 foreach($parameters AS $name => $value) {
787 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
790 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
792 print '</td><td> </td><td>';
793 print '<input type="submit" name="Search" value="'._('Search').'" />';
796 if (isset($group_id) && $group_id) {
798 <td width="10"> </td>
799 <td><a class="lnkutility" href="'.$GLOBALS['sys_urlprefix'].'/search/advanced_search.php?group_id='.$group_id.'"> '._('Advanced search').'</a></td>';
801 print '</tr></table>';
806 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
807 // display the searchmask
809 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
810 <input type="hidden" name="search" value="1"/>
811 <input type="hidden" name="group_id" value="'.$group_id.'"/>
812 <div align="center"><br />
816 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
817 <input type="submit" name="submitbutton" value="'._('Search').'" />
822 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
825 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
828 </table><br /></div>'
829 .$this->createUnderSections($sectionsArray).'
833 //create javascript methods for select none/all
835 <script type="text/javascript">
836 <!-- method for disable/enable checkboxes
837 function setCheckBoxes(parent, checked) {
840 for (var i = 0; i < document.advancedsearch.elements.length; i++)
841 if (document.advancedsearch.elements[i].type == "checkbox")
842 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
843 document.advancedsearch.elements[i].checked = checked;
851 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.'">'.$Language->getText('group', $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>'.$Language->getText('group', $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"