require_once 'date_api.php'; require_once 'icon_api.php'; require_once 'string_api.php'; require_once 'columns_api.php'; require_once 'config_filter_defaults_inc.php'; auth_ensure_user_authenticated(); $f_search = gpc_get_string(FILTER_PROPERTY_FREE_TEXT, false); /** @todo need a better default */ $f_offset = gpc_get_int('offset', 0); $t_cookie_value_id = gpc_get_cookie(config_get('view_all_cookie'), ''); $t_cookie_value = filter_db_get_filter($t_cookie_value_id); $f_highlight_changed = 0; $f_sort = null; $f_dir = null; $t_project_id = 0; $t_columns = helper_get_columns_to_view(COLUMNS_TARGET_PRINT_PAGE); $t_num_of_columns = count($t_columns); # check to see if the cookie exists if (!is_blank($t_cookie_value)) { # check to see if new cookie is needed if (!filter_is_cookie_valid()) { print_header_redirect('view_all_set.php?type=0&print=1'); } $t_setting_arr = explode('#', $t_cookie_value, 2); $t_filter_cookie_arr = unserialize($t_setting_arr[1]); $f_highlight_changed = $t_filter_cookie_arr[FILTER_PROPERTY_HIGHLIGHT_CHANGED]; $f_sort = $t_filter_cookie_arr[FILTER_PROPERTY_SORT_FIELD_NAME]; $f_dir = $t_filter_cookie_arr[FILTER_PROPERTY_SORT_DIRECTION]; $t_project_id = helper_get_current_project(); } # This replaces the actual search that used to be here
/** * An array of column names that are used to identify fields to include and in which order. * @param type $todo TODO * @return TODO * @access public */ function csv_get_columns() { $t_columns = helper_get_columns_to_view(COLUMNS_TARGET_CSV_PAGE); return $t_columns; }
/** * 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" />'; } }
<?php } # @@@ thraxisp - could this be replaced by a call to filter_draw_selection_area2 $t_filter = current_user_get_bug_filter(); $t_filter = filter_ensure_valid_filter($t_filter); $t_project_id = helper_get_current_project(); $t_current_user_access_level = current_user_get_access_level(); $t_accessible_custom_fields_ids = array(); $t_accessible_custom_fields_names = array(); $t_accessible_custom_fields_type = array(); $t_accessible_custom_fields_values = array(); $t_filter_cols = config_get('filter_custom_fields_per_row'); $t_custom_cols = 1; $t_custom_rows = 0; #get valid target fields $t_fields = helper_get_columns_to_view(); $t_n_fields = count($t_fields); for ($i = 0; $i < $t_n_fields; $i++) { if (in_array($t_fields[$i], array('selection', 'edit', 'bugnotes_count', 'attachment'))) { unset($t_fields[$i]); } } if (ON == config_get('filter_by_custom_fields')) { $t_custom_cols = $t_filter_cols; $t_custom_fields = custom_field_get_linked_ids($t_project_id); foreach ($t_custom_fields as $t_cfid) { $t_field_info = custom_field_cache_row($t_cfid, true); if ($t_field_info['access_level_r'] <= $t_current_user_access_level) { $t_accessible_custom_fields_ids[] = $t_cfid; $t_accessible_custom_fields_names[] = $t_field_info['name']; $t_accessible_custom_fields_types[] = $t_field_info['type'];
$t_project_id = helper_get_current_project(); # Calculate the user id to set the configuration for. if ($t_manage_page) { $t_user_id = NO_USER; } else { $t_user_id = auth_get_current_user_id(); } $t_columns = columns_get_all($t_project_id); $t_all = implode(', ', $t_columns); $t_columns = helper_get_columns_to_view(COLUMNS_TARGET_CSV_PAGE, false, $t_user_id); $t_csv = implode(', ', $t_columns); $t_columns = helper_get_columns_to_view(COLUMNS_TARGET_VIEW_PAGE, false, $t_user_id); $t_view_issues = implode(', ', $t_columns); $t_columns = helper_get_columns_to_view(COLUMNS_TARGET_PRINT_PAGE, false, $t_user_id); $t_print_issues = implode(', ', $t_columns); $t_columns = helper_get_columns_to_view(COLUMNS_TARGET_EXCEL_PAGE, false, $t_user_id); $t_excel = implode(', ', $t_columns); ?> <div id="manage-columns-div" class="form-container"> <form id="manage-columns-form" method="post" action="manage_config_columns_set.php"> <fieldset class="has-required"> <legend><span><?php echo lang_get('manage_columns_config'); ?> </span></legend> <?php if ($t_account_page) { print_account_menu('account_manage_columns_page.php'); } ?>
/** * Gets the columns to be included in the Excel Xml export. * @returns column names. */ function excel_get_columns() { $t_columns = helper_get_columns_to_view(COLUMNS_TARGET_EXCEL_PAGE); return $t_columns; }
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\" />"; } }
filter_init($t_filter); list($t_sort, ) = explode(',', $g_filter['sort']); list($t_dir, ) = explode(',', $g_filter['dir']); $g_checkboxes_exist = false; $t_icon_path = config_get('icon_path'); # Improve performance by caching category data in one pass if (helper_get_current_project() > 0) { category_get_all_rows(helper_get_current_project()); } else { $t_categories = array(); foreach ($t_rows as $t_row) { $t_categories[] = $t_row->category_id; } category_cache_array_rows(array_unique($t_categories)); } $g_columns = helper_get_columns_to_view(COLUMNS_TARGET_VIEW_PAGE); $t_col_count = count($g_columns); $t_filter_position = config_get('filter_position'); # -- ====================== FILTER FORM ========================= -- if (($t_filter_position & FILTER_POSITION_TOP) == FILTER_POSITION_TOP) { filter_draw_selection_area($f_page_number); } # -- ====================== end of FILTER FORM ================== -- # -- ====================== BUG LIST ============================ -- html_status_legend(STATUS_LEGEND_POSITION_TOP, true); ?> <br /> <form id="bug_action" method="get" action="bug_actiongroup_page.php"> <?php # CSRF protection not required here - form does not result in modifications ?>
} else { echo ' - ' . $t_last_updated; } ?> </div> </div> </td> <tr class="nopad"> <?php #********* custom field value # Custom Fields $t_custom_fields_found = false; $t_related_custom_field_ids = custom_field_get_linked_ids($t_bug->project_id); $g_show_only_custom_fields = config_get('show_only_custom_fields'); //** print_r($g_show_only_custom_fields); $t_columns = helper_get_columns_to_view(COLUMNS_TARGET_HOME_VIEW_PAGE, false, $t_current_user_id); // $t_cond = in_array($t_def_custom,$t_columns)===TRUE; $t_config_table = db_get_table('mantis_config_table'); $b_helper_user_exists = helper_user_exists($t_current_user_id, $t_config_table); if ($b_helper_user_exists) { foreach ($t_columns as $t_column_name) { foreach ($t_related_custom_field_ids as $key => $t_id) { if (!custom_field_has_read_access($t_id, $t_bug->id)) { continue; } $t_custom_fields_found = true; $t_def = custom_field_get_definition($t_id); $t_def_custom = 'custom_' . strtolower($t_def['name']); if ($t_def_custom === $t_column_name) { echo '<td class="custom_field pad1 center" title="', string_display(lang_get_defaulted($t_def['name'])), '">', print_custom_field_value($t_def, $t_id, $t_bug->id), '</td>'; }
$t_user_id = auth_get_current_user_id(); } $t_columns = columns_get_all( $t_project_id ); $t_all = implode( ', ', $t_columns ); $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_CSV_PAGE, /* $p_viewable_only */ false, $t_user_id ); $t_csv = implode( ', ', $t_columns ); $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_VIEW_PAGE, /* $p_viewable_only */ false, $t_user_id ); $t_view_issues = implode( ', ', $t_columns ); $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_PRINT_PAGE, /* $p_viewable_only */ false, $t_user_id ); $t_print_issues = implode( ', ', $t_columns ); $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_EXCEL_PAGE, /* $p_viewable_only */ false, $t_user_id ); $t_excel = implode( ', ', $t_columns ); ?> <div id="manage-columns-div" class="form-container"> <form id="manage-columns-form" method="post" <?php if ( file_allow_bug_upload() ) { echo 'enctype="multipart/form-data"'; } ?> action="manage_config_columns_set.php"> <fieldset class="has-required"> <legend><span><?php echo lang_get( 'manage_columns_config' ) ?></span></legend> <?php if ( $t_account_page ) { print_account_menu( 'account_manage_columns_page.php' ); } ?> <?php echo form_security_field( 'manage_config_columns_set' ) ?> <input type="hidden" name="project_id" value="<?php echo $t_project_id ?>" /> <input type="hidden" name="form_page" value="<?php echo $t_account_page ? 'account' : 'manage'; ?>" />