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 - 2012, 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) {
64 if (!isset($params['h1']) && isset($params['title'])) {
65 $params['h1'] = $params['title'];
68 if (!isset($params['title'])) {
69 $params['title'] = forge_get_config('forge_name');
71 $params['title'] = $params['title'] . " - ".forge_get_config('forge_name');
74 echo '<table id="header" class="width-100p100">' . "\n";
76 echo '<td id="header-col1">' . "\n";
77 echo util_make_link('/', html_image('/header/top-logo.png', null, null, array('alt'=>'FusionForge Home'))) . "\n";
80 echo '<td id="header-col2">' . "\n";
82 $items = $this->navigation->getUserLinks();
83 for ($j = 0; $j < count($items['titles']); $j++) {
84 $links[] = util_make_link($items['urls'][$j], $items['titles'][$j], array('class'=>'userlink'), true);
86 echo implode(' | ', $links);
87 plugin_hook('headermenu', $params);
92 echo '<td colspan="2" id="header-line2">' . "\n";
93 // echo $this->quicknewsbutton();
97 echo '</td></tr>' . "\n";
98 echo '<tr><td colspan="2" id="header-news">' . "\n";
99 //echo $this->quicknews();
100 echo'</td></tr></table><!-- outer tabs -->' . "\n";
101 echo $this->outerTabs($params);
102 echo '<!-- inner tabs -->' . "\n";
103 echo '<div class="innertabs">' . "\n";
104 if (isset($params['group']) && $params['group']) {
105 echo $this->projectTabs($params['toptab'], $params['group']);
108 echo '</div>' . "\n";
109 echo '<div id="maindiv">' . "\n";
111 plugin_hook('message', array());
113 if(isset($GLOBALS['error_msg']) && $GLOBALS['error_msg']) {
114 echo $this->error_msg($GLOBALS['error_msg']);
116 if(isset($GLOBALS['warning_msg']) && $GLOBALS['warning_msg']) {
117 echo $this->warning_msg($GLOBALS['warning_msg']);
119 if(isset($GLOBALS['feedback']) && $GLOBALS['feedback']) {
120 echo $this->feedback($GLOBALS['feedback']);
123 if (isset($params['h1'])) {
124 echo '<h1>'.$params['h1'].'</h1>';
125 } elseif (isset($params['title'])) {
126 echo '<h1 class="hide">'.$params['title'].'</h1>';
128 if (isset($params['submenu']))
129 echo $params['submenu'];
132 function bodyFooter($params) {
133 echo '</div><!-- id="maindiv" -->' . "\n";
136 function footer($params) {
137 $this->bodyFooter($params);
138 echo '<div class="footer">' . "\n";
139 echo $this->navigation->getPoweredBy();
140 echo $this->navigation->getShowSource();
141 echo '<div style="clear:both"></div></div>';
142 plugin_hook('webanalytics_url', array());
143 echo '</body></html>' . "\n";
147 * boxTop() - Top HTML box
149 * @param string Box title
150 * @param bool Whether to echo or return the results
151 * @param string The box background color
153 function boxTop($title, $id = '') {
155 $id = $this->toSlug($id);
156 $idid = ' id="' . $id . '"';
157 $idtitle = ' id="' . $id . '-title"';
158 $idtcont = ' id="' . $id . '-title-content"';
166 $t_result .= '<div' . $idid . ' class="box-surround">';
167 $t_result .= '<div' . $idtitle . ' class="box-title">';
168 $t_result .= '<div' . $idtcont . ' class="box-title-content">'. $title .'</div>';
169 $t_result .= '</div> <!-- class="box-title" -->';
175 * boxMiddle() - Middle HTML box
177 * @param string Box title
178 * @param string The box background color
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 Box content
198 function boxContent($content, $id = '') {
200 $id = $this->toSlug($id);
201 $idcont = ' id="' . $id . '-content"';
206 $t_result ='<div' . $idcont . ' class="box-content">'.$content.'</div>';
211 * boxBottom() - Bottom HTML box
214 function boxBottom() {
215 $t_result='</div><!-- class="box-surround" -->';
221 * boxGetAltRowStyle() - Get an alternating row style for tables
223 * @param int Row number
225 function boxGetAltRowStyle($i) {
227 return 'class="bgcolor-white"';
229 return 'class="bgcolor-grey"';
232 function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS, $nested=false, $selected=false, $sel_tab_bgcolor='WHITE', $total_width='100%') {
233 $count = count($TABS_DIRS);
238 global $use_tooltips;
242 <script type="text/javascript">//<![CDATA[
243 if (typeof(jQuery(window).tipsy) == 'function') {
244 jQuery(document).ready(
246 jQuery('.tabtitle').tipsy({delayIn: 500, delayOut: 0, fade: true});
247 jQuery('.tabtitle-nw').tipsy({gravity: 'nw', delayIn: 500, delayOut: 0, fade: true});
248 jQuery('.tabtitle-ne').tipsy({gravity: 'ne', delayIn: 500, delayOut: 0, fade: true});
249 jQuery('.tabtitle-w').tipsy({gravity: 'w', delayIn: 500, delayOut: 0, fade: true});
250 jQuery('.tabtitle-e').tipsy({gravity: 'e', delayIn: 500, delayOut: 0, fade: true});
251 jQuery('.tabtitle-sw').tipsy({gravity: 'sw', delayIn: 500, delayOut: 0, fade: true});
252 jQuery('.tabtitle-se').tipsy({gravity: 'se', delayIn: 500, delayOut: 0, fade: true});
260 $return = '<!-- start tabs -->';
261 $return .= '<table class="tabGenerator width-100p100" ';
263 if ($total_width != '100%')
264 $return .= 'style="width:' . $total_width . ';"';
269 $accumulated_width = 0;
271 for ($i=0; $i<$count; $i++) {
272 $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width ;
273 $accumulated_width += $tabwidth ;
278 $return .= '<td class="tg-middle" style="width:'.$tabwidth.'%;"><a ';
279 $return .= 'id="'.md5($TABS_DIRS[$i]).'" ';
281 $return .= 'class="tabtitle" title="'.$TABS_TOOLTIPS[$i].'"';
282 $return .= 'href="'.$TABS_DIRS[$i].'">' . "\n";
286 $return .= ' class="selected"';
292 $return .= ' class="nested"';
294 $return .= '>' . "\n";
295 $return .= ''.$TABS_TITLES[$i].'' . "\n";
296 $return .= '</span>';
297 $return .= '</span>' . "\n";
298 $return .= '</a></td>' . "\n";
302 $return .= '</tr></table><!-- end tabs -->';
308 * beginSubMenu() - Opening a submenu.
310 * @return string Html to start a submenu.
312 function beginSubMenu() {
313 $return = '<ul class="submenu">';
318 * endSubMenu() - Closing a submenu.
320 * @return string Html to end a submenu.
322 function endSubMenu() {
328 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
330 * @param array The array of titles.
331 * @param array The array of title links.
332 * @param array The array of attributs by link
333 * @return string Html to build a submenu.
335 function printSubMenu($title_arr, $links_arr, $attr_arr) {
336 $count = count($title_arr) - 1;
339 for ($i=0; $i<$count; $i++)
340 $return .= "<li><span>" . util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]) . "</span></li>";
342 $return .= "<li><span>" . util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]) . "</span></li>";
347 * subMenu() - Takes two array of titles and links and build a menu.
349 * @param array The array of titles.
350 * @param array The array of title links.
351 * @param array The array of attributs by link
352 * @return string Html to build a submenu.
354 function subMenu($title_arr, $links_arr, $attr_arr = false) {
355 $return = $this->beginSubMenu();
356 $return .= $this->printSubMenu($title_arr, $links_arr, $attr_arr);
357 $return .= $this->endSubMenu();
362 * multiTableRow() - create a mutlilevel row in a table
364 * @param string the row attributes
365 * @param array the array of cell data, each element is an array,
366 * the first item being the text,
367 * the subsequent items are attributes (dont include
368 * the bgcolor for the title here, that will be
369 * handled by $istitle
370 * @param boolean is this row part of the title ?
373 function multiTableRow($row_attr, $cell_data, $istitle)
375 $return= '<tr class="ff" '.$row_attr;
377 $return .=' align="center"';
380 for ( $c = 0; $c < count($cell_data); $c++ ) {
381 $return .='<td class="ff" ';
382 for ( $a=1; $a < count($cell_data[$c]); $a++)
383 $return .= $cell_data[$c][$a].' ';
387 $return .='<strong>';
389 $return .= $cell_data[$c][0];
391 $return .='</strong>';
400 * getThemeIdFromName()
402 * @param string the dirname of the theme
403 * @return integer the theme id
405 function getThemeIdFromName($dirname)
407 $res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1', array($dirname));
408 return db_result($res, 0, 'theme_id');
412 * headerJS() - creates the JS headers and calls the plugin javascript hook
413 * @todo generalize this
417 echo '<script type="text/javascript" src="'. util_make_uri('/js/common.js') .'"></script>';
418 echo '<script type="text/javascript" src="/scripts/codendi/LayoutManager.js"></script>';
419 echo '<script type="text/javascript" src="/scripts/codendi/ReorderColumns.js"></script>';
420 echo '<script type="text/javascript" src="/scripts/codendi/codendi-1236793993.js"></script>';
421 echo '<script type="text/javascript" src="/scripts/codendi/validate.js"></script>';
422 echo '<script type="text/javascript" src="/scripts/codendi/Tooltip.js"></script>';
424 plugin_hook("javascript_file", false);
426 // invoke the 'javascript' hook for custom javascript addition
427 $params = array('return' => false);
428 plugin_hook("javascript", $params);
429 $javascript = $params['return'];
431 echo '<script type="text/javascript">//<![CDATA['."\n";
433 echo "\n//]]></script>\n";
437 html_use_simplemenu();
438 html_use_coolfieldset();
440 echo $this->getJavascripts();
441 echo $this->getStylesheets();
443 <script type="text/javascript">//<![CDATA[
445 jQuery(window).load(function(){
446 jQuery(".quicknews").hide();
447 setTimeout("jQuery('.feedback').hide('slow')", 5000);
456 // c-file-style: "bsd"