コード例 #1
0
ファイル: account_sponsor_page.php プロジェクト: gtn/mantisbt
 for ($i = 0; $i < $t_sponsor_count; ++$i) {
     $t_sponsor_row = $t_sponsors[$i];
     $t_bug = bug_get($t_sponsor_row['bug']);
     $t_sponsor = sponsorship_get($t_sponsor_row['sponsor']);
     $t_buglist[] = $t_sponsor_row['bug'] . ':' . $t_sponsor_row['sponsor'];
     # describe bug
     $t_status = string_attribute(get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id));
     $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id));
     $t_version_id = version_get_id($t_bug->fixed_in_version, $t_bug->project_id);
     if (false !== $t_version_id && VERSION_RELEASED == version_get_field($t_version_id, 'released')) {
         $t_released_label = '<a title="' . lang_get('released') . '">' . $t_bug->fixed_in_version . '</a>';
     } else {
         $t_released_label = $t_bug->fixed_in_version;
     }
     # choose color based on status
     $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
     echo '<tr class="' . $t_status_label . '">';
     echo '<td><a href="' . string_get_bug_view_url($t_sponsor_row['bug']) . '">' . bug_format_id($t_sponsor_row['bug']) . '</a></td>';
     echo '<td>' . string_display_line(project_get_field($t_bug->project_id, 'name')) . '&#160;</td>';
     echo '<td class="right">' . $t_released_label . '&#160;</td>';
     echo '<td><a title="' . $t_resolution . '"><span class="underline">' . $t_status . '</span>&#160;</a></td>';
     # summary
     echo '<td>' . string_display_line($t_bug->summary);
     if (VS_PRIVATE == $t_bug->view_state) {
         printf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private'));
     }
     echo '</td>';
     # describe sponsorship amount
     echo '<td>';
     print_user($t_sponsor->user_id);
     echo '</td>';
コード例 #2
0
/**
 * Print the list of selected issues and the legend for the status colors.
 *
 * @param array $p_bug_ids_array An array of issue ids.
 * @return void
 */
function bug_group_action_print_bug_list(array $p_bug_ids_array)
{
    $t_legend_position = config_get('status_legend_position');
    if (STATUS_LEGEND_POSITION_TOP == $t_legend_position) {
        html_status_legend();
        echo '<br />';
    }
    echo '<div id="action-group-issues-div">';
    echo '<table>';
    echo '<tr class="row-1">';
    echo '<th class="category" colspan="2">';
    echo lang_get('actiongroup_bugs');
    echo '</th>';
    echo '</tr>';
    $t_i = 1;
    foreach ($p_bug_ids_array as $t_bug_id) {
        # choose color based on status
        $t_status_label = html_get_status_css_class(bug_get_field($t_bug_id, 'status'), auth_get_current_user_id(), bug_get_field($t_bug_id, 'project_id'));
        echo sprintf("<tr class=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n", $t_status_label, string_get_bug_view_link($t_bug_id), string_attribute(bug_get_field($t_bug_id, 'summary')));
    }
    echo '</table>';
    echo '</div>';
    if (STATUS_LEGEND_POSITION_BOTTOM == $t_legend_position) {
        echo '<br />';
        html_status_legend();
    }
}
コード例 #3
0
/**
 * return formatted string with all the details on the requested relationship
 * @param integer             $p_bug_id       A bug identifier.
 * @param BugRelationshipData $p_relationship A bug relationship object.
 * @param boolean             $p_html         Whether to return html or text output.
 * @param boolean             $p_html_preview Whether to include style/hyperlinks - if preview is false, we prettify the output.
 * @param boolean             $p_show_project Show Project details.
 * @return string
 */
function relationship_get_details($p_bug_id, BugRelationshipData $p_relationship, $p_html = false, $p_html_preview = false, $p_show_project = false)
{
    $t_summary_wrap_at = utf8_strlen(config_get('email_separator2')) - 28;
    $t_icon_path = config_get('icon_path');
    if ($p_bug_id == $p_relationship->src_bug_id) {
        # root bug is in the source side, related bug in the destination side
        $t_related_bug_id = $p_relationship->dest_bug_id;
        $t_related_project_name = project_get_name($p_relationship->dest_project_id);
        $t_relationship_descr = relationship_get_description_src_side($p_relationship->type);
    } else {
        # root bug is in the dest side, related bug in the source side
        $t_related_bug_id = $p_relationship->src_bug_id;
        $t_related_project_name = project_get_name($p_relationship->src_project_id);
        $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type);
    }
    # related bug not existing...
    if (!bug_exists($t_related_bug_id)) {
        return '';
    }
    # user can access to the related bug at least as a viewer
    if (!access_has_bug_level(VIEWER, $t_related_bug_id)) {
        return '';
    }
    if ($p_html_preview == false) {
        $t_td = '<td>';
    } else {
        $t_td = '<td class="print">';
    }
    # get the information from the related bug and prepare the link
    $t_bug = bug_get($t_related_bug_id, false);
    $t_status_string = get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
    $t_resolution_string = get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id);
    $t_relationship_info_html = $t_td . string_no_break($t_relationship_descr) . '&#160;</td>';
    if ($p_html_preview == false) {
        $t_relationship_info_html .= '<td><a href="' . string_get_bug_view_url($t_related_bug_id) . '">' . string_display_line(bug_format_id($t_related_bug_id)) . '</a></td>';
        $t_relationship_info_html .= '<td><span class="issue-status" title="' . string_attribute($t_resolution_string) . '">' . string_display_line($t_status_string) . '</span></td>';
    } else {
        $t_relationship_info_html .= $t_td . string_display_line(bug_format_id($t_related_bug_id)) . '</td>';
        $t_relationship_info_html .= $t_td . string_display_line($t_status_string) . '&#160;</td>';
    }
    $t_relationship_info_text = utf8_str_pad($t_relationship_descr, 20);
    $t_relationship_info_text .= utf8_str_pad(bug_format_id($t_related_bug_id), 8);
    # get the handler name of the related bug
    $t_relationship_info_html .= $t_td;
    if ($t_bug->handler_id > 0) {
        $t_relationship_info_html .= string_no_break(prepare_user_name($t_bug->handler_id));
    }
    $t_relationship_info_html .= '&#160;</td>';
    # add project name
    if ($p_show_project) {
        $t_relationship_info_html .= $t_td . string_display_line($t_related_project_name) . '&#160;</td>';
    }
    # add summary
    if ($p_html == true) {
        $t_relationship_info_html .= $t_td . string_display_line_links($t_bug->summary);
        if (VS_PRIVATE == $t_bug->view_state) {
            $t_relationship_info_html .= sprintf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private'));
        }
    } else {
        if (utf8_strlen($t_bug->summary) <= $t_summary_wrap_at) {
            $t_relationship_info_text .= string_email_links($t_bug->summary);
        } else {
            $t_relationship_info_text .= utf8_substr(string_email_links($t_bug->summary), 0, $t_summary_wrap_at - 3) . '...';
        }
    }
    # add delete link if bug not read only and user has access level
    if (!bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && $p_html_preview == false) {
        if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) {
            $t_relationship_info_html .= ' [<a class="small" href="bug_relationship_delete.php?bug_id=' . $p_bug_id . '&amp;rel_id=' . $p_relationship->id . htmlspecialchars(form_security_param('bug_relationship_delete')) . '">' . lang_get('delete_link') . '</a>]';
        }
    }
    $t_relationship_info_html .= '&#160;</td>';
    $t_relationship_info_text .= "\n";
    if ($p_html_preview == false) {
        # choose color based on status
        $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
        $t_relationship_info_html = '<tr class="' . $t_status_label . '">' . $t_relationship_info_html . '</tr>' . "\n";
    } else {
        $t_relationship_info_html = '<tr>' . $t_relationship_info_html . '</tr>';
    }
    if ($p_html == true) {
        return $t_relationship_info_html;
    } else {
        return $t_relationship_info_text;
    }
}
コード例 #4
0
ファイル: bug_update_page.php プロジェクト: N0ctrnl/mantisbt
    if ($t_spacer > 0) {
        echo '<td colspan="', $t_spacer, '">&#160;</td>';
    }
    echo '</tr>';
}
#
# Status, Resolution
#
if ($t_show_status || $t_show_resolution) {
    echo '<tr>';
    $t_spacer = 2;
    if ($t_show_status) {
        # Status
        echo '<th class="category"><label for="status">' . lang_get('status') . '</label></th>';
        # choose color based on status
        $status_label = html_get_status_css_class($t_bug->status);
        echo '<td class="' . $status_label . '">';
        print_status_option_list('status', $t_bug->status, access_can_close_bug($t_bug), $t_bug->project_id);
        echo '</td>';
    } else {
        $t_spacer += 2;
    }
    if ($t_show_resolution) {
        # Resolution
        echo '<th class="category"><label for="resolution">' . lang_get('resolution') . '</label></th>';
        echo '<td><select ' . helper_get_tab_index() . ' id="resolution" name="resolution">';
        print_enum_string_option_list('resolution', $t_bug->resolution);
        echo '</select></td>';
    } else {
        $t_spacer += 2;
    }
コード例 #5
0
ファイル: view_all_inc.php プロジェクト: N0ctrnl/mantisbt
/**
 * Output Bug Rows
 *
 * @param array array of bug objects
 */
function write_bug_rows($p_rows)
{
    global $t_columns, $t_filter;
    $t_in_stickies = $t_filter && 'on' == $t_filter[FILTER_PROPERTY_STICKY];
    # pre-cache custom column data
    columns_plugin_cache_issue_data($p_rows);
    # -- Loop over bug rows --
    $t_rows = count($p_rows);
    for ($i = 0; $i < $t_rows; $i++) {
        $t_row = $p_rows[$i];
        if (0 == $t_row->sticky && 0 == $i) {
            $t_in_stickies = false;
        }
        if (0 == $t_row->sticky && $t_in_stickies) {
            # demarcate stickies, if any have been shown
            ?>
		   <tr>
				   <td class="left" colspan="<?php 
            echo count($t_columns);
            ?>
" bgcolor="#999999">&#160;</td>
		   </tr>
<?php 
            $t_in_stickies = false;
        }
        # choose color based on status
        $status_label = html_get_status_css_class($t_row->status, auth_get_current_user_id(), $t_row->project_id);
        echo '<tr class="' . $status_label . '">';
        $t_column_value_function = 'print_column_value';
        foreach ($t_columns as $t_column) {
            helper_call_custom_function($t_column_value_function, array($t_column, $t_row));
        }
        echo '</tr>';
    }
}
コード例 #6
0
/**
 * Print the list of selected issues and the legend for the status colors.
 *
 * @param $p_bug_ids_array   An array of issue ids.
 */
function bug_group_action_print_bug_list( $p_bug_ids_array ) {
	$t_legend_position = config_get( 'status_legend_position' );

	if( STATUS_LEGEND_POSITION_TOP == $t_legend_position ) {
		html_status_legend();
		echo '<br />';
	}

	echo '<div>';
	echo '<table class="width75" cellspacing="1">';
	echo '<tr class="row-1">';
	echo '<th class="category" colspan="2">';
	echo lang_get( 'actiongroup_bugs' );
	echo '</th>';
	echo '</tr>';

	$t_i = 1;

	foreach( $p_bug_ids_array as $t_bug_id ) {
		$t_class = sprintf( "row-%d", ( $t_i++ % 2 ) + 1 );

		# choose color based on status
		$status_label = html_get_status_css_class( bug_get_field( $t_bug_id, 'status' ) );

		echo sprintf( "<tr class=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n", $status_label, string_get_bug_view_link( $t_bug_id ), string_attribute( bug_get_field( $t_bug_id, 'summary' ) ) );
	}

	echo '</table>';
	echo '</div>';

	if( STATUS_LEGEND_POSITION_BOTTOM == $t_legend_position ) {
		echo '<br />';
		html_status_legend();
	}
}
コード例 #7
0
ファイル: status_config.php プロジェクト: pkdevboxy/mantisbt
 *	other pages may need to include dynamic css styles as well
 */
$t_referer_page = array_key_exists('HTTP_REFERER', $_SERVER) ? basename(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH)) : basename(__FILE__);
switch ($t_referer_page) {
    case 'login_page.php':
    case 'signup_page.php':
    case 'lost_pwd_page.php':
    case 'account_update.php':
        # We don't need custom status colors on login page, and this is
        # actually causing an error since we're not authenticated yet.
        exit;
}
$t_status_string = config_get('status_enum_string');
$t_statuses = MantisEnum::getAssocArrayIndexedByValues($t_status_string);
$t_colors = config_get('status_colors');
$t_status_percents = auth_is_user_authenticated() ? get_percentage_by_status() : array();
foreach ($t_statuses as $t_id => $t_label) {
    $t_css_class = html_get_status_css_class($t_id);
    # Status color class
    if (array_key_exists($t_label, $t_colors)) {
        echo '.' . $t_css_class . " { background-color: {$t_colors[$t_label]}; }\n";
    }
    # Status percentage width class
    if (array_key_exists($t_id, $t_status_percents)) {
        echo '.' . str_replace('color', 'percentage', $t_css_class) . " { width: {$t_status_percents[$t_id]}%; }\n";
    }
}
# Status legend width class
$t_color_count = count($t_colors);
$t_color_width = $t_color_count > 0 ? round(100 / $t_color_count) : 0;
echo ".status-legend-width { width: {$t_color_width}%; }\n";
コード例 #8
0
ファイル: html_api.php プロジェクト: AsBilou/mantisbt
/**
 * Print the legend for the status percentage
 * @return void
 */
function html_status_percentage_legend()
{
    $t_status_percents = get_percentage_by_status();
    $t_status_enum_string = config_get('status_enum_string');
    $t_enum_values = MantisEnum::getValues($t_status_enum_string);
    $t_enum_count = count($t_enum_values);
    $t_bug_count = array_sum($t_status_percents);
    if ($t_bug_count > 0) {
        echo '<br />';
        echo '<table class="width100" cellspacing="1">';
        echo '<tr>';
        echo '<td class="form-title" colspan="' . $t_enum_count . '">' . lang_get('issue_status_percentage') . '</td>';
        echo '</tr>';
        echo '<tr>';
        foreach ($t_enum_values as $t_status) {
            $t_percent = isset($t_status_percents[$t_status]) ? $t_status_percents[$t_status] : 0;
            if ($t_percent > 0) {
                $t_class = html_get_status_css_class($t_status);
                echo '<td class="small-caption-center ' . $t_class . ' ' . str_replace('color', 'percentage', $t_class) . '">' . $t_percent . '%</td>';
            }
        }
        echo '</tr>';
        echo '</table>';
    }
}