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) {
60 $this->headerStart($params); ?>
62 <link rel="stylesheet" type="text/css" href="<?php echo util_make_uri ('/themes/osx/css/theme.css'); ?>" />
65 <table border="0" width="100%" cellspacing="0" cellpadding="0">
68 <td><a href="<?php echo util_make_url ('/'); ?>"
69 onmouseover="imgOver('logo')"
70 onmouseout="imgOff('logo')"><img name="logo" border="0" height="60" width="180"
71 src="<?php echo $this->imgroot.'logo.png'; ?>" alt="GForge Logo" /></a></td>
72 <td><?php echo $this->searchBox(); ?></td>
73 <td style="text-align:right"><?php
74 if (session_loggedin()) {
78 $u =& user_get_object(user_getid());
79 echo util_make_link ('/account/logout.php', sprintf("%s (%s)", _('Log Out'), $u->getRealName()));
81 <b><?php echo util_make_link ('/account/',_('My Account')); ?></b><?php
84 <b><?php echo util_make_link ('/account/login.php',_('Log In')); ?></b><br />
85 <b><?php echo util_make_link ('/account/register.php',_('New Account')); ?></b><?php
88 $params['template'] = '<br/><b>{menu}</b>';
89 plugin_hook ('headermenu', $params);
97 <table border="0" width="100%" cellspacing="0" cellpadding="0">
103 <?php echo $this->outerTabs($params); ?>
111 <td valign="top" width="99%" colspan="3">
112 <!-- Inner Tabs / Shell -->
114 <table border="0" width="100%" cellspacing="0" cellpadding="0">
118 if (isset($params['group']) && $params['group']) {
126 echo $this->projectTabs($params['toptab'],$params['group']);
139 src="<?php echo $this->imgroot; ?>clear.png" width="99%" height="10" alt="" /></td>
144 src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td>
145 <td valign="top" width="99%">
149 function footer($params) {
153 <!-- end main body row -->
158 src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
162 src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td>
166 <!-- end inner body row -->
169 <td width="10"><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td>
172 <!-- some extra space to make it look nicer -->
173 <td height="100"> </td>
177 echo $this->footerEnd($params);
183 * boxTop() - Top HTML box
185 * @param string Box title
186 * @param bool Whether to echo or return the results
187 * @param string The box background color
189 function boxTop($title) {
192 <table cellspacing="2" cellpadding="0" width="100%" border="0">
195 <table cellspacing="2" cellpadding="0" width="100%" border="0" >
197 <td colspan="2"><span class="titlebar">'.$title.'</span></td>
199 <tr align="left" bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
200 <td colspan="2" height="1"></td></tr><tr style="text-align:left"><td colspan="2">';
204 * boxMiddle() - Middle HTML box
206 * @param string Box title
207 * @param string The box background color
209 function boxMiddle($title) {
214 <tr><td height="20" colspan="2"> </td></tr>
216 <td colspan="2"><span class="titlebar">'.$title.'</span></td>
218 <tr align="left" bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
219 <td colspan="2" height="1"></td></tr><tr><td colspan="2">';
223 * boxGetAltRowStyle() - Get an alternating row style for tables
225 * @param int Row number
227 function boxGetAltRowStyle($i) {
230 return ' bgcolor="#FFFFFF"';
232 return ' bgcolor="#DDDDDD"';
234 return ' bgcolor="#B6B6B6"';
239 * boxBottom() - Bottom HTML box
241 * @param bool Whether to echo or return the results
243 function boxBottom() {
244 return '<!-- boxBottom -->
249 <tr><td height="20" colspan="2"> </td></tr>
254 * listTableTop() - Takes an array of titles and builds the first row of a new table.
256 * @param array The array of titles
257 * @param array The array of title links
259 function listTableTop ($title_arr,$links_arr=false) {
261 <!-- listTableTop -->
262 <table cellspacing="0" cellpadding="1" width="100%" border="0">
264 <table width="100%" border="0" cellspacing="2" cellpadding="0">
267 $count=count($title_arr);
269 for ($i=0; $i<$count; $i++) {
271 <td style="text-align:left"><a class="titlebar" href="'.$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
274 for ($i=0; $i<$count; $i++) {
276 <td style="text-align:left">'.$title_arr[$i].'</td>';
281 <tr align="left" bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
282 <td colspan="'.$count.'" height="1"><img src="'.$this->imgroot.'clear.png" height="1" width="1" alt="" /></td>
287 function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
289 $deselect_tab='style="background-image: url('.$this->imgroot.'tabs/deselect.png);"';
290 $select_tab='style="background-image: url('.$this->imgroot.'tabs/select.png);"';
291 $deselect_rule='style="background-image: url('.$this->imgroot.'tabs/ruledeselect.png);"';
292 $select_rule='style="background-image: url('.$this->imgroot.'tabs/ruleselect.png);"';
294 $count=count($TABS_DIRS);
295 $width=intval((100/($count+1)));
296 $space=intval($width/2);
299 <!-- tabGenerator -->
301 <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
303 <td><img src="'.$this->imgroot.'clear.png" height="'.$this->TAB_HEIGHT.'" width="'.$space.'%" alt="" /></td>';
309 for ($i=0; $i<$count; $i++) {
310 $TABS_TITLES[$i] = preg_replace("/ +/", " ", $TABS_TITLES[$i]);
311 $bgimg=(($selected==$i)?$select_tab:$deselect_tab);
312 $cornerimg=(($selected==$i)?'select':'deselect');
314 <td height="'.$this->TAB_HEIGHT.'" width="5"
315 style="background-image: url('.$this->imgroot.'tabs/left'.$cornerimg.'.png);"></td>
316 <td '.$bgimg.' height="'.$this->TAB_HEIGHT.'" width="'.$width.'%" style="text-align:center">'.
317 '<a class="'. (($selected==$i)?'tabsellink':'tablink') .'" href="'. $TABS_DIRS[$i] .'">'. $TABS_TITLES[$i] .'</a></td>
318 <td height="'.$this->TAB_HEIGHT.'" width="5"
319 style="background-image: url('.$this->imgroot.'tabs/right'.$cornerimg.'.png);"></td>';
323 <td><img src="'.$this->imgroot.'clear.png" height="'.$this->TAB_HEIGHT.'" width="'.$space.'%" alt="" /></td>
326 <td style="background-image: url('.$this->imgroot.'tabs/ruleselect.png);" style="text-align:center"><img
327 src="'.$this->imgroot.'clear.png" height="8" width="'.$space.'%" alt="" /></td>';
328 for ($i=0; $i<$count; $i++) {
329 $bgimg=(($selected==$i)?$select_rule:$deselect_rule);
330 $blendimg=(($selected==$i)?'select':'deselect');
332 <td style="background-image: url('.$this->imgroot.'tabs/leftblend'.$blendimg.'.png);"><img
333 src="'.$this->imgroot . 'clear.png" height="8" width="5" alt="" /></td>
334 <td '.$bgimg.' width="'.$width.'%" style="text-align:center"><img
335 src="'.$this->imgroot . 'clear.png" height="8" width="1" alt="" /></td>
336 <td style="background-image: url('.$this->imgroot.'tabs/rightblend'.$blendimg.'.png);"><img
337 src="'.$this->imgroot . 'clear.png" height="8" width="5" alt="" /></td>';
341 <td style="background-image: url('.$this->imgroot.'tabs/ruleselect.png);" style="text-align:center"><img
342 src="'.$this->imgroot.'clear.png" height="8" width="'.$space.'%" alt="" /></td>
344 <tr><td height="10"> </td></tr>
346 <!-- end tabGenerator -->';
350 * multiTableRow() - create a mutlilevel row in a table
352 * @param string the row attributes
353 * @param array the array of cell data, each element is an array,
354 * the first item being the text,
355 * the subsequent items are attributes
356 * @param boolean is this row part of the title ?
359 function multiTableRow($row_attr, $cell_data, $istitle) {
361 <!-- multiTableRow -->
364 $return .=' align="center" ';
367 for ( $c = 0; $c < count($cell_data); $c++ ) {
369 for ( $a=1; $a < count($cell_data[$c]); $a++) {
370 $return .= $cell_data[$c][$a].' ';
374 $return .='<span class="titlebar">';
376 $return .= $cell_data[$c][0];
384 <!-- end multiTableRow -->
394 // c-file-style: "bsd"