3 * FusionForge Funky Theme
5 * Copyright 2010, Antoine Mercadal - Capgemini
6 * Copyright 2010, Marc-Etienne Vargenau, Alcatel-Lucent
7 * Copyright 2011, Franck Villaume - Capgemini
9 * This file is part of FusionForge.
11 * FusionForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published
13 * by the Free Software Foundation; either version 2 of the License,
14 * or (at your option) any later version.
16 * FusionForge is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with FusionForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28 require_once $gfwww.'include/Layout.class.php';
30 define('TOP_TAB_HEIGHT', 30);
31 define('BOTTOM_TAB_HEIGHT', 22);
33 class Theme extends Layout {
39 $this->themeurl = util_make_url('themes/funky/');
40 $this->imgbaseurl = $this->themeurl . 'images/';
41 $this->imgroot = $this->imgbaseurl;
42 // $this->doctype = 'strict';
44 $this->addStylesheet('/themes/funky/css/theme.css');
45 $this->addStylesheet('/themes/funky/css/theme-pages.css');
48 function quicknewsbutton()
50 return "<div class='quicknews-toggle'><a href=# onclick='jQuery(\".quicknews\").slideToggle()'>news</a></div>";
55 $ret = "<div class='quicknews'>";
57 $ret .= "<li><h1>news de ouf</h1>hello world</li>";
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>";
66 function bodyHeader($params)
68 global $user_guide, $HTML;
69 echo '<table id="header" class="width-100p100">' . "\n";
71 echo '<td id="header-col1">' . "\n";
72 echo '<h1>'. util_make_link ('/', html_image('/header/top-logo.png',null,null,array('alt'=>'FusionForge Home'))) .'</h1>' . "\n";
74 echo '<td id="header-col2">' . "\n";
76 $items = $this->navigation->getUserLinks();
77 for ($j = 0; $j < count($items['titles']); $j++)
79 $links[] = util_make_link($items['urls'][$j], $items['titles'][$j], array('class'=>'userlink'), true);
81 echo implode(' | ', $links);
82 plugin_hook ('headermenu', $params);
87 echo '<td colspan="2" id="header-line2">' . "\n";
88 // echo $this->quicknewsbutton();
92 echo '</td></tr>' . "\n";
93 echo '<tr><td colspan="2" id="header-news">' . "\n";
94 //echo $this->quicknews();
95 echo'</td></tr></table><!-- outer tabs -->' . "\n";
96 echo $this->outerTabs($params);
97 echo '<!-- inner tabs -->' . "\n";
98 echo '<div class="innertabs">' . "\n";
99 if (isset($params['group']) && $params['group'])
100 echo $this->projectTabs($params['toptab'],$params['group']);
102 echo '</div>' . "\n";
103 echo '<div id="maindiv">' . "\n";
106 function bodyFooter($params) {
107 echo '</div><!-- id="maindiv" -->' . "\n";
110 function footer($params)
112 $this->bodyFooter($params);
113 echo '<div class="footer">' . "\n";
114 // echo '<div>Theme designed by Antoine Mercadal. Copyright © 2010 Capgemini';
115 echo $this->navigation->getPoweredBy();
116 echo $this->navigation->getShowSource();
117 echo '<div style="clear:both"></div></div></body></html>' . "\n";
121 * boxTop() - Top HTML box
123 * @param string Box title
124 * @param bool Whether to echo or return the results
125 * @param string The box background color
127 function boxTop($title, $id = '')
130 $t_result .= '<div id="' . $this->toSlug($id) . '" class="box-surround">';
131 $t_result .= '<div id="'. $this->toSlug($id) . '-title" class="box-title">';
132 $t_result .= '<div class="box-title-content" id="'. $this->toSlug($id) .'-title-content">'. $title .'</div>';
133 $t_result .= '</div> <!-- class="box-title" -->';
139 * boxMiddle() - Middle HTML box
141 * @param string Box title
142 * @param string The box background color
144 function boxMiddle($title, $id = '')
146 $t_result ='<div id="title-'. $this->toSlug($id).'" class="box-middle">'.$title.'</div>';
152 * boxContent() - Content HTML box
154 * @param string Box content
156 function boxContent($content, $id = '')
158 $t_result ='<div id="'. $this->toSlug($id) .'-content" class="box-content">'.$content.'</div>';
163 * boxBottom() - Bottom HTML box
168 $t_result='</div><!-- class="box-surround" -->';
174 * boxGetAltRowStyle() - Get an alternating row style for tables
176 * @param int Row number
178 function boxGetAltRowStyle($i)
181 return 'class="bgcolor-white"';
183 return 'class="bgcolor-grey"';
186 function tabGenerator($TABS_DIRS, $TABS_TITLES, $nested=false, $selected=false, $sel_tab_bgcolor='WHITE', $total_width='100%')
188 $count=count($TABS_DIRS);
193 $return = '<!-- start tabs -->';
194 $return .= '<table class="tabGenerator width-100p100" summary="" ';
196 if ($total_width != '100%')
197 $return .= 'style="width:' . $total_width . ';"';
202 $accumulated_width = 0;
204 for ($i=0; $i<$count; $i++)
206 $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width ;
207 $accumulated_width += $tabwidth ;
212 $return .= '<td class="tg-middle" style="width:'.$tabwidth.'%;"><a href="'.$TABS_DIRS[$i].'">' . "\n";
216 $return .= ' class="selected"';
222 $return .= ' class="nested"';
224 $return .= '>' . "\n";
225 $return .= ''.$TABS_TITLES[$i].'' . "\n";
226 $return .= '</span>';
227 $return .= '</span>' . "\n";
228 $return .= '</a></td>' . "\n";
232 $return .= '</tr></table><!-- end tabs -->';
238 * beginSubMenu() - Opening a submenu.
240 * @return string Html to start a submenu.
242 function beginSubMenu() {
243 $return = '<ul class="submenu">';
248 * endSubMenu() - Closing a submenu.
250 * @return string Html to end a submenu.
252 function endSubMenu() {
258 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
260 * @param array The array of titles.
261 * @param array The array of title links.
262 * @param array The array of attributs by link
263 * @return string Html to build a submenu.
265 function printSubMenu($title_arr, $links_arr, $attr_arr) {
266 $count = count($title_arr) - 1;
269 for ($i=0; $i<$count; $i++)
270 $return .= "<li><span>" . util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]) . "</span></li>";
272 $return .= "<li><span>" . util_make_link($links_arr[$i], $title_arr[$i], $attr_arr[$i]) . "</span></li>";
277 * subMenu() - Takes two array of titles and links and build a menu.
279 * @param array The array of titles.
280 * @param array The array of title links.
281 * @param array The array of attributs by link
282 * @return string Html to build a submenu.
284 function subMenu($title_arr, $links_arr, $attr_arr = false) {
285 $return = $this->beginSubMenu();
286 $return .= $this->printSubMenu($title_arr, $links_arr, $attr_arr);
287 $return .= $this->endSubMenu();
292 * multiTableRow() - create a mutlilevel row in a table
294 * @param string the row attributes
295 * @param array the array of cell data, each element is an array,
296 * the first item being the text,
297 * the subsequent items are attributes (dont include
298 * the bgcolor for the title here, that will be
299 * handled by $istitle
300 * @param boolean is this row part of the title ?
303 function multiTableRow($row_attr, $cell_data, $istitle)
305 $return= '<tr class="ff" '.$row_attr;
308 $return .=' align="center"';
312 for ( $c = 0; $c < count($cell_data); $c++ )
314 $return .='<td class="ff" ';
316 for ( $a=1; $a < count($cell_data[$c]); $a++)
317 $return .= $cell_data[$c][$a].' ';
322 $return .='<strong>';
324 $return .= $cell_data[$c][0];
327 $return .='</strong>';
338 * getThemeIdFromName()
340 * @param string the dirname of the theme
341 * @return integer the theme id
343 function getThemeIdFromName($dirname)
345 $res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1', array($dirname));
347 return db_result($res,0,'theme_id');
351 * headerJS() - creates the JS headers and calls the plugin javascript hook
352 * @todo generalize this
356 use_javascript('/scripts/jquery/jquery-1.4.2.min.js');
358 echo '<script type="text/javascript" src="'. util_make_uri('/js/common.js') .'"></script>';
359 echo '<script type="text/javascript" src="/scripts/codendi/LayoutManager.js"></script>';
360 echo '<script type="text/javascript" src="/scripts/codendi/ReorderColumns.js"></script>';
361 echo '<script type="text/javascript" src="/scripts/codendi/codendi-1236793993.js"></script>';
362 echo '<script type="text/javascript" src="/scripts/codendi/validate.js"></script>';
363 echo '<script type="text/javascript" src="/scripts/codendi/Tooltip.js"></script>';
365 echo '<script type="text/javascript">';
366 plugin_hook ("javascript",false);
367 echo '</script>'."\n";
369 plugin_hook ("javascript_file",false);
370 echo $this->getJavascripts();
372 <script type="text/javascript">
374 jQuery(window).load(function(){
375 jQuery(".quicknews").hide();
376 setTimeout("jQuery('.feedback').hide('slow')",5000);
386 // c-file-style: "bsd"