5 * Copyright (c) 2002-2003 Richard Offer. All rights reserved.
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 * Except as contained in this notice, the name of the author shall not be
24 * used in advertising or otherwise to promote the sale, use or other dealings
25 * in this Software without prior written authorization from the author.
28 * Based on the "debian" theme, which is apparantly :-
29 * Copyright 1999-2001 (c) VA Linux Systems
33 class Theme extends Layout {
37 * Theme() - Constructor
45 // The HTML box background color
46 $this->COLOR_HTMLBOX_BACK = '#B6B6B6';
48 // height of a tab (ie the size of the background image), 23 is specified in the
49 // style guide and so the background images were drawn for that size, changing
50 // this will lead to the images being cropped or tiled, either will look bad.
55 * header() - "steel theme" top of page
57 * @param array Header parameters array
59 function header($params) {
62 $this->headerStart($params); ?>
64 <link rel="stylesheet" type="text/css" href="<?php echo util_make_url ('/themes/osx/css/theme.css'); ?>" />
67 <table border="0" width="100%" cellspacing="0" cellpadding="0">
70 <td><a href="<?php echo util_make_url ('/'); ?>"
71 onmouseover="imgOver('logo')"
72 onmouseout="imgOff('logo')"><img name="logo" border="0" height="60" width="180"
73 src="<?php echo $this->imgroot.'logo.png'; ?>" alt="GForge Logo" /></a></td>
74 <td><?php echo $this->searchBox(); ?></td>
75 <td style="text-align:right"><?php
76 if (session_loggedin()) {
78 <b><?php echo util_make_link ('/account/logout.php',_('Log Out')); ?></b><br />
79 <b><?php echo util_make_link ('/account/',_('My Account')); ?></b><?php
82 <b><?php echo util_make_link ('/account/login.php',_('Log In')); ?></b><br />
83 <b><?php echo util_make_link ('/account/register.php',_('New Account')); ?></b><?php
86 $params['template'] = '<br/><b>{menu}</b>';
87 plugin_hook ('headermenu', $params);
95 <table border="0" width="100%" cellspacing="0" cellpadding="0">
101 <?php echo $this->outerTabs($params); ?>
109 <td valign="top" width="99%" colspan="3">
110 <!-- Inner Tabs / Shell -->
112 <table border="0" width="100%" cellspacing="0" cellpadding="0">
116 if (isset($params['group']) && $params['group']) {
124 echo $this->projectTabs($params['toptab'],$params['group']);
137 src="<?php echo $this->imgroot; ?>clear.png" width="99%" height="10" alt="" /></td>
142 src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td>
143 <td valign="top" width="99%">
147 function footer($params) {
151 <!-- end main body row -->
156 src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
160 src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
164 <!-- end inner body row -->
167 <td width="10"><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
170 <!-- some extra space to make it look nicer -->
171 <td height="100"> </td>
175 echo $this->footerEnd($params);
181 * boxTop() - Top HTML box
183 * @param string Box title
184 * @param bool Whether to echo or return the results
185 * @param string The box background color
187 function boxTop($title) {
190 <table cellspacing="2" cellpadding="0" width="100%" border="0">
193 <table cellspacing="2" cellpadding="0" width="100%" border="0" >
195 <td colspan="2"><span class="titlebar">'.$title.'</span></td>
197 <tr align="left" bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
198 <td colspan="2" height="1"></td></tr><tr style="text-align:left"><td colspan="2">';
202 * boxMiddle() - Middle HTML box
204 * @param string Box title
205 * @param string The box background color
207 function boxMiddle($title) {
212 <tr><td height="20" colspan="2"> </td></tr>
214 <td colspan="2"><span class="titlebar">'.$title.'</span></td>
216 <tr align="left" bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
217 <td colspan="2" height="1"></td></tr><tr><td colspan="2">';
221 * boxGetAltRowStyle() - Get an alternating row style for tables
223 * @param int Row number
225 function boxGetAltRowStyle($i) {
228 return ' bgcolor="#FFFFFF"';
230 return ' bgcolor="#DDDDDD"';
232 return ' bgcolor="#B6B6B6"';
237 * boxBottom() - Bottom HTML box
239 * @param bool Whether to echo or return the results
241 function boxBottom() {
242 return '<!-- boxBottom -->
247 <tr><td height="20" colspan="2"> </td></tr>
252 * listTableTop() - Takes an array of titles and builds the first row of a new table.
254 * @param array The array of titles
255 * @param array The array of title links
257 function listTableTop ($title_arr,$links_arr=false) {
259 <!-- listTableTop -->
260 <table cellspacing="0" cellpadding="1" width="100%" border="0">
262 <table width="100%" border="0" cellspacing="2" cellpadding="0">
265 $count=count($title_arr);
267 for ($i=0; $i<$count; $i++) {
269 <td style="text-align:left"><a class="titlebar" href="'.$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
272 for ($i=0; $i<$count; $i++) {
274 <td style="text-align:left">'.$title_arr[$i].'</td>';
279 <tr align="left" bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
280 <td colspan="'.$count.'" height="1"><img src="'.$this->imgroot.'clear.png" height="1" width="1" alt="" /></td>
285 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
287 $deselect_tab='style="background-image: url('.$this->imgroot.'tabs/deselect.png);"';
288 $select_tab='style="background-image: url('.$this->imgroot.'tabs/select.png);"';
289 $deselect_rule='style="background-image: url('.$this->imgroot.'tabs/ruledeselect.png);"';
290 $select_rule='style="background-image: url('.$this->imgroot.'tabs/ruleselect.png);"';
292 $count=count($TABS_DIRS);
293 $width=intval((100/($count+1)));
294 $space=intval($width/2);
297 <!-- tabGenerator -->
299 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
301 <td><img src="'.$this->imgroot.'clear.png" height="'.$this->TAB_HEIGHT.'" width="'.$space.'%" alt="" /></td>';
307 for ($i=0; $i<$count; $i++) {
308 $TABS_TITLES[$i] = preg_replace("/ +/", " ", $TABS_TITLES[$i]);
309 $bgimg=(($selected==$i)?$select_tab:$deselect_tab);
310 $cornerimg=(($selected==$i)?'select':'deselect');
312 <td height="'.$this->TAB_HEIGHT.'" width="5"
313 style="background-image: url('.$this->imgroot.'tabs/left'.$cornerimg.'.png);"></td>
314 <td '.$bgimg.' height="'.$this->TAB_HEIGHT.'" width="'.$width.'%" style="text-align:center">'.
315 '<a class="'. (($selected==$i)?'tabsellink':'tablink') .'" href="'. $TABS_DIRS[$i] .'">'. $TABS_TITLES[$i] .'</a></td>
316 <td height="'.$this->TAB_HEIGHT.'" width="5"
317 style="background-image: url('.$this->imgroot.'tabs/right'.$cornerimg.'.png);"></td>';
321 <td><img src="'.$this->imgroot.'clear.png" height="'.$this->TAB_HEIGHT.'" width="'.$space.'%" alt="" /></td>
324 <td style="background-image: url('.$this->imgroot.'tabs/ruleselect.png);" style="text-align:center"><img
325 src="'.$this->imgroot.'clear.png" height="8" width="'.$space.'%" alt="" /></td>';
326 for ($i=0; $i<$count; $i++) {
327 $bgimg=(($selected==$i)?$select_rule:$deselect_rule);
328 $blendimg=(($selected==$i)?'select':'deselect');
330 <td style="background-image: url('.$this->imgroot.'tabs/leftblend'.$blendimg.'.png);"><img
331 src="'.$this->imgroot . 'clear.png" height="8" width="5" alt="" /></td>
332 <td '.$bgimg.' width="'.$width.'%" style="text-align:center"><img
333 src="'.$this->imgroot . 'clear.png" height="8" width="1" alt="" /></td>
334 <td style="background-image: url('.$this->imgroot.'tabs/rightblend'.$blendimg.'.png);"><img
335 src="'.$this->imgroot . 'clear.png" height="8" width="5" alt="" /></td>';
339 <td style="background-image: url('.$this->imgroot.'tabs/ruleselect.png);" style="text-align:center"><img
340 src="'.$this->imgroot.'clear.png" height="8" width="'.$space.'%" alt="" /></td>
342 <tr><td height="10"> </td></tr>
344 <!-- end tabGenerator -->';
348 * multiTableRow() - create a mutlilevel row in a table
350 * @param string the row attributes
351 * @param array the array of cell data, each element is an array,
352 * the first item being the text,
353 * the subsequent items are attributes
354 * @param boolean is this row part of the title ?
357 function multiTableRow($row_attr, $cell_data, $istitle) {
359 <!-- multiTableRow -->
362 $return .=' align="center" ';
365 for ( $c = 0; $c < count($cell_data); $c++ ) {
367 for ( $a=1; $a < count($cell_data[$c]); $a++) {
368 $return .= $cell_data[$c][$a].' ';
372 $return .='<span class="titlebar">';
374 $return .= $cell_data[$c][0];
382 <!-- end multiTableRow -->
392 // c-file-style: "bsd"