3 * FusionForge Funky Theme
5 * Copyright 2010, Antoine Mercadal - Capgemini
6 * Copyright 2010, Marc-Etienne Vargenau, Alcatel-Lucent
8 * This file is part of FusionForge.
10 * FusionForge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published
12 * by the Free Software Foundation; either version 2 of the License,
13 * or (at your option) any later version.
15 * FusionForge is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with FusionForge; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27 require_once $gfwww.'include/Layout.class.php';
29 define('TOP_TAB_HEIGHT', 30);
30 define('BOTTOM_TAB_HEIGHT', 22);
32 class Theme extends Layout {
38 $this->themeurl = util_make_url('themes/funky/');
39 $this->imgbaseurl = $this->themeurl . 'images/';
40 $this->imgroot = $this->imgbaseurl;
41 // $this->doctype = 'strict';
43 $this->addStylesheet('/themes/funky/css/theme.css');
44 $this->addStylesheet('/themes/funky/css/theme-pages.css');
47 function quicknewsbutton()
49 return "<div class='quicknews-toggle'><a href=# onclick='jQuery(\".quicknews\").slideToggle()'>news</a></div>";
54 $ret = "<div class='quicknews'>";
56 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
57 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
58 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
59 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
65 function bodyHeader($params)
67 global $user_guide, $HTML;
68 echo '<table id="header" class="width-100p100">' . "\n";
70 echo '<td id="header-col1">' . "\n";
71 echo '<h1>'. util_make_link ('/', html_image('/header/top-logo.png',null,null,array('alt'=>'FusionForge Home'))) .'</h1>' . "\n";
73 echo '<td id="header-col2">' . "\n";
75 $items = $this->navigation->getUserLinks();
76 for ($j = 0; $j < count($items['titles']); $j++)
78 $links[] = util_make_link($items['urls'][$j], $items['titles'][$j], array('class'=>'userlink'), true);
80 echo implode(' | ', $links);
81 plugin_hook ('headermenu', $params);
86 echo '<td colspan="2" id="header-line2">' . "\n";
87 // echo $this->quicknewsbutton();
91 echo '</td></tr>' . "\n";
92 echo '<tr><td colspan="2" id="header-news">' . "\n";
93 //echo $this->quicknews();
94 echo'</td></tr></table><!-- outer tabs -->' . "\n";
95 echo $this->outerTabs($params);
96 echo '<!-- inner tabs -->' . "\n";
97 echo '<div class="innertabs">' . "\n";
98 if (isset($params['group']) && $params['group'])
99 echo $this->projectTabs($params['toptab'],$params['group']);
101 echo '</div>' . "\n";
102 echo '<div id="maindiv">' . "\n";
105 function bodyFooter($params) {
106 echo '</div><!-- id="maindiv" -->' . "\n";
109 function footer($params)
111 $this->bodyFooter($params);
112 echo '<div class="footer">' . "\n";
113 // echo '<div>Theme designed by Antoine Mercadal. Copyright © 2010 Capgemini';
114 echo $this->navigation->getPoweredBy();
115 echo $this->navigation->getShowSource();
116 echo '<div style="clear:both"></div></div></body></html>' . "\n";
120 * boxTop() - Top HTML box
122 * @param string Box title
123 * @param bool Whether to echo or return the results
124 * @param string The box background color
126 function boxTop($title, $id = '')
129 $t_result .= '<div id="' . $this->toSlug($id) . '" class="box-surround">';
130 $t_result .= '<div id="'. $this->toSlug($id) . '-title" class="box-title">';
131 $t_result .= '<div class="box-title-content" id="'. $this->toSlug($id) .'-title-content">'. $title .'</div>';
132 $t_result .= '</div> <!-- class="box-title" -->';
138 * boxMiddle() - Middle HTML box
140 * @param string Box title
141 * @param string The box background color
143 function boxMiddle($title, $id = '')
145 $t_result ='<div id="title-'. $this->toSlug($id).'" class="box-middle">'.$title.'</div>';
151 * boxContent() - Content HTML box
153 * @param string Box content
155 function boxContent($content, $id = '')
157 $t_result ='<div id="'. $this->toSlug($id) .'-content" class="box-content">'.$content.'</div>';
162 * boxBottom() - Bottom HTML box
167 $t_result='</div><!-- class="box-surround" -->';
173 * boxGetAltRowStyle() - Get an alternating row style for tables
175 * @param int Row number
177 function boxGetAltRowStyle($i)
180 return 'class="bgcolor-white"';
182 return 'class="bgcolor-grey"';
185 function tabGenerator($TABS_DIRS, $TABS_TITLES, $nested=false, $selected=false, $sel_tab_bgcolor='WHITE', $total_width='100%')
187 $count=count($TABS_DIRS);
192 $return = '<!-- start tabs -->';
193 $return .= '<table class="tabGenerator width-100p100" summary="" ';
195 if ($total_width != '100%')
196 $return .= 'style="width:' . $total_width . ';"';
201 $accumulated_width = 0;
203 for ($i=0; $i<$count; $i++)
205 $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width ;
206 $accumulated_width += $tabwidth ;
211 $return .= '<td class="tg-middle" style="width:'.$tabwidth.'%;"><a href="'.$TABS_DIRS[$i].'">' . "\n";
215 $return .= ' class="selected"';
221 $return .= ' class="nested"';
223 $return .= '>' . "\n";
224 $return .= ''.$TABS_TITLES[$i].'' . "\n";
225 $return .= '</span>';
226 $return .= '</span>' . "\n";
227 $return .= '</a></td>' . "\n";
231 $return .= '</tr></table><!-- end tabs -->';
238 * beginSubMenu() - Opening a submenu.
240 * @return string Html to start a submenu.
242 function beginSubMenu ()
244 $return = '<ul class="submenu">';
250 * endSubMenu() - Closing a submenu.
252 * @return string Html to end a submenu.
254 function endSubMenu ()
262 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
264 * @param array The array of titles.
265 * @param array The array of title links.
266 * @return string Html to build a submenu.
268 function printSubMenu ($title_arr,$links_arr)
270 $count = count($title_arr) - 1;
273 for ($i=0; $i<$count; $i++)
274 $return .= "<li><span>" . util_make_link ($links_arr[$i], $title_arr[$i]) . "</span></li>";
276 $return .= "<li><span>" . util_make_link ($links_arr[$i], $title_arr[$i]) . "</span></li>";
282 * subMenu() - Takes two array of titles and links and build a menu.
284 * @param array The array of titles.
285 * @param array The array of title links.
286 * @return string Html to build a submenu.
288 function subMenu ($title_arr,$links_arr)
290 $return = $this->beginSubMenu () ;
291 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
292 $return .= $this->endSubMenu () ;
298 * multiTableRow() - create a mutlilevel row in a table
300 * @param string the row attributes
301 * @param array the array of cell data, each element is an array,
302 * the first item being the text,
303 * the subsequent items are attributes (dont include
304 * the bgcolor for the title here, that will be
305 * handled by $istitle
306 * @param boolean is this row part of the title ?
309 function multiTableRow($row_attr, $cell_data, $istitle)
311 $return= '<tr class="ff" '.$row_attr;
314 $return .=' align="center"';
318 for ( $c = 0; $c < count($cell_data); $c++ )
320 $return .='<td class="ff" ';
322 for ( $a=1; $a < count($cell_data[$c]); $a++)
323 $return .= $cell_data[$c][$a].' ';
328 $return .='<strong>';
330 $return .= $cell_data[$c][0];
333 $return .='</strong>';
344 * getThemeIdFromName()
346 * @param string the dirname of the theme
347 * @return integer the theme id
349 function getThemeIdFromName($dirname)
351 $res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1', array($dirname));
353 return db_result($res,0,'theme_id');
357 * headerJS() - creates the JS headers and calls the plugin javascript hook
358 * @todo generalize this
362 use_javascript('/scripts/jquery/jquery-1.4.2.min.js');
364 echo '<script type="text/javascript" src="'. util_make_uri('/js/common.js') .'"></script>';
365 echo '<script type="text/javascript" src="/scripts/codendi/LayoutManager.js"></script>';
366 echo '<script type="text/javascript" src="/scripts/codendi/ReorderColumns.js"></script>';
367 echo '<script type="text/javascript" src="/scripts/codendi/codendi-1236793993.js"></script>';
368 echo '<script type="text/javascript" src="/scripts/codendi/validate.js"></script>';
369 echo '<script type="text/javascript" src="/scripts/codendi/Tooltip.js"></script>';
371 echo '<script type="text/javascript">';
372 plugin_hook ("javascript",false);
373 echo '</script>'."\n";
375 plugin_hook ("javascript_file",false);
376 echo $this->getJavascripts();
378 <script type="text/javascript">
380 jQuery(window).load(function(){
381 jQuery(".quicknews").hide();
382 setTimeout("jQuery('.feedback').hide('slow')",5000);
392 // c-file-style: "bsd"