3 * FusionForge Funky Theme
5 * Copyright 2010, Antoine Mercadal - Capgemini
6 * Copyright 2010, Marc-Etienne Vargenau, Alcatel-Lucent
7 * Copyright 2011, Franck Villaume - Capgemini
8 * Copyright 2011-2013, Franck Villaume - TrivialDev
9 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
11 * This file is part of FusionForge. FusionForge is free software;
12 * you can redistribute it and/or modify it under the terms of the
13 * GNU General Public License as published by the Free Software
14 * Foundation; either version 2 of the Licence, or (at your option)
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
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 {
37 $this->themeurl = util_make_url('themes/funky/');
38 $this->imgbaseurl = $this->themeurl . 'images/';
39 $this->imgroot = $this->imgbaseurl;
41 $this->addStylesheet('/themes/funky/css/theme.css');
42 $this->addStylesheet('/themes/funky/css/theme-pages.css');
45 function quicknewsbutton() {
46 return "<div class='quicknews-toggle'><a href=# onclick='jQuery(\".quicknews\").slideToggle()'>news</a></div>";
49 function quicknews() {
50 $ret = "<div class='quicknews'>";
52 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
53 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
54 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
55 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
61 function bodyHeader($params) {
63 if (!isset($params['h1']) && isset($params['title'])) {
64 $params['h1'] = $params['title'];
67 if (!isset($params['title'])) {
68 $params['title'] = forge_get_config('forge_name');
70 $params['title'] = $params['title'] . " - ".forge_get_config('forge_name');
73 echo '<table id="header" class="fullwidth">' . "\n";
75 echo '<td id="header-col1">' . "\n";
76 echo util_make_link('/', html_image('/header/top-logo.png', null, null, array('alt'=>'FusionForge Home'))) . "\n";
79 echo '<td id="header-col2">' . "\n";
81 $items = $this->navigation->getUserLinks();
82 for ($j = 0; $j < count($items['titles']); $j++) {
83 $links[] = util_make_link($items['urls'][$j], $items['titles'][$j], array('class'=>'userlink'), true);
85 echo implode(' | ', $links);
86 plugin_hook('headermenu', $params);
91 echo '<td colspan="2" id="header-line2">' . "\n";
92 // echo $this->quicknewsbutton();
96 echo '</td></tr>' . "\n";
97 echo '<tr><td colspan="2" id="header-news">' . "\n";
98 //echo $this->quicknews();
99 echo'</td></tr></table><!-- outer tabs -->' . "\n";
100 $this->outerTabs($params);
101 echo '<!-- inner tabs -->' . "\n";
102 echo '<div class="innertabs">' . "\n";
103 if (isset($params['group']) && $params['group']) {
104 $this->projectTabs($params['toptab'], $params['group']);
107 echo '</div>' . "\n";
108 echo '<div id="maindiv">' . "\n";
110 plugin_hook('message', array());
112 if(isset($GLOBALS['error_msg']) && $GLOBALS['error_msg']) {
113 echo $this->error_msg($GLOBALS['error_msg']);
115 if(isset($GLOBALS['warning_msg']) && $GLOBALS['warning_msg']) {
116 echo $this->warning_msg($GLOBALS['warning_msg']);
118 if(isset($GLOBALS['feedback']) && $GLOBALS['feedback']) {
119 echo $this->feedback($GLOBALS['feedback']);
122 if (isset($params['h1'])) {
123 echo '<h1>'.$params['h1'].'</h1>';
124 } elseif (isset($params['title'])) {
125 echo '<h1 class="hide">'.$params['title'].'</h1>';
127 if (isset($params['submenu']))
128 echo $params['submenu'];
131 function bodyFooter($params) {
132 echo '</div><!-- id="maindiv" -->' . "\n";
135 function footer($params) {
136 $this->bodyFooter($params);
137 echo '<div class="footer">' . "\n";
138 echo $this->navigation->getPoweredBy();
139 echo $this->navigation->getShowSource();
140 echo '<div style="clear:both"></div></div>';
141 plugin_hook('webanalytics_url', array());
142 echo '</body></html>' . "\n";
146 * boxTop() - Top HTML box
148 * @param string $title Box title
152 function boxTop($title, $id = '') {
154 $id = $this->toSlug($id);
155 $idid = ' id="' . $id . '"';
156 $idtitle = ' id="' . $id . '-title"';
157 $idtcont = ' id="' . $id . '-title-content"';
165 $t_result .= '<div' . $idid . ' class="box-surround">';
166 $t_result .= '<div' . $idtitle . ' class="box-title">';
167 $t_result .= '<div' . $idtcont . ' class="box-title-content">'. $title .'</div>';
168 $t_result .= '</div> <!-- class="box-title" -->';
174 * boxMiddle() - Middle HTML box
176 * @param string $title Box title
180 function boxMiddle($title, $id = '') {
182 $id = $this->toSlug($id);
183 $idtitle = ' id="' . $id . '-title"';
188 $t_result ='<div' . $idtitle . ' class="box-middle">'.$title.'</div>';
194 * boxContent() - Content HTML box
196 * @param string $content Box content
200 function boxContent($content, $id = '') {
202 $id = $this->toSlug($id);
203 $idcont = ' id="' . $id . '-content"';
208 $t_result ='<div' . $idcont . ' class="box-content">'.$content.'</div>';
213 * boxBottom() - Bottom HTML box
217 function boxBottom() {
218 $t_result='</div><!-- class="box-surround" -->';
224 * boxGetAltRowStyle() - Get an alternating row style for tables
226 * @param int $i Row number
229 function boxGetAltRowStyle($i) {
231 return 'class="bgcolor-white"';
233 return 'class="bgcolor-grey"';
236 function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS, $nested=false, $selected=false, $sel_tab_bgcolor='WHITE', $total_width='100%') {
237 $count = count($TABS_DIRS);
243 global $use_tooltips;
247 <script type="text/javascript">//<![CDATA[
248 if (typeof(jQuery(window).tipsy) == 'function') {
249 jQuery(document).ready(
251 jQuery('.tabtitle').tipsy({delayIn: 500, delayOut: 0, fade: true});
252 jQuery('.tabtitle-nw').tipsy({gravity: 'nw', delayIn: 500, delayOut: 0, fade: true});
253 jQuery('.tabtitle-ne').tipsy({gravity: 'ne', delayIn: 500, delayOut: 0, fade: true});
254 jQuery('.tabtitle-w').tipsy({gravity: 'w', delayIn: 500, delayOut: 0, fade: true});
255 jQuery('.tabtitle-e').tipsy({gravity: 'e', delayIn: 500, delayOut: 0, fade: true});
256 jQuery('.tabtitle-sw').tipsy({gravity: 'sw', delayIn: 500, delayOut: 0, fade: true});
257 jQuery('.tabtitle-se').tipsy({gravity: 'se', delayIn: 500, delayOut: 0, fade: true});
265 $return = '<!-- start tabs -->';
266 $return .= '<table class="tabGenerator fullwidth" ';
268 if ($total_width != '100%')
269 $return .= 'style="width:' . $total_width . ';"';
274 $accumulated_width = 0;
276 for ($i=0; $i<$count; $i++) {
277 $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width ;
278 $accumulated_width += $tabwidth ;
283 $return .= '<td class="tg-middle" style="width:'.$tabwidth.'%;"><a ';
284 $return .= 'id="'.md5($TABS_DIRS[$i]).'" ';
285 if ($use_tooltips && isset($TABS_TOOLTIPS[$i]))
286 $return .= 'class="tabtitle" title="'.$TABS_TOOLTIPS[$i].'" ';
287 $return .= 'href="'.$TABS_DIRS[$i].'">' . "\n";
291 $return .= ' class="selected"';
297 $return .= ' class="nested"';
299 $return .= '>' . "\n";
300 $return .= ''.$TABS_TITLES[$i].'' . "\n";
301 $return .= '</span>';
302 $return .= '</span>' . "\n";
303 $return .= '</a></td>' . "\n";
307 $return .= '</tr></table><!-- end tabs -->';
313 * beginSubMenu() - Opening a submenu.
315 * @return string Html to start a submenu.
317 function beginSubMenu() {
318 $return = '<ul class="submenu">';
323 * endSubMenu() - Closing a submenu.
325 * @return string Html to end a submenu.
327 function endSubMenu() {
333 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
335 * @param array $title_arr The array of titles.
336 * @param array $links_arr The array of title links.
337 * @param array $attr_arr The array of attributs by link
338 * @return string Html to build a submenu.
340 function printSubMenu($title_arr, $links_arr, $attr_arr) {
341 $count = count($title_arr) - 1;
344 for ($i=0; $i<$count; $i++)
345 $return .= "<li><span>" . util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]) . "</span></li>";
347 $return .= "<li><span>" . util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]) . "</span></li>";
352 * subMenu() - Takes two array of titles and links and build a menu.
354 * @param array $title_arr The array of titles.
355 * @param array $links_arr The array of title links.
356 * @param array $attr_arr The array of attributes by link
357 * @return string Html to build a submenu.
359 function subMenu($title_arr, $links_arr, $attr_arr = array()) {
360 $return = $this->beginSubMenu();
361 $return .= $this->printSubMenu($title_arr, $links_arr, $attr_arr);
362 $return .= $this->endSubMenu();
367 * multiTableRow() - create a multilevel row in a table
369 * @param string $row_attr the row attributes
370 * @param array $cell_data the array of cell data, each element is an array,
371 * the first item being the text,
372 * the subsequent items are attributes (dont include
373 * the bgcolor for the title here, that will be
374 * handled by $istitle
375 * @param bool $istitle is this row part of the title ?
379 function multiTableRow($row_attr, $cell_data, $istitle)
381 $return= '<tr class="ff" '.$row_attr;
383 $return .=' align="center"';
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 .='<strong>';
395 $return .= $cell_data[$c][0];
397 $return .='</strong>';
406 * getThemeIdFromName()
408 * @param string $dirname the dirname of the theme
409 * @return int the theme id
411 function getThemeIdFromName($dirname)
413 $res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1', array($dirname));
414 return db_result($res, 0, 'theme_id');
418 * headerJS() - creates the JS headers and calls the plugin javascript hook
419 * @todo generalize this
423 echo '<script type="text/javascript" src="'. util_make_uri('/js/common.js') .'"></script>';
425 plugin_hook("javascript_file", false);
427 // invoke the 'javascript' hook for custom javascript addition
428 $params = array('return' => false);
429 plugin_hook("javascript", $params);
430 $javascript = $params['return'];
432 echo '<script type="text/javascript">//<![CDATA['."\n";
434 echo "\n//]]></script>\n";
438 html_use_simplemenu();
439 html_use_coolfieldset();
441 echo $this->getJavascripts();
442 echo $this->getStylesheets();
444 <script type="text/javascript">//<![CDATA[
445 jQuery(window).load(function(){
446 jQuery(".quicknews").hide();
447 setTimeout("jQuery('.feedback').hide('slow')", 5000);
448 setInterval(function() {
449 setTimeout("jQuery('.feedback').hide('slow')", 5000);
459 // c-file-style: "bsd"