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></body></html>' . "\n";
145 * boxTop() - Top HTML box
147 * @param string Box title
148 * @param bool Whether to echo or return the results
149 * @param string The box background color
151 function boxTop($title, $id = '') {
153 $id = $this->toSlug($id);
154 $idid = ' id="' . $id . '"';
155 $idtitle = ' id="' . $id . '-title"';
156 $idtcont = ' id="' . $id . '-title-content"';
164 $t_result .= '<div' . $idid . ' class="box-surround">';
165 $t_result .= '<div' . $idtitle . ' class="box-title">';
166 $t_result .= '<div' . $idtcont . ' class="box-title-content">'. $title .'</div>';
167 $t_result .= '</div> <!-- class="box-title" -->';
173 * boxMiddle() - Middle HTML box
175 * @param string Box title
176 * @param string The box background color
178 function boxMiddle($title, $id = '') {
180 $id = $this->toSlug($id);
181 $idtitle = ' id="' . $id . '-title"';
186 $t_result ='<div' . $idtitle . ' class="box-middle">'.$title.'</div>';
192 * boxContent() - Content HTML box
194 * @param string Box content
196 function boxContent($content, $id = '') {
198 $id = $this->toSlug($id);
199 $idcont = ' id="' . $id . '-content"';
204 $t_result ='<div' . $idcont . ' class="box-content">'.$content.'</div>';
209 * boxBottom() - Bottom HTML box
212 function boxBottom() {
213 $t_result='</div><!-- class="box-surround" -->';
219 * boxGetAltRowStyle() - Get an alternating row style for tables
221 * @param int Row number
223 function boxGetAltRowStyle($i) {
225 return 'class="bgcolor-white"';
227 return 'class="bgcolor-grey"';
230 function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS, $nested=false, $selected=false, $sel_tab_bgcolor='WHITE', $total_width='100%') {
231 $count = count($TABS_DIRS);
236 global $use_tooltips;
240 <script type="text/javascript">//<![CDATA[
241 if (typeof(jQuery(window).tipsy) == 'function') {
242 jQuery(document).ready(
244 jQuery('.tabtitle').tipsy({delayIn: 500, delayOut: 0, fade: true});
245 jQuery('.tabtitle-nw').tipsy({gravity: 'nw', delayIn: 500, delayOut: 0, fade: true});
246 jQuery('.tabtitle-ne').tipsy({gravity: 'ne', delayIn: 500, delayOut: 0, fade: true});
247 jQuery('.tabtitle-w').tipsy({gravity: 'w', delayIn: 500, delayOut: 0, fade: true});
248 jQuery('.tabtitle-e').tipsy({gravity: 'e', delayIn: 500, delayOut: 0, fade: true});
249 jQuery('.tabtitle-sw').tipsy({gravity: 'sw', delayIn: 500, delayOut: 0, fade: true});
250 jQuery('.tabtitle-se').tipsy({gravity: 'se', delayIn: 500, delayOut: 0, fade: true});
258 $return = '<!-- start tabs -->';
259 $return .= '<table class="tabGenerator width-100p100" ';
261 if ($total_width != '100%')
262 $return .= 'style="width:' . $total_width . ';"';
267 $accumulated_width = 0;
269 for ($i=0; $i<$count; $i++) {
270 $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width ;
271 $accumulated_width += $tabwidth ;
276 $return .= '<td class="tg-middle" style="width:'.$tabwidth.'%;"><a ';
277 $return .= 'id="'.md5($TABS_DIRS[$i]).'" ';
279 $return .= 'class="tabtitle" title="'.$TABS_TOOLTIPS[$i].'"';
280 $return .= 'href="'.$TABS_DIRS[$i].'">' . "\n";
284 $return .= ' class="selected"';
290 $return .= ' class="nested"';
292 $return .= '>' . "\n";
293 $return .= ''.$TABS_TITLES[$i].'' . "\n";
294 $return .= '</span>';
295 $return .= '</span>' . "\n";
296 $return .= '</a></td>' . "\n";
300 $return .= '</tr></table><!-- end tabs -->';
306 * beginSubMenu() - Opening a submenu.
308 * @return string Html to start a submenu.
310 function beginSubMenu() {
311 $return = '<ul class="submenu">';
316 * endSubMenu() - Closing a submenu.
318 * @return string Html to end a submenu.
320 function endSubMenu() {
326 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
328 * @param array The array of titles.
329 * @param array The array of title links.
330 * @param array The array of attributs by link
331 * @return string Html to build a submenu.
333 function printSubMenu($title_arr, $links_arr, $attr_arr) {
334 $count = count($title_arr) - 1;
337 for ($i=0; $i<$count; $i++)
338 $return .= "<li><span>" . util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]) . "</span></li>";
340 $return .= "<li><span>" . util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]) . "</span></li>";
345 * subMenu() - Takes two array of titles and links and build a menu.
347 * @param array The array of titles.
348 * @param array The array of title links.
349 * @param array The array of attributs by link
350 * @return string Html to build a submenu.
352 function subMenu($title_arr, $links_arr, $attr_arr = false) {
353 $return = $this->beginSubMenu();
354 $return .= $this->printSubMenu($title_arr, $links_arr, $attr_arr);
355 $return .= $this->endSubMenu();
360 * multiTableRow() - create a mutlilevel row in a table
362 * @param string the row attributes
363 * @param array the array of cell data, each element is an array,
364 * the first item being the text,
365 * the subsequent items are attributes (dont include
366 * the bgcolor for the title here, that will be
367 * handled by $istitle
368 * @param boolean is this row part of the title ?
371 function multiTableRow($row_attr, $cell_data, $istitle)
373 $return= '<tr class="ff" '.$row_attr;
375 $return .=' align="center"';
378 for ( $c = 0; $c < count($cell_data); $c++ ) {
379 $return .='<td class="ff" ';
380 for ( $a=1; $a < count($cell_data[$c]); $a++)
381 $return .= $cell_data[$c][$a].' ';
385 $return .='<strong>';
387 $return .= $cell_data[$c][0];
389 $return .='</strong>';
398 * getThemeIdFromName()
400 * @param string the dirname of the theme
401 * @return integer the theme id
403 function getThemeIdFromName($dirname)
405 $res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1', array($dirname));
406 return db_result($res, 0, 'theme_id');
410 * headerJS() - creates the JS headers and calls the plugin javascript hook
411 * @todo generalize this
415 echo '<script type="text/javascript" src="'. util_make_uri('/js/common.js') .'"></script>';
416 echo '<script type="text/javascript" src="/scripts/codendi/LayoutManager.js"></script>';
417 echo '<script type="text/javascript" src="/scripts/codendi/ReorderColumns.js"></script>';
418 echo '<script type="text/javascript" src="/scripts/codendi/codendi-1236793993.js"></script>';
419 echo '<script type="text/javascript" src="/scripts/codendi/validate.js"></script>';
420 echo '<script type="text/javascript" src="/scripts/codendi/Tooltip.js"></script>';
422 plugin_hook("javascript_file", false);
424 // invoke the 'javascript' hook for custom javascript addition
425 $params = array('return' => false);
426 plugin_hook("javascript", $params);
427 $javascript = $params['return'];
429 echo '<script type="text/javascript">//<![CDATA['."\n";
431 echo "\n//]]></script>\n";
435 html_use_simplemenu();
436 html_use_coolfieldset();
438 echo $this->getJavascripts();
439 echo $this->getStylesheets();
441 <script type="text/javascript">//<![CDATA[
443 jQuery(window).load(function(){
444 jQuery(".quicknews").hide();
445 setTimeout("jQuery('.feedback').hide('slow')", 5000);
454 // c-file-style: "bsd"