3 require_once $gfwww.'include/Layout.class.php';
5 define('THEME_DIR', util_make_url ('/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';
43 $this->rootindex = $GLOBALS['gfwww'].'index_std.php';
48 Set up the priority color array one time only
50 $bgpri[1] = '#dadada';
51 $bgpri[2] = '#dacaca';
52 $bgpri[3] = '#dababa';
53 $bgpri[4] = '#daaaaa';
54 $bgpri[5] = '#da8a8a';
56 //determine font for this platform
57 if (browser_is_windows() && browser_is_ie()) {
59 //ie needs smaller fonts
60 $this->FONTSIZE='x-small';
61 $this->FONTSIZE_SMALLER='xx-small';
62 $this->FONTSIZE_SMALLEST='7pt';
64 } else if (browser_is_windows()) {
67 $this->FONTSIZE='small';
68 $this->FONTSIZE_SMALLER='x-small';
69 $this->FONTSIZE_SMALLEST='x-small';
71 } else if (browser_is_mac()){
73 //mac users need bigger fonts
74 $this->FONTSIZE='medium';
75 $this->FONTSIZE_SMALLER='small';
76 $this->FONTSIZE_SMALLEST='x-small';
80 //linux and other users
81 $this->FONTSIZE='small';
82 $this->FONTSIZE_SMALLER='x-small';
83 $this->FONTSIZE_SMALLEST='xx-small';
87 $this->FONTSIZE_HTMLBOX_TITLE = $this->FONTSIZE;
91 * header() - "steel theme" top of page
93 * @param array Header parameters array
95 function header($params) {
96 if (!isset($params['title'])) {
97 $params['title'] = $GLOBALS['sys_name'];
99 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
102 print '<?xml version="1.0" encoding="utf-8"?>';
106 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
107 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
109 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo _('en') ?>" lang="<?php echo _('en'); ?>">
112 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
113 <title><?php echo $params['title']; ?></title>
114 <link rel="icon" type="image/png" href="<?php echo util_make_url('/images/icon.png'); ?>"/>
115 <link rel="shortcut icon" type="image/png" href="<?php echo util_make_url('/images/icon.png'); ?>"/>
116 <?php $this->headerLink(); ?>
117 <script type="text/javascript" src="<?php echo util_make_url('/js/common.js'); ?>"></script>
118 <script type="text/javascript" src="<?php echo util_make_url('/js/sortable.js'); ?>"></script>
119 <script type="text/javascript">
120 <?php plugin_hook ("javascript",false) ; ?>
123 if (_('default_font') != 'default_font') {
124 $site_fonts = _('default_font');
126 $site_fonts = 'helvetica' ;
136 $this->bodyHeader($params);
139 function bodyHeader($params){
144 <table class="header" border="0" width="100%" cellspacing="0" cellpadding="0">
146 <td class="topLeft"><?php echo util_make_link ('/', html_image('header/top-logo.png',192,54,array('border'=>'0'))); ?></td>
147 <td class="middleRight"><?php echo $this->searchBox(); ?></td>
148 <td class="middleRight"><?php
149 if (session_loggedin()) {
150 $u =& user_get_object(user_getid());
151 echo util_make_link ('/account/logout.php', sprintf("%s (%s)", _('Log Out'), $u->getRealName()),array('class'=>'userlink'));
153 echo util_make_link ('/account/', _('My Account'),array('class'=>'userlink'));
155 $url = '/account/login.php';
156 if(getStringFromServer('REQUEST_METHOD') != 'POST') {
157 $url .= '?return_to=';
158 $url .= urlencode(getStringFromServer('REQUEST_URI'));
161 echo util_make_link ($url, _('Log In'),array('class'=>'userlink'));
163 if (!$GLOBALS['sys_user_reg_restricted']) {
164 echo util_make_link ('/account/register.php', _('New Account'),array('class'=>'userlink'));
168 plugin_hook ('headermenu', $params);
170 echo $this->quickNav();
172 <td class="ff"> </td>
179 <table border="0" width="100%" cellspacing="0" cellpadding="0">
181 <td class="ff"><?php echo $this->outerTabs($params); ?></td>
186 <table border="0" width="100%" cellspacing="0" cellpadding="0">
188 if (isset($params['group']) && $params['group']) {
193 echo $this->projectTabs($params['toptab'],$params['group']);
202 <table border="0" width="100%" cellspacing="0" cellpadding="0">
204 <td class="mainCanvas"> <!-- main body area -->
208 function footer($params) {
210 </td> <!-- end main body area -->
214 <!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
217 <a href="http://fusionforge.org/"><img src="<?php echo util_make_url ('/images/pow-fusionforge.png'); ?>" alt="Powered By FusionForge" border="0" /></a>
221 global $sys_show_source;
222 if ($sys_show_source) {
224 print util_make_link ('/source.php?file=' . $SCRIPT_NAME, _('Show source'), array ("class" => "showsource"));
235 function headerCSS(){
237 <link rel="stylesheet" type="text/css" href="<?php echo util_make_url ('/themes/css/gforge.css') ?>" />
238 <link rel="stylesheet" type="text/css" href="<?php echo THEME_DIR ?>/css/theme.css" />
240 plugin_hook ('cssfile',$this);
243 function getRootIndex() {
244 return $this->rootindex;
248 * boxTop() - Top HTML box
250 * @param string Box title
251 * @param bool Whether to echo or return the results
252 * @param string The box background color
254 function boxTop($title) {
256 <!-- Box Top Start -->
258 <table cellspacing="0" cellpadding="0" style="table-layout:fixed" width="100%" border="0" background="'.$this->imgroot.'vert-grad.png">
259 <tr class="ff" align="center">
260 <td class="ff" 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>
261 <td class="ff" width="100%" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
262 <td class="ff" valign="top" width="10" background="'.$this->imgroot.'box-topright.png"><img src="'.$this->imgroot.'clear.png" width="10" height="20" /></td>
265 <td class="ff" colspan="3">
266 <table cellspacing="2" cellpadding="2" width="100%" border="0">
267 <tr class="ff" align="left">
268 <td class="ff" colspan="2">
270 <!-- Box Top End -->';
274 * boxMiddle() - Middle HTML box
276 * @param string Box title
277 * @param string The box background color
279 function boxMiddle($title) {
281 <!-- Box Middle Start -->
284 <tr class="ff" align="center">
285 <td class="ff" colspan="2" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
287 <tr class="ff" align="left">
288 <td class="ff" colspan="2">
289 <!-- Box Middle End -->';
293 * boxBottom() - Bottom HTML box
295 * @param bool Whether to echo or return the results
297 function boxBottom() {
299 <!-- Box Bottom Start -->
306 <!-- Box Bottom End -->';
310 * boxGetAltRowStyle() - Get an alternating row style for tables
312 * @param int Row number
314 function boxGetAltRowStyle($i) {
316 return ' bgcolor="#EAEAEA"';
318 return ' bgcolor="#E0E0E0"';
323 * listTableTop() - Takes an array of titles and builds the first row of a new table.
325 * @param array The array of titles
326 * @param array The array of title links
328 function listTableTop ($title_arr,$links_arr=false) {
330 <table cellspacing="0" cellpadding="0" width="100%" border="0">
331 <tr class="ff" align="center">
332 <!-- <td class="ff" 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> -->
333 <td class="ff" background="'.$this->imgroot.'box-grad.png">
334 <table width="100%" border="0" cellspacing="1" cellpadding="2">
337 $count=count($title_arr);
339 for ($i=0; $i<$count; $i++) {
341 <td class="ff" style="text-align:center"><a class="sortbutton" href="'.util_make_url ($links_arr[$i]).'"><span style="color:'.
342 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></a></td>';
345 for ($i=0; $i<$count; $i++) {
347 <td class="ff" style="text-align:center"><span style="color:'.
348 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></td>';
351 return $return.'</tr>';
354 function listTableBottom() {
355 return '</table></td>
356 <!-- <td class="ff" 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> -->
360 function outerTabs($params) {
361 global $sys_use_trove,$sys_use_snippet,$sys_use_people,$sys_use_project_tags,$sys_use_project_full_list;
363 $TABS_DIRS[]=util_make_url ('/') ;
364 $TABS_DIRS[]=util_make_url ('/my/') ;
365 if ($sys_use_trove || $sys_use_project_tags || $sys_use_project_full_list) {
366 $TABS_DIRS[]=util_make_url ('/softwaremap/') ;
368 if ($sys_use_snippet) {
369 $TABS_DIRS[]=util_make_url ('/snippet/') ;
371 if ($sys_use_people) {
372 $TABS_DIRS[]=util_make_url ('/people/') ;
374 $TABS_TITLES[]=_('Home');
375 $TABS_TITLES[]=_('My Page');
376 if ($sys_use_trove || $sys_use_project_tags || $sys_use_project_full_list) {
377 $TABS_TITLES[]=_('Projects');
379 if ($sys_use_snippet) {
380 $TABS_TITLES[]=_('Code Snippets');
382 if ($sys_use_people) {
383 $TABS_TITLES[]=_('Project Openings');
386 $PLUGIN_TABS_DIRS = Array();
387 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
388 $hookParams['TITLES'] = &$TABS_TITLES;
389 plugin_hook ("outermenu", $hookParams) ;
390 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
392 $user_is_super=false;
394 if (session_loggedin()) {
395 $projectmaster =& group_get_object(GROUP_IS_MASTER);
396 $projectstats =& group_get_object(GROUP_IS_STATS);
397 $permmaster =& $projectmaster->getPermission( session_get_user() );
398 $permstats =& $projectstats->getPermission( session_get_user() );
400 if ($permmaster->isAdmin()) {
402 $TABS_DIRS[]=util_make_url ('/admin/') ;
403 $TABS_TITLES[]=_('Admin');
405 if ($permstats->isMember()) {
406 $TABS_DIRS[]=util_make_url ('/reporting/') ;
407 $TABS_TITLES[]=_('Reporting');
410 if(isset($params['group']) && $params['group']) {
411 // get group info using the common result set
412 $project =& group_get_object($params['group']);
413 if ($project && is_object($project)) {
414 if ($project->isError()) {
416 } elseif (!$project->isProject()) {
419 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
420 $TABS_DIRS[]=util_make_url ('/project/?group_id='. $params['group']) ;
422 $TABS_DIRS[]=util_make_url ('/projects/'.$project->getUnixName().'/') ;
424 $TABS_TITLES[]=$project->getPublicName();
425 $selected=count($TABS_DIRS)-1;
428 } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/my/')) || strstr(getStringFromServer('REQUEST_URI'),'/account/') ||
429 strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/themes/')) ) {
430 $selected=array_search(util_make_url ('/my/'), $TABS_DIRS);
431 } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('softwaremap'))) {
432 $selected=array_search(util_make_url ('/softwaremap/'), $TABS_DIRS);
433 } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/snippet/'))) {
434 $selected=array_search(util_make_url ('/snippet/'), $TABS_DIRS);
435 } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/people/'))) {
436 $selected=array_search(util_make_url ('/people/'), $TABS_DIRS);
437 } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/reporting/'))) {
438 $selected=array_search(util_make_url ('/reporting/'),$TABS_DIRS);
439 } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/admin/')) && $user_is_super) {
440 $selected=array_search(util_make_url ('/admin/'),$TABS_DIRS);
441 } elseif (count($PLUGIN_TABS_DIRS)>0) {
442 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
443 if (strstr(getStringFromServer('REQUEST_URI'),$PLUGIN_TABS_DIRS_VALUE)) {
444 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
451 if (!$this->COLOR_SELECTED_TAB) {
452 $this->COLOR_SELECTED_TAB= '#e0e0e0';
454 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
459 * projectTabs() - Prints out the project tabs, contained here in case
460 * we want to allow it to be overriden
462 * @param string Is the tab currently selected
463 * @param string Is the group we should look up get title info
465 function projectTabs($toptab,$group) {
466 // get group info using the common result set
467 $project =& group_get_object($group);
468 if (!$project || !is_object($project)) {
471 if ($project->isError()) {
472 //wasn't found or some other problem
475 if (!$project->isProject()) {
480 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
481 $TABS_DIRS[]=util_make_url ('/project/?group_id='. $group);
483 $TABS_DIRS[]=util_make_url ('/projects/'. $project->getUnixName() .'/');
485 $TABS_TITLES[]=_('Summary');
486 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
489 $perm =& $project->getPermission( session_get_user() );
490 if ($perm->isAdmin()) {
491 $TABS_DIRS[]=util_make_url ('/project/admin/?group_id='. $group);
492 $TABS_TITLES[]=_('Admin');
493 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
496 $TABS_DIRS[]=util_make_url ('http://'. $project->getHomePage());
497 $TABS_TITLES[]=_('Home Page');
500 // Project Activity tab
501 $TABS_DIRS[]=util_make_url ('/activity/?group_id='. $group);
502 $TABS_TITLES[]=_('Activity');
503 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
506 if ($project->usesForum()) {
507 $TABS_DIRS[]=util_make_url ('/forum/?group_id='.$group);
508 $TABS_TITLES[]=_('Forums');
509 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
513 if ($project->usesTracker()) {
514 $TABS_DIRS[]=util_make_url ('/tracker/?group_id='.$group);
515 $TABS_TITLES[]=_('Tracker');
516 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
517 ? $selected=(count($TABS_TITLES)-1) : '' );
521 if ($project->usesMail()) {
522 $TABS_DIRS[]=util_make_url ('/mail/?group_id='.$group);
523 $TABS_TITLES[]=_('Lists');
524 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
528 if ($project->usesPm()) {
529 $TABS_DIRS[]=util_make_url ('/pm/?group_id='.$group);
530 $TABS_TITLES[]=_('Tasks');
531 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
535 if ($project->usesDocman()) {
536 $TABS_DIRS[]=util_make_url ('/docman/?group_id='.$group);
537 $TABS_TITLES[]=_('Docs');
538 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
542 if ($project->usesSurvey()) {
543 $TABS_DIRS[]=util_make_url ('/survey/?group_id='.$group);
544 $TABS_TITLES[]=_('Surveys');
545 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
549 if ($project->usesNews()) {
550 $TABS_DIRS[]=util_make_url ('/news/?group_id='.$group);
551 $TABS_TITLES[]=_('News');
552 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
556 if ($project->usesSCM()) {
557 $TABS_DIRS[]=util_make_url ('/scm/?group_id='.$group);
558 $TABS_TITLES[]=_('SCM');
559 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
562 // groupmenu_after_scm hook
563 $hookParams['DIRS'] = &$TABS_DIRS;
564 $hookParams['TITLES'] = &$TABS_TITLES;
565 $hookParams['toptab'] = &$toptab;
566 $hookParams['selected'] = &$selected;
567 $hookParams['group_id'] = $group ;
569 plugin_hook ("groupmenu_scm", $hookParams) ;
572 if ($project->usesFRS()) {
573 $TABS_DIRS[]=util_make_url ('/frs/?group_id='.$group);
574 $TABS_TITLES[]=_('Files');
575 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
579 $hookParams['DIRS'] = &$TABS_DIRS;
580 $hookParams['TITLES'] = &$TABS_TITLES;
581 $hookParams['toptab'] = &$toptab;
582 $hookParams['selected'] = &$selected;
583 $hookParams['group'] = $group;
585 plugin_hook ("groupmenu", $hookParams) ;
587 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
591 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
592 $count=count($TABS_DIRS);
593 $width=intval((100/$count));
599 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
602 $folder = $this->imgroot.($nested ? 'bottomtab-new/' : 'toptab-new/');
604 for ($i=0; $i<$count; $i++) {
605 if ($selected == $i) {
606 $left_img = $folder.'selected-left.gif';
607 $middle_img = $folder.'selected-middle.gif';
608 $right_img = $folder.'selected-right.gif';
609 $separ_img = $folder.'selected-separator.gif';
610 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
612 $left_img = $folder.'left.gif';
613 $middle_img = $folder.'middle.gif';
614 $right_img = $folder.'right.gif';
615 $separ_img = $folder.'separator.gif';
616 $css_class = $nested ? 'bottomTab' : 'topTab';
619 $clear_img = $this->imgroot.'clear.png';
622 $tab_height = BOTTOM_TAB_HEIGHT;
624 '<td class="ff" valign="top" width="5" background="%s">
625 <img src="%s" height="%d" width="5" alt="" />
626 </td>', $middle_img, $clear_img, $tab_height );
628 '<td class="ff" background="%s" width="'.$width.'%%" style="text-align:center">
629 <a class="%s" href="%s">%s</a>
630 </td>', $middle_img, $css_class, $TABS_DIRS[$i], $TABS_TITLES[$i]);
632 // if the next tab is not last, insert a separator
635 '<td class="ff" valign="top" width="2" background="%s">
636 <img src="%s" height="%d" width="2" alt="" />
637 </td>', $separ_img, $clear_img, $tab_height );
641 $tab_height = TOP_TAB_HEIGHT;
644 '<td class="ff" valign="top" width="3" background="%s">
645 <img src="%s" height="%d" width="3" alt="" />
646 </td>', $left_img, $clear_img, $tab_height );
649 '<td class="ff" background="%s" width="'.$width.'%%" style="text-align:center">
650 <a class="%s" href="%s">%s</a>
651 </td>', $middle_img, $css_class, $TABS_DIRS[$i], $TABS_TITLES[$i]);
653 // if the next tab is not selected, close this tab
654 if ($selected != $i+1) {
656 '<td class="ff" valign="top" width="9" background="%s">
657 <img src="%s" height="%d" width="9" alt="" />
658 </td>', $right_img, $clear_img, $tab_height );
664 // Building a bottom row in this table, which will be darker
667 if ($selected == 0) {
669 $end_cols=((count($TABS_DIRS)*3)-3);
670 } elseif ($selected == (count($TABS_DIRS)-1)) {
671 $beg_cols=((count($TABS_DIRS)*3)-3);
674 $beg_cols=($selected*3);
675 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
678 $return .= '<tr class="ff">';
682 '<td class="ff" colspan="'.$beg_cols.'" height="1" bgcolor="#909090">
683 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
687 '<td class="ff" colspan="3" height="1" bgcolor="'.$sel_tab_bgcolor.'">
688 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
692 '<td class="ff" colspan="'.$end_cols.'" height="1" bgcolor="#909090">
693 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
707 function searchBox() {
708 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
710 if(get_magic_quotes_gpc()) {
711 $defaultWords = stripslashes($words);
713 $defaultWords = $words;
716 // if there is no search currently, set the default
717 if ( ! isset($type_of_search) ) {
722 <form class="search" action="'.util_make_url ('/search/').'" method="get">
723 <table border="0" cellpadding="0" cellspacing="0">
724 <tr class="ff"><td class="ff">
725 <div align="center" style="font-size:smaller">';
727 SEARCH__PARAMETER_GROUP_ID => $group_id,
728 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
729 SEARCH__PARAMETER_FORUM_ID => $forum_id,
730 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
733 $searchManager =& getSearchManager();
734 $searchManager->setParametersValues($parameters);
735 $searchEngines =& $searchManager->getAvailableSearchEngines();
737 echo '<select class="ff" name="type_of_search">';
738 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
739 $searchEngine =& $searchEngines[$i];
740 echo '<option class="ff" value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
742 echo '</select></div>';
746 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
748 print '</td><td class="ff"> ';
749 $parameters = $searchManager->getParameters();
750 foreach($parameters AS $name => $value) {
751 print '<input class="ff" type="hidden" value="'.$value.'" name="'.$name.'" />';
753 print '</td><td class="ff">';
754 print '<input class="ff" type="text" size="12" name="words" value="'.$defaultWords.'" />';
756 print '</td><td class="ff"> </td><td class="ff">';
757 print '<input class="ff" type="submit" name="Search" value="'._('Search').'" />';
760 if (isset($group_id) && $group_id) {
762 <td class="ff" width="10"> </td>
763 <td class="ff">'.util_make_link ('/search/advanced_search.php?group_id='.$group_id, _('Advanced search'),array('class'=>'userlink')).'</td>';
765 print '</tr></table>';
770 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
771 // display the searchmask
773 <form class="ff" name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
774 <input class="ff" type="hidden" name="search" value="1"/>
775 <input class="ff" type="hidden" name="group_id" value="'.$group_id.'"/>
776 <div align="center"><br />
779 <td class="ff" colspan ="2">
780 <input class="ff" type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
781 <input class="ff" type="submit" name="submitbutton" value="'._('Search').'" />
785 <td class="ff" valign="top">
786 <input class="ff" type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
789 <input class="ff" type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
792 </table><br /></div>'
793 .$this->createUnderSections($sectionsArray).'
797 //create javascript methods for select none/all
799 <script type="text/javascript">
800 <!-- method for disable/enable checkboxes
801 function setCheckBoxes(parent, checked) {
804 for (var i = 0; i < document.advancedsearch.elements.length; i++)
805 if (document.advancedsearch.elements[i].type == "checkbox")
806 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
807 document.advancedsearch.elements[i].checked = checked;
815 function createUnderSections($sectionsArray) {
816 global $group_subsection_names;
818 foreach ($sectionsArray as $section) {
819 if(is_array($section)) {
820 $countLines += (3 + count ($section));
822 //2 lines one for section name and one for checkbox
826 $breakLimit = round($countLines/3);
827 $break = $breakLimit;
830 <table width="99%" border="0" cellspacing="0" cellpadding="1" style="background-color:'. $this->COLOR_LTBACK2.'">
833 <table width="100%" cellspacing="0" border="0" style="background-color:'. $this->COLOR_LTBACK1.'">
834 <tr class="ff" style="font-weight: bold;background-color:'. $this->COLOR_LTBACK2 .'">
835 <td class="ff" colspan="2">'._('Search in').'</td>
836 <td class="ff" style="text-align:right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
838 <tr class="ff" height="20">
839 <td class="ff" colspan="3"> </td>
841 <tr class="ff" align="center" valign="top">
843 foreach($sectionsArray as $key => $section) {
844 $oldcountlines = $countLines;
845 if (is_array($section)) {
846 $countLines += (3 + count ($section));
851 if ($countLines >= $break) {
852 //if the next block is so large that shifting it to the next column hits the breakpoint better
853 //the second part of statement (behind &&) proofs, that no 4th column is added
854 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
855 $return .= '</td><td class="ff">';
856 $break += $breakLimit;
860 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0" style="background-color:'. $this->COLOR_LTBACK2.'">
861 <tr class="ff"><td class="ff"><table width="100%" border="0" cellspacing="0" cellpadding="3">
862 <tr class="ff" style="background-color:'. $this->COLOR_LTBACK2 .'; font-weight: bold">
863 <td class="ff" cellspacing="0">
864 <a href="#'.$key.'">'.$group_subsection_names[$key].'</a>'
866 <td class="ff" style="text-align:right">'
867 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
870 <tr class="ff" style="background-color:'. $this->COLOR_LTBACK1.'">
871 <td class="ff" colspan="2">';
873 if (!is_array($section)) {
874 $return .= ' <input class="ff" type="checkbox" name="'.urlencode($key).'"';
875 if (isset($GLOBALS[urlencode($key)]))
876 $return .= ' checked="checked" ';
877 $return .= ' /></input>'.$group_subsection_names[$key].'<br />';
880 foreach($section as $underkey => $undersection) {
881 $return .= ' <input class="ff" type="checkbox" name="'.urlencode($key.$underkey).'"';
882 if (isset($GLOBALS[urlencode($key.$underkey)]))
883 $return .= ' checked ';
884 $return .= '></input>'.$undersection.'<br />';
890 </table></td></tr></table><br />';
892 if ($countLines >= $break) {
893 if (($countLines - $break) < ($break - $countLines)) {
894 $return .= '</td><td class="ff" width="33%">';
895 $break += $breakLimit;
900 return $return.' </td>
902 </table></td></tr></table>';
906 * beginSubMenu() - Opening a submenu.
908 * @return string Html to start a submenu.
910 function beginSubMenu () {
917 * endSubMenu() - Closing a submenu.
919 * @return string Html to end a submenu.
921 function endSubMenu () {
922 $return = '</strong></p>';
927 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
929 * @param array The array of titles.
930 * @param array The array of title links.
931 * @return string Html to build a submenu.
933 function printSubMenu ($title_arr,$links_arr) {
934 $count=count($title_arr);
939 for ($i=0; $i<$count; $i++) {
940 $return .= util_make_link ($links_arr[$i], $title_arr[$i]) . ' | ';
942 $return .= util_make_link ($links_arr[$i], $title_arr[$i]);
947 * subMenu() - Takes two array of titles and links and build a menu.
949 * @param array The array of titles.
950 * @param array The array of title links.
951 * @return string Html to build a submenu.
953 function subMenu ($title_arr,$links_arr) {
954 $return = $this->beginSubMenu () ;
955 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
956 $return .= $this->endSubMenu () ;
961 * multiTableRow() - create a mutlilevel row in a table
963 * @param string the row attributes
964 * @param array the array of cell data, each element is an array,
965 * the first item being the text,
966 * the subsequent items are attributes (dont include
967 * the bgcolor for the title here, that will be
968 * handled by $istitle
969 * @param boolean is this row part of the title ?
972 function multiTableRow($row_attr, $cell_data, $istitle) {
974 <tr class="ff" '.$row_attr;
976 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
979 for ( $c = 0; $c < count($cell_data); $c++ ) {
980 $return .='<td class="ff" ';
981 for ( $a=1; $a < count($cell_data[$c]); $a++) {
982 $return .= $cell_data[$c][$a].' ';
986 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
988 $return .= $cell_data[$c][0];
990 $return .='</strong></font>';
1002 * feedback() - returns the htmlized feedback string when an action is performed.
1004 * @param string feedback string
1005 * @return string htmlized feedback
1007 function feedback($feedback) {
1012 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
1017 * getThemeIdFromName()
1019 * @param string the dirname of the theme
1020 * @return integer the theme id
1022 function getThemeIdFromName($dirname) {
1023 $res=db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1',
1025 return db_result($res,0,'theme_id');
1032 // c-file-style: "bsd"