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-2017, 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_Guy extends Layout {
31 function __construct() {
32 parent::__construct();
33 $this->themeurl = util_make_uri('themes/funky-guy/');
34 $this->imgbaseurl = $this->themeurl . 'images/';
35 $this->addStylesheet('/themes/funky-guy/css/theme.css');
36 $this->addStylesheet('/themes/funky-guy/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');
43 * headerJS() - creates the JS headers and calls the plugin javascript hook
44 * @todo generalize this
49 echo html_e('script', array('type' => 'text/javascript', 'src' => util_make_uri('/js/common.js')), '', false);
50 plugin_hook("javascript_file");
52 // invoke the 'javascript' hook for custom javascript addition
53 $params = array('return' => false);
54 plugin_hook("javascript", $params);
55 $javascript = $params['return'];
57 echo html_ao('script', array('type' => 'text/javascript')).'//<![CDATA['."\n";
59 echo "\n".'//]]'."\n";
60 echo html_ac(html_ap() -1);
63 html_use_coolfieldset();
65 echo $this->getJavascripts();
66 echo html_ao('script', array('type' => 'text/javascript'));
68 jQuery(window).load(function(){
69 setTimeout("jQuery(\'.feedback\').hide(\'slow\')", 5000);
70 setInterval(function() {
71 setTimeout("jQuery(\'.feedback\').hide(\'slow\')", 5000);
73 jQuery("button").button();
74 jQuery(":submit").button();
75 jQuery(":reset").button();
76 jQuery(":button").button();
77 jQuery("#tabber").tabs();
78 jQuery("input").filter(\'[type="number"]\').spinner();
82 echo ' jQuery(document).ready(
84 jQuery(document).tooltip({
89 open: function (event, ui) {
90 setTimeout(function () {
91 jQuery(ui.tooltip).hide(\'slideUp\');
98 echo html_ac(html_ap() -1);
99 echo html_ao('script', array('type' => 'text/javascript'));
100 echo 'function checkMenu(){
101 document.getElementById("hamburgerButton").checked = true;
103 echo html_ac(html_ap() -1);
106 function hamburgerButton() {
107 $hamburgerIcon = '<svg viewBox="0 0 50 40" width="20" height="20" fill="#eee">
108 <rect width="50" height="7"></rect>
109 <rect y="15" width="50" height="7"></rect>
110 <rect y="30" width="50" height="7"></rect>
112 echo html_ao('label', array('for' => 'hamburgerButton'));
114 echo html_ac(html_ap() -1); // </label>
117 function bodyHeader($params) {
118 if (!isset($params['h1']) && isset($params['title'])) {
119 $params['h1'] = $params['title'];
122 if (!isset($params['title'])) {
123 $params['title'] = forge_get_config('forge_name');
125 $params['title'] = $params['title'] . " - ".forge_get_config('forge_name');
128 echo html_ao('header', array('role' => 'banner'));
129 echo html_ao('nav', array('role' => 'navigation'));
131 $skipToContent = _('Skip to content');
132 $skipToMenu = _('Skip to menu');
133 echo html_ao('a', array('href' => '#content', 'class' => 'skipLink'));
135 echo html_ac(html_ap() -1); // </a>
136 echo html_ao('a', array('href' => '#menu', 'class' => 'skipLink',
137 'onclick' => 'checkMenu()'));
139 echo html_ac(html_ap() -1); // </a>
141 echo $this->hamburgerButton();
142 echo html_ao('logo');
143 echo util_make_link('/', html_image('header/header-logo.png', null, null, array('alt'=>'FusionForge Home', 'height'=>'40')));
144 echo html_ac(html_ap() -1); // </logo>
145 echo $this->searchBox();
147 $items = $this->navigation->getUserLinks();
148 for ($j = 0; $j < count($items['titles']); $j++) {
149 $links[] = html_ao('li')
150 .util_make_link($items['urls'][$j], $items['titles'][$j], array('class' => 'userlink'), true)
151 .html_ac(html_ap() -1);
153 $params['links'] = &$links;
154 plugin_hook('headermenu', $params);
155 $template = isset($params['template']) ? $params['template'] : null;
157 echo html_ao('div', array('id' => 'userlinksdiv'));
159 echo implode($template, $links);
160 echo html_ac(html_ap() -1); // </ul>
161 echo html_ac(html_ap() -1); // </div> #userlinkdiv
163 echo util_make_link('#', null, array('id' => 'menu', 'name' => 'menu'));
164 echo html_ao('div', array('id' => 'menudiv'));
165 echo html_ao('input', array('id' => 'hamburgerButton', 'type' => 'checkbox'));
166 echo html_ac(html_ap() -1); // </input>
167 echo html_ao('div', array('id' => 'hamburgermenudiv'));
168 $this->outerTabs($params);
169 echo html_ac(html_ap() -1); // </div> #hamburgermenudiv
170 echo html_ao('div', array('id' => 'userlinkshamburgerdiv'));
172 echo implode($template, array_reverse($links));
173 echo html_ac(html_ap() -1); // </ul>
174 echo html_ac(html_ap() -1); // </div> #userlinkhamburgerdiv
175 echo html_ac(html_ap() -1); // </div> #menudiv
177 echo $this->quickNav();
178 echo '<!-- inner tabs -->' . "\n";
179 echo html_ao('div', array('class' => 'innertabs'));
180 if (isset($params['group']) && $params['group']) {
181 $this->projectTabs($params['toptab'], $params['group']);
183 echo html_ac(html_ap() -1); // </div> #tabGenerator
184 echo html_ac(html_ap() -1); // </div> #innertabs
185 echo html_ac(html_ap() -1); // </nav>
186 echo html_ac(html_ap() -2); // </header>
188 echo util_make_link('#', null, array('id' => 'content', 'name' => 'content'));
190 echo html_ao('main', array('id' => 'maindiv', 'role' => 'main'));
191 plugin_hook('message');
193 if (isset($GLOBALS['error_msg']) && $GLOBALS['error_msg']) {
194 echo $this->error_msg($GLOBALS['error_msg']);
196 if (isset($GLOBALS['warning_msg']) && $GLOBALS['warning_msg']) {
197 echo $this->warning_msg($GLOBALS['warning_msg']);
199 if (isset($GLOBALS['feedback']) && $GLOBALS['feedback']) {
200 echo $this->feedback($GLOBALS['feedback']);
203 if (!empty($params['h1'])) {
204 echo html_e('h1', array(), $params['h1'], false);
205 } elseif (!empty($params['title'])) {
206 echo html_e('h1', array('class' => 'hide'), $params['title'], false);
208 if (isset($params['submenu'])) {
209 echo $params['submenu'];
213 function bodyFooter() {
214 echo html_ac(html_ap() -1).'<!-- id="maindiv" -->' . "\n";
219 echo html_ao('footer', array('role' => 'contentinfo'));
220 echo $this->navigation->getPoweredBy();
221 echo $this->navigation->getShowSource();
222 echo html_e('div', array('style' => 'clear:both'), '', false);
223 echo html_ac(html_ap() -1);
224 plugin_hook('webanalytics_url');
225 echo html_ac(html_ap() -1);
227 echo html_ao('div', array('id' => 'loader'));
229 echo html_ac(html_ap() -2); // </div>
230 echo html_ao('script');
232 var loader = document.getElementById("loader");
233 function loadSubmit(event) {
234 loader.style.top = "0";
235 loader.classList.add("loading");
237 var max = document.getElementsByTagName("FORM").length;
239 for (let i = 0 ; i < max ; i++){
240 document.forms[i].addEventListener("submit", loadSubmit);
244 echo html_ac(html_ap() -1);
246 echo '</html>' . "\n";
250 * boxTop() - Top HTML box
252 * @param string $title Box title
256 function boxTop($title, $id = '') {
258 $id = $this->toSlug($id);
260 $idtitle = $id.'-title';
261 $idtcont = $id.'-title-content';
269 $t_result .= html_ao('div', array('id' => $idid, 'class' => 'box-surround'));
270 $t_result .= html_ao('div', array('id' => $idtitle, 'class' => 'box-title'));
271 $t_result .= html_e('div', array('id' => $idtcont, 'class' => 'box-title-content'), $title, false);
272 $t_result .= html_ac(html_ap() -1);
277 * boxMiddle() - Middle HTML box
279 * @param string $title Box title
283 function boxMiddle($title, $id = '') {
285 $id = $this->toSlug($id);
286 $idtitle = $id.'-title"';
291 return html_e('div', array('id' => $idtitle, 'class' => 'box-middle'), $title, false);
295 * boxContent() - Content HTML box
297 * @param string $content Box content
301 function boxContent($content, $id = '') {
303 $id = $this->toSlug($id);
304 $idcont = $id.'-content"';
309 return html_e('div', array('id' => $idcont, 'class' => 'box-content'), $content, false);
313 * boxBottom() - Bottom HTML box
317 function boxBottom() {
318 return html_ac(html_ap() -1).'<!-- class="box-surround" -->'."\n";
321 function tabGenerator($tabs_dirs, $tabs_titles, $tabs_tooltips, $nested=false, $selected=false, $sel_tab_bgcolor='white', $total_width='100%') {
322 $count = count($tabs_dirs);
328 $return = '<!-- start tabs -->'."\n";
329 $attrs = array('class' => 'tabGenerator fullwidth');
331 if ($total_width != '100%')
332 $attrs['style'] = 'width:' . $total_width;
334 $return .= html_ao('div', $attrs);
335 $return .= html_ao('ul');
337 $accumulated_width = 0;
339 for ($i = 0; $i < $count; $i++) {
340 $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width;
341 $accumulated_width += $tabwidth;
345 $attrs['class'] = 'tg-middle';
346 $return .= html_ao('li', $attrs);
348 $attrs['id'] = md5($tabs_dirs[$i]).rand();
349 $attrs['href'] = $tabs_dirs[$i];
350 if (preg_match('/^https?:\/\//', $tabs_dirs[$i])) {
351 $attrs['target'] = '_blank';
353 $return .= html_ao('a', $attrs);
355 $attrs = array('title' => $tabs_tooltips[$i]);
357 $attrs['class'] = 'selected';
359 $attrs['class'] = 'nested';
361 $return .= html_e('span', $attrs, $tabs_titles[$i], false);
362 $return .= html_ac(html_ap() - 2);
365 $return .= html_ac(html_ap() -1).'<!-- end tabs -->'."\n";
370 * beginSubMenu() - Opening a submenu.
372 * @return string Html to start a submenu.
374 function beginSubMenu() {
375 return html_ao('ul', array('class' => 'submenu'));
379 * endSubMenu() - Closing a submenu.
381 * @return string Html to end a submenu.
383 function endSubMenu() {
384 return html_ac(html_ap() -1);
388 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
390 * @param array $title_arr The array of titles.
391 * @param array $links_arr The array of title links.
392 * @param array $attr_arr The array of attributs by link
393 * @return string Html to build a submenu.
395 function printSubMenu($title_arr, $links_arr, $attr_arr) {
396 $count = count($title_arr) - 1;
399 if (!count($attr_arr)) {
400 for ($i=0; $i<count($title_arr); $i++) {
404 for ($i = 0; $i < $count; $i++) {
405 $return .= html_ao('li');
406 $return .= html_e('span', array(), util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]), false);
407 $return .= html_ac(html_ap() -1);
410 $return .= html_ao('li');
411 $return .= html_e('span', array(), util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]), false);
412 $return .= html_ac(html_ap() -1);
417 * subMenu() - Takes two array of titles and links and build a menu.
419 * @param array $title_arr The array of titles.
420 * @param array $links_arr The array of title links.
421 * @param array $attr_arr The array of attributes by link
422 * @return string Html to build a submenu.
424 function subMenu($title_arr, $links_arr, $attr_arr = array()) {
425 $return = $this->beginSubMenu();
426 $return .= $this->printSubMenu($title_arr, $links_arr, $attr_arr);
427 $return .= $this->endSubMenu();
434 // c-file-style: "bsd"