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) {
105 if (!$params['title']) {
106 $params['title'] = $GLOBALS['sys_name'];
108 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
110 print '<?xml version="1.0" encoding="' . $Language->getEncoding(). '"?>';
114 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
115 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
117 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo $Language->getLanguageCode(); ?>">
120 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $Language->getEncoding(); ?>" />
121 <title><?php echo $params['title']; ?></title>
122 <link rel="icon" type="image/png" href="<?php echo $this->imgroot; ?>icon.png"/>
123 <link rel="shortcut icon" href="<?php echo $this->imgroot; ?>icon.png"/>
124 <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"/>
125 <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"/>
126 <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"/>
128 <script language="JavaScript" type="text/javascript">
131 function admin_window(adminurl) {
132 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
135 function help_window(helpurl) {
136 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
139 <?php plugin_hook ("javascript",false) ; ?>
144 WARNING - changing this font call can affect
149 //gets font from Language Object
150 $site_fonts=$GLOBALS['Language']->getFont();
160 $this->bodyHeader($params);
163 function bodyHeader($params){
166 <table border="0" width="100%" cellspacing="0" cellpadding="0">
168 <td class="topLeft"><a href="/"><?php echo html_image('header/top-logo.gif',205,54,array('border'=>'0')); ?></a></td>
169 <td class="middleRight"><?php echo $this->searchBox(); ?></td>
170 <td class="middleRight"><?php
171 if (session_loggedin()) {
173 <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/logout.php"><?php echo _('Log Out'); ?></a>
175 <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/"><?php echo _('My Account'); ?></a>
179 <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/login.php"><?php echo _('Log In'); ?></a>
181 <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/register.php"><?php echo _('New Account'); ?></a>
184 echo $this->quickNav();
186 <td> </td>
193 <table border="0" width="100%" cellspacing="0" cellpadding="0">
195 <td><?php echo $this->outerTabs($params); ?></td>
200 <table border="0" width="100%" cellspacing="0" cellpadding="0">
202 if (isset($params['group']) && $params['group']) {
207 echo $this->projectTabs($params['toptab'],$params['group']);
216 <table border="0" width="100%" cellspacing="0" cellpadding="0">
218 <td class="mainCanvas"> <!-- main body area -->
222 function footer($params) {
224 </td> <!-- end main body area -->
228 <!-- PLEASE LEAVE "Powered By GForge" on your site -->
231 <a href="http://gforge.org/"><img src="/images/pow-gforge.png" alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
235 global $sys_show_source;
236 if ($sys_show_source) {
238 print '<a class="showsource" href="'.$GLOBALS['sys_urlprefix'].'/source.php?file=' . $SCRIPT_NAME . '"> '._('Show source').' </a>';
249 function headerCSS(){
251 <link rel="stylesheet" type="text/css" href="<?php echo THEME_DIR ?>/css/theme.css" />
253 plugin_hook ('cssfile',$this);
256 function getRootIndex() {
257 return $this->rootindex;
261 * boxTop() - Top HTML box
263 * @param string Box title
264 * @param bool Whether to echo or return the results
265 * @param string The box background color
267 function boxTop($title) {
269 <!-- Box Top Start -->
271 <table cellspacing="0" cellpadding="0" width="100%" border="0" background="'.$this->imgroot.'vert-grad.png">
273 <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>
274 <td width="100%" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
275 <td valign="top" width="10" background="'.$this->imgroot.'box-topright.png"><img src="'.$this->imgroot.'clear.png" width="10" height="20" /></td>
279 <table cellspacing="2" cellpadding="2" width="100%" border="0">
283 <!-- Box Top End -->';
287 * boxMiddle() - Middle HTML box
289 * @param string Box title
290 * @param string The box background color
292 function boxMiddle($title) {
294 <!-- Box Middle Start -->
298 <td colspan="2" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
302 <!-- Box Middle End -->';
306 * boxBottom() - Bottom HTML box
308 * @param bool Whether to echo or return the results
310 function boxBottom() {
312 <!-- Box Bottom Start -->
319 <!-- Box Bottom End -->';
323 * boxGetAltRowStyle() - Get an alternating row style for tables
325 * @param int Row number
327 function boxGetAltRowStyle($i) {
329 return ' bgcolor="#EAEAEA"';
331 return ' bgcolor="#E0E0E0"';
336 * listTableTop() - Takes an array of titles and builds the first row of a new table.
338 * @param array The array of titles
339 * @param array The array of title links
341 function listTableTop ($title_arr,$links_arr=false) {
343 <table cellspacing="0" cellpadding="0" width="100%" border="0">
345 <!-- <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> -->
346 <td background="'.$this->imgroot.'box-grad.png">
347 <table width="100%" border="0" cellspacing="1" cellpadding="2">
350 $count=count($title_arr);
352 for ($i=0; $i<$count; $i++) {
354 <td style="text-align:center"><a class="sortbutton" href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'"><span style="color:'.
355 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></a></td>';
358 for ($i=0; $i<$count; $i++) {
360 <td style="text-align:center"><span style="color:'.
361 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></td>';
364 return $return.'</tr>';
367 function listTableBottom() {
368 return '</table></td>
369 <!-- <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> -->
373 function outerTabs($params) {
374 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
378 if ($sys_use_trove) {
379 $TABS_DIRS[]='/softwaremap/';
381 if ($sys_use_snippet) {
382 $TABS_DIRS[]='/snippet/';
384 if ($sys_use_people) {
385 $TABS_DIRS[]='/people/';
387 $TABS_TITLES[]=_('Home');
388 $TABS_TITLES[]=_('My Page');
389 if ($sys_use_trove) {
390 $TABS_TITLES[]=_('Project Tree');
392 if ($sys_use_snippet) {
393 $TABS_TITLES[]=_('Code Snippets');
395 if ($sys_use_people) {
396 $TABS_TITLES[]=_('Project Openings');
399 $PLUGIN_TABS_DIRS = Array();
400 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
401 $hookParams['TITLES'] = &$TABS_TITLES;
402 plugin_hook ("outermenu", $hookParams) ;
403 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
405 $user_is_super=false;
406 if (session_loggedin()) {
407 $projectmaster =& group_get_object(GROUP_IS_MASTER);
408 $projectstats =& group_get_object(GROUP_IS_STATS);
409 $permmaster =& $projectmaster->getPermission( session_get_user() );
410 $permstats =& $projectstats->getPermission( session_get_user() );
412 if ($permmaster->isAdmin()) {
414 $TABS_DIRS[]='/admin/';
415 $TABS_TITLES[]=_('Admin');
417 if ($permstats->isMember()) {
418 $TABS_DIRS[]='/reporting/';
419 $TABS_TITLES[]=_('Reporting');
422 if(isset($params['group']) && $params['group']) {
423 // get group info using the common result set
424 $project =& group_get_object($params['group']);
425 if ($project && is_object($project)) {
426 if ($project->isError()) {
428 } elseif (!$project->isProject()) {
431 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
432 $TABS_TITLES[]=$project->getPublicName();
433 $selected=count($TABS_DIRS)-1;
436 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ||
437 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
438 $selected=array_search("/my/", $TABS_DIRS);
439 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
440 $selected=array_search("/softwaremap/", $TABS_DIRS);
441 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
442 $selected=array_search("/snippet/", $TABS_DIRS);
443 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
444 $selected=array_search("/people/", $TABS_DIRS);
445 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
446 $selected=array_search('/reporting/',$TABS_DIRS);
447 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
448 $selected=array_search('/admin/',$TABS_DIRS);
452 if (!$this->COLOR_SELECTED_TAB) {
453 $this->COLOR_SELECTED_TAB= '#e0e0e0';
455 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
460 * projectTabs() - Prints out the project tabs, contained here in case
461 * we want to allow it to be overriden
463 * @param string Is the tab currently selected
464 * @param string Is the group we should look up get title info
466 function projectTabs($toptab,$group) {
467 // get group info using the common result set
468 $project =& group_get_object($group);
469 if (!$project || !is_object($project)) {
472 if ($project->isError()) {
473 //wasn't found or some other problem
476 if (!$project->isProject()) {
481 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
482 $TABS_TITLES[]=_('Summary');
483 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
486 $perm =& $project->getPermission( session_get_user() );
487 if ($perm->isAdmin()) {
488 $TABS_DIRS[]='/project/admin/?group_id='. $group;
489 $TABS_TITLES[]=_('Admin');
490 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
493 $TABS_DIRS[]='http://'. $project->getHomePage();
494 $TABS_TITLES[]=_('Home Page');
497 // Project Activity tab
498 $TABS_DIRS[]='/activity/?group_id='. $group;
499 $TABS_TITLES[]=_('Activity');
500 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
503 if ($project->usesForum()) {
504 $TABS_DIRS[]='/forum/?group_id='.$group;
505 $TABS_TITLES[]=_('Forums');
506 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
510 if ($project->usesTracker()) {
511 $TABS_DIRS[]='/tracker/?group_id='.$group;
512 $TABS_TITLES[]=_('Tracker');
513 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
514 ? $selected=(count($TABS_TITLES)-1) : '' );
518 if ($project->usesMail()) {
519 $TABS_DIRS[]='/mail/?group_id='.$group;
520 $TABS_TITLES[]=_('Lists');
521 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
525 if ($project->usesPm()) {
526 $TABS_DIRS[]='/pm/?group_id='.$group;
527 $TABS_TITLES[]=_('Tasks');
528 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
532 if ($project->usesDocman()) {
533 $TABS_DIRS[]='/docman/?group_id='.$group;
534 $TABS_TITLES[]=_('Docs');
535 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
539 if ($project->usesSurvey()) {
540 $TABS_DIRS[]='/survey/?group_id='.$group;
541 $TABS_TITLES[]=_('Surveys');
542 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
546 if ($project->usesNews()) {
547 $TABS_DIRS[]='/news/?group_id='.$group;
548 $TABS_TITLES[]=_('News');
549 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
553 if ($project->usesSCM()) {
554 $TABS_DIRS[]='/scm/?group_id='.$group;
555 $TABS_TITLES[]=_('SCM');
556 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
559 // groupmenu_after_scm hook
560 $hookParams['DIRS'] = &$TABS_DIRS;
561 $hookParams['TITLES'] = &$TABS_TITLES;
562 $hookParams['toptab'] = &$toptab;
563 $hookParams['selected'] = &$selected;
564 $hookParams['group_id'] = $group ;
566 plugin_hook ("groupmenu_scm", $hookParams) ;
569 if ($project->usesFRS()) {
570 $TABS_DIRS[]='/frs/?group_id='.$group;
571 $TABS_TITLES[]=_('Files');
572 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
576 $hookParams['DIRS'] = &$TABS_DIRS;
577 $hookParams['TITLES'] = &$TABS_TITLES;
578 $hookParams['toptab'] = &$toptab;
579 $hookParams['selected'] = &$selected;
580 $hookParams['group'] = $group;
582 plugin_hook ("groupmenu", $hookParams) ;
584 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
588 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
589 $count=count($TABS_DIRS);
590 $width=intval((100/$count));
596 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
599 $folder = $this->imgroot.($nested ? 'bottomtab-new/' : 'toptab-new/');
601 for ($i=0; $i<$count; $i++) {
602 if ($selected == $i) {
603 $left_img = $folder.'selected-left.gif';
604 $middle_img = $folder.'selected-middle.gif';
605 $right_img = $folder.'selected-right.gif';
606 $separ_img = $folder.'selected-separator.gif';
607 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
609 $left_img = $folder.'left.gif';
610 $middle_img = $folder.'middle.gif';
611 $right_img = $folder.'right.gif';
612 $separ_img = $folder.'separator.gif';
613 $css_class = $nested ? 'bottomTab' : 'topTab';
616 $clear_img = $this->imgroot.'clear.png';
619 $tab_height = BOTTOM_TAB_HEIGHT;
621 '<td valign="top" width="5" background="%s">
622 <img src="%s" height="%d" width="5" alt="" />
623 </td>', $middle_img, $clear_img, $tab_height );
625 '<td background="%s" width="'.$width.'%%" style="text-align:center">
626 <a class="%s" href="%s">%s</a>
627 </td>', $middle_img, $css_class, $GLOBALS['sys_urlprefix'].$TABS_DIRS[$i], $TABS_TITLES[$i]);
629 // if the next tab is not last, insert a separator
632 '<td valign="top" width="2" background="%s">
633 <img src="%s" height="%d" width="2" alt="" />
634 </td>', $separ_img, $clear_img, $tab_height );
638 $tab_height = TOP_TAB_HEIGHT;
641 '<td valign="top" width="3" background="%s">
642 <img src="%s" height="%d" width="3" alt="" />
643 </td>', $left_img, $clear_img, $tab_height );
646 '<td background="%s" width="'.$width.'%%" style="text-align:center">
647 <a class="%s" href="%s">%s</a>
648 </td>', $middle_img, $css_class, $GLOBALS['sys_urlprefix'].$TABS_DIRS[$i], $TABS_TITLES[$i]);
650 // if the next tab is not selected, close this tab
651 if ($selected != $i+1) {
653 '<td valign="top" width="9" background="%s">
654 <img src="%s" height="%d" width="9" alt="" />
655 </td>', $right_img, $clear_img, $tab_height );
661 // Building a bottom row in this table, which will be darker
664 if ($selected == 0) {
666 $end_cols=((count($TABS_DIRS)*3)-3);
667 } elseif ($selected == (count($TABS_DIRS)-1)) {
668 $beg_cols=((count($TABS_DIRS)*3)-3);
671 $beg_cols=($selected*3);
672 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
679 '<td colspan="'.$beg_cols.'" height="1" bgcolor="#909090">
680 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
684 '<td colspan="3" height="1" bgcolor="'.$sel_tab_bgcolor.'">
685 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
689 '<td colspan="'.$end_cols.'" height="1" bgcolor="#909090">
690 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
704 function searchBox() {
705 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
707 if(get_magic_quotes_gpc()) {
708 $defaultWords = stripslashes($words);
710 $defaultWords = $words;
713 // if there is no search currently, set the default
714 if ( ! isset($type_of_search) ) {
719 <form action="/search/" method="get">
720 <table border="0" cellpadding="0" cellspacing="0">
722 <div align="center" style="font-size:smaller">';
724 SEARCH__PARAMETER_GROUP_ID => $group_id,
725 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
726 SEARCH__PARAMETER_FORUM_ID => $forum_id,
727 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
730 $searchManager =& getSearchManager();
731 $searchManager->setParametersValues($parameters);
732 $searchEngines =& $searchManager->getAvailableSearchEngines();
734 echo '<select name="type_of_search">';
735 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
736 $searchEngine =& $searchEngines[$i];
737 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
739 echo '</select></div>';
743 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
745 print '</td><td> ';
746 $parameters = $searchManager->getParameters();
747 foreach($parameters AS $name => $value) {
748 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
751 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
753 print '</td><td> </td><td>';
754 print '<input type="submit" name="Search" value="'._('Search').'" />';
757 if (isset($group_id) && $group_id) {
759 <td width="10"> </td>
760 <td><a href="'.$GLOBALS['sys_urlprefix'].'/search/advanced_search.php?group_id='.$group_id.'"> '._('Advanced search').'</a></td>';
762 print '</tr></table>';
767 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
768 // display the searchmask
770 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
771 <input type="hidden" name="search" value="1"/>
772 <input type="hidden" name="group_id" value="'.$group_id.'"/>
773 <div align="center"><br />
777 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
778 <input type="submit" name="submitbutton" value="'._('Search').'" />
783 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
786 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
789 </table><br /></div>'
790 .$this->createUnderSections($sectionsArray).'
794 //create javascript methods for select none/all
796 <script type="text/javascript">
797 <!-- method for disable/enable checkboxes
798 function setCheckBoxes(parent, checked) {
801 for (var i = 0; i < document.advancedsearch.elements.length; i++)
802 if (document.advancedsearch.elements[i].type == "checkbox")
803 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
804 document.advancedsearch.elements[i].checked = checked;
812 function createUnderSections($sectionsArray) {
815 foreach ($sectionsArray as $section) {
816 if(is_array($section)) {
817 $countLines += (3 + count ($section));
819 //2 lines one for section name and one for checkbox
823 $breakLimit = round($countLines/3);
824 $break = $breakLimit;
827 <table width="99%" border="0" cellspacing="0" cellpadding="1" style="background-color:'. $this->COLOR_LTBACK2.'">
830 <table width="100%" cellspacing="0" border="0" style="background-color:'. $this->COLOR_LTBACK1.'">
831 <tr style="font-weight: bold;background-color:'. $this->COLOR_LTBACK2 .'">
832 <td colspan="2">'._('Search in').':</td>
833 <td style="text-align:right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
836 <td colspan="3"> </td>
838 <tr align="center" valign="top">
840 foreach($sectionsArray as $key => $section) {
841 $oldcountlines = $countLines;
842 if (is_array($section)) {
843 $countLines += (3 + count ($section));
848 if ($countLines >= $break) {
849 //if the next block is so large that shifting it to the next column hits the breakpoint better
850 //the second part of statement (behind &&) proofs, that no 4th column is added
851 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
852 $return .= '</td><td>';
853 $break += $breakLimit;
857 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0" style="background-color:'. $this->COLOR_LTBACK2.'">
858 <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
859 <tr style="background-color:'. $this->COLOR_LTBACK2 .'; font-weight: bold">
861 <a href="#'.$key.'">'.$Language->getText('group', $key).'</a>'
863 <td style="text-align:right">'
864 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
867 <tr style="background-color:'. $this->COLOR_LTBACK1.'">
870 if (!is_array($section)) {
871 $return .= ' <input type="checkbox" name="'.urlencode($key).'"';
872 if (isset($GLOBALS[urlencode($key)]))
873 $return .= ' checked="checked" ';
874 $return .= ' /></input>'.$Language->getText('group', $key).'<br />';
877 foreach($section as $underkey => $undersection) {
878 $return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
879 if (isset($GLOBALS[urlencode($key.$underkey)]))
880 $return .= ' checked ';
881 $return .= '></input>'.$undersection.'<br />';
887 </table></td></tr></table><br />';
889 if ($countLines >= $break) {
890 if (($countLines - $break) < ($break - $countLines)) {
891 $return .= '</td><td width="33%">';
892 $break += $breakLimit;
897 return $return.' </td>
899 </table></td></tr></table>';
903 * beginSubMenu() - Opening a submenu.
905 * @return string Html to start a submenu.
907 function beginSubMenu () {
914 * endSubMenu() - Closing a submenu.
916 * @return string Html to end a submenu.
918 function endSubMenu () {
919 $return = '</strong></p>';
924 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
926 * @param array The array of titles.
927 * @param array The array of title links.
928 * @return string Html to build a submenu.
930 function printSubMenu ($title_arr,$links_arr) {
931 $count=count($title_arr);
936 for ($i=0; $i<$count; $i++) {
938 <a href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a> | ';
941 <a href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a>';
946 * subMenu() - Takes two array of titles and links and build a menu.
948 * @param array The array of titles.
949 * @param array The array of title links.
950 * @return string Html to build a submenu.
952 function subMenu ($title_arr,$links_arr) {
953 $return = $this->beginSubMenu () ;
954 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
955 $return .= $this->endSubMenu () ;
960 * multiTableRow() - create a mutlilevel row in a table
962 * @param string the row attributes
963 * @param array the array of cell data, each element is an array,
964 * the first item being the text,
965 * the subsequent items are attributes (dont include
966 * the bgcolor for the title here, that will be
967 * handled by $istitle
968 * @param boolean is this row part of the title ?
971 function multiTableRow($row_attr, $cell_data, $istitle) {
975 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
978 for ( $c = 0; $c < count($cell_data); $c++ ) {
980 for ( $a=1; $a < count($cell_data[$c]); $a++) {
981 $return .= $cell_data[$c][$a].' ';
985 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
987 $return .= $cell_data[$c][0];
989 $return .='</strong></font>';
1001 * feedback() - returns the htmlized feedback string when an action is performed.
1003 * @param string feedback string
1004 * @return string htmlized feedback
1006 function feedback($feedback) {
1011 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
1016 * getThemeIdFromName()
1018 * @param string the dirname of the theme
1019 * @return integer the theme id
1021 function getThemeIdFromName($dirname) {
1022 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
1023 return db_result($res,0,'theme_id');
1026 function quickNav() {
1027 if (!session_loggedin()) {
1030 $res=db_query("SELECT * FROM groups NATURAL JOIN user_group WHERE user_id='".user_getid()."' ORDER BY group_name");
1032 if (!$res || db_numrows($res) < 1) {
1036 <form name="quicknavform">
1037 <select name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">';
1039 <option value="">Quick Jump To...</option>';
1040 for ($i=0; $i<db_numrows($res); $i++) {
1042 <option value="/projects/'.db_result($res,$i,'unix_group_name').'/">'.db_result($res,$i,'group_name').'</option>';
1043 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1045 <option value="/project/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1048 if (db_result($res,$i,'use_tracker')) {
1050 <option value="/tracker/?group_id='.db_result($res,$i,'group_id').'"> Tracker</option>';
1051 if (db_result($res,$i,'admin_flags') || db_result($res,$i,'tracker_flags')) {
1053 <option value="/tracker/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1057 if (db_result($res,$i,'use_pm')) {
1059 <option value="/pm/?group_id='.db_result($res,$i,'group_id').'"> Task Manager</option>';
1060 if (trim(db_result($res,$i,'admin_flags')) =='A' || db_result($res,$i,'project_flags')) {
1062 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1066 if (db_result($res,$i,'use_frs')) {
1068 <option value="/frs/?group_id='.db_result($res,$i,'group_id').'"> Files</option>';
1069 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'release_flags')) {
1071 <option value="/frs/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1075 if (db_result($res,$i,'use_scm')) {
1077 <option value="/scm/?group_id='.db_result($res,$i,'group_id').'"> SCM</option>';
1078 /*if (db_result($res,$i,'admin_flags') || db_result($res,$i,'project_flags')) {
1080 <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1084 if (db_result($res,$i,'use_forum')) {
1086 <option value="/forum/?group_id='.db_result($res,$i,'group_id').'"> Forum</option>';
1087 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'forum_flags')) {
1089 <option value="/forum/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1093 if (db_result($res,$i,'use_mail')) {
1095 <option value="/mail/?group_id='.db_result($res,$i,'group_id').'"> Lists</option>';
1096 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1098 <option value="/mail/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1102 if (db_result($res,$i,'use_docman')) {
1104 <option value="/docman/?group_id='.db_result($res,$i,'group_id').'"> Docs</option>';
1105 if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'doc_flags')) {
1107 <option value="/docman/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1111 if (db_result($res,$i,'use_news')) {
1113 <option value="/news/?group_id='.db_result($res,$i,'group_id').'"> News</option>';
1114 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1116 <option value="/news/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1120 if (db_result($res,$i,'use_survey')) {
1122 <option value="/survey/?group_id='.db_result($res,$i,'group_id').'"> Surveys</option>';
1123 if (trim(db_result($res,$i,'admin_flags'))=='A') {
1125 <option value="/survey/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
1141 // c-file-style: "bsd"