Exemple #1
0
function print_build_option_list($p_build = '')
{
    $t_bug_table = db_get_table('bug');
    $t_overall_build_arr = array();
    $t_project_id = helper_get_current_project();
    $t_project_where = helper_project_specific_where($t_project_id);
    # Get the "found in" build list
    $query = "SELECT DISTINCT build\n\t\t\t\tFROM {$t_bug_table}\n\t\t\t\tWHERE {$t_project_where}\n\t\t\t\tORDER BY build DESC";
    $result = db_query_bound($query);
    $option_count = db_num_rows($result);
    for ($i = 0; $i < $option_count; $i++) {
        $row = db_fetch_array($result);
        $t_overall_build_arr[] = $row['build'];
    }
    $t_max_length = config_get('max_dropdown_length');
    foreach ($t_overall_build_arr as $t_build_unescaped) {
        $t_build = string_attribute($t_build_unescaped);
        echo "<option value=\"{$t_build}\"";
        check_selected($p_build, $t_build_unescaped);
        echo ">" . string_shorten($t_build, $t_max_length) . "</option>";
    }
}
Exemple #2
0
/**
 * print custom fields
 * @param integer $p_field_id Custom field identifier.
 * @return void
 */
function print_filter_custom_field($p_field_id)
{
    global $g_filter, $t_accessible_custom_fields_names, $t_accessible_custom_fields_types, $t_accessible_custom_fields_values, $t_accessible_custom_fields_ids, $g_select_modifier;
    $j = array_search($p_field_id, $t_accessible_custom_fields_ids);
    if ($j === null || $j === false) {
        ?>
			<span style="color:red;font-weight:bold;">
				unknown custom filter (custom <?php 
        echo $p_field_id;
        ?>
)
			</span>
		<?php 
    } else {
        if (isset($t_accessible_custom_fields_names[$j])) {
            if ($t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_DATE) {
                print_filter_custom_field_date($j, $p_field_id);
            } else {
                if ($t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_TEXTAREA) {
                    echo '<input type="text" name="custom_field_', $p_field_id, '" size="10" value="" />';
                } else {
                    echo '<select' . $g_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
                    echo '<option value="' . META_FILTER_ANY . '"';
                    check_selected($g_filter['custom_fields'][$p_field_id], (string) META_FILTER_ANY);
                    echo '>[' . lang_get('any') . ']</option>';
                    # don't show META_FILTER_NONE for enumerated types as it's not possible for them to be blank
                    if (!in_array($t_accessible_custom_fields_types[$j], array(CUSTOM_FIELD_TYPE_ENUM, CUSTOM_FIELD_TYPE_LIST, CUSTOM_FIELD_TYPE_MULTILIST))) {
                        echo '<option value="' . META_FILTER_NONE . '"';
                        check_selected($g_filter['custom_fields'][$p_field_id], (string) META_FILTER_NONE);
                        echo '>[' . lang_get('none') . ']</option>';
                    }
                    if (is_array($t_accessible_custom_fields_values[$j])) {
                        $t_max_length = config_get('max_dropdown_length');
                        foreach ($t_accessible_custom_fields_values[$j] as $t_item) {
                            if (strtolower($t_item) !== META_FILTER_ANY && strtolower($t_item) !== META_FILTER_NONE) {
                                echo '<option value="' . string_attribute($t_item) . '"';
                                if (isset($g_filter['custom_fields'][$p_field_id])) {
                                    check_selected($g_filter['custom_fields'][$p_field_id], $t_item);
                                }
                                echo '>' . string_attribute(string_shorten($t_item, $t_max_length)) . '</option>' . "\n";
                            }
                        }
                    }
                    echo '</select>';
                }
            }
        }
    }
}
Exemple #3
0
function print_filter_custom_field($p_field_id)
{
    global $t_filter, $t_accessible_custom_fields_names, $t_accessible_custom_fields_types, $t_accessible_custom_fields_values, $t_accessible_custom_fields_ids, $t_select_modifier;
    $j = array_search($p_field_id, $t_accessible_custom_fields_ids);
    if ($j === null || $j === false) {
        # Note: Prior to PHP 4.2.0, array_search() returns NULL on failure instead of FALSE.
        ?>
			<span style="color:red;weight:bold;">
				unknown custom filter (custom <?php 
        $p_field_id;
        ?>
)
			</span>
			<?php 
    } elseif (isset($t_accessible_custom_fields_names[$j])) {
        if ($t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_DATE) {
            print_filter_custom_field_date($j, $p_field_id);
        } else {
            echo '<select ' . $t_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
            echo '<option value="' . META_FILTER_ANY . '" ';
            check_selected($t_filter['custom_fields'][$p_field_id], META_FILTER_ANY);
            echo '>[' . lang_get('any') . ']</option>';
            # don't show META_FILTER_NONE for enumerated types as it's not possible for them to be blank
            if (!in_array($t_accessible_custom_fields_types[$j], array(CUSTOM_FIELD_TYPE_ENUM, CUSTOM_FIELD_TYPE_LIST, CUSTOM_FIELD_TYPE_MULTILIST))) {
                echo '<option value="' . META_FILTER_NONE . '" ';
                check_selected($t_filter['custom_fields'][$p_field_id], META_FILTER_NONE);
                echo '>[' . lang_get('none') . ']</option>';
            }
            foreach ($t_accessible_custom_fields_values[$j] as $t_item) {
                if (strtolower($t_item) !== META_FILTER_ANY && strtolower($t_item) !== META_FILTER_NONE) {
                    echo '<option value="' . string_html_entities($t_item) . '" ';
                    if (isset($t_filter['custom_fields'][$p_field_id])) {
                        check_selected($t_filter['custom_fields'][$p_field_id], $t_item);
                    }
                    echo '>' . string_shorten($t_item) . '</option>' . "\n";
                }
            }
            echo '</select>';
        }
    }
}
Exemple #4
0
/**
 * print build option list
 * @param string $p_build The current build value.
 * @return void
 */
function print_build_option_list($p_build = '')
{
    $t_overall_build_arr = array();
    $t_project_id = helper_get_current_project();
    $t_project_where = helper_project_specific_where($t_project_id);
    # Get the "found in" build list
    $t_query = 'SELECT DISTINCT build
				FROM {bug}
				WHERE ' . $t_project_where . '
				ORDER BY build DESC';
    $t_result = db_query($t_query);
    while ($t_row = db_fetch_array($t_result)) {
        $t_overall_build_arr[] = $t_row['build'];
    }
    $t_max_length = config_get('max_dropdown_length');
    foreach ($t_overall_build_arr as $t_build_unescaped) {
        $t_build = string_attribute($t_build_unescaped);
        echo '<option value="' . $t_build . '"';
        check_selected($p_build, $t_build_unescaped);
        echo '>' . string_shorten($t_build, $t_max_length) . '</option>';
    }
}
Exemple #5
0
function print_build_option_list($p_build = '')
{
    $t_bug_table = config_get('mantis_bug_table');
    $t_overall_build_arr = array();
    $t_project_id = helper_get_current_project();
    $t_project_where = helper_project_specific_where($t_project_id);
    # Get the "found in" build list
    $query = "SELECT DISTINCT build\r\n\t\t\t\tFROM {$t_bug_table}\r\n\t\t\t\tWHERE {$t_project_where}\r\n\t\t\t\tORDER BY build DESC";
    $result = db_query($query);
    $option_count = db_num_rows($result);
    for ($i = 0; $i < $option_count; $i++) {
        $row = db_fetch_array($result);
        $t_overall_build_arr[] = $row['build'];
    }
    foreach ($t_overall_build_arr as $t_build) {
        print "<option value=\"{$t_build}\"";
        check_selected($p_build, $t_build);
        print ">" . string_shorten($t_build) . "</option>";
    }
}