|
|
4c79b5 |
|
|
|
4c79b5 |
# Mantis - a php based bugtracking system
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
|
|
|
4c79b5 |
# Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Mantis is free software: you can redistribute it and/or modify
|
|
|
4c79b5 |
# it under the terms of the GNU General Public License as published by
|
|
|
4c79b5 |
# the Free Software Foundation, either version 2 of the License, or
|
|
|
4c79b5 |
# (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Mantis is distributed in the hope that it will be useful,
|
|
|
4c79b5 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c79b5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
4c79b5 |
# GNU General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# You should have received a copy of the GNU General Public License
|
|
|
4c79b5 |
# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#------------------------------
|
|
|
4c79b5 |
# $Revision: 2643 $
|
|
|
4c79b5 |
# $Author: al $
|
|
|
4c79b5 |
# $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $
|
|
|
4c79b5 |
#------------------------------
|
|
|
4c79b5 |
|
|
|
4c79b5 |
###########################################################################
|
|
|
4c79b5 |
# HTML API
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# These functions control the display of each page
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This is the call order of these functions, should you need to figure out
|
|
|
4c79b5 |
# which to modify or which to leave out.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# html_page_top1
|
|
|
4c79b5 |
# html_begin
|
|
|
4c79b5 |
# html_head_begin
|
|
|
4c79b5 |
# html_css
|
|
|
4c79b5 |
# html_content_type
|
|
|
4c79b5 |
# html_rss_link
|
|
|
4c79b5 |
# (html_meta_redirect)
|
|
|
4c79b5 |
# html_title
|
|
|
4c79b5 |
# html_page_top2
|
|
|
4c79b5 |
# html_page_top2a
|
|
|
4c79b5 |
# html_head_end
|
|
|
4c79b5 |
# html_body_begin
|
|
|
4c79b5 |
# html_header
|
|
|
4c79b5 |
# html_top_banner
|
|
|
4c79b5 |
# html_login_info
|
|
|
4c79b5 |
# (print_project_menu_bar)
|
|
|
4c79b5 |
# print_menu
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# ...Page content here...
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# html_page_bottom1
|
|
|
4c79b5 |
# (print_menu)
|
|
|
4c79b5 |
# html_page_bottom1a
|
|
|
4c79b5 |
# html_bottom_banner
|
|
|
4c79b5 |
# html_footer
|
|
|
4c79b5 |
# html_body_end
|
|
|
4c79b5 |
# html_end
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
###########################################################################
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
require_once( $t_core_dir . 'current_user_api.php' );
|
|
|
4c79b5 |
require_once( $t_core_dir . 'string_api.php' );
|
|
|
4c79b5 |
require_once( $t_core_dir . 'bug_api.php' );
|
|
|
4c79b5 |
require_once( $t_core_dir . 'project_api.php' );
|
|
|
4c79b5 |
require_once( $t_core_dir . 'helper_api.php' );
|
|
|
4c79b5 |
require_once( $t_core_dir . 'authentication_api.php' );
|
|
|
4c79b5 |
require_once( $t_core_dir . 'user_api.php' );
|
|
|
4c79b5 |
require_once( $t_core_dir . 'rss_api.php' );
|
|
|
4c79b5 |
require_once( $t_core_dir . 'wiki_api.php' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$g_rss_feed_url = null;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# flag for error handler to skip header menus
|
|
|
4c79b5 |
$g_error_send_page_header = true;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Projax library disabled by default. It will be enabled if projax_api.php
|
|
|
4c79b5 |
# is included. But it must be included after html_api.php
|
|
|
4c79b5 |
$g_enable_projax = false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Sets the url for the rss link associated with the current page.
|
|
|
4c79b5 |
# null: means no feed (default).
|
|
|
4c79b5 |
function html_set_rss_link( $p_rss_feed_url )
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if ( OFF != config_get( 'rss_enabled' ) ) {
|
|
|
4c79b5 |
global $g_rss_feed_url;
|
|
|
4c79b5 |
$g_rss_feed_url = $p_rss_feed_url;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Prints the link that allows auto-detection of the associated feed.
|
|
|
4c79b5 |
function html_rss_link()
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $g_rss_feed_url;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $g_rss_feed_url !== null ) {
|
|
|
4c79b5 |
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"$g_rss_feed_url\" />";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the part of the page that comes before meta redirect tags should
|
|
|
4c79b5 |
# be inserted
|
|
|
4c79b5 |
function html_page_top1( $p_page_title = null ) {
|
|
|
4c79b5 |
html_begin();
|
|
|
4c79b5 |
html_head_begin();
|
|
|
4c79b5 |
html_css();
|
|
|
4c79b5 |
html_content_type();
|
|
|
4c79b5 |
include( config_get( 'meta_include_file' ) );
|
|
|
4c79b5 |
html_rss_link();
|
|
|
4c79b5 |
echo '<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />';
|
|
|
4c79b5 |
html_title( $p_page_title );
|
|
|
4c79b5 |
html_head_javascript();
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the part of the page that comes after meta tags, but before the
|
|
|
4c79b5 |
# actual page content
|
|
|
4c79b5 |
function html_page_top2() {
|
|
|
4c79b5 |
html_page_top2a();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( !db_is_connected() ) {
|
|
|
4c79b5 |
return;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the part of the page that comes after meta tags and before the
|
|
|
4c79b5 |
# actual page content, but without login info or menus. This is used
|
|
|
4c79b5 |
# directly during the login process and other times when the user may
|
|
|
4c79b5 |
# not be authenticated
|
|
|
4c79b5 |
function html_page_top2a() {
|
|
|
4c79b5 |
global $g_error_send_page_header;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
html_head_end();
|
|
|
4c79b5 |
html_body_begin();
|
|
|
4c79b5 |
$g_error_send_page_header = false;
|
|
|
4c79b5 |
html_header();
|
|
|
4c79b5 |
html_top_banner();
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the part of the page that comes below the page content
|
|
|
4c79b5 |
# $p_file should always be the __FILE__ variable. This is passed to show source
|
|
|
4c79b5 |
function html_page_bottom1( $p_file = null ) {
|
|
|
4c79b5 |
if ( !db_is_connected() ) {
|
|
|
4c79b5 |
return;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
html_page_bottom1a( $p_file );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the part of the page that comes below the page content but leave off
|
|
|
4c79b5 |
# the menu. This is used during the login process and other times when the
|
|
|
4c79b5 |
# user may not be authenticated.
|
|
|
4c79b5 |
function html_page_bottom1a( $p_file = null ) {
|
|
|
4c79b5 |
if ( null === $p_file ) {
|
|
|
4c79b5 |
$p_file = basename( $_SERVER['PHP_SELF'] );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
html_bottom_banner();
|
|
|
4c79b5 |
html_footer( $p_file );
|
|
|
4c79b5 |
html_body_end();
|
|
|
4c79b5 |
html_end();
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (1) Print the document type and the opening <html> tag
|
|
|
4c79b5 |
function html_begin() {
|
|
|
4c79b5 |
# @@@ NOTE make this a configurable global.
|
|
|
4c79b5 |
#echo '', "\n";
|
|
|
4c79b5 |
#echo '', "\n";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo '', "\n";
|
|
|
4c79b5 |
echo '<html>', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (2) Begin the <head> section
|
|
|
4c79b5 |
function html_head_begin() {
|
|
|
4c79b5 |
echo '<head>', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (3) Print the content-type
|
|
|
4c79b5 |
function html_content_type() {
|
|
|
4c79b5 |
echo "\t", '<meta http-equiv="Content-type" content="text/html;charset=', lang_get( 'charset' ), '" />', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (4) Print the window title
|
|
|
4c79b5 |
function html_title( $p_page_title = null ) {
|
|
|
4c79b5 |
$t_title = config_get( 'window_title' );
|
|
|
4c79b5 |
echo "\t", '<title>';
|
|
|
4c79b5 |
if ( 0 == strlen( $p_page_title ) ) {
|
|
|
4c79b5 |
echo string_display( $t_title );
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
if ( 0 == strlen( $t_title ) ) {
|
|
|
4c79b5 |
echo $p_page_title;
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
echo $p_page_title . ' - ' . string_display( $t_title );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
echo '</title>', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (5) Print the link to include the css file
|
|
|
4c79b5 |
function html_css() {
|
|
|
4c79b5 |
$t_css_url = config_get( 'css_include_file' );
|
|
|
4c79b5 |
echo "\t", '<link rel="stylesheet" type="text/css" href="', $t_css_url, '" />', "\n";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# fix for NS 4.x css
|
|
|
4c79b5 |
echo "\t", '<script type="text/javascript" language="JavaScript">
|
|
|
4c79b5 |
echo "\t\t", 'if(document.layers) {document.write("<style>td{padding:0px;}<\/style>")}', "\n";
|
|
|
4c79b5 |
echo "\t", '// --></script>', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (6) Print an HTML meta tag to redirect to another page
|
|
|
4c79b5 |
# This function is optional and may be called by pages that need a redirect.
|
|
|
4c79b5 |
# $p_time is the number of seconds to wait before redirecting.
|
|
|
4c79b5 |
# If we have handled any errors on this page and the 'stop_on_errors' config
|
|
|
4c79b5 |
# option is turned on, return false and don't redirect.
|
|
|
4c79b5 |
function html_meta_redirect( $p_url, $p_time = null, $p_sanitize = false ) {
|
|
|
4c79b5 |
if ( ON == config_get( 'stop_on_errors' ) && error_handled() ) {
|
|
|
4c79b5 |
return false;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( null === $p_time ) {
|
|
|
4c79b5 |
$p_time = current_user_get_pref( 'redirect_delay' );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $p_sanitize ) {
|
|
|
4c79b5 |
$t_url = string_sanitize_url( $p_url );
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$t_url = $p_url;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo "\t<meta http-equiv=\"Refresh\" content=\"$p_time;URL=$t_url\" />\n";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
return true;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# ---------------------
|
|
|
4c79b5 |
# (6a) Javascript...
|
|
|
4c79b5 |
function html_head_javascript() {
|
|
|
4c79b5 |
if ( ON == config_get( 'use_javascript' ) ) {
|
|
|
4c79b5 |
echo "\t" . '<script type="text/javascript" language="JavaScript" src="javascript/common.js">';
|
|
|
4c79b5 |
echo '</script>' . "\n";
|
|
|
4c79b5 |
echo "\t" . '<script type="text/JavaScript" src="javascript/ajax.js">';
|
|
|
4c79b5 |
echo '</script>' . "\n";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
global $g_enable_projax;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $g_enable_projax ) {
|
|
|
4c79b5 |
echo '<script type="text/javascript" src="javascript/projax/prototype.js"></script>';
|
|
|
4c79b5 |
echo '<script type="text/javascript" src="javascript/projax/scriptaculous.js"></script>';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (7) End the <head> section
|
|
|
4c79b5 |
function html_head_end() {
|
|
|
4c79b5 |
echo '</head>', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (8) Begin the <body> section
|
|
|
4c79b5 |
function html_body_begin() {
|
|
|
4c79b5 |
echo '<body>', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (9) Print the title displayed at the top of the page
|
|
|
4c79b5 |
function html_header() {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#$t_title = config_get( 'page_title' );
|
|
|
4c79b5 |
#echo '', string_display( $t_title ), ' ', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (10) Print a user-defined banner at the top of the page if there is one.
|
|
|
4c79b5 |
function html_top_banner() {
|
|
|
4c79b5 |
$t_page = config_get( 'top_include_page' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( !is_blank( $t_page ) && file_exists( $t_page ) && !is_dir( $t_page ) ) {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '
|
|
|
4c79b5 |
|
|
|
4c79b5 |
include( $t_page );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( auth_is_user_authenticated() ) {
|
|
|
4c79b5 |
html_login_info();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if( ON == config_get( 'show_project_menu_bar' ) ) {
|
|
|
4c79b5 |
print_project_menu_bar();
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT ' ';
|
|
|
4c79b5 |
print_menu();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( auth_is_user_authenticated() ) {
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
print_recently_visited();
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
print_projectinfo();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT ' ';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
if ( is_page_name( 'login_page' ) ) {
|
|
|
4c79b5 |
$t_align = 'center';
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$t_align = 'left';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (11) Print the user's account information
|
|
|
4c79b5 |
function html_login_info() {
|
|
|
4c79b5 |
$t_now = date( config_get( 'complete_date_format' ) );
|
|
|
4c79b5 |
$t_username = current_user_get_field( 'username' );
|
|
|
4c79b5 |
$t_access_level = get_enum_element( 'access_levels', current_user_get_access_level() );
|
|
|
4c79b5 |
$t_realname = current_user_get_field( 'realname' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
print '
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
print $t_now;
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print '
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
if ( current_user_is_anonymous() ) {
|
|
|
4c79b5 |
$t_return_page = $_SERVER['PHP_SELF'];
|
|
|
4c79b5 |
if ( isset( $_SERVER['QUERY_STRING'] ) ) {
|
|
|
4c79b5 |
$t_return_page .= '?' . $_SERVER['QUERY_STRING'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_return_page = string_url( $t_return_page );
|
|
|
4c79b5 |
PRINT lang_get( 'anonymous' ) . ' | ' . lang_get( 'login_link' ) . '';
|
|
|
4c79b5 |
if ( config_get( 'allow_signup' ) == ON ) {
|
|
|
4c79b5 |
PRINT ' | ' . lang_get( 'signup_link' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
echo lang_get( 'logged_in_as' ), ": ", string_display( $t_username ), "";
|
|
|
4c79b5 |
echo is_blank( $t_realname ) ? "($t_access_level)" : "(" . string_display( $t_realname ) . " - $t_access_level)";
|
|
|
4c79b5 |
echo "";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Logout (no if anonymously logged in)
|
|
|
4c79b5 |
if ( !current_user_is_anonymous() ) {
|
|
|
4c79b5 |
echo '' . lang_get( 'logout_link' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (12) Print a user-defined banner at the bottom of the page if there is one.
|
|
|
4c79b5 |
function html_bottom_banner() {
|
|
|
4c79b5 |
$t_page = config_get( 'bottom_include_page' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( !is_blank( $t_page ) && file_exists( $t_page ) && !is_dir( $t_page ) ) {
|
|
|
4c79b5 |
include( $t_page );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (13) Print the page footer information
|
|
|
4c79b5 |
function html_footer( $p_file ) {
|
|
|
4c79b5 |
global $g_timer, $g_queries_array, $g_request_time;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# If a user is logged in, update their last visit time.
|
|
|
4c79b5 |
# We do this at the end of the page so that:
|
|
|
4c79b5 |
# 1) we can display the user's last visit time on a page before updating it
|
|
|
4c79b5 |
# 2) we don't invalidate the user cache immediately after fetching it
|
|
|
4c79b5 |
# 3) don't do this on the password verification or update page, as it causes the
|
|
|
4c79b5 |
# verification comparison to fail
|
|
|
4c79b5 |
if ( auth_is_user_authenticated() && !( is_page_name( 'verify.php' ) || is_page_name( 'account_update.php' ) ) ) {
|
|
|
4c79b5 |
$t_user_id = auth_get_current_user_id();
|
|
|
4c79b5 |
user_update_last_visit( $t_user_id );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print ''; # close page div. Opened at html_top_banner.
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print '
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( config_get( 'show_footer_menu' ) ) {
|
|
|
4c79b5 |
print_menu();
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT ' ';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# print powered by Mantis button.
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# print Mantis version
|
|
|
4c79b5 |
if ( ON == config_get( 'show_version' ) ) {
|
|
|
4c79b5 |
echo "\t", 'Mantis ', MANTIS_VERSION, '', '[^] ', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# only display webmaster email is current user is not the anonymous user
|
|
|
4c79b5 |
if ( ! is_page_name( 'login_page.php' ) && !current_user_is_anonymous() ) {
|
|
|
4c79b5 |
echo "\t", '', config_get( 'webmaster_email' ), ' ', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# print timings
|
|
|
4c79b5 |
if ( ON == config_get( 'show_timer' ) ) {
|
|
|
4c79b5 |
$g_timer->print_times();
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# print db queries that were run
|
|
|
4c79b5 |
if ( helper_show_queries() ) {
|
|
|
4c79b5 |
$t_count = count( $g_queries_array );
|
|
|
4c79b5 |
echo "\t", $t_count, ' total queries executed. ', "\n";
|
|
|
4c79b5 |
$t_unique_queries = 0;
|
|
|
4c79b5 |
$t_shown_queries = array();
|
|
|
4c79b5 |
for ( $i = 0; $i < $t_count; $i++ ) {
|
|
|
4c79b5 |
if ( ! in_array( $g_queries_array[$i][0], $t_shown_queries ) ) {
|
|
|
4c79b5 |
$t_unique_queries++;
|
|
|
4c79b5 |
$g_queries_array[$i][3] = false;
|
|
|
4c79b5 |
array_push( $t_shown_queries, $g_queries_array[$i][0] );
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$g_queries_array[$i][3] = true;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
echo "\t", $t_unique_queries . ' unique queries executed.', "\n";
|
|
|
4c79b5 |
if ( ON == config_get( 'show_queries_list' ) ) {
|
|
|
4c79b5 |
echo "\t", '', "\n";
|
|
|
4c79b5 |
$t_total = 0;
|
|
|
4c79b5 |
for ( $i = 0; $i < $t_count; $i++ ) {
|
|
|
4c79b5 |
$t_time = $g_queries_array[$i][1];
|
|
|
4c79b5 |
$t_caller = $g_queries_array[$i][2];
|
|
|
4c79b5 |
$t_total += $t_time;
|
|
|
4c79b5 |
$t_style_tag = '';
|
|
|
4c79b5 |
if ( true == $g_queries_array[$i][3] ) {
|
|
|
4c79b5 |
$t_style_tag = ' style="color: red;"';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
echo "\t", '<td', $t_style_tag, '>', ($i+1), '';
|
|
|
4c79b5 |
echo '<td', $t_style_tag, '>', $t_time , '';
|
|
|
4c79b5 |
echo '<td', $t_style_tag, '>', $t_caller, ' ', string_html_specialchars($g_queries_array[$i][0]), '', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# @@@ Note sure if we should localize them given that they are debug info. Will add if requested by users.
|
|
|
4c79b5 |
echo "\t", '', $t_total, 'SQL Queries Total Time', "\n";
|
|
|
4c79b5 |
echo "\t", '', round( microtime_float() - $g_request_time, 4 ), 'Page Request Total Time', "\n";
|
|
|
4c79b5 |
echo "\t", '', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT ' ';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (14) End the <body> section
|
|
|
4c79b5 |
function html_body_end() {
|
|
|
4c79b5 |
echo '</body>', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# (15) Print the closing <html> tag
|
|
|
4c79b5 |
function html_end() {
|
|
|
4c79b5 |
echo '</html>', "\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
###########################################################################
|
|
|
4c79b5 |
# HTML Menu API
|
|
|
4c79b5 |
###########################################################################
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function prepare_custom_menu_options( $p_config ) {
|
|
|
4c79b5 |
$t_custom_menu_options = config_get( $p_config );
|
|
|
4c79b5 |
$t_options = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach( $t_custom_menu_options as $t_custom_option ) {
|
|
|
4c79b5 |
$t_access_level = $t_custom_option[1];
|
|
|
4c79b5 |
if ( access_has_project_level( $t_access_level ) ) {
|
|
|
4c79b5 |
$t_caption = lang_get_defaulted( $t_custom_option[0] );
|
|
|
4c79b5 |
$t_link = $t_custom_option[2];
|
|
|
4c79b5 |
$t_options[] = "$t_caption";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
return $t_options;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the main menu
|
|
|
4c79b5 |
function print_menu() {
|
|
|
4c79b5 |
if ( auth_is_user_authenticated() ) {
|
|
|
4c79b5 |
$t_protected = current_user_get_field( 'protected' );
|
|
|
4c79b5 |
$t_current_project = helper_get_current_project();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '
|
|
|
4c79b5 |
$t_menu_options = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Main Page
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'main_link' ) . '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# My View
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'my_view_link' ) . '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# View Bugs
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'view_bugs_link' ) . '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Report Bugs
|
|
|
4c79b5 |
if ( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) {
|
|
|
4c79b5 |
$t_menu_options[] = '' . string_get_bug_report_link() . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Changelog Page
|
|
|
4c79b5 |
if ( access_has_project_level( config_get( 'view_changelog_threshold' ) ) ) {
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'changelog_link' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Roadmap Page
|
|
|
4c79b5 |
if ( access_has_project_level( config_get( 'roadmap_view_threshold' ) ) ) {
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'roadmap_link' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Summary Page
|
|
|
4c79b5 |
if ( access_has_project_level( config_get( 'view_summary_threshold' ) ) ) {
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'summary_link' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Project Documentation Page
|
|
|
4c79b5 |
if( ON == config_get( 'enable_project_documentation' ) ) {
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'docs_link' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Project Wiki
|
|
|
4c79b5 |
if ( wiki_is_enabled() ) {
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'wiki' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Manage Users (admins) or Manage Project (managers) or Manage Custom Fields
|
|
|
4c79b5 |
$t_show_access = min( config_get( 'manage_user_threshold' ), config_get( 'manage_project_threshold' ), config_get( 'manage_custom_fields_threshold' ) );
|
|
|
4c79b5 |
if ( access_has_global_level( $t_show_access) || access_has_any_project( $t_show_access ) ) {
|
|
|
4c79b5 |
$t_current_project = helper_get_current_project();
|
|
|
4c79b5 |
if ( access_has_global_level( config_get( 'manage_user_threshold' ) ) ) {
|
|
|
4c79b5 |
$t_link = 'manage_user_page.php';
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
if ( access_has_project_level( config_get( 'manage_project_threshold' ), $t_current_project )
|
|
|
4c79b5 |
&& ( $t_current_project <> ALL_PROJECTS ) ) {
|
|
|
4c79b5 |
$t_link = 'manage_proj_edit_page.php?project_id=' . $t_current_project;
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$t_link = 'manage_proj_page.php';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$t_menu_options[] = "" . lang_get( 'manage_link' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# News Page
|
|
|
4c79b5 |
if ( access_has_project_level( config_get( 'manage_news_threshold' ) ) ) {
|
|
|
4c79b5 |
# Admin can edit news for All Projects (site-wide)
|
|
|
4c79b5 |
if ( ( ALL_PROJECTS != helper_get_current_project() ) || ( access_has_project_level( ADMINISTRATOR ) ) ) {
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'edit_news_link' ) . '';
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'edit_news_link' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Account Page (only show accounts that are NOT protected)
|
|
|
4c79b5 |
if ( OFF == $t_protected ) {
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'account_link' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Add custom options
|
|
|
4c79b5 |
$t_custom_options = prepare_custom_menu_options( 'main_menu_custom_options' );
|
|
|
4c79b5 |
$t_menu_options = array_merge( $t_menu_options, $t_custom_options );
|
|
|
4c79b5 |
if ( config_get('time_tracking_enabled') && config_get('time_tracking_with_billing') )
|
|
|
4c79b5 |
$t_menu_options[] = '' . lang_get( 'time_tracking_billing_link' ) . '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT implode( $t_menu_options );
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the project switcher and issues jumper if user is authenticated
|
|
|
4c79b5 |
function print_projectinfo() {
|
|
|
4c79b5 |
if ( auth_is_user_authenticated() ) {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
print '
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '<form method="post" name="form_set_project" action="set_project.php">';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo lang_get( 'email_project' ), ': ';
|
|
|
4c79b5 |
if ( ON == config_get( 'show_extended_project_browser' ) ) {
|
|
|
4c79b5 |
PRINT_extended_project_browser( helper_get_current_project_trace() );
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
if ( ON == config_get( 'use_javascript' ) ) {
|
|
|
4c79b5 |
PRINT '<select name="project_id" class="small" onchange="document.forms.form_set_project.submit();">';
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
PRINT '<select name="project_id" class="small">';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
PRINT_project_option_list( join( ';', helper_get_current_project_trace() ), true, null, true );
|
|
|
4c79b5 |
PRINT '</select> ';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
PRINT '<input type="submit" class="button-small" value="' . lang_get( 'switch' ) . '" />';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( OFF != config_get( 'rss_enabled' ) ) {
|
|
|
4c79b5 |
# Link to RSS issues feed for the selected project, including authentication details.
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '</form>';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '<form method="post" action="jump_to_bug.php">';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( ON == config_get( 'use_javascript' ) ) {
|
|
|
4c79b5 |
$t_bug_label = lang_get( 'issue_id' );
|
|
|
4c79b5 |
PRINT "<input type=\"text\" name=\"bug_id\" size=\"10\" class=\"small\" value=\"$t_bug_label\" onfocus=\"if (this.value == '$t_bug_label') this.value = ''\" onblur=\"if (this.value == '') this.value = '$t_bug_label'\" /> ";
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
PRINT "<input type=\"text\" name=\"bug_id\" size=\"10\" class=\"small\" /> ";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '<input type="submit" class="button-small" value="' . lang_get( 'jump' ) . '" /> ';
|
|
|
4c79b5 |
PRINT '</form>';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
print '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the menu bar with a list of projects to which the user has access
|
|
|
4c79b5 |
function print_project_menu_bar() {
|
|
|
4c79b5 |
$t_project_ids = current_user_get_accessible_projects();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '' . lang_get( 'all_projects' ) . '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ( $t_project_ids as $t_id ) {
|
|
|
4c79b5 |
PRINT " | " . string_display( project_get_field( $t_id, 'name' ) ) . '';
|
|
|
4c79b5 |
print_subproject_menu_bar( $t_id, $t_id . ';' );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the menu bar with a list of projects to which the user has access
|
|
|
4c79b5 |
function print_subproject_menu_bar( $p_project_id, $p_parents = '' ) {
|
|
|
4c79b5 |
$t_subprojects = current_user_get_accessible_subprojects( $p_project_id );
|
|
|
4c79b5 |
$t_char = ':';
|
|
|
4c79b5 |
foreach ( $t_subprojects as $t_subproject ) {
|
|
|
4c79b5 |
PRINT "$t_char " . string_display( project_get_field( $t_subproject, 'name' ) ) . '';
|
|
|
4c79b5 |
print_subproject_menu_bar( $t_subproject, $p_parents . $t_subproject . ';' );
|
|
|
4c79b5 |
$t_char = ',';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the menu for the graph summary section
|
|
|
4c79b5 |
function print_menu_graph() {
|
|
|
4c79b5 |
if ( config_get( 'use_jpgraph' ) ) {
|
|
|
4c79b5 |
$t_icon_path = config_get( 'icon_path' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT ' ';
|
|
|
4c79b5 |
PRINT '' . lang_get( 'synthesis_link' ) . ' | ';
|
|
|
4c79b5 |
PRINT '' . lang_get( 'status_link' ) . ' | ';
|
|
|
4c79b5 |
PRINT '' . lang_get( 'priority_link' ) . ' | ';
|
|
|
4c79b5 |
PRINT '' . lang_get( 'severity_link' ) . ' | ';
|
|
|
4c79b5 |
PRINT '' . lang_get( 'category_link' ) . ' | ';
|
|
|
4c79b5 |
PRINT '' . lang_get( 'resolution_link' ) . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the menu for the manage section
|
|
|
4c79b5 |
# $p_page specifies the current page name so it's link can be disabled
|
|
|
4c79b5 |
function print_manage_menu( $p_page = '' ) {
|
|
|
4c79b5 |
$t_manage_user_page = 'manage_user_page.php';
|
|
|
4c79b5 |
$t_manage_project_menu_page = 'manage_proj_page.php';
|
|
|
4c79b5 |
$t_manage_custom_field_page = 'manage_custom_field_page.php';
|
|
|
4c79b5 |
$t_manage_config_page = 'adm_config_report.php';
|
|
|
4c79b5 |
$t_manage_prof_menu_page = 'manage_prof_menu_page.php';
|
|
|
4c79b5 |
# $t_documentation_page = 'documentation_page.php';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ( $p_page ) {
|
|
|
4c79b5 |
case $t_manage_user_page:
|
|
|
4c79b5 |
$t_manage_user_page = '';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case $t_manage_project_menu_page:
|
|
|
4c79b5 |
$t_manage_project_menu_page = '';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case $t_manage_custom_field_page:
|
|
|
4c79b5 |
$t_manage_custom_field_page = '';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case $t_manage_config_page:
|
|
|
4c79b5 |
$t_manage_config_page = '';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case $t_manage_prof_menu_page:
|
|
|
4c79b5 |
$t_manage_prof_menu_page = '';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
# case $t_documentation_page:
|
|
|
4c79b5 |
# $t_documentation_page = '';
|
|
|
4c79b5 |
# break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '
';
|
|
|
4c79b5 |
if ( access_has_global_level( config_get( 'manage_user_threshold' ) ) ) {
|
|
|
4c79b5 |
print_bracket_link( $t_manage_user_page, lang_get( 'manage_users_link' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
if ( access_has_project_level( config_get( 'manage_project_threshold' ) ) ) {
|
|
|
4c79b5 |
print_bracket_link( $t_manage_project_menu_page, lang_get( 'manage_projects_link' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
if ( access_has_global_level( config_get( 'manage_custom_fields_threshold' ) ) ) {
|
|
|
4c79b5 |
print_bracket_link( $t_manage_custom_field_page, lang_get( 'manage_custom_field_link' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
if ( access_has_global_level( config_get( 'manage_global_profile_threshold' ) ) ) {
|
|
|
4c79b5 |
print_bracket_link( $t_manage_prof_menu_page, lang_get( 'manage_global_profiles_link' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
if ( access_has_project_level( config_get( 'view_configuration_threshold' ) ) ) {
|
|
|
4c79b5 |
print_bracket_link( $t_manage_config_page, lang_get( 'manage_config_link' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
# print_bracket_link( $t_documentation_page, lang_get( 'documentation_link' ) );
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the menu for the manage configuration section
|
|
|
4c79b5 |
# $p_page specifies the current page name so it's link can be disabled
|
|
|
4c79b5 |
function print_manage_config_menu( $p_page = '' ) {
|
|
|
4c79b5 |
$t_configuration_report = 'adm_config_report.php';
|
|
|
4c79b5 |
$t_permissions_summary_report = 'adm_permissions_report.php';
|
|
|
4c79b5 |
$t_manage_work_threshold = 'manage_config_work_threshold_page.php';
|
|
|
4c79b5 |
$t_manage_email = 'manage_config_email_page.php';
|
|
|
4c79b5 |
$t_manage_workflow = 'manage_config_workflow_page.php';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ( $p_page ) {
|
|
|
4c79b5 |
case $t_configuration_report:
|
|
|
4c79b5 |
$t_configuration_report = '';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case $t_permissions_summary_report:
|
|
|
4c79b5 |
$t_permissions_summary_report = '';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case $t_manage_work_threshold:
|
|
|
4c79b5 |
$t_manage_work_threshold = '';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case $t_manage_email:
|
|
|
4c79b5 |
$t_manage_email = '';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case $t_manage_workflow:
|
|
|
4c79b5 |
$t_manage_workflow = '';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '
';
|
|
|
4c79b5 |
if ( access_has_project_level( config_get( 'view_configuration_threshold' ) ) ) {
|
|
|
4c79b5 |
print_bracket_link( $t_configuration_report, lang_get_defaulted( 'configuration_report' ) );
|
|
|
4c79b5 |
print_bracket_link( $t_permissions_summary_report, lang_get( 'permissions_summary_report' ) );
|
|
|
4c79b5 |
print_bracket_link( $t_manage_work_threshold, lang_get( 'manage_threshold_config' ) );
|
|
|
4c79b5 |
print_bracket_link( $t_manage_workflow, lang_get( 'manage_workflow_config' ) );
|
|
|
4c79b5 |
print_bracket_link( $t_manage_email, lang_get( 'manage_email_config' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the menu for the account section
|
|
|
4c79b5 |
# $p_page specifies the current page name so it's link can be disabled
|
|
|
4c79b5 |
function print_account_menu( $p_page='' ) {
|
|
|
4c79b5 |
$t_account_page = 'account_page.php';
|
|
|
4c79b5 |
$t_account_prefs_page = 'account_prefs_page.php';
|
|
|
4c79b5 |
$t_account_profile_menu_page = 'account_prof_menu_page.php';
|
|
|
4c79b5 |
$t_account_sponsor_page = 'account_sponsor_page.php';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ( $p_page ) {
|
|
|
4c79b5 |
case $t_account_page : $t_account_page = ''; break;
|
|
|
4c79b5 |
case $t_account_prefs_page : $t_account_prefs_page = ''; break;
|
|
|
4c79b5 |
case $t_account_profile_menu_page : $t_account_profile_menu_page = ''; break;
|
|
|
4c79b5 |
case $t_account_sponsor_page : $t_account_sponsor_page = ''; break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print_bracket_link( $t_account_page, lang_get( 'account_link' ) );
|
|
|
4c79b5 |
print_bracket_link( $t_account_prefs_page, lang_get( 'change_preferences_link' ) );
|
|
|
4c79b5 |
if ( access_has_project_level( config_get( 'add_profile_threshold' ) ) ) {
|
|
|
4c79b5 |
print_bracket_link( $t_account_profile_menu_page, lang_get( 'manage_profiles_link' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
if ( ( config_get( 'enable_sponsorship' ) == ON ) &&
|
|
|
4c79b5 |
( access_has_project_level( config_get( 'view_sponsorship_total_threshold' ) ) ) &&
|
|
|
4c79b5 |
!current_user_is_anonymous() ) {
|
|
|
4c79b5 |
print_bracket_link( $t_account_sponsor_page, lang_get( 'my_sponsorship' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the menu for the docs section
|
|
|
4c79b5 |
# $p_page specifies the current page name so it's link can be disabled
|
|
|
4c79b5 |
function print_doc_menu( $p_page='' ) {
|
|
|
4c79b5 |
$t_documentation_html = config_get( 'manual_url' );
|
|
|
4c79b5 |
$t_proj_doc_page = 'proj_doc_page.php';
|
|
|
4c79b5 |
$t_proj_doc_add_page = 'proj_doc_add_page.php';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ( $p_page ) {
|
|
|
4c79b5 |
case $t_documentation_html : $t_documentation_html = ''; break;
|
|
|
4c79b5 |
case $t_proj_doc_page : $t_proj_doc_page = ''; break;
|
|
|
4c79b5 |
case $t_proj_doc_add_page : $t_proj_doc_add_page = ''; break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print_bracket_link( $t_documentation_html, lang_get( 'user_documentation' ) );
|
|
|
4c79b5 |
print_bracket_link( $t_proj_doc_page, lang_get( 'project_documentation' ) );
|
|
|
4c79b5 |
if ( file_allow_project_upload() ) {
|
|
|
4c79b5 |
print_bracket_link( $t_proj_doc_add_page, lang_get( 'add_file' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the menu for the summary section
|
|
|
4c79b5 |
# $p_page specifies the current page name so it's link can be disabled
|
|
|
4c79b5 |
function print_summary_menu( $p_page='' ) {
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
print_bracket_link( 'print_all_bug_page.php', lang_get( 'print_all_bug_page_link' ) );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( config_get( 'use_jpgraph' ) != 0 ) {
|
|
|
4c79b5 |
$t_summary_page = 'summary_page.php';
|
|
|
4c79b5 |
$t_summary_jpgraph_page = 'summary_jpgraph_page.php';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ( $p_page ) {
|
|
|
4c79b5 |
case $t_summary_page : $t_summary_page = ''; break;
|
|
|
4c79b5 |
case $t_summary_jpgraph_page: $t_summary_jpgraph_page = ''; break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print_bracket_link( $t_summary_page, lang_get( 'summary_link' ) );
|
|
|
4c79b5 |
print_bracket_link( $t_summary_jpgraph_page, lang_get( 'summary_jpgraph_link' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#=========================
|
|
|
4c79b5 |
# Candidates for moving to print_api
|
|
|
4c79b5 |
#=========================
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the color legend for the status colors
|
|
|
4c79b5 |
function html_status_legend() {
|
|
|
4c79b5 |
PRINT ' ';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_arr = explode_enum_string( config_get( 'status_enum_string' ) );
|
|
|
4c79b5 |
$enum_count = count( $t_arr );
|
|
|
4c79b5 |
$width = (int)(100 / $enum_count);
|
|
|
4c79b5 |
for ( $i=0; $i < $enum_count; $i++) {
|
|
|
4c79b5 |
$t_s = explode_enum_arr( $t_arr[$i] );
|
|
|
4c79b5 |
$t_val = get_enum_element( 'status', $t_s[0] );
|
|
|
4c79b5 |
$t_color = get_status_color( $t_s[0] );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT "$t_val";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
if ( ON == config_get( 'status_percentage_legend' ) ) {
|
|
|
4c79b5 |
html_status_percentage_legend();
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print the legend for the status percentage
|
|
|
4c79b5 |
function html_status_percentage_legend() {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_mantis_bug_table = config_get( 'mantis_bug_table' );
|
|
|
4c79b5 |
$t_project_id = helper_get_current_project();
|
|
|
4c79b5 |
$t_user_id = auth_get_current_user_id();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#checking if it's a per project statistic or all projects
|
|
|
4c79b5 |
$t_specific_where = helper_project_specific_where( $t_project_id, $t_user_id );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$query = "SELECT status, COUNT(*) AS number
|
|
|
4c79b5 |
FROM $t_mantis_bug_table
|
|
|
4c79b5 |
WHERE $t_specific_where
|
|
|
4c79b5 |
GROUP BY status";
|
|
|
4c79b5 |
$result = db_query( $query );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_bug_count = 0;
|
|
|
4c79b5 |
$t_status_count_array = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
while ( $row = db_fetch_array( $result ) ) {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_status_count_array[ $row['status'] ] = $row['number'];
|
|
|
4c79b5 |
$t_bug_count += $row['number'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_arr = explode_enum_string( config_get( 'status_enum_string' ) );
|
|
|
4c79b5 |
$enum_count = count( $t_arr );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $t_bug_count > 0 ) {
|
|
|
4c79b5 |
echo ' ';
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
echo ''.lang_get( 'issue_status_percentage' ).'';
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
for ( $i=0; $i < $enum_count; $i++) {
|
|
|
4c79b5 |
$t_s = explode_enum_arr( $t_arr[$i] );
|
|
|
4c79b5 |
$t_color = get_status_color( $t_s[0] );
|
|
|
4c79b5 |
$t_status = $t_s[0];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( !isset( $t_status_count_array[ $t_status ] ) ) {
|
|
|
4c79b5 |
$t_status_count_array[ $t_status ] = 0;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$width = round( ( $t_status_count_array[ $t_status ] / $t_bug_count ) * 100 );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($width > 0) {
|
|
|
4c79b5 |
echo "$width%";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print an html button inside a form
|
|
|
4c79b5 |
function html_button ( $p_action, $p_button_text, $p_fields = null, $p_method = 'post' ) {
|
|
|
4c79b5 |
$p_action = urlencode( $p_action );
|
|
|
4c79b5 |
$p_button_text = string_attribute( $p_button_text );
|
|
|
4c79b5 |
if ( null === $p_fields ) {
|
|
|
4c79b5 |
$p_fields = array();
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( strtolower( $p_method ) == 'get' ) {
|
|
|
4c79b5 |
$t_method = 'get';
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$t_method = 'post';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT "<form method=\"$t_method\" action=\"$p_action\">\n";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ( $p_fields as $key => $val ) {
|
|
|
4c79b5 |
$key = string_attribute( $key );
|
|
|
4c79b5 |
$val = string_attribute( $val );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT " <input type=\"hidden\" name=\"$key\" value=\"$val\" />\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT " <input type=\"submit\" class=\"button\" value=\"$p_button_text\" />\n";
|
|
|
4c79b5 |
PRINT "</form>\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print a button to update the given bug
|
|
|
4c79b5 |
function html_button_bug_update( $p_bug_id ) {
|
|
|
4c79b5 |
if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) {
|
|
|
4c79b5 |
html_button( string_get_bug_update_page(),
|
|
|
4c79b5 |
lang_get( 'update_bug_button' ),
|
|
|
4c79b5 |
array( 'bug_id' => $p_bug_id ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print Change Status to: button
|
|
|
4c79b5 |
# This code is similar to print_status_option_list except
|
|
|
4c79b5 |
# there is no masking, except for the current state
|
|
|
4c79b5 |
function html_button_bug_change_status( $p_bug_id ) {
|
|
|
4c79b5 |
$t_bug_project_id = bug_get_field( $p_bug_id, 'project_id' );
|
|
|
4c79b5 |
$t_bug_current_state = bug_get_field( $p_bug_id, 'status' );
|
|
|
4c79b5 |
$t_current_access = access_get_project_level( $t_bug_project_id );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_enum_list = get_status_option_list( $t_current_access, $t_bug_current_state, false,
|
|
|
4c79b5 |
( bug_get_field( $p_bug_id, 'reporter_id' ) == auth_get_current_user_id() && ( ON == config_get( 'allow_reporter_close' ) ) ) );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( count( $t_enum_list ) > 0 ) {
|
|
|
4c79b5 |
# resort the list into ascending order after noting the key from the first element (the default)
|
|
|
4c79b5 |
$t_default_arr = each( $t_enum_list );
|
|
|
4c79b5 |
$t_default = $t_default_arr['key'];
|
|
|
4c79b5 |
ksort( $t_enum_list );
|
|
|
4c79b5 |
reset( $t_enum_list );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo "<form method=\"post\" action=\"bug_change_status_page.php\">";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_button_text = lang_get( 'bug_status_to_button' );
|
|
|
4c79b5 |
echo "<input type=\"submit\" class=\"button\" value=\"$t_button_text\" />";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo " <select name=\"new_status\">"; # space at beginning of line is important
|
|
|
4c79b5 |
foreach ( $t_enum_list as $key => $val ) {
|
|
|
4c79b5 |
echo "
|
|
|
4c79b5 |
check_selected( $key, $t_default );
|
|
|
4c79b5 |
echo ">$val</option>";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
echo '</select>';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_bug_id = string_attribute( $p_bug_id );
|
|
|
4c79b5 |
echo "<input type=\"hidden\" name=\"bug_id\" value=\"$t_bug_id\" />\n";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo "</form>\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print Assign To: combo box of possible handlers
|
|
|
4c79b5 |
function html_button_bug_assign_to( $p_bug_id ) {
|
|
|
4c79b5 |
# make sure status is allowed of assign would cause auto-set-status
|
|
|
4c79b5 |
$t_status = bug_get_field( $p_bug_id, 'status' ); # workflow implementation
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( ON == config_get( 'auto_set_status_to_assigned' ) &&
|
|
|
4c79b5 |
!bug_check_workflow( $t_status, config_get( 'bug_assigned_status' ) ) ) { # workflow
|
|
|
4c79b5 |
return;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# make sure current user has access to modify bugs.
|
|
|
4c79b5 |
if ( !access_has_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold' ) ), $p_bug_id ) ) {
|
|
|
4c79b5 |
return;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_reporter_id = bug_get_field( $p_bug_id, 'reporter_id' );
|
|
|
4c79b5 |
$t_handler_id = bug_get_field( $p_bug_id, 'handler_id' );
|
|
|
4c79b5 |
$t_current_user_id = auth_get_current_user_id();
|
|
|
4c79b5 |
$t_new_status = ( ON == config_get( 'auto_set_status_to_assigned' ) ) ? config_get( 'bug_assigned_status' ) : $t_status;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_options = array();
|
|
|
4c79b5 |
$t_default_assign_to = null;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( ( $t_handler_id != $t_current_user_id ) &&
|
|
|
4c79b5 |
( access_has_bug_level( config_get( 'handle_bug_threshold' ), $p_bug_id, $t_current_user_id ) ) ) {
|
|
|
4c79b5 |
$t_options[] = array( $t_current_user_id, '[' . lang_get( 'myself' ) . ']' );
|
|
|
4c79b5 |
$t_default_assign_to = $t_current_user_id;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( ( $t_handler_id != $t_reporter_id ) && user_exists( $t_reporter_id ) &&
|
|
|
4c79b5 |
( access_has_bug_level( config_get( 'handle_bug_threshold' ), $p_bug_id, $t_reporter_id ) ) ) {
|
|
|
4c79b5 |
$t_options[] = array( $t_reporter_id, '[' . lang_get( 'reporter' ) . ']' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $t_default_assign_to === null ) {
|
|
|
4c79b5 |
$t_default_assign_to = $t_reporter_id;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT "<form method=\"post\" action=\"bug_assign.php\">";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_button_text = lang_get( 'bug_assign_to_button' );
|
|
|
4c79b5 |
PRINT "<input type=\"submit\" class=\"button\" value=\"$t_button_text\" />";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT " <select name=\"handler_id\">"; # space at beginning of line is important
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_already_selected = false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ( $t_options as $t_entry ) {
|
|
|
4c79b5 |
$t_id = string_attribute( $t_entry[0] );
|
|
|
4c79b5 |
$t_caption = string_attribute( $t_entry[1] );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# if current user and reporter can't be selected, then select the first
|
|
|
4c79b5 |
# user in the list.
|
|
|
4c79b5 |
if ( $t_default_assign_to === null ) {
|
|
|
4c79b5 |
$t_default_assign_to = $t_id;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT "
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( ( $t_id == $t_default_assign_to ) && !$t_already_selected ) {
|
|
|
4c79b5 |
check_selected( $t_id, $t_default_assign_to );
|
|
|
4c79b5 |
$t_already_selected = true;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT ">$t_caption</option>";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# allow un-assigning if already assigned.
|
|
|
4c79b5 |
if ( $t_handler_id != 0 ) {
|
|
|
4c79b5 |
PRINT "<option value=\"0\"></option>";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_project_id = bug_get_field( $p_bug_id, 'project_id' );
|
|
|
4c79b5 |
# 0 means currently selected
|
|
|
4c79b5 |
print_assign_to_option_list( 0, $t_project_id );
|
|
|
4c79b5 |
PRINT "</select>";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_bug_id = string_attribute( $p_bug_id );
|
|
|
4c79b5 |
PRINT "<input type=\"hidden\" name=\"bug_id\" value=\"$t_bug_id\" />\n";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT "</form>\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print a button to move the given bug to a different project
|
|
|
4c79b5 |
function html_button_bug_move( $p_bug_id ) {
|
|
|
4c79b5 |
$t_status = bug_get_field( $p_bug_id, 'status' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( access_has_bug_level( config_get( 'move_bug_threshold' ), $p_bug_id ) ) {
|
|
|
4c79b5 |
html_button( 'bug_actiongroup_page.php',
|
|
|
4c79b5 |
lang_get( 'move_bug_button' ),
|
|
|
4c79b5 |
array( 'bug_arr[]' => $p_bug_id, 'action' => 'MOVE' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print a button to move the given bug to a different project
|
|
|
4c79b5 |
function html_button_bug_create_child( $p_bug_id ) {
|
|
|
4c79b5 |
if ( ON == config_get( 'enable_relationship' ) ) {
|
|
|
4c79b5 |
if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) {
|
|
|
4c79b5 |
html_button( string_get_bug_report_url(),
|
|
|
4c79b5 |
lang_get( 'create_child_bug_button' ),
|
|
|
4c79b5 |
array( 'm_id' => $p_bug_id ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print a button to reopen the given bug
|
|
|
4c79b5 |
function html_button_bug_reopen( $p_bug_id ) {
|
|
|
4c79b5 |
$t_status = bug_get_field( $p_bug_id, 'status' );
|
|
|
4c79b5 |
$t_reopen_status = config_get( 'bug_reopen_status' );
|
|
|
4c79b5 |
$t_project = bug_get_field( $p_bug_id, 'project_id' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( access_has_bug_level( config_get( 'reopen_bug_threshold' ), $p_bug_id ) ||
|
|
|
4c79b5 |
( ( bug_get_field( $p_bug_id, 'reporter_id' ) == auth_get_current_user_id() ) &&
|
|
|
4c79b5 |
( ON == config_get( 'allow_reporter_reopen' ) )
|
|
|
4c79b5 |
)
|
|
|
4c79b5 |
) {
|
|
|
4c79b5 |
html_button( 'bug_change_status_page.php',
|
|
|
4c79b5 |
lang_get( 'reopen_bug_button' ),
|
|
|
4c79b5 |
array( 'bug_id' => $p_bug_id ,
|
|
|
4c79b5 |
'new_status' => $t_reopen_status,
|
|
|
4c79b5 |
'reopen_flag' => ON ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print a button to monitor the given bug
|
|
|
4c79b5 |
function html_button_bug_monitor( $p_bug_id ) {
|
|
|
4c79b5 |
if ( access_has_bug_level( config_get( 'monitor_bug_threshold' ), $p_bug_id ) ) {
|
|
|
4c79b5 |
html_button( 'bug_monitor.php',
|
|
|
4c79b5 |
lang_get( 'monitor_bug_button' ),
|
|
|
4c79b5 |
array( 'bug_id' => $p_bug_id, 'action' => 'add' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print a button to unmonitor the given bug
|
|
|
4c79b5 |
# no reason to ever disallow someone from unmonitoring a bug
|
|
|
4c79b5 |
function html_button_bug_unmonitor( $p_bug_id ) {
|
|
|
4c79b5 |
html_button( 'bug_monitor.php',
|
|
|
4c79b5 |
lang_get( 'unmonitor_bug_button' ),
|
|
|
4c79b5 |
array( 'bug_id' => $p_bug_id, 'action' => 'delete' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print a button to delete the given bug
|
|
|
4c79b5 |
function html_button_bug_delete( $p_bug_id ) {
|
|
|
4c79b5 |
if ( access_has_bug_level( config_get( 'delete_bug_threshold' ), $p_bug_id ) ) {
|
|
|
4c79b5 |
html_button( 'bug_actiongroup_page.php',
|
|
|
4c79b5 |
lang_get( 'delete_bug_button' ),
|
|
|
4c79b5 |
array( 'bug_arr[]' => $p_bug_id, 'action' => 'DELETE' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print a button to create a wiki page
|
|
|
4c79b5 |
function html_button_wiki( $p_bug_id ) {
|
|
|
4c79b5 |
if ( ON == config_get( 'wiki_enable' ) ) {
|
|
|
4c79b5 |
if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) {
|
|
|
4c79b5 |
html_button( 'wiki.php',
|
|
|
4c79b5 |
lang_get_defaulted( 'Wiki' ),
|
|
|
4c79b5 |
array( 'id' => $p_bug_id, 'type' => 'issue' ),
|
|
|
4c79b5 |
'get' );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# --------------------
|
|
|
4c79b5 |
# Print all buttons for view bug pages
|
|
|
4c79b5 |
function html_buttons_view_bug_page( $p_bug_id ) {
|
|
|
4c79b5 |
$t_resolved = config_get( 'bug_resolved_status_threshold' );
|
|
|
4c79b5 |
$t_status = bug_get_field( $p_bug_id, 'status' );
|
|
|
4c79b5 |
$t_readonly = bug_is_readonly( $p_bug_id );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
if ( !$t_readonly ) {
|
|
|
4c79b5 |
# UPDATE button
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
html_button_bug_update( $p_bug_id );
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# ASSIGN button
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
html_button_bug_assign_to( $p_bug_id );
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Change State button
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
html_button_bug_change_status( $p_bug_id );
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# MONITOR/UNMONITOR button
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
if ( !current_user_is_anonymous() ) {
|
|
|
4c79b5 |
if ( user_is_monitoring_bug( auth_get_current_user_id(), $p_bug_id ) ) {
|
|
|
4c79b5 |
html_button_bug_unmonitor( $p_bug_id );
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
html_button_bug_monitor( $p_bug_id );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( !$t_readonly ) {
|
|
|
4c79b5 |
# CREATE CHILD button
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
html_button_bug_create_child( $p_bug_id );
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $t_resolved <= $t_status ) { # resolved is not the same as readonly
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
# REOPEN button
|
|
|
4c79b5 |
html_button_bug_reopen( $p_bug_id );
|
|
|
4c79b5 |
PRINT '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( !$t_readonly ) {
|
|
|
4c79b5 |
# MOVE button
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
html_button_bug_move( $p_bug_id );
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# DELETE button
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
html_button_bug_delete( $p_bug_id );
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
helper_call_custom_function( 'print_bug_view_page_custom_buttons', array( $p_bug_id ) );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
?>
|