* Base layout class.
*
* Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 - Alain Peyrat
+ * Copyright 2010 - Franck Villaume - Capgemini
+ * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge.
*/
require_once $gfcommon.'include/constants.php';
+require_once $gfcommon.'include/FusionForge.class.php';
require_once $gfcommon.'include/Navigation.class.php';
class Layout extends Error {
*/
var $doctype = 'transitional';
- /**
- * Which cssfiles to use. Can be configured in the
- * constructor.
- *
- * @var array $cssurls is a list of urls that should point to
- * the used stylesheets.
- */
- var $cssurls;
-
/**
* The default main page content
- * @var string $rootindex
+ * @var string $rootindex
*/
var $rootindex = 'index_std.php';
/**
* The base directory of the theme in the servers file system
- * @var string $themedir
+ * @var string $themedir
*/
var $themedir;
/**
* The base url of the theme
- * @var string $themeurl
+ * @var string $themeurl
*/
var $themeurl;
- /**
- * The base directory of the css files in the servers file system
- * @var string $cssdir
- */
- var $cssdir;
-
- /**
- * The base url of the css files
- * @var string $cssbaseurl
- */
- var $cssbaseurl;
-
/**
* The base directory of the image files in the servers file system
- * @var string $imgdir
+ * @var string $imgdir
*/
var $imgdir;
/**
* The base url of the image files
- * @var string $imgbaseurl
+ * @var string $imgbaseurl
*/
var $imgbaseurl;
/**
* The base directory of the js files in the servers file system
- * @var string $jsdir
+ * @var string $jsdir
*/
var $jsdir;
/**
* The base url of the js files
- * @var string $jsbaseurl
+ * @var string $jsbaseurl
*/
var $jsbaseurl;
- /*
- * kept for backwards compatibility
- */
- /**
- * The base directory of the theme
- * @var string $themeroot
- * @todo: remove in 5.0
- * @deprecated deprecated since 4.9
- */
- var $imgroot;
-
/**
* The navigation object that provides the basic links. Should
* not be modified.
*/
var $navigation;
-
/**
* The color bars in pm reporting
*/
var $COLOR_LTBACK1 = '#C0C0C0';
-
var $js = array();
var $js_min = array();
var $javascripts = array();
$this->themeurl = util_make_url('themes/' . forge_get_config('default_theme') . '/');
// determine {css,img,js}{url,dir}
- if (file_exists ($this->themedir . 'css/')) {
- $this->cssdir = $this->themedir . 'css/';
- $this->cssbaseurl = $this->themeurl . 'css/';
- } else {
- $this->cssdir = $this->themedir;
- $this->cssbaseurl = $this->themeurl;
- }
-
if (file_exists ($this->themedir . 'images/')) {
$this->imgdir = $this->themedir . 'images/';
$this->imgbaseurl = $this->themeurl . 'images/';
$this->jsbaseurl = $this->themeurl;
}
- // determine CSS stylesheets
- $this->cssurls[] = util_make_url ('/themes/css/fusionforge.css');
-
- /* check if a personalized css stylesheet exist, if yes include only
- this stylesheet. New stylesheets should use the <themename>.css file.
- */
- $theme_cssfile = forge_get_config('default_theme') . '.css';
- if (file_exists($this->cssdir . $theme_cssfile)) {
- $this->cssurls[] = $this->cssbaseurl . $theme_cssfile;
- } else {
- /* if this is not the case, then include the compatibility stylesheet
- that contains all removed styles from the code and check if a
- custom stylesheet exists.
- Used for compatibility with existing stylesheets
- */
- if (file_exists($this->cssdir . 'theme.css')) {
- $this->cssurls[] = $this->cssbaseurl . 'theme.css';
- }
- }
+ $this->addStylesheet('/themes/css/fusionforge.css');
- // for backward compatibility
- $this->imgroot = $this->imgbaseurl;
}
function addJavascript($js) {
if (isset($this->js_min[$js])) {
$js = $this->js_min[$js];
}
- if (!isset($this->js[$js])) {
+ if ($js && !isset($this->js[$js])) {
$this->js[$js] = true;
$filename = $GLOBALS['fusionforge_basedir'].'/www'.$js;
if (file_exists($filename)) {
$this->bodyHeader($params);
}
-
/**
* headerStart() - generates the header code for all themes up to the
* closing </head>.
*/
function headerStart($params) {
$this->headerHTMLDeclaration();
- ?>
+ ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <?php
- $this->headerTitle($params);
+ <?php
+ $this->headerTitle($params);
$this->headerFavIcon();
$this->headerRSS();
$this->headerSearch();
$this->headerCSS();
$this->headerJS();
+ $this->headerForgepluckerMeta();
?>
</head>
- <?php
+ <?php
}
- /**
- * headerLink() - creates the link headers of the page (FavIcon, RSS and Search)
- * @deprecated deprecated since 4.9, use the individual header-functions
- * @todo remove in 5.0
- */
- function headerLink() {
- $this->headerFavIcon();
- $this->headerRSS();
- $this->headerSearch();
- }
-
/**
* headerHTMLDeclaration() - generates the HTML declaration, i.e. the
* XML declaration, the doctype definition, and the opening <html>.
*
*/
function headerHTMLDeclaration() {
- print '<?xml version="1.0" encoding="utf-8"?>';
- if ($this->doctype=='strict') {
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
+ print '<?xml version="1.0" encoding="utf-8"?>'."\n";
+ if (isset($this->doctype) && $this->doctype=='strict') {
+ echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n";
} else {
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
+ echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
}
- echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'
- . _('en') . '" lang="' . _('en') . '">';
+ echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'
+ . _('en') . '" lang="' . _('en') . '">'."\n";
}
/**
/**
- * headerFavIcon() - creates the favicon <link> headers
+ * headerFavIcon() - creates the favicon <link> headers.
*
*/
function headerFavIcon() {
}
/**
- * headerRSS() - creates the RSS <link> headers
+ * headerRSS() - creates the RSS <link> headers.
*
*/
function headerRSS() {
}
/**
- * headerSearch() - creates the search <link> header
+ * headerSearch() - creates the search <link> header.
*
*/
function headerSearch() {
echo '<link rel="search" title="'
. forge_get_config ('forge_name').'" href="'
. util_make_url ('/export/search_plugin.php')
- . '" type="application/opensearchdescription+xml"/>';
+ . '" type="application/opensearchdescription+xml"/>'."\n";
}
/**
* calls the plugin cssfile hook.
*/
function headerCSS() {
- // include the common css
- foreach ($this->cssurls as $cssurl) {
- echo '<link rel="stylesheet" type="text/css" href="' . $cssurl . '" />';
- }
-
plugin_hook ('cssfile',$this);
echo $this->getStylesheets();
}
*/
function headerJS() {
echo '
-<script type="text/javascript" src="/scripts/prototype/prototype.js"></script>
- <script type="text/javascript" src="/scripts/scriptaculous/scriptaculous.js"></script>
- <script type="text/javascript" src="/scripts/codendi/Tooltip.js"></script>
- <script type="text/javascript" src="/scripts/codendi/LayoutManager.js"></script>
- <script type="text/javascript" src="/scripts/codendi/ReorderColumns.js"></script>
- <script type="text/javascript" src="/scripts/codendi/codendi-1236793993.js"></script>
- <script type="text/javascript" src="/scripts/codendi/validate.js"></script>
+ <script type="text/javascript" src="/scripts/prototype/prototype.js"></script>
+ <script type="text/javascript" src="/scripts/scriptaculous/scriptaculous.js"></script>
+ <script type="text/javascript" src="/scripts/codendi/Tooltip.js"></script>
+ <script type="text/javascript" src="/scripts/codendi/LayoutManager.js"></script>
+ <script type="text/javascript" src="/scripts/codendi/ReorderColumns.js"></script>
+ <script type="text/javascript" src="/scripts/codendi/codendi-1236793993.js"></script>
+ <script type="text/javascript" src="/scripts/codendi/validate.js"></script>
<script type="text/javascript" src="'. util_make_uri('/js/common.js') .'"></script>
<script type="text/javascript">';
plugin_hook ("javascript",false);
echo $this->getJavascripts();
}
+ function headerForgepluckerMeta() {
+ /*-
+ * Forge-Identification Meta Header, Version 1.0
+ * cf. http://home.gna.org/forgeplucker/forge-identification.html
+ */
+ echo "\t\t\t";
+ $ff = new FusionForge();
+ printf('<meta name="Forge-Identification" content="%s:%s" />',
+ $ff->software_name, $ff->software_version);
+ echo "\n";
+ }
+
function bodyHeader($params){
?>
<div class="header">
<!-- end main body row -->
-
</td>
<td width="10" class="footer3" ><img src="<?php echo $this->imgbaseurl; ?>clear.png" width="2" height="1" alt="" /></td>
</tr>
<?php echo $this->navigation->getPoweredBy(); ?>
</div>
- <?php echo $this->navigation->getShowSource(); ?>
+ <?php echo $this->navigation->getShowSource(); ?>
</body>
- </div>
</html>
<?php
}
/**
- * boxTop() - Top HTML box
+ * boxTop() - Top HTML box.
*
- * @param string Box title
- * @param bool Whether to echo or return the results
- * @param string The box background color
+ * @param string Box title
+ * @return string the html code
*/
function boxTop($title) {
return '
}
/**
- * boxMiddle() - Middle HTML box
+ * boxMiddle() - Middle HTML box.
*
- * @param string Box title
- * @param string The box background color
+ * @param string Box title
+ * @return string The html code
*/
function boxMiddle($title) {
return '
}
/**
- * boxBottom() - Bottom HTML box
+ * boxBottom() - Bottom HTML box.
*
- * @param bool Whether to echo or return the results
+ * @return string the html code
*/
function boxBottom() {
return '
}
/**
- * boxGetAltRowStyle() - Get an alternating row style for tables
+ * boxGetAltRowStyle() - Get an alternating row style for tables.
*
- * @param int Row number
+ * @param int Row number
+ * @return string the class code
*/
function boxGetAltRowStyle($i) {
if ($i % 2 == 0) {
/**
* listTableTop() - Takes an array of titles and builds the first row of a new table.
*
- * @param array The array of titles
- * @param array The array of title links
+ * @param array The array of titles
+ * @param array The array of title links
+ * @param string The css classes to add (optional)
+ * @param string The id of the table (needed by sortable for example)
+ * @param array specific class for th column
+ * @return string the html code
*/
- function listTableTop ($title_arr,$links_arr=false,$selected=false) {
- $return = '
- <table cellspacing="0" cellpadding="0" width="100%" border="0">
- <tr class="align-center">
- <!-- <td valign="top" align="right" width="10" style="background:url('.$this->imgbaseurl.'box-grad.png)"><img src="'.$this->imgbaseurl.'box-topleft.png" width="10" height="75" alt="" /></td> -->
- <td style="background:url('.$this->imgbaseurl.'box-grad.png)">
- <table width="100%" border="0" cellspacing="1" cellpadding="2" >
- <tr class="tableheading">';
- $count=count($title_arr);
- if ($links_arr) {
- for ($i=0; $i<$count; $i++) {
- $return .= '<td>'.util_make_link ($links_arr[$i],$title_arr[$i],array('class'=>'sortbutton')).'</td>';
- }
+ function listTableTop($titleArray, $linksArray=false, $class='', $id='', $thClassArray=array()) {
+ $args = '';
+ if ($class) {
+ $args .= ' class="listing '.$class.'"';
} else {
+ $args .= ' class="listing full"';
+ }
+ if ($id) {
+ $args .= ' id="'.$id.'"';
+ }
+ $return = "\n".
+ '<table'.$args.'>';
+
+ if (count($titleArray)) {
+ $return .= '<thead><tr>';
+
+ $count=count($titleArray);
for ($i=0; $i<$count; $i++) {
- $return .= '
- <td>'.$title_arr[$i].'</td>';
+ $th = '';
+ if ($thClassArray && $thClassArray[$i]) {
+ $th .= ' class="'.$thClassArray[$i].'"';
+ }
+ $cell = $titleArray[$i];
+ if ($linksArray) {
+ $cell = util_make_link($linksArray[$i],$titleArray[$i]);
+ }
+ $return .= "\n".' <th'.$th.'>'.$cell.'</th>';
}
+ $return .= "\n".'</tr></thead>'."\n";
}
- return $return.'</tr>';
+ $return .= '<tbody>';
+ return $return;
}
function listTableBottom() {
- return '</table></td>
- <!-- <td valign="top" align="right" width="10" style="background:url('.$this->imgbaseurl.'box-grad.png)"><img src="'.$this->imgbaseurl.'box-topright.png" width="10" height="75" alt="" /></td> -->
- </tr></table>';
+ return '</tbody>'."\n".'</table>';
}
function outerTabs($params) {
$menu = $this->navigation->getSiteMenu();
-
echo $this->tabGenerator($menu['urls'], $menu['titles'], false, $menu['selected'], '');
-
}
/**
return;
} else {
// get all projects that the user belongs to
- $groups = session_get_user()->getGroups () ;
+ $groups = session_get_user()->getGroups();
- if (count ($groups) < 1) {
+ if (count($groups) < 1) {
return;
} else {
- sortProjectList ($groups) ;
+ sortProjectList($groups);
echo '
<form id="quicknavform" name="quicknavform" action=""><div>
<option value="">'._('Quick Jump To...').'</option>';
foreach ($groups as $g) {
- $group_id = $g->getID() ;
- $menu =& $this->navigation->getProjectMenu($group_id);
+ $group_id = $g->getID();
+ $menu = $this->navigation->getProjectMenu($group_id);
echo '
<option value="' . $menu['starturl'] . '">'
}
/**
- * projectTabs() - Prints out the project tabs, contained here in case
- * we want to allow it to be overriden
+ * projectTabs() - Prints out the project tabs, contained here in case
+ * we want to allow it to be overriden.
*
- * @param string Is the tab currently selected
- * @param string Is the group we should look up get title info
+ * @param string Is the tab currently selected
+ * @param string Is the group we should look up get title info
*/
function projectTabs($toptab, $group_id) {
// get group info using the common result set
- $menu =& $this->navigation->getProjectMenu($group_id, $toptab);
-
+ $menu = $this->navigation->getProjectMenu($group_id, $toptab);
echo $this->tabGenerator($menu['urls'], $menu['titles'], true, $menu['selected'], 'white');
}
/**
* printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
*
- * @param array The array of titles.
- * @param array The array of title links.
+ * @param array The array of titles.
+ * @param array The array of title links.
* @return string Html to build a submenu.
*/
function printSubMenu ($title_arr,$links_arr) {
$return = '';
for ($i=0; $i<$count; $i++) {
- $return .= util_make_link ($links_arr[$i],$title_arr[$i]).' | ';
+ $return .= util_make_link($links_arr[$i],$title_arr[$i]).' | ';
}
- $return .= util_make_link ($links_arr[$i],$title_arr[$i]);
+ $return .= util_make_link($links_arr[$i],$title_arr[$i]);
return $return;
}
/**
* subMenu() - Takes two array of titles and links and build a menu.
*
- * @param array The array of titles.
- * @param array The array of title links.
+ * @param array The array of titles.
+ * @param array The array of title links.
* @return string Html to build a submenu.
*/
function subMenu ($title_arr,$links_arr) {
- $return = $this->beginSubMenu () ;
- $return .= $this->printSubMenu ($title_arr,$links_arr) ;
- $return .= $this->endSubMenu () ;
+ $return = $this->beginSubMenu() ;
+ $return .= $this->printSubMenu($title_arr,$links_arr) ;
+ $return .= $this->endSubMenu() ;
return $return;
}
*
* @param string the row attributes
* @param array the array of cell data, each element is an array,
- * the first item being the text,
- * the subsequent items are attributes (dont include
- * the bgcolor for the title here, that will be
- * handled by $istitle
- * @param boolean is this row part of the title ?
- *
+ * the first item being the text,
+ * the subsequent items are attributes (dont include
+ * the bgcolor for the title here, that will be
+ * handled by $istitle
+ * @param boolean is this row part of the title ?
+ * @return string the html code
*/
function multiTableRow($row_attr, $cell_data, $istitle) {
$return= '
foreach ($buttons as $b => $v) {
$btns[] = '<input type="submit" name="'.$b.'" value="'.$v.'" />'."\n";
}
- $btn = join(' '."\n ", $btns);
+ $btn = join(' '."\n ", $btns);
return '
<div id="infobox" style="margin-top: 15%; margin-left: 15%; margin-right: 15%; text-align: center;">
return $return;
}
+ /**
+ * @todo use listTableTop and make this function deprecated ?
+ */
function html_table_top($cols, $summary = '', $class = '', $extra_params = '') {
$return = '<table summary="' . $summary . '" ';
if ($class) {
$string = str_replace(" ", $space, $string);
return $string;
}
+
function widget(&$widget, $layout_id, $readonly, $column_id, $is_minimized, $display_preferences, $owner_id, $owner_type) {
$element_id = 'widget_'. $widget->id .'-'. $widget->getInstanceId();
echo '<div class="widget" id="'. $element_id .'">';
}
echo '</div>';
}
+
function _getTogglePlusForWidgets() {
return 'ic/toggle_plus.png';
}
+
function _getToggleMinusForWidgets() {
return 'ic/toggle_minus.png';
}
-}
+ /* Get the navigation links for the software map pages (trove,
+ * tag cloud, full project list) according to what's enabled
+ */
+ function printSoftwareMapLinks() {
+ $subMenuTitle = array();
+ $subMenuUrl = array();
+
+ if (forge_get_config('use_project_tags')) {
+ $subMenuTitle[] = _('Tag cloud');
+ $subMenuUrl[] = '/softwaremap/tag_cloud.php';
+ }
+
+ if (forge_get_config('use_trove')) {
+ $subMenuTitle[] = _('Project Tree');
+ $subMenuUrl[] = '/softwaremap/trove_list.php';
+ }
+
+ if (forge_get_config('use_project_full_list')) {
+ $subMenuTitle[] = _('Project List');
+ $subMenuUrl[] = '/softwaremap/full_list.php';
+ }
+
+ echo $this->subMenu($subMenuTitle, $subMenuUrl);
+ }
+
+}
// Local Variables:
// mode: php