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, Franck Villaume - TrivialDev
9 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
11 * This file is part of FusionForge.
13 * FusionForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published
15 * by the Free Software Foundation; either version 2 of the License,
16 * or (at your option) any later version.
18 * FusionForge is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with FusionForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
29 require_once $gfwww.'include/Layout.class.php';
31 define('TOP_TAB_HEIGHT', 30);
32 define('BOTTOM_TAB_HEIGHT', 22);
34 class Theme extends Layout {
40 $this->themeurl = util_make_url('themes/funky/');
41 $this->imgbaseurl = $this->themeurl . 'images/';
42 $this->imgroot = $this->imgbaseurl;
43 // $this->doctype = 'strict';
45 $this->addStylesheet('/themes/funky/css/theme.css');
46 $this->addStylesheet('/themes/funky/css/theme-pages.css');
49 function quicknewsbutton()
51 return "<div class='quicknews-toggle'><a href=# onclick='jQuery(\".quicknews\").slideToggle()'>news</a></div>";
56 $ret = "<div class='quicknews'>";
58 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
59 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
60 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
61 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
67 function bodyHeader($params)
71 if (!isset($params['h1']) && isset($params['title'])) {
72 $params['h1'] = $params['title'];
75 if (!isset($params['title'])) {
76 $params['title'] = forge_get_config('forge_name');
78 $params['title'] = $params['title'] . " - forge_get_config('forge_name') ";
81 echo '<table id="header" class="width-100p100">' . "\n";
83 echo '<td id="header-col1">' . "\n";
84 echo util_make_link('/', html_image('/header/top-logo.png', null, null, array('alt'=>'FusionForge Home'))) . "\n";
87 echo '<td id="header-col2">' . "\n";
89 $items = $this->navigation->getUserLinks();
90 for ($j = 0; $j < count($items['titles']); $j++) {
91 $links[] = util_make_link($items['urls'][$j], $items['titles'][$j], array('class'=>'userlink'), true);
93 echo implode(' | ', $links);
94 plugin_hook('headermenu', $params);
99 echo '<td colspan="2" id="header-line2">' . "\n";
100 // echo $this->quicknewsbutton();
104 echo '</td></tr>' . "\n";
105 echo '<tr><td colspan="2" id="header-news">' . "\n";
106 //echo $this->quicknews();
107 echo'</td></tr></table><!-- outer tabs -->' . "\n";
108 echo $this->outerTabs($params);
109 echo '<!-- inner tabs -->' . "\n";
110 echo '<div class="innertabs">' . "\n";
111 if (isset($params['group']) && $params['group']) {
112 echo $this->projectTabs($params['toptab'], $params['group']);
115 echo '</div>' . "\n";
116 echo '<div id="maindiv">' . "\n";
118 plugin_hook('message', array());
120 if(isset($GLOBALS['error_msg']) && $GLOBALS['error_msg']) {
121 echo $this->error_msg($GLOBALS['error_msg']);
123 if(isset($GLOBALS['warning_msg']) && $GLOBALS['warning_msg']) {
124 echo $this->warning_msg($GLOBALS['warning_msg']);
126 if(isset($GLOBALS['feedback']) && $GLOBALS['feedback']) {
127 echo $this->feedback($GLOBALS['feedback']);
130 if (isset($params['h1'])) {
131 echo '<h1>'.$params['h1'].'</h1>';
132 } elseif (isset($params['title'])) {
133 echo '<h1 class="hide">'.$params['title'].'</h1>';
135 if (isset($params['submenu']))
136 echo $params['submenu'];
139 function bodyFooter($params) {
140 echo '</div><!-- id="maindiv" -->' . "\n";
143 function footer($params)
145 $this->bodyFooter($params);
146 echo '<div class="footer">' . "\n";
147 echo $this->navigation->getPoweredBy();
148 echo $this->navigation->getShowSource();
149 echo '<div style="clear:both"></div></div></body></html>' . "\n";
153 * boxTop() - Top HTML box
155 * @param string Box title
156 * @param bool Whether to echo or return the results
157 * @param string The box background color
159 function boxTop($title, $id = '')
162 $t_result .= '<div id="' . $this->toSlug($id) . '" class="box-surround">';
163 $t_result .= '<div id="'. $this->toSlug($id) . '-title" class="box-title">';
164 $t_result .= '<div class="box-title-content" id="'. $this->toSlug($id) .'-title-content">'. $title .'</div>';
165 $t_result .= '</div> <!-- class="box-title" -->';
171 * boxMiddle() - Middle HTML box
173 * @param string Box title
174 * @param string The box background color
176 function boxMiddle($title, $id = '')
178 $t_result ='<div id="title-'. $this->toSlug($id).'" class="box-middle">'.$title.'</div>';
184 * boxContent() - Content HTML box
186 * @param string Box content
188 function boxContent($content, $id = '')
190 $t_result ='<div id="'. $this->toSlug($id) .'-content" class="box-content">'.$content.'</div>';
195 * boxBottom() - Bottom HTML box
200 $t_result='</div><!-- class="box-surround" -->';
206 * boxGetAltRowStyle() - Get an alternating row style for tables
208 * @param int Row number
210 function boxGetAltRowStyle($i)
213 return 'class="bgcolor-white"';
215 return 'class="bgcolor-grey"';
218 function tabGenerator($TABS_DIRS, $TABS_TITLES, $nested=false, $selected=false, $sel_tab_bgcolor='WHITE', $total_width='100%')
220 $count = count($TABS_DIRS);
225 $return = '<!-- start tabs -->';
226 $return .= '<table class="tabGenerator width-100p100" summary="" ';
228 if ($total_width != '100%')
229 $return .= 'style="width:' . $total_width . ';"';
234 $accumulated_width = 0;
236 for ($i=0; $i<$count; $i++) {
237 $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width ;
238 $accumulated_width += $tabwidth ;
243 $return .= '<td class="tg-middle" style="width:'.$tabwidth.'%;"><a href="'.$TABS_DIRS[$i].'">' . "\n";
247 $return .= ' class="selected"';
253 $return .= ' class="nested"';
255 $return .= '>' . "\n";
256 $return .= ''.$TABS_TITLES[$i].'' . "\n";
257 $return .= '</span>';
258 $return .= '</span>' . "\n";
259 $return .= '</a></td>' . "\n";
263 $return .= '</tr></table><!-- end tabs -->';
269 * beginSubMenu() - Opening a submenu.
271 * @return string Html to start a submenu.
273 function beginSubMenu() {
274 $return = '<ul class="submenu">';
279 * endSubMenu() - Closing a submenu.
281 * @return string Html to end a submenu.
283 function endSubMenu() {
289 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
291 * @param array The array of titles.
292 * @param array The array of title links.
293 * @param array The array of attributs by link
294 * @return string Html to build a submenu.
296 function printSubMenu($title_arr, $links_arr, $attr_arr) {
297 $count = count($title_arr) - 1;
300 for ($i=0; $i<$count; $i++)
301 $return .= "<li><span>" . util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]) . "</span></li>";
303 $return .= "<li><span>" . util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]) . "</span></li>";
308 * subMenu() - Takes two array of titles and links and build a menu.
310 * @param array The array of titles.
311 * @param array The array of title links.
312 * @param array The array of attributs by link
313 * @return string Html to build a submenu.
315 function subMenu($title_arr, $links_arr, $attr_arr = false) {
316 $return = $this->beginSubMenu();
317 $return .= $this->printSubMenu($title_arr, $links_arr, $attr_arr);
318 $return .= $this->endSubMenu();
323 * multiTableRow() - create a mutlilevel row in a table
325 * @param string the row attributes
326 * @param array the array of cell data, each element is an array,
327 * the first item being the text,
328 * the subsequent items are attributes (dont include
329 * the bgcolor for the title here, that will be
330 * handled by $istitle
331 * @param boolean is this row part of the title ?
334 function multiTableRow($row_attr, $cell_data, $istitle)
336 $return= '<tr class="ff" '.$row_attr;
339 $return .=' align="center"';
343 for ( $c = 0; $c < count($cell_data); $c++ ) {
344 $return .='<td class="ff" ';
346 for ( $a=1; $a < count($cell_data[$c]); $a++)
347 $return .= $cell_data[$c][$a].' ';
352 $return .='<strong>';
354 $return .= $cell_data[$c][0];
357 $return .='</strong>';
368 * getThemeIdFromName()
370 * @param string the dirname of the theme
371 * @return integer the theme id
373 function getThemeIdFromName($dirname)
375 $res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1', array($dirname));
377 return db_result($res,0,'theme_id');
381 * headerJS() - creates the JS headers and calls the plugin javascript hook
382 * @todo generalize this
386 use_javascript('/scripts/jquery/jquery-1.4.2.min.js');
388 echo '<script type="text/javascript" src="'. util_make_uri('/js/common.js') .'"></script>';
389 echo '<script type="text/javascript" src="/scripts/codendi/LayoutManager.js"></script>';
390 echo '<script type="text/javascript" src="/scripts/codendi/ReorderColumns.js"></script>';
391 echo '<script type="text/javascript" src="/scripts/codendi/codendi-1236793993.js"></script>';
392 echo '<script type="text/javascript" src="/scripts/codendi/validate.js"></script>';
393 echo '<script type="text/javascript" src="/scripts/codendi/Tooltip.js"></script>';
395 plugin_hook("javascript_file",false);
396 echo $this->getJavascripts();
398 // invoke the 'javascript' hook for custom javascript addition
399 $params = array('return' => false);
400 plugin_hook("javascript",$params);
401 $javascript = $params['return'];
403 echo '<script type="text/javascript">';
405 echo '</script>'."\n";
408 <script type="text/javascript">
410 jQuery(window).load(function(){
411 jQuery(".quicknews").hide();
412 setTimeout("jQuery('.feedback').hide('slow')",5000);
422 // c-file-style: "bsd"