* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010 - Alain Peyrat
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2010-2011, Alain Peyrat - Alcatel-Lucent
+ * Copyright 2010-2012, Alain Peyrat - Alcatel-Lucent
* Copyright © 2011 Thorsten Glaser – tarent GmbH
+ * Copyright 2011 - Marc-Etienne Vargenau, Alcatel-Lucent
+ * Copyright 2012 - Franck Villaume - TrivialDev
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* Which doctype to use. Can be configured in the
* constructor. If set to 'strict', headerHTMLDeclaration will
* create a doctype definition that uses the strict doctype,
- * otherwise it will use the transitional doctype.
+ * otherwise it will use the transitional doctype.
* @var string $doctype
*/
var $doctype = 'transitional';
/**
- * The default main page content
+ * The default main page content
* @var string $rootindex
*/
var $rootindex = 'index_std.php';
/**
* The base directory of the theme in the servers file system
* @var string $themedir
- */
+ */
var $themedir;
/**
* The base url of the theme
* @var string $themeurl
- */
+ */
var $themeurl;
/**
* The base directory of the image files in the servers file system
* @var string $imgdir
- */
+ */
var $imgdir;
/**
* The base url of the image files
* @var string $imgbaseurl
- */
+ */
var $imgbaseurl;
/**
* The base directory of the js files in the servers file system
* @var string $jsdir
- */
+ */
var $jsdir;
/**
* The base url of the js files
* @var string $jsbaseurl
- */
+ */
var $jsbaseurl;
/**
}
/**
- * Constructs a list of Javascript files followed by some timestamp
+ * Build the list of required Javascript files.
+ *
+ * If js file is found, then a timestamp is automatically added to ensure
+ * that file is cached only if not changed.
*
- * TODO document the purpose of this : probably to avoid caching versions updated on the server
* @param string $js path to the JS file
*/
function addJavascript($js) {
- // TODO : what's the point of this ? ... unused ?
+ // If a minified version of the javascript is available, then use it.
if (isset($this->js_min[$js])) {
$js = $this->js_min[$js];
}
return $code;
}
- /**
- * header() - generates the complete header of page by calling
+ /**
+ * header() - generates the complete header of page by calling
* headerStart() and bodyHeader().
*/
function header($params) {
}
/**
- * headerStart() - generates the header code for all themes up to the
+ * headerStart() - generates the header code for all themes up to the
* closing </head>.
- * Override any of the methods headerHTMLDeclaration(), headerTitle(),
- * headerFavIcon(), headerRSS(), headerSearch(), headerCSS(), or
- * headerJS() to adapt your theme.
+ * Override any of the methods headerHTMLDeclaration(), headerTitle(),
+ * headerFavIcon(), headerRSS(), headerSearch(), headerCSS(), or
+ * headerJS() to adapt your theme.
*
* @param array Header parameters array
*/
function headerStart($params) {
$this->headerHTMLDeclaration();
?>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<?php if (isset($params['meta-description'])) { ?>
+ <meta name="description" content="<?php echo $params['meta-description'] ?>" />
+<?php } ?>
+<?php if (isset($params['meta-keywords'])) { ?>
+ <meta name="keywords" content="<?php echo $params['meta-keywords'] ?>" />
+<?php } ?>
<?php
plugin_hook('htmlhead', array());
$this->headerTitle($params);
$this->headerRSS();
$this->headerSearch();
$this->headerCSS();
- $this->headerJS();
- $this->headerForgepluckerMeta();
+ $this->headerJS();
+ $this->headerForgepluckerMeta();
+ $this->headerLinkedDataAutodiscovery();
?>
- </head>
+ </head>
<?php
- }
+ }
/**
* headerHTMLDeclaration() - generates the HTML declaration, i.e. the
- * XML declaration, the doctype definition, and the opening <html>.
+ * XML declaration, the doctype definition, and the opening <html>.
*
*/
function headerHTMLDeclaration() {
}
/**
- * headerTitle() - creates the <title> header
+ * headerTitle() - creates the <title> header
*
* @param array Header parameters array
*/
*
*/
function headerSearch() {
- echo '<link rel="search" title="'
- . forge_get_config ('forge_name').'" href="'
- . util_make_url ('/export/search_plugin.php')
+ echo '<link rel="search" title="'
+ . forge_get_config ('forge_name').'" href="'
+ . util_make_url ('/export/search_plugin.php')
. '" type="application/opensearchdescription+xml"/>'."\n";
}
- /**
+ /**
* Create the CSS headers for all cssfiles in $cssfiles and
* calls the plugin cssfile hook.
*/
<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" src="'. util_make_uri('/js/common.js') .'"></script>
+ <script language="JavaScript" type="text/javascript">/* <![CDATA[ */';
+ plugin_hook ("javascript",false);
+ echo '
+ /* ]]> */</script>';
plugin_hook ("javascript_file",false);
echo $this->getJavascripts();
-
+
// invoke the 'javascript' hook for custom javascript addition
$params = array('return' => false);
plugin_hook("javascript",$params);
}
}
+ /**
+ * headerLinkedDataAutodiscovery() - creates the link+meta links to alternate
+ * representations for Linked Data autodiscovery
+ */
+ function headerLinkedDataAutodiscovery() {
+ // Only activated for /projects or /users for the moment
+ $script_name = getStringFromServer('SCRIPT_NAME');
+
+ if ($script_name == '/projects' || $script_name == '/users') {
+
+ // invoke the 'alt_representations' hook
+ $params = array('script_name' => $script_name,
+ 'return' => array());
+
+ plugin_hook_by_reference('alt_representations', $params);
+
+ foreach($params['return'] as $link) {
+ echo " $link"."\n";
+ }
+ }
+ }
+
function headerForgepluckerMeta() {
/*-
* Forge-Identification Meta Header, Version 1.0
<td class="projecttab" ><img src="<?php echo $this->imgbaseurl; ?>clear.png" width="10" height="1" alt="" /></td>
<td valign="top" width="99%" class="projecttab">
- <?php
+ <?php
}
<?php echo $this->navigation->getPoweredBy(); ?>
</div>
- <?php echo $this->navigation->getShowSource(); ?>
+ <?php echo $this->navigation->getShowSource();
+
+ plugin_hook('webanalytics_url', array());
+
+ ?>
</body>
</html>
return '
<!-- Box Top Start -->
- <table cellspacing="0" cellpadding="0" width="100%" border="0" style="background:url('.$this->imgbaseurl.'vert-grad.png)">
+ <table class="fullwidth" style="background:url('.$this->imgroot.'vert-grad.png)">
<tr class="align-center">
<td valign="top" align="right" width="10" style="background:url('.$this->imgbaseurl.'box-topleft.png)"><img src="'.$this->imgbaseurl.'clear.png" width="10" height="20" alt="" /></td>
<td width="100%" style="background:url('.$this->imgbaseurl.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
<tr class="align-center">
<td colspan="2" style="background:url('.$this->imgbaseurl.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
</tr>
- <tr align="left">
+ <tr class="align-left">
<td colspan="2">
<!-- Box Middle End -->';
}
}
$return = "\n".
'<table'.$args.'>';
-
+
if (count($titleArray)) {
$return .= '<thead><tr>';
echo '
<form id="quicknavform" name="quicknavform" action=""><div>
- <select name="quicknav" id="quicknav">
+ <select name="quicknav" id="quicknav" onchange="location.href=document.quicknavform.quicknav.value">
<option value="">'._('Quick Jump To...').'</option>';
foreach ($groups as $g) {
$menu = $this->navigation->getProjectMenu($group_id);
echo '
- <option value="' . $menu['starturl'] . '">'
+ <option value="' . $menu['starturl'] . '">'
. $menu['name'] .'</option>';
for ($j = 0; $j < count($menu['urls']); $j++) {
echo '
- <option value="' . $menu['urls'][$j] .'"> '
+ <option value="' . $menu['urls'][$j] .'"> '
. $menu['titles'][$j] . '</option>';
if (@$menu['adminurls'][$j]) {
echo '
- <option value="' . $menu['adminurls'][$j]
- . '"> '
+ <option value="' . $menu['adminurls'][$j]
+ . '"> '
. _('Admin') . '</option>';
}
}
// $rowspan=(($issel)?'rowspan="2" ' : '');
$return .= '
- <td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgbaseurl . 'theme-'.$inner.'-end-'.(($issel) ? '' : 'not').'selected.png)">'.
+ <td '.$rowspan.'class="top" width="10" style="background:url('.$this->imgbaseurl . 'theme-'.$inner.'-end-'.(($issel) ? '' : 'not').'selected.png)">'.
'<img src="'.$this->imgbaseurl . 'clear.png" height="25" width="10" alt="" /></td>'.
'<td '.$rowspan.'style="background:url('.$this->imgbaseurl . $bgimg.')" width="'.$width.'%" align="center">'.util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('class'=>(($issel)?'tabsellink':'tablink')),true).'</td>';
} elseif ($i==$count-1) {
// Build image between current and prior tab
//
$return .= '
- <td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgbaseurl . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
+ <td '.$rowspan.'colspan="2" class="top" width="20" style="background:url('.$this->imgbaseurl . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
'<img src="'.$this->imgbaseurl . 'clear.png" height="2" width="20" alt="" /></td>'.
'<td '.$rowspan.'style="background:url('.$this->imgbaseurl . $bgimg.')" width="'.$width.'%" align="center">'.util_make_link($TABS_DIRS[$i], $TABS_TITLES[$i], array('class'=>(($issel)?'tabsellink':'tablink')), true).'</td>';
//
// Last graphic on right-side
//
$return .= '
- <td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgbaseurl . 'theme-'.$inner.'-'.(($issel) ? '' : 'not').'selected-end.png)">'.
+ <td '.$rowspan.'class="top" width="10" style="background:url('.$this->imgbaseurl . 'theme-'.$inner.'-'.(($issel) ? '' : 'not').'selected-end.png)">'.
'<img src="'.$this->imgbaseurl . 'clear.png" height="2" width="10" alt="" /></td>';
} else {
// Build image between current and prior tab
//
$return .= '
- <td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgbaseurl . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
+ <td '.$rowspan.'colspan="2" class="top" width="20" style="background:url('.$this->imgbaseurl . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
'<img src="'.$this->imgbaseurl . 'clear.png" height="2" width="20" alt="" /></td>'.
'<td '.$rowspan.'style="background:url('.$this->imgbaseurl . $bgimg.')" width="'.$width.'%" align="center">'.util_make_link($TABS_DIRS[$i], $TABS_TITLES[$i], array('class'=>(($issel)?'tabsellink':'tablink')), true).'</td>';
return $return.'
- </table>
+ </table>
<!-- end tabs -->
';
$return = '';
for ($i=0; $i<$count; $i++) {
- $return .= util_make_link($links_arr[$i],$title_arr[$i],$attr_arr[$i]).' | ';
+ $return .= util_make_link($links_arr[$i],$title_arr[$i],$attr_arr[$i]). $this->subMenuSeparator();
}
$return .= util_make_link($links_arr[$i],$title_arr[$i],$attr_arr[$i]);
return $return;
}
+ /**
+ * subMenuSeparator() - returns the separator used between submenus
+ *
+ * @return string Html to build a submenu separator.
+ */
+ function subMenuSeparator() {
+ return '';
+ }
+
/**
* subMenu() - Takes two array of titles and links and build a menu.
*
return '';
} else {
return '
- <div class="feedback">'.strip_tags($feedback, '<br>').'</div>';
+ <p class="feedback">'.strip_tags($feedback, '<br>').'</p>';
}
}
/**
return '';
} else {
return '
- <div class="warning_msg">'.strip_tags($msg, '<br>').'</div>';
+ <p class="warning_msg">'.strip_tags($msg, '<br>').'</p>';
}
}
return '';
} else {
return '
- <div class="error">'.strip_tags($msg, '<br>').'</div>';
+ <div class="error">' .
+ util_pwrap(strip_tags($msg, '<br>')) .
+ "</div>\n";
}
}
+ /**
+ * information() - returns the htmlized information string.
+ *
+ * @param string msg string
+ * @return string htmlized information
+ */
+ function information($msg) {
+ if (!$msg) {
+ return '';
+ } else {
+ return '
+ <p class="information">'.strip_tags($msg, '<br>').'</p>';
+ }
+ }
/**
* getThemeIdFromName()
*
* @param string the dirname of the theme
- * @return integer the theme id
+ * @return integer the theme id
*/
function getThemeIdFromName($dirname) {
$res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1',
foreach ($params as $b => $v) {
$prms[] = '<input type="hidden" name="'.$b.'" value="'.$v.'" />'."\n";
}
- $prm = join(' ', $prms);
+ $prm = join(' ', $prms);
foreach ($buttons as $b => $v) {
$btns[] = '<input type="submit" name="'.$b.'" value="'.$v.'" />'."\n";
}
function getMonitorPic($title = '', $alt = '') {
- return $this->getPicto('ic/mail16w.png', $title, $alt, '15', '15');
+ return $this->getPicto('ic/mail16w.png', $title, $alt);
}
function getReleaseNotesPic($title = '', $alt = '') {
- return $this->getPicto('ic/manual16c.png', $title, $alt, '15', '15');
+ return $this->getPicto('ic/manual16c.png', $title, $alt);
}
/* no picto for download */
function getDownloadPic($title = '', $alt = '') {
- return $this->getPicto('ic/save.png', $title, $alt, '15', '15');
+ return $this->getPicto('ic/save.png', $title, $alt);
}
function getHomePic($title = '', $alt = '') {
function getPicto($url, $title, $alt, $width = '20', $height = '20') {
if (!$alt) {
- $alt = $title;
+ $alt = $title;
}
return html_image($url, $width, $height, array('title'=>$title, 'alt'=>$alt));
}
}
echo "</div>\n";
if ($widget->isAjax()) {
- echo '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */'."
+ echo '<script type="text/javascript">/* <![CDATA[ */'."
document.observe('dom:loaded', function () {
- $('$element_id-ajax').update('<div style=\"text-align:center\">". $this->getPicto('ic/spinner.gif','spinner','spinner') ."</div>');
- new Ajax.Updater('$element_id-ajax',
+ $('$element_id-ajax').update('<div style=\"text-align:center\">". $this->getPicto('ic/spinner.gif','spinner','spinner', 10, 10) ."</div>');
+ new Ajax.Updater('$element_id-ajax',
'". $widget->getAjaxUrl($owner_id, $owner_type) ."'
);
});
function printSoftwareMapLinks() {
$subMenuTitle = array();
$subMenuUrl = array();
-
+ $subMenuAttr = array();
+
if (forge_get_config('use_project_tags')) {
$subMenuTitle[] = _('Tag cloud');
$subMenuUrl[] = '/softwaremap/tag_cloud.php';
+ $subMenuAttr[] = array('title' => _('Browse per tags defined by the projects.'), 'class' => 'tabtitle-nw');
}
-
+
if (forge_get_config('use_trove')) {
$subMenuTitle[] = _('Project Tree');
$subMenuUrl[] = '/softwaremap/trove_list.php';
+ $subMenuAttr[] = array('title' => _('Browse per category.'), 'class' => 'tabtitle');
}
-
+
if (forge_get_config('use_project_full_list')) {
$subMenuTitle[] = _('Project List');
$subMenuUrl[] = '/softwaremap/full_list.php';
+ $subMenuAttr[] = array('title' => _('Complete listing of available projects.'), 'class' => 'tabtitle');
}
-
- echo $this->subMenu($subMenuTitle, $subMenuUrl);
+
+ echo $this->subMenu($subMenuTitle, $subMenuUrl, $subMenuAttr);
}
}