3 require_once $gfwww.'include/Layout.class.php';
4 require_once $gfcommon.'include/FusionForge.class.php';
6 define('THEME_DIR', util_make_url ('/themes/gforge'));
8 define('TOP_TAB_HEIGHT', 30);
9 define('BOTTOM_TAB_HEIGHT', 22);
11 class Theme extends Layout {
17 $this->imgroot = THEME_DIR.'/images/';
18 $this->COLOR_CONTENT_BACK= '#ffffff';
19 $this->COLOR_LTBACK1= '#eeeeef';
20 $this->COLOR_LTBACK2= '#fafafa';
21 $this->COLOR_SELECTED_TAB= '#e0e0e0';
22 $this->COLOR_HTMLBOX_TITLE = '#bbbbbb';
23 $this->COLOR_HTMLBOX_BACK = '#eaecef';
24 $this->FONT_CONTENT = 'helvetica';
25 $this->FONT_HTMLBOX_TITLE = 'helvetica';
26 $this->FONTCOLOR_HTMLBOX_TITLE = '#333333';
27 $this->FONTCOLOR_CONTENT = '#333333';
28 $this->FONTSIZE = 'small';
29 $this->FONTSIZE_SMALLER='x-small';
30 $this->FONTSIZE_SMALLEST='xx-small';
31 $this->FONTSIZE_HTMLBOX_TITLE = 'small';
32 $this->bgpri = array();
36 * Layout() - Constructor
40 // Constructor for parent class...
41 if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
42 $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
44 $this->rootindex = $GLOBALS['gfwww'].'index_std.php';
49 Set up the priority color array one time only
51 $bgpri[1] = '#dadada';
52 $bgpri[2] = '#dacaca';
53 $bgpri[3] = '#dababa';
54 $bgpri[4] = '#daaaaa';
55 $bgpri[5] = '#da8a8a';
57 //determine font for this platform
58 if (browser_is_windows() && browser_is_ie()) {
60 //ie needs smaller fonts
61 $this->FONTSIZE='x-small';
62 $this->FONTSIZE_SMALLER='xx-small';
63 $this->FONTSIZE_SMALLEST='7pt';
65 } else if (browser_is_windows()) {
68 $this->FONTSIZE='small';
69 $this->FONTSIZE_SMALLER='x-small';
70 $this->FONTSIZE_SMALLEST='x-small';
72 } else if (browser_is_mac()){
74 //mac users need bigger fonts
75 $this->FONTSIZE='medium';
76 $this->FONTSIZE_SMALLER='small';
77 $this->FONTSIZE_SMALLEST='x-small';
81 //linux and other users
82 $this->FONTSIZE='small';
83 $this->FONTSIZE_SMALLER='x-small';
84 $this->FONTSIZE_SMALLEST='xx-small';
88 $this->FONTSIZE_HTMLBOX_TITLE = $this->FONTSIZE;
92 * header() - "steel theme" top of page
94 * @param array Header parameters array
96 function header($params) {
97 if (!isset($params['title'])) {
98 $params['title'] = $GLOBALS['sys_name'];
100 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
103 print '<?xml version="1.0" encoding="utf-8"?>';
107 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
108 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
110 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo _('en') ?>" lang="<?php echo _('en'); ?>">
113 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
114 <title><?php echo $params['title']; ?></title>
115 <link rel="icon" type="image/png" href="<?php echo util_make_url('/images/icon.png'); ?>"/>
116 <link rel="shortcut icon" type="image/png" href="<?php echo util_make_url('/images/icon.png'); ?>"/>
117 <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS" href="<?php echo util_make_url ('/export/rss_sfnews.php'); ?>" type="application/rss+xml"/>
118 <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS" href="<?php echo util_make_url ('/export/rss20_news.php'); ?>" type="application/rss+xml"/>
119 <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - New Projects RSS" href="<?php echo util_make_url ('/export/rss_sfprojects.php'); ?>" type="application/rss+xml"/>
121 <script language="JavaScript" type="text/javascript">
124 function admin_window(adminurl) {
125 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
128 function help_window(helpurl) {
129 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=600');
132 <?php plugin_hook ("javascript",false) ; ?>
135 if (_('default_font') != 'default_font') {
136 $site_fonts = _('default_font');
138 $site_fonts = 'helvetica' ;
148 $this->bodyHeader($params);
151 function bodyHeader($params){
156 <table border="0" width="100%" cellspacing="0" cellpadding="0">
158 <td class="topLeft"><?php echo util_make_link ('/', html_image('header/top-logo.png',300,54,array('border'=>'0'))); ?></td>
159 <td class="middleRight"><?php echo $this->searchBox(); ?></td>
160 <td class="middleRight"><?php
161 if (session_loggedin()) {
162 echo util_make_link ('/account/logout.php', _('Log Out'));
164 echo util_make_link ('/account/', _('My Account'));
166 echo util_make_link ('/account/login.php', _('Log In'));
168 if (!$GLOBALS['sys_user_reg_restricted']) {
169 echo util_make_link ('/account/register.php', _('New Account'));
173 plugin_hook ('headermenu', $params);
175 echo $this->quickNav();
177 <td> </td>
184 <table border="0" width="100%" cellspacing="0" cellpadding="0">
186 <td><?php echo $this->outerTabs($params); ?></td>
191 <table border="0" width="100%" cellspacing="0" cellpadding="0">
193 if (isset($params['group']) && $params['group']) {
198 echo $this->projectTabs($params['toptab'],$params['group']);
207 <table border="0" width="100%" cellspacing="0" cellpadding="0">
209 <td class="mainCanvas"> <!-- main body area -->
213 function footer($params) {
215 </td> <!-- end main body area -->
219 <!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
222 <a href="http://fusionforge.org/"><img src="<?php echo util_make_url ('/images/pow-fusionforge.png'); ?>" alt="Powered By FusionForge" border="0" /></a>
225 $forge = new FusionForge() ;
226 printf (_('This site is running %1$s version %2$s'),
227 $forge->software_name,
228 $forge->software_version) ;
234 global $sys_show_source;
235 if ($sys_show_source) {
237 print util_make_link ('/source.php?file=' . $SCRIPT_NAME, _('Show source'), array ("class" => "showsource"));
248 function headerCSS(){
250 <link rel="stylesheet" type="text/css" href="<?php echo util_make_url ('/themes/css/gforge.css') ?>" />
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="'.util_make_url ($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 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
432 $TABS_DIRS[]='/project/?group_id='. $params['group'];
434 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
436 $TABS_TITLES[]=$project->getPublicName();
437 $selected=count($TABS_DIRS)-1;
440 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ||
441 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
442 $selected=array_search("/my/", $TABS_DIRS);
443 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
444 $selected=array_search("/softwaremap/", $TABS_DIRS);
445 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
446 $selected=array_search("/snippet/", $TABS_DIRS);
447 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
448 $selected=array_search("/people/", $TABS_DIRS);
449 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
450 $selected=array_search('/reporting/',$TABS_DIRS);
451 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
452 $selected=array_search('/admin/',$TABS_DIRS);
453 } elseif (count($PLUGIN_TABS_DIRS)>0) {
454 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
455 if (strstr(getStringFromServer('REQUEST_URI'),$PLUGIN_TABS_DIRS_VALUE)) {
456 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
463 if (!$this->COLOR_SELECTED_TAB) {
464 $this->COLOR_SELECTED_TAB= '#e0e0e0';
466 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
471 * projectTabs() - Prints out the project tabs, contained here in case
472 * we want to allow it to be overriden
474 * @param string Is the tab currently selected
475 * @param string Is the group we should look up get title info
477 function projectTabs($toptab,$group) {
478 // get group info using the common result set
479 $project =& group_get_object($group);
480 if (!$project || !is_object($project)) {
483 if ($project->isError()) {
484 //wasn't found or some other problem
487 if (!$project->isProject()) {
492 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
493 $TABS_DIRS[]='/project/?group_id='. $group;
495 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
497 $TABS_TITLES[]=_('Summary');
498 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
501 $perm =& $project->getPermission( session_get_user() );
502 if ($perm->isAdmin()) {
503 $TABS_DIRS[]='/project/admin/?group_id='. $group;
504 $TABS_TITLES[]=_('Admin');
505 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
508 $TABS_DIRS[]='http://'. $project->getHomePage();
509 $TABS_TITLES[]=_('Home Page');
512 // Project Activity tab
513 $TABS_DIRS[]='/activity/?group_id='. $group;
514 $TABS_TITLES[]=_('Activity');
515 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
518 if ($project->usesForum()) {
519 $TABS_DIRS[]='/forum/?group_id='.$group;
520 $TABS_TITLES[]=_('Forums');
521 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
525 if ($project->usesTracker()) {
526 $TABS_DIRS[]='/tracker/?group_id='.$group;
527 $TABS_TITLES[]=_('Tracker');
528 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
529 ? $selected=(count($TABS_TITLES)-1) : '' );
533 if ($project->usesMail()) {
534 $TABS_DIRS[]='/mail/?group_id='.$group;
535 $TABS_TITLES[]=_('Lists');
536 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
540 if ($project->usesPm()) {
541 $TABS_DIRS[]='/pm/?group_id='.$group;
542 $TABS_TITLES[]=_('Tasks');
543 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
547 if ($project->usesDocman()) {
548 $TABS_DIRS[]='/docman/?group_id='.$group;
549 $TABS_TITLES[]=_('Docs');
550 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
554 if ($project->usesSurvey()) {
555 $TABS_DIRS[]='/survey/?group_id='.$group;
556 $TABS_TITLES[]=_('Surveys');
557 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
561 if ($project->usesNews()) {
562 $TABS_DIRS[]='/news/?group_id='.$group;
563 $TABS_TITLES[]=_('News');
564 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
568 if ($project->usesSCM()) {
569 $TABS_DIRS[]='/scm/?group_id='.$group;
570 $TABS_TITLES[]=_('SCM');
571 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
574 // groupmenu_after_scm hook
575 $hookParams['DIRS'] = &$TABS_DIRS;
576 $hookParams['TITLES'] = &$TABS_TITLES;
577 $hookParams['toptab'] = &$toptab;
578 $hookParams['selected'] = &$selected;
579 $hookParams['group_id'] = $group ;
581 plugin_hook ("groupmenu_scm", $hookParams) ;
584 if ($project->usesFRS()) {
585 $TABS_DIRS[]='/frs/?group_id='.$group;
586 $TABS_TITLES[]=_('Files');
587 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
591 $hookParams['DIRS'] = &$TABS_DIRS;
592 $hookParams['TITLES'] = &$TABS_TITLES;
593 $hookParams['toptab'] = &$toptab;
594 $hookParams['selected'] = &$selected;
595 $hookParams['group'] = $group;
597 plugin_hook ("groupmenu", $hookParams) ;
599 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
603 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
604 $count=count($TABS_DIRS);
605 $width=intval((100/$count));
611 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
614 $folder = $this->imgroot.($nested ? 'bottomtab-new/' : 'toptab-new/');
616 for ($i=0; $i<$count; $i++) {
617 if ($selected == $i) {
618 $left_img = $folder.'selected-left.gif';
619 $middle_img = $folder.'selected-middle.gif';
620 $right_img = $folder.'selected-right.gif';
621 $separ_img = $folder.'selected-separator.gif';
622 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
624 $left_img = $folder.'left.gif';
625 $middle_img = $folder.'middle.gif';
626 $right_img = $folder.'right.gif';
627 $separ_img = $folder.'separator.gif';
628 $css_class = $nested ? 'bottomTab' : 'topTab';
631 $clear_img = $this->imgroot.'clear.png';
634 $tab_height = BOTTOM_TAB_HEIGHT;
636 '<td valign="top" width="5" background="%s">
637 <img src="%s" height="%d" width="5" alt="" />
638 </td>', $middle_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, util_make_url ($TABS_DIRS[$i]), $TABS_TITLES[$i]);
644 // if the next tab is not last, insert a separator
647 '<td valign="top" width="2" background="%s">
648 <img src="%s" height="%d" width="2" alt="" />
649 </td>', $separ_img, $clear_img, $tab_height );
653 $tab_height = TOP_TAB_HEIGHT;
656 '<td valign="top" width="3" background="%s">
657 <img src="%s" height="%d" width="3" alt="" />
658 </td>', $left_img, $clear_img, $tab_height );
661 '<td background="%s" width="'.$width.'%%" style="text-align:center">
662 <a class="%s" href="%s">%s</a>
663 </td>', $middle_img, $css_class, util_make_url ($TABS_DIRS[$i]), $TABS_TITLES[$i]);
665 // if the next tab is not selected, close this tab
666 if ($selected != $i+1) {
668 '<td valign="top" width="9" background="%s">
669 <img src="%s" height="%d" width="9" alt="" />
670 </td>', $right_img, $clear_img, $tab_height );
676 // Building a bottom row in this table, which will be darker
679 if ($selected == 0) {
681 $end_cols=((count($TABS_DIRS)*3)-3);
682 } elseif ($selected == (count($TABS_DIRS)-1)) {
683 $beg_cols=((count($TABS_DIRS)*3)-3);
686 $beg_cols=($selected*3);
687 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
694 '<td colspan="'.$beg_cols.'" height="1" bgcolor="#909090">
695 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
699 '<td colspan="3" height="1" bgcolor="'.$sel_tab_bgcolor.'">
700 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
704 '<td colspan="'.$end_cols.'" height="1" bgcolor="#909090">
705 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
719 function searchBox() {
720 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
722 if(get_magic_quotes_gpc()) {
723 $defaultWords = stripslashes($words);
725 $defaultWords = $words;
728 // if there is no search currently, set the default
729 if ( ! isset($type_of_search) ) {
734 <form action="'.util_make_url ('/search/').'" method="get">
735 <table border="0" cellpadding="0" cellspacing="0">
737 <div align="center" style="font-size:smaller">';
739 SEARCH__PARAMETER_GROUP_ID => $group_id,
740 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
741 SEARCH__PARAMETER_FORUM_ID => $forum_id,
742 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
745 $searchManager =& getSearchManager();
746 $searchManager->setParametersValues($parameters);
747 $searchEngines =& $searchManager->getAvailableSearchEngines();
749 echo '<select name="type_of_search">';
750 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
751 $searchEngine =& $searchEngines[$i];
752 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
754 echo '</select></div>';
758 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
760 print '</td><td> ';
761 $parameters = $searchManager->getParameters();
762 foreach($parameters AS $name => $value) {
763 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
766 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
768 print '</td><td> </td><td>';
769 print '<input type="submit" name="Search" value="'._('Search').'" />';
772 if (isset($group_id) && $group_id) {
774 <td width="10"> </td>
775 <td>'.util_make_link ('/search/advanced_search.php?group_id='.$group_id, _('Advanced search')).'</td>';
777 print '</tr></table>';
782 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
783 // display the searchmask
785 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
786 <input type="hidden" name="search" value="1"/>
787 <input type="hidden" name="group_id" value="'.$group_id.'"/>
788 <div align="center"><br />
792 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
793 <input type="submit" name="submitbutton" value="'._('Search').'" />
798 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
801 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
804 </table><br /></div>'
805 .$this->createUnderSections($sectionsArray).'
809 //create javascript methods for select none/all
811 <script type="text/javascript">
812 <!-- method for disable/enable checkboxes
813 function setCheckBoxes(parent, checked) {
816 for (var i = 0; i < document.advancedsearch.elements.length; i++)
817 if (document.advancedsearch.elements[i].type == "checkbox")
818 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
819 document.advancedsearch.elements[i].checked = checked;
827 function createUnderSections($sectionsArray) {
828 global $group_subsection_names;
830 foreach ($sectionsArray as $section) {
831 if(is_array($section)) {
832 $countLines += (3 + count ($section));
834 //2 lines one for section name and one for checkbox
838 $breakLimit = round($countLines/3);
839 $break = $breakLimit;
842 <table width="99%" border="0" cellspacing="0" cellpadding="1" style="background-color:'. $this->COLOR_LTBACK2.'">
845 <table width="100%" cellspacing="0" border="0" style="background-color:'. $this->COLOR_LTBACK1.'">
846 <tr style="font-weight: bold;background-color:'. $this->COLOR_LTBACK2 .'">
847 <td colspan="2">'._('Search in').'</td>
848 <td style="text-align:right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
851 <td colspan="3"> </td>
853 <tr align="center" valign="top">
855 foreach($sectionsArray as $key => $section) {
856 $oldcountlines = $countLines;
857 if (is_array($section)) {
858 $countLines += (3 + count ($section));
863 if ($countLines >= $break) {
864 //if the next block is so large that shifting it to the next column hits the breakpoint better
865 //the second part of statement (behind &&) proofs, that no 4th column is added
866 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
867 $return .= '</td><td>';
868 $break += $breakLimit;
872 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0" style="background-color:'. $this->COLOR_LTBACK2.'">
873 <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
874 <tr style="background-color:'. $this->COLOR_LTBACK2 .'; font-weight: bold">
876 <a href="#'.$key.'">'.$group_subsection_names[$key].'</a>'
878 <td style="text-align:right">'
879 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
882 <tr style="background-color:'. $this->COLOR_LTBACK1.'">
885 if (!is_array($section)) {
886 $return .= ' <input type="checkbox" name="'.urlencode($key).'"';
887 if (isset($GLOBALS[urlencode($key)]))
888 $return .= ' checked="checked" ';
889 $return .= ' /></input>'.$group_subsection_names[$key].'<br />';
892 foreach($section as $underkey => $undersection) {
893 $return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
894 if (isset($GLOBALS[urlencode($key.$underkey)]))
895 $return .= ' checked ';
896 $return .= '></input>'.$undersection.'<br />';
902 </table></td></tr></table><br />';
904 if ($countLines >= $break) {
905 if (($countLines - $break) < ($break - $countLines)) {
906 $return .= '</td><td width="33%">';
907 $break += $breakLimit;
912 return $return.' </td>
914 </table></td></tr></table>';
918 * beginSubMenu() - Opening a submenu.
920 * @return string Html to start a submenu.
922 function beginSubMenu () {
929 * endSubMenu() - Closing a submenu.
931 * @return string Html to end a submenu.
933 function endSubMenu () {
934 $return = '</strong></p>';
939 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
941 * @param array The array of titles.
942 * @param array The array of title links.
943 * @return string Html to build a submenu.
945 function printSubMenu ($title_arr,$links_arr) {
946 $count=count($title_arr);
951 for ($i=0; $i<$count; $i++) {
952 $return .= util_make_link ($links_arr[$i], $title_arr[$i]) . ' | ';
954 $return .= util_make_link ($links_arr[$i], $title_arr[$i]);
959 * subMenu() - Takes two array of titles and links and build a menu.
961 * @param array The array of titles.
962 * @param array The array of title links.
963 * @return string Html to build a submenu.
965 function subMenu ($title_arr,$links_arr) {
966 $return = $this->beginSubMenu () ;
967 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
968 $return .= $this->endSubMenu () ;
973 * multiTableRow() - create a mutlilevel row in a table
975 * @param string the row attributes
976 * @param array the array of cell data, each element is an array,
977 * the first item being the text,
978 * the subsequent items are attributes (dont include
979 * the bgcolor for the title here, that will be
980 * handled by $istitle
981 * @param boolean is this row part of the title ?
984 function multiTableRow($row_attr, $cell_data, $istitle) {
988 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
991 for ( $c = 0; $c < count($cell_data); $c++ ) {
993 for ( $a=1; $a < count($cell_data[$c]); $a++) {
994 $return .= $cell_data[$c][$a].' ';
998 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
1000 $return .= $cell_data[$c][0];
1002 $return .='</strong></font>';
1014 * feedback() - returns the htmlized feedback string when an action is performed.
1016 * @param string feedback string
1017 * @return string htmlized feedback
1019 function feedback($feedback) {
1024 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
1029 * getThemeIdFromName()
1031 * @param string the dirname of the theme
1032 * @return integer the theme id
1034 function getThemeIdFromName($dirname) {
1035 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
1036 return db_result($res,0,'theme_id');
1043 // c-file-style: "bsd"