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-2016, 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 class Theme_Funky extends Layout {
30 function __construct() {
31 parent::__construct();
32 $this->themeurl = util_make_uri('themes/funky/');
33 $this->imgbaseurl = $this->themeurl . 'images/';
34 $this->imgroot = $this->imgbaseurl;
35 $this->addStylesheet('/themes/funky/css/theme.css');
36 $this->addStylesheet('/themes/funky/css/theme-pages.css');
37 $this->addStylesheet('/scripts/jquery-ui/css/overcast/jquery-ui-1.12.1.css');
38 $this->addStylesheet('/scripts/jquery-ui/css/overcast/jquery-ui.structure-1.12.1.css');
39 $this->addStylesheet('/scripts/jquery-ui/css/overcast/jquery-ui.theme-1.12.1.css');
42 function bodyHeader($params) {
43 if (!isset($params['h1']) && isset($params['title'])) {
44 $params['h1'] = $params['title'];
47 if (!isset($params['title'])) {
48 $params['title'] = forge_get_config('forge_name');
50 $params['title'] = $params['title'] . " - ".forge_get_config('forge_name');
53 echo $this->listTableTop(array(), array(), 'fullwidth', 'header');
55 $cells[] = array(util_make_link('/', html_image('/header/top-logo.png', null, null, array('alt'=>'FusionForge Home'))), 'id' => 'header-col1');
56 $items = $this->navigation->getUserLinks();
57 for ($j = 0; $j < count($items['titles']); $j++) {
58 $links[] = util_make_link($items['urls'][$j], $items['titles'][$j], array('class' => 'userlink'), true);
60 $params['links'] = &$links;
61 plugin_hook('headermenu', $params);
62 $template = isset($params['template']) ? $params['template'] : ' | ';
63 $cells[] = array(implode($template, $links), 'id' => 'header-col2');
64 echo $this->multiTableRow(array(), $cells);
66 $cells[] = array($this->quickNav().$this->searchBox(), 'id' => 'header-line2', 'colspan' => 2);
67 echo $this->multiTableRow(array(), $cells);
68 echo $this->listTableBottom();
69 $this->outerTabs($params);
70 echo '<!-- inner tabs -->' . "\n";
71 echo html_ao('div', array('class' => 'innertabs'));
72 if (isset($params['group']) && $params['group']) {
73 $this->projectTabs($params['toptab'], $params['group']);
76 echo html_ac(html_ap() -1);
77 echo html_ao('div', array('id' => 'maindiv'));
79 plugin_hook('message');
81 if(isset($GLOBALS['error_msg']) && $GLOBALS['error_msg']) {
82 echo $this->error_msg($GLOBALS['error_msg']);
84 if(isset($GLOBALS['warning_msg']) && $GLOBALS['warning_msg']) {
85 echo $this->warning_msg($GLOBALS['warning_msg']);
87 if(isset($GLOBALS['feedback']) && $GLOBALS['feedback']) {
88 echo $this->feedback($GLOBALS['feedback']);
91 if (isset($params['h1'])) {
92 echo html_e('h1', array(), $params['h1'], false);
93 } elseif (isset($params['title'])) {
94 echo html_e('h1', array('class' => 'hide'), $params['title'], false);
96 if (isset($params['submenu']))
97 echo $params['submenu'];
100 function bodyFooter($params) {
101 echo html_ac(html_ap() -1).'<!-- id="maindiv" -->' . "\n";
104 function footer($params = array()) {
105 $this->bodyFooter($params);
106 echo html_ao('div', array('class' => 'footer'));
107 echo $this->navigation->getPoweredBy();
108 echo $this->navigation->getShowSource();
109 echo html_e('div', array('style' => 'clear:both'), '', false);
110 echo html_ac(html_ap() -1);
111 plugin_hook('webanalytics_url');
112 echo html_ac(html_ap() -1);
113 echo '</html>' . "\n";
117 * boxTop() - Top HTML box
119 * @param string $title Box title
123 function boxTop($title, $id = '') {
125 $id = $this->toSlug($id);
127 $idtitle = $id.'-title';
128 $idtcont = $id.'-title-content';
136 $t_result .= html_ao('div', array('id' => $idid, 'class' => 'box-surround'));
137 $t_result .= html_ao('div', array('id' => $idtitle, 'class' => 'box-title'));
138 $t_result .= html_e('div', array('id' => $idtcont, 'class' => 'box-title-content'), $title, false);
139 $t_result .= html_ac(html_ap() -1);
144 * boxMiddle() - Middle HTML box
146 * @param string $title Box title
150 function boxMiddle($title, $id = '') {
152 $id = $this->toSlug($id);
153 $idtitle = $id.'-title"';
158 return html_e('div', array('id' => $idtitle, 'class' => 'box-middle'), $title, false);
162 * boxContent() - Content HTML box
164 * @param string $content Box content
168 function boxContent($content, $id = '') {
170 $id = $this->toSlug($id);
171 $idcont = $id.'-content"';
176 return html_e('div', array('id' => $idcont, 'class' => 'box-content'), $content, false);
180 * boxBottom() - Bottom HTML box
184 function boxBottom() {
185 return html_ac(html_ap() -1).'<!-- class="box-surround" -->'."\n";
189 * boxGetAltRowStyle() - Get an alternating row style for tables
191 * @param int $i Row number
192 * @param bool $classonly Return class name only
195 function boxGetAltRowStyle($i, $classonly = false) {
197 $ret = 'bgcolor-white';
199 $ret = 'bgcolor-grey';
203 return 'class="'.$ret.'"';
206 function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS, $nested=false, $selected=false, $sel_tab_bgcolor='WHITE', $total_width='100%') {
207 $count = count($TABS_DIRS);
213 $return = '<!-- start tabs -->'."\n";
214 $attrs = array('class' => 'tabGenerator fullwidth');
216 if ($total_width != '100%')
217 $attrs['style'] = 'width:' . $total_width;
219 $return .= html_ao('table', $attrs);
220 $return .= html_ao('tr');
222 $accumulated_width = 0;
224 for ($i = 0; $i < $count; $i++) {
225 $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width;
226 $accumulated_width += $tabwidth;
230 $attrs['class'] = 'tg-middle';
231 $attrs['style'] = 'width:'.$tabwidth.'%';
232 $return .= html_ao('td', $attrs);
234 $attrs['id'] = md5($TABS_DIRS[$i]);
235 $attrs['href'] = $TABS_DIRS[$i];
236 if (preg_match('/^https?:\/\//', $TABS_DIRS[$i])) {
237 $attrs['target'] = '_blank';
239 $return .= html_ao('a', $attrs);
242 $attrs['class'] = 'selected';
244 $return .= html_ao('span', $attrs);
245 $attrs = array('title' => $TABS_TOOLTIPS[$i]);
247 $attrs['class'] = 'nested';
249 $return .= html_e('span', $attrs, $TABS_TITLES[$i], false);
250 $return .= html_ac(html_ap() - 3);
253 $return .= html_ac(html_ap() -2).'<!-- end tabs -->'."\n";
258 * beginSubMenu() - Opening a submenu.
260 * @return string Html to start a submenu.
262 function beginSubMenu() {
263 return html_ao('ul', array('class' => 'submenu'));
267 * endSubMenu() - Closing a submenu.
269 * @return string Html to end a submenu.
271 function endSubMenu() {
272 return html_ac(html_ap() -1);
276 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
278 * @param array $title_arr The array of titles.
279 * @param array $links_arr The array of title links.
280 * @param array $attr_arr The array of attributs by link
281 * @return string Html to build a submenu.
283 function printSubMenu($title_arr, $links_arr, $attr_arr) {
284 $count = count($title_arr) - 1;
287 if (!count($attr_arr)) {
288 for ($i=0; $i<count($title_arr); $i++) {
292 for ($i = 0; $i < $count; $i++) {
293 $return .= html_ao('li');
294 $return .= html_e('span', array(), util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]), false);
295 $return .= html_ac(html_ap() -1);
298 $return .= html_ao('li');
299 $return .= html_e('span', array(), util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]), false);
300 $return .= html_ac(html_ap() -1);
305 * subMenu() - Takes two array of titles and links and build a menu.
307 * @param array $title_arr The array of titles.
308 * @param array $links_arr The array of title links.
309 * @param array $attr_arr The array of attributes by link
310 * @return string Html to build a submenu.
312 function subMenu($title_arr, $links_arr, $attr_arr = array()) {
313 $return = $this->beginSubMenu();
314 $return .= $this->printSubMenu($title_arr, $links_arr, $attr_arr);
315 $return .= $this->endSubMenu();
320 * headerJS() - creates the JS headers and calls the plugin javascript hook
321 * @todo generalize this
323 function headerJS() {
324 global $use_tooltips;
326 echo html_e('script', array('type' => 'text/javascript', 'src' => util_make_uri('/js/common.js')), '', false);
327 plugin_hook("javascript_file");
329 // invoke the 'javascript' hook for custom javascript addition
330 $params = array('return' => false);
331 plugin_hook("javascript", $params);
332 $javascript = $params['return'];
334 echo html_ao('script', array('type' => 'text/javascript')).'//<![CDATA['."\n";
336 echo "\n".'//]]'."\n";
337 echo html_ac(html_ap() -1);
340 html_use_coolfieldset();
342 echo $this->getJavascripts();
343 echo html_ao('script', array('type' => 'text/javascript'));
345 jQuery(window).load(function(){
346 setTimeout("jQuery(\'.feedback\').hide(\'slow\')", 5000);
347 setInterval(function() {
348 setTimeout("jQuery(\'.feedback\').hide(\'slow\')", 5000);
350 jQuery("button").button();
351 jQuery(":submit").button();
352 jQuery(":reset").button();
353 jQuery(":button").button();
354 jQuery("#tabber").tabs();
358 echo ' jQuery(document).ready(
360 jQuery(document).tooltip({
362 effect: \'slideDown\'
365 open: function (event, ui) {
366 setTimeout(function () {
367 jQuery(ui.tooltip).hide(\'slideUp\');
374 echo html_ac(html_ap() -1);
380 // c-file-style: "bsd"