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 <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"/>
117 <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"/>
118 <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"/>
120 <script language="JavaScript" type="text/javascript">
123 function admin_window(adminurl) {
124 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
127 function help_window(helpurl) {
128 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=600');
131 <?php plugin_hook ("javascript",false) ; ?>
134 if (_('default_font') != 'default_font') {
135 $site_fonts = _('default_font');
137 $site_fonts = 'helvetica' ;
147 $this->bodyHeader($params);
150 function bodyHeader($params){
155 <table border="0" width="100%" cellspacing="0" cellpadding="0">
157 <td class="topLeft"><?php echo util_make_link ('/', html_image('header/top-logo.png',192,54,array('border'=>'0'))); ?></td>
158 <td class="middleRight"><?php echo $this->searchBox(); ?></td>
159 <td class="middleRight"><?php
160 if (session_loggedin()) {
161 echo util_make_link ('/account/logout.php', _('Log Out'));
163 echo util_make_link ('/account/', _('My Account'));
165 echo util_make_link ('/account/login.php', _('Log In'));
167 if (!$GLOBALS['sys_user_reg_restricted']) {
168 echo util_make_link ('/account/register.php', _('New Account'));
172 plugin_hook ('headermenu', $params);
174 echo $this->quickNav();
176 <td> </td>
183 <table border="0" width="100%" cellspacing="0" cellpadding="0">
185 <td><?php echo $this->outerTabs($params); ?></td>
190 <table border="0" width="100%" cellspacing="0" cellpadding="0">
192 if (isset($params['group']) && $params['group']) {
197 echo $this->projectTabs($params['toptab'],$params['group']);
206 <table border="0" width="100%" cellspacing="0" cellpadding="0">
208 <td class="mainCanvas"> <!-- main body area -->
212 function footer($params) {
214 </td> <!-- end main body area -->
218 <!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
221 <a href="http://fusionforge.org/"><img src="<?php echo util_make_url ('/images/pow-fusionforge.png'); ?>" alt="Powered By FusionForge" border="0" /></a>
225 global $sys_show_source;
226 if ($sys_show_source) {
228 print util_make_link ('/source.php?file=' . $SCRIPT_NAME, _('Show source'), array ("class" => "showsource"));
239 function headerCSS(){
241 <link rel="stylesheet" type="text/css" href="<?php echo util_make_url ('/themes/css/gforge.css') ?>" />
242 <link rel="stylesheet" type="text/css" href="<?php echo THEME_DIR ?>/css/theme.css" />
244 plugin_hook ('cssfile',$this);
247 function getRootIndex() {
248 return $this->rootindex;
252 * boxTop() - Top HTML box
254 * @param string Box title
255 * @param bool Whether to echo or return the results
256 * @param string The box background color
258 function boxTop($title) {
260 <!-- Box Top Start -->
262 <table cellspacing="0" cellpadding="0" width="100%" border="0" background="'.$this->imgroot.'vert-grad.png">
264 <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>
265 <td width="100%" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
266 <td valign="top" width="10" background="'.$this->imgroot.'box-topright.png"><img src="'.$this->imgroot.'clear.png" width="10" height="20" /></td>
270 <table cellspacing="2" cellpadding="2" width="100%" border="0">
274 <!-- Box Top End -->';
278 * boxMiddle() - Middle HTML box
280 * @param string Box title
281 * @param string The box background color
283 function boxMiddle($title) {
285 <!-- Box Middle Start -->
289 <td colspan="2" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
293 <!-- Box Middle End -->';
297 * boxBottom() - Bottom HTML box
299 * @param bool Whether to echo or return the results
301 function boxBottom() {
303 <!-- Box Bottom Start -->
310 <!-- Box Bottom End -->';
314 * boxGetAltRowStyle() - Get an alternating row style for tables
316 * @param int Row number
318 function boxGetAltRowStyle($i) {
320 return ' bgcolor="#EAEAEA"';
322 return ' bgcolor="#E0E0E0"';
327 * listTableTop() - Takes an array of titles and builds the first row of a new table.
329 * @param array The array of titles
330 * @param array The array of title links
332 function listTableTop ($title_arr,$links_arr=false) {
334 <table cellspacing="0" cellpadding="0" width="100%" border="0">
336 <!-- <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> -->
337 <td background="'.$this->imgroot.'box-grad.png">
338 <table width="100%" border="0" cellspacing="1" cellpadding="2">
341 $count=count($title_arr);
343 for ($i=0; $i<$count; $i++) {
345 <td style="text-align:center"><a class="sortbutton" href="'.util_make_url ($links_arr[$i]).'"><span style="color:'.
346 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></a></td>';
349 for ($i=0; $i<$count; $i++) {
351 <td style="text-align:center"><span style="color:'.
352 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></td>';
355 return $return.'</tr>';
358 function listTableBottom() {
359 return '</table></td>
360 <!-- <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> -->
364 function outerTabs($params) {
365 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
369 if ($sys_use_trove) {
370 $TABS_DIRS[]='/softwaremap/';
372 if ($sys_use_snippet) {
373 $TABS_DIRS[]='/snippet/';
375 if ($sys_use_people) {
376 $TABS_DIRS[]='/people/';
378 $TABS_TITLES[]=_('Home');
379 $TABS_TITLES[]=_('My Page');
380 if ($sys_use_trove) {
381 $TABS_TITLES[]=_('Project Tree');
383 if ($sys_use_snippet) {
384 $TABS_TITLES[]=_('Code Snippets');
386 if ($sys_use_people) {
387 $TABS_TITLES[]=_('Project Openings');
390 $PLUGIN_TABS_DIRS = Array();
391 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
392 $hookParams['TITLES'] = &$TABS_TITLES;
393 plugin_hook ("outermenu", $hookParams) ;
394 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
396 $user_is_super=false;
398 if (session_loggedin()) {
399 $projectmaster =& group_get_object(GROUP_IS_MASTER);
400 $projectstats =& group_get_object(GROUP_IS_STATS);
401 $permmaster =& $projectmaster->getPermission( session_get_user() );
402 $permstats =& $projectstats->getPermission( session_get_user() );
404 if ($permmaster->isAdmin()) {
406 $TABS_DIRS[]='/admin/';
407 $TABS_TITLES[]=_('Admin');
409 if ($permstats->isMember()) {
410 $TABS_DIRS[]='/reporting/';
411 $TABS_TITLES[]=_('Reporting');
414 if(isset($params['group']) && $params['group']) {
415 // get group info using the common result set
416 $project =& group_get_object($params['group']);
417 if ($project && is_object($project)) {
418 if ($project->isError()) {
420 } elseif (!$project->isProject()) {
423 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
424 $TABS_DIRS[]='/project/?group_id='. $params['group'];
426 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
428 $TABS_TITLES[]=$project->getPublicName();
429 $selected=count($TABS_DIRS)-1;
432 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ||
433 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
434 $selected=array_search("/my/", $TABS_DIRS);
435 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
436 $selected=array_search("/softwaremap/", $TABS_DIRS);
437 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
438 $selected=array_search("/snippet/", $TABS_DIRS);
439 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
440 $selected=array_search("/people/", $TABS_DIRS);
441 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
442 $selected=array_search('/reporting/',$TABS_DIRS);
443 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
444 $selected=array_search('/admin/',$TABS_DIRS);
445 } elseif (count($PLUGIN_TABS_DIRS)>0) {
446 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
447 if (strstr(getStringFromServer('REQUEST_URI'),$PLUGIN_TABS_DIRS_VALUE)) {
448 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
455 if (!$this->COLOR_SELECTED_TAB) {
456 $this->COLOR_SELECTED_TAB= '#e0e0e0';
458 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
463 * projectTabs() - Prints out the project tabs, contained here in case
464 * we want to allow it to be overriden
466 * @param string Is the tab currently selected
467 * @param string Is the group we should look up get title info
469 function projectTabs($toptab,$group) {
470 // get group info using the common result set
471 $project =& group_get_object($group);
472 if (!$project || !is_object($project)) {
475 if ($project->isError()) {
476 //wasn't found or some other problem
479 if (!$project->isProject()) {
484 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
485 $TABS_DIRS[]='/project/?group_id='. $group;
487 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
489 $TABS_TITLES[]=_('Summary');
490 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
493 $perm =& $project->getPermission( session_get_user() );
494 if ($perm->isAdmin()) {
495 $TABS_DIRS[]='/project/admin/?group_id='. $group;
496 $TABS_TITLES[]=_('Admin');
497 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
500 $TABS_DIRS[]='http://'. $project->getHomePage();
501 $TABS_TITLES[]=_('Home Page');
504 // Project Activity tab
505 $TABS_DIRS[]='/activity/?group_id='. $group;
506 $TABS_TITLES[]=_('Activity');
507 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
510 if ($project->usesForum()) {
511 $TABS_DIRS[]='/forum/?group_id='.$group;
512 $TABS_TITLES[]=_('Forums');
513 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
517 if ($project->usesTracker()) {
518 $TABS_DIRS[]='/tracker/?group_id='.$group;
519 $TABS_TITLES[]=_('Tracker');
520 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
521 ? $selected=(count($TABS_TITLES)-1) : '' );
525 if ($project->usesMail()) {
526 $TABS_DIRS[]='/mail/?group_id='.$group;
527 $TABS_TITLES[]=_('Lists');
528 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
532 if ($project->usesPm()) {
533 $TABS_DIRS[]='/pm/?group_id='.$group;
534 $TABS_TITLES[]=_('Tasks');
535 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
539 if ($project->usesDocman()) {
540 $TABS_DIRS[]='/docman/?group_id='.$group;
541 $TABS_TITLES[]=_('Docs');
542 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
546 if ($project->usesSurvey()) {
547 $TABS_DIRS[]='/survey/?group_id='.$group;
548 $TABS_TITLES[]=_('Surveys');
549 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
553 if ($project->usesNews()) {
554 $TABS_DIRS[]='/news/?group_id='.$group;
555 $TABS_TITLES[]=_('News');
556 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
560 if ($project->usesSCM()) {
561 $TABS_DIRS[]='/scm/?group_id='.$group;
562 $TABS_TITLES[]=_('SCM');
563 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
566 // groupmenu_after_scm hook
567 $hookParams['DIRS'] = &$TABS_DIRS;
568 $hookParams['TITLES'] = &$TABS_TITLES;
569 $hookParams['toptab'] = &$toptab;
570 $hookParams['selected'] = &$selected;
571 $hookParams['group_id'] = $group ;
573 plugin_hook ("groupmenu_scm", $hookParams) ;
576 if ($project->usesFRS()) {
577 $TABS_DIRS[]='/frs/?group_id='.$group;
578 $TABS_TITLES[]=_('Files');
579 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
583 $hookParams['DIRS'] = &$TABS_DIRS;
584 $hookParams['TITLES'] = &$TABS_TITLES;
585 $hookParams['toptab'] = &$toptab;
586 $hookParams['selected'] = &$selected;
587 $hookParams['group'] = $group;
589 plugin_hook ("groupmenu", $hookParams) ;
591 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
595 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
596 $count=count($TABS_DIRS);
597 $width=intval((100/$count));
603 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
606 $folder = $this->imgroot.($nested ? 'bottomtab-new/' : 'toptab-new/');
608 for ($i=0; $i<$count; $i++) {
609 if ($selected == $i) {
610 $left_img = $folder.'selected-left.gif';
611 $middle_img = $folder.'selected-middle.gif';
612 $right_img = $folder.'selected-right.gif';
613 $separ_img = $folder.'selected-separator.gif';
614 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
616 $left_img = $folder.'left.gif';
617 $middle_img = $folder.'middle.gif';
618 $right_img = $folder.'right.gif';
619 $separ_img = $folder.'separator.gif';
620 $css_class = $nested ? 'bottomTab' : 'topTab';
623 $clear_img = $this->imgroot.'clear.png';
626 $tab_height = BOTTOM_TAB_HEIGHT;
628 '<td valign="top" width="5" background="%s">
629 <img src="%s" height="%d" width="5" alt="" />
630 </td>', $middle_img, $clear_img, $tab_height );
632 '<td background="%s" width="'.$width.'%%" style="text-align:center">
633 <a class="%s" href="%s">%s</a>
634 </td>', $middle_img, $css_class, util_make_url ($TABS_DIRS[$i]), $TABS_TITLES[$i]);
636 // if the next tab is not last, insert a separator
639 '<td valign="top" width="2" background="%s">
640 <img src="%s" height="%d" width="2" alt="" />
641 </td>', $separ_img, $clear_img, $tab_height );
645 $tab_height = TOP_TAB_HEIGHT;
648 '<td valign="top" width="3" background="%s">
649 <img src="%s" height="%d" width="3" alt="" />
650 </td>', $left_img, $clear_img, $tab_height );
653 '<td background="%s" width="'.$width.'%%" style="text-align:center">
654 <a class="%s" href="%s">%s</a>
655 </td>', $middle_img, $css_class, util_make_url ($TABS_DIRS[$i]), $TABS_TITLES[$i]);
657 // if the next tab is not selected, close this tab
658 if ($selected != $i+1) {
660 '<td valign="top" width="9" background="%s">
661 <img src="%s" height="%d" width="9" alt="" />
662 </td>', $right_img, $clear_img, $tab_height );
668 // Building a bottom row in this table, which will be darker
671 if ($selected == 0) {
673 $end_cols=((count($TABS_DIRS)*3)-3);
674 } elseif ($selected == (count($TABS_DIRS)-1)) {
675 $beg_cols=((count($TABS_DIRS)*3)-3);
678 $beg_cols=($selected*3);
679 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
686 '<td colspan="'.$beg_cols.'" height="1" bgcolor="#909090">
687 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
691 '<td colspan="3" height="1" bgcolor="'.$sel_tab_bgcolor.'">
692 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
696 '<td colspan="'.$end_cols.'" height="1" bgcolor="#909090">
697 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
711 function searchBox() {
712 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
714 if(get_magic_quotes_gpc()) {
715 $defaultWords = stripslashes($words);
717 $defaultWords = $words;
720 // if there is no search currently, set the default
721 if ( ! isset($type_of_search) ) {
726 <form action="'.util_make_url ('/search/').'" method="get">
727 <table border="0" cellpadding="0" cellspacing="0">
729 <div align="center" style="font-size:smaller">';
731 SEARCH__PARAMETER_GROUP_ID => $group_id,
732 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
733 SEARCH__PARAMETER_FORUM_ID => $forum_id,
734 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
737 $searchManager =& getSearchManager();
738 $searchManager->setParametersValues($parameters);
739 $searchEngines =& $searchManager->getAvailableSearchEngines();
741 echo '<select name="type_of_search">';
742 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
743 $searchEngine =& $searchEngines[$i];
744 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
746 echo '</select></div>';
750 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
752 print '</td><td> ';
753 $parameters = $searchManager->getParameters();
754 foreach($parameters AS $name => $value) {
755 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
758 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
760 print '</td><td> </td><td>';
761 print '<input type="submit" name="Search" value="'._('Search').'" />';
764 if (isset($group_id) && $group_id) {
766 <td width="10"> </td>
767 <td>'.util_make_link ('/search/advanced_search.php?group_id='.$group_id, _('Advanced search')).'</td>';
769 print '</tr></table>';
774 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
775 // display the searchmask
777 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
778 <input type="hidden" name="search" value="1"/>
779 <input type="hidden" name="group_id" value="'.$group_id.'"/>
780 <div align="center"><br />
784 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
785 <input type="submit" name="submitbutton" value="'._('Search').'" />
790 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
793 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
796 </table><br /></div>'
797 .$this->createUnderSections($sectionsArray).'
801 //create javascript methods for select none/all
803 <script type="text/javascript">
804 <!-- method for disable/enable checkboxes
805 function setCheckBoxes(parent, checked) {
808 for (var i = 0; i < document.advancedsearch.elements.length; i++)
809 if (document.advancedsearch.elements[i].type == "checkbox")
810 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
811 document.advancedsearch.elements[i].checked = checked;
819 function createUnderSections($sectionsArray) {
820 global $group_subsection_names;
822 foreach ($sectionsArray as $section) {
823 if(is_array($section)) {
824 $countLines += (3 + count ($section));
826 //2 lines one for section name and one for checkbox
830 $breakLimit = round($countLines/3);
831 $break = $breakLimit;
834 <table width="99%" border="0" cellspacing="0" cellpadding="1" style="background-color:'. $this->COLOR_LTBACK2.'">
837 <table width="100%" cellspacing="0" border="0" style="background-color:'. $this->COLOR_LTBACK1.'">
838 <tr style="font-weight: bold;background-color:'. $this->COLOR_LTBACK2 .'">
839 <td colspan="2">'._('Search in').'</td>
840 <td style="text-align:right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
843 <td colspan="3"> </td>
845 <tr align="center" valign="top">
847 foreach($sectionsArray as $key => $section) {
848 $oldcountlines = $countLines;
849 if (is_array($section)) {
850 $countLines += (3 + count ($section));
855 if ($countLines >= $break) {
856 //if the next block is so large that shifting it to the next column hits the breakpoint better
857 //the second part of statement (behind &&) proofs, that no 4th column is added
858 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
859 $return .= '</td><td>';
860 $break += $breakLimit;
864 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0" style="background-color:'. $this->COLOR_LTBACK2.'">
865 <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
866 <tr style="background-color:'. $this->COLOR_LTBACK2 .'; font-weight: bold">
868 <a href="#'.$key.'">'.$group_subsection_names[$key].'</a>'
870 <td style="text-align:right">'
871 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
874 <tr style="background-color:'. $this->COLOR_LTBACK1.'">
877 if (!is_array($section)) {
878 $return .= ' <input type="checkbox" name="'.urlencode($key).'"';
879 if (isset($GLOBALS[urlencode($key)]))
880 $return .= ' checked="checked" ';
881 $return .= ' /></input>'.$group_subsection_names[$key].'<br />';
884 foreach($section as $underkey => $undersection) {
885 $return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
886 if (isset($GLOBALS[urlencode($key.$underkey)]))
887 $return .= ' checked ';
888 $return .= '></input>'.$undersection.'<br />';
894 </table></td></tr></table><br />';
896 if ($countLines >= $break) {
897 if (($countLines - $break) < ($break - $countLines)) {
898 $return .= '</td><td width="33%">';
899 $break += $breakLimit;
904 return $return.' </td>
906 </table></td></tr></table>';
910 * beginSubMenu() - Opening a submenu.
912 * @return string Html to start a submenu.
914 function beginSubMenu () {
921 * endSubMenu() - Closing a submenu.
923 * @return string Html to end a submenu.
925 function endSubMenu () {
926 $return = '</strong></p>';
931 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
933 * @param array The array of titles.
934 * @param array The array of title links.
935 * @return string Html to build a submenu.
937 function printSubMenu ($title_arr,$links_arr) {
938 $count=count($title_arr);
943 for ($i=0; $i<$count; $i++) {
944 $return .= util_make_link ($links_arr[$i], $title_arr[$i]) . ' | ';
946 $return .= util_make_link ($links_arr[$i], $title_arr[$i]);
951 * subMenu() - Takes two array of titles and links and build a menu.
953 * @param array The array of titles.
954 * @param array The array of title links.
955 * @return string Html to build a submenu.
957 function subMenu ($title_arr,$links_arr) {
958 $return = $this->beginSubMenu () ;
959 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
960 $return .= $this->endSubMenu () ;
965 * multiTableRow() - create a mutlilevel row in a table
967 * @param string the row attributes
968 * @param array the array of cell data, each element is an array,
969 * the first item being the text,
970 * the subsequent items are attributes (dont include
971 * the bgcolor for the title here, that will be
972 * handled by $istitle
973 * @param boolean is this row part of the title ?
976 function multiTableRow($row_attr, $cell_data, $istitle) {
980 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
983 for ( $c = 0; $c < count($cell_data); $c++ ) {
985 for ( $a=1; $a < count($cell_data[$c]); $a++) {
986 $return .= $cell_data[$c][$a].' ';
990 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
992 $return .= $cell_data[$c][0];
994 $return .='</strong></font>';
1006 * feedback() - returns the htmlized feedback string when an action is performed.
1008 * @param string feedback string
1009 * @return string htmlized feedback
1011 function feedback($feedback) {
1016 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
1021 * getThemeIdFromName()
1023 * @param string the dirname of the theme
1024 * @return integer the theme id
1026 function getThemeIdFromName($dirname) {
1027 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
1028 return db_result($res,0,'theme_id');
1035 // c-file-style: "bsd"