5 * SourceForge: Breaking Down the Barriers to Open Source Development
6 * Copyright 1999-2001 (c) VA Linux Systems
7 * http://sourceforge.net
12 class Theme extends Layout {
15 * Theme() - Constructor
21 // The root location for images
22 $this->imgroot = '/themes/gforge/images/';
24 // The content background color
26 $this->COLOR_CONTENT_BACK= 'white';
28 // The background color
29 $this->COLOR_BACK= '#FFFFFF';
31 // The primary light background color
33 $this->COLOR_LTBACK1= '#FFEDCF';
35 // The secondary light background color
36 $this->COLOR_LTBACK2= '#E0E0E0';
38 // The HTML box title color
39 $this->COLOR_HTMLBOX_TITLE = '#F57900';
41 // The HTML box background color
42 $this->COLOR_HTMLBOX_BACK = '#FFEDCF';
44 // Font Face Constants
46 $this->FONT_CONTENT = 'Helvetica';
47 // The HTML box title font
48 $this->FONT_HTMLBOX_TITLE = 'Helvetica';
49 // The HTML box title font color
50 $this->FONTCOLOR_HTMLBOX_TITLE = '#C6BCBF';
51 // The content font color
52 $this->FONTCOLOR_CONTENT = '#000000';
53 //The smaller font size
54 $this->FONTSIZE_SMALLER='x-small';
55 //The smallest font size
56 $this->FONTSIZE_SMALLEST='xx-small';
57 //The HTML box title font size
58 $this->FONTSIZE_HTMLBOX_TITLE = 'small';
63 * header() - "steel theme" top of page
65 * @param array Header parameters array
67 function header($params) {
68 if (!$params['title']) {
69 $params['title'] = "GForge";
71 $params['title'] = "GForge: " . $params['title'];
73 echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
75 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
76 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo _('en') ?>">
78 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
79 <title><?php echo $params['title']; ?></title>
80 <link rel="stylesheet" type="text/css" href="<?php echo util_make_url ('/themes/lite/css/theme.css'); ?>" />
81 <script type="text/javascript">
83 function help_window(helpurl) {
84 HelpWin = window.open( '<?php echo ((session_issecure()) ? 'https://'.
85 $GLOBALS['sys_default_domain'] : 'http://'.$GLOBALS['sys_default_domain']); ?>' + helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
88 <?php plugin_hook ("javascript",false) ; ?>
91 if (_('default_font') != 'default_font') {
92 $site_fonts = _('default_font');
94 $site_fonts = 'helvetica' ;
98 <style type="text/css">
100 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 ?>; }
102 H1 { font-size: x-large; font-family: <?php echo $site_fonts; ?>; }
103 H2 { font-size: large; font-family: <?php echo $site_fonts; ?>; }
104 H3 { font-size: medium; font-family: <?php echo $site_fonts; ?>; }
105 H4 { font-size: small; font-family: <?php echo $site_fonts; ?>; }
106 H5 { font-size: x-small; font-family: <?php echo $site_fonts; ?>; }
107 H6 { font-size: xx-small; font-family: <?php echo $site_fonts; ?>; }
109 PRE,TT { font-family: courier,sans-serif }
117 <table border="0px" width="100%" cellspacing="0px" cellpadding="0px" class="content">
120 <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>
121 <td align="right"><?php echo $this->searchBox(); ?></td>
122 <td align="right"><?php
123 if (session_loggedin()) {
124 echo util_make_link ('/account/logout.php',_('Logout')); ?><br /><?php
125 echo util_make_link ('/account/',_('My Account')); ?><br /><?php
127 echo util_make_link ('/account/login.php',_('Login')); ?><br /><?php
128 echo util_make_link ('/account/register.php',_('New Account')); ?><br /><?php
132 <td> </td>
139 <?php echo $this->mainMenu($params); ?>
141 <!-- Inner Tabs / Shell -->
145 if ($params['group']) {
147 <div class="union_menu" >
150 echo $this->projectTabs($params['toptab'],$params['group']);
158 <div class="content">
163 function footer($params) {
167 <!-- end main body row -->
170 <!-- end inner body row -->
171 </div> <!-- end of content -->
172 <!-- PLEASE LEAVE "Powered By GForge" on your site -->
175 <a href="http://gforge.org/"><img src="<?php echo util_make_url ('/images/pow-gforge.png'); ?>" alt="Powered By GForge Collaborative Development En
176 vironment" border="0" /></a>
188 * boxTop() - Top HTML box
190 * @param string Box title
191 * @param bool Whether to echo or return the results
192 * @param string The box background color
194 function boxTop($title) {
196 <table cellspacing="0" cellpadding="1" width="100%" border="0" bgcolor="' .$this->COLOR_HTMLBOX_TITLE.'">
198 <table cellspacing="0" cellpadding="2" width="100%" border="0" bgcolor="'. $this->COLOR_HTMLBOX_BACK.'">
199 <tr bgcolor="'.$this->COLOR_HTMLBOX_TITLE.'" align="center">
200 <td colspan="2"><span class=titlebar>'.$title.'</span></td>
207 * boxMiddle() - Middle HTML box
209 * @param string Box title
210 * @param string The box background color
212 function boxMiddle($title) {
216 <tr bgcolor="'.$this->COLOR_HTMLBOX_TITLE.'" align="center">
217 <td colspan="2"><SPAN class=titlebar>'.$title.'</SPAN></td>
219 <tr align=left bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
224 * boxGetAltRowStyle() - Get an alternating row style for tables
226 * @param int Row number
228 function boxGetAltRowStyle($i) {
230 return ' BGCOLOR="#FFFFFF"';
232 return ' BGCOLOR="' . $this->COLOR_LTBACK1 . '"';
237 * boxBottom() - Bottom HTML box
239 * @param bool Whether to echo or return the results
241 function boxBottom() {
250 function mainMenu($params) {
251 global $sys_use_trove,$sys_use_snippet,$sys_use_people;
255 if ($sys_use_trove) {
256 $TABS_DIRS[]='/softwaremap/';
258 if ($sys_use_snippet) {
259 $TABS_DIRS[]='/snippet/';
261 if ($sys_use_people) {
262 $TABS_DIRS[]='/people/';
264 $TABS_TITLES[]=_('Home');
265 $TABS_TITLES[]=_('My Page');
266 if ($sys_use_trove) {
267 $TABS_TITLES[]=_('Project Tree');
269 if ($sys_use_snippet) {
270 $TABS_TITLES[]=_('Code Snippets');
272 if ($sys_use_people) {
273 $TABS_TITLES[]=_('Project Openings');
277 $PLUGIN_TABS_DIRS = Array();
278 $hookParams['DIRS'] = &$PLUGIN_TABS_DIRS;
279 $hookParams['TITLES'] = &$TABS_TITLES;
280 plugin_hook ("outermenu", $hookParams) ;
281 $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
283 if (user_ismember(1,'A')) {
284 $TABS_DIRS[]='/admin/';
285 $TABS_TITLES[]=_('Admin');
287 if (user_ismember($GLOBALS['sys_stats_group'])) {
288 $TABS_DIRS[]='/reporting/';
289 $TABS_TITLES[]=_('Reporting');
291 if(isset($params['group']) && $params['group']) {
292 // get group info using the common result set
293 $project =& group_get_object($params['group']);
294 if ($project && is_object($project)) {
295 if ($project->isError()) {
297 } elseif (!$project->isProject()) {
300 if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
301 $TABS_DIRS[]='/project/?group_id='. $params['group'];
303 $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
305 $TABS_TITLES[]=$project->getPublicName();
306 $selected=count($TABS_DIRS)-1;
309 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/my/') || strstr(getStringFromServer('REQUEST_URI'),'/account/') || strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
310 $selected=array_search("/my/", $TABS_DIRS);
311 } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
312 $selected=array_search("/softwaremap/", $TABS_DIRS);
313 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
314 $selected=array_search("/snippet/", $TABS_DIRS);
315 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
316 $selected=array_search("/people/", $TABS_DIRS);
317 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
318 $selected=array_search('/reporting/',$TABS_DIRS);
319 } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && user_ismember(1,'A')) {
320 $selected=array_search('/admin/',$TABS_DIRS);
321 } elseif (count($PLUGIN_TABS_DIRS)>0) {
322 foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
323 if (strstr($GLOBALS['REQUEST_URI'],$PLUGIN_TABS_DIRS_VALUE)) {
324 $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
331 if (!$this->COLOR_SELECTED_TAB) {
332 $this->COLOR_SELECTED_TAB= '#e0e0e0';
334 echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
337 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
339 $count=count($TABS_DIRS);
340 $width=intval((100/$count));
349 <div class='".$inner."'>";
351 for ($i=0; $i<$count; $i++) {
352 $wassel=($selected==$i-1);
353 $issel=($selected==$i);
355 <a class="'. (($issel)?'tabsellink':'tablink') .'" href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a>';
357 // Last graphic on right-side
361 // Building a bottom row in this table, which will be darker
363 if ($selected == 0) {
365 $end_cols=((count($TABS_DIRS)*3)-3);
366 } elseif ($selected == (count($TABS_DIRS)-1)) {
367 $beg_cols=((count($TABS_DIRS)*3)-3);
370 $beg_cols=($selected*3);
371 $end_cols=(((count($TABS_DIRS)*3)-3)-$beg_cols);
374 return $return.'</div>
382 // c-file-style: "bsd"