* for displaying all site dependent HTML, while allowing
* extendibility/overriding by themes via the Theme class.
*
- * Make sure browser.php is included _before_ you create an instance of this object.
+ * Make sure browser.php is included _before_ you create an instance
+ * of this object.
*
* Geoffrey Herteg, August 29, 2000
*
- * @version $Id$
*/
-require_once('common/include/constants.php');
-require_once('www/search/include/SearchManager.class.php');
+require_once $gfcommon.'include/constants.php';
+require_once $gfwww.'search/include/SearchManager.class.php';
class Layout extends Error {
* Layout() - Constructor
*/
function Layout() {
-
- $this->themeroot=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'];
+ // determine rootindex
+ if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
+ $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
+ else
+ $this->rootindex = $GLOBALS['gfwww'].'index_std.php';
+
+ // determine themeroot
+ $this->themeroot = $GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'];
/* if images directory exists in theme, then use it as imgroot */
if (file_exists ($this->themeroot.'/images')){
- $this->imgroot=$GLOBALS['sys_urlprefix'].'/themes/'.$GLOBALS['sys_theme'].'/images/';
+ $this->imgroot = util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/images/');
}
- // Constructor for parent class...
- if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
- $this->rootindex = $GLOBALS['sys_custom_path'] . '/index_std.php';
+
$this->Error();
}
/**
- * createLinkToUserHome() - Creates a link to a user's home page
- *
- * @param string The user's user_name
- * @param string The user's realname
+ * headerLink() - common code for all themes
+ *
*/
- function createLinkToUserHome($user_name, $realname) {
- return '<a href="'.$GLOBALS['sys_urlprefix'].'/users/'.$user_name.'/">'.$realname.'</a>';
+ function headerLink() {
+ echo '<link rel="alternate" title="'.$GLOBALS['sys_name'].' - Project News Highlights RSS" href="'.util_make_url ('/export/rss_sfnews.php').'" type="application/rss+xml"/>';
+ echo '<link rel="alternate" title="'.$GLOBALS['sys_name'].' - Project News Highlights RSS 2.0" href="'.util_make_url ('/export/rss20_news.php').'" type="application/rss+xml"/>';
+ echo '<link rel="alternate" title="'.$GLOBALS['sys_name'].' - New Projects RSS" href="'.util_make_url ('/export/rss_sfprojects.php').'" type="application/rss+xml"/>';
+ echo '<link rel="search" title="'.$GLOBALS['sys_name'].'" href="'.util_make_url ('/export/search_plugin.php').'" type="application/opensearchdescription+xml"/>';
}
/**
* @param array Header parameters array
*/
function headerStart($params) {
- global $Language;
-
if (!$params['title']) {
$params['title'] = $GLOBALS['sys_name'];
} else {
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo _('en') ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo _('en') ?>" lang="<?php echo _('en') ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $params['title']; ?></title>
- <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/export/rss_sfnews.php" type="application/rss+xml"/>
- <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - Project News Highlights RSS 2.0" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/export/rss20_news.php" type="application/rss+xml"/>
- <link rel="alternate" title="<?php echo $GLOBALS['sys_name']; ?> - New Projects RSS" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/export/rss_sfprojects.php" type="application/rss+xml"/>
+ <?php $this->headerLink(); ?>
<?php if (isset($GLOBALS['group_id'])) {
- $activity = '<link rel="alternate" title="' . $GLOBALS['sys_name'] . ' - New Activity RSS" href="'.$GLOBALS['sys_urlprefix'].'/export/rss20_activity.php?group_id='.$GLOBALS['group_id'].'" type="application/rss+xml"/>';
+ $activity = '<link rel="alternate" title="' . $GLOBALS['sys_name'] . ' - New Activity RSS" href="'. util_make_url ('/export/rss20_activity.php?group_id='.$GLOBALS['group_id']).'" type="application/rss+xml"/>';
echo $activity;
}
?>
this stylesheet
new stylesheets should use the <themename>.css file
*/
- $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css';
+ $theme_cssfile = $this->themeroot . '/css/'.$GLOBALS['sys_theme'].'.css';
if (file_exists($theme_cssfile)){
echo '
- <link rel="stylesheet" type="text/css" href="'.$GLOBALS['sys_urlprefix'].'/themes/'.$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css"/>';
+ <link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css').'"/>';
} else {
/* if this is not our case, then include the compatibility stylesheet
that contains all removed styles from the code and check if a
Used for compatibility with existing stylesheets
*/
echo '
- <link rel="stylesheet" type="text/css" href="'.$GLOBALS['sys_urlprefix'].'/themes/css/gforge-compat.css" />';
- $theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/theme.css';
+ <link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/css/gforge-compat.css').'" />';
+ $theme_cssfile = $this->themeroot . '/css/theme.css';
if (file_exists($theme_cssfile)){
echo '
- <link rel="stylesheet" type="text/css" href="'.$GLOBALS['sys_urlprefix'].'/themes/'.$GLOBALS['sys_theme'].'/css/theme.css" />';
+ <link rel="stylesheet" type="text/css" href="'.util_make_url ('/themes/'.$GLOBALS['sys_theme'].'/css/theme.css').'" />';
}
}
plugin_hook ('cssfile',$this);
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="headertable">
<tr>
- <td><a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/"><?php echo html_image('logo.png',198,52,array('border'=>'0')); ?></a></td>
+ <td><a href="<?php echo util_make_url ('/'); ?>"><?php echo html_image('logo.png',198,52,array('border'=>'0')); ?></a></td>
<td><?php echo $this->searchBox(); ?></td>
<td align="right"><?php
if (session_loggedin()) {
- ?>
- <a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/logout.php"><?php echo _('Log Out'); ?></a><br />
- <a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/"><?php echo _('My Account'); ?></a>
- <?php
+ $u =& user_get_object(user_getid());
+ echo util_make_link ('/account/logout.php', sprintf("%s (%s)", _('Log Out'), $u->getRealName()),array('class'=>'lnkutility'));
+ echo util_make_link ('/account/',_('My Account'),array('class'=>'lnkutility'));
} else {
- ?>
- <b><a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/login.php"><?php echo _('Log In'); ?></a></b><br />
- <b><a class="lnkutility" href="<?php echo $GLOBALS['sys_urlprefix']; ?>/account/register.php"><?php echo _('New Account'); ?></a></b>
- <?php
+ echo util_make_link ('/account/login.php',_('Log In'),array('class'=>'lnkutility'));
+ if (!$GLOBALS['sys_user_reg_restricted']) {
+ echo util_make_link ('/account/register.php',_('New Account'),array('class'=>'lnkutility'));
+ }
}
+
+ $params['template'] = ' {menu}';
+ plugin_hook ('headermenu', $params);
+
echo $this->quickNav();
?></td>
<td> </td>
</tr>
<?php
-
}
-
?>
<tr>
<td align="left" class="projecttab" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft-inner.png" height="9" width="9" alt="" /></td>
<?php
- }
-
+ }
+
function footer($params) {
?>
function footerEnd($params) { ?>
-<!-- PLEASE LEAVE "Powered By GForge" on your site -->
-<br />
-<center>
-<a href="http://gforge.org/"><img src="/images/pow-gforge.png" alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
-</center>
+<!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
+<div align="right">
+<a href="http://fusionforge.org/"><img src="<?php echo util_make_url ('/images/pow-fusionforge.png'); ?>" alt="Powered By FusionForge" border="0" /></a>
+</div>
<?php
global $sys_show_source;
if ($sys_show_source) {
- print '<a class="showsource" href="'.$GLOBALS['sys_urlprefix'].'/source.php?file=' . getStringFromServer('SCRIPT_NAME') . '"> '._('Show source').' </a>';
+ echo util_make_link ('/source.php?file='.getStringFromServer('SCRIPT_NAME'),_('Show source'),array('class'=>'showsource'));
}
?>
<!-- Box Top Start -->
<table cellspacing="0" cellpadding="0" width="100%" border="0" style="background:url('.$this->imgroot.'vert-grad.png)">
- <tr align="center">
+ <tr class="align-center">
<td valign="top" align="right" width="10" style="background:url('.$this->imgroot.'box-topleft.png)"><img src="'.$this->imgroot.'clear.png" width="10" height="20" alt="" /></td>
<td width="100%" style="background:url('.$this->imgroot.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
<td valign="top" width="10" style="background:url('.$this->imgroot.'box-topright.png)"><img src="'.$this->imgroot.'clear.png" width="10" height="20" alt="" /></td>
<!-- Box Middle Start -->
</td>
</tr>
- <tr align="center">
+ <tr class="align-center">
<td colspan="2" style="background:url('.$this->imgroot.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
</tr>
<tr align="left">
* @param array The array of titles
* @param array The array of title links
*/
- function listTableTop ($title_arr,$links_arr=false) {
+ function listTableTop ($title_arr,$links_arr=false,$selected=false) {
$return = '
<table cellspacing="0" cellpadding="0" width="100%" border="0">
- <tr align="center">
+ <tr class="align-center">
<!-- <td valign="top" align="right" width="10" style="background:url('.$this->imgroot.'box-grad.png)"><img src="'.$this->imgroot.'box-topleft.png" width="10" height="75" alt="" /></td> -->
<td style="background:url('.$this->imgroot.'box-grad.png)">
<table width="100%" border="0" cellspacing="1" cellpadding="2" >
$count=count($title_arr);
if ($links_arr) {
for ($i=0; $i<$count; $i++) {
- $return .= '
- <td><a class="sortbutton" href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
+ $return .= '<td>'.util_make_link ($links_arr[$i],$title_arr[$i],array('class'=>'sortbutton')).'</td>';
}
} else {
for ($i=0; $i<$count; $i++) {
}
function outerTabs($params) {
- global $sys_use_trove,$sys_use_snippet,$sys_use_people;
+ global $sys_use_trove,$sys_use_snippet,$sys_use_people,$sys_use_project_tags, $sys_use_project_full_list;
- $TABS_DIRS[]='/';
- $TABS_DIRS[]='/my/';
- if ($sys_use_trove) {
- $TABS_DIRS[]='/softwaremap/';
+ $TABS_DIRS[]=util_make_url ('/');
+ $TABS_DIRS[]=util_make_url ('/my/');
+ if ($sys_use_trove || $sys_use_project_tags || $sys_use_project_full_list) {
+ $TABS_DIRS[]=util_make_url ('/softwaremap/') ;
}
if ($sys_use_snippet) {
- $TABS_DIRS[]='/snippet/';
+ $TABS_DIRS[]=util_make_url ('/snippet/') ;
}
if ($sys_use_people) {
- $TABS_DIRS[]='/people/';
+ $TABS_DIRS[]=util_make_url ('/people/') ;
}
$TABS_TITLES[]=_('Home');
$TABS_TITLES[]=_('My Page');
- if ($sys_use_trove) {
- $TABS_TITLES[]=_('Project Tree');
+ if ($sys_use_trove || $sys_use_project_tags || $sys_use_project_full_list) {
+ $TABS_TITLES[]=_('Projects');
}
if ($sys_use_snippet) {
$TABS_TITLES[]=_('Code Snippets');
if ($permmaster->isAdmin()) {
$user_is_super=true;
- $TABS_DIRS[]='/admin/';
+ $TABS_DIRS[]=util_make_url ('/admin/') ;
$TABS_TITLES[]=_('Admin');
}
if ($permstats->isMember()) {
- $TABS_DIRS[]='/reporting/';
+ $TABS_DIRS[]=util_make_url ('/reporting/') ;
$TABS_TITLES[]=_('Reporting');
}
}
} elseif (!$project->isProject()) {
} else {
- $TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
+ if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
+ $TABS_DIRS[]=util_make_url ('/project/?group_id') .$project->getId();
+ } else {
+ $TABS_DIRS[]=util_make_url ('/projects/') .$project->getUnixName().'/';
+ }
$TABS_TITLES[]=$project->getPublicName();
$selected=count($TABS_DIRS)-1;
}
}
- } elseif (strstr($GLOBALS['REQUEST_URI'],'/my/') ||
- strstr($GLOBALS['REQUEST_URI'],'/account/') ||
- strstr($GLOBALS['REQUEST_URI'],'/register/') ||
- strstr(getStringFromServer('REQUEST_URI'),'/themes/') ) {
- $selected=array_search("/my/", $TABS_DIRS);
- } elseif (strstr(getStringFromServer('REQUEST_URI'),'softwaremap')) {
- $selected=array_search("/softwaremap/", $TABS_DIRS);
- } elseif (strstr(getStringFromServer('REQUEST_URI'),'/snippet/')) {
- $selected=array_search("/snippet/", $TABS_DIRS);
- } elseif (strstr(getStringFromServer('REQUEST_URI'),'/people/')) {
- $selected=array_search("/people/", $TABS_DIRS);
- } elseif (strstr(getStringFromServer('REQUEST_URI'),'/reporting/')) {
- $selected=array_search('/reporting/',$TABS_DIRS);
- } elseif (strstr(getStringFromServer('REQUEST_URI'),'/admin/') && $user_is_super) {
- $selected=array_search('/admin/',$TABS_DIRS);
+ } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/my/') ) ||
+ strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/account/') ) ||
+ strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/register/') ) ||
+ strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/themes/') ) ) {
+ $selected=array_search(util_make_url ('/my/'), $TABS_DIRS);
+ } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('softwaremap') )) {
+ $selected=array_search(util_make_url ('/softwaremap/'), $TABS_DIRS);
+ } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/snippet/') )) {
+ $selected=array_search(util_make_url ('/snippet/'), $TABS_DIRS);
+ } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/people/') )) {
+ $selected=array_search(util_make_url ('/people/'), $TABS_DIRS);
+ } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/reporting/') )) {
+ $selected=array_search(util_make_url ('/reporting/'),$TABS_DIRS);
+ } elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/admin/') ) && $user_is_super) {
+ $selected=array_search(util_make_url ('/admin/'),$TABS_DIRS);
} elseif (count($PLUGIN_TABS_DIRS)>0) {
foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
- if (strstr(getStringFromServer('REQUEST_URI'),$PLUGIN_TABS_DIRS_VALUE)) {
- $selected=array_search($PLUGIN_TABS_DIRS_VALUE,$TABS_DIRS);
+ if (strstr(getStringFromServer('REQUEST_URI'), $PLUGIN_TABS_DIRS_VALUE)) {
+ $selected=array_search($PLUGIN_TABS_DIRS_VALUE, $TABS_DIRS);
break;
}
}
} else {
$selected=0;
}
- echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,'','100%');
+ echo $this->tabGenerator($TABS_DIRS, $TABS_TITLES, false, $selected, '');
+
+ }
+ /**
+ * quicknav() - Prints out the quicknav menu, contained
+ * here in case we want to allow it to be
+ * overridden.
+ *
+ */
+ function quickNav() {
+ if (!session_loggedin()) {
+ return '';
+ } else {
+ // get all projects that the user belongs to
+ $res = db_query_params ('SELECT group_id FROM groups JOIN user_group USING (group_id) WHERE user_group.user_id=$1 AND groups.status=$2 ORDER BY group_name',
+ array (user_getid(),
+ 'A'));
+ echo db_error();
+ if (!$res || db_numrows($res) < 1) {
+ return '';
+ } else {
+ $ret = '
+ <form id="quicknavform" name="quicknavform" action=""><div>
+ <select name="quicknav" id="quicknav" onChange="location.href=document.quicknavform.quicknav.value">
+ <option value="">'._('Quick Jump To...').'</option>';
+
+ for ($i = 0; $i < db_numrows($res); $i++) {
+ $group_id = db_result($res, $i, 'group_id');
+ $project =& group_get_object($group_id);
+ if (!$project || !is_object($project)) {
+ return;
+ }
+ if ($project->isError()) {
+ //wasn't found or some other problem
+ return;
+ }
+ if (!$project->isProject()) {
+ return;
+ }
+
+ $menu = $project->getMenu();
+ $ret .= '
+ <option value="' . $menu['start'] . '">'
+ . $project->getPublicName() .'</option>';
+
+ for ($j = 0; $j < count($menu['dirs']); $j++) {
+ $ret .= '
+ <option value="' . $menu['dirs'][$j] .'"> '
+ . $menu['titles'][$j] . '</option>';
+ if ($menu['admindirs'][$j]) {
+ $ret .= '
+ <option value="' . $menu['admindirs'][$j]
+ . '"> '
+ . _('Admin') . '</option>';
+ }
+ }
+ }
+ $ret .= '
+ </select>
+ </div></form>';
+ }
+ }
+ return $ret;
}
/**
* @param string Is the tab currently selected
* @param string Is the group we should look up get title info
*/
- function projectTabs($toptab,$group) {
+ function projectTabs($toptab, $group) {
// get group info using the common result set
$project =& group_get_object($group);
if (!$project || !is_object($project)) {
return;
}
- // Summary
- $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/';
- $TABS_TITLES[]=_('Summary');
- (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' );
-
- // Project Admin
- $perm =& $project->getPermission( session_get_user() );
- if ($perm->isAdmin()) {
- $TABS_DIRS[]='/project/admin/?group_id='. $group;
- $TABS_TITLES[]=_('Admin');
- (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
- /* Homepage
- $TABS_DIRS[]='http://'. $project->getHomePage();
- $TABS_TITLES[]=_('Home Page');
- */
-
- // Project Activity tab
-
- $TABS_DIRS[]='/activity/?group_id='. $group;
- $TABS_TITLES[]=_('Activity');
- (($toptab == 'activity') ? $selected=(count($TABS_TITLES)-1) : '' );
-
- // Forums
- if ($project->usesForum()) {
- $TABS_DIRS[]='/forum/?group_id='.$group;
- $TABS_TITLES[]=_('Forums');
- (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Artifact Tracking
- if ($project->usesTracker()) {
- $TABS_DIRS[]='/tracker/?group_id='.$group;
- $TABS_TITLES[]=_('Tracker');
- (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch')
- ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Mailing Lists
- if ($project->usesMail()) {
- $TABS_DIRS[]='/mail/?group_id='.$group;
- $TABS_TITLES[]=_('Lists');
- (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Project Manager
- if ($project->usesPm()) {
- $TABS_DIRS[]='/pm/?group_id='.$group;
- $TABS_TITLES[]=_('Tasks');
- (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Doc Manager
- if ($project->usesDocman()) {
- $TABS_DIRS[]='/docman/?group_id='.$group;
- $TABS_TITLES[]=_('Docs');
- (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // Surveys
- if ($project->usesSurvey()) {
- $TABS_DIRS[]='/survey/?group_id='.$group;
- $TABS_TITLES[]=_('Surveys');
- (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- //newsbytes
- if ($project->usesNews()) {
- $TABS_DIRS[]='/news/?group_id='.$group;
- $TABS_TITLES[]=_('News');
- (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // SCM systems
- if ($project->usesSCM()) {
- $TABS_DIRS[]='/scm/?group_id='.$group;
- $TABS_TITLES[]=_('SCM');
- (($toptab == 'scm') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // groupmenu_after_scm hook
- $hookParams['DIRS'] = &$TABS_DIRS;
- $hookParams['TITLES'] = &$TABS_TITLES;
- $hookParams['toptab'] = &$toptab;
- $hookParams['selected'] = &$selected;
- $hookParams['group_id'] = $group ;
-
- plugin_hook ("groupmenu_scm", $hookParams) ;
-
- // Downloads
- if ($project->usesFRS()) {
- $TABS_DIRS[]='/frs/?group_id='.$group;
- $TABS_TITLES[]=_('Files');
- (($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
- }
-
- // groupmenu hook
- $hookParams['DIRS'] = &$TABS_DIRS;
- $hookParams['TITLES'] = &$TABS_TITLES;
- $hookParams['toptab'] = &$toptab;
- $hookParams['selected'] = &$selected;
- $hookParams['group'] = $group;
-
- plugin_hook ("groupmenu", $hookParams) ;
-
- echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
+ $menu = $project->getMenu($toptab);
+ echo $this->tabGenerator($menu['dirs'], $menu['titles'], true, $menu['selected'], 'white');
}
- function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') {
+ function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='white',$total_width='100%') {
$count=count($TABS_DIRS);
$width=intval((100/$count));
$return = '';
-
$return .= '
-
<!-- start tabs -->
-
- <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'">
- <tr>';
+ <table class="tabGenerator" ';
+
+ if ($total_width != '100%') {
+ $return .= 'style="width:' . $total_width . ';"';
+ }
+ $return .= ">\n";
+ $return .= '<tr>';
if ($nested) {
$inner='bottomtab';
} else {
$return .= '
<td '.$rowspan.'valign="top" width="10" style="background:url('.$this->imgroot . 'theme-'.$inner.'-end-'.(($issel) ? '' : 'not').'selected.png)">'.
'<img src="'.$this->imgroot . 'clear.png" height="25" width="10" alt="" /></td>'.
- '<td '.$rowspan.'style="background:url('.$this->imgroot . $bgimg.')" width="'.$width.'%" align="center"><a class="'. (($issel)?'tabsellink':'tablink') .'" href="'.$GLOBALS['sys_urlprefix'].$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a></td>';
+ '<td '.$rowspan.'style="background:url('.$this->imgroot . $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) {
//
// this is the last tab, choose an image with name-end
$return .= '
<td '.$rowspan.'colspan="2" valign="top" width="20" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
'<img src="'.$this->imgroot . 'clear.png" height="2" width="20" alt="" /></td>'.
- '<td '.$rowspan.'style="background:url('.$this->imgroot . $bgimg.')" width="'.$width.'%" align="center"><a class="'. (($issel)?'tabsellink':'tablink') .'" href="'.$GLOBALS['sys_urlprefix'].$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a></td>';
+ '<td '.$rowspan.'style="background:url('.$this->imgroot . $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.'colspan="2" valign="top" width="20" style="background:url('.$this->imgroot . 'theme-'.$inner.'-'.(($wassel) ? '' : 'not').'selected-'.(($issel) ? '' : 'not').'selected.png)">'.
'<img src="'.$this->imgroot . 'clear.png" height="2" width="20" alt="" /></td>'.
- '<td '.$rowspan.'style="background:url('.$this->imgroot . $bgimg.')" width="'.$width.'%" align="center"><a class="'. (($issel)?'tabsellink':'tablink') .'" href="'.$GLOBALS['sys_urlprefix'].$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a></td>';
+ '<td '.$rowspan.'style="background:url('.$this->imgroot . $bgimg.')" width="'.$width.'%" align="center">'.util_make_link ($TABS_DIRS[$i],$TABS_TITLES[$i],array('class'=>(($issel)?'tabsellink':'tablink')),true).'</td>';
}
}
} else {
$defaultWords = $words;
}
+
+ //Fix CVE-2007-0176
+ $defaultWords = htmlspecialchars($defaultWords);
// if there is no search currently, set the default
if ( ! isset($type_of_search) ) {
$exact = 1;
}
-
- print '
- <form action="/search/" method="get">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><td>
- <div align="center" class="searchbox">';
+
+ print '<form action="/search/" method="get" id="search-box-form">';
+ print '<div class="searchbox">';
$parameters = array(
SEARCH__PARAMETER_GROUP_ID => $group_id,
SEARCH__PARAMETER_ARTIFACT_ID => $atid,
$searchEngine =& $searchEngines[$i];
echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
}
- echo '</select></div>';
-
-// print '<br />';
-// print '
-// <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words';
-
- print '</td><td> ';
+ echo '</select>';
+
$parameters = $searchManager->getParameters();
foreach($parameters AS $name => $value) {
- print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
+ print '<input type="hidden" value="'.$value.'" name="'.$name.'" id="'.$name.'"/>';
}
- print '</td><td>';
- print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
-
- print '</td><td> </td><td>';
- print '<input type="submit" name="Search" value="'._('Search').'" />';
- print '</td>';
-
+ print '<label for="search-words" class="skip">' . html_image('pixel-transparent.gif', 1, 1, array('alt' => "")) . '</label>';
+ print '<input type="text" name="words" size="12" id="search-words" value="'.$defaultWords.'" />';
+
+ print '<label for="search-submit" class="skip">' . html_image('pixel-transparent.gif', 1, 1, array('alt' => "")) . '</label>';
+ print '<input type="image" name="Search" id="search-submit" src="/themes/adullact-v3/image/picto_bleu_loupe.png" alt="'._('Search').'" title="'._('Search').'" />';
+
if (isset($group_id) && $group_id) {
- print '
- <td width="10"> </td>
- <td><a class="lnkutility" href="'.$GLOBALS['sys_urlprefix'].'/search/advanced_search.php?group_id='.$group_id.'"> '._('Advanced search').'</a></td>';
+ $link_content = html_image('picto_remarques.png','21','21',array('alt'=>_('Advanced search'), 'title'=>_('Advanced search')));
+ print ' '.util_make_link ('/search/advanced_search.php?group_id='.$group_id, $link_content, array('class'=>'lnkutility', 'id'=>'advanced-search'));
}
- print '</tr></table>';
+ print '</div>';
print '</form>';
-
}
-
+
function advancedSearchBox($sectionsArray, $group_id, $words, $isExact) {
- // display the searchmask
+ // display the searchmask
print '
<form name="advancedsearch" action="'.getStringFromServer('PHP_SELF').'" method="post">
<input type="hidden" name="search" value="1"/>
<input type="hidden" name="group_id" value="'.$group_id.'"/>
- <div align="center"><br />
+ <div class="align-center"><br />
<table border="0">
<tr>
<td colspan ="2">
}
function createUnderSections($sectionsArray) {
- global $Language;
+ global $group_subsection_names;
+
$countLines = 0;
foreach ($sectionsArray as $section) {
if(is_array($section)) {
$countLines += 3;
}
}
- $breakLimit = round($countLines/3);
+
+ $maxCol = 3;
+ $breakLimit = ceil($countLines/$maxCol);
$break = $breakLimit;
$countLines = 0;
+ $countCol = 1;
+
$return = '
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr class="tableheader">
<!--<td colspan="2">'._('Search in').':</td-->
<td align="right">'._('Select').' <a href="javascript:setCheckBoxes(\'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\'\', false)">'._('none').'</a></td>
</tr>
- <tr height="20" class="tablecontent">
+ <tr class="tablecontent">
<td colspan="3"> </td>
</tr>
- <tr align="center" valign="top" class="tablecontent">
+ <tr valign="top" class="tablecontent align-center">
<td>';
foreach($sectionsArray as $key => $section) {
$oldcountlines = $countLines;
}
if ($countLines >= $break) {
- //if the next block is so large that shifting it to the next column hits the breakpoint better
- //the second part of statement (behind &&) proofs, that no 4th column is added
- if ((($countLines - $break) >= ($break - $countLines)) && ((($break + $breakLimit)/$breakLimit) <= 3)) {
+ // if we are closer to the limit with this one included, then
+ // it's better to include it.
+ if (($countCol < $maxCol) && ($countLines - $break) >= ($break - $oldcountlines)) {
$return .= '</td><td>';
+ $countCol++;
$break += $breakLimit;
}
}
<tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td cellspacing="0">
- <a href="#'.$key.'">'.$Language->getText('group', $key).'</a>'
+ <a href="#'.$key.'">'.$group_subsection_names[$key].'</a>'
.' </td>
<td align="right">'
._('Select').' <a href="javascript:setCheckBoxes(\''.$key.'\', true)">'._('all').'</a> / <a href="javascript:setCheckBoxes(\''.$key.'\', false)">'._('none').'</a>
$return .= ' <input type="checkbox" name="'.urlencode($key).'"';
if (isset($GLOBALS[urlencode($key)]))
$return .= ' checked="checked" ';
- $return .= ' /></input>'.$Language->getText('group', $key).'<br />';
+ $return .= ' /></input>'.$group_subsection_names[$key].'<br />';
}
else
foreach($section as $underkey => $undersection) {
$return .= ' <input type="checkbox" name="'.urlencode($key.$underkey).'"';
if (isset($GLOBALS[urlencode($key.$underkey)]))
- $return .= ' checked ';
- $return .= '></input>'.$undersection.'<br />';
+ $return .= ' checked="checked" ';
+ $return .= ' />'.$undersection.'<br />';
}
$count--;
$return = '';
-
for ($i=0; $i<$count; $i++) {
- $return .= '
- <a href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a> | ';
+ $return .= util_make_link ($links_arr[$i],$title_arr[$i]).' | ';
}
- $return .= '
- <a href="'.$GLOBALS['sys_urlprefix'].$links_arr[$i].'">'.$title_arr[$i].'</a>';
+ $return .= util_make_link ($links_arr[$i],$title_arr[$i]);
return $return;
}
$return= '
<tr '.$row_attr;
if ( $istitle ) {
- $return .=' align="center" class="multiTableRowTitle"';
+ $return .=' class="align-center multiTableRowTitle"';
}
$return .= '>';
for ( $c = 0; $c < count($cell_data); $c++ ) {
return '';
} else {
return '
- <span class="feedback">'.strip_tags($feedback, '<br>').'</span>';
+ <div class="feedback">'.strip_tags($feedback, '<br>').'</div>';
+ }
+ }
+ /**
+ * warning_msg() - returns the htmlized warning string when an action is performed.
+ *
+ * @param string msg string
+ * @return string htmlized warning
+ */
+ function warning_msg($msg) {
+ if (!$msg) {
+ return '';
+ } else {
+ return '
+ <div class="warning_msg">'.strip_tags($msg, '<br>').'</div>';
}
}
+
+ /**
+ * error_msg() - returns the htmlized error string when an action is performed.
+ *
+ * @param string msg string
+ * @return string htmlized error
+ */
+ function error_msg($msg) {
+ if (!$msg) {
+ return '';
+ } else {
+ return '
+ <div class="error">'.strip_tags($msg, '<br>').'</div>';
+ }
+ }
+
/**
* getThemeIdFromName()
* @return integer the theme id
*/
function getThemeIdFromName($dirname) {
- $res=db_query("SELECT theme_id FROM themes WHERE dirname='$dirname'");
+ $res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1',
+ array ($dirname));
return db_result($res,0,'theme_id');
}
- function quickNav() {
- if (!session_loggedin()) {
- return '';
- } else {
- $res=db_query("SELECT * FROM groups NATURAL JOIN user_group WHERE user_id='".user_getid()."' ORDER BY group_name");
-echo db_error();
- if (!$res || db_numrows($res) < 1) {
- return '';
+ function confirmBox($msg, $params, $buttons, $image='*none*') {
+ if ($image == '*none*') {
+ $image = html_image('stop.png','48','48',array());
+ }
+
+ foreach ($params as $b => $v) {
+ $prms[] = '<input type="hidden" name="'.$b.'" value="'.$v.'" />'."\n";
+ }
+ $prm = join(' ', $prms);
+
+ foreach ($buttons as $b => $v) {
+ $btns[] = '<input type="submit" name="'.$b.'" value="'.$v.'" />'."\n";
+ }
+ $btn = join(' '."\n ", $btns);
+
+ return '
+ <div id="infobox" style="margin-top: 15%; margin-left: 15%; margin-right: 15%; text-align: center;">
+ <table align="center">
+ <tr>
+ <td>'.$image.'</td>
+ <td>'.$msg.'<br/></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <br />
+ <form action="' . getStringFromServer('PHP_SELF') . '" method="get" >
+ '.$prm.'
+ '.$btn.'
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ ';
+ }
+
+ function html_input($name, $id = '', $label = '', $type = 'text', $value = '', $extra_params = '') {
+ if (!$id) {
+ $id = $name;
+ }
+ $return = '<div class="field-holder">
+ ';
+ if ($label) {
+ $return .= '<label for="' . $id . '">' . $label . '</label>
+ ';
+ }
+ $return .= '<input id="' . $id . '" type="' . $type . '"';
+ //if input is a submit then name is not present
+ if ($name) {
+ $return .= ' name="' . $name . '"';
+ }
+ if ($value) {
+ $return .= ' value="' . $value . '"';
+ }
+ if (is_array($extra_params)) {
+ foreach ($extra_params as $key => $extra_params_value) {
+ $return .= $key . '="' . $extra_params_value . '" ';
+ }
+ }
+ $return .= '/>
+ </div>';
+ return $return;
+ }
+
+ function html_checkbox($name, $value, $id = '', $label = '', $checked = '', $extra_params = '') {
+ if (!$id) {
+ $id = $name;
+ }
+ $return = '<div class="field-holder">
+ ';
+ $return .= '<input name="' . $name . '" id="' . $id . '" type="checkbox" value="' . $value . '" ';
+ if ($checked) {
+ $return .= 'checked="checked" ';
+ }
+ if (is_array($extra_params)) {
+ foreach ($extra_params as $key => $extra_params_value) {
+ $return .= $key . '="' . $extra_params_value . '" ';
+ }
+ }
+ $return .= '/>';
+ if ($label) {
+ $return .= '<label for="' . $id . '">' . $label . '</label>
+ ';
+ }
+ $return .= '</div>';
+ return $return;
+ }
+
+ function html_text_input_img_submit($name, $img_src, $id = '', $label = '', $value = '', $img_title = '', $img_alt = '', $extra_params = '', $img_extra_params = '') {
+ if (!$id) {
+ $id = $name;
+ }
+ if (!$img_title) {
+ $img_title = $name;
+ }
+ if (!$img_alt) {
+ $img_alt = $img_title;
+ }
+ $return = '<div class="field-holder">
+ ';
+ if ($label) {
+ $return .= '<label for="' . $id . '">' . $label . '</label>
+ ';
+ }
+ $return .= '<input id="' . $id . '" type="text" name="' . $name . '"';
+ if ($value) {
+ $return .= ' value="' . $value . '"';
+ }
+ if (is_array($extra_params)) {
+ foreach ($extra_params as $key => $extra_params_value) {
+ $return .= $key . '="' . $extra_params_value . '" ';
+ }
+ }
+ $return .= '/>
+ <input type="image" id="' . $id . '_submit" src="' . $this->imgroot . $img_src . '" alt="' . $img_alt . '" title="' . $img_title . '"';
+ if (is_array($img_extra_params)) {
+ foreach ($img_extra_params as $key => $img_extra_params_value) {
+ $return .= $key . '="' . $img_extra_params_value . '" ';
+ }
+ }
+ $return .= '/>
+ </div>';
+ return $return;
+ }
+
+ function html_select($vals, $name, $label = '', $id = '', $checked_val = '', $text_is_value = false, $extra_params = '') {
+ if (!$id) {
+ $id = $name;
+ }
+ $return = '<div class="field-holder">
+ ';
+ if ($label) {
+ $return .= '<label for="' . $id . '">' . $label . '</label>
+ ';
+ }
+ $return .= '<select name="' . $name . '" id="' . $id . '" ';
+ if (is_array($extra_params)) {
+ foreach ($extra_params as $key => $extra_params_value) {
+ $return .= $key . '="' . $extra_params_value . '" ';
+ }
+ }
+ $return .= '>';
+ $rows = count($vals);
+ for ($i = 0; $i < $rows; $i++) {
+ if ( $text_is_value ) {
+ $return .= '
+ <option value="' . $vals[$i] . '"';
+ if ($vals[$i] == $checked_val) {
+ $return .= ' selected="selected"';
+ }
} else {
- $ret = '
- <form name="quicknavform">
- <select name="quicknav" onChange="location.href=document.quicknavform.quicknav.value">';
- $ret .= '
- <option value="">Quick Jump To...</option>';
- for ($i=0; $i<db_numrows($res); $i++) {
- $ret .= '
- <option value="/projects/'.db_result($res,$i,'unix_group_name').'/">'.db_result($res,$i,'group_name').'</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A') {
- $ret .= '
- <option value="/project/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
- }
- //tracker
- if (db_result($res,$i,'use_tracker')) {
- $ret .= '
- <option value="/tracker/?group_id='.db_result($res,$i,'group_id').'"> Tracker</option>';
- if (db_result($res,$i,'admin_flags') || db_result($res,$i,'tracker_flags')) {
- $ret .= '
- <option value="/tracker/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
- }
- }
- //task mgr
- if (db_result($res,$i,'use_pm')) {
- $ret .= '
- <option value="/pm/?group_id='.db_result($res,$i,'group_id').'"> Task Manager</option>';
- if (trim(db_result($res,$i,'admin_flags')) =='A' || db_result($res,$i,'project_flags')) {
- $ret .= '
- <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
- }
- }
- //FRS
- if (db_result($res,$i,'use_frs')) {
- $ret .= '
- <option value="/frs/?group_id='.db_result($res,$i,'group_id').'"> Files</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'release_flags')) {
- $ret .= '
- <option value="/frs/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
- }
- }
- //SCM
- if (db_result($res,$i,'use_scm')) {
- $ret .= '
- <option value="/scm/?group_id='.db_result($res,$i,'group_id').'"> SCM</option>';
- /*if (db_result($res,$i,'admin_flags') || db_result($res,$i,'project_flags')) {
- $ret .= '
- <option value="/pm/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
- } */
- }
- //forum
- if (db_result($res,$i,'use_forum')) {
- $ret .= '
- <option value="/forum/?group_id='.db_result($res,$i,'group_id').'"> Forum</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'forum_flags')) {
- $ret .= '
- <option value="/forum/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
- }
- }
- //mail
- if (db_result($res,$i,'use_mail')) {
- $ret .= '
- <option value="/mail/?group_id='.db_result($res,$i,'group_id').'"> Lists</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A') {
- $ret .= '
- <option value="/mail/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
- }
- }
- //doc
- if (db_result($res,$i,'use_docman')) {
- $ret .= '
- <option value="/docman/?group_id='.db_result($res,$i,'group_id').'"> Docs</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A' || db_result($res,$i,'doc_flags')) {
- $ret .= '
- <option value="/docman/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
- }
- }
- //news
- if (db_result($res,$i,'use_news')) {
- $ret .= '
- <option value="/news/?group_id='.db_result($res,$i,'group_id').'"> News</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A') {
- $ret .= '
- <option value="/news/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
- }
- }
- //survey
- if (db_result($res,$i,'use_survey')) {
- $ret .= '
- <option value="/survey/?group_id='.db_result($res,$i,'group_id').'"> Surveys</option>';
- if (trim(db_result($res,$i,'admin_flags'))=='A') {
- $ret .= '
- <option value="/survey/admin/?group_id='.db_result($res,$i,'group_id').'"> Admin</option>';
- }
- }
- }
- $ret .= '
- </select>
- </form>';
+ $return .= '
+ <option value="' . $i . '"';
+ if ($i == $checked_val) {
+ $return .= ' selected="selected"';
+ }
}
+ $return .= '>' . htmlspecialchars($vals[$i]) . '</option>';
}
- return $ret;
+ $return .= '
+ </select>
+ </div>';
+ return $return;
}
+
+ function html_textarea($name, $id = '', $label = '', $value = '', $extra_params = '') {
+ if (!$id) {
+ $id = $name;
+ }
+ $return = '<div class="field-holder">
+ ';
+ if ($label) {
+ $return .= '<label for="' . $id . '">' . $label . '</label>
+ ';
+ }
+ $return .= '<textarea id="' . $id . '" name="' . $name . '" ';
+ if (is_array($extra_params)) {
+ foreach ($extra_params as $key => $extra_params_value) {
+ $return .= $key . '="' . $extra_params_value . '" ';
+ }
+ }
+ $return .= '>';
+ if ($value) {
+ $return .= $value;
+ }
+ $return .= '</textarea>
+ </div>';
+ return $return;
+ }
+
+ function html_table_top($cols, $summary = '', $class = '', $extra_params = '') {
+ $return = '<table summary="' . $summary . '" ';
+ if ($class) {
+ $return .= 'class="' . $class . '" ';
+ }
+ if (is_array($extra_params)) {
+ foreach ($extra_params as $key => $extra_params_value) {
+ $return .= $key . '="' . $extra_params_value . '" ';
+ }
+ }
+ $return .= '>';
+ $return .= '<thead><tr>';
+ $nbCols = count($cols);
+ for ($i = 0; $i < $nbCols; $i++) {
+ $return .= '<th scope="col">' . $cols[$i] . '</th>';
+ }
+ $return .= '</tr></thead>';
+ return $return;
+ }
+
+ function getMonitorPic($title = '', $alt = '') {
+ return $this->getPicto('ic/mail16w.png', $title, $alt, '15', '15');
+ }
+
+ function getReleaseNotesPic($title = '', $alt = '') {
+ return $this->getPicto('ic/manual16c.png', $title, $alt, '15', '15');
+ }
+
+ /* no picto for download */
+ function getDownloadPic($title = '', $alt = '') {
+ return $this->getPicto('ic/save.png', $title, $alt, '15', '15');
+ }
+
+ function getHomePic($title = '', $alt = '') {
+ return $this->getPicto('ic/home16b.png', $title, $alt);
+ }
+
+ function getFollowPic($title = '', $alt = '') {
+ return $this->getPicto('ic/tracker20g.png', $title, $alt);
+ }
+
+ function getForumPic($title = '', $alt = '') {
+ return $this->getPicto('ic/forum20g.png', $title, $alt);;
+ }
+
+ function getDocmanPic($title = '', $alt = '') {
+ return $this->getPicto('ic/docman16b.png', $title, $alt);
+ }
+
+ function getMailPic($title = '', $alt = '') {
+ return $this->getPicto('ic/mail16b.png', $title, $alt);
+ }
+
+ function getPmPic($title = '', $alt = '') {
+ return $this->getPicto('ic/taskman20g.png', $title, $alt);
+ }
+
+ function getScmPic($title = '', $alt = '') {
+ return $this->getPicto('ic/cvs16b.png', $title, $alt);
+ }
+
+ function getFtpPic($title = '', $alt = '') {
+ return $this->getPicto('ic/ftp16b.png', $title, $alt);
+ }
+
+ function getPicto($url, $title, $alt, $width = '20', $height = '20') {
+ if (!$alt) {
+ $alt = $title;
+ }
+ return html_image($url, $width, $height, array('title'=>$title, 'alt'=>$alt));
+ }
+
+ /**
+ * toSlug() - protect a string to be used as a link or an anchor
+ *
+ * @param string $string the string used as a link or an anchor
+ * @param string $space the caracter used as a replacement for a space
+ * @return a protected string with only alphanumeric caracters
+ */
+ function toSlug($string, $space = "-") {
+ if (function_exists('iconv')) {
+ $string = @iconv('UTF-8', 'ASCII//TRANSLIT', $string);
+ }
+ $string = preg_replace("/[^a-zA-Z0-9- ]/", "-", $string);
+ $string = strtolower($string);
+ $string = str_replace(" ", $space, $string);
+ return $string;
+ }
+}
-}
// Local Variables:
// mode: php