3 require_once('www/include/Layout.class.php');
5 define('THEME_DIR', $GLOBALS['sys_urlprefix'].'/themes/gforge');
7 define('TOP_TAB_HEIGHT', 30);
8 define('BOTTOM_TAB_HEIGHT', 22);
10 class Theme extends Layout {
16 $this->imgroot = THEME_DIR.'/images/';
17 $this->COLOR_CONTENT_BACK= '#ffffff';
18 $this->COLOR_LTBACK1= '#eeeeef';
19 $this->COLOR_LTBACK2= '#fafafa';
20 $this->COLOR_SELECTED_TAB= '#e0e0e0';
21 $this->COLOR_HTMLBOX_TITLE = '#bbbbbb';
22 $this->COLOR_HTMLBOX_BACK = '#eaecef';
23 $this->FONT_CONTENT = 'helvetica';
24 $this->FONT_HTMLBOX_TITLE = 'helvetica';
25 $this->FONTCOLOR_HTMLBOX_TITLE = '#333333';
26 $this->FONTCOLOR_CONTENT = '#333333';
27 $this->FONTSIZE = 'small';
28 $this->FONTSIZE_SMALLER='x-small';
29 $this->FONTSIZE_SMALLEST='xx-small';
30 $this->FONTSIZE_HTMLBOX_TITLE = 'small';
31 $this->bgpri = array();
35 * Layout() - Constructor
39 // Constructor for parent class...
40 if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
41 $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
45 Set up the priority color array one time only
47 $bgpri[1] = '#dadada';
48 $bgpri[2] = '#dacaca';
49 $bgpri[3] = '#dababa';
50 $bgpri[4] = '#daaaaa';
51 $bgpri[5] = '#da8a8a';
53 //determine font for this platform
54 if (browser_is_windows() && browser_is_ie()) {
56 //ie needs smaller fonts
57 $this->FONTSIZE='x-small';
58 $this->FONTSIZE_SMALLER='xx-small';
59 $this->FONTSIZE_SMALLEST='7pt';
61 } else if (browser_is_windows()) {
64 $this->FONTSIZE='small';
65 $this->FONTSIZE_SMALLER='x-small';
66 $this->FONTSIZE_SMALLEST='x-small';
68 } else if (browser_is_mac()){
70 //mac users need bigger fonts
71 $this->FONTSIZE='medium';
72 $this->FONTSIZE_SMALLER='small';
73 $this->FONTSIZE_SMALLEST='x-small';
77 //linux and other users
78 $this->FONTSIZE='small';
79 $this->FONTSIZE_SMALLER='x-small';
80 $this->FONTSIZE_SMALLEST='xx-small';
84 $this->FONTSIZE_HTMLBOX_TITLE = $this->FONTSIZE;
88 * createLinkToUserHome() - Creates a link to a user's home page
90 * @param string The user's user_name
91 * @param string The user's realname
93 function createLinkToUserHome($user_name, $realname) {
94 return '<a href="'.$GLOBALS['sys_urlprefix'].'/users/'.$user_name.'/">'.$realname.'</a>';
98 * header() - "steel theme" top of page
100 * @param array Header parameters array
102 function header($params) {
103 if (!$params['title']) {
104 $params['title'] = $GLOBALS['sys_name'];
106 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
108 print '<?xml version="1.0" encoding="utf-8"?>';
112 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
113 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
115 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo _('en'); ?>">
118 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
119 <title><?php echo $params['title']; ?></title>
120 <link rel="icon" type="image/png" href="<?php echo $this->imgroot; ?>icon.png"/>
121 <link rel="shortcut icon" href="<?php echo $this->imgroot; ?>icon.png"/>
122 <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"/>
123 <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/export/rss20_news.php" type="application/rss+xml"/>
124 <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"/>
126 <script language="JavaScript" type="text/javascript">
129 function admin_window(adminurl) {
130 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
133 function help_window(helpurl) {
134 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
137 <?php plugin_hook ("javascript",false) ; ?>
140 if (_('default_font') != 'default_font') {
141 $site_fonts = _('default_font');
143 $site_fonts = 'helvetica' ;
154 $this->bodyHeader($params);
157 function bodyHeader($params){
160 <table border="0" width="100%" cellspacing="0" cellpadding="0">
162 <td class="topLeft"><a href="/"><?php echo html_image('header/top-logo.gif',205,54,array('border'=>'0')); ?></a></td>
163 <td class="middleRight"><?php echo $this->searchBox(); ?></td>
164 <td class="middleRight"><?php
165 if (session_loggedin()) {
167 <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/logout.php"><?php echo _('Log Out'); ?></a>
169 <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/"><?php echo _('My Account'); ?></a>
173 <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/login.php"><?php echo _('Log In'); ?></a>
175 <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/register.php"><?php echo _('New Account'); ?></a>
178 echo $this->quickNav();
180 <td> </td>
187 <table border="0" width="100%" cellspacing="0" cellpadding="0">
189 <td><?php echo $this->outerTabs($params); ?></td>
194 <table border="0" width="100%" cellspacing="0" cellpadding="0">
196 if (isset($params['group']) && $params['group']) {
201 echo $this->projectTabs($params['toptab'],$params['group']);
210 <table border="0" width="100%" cellspacing="0" cellpadding="0">
212 <td class="mainCanvas"> <!-- main body area -->
216 function footer($params) {
218 </td> <!-- end main body area -->
222 <!-- PLEASE LEAVE "Powered By GForge" on your site -->
225 <a href="http://gforge.org/"><img src="/images/pow-gforge.png" alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
229 global $sys_show_source;
230 if ($sys_show_source) {
232 print '<a class="showsource" href="'.$GLOBALS['sys_urlprefix'].'/source.php?file=' . $SCRIPT_NAME . '"> '._('Show source').' </a>';
243 function headerCSS(){
245 <link rel="stylesheet" type="text/css" href="<?php echo THEME_DIR ?>/css/theme.css" />
247 plugin_hook ('cssfile',$this);
250 function getRootIndex() {
251 return $this->rootindex;
255 * boxTop() - Top HTML box
257 * @param string Box title
258 * @param bool Whether to echo or return the results
259 * @param string The box background color
261 function boxTop($title) {
263 <!-- Box Top Start -->
265 <table cellspacing="0" cellpadding="0" width="100%" border="0" background="'.$this->imgroot.'vert-grad.png">
267 <td valign="top" style="text-align:right" width="10" background="'.$this->imgroot.'box-topleft.png"><img src="'.$this->imgroot.'clear.png" width="10" height="20" /></td>
268 <td width="100%" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
269 <td valign="top" width="10" background="'.$this->imgroot.'box-topright.png"><img src="'.$this->imgroot.'clear.png" width="10" height="20" /></td>
273 <table cellspacing="2" cellpadding="2" width="100%" border="0">
277 <!-- Box Top End -->';
281 * boxMiddle() - Middle HTML box
283 * @param string Box title
284 * @param string The box background color
286 function boxMiddle($title) {
288 <!-- Box Middle Start -->
292 <td colspan="2" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
296 <!-- Box Middle End -->';
300 * boxBottom() - Bottom HTML box
302 * @param bool Whether to echo or return the results
304 function boxBottom() {
306 <!-- Box Bottom Start -->
313 <!-- Box Bottom End -->';
317 * boxGetAltRowStyle() - Get an alternating row style for tables
319 * @param int Row number
321 function boxGetAltRowStyle($i) {
323 return ' bgcolor="#EAEAEA"';
325 return ' bgcolor="#E0E0E0"';
330 * listTableTop() - Takes an array of titles and builds the first row of a new table.
332 * @param array The array of titles
333 * @param array The array of title links
335 function listTableTop ($title_arr,$links_arr=false) {
337 <table cellspacing="0" cellpadding="0" width="100%" border="0">
339 <!-- <td valign="top" style="text-align:right" width="10" background="'.$this->imgroot.'box-grad.png"><img src="'.$this->imgroot.'box-topleft.png" width="10" height="75" /></td> -->
340 <td background="'.$this->imgroot.'box-grad.png">
341 <table width="100%" border="0" cellspacing="1" cellpadding="2">
344 $count=count($title_arr);
346 for ($i=0; $i<$count; $i++) {
348 <td style="text-align:center"><a class="sortbutton" href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'"><span style="color:'.
349 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></a></td>';
352 for ($i=0; $i<$count; $i++) {
354 <td style="text-align:center"><span style="color:'.
355 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></td>';
358 return $return.'</tr>';
361 function listTableBottom() {
362 return '</table></td>
363 <!-- <td valign="top" style="text-align:right" width="10" background="'.$this->imgroot.'box-grad.png"><img src="'.$this->imgroot.'box-topright.png" width="10" height="75" /></td> -->
367 function outerTabs($params) {
368 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
372 if ($sys_use_trove) {
373 $TABS_DIRS[]='/softwaremap/';
375 if ($sys_use_snippet) {
376 $TABS_DIRS[]='/snippet/';
378 if ($sys_use_people) {
379 $TABS_DIRS[]='/people/';
381 $TABS_TITLES[]=_('Home');
382 $TABS_TITLES[]=_('My Page');
383 if ($sys_use_trove) {
384 $TABS_TITLES[]=_('Project Tree');
386 if ($sys_use_snippet) {
387 $TABS_TITLES[]=_('Code Snippets');
389 if ($sys_use_people) {
390 $TABS_TITLES[]=_('Project Openings');
393 $PLUGIN_TABS_DIRS = Array();
394 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
395 $hookParams['TITLES'] = &$TABS_TITLES;
396 plugin_hook ("outermenu", $hookParams) ;
397 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
399 $user_is_super=false;
400 if (session_loggedin()) {
401 $projectmaster =& group_get_object(GROUP_IS_MASTER);
402 $projectstats =& group_get_object(GROUP_IS_STATS);
403 $permmaster =& $projectmaster->getPermission( session_get_user() );
404 $permstats =& $projectstats->getPermission( session_get_user() );
406 if ($permmaster->isAdmin()) {
408 $TABS_DIRS[]='/admin/';
409 $TABS_TITLES[]=_('Admin');
411 if ($permstats->isMember()) {
412 $TABS_DIRS[]='/reporting/';
413 $TABS_TITLES[]=_('Reporting');
416 if(isset($params['group']) && $params['group']) {
417 // get group info using the common result set
418 $project =& group_get_object($params['group']);
419 if ($project && is_object($project)) {
420 if ($project->isError()) {
422 } elseif (!$project->isProject()) {
425 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
426 $TABS_TITLES[]=$project->getPublicName();
427 $selected=count($TABS_DIRS)-1;
430 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ||
431 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
432 $selected=array_search("/my/", $TABS_DIRS);
433 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
434 $selected=array_search("/softwaremap/", $TABS_DIRS);
435 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
436 $selected=array_search("/snippet/", $TABS_DIRS);
437 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
438 $selected=array_search("/people/", $TABS_DIRS);
439 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
440 $selected=array_search('/reporting/',$TABS_DIRS);
441 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
442 $selected=array_search('/admin/',$TABS_DIRS);
446 if (!$this->COLOR_SELECTED_TAB) {
447 $this->COLOR_SELECTED_TAB= '#e0e0e0';
449 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
454 * projectTabs() - Prints out the project tabs, contained here in case
455 * we want to allow it to be overriden
457 * @param string Is the tab currently selected
458 * @param string Is the group we should look up get title info
460 function projectTabs($toptab,$group) {
461 // get group info using the common result set
462 $project =& group_get_object($group);
463 if (!$project || !is_object($project)) {
466 if ($project->isError()) {
467 //wasn't found or some other problem
470 if (!$project->isProject()) {
475 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
476 $TABS_TITLES[]=_('Summary');
477 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
480 $perm =& $project->getPermission( session_get_user() );
481 if ($perm->isAdmin()) {
482 $TABS_DIRS[]='/project/admin/?group_id='. $group;
483 $TABS_TITLES[]=_('Admin');
484 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
487 $TABS_DIRS[]='http://'. $project->getHomePage();
488 $TABS_TITLES[]=_('Home Page');
491 // Project Activity tab
492 $TABS_DIRS[]='/activity/?group_id='. $group;
493 $TABS_TITLES[]=_('Activity');
494 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
497 if ($project->usesForum()) {
498 $TABS_DIRS[]='/forum/?group_id='.$group;
499 $TABS_TITLES[]=_('Forums');
500 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
504 if ($project->usesTracker()) {
505 $TABS_DIRS[]='/tracker/?group_id='.$group;
506 $TABS_TITLES[]=_('Tracker');
507 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
508 ? $selected=(count($TABS_TITLES)-1) : '' );
512 if ($project->usesMail()) {
513 $TABS_DIRS[]='/mail/?group_id='.$group;
514 $TABS_TITLES[]=_('Lists');
515 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
519 if ($project->usesPm()) {
520 $TABS_DIRS[]='/pm/?group_id='.$group;
521 $TABS_TITLES[]=_('Tasks');
522 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
526 if ($project->usesDocman()) {
527 $TABS_DIRS[]='/docman/?group_id='.$group;
528 $TABS_TITLES[]=_('Docs');
529 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
533 if ($project->usesSurvey()) {
534 $TABS_DIRS[]='/survey/?group_id='.$group;
535 $TABS_TITLES[]=_('Surveys');
536 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
540 if ($project->usesNews()) {
541 $TABS_DIRS[]='/news/?group_id='.$group;
542 $TABS_TITLES[]=_('News');
543 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
547 if ($project->usesSCM()) {
548 $TABS_DIRS[]='/scm/?group_id='.$group;
549 $TABS_TITLES[]=_('SCM');
550 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
553 // groupmenu_after_scm hook
554 $hookParams['DIRS'] = &$TABS_DIRS;
555 $hookParams['TITLES'] = &$TABS_TITLES;
556 $hookParams['toptab'] = &$toptab;
557 $hookParams['selected'] = &$selected;
558 $hookParams['group_id'] = $group ;
560 plugin_hook ("groupmenu_scm", $hookParams) ;
563 if ($project->usesFRS()) {
564 $TABS_DIRS[]='/frs/?group_id='.$group;
565 $TABS_TITLES[]=_('Files');
566 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
570 $hookParams['DIRS'] = &$TABS_DIRS;
571 $hookParams['TITLES'] = &$TABS_TITLES;
572 $hookParams['toptab'] = &$toptab;
573 $hookParams['selected'] = &$selected;
574 $hookParams['group'] = $group;
576 plugin_hook ("groupmenu", $hookParams) ;
578 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
582 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
583 $count=count($TABS_DIRS);
584 $width=intval((100/$count));
590 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
593 $folder = $this->imgroot.($nested ? 'bottomtab-new/' : 'toptab-new/');
595 for ($i=0; $i<$count; $i++) {
596 if ($selected == $i) {
597 $left_img = $folder.'selected-left.gif';
598 $middle_img = $folder.'selected-middle.gif';
599 $right_img = $folder.'selected-right.gif';
600 $separ_img = $folder.'selected-separator.gif';
601 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
603 $left_img = $folder.'left.gif';
604 $middle_img = $folder.'middle.gif';
605 $right_img = $folder.'right.gif';
606 $separ_img = $folder.'separator.gif';
607 $css_class = $nested ? 'bottomTab' : 'topTab';
610 $clear_img = $this->imgroot.'clear.png';
613 $tab_height = BOTTOM_TAB_HEIGHT;
615 '<td valign="top" width="5" background="%s">
616 <img src="%s" height="%d" width="5" alt="" />
617 </td>', $middle_img, $clear_img, $tab_height );
619 '<td background="%s" width="'.$width.'%%" style="text-align:center">
620 <a class="%s" href="%s">%s</a>
621 </td>', $middle_img, $css_class, $GLOBALS['sys_urlprefix'].$TABS_DIRS[$i], $TABS_TITLES[$i]);
623 // if the next tab is not last, insert a separator
626 '<td valign="top" width="2" background="%s">
627 <img src="%s" height="%d" width="2" alt="" />
628 </td>', $separ_img, $clear_img, $tab_height );
632 $tab_height = TOP_TAB_HEIGHT;
635 '<td valign="top" width="3" background="%s">
636 <img src="%s" height="%d" width="3" alt="" />
637 </td>', $left_img, $clear_img, $tab_height );
640 '<td background="%s" width="'.$width.'%%" style="text-align:center">
641 <a class="%s" href="%s">%s</a>
642 </td>', $middle_img, $css_class, $GLOBALS['sys_urlprefix'].$TABS_DIRS[$i], $TABS_TITLES[$i]);
644 // if the next tab is not selected, close this tab
645 if ($selected != $i+1) {
647 '<td valign="top" width="9" background="%s">
648 <img src="%s" height="%d" width="9" alt="" />
649 </td>', $right_img, $clear_img, $tab_height );
655 // Building a bottom row in this table, which will be darker
658 if ($selected == 0) {
660 $end_cols=((count($TABS_DIRS)*3)-3);
661 } elseif ($selected == (count($TABS_DIRS)-1)) {
662 $beg_cols=((count($TABS_DIRS)*3)-3);
665 $beg_cols=($selected*3);
666 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
673 '<td colspan="'.$beg_cols.'" height="1" bgcolor="#909090">
674 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
678 '<td colspan="3" height="1" bgcolor="'.$sel_tab_bgcolor.'">
679 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
683 '<td colspan="'.$end_cols.'" height="1" bgcolor="#909090">
684 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
698 function searchBox() {
699 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
701 if(get_magic_quotes_gpc()) {
702 $defaultWords = stripslashes($words);
704 $defaultWords = $words;
707 // if there is no search currently, set the default
708 if ( ! isset($type_of_search) ) {
713 <form action="/search/" method="get">
714 <table border="0" cellpadding="0" cellspacing="0">
716 <div align="center" style="font-size:smaller">';
718 SEARCH__PARAMETER_GROUP_ID => $group_id,
719 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
720 SEARCH__PARAMETER_FORUM_ID => $forum_id,
721 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
724 $searchManager =& getSearchManager();
725 $searchManager->setParametersValues($parameters);
726 $searchEngines =& $searchManager->getAvailableSearchEngines();
728 echo '<select name="type_of_search">';
729 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
730 $searchEngine =& $searchEngines[$i];
731 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
733 echo '</select></div>';
737 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
739 print '</td><td> ';
740 $parameters = $searchManager->getParameters();
741 foreach($parameters AS $name => $value) {
742 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
745 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
747 print '</td><td> </td><td>';
748 print '<input type="submit" name="Search" value="'._('Search').'" />';
751 if (isset($group_id) && $group_id) {
753 <td width="10"> </td>
754 <td><a href="'.$GLOBALS['sys_urlprefix'].'/search/advanced_search.php?group_id='.$group_id.'"> '._('Advanced search').'</a></td>';
756 print '</tr></table>';
761 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
762 // display the searchmask
764 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
765 <input type="hidden" name="search" value="1"/>
766 <input type="hidden" name="group_id" value="'.$group_id.'"/>
767 <div align="center"><br />
771 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
772 <input type="submit" name="submitbutton" value="'._('Search').'" />
777 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
780 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
783 </table><br /></div>'
784 .$this->createUnderSections($sectionsArray).'
788 //create javascript methods for select none/all
790 <script type="text/javascript">
791 <!-- method for disable/enable checkboxes
792 function setCheckBoxes(parent, checked) {
795 for (var i = 0; i < document.advancedsearch.elements.length; i++)
796 if (document.advancedsearch.elements[i].type == "checkbox")
797 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
798 document.advancedsearch.elements[i].checked = checked;
806 function createUnderSections($sectionsArray) {
809 foreach ($sectionsArray as $section) {
810 if(is_array($section)) {
811 $countLines += (3 + count ($section));
813 //2 lines one for section name and one for checkbox
817 $breakLimit = round($countLines/3);
818 $break = $breakLimit;
821 <table width="99%" border="0" cellspacing="0" cellpadding="1" style="background-color:'. $this->COLOR_LTBACK2.'">
824 <table width="100%" cellspacing="0" border="0" style="background-color:'. $this->COLOR_LTBACK1.'">
825 <tr style="font-weight: bold;background-color:'. $this->COLOR_LTBACK2 .'">
826 <td colspan="2">'._('Search in').'</td>
827 <td style="text-align:right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
830 <td colspan="3"> </td>
832 <tr align="center" valign="top">
834 foreach($sectionsArray as $key => $section) {
835 $oldcountlines = $countLines;
836 if (is_array($section)) {
837 $countLines += (3 + count ($section));
842 if ($countLines >= $break) {
843 //if the next block is so large that shifting it to the next column hits the breakpoint better
844 //the second part of statement (behind &&) proofs, that no 4th column is added
845 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
846 $return .= '</td><td>';
847 $break += $breakLimit;
851 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0" style="background-color:'. $this->COLOR_LTBACK2.'">
852 <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
853 <tr style="background-color:'. $this->COLOR_LTBACK2 .'; font-weight: bold">
855 <a href="#'.$key.'">'.$group_subsection_names[$key].'</a>'
857 <td style="text-align:right">'
858 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
861 <tr style="background-color:'. $this->COLOR_LTBACK1.'">
864 if (!is_array($section)) {
865 $return .= ' <input type="checkbox" name="'.urlencode($key).'"';
866 if (isset($GLOBALS[urlencode($key)]))
867 $return .= ' checked="checked" ';
868 $return .= ' /></input>'.$group_subsection_names[$key].'<br />';
871 foreach($section as $underkey => $undersection) {
872 $return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
873 if (isset($GLOBALS[urlencode($key.$underkey)]))
874 $return .= ' checked ';
875 $return .= '></input>'.$undersection.'<br />';
881 </table></td></tr></table><br />';
883 if ($countLines >= $break) {
884 if (($countLines - $break) < ($break - $countLines)) {
885 $return .= '</td><td width="33%">';
886 $break += $breakLimit;
891 return $return.' </td>
893 </table></td></tr></table>';
897 * beginSubMenu() - Opening a submenu.
899 * @return string Html to start a submenu.
901 function beginSubMenu () {
908 * endSubMenu() - Closing a submenu.
910 * @return string Html to end a submenu.
912 function endSubMenu () {
913 $return = '</strong></p>';
918 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
920 * @param array The array of titles.
921 * @param array The array of title links.
922 * @return string Html to build a submenu.
924 function printSubMenu ($title_arr,$links_arr) {
925 $count=count($title_arr);
930 for ($i=0; $i<$count; $i++) {
932 <a href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a> | ';
935 <a href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a>';
940 * subMenu() - Takes two array of titles and links and build a menu.
942 * @param array The array of titles.
943 * @param array The array of title links.
944 * @return string Html to build a submenu.
946 function subMenu ($title_arr,$links_arr) {
947 $return = $this->beginSubMenu () ;
948 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
949 $return .= $this->endSubMenu () ;
954 * multiTableRow() - create a mutlilevel row in a table
956 * @param string the row attributes
957 * @param array the array of cell data, each element is an array,
958 * the first item being the text,
959 * the subsequent items are attributes (dont include
960 * the bgcolor for the title here, that will be
961 * handled by $istitle
962 * @param boolean is this row part of the title ?
965 function multiTableRow($row_attr, $cell_data, $istitle) {
969 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
972 for ( $c = 0; $c < count($cell_data); $c++ ) {
974 for ( $a=1; $a < count($cell_data[$c]); $a++) {
975 $return .= $cell_data[$c][$a].' ';
979 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
981 $return .= $cell_data[$c][0];
983 $return .='</strong></font>';
995 * feedback() - returns the htmlized feedback string when an action is performed.
997 * @param string feedback string
998 * @return string htmlized feedback
1000 function feedback($feedback) {
1005 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
1010 * getThemeIdFromName()
1012 * @param string the dirname of the theme
1013 * @return integer the theme id
1015 function getThemeIdFromName($dirname) {
1016 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
1017 return db_result($res,0,'theme_id');
1020 function quickNav() {
1021 if (!session_loggedin()) {
1024 $res=db_query("SELECT * FROM groups NATURAL JOIN user_group WHERE user_id='".user_getid()."' ORDER BY group_name");
1026 if (!$res || db_numrows($res) < 1) {
1030 <form name="quicknavform">
1031 <select name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">';
1033 <option value="">Quick Jump To...</option>';
1034 for ($i=0; $i<db_numrows($res); $i++) {
1036 <option value="/projects/'.db_result($res,$i,'unix_group_name').'/">'.db_result($res,$i,'group_name').'</option>';
1037 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1039 <option value="/project/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1042 if (db_result($res,$i,'use_tracker')) {
1044 <option value="/tracker/?group_id='.db_result($res,$i,'group_id').'"> Tracker</option>';
1045 if (db_result($res,$i,'admin_flags') || db_result($res,$i,'tracker_flags')) {
1047 <option value="/tracker/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1051 if (db_result($res,$i,'use_pm')) {
1053 <option value="/pm/?group_id='.db_result($res,$i,'group_id').'"> Task Manager</option>';
1054 if (trim(db_result($res,$i,'admin_flags')) =='A' || db_result($res,$i,'project_flags')) {
1056 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1060 if (db_result($res,$i,'use_frs')) {
1062 <option value="/frs/?group_id='.db_result($res,$i,'group_id').'"> Files</option>';
1063 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'release_flags')) {
1065 <option value="/frs/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1069 if (db_result($res,$i,'use_scm')) {
1071 <option value="/scm/?group_id='.db_result($res,$i,'group_id').'"> SCM</option>';
1072 /*if (db_result($res,$i,'admin_flags') || db_result($res,$i,'project_flags')) {
1074 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1078 if (db_result($res,$i,'use_forum')) {
1080 <option value="/forum/?group_id='.db_result($res,$i,'group_id').'"> Forum</option>';
1081 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'forum_flags')) {
1083 <option value="/forum/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1087 if (db_result($res,$i,'use_mail')) {
1089 <option value="/mail/?group_id='.db_result($res,$i,'group_id').'"> Lists</option>';
1090 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1092 <option value="/mail/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1096 if (db_result($res,$i,'use_docman')) {
1098 <option value="/docman/?group_id='.db_result($res,$i,'group_id').'"> Docs</option>';
1099 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'doc_flags')) {
1101 <option value="/docman/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1105 if (db_result($res,$i,'use_news')) {
1107 <option value="/news/?group_id='.db_result($res,$i,'group_id').'"> News</option>';
1108 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1110 <option value="/news/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1114 if (db_result($res,$i,'use_survey')) {
1116 <option value="/survey/?group_id='.db_result($res,$i,'group_id').'"> Surveys</option>';
1117 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1119 <option value="/survey/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1135 // c-file-style: "bsd"