3 require_once $gfwww.'include/Layout.class.php';
5 define('TOP_TAB_HEIGHT', 30);
6 define('BOTTOM_TAB_HEIGHT', 22);
8 class Theme extends Layout {
13 $this->doctype = 'strict';
14 $this->cssurls = array(
15 'http://yui.yahooapis.com/2.6.0/build/reset-fonts-grids/reset-fonts-grids.css',
16 'http://yui.yahooapis.com/2.6.0/build/base/base-min.css',
17 util_make_url ('/themes/css/fusionforge.css'),
18 $this->cssbaseurl .'theme.css',
19 $this->cssbaseurl .'theme-pages.css',
25 <script type="text/javascript" src="'. util_make_uri('/js/common.js') .'"></script>
26 <script type="text/javascript">';
27 plugin_hook ("javascript",false);
32 function bodyHeader($params) {
36 <table id="header" class="width-100p100">
39 <h1>'. util_make_link ('/', html_image('header/top-logo.png',192,54,array('alt'=>'FusionForge Home'))) .'</h1>
41 <td id="header-col2">';
47 $items = $this->navigation->getUserLinks();
48 for ($j = 0; $j < count($items['titles']); $j++) {
49 $links[] = util_make_link($items['urls'][$j], $items['titles'][$j],
50 array('class'=>'userlink'), true);
52 echo implode(' | ', $links);
54 plugin_hook ('headermenu', $params);
64 echo $this->outerTabs($params);
65 echo '<!-- inner tabs -->';
66 if (isset($params['group']) && $params['group']) {
67 echo $this->projectTabs($params['toptab'],$params['group']);
69 echo '<div id="maindiv">
73 function bodyFooter($params) {
78 function footer($params) {
80 <!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
81 <div class="align-right">
82 ' . $this->navigation->getPoweredBy() . '
84 ' . $this->navigation->getShowSource() . '
94 * boxTop() - Top HTML box
96 * @param string Box title
97 * @param bool Whether to echo or return the results
98 * @param string The box background color
100 function boxTop($title, $id = '') {
102 <div id="' . $this->toSlug($id) . '" class="box-surround">
103 <div id="'. $this->toSlug($id) . '-title" class="box-title">
104 <div class="box-title-left">
105 <div class="box-title-right">
106 <h3 class="box-title-content" id="'. $this->toSlug($id) .'-title-content">'. $title .'</h3>
110 <div id="'. $this->toSlug($id) .'-content" class="box-content">
116 * boxMiddle() - Middle HTML box
118 * @param string Box title
119 * @param string The box background color
121 function boxMiddle($title, $id = '') {
123 </div> <!-- class="box-content" -->
124 <h3 id="title-'. $this->toSlug($id).'" class="box-middle">'.$title.'</h3>
125 <div class="box-content">
131 * boxBottom() - Bottom HTML box
134 function boxBottom() {
137 </div> <!-- class="box-surround" -->
143 * boxGetAltRowStyle() - Get an alternating row style for tables
145 * @param int Row number
147 function boxGetAltRowStyle($i) {
149 return 'class="bgcolor-white"';
151 return 'class="bgcolor-grey"';
156 * listTableTop() - Takes an array of titles and builds the first row of a new table.
158 * @param array The array of titles
159 * @param array The array of title links
160 * @param boolean Whether to highlight or not the entry
162 function listTableTop ($title_arr,$links_arr=false,$selected=false) {
163 $return = '<table class="width-100p100 listTable';
164 if ($selected == true) {
165 $return .= ' selected';
170 $count=count($title_arr);
172 for ($i=0; $i<$count; $i++) {
174 <th scope="col"><a class="sortbutton" href="'.util_make_url ($links_arr[$i]).'"><strong>'.$title_arr[$i].'</strong></a></th>';
177 for ($i=0; $i<$count; $i++) {
179 <th scope="col"><strong>'.$title_arr[$i].'</strong></th>';
182 return $return.'</tr>';
185 function listTableBottom() {
191 function tabGenerator($TABS_DIRS, $TABS_TITLES, $nested=false,
192 $selected=false, $sel_tab_bgcolor='WHITE',
193 $total_width='100%') {
194 $count=count($TABS_DIRS);
198 // The width for each tab is given in percent. Note
199 // that an integer value is used as Opera doesn't seem
200 // to interpret fractional percentage values:
201 // http://www.christianmontoya.com/2007/06/26/fluid-widths-and-point-nine-nine-percent/
202 $width=intval((100/$count));
203 $rest_width=100-$count*$width;
207 <table class="tabGenerator width-100p100" summary="" ';
209 if ($total_width != '100%') {
210 $return .= 'style="width:' . $total_width . ';"';
215 $folder = $this->imgurl.($nested ? 'bottomtab-new/' : 'toptab-new/');
217 for ($i=0; $i<$count; $i++) {
218 if ($selected == $i) {
219 $left_img = $folder.'selected-left.gif';
220 $middle_img = $folder.'selected-middle.gif';
221 $right_img = $folder.'selected-right.gif';
222 $separ_img = $folder.'selected-separator.gif';
223 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
225 $left_img = $folder.'left.gif';
226 $middle_img = $folder.'middle.gif';
227 $right_img = $folder.'right.gif';
228 $separ_img = $folder.'separator.gif';
229 $css_class = $nested ? 'bottomTab' : 'topTab';
232 $clear_img = $this->imgurl.'clear.png';
237 $return .= '<td class="tg-left">' . "\n";
239 if ($selected == $i) {
240 $return .= ' class="selected"';
246 $return .= ' class="nested"';
248 $return .= '>' . "\n";
250 $return .= '</div>' . "\n";
251 $return .= '</td>' . "\n";
254 $return .= '<td class="tg-middle" style="width:'.$width.'%;">' . "\n";
256 if ($selected == $i) {
257 $return .= ' class="selected"';
262 $return .= ' class="nested"';
264 $return .= '>' . "\n";
265 $return .= '<a href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a>' . "\n";
267 $return .= '</div>' . "\n";
268 $return .= '</td>' . "\n";
271 // if the next tab is not selected, close this tab
272 if ($selected != $i+1) {
273 $return .= '<td class="tg-right">' . "\n";
275 if ($selected == $i) {
276 $return .= ' class="selected"';
281 $return .= ' class="nested"';
283 $return .= '>' . "\n";
285 $return .= '</div>' . "\n";
286 $return .= '</td>' . "\n";
290 // create a partial tab if there is any rest-width
291 if ($rest_width > 0) {
293 $return .= '<td class="tg-left">' . "\n";
294 $return .= '<div><div' . ($nested ? ' class="nested"' : '') . ">\n";
295 $return .= '</div></div>' . "\n";
296 $return .= '</td>' . "\n";
298 $return .= '<td class="tg-middle" style="width:'.$rest_width.'%;">' . "\n";
299 $return .= '<div><div' . ($nested ? ' class="nested"' : '') . ">\n";
300 $return .= '</div></div>' . "\n";
301 $return .= '</td>' . "\n";
313 * beginSubMenu() - Opening a submenu.
315 * @return string Html to start a submenu.
317 function beginSubMenu () {
324 * endSubMenu() - Closing a submenu.
326 * @return string Html to end a submenu.
328 function endSubMenu () {
329 $return = '</strong></p>';
334 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
336 * @param array The array of titles.
337 * @param array The array of title links.
338 * @return string Html to build a submenu.
340 function printSubMenu ($title_arr,$links_arr) {
341 $count=count($title_arr);
346 for ($i=0; $i<$count; $i++) {
347 $return .= util_make_link ($links_arr[$i], $title_arr[$i]) . ' | ';
349 $return .= util_make_link ($links_arr[$i], $title_arr[$i]);
354 * subMenu() - Takes two array of titles and links and build a menu.
356 * @param array The array of titles.
357 * @param array The array of title links.
358 * @return string Html to build a submenu.
360 function subMenu ($title_arr,$links_arr) {
361 $return = $this->beginSubMenu () ;
362 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
363 $return .= $this->endSubMenu () ;
368 * multiTableRow() - create a mutlilevel row in a table
370 * @param string the row attributes
371 * @param array the array of cell data, each element is an array,
372 * the first item being the text,
373 * the subsequent items are attributes (dont include
374 * the bgcolor for the title here, that will be
375 * handled by $istitle
376 * @param boolean is this row part of the title ?
379 function multiTableRow($row_attr, $cell_data, $istitle) {
381 <tr class="ff" '.$row_attr;
383 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
386 for ( $c = 0; $c < count($cell_data); $c++ ) {
387 $return .='<td class="ff" ';
388 for ( $a=1; $a < count($cell_data[$c]); $a++) {
389 $return .= $cell_data[$c][$a].' ';
393 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
395 $return .= $cell_data[$c][0];
397 $return .='</strong></font>';
409 * feedback() - returns the htmlized feedback string when an action is performed.
411 * @param string feedback string
412 * @return string htmlized feedback
414 function feedback($feedback) {
419 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
424 * getThemeIdFromName()
426 * @param string the dirname of the theme
427 * @return integer the theme id
429 function getThemeIdFromName($dirname) {
430 $res=db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1',
432 return db_result($res,0,'theme_id');
438 // c-file-style: "bsd"