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 (!$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="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 $this->imgroot; ?>icon.png"/>
115 <link rel="shortcut icon" href="<?php echo $this->imgroot; ?>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.gif',205,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 echo util_make_link ('/account/register.php', _('New Account'));
170 plugin_hook ('headermenu', $params);
172 echo $this->quickNav();
174 <td> </td>
181 <table border="0" width="100%" cellspacing="0" cellpadding="0">
183 <td><?php echo $this->outerTabs($params); ?></td>
188 <table border="0" width="100%" cellspacing="0" cellpadding="0">
190 if (isset($params['group']) && $params['group']) {
195 echo $this->projectTabs($params['toptab'],$params['group']);
204 <table border="0" width="100%" cellspacing="0" cellpadding="0">
206 <td class="mainCanvas"> <!-- main body area -->
210 function footer($params) {
212 </td> <!-- end main body area -->
216 <!-- PLEASE LEAVE "Powered By GForge" on your site -->
219 <a href="http://gforge.org/"><img src="/images/pow-gforge.png" alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
223 global $sys_show_source;
224 if ($sys_show_source) {
226 print util_make_link ('/source.php?file=' . $SCRIPT_NAME, _('Show source'), array ("class" => "showsource"));
237 function headerCSS(){
239 <link rel="stylesheet" type="text/css" href="<?php echo util_make_url ('/themes/css/gforge.css') ?>" />
240 <link rel="stylesheet" type="text/css" href="<?php echo THEME_DIR ?>/css/theme.css" />
242 plugin_hook ('cssfile',$this);
245 function getRootIndex() {
246 return $this->rootindex;
250 * boxTop() - Top HTML box
252 * @param string Box title
253 * @param bool Whether to echo or return the results
254 * @param string The box background color
256 function boxTop($title) {
258 <!-- Box Top Start -->
260 <table cellspacing="0" cellpadding="0" width="100%" border="0" background="'.$this->imgroot.'vert-grad.png">
262 <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>
263 <td width="100%" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
264 <td valign="top" width="10" background="'.$this->imgroot.'box-topright.png"><img src="'.$this->imgroot.'clear.png" width="10" height="20" /></td>
268 <table cellspacing="2" cellpadding="2" width="100%" border="0">
272 <!-- Box Top End -->';
276 * boxMiddle() - Middle HTML box
278 * @param string Box title
279 * @param string The box background color
281 function boxMiddle($title) {
283 <!-- Box Middle Start -->
287 <td colspan="2" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
291 <!-- Box Middle End -->';
295 * boxBottom() - Bottom HTML box
297 * @param bool Whether to echo or return the results
299 function boxBottom() {
301 <!-- Box Bottom Start -->
308 <!-- Box Bottom End -->';
312 * boxGetAltRowStyle() - Get an alternating row style for tables
314 * @param int Row number
316 function boxGetAltRowStyle($i) {
318 return ' bgcolor="#EAEAEA"';
320 return ' bgcolor="#E0E0E0"';
325 * listTableTop() - Takes an array of titles and builds the first row of a new table.
327 * @param array The array of titles
328 * @param array The array of title links
330 function listTableTop ($title_arr,$links_arr=false) {
332 <table cellspacing="0" cellpadding="0" width="100%" border="0">
334 <!-- <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> -->
335 <td background="'.$this->imgroot.'box-grad.png">
336 <table width="100%" border="0" cellspacing="1" cellpadding="2">
339 $count=count($title_arr);
341 for ($i=0; $i<$count; $i++) {
343 <td style="text-align:center"><a class="sortbutton" href="'.util_make_url ($links_arr[$i]).'"><span style="color:'.
344 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></a></td>';
347 for ($i=0; $i<$count; $i++) {
349 <td style="text-align:center"><span style="color:'.
350 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></td>';
353 return $return.'</tr>';
356 function listTableBottom() {
357 return '</table></td>
358 <!-- <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> -->
362 function outerTabs($params) {
363 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
367 if ($sys_use_trove) {
368 $TABS_DIRS[]='/softwaremap/';
370 if ($sys_use_snippet) {
371 $TABS_DIRS[]='/snippet/';
373 if ($sys_use_people) {
374 $TABS_DIRS[]='/people/';
376 $TABS_TITLES[]=_('Home');
377 $TABS_TITLES[]=_('My Page');
378 if ($sys_use_trove) {
379 $TABS_TITLES[]=_('Project Tree');
381 if ($sys_use_snippet) {
382 $TABS_TITLES[]=_('Code Snippets');
384 if ($sys_use_people) {
385 $TABS_TITLES[]=_('Project Openings');
388 $PLUGIN_TABS_DIRS = Array();
389 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
390 $hookParams['TITLES'] = &$TABS_TITLES;
391 plugin_hook ("outermenu", $hookParams) ;
392 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
394 $user_is_super=false;
395 if (session_loggedin()) {
396 $projectmaster =& group_get_object(GROUP_IS_MASTER);
397 $projectstats =& group_get_object(GROUP_IS_STATS);
398 $permmaster =& $projectmaster->getPermission( session_get_user() );
399 $permstats =& $projectstats->getPermission( session_get_user() );
401 if ($permmaster->isAdmin()) {
403 $TABS_DIRS[]='/admin/';
404 $TABS_TITLES[]=_('Admin');
406 if ($permstats->isMember()) {
407 $TABS_DIRS[]='/reporting/';
408 $TABS_TITLES[]=_('Reporting');
411 if(isset($params['group']) && $params['group']) {
412 // get group info using the common result set
413 $project =& group_get_object($params['group']);
414 if ($project && is_object($project)) {
415 if ($project->isError()) {
417 } elseif (!$project->isProject()) {
420 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
421 $TABS_DIRS[]='/project/?group_id='. $params['group'];
423 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
425 $TABS_TITLES[]=$project->getPublicName();
426 $selected=count($TABS_DIRS)-1;
429 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ||
430 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
431 $selected=array_search("/my/", $TABS_DIRS);
432 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
433 $selected=array_search("/softwaremap/", $TABS_DIRS);
434 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
435 $selected=array_search("/snippet/", $TABS_DIRS);
436 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
437 $selected=array_search("/people/", $TABS_DIRS);
438 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
439 $selected=array_search('/reporting/',$TABS_DIRS);
440 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
441 $selected=array_search('/admin/',$TABS_DIRS);
445 if (!$this->COLOR_SELECTED_TAB) {
446 $this->COLOR_SELECTED_TAB= '#e0e0e0';
448 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
453 * projectTabs() - Prints out the project tabs, contained here in case
454 * we want to allow it to be overriden
456 * @param string Is the tab currently selected
457 * @param string Is the group we should look up get title info
459 function projectTabs($toptab,$group) {
460 // get group info using the common result set
461 $project =& group_get_object($group);
462 if (!$project || !is_object($project)) {
465 if ($project->isError()) {
466 //wasn't found or some other problem
469 if (!$project->isProject()) {
474 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
475 $TABS_DIRS[]='/project/?group_id='. $group;
477 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
479 $TABS_TITLES[]=_('Summary');
480 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
483 $perm =& $project->getPermission( session_get_user() );
484 if ($perm->isAdmin()) {
485 $TABS_DIRS[]='/project/admin/?group_id='. $group;
486 $TABS_TITLES[]=_('Admin');
487 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
490 $TABS_DIRS[]='http://'. $project->getHomePage();
491 $TABS_TITLES[]=_('Home Page');
494 // Project Activity tab
495 $TABS_DIRS[]='/activity/?group_id='. $group;
496 $TABS_TITLES[]=_('Activity');
497 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
500 if ($project->usesForum()) {
501 $TABS_DIRS[]='/forum/?group_id='.$group;
502 $TABS_TITLES[]=_('Forums');
503 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
507 if ($project->usesTracker()) {
508 $TABS_DIRS[]='/tracker/?group_id='.$group;
509 $TABS_TITLES[]=_('Tracker');
510 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
511 ? $selected=(count($TABS_TITLES)-1) : '' );
515 if ($project->usesMail()) {
516 $TABS_DIRS[]='/mail/?group_id='.$group;
517 $TABS_TITLES[]=_('Lists');
518 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
522 if ($project->usesPm()) {
523 $TABS_DIRS[]='/pm/?group_id='.$group;
524 $TABS_TITLES[]=_('Tasks');
525 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
529 if ($project->usesDocman()) {
530 $TABS_DIRS[]='/docman/?group_id='.$group;
531 $TABS_TITLES[]=_('Docs');
532 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
536 if ($project->usesSurvey()) {
537 $TABS_DIRS[]='/survey/?group_id='.$group;
538 $TABS_TITLES[]=_('Surveys');
539 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
543 if ($project->usesNews()) {
544 $TABS_DIRS[]='/news/?group_id='.$group;
545 $TABS_TITLES[]=_('News');
546 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
550 if ($project->usesSCM()) {
551 $TABS_DIRS[]='/scm/?group_id='.$group;
552 $TABS_TITLES[]=_('SCM');
553 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
556 // groupmenu_after_scm hook
557 $hookParams['DIRS'] = &$TABS_DIRS;
558 $hookParams['TITLES'] = &$TABS_TITLES;
559 $hookParams['toptab'] = &$toptab;
560 $hookParams['selected'] = &$selected;
561 $hookParams['group_id'] = $group ;
563 plugin_hook ("groupmenu_scm", $hookParams) ;
566 if ($project->usesFRS()) {
567 $TABS_DIRS[]='/frs/?group_id='.$group;
568 $TABS_TITLES[]=_('Files');
569 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
573 $hookParams['DIRS'] = &$TABS_DIRS;
574 $hookParams['TITLES'] = &$TABS_TITLES;
575 $hookParams['toptab'] = &$toptab;
576 $hookParams['selected'] = &$selected;
577 $hookParams['group'] = $group;
579 plugin_hook ("groupmenu", $hookParams) ;
581 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
585 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
586 $count=count($TABS_DIRS);
587 $width=intval((100/$count));
593 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
596 $folder = $this->imgroot.($nested ? 'bottomtab-new/' : 'toptab-new/');
598 for ($i=0; $i<$count; $i++) {
599 if ($selected == $i) {
600 $left_img = $folder.'selected-left.gif';
601 $middle_img = $folder.'selected-middle.gif';
602 $right_img = $folder.'selected-right.gif';
603 $separ_img = $folder.'selected-separator.gif';
604 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
606 $left_img = $folder.'left.gif';
607 $middle_img = $folder.'middle.gif';
608 $right_img = $folder.'right.gif';
609 $separ_img = $folder.'separator.gif';
610 $css_class = $nested ? 'bottomTab' : 'topTab';
613 $clear_img = $this->imgroot.'clear.png';
616 $tab_height = BOTTOM_TAB_HEIGHT;
618 '<td valign="top" width="5" background="%s">
619 <img src="%s" height="%d" width="5" alt="" />
620 </td>', $middle_img, $clear_img, $tab_height );
622 '<td background="%s" width="'.$width.'%%" style="text-align:center">
623 <a class="%s" href="%s">%s</a>
624 </td>', $middle_img, $css_class, util_make_url ($TABS_DIRS[$i]), $TABS_TITLES[$i]);
626 // if the next tab is not last, insert a separator
629 '<td valign="top" width="2" background="%s">
630 <img src="%s" height="%d" width="2" alt="" />
631 </td>', $separ_img, $clear_img, $tab_height );
635 $tab_height = TOP_TAB_HEIGHT;
638 '<td valign="top" width="3" background="%s">
639 <img src="%s" height="%d" width="3" alt="" />
640 </td>', $left_img, $clear_img, $tab_height );
643 '<td background="%s" width="'.$width.'%%" style="text-align:center">
644 <a class="%s" href="%s">%s</a>
645 </td>', $middle_img, $css_class, util_make_url ($TABS_DIRS[$i]), $TABS_TITLES[$i]);
647 // if the next tab is not selected, close this tab
648 if ($selected != $i+1) {
650 '<td valign="top" width="9" background="%s">
651 <img src="%s" height="%d" width="9" alt="" />
652 </td>', $right_img, $clear_img, $tab_height );
658 // Building a bottom row in this table, which will be darker
661 if ($selected == 0) {
663 $end_cols=((count($TABS_DIRS)*3)-3);
664 } elseif ($selected == (count($TABS_DIRS)-1)) {
665 $beg_cols=((count($TABS_DIRS)*3)-3);
668 $beg_cols=($selected*3);
669 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
676 '<td colspan="'.$beg_cols.'" height="1" bgcolor="#909090">
677 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
681 '<td colspan="3" height="1" bgcolor="'.$sel_tab_bgcolor.'">
682 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
686 '<td colspan="'.$end_cols.'" height="1" bgcolor="#909090">
687 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
701 function searchBox() {
702 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
704 if(get_magic_quotes_gpc()) {
705 $defaultWords = stripslashes($words);
707 $defaultWords = $words;
710 // if there is no search currently, set the default
711 if ( ! isset($type_of_search) ) {
716 <form action="'.util_make_url ('/search/').'" method="get">
717 <table border="0" cellpadding="0" cellspacing="0">
719 <div align="center" style="font-size:smaller">';
721 SEARCH__PARAMETER_GROUP_ID => $group_id,
722 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
723 SEARCH__PARAMETER_FORUM_ID => $forum_id,
724 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
727 $searchManager =& getSearchManager();
728 $searchManager->setParametersValues($parameters);
729 $searchEngines =& $searchManager->getAvailableSearchEngines();
731 echo '<select name="type_of_search">';
732 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
733 $searchEngine =& $searchEngines[$i];
734 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
736 echo '</select></div>';
740 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
742 print '</td><td> ';
743 $parameters = $searchManager->getParameters();
744 foreach($parameters AS $name => $value) {
745 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
748 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
750 print '</td><td> </td><td>';
751 print '<input type="submit" name="Search" value="'._('Search').'" />';
754 if (isset($group_id) && $group_id) {
756 <td width="10"> </td>
757 <td>'.util_make_link ('/search/advanced_search.php?group_id='.$group_id, _('Advanced search')).'</td>';
759 print '</tr></table>';
764 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
765 // display the searchmask
767 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
768 <input type="hidden" name="search" value="1"/>
769 <input type="hidden" name="group_id" value="'.$group_id.'"/>
770 <div align="center"><br />
774 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
775 <input type="submit" name="submitbutton" value="'._('Search').'" />
780 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
783 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
786 </table><br /></div>'
787 .$this->createUnderSections($sectionsArray).'
791 //create javascript methods for select none/all
793 <script type="text/javascript">
794 <!-- method for disable/enable checkboxes
795 function setCheckBoxes(parent, checked) {
798 for (var i = 0; i < document.advancedsearch.elements.length; i++)
799 if (document.advancedsearch.elements[i].type == "checkbox")
800 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
801 document.advancedsearch.elements[i].checked = checked;
809 function createUnderSections($sectionsArray) {
810 global $group_subsection_names;
812 foreach ($sectionsArray as $section) {
813 if(is_array($section)) {
814 $countLines += (3 + count ($section));
816 //2 lines one for section name and one for checkbox
820 $breakLimit = round($countLines/3);
821 $break = $breakLimit;
824 <table width="99%" border="0" cellspacing="0" cellpadding="1" style="background-color:'. $this->COLOR_LTBACK2.'">
827 <table width="100%" cellspacing="0" border="0" style="background-color:'. $this->COLOR_LTBACK1.'">
828 <tr style="font-weight: bold;background-color:'. $this->COLOR_LTBACK2 .'">
829 <td colspan="2">'._('Search in').'</td>
830 <td style="text-align:right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
833 <td colspan="3"> </td>
835 <tr align="center" valign="top">
837 foreach($sectionsArray as $key => $section) {
838 $oldcountlines = $countLines;
839 if (is_array($section)) {
840 $countLines += (3 + count ($section));
845 if ($countLines >= $break) {
846 //if the next block is so large that shifting it to the next column hits the breakpoint better
847 //the second part of statement (behind &&) proofs, that no 4th column is added
848 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
849 $return .= '</td><td>';
850 $break += $breakLimit;
854 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0" style="background-color:'. $this->COLOR_LTBACK2.'">
855 <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
856 <tr style="background-color:'. $this->COLOR_LTBACK2 .'; font-weight: bold">
858 <a href="#'.$key.'">'.$group_subsection_names[$key].'</a>'
860 <td style="text-align:right">'
861 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
864 <tr style="background-color:'. $this->COLOR_LTBACK1.'">
867 if (!is_array($section)) {
868 $return .= ' <input type="checkbox" name="'.urlencode($key).'"';
869 if (isset($GLOBALS[urlencode($key)]))
870 $return .= ' checked="checked" ';
871 $return .= ' /></input>'.$group_subsection_names[$key].'<br />';
874 foreach($section as $underkey => $undersection) {
875 $return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
876 if (isset($GLOBALS[urlencode($key.$underkey)]))
877 $return .= ' checked ';
878 $return .= '></input>'.$undersection.'<br />';
884 </table></td></tr></table><br />';
886 if ($countLines >= $break) {
887 if (($countLines - $break) < ($break - $countLines)) {
888 $return .= '</td><td width="33%">';
889 $break += $breakLimit;
894 return $return.' </td>
896 </table></td></tr></table>';
900 * beginSubMenu() - Opening a submenu.
902 * @return string Html to start a submenu.
904 function beginSubMenu () {
911 * endSubMenu() - Closing a submenu.
913 * @return string Html to end a submenu.
915 function endSubMenu () {
916 $return = '</strong></p>';
921 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
923 * @param array The array of titles.
924 * @param array The array of title links.
925 * @return string Html to build a submenu.
927 function printSubMenu ($title_arr,$links_arr) {
928 $count=count($title_arr);
933 for ($i=0; $i<$count; $i++) {
934 $return .= util_make_link ($links_arr[$i], $title_arr[$i]) . ' | ';
936 $return .= util_make_link ($links_arr[$i], $title_arr[$i]);
941 * subMenu() - Takes two array of titles and links and build a menu.
943 * @param array The array of titles.
944 * @param array The array of title links.
945 * @return string Html to build a submenu.
947 function subMenu ($title_arr,$links_arr) {
948 $return = $this->beginSubMenu () ;
949 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
950 $return .= $this->endSubMenu () ;
955 * multiTableRow() - create a mutlilevel row in a table
957 * @param string the row attributes
958 * @param array the array of cell data, each element is an array,
959 * the first item being the text,
960 * the subsequent items are attributes (dont include
961 * the bgcolor for the title here, that will be
962 * handled by $istitle
963 * @param boolean is this row part of the title ?
966 function multiTableRow($row_attr, $cell_data, $istitle) {
970 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
973 for ( $c = 0; $c < count($cell_data); $c++ ) {
975 for ( $a=1; $a < count($cell_data[$c]); $a++) {
976 $return .= $cell_data[$c][$a].' ';
980 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
982 $return .= $cell_data[$c][0];
984 $return .='</strong></font>';
996 * feedback() - returns the htmlized feedback string when an action is performed.
998 * @param string feedback string
999 * @return string htmlized feedback
1001 function feedback($feedback) {
1006 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
1011 * getThemeIdFromName()
1013 * @param string the dirname of the theme
1014 * @return integer the theme id
1016 function getThemeIdFromName($dirname) {
1017 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
1018 return db_result($res,0,'theme_id');
1025 // c-file-style: "bsd"