*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010 (c) FusionForge Team
+ * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2011, Franck Villaume - Capgemini
+ * Copyright 2011, Franck Villaume - TrivialDev
*
- * This file is part of FusionForge.
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
*
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* html_feedback_top() - Show the feedback output at the top of the page.
*
- * @param string The feedback.
+ * @param string The feedback.
*/
function html_feedback_top($feedback) {
global $HTML;
/**
* html_warning_top() - Show the warning output at the top of the page.
*
- * @param string The warning message.
+ * @param string The warning message.
*/
function html_warning_top($msg) {
global $HTML;
/**
* html_error_top() - Show the error output at the top of the page.
*
- * @param string The error message.
+ * @param string The error message.
*/
function html_error_top($msg) {
global $HTML;
/**
* make_user_link() - Make a username reference into a link to that users User page on SF.
*
- * @param string The username of the user to link.
+ * @param string The username of the user to link.
*/
function make_user_link($username,$displayname='') {
- if (empty($displayname))
- $displayname = $username;
+ if (empty($displayname))
+ $displayname = $username;
if (!strcasecmp($username,'Nobody') || !strcasecmp($username,'None')) {
return $username;
} else {
- return '<a href="/users/'.$username.'">'.$displayname.'</a>' ;
+ return '<a href="/users/'.$username.'">'.$displayname.'</a>';
}
}
/**
- * html_feedback_top() - Show the feedback output at the bottom of the page.
+ * html_feedback_bottom() - Show the feedback output at the bottom of the page.
*
- * @param string The feedback.
+ * @param string The feedback.
*/
function html_feedback_bottom($feedback) {
global $HTML;
/**
* html_blankimage() - Show the blank spacer image.
*
- * @param int The height of the image
- * @param int The width of the image
+ * @param int The height of the image
+ * @param int The width of the image
*/
function html_blankimage($height,$width) {
return '<img src="/images/blank.png" width="' . $width . '" height="' . $height . '" alt="" />';
/**
* html_abs_image() - Show an image given an absolute URL.
*
- * @param string URL
- * @param int width of the image
- * @param int height of the image
- * @param array Any <img> tag parameters (i.e. 'border', 'alt', etc...)
+ * @param string URL
+ * @param int width of the image
+ * @param int height of the image
+ * @param array Any <img> tag parameters (i.e. 'border', 'alt', etc...)
*/
function html_abs_image($url, $width, $height, $args) {
$return = ('<img src="' . $url . '"');
$return .= ' alt=""';
}
- // ## add image dimensions
- $return .= " width=\"" . $width . "\"";
- $return .= " height=\"" . $height . "\"";
+ // Add image dimensions (if given)
+ $return .= $width ?" width=\"" . $width . "\"": '';
+ $return .= $height? " height=\"" . $height . "\"": '';
$return .= (' />');
return $return;
/**
* html_image() - Build an image tag of an image contained in $src
*
- * @param string The source location of the image
- * @param int The width of the image
- * @param int The height of the image
- * @param array Any IMG tag parameters associated with this image (i.e. 'border', 'alt', etc...)
- * @param bool DEPRECATED
+ * @param string The source location of the image
+ * @param int The width of the image
+ * @param int The height of the image
+ * @param array Any IMG tag parameters associated with this image (i.e. 'border', 'alt', etc...)
+ * @param bool DEPRECATED
*/
-function html_image($src,$width='',$height='',$args=array(),$display=1) {
+function html_image($src, $width='', $height='', $args=array(), $display=1) {
global $HTML;
+
+ if (method_exists($HTML, 'html_image')) {
+ $HTML->html_image($src, $width, $height, $args);
+ }
$s = ((session_issecure()) ? forge_get_config('images_secure_url') : forge_get_config('images_url') );
return html_abs_image($s.$HTML->imgroot.$src, $width, $height, $args);
}
/**
* html_get_language_popup() - Pop up box of supported languages.
*
- * @param string The title of the popup box.
- * @param string Which element of the box is to be selected.
+ * @param string The title of the popup box.
+ * @param string Which element of the box is to be selected.
* @return string The html select box.
*/
-function html_get_language_popup ($title='language_id',$selected='xzxz') {
- $res = db_query_params ('SELECT * FROM supported_languages ORDER BY name ASC',
- array ());
- return html_build_select_box ($res,$title,$selected,false);
+function html_get_language_popup($title='language_id', $selected='xzxz') {
+ $res = db_query_params('SELECT * FROM supported_languages ORDER BY name ASC',
+ array());
+ return html_build_select_box($res, $title, $selected, false);
}
/**
* html_get_theme_popup() - Pop up box of supported themes.
*
- * @param string The title of the popup box.
- * @param string Which element of the box is to be selected.
+ * @param string The title of the popup box.
+ * @param string Which element of the box is to be selected.
* @return string The html select box.
*/
-function html_get_theme_popup ($title='theme_id',$selected='xzxz') {
- $res=db_query_params ('SELECT theme_id, fullname FROM themes WHERE enabled=true',
+function html_get_theme_popup($title='theme_id', $selected='xzxz') {
+ $res=db_query_params('SELECT theme_id, fullname FROM themes WHERE enabled=true',
array());
$nbTheme = db_numrows($res);
if($nbTheme < 2) {
return("");
}
else {
- return html_build_select_box($res,$title,$selected,false);
+ return html_build_select_box($res, $title, $selected, false);
}
}
/**
* html_get_ccode_popup() - Pop up box of supported country_codes.
*
- * @param string The title of the popup box.
- * @param string Which element of the box is to be selected.
+ * @param string The title of the popup box.
+ * @param string Which element of the box is to be selected.
* @return string The html select box.
*/
-function html_get_ccode_popup ($title='ccode',$selected='xzxz') {
- $res=db_query_params ('SELECT ccode,country_name FROM country_code ORDER BY country_name',
+function html_get_ccode_popup($title='ccode', $selected='xzxz') {
+ $res=db_query_params('SELECT ccode,country_name FROM country_code ORDER BY country_name',
array());
- return html_build_select_box ($res,$title,$selected,false);
+ return html_build_select_box($res, $title, $selected, false);
}
/**
* html_get_timezone_popup() - Pop up box of supported Timezones.
* Assumes you have included Timezones array file.
*
- * @param string The title of the popup box.
- * @param string Which element of the box is to be selected.
+ * @param string The title of the popup box.
+ * @param string Which element of the box is to be selected.
* @return string The html select box.
*/
-function html_get_timezone_popup ($title='timezone',$selected='xzxz') {
+function html_get_timezone_popup($title='timezone', $selected='xzxz') {
global $TZs;
if ($selected == 'xzxzxzx') {
- $r = file ('/etc/timezone');
- $selected = str_replace ("\n", '', $r[0]);
+ $r = file('/etc/timezone');
+ $selected = str_replace("\n", '', $r[0]);
}
- return html_build_select_box_from_arrays ($TZs,$TZs,$title,$selected,false);
+ return html_build_select_box_from_arrays($TZs, $TZs, $title, $selected, false);
}
$return = '
<select name="'.$select_name.'">';
- $rows=count($vals);
+ $rows = count($vals);
- for ($i=0; $i<$rows; $i++) {
+ for ($i = 0; $i < $rows; $i++) {
if ( $samevals ) {
$return .= "\n\t\t<option value=\"" . $vals[$i] . "\"";
if ($vals[$i] == $checked_val) {
}
function html_get_tooltip_description($element_name) {
- switch( $element_name ) {
- case 'assigned_to':
- return( _('This drop-down box represents the person to which a tracker item is assigned.'));
- case 'status_id':
- return( _('This drop-down box represents the current status of a tracker item.<br /><br />You can set the status to \'Pending\' if you are waiting for a response from the tracker item author. When the author responds the status is automatically reset to that of \'Open\'. Otherwise, if the author doesn\'t respond with an admin-defined amount of time (default is 14 days) then the item is given a status of \'Deleted\'.'));
- case 'category':
- return( _('Tracker category'));
- case 'group':
- return( _('Tracker group'));
- case 'sort_by':
- return( _('The Sort By option allows you to determine how the browse results are sorted.<br /><br /> You can sort by ID, Priority, Summary, Open Date, Close Date, Submitter, or Assignee. You can also have the results sorted in Ascending or Descending order.'));
- case 'new_artifact_type_id':
- return( _('The Data Type option determines the type of tracker item this is. Since the tracker rolls into one the bug, patch, support, etc... managers you need to be able to determine which one of these an item should belong.<br /><br />This has the added benefit of enabling an admin to turn a support request into a bug.'));
- case 'priority':
- return( _('The priority option allows a user to define a tracker item priority (ranging from 1-Lowest to 5-Highest).<br /><br />This is especially helpful for bugs and support requests where a user might find a critical problem with a project.'));
- case 'resolution':
- return( _('Resolution'));
- case 'summary':
- return( _('The summary text-box represents a short tracker item summary. Useful when browsing through several tracker items.'));
- case 'canned_response':
- return( _('The canned response drop-down represents a list of project admin-defined canned responses to common support or bug submission.<br /><br /> If you are a project admin you can click the \'(admin)\' link to define your own canned responses'));
- case 'comment':
- return( _('Comment'));
- case 'description':
- return( htmlentities(_('Enter the complete description.').'<br/><br/>'.
- _("<div align=\"left\"><b>Editing tips:</b><br/><strong>http,https or ftp</strong>: Hyperlinks.<br/><strong>[#NNN]</strong>: Tracker id NNN.<br/><strong>[TNNN]</strong>: Task id NNN.<br/><strong>[wiki:<pagename>]</strong>: Wiki page.<br/><strong>[forum:<msg_id>]</strong>: Forum post.</div>")));
- case 'attach_file':
- return( _('When you wish to attach a file to a tracker item you must check this checkbox before submitting changes.'));
- case 'monitor':
- return( htmlentities(_('You can monitor or un-monitor this item by clicking the "Monitor" button. <br /><br /><strong>Note!</strong> this will send you additional email. If you add comments to this item, or submitted, or are assigned this item, you will also get emails for those reasons as well!')));
- default:
- return('');
+ global $use_tooltips;
+ if ($use_tooltips) {
+ switch( $element_name ) {
+ case 'assigned_to':
+ return( _('This drop-down box represents the person to which a tracker item is assigned.'));
+ case 'status_id':
+ return( _('This drop-down box represents the current status of a tracker item.<br /><br />You can set the status to \'Pending\' if you are waiting for a response from the tracker item author. When the author responds the status is automatically reset to that of \'Open\'. Otherwise, if the author doesn\'t respond with an admin-defined amount of time (default is 14 days) then the item is given a status of \'Deleted\'.'));
+ case 'category':
+ return( _('Tracker category'));
+ case 'group':
+ return( _('Tracker group'));
+ case 'sort_by':
+ return( _('The Sort By option allows you to determine how the browse results are sorted.<br /><br /> You can sort by ID, Priority, Summary, Open Date, Close Date, Submitter, or Assignee. You can also have the results sorted in Ascending or Descending order.'));
+ case 'new_artifact_type_id':
+ return( _('The Data Type option determines the type of tracker item this is. Since the tracker rolls into one the bug, patch, support, etc... managers you need to be able to determine which one of these an item should belong.<br /><br />This has the added benefit of enabling an admin to turn a support request into a bug.'));
+ case 'priority':
+ return( _('The priority option allows a user to define a tracker item priority (ranging from 1-Lowest to 5-Highest).<br /><br />This is especially helpful for bugs and support requests where a user might find a critical problem with a project.'));
+ case 'resolution':
+ return( _('Resolution'));
+ case 'summary':
+ return( _('The summary text-box represents a short tracker item summary. Useful when browsing through several tracker items.'));
+ case 'canned_response':
+ return( _('The canned response drop-down represents a list of project admin-defined canned responses to common support or bug submission.<br /><br /> If you are a project admin you can click the \'(admin)\' link to define your own canned responses'));
+ case 'comment':
+ return( _('Anyone can add here comments to give additional information, answers and solutions. Please, be as precise as possible to avoid misunderstanding. If relevant, screenshots or documents can be added as attached files.'));
+ case 'description':
+ return( htmlentities(_('Enter the complete description.').'<br/><br/>'.
+ _("<div align=\"left\"><b>Editing tips:</b><br/><strong>http,https or ftp</strong>: Hyperlinks.<br/><strong>[#NNN]</strong>: Tracker id NNN.<br/><strong>[TNNN]</strong>: Task id NNN.<br/><strong>[wiki:<pagename>]</strong>: Wiki page.<br/><strong>[forum:<msg_id>]</strong>: Forum post.</div>"),
+ ENT_COMPAT, 'UTF-8'));
+ case 'attach_file':
+ return( _('When you wish to attach a file to a tracker item you must check this checkbox before submitting changes.'));
+ case 'monitor':
+ return( htmlentities(_('You can monitor or un-monitor this item by clicking the "Monitor" button. <br /><br /><strong>Note!</strong> this will send you additional email. If you add comments to this item, or submitted, or are assigned this item, you will also get emails for those reasons as well!'),
+ ENT_COMPAT, 'UTF-8'));
+ default:
+ return('');
+ }
+ } else {
+ return('');
}
}
-function html_use_tooltips() {
+function html_use_jquery() {
use_javascript('/scripts/jquery/jquery-1.4.2.min.js');
+}
+
+function html_use_tooltips() {
+ html_use_jquery();
use_javascript('/scripts/jquery-tipsy/src/javascripts/jquery.tipsy.js');
- use_javascript('/js/tooltips.js');
+ use_javascript('/js/jquery-common.js');
use_stylesheet('/scripts/jquery-tipsy/src/stylesheets/tipsy.css');
}
+function html_use_storage() {
+ html_use_jquery();
+ use_javascript('/scripts/jquery-storage/jquery.Storage.js');
+}
+
+function html_use_simplemenu() {
+ html_use_jquery();
+ use_javascript('/scripts/jquery-simpletreemenu/js/jquery-simpleTreeMenu-1.1.0.js');
+ use_stylesheet('/scripts/jquery-simpletreemenu/css/jquery-simpleTreeMenu-1.1.0.css');
+}
+
+function html_use_coolfieldset() {
+ html_use_jquery();
+ use_javascript('/scripts/coolfieldset/js/jquery.coolfieldset.js');
+ use_javascript('/js/jquery-common.js');
+ use_stylesheet('/scripts/coolfieldset/css/jquery.coolfieldset.css');
+}
+
/**
* html_build_select_box_from_arrays() - Takes two arrays, with the first array being the "id" or value and the other
* array being the text you want displayed.
* @param array Array of all allowed values from the full list.
*/
function html_build_select_box_from_arrays ($vals,$texts,$select_name,$checked_val='xzxz',$show_100=true,$text_100='none',$show_any=false,$text_any='any', $allowed=false) {
+ $have_a_subelement = false;
+
if ($text_100=='none'){
$text_100=_('None');
}
$return .= 'ERROR - uneven row counts';
}
+ $title = html_get_tooltip_description($select_name);
+ $id = '';
+ if ($title) {
+ $id = ' id="tracker-'.$select_name.'"';
+ if (preg_match('/\[\]/', $id)) {
+ $id = '';
+ }
+ }
+
$title = html_get_tooltip_description($select_name);
$return .= '
- <select id="tracker-'.$select_name.'" name="'.$select_name.'" title="'.$title.'">';
+ <select'.$id.' name="'.$select_name.'" title="'.util_html_secure($title).'">';
//we don't always want the default Any row shown
if ($show_any) {
$return .= '
- <option value=""'.(($checked_val=='') ? ' selected="selected"' : '').'>'. $text_any .'</option>';
+ <option value=""'.(($checked_val=='') ? ' selected="selected"' : '').'>'. util_html_secure($text_any) .'</option>';
+ $have_a_subelement = true;
}
//we don't always want the default 100 row shown
if ($show_100) {
$return .= '
- <option value="100"'.(($checked_val==100) ? ' selected="selected"' : '').'>'. $text_100 .'</option>';
+ <option value="100"'.(($checked_val==100) ? ' selected="selected"' : '').'>'. util_html_secure($text_100) .'</option>';
+ $have_a_subelement = true;
}
$checked_found=false;
// if it was shown above, otherwise do show it
if (($vals[$i] != '100') || ($vals[$i] == '100' && !$show_100)) {
$return .= '
- <option value="'.$vals[$i].'"';
+ <option value="'.util_html_secure($vals[$i]).'"';
if ((string)$vals[$i] == (string)$checked_val) {
$checked_found=true;
$return .= ' selected="selected"';
if (is_array($allowed) && !in_array($vals[$i], $allowed)) {
$return .= ' disabled="disabled" class="option_disabled"';
}
- $return .= '>'./*htmlspecialchars(*/$texts[$i]/*)*/.'</option>';
+ $return .= '>'.util_html_secure($texts[$i]).'</option>';
+ $have_a_subelement = true;
}
}
//
//
if (!$checked_found && $checked_val != 'xzxz' && $checked_val && $checked_val != 100) {
$return .= '
- <option value="'.$checked_val.'" selected="selected">'._('No Change').'</option>';
+ <option value="'.util_html_secure($checked_val).'" selected="selected">'._('No Change').'</option>';
+ $have_a_subelement = true;
+ }
+
+ if (!$have_a_subelement) {
+ /* <select></select> without <option/> in between is invalid */
+ return '<!-- select without options -->';
}
$return .= '
* @param bool Whether or not to show the '100 row'
* @param string What to call the '100 row'. Defaults to none.
*/
-function html_build_select_box ($result, $name, $checked_val="xzxz",$show_100=true,$text_100='none',$show_any=false,$text_any='Select One') {
+function html_build_select_box ($result, $name, $checked_val="xzxz", $show_100=true, $text_100='none', $show_any=false, $text_any='Select One') {
if ($text_100=='none'){
$text_100=_('None');
}
/**
* html_build_multiple_select_box_from_arrays() - Takes two arrays and builds a multi-select box
*
- * @param array id of the field
+ * @param array id of the field
* @param array Text to be displayed
* @param string id of the items selected
* @param string The item that should be checked
$rows=count($ids);
for ($i=0; $i<$rows; $i++) {
if (( $ids[$i] != '100') || ($ids[$i] == '100' && !$show_100)) {
- $return .='
+ $return .='
<option value="'.$ids[$i].'"';
/*
Determine if it's checked
*/
function html_build_priority_select_box ($name='priority', $checked_val='3', $nochange=false) {
?>
- <select id="tracker-<?php echo $name ?>" name="<?php echo $name; ?>" title="<?php echo html_get_tooltip_description($name) ?>">
+ <select id="tracker-<?php echo $name ?>" name="<?php echo $name; ?>" title="<?php echo util_html_secure(html_get_tooltip_description($name)) ?>">
<?php if($nochange) { ?>
<option value="100"<?php if ($nochange) {echo " selected=\"selected\"";} ?>><?php echo _('No Change') ?></option>
<?php } ?>
/**
* html_buildcheckboxarray() - Build an HTML checkbox array.
*
- * @param array Options array
- * @param name Checkbox name
- * @param array Array of boxes to be pre-checked
+ * @param array Options array
+ * @param name Checkbox name
+ * @param array Array of boxes to be pre-checked
*/
function html_buildcheckboxarray($options,$name,$checked_array) {
$option_count=count($options);
}
/**
- * site_header() - everything required to handle security and
- * add navigation for user pages like /my/ and /account/
+ * site_header() - everything required to handle security and
+ * add navigation for user pages like /my/ and /account/
*
- * @param array Must contain $user_id
+ * @param array Must contain $user_id
*/
function site_header($params) {
GLOBAL $HTML;
Check to see if logged in
*/
echo $HTML->header($params);
-
- if(isset($GLOBALS['error_msg']) && $GLOBALS['error_msg']) {
- echo html_error_top($GLOBALS['error_msg']);
- }
- if(isset($GLOBALS['warning_msg']) && $GLOBALS['warning_msg']) {
- echo html_warning_top($GLOBALS['warning_msg']);
- }
- if(isset($GLOBALS['feedback']) && $GLOBALS['feedback']) {
- echo html_feedback_top($GLOBALS['feedback']);
- }
}
/**
* site_footer() - Show the HTML site footer.
*
- * @param array Footer params array
+ * @param array Footer params array
*/
function site_footer($params) {
- GLOBAL $HTML;
+ global $HTML;
$HTML->footer($params);
}
/**
- * site_project_header() - everything required to handle
- * security and state checks for a project web page
+ * site_project_header() - everything required to handle
+ * security and state checks for a project web page
*
- * @param params array() must contain $toptab and $group
+ * @param params array() must contain $toptab and $group
*/
function site_project_header($params) {
- GLOBAL $HTML;
+ global $HTML;
/*
Check to see if active
exit_error(sprintf(_('Project Problem: %s'),$project->getErrorMessage()),'home');
}
- //group is private
- if (!$project->isPublic()) {
- session_require_perm ('project_read', $group_id);
- }
+ // Check permissions in case of restricted access
+ session_require_perm ('project_read', $group_id);
//for dead projects must be member of admin project
if (!$project->isActive()) {
}
if (isset($params['title'])){
+ $h1=$params['title'];
$params['title']=$project->getPublicName().': '.$params['title'];
} else {
+ $h1=$project->getPublicName();
$params['title']=$project->getPublicName();
}
-
+ if (!isset($params['h1'])){
+ $params['h1'] = $h1;
+ }
+
site_header($params);
-
-// echo $HTML->project_tabs($params['toptab'],$params['group'],$params['tabtext']);
}
/**
- * site_project_footer() - currently a simple shim
- * that should be on every project page, rather than
- * a direct call to site_footer() or theme_footer()
+ * site_project_footer() - currently a simple shim
+ * that should be on every project page, rather than
+ * a direct call to site_footer() or theme_footer()
*
- * @param params array() empty
+ * @param params array() empty
*/
function site_project_footer($params) {
site_footer($params);
}
/**
- * site_user_header() - everything required to handle security and
- * add navigation for user pages like /my/ and /account/
+ * site_user_header() - everything required to handle security and
+ * add navigation for user pages like /my/ and /account/
*
- * @param params array() must contain $user_id
+ * @param params array() must contain $user_id
*/
function site_user_header($params) {
GLOBAL $HTML;
Check to see if active user
Check to see if logged in
*/
- echo $HTML->header($params);
- echo "<h1>" . _('My Personal Page') . "</h1>\n";
- if (isset($GLOBALS['error_msg'])) {
- echo html_feedback_top($GLOBALS['error_msg']);
+ site_header($params);
+ echo ($HTML->beginSubMenu());
+ $arr_t = array();
+ $all_l = array();
+ $arr_attr = array();
+
+ $arr_t[] = _('My Personal Page');
+ $arr_l[] = '/my/';
+ $arr_attr[] = array('title' => _('View your personal page, a selection of widgets to follow the informations from projects.'), 'class' => 'tabtitle-nw');
+
+
+ $arr_t[] = _('Trackers dashboard');
+ $arr_l[] = '/my/dashboard.php';
+ $arr_attr[] = array('title' => _('View your tasks and artifacts.'), 'class' => 'tabtitle');
+
+
+ if (forge_get_config('use_diary')) {
+ $arr_t[] = _('Diary & Notes');
+ $arr_l[] = '/my/diary.php';
+ $arr_attr[] = array('title' => _('Manage your diary. Add, modify or delete your notes.'), 'class' => 'tabtitle');
}
- if (isset($GLOBALS['warning_msg'])) {
- echo html_feedback_top($GLOBALS['warning_msg']);
+
+ $arr_t[] = _('Account Maintenance');
+ $arr_l[] = '/account/';
+ $arr_attr[] = array('title' => _('Manage your account. Change your password, select your preferences.'), 'class' => 'tabtitle');
+
+ if (!forge_get_config('project_registration_restricted')
+ || forge_check_global_perm('approve_projects', '')) {
+ $arr_t[] = _('Register Project');
+ $arr_l[] = '/register/';
+ $arr_attr[] = array('title' => _('Register a new project in forge, following the workflow.'), 'class' => 'tabtitle');
}
- if (isset($GLOBALS['feedback'])) {
- echo html_feedback_top($GLOBALS['feedback']);
+
+ echo ($HTML->printSubMenu($arr_t, $arr_l, $arr_attr));
+ if ( plugin_hook_listeners("usermenu") > 0 ) {
+ echo $HTML->subMenuSeparator();
}
- echo ($HTML->beginSubMenu());
- if ($GLOBALS['sys_use_diary']) {
- echo ($HTML->printSubMenu(
- array(_('My Personal Page'),
- _('Trackers dashboard'),
- _('Diary & Notes'),
- _('Account Maintenance'),
- _('Register Project')),
- array('/my/',
- '/my/dashboard.php',
- '/my/diary.php',
- '/account/',
- '/register/')));
- } else {
- echo ($HTML->printSubMenu(
- array(_('My Personal Page'),
- _('Account Maintenance'),
- _('Register Project')),
- array('/my/',
- '/account/',
- '/register/')));
- }
- plugin_hook ("usermenu", false) ;
+ plugin_hook("usermenu", false);
echo ($HTML->endSubMenu());
}
/**
- * site_user_footer() - currently a simple shim that should be on every user page,
- * rather than a direct call to site_footer() or theme_footer()
+ * site_user_footer() - currently a simple shim that should be on every user page,
+ * rather than a direct call to site_footer() or theme_footer()
*
- * @param params array() empty
+ * @param params array() empty
*/
function site_user_footer($params) {
site_footer($params);
}
/**
- * html_clean_hash_string() - Remove noise characters from hex hash string
+ * html_clean_hash_string() - Remove noise characters from hex hash string
*
- * Thruout SourceForge, URLs with hexadecimal hash string parameters
- * are being sent via email to request confirmation of user actions.
- * It was found that some mail clients distort this hash, so we take
- * special steps to encode it in the way which help to preserve its
- * recognition. This routine
+ * Thruout SourceForge, URLs with hexadecimal hash string parameters
+ * are being sent via email to request confirmation of user actions.
+ * It was found that some mail clients distort this hash, so we take
+ * special steps to encode it in the way which help to preserve its
+ * recognition. This routine
*
- * @param hashstr required hash parameter as received from browser
- * @return pure hex string
+ * @param hashstr required hash parameter as received from browser
+ * @return pure hex string
*/
function html_clean_hash_string($hashstr) {
return $hashstr;
}
+function relative_date ($date) {
+ $delta = time() - $date;
+ if ($delta<60)
+ return sprintf(ngettext('%d second ago', '%d seconds ago', $delta), $delta);
+
+ $delta = round($delta/60);
+ if ($delta<60)
+ return sprintf(ngettext('%d minute ago', '%d minutes ago', $delta), $delta);
+
+ $delta = round($delta/60);
+ if ($delta<24)
+ return sprintf(ngettext('%d hour ago', '%d hours ago', $delta), $delta);
+
+ $delta = round($delta/24);
+ if ($delta<7)
+ return sprintf(ngettext('%d day ago', '%d days ago', $delta), $delta);
+
+ $delta = round($delta/7);
+ if ($delta<4)
+ return sprintf(ngettext('%d week ago', '%d weeks ago', $delta), $delta);
+
+ return date(_('Y-m-d H:i'), $date);
+}
// Local Variables:
// mode: php
// c-file-style: "bsd"