* Copyright 2010-2011, Franck Villaume - Capgemini
* Copyright 2010-2011, Alain Peyrat - Alcatel-Lucent
* Copyright © 2011 Thorsten Glaser – tarent GmbH
+ * Copyright 2011 - Marc-Etienne Vargenau, 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
*/
$this->headerRSS();
$this->headerSearch();
$this->headerCSS();
- $this->headerJS();
- $this->headerForgepluckerMeta();
+ $this->headerJS();
+ $this->headerForgepluckerMeta();
?>
</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);
<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" onChange="location.href=document.quicknavform.quicknav.value">
+ <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>';
}
}
function projectTabs($toptab, $group_id) {
// get group info using the common result set
$menu = $this->navigation->getProjectMenu($group_id, $toptab);
- echo $this->tabGenerator($menu['urls'], $menu['titles'], true, $menu['selected'], 'white');
+ echo $this->tabGenerator($menu['urls'], $menu['titles'], $menu['tooltips'], true, $menu['selected'], 'white');
}
function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS, $nested=false, $selected=false, $sel_tab_bgcolor='white', $total_width='100%') {
// $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 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));
}
if (function_exists('iconv')) {
$string = @iconv('UTF-8', 'ASCII//TRANSLIT', $string);
}
- $string = preg_replace("/[^a-zA-Z0-9- ]/", "-", $string);
+ $string = preg_replace("/[^a-zA-Z0-9_:. -]/", "-", $string);
$string = strtolower($string);
$string = str_replace(" ", $space, $string);
+ if (!preg_match("/^[a-zA-Z:_]/", $string)) {
+ /* some chars aren't allowed at the begin */
+ $string = "_" . $string;
+ }
return $string;
}
echo '<script language="JavaScript" 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',
+ 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);
}
}