3 require_once('www/include/Layout.class.php');
5 define('THEME_DIR', $GLOBALS['sys_urlprefix'].'/themes/gforge');
7 define('TOP_TAB_HEIGHT', 30);
8 define('BOTTOM_TAB_HEIGHT', 22);
11 'user' => 'ug_user.html',
12 'login' => 'ug_getting_started_login.html',
13 'trove' => 'ug_sitewide_trove.html',
14 'snippet' => 'ug_sitewide_snippet.html',
15 'people' => 'ug_sitewide_project_help.html',
16 'home' => 'ug_project.html',
17 'admin' => 'ug_project_project_admin.html',
18 'activity' => 'ug_project_activity.html',
19 'forums' => 'ug_project_forums.html',
20 'tracker' => 'ug_project_tracker.html',
21 'mail' => 'ug_project_mailing_lists.html',
22 'pm' => 'ug_project_task_manager.html',
23 'docman' => 'ug_project_docman.html',
24 'surveys' => 'ug_project_surveys.html',
25 'news' => 'ug_project_news.html',
26 'scm' => 'ug_project_subversion.html',
27 'frs' => 'ug_project_file_releases.html',
28 'wiki' => 'ug_project_wiki.html',
31 class Theme extends Layout {
37 $this->imgroot = THEME_DIR.'/images/';
38 $this->COLOR_CONTENT_BACK= '#ffffff';
39 $this->COLOR_LTBACK1= '#eeeeef';
40 $this->COLOR_LTBACK2= '#fafafa';
41 $this->COLOR_SELECTED_TAB= '#e0e0e0';
42 $this->COLOR_HTMLBOX_TITLE = '#bbbbbb';
43 $this->COLOR_HTMLBOX_BACK = '#eaecef';
44 $this->FONT_CONTENT = 'helvetica';
45 $this->FONT_HTMLBOX_TITLE = 'helvetica';
46 $this->FONTCOLOR_HTMLBOX_TITLE = '#333333';
47 $this->FONTCOLOR_CONTENT = '#333333';
48 $this->FONTSIZE = 'small';
49 $this->FONTSIZE_SMALLER='x-small';
50 $this->FONTSIZE_SMALLEST='xx-small';
51 $this->FONTSIZE_HTMLBOX_TITLE = 'small';
52 $this->bgpri = array();
56 * Layout() - Constructor
60 // Constructor for parent class...
61 if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
62 $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
66 Set up the priority color array one time only
68 $bgpri[1] = '#dadada';
69 $bgpri[2] = '#dacaca';
70 $bgpri[3] = '#dababa';
71 $bgpri[4] = '#daaaaa';
72 $bgpri[5] = '#da8a8a';
74 //determine font for this platform
75 if (browser_is_windows() && browser_is_ie()) {
77 //ie needs smaller fonts
78 $this->FONTSIZE='x-small';
79 $this->FONTSIZE_SMALLER='xx-small';
80 $this->FONTSIZE_SMALLEST='7pt';
82 } else if (browser_is_windows()) {
85 $this->FONTSIZE='small';
86 $this->FONTSIZE_SMALLER='x-small';
87 $this->FONTSIZE_SMALLEST='x-small';
89 } else if (browser_is_mac()){
91 //mac users need bigger fonts
92 $this->FONTSIZE='medium';
93 $this->FONTSIZE_SMALLER='small';
94 $this->FONTSIZE_SMALLEST='x-small';
98 //linux and other users
99 $this->FONTSIZE='small';
100 $this->FONTSIZE_SMALLER='x-small';
101 $this->FONTSIZE_SMALLEST='xx-small';
105 $this->FONTSIZE_HTMLBOX_TITLE = $this->FONTSIZE;
109 * createLinkToUserHome() - Creates a link to a user's home page
111 * @param string The user's user_name
112 * @param string The user's realname
114 function createLinkToUserHome($user_name, $realname) {
115 return util_make_link ('/users/'.$user_name, $realname);
119 * header() - "steel theme" top of page
121 * @param array Header parameters array
123 function header($params) {
124 if (!$params['title']) {
125 $params['title'] = $GLOBALS['sys_name'];
127 $params['title'] = $GLOBALS['sys_name'] . ': ' . $params['title'];
130 print '<?xml version="1.0" encoding="utf-8"?>';
134 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
135 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
137 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo _('en'); ?>">
140 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
141 <title><?php echo $params['title']; ?></title>
142 <link rel="icon" type="image/png" href="<?php echo $this->imgroot; ?>icon.png"/>
143 <link rel="shortcut icon" href="<?php echo $this->imgroot; ?>icon.png"/>
144 <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"/>
145 <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"/>
146 <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"/>
148 <script language="JavaScript" type="text/javascript">
151 function admin_window(adminurl) {
152 AdminWin = window.open( adminurl, 'AdminWindow','scrollbars=yes,resizable=yes, toolbar=yes, height=400, width=400, top=2, left=2');
155 function help_window(helpurl) {
156 HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=600');
159 <?php plugin_hook ("javascript",false) ; ?>
162 if (_('default_font') != 'default_font') {
163 $site_fonts = _('default_font');
165 $site_fonts = 'helvetica' ;
176 $this->bodyHeader($params);
179 function bodyHeader($params){
184 <table border="0" width="100%" cellspacing="0" cellpadding="0">
186 <td class="topLeft"><?php echo util_make_link ('/', html_image('header/top-logo.gif',205,54,array('border'=>'0'))); ?></td>
187 <td class="middleRight"><?php echo $this->searchBox(); ?></td>
188 <td class="middleRight"><?php
189 if (session_loggedin()) {
190 echo util_make_link ('/account/logout.php', _('Log Out'));
192 echo util_make_link ('/account/', _('My Account'));
194 echo util_make_link ('/account/login.php', _('Log In'));
196 echo util_make_link ('/account/register.php', _('New Account'));
199 $guide = $GLOBALS['sys_urlprefix'].'/help/guide/';
200 if (strstr($_SERVER['REQUEST_URI'],'softwaremap')) {
201 $guide .= $user_guide['trove'];
202 } elseif (strstr($_SERVER['REQUEST_URI'],'/my/')) {
203 $guide .= $user_guide['user'];
204 } elseif (strstr($_SERVER['REQUEST_URI'],'/account/login.php')) {
205 $guide .= $user_guide['login'];
206 } elseif (strstr($_SERVER['REQUEST_URI'],'/account/')) {
207 $guide .= $user_guide['user'];
208 } elseif (strstr($_SERVER['REQUEST_URI'],'/snippet/')) {
209 $guide .= $user_guide['snippet'];
210 } elseif (strstr($_SERVER['REQUEST_URI'],'/people/')) {
211 $guide .= $user_guide['people'];
212 } elseif (isset($params['toptab']) && isset($user_guide[ $params['toptab'] ])) {
213 $guide .= $user_guide[ $params['toptab'] ];
215 $guide .= 'index.html';
219 <a href="javascript:help_window('<?php echo $guide ?>')"><?php echo _('Get Help'); ?></a>
221 echo $this->quickNav();
223 <td> </td>
230 <table border="0" width="100%" cellspacing="0" cellpadding="0">
232 <td><?php echo $this->outerTabs($params); ?></td>
237 <table border="0" width="100%" cellspacing="0" cellpadding="0">
239 if (isset($params['group']) && $params['group']) {
244 echo $this->projectTabs($params['toptab'],$params['group']);
253 <table border="0" width="100%" cellspacing="0" cellpadding="0">
255 <td class="mainCanvas"> <!-- main body area -->
259 function footer($params) {
261 </td> <!-- end main body area -->
265 <!-- PLEASE LEAVE "Powered By GForge" on your site -->
268 <a href="http://gforge.org/"><img src="/images/pow-gforge.png" alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
272 global $sys_show_source;
273 if ($sys_show_source) {
275 print util_make_link ('/source.php?file=' . $SCRIPT_NAME, _('Show source'), array ("class" => "showsource"));
286 function headerCSS(){
288 <link rel="stylesheet" type="text/css" href="<?php echo THEME_DIR ?>/css/theme.css" />
290 plugin_hook ('cssfile',$this);
293 function getRootIndex() {
294 return $this->rootindex;
298 * boxTop() - Top HTML box
300 * @param string Box title
301 * @param bool Whether to echo or return the results
302 * @param string The box background color
304 function boxTop($title) {
306 <!-- Box Top Start -->
308 <table cellspacing="0" cellpadding="0" width="100%" border="0" background="'.$this->imgroot.'vert-grad.png">
310 <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>
311 <td width="100%" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
312 <td valign="top" width="10" background="'.$this->imgroot.'box-topright.png"><img src="'.$this->imgroot.'clear.png" width="10" height="20" /></td>
316 <table cellspacing="2" cellpadding="2" width="100%" border="0">
320 <!-- Box Top End -->';
324 * boxMiddle() - Middle HTML box
326 * @param string Box title
327 * @param string The box background color
329 function boxMiddle($title) {
331 <!-- Box Middle Start -->
335 <td colspan="2" background="'.$this->imgroot.'box-grad.png"><span class="titlebar">'.$title.'</span></td>
339 <!-- Box Middle End -->';
343 * boxBottom() - Bottom HTML box
345 * @param bool Whether to echo or return the results
347 function boxBottom() {
349 <!-- Box Bottom Start -->
356 <!-- Box Bottom End -->';
360 * boxGetAltRowStyle() - Get an alternating row style for tables
362 * @param int Row number
364 function boxGetAltRowStyle($i) {
366 return ' bgcolor="#EAEAEA"';
368 return ' bgcolor="#E0E0E0"';
373 * listTableTop() - Takes an array of titles and builds the first row of a new table.
375 * @param array The array of titles
376 * @param array The array of title links
378 function listTableTop ($title_arr,$links_arr=false) {
380 <table cellspacing="0" cellpadding="0" width="100%" border="0">
382 <!-- <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> -->
383 <td background="'.$this->imgroot.'box-grad.png">
384 <table width="100%" border="0" cellspacing="1" cellpadding="2">
387 $count=count($title_arr);
389 for ($i=0; $i<$count; $i++) {
391 <td style="text-align:center"><a class="sortbutton" href="'.util_make_url ($links_arr[$i]).'"><span style="color:'.
392 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></a></td>';
395 for ($i=0; $i<$count; $i++) {
397 <td style="text-align:center"><span style="color:'.
398 $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></td>';
401 return $return.'</tr>';
404 function listTableBottom() {
405 return '</table></td>
406 <!-- <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> -->
410 function outerTabs($params) {
411 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
415 if ($sys_use_trove) {
416 $TABS_DIRS[]='/softwaremap/';
418 if ($sys_use_snippet) {
419 $TABS_DIRS[]='/snippet/';
421 if ($sys_use_people) {
422 $TABS_DIRS[]='/people/';
424 $TABS_TITLES[]=_('Home');
425 $TABS_TITLES[]=_('My Page');
426 if ($sys_use_trove) {
427 $TABS_TITLES[]=_('Project Tree');
429 if ($sys_use_snippet) {
430 $TABS_TITLES[]=_('Code Snippets');
432 if ($sys_use_people) {
433 $TABS_TITLES[]=_('Project Openings');
436 $PLUGIN_TABS_DIRS = Array();
437 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
438 $hookParams['TITLES'] = &$TABS_TITLES;
439 plugin_hook ("outermenu", $hookParams) ;
440 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
442 $user_is_super=false;
443 if (session_loggedin()) {
444 $projectmaster =& group_get_object(GROUP_IS_MASTER);
445 $projectstats =& group_get_object(GROUP_IS_STATS);
446 $permmaster =& $projectmaster->getPermission( session_get_user() );
447 $permstats =& $projectstats->getPermission( session_get_user() );
449 if ($permmaster->isAdmin()) {
451 $TABS_DIRS[]='/admin/';
452 $TABS_TITLES[]=_('Admin');
454 if ($permstats->isMember()) {
455 $TABS_DIRS[]='/reporting/';
456 $TABS_TITLES[]=_('Reporting');
459 if(isset($params['group']) && $params['group']) {
460 // get group info using the common result set
461 $project =& group_get_object($params['group']);
462 if ($project && is_object($project)) {
463 if ($project->isError()) {
465 } elseif (!$project->isProject()) {
468 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
469 $TABS_DIRS[]='/project/?group_id='. $params['group'];
471 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
473 $TABS_TITLES[]=$project->getPublicName();
474 $selected=count($TABS_DIRS)-1;
477 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') ||
478 strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
479 $selected=array_search("/my/", $TABS_DIRS);
480 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
481 $selected=array_search("/softwaremap/", $TABS_DIRS);
482 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
483 $selected=array_search("/snippet/", $TABS_DIRS);
484 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
485 $selected=array_search("/people/", $TABS_DIRS);
486 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
487 $selected=array_search('/reporting/',$TABS_DIRS);
488 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
489 $selected=array_search('/admin/',$TABS_DIRS);
493 if (!$this->COLOR_SELECTED_TAB) {
494 $this->COLOR_SELECTED_TAB= '#e0e0e0';
496 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
501 * projectTabs() - Prints out the project tabs, contained here in case
502 * we want to allow it to be overriden
504 * @param string Is the tab currently selected
505 * @param string Is the group we should look up get title info
507 function projectTabs($toptab,$group) {
508 // get group info using the common result set
509 $project =& group_get_object($group);
510 if (!$project || !is_object($project)) {
513 if ($project->isError()) {
514 //wasn't found or some other problem
517 if (!$project->isProject()) {
522 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
523 $TABS_DIRS[]='/project/?group_id='. $group;
525 $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
527 $TABS_TITLES[]=_('Summary');
528 (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
531 $perm =& $project->getPermission( session_get_user() );
532 if ($perm->isAdmin()) {
533 $TABS_DIRS[]='/project/admin/?group_id='. $group;
534 $TABS_TITLES[]=_('Admin');
535 (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
538 $TABS_DIRS[]='http://'. $project->getHomePage();
539 $TABS_TITLES[]=_('Home Page');
542 // Project Activity tab
543 $TABS_DIRS[]='/activity/?group_id='. $group;
544 $TABS_TITLES[]=_('Activity');
545 (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
548 if ($project->usesForum()) {
549 $TABS_DIRS[]='/forum/?group_id='.$group;
550 $TABS_TITLES[]=_('Forums');
551 (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
555 if ($project->usesTracker()) {
556 $TABS_DIRS[]='/tracker/?group_id='.$group;
557 $TABS_TITLES[]=_('Tracker');
558 (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
559 ? $selected=(count($TABS_TITLES)-1) : '' );
563 if ($project->usesMail()) {
564 $TABS_DIRS[]='/mail/?group_id='.$group;
565 $TABS_TITLES[]=_('Lists');
566 (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
570 if ($project->usesPm()) {
571 $TABS_DIRS[]='/pm/?group_id='.$group;
572 $TABS_TITLES[]=_('Tasks');
573 (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
577 if ($project->usesDocman()) {
578 $TABS_DIRS[]='/docman/?group_id='.$group;
579 $TABS_TITLES[]=_('Docs');
580 (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
584 if ($project->usesSurvey()) {
585 $TABS_DIRS[]='/survey/?group_id='.$group;
586 $TABS_TITLES[]=_('Surveys');
587 (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
591 if ($project->usesNews()) {
592 $TABS_DIRS[]='/news/?group_id='.$group;
593 $TABS_TITLES[]=_('News');
594 (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
598 if ($project->usesSCM()) {
599 $TABS_DIRS[]='/scm/?group_id='.$group;
600 $TABS_TITLES[]=_('SCM');
601 (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
604 // groupmenu_after_scm hook
605 $hookParams['DIRS'] = &$TABS_DIRS;
606 $hookParams['TITLES'] = &$TABS_TITLES;
607 $hookParams['toptab'] = &$toptab;
608 $hookParams['selected'] = &$selected;
609 $hookParams['group_id'] = $group ;
611 plugin_hook ("groupmenu_scm", $hookParams) ;
614 if ($project->usesFRS()) {
615 $TABS_DIRS[]='/frs/?group_id='.$group;
616 $TABS_TITLES[]=_('Files');
617 (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
621 $hookParams['DIRS'] = &$TABS_DIRS;
622 $hookParams['TITLES'] = &$TABS_TITLES;
623 $hookParams['toptab'] = &$toptab;
624 $hookParams['selected'] = &$selected;
625 $hookParams['group'] = $group;
627 plugin_hook ("groupmenu", $hookParams) ;
629 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
633 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
634 $count=count($TABS_DIRS);
635 $width=intval((100/$count));
641 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
644 $folder = $this->imgroot.($nested ? 'bottomtab-new/' : 'toptab-new/');
646 for ($i=0; $i<$count; $i++) {
647 if ($selected == $i) {
648 $left_img = $folder.'selected-left.gif';
649 $middle_img = $folder.'selected-middle.gif';
650 $right_img = $folder.'selected-right.gif';
651 $separ_img = $folder.'selected-separator.gif';
652 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
654 $left_img = $folder.'left.gif';
655 $middle_img = $folder.'middle.gif';
656 $right_img = $folder.'right.gif';
657 $separ_img = $folder.'separator.gif';
658 $css_class = $nested ? 'bottomTab' : 'topTab';
661 $clear_img = $this->imgroot.'clear.png';
664 $tab_height = BOTTOM_TAB_HEIGHT;
666 '<td valign="top" width="5" background="%s">
667 <img src="%s" height="%d" width="5" alt="" />
668 </td>', $middle_img, $clear_img, $tab_height );
670 '<td background="%s" width="'.$width.'%%" style="text-align:center">
671 <a class="%s" href="%s">%s</a>
672 </td>', $middle_img, $css_class, util_make_url ($TABS_DIRS[$i]), $TABS_TITLES[$i]);
674 // if the next tab is not last, insert a separator
677 '<td valign="top" width="2" background="%s">
678 <img src="%s" height="%d" width="2" alt="" />
679 </td>', $separ_img, $clear_img, $tab_height );
683 $tab_height = TOP_TAB_HEIGHT;
686 '<td valign="top" width="3" background="%s">
687 <img src="%s" height="%d" width="3" alt="" />
688 </td>', $left_img, $clear_img, $tab_height );
691 '<td background="%s" width="'.$width.'%%" style="text-align:center">
692 <a class="%s" href="%s">%s</a>
693 </td>', $middle_img, $css_class, util_make_url ($TABS_DIRS[$i]), $TABS_TITLES[$i]);
695 // if the next tab is not selected, close this tab
696 if ($selected != $i+1) {
698 '<td valign="top" width="9" background="%s">
699 <img src="%s" height="%d" width="9" alt="" />
700 </td>', $right_img, $clear_img, $tab_height );
706 // Building a bottom row in this table, which will be darker
709 if ($selected == 0) {
711 $end_cols=((count($TABS_DIRS)*3)-3);
712 } elseif ($selected == (count($TABS_DIRS)-1)) {
713 $beg_cols=((count($TABS_DIRS)*3)-3);
716 $beg_cols=($selected*3);
717 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
724 '<td colspan="'.$beg_cols.'" height="1" bgcolor="#909090">
725 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
729 '<td colspan="3" height="1" bgcolor="'.$sel_tab_bgcolor.'">
730 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
734 '<td colspan="'.$end_cols.'" height="1" bgcolor="#909090">
735 <img src="'.$this->imgroot.'clear.png" height="1" width="10" />
749 function searchBox() {
750 global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
752 if(get_magic_quotes_gpc()) {
753 $defaultWords = stripslashes($words);
755 $defaultWords = $words;
758 // if there is no search currently, set the default
759 if ( ! isset($type_of_search) ) {
764 <form action="/search/" method="get">
765 <table border="0" cellpadding="0" cellspacing="0">
767 <div align="center" style="font-size:smaller">';
769 SEARCH__PARAMETER_GROUP_ID => $group_id,
770 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
771 SEARCH__PARAMETER_FORUM_ID => $forum_id,
772 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
775 $searchManager =& getSearchManager();
776 $searchManager->setParametersValues($parameters);
777 $searchEngines =& $searchManager->getAvailableSearchEngines();
779 echo '<select name="type_of_search">';
780 for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
781 $searchEngine =& $searchEngines[$i];
782 echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
784 echo '</select></div>';
788 // <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
790 print '</td><td> ';
791 $parameters = $searchManager->getParameters();
792 foreach($parameters AS $name => $value) {
793 print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
796 print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
798 print '</td><td> </td><td>';
799 print '<input type="submit" name="Search" value="'._('Search').'" />';
802 if (isset($group_id) && $group_id) {
804 <td width="10"> </td>
805 <td>'.util_make_link ('/search/advanced_search.php?group_id='.$group_id, _('Advanced search')).'</td>';
807 print '</tr></table>';
812 function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
813 // display the searchmask
815 <form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
816 <input type="hidden" name="search" value="1"/>
817 <input type="hidden" name="group_id" value="'.$group_id.'"/>
818 <div align="center"><br />
822 <input type="text" size="60" name="words" value="'.stripslashes(htmlspecialchars($words)).'" />
823 <input type="submit" name="submitbutton" value="'._('Search').'" />
828 <input type="radio" name="mode" value="'.SEARCH__MODE_AND.'" '.($isExact ? 'checked="checked"' : '').' />'._('with all words').'
831 <input type="radio" name="mode" value="'.SEARCH__MODE_OR.'" '.(!$isExact ? 'checked="checked"' : '').' />'._('with one word').'
834 </table><br /></div>'
835 .$this->createUnderSections($sectionsArray).'
839 //create javascript methods for select none/all
841 <script type="text/javascript">
842 <!-- method for disable/enable checkboxes
843 function setCheckBoxes(parent, checked) {
846 for (var i = 0; i < document.advancedsearch.elements.length; i++)
847 if (document.advancedsearch.elements[i].type == "checkbox")
848 if (document.advancedsearch.elements[i].name.substr(0, parent.length) == parent)
849 document.advancedsearch.elements[i].checked = checked;
857 function createUnderSections($sectionsArray) {
858 global $group_subsection_names;
860 foreach ($sectionsArray as $section) {
861 if(is_array($section)) {
862 $countLines += (3 + count ($section));
864 //2 lines one for section name and one for checkbox
868 $breakLimit = round($countLines/3);
869 $break = $breakLimit;
872 <table width="99%" border="0" cellspacing="0" cellpadding="1" style="background-color:'. $this->COLOR_LTBACK2.'">
875 <table width="100%" cellspacing="0" border="0" style="background-color:'. $this->COLOR_LTBACK1.'">
876 <tr style="font-weight: bold;background-color:'. $this->COLOR_LTBACK2 .'">
877 <td colspan="2">'._('Search in').'</td>
878 <td style="text-align:right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
881 <td colspan="3"> </td>
883 <tr align="center" valign="top">
885 foreach($sectionsArray as $key => $section) {
886 $oldcountlines = $countLines;
887 if (is_array($section)) {
888 $countLines += (3 + count ($section));
893 if ($countLines >= $break) {
894 //if the next block is so large that shifting it to the next column hits the breakpoint better
895 //the second part of statement (behind &&) proofs, that no 4th column is added
896 if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
897 $return .= '</td><td>';
898 $break += $breakLimit;
902 $return .= '<table width="90%" border="0" cellpadding="1" cellspacing="0" style="background-color:'. $this->COLOR_LTBACK2.'">
903 <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
904 <tr style="background-color:'. $this->COLOR_LTBACK2 .'; font-weight: bold">
906 <a href="#'.$key.'">'.$group_subsection_names[$key].'</a>'
908 <td style="text-align:right">'
909 ._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
912 <tr style="background-color:'. $this->COLOR_LTBACK1.'">
915 if (!is_array($section)) {
916 $return .= ' <input type="checkbox" name="'.urlencode($key).'"';
917 if (isset($GLOBALS[urlencode($key)]))
918 $return .= ' checked="checked" ';
919 $return .= ' /></input>'.$group_subsection_names[$key].'<br />';
922 foreach($section as $underkey => $undersection) {
923 $return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
924 if (isset($GLOBALS[urlencode($key.$underkey)]))
925 $return .= ' checked ';
926 $return .= '></input>'.$undersection.'<br />';
932 </table></td></tr></table><br />';
934 if ($countLines >= $break) {
935 if (($countLines - $break) < ($break - $countLines)) {
936 $return .= '</td><td width="33%">';
937 $break += $breakLimit;
942 return $return.' </td>
944 </table></td></tr></table>';
948 * beginSubMenu() - Opening a submenu.
950 * @return string Html to start a submenu.
952 function beginSubMenu () {
959 * endSubMenu() - Closing a submenu.
961 * @return string Html to end a submenu.
963 function endSubMenu () {
964 $return = '</strong></p>';
969 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
971 * @param array The array of titles.
972 * @param array The array of title links.
973 * @return string Html to build a submenu.
975 function printSubMenu ($title_arr,$links_arr) {
976 $count=count($title_arr);
981 for ($i=0; $i<$count; $i++) {
982 $return .= util_make_link ($links_arr[$i], $title_arr[$i]) . ' | ';
984 $return .= util_make_link ($links_arr[$i], $title_arr[$i]);
989 * subMenu() - Takes two array of titles and links and build a menu.
991 * @param array The array of titles.
992 * @param array The array of title links.
993 * @return string Html to build a submenu.
995 function subMenu ($title_arr,$links_arr) {
996 $return = $this->beginSubMenu () ;
997 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
998 $return .= $this->endSubMenu () ;
1003 * multiTableRow() - create a mutlilevel row in a table
1005 * @param string the row attributes
1006 * @param array the array of cell data, each element is an array,
1007 * the first item being the text,
1008 * the subsequent items are attributes (dont include
1009 * the bgcolor for the title here, that will be
1010 * handled by $istitle
1011 * @param boolean is this row part of the title ?
1014 function multiTableRow($row_attr, $cell_data, $istitle) {
1018 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
1021 for ( $c = 0; $c < count($cell_data); $c++ ) {
1023 for ( $a=1; $a < count($cell_data[$c]); $a++) {
1024 $return .= $cell_data[$c][$a].' ';
1028 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
1030 $return .= $cell_data[$c][0];
1032 $return .='</strong></font>';
1044 * feedback() - returns the htmlized feedback string when an action is performed.
1046 * @param string feedback string
1047 * @return string htmlized feedback
1049 function feedback($feedback) {
1054 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
1059 * getThemeIdFromName()
1061 * @param string the dirname of the theme
1062 * @return integer the theme id
1064 function getThemeIdFromName($dirname) {
1065 $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
1066 return db_result($res,0,'theme_id');
1073 // c-file-style: "bsd"