5 * SourceForge: Breaking Down the Barriers to Open Source Development
6 * Copyright 1999-2001 (c) VA Linux Systems
7 * http://sourceforge.net
11 class Theme extends Layout {
14 * Theme() - Constructor
20 // The root location for images
21 $this->imgroot = '/themes/gforge/images/';
23 // The content background color
25 $this->COLOR_CONTENT_BACK= 'white';
27 // The background color
28 $this->COLOR_BACK= '#FFFFFF';
30 // The primary light background color
32 $this->COLOR_LTBACK1= '#FFEDCF';
34 // The secondary light background color
35 $this->COLOR_LTBACK2= '#E0E0E0';
37 // The HTML box title color
38 $this->COLOR_HTMLBOX_TITLE = '#F57900';
40 // The HTML box background color
41 $this->COLOR_HTMLBOX_BACK = '#FFEDCF';
43 // Font Face Constants
45 $this->FONT_CONTENT = 'Helvetica';
46 // The HTML box title font
47 $this->FONT_HTMLBOX_TITLE = 'Helvetica';
48 // The HTML box title font color
49 $this->FONTCOLOR_HTMLBOX_TITLE = '#C6BCBF';
50 // The content font color
51 $this->FONTCOLOR_CONTENT = '#000000';
53 $this->FONTSIZE='small';
54 //The smaller font size
55 $this->FONTSIZE_SMALLER='x-small';
56 //The smallest font size
57 $this->FONTSIZE_SMALLEST='xx-small';
58 //The HTML box title font size
59 $this->FONTSIZE_HTMLBOX_TITLE = 'small';
64 * header() - "steel theme" top of page
66 * @param array Header parameters array
68 function header($params) {
69 if (!$params['title']) {
70 $params['title'] = "FusionForge";
72 $params['title'] = "FusionForge: " . $params['title'];
74 echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
76 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
77 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo _('en') ?>" lang="<?php echo _('en') ?>">
79 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
80 <title><?php echo $params['title']; ?></title>
81 <?php $this->headerLink(); ?>
82 <link rel="stylesheet" type="text/css" href="<?php echo util_make_uri ('/themes/lite/css/theme.css'); ?>" />
83 <script type="text/javascript">
85 function help_window(helpurl) {
86 HelpWin = window.open( '<?php echo ((session_issecure()) ? 'https://'.
87 $GLOBALS['sys_default_domain'] : 'http://'.$GLOBALS['sys_default_domain']); ?>' + helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
90 <?php plugin_hook ("javascript",false) ; ?>
93 if (_('default_font') != 'default_font') {
94 $site_fonts = _('default_font');
96 $site_fonts = 'helvetica' ;
100 <style type="text/css">
102 OL,UL,P,BODY,TD,TR,TH,FORM { font-family: <?php echo $site_fonts; ?>; font-size:<?php echo $this->FONTSIZE; ?>; color: <?php echo $this->FONTCOLOR_CONTENT ?>; }
104 H1 { font-size: x-large; font-family: <?php echo $site_fonts; ?>; }
105 H2 { font-size: large; font-family: <?php echo $site_fonts; ?>; }
106 H3 { font-size: medium; font-family: <?php echo $site_fonts; ?>; }
107 H4 { font-size: small; font-family: <?php echo $site_fonts; ?>; }
108 H5 { font-size: x-small; font-family: <?php echo $site_fonts; ?>; }
109 H6 { font-size: xx-small; font-family: <?php echo $site_fonts; ?>; }
111 PRE,TT { font-family: courier,sans-serif }
119 <table border="0px" width="100%" cellspacing="0px" cellpadding="0px" class="content">
122 <td><a href="<?php echo util_make_url ('/'); ?>"><img src="/themes/lite/images/gforge_logo.png" border="0" alt="Gforge Logo" width="200px" /></a></td>
123 <td align="right"><?php echo $this->searchBox(); ?></td>
124 <td align="right"><?php
125 if (session_loggedin()) {
126 $u =& user_get_object(user_getid());
127 echo util_make_link ('/account/logout.php', sprintf("%s (%s)", _('Log Out'), $u->getRealName()));
129 echo util_make_link ('/account/',_('My Account')); ?><br /><?php
131 echo util_make_link ('/account/login.php',_('Login')); ?><br /><?php
132 echo util_make_link ('/account/register.php',_('New Account')); ?><br /><?php
136 <td> </td>
143 <?php echo $this->mainMenu($params); ?>
145 <!-- Inner Tabs / Shell -->
149 if (isset($params['group']) && $params['group']) {
151 <div class="union_menu" >
154 echo $this->projectTabs($params['toptab'],$params['group']);
162 <div class="content">
167 function footer($params) {
171 <!-- end main body row -->
174 <!-- end inner body row -->
175 </div> <!-- end of content -->
176 <!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
179 <a href="http://fusionforge.org/"><img src="<?php echo util_make_uri ('/images/pow-fusionforge.png'); ?>" alt="Powered By FusionForge" border="0" /></a>
191 * boxTop() - Top HTML box
193 * @param string Box title
194 * @param bool Whether to echo or return the results
195 * @param string The box background color
197 function boxTop($title) {
199 <table cellspacing="0" cellpadding="1" width="100%" border="0" bgcolor="' .$this->COLOR_HTMLBOX_TITLE.'">
201 <table cellspacing="0" cellpadding="2" width="100%" border="0" bgcolor="'. $this->COLOR_HTMLBOX_BACK.'">
202 <tr bgcolor="'.$this->COLOR_HTMLBOX_TITLE.'" align="center">
203 <td colspan="2"><span class=titlebar>'.$title.'</span></td>
210 * boxMiddle() - Middle HTML box
212 * @param string Box title
213 * @param string The box background color
215 function boxMiddle($title) {
219 <tr bgcolor="'.$this->COLOR_HTMLBOX_TITLE.'" align="center">
220 <td colspan="2"><SPAN class=titlebar>'.$title.'</span></td>
222 <tr align=left bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
227 * boxGetAltRowStyle() - Get an alternating row style for tables
229 * @param int Row number
231 function boxGetAltRowStyle($i) {
233 return ' BGCOLOR="#FFFFFF"';
235 return ' BGCOLOR="' . $this->COLOR_LTBACK1 . '"';
240 * boxBottom() - Bottom HTML box
242 * @param bool Whether to echo or return the results
244 function boxBottom() {
253 function mainMenu($params) {
254 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
258 if ($sys_use_trove) {
259 $TABS_DIRS[]='/softwaremap/';
261 if ($sys_use_snippet) {
262 $TABS_DIRS[]='/snippet/';
264 if ($sys_use_people) {
265 $TABS_DIRS[]='/people/';
267 $TABS_TITLES[]=_('Home');
268 $TABS_TITLES[]=_('My Page');
269 if ($sys_use_trove) {
270 $TABS_TITLES[]=_('Projects');
272 if ($sys_use_snippet) {
273 $TABS_TITLES[]=_('Code Snippets');
275 if ($sys_use_people) {
276 $TABS_TITLES[]=_('Project Openings');
280 $PLUGIN_TABS_DIRS = Array();
281 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
282 $hookParams['TITLES'] = &$TABS_TITLES;
283 plugin_hook ("outermenu", $hookParams) ;
284 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
286 if (user_ismember(1,'A')) {
287 $TABS_DIRS[]='/admin/';
288 $TABS_TITLES[]=_('Admin');
290 if (user_ismember($GLOBALS['sys_stats_group'])) {
291 $TABS_DIRS[]='/reporting/';
292 $TABS_TITLES[]=_('Reporting');
294 if(isset($params['group']) && $params['group']) {
295 // get group info using the common result set
296 $project =& group_get_object($params['group']);
297 if ($project && is_object($project)) {
298 if ($project->isError()) {
300 } elseif (!$project->isProject()) {
303 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
304 $TABS_DIRS[]='/project/?group_id='. $params['group'];
306 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
308 $TABS_TITLES[]=$project->getPublicName();
309 $selected=count($TABS_DIRS)-1;
312 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') || strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
313 $selected=array_search("/my/", $TABS_DIRS);
314 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
315 $selected=array_search("/softwaremap/", $TABS_DIRS);
316 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
317 $selected=array_search("/snippet/", $TABS_DIRS);
318 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
319 $selected=array_search("/people/", $TABS_DIRS);
320 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
321 $selected=array_search('/reporting/',$TABS_DIRS);
322 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && user_ismember(1,'A')) {
323 $selected=array_search('/admin/',$TABS_DIRS);
324 } elseif (count($PLUGIN_TABS_DIRS)>0) {
325 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
326 if (strstr($GLOBALS['REQUEST_URI'],$PLUGIN_TABS_DIRS_VALUE)) {
327 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
334 if (!isset($this->COLOR_SELECTED_TAB)) {
335 $this->COLOR_SELECTED_TAB= '#e0e0e0';
337 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
340 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
342 $count=count($TABS_DIRS);
343 $width=intval((100/$count));
352 <div class='".$inner."'>";
354 for ($i=0; $i<$count; $i++) {
355 $wassel=($selected==$i-1);
356 $issel=($selected==$i);
358 <a class="'. (($issel)?'tabsellink':'tablink') .'" href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a>';
360 // Last graphic on right-side
364 // Building a bottom row in this table, which will be darker
366 if ($selected == 0) {
368 $end_cols=((count($TABS_DIRS)*3)-3);
369 } elseif ($selected == (count($TABS_DIRS)-1)) {
370 $beg_cols=((count($TABS_DIRS)*3)-3);
373 $beg_cols=($selected*3);
374 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
377 return $return.'</div>
385 // c-file-style: "bsd"