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;
397 if (session_loggedin()) {
398 $projectmaster =& group_get_object(GROUP_IS_MASTER);
399 $projectstats =& group_get_object(GROUP_IS_STATS);
400 $permmaster =& $projectmaster->getPermission( session_get_user() );
401 $permstats =& $projectstats->getPermission( session_get_user() );
403 if ($permmaster->isAdmin()) {
405 $TABS_DIRS[]='/admin/';
406 $TABS_TITLES[]=_('Admin');
408 if ($permstats->isMember()) {
409 $TABS_DIRS[]='/reporting/';
410 $TABS_TITLES[]=_('Reporting');
413 if(isset($params['group']) && $params['group']) {
414 // get group info using the common result set
415 $project =& group_get_object($params['group']);
416 if ($project && is_object($project)) {
417 if ($project->isError()) {
419 } elseif (!$project->isProject()) {
422 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
423 $TABS_DIRS[]='/project/?group_id='. $params['group'];
425 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
427 $TABS_TITLES[]=$project->getPublicName();
428 $selected=count($TABS_DIRS)-1;
431 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ||
432 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
433 $selected=array_search("/my/", $TABS_DIRS);
434 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
435 $selected=array_search("/softwaremap/", $TABS_DIRS);
436 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
437 $selected=array_search("/snippet/", $TABS_DIRS);
438 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
439 $selected=array_search("/people/", $TABS_DIRS);
440 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
441 $selected=array_search('/reporting/',$TABS_DIRS);
442 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
443 $selected=array_search('/admin/',$TABS_DIRS);
444 } elseif (count($PLUGIN_TABS_DIRS)>0) {
445 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
446 if (strstr(getStringFromServer('REQUEST_URI'),$PLUGIN_TABS_DIRS_VALUE)) {
447 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
454 if (!$this->COLOR_SELECTED_TAB) {
455 $this->COLOR_SELECTED_TAB= '#e0e0e0';
457 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
462 * projectTabs() - Prints out the project tabs, contained here in case
463 * we want to allow it to be overriden
465 * @param string Is the tab currently selected
466 * @param string Is the group we should look up get title info
468 function projectTabs($toptab,$group) {
469 // get group info using the common result set
470 $project =& group_get_object($group);
471 if (!$project || !is_object($project)) {
474 if ($project->isError()) {
475 //wasn't found or some other problem
478 if (!$project->isProject()) {
483 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
484 $TABS_DIRS[]='/project/?group_id='. $group;
486 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
488 $TABS_TITLES[]=_('Summary');
489 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
492 $perm =& $project->getPermission( session_get_user() );
493 if ($perm->isAdmin()) {
494 $TABS_DIRS[]='/project/admin/?group_id='. $group;
495 $TABS_TITLES[]=_('Admin');
496 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
499 $TABS_DIRS[]='http://'. $project->getHomePage();
500 $TABS_TITLES[]=_('Home Page');
503 // Project Activity tab
504 $TABS_DIRS[]='/activity/?group_id='. $group;
505 $TABS_TITLES[]=_('Activity');
506 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
509 if ($project->usesForum()) {
510 $TABS_DIRS[]='/forum/?group_id='.$group;
511 $TABS_TITLES[]=_('Forums');
512 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
516 if ($project->usesTracker()) {
517 $TABS_DIRS[]='/tracker/?group_id='.$group;
518 $TABS_TITLES[]=_('Tracker');
519 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
520 ? $selected=(count($TABS_TITLES)-1) : '' );
524 if ($project->usesMail()) {
525 $TABS_DIRS[]='/mail/?group_id='.$group;
526 $TABS_TITLES[]=_('Lists');
527 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
531 if ($project->usesPm()) {
532 $TABS_DIRS[]='/pm/?group_id='.$group;
533 $TABS_TITLES[]=_('Tasks');
534 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
538 if ($project->usesDocman()) {
539 $TABS_DIRS[]='/docman/?group_id='.$group;
540 $TABS_TITLES[]=_('Docs');
541 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
545 if ($project->usesSurvey()) {
546 $TABS_DIRS[]='/survey/?group_id='.$group;
547 $TABS_TITLES[]=_('Surveys');
548 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
552 if ($project->usesNews()) {
553 $TABS_DIRS[]='/news/?group_id='.$group;
554 $TABS_TITLES[]=_('News');
555 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
559 if ($project->usesSCM()) {
560 $TABS_DIRS[]='/scm/?group_id='.$group;
561 $TABS_TITLES[]=_('SCM');
562 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
565 // groupmenu_after_scm hook
566 $hookParams['DIRS'] = &$TABS_DIRS;
567 $hookParams['TITLES'] = &$TABS_TITLES;
568 $hookParams['toptab'] = &$toptab;
569 $hookParams['selected'] = &$selected;
570 $hookParams['group_id'] = $group ;
572 plugin_hook ("groupmenu_scm", $hookParams) ;
575 if ($project->usesFRS()) {
576 $TABS_DIRS[]='/frs/?group_id='.$group;
577 $TABS_TITLES[]=_('Files');
578 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
582 $hookParams['DIRS'] = &$TABS_DIRS;
583 $hookParams['TITLES'] = &$TABS_TITLES;
584 $hookParams['toptab'] = &$toptab;
585 $hookParams['selected'] = &$selected;
586 $hookParams['group'] = $group;
588 plugin_hook ("groupmenu", $hookParams) ;
590 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
594 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
595 $count=count($TABS_DIRS);
596 $width=intval((100/$count));
602 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
605 $folder = $this->imgroot.($nested ? 'bottomtab-new/' : 'toptab-new/');
607 for ($i=0; $i<$count; $i++) {
608 if ($selected == $i) {
609 $left_img = $folder.'selected-left.gif';
610 $middle_img = $folder.'selected-middle.gif';
611 $right_img = $folder.'selected-right.gif';
612 $separ_img = $folder.'selected-separator.gif';
613 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
615 $left_img = $folder.'left.gif';
616 $middle_img = $folder.'middle.gif';
617 $right_img = $folder.'right.gif';
618 $separ_img = $folder.'separator.gif';
619 $css_class = $nested ? 'bottomTab' : 'topTab';
622 $clear_img = $this->imgroot.'clear.png';
625 $tab_height = BOTTOM_TAB_HEIGHT;
627 '<td valign="top" width="5" background="%s">
628 <img src="%s" height="%d" width="5" alt="" />
629 </td>', $middle_img, $clear_img, $tab_height );
631 '<td background="%s" width="'.$width.'%%" style="text-align:center">
632 <a class="%s" href="%s">%s</a>
633 </td>', $middle_img, $css_class, util_make_url ($TABS_DIRS[$i]), $TABS_TITLES[$i]);
635 // if the next tab is not last, insert a separator
638 '<td valign="top" width="2" background="%s">
639 <img src="%s" height="%d" width="2" alt="" />
640 </td>', $separ_img, $clear_img, $tab_height );
644 $tab_height = TOP_TAB_HEIGHT;
647 '<td valign="top" width="3" background="%s">
648 <img src="%s" height="%d" width="3" alt="" />
649 </td>', $left_img, $clear_img, $tab_height );
652 '<td background="%s" width="'.$width.'%%" style="text-align:center">
653 <a class="%s" href="%s">%s</a>
654 </td>', $middle_img, $css_class, util_make_url ($TABS_DIRS[$i]), $TABS_TITLES[$i]);
656 // if the next tab is not selected, close this tab
657 if ($selected != $i+1) {
659 '<td valign="top" width="9" background="%s">
660 <img src="%s" height="%d" width="9" alt="" />
661 </td>', $right_img, $clear_img, $tab_height );
667 // Building a bottom row in this table, which will be darker
670 if ($selected == 0) {
672 $end_cols=((count($TABS_DIRS)*3)-3);
673 } elseif ($selected == (count($TABS_DIRS)-1)) {
674 $beg_cols=((count($TABS_DIRS)*3)-3);
677 $beg_cols=($selected*3);
678 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
685 '<td colspan="'.$beg_cols.'" height="1" bgcolor="#909090">
686 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
690 '<td colspan="3" height="1" bgcolor="'.$sel_tab_bgcolor.'">
691 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
695 '<td colspan="'.$end_cols.'" height="1" bgcolor="#909090">
696 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
710 function searchBox() {
711 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
713 if(get_magic_quotes_gpc()) {
714 $defaultWords = stripslashes($words);
716 $defaultWords = $words;
719 // if there is no search currently, set the default
720 if ( ! isset($type_of_search) ) {
725 <form action="'.util_make_url ('/search/').'" method="get">
726 <table border="0" cellpadding="0" cellspacing="0">
728 <div align="center" style="font-size:smaller">';
730 SEARCH__PARAMETER_GROUP_ID => $group_id,
731 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
732 SEARCH__PARAMETER_FORUM_ID => $forum_id,
733 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
736 $searchManager =& getSearchManager();
737 $searchManager->setParametersValues($parameters);
738 $searchEngines =& $searchManager->getAvailableSearchEngines();
740 echo '<select name="type_of_search">';
741 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
742 $searchEngine =& $searchEngines[$i];
743 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
745 echo '</select></div>';
749 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
751 print '</td><td> ';
752 $parameters = $searchManager->getParameters();
753 foreach($parameters AS $name => $value) {
754 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
757 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
759 print '</td><td> </td><td>';
760 print '<input type="submit" name="Search" value="'._('Search').'" />';
763 if (isset($group_id) && $group_id) {
765 <td width="10"> </td>
766 <td>'.util_make_link ('/search/advanced_search.php?group_id='.$group_id, _('Advanced search')).'</td>';
768 print '</tr></table>';
773 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
774 // display the searchmask
776 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
777 <input type="hidden" name="search" value="1"/>
778 <input type="hidden" name="group_id" value="'.$group_id.'"/>
779 <div align="center"><br />
783 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
784 <input type="submit" name="submitbutton" value="'._('Search').'" />
789 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
792 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
795 </table><br /></div>'
796 .$this->createUnderSections($sectionsArray).'
800 //create javascript methods for select none/all
802 <script type="text/javascript">
803 <!-- method for disable/enable checkboxes
804 function setCheckBoxes(parent, checked) {
807 for (var i = 0; i < document.advancedsearch.elements.length; i++)
808 if (document.advancedsearch.elements[i].type == "checkbox")
809 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
810 document.advancedsearch.elements[i].checked = checked;
818 function createUnderSections($sectionsArray) {
819 global $group_subsection_names;
821 foreach ($sectionsArray as $section) {
822 if(is_array($section)) {
823 $countLines += (3 + count ($section));
825 //2 lines one for section name and one for checkbox
829 $breakLimit = round($countLines/3);
830 $break = $breakLimit;
833 <table width="99%" border="0" cellspacing="0" cellpadding="1" style="background-color:'. $this->COLOR_LTBACK2.'">
836 <table width="100%" cellspacing="0" border="0" style="background-color:'. $this->COLOR_LTBACK1.'">
837 <tr style="font-weight: bold;background-color:'. $this->COLOR_LTBACK2 .'">
838 <td colspan="2">'._('Search in').'</td>
839 <td style="text-align:right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
842 <td colspan="3"> </td>
844 <tr align="center" valign="top">
846 foreach($sectionsArray as $key => $section) {
847 $oldcountlines = $countLines;
848 if (is_array($section)) {
849 $countLines += (3 + count ($section));
854 if ($countLines >= $break) {
855 //if the next block is so large that shifting it to the next column hits the breakpoint better
856 //the second part of statement (behind &&) proofs, that no 4th column is added
857 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
858 $return .= '</td><td>';
859 $break += $breakLimit;
863 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0" style="background-color:'. $this->COLOR_LTBACK2.'">
864 <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
865 <tr style="background-color:'. $this->COLOR_LTBACK2 .'; font-weight: bold">
867 <a href="#'.$key.'">'.$group_subsection_names[$key].'</a>'
869 <td style="text-align:right">'
870 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
873 <tr style="background-color:'. $this->COLOR_LTBACK1.'">
876 if (!is_array($section)) {
877 $return .= ' <input type="checkbox" name="'.urlencode($key).'"';
878 if (isset($GLOBALS[urlencode($key)]))
879 $return .= ' checked="checked" ';
880 $return .= ' /></input>'.$group_subsection_names[$key].'<br />';
883 foreach($section as $underkey => $undersection) {
884 $return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
885 if (isset($GLOBALS[urlencode($key.$underkey)]))
886 $return .= ' checked ';
887 $return .= '></input>'.$undersection.'<br />';
893 </table></td></tr></table><br />';
895 if ($countLines >= $break) {
896 if (($countLines - $break) < ($break - $countLines)) {
897 $return .= '</td><td width="33%">';
898 $break += $breakLimit;
903 return $return.' </td>
905 </table></td></tr></table>';
909 * beginSubMenu() - Opening a submenu.
911 * @return string Html to start a submenu.
913 function beginSubMenu () {
920 * endSubMenu() - Closing a submenu.
922 * @return string Html to end a submenu.
924 function endSubMenu () {
925 $return = '</strong></p>';
930 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
932 * @param array The array of titles.
933 * @param array The array of title links.
934 * @return string Html to build a submenu.
936 function printSubMenu ($title_arr,$links_arr) {
937 $count=count($title_arr);
942 for ($i=0; $i<$count; $i++) {
943 $return .= util_make_link ($links_arr[$i], $title_arr[$i]) . ' | ';
945 $return .= util_make_link ($links_arr[$i], $title_arr[$i]);
950 * subMenu() - Takes two array of titles and links and build a menu.
952 * @param array The array of titles.
953 * @param array The array of title links.
954 * @return string Html to build a submenu.
956 function subMenu ($title_arr,$links_arr) {
957 $return = $this->beginSubMenu () ;
958 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
959 $return .= $this->endSubMenu () ;
964 * multiTableRow() - create a mutlilevel row in a table
966 * @param string the row attributes
967 * @param array the array of cell data, each element is an array,
968 * the first item being the text,
969 * the subsequent items are attributes (dont include
970 * the bgcolor for the title here, that will be
971 * handled by $istitle
972 * @param boolean is this row part of the title ?
975 function multiTableRow($row_attr, $cell_data, $istitle) {
979 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
982 for ( $c = 0; $c < count($cell_data); $c++ ) {
984 for ( $a=1; $a < count($cell_data[$c]); $a++) {
985 $return .= $cell_data[$c][$a].' ';
989 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
991 $return .= $cell_data[$c][0];
993 $return .='</strong></font>';
1005 * feedback() - returns the htmlized feedback string when an action is performed.
1007 * @param string feedback string
1008 * @return string htmlized feedback
1010 function feedback($feedback) {
1015 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
1020 * getThemeIdFromName()
1022 * @param string the dirname of the theme
1023 * @return integer the theme id
1025 function getThemeIdFromName($dirname) {
1026 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
1027 return db_result($res,0,'theme_id');
1034 // c-file-style: "bsd"