コード例 #1
0
/**
 * updates the status field
 * @return bool 
 * @access public
 * @see bug_update.php
 */
function kanban_ajax_request_bug_update_status()
{
    $p_bug_id = gpc_get_int('id');
    $p_new_status = gpc_get_int('new_status');
    $t_project_id = gpc_get_int('project_id');
    $c_bug_id = (int) $p_bug_id;
    $f_new_status = (int) $p_new_status;
    $t_bug_data = bug_get($c_bug_id, true);
    $f_update_mode = gpc_get_bool('update_mode', FALSE);
    # set if called from generic update page
    if (!(access_has_bug_level(access_get_status_threshold($f_new_status, $t_project_id), $c_bug_id) || access_has_bug_level(config_get('update_bug_threshold'), $c_bug_id) || bug_get_field($c_bug_id, 'reporter_id') == auth_get_current_user_id() && (ON == config_get('allow_reporter_reopen') || ON == config_get('allow_reporter_close')))) {
        access_denied();
    }
    # extract current extended information
    $t_old_bug_status = $t_bug_data->status;
    log_event(LOG_AJAX, "Old bug status {$t_old_bug_status} - trying update to new status {$f_new_status}...");
    $t_bug_data->reporter_id = gpc_get_int('reporter_id', $t_bug_data->reporter_id);
    $t_bug_data->handler_id = gpc_get_int('handler_id', $t_bug_data->handler_id);
    $t_bug_data->duplicate_id = gpc_get_int('duplicate_id', $t_bug_data->duplicate_id);
    $t_bug_data->priority = gpc_get_int('priority', $t_bug_data->priority);
    $t_bug_data->severity = gpc_get_int('severity', $t_bug_data->severity);
    $t_bug_data->reproducibility = gpc_get_int('reproducibility', $t_bug_data->reproducibility);
    $t_bug_data->status = gpc_get_int('new_status', $t_bug_data->status);
    $t_bug_data->resolution = gpc_get_int('resolution', $t_bug_data->resolution);
    $t_bug_data->projection = gpc_get_int('projection', $t_bug_data->projection);
    $t_bug_data->category_id = gpc_get_int('category_id', $t_bug_data->category_id);
    $t_bug_data->eta = gpc_get_int('eta', $t_bug_data->eta);
    $t_bug_data->os = gpc_get_string('os', $t_bug_data->os);
    $t_bug_data->os_build = gpc_get_string('os_build', $t_bug_data->os_build);
    $t_bug_data->platform = gpc_get_string('platform', $t_bug_data->platform);
    $t_bug_data->version = gpc_get_string('version', $t_bug_data->version);
    $t_bug_data->build = gpc_get_string('build', $t_bug_data->build);
    $t_bug_data->fixed_in_version = gpc_get_string('fixed_in_version', $t_bug_data->fixed_in_version);
    $t_bug_data->view_state = gpc_get_int('view_state', $t_bug_data->view_state);
    $t_bug_data->summary = gpc_get_string('summary', $t_bug_data->summary);
    $t_due_date = gpc_get_string('due_date', null);
    if (access_has_project_level(config_get('roadmap_update_threshold'), $t_bug_data->project_id)) {
        $t_bug_data->target_version = gpc_get_string('target_version', $t_bug_data->target_version);
    }
    if ($t_due_date !== null) {
        if (is_blank($t_due_date)) {
            $t_bug_data->due_date = 1;
        } else {
            $t_bug_data->due_date = strtotime($t_due_date);
        }
    }
    $t_bug_data->description = gpc_get_string('description', $t_bug_data->description);
    $t_bug_data->steps_to_reproduce = gpc_get_string('steps_to_reproduce', $t_bug_data->steps_to_reproduce);
    $t_bug_data->additional_information = gpc_get_string('additional_information', $t_bug_data->additional_information);
    $f_private = gpc_get_bool('private');
    $f_bugnote_text = gpc_get_string('bugnote_text', '');
    $f_time_tracking = gpc_get_string('time_tracking', '0:00');
    $f_close_now = gpc_get_string('close_now', false);
    # Handle auto-assigning
    if (config_get('bug_submit_status') == $t_bug_data->status && $t_bug_data->status == $t_old_bug_status && 0 != $t_bug_data->handler_id && ON == config_get('auto_set_status_to_assigned')) {
        $t_bug_data->status = config_get('bug_assigned_status');
    }
    helper_call_custom_function('issue_update_validate', array($c_bug_id, $t_bug_data, $f_bugnote_text));
    $t_resolved = config_get('bug_resolved_status_threshold');
    $t_closed = config_get('bug_closed_status_threshold');
    $t_custom_status_label = "update";
    # default info to check
    if ($t_bug_data->status == $t_resolved) {
        $t_custom_status_label = "resolved";
    }
    if ($t_bug_data->status == $t_closed) {
        $t_custom_status_label = "closed";
    }
    $t_related_custom_field_ids = custom_field_get_linked_ids($t_bug_data->project_id);
    foreach ($t_related_custom_field_ids as $t_id) {
        $t_def = custom_field_get_definition($t_id);
        # Only update the field if it would have been display for editing
        if (!(!$f_update_mode && $t_def['require_' . $t_custom_status_label] || !$f_update_mode && $t_def['display_' . $t_custom_status_label] && in_array($t_custom_status_label, array("resolved", "closed")) || $f_update_mode && $t_def['display_update'] || $f_update_mode && $t_def['require_update'])) {
            continue;
        }
        # Do not set custom field value if user has no write access.
        if (!custom_field_has_write_access($t_id, $c_bug_id)) {
            continue;
        }
        if ($t_def['require_' . $t_custom_status_label] && !gpc_isset_custom_field($t_id, $t_def['type'])) {
            error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
            trigger_error(ERROR_EMPTY_FIELD, ERROR);
        }
        # Only update the field if it is posted,
        #	or if it is empty, and the current value isn't the default
        if (!gpc_isset_custom_field($t_id, $t_def['type']) && custom_field_get_value($t_id, $c_bug_id) == $t_def['default_value']) {
            continue;
        }
        if (!custom_field_set_value($t_id, $c_bug_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], NULL))) {
            error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
            log_event(LOG_AJAX, "Error setting new status: " . ERROR_CUSTOM_FIELD_INVALID_VALUE . "\nBugdata: " . print_r($t_bug_data, true) . " Line: " . __LINE__);
            trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
        }
    }
    $t_notify = true;
    $t_bug_note_set = false;
    if ($t_old_bug_status != $t_bug_data->status && FALSE == $f_update_mode) {
        # handle status transitions that come from pages other than bug_*update_page.php
        # this does the minimum to act on the bug and sends a specific message
        if ($t_bug_data->status >= $t_resolved && $t_bug_data->status < $t_closed && $t_old_bug_status < $t_resolved) {
            # bug_resolve updates the status, fixed_in_version, resolution, handler_id and bugnote and sends message
            bug_resolve($c_bug_id, $t_bug_data->resolution, $t_bug_data->fixed_in_version, $f_bugnote_text, $t_bug_data->duplicate_id, $t_bug_data->handler_id, $f_private, $f_time_tracking);
            $t_notify = false;
            $t_bug_note_set = true;
            if ($f_close_now) {
                bug_set_field($c_bug_id, 'status', $t_closed);
            }
            // update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
            // in bug_update() call below.
            $t_bug_data->handler_id = bug_get_field($c_bug_id, 'handler_id');
            $t_bug_data->status = bug_get_field($c_bug_id, 'status');
        } else {
            if ($t_bug_data->status >= $t_closed && $t_old_bug_status < $t_closed) {
                # bug_close updates the status and bugnote and sends message
                bug_close($c_bug_id, $f_bugnote_text, $f_private, $f_time_tracking);
                $t_notify = false;
                $t_bug_note_set = true;
            } else {
                if ($t_bug_data->status == config_get('bug_reopen_status') && $t_old_bug_status >= $t_resolved) {
                    bug_set_field($c_bug_id, 'handler_id', $t_bug_data->handler_id);
                    # fix: update handler_id before calling bug_reopen
                    # bug_reopen updates the status and bugnote and sends message
                    bug_reopen($c_bug_id, $f_bugnote_text, $f_time_tracking, $f_private);
                    $t_notify = false;
                    $t_bug_note_set = true;
                    // update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
                    // in bug_update() call below.
                    $t_bug_data->status = bug_get_field($c_bug_id, 'status');
                    $t_bug_data->resolution = bug_get_field($c_bug_id, 'resolution');
                }
            }
        }
    }
    # Plugin support
    $t_new_bug_data = event_signal('EVENT_UPDATE_BUG', $t_bug_data, $c_bug_id);
    if (!is_null($t_new_bug_data)) {
        $t_bug_data = $t_new_bug_data;
    }
    # Add a bugnote if there is one
    if (false == $t_bug_note_set) {
        bugnote_add($c_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, 0, '', NULL, FALSE);
    }
    # Update the bug entry, notify if we haven't done so already
    $t_bug_data->update(true, false == $t_notify);
    helper_call_custom_function('issue_update_notify', array($c_bug_id));
    return true;
}
コード例 #2
0
ファイル: filter_api.php プロジェクト: vipjaven/mantisbt
/**
 * Print sort fields
 * @return void
 */
function print_filter_show_sort()
{
    global $g_filter;
    # get all of the displayed fields for sort, then drop ones that
    #  are not appropriate and translate the rest
    $t_fields = helper_get_columns_to_view();
    $t_n_fields = count($t_fields);
    $t_shown_fields[''] = '';
    for ($i = 0; $i < $t_n_fields; $i++) {
        if (!in_array($t_fields[$i], array('selection', 'edit', 'bugnotes_count', 'attachment_count'))) {
            if (strpos($t_fields[$i], 'custom_') === 0) {
                $t_field_name = string_display(lang_get_defaulted(utf8_substr($t_fields[$i], utf8_strlen('custom_'))));
            } else {
                $t_field_name = string_get_field_name($t_fields[$i]);
            }
            $t_shown_fields[$t_fields[$i]] = $t_field_name;
        }
    }
    $t_shown_dirs[''] = '';
    $t_shown_dirs['ASC'] = lang_get('bugnote_order_asc');
    $t_shown_dirs['DESC'] = lang_get('bugnote_order_desc');
    # get default values from filter structure
    $t_sort_fields = explode(',', $g_filter[FILTER_PROPERTY_SORT_FIELD_NAME]);
    $t_dir_fields = explode(',', $g_filter[FILTER_PROPERTY_SORT_DIRECTION]);
    if (!isset($t_sort_fields[1])) {
        $t_sort_fields[1] = '';
        $t_dir_fields[1] = '';
    }
    # if there are fields to display, show the dropdowns
    if (count($t_fields) > 0) {
        # display a primary and secondary sort fields
        echo '<select name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_0">';
        foreach ($t_shown_fields as $t_key => $t_val) {
            echo '<option value="' . $t_key . '"';
            check_selected($t_key, $t_sort_fields[0]);
            echo '>' . $t_val . '</option>';
        }
        echo '</select>';
        echo '<select name="', FILTER_PROPERTY_SORT_DIRECTION, '_0">';
        foreach ($t_shown_dirs as $t_key => $t_val) {
            echo '<option value="' . $t_key . '"';
            check_selected($t_key, $t_dir_fields[0]);
            echo '>' . $t_val . '</option>';
        }
        echo '</select>';
        echo ', ';
        # for secondary sort
        echo '<select name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_1">';
        foreach ($t_shown_fields as $t_key => $t_val) {
            echo '<option value="' . $t_key . '"';
            check_selected($t_key, $t_sort_fields[1]);
            echo '>' . $t_val . '</option>';
        }
        echo '</select>';
        echo '<select name="', FILTER_PROPERTY_SORT_DIRECTION, '_1">';
        foreach ($t_shown_dirs as $t_key => $t_val) {
            echo '<option value="' . $t_key . '"';
            check_selected($t_key, $t_dir_fields[1]);
            echo '>' . $t_val . '</option>';
        }
        echo '</select>';
    } else {
        echo lang_get_defaulted('last_updated') . lang_get('bugnote_order_desc');
        echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_1" value="last_updated" />';
        echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_DIRECTION, '_1" value="DESC" />';
    }
}
コード例 #3
0
        }
    }
    echo '</tr>';
}
$t_resolved = config_get('bug_resolved_status_threshold');
$t_closed = config_get('bug_closed_status_threshold');
$t_bin_count = $t_ptr;
$t_labels = array();
$i = 0;
if ($f_summary) {
    $t_labels[++$i] = $t_label_strings[0];
    $t_labels[++$i] = $t_label_strings[1];
    $t_labels[++$i] = $t_label_strings[2];
} else {
    foreach ($t_view_status as $t_status => $t_label) {
        $t_labels[++$i] = isset($t_status_labels[$t_status]) ? $t_status_labels[$t_status] : lang_get_defaulted($t_label);
    }
}
$t_label_count = $i;
// reverse the array and consolidate the data, if necessary
$t_metrics = array();
for ($t_ptr = 0; $t_ptr < $t_bin_count; $t_ptr++) {
    $t = $t_bin_count - $t_ptr;
    $t_metrics[0][$t_ptr] = $t_marker[$t];
    if ($f_summary) {
        $t_metrics[1][$t_ptr] = 0;
        $t_metrics[2][$t_ptr] = 0;
        $t_metrics[3][$t_ptr] = 0;
        foreach ($t_view_status as $t_status => $t_label) {
            if (isset($t_data[$t][$t_status])) {
                if ($t_status < $t_resolved) {
コード例 #4
0
    }
    echo '<td class="print" colspan="', $t_spacer, '">&#160;</td>';
    echo '</tr>';
}
#
# Custom Fields
#
$t_related_custom_field_ids = custom_field_get_linked_ids($t_bug->project_id);
foreach ($t_related_custom_field_ids as $t_id) {
    # Don't display the field if user does not have read access to it
    if (!custom_field_has_read_access_by_project_id($t_id, $t_bug->project_id)) {
        continue;
    }
    $t_def = custom_field_get_definition($t_id);
    echo '<tr class="print">';
    echo '<th class="print-category">', string_display_line(lang_get_defaulted($t_def['name'])), '</th>';
    echo '<td class="print" colspan="4">';
    print_custom_field_value($t_def, $t_id, $f_bug_id);
    echo '</td>';
    echo '</tr>';
}
# foreach
echo '<tr><td class="print-spacer" colspan="6"><hr /></td></tr>';
if ($t_show_summary) {
    echo '<tr class="print">';
    echo '<th class="print-category">', lang_get('summary'), '</th>';
    echo '<td class="print" colspan="5">', $t_summary, '</td>';
    echo '</tr>';
}
if ($t_show_description) {
    echo '<tr class="print">';
コード例 #5
0
	<?php 
    # -- Custom Field Searching --
    ?>
	<?php 
    if (sizeof($t_accessible_custom_fields_ids) > 0) {
        $t_per_row = config_get('filter_custom_fields_per_row');
        $t_num_rows = ceil(sizeof($t_accessible_custom_fields_ids) / $t_per_row);
        $t_base = 0;
        for ($i = 0; $i < $t_num_rows; $i++) {
            ?>
			<tr class="row-category2">
			<?php 
            for ($j = 0; $j < $t_per_row; $j++) {
                echo '<td class="small-caption" colspan="' . 1 * $t_filter_cols . '">';
                if (isset($t_accessible_custom_fields_names[$t_base + $j])) {
                    echo string_display(lang_get_defaulted($t_accessible_custom_fields_names[$t_base + $j]));
                } else {
                    echo '&nbsp;';
                }
                echo '</td>';
            }
            ?>
			</tr>
			<tr class="row-2">
			<?php 
            for ($j = 0; $j < $t_per_row; $j++) {
                echo '<td colspan="' . 1 * $t_filter_cols . '">';
                if (isset($t_accessible_custom_fields_ids[$t_base + $j])) {
                    print_filter_custom_field($t_accessible_custom_fields_ids[$t_base + $j]);
                } else {
                    echo '&nbsp;';
コード例 #6
0
        $t_button_title = lang_get('view_status_group_bugs_button');
        $t_form = 'view_status';
        break;
    case 'UP_FIXED_IN_VERSION':
        $t_question_title = lang_get('fixed_in_version_bugs_conf_msg');
        $t_button_title = lang_get('fixed_in_version_group_bugs_button');
        $t_form = 'fixed_in_version';
        break;
    case 'UP_TARGET_VERSION':
        $t_question_title = lang_get('target_version_bugs_conf_msg');
        $t_button_title = lang_get('target_version_group_bugs_button');
        $t_form = 'target_version';
        break;
    case 'CUSTOM':
        $t_custom_field_def = custom_field_get_definition($t_custom_field_id);
        $t_question_title = sprintf(lang_get('actiongroup_menu_update_field'), lang_get_defaulted($t_custom_field_def['name']));
        $t_button_title = $t_question_title;
        $t_form = "custom_field_{$t_custom_field_id}";
        break;
    default:
        trigger_error(ERROR_GENERIC, ERROR);
}
bug_group_action_print_top();
if ($t_multiple_projects) {
    echo '<p class="bold">' . lang_get('multiple_projects') . '</p>';
}
?>

<br />

<div align="center">
コード例 #7
0
ファイル: html_api.php プロジェクト: amjadtbssm/website
function html_button_wiki($p_bug_id)
{
    if (ON == config_get('wiki_enable')) {
        if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) {
            html_button('wiki.php', lang_get_defaulted('Wiki'), array('id' => $p_bug_id, 'type' => 'issue'), 'get');
        }
    }
}
コード例 #8
0
		<?php 
        print_custom_field_input($t_def, $f_bug_id);
        ?>
	</td>
</tr>
<?php 
    } else {
        if (custom_field_has_read_access($t_id, $f_bug_id)) {
            ?>
	<tr <?php 
            echo helper_alternate_class();
            ?>
>
		<th class="category">
			<?php 
            echo lang_get_defaulted($t_def['name']);
            ?>
		</th>
		<td>
			<?php 
            print_custom_field_value($t_def, $t_id, $f_bug_id);
            ?>
		</td>
	</tr>
<?php 
        }
    }
    # custom_field_has_read_access( $t_id, $f_bug_id ) )
}
# foreach( $t_related_custom_field_ids as $t_id )
?>
コード例 #9
0
ファイル: filter_api.php プロジェクト: amjadtbssm/website
function print_filter_show_sort()
{
    global $t_filter;
    # get all of the displayed fields for sort, then drop ones that
    #  are not appropriate and translate the rest
    $t_fields = helper_get_columns_to_view();
    $t_n_fields = count($t_fields);
    $t_shown_fields[""] = "";
    for ($i = 0; $i < $t_n_fields; $i++) {
        if (!in_array($t_fields[$i], array('selection', 'edit', 'bugnotes_count', 'attachment'))) {
            if (strpos($t_fields[$i], 'custom_') === 0) {
                $t_field_name = string_display(lang_get_defaulted(substr($t_fields[$i], strlen('custom_'))));
            } else {
                $t_field_name = string_get_field_name($t_fields[$i]);
            }
            $t_shown_fields[$t_fields[$i]] = $t_field_name;
        }
    }
    $t_shown_dirs[""] = "";
    $t_shown_dirs["ASC"] = lang_get('bugnote_order_asc');
    $t_shown_dirs["DESC"] = lang_get('bugnote_order_desc');
    # get default values from filter structure
    $t_sort_fields = split(',', $t_filter['sort']);
    $t_dir_fields = split(',', $t_filter['dir']);
    if (!isset($t_sort_fields[1])) {
        $t_sort_fields[1] = '';
        $t_dir_fields[1] = '';
    }
    # if there are fields to display, show the dropdowns
    if (count($t_fields) > 0) {
        # display a primary and secondary sort fields
        echo '<select name="sort_0">';
        foreach ($t_shown_fields as $key => $val) {
            echo "<option value=\"{$key}\"";
            check_selected($key, $t_sort_fields[0]);
            echo ">{$val}</option>";
        }
        echo '</select>';
        echo '<select name="dir_0">';
        foreach ($t_shown_dirs as $key => $val) {
            echo "<option value=\"{$key}\"";
            check_selected($key, $t_dir_fields[0]);
            echo ">{$val}</option>";
        }
        echo '</select>';
        echo ', ';
        # for secondary sort
        echo '<select name="sort_1">';
        foreach ($t_shown_fields as $key => $val) {
            echo "<option value=\"{$key}\"";
            check_selected($key, $t_sort_fields[1]);
            echo ">{$val}</option>";
        }
        echo '</select>';
        echo '<select name="dir_1">';
        foreach ($t_shown_dirs as $key => $val) {
            echo "<option value=\"{$key}\"";
            check_selected($key, $t_dir_fields[1]);
            echo ">{$val}</option>";
        }
        echo '</select>';
    } else {
        echo lang_get_defaulted('last_updated') . lang_get('bugnote_order_desc');
        echo "<input type=\"hidden\" name=\"sort_1\" value=\"last_updated\" />";
        echo "<input type=\"hidden\" name=\"dir_1\" value=\"DESC\" />";
    }
}
コード例 #10
0
	</td>
	<td class="print" colspan="2">&#160;</td>
</tr>
<?php 
        $t_related_custom_field_ids = custom_field_get_linked_ids($t_bug->project_id);
        foreach ($t_related_custom_field_ids as $t_custom_field_id) {
            # Don't display the field if user does not have read access to it
            if (!custom_field_has_read_access_by_project_id($t_custom_field_id, $t_bug->project_id)) {
                continue;
            }
            $t_def = custom_field_get_definition($t_custom_field_id);
            ?>
<tr class="print">
	<td class="print-category">
		<?php 
            echo string_display_line(sprintf(lang_get('label'), lang_get_defaulted($t_def['name'])));
            ?>
	</td>
	<td class="print" colspan="5">
		<?php 
            print_custom_field_value($t_def, $t_custom_field_id, $t_id);
            ?>
	</td>
</tr>
<?php 
        }
        # foreach
        ?>
<tr>
	<td class="print-spacer" colspan="6">
		<hr />
コード例 #11
0
ファイル: excel_api.php プロジェクト: kaos/mantisbt
/**
 * Gets an Xml Row that contains all column titles.
 * @returns The xml row.
 */
function excel_get_titles_row()
{
    $t_columns = excel_get_columns();
    $t_ret = '<Row>';
    foreach ($t_columns as $t_column) {
        $t_custom_field = column_get_custom_field_name($t_column);
        if ($t_custom_field !== null) {
            $t_ret .= excel_format_column_title(lang_get_defaulted($t_custom_field));
        } else {
            $t_column_title = column_get_title($t_column);
            $t_ret .= excel_format_column_title($t_column_title);
        }
    }
    $t_ret .= '</Row>';
    return $t_ret;
}
コード例 #12
0
ファイル: config_api.php プロジェクト: mikemol/EmailReporting
function ERP_custom_function_print_custom_fields($p_name, $p_sel_value)
{
    # Custom Fields
    $t_custom_fields = custom_field_get_ids();
    foreach ($t_custom_fields as $t_field_id) {
        $t_def = custom_field_get_definition($t_field_id);
        echo '<tr ' . helper_alternate_class() . '><td class="category">';
        ERP_print_documentation_link($p_name);
        echo ': ' . string_display(lang_get_defaulted($t_def['name'])) . '</td>';
        echo '<td class="center" colspan="2">';
        ERP_print_custom_field_input(is_array($p_sel_value) && isset($p_sel_value[$t_field_id]) ? $p_sel_value[$t_field_id] : NULL, $t_def);
        echo '</td></tr>';
    }
}
コード例 #13
0
$t_custom_fields_found = false;
$t_related_custom_field_ids = custom_field_get_linked_ids($t_bug->project_id);
foreach ($t_related_custom_field_ids as $t_id) {
    $t_def = custom_field_get_definition($t_id);
    if (($t_def['display_update'] || $t_def['require_update']) && custom_field_has_write_access($t_id, $t_bug_id)) {
        $t_custom_fields_found = true;
        $t_required_class = $t_def['require_update'] ? ' class="required" ' : '';
        if ($t_def['type'] != CUSTOM_FIELD_TYPE_RADIO && $t_def['type'] != CUSTOM_FIELD_TYPE_CHECKBOX) {
            $t_label_for = ' for="custom_field_' . string_attribute($t_def['id']) . '" ';
        } else {
            $t_label_for = '';
        }
        echo '<tr>';
        echo '<td class="category">';
        echo '<label', $t_required_class, $t_label_for, '>';
        echo '<span>', string_display(lang_get_defaulted($t_def['name'])), '</span>';
        echo '</label>';
        echo '</td><td colspan="5">';
        print_custom_field_input($t_def, $t_bug_id);
        echo '</td></tr>';
    }
}
# foreach( $t_related_custom_field_ids as $t_id )
if ($t_custom_fields_found) {
    # spacer
    echo '<tr class="spacer"><td colspan="6"></td></tr>';
    echo '<tr class="hidden"></tr>';
}
# Bugnote Text Box
echo '<tr>';
echo '<th class="category"><label for="bugnote_text">' . lang_get('add_bugnote_title') . '</label></th>';
コード例 #14
0
function print_all_bug_action_option_list()
{
    $commands = array('MOVE' => lang_get('actiongroup_menu_move'), 'COPY' => lang_get('actiongroup_menu_copy'), 'ASSIGN' => lang_get('actiongroup_menu_assign'), 'CLOSE' => lang_get('actiongroup_menu_close'), 'DELETE' => lang_get('actiongroup_menu_delete'), 'RESOLVE' => lang_get('actiongroup_menu_resolve'), 'SET_STICKY' => lang_get('actiongroup_menu_set_sticky'), 'UP_PRIOR' => lang_get('actiongroup_menu_update_priority'), 'UP_STATUS' => lang_get('actiongroup_menu_update_status'), 'UP_CATEGORY' => lang_get('actiongroup_menu_update_category'), 'VIEW_STATUS' => lang_get('actiongroup_menu_update_view_status'), 'EXT_ADD_NOTE' => lang_get('actiongroup_menu_add_note'), 'EXT_ATTACH_TAGS' => lang_get('actiongroup_menu_attach_tags'));
    $t_project_id = helper_get_current_project();
    if (ALL_PROJECTS != $t_project_id) {
        $t_user_id = auth_get_current_user_id();
        if (access_has_project_level(config_get('update_bug_threshold'), $t_project_id)) {
            $commands['UP_FIXED_IN_VERSION'] = lang_get('actiongroup_menu_update_fixed_in_version');
        }
        if (access_has_project_level(config_get('roadmap_update_threshold'), $t_project_id)) {
            $commands['UP_TARGET_VERSION'] = lang_get('actiongroup_menu_update_target_version');
        }
        $t_custom_field_ids = custom_field_get_linked_ids($t_project_id);
        foreach ($t_custom_field_ids as $t_custom_field_id) {
            # if user has not access right to modify the field, then there is no
            # point in showing it.
            if (!custom_field_has_write_access_to_project($t_custom_field_id, $t_project_id, $t_user_id)) {
                continue;
            }
            $t_custom_field_def = custom_field_get_definition($t_custom_field_id);
            $t_command_id = 'custom_field_' . $t_custom_field_id;
            $t_command_caption = sprintf(lang_get('actiongroup_menu_update_field'), lang_get_defaulted($t_custom_field_def['name']));
            $commands[$t_command_id] = string_display($t_command_caption);
        }
    }
    $t_custom_group_actions = config_get('custom_group_actions');
    foreach ($t_custom_group_actions as $t_custom_group_action) {
        # use label if provided to get the localized text, otherwise fallback to action name.
        if (isset($t_custom_group_action['label'])) {
            $commands[$t_custom_group_action['action']] = lang_get_defaulted($t_custom_group_action['label']);
        } else {
            $commands[$t_custom_group_action['action']] = lang_get_defaulted($t_custom_group_action['action']);
        }
    }
    while (list($key, $val) = each($commands)) {
        print "<option value=\"" . $key . "\">" . $val . "</option>";
    }
}
コード例 #15
0
	<form method="post" action="manage_proj_custom_field_add_existing.php">
		<fieldset>
			<?php 
        echo form_security_field('manage_proj_custom_field_add_existing');
        ?>
			<input type="hidden" name="project_id" value="<?php 
        echo $f_project_id;
        ?>
" />
			<select name="field_id">
				<?php 
        $t_custom_fields = custom_field_get_ids();
        foreach ($t_custom_fields as $t_field_id) {
            if (!custom_field_is_linked($t_field_id, $f_project_id)) {
                $t_desc = custom_field_get_definition($t_field_id);
                echo "<option value=\"{$t_field_id}\">" . string_attribute(lang_get_defaulted($t_desc['name'])) . '</option>';
            }
        }
        ?>
			</select>
			<input type="submit" class="button" value="<?php 
        echo lang_get('add_existing_custom_field');
        ?>
" />
		</fieldset>
	</form><?php 
    }
    ?>
</div><?php 
}
event_signal('EVENT_MANAGE_PROJECT_PAGE', array($f_project_id));
コード例 #16
0
function custom_function_default_print_column_title($p_column, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    global $t_sort, $t_dir;
    if (strpos($p_column, 'custom_') === 0) {
        $t_custom_field = substr($p_column, 7);
        if (COLUMNS_TARGET_CSV_PAGE != $p_columns_target) {
            echo '<td>';
        }
        $t_field_id = custom_field_get_id_from_name($t_custom_field);
        if ($t_field_id === false) {
            echo '@', $t_custom_field, '@';
        } else {
            $t_def = custom_field_get_definition($t_field_id);
            $t_custom_field = lang_get_defaulted($t_def['name']);
            if (COLUMNS_TARGET_CSV_PAGE != $p_columns_target) {
                print_view_bug_sort_link($t_custom_field, $p_column, $t_sort, $t_dir, $p_columns_target);
                print_sort_icon($t_dir, $t_sort, $p_column);
            } else {
                echo $t_custom_field;
            }
        }
        if (COLUMNS_TARGET_CSV_PAGE != $p_columns_target) {
            echo '</td>';
        }
    } else {
        $t_function = 'print_column_title_' . $p_column;
        if (function_exists($t_function)) {
            $t_function($t_sort, $t_dir, $p_columns_target);
        } else {
            echo '<td>';
            print_view_bug_sort_link(lang_get_defaulted($p_column), $p_column, $t_sort, $t_dir, $p_columns_target);
            print_sort_icon($t_dir, $t_sort, $p_column);
            echo '</td>';
        }
    }
}
コード例 #17
0
ファイル: custom_field_api.php プロジェクト: hamx0r/mantisbt
/**
 * Return custom field name including localized name (if available)
 *
 * @param string $p_name Custom field's name.
 * @return string CustomFieldName [(LocalizedName)]
 * @access public
 */
function custom_field_get_display_name($p_name)
{
    $t_local_name = lang_get_defaulted($p_name);
    if ($t_local_name != $p_name) {
        $p_name .= ' (' . $t_local_name . ')';
    }
    return string_display($p_name);
}
コード例 #18
0
ファイル: bug_view_inc.php プロジェクト: fur81/zofaxiopeu
    echo '</td></tr>';
}
# spacer
echo '<tr class="spacer"><td colspan="6"></td></tr>';
# Custom Fields
$t_custom_fields_found = false;
$t_related_custom_field_ids = custom_field_get_linked_ids($tpl_bug->project_id);
foreach ($t_related_custom_field_ids as $t_id) {
    if (!custom_field_has_read_access($t_id, $f_bug_id)) {
        continue;
    }
    # has read access
    $t_custom_fields_found = true;
    $t_def = custom_field_get_definition($t_id);
    echo '<tr ', helper_alternate_class(), '>';
    echo '<td class="category">', string_display(lang_get_defaulted($t_def['name'])), '</td>';
    echo '<td colspan="5">';
    print_custom_field_value($t_def, $t_id, $f_bug_id);
    echo '</td></tr>';
}
if ($t_custom_fields_found) {
    # spacer
    echo '<tr class="spacer"><td colspan="6"></td></tr>';
}
# custom fields found
# Attachments
if ($tpl_show_attachments) {
    echo '<tr ', helper_alternate_class(), '>';
    echo '<td class="category"><a name="attachments" id="attachments" />', lang_get('attached_files'), '</td>';
    echo '<td colspan="5">';
    print_bug_attachments_list($tpl_bug_id);
コード例 #19
0
ファイル: history_api.php プロジェクト: gtn/mantisbt
/**
 * Localizes one raw history item specified by set the next parameters: $p_field_name, $p_type, $p_old_value, $p_new_value
 * Returns array with two elements indexed as 'note' and 'change'
 * @param string  $p_field_name The field name of the field being localized.
 * @param integer $p_type       The type of the history entry.
 * @param string  $p_old_value  The old value of the field.
 * @param string  $p_new_value  The new value of the field.
 * @param boolean $p_linkify    Whether to return a string containing hyperlinks.
 * @return array
 */
function history_localize_item($p_field_name, $p_type, $p_old_value, $p_new_value, $p_linkify = true)
{
    $t_note = '';
    $t_change = '';
    $t_field_localized = $p_field_name;
    $t_raw = true;
    if (PLUGIN_HISTORY == $p_type) {
        $t_note = lang_get_defaulted('plugin_' . $p_field_name, $p_field_name);
        $t_change = isset($p_new_value) ? $p_old_value . ' => ' . $p_new_value : $p_old_value;
        return array('note' => $t_note, 'change' => $t_change, 'raw' => true);
    }
    switch ($p_field_name) {
        case 'category':
            $t_field_localized = lang_get('category');
            break;
        case 'status':
            $p_old_value = get_enum_element('status', $p_old_value);
            $p_new_value = get_enum_element('status', $p_new_value);
            $t_field_localized = lang_get('status');
            break;
        case 'severity':
            $p_old_value = get_enum_element('severity', $p_old_value);
            $p_new_value = get_enum_element('severity', $p_new_value);
            $t_field_localized = lang_get('severity');
            break;
        case 'reproducibility':
            $p_old_value = get_enum_element('reproducibility', $p_old_value);
            $p_new_value = get_enum_element('reproducibility', $p_new_value);
            $t_field_localized = lang_get('reproducibility');
            break;
        case 'resolution':
            $p_old_value = get_enum_element('resolution', $p_old_value);
            $p_new_value = get_enum_element('resolution', $p_new_value);
            $t_field_localized = lang_get('resolution');
            break;
        case 'priority':
            $p_old_value = get_enum_element('priority', $p_old_value);
            $p_new_value = get_enum_element('priority', $p_new_value);
            $t_field_localized = lang_get('priority');
            break;
        case 'eta':
            $p_old_value = get_enum_element('eta', $p_old_value);
            $p_new_value = get_enum_element('eta', $p_new_value);
            $t_field_localized = lang_get('eta');
            break;
        case 'view_state':
            $p_old_value = get_enum_element('view_state', $p_old_value);
            $p_new_value = get_enum_element('view_state', $p_new_value);
            $t_field_localized = lang_get('view_status');
            break;
        case 'projection':
            $p_old_value = get_enum_element('projection', $p_old_value);
            $p_new_value = get_enum_element('projection', $p_new_value);
            $t_field_localized = lang_get('projection');
            break;
        case 'sticky':
            $p_old_value = gpc_string_to_bool($p_old_value) ? lang_get('yes') : lang_get('no');
            $p_new_value = gpc_string_to_bool($p_new_value) ? lang_get('yes') : lang_get('no');
            $t_field_localized = lang_get('sticky_issue');
            break;
        case 'project_id':
            if (project_exists($p_old_value)) {
                $p_old_value = project_get_field($p_old_value, 'name');
            } else {
                $p_old_value = '@' . $p_old_value . '@';
            }
            # Note that the new value maybe an intermediately project and not the
            # current one.
            if (project_exists($p_new_value)) {
                $p_new_value = project_get_field($p_new_value, 'name');
            } else {
                $p_new_value = '@' . $p_new_value . '@';
            }
            $t_field_localized = lang_get('email_project');
            break;
        case 'handler_id':
            $t_field_localized = lang_get('assigned_to');
        case 'reporter_id':
            if ('reporter_id' == $p_field_name) {
                $t_field_localized = lang_get('reporter');
            }
            if (0 == $p_old_value) {
                $p_old_value = '';
            } else {
                $p_old_value = user_get_name($p_old_value);
            }
            if (0 == $p_new_value) {
                $p_new_value = '';
            } else {
                $p_new_value = user_get_name($p_new_value);
            }
            break;
        case 'version':
            $t_field_localized = lang_get('product_version');
            break;
        case 'fixed_in_version':
            $t_field_localized = lang_get('fixed_in_version');
            break;
        case 'target_version':
            $t_field_localized = lang_get('target_version');
            break;
        case 'date_submitted':
            $p_old_value = date(config_get('normal_date_format'), $p_old_value);
            $p_new_value = date(config_get('normal_date_format'), $p_new_value);
            $t_field_localized = lang_get('date_submitted');
            break;
        case 'last_updated':
            $p_old_value = date(config_get('normal_date_format'), $p_old_value);
            $p_new_value = date(config_get('normal_date_format'), $p_new_value);
            $t_field_localized = lang_get('last_update');
            break;
        case 'os':
            $t_field_localized = lang_get('os');
            break;
        case 'os_build':
            $t_field_localized = lang_get('os_version');
            break;
        case 'build':
            $t_field_localized = lang_get('build');
            break;
        case 'platform':
            $t_field_localized = lang_get('platform');
            break;
        case 'summary':
            $t_field_localized = lang_get('summary');
            break;
        case 'duplicate_id':
            $t_field_localized = lang_get('duplicate_id');
            break;
        case 'sponsorship_total':
            $t_field_localized = lang_get('sponsorship_total');
            break;
        case 'due_date':
            if ($p_old_value !== '') {
                $p_old_value = date(config_get('normal_date_format'), (int) $p_old_value);
            }
            if ($p_new_value !== '') {
                $p_new_value = date(config_get('normal_date_format'), (int) $p_new_value);
            }
            $t_field_localized = lang_get('due_date');
            break;
        default:
            # assume it's a custom field name
            $t_field_id = custom_field_get_id_from_name($p_field_name);
            if (false !== $t_field_id) {
                $t_cf_type = custom_field_type($t_field_id);
                if ('' != $p_old_value) {
                    $p_old_value = string_custom_field_value_for_email($p_old_value, $t_cf_type);
                }
                $p_new_value = string_custom_field_value_for_email($p_new_value, $t_cf_type);
                $t_field_localized = lang_get_defaulted($p_field_name);
            }
    }
    if (NORMAL_TYPE != $p_type) {
        switch ($p_type) {
            case NEW_BUG:
                $t_note = lang_get('new_bug');
                break;
            case BUGNOTE_ADDED:
                $t_note = lang_get('bugnote_added') . ': ' . $p_old_value;
                break;
            case BUGNOTE_UPDATED:
                $t_note = lang_get('bugnote_edited') . ': ' . $p_old_value;
                $t_old_value = (int) $p_old_value;
                $t_new_value = (int) $p_new_value;
                if ($p_linkify && bug_revision_exists($t_new_value)) {
                    if (bugnote_exists($t_old_value)) {
                        $t_bug_revision_view_page_argument = 'bugnote_id=' . $t_old_value . '#r' . $t_new_value;
                    } else {
                        $t_bug_revision_view_page_argument = 'rev_id=' . $t_new_value;
                    }
                    $t_change = '<a href="bug_revision_view_page.php?' . $t_bug_revision_view_page_argument . '">' . lang_get('view_revisions') . '</a>';
                    $t_raw = false;
                }
                break;
            case BUGNOTE_DELETED:
                $t_note = lang_get('bugnote_deleted') . ': ' . $p_old_value;
                break;
            case DESCRIPTION_UPDATED:
                $t_note = lang_get('description_updated');
                $t_old_value = (int) $p_old_value;
                if ($p_linkify && bug_revision_exists($t_old_value)) {
                    $t_change = '<a href="bug_revision_view_page.php?rev_id=' . $t_old_value . '#r' . $t_old_value . '">' . lang_get('view_revisions') . '</a>';
                    $t_raw = false;
                }
                break;
            case ADDITIONAL_INFO_UPDATED:
                $t_note = lang_get('additional_information_updated');
                $t_old_value = (int) $p_old_value;
                if ($p_linkify && bug_revision_exists($t_old_value)) {
                    $t_change = '<a href="bug_revision_view_page.php?rev_id=' . $t_old_value . '#r' . $t_old_value . '">' . lang_get('view_revisions') . '</a>';
                    $t_raw = false;
                }
                break;
            case STEP_TO_REPRODUCE_UPDATED:
                $t_note = lang_get('steps_to_reproduce_updated');
                $t_old_value = (int) $p_old_value;
                if ($p_linkify && bug_revision_exists($t_old_value)) {
                    $t_change = '<a href="bug_revision_view_page.php?rev_id=' . $t_old_value . '#r' . $t_old_value . '">' . lang_get('view_revisions') . '</a>';
                    $t_raw = false;
                }
                break;
            case FILE_ADDED:
                $t_note = lang_get('file_added') . ': ' . $p_old_value;
                break;
            case FILE_DELETED:
                $t_note = lang_get('file_deleted') . ': ' . $p_old_value;
                break;
            case BUGNOTE_STATE_CHANGED:
                $p_old_value = get_enum_element('view_state', $p_old_value);
                $t_note = lang_get('bugnote_view_state') . ': ' . $p_new_value . ': ' . $p_old_value;
                break;
            case BUG_MONITOR:
                $p_old_value = user_get_name($p_old_value);
                $t_note = lang_get('bug_monitor') . ': ' . $p_old_value;
                break;
            case BUG_UNMONITOR:
                if ($p_old_value !== '') {
                    $p_old_value = user_get_name($p_old_value);
                }
                $t_note = lang_get('bug_end_monitor') . ': ' . $p_old_value;
                break;
            case BUG_DELETED:
                $t_note = lang_get('bug_deleted') . ': ' . $p_old_value;
                break;
            case BUG_ADD_SPONSORSHIP:
                $t_note = lang_get('sponsorship_added');
                $t_change = user_get_name($p_old_value) . ': ' . sponsorship_format_amount($p_new_value);
                break;
            case BUG_UPDATE_SPONSORSHIP:
                $t_note = lang_get('sponsorship_updated');
                $t_change = user_get_name($p_old_value) . ': ' . sponsorship_format_amount($p_new_value);
                break;
            case BUG_DELETE_SPONSORSHIP:
                $t_note = lang_get('sponsorship_deleted');
                $t_change = user_get_name($p_old_value) . ': ' . sponsorship_format_amount($p_new_value);
                break;
            case BUG_PAID_SPONSORSHIP:
                $t_note = lang_get('sponsorship_paid');
                $t_change = user_get_name($p_old_value) . ': ' . get_enum_element('sponsorship', $p_new_value);
                break;
            case BUG_ADD_RELATIONSHIP:
                $t_note = lang_get('relationship_added');
                $t_change = relationship_get_description_for_history($p_old_value) . ' ' . bug_format_id($p_new_value);
                break;
            case BUG_REPLACE_RELATIONSHIP:
                $t_note = lang_get('relationship_replaced');
                $t_change = relationship_get_description_for_history($p_old_value) . ' ' . bug_format_id($p_new_value);
                break;
            case BUG_DEL_RELATIONSHIP:
                $t_note = lang_get('relationship_deleted');
                # Fix for #7846: There are some cases where old value is empty, this may be due to an old bug.
                if (!is_blank($p_old_value) && $p_old_value > 0) {
                    $t_change = relationship_get_description_for_history($p_old_value) . ' ' . bug_format_id($p_new_value);
                } else {
                    $t_change = bug_format_id($p_new_value);
                }
                break;
            case BUG_CLONED_TO:
                $t_note = lang_get('bug_cloned_to') . ': ' . bug_format_id($p_new_value);
                break;
            case BUG_CREATED_FROM:
                $t_note = lang_get('bug_created_from') . ': ' . bug_format_id($p_new_value);
                break;
            case TAG_ATTACHED:
                $t_note = lang_get('tag_history_attached') . ': ' . $p_old_value;
                break;
            case TAG_DETACHED:
                $t_note = lang_get('tag_history_detached') . ': ' . $p_old_value;
                break;
            case TAG_RENAMED:
                $t_note = lang_get('tag_history_renamed');
                $t_change = $p_old_value . ' => ' . $p_new_value;
                break;
            case BUG_REVISION_DROPPED:
                $t_note = lang_get('bug_revision_dropped_history') . ': ' . bug_revision_get_type_name($p_new_value) . ': ' . $p_old_value;
                break;
            case BUGNOTE_REVISION_DROPPED:
                $t_note = lang_get('bugnote_revision_dropped_history') . ': ' . $p_new_value . ': ' . $p_old_value;
                break;
        }
    }
    # output special cases
    if (NORMAL_TYPE == $p_type) {
        $t_note = $t_field_localized;
        $t_change = $p_old_value . ' => ' . $p_new_value;
    }
    # end if DEFAULT
    return array('note' => $t_note, 'change' => $t_change, 'raw' => $t_raw);
}
コード例 #20
0
/**
 * remap a field name to a string name (for sort filter)
 */
function string_get_field_name($p_string)
{
    $t_map = array('last_updated' => 'last_update', 'id' => 'email_bug');
    $t_string = $p_string;
    if (isset($t_map[$p_string])) {
        $t_string = $t_map[$p_string];
    }
    return lang_get_defaulted($t_string);
}
コード例 #21
0
ファイル: custom_function_api.php プロジェクト: gtn/mantisbt
/**
 * Print the title of a column given its name.
 *
 * @param string  $p_column         Custom_xxx for custom field xxx, or otherwise field name as in bug table.
 * @param integer $p_columns_target See COLUMNS_TARGET_* in constant_inc.php.
 * @return void
 */
function custom_function_default_print_column_title($p_column, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    global $t_sort, $t_dir;
    $t_custom_field = column_get_custom_field_name($p_column);
    if ($t_custom_field !== null) {
        if (COLUMNS_TARGET_CSV_PAGE != $p_columns_target) {
            echo '<th class="column-custom-' . $t_custom_field . '">';
        }
        $t_field_id = custom_field_get_id_from_name($t_custom_field);
        if ($t_field_id === false) {
            echo '@', $t_custom_field, '@';
        } else {
            $t_def = custom_field_get_definition($t_field_id);
            $t_custom_field = lang_get_defaulted($t_def['name']);
            if (COLUMNS_TARGET_CSV_PAGE != $p_columns_target) {
                print_view_bug_sort_link($t_custom_field, $p_column, $t_sort, $t_dir, $p_columns_target);
                print_sort_icon($t_dir, $t_sort, $p_column);
            } else {
                echo $t_custom_field;
            }
        }
        if (COLUMNS_TARGET_CSV_PAGE != $p_columns_target) {
            echo '</th>';
        }
    } else {
        $t_plugin_columns = columns_get_plugin_columns();
        $t_function = 'print_column_title_' . $p_column;
        if (function_exists($t_function)) {
            $t_function($t_sort, $t_dir, $p_columns_target);
        } else {
            if (isset($t_plugin_columns[$p_column])) {
                $t_column_object = $t_plugin_columns[$p_column];
                print_column_title_plugin($p_column, $t_column_object, $t_sort, $t_dir, $p_columns_target);
            } else {
                echo '<th>';
                print_view_bug_sort_link(column_get_title($p_column), $p_column, $t_sort, $t_dir, $p_columns_target);
                print_sort_icon($t_dir, $t_sort, $p_column);
                echo '</th>';
            }
        }
    }
}
コード例 #22
0
/**
 * Build the bug info part of the message
 * @param array $p_visible_bug_data
 * @return string
 */
function email_format_bug_message($p_visible_bug_data)
{
    $t_normal_date_format = config_get('normal_date_format');
    $t_complete_date_format = config_get('complete_date_format');
    $t_email_separator1 = config_get('email_separator1');
    $t_email_separator2 = config_get('email_separator2');
    $t_email_padding_length = config_get('email_padding_length');
    $t_status = $p_visible_bug_data['email_status'];
    $p_visible_bug_data['email_date_submitted'] = date($t_complete_date_format, $p_visible_bug_data['email_date_submitted']);
    $p_visible_bug_data['email_last_modified'] = date($t_complete_date_format, $p_visible_bug_data['email_last_modified']);
    $p_visible_bug_data['email_status'] = get_enum_element('status', $t_status);
    $p_visible_bug_data['email_severity'] = get_enum_element('severity', $p_visible_bug_data['email_severity']);
    $p_visible_bug_data['email_priority'] = get_enum_element('priority', $p_visible_bug_data['email_priority']);
    $p_visible_bug_data['email_reproducibility'] = get_enum_element('reproducibility', $p_visible_bug_data['email_reproducibility']);
    $t_message = $t_email_separator1 . " \n";
    if (isset($p_visible_bug_data['email_bug_view_url'])) {
        $t_message .= $p_visible_bug_data['email_bug_view_url'] . " \n";
        $t_message .= $t_email_separator1 . " \n";
    }
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_reporter');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_handler');
    $t_message .= $t_email_separator1 . " \n";
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_project');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_bug');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_category');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_reproducibility');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_severity');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_priority');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_status');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_target_version');
    # custom fields formatting
    foreach ($p_visible_bug_data['custom_fields'] as $t_custom_field_name => $t_custom_field_data) {
        $t_message .= utf8_str_pad(lang_get_defaulted($t_custom_field_name, null) . ': ', $t_email_padding_length, ' ', STR_PAD_RIGHT);
        $t_message .= string_custom_field_value_for_email($t_custom_field_data['value'], $t_custom_field_data['type']);
        $t_message .= " \n";
    }
    # end foreach custom field
    if (config_get('bug_resolved_status_threshold') <= $t_status) {
        $p_visible_bug_data['email_resolution'] = get_enum_element('resolution', $p_visible_bug_data['email_resolution']);
        $t_message .= email_format_attribute($p_visible_bug_data, 'email_resolution');
        $t_message .= email_format_attribute($p_visible_bug_data, 'email_fixed_in_version');
    }
    $t_message .= $t_email_separator1 . " \n";
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_date_submitted');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_last_modified');
    $t_message .= $t_email_separator1 . " \n";
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_summary');
    $t_message .= lang_get('email_description') . ": \n" . $p_visible_bug_data['email_description'] . "\n";
    if (!is_blank($p_visible_bug_data['email_steps_to_reproduce'])) {
        $t_message .= "\n" . lang_get('email_steps_to_reproduce') . ": \n" . $p_visible_bug_data['email_steps_to_reproduce'] . "\n";
    }
    if (!is_blank($p_visible_bug_data['email_additional_information'])) {
        $t_message .= "\n" . lang_get('email_additional_information') . ": \n" . $p_visible_bug_data['email_additional_information'] . "\n";
    }
    if (isset($p_visible_bug_data['relations'])) {
        if ($p_visible_bug_data['relations'] != '') {
            $t_message .= $t_email_separator1 . "\n" . str_pad(lang_get('bug_relationships'), 20) . str_pad(lang_get('id'), 8) . lang_get('summary') . "\n" . $t_email_separator2 . "\n" . $p_visible_bug_data['relations'];
        }
    }
    # Sponsorship
    if (isset($p_visible_bug_data['sponsorship_total']) && $p_visible_bug_data['sponsorship_total'] > 0) {
        $t_message .= $t_email_separator1 . " \n";
        $t_message .= sprintf(lang_get('total_sponsorship_amount'), sponsorship_format_amount($p_visible_bug_data['sponsorship_total'])) . "\n" . "\n";
        if (isset($p_visible_bug_data['sponsorships'])) {
            foreach ($p_visible_bug_data['sponsorships'] as $t_sponsorship) {
                $t_date_added = date(config_get('normal_date_format'), $t_sponsorship->date_submitted);
                $t_message .= $t_date_added . ': ';
                $t_message .= user_get_name($t_sponsorship->user_id);
                $t_message .= ' (' . sponsorship_format_amount($t_sponsorship->amount) . ')' . " \n";
            }
        }
    }
    $t_message .= $t_email_separator1 . " \n\n";
    # format bugnotes
    foreach ($p_visible_bug_data['bugnotes'] as $t_bugnote) {
        $t_last_modified = date($t_normal_date_format, $t_bugnote->last_modified);
        $t_formatted_bugnote_id = bugnote_format_id($t_bugnote->id);
        $t_bugnote_link = string_process_bugnote_link(config_get('bugnote_link_tag') . $t_bugnote->id, false, false, true);
        if ($t_bugnote->time_tracking > 0) {
            $t_time_tracking = ' ' . lang_get('time_tracking') . ' ' . db_minutes_to_hhmm($t_bugnote->time_tracking) . "\n";
        } else {
            $t_time_tracking = '';
        }
        if (user_exists($t_bugnote->reporter_id)) {
            $t_access_level = access_get_project_level($p_visible_bug_data['email_project_id'], $t_bugnote->reporter_id);
            $t_access_level_string = ' (' . get_enum_element('access_levels', $t_access_level) . ') - ';
        } else {
            $t_access_level_string = '';
        }
        $t_string = ' (' . $t_formatted_bugnote_id . ') ' . user_get_name($t_bugnote->reporter_id) . $t_access_level_string . $t_last_modified . "\n" . $t_time_tracking . ' ' . $t_bugnote_link;
        $t_message .= $t_email_separator2 . " \n";
        $t_message .= $t_string . " \n";
        $t_message .= $t_email_separator2 . " \n";
        $t_message .= $t_bugnote->note . " \n\n";
    }
    # format history
    if (array_key_exists('history', $p_visible_bug_data)) {
        $t_message .= lang_get('bug_history') . " \n";
        $t_message .= utf8_str_pad(lang_get('date_modified'), 17) . utf8_str_pad(lang_get('username'), 15) . utf8_str_pad(lang_get('field'), 25) . utf8_str_pad(lang_get('change'), 20) . " \n";
        $t_message .= $t_email_separator1 . " \n";
        foreach ($p_visible_bug_data['history'] as $t_raw_history_item) {
            $t_localized_item = history_localize_item($t_raw_history_item['field'], $t_raw_history_item['type'], $t_raw_history_item['old_value'], $t_raw_history_item['new_value'], false);
            $t_message .= utf8_str_pad(date($t_normal_date_format, $t_raw_history_item['date']), 17) . utf8_str_pad($t_raw_history_item['username'], 15) . utf8_str_pad($t_localized_item['note'], 25) . utf8_str_pad($t_localized_item['change'], 20) . "\n";
        }
        $t_message .= $t_email_separator1 . " \n\n";
    }
    return $t_message;
}
コード例 #23
0
/**
 * Get a list of bug group actions available to the current user for one or
 * more projects.
 * @param array $p_project_ids An array containing one or more project IDs.
 * @return array
 */
function bug_group_action_get_commands(array $p_project_ids = null)
{
    if ($p_project_ids === null || count($p_project_ids) == 0) {
        $p_project_ids = array(ALL_PROJECTS);
    }
    $t_commands = array();
    foreach ($p_project_ids as $t_project_id) {
        if (!isset($t_commands['MOVE']) && access_has_project_level(config_get('move_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['MOVE'] = lang_get('actiongroup_menu_move');
        }
        if (!isset($t_commands['COPY']) && access_has_any_project(config_get('report_bug_threshold', null, null, $t_project_id))) {
            $t_commands['COPY'] = lang_get('actiongroup_menu_copy');
        }
        if (!isset($t_commands['ASSIGN']) && access_has_project_level(config_get('update_bug_assign_threshold', null, null, $t_project_id), $t_project_id)) {
            if (ON == config_get('auto_set_status_to_assigned', null, null, $t_project_id) && access_has_project_level(access_get_status_threshold(config_get('bug_assigned_status', null, null, $t_project_id), $t_project_id), $t_project_id)) {
                $t_commands['ASSIGN'] = lang_get('actiongroup_menu_assign');
            } else {
                $t_commands['ASSIGN'] = lang_get('actiongroup_menu_assign');
            }
        }
        if (!isset($t_commands['CLOSE']) && access_has_project_level(config_get('update_bug_status_threshold', null, null, $t_project_id), $t_project_id) && (access_has_project_level(access_get_status_threshold(config_get('bug_closed_status_threshold', null, null, $t_project_id), $t_project_id), $t_project_id) || access_has_project_level(config_get('allow_reporter_close', null, null, $t_project_id), $t_project_id))) {
            $t_commands['CLOSE'] = lang_get('actiongroup_menu_close');
        }
        if (!isset($t_commands['DELETE']) && access_has_project_level(config_get('delete_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['DELETE'] = lang_get('actiongroup_menu_delete');
        }
        if (!isset($t_commands['RESOLVE']) && access_has_project_level(config_get('update_bug_status_threshold', null, null, $t_project_id), $t_project_id) && access_has_project_level(access_get_status_threshold(config_get('bug_resolved_status_threshold', null, null, $t_project_id), $t_project_id), $t_project_id)) {
            $t_commands['RESOLVE'] = lang_get('actiongroup_menu_resolve');
        }
        if (!isset($t_commands['SET_STICKY']) && access_has_project_level(config_get('set_bug_sticky_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['SET_STICKY'] = lang_get('actiongroup_menu_set_sticky');
        }
        if (!isset($t_commands['UP_PRIOR']) && access_has_project_level(config_get('update_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['UP_PRIOR'] = lang_get('actiongroup_menu_update_priority');
        }
        if (!isset($t_commands['EXT_UPDATE_SEVERITY']) && access_has_project_level(config_get('update_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['EXT_UPDATE_SEVERITY'] = lang_get('actiongroup_menu_update_severity');
        }
        if (!isset($t_commands['UP_STATUS']) && access_has_project_level(config_get('update_bug_status_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['UP_STATUS'] = lang_get('actiongroup_menu_update_status');
        }
        if (!isset($t_commands['UP_CATEGORY']) && access_has_project_level(config_get('update_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['UP_CATEGORY'] = lang_get('actiongroup_menu_update_category');
        }
        if (!isset($t_commands['VIEW_STATUS']) && access_has_project_level(config_get('change_view_status_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['VIEW_STATUS'] = lang_get('actiongroup_menu_update_view_status');
        }
        if (!isset($t_commands['EXT_UPDATE_PRODUCT_BUILD']) && config_get('enable_product_build', null, null, $t_project_id) == ON && access_has_project_level(config_get('update_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['EXT_UPDATE_PRODUCT_BUILD'] = lang_get('actiongroup_menu_update_product_build');
        }
        if (!isset($t_commands['EXT_ADD_NOTE']) && access_has_project_level(config_get('add_bugnote_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['EXT_ADD_NOTE'] = lang_get('actiongroup_menu_add_note');
        }
        if (!isset($t_commands['EXT_ATTACH_TAGS']) && access_has_project_level(config_get('tag_attach_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['EXT_ATTACH_TAGS'] = lang_get('actiongroup_menu_attach_tags');
        }
        if (!isset($t_commands['UP_FIXED_IN_VERSION']) && version_should_show_product_version($t_project_id) && access_has_project_level(config_get('update_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['UP_FIXED_IN_VERSION'] = lang_get('actiongroup_menu_update_fixed_in_version');
        }
        if (!isset($t_commands['UP_TARGET_VERSION']) && version_should_show_product_version($t_project_id) && access_has_project_level(config_get('roadmap_update_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['UP_TARGET_VERSION'] = lang_get('actiongroup_menu_update_target_version');
        }
        $t_custom_field_ids = custom_field_get_linked_ids($t_project_id);
        foreach ($t_custom_field_ids as $t_custom_field_id) {
            if (!custom_field_has_write_access_to_project($t_custom_field_id, $t_project_id)) {
                continue;
            }
            $t_custom_field_def = custom_field_get_definition($t_custom_field_id);
            $t_command_id = 'custom_field_' . $t_custom_field_id;
            $t_command_caption = sprintf(lang_get('actiongroup_menu_update_field'), lang_get_defaulted($t_custom_field_def['name']));
            $t_commands[$t_command_id] = string_display($t_command_caption);
        }
    }
    $t_custom_group_actions = config_get('custom_group_actions');
    foreach ($t_custom_group_actions as $t_custom_group_action) {
        # use label if provided to get the localized text, otherwise fallback to action name.
        if (isset($t_custom_group_action['label'])) {
            $t_commands[$t_custom_group_action['action']] = lang_get_defaulted($t_custom_group_action['label']);
        } else {
            $t_commands[$t_custom_group_action['action']] = lang_get_defaulted($t_custom_group_action['action']);
        }
    }
    return $t_commands;
}
コード例 #24
0
ファイル: bug_view_inc.php プロジェクト: nextgens/mantisbt
    echo '</td></tr>';
}
# spacer
echo '<tr class="spacer"><td colspan="6"></td></tr>';
# Custom Fields
$t_custom_fields_found = false;
$t_related_custom_field_ids = custom_field_get_linked_ids($tpl_bug->project_id);
foreach ($t_related_custom_field_ids as $t_id) {
    if (!custom_field_has_read_access($t_id, $f_bug_id)) {
        continue;
    }
    # has read access
    $t_custom_fields_found = true;
    $t_def = custom_field_get_definition($t_id);
    echo '<tr ', helper_alternate_class(), '>';
    echo '<th class="bug-custom-field category">', string_display(lang_get_defaulted($t_def['name'])), '</th>';
    echo '<td class="bug-custom-field" colspan="5">';
    print_custom_field_value($t_def, $t_id, $f_bug_id);
    echo '</td></tr>';
}
if ($t_custom_fields_found) {
    # spacer
    echo '<tr class="spacer"><td colspan="6"></td></tr>';
}
# custom fields found
# Attachments
if ($tpl_show_attachments) {
    echo '<tr id="attachments" ', helper_alternate_class(), '>';
    echo '<th class="bug-attachments category">', lang_get('attached_files'), '</th>';
    echo '<td class="bug-attachments" colspan="5">';
    print_bug_attachments_list($tpl_bug_id);
コード例 #25
0
ファイル: bug_report.php プロジェクト: fur81/zofaxiopeu
        $t_file['tmp_name'] = $f_files['tmp_name'][$i];
        $t_file['type'] = $f_files['type'][$i];
        $t_file['error'] = $f_files['error'][$i];
        $t_file['size'] = $f_files['size'][$i];
        file_add($t_bug_id, $t_file, 'bug');
    }
}
# Handle custom field submission
foreach ($t_related_custom_field_ids as $t_id) {
    # Do not set custom field value if user has no write access
    if (!custom_field_has_write_access($t_id, $t_bug_id)) {
        continue;
    }
    $t_def = custom_field_get_definition($t_id);
    if (!custom_field_set_value($t_id, $t_bug_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], $t_def['default_value']), false)) {
        error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
        trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
    }
}
$f_master_bug_id = gpc_get_int('m_id', 0);
$f_rel_type = gpc_get_int('rel_type', -1);
if ($f_master_bug_id > 0) {
    # it's a child generation... let's create the relationship and add some lines in the history
    # update master bug last updated
    bug_update_date($f_master_bug_id);
    # Add log line to record the cloning action
    history_log_event_special($t_bug_id, BUG_CREATED_FROM, '', $f_master_bug_id);
    history_log_event_special($f_master_bug_id, BUG_CLONED_TO, '', $t_bug_id);
    if ($f_rel_type >= 0) {
        # Add the relationship
        relationship_add($t_bug_id, $f_master_bug_id, $f_rel_type);
コード例 #26
0
ファイル: string_api.php プロジェクト: derrickweaver/mantisbt
/**
 * remap a field name to a string name (for sort filter)
 * @param string $p_string The string to process.
 * @return string
 */
function string_get_field_name($p_string)
{
    $t_map = array('attachment_count' => 'attachments', 'category_id' => 'category', 'handler_id' => 'assigned_to', 'id' => 'email_bug', 'last_updated' => 'updated', 'project_id' => 'email_project', 'reporter_id' => 'reporter', 'view_state' => 'view_status');
    $t_string = $p_string;
    if (isset($t_map[$p_string])) {
        $t_string = $t_map[$p_string];
    }
    return lang_get_defaulted($t_string);
}
コード例 #27
0
			<?php 
        }
        ?>
			<?php 
        if ($t_def['type'] != CUSTOM_FIELD_TYPE_RADIO && $t_def['type'] != CUSTOM_FIELD_TYPE_CHECKBOX) {
            ?>
				<label for="custom_field_<?php 
            echo string_attribute($t_def['id']);
            ?>
"><?php 
            echo string_display(lang_get_defaulted($t_def['name']));
            ?>
</label>
			<?php 
        } else {
            echo string_display(lang_get_defaulted($t_def['name']));
        }
        ?>
		</th>
		<td>
			<?php 
        print_custom_field_input($t_def, $f_master_bug_id === 0 ? null : $f_master_bug_id);
        ?>
		</td>
	</tr>
<?php 
    }
}
# foreach( $t_related_custom_field_ids as $t_id )
# File Upload (if enabled)
if ($t_show_attachments) {
コード例 #28
0
function graph_bydate($p_metrics, $p_labels, $p_title, $p_graph_width = 300, $p_graph_height = 380)
{
    $t_graph_font = graph_get_font();
    error_check(is_array($p_metrics) ? count($p_metrics) : 0, lang_get('by_date'));
    $graph = new Graph($p_graph_width, $p_graph_height);
    $graph->img->SetMargin(40, 140, 40, 100);
    if (ON == config_get_global('jpgraph_antialias')) {
        $graph->img->SetAntiAliasing();
    }
    $graph->SetScale('linlin');
    $graph->SetMarginColor('white');
    $graph->SetFrame(false);
    $graph->title->Set($p_title . ' ' . lang_get('by_date'));
    $graph->title->SetFont($t_graph_font, FS_BOLD);
    $graph->legend->Pos(0.01, 0.05, 'right', 'top');
    $graph->legend->SetShadow(false);
    $graph->legend->SetFillColor('white');
    $graph->legend->SetLayout(LEGEND_VERT);
    $graph->legend->SetFont($t_graph_font);
    $graph->yaxis->scale->ticks->SetDirection(-1);
    $graph->yaxis->SetFont($t_graph_font);
    $graph->yaxis->scale->SetAutoMin(0);
    if (FF_FONT2 <= $t_graph_font) {
        $graph->xaxis->SetLabelAngle(60);
    } else {
        $graph->xaxis->SetLabelAngle(90);
        # can't rotate non truetype fonts
    }
    $graph->xaxis->SetLabelFormatCallback('graph_date_format');
    $graph->xaxis->SetFont($t_graph_font);
    $t_line_colours = config_get('graph_colors');
    $t_count_colours = count($t_line_colours);
    $t_lines = count($p_metrics) - 1;
    $t_line = array();
    for ($i = 1; $i <= $t_lines; $i++) {
        $t_line[$i] = new LinePlot($p_metrics[$i], $p_metrics[0]);
        $t_line[$i]->SetColor($t_line_colours[$i % $t_count_colours]);
        $t_line[$i]->SetCenter();
        $t_line[$i]->SetLegend(lang_get_defaulted($p_labels[$i]));
        $graph->Add($t_line[$i]);
    }
    if (helper_show_queries()) {
        $graph->subtitle->Set(db_count_queries() . ' queries (' . db_count_unique_queries() . ' unique) (' . db_time_queries() . 'sec)');
        $graph->subtitle->SetFont($t_graph_font, FS_NORMAL, 8);
    }
    $graph->Stroke();
}
コード例 #29
0
ファイル: columns_api.php プロジェクト: N0ctrnl/mantisbt
/**
 * Gets the localized title for the specified column.  The column can be native or custom.
 * The custom fields must contain the 'custom_' prefix.
 *
 * @param string $p_column - The column name.
 * @return string The column localized name.
 * @access public
 */
function column_get_title($p_column)
{
    $t_custom_field = column_get_custom_field_name($p_column);
    if ($t_custom_field !== null) {
        $t_field_id = custom_field_get_id_from_name($t_custom_field);
        if ($t_field_id === false) {
            $t_custom_field = '@' . $t_custom_field . '@';
        } else {
            $t_def = custom_field_get_definition($t_field_id);
            $t_custom_field = lang_get_defaulted($t_def['name']);
        }
        return $t_custom_field;
    }
    $t_plugin_columns = columns_get_plugin_columns();
    if (isset($t_plugin_columns[$p_column])) {
        $t_column_object = $t_plugin_columns[$p_column];
        return $t_column_object->title;
    }
    switch ($p_column) {
        case 'attachment_count':
            return lang_get('attachments');
        case 'bugnotes_count':
            return '#';
        case 'category_id':
            return lang_get('category');
        case 'edit':
            return '';
        case 'handler_id':
            return lang_get('assigned_to');
        case 'last_updated':
            return lang_get('updated');
        case 'os_build':
            return lang_get('os_version');
        case 'project_id':
            return lang_get('email_project');
        case 'reporter_id':
            return lang_get('reporter');
        case 'selection':
            return '';
        case 'sponsorship_total':
            return sponsorship_get_currency();
        case 'version':
            return lang_get('product_version');
        case 'view_state':
            return lang_get('view_status');
        default:
            return lang_get_defaulted($p_column);
    }
}
コード例 #30
0
	<form method="post" action="manage_proj_custom_field_add_existing.php">
		<fieldset>
			<?php 
        echo form_security_field('manage_proj_custom_field_add_existing');
        ?>
			<input type="hidden" name="project_id" value="<?php 
        echo $f_project_id;
        ?>
" />
			<select name="field_id">
				<?php 
        $t_custom_fields = custom_field_get_ids();
        foreach ($t_custom_fields as $t_field_id) {
            if (!custom_field_is_linked($t_field_id, $f_project_id)) {
                $t_desc = custom_field_get_definition($t_field_id);
                echo '<option value="' . $t_field_id . '">' . string_attribute(lang_get_defaulted($t_desc['name'])) . '</option>';
            }
        }
        ?>
			</select>
			<input type="submit" class="button" value="<?php 
        echo lang_get('add_existing_custom_field');
        ?>
" />
		</fieldset>
	</form><?php 
    }
    ?>
</div><?php 
}
event_signal('EVENT_MANAGE_PROJECT_PAGE', array($f_project_id));