} else { $row = user_get_profile_row($t_bug_data->reporter_id, $t_bug_data->profile_id); } if (is_blank($t_bug_data->platform)) { $t_bug_data->platform = $row['platform']; } if (is_blank($t_bug_data->os)) { $t_bug_data->os = $row['os']; } if (is_blank($t_bug_data->os_build)) { $t_bug_data->os_build = $row['os_build']; } } helper_call_custom_function('issue_create_validate', array($t_bug_data)); # Validate the custom fields before adding the bug. $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); # Produce an error if the field is required but wasn't posted if (!gpc_isset_custom_field($t_id, $t_def['type']) && $t_def['require_report']) { error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name'))); trigger_error(ERROR_EMPTY_FIELD, ERROR); } if (!custom_field_validate($t_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'))); trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR); } } # Allow plugins to pre-process bug data $t_bug_data = event_signal('EVENT_REPORT_BUG_DATA', $t_bug_data); # Ensure that resolved bugs have a handler
# You need either global permissions or project-specific permissions to link # custom fields if (access_has_project_level(config_get('custom_field_link_threshold'), $f_project_id) && count(custom_field_get_ids()) > 0) { ?> <br /> <div id="customfields" align="center"> <table class="width75" cellspacing="1"> <tr> <td class="form-title" colspan="3"> <?php echo lang_get('custom_fields_setup'); ?> </td> </tr> <?php $t_custom_fields = custom_field_get_linked_ids($f_project_id); if (count($t_custom_fields) > 0) { ?> <tr class="row-category"> <td width="50%"> <?php echo lang_get('custom_field'); ?> </td> <td width="25%"> <?php echo lang_get('custom_field_sequence'); ?> </td> <td class="center" width="25%"> <?php
/** * 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; }
/** * Get the custom fields that belong to the specified project. * * @param string $p_username The name of the user trying to access the versions. * @param string $p_password The password of the user. * @param integer $p_project_id The id of the project to retrieve the custom fields for. * @return Array representing a CustomFieldDefinitionDataArray structure. */ function mc_project_get_custom_fields($p_username, $p_password, $p_project_id) { $t_user_id = mci_check_login($p_username, $p_password); if ($t_user_id === false) { return mci_soap_fault_login_failed(); } if (!project_exists($p_project_id)) { return new soap_fault('Client', '', "Project '{$p_project_id}' does not exist."); } if (!mci_has_readonly_access($t_user_id, $p_project_id)) { return mci_soap_fault_access_denied($t_user_id); } $t_result = array(); $t_related_custom_field_ids = custom_field_get_linked_ids($p_project_id); foreach (custom_field_get_linked_ids($p_project_id) as $t_id) { $t_def = custom_field_get_definition($t_id); if (access_has_project_level($t_def['access_level_r'], $p_project_id)) { $t_result[] = array('field' => array('id' => $t_def['id'], 'name' => $t_def['name']), 'type' => $t_def['type'], 'default_value' => $t_def['default_value'], 'possible_values' => $t_def['possible_values'], 'valid_regexp' => $t_def['valid_regexp'], 'access_level_r' => $t_def['access_level_r'], 'access_level_rw' => $t_def['access_level_rw'], 'length_min' => $t_def['length_min'], 'length_max' => $t_def['length_max'], 'display_report' => $t_def['display_report'], 'display_update' => $t_def['display_update'], 'display_resolved' => $t_def['display_resolved'], 'display_closed' => $t_def['display_closed'], 'require_report' => $t_def['require_report'], 'require_update' => $t_def['require_update'], 'require_resolved' => $t_def['require_resolved'], 'require_closed' => $t_def['require_closed']); } } return $t_result; }
/** * Get all custom_field columns for the current project / current user.. * @param int $p_project_id project id * @return array array of columns * @access public */ function columns_get_custom_fields($p_project_id = null) { # Add project custom fields to the array. Only add the ones for which the current user has at least read access. if ($p_project_id === null) { $t_project_id = helper_get_current_project(); } else { $t_project_id = $p_project_id; } $t_related_custom_field_ids = custom_field_get_linked_ids($t_project_id); foreach ($t_related_custom_field_ids as $t_id) { if (!custom_field_has_read_access_by_project_id($t_id, $t_project_id)) { continue; } $t_def = custom_field_get_definition($t_id); $t_columns[] = 'custom_' . strtolower($t_def['name']); } return $t_columns; }
function project_copy_custom_fields($p_destination_id, $p_source_id) { $t_custom_field_ids = custom_field_get_linked_ids($p_source_id); foreach ($t_custom_field_ids as $t_custom_field_id) { if (!custom_field_is_linked($t_custom_field_id, $p_destination_id)) { custom_field_link($t_custom_field_id, $p_destination_id); $t_sequence = custom_field_get_sequence($t_custom_field_id, $p_source_id); custom_field_set_sequence($t_custom_field_id, $p_destination_id, $t_sequence); } } }
function filter_draw_selection_area2($p_page_number, $p_for_screen = true, $p_expanded = true) { $t_form_name_suffix = $p_expanded ? '_open' : '_closed'; $t_filter = current_user_get_bug_filter(); $t_filter = filter_ensure_valid_filter($t_filter); $t_project_id = helper_get_current_project(); $t_page_number = (int) $p_page_number; $t_view_type = $t_filter['_view_type']; $t_tdclass = 'small-caption'; $t_trclass = 'row-category2'; $t_action = 'view_all_set.php?f=3'; if ($p_for_screen == false) { $t_tdclass = 'print'; $t_trclass = ''; $t_action = 'view_all_set.php'; } ?> <br /> <form method="post" name="filters<?php echo $t_form_name_suffix; ?> " id="filters_form<?php echo $t_form_name_suffix; ?> " action="<?php print $t_action; ?> "> <input type="hidden" name="type" value="1" /> <?php if ($p_for_screen == false) { print '<input type="hidden" name="print" value="1" />'; print '<input type="hidden" name="offset" value="0" />'; } ?> <input type="hidden" name="page_number" value="<?php print $t_page_number; ?> " /> <input type="hidden" name="view_type" value="<?php print $t_view_type; ?> " /> <table class="width100" cellspacing="1"> <?php $t_filter_cols = config_get('filter_custom_fields_per_row'); if ($p_expanded) { $t_custom_cols = $t_filter_cols; $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_values = array(); $t_num_custom_rows = 0; $t_per_row = 0; if (ON == config_get('filter_by_custom_fields')) { $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_accessible_custom_fields_values[] = custom_field_distinct_values($t_cfid); } } if (count($t_accessible_custom_fields_ids) > 0) { $t_per_row = config_get('filter_custom_fields_per_row'); $t_num_custom_rows = ceil(count($t_accessible_custom_fields_ids) / $t_per_row); } } $t_filters_url = 'view_filters_page.php?for_screen=' . $p_for_screen; if ('advanced' == $t_view_type) { $t_filters_url = $t_filters_url . '&view_type=advanced'; } $t_filters_url = $t_filters_url . '&target_field='; $t_show_version = ON == config_get('show_product_version') || AUTO == config_get('show_product_version') && count(version_get_all_rows_with_subs($t_project_id)) > 0; # overload handler_id setting if user isn't supposed to see them (ref #6189) if (!access_has_project_level(config_get('view_handler_threshold'), $t_project_id)) { $t_filter['handler_id'] = array(META_FILTER_ANY); } ?> <tr <?php print "class=\"" . $t_trclass . "\""; ?> > <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'reporter_id[]'; ?> " id="reporter_id_filter"><?php print lang_get('reporter'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'user_monitor[]'; ?> " id="user_monitor_filter"><?php print lang_get('monitored_by'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'handler_id[]'; ?> " id="handler_id_filter"><?php print lang_get('assigned_to'); ?> :</a> </td> <td colspan="2" class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'show_category[]'; ?> " id="show_category_filter"><?php print lang_get('category'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'show_severity[]'; ?> " id="show_severity_filter"><?php print lang_get('severity'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'show_resolution[]'; ?> " id="show_resolution_filter"><?php print lang_get('resolution'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'show_profile[]'; ?> " id="show_profile_filter"><?php print lang_get('profile'); ?> :</a> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr class="row-1"> <td class="small-caption" valign="top" id="reporter_id_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['reporter_id']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['reporter_id'] as $t_current) { $t_this_name = ''; ?> <input type="hidden" name="reporter_id[]" value="<?php echo $t_current; ?> " /> <?php if ($t_current === 0 || is_blank($t_current) || META_FILTER_ANY == $t_current) { $t_any_found = true; } else { if (META_FILTER_MYSELF == $t_current) { if (access_has_project_level(config_get('report_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { if (META_FILTER_NONE == $t_current) { $t_this_name = lang_get('none'); } else { $t_this_name = user_get_name($t_current); } } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_name; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <td class="small-caption" valign="top" id="user_monitor_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['user_monitor']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['user_monitor'] as $t_current) { ?> <input type="hidden" name="user_monitor[]" value="<?php echo $t_current; ?> " /> <?php $t_this_name = ''; if ($t_current === 0 || is_blank($t_current) || META_FILTER_ANY == $t_current) { $t_any_found = true; } else { if (META_FILTER_MYSELF == $t_current) { if (access_has_project_level(config_get('monitor_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { $t_this_name = user_get_name($t_current); } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_name; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <td class="small-caption" valign="top" id="handler_id_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['handler_id']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['handler_id'] as $t_current) { ?> <input type="hidden" name="handler_id[]" value="<?php echo $t_current; ?> " /> <?php $t_this_name = ''; if (META_FILTER_NONE == $t_current) { $t_this_name = lang_get('none'); } else { if ($t_current === 0 || is_blank($t_current) || META_FILTER_ANY == $t_current) { $t_any_found = true; } else { if (META_FILTER_MYSELF == $t_current) { if (access_has_project_level(config_get('handle_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { $t_this_name = user_get_name($t_current); } } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_name; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <td colspan="2" class="small-caption" valign="top" id="show_category_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['show_category']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['show_category'] as $t_current) { $t_current = stripslashes($t_current); ?> <input type="hidden" name="show_category[]" value="<?php echo string_display($t_current); ?> " /> <?php $t_this_string = ''; if ($t_current == META_FILTER_ANY && is_numeric($t_current) || is_blank($t_current)) { $t_any_found = true; } else { $t_this_string = string_display($t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <td class="small-caption" valign="top" id="show_severity_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['show_severity']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['show_severity'] as $t_current) { ?> <input type="hidden" name="show_severity[]" value="<?php echo $t_current; ?> " /> <?php $t_this_string = ''; if ($t_current === META_FILTER_ANY || is_blank($t_current) || $t_current == 0) { $t_any_found = true; } else { $t_this_string = get_enum_element('severity', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <td class="small-caption" valign="top" id="show_resolution_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['show_resolution']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['show_resolution'] as $t_current) { ?> <input type="hidden" name="show_resolution[]" value="<?php echo $t_current; ?> " /> <?php $t_this_string = ''; if ($t_current === META_FILTER_ANY || is_blank($t_current) || $t_current === 0) { $t_any_found = true; } else { $t_this_string = get_enum_element('resolution', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <td class="small-caption" valign="top" id="show_profile_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['show_profile']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['show_profile'] as $t_current) { ?> <input type="hidden" name="show_profile[]" value="<?php echo $t_current; ?> " /> <?php $t_this_string = ''; if ($t_current === META_FILTER_ANY || is_blank($t_current) || $t_current === 0) { $t_any_found = true; } else { $t_profile = profile_get_row_direct($t_current); $t_this_string = "{$t_profile['platform']} {$t_profile['os']} {$t_profile['os_build']}"; } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr <?php print "class=\"" . $t_trclass . "\""; ?> > <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'show_status[]'; ?> " id="show_status_filter"><?php print lang_get('status'); ?> :</a> </td> <td class="small-caption" valign="top"> <?php if ('simple' == $t_view_type) { ?> <a href="<?php print $t_filters_url . 'hide_status[]'; ?> " id="hide_status_filter"><?php print lang_get('hide_status'); ?> :</a> <?php } ?> </td> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'show_build[]'; ?> " id="show_build_filter"><?php print lang_get('product_build'); ?> :</a> </td> <?php if ($t_show_version) { ?> <td colspan="2" class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'show_version[]'; ?> " id="show_version_filter"><?php print lang_get('product_version'); ?> :</a> </td> <td colspan="1" class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'fixed_in_version[]'; ?> " id="show_fixed_in_version_filter"><?php print lang_get('fixed_in_version'); ?> :</a> </td> <?php } else { ?> <td colspan="2" class="small-caption" valign="top"> </td> <td colspan="1" class="small-caption" valign="top"> </td> <?php } ?> <td colspan="1" class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'show_priority[]'; ?> " id="show_priority_filter"><?php print lang_get('priority'); ?> :</a> </td> <td colspan="1" class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . 'target_version[]'; ?> " id="show_target_version_filter"><?php echo lang_get('target_version'); ?> :</a> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 7) . '"> </td>'; } ?> </tr> <tr class="row-1"> <td class="small-caption" valign="top" id="show_status_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['show_status']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['show_status'] as $t_current) { ?> <input type="hidden" name="show_status[]" value="<?php echo $t_current; ?> " /> <?php $t_this_string = ''; if ($t_current === META_FILTER_ANY || is_blank($t_current) || $t_current === 0) { $t_any_found = true; } else { $t_this_string = get_enum_element('status', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <td class="small-caption" valign="top" id="hide_status_filter_target"> <?php if ('simple' == $t_view_type) { $t_output = ''; $t_none_found = false; if (count($t_filter['hide_status']) == 0) { print lang_get('none'); } else { $t_first_flag = true; foreach ($t_filter['hide_status'] as $t_current) { ?> <input type="hidden" name="hide_status[]" value="<?php echo $t_current; ?> " /> <?php $t_this_string = ''; if ($t_current == META_FILTER_NONE || is_blank($t_current) || $t_current === 0) { $t_none_found = true; } else { $t_this_string = get_enum_element('status', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } $t_hide_status_post = ''; if (count($t_filter['hide_status']) == 1) { $t_hide_status_post = ' (' . lang_get('and_above') . ')'; } if (true == $t_none_found) { print lang_get('none'); } else { print $t_output . $t_hide_status_post; } } } ?> </td> <td class="small-caption" valign="top" id="show_build_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['show_build']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['show_build'] as $t_current) { $t_current = stripslashes($t_current); ?> <input type="hidden" name="show_build[]" value="<?php echo string_display($t_current); ?> " /> <?php $t_this_string = ''; if ($t_current == META_FILTER_ANY && is_numeric($t_current) || is_blank($t_current)) { $t_any_found = true; } else { if (META_FILTER_NONE == $t_current) { $t_this_string = lang_get('none'); } else { $t_this_string = string_display($t_current); } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <?php if ($t_show_version) { ?> <td colspan="2" class="small-caption" valign="top" id="show_version_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['show_version']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['show_version'] as $t_current) { $t_current = stripslashes($t_current); ?> <input type="hidden" name="show_version[]" value="<?php echo string_display($t_current); ?> " /> <?php $t_this_string = ''; if ($t_current == META_FILTER_ANY && is_numeric($t_current) || is_blank($t_current)) { $t_any_found = true; } else { if (META_FILTER_NONE == $t_current) { $t_this_string = lang_get('none'); } else { $t_this_string = string_display($t_current); } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <td colspan="1" class="small-caption" valign="top" id="show_fixed_in_version_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['fixed_in_version']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['fixed_in_version'] as $t_current) { $t_current = stripslashes($t_current); ?> <input type="hidden" name="fixed_in_version[]" value="<?php echo string_display($t_current); ?> " /> <?php $t_this_string = ''; if ($t_current == META_FILTER_ANY && is_numeric($t_current) || is_blank($t_current)) { $t_any_found = true; } else { if (META_FILTER_NONE == $t_current) { $t_this_string = lang_get('none'); } else { $t_this_string = string_display($t_current); } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <?php } else { ?> <td colspan="2" class="small-caption" valign="top"> </td> <td colspan="1" class="small-caption" valign="top"> </td> <?php } ?> <td colspan="1" class="small-caption" valign="top" id="show_priority_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['show_priority']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['show_priority'] as $t_current) { ?> <input type="hidden" name="show_priority[]" value="<?php echo $t_current; ?> " /> <?php $t_this_string = ''; if ($t_current === META_FILTER_ANY || is_blank($t_current) || $t_current === 0) { $t_any_found = true; } else { $t_this_string = get_enum_element('priority', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <td colspan="1" class="small-caption" valign="top" id="show_target_version_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['target_version']) == 0) { print lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['target_version'] as $t_current) { $t_current = stripslashes($t_current); ?> <input type="hidden" name="target_version[]" value="<?php echo string_display($t_current); ?> " /> <?php $t_this_string = ''; if ($t_current == META_FILTER_ANY && is_numeric($t_current) || is_blank($t_current)) { $t_any_found = true; } else { if (META_FILTER_NONE == $t_current) { $t_this_string = lang_get('none'); } else { $t_this_string = string_display($t_current); } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; } if (true == $t_any_found) { print lang_get('any'); } else { print $t_output; } } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 7) . '"> </td>'; } ?> </tr> <tr <?php print "class=\"" . $t_trclass . "\""; ?> > <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'per_page'; ?> " id="per_page_filter"><?php print lang_get('show'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'view_state'; ?> " id="view_state_filter"><?php print lang_get('view_status'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'sticky_issues'; ?> " id="sticky_issues_filter"><?php print lang_get('sticky'); ?> :</a> </td> <td class="small-caption" valign="top" colspan="2"> <a href="<?php print $t_filters_url . 'highlight_changed'; ?> " id="highlight_changed_filter"><?php print lang_get('changed'); ?> :</a> </td> <td class="small-caption" valign="top" > <a href="<?php print $t_filters_url . 'do_filter_by_date'; ?> " id="do_filter_by_date_filter"><?php print lang_get('use_date_filters'); ?> :</a> </td> <td class="small-caption" valign="top" colspan="2"> <a href="<?php print $t_filters_url . 'relationship_type'; ?> " id="relationship_type_filter"><?php print lang_get('bug_relationships'); ?> :</a> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr class="row-1"> <td class="small-caption" valign="top" id="per_page_filter_target"> <?php echo $t_filter['per_page'] == 0 ? lang_get('all') : $t_filter['per_page']; ?> <input type="hidden" name="per_page" value="<?php echo $t_filter['per_page']; ?> " /> </td> <td class="small-caption" valign="top" id="view_state_filter_target"> <?php if (VS_PUBLIC === $t_filter['view_state']) { print lang_get('public'); } else { if (VS_PRIVATE === $t_filter['view_state']) { print lang_get('private'); } else { print lang_get('any'); $t_filter['view_state'] = META_FILTER_ANY; } } ?> <input type="hidden" name="view_state" value="<?php echo $t_filter['view_state']; ?> " /> </td> <td class="small-caption" valign="top" id="sticky_issues_filter_target"> <?php $t_sticky_filter_state = gpc_string_to_bool($t_filter['sticky_issues']); print $t_sticky_filter_state ? lang_get('yes') : lang_get('no'); ?> <input type="hidden" name="sticky_issues" value="<?php echo $t_sticky_filter_state ? 'on' : 'off'; ?> " /> </td> <td class="small-caption" valign="top" colspan="2" id="highlight_changed_filter_target"> <?php print $t_filter['highlight_changed']; ?> <input type="hidden" name="highlight_changed" value="<?php echo $t_filter['highlight_changed']; ?> " /> </td> <td class="small-caption" valign="top" id="do_filter_by_date_filter_target"> <?php if (ON == config_get('dhtml_filters') && ON == config_get('use_javascript')) { ?> <script type="text/javascript" language="JavaScript"> <!-- function SwitchDateFields() { // All fields need to be enabled to go back to the script document.filters_open.start_month.disabled = ! document.filters_open.do_filter_by_date.checked; document.filters_open.start_day.disabled = ! document.filters_open.do_filter_by_date.checked; document.filters_open.start_year.disabled = ! document.filters_open.do_filter_by_date.checked; document.filters_open.end_month.disabled = ! document.filters_open.do_filter_by_date.checked; document.filters_open.end_day.disabled = ! document.filters_open.do_filter_by_date.checked; document.filters_open.end_year.disabled = ! document.filters_open.do_filter_by_date.checked; return true; } // --> </script> <?php } # end if dhtml_filters if ('on' == $t_filter['do_filter_by_date']) { ?> <input type="hidden" name="do_filter_by_date" value="<?php echo $t_filter['do_filter_by_date']; ?> " /> <input type="hidden" name="start_month" value="<?php echo $t_filter['start_month']; ?> " /> <input type="hidden" name="start_day" value="<?php echo $t_filter['start_day']; ?> " /> <input type="hidden" name="start_year" value="<?php echo $t_filter['start_year']; ?> " /> <input type="hidden" name="end_month" value="<?php echo $t_filter['end_month']; ?> " /> <input type="hidden" name="end_day" value="<?php echo $t_filter['end_day']; ?> " /> <input type="hidden" name="end_year" value="<?php echo $t_filter['end_year']; ?> " /> <?php $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY); $t_time = mktime(0, 0, 0, $t_filter['start_month'], $t_filter['start_day'], $t_filter['start_year']); foreach ($t_chars as $t_char) { if (strcasecmp($t_char, "M") == 0) { print ' '; print date('F', $t_time); } if (strcasecmp($t_char, "D") == 0) { print ' '; print date('d', $t_time); } if (strcasecmp($t_char, "Y") == 0) { print ' '; print date('Y', $t_time); } } print ' - '; $t_time = mktime(0, 0, 0, $t_filter['end_month'], $t_filter['end_day'], $t_filter['end_year']); foreach ($t_chars as $t_char) { if (strcasecmp($t_char, "M") == 0) { print ' '; print date('F', $t_time); } if (strcasecmp($t_char, "D") == 0) { print ' '; print date('d', $t_time); } if (strcasecmp($t_char, "Y") == 0) { print ' '; print date('Y', $t_time); } } } else { print lang_get('no'); } ?> </td> <td class="small-caption" valign="top" colspan="2" id="relationship_type_filter_target"> <input type="hidden" name="relationship_type" value="<?php echo $t_filter['relationship_type']; ?> " /> <input type="hidden" name="relationship_bug" value="<?php echo $t_filter['relationship_bug']; ?> " /> <?php $c_rel_type = $t_filter['relationship_type']; $c_rel_bug = $t_filter['relationship_bug']; if (-1 == $c_rel_type || 0 == $c_rel_bug) { print lang_get('any'); } else { print relationship_get_description_for_history($c_rel_type) . ' ' . $c_rel_bug; } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr <?php print "class=\"" . $t_trclass . "\""; ?> > <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . 'platform'; ?> " id="platform_filter"><?php echo lang_get('platform'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'os'; ?> " id="os_filter"><?php echo lang_get('os'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'os_build'; ?> " id="os_build_filter"><?php echo lang_get('os_version'); ?> :</a> </td> <td class="small-caption" valign="top" colspan="5"> <?php if (access_has_global_level(config_get('tag_view_threshold'))) { ?> <a href="<?php print $t_filters_url . 'tag_string'; ?> " id="tag_string_filter"><?php echo lang_get('tags'); ?> :</a> <?php } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr class="row-1"> <td class="small-caption" valign="top" id="platform_filter_target"> <?php print_multivalue_field(FILTER_PROPERTY_PLATFORM, $t_filter[FILTER_PROPERTY_PLATFORM]); ?> </td> <td class="small-caption" valign="top" id="os_filter_target"> <?php print_multivalue_field(FILTER_PROPERTY_OS, $t_filter[FILTER_PROPERTY_OS]); ?> </td> <td class="small-caption" valign="top" id="os_build_filter_target"> <?php print_multivalue_field(FILTER_PROPERTY_OS_BUILD, $t_filter[FILTER_PROPERTY_OS_BUILD]); ?> </td> <td class="small-caption" valign="top" id="tag_string_filter_target" colspan="5"> <?php $t_tag_string = $t_filter['tag_string']; if ($t_filter['tag_select'] != 0) { $t_tag_string .= is_blank($t_tag_string) ? '' : config_get('tag_separator'); $t_tag_string .= tag_get_field($t_filter['tag_select'], 'name'); } print $t_tag_string; ?> <input type="hidden" name="tag_string" value="<?php echo $t_tag_string; ?> "/> </td> </tr> <?php if (ON == config_get('filter_by_custom_fields')) { # -- Custom Field Searching -- if (count($t_accessible_custom_fields_ids) > 0) { $t_per_row = config_get('filter_custom_fields_per_row'); $t_num_fields = count($t_accessible_custom_fields_ids); $t_row_idx = 0; $t_col_idx = 0; $t_fields = ""; $t_values = ""; for ($i = 0; $i < $t_num_fields; $i++) { if ($t_col_idx == 0) { $t_fields = '<tr class="' . $t_trclass . '">'; $t_values = '<tr class="row-1">'; } if (isset($t_accessible_custom_fields_names[$i])) { $t_fields .= '<td class="small-caption" valign="top"> '; $t_fields .= '<a href="' . $t_filters_url . 'custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter">'; $t_fields .= string_display(lang_get_defaulted($t_accessible_custom_fields_names[$i])); $t_fields .= '</a> </td> '; } $t_output = ''; $t_any_found = false; $t_values .= '<td class="small-caption" valign="top" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter_target"> '; if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]])) { $t_values .= lang_get('any'); } else { if ($t_accessible_custom_fields_types[$i] == CUSTOM_FIELD_TYPE_DATE) { # @@@ moved embedded javascript here from print_filter_custom_field_date # it appears not to load properly on Firefox and other browsers if loaded through the httpxmlreq $t_field_id = $t_accessible_custom_fields_ids[$i]; $t_js_toggle_func = "toggle_custom_date_field_" . $t_field_id . "_controls"; if (ON == config_get('dhtml_filters') && ON == config_get('use_javascript')) { ?> <script type="text/javascript" language="JavaScript"> <!-- function <?php echo $t_js_toggle_func . "_start"; ?> (disable) { document.filters_open.custom_field_<?php echo $t_field_id; ?> _start_year.disabled = disable ; document.filters_open.custom_field_<?php echo $t_field_id; ?> _start_month.disabled = disable ; document.filters_open.custom_field_<?php echo $t_field_id; ?> _start_day.disabled = disable ; } ; function <?php echo $t_js_toggle_func . "_end"; ?> (disable) { document.filters_open.custom_field_<?php echo $t_field_id; ?> _end_year.disabled = disable ; document.filters_open.custom_field_<?php echo $t_field_id; ?> _end_month.disabled = disable ; document.filters_open.custom_field_<?php echo $t_field_id; ?> _end_day.disabled = disable ; } ; function <?php echo $t_js_toggle_func; ?> () { switch (document.filters_open.custom_field_<?php echo $t_field_id; ?> _control.selectedIndex) { case <?php echo CUSTOM_FIELD_DATE_ANY; ?> : case <?php echo CUSTOM_FIELD_DATE_NONE; ?> : <?php echo $t_js_toggle_func . "_start"; ?> (true) ; <?php echo $t_js_toggle_func . "_end"; ?> (true) ; break ; case <?php echo CUSTOM_FIELD_DATE_BETWEEN; ?> : <?php echo $t_js_toggle_func . "_start"; ?> (false) ; <?php echo $t_js_toggle_func . "_end"; ?> (false) ; break ; default: <?php echo $t_js_toggle_func . "_start"; ?> (false) ; <?php echo $t_js_toggle_func . "_end"; ?> (true) ; break ; } } // --> </script> <?php } # end if dhtml_filters $t_short_date_format = config_get('short_date_format'); if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1])) { $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1] = 0; } $t_start = date($t_short_date_format, $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1]); if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2])) { $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2] = 0; } $t_end = date($t_short_date_format, $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2]); switch ($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][0]) { case CUSTOM_FIELD_DATE_ANY: $t_values .= lang_get('any'); break; case CUSTOM_FIELD_DATE_NONE: $t_values .= lang_get('none'); break; case CUSTOM_FIELD_DATE_BETWEEN: $t_values .= lang_get('between') . '<br />'; $t_values .= $t_start . '<br />' . $t_end; break; case CUSTOM_FIELD_DATE_ONORBEFORE: $t_values .= lang_get('on_or_before') . '<br />'; $t_values .= $t_end; break; case CUSTOM_FIELD_DATE_BEFORE: $t_values .= lang_get('before') . '<br />'; $t_values .= $t_end; break; case CUSTOM_FIELD_DATE_ON: $t_values .= lang_get('on') . '<br />'; $t_values .= $t_start; break; case CUSTOM_FIELD_DATE_AFTER: $t_values .= lang_get('after') . '<br />'; $t_values .= $t_start; break; case CUSTOM_FIELD_DATE_ONORAFTER: $t_values .= lang_get('on_or_after') . '<br />'; $t_values .= $t_start; break; } } else { $t_first_flag = true; foreach ($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]] as $t_current) { $t_current = stripslashes($t_current); $t_this_string = ''; if ($t_current == META_FILTER_ANY && is_numeric($t_current) || is_blank($t_current)) { $t_any_found = true; } else { if (META_FILTER_NONE == $t_current && is_numeric($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = string_display($t_current); } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_string; $t_values .= '<input type="hidden" name="custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]" value="' . string_display($t_current) . '" />'; } } if (true == $t_any_found) { $t_values .= lang_get('any'); } else { $t_values .= $t_output; } } $t_values .= ' </td>'; $t_col_idx++; if ($t_col_idx == $t_per_row) { if ($t_filter_cols > $t_per_row) { $t_fields .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; $t_values .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; } $t_fields .= '</tr>' . "\n"; $t_values .= '</tr>' . "\n"; echo $t_fields; echo $t_values; $t_col_idx = 0; $t_row_idx++; } } if ($t_col_idx > 0) { if ($t_col_idx < $t_per_row) { $t_fields .= '<td colspan="' . ($t_per_row - $t_col_idx) . '"> </td> '; $t_values .= '<td colspan="' . ($t_per_row - $t_col_idx) . '"> </td> '; } if ($t_filter_cols > $t_per_row) { $t_fields .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; $t_values .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; } $t_fields .= '</tr>' . "\n"; $t_values .= '</tr>' . "\n"; echo $t_fields; echo $t_values; } } } ?> <tr class="row-1"> <td class="small-caption" valign="top"> <a href="<?php print $t_filters_url . 'show_sort'; ?> " id="show_sort_filter"><?php print lang_get('sort'); ?> :</a> </td> <td class="small-caption" valign="top" colspan="2" id="show_sort_filter_target"> <?php $t_sort_fields = split(',', $t_filter['sort']); $t_dir_fields = split(',', $t_filter['dir']); for ($i = 0; $i < 2; $i++) { if (isset($t_sort_fields[$i])) { if (0 < $i) { echo ", "; } $t_sort = $t_sort_fields[$i]; if (strpos($t_sort, 'custom_') === 0) { $t_field_name = string_display(lang_get_defaulted(substr($t_sort, strlen('custom_')))); } else { $t_field_name = string_get_field_name($t_sort); } echo $t_field_name . " " . lang_get('bugnote_order_' . strtolower($t_dir_fields[$i])); echo "<input type=\"hidden\" name=\"sort_{$i}\" value=\"{$t_sort_fields[$i]}\" />"; echo "<input type=\"hidden\" name=\"dir_{$i}\" value=\"{$t_dir_fields[$i]}\" />"; } } ?> </td> <?php if ('advanced' == $t_view_type) { ?> <td class="small-caption" valign="top" colspan="2"> <a href="<?php print $t_filters_url . 'project_id'; ?> " id="project_id_filter"><?php print lang_get('email_project'); ?> :</a> </td> <td class="small-caption" valign="top" id="project_id_filter_target"> <?php $t_output = ''; if (!is_array($t_filter['project_id'])) { $t_filter['project_id'] = array($t_filter['project_id']); } if (count($t_filter['project_id']) == 0) { print lang_get('current'); } else { $t_first_flag = true; foreach ($t_filter['project_id'] as $t_current) { ?> <input type="hidden" name="project_id[]" value="<?php echo $t_current; ?> " /> <?php $t_this_name = ''; if (META_FILTER_CURRENT == $t_current) { $t_this_name = lang_get('current'); } else { $t_this_name = project_get_name($t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . $t_this_name; } print $t_output; } ?> </td> <?php if ($t_filter_cols > 6) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 5) . '"> </td>'; } } else { if ($t_filter_cols > 3) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 2) . '"> </td>'; } } ?> </tr> <?php } // expanded ?> <tr> <td colspan="2"> <?php collapse_icon('filter'); echo lang_get('search'); ?> : <input type="text" size="16" name="search" value="<?php print string_html_specialchars($t_filter['search']); ?> " /> <input type="submit" name="filter" class="button-small" value="<?php print lang_get('filter_button'); ?> " /> </td> </form> <td class="center" colspan="<?php echo $t_filter_cols - 6; ?> "> <!-- use this label for padding --> <?php if (ON == config_get('dhtml_filters')) { $f_switch_view_link = 'view_all_set.php?type=6&view_type='; } else { $f_switch_view_link = 'view_filters_page.php?view_type='; } if (SIMPLE_ONLY != config_get('view_filters') && ADVANCED_ONLY != config_get('view_filters')) { if ('advanced' == $t_view_type) { print_bracket_link($f_switch_view_link . 'simple', lang_get('simple_filters')); } else { print_bracket_link($f_switch_view_link . 'advanced', lang_get('advanced_filters')); } print_bracket_link('permalink_page.php?url=' . urlencode(filter_get_url($t_filter)), lang_get('create_filter_link'), true); } ?> </td> <td class="right" colspan="4"> <?php $t_stored_queries_arr = array(); $t_stored_queries_arr = filter_db_get_available_queries(); if (count($t_stored_queries_arr) > 0) { ?> <form method="get" name="list_queries<?php echo $t_form_name_suffix; ?> " action="view_all_set.php"> <input type="hidden" name="type" value="3" /> <?php if (ON == config_get('use_javascript')) { echo "<select name=\"source_query_id\" onchange=\"document.forms.list_queries{$t_form_name_suffix}.submit();\">"; } else { print '<select name="source_query_id">'; } ?> <option value="-1"><?php print '[' . lang_get('reset_query') . ']'; ?> </option> <option value="-1"></option> <?php foreach ($t_stored_queries_arr as $t_query_id => $t_query_name) { print '<option value="' . $t_query_id . '">' . $t_query_name . '</option>'; } ?> </select> <input type="submit" name="switch_to_query_button" class="button-small" value="<?php print lang_get('use_query'); ?> " /> </form> <form method="post" name="open_queries" action="query_view_page.php"> <input type="submit" name="switch_to_query_button" class="button-small" value="<?php print lang_get('open_queries'); ?> " /> </form> <?php } else { ?> <form method="get" name="reset_query" action="view_all_set.php"> <input type="hidden" name="type" value="3" /> <input type="hidden" name="source_query_id" value="-1" /> <input type="submit" name="reset_query_button" class="button-small" value="<?php print lang_get('reset_query'); ?> " /> </form> <?php } if (access_has_project_level(config_get('stored_query_create_threshold'))) { ?> <form method="post" name="save_query" action="query_store_page.php"> <input type="submit" name="save_query_button" class="button-small" value="<?php print lang_get('save_query'); ?> " /> </form> <?php } else { ?> <?php } ?> </td> </tr> </table> <?php }
function print_custom_field_projects_list($p_field_id) { $c_field_id = (int) $p_field_id; $t_project_ids = custom_field_get_project_ids($p_field_id); $t_security_token = form_security_param('manage_proj_custom_field_remove'); foreach ($t_project_ids as $t_project_id) { $t_project_name = project_get_field($t_project_id, 'name'); $t_sequence = custom_field_get_sequence($p_field_id, $t_project_id); echo '<strong>', string_display_line($t_project_name), '</strong>: '; print_bracket_link("manage_proj_custom_field_remove.php?field_id={$c_field_id}&project_id={$t_project_id}&return=custom_field{$t_security_token}", lang_get('remove_link')); echo '<br />- '; $t_linked_field_ids = custom_field_get_linked_ids($t_project_id); $t_current_project_fields = array(); $t_first = true; foreach ($t_linked_field_ids as $t_current_field_id) { if ($t_first) { $t_first = false; } else { echo ', '; } if ($t_current_field_id == $p_field_id) { echo '<em>'; } echo string_display_line(custom_field_get_field($t_current_field_id, 'name')); echo ' (', custom_field_get_sequence($t_current_field_id, $t_project_id), ')'; if ($t_current_field_id == $p_field_id) { echo '</em>'; } } echo '<br /><br />'; } }
/** * Prints the filter selection area for both the bug list view screen and * the bug list print screen. This function was an attempt to make it easier to * add new filters and rearrange them on screen for both pages. * @param int $p_page_number * @param bool $p_for_screen * @param bool $p_expanded */ function filter_draw_selection_area2($p_page_number, $p_for_screen = true, $p_expanded = true) { $t_form_name_suffix = $p_expanded ? '_open' : '_closed'; $t_filter = current_user_get_bug_filter(); $t_filter = filter_ensure_valid_filter($t_filter); $t_project_id = helper_get_current_project(); $t_page_number = (int) $p_page_number; $t_view_type = $t_filter['_view_type']; $t_tdclass = 'small-caption'; $t_trclass = 'row-category2'; $t_action = 'view_all_set.php?f=3'; if ($p_for_screen == false) { $t_tdclass = 'print'; $t_trclass = ''; $t_action = 'view_all_set.php'; } ?> <br /> <form method="post" name="filters<?php echo $t_form_name_suffix; ?> " id="filters_form<?php echo $t_form_name_suffix; ?> " action="<?php echo $t_action; ?> "> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="hidden" name="type" value="1" /> <?php if ($p_for_screen == false) { echo '<input type="hidden" name="print" value="1" />'; echo '<input type="hidden" name="offset" value="0" />'; } ?> <input type="hidden" name="page_number" value="<?php echo $t_page_number; ?> " /> <input type="hidden" name="view_type" value="<?php echo $t_view_type; ?> " /> <table class="width100" cellspacing="1"> <?php $t_filter_cols = config_get('filter_custom_fields_per_row'); if ($p_expanded) { $t_custom_cols = $t_filter_cols; $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_values = array(); $t_num_custom_rows = 0; $t_per_row = 0; if (ON == config_get('filter_by_custom_fields')) { $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_field_info['filter_by']) { $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_accessible_custom_fields_values[] = custom_field_distinct_values($t_field_info); } } if (count($t_accessible_custom_fields_ids) > 0) { $t_per_row = config_get('filter_custom_fields_per_row'); $t_num_custom_rows = ceil(count($t_accessible_custom_fields_ids) / $t_per_row); } } $t_filters_url = 'view_filters_page.php?for_screen=' . $p_for_screen; if ('advanced' == $t_view_type) { $t_filters_url = $t_filters_url . '&view_type=advanced'; } $t_filters_url = $t_filters_url . '&target_field='; $t_show_product_version = version_should_show_product_version($t_project_id); $t_show_build = $t_show_product_version && config_get('enable_product_build') == ON; # overload handler_id setting if user isn't supposed to see them (ref #6189) if (!access_has_project_level(config_get('view_handler_threshold'), $t_project_id)) { $t_filter[FILTER_PROPERTY_HANDLER_ID] = array(META_FILTER_ANY); } ?> <tr <?php echo "class=\"" . $t_trclass . "\""; ?> > <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_REPORTER_ID . '[]'; ?> " id="reporter_id_filter"><?php echo lang_get('reporter'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_MONITOR_USER_ID . '[]'; ?> " id="user_monitor_filter"><?php echo lang_get('monitored_by'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HANDLER_ID . '[]'; ?> " id="handler_id_filter"><?php echo lang_get('assigned_to'); ?> :</a> </td> <td colspan="2" class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_CATEGORY . '[]'; ?> " id="show_category_filter"><?php echo lang_get('category'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_SEVERITY_ID . '[]'; ?> " id="show_severity_filter"><?php echo lang_get('severity'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_RESOLUTION_ID . '[]'; ?> " id="show_resolution_filter"><?php echo lang_get('resolution'); ?> :</a> </td> <td class="small-caption" valign="top"> <?php if (ON == config_get('enable_profiles')) { ?> <a href="<?php echo $t_filters_url . 'show_profile[]'; ?> " id="show_profile_filter"><?php echo lang_get('profile'); ?> :</a> <?php } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr class="row-1"> <td class="small-caption" valign="top" id="reporter_id_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_REPORTER_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_REPORTER_ID] as $t_current) { $t_this_name = ''; echo '<input type="hidden" name="', FILTER_PROPERTY_REPORTER_ID, '[]" value="', string_attribute($t_current), '" />'; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_myself($t_current)) { if (access_has_project_level(config_get('report_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { if (filter_field_is_none($t_current)) { $t_this_name = lang_get('none'); } else { $t_this_name = user_get_name($t_current); } } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_name); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td class="small-caption" valign="top" id="user_monitor_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_MONITOR_USER_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_MONITOR_USER_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_MONITOR_USER_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_name = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_myself($t_current)) { if (access_has_project_level(config_get('monitor_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { $t_this_name = user_get_name($t_current); } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_name); } if (true == $t_any_found) { echo lang_get('any'); } else { echo string_display($t_output); } } ?> </td> <td class="small-caption" valign="top" id="handler_id_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_HANDLER_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_HANDLER_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_HANDLER_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_name = ''; if (filter_field_is_none($t_current)) { $t_this_name = lang_get('none'); } else { if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_myself($t_current)) { if (access_has_project_level(config_get('handle_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { $t_this_name = user_get_name($t_current); } } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_name); } if (true == $t_any_found) { echo lang_get('any'); } else { echo string_display($t_output); } } ?> </td> <td colspan="2" class="small-caption" valign="top" id="show_category_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_CATEGORY]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_CATEGORY] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_CATEGORY, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_this_string = $t_current; } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td class="small-caption" valign="top" id="show_severity_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_SEVERITY_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_SEVERITY_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_SEVERITY_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_this_string = get_enum_element('severity', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td class="small-caption" valign="top" id="show_resolution_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_RESOLUTION_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_RESOLUTION_ID] as $t_current) { ?> <input type="hidden" name="show_resolution[]" value="<?php echo string_attribute($t_current); ?> " /> <?php $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_this_string = get_enum_element('resolution', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php if (ON == config_get('enable_profiles')) { ?> <td class="small-caption" valign="top" id="show_profile_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter['show_profile']) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter['show_profile'] as $t_current) { ?> <input type="hidden" name="show_profile[]" value="<?php echo string_attribute($t_current); ?> " /> <?php $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_profile = profile_get_row_direct($t_current); $t_this_string = "{$t_profile['platform']} {$t_profile['os']} {$t_profile['os_build']}"; } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php } else { ?> <td></td> <?php } if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr <?php echo "class=\"" . $t_trclass . "\""; ?> > <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_STATUS_ID . '[]'; ?> " id="show_status_filter"><?php echo lang_get('status'); ?> :</a> </td> <td class="small-caption" valign="top"> <?php if ('simple' == $t_view_type) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIDE_STATUS_ID . '[]'; ?> " id="hide_status_filter"><?php echo lang_get('hide_status'); ?> :</a> <?php } ?> </td> <td class="small-caption" valign="top"> <?php if ($t_show_build) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PRODUCT_BUILD . '[]'; ?> " id="show_build_filter"><?php echo lang_get('product_build'); ?> :</a> <?php } ?> </td> <?php if ($t_show_product_version) { ?> <td colspan="2" class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PRODUCT_VERSION . '[]'; ?> " id="show_version_filter"><?php echo lang_get('product_version'); ?> :</a> </td> <td colspan="1" class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_FIXED_IN_VERSION . '[]'; ?> " id="show_fixed_in_version_filter"><?php echo lang_get('fixed_in_version'); ?> :</a> </td> <td colspan="1" class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_TARGET_VERSION . '[]'; ?> " id="show_target_version_filter"><?php echo lang_get('target_version'); ?> :</a> </td> <?php } else { ?> <td colspan="2" class="small-caption" valign="top">   </td> <td colspan="1" class="small-caption" valign="top">   </td> <td colspan="1" class="small-caption" valign="top"> </td> <?php } ?> <td colspan="1" class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PRIORITY_ID . '[]'; ?> " id="show_priority_filter"><?php echo lang_get('priority'); ?> :</a> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 7) . '"> </td>'; } ?> </tr> <tr class="row-1"> <td class="small-caption" valign="top" id="show_status_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_STATUS_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_STATUS_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_STATUS_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_this_string = get_enum_element('status', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td class="small-caption" valign="top" id="hide_status_filter_target"> <?php if ('simple' == $t_view_type) { $t_output = ''; $t_none_found = false; if (count($t_filter[FILTER_PROPERTY_HIDE_STATUS_ID]) == 0) { echo lang_get('none'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_HIDE_STATUS_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_none($t_current)) { $t_none_found = true; } else { $t_this_string = get_enum_element('status', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } $t_hide_status_post = ''; if (count($t_filter[FILTER_PROPERTY_HIDE_STATUS_ID]) == 1) { $t_hide_status_post = ' (' . lang_get('and_above') . ')'; } if (true == $t_none_found) { echo lang_get('none'); } else { echo $t_output . string_display_line($t_hide_status_post); } } } ?> </td> <?php if ($t_show_build) { ?> <td class="small-caption" valign="top" id="show_build_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_PRODUCT_BUILD]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_PRODUCT_BUILD] as $t_current) { $t_current = stripslashes($t_current); echo '<input type="hidden" name="', FILTER_PROPERTY_PRODUCT_BUILD, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_none($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = $t_current; } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php } else { ?> <td class="small-caption" valign="top"></td> <?php } if ($t_show_product_version) { ?> <td colspan="2" class="small-caption" valign="top" id="show_version_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_PRODUCT_VERSION]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_PRODUCT_VERSION] as $t_current) { $t_current = stripslashes($t_current); echo '<input type="hidden" name="', FILTER_PROPERTY_PRODUCT_VERSION, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_none($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = $t_current; } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td colspan="1" class="small-caption" valign="top" id="show_fixed_in_version_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_FIXED_IN_VERSION]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_FIXED_IN_VERSION] as $t_current) { $t_current = stripslashes($t_current); echo '<input type="hidden" name="', FILTER_PROPERTY_FIXED_IN_VERSION, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_none($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = $t_current; } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td colspan="1" class="small-caption" valign="top" id="show_target_version_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_TARGET_VERSION]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_TARGET_VERSION] as $t_current) { $t_current = stripslashes($t_current); echo '<input type="hidden" name="', FILTER_PROPERTY_TARGET_VERSION, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_none($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = $t_current; } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php } else { ?> <td colspan="2" class="small-caption" valign="top">   </td> <td colspan="1" class="small-caption" valign="top">   </td> <td colspan="1" class="small-caption" valign="top"> </td> <?php } ?> <td colspan="1" class="small-caption" valign="top" id="show_priority_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_PRIORITY_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_PRIORITY_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_PRIORITY_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_this_string = get_enum_element('priority', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 7) . '"> </td>'; } ?> </tr> <tr <?php echo "class=\"" . $t_trclass . "\""; ?> > <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_ISSUES_PER_PAGE; ?> " id="per_page_filter"><?php echo lang_get('show'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_VIEW_STATE_ID; ?> " id="view_state_filter"><?php echo lang_get('view_status'); ?> :</a> </td> <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_SHOW_STICKY_ISSUES; ?> " id="sticky_issues_filter"><?php echo lang_get('sticky'); ?> :</a> </td> <td class="small-caption" valign="top" colspan="2"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIGHLIGHT_CHANGED; ?> " id="highlight_changed_filter"><?php echo lang_get('changed'); ?> :</a> </td> <td class="small-caption" valign="top" > <a href="<?php echo $t_filters_url . FILTER_PROPERTY_FILTER_BY_DATE; ?> " id="do_filter_by_date_filter"><?php echo lang_get('use_date_filters'); ?> :</a> </td> <td class="small-caption" valign="top" colspan="2"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_RELATIONSHIP_TYPE; ?> " id="relationship_type_filter"><?php echo lang_get('bug_relationships'); ?> :</a> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr class="row-1"> <td class="small-caption" valign="top" id="per_page_filter_target"> <?php echo $t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE] == 0 ? lang_get('all') : string_display_line($t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE]); echo '<input type="hidden" name="', FILTER_PROPERTY_ISSUES_PER_PAGE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE]), '" />'; ?> </td> <td class="small-caption" valign="top" id="view_state_filter_target"> <?php if (VS_PUBLIC === $t_filter[FILTER_PROPERTY_VIEW_STATE_ID]) { echo lang_get('public'); } else { if (VS_PRIVATE === $t_filter[FILTER_PROPERTY_VIEW_STATE_ID]) { echo lang_get('private'); } else { echo lang_get('any'); $t_filter[FILTER_PROPERTY_VIEW_STATE_ID] = META_FILTER_ANY; } } echo '<input type="hidden" name="', FILTER_PROPERTY_VIEW_STATE_ID, '" value="', string_attribute($t_filter[FILTER_PROPERTY_VIEW_STATE_ID]), '" />'; ?> </td> <td class="small-caption" valign="top" id="sticky_issues_filter_target"> <?php $t_sticky_filter_state = gpc_string_to_bool($t_filter[FILTER_PROPERTY_SHOW_STICKY_ISSUES]); print $t_sticky_filter_state ? lang_get('yes') : lang_get('no'); ?> <input type="hidden" name="sticky_issues" value="<?php echo $t_sticky_filter_state ? 'on' : 'off'; ?> " /> </td> <td class="small-caption" valign="top" colspan="2" id="highlight_changed_filter_target"> <?php echo $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED]; echo '<input type="hidden" name="', FILTER_PROPERTY_HIGHLIGHT_CHANGED, '" value="', string_attribute($t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED]), '" />'; ?> </td> <td class="small-caption" valign="top" id="do_filter_by_date_filter_target"> <?php if (ON == config_get('dhtml_filters') && ON == config_get('use_javascript')) { ?> <script type="text/javascript" language="JavaScript"> <!-- function SwitchDateFields() { // All fields need to be enabled to go back to the script document.filters_open.start_month.disabled = ! document.filters_open.do_filter_by_date.checked; document.filters_open.start_day.disabled = ! document.filters_open.do_filter_by_date.checked; document.filters_open.start_year.disabled = ! document.filters_open.do_filter_by_date.checked; document.filters_open.end_month.disabled = ! document.filters_open.do_filter_by_date.checked; document.filters_open.end_day.disabled = ! document.filters_open.do_filter_by_date.checked; document.filters_open.end_year.disabled = ! document.filters_open.do_filter_by_date.checked; return true; } // --> </script> <?php } # end if dhtml_filters if ('on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE]) { echo '<input type="hidden" name="', FILTER_PROPERTY_FILTER_BY_DATE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_FILTER_BY_DATE]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_START_MONTH, '" value="', string_attribute($t_filter[FILTER_PROPERTY_START_MONTH]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_START_DAY, '" value="', string_attribute($t_filter[FILTER_PROPERTY_START_DAY]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_START_YEAR, '" value="', string_attribute($t_filter[FILTER_PROPERTY_START_YEAR]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_END_MONTH, '" value="', string_attribute($t_filter[FILTER_PROPERTY_END_MONTH]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_END_DAY, '" value="', string_attribute($t_filter[FILTER_PROPERTY_END_DAY]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_END_YEAR, '" value="', string_attribute($t_filter[FILTER_PROPERTY_END_YEAR]), '" />'; $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY); $t_time = mktime(0, 0, 0, $t_filter[FILTER_PROPERTY_START_MONTH], $t_filter[FILTER_PROPERTY_START_DAY], $t_filter[FILTER_PROPERTY_START_YEAR]); foreach ($t_chars as $t_char) { if (strcasecmp($t_char, "M") == 0) { echo ' '; echo date('F', $t_time); } if (strcasecmp($t_char, "D") == 0) { echo ' '; echo date('d', $t_time); } if (strcasecmp($t_char, "Y") == 0) { echo ' '; echo date('Y', $t_time); } } echo ' - '; $t_time = mktime(0, 0, 0, $t_filter[FILTER_PROPERTY_END_MONTH], $t_filter[FILTER_PROPERTY_END_DAY], $t_filter[FILTER_PROPERTY_END_YEAR]); foreach ($t_chars as $t_char) { if (strcasecmp($t_char, "M") == 0) { echo ' '; echo date('F', $t_time); } if (strcasecmp($t_char, "D") == 0) { echo ' '; echo date('d', $t_time); } if (strcasecmp($t_char, "Y") == 0) { echo ' '; echo date('Y', $t_time); } } } else { echo lang_get('no'); } ?> </td> <td class="small-caption" valign="top" colspan="2" id="relationship_type_filter_target"> <?php echo '<input type="hidden" name="', FILTER_PROPERTY_RELATIONSHIP_TYPE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_RELATIONSHIP_BUG, '" value="', string_attribute($t_filter[FILTER_PROPERTY_RELATIONSHIP_BUG]), '" />'; $c_rel_type = $t_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE]; $c_rel_bug = $t_filter[FILTER_PROPERTY_RELATIONSHIP_BUG]; if (-1 == $c_rel_type || 0 == $c_rel_bug) { echo lang_get('any'); } else { echo relationship_get_description_for_history($c_rel_type) . ' ' . $c_rel_bug; } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr <?php echo "class=\"" . $t_trclass . "\""; ?> > <td class="small-caption" valign="top"> <?php if (ON == config_get('enable_profiles')) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PLATFORM; ?> " id="platform_filter"><?php echo lang_get('platform'); ?> :</a> <?php } ?> </td> <td class="small-caption" valign="top"> <?php if (ON == config_get('enable_profiles')) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_OS; ?> " id="os_filter"><?php echo lang_get('os'); ?> :</a> <?php } ?> </td> <td class="small-caption" valign="top"> <?php if (ON == config_get('enable_profiles')) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_OS_BUILD; ?> " id="os_build_filter"><?php echo lang_get('os_version'); ?> :</a> <?php } ?> </td> <td class="small-caption" valign="top" colspan="5"> <?php if (access_has_global_level(config_get('tag_view_threshold'))) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_TAG_STRING; ?> " id="tag_string_filter"><?php echo lang_get('tags'); ?> :</a> <?php } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr class="row-1"> <?php if (ON == config_get('enable_profiles')) { ?> <td class="small-caption" valign="top" id="platform_filter_target"> <?php print_multivalue_field(FILTER_PROPERTY_PLATFORM, $t_filter[FILTER_PROPERTY_PLATFORM]); ?> </td> <td class="small-caption" valign="top" id="os_filter_target"> <?php print_multivalue_field(FILTER_PROPERTY_OS, $t_filter[FILTER_PROPERTY_OS]); ?> </td> <td class="small-caption" valign="top" id="os_build_filter_target"> <?php print_multivalue_field(FILTER_PROPERTY_OS_BUILD, $t_filter[FILTER_PROPERTY_OS_BUILD]); ?> </td> <?php } else { ?> <td colspan="3"> </td> <?php } ?> <td class="small-caption" valign="top" id="tag_string_filter_target" colspan="5"> <?php $t_tag_string = $t_filter[FILTER_PROPERTY_TAG_STRING]; if ($t_filter[FILTER_PROPERTY_TAG_SELECT] != 0 && tag_exists($t_filter[FILTER_PROPERTY_TAG_SELECT])) { $t_tag_string .= is_blank($t_tag_string) ? '' : config_get('tag_separator'); $t_tag_string .= tag_get_field($t_filter[FILTER_PROPERTY_TAG_SELECT], 'name'); } echo string_html_entities($t_tag_string); echo '<input type="hidden" name="', FILTER_PROPERTY_TAG_STRING, '" value="', string_attribute($t_tag_string), '" />'; ?> </td> </tr> <?php # get plugin filters $t_plugin_filters = filter_get_plugin_filters(); $t_column = 0; $t_fields = ''; $t_values = ''; # output a filter form element for each plugin filter foreach ($t_plugin_filters as $t_field_name => $t_filter_object) { $t_fields .= '<td class="small-caption" valign="top"> <a href="' . $t_filters_url . string_attribute($t_field_name) . '" id="' . string_attribute($t_field_name) . '_filter">' . string_display_line($t_filter_object->title) . '</a> </td>'; $t_values .= '<td class="small-caption" valign="top" id="' . string_attribute($t_field_name) . '_filter_target"> '; if (!isset($t_filter[$t_field_name])) { $t_values .= lang_get('any'); } else { switch ($t_filter_object->type) { case FILTER_TYPE_STRING: case FILTER_TYPE_INT: if (filter_field_is_any($t_filter[$t_field_name])) { $t_values .= lang_get('any'); } else { $t_values .= string_display_line($t_filter[$t_field_name]); } $t_values .= '<input type="hidden" name="' . string_attribute($t_field_name) . '" value="' . string_attribute($t_filter[$t_field_name]) . '"/>'; break; case FILTER_TYPE_BOOLEAN: $t_values .= string_display_line($t_filter_object->display((bool) $t_filter[$t_field_name])); $t_values .= '<input type="hidden" name="' . string_attribute($t_field_name) . '" value="' . (bool) $t_filter[$t_field_name] . '"/>'; break; case FILTER_TYPE_MULTI_STRING: case FILTER_TYPE_MULTI_INT: $t_first = true; $t_output = ''; if (!is_array($t_filter[$t_field_name])) { $t_filter[$t_field_name] = array($t_filter[$t_field_name]); } foreach ($t_filter[$t_field_name] as $t_current) { if (filter_field_is_any($t_current)) { $t_output .= lang_get('any'); } else { $t_output .= ($t_first ? '' : '<br />') . string_display_line($t_filter_object->display($t_current)); $t_first = false; } $t_values .= '<input type="hidden" name="' . string_attribute($t_field_name) . '[]" value="' . string_attribute($t_current) . '"/>'; } $t_values .= $t_output; break; } } $t_values .= '</td>'; $t_column++; # wrap at the appropriate column if ($t_column >= $t_filter_cols) { echo '<tr class="', $t_trclass, '">', $t_fields, '</tr>'; echo '<tr class="row-1">', $t_values, '</tr>'; $t_fields = ''; $t_values = ''; $t_column = 0; } } # output any remaining plugin filters if ($t_column > 0) { if ($t_column < $t_filter_cols) { $t_fields .= '<td class="small-caption" colspan="' . ($t_filter_cols - $t_column) . '"> </td>'; $t_values .= '<td class="small-caption" colspan="' . ($t_filter_cols - $t_column) . '"> </td>'; } echo '<tr class="', $t_trclass, '">', $t_fields, '</tr>'; echo '<tr class="row-1">', $t_values, '</tr>'; } if (ON == config_get('filter_by_custom_fields')) { # -- Custom Field Searching -- if (count($t_accessible_custom_fields_ids) > 0) { $t_per_row = config_get('filter_custom_fields_per_row'); $t_num_fields = count($t_accessible_custom_fields_ids); $t_row_idx = 0; $t_col_idx = 0; $t_fields = ''; $t_values = ''; for ($i = 0; $i < $t_num_fields; $i++) { if ($t_col_idx == 0) { $t_fields = '<tr class="' . $t_trclass . '">'; $t_values = '<tr class="row-1">'; } if (isset($t_accessible_custom_fields_names[$i])) { $t_fields .= '<td class="small-caption" valign="top"> '; $t_fields .= '<a href="' . $t_filters_url . 'custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter">'; $t_fields .= string_display_line(lang_get_defaulted($t_accessible_custom_fields_names[$i])); $t_fields .= '</a> </td> '; } $t_output = ''; $t_any_found = false; $t_values .= '<td class="small-caption" valign="top" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter_target"> '; if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]])) { $t_values .= lang_get('any'); } else { if ($t_accessible_custom_fields_types[$i] == CUSTOM_FIELD_TYPE_DATE) { /** @todo moved embedded javascript here from print_filter_custom_field_date * it appears not to load properly on Firefox and other browsers if loaded through the httpxmlreq */ $t_field_id = $t_accessible_custom_fields_ids[$i]; $t_js_toggle_func = "toggle_custom_date_field_" . $t_field_id . "_controls"; if (ON == config_get('dhtml_filters') && ON == config_get('use_javascript')) { ?> <script type="text/javascript" language="JavaScript"> <!-- function <?php echo $t_js_toggle_func . "_start"; ?> (disable) { document.filters_open.custom_field_<?php echo $t_field_id; ?> _start_year.disabled = disable ; document.filters_open.custom_field_<?php echo $t_field_id; ?> _start_month.disabled = disable ; document.filters_open.custom_field_<?php echo $t_field_id; ?> _start_day.disabled = disable ; } ; function <?php echo $t_js_toggle_func . "_end"; ?> (disable) { document.filters_open.custom_field_<?php echo $t_field_id; ?> _end_year.disabled = disable ; document.filters_open.custom_field_<?php echo $t_field_id; ?> _end_month.disabled = disable ; document.filters_open.custom_field_<?php echo $t_field_id; ?> _end_day.disabled = disable ; } ; function <?php echo $t_js_toggle_func; ?> () { switch (document.filters_open.custom_field_<?php echo $t_field_id; ?> _control.selectedIndex) { case <?php echo CUSTOM_FIELD_DATE_ANY; ?> : case <?php echo CUSTOM_FIELD_DATE_NONE; ?> : <?php echo $t_js_toggle_func . "_start"; ?> (true) ; <?php echo $t_js_toggle_func . "_end"; ?> (true) ; break ; case <?php echo CUSTOM_FIELD_DATE_BETWEEN; ?> : <?php echo $t_js_toggle_func . "_start"; ?> (false) ; <?php echo $t_js_toggle_func . "_end"; ?> (false) ; break ; default: <?php echo $t_js_toggle_func . "_start"; ?> (false) ; <?php echo $t_js_toggle_func . "_end"; ?> (true) ; break ; } } // --> </script> <?php } # end if dhtml_filters $t_short_date_format = config_get('short_date_format'); if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1])) { $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1] = 0; } $t_start = date($t_short_date_format, $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1]); if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2])) { $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2] = 0; } $t_end = date($t_short_date_format, $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2]); switch ($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][0]) { case CUSTOM_FIELD_DATE_ANY: $t_values .= lang_get('any'); break; case CUSTOM_FIELD_DATE_NONE: $t_values .= lang_get('none'); break; case CUSTOM_FIELD_DATE_BETWEEN: $t_values .= lang_get('between_date') . '<br />'; $t_values .= $t_start . '<br />' . $t_end; break; case CUSTOM_FIELD_DATE_ONORBEFORE: $t_values .= lang_get('on_or_before_date') . '<br />'; $t_values .= $t_end; break; case CUSTOM_FIELD_DATE_BEFORE: $t_values .= lang_get('before_date') . '<br />'; $t_values .= $t_end; break; case CUSTOM_FIELD_DATE_ON: $t_values .= lang_get('on_date') . '<br />'; $t_values .= $t_start; break; case CUSTOM_FIELD_DATE_AFTER: $t_values .= lang_get('after_date') . '<br />'; $t_values .= $t_start; break; case CUSTOM_FIELD_DATE_ONORAFTER: $t_values .= lang_get('on_or_after_date') . '<br />'; $t_values .= $t_start; break; } } else { $t_first_flag = true; foreach ($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]] as $t_current) { $t_current = stripslashes($t_current); $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_none($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = $t_current; } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); $t_values .= '<input type="hidden" name="custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]" value="' . string_attribute($t_current) . '" />'; } } if (true == $t_any_found) { $t_values .= lang_get('any'); } else { $t_values .= $t_output; } } $t_values .= ' </td>'; $t_col_idx++; if ($t_col_idx == $t_per_row) { if ($t_filter_cols > $t_per_row) { $t_fields .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; $t_values .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; } $t_fields .= '</tr>' . "\n"; $t_values .= '</tr>' . "\n"; echo $t_fields; echo $t_values; $t_col_idx = 0; $t_row_idx++; } } if ($t_col_idx > 0) { if ($t_col_idx < $t_per_row) { $t_fields .= '<td colspan="' . ($t_per_row - $t_col_idx) . '"> </td> '; $t_values .= '<td colspan="' . ($t_per_row - $t_col_idx) . '"> </td> '; } if ($t_filter_cols > $t_per_row) { $t_fields .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; $t_values .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; } $t_fields .= '</tr>' . "\n"; $t_values .= '</tr>' . "\n"; echo $t_fields; echo $t_values; } } } ?> <tr class="row-1"> <td class="small-caption category2" valign="top"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_NOTE_USER_ID; ?> " id="note_user_id_filter"><?php echo lang_get('note_user_id'); ?> :</a> </td> <td class="small-caption" valign="top" id="note_user_id_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_NOTE_USER_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_NOTE_USER_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_NOTE_USER_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_name = ''; if (filter_field_is_none($t_current)) { $t_this_name = lang_get('none'); } else { if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_myself($t_current)) { if (access_has_project_level(config_get('handle_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { $t_this_name = user_get_name($t_current); } } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_name); } if (true == $t_any_found) { echo lang_get('any'); } else { $t_output; } } ?> </td> <td class="small-caption" valign="top"> <a href="<?php echo $t_filters_url . 'show_sort'; ?> " id="show_sort_filter"><?php echo lang_get('sort'); ?> :</a> </td> <td class="small-caption" valign="top" id="show_sort_filter_target"> <?php $t_sort_fields = explode(',', $t_filter[FILTER_PROPERTY_SORT_FIELD_NAME]); $t_dir_fields = explode(',', $t_filter[FILTER_PROPERTY_SORT_DIRECTION]); for ($i = 0; $i < 2; $i++) { if (isset($t_sort_fields[$i])) { if (0 < $i) { echo ', '; } $t_sort = $t_sort_fields[$i]; if (strpos($t_sort, 'custom_') === 0) { $t_field_name = string_display(lang_get_defaulted(utf8_substr($t_sort, utf8_strlen('custom_')))); } else { $t_field_name = string_get_field_name($t_sort); } echo $t_field_name . ' ' . lang_get('bugnote_order_' . utf8_strtolower($t_dir_fields[$i])); echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_', $i, '" value="', string_attribute($t_sort_fields[$i]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_DIRECTION, '_', $i, '" value="', string_attribute($t_dir_fields[$i]), '" />'; } } ?> </td> <?php if ('advanced' == $t_view_type) { ?> <td class="small-caption" valign="top" colspan="2"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PROJECT_ID; ?> " id="project_id_filter"><?php echo lang_get('email_project'); ?> :</a> </td> <td class="small-caption" valign="top" id="project_id_filter_target"> <?php $t_output = ''; if (!is_array($t_filter[FILTER_PROPERTY_PROJECT_ID])) { $t_filter[FILTER_PROPERTY_PROJECT_ID] = array($t_filter[FILTER_PROPERTY_PROJECT_ID]); } if (count($t_filter[FILTER_PROPERTY_PROJECT_ID]) == 0) { echo lang_get('current'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_PROJECT_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_PROJECT_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_name = ''; if (META_FILTER_CURRENT == $t_current) { $t_this_name = lang_get('current'); } else { $t_this_name = project_get_name($t_current, false); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_name); } echo $t_output; } ?> </td> <?php if ($t_filter_cols > 6) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 5) . '"> </td>'; } } else { if ($t_filter_cols > 3) { echo '<td class="small-caption" valign="top" colspan="' . ($t_filter_cols - 2) . '"> </td>'; } } ?> </tr> <?php } // expanded ?> <tr> <td colspan="2"> <?php collapse_icon('filter'); echo lang_get('search') . ' '; echo '<input type="text" size="16" name="', FILTER_PROPERTY_FREE_TEXT, '" value="', string_attribute($t_filter[FILTER_PROPERTY_FREE_TEXT]), '" />'; ?> <input type="submit" name="filter" class="button-small" value="<?php echo lang_get('filter_button'); ?> " /> </td> </form> <td class="center" colspan="<?php echo $t_filter_cols - 6; ?> "> <!-- use this label for padding --> <?php if (ON == config_get('dhtml_filters')) { $f_switch_view_link = 'view_all_set.php?type=6&view_type='; } else { $f_switch_view_link = 'view_filters_page.php?view_type='; } $t_view_filters = config_get('view_filters'); if (SIMPLE_ONLY != $t_view_filters && ADVANCED_ONLY != $t_view_filters) { if ('advanced' == $t_view_type) { print_bracket_link($f_switch_view_link . 'simple', lang_get('simple_filters')); } else { print_bracket_link($f_switch_view_link . 'advanced', lang_get('advanced_filters')); } } if (access_has_project_level(config_get('create_permalink_threshold'))) { print_bracket_link('permalink_page.php?url=' . urlencode(filter_get_url($t_filter)), lang_get('create_filter_link'), true); } ?> </td> <td class="right" colspan="4"> <?php $t_stored_queries_arr = array(); $t_stored_queries_arr = filter_db_get_available_queries(); if (count($t_stored_queries_arr) > 0) { ?> <form method="get" name="list_queries<?php echo $t_form_name_suffix; ?> " action="view_all_set.php"> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="hidden" name="type" value="3" /> <?php if (ON == config_get('use_javascript')) { echo "<select name=\"source_query_id\" onchange=\"document.forms.list_queries{$t_form_name_suffix}.submit();\">"; } else { echo '<select name="source_query_id">'; } ?> <option value="-1"><?php echo '[' . lang_get('reset_query') . ']'; ?> </option> <option value="-1"></option> <?php foreach ($t_stored_queries_arr as $t_query_id => $t_query_name) { echo '<option value="' . string_attribute($t_query_id) . '">' . string_display_line($t_query_name) . '</option>'; } ?> </select> <input type="submit" name="switch_to_query_button" class="button-small" value="<?php echo lang_get('use_query'); ?> " /> </form> <form method="post" name="open_queries" action="query_view_page.php"> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="submit" name="switch_to_query_button" class="button-small" value="<?php echo lang_get('open_queries'); ?> " /> </form> <?php } else { ?> <form method="get" name="reset_query" action="view_all_set.php"> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="hidden" name="type" value="3" /> <input type="hidden" name="source_query_id" value="-1" /> <input type="submit" name="reset_query_button" class="button-small" value="<?php echo lang_get('reset_query'); ?> " /> </form> <?php } if (access_has_project_level(config_get('stored_query_create_threshold'))) { ?> <form method="post" name="save_query" action="query_store_page.php"> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="submit" name="save_query_button" class="button-small" value="<?php echo lang_get('save_query'); ?> " /> </form> <?php } ?> </td> </tr> </table> <?php }
<!-- Custom Fields --> <?php /** @todo thraxisp - I undid part of the change for #5068 for #5527 * We really need to say what fields are shown in which statusses. For now, * this page will show required custom fields in update mode, or * display or required fields on resolve or close */ $t_custom_status_label = "update"; # Don't show custom fields by default if ($f_new_status == $t_resolved && $f_new_status < $t_closed) { $t_custom_status_label = "resolved"; } if ($t_closed == $f_new_status) { $t_custom_status_label = "closed"; } $t_related_custom_field_ids = custom_field_get_linked_ids(bug_get_field($f_bug_id, 'project_id')); foreach ($t_related_custom_field_ids as $t_id) { $t_def = custom_field_get_definition($t_id); $t_display = $t_def['display_' . $t_custom_status_label]; $t_require = $t_def['require_' . $t_custom_status_label]; if ("update" == $t_custom_status_label && !$t_require) { continue; } if (in_array($t_custom_status_label, array("resolved", "closed")) && !($t_display || $t_require)) { continue; } if (custom_field_has_write_access($t_id, $f_bug_id)) { ?> <tr <?php echo helper_alternate_class(); ?>
/** * 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; }
function format_value($bug, $field_name) { $values = array('id' => function ($bug) { return sprintf('%s <%s>', $bug->id, string_get_bug_view_url_with_fqdn($bug->id)); }, 'project_id' => function ($bug) { return project_get_name($bug->project_id); }, 'reporter_id' => function ($bug) { return '@' . user_get_name($bug->reporter_id); }, 'handler_id' => function ($bug) { return empty($bug->handler_id) ? plugin_lang_get('no_user') : '@' . user_get_name($bug->handler_id); }, 'duplicate_id' => function ($bug) { return sprintf('%s <%s>', $bug->duplicate_id, string_get_bug_view_url_with_fqdn($bug->duplicate_id)); }, 'priority' => function ($bug) { return get_enum_element('priority', $bug->priority); }, 'severity' => function ($bug) { return get_enum_element('severity', $bug->severity); }, 'reproducibility' => function ($bug) { return get_enum_element('reproducibility', $bug->reproducibility); }, 'status' => function ($bug) { return get_enum_element('status', $bug->status); }, 'resolution' => function ($bug) { return get_enum_element('resolution', $bug->resolution); }, 'projection' => function ($bug) { return get_enum_element('projection', $bug->projection); }, 'category_id' => function ($bug) { return category_full_name($bug->category_id, false); }, 'eta' => function ($bug) { return get_enum_element('eta', $bug->eta); }, 'view_state' => function ($bug) { return $bug->view_state == VS_PRIVATE ? lang_get('private') : lang_get('public'); }, 'sponsorship_total' => function ($bug) { return sponsorship_format_amount($bug->sponsorship_total); }, 'os' => function ($bug) { return $bug->os; }, 'os_build' => function ($bug) { return $bug->os_build; }, 'platform' => function ($bug) { return $bug->platform; }, 'version' => function ($bug) { return $bug->version; }, 'fixed_in_version' => function ($bug) { return $bug->fixed_in_version; }, 'target_version' => function ($bug) { return $bug->target_version; }, 'build' => function ($bug) { return $bug->build; }, 'summary' => function ($bug) { return HipChatPlugin::clean_summary(bug_format_summary($bug->id, SUMMARY_FIELD)); }, 'last_updated' => function ($bug) { return date(config_get('short_date_format'), $bug->last_updated); }, 'date_submitted' => function ($bug) { return date(config_get('short_date_format'), $bug->date_submitted); }, 'due_date' => function ($bug) { return date(config_get('short_date_format'), $bug->due_date); }, 'description' => function ($bug) { return string_display_links($bug->description); }, 'steps_to_reproduce' => function ($bug) { return string_display_links($bug->steps_to_reproduce); }, 'additional_information' => function ($bug) { return string_display_links($bug->additional_information); }); // Discover custom fields. $t_related_custom_field_ids = custom_field_get_linked_ids($bug->project_id); foreach ($t_related_custom_field_ids as $t_id) { $t_def = custom_field_get_definition($t_id); $values['custom_' . $t_def['name']] = function ($bug) use($t_id) { return custom_field_get_value($t_id, $bug->id); }; } if (isset($values[$field_name])) { $func = $values[$field_name]; return $func($bug); } else { return sprintf(plugin_lang_get('unknown_field'), $field_name); } }
function save_bug($p_project_id, $p_user_id) { require 'ProfileAcraExt.php'; $t_project_id = $p_project_id; global $g_cache_current_user_id; $g_cache_current_user_id = $p_user_id; $t_bug_data = new BugData(); $t_bug_data->project_id = $t_project_id; $t_bug_data->reporter_id = $p_user_id; $t_bug_data->build = gpc_get_string('APP_VERSION_CODE', ''); $t_bug_data->platform = "Android"; $t_bug_data->os = gpc_get_string('ANDROID_VERSION', ''); //gpc_get_string( 'os', '' ); $t_os_build = gpc_get_string('BUILD', ''); if (preg_match('/DISPLAY\\s*=\\s*(.*)/', $t_os_build, $t_match)) { var_dump($t_match); $t_os_build = $t_match[1]; } else { $t_os_build = gpc_get_string('ANDROID_VERSION', ''); } $t_bug_data->os_build = $t_os_build; //gpc_get_string( 'os_build', '' ); $t_bug_data->version = gpc_get_string('APP_VERSION_NAME', ''); $t_bug_data->profile_id = profile_create_unique(ALL_USERS, $t_bug_data->platform, $t_bug_data->os, $t_bug_data->os_build, ""); $t_bug_data->handler_id = gpc_get_int('handler_id', 0); $t_bug_data->view_state = gpc_get_int('view_state', config_get('default_bug_view_status', 'VS_PRIVATE', 'acra_reporter')); $t_bug_data->category_id = $this->get_category_id($p_project_id); //gpc_get_int( 'category_id', 0 ); $t_bug_data->reproducibility = 10; //gpc_get_int( 'reproducibility', config_get( 'default_bug_reproducibility' ) ); $t_bug_data->severity = CRASH; //gpc_get_int( 'severity', config_get( 'default_bug_severity' ) ); $t_bug_data->priority = HIGH; //gpc_get_int( 'priority', config_get( 'default_bug_priority' ) ); $t_bug_data->projection = gpc_get_int('projection', config_get('default_bug_projection')); $t_bug_data->eta = gpc_get_int('eta', config_get('default_bug_eta')); $t_bug_data->resolution = OPEN; //gpc_get_string('resolution', config_get( 'default_bug_resolution' ) ); $t_bug_data->status = NEW_; //gpc_get_string( 'status', config_get( 'bug_submit_status' ) ); $t_bug_data->description = gpc_get_string('STACK_TRACE'); //gpc_get_string( 'description' ); $t_bug_data->summary = get_bug_summary_by_version(gpc_get_string('APP_VERSION_NAME', ''), $t_bug_data->description, $t_project_id); $t_bug_data->steps_to_reproduce = gpc_get_string('LOGCAT', ""); $t_bug_data->additional_information = gpc_get_string('CRASH_CONFIGURATION', ""); $t_bug_data->due_date = gpc_get_string('USER_CRASH_DATE', ''); if (is_blank($t_bug_data->due_date)) { $t_bug_data->due_date = date_get_null(); } $f_files = gpc_get_file('ufile', null); /** @todo (thraxisp) Note that this always returns a structure */ $f_report_stay = gpc_get_bool('report_stay', false); $f_copy_notes_from_parent = gpc_get_bool('copy_notes_from_parent', false); helper_call_custom_function('issue_create_validate', array($t_bug_data)); # Validate the custom fields before adding the bug. $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); # Produce an error if the field is required but wasn't posted if (!gpc_isset_custom_field($t_id, $t_def['type']) && $t_def['require_report']) { error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name'))); trigger_error(ERROR_EMPTY_FIELD, ERROR); } if (!custom_field_validate($t_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'))); trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR); } } # Allow plugins to pre-process bug data $t_bug_data = event_signal('EVENT_REPORT_BUG_DATA', $t_bug_data); # Ensure that resolved bugs have a handler if ($t_bug_data->handler_id == NO_USER && $t_bug_data->status >= config_get('bug_resolved_status_threshold')) { $t_bug_data->handler_id = $this->get_user_id(); } # Create the bug $t_bug_id = $t_bug_data->create(); # Mark the added issue as visited so that it appears on the last visited list. last_visited_issue($t_bug_id); # Handle the file upload if ($f_files != null) { $t_files = helper_array_transpose($f_files); if ($t_files != null) { foreach ($t_files as $t_file) { if (!empty($t_file['name'])) { 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); # Add log line to the history (both issues) history_log_event_special($f_master_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type($f_rel_type), $t_bug_id); history_log_event_special($t_bug_id, BUG_ADD_RELATIONSHIP, $f_rel_type, $f_master_bug_id); # update relationship target bug last updated bug_update_date($t_bug_id); # Send the email notification email_relationship_added($f_master_bug_id, $t_bug_id, relationship_get_complementary_type($f_rel_type)); } # copy notes from parent if ($f_copy_notes_from_parent) { $t_parent_bugnotes = bugnote_get_all_bugnotes($f_master_bug_id); foreach ($t_parent_bugnotes as $t_parent_bugnote) { $t_private = $t_parent_bugnote->view_state == VS_PRIVATE; bugnote_add($t_bug_id, $t_parent_bugnote->note, $t_parent_bugnote->time_tracking, $t_private, $t_parent_bugnote->note_type, $t_parent_bugnote->note_attr, $t_parent_bugnote->reporter_id, FALSE, FALSE); } } } helper_call_custom_function('issue_create_notify', array($t_bug_id)); # Allow plugins to post-process bug data with the new bug ID event_signal('EVENT_REPORT_BUG', array($t_bug_data, $t_bug_id)); email_new_bug($t_bug_id); // log status and resolution changes if they differ from the default if ($t_bug_data->status != config_get('bug_submit_status')) { history_log_event($t_bug_id, 'status', config_get('bug_submit_status')); } if ($t_bug_data->resolution != config_get('default_bug_resolution')) { history_log_event($t_bug_id, 'resolution', config_get('default_bug_resolution')); } return $t_bug_id; }
/** * Prints the filter selection area for both the bug list view screen and * the bug list print screen. This function was an attempt to make it easier to * add new filters and rearrange them on screen for both pages. * @param integer $p_page_number Page number. * @param boolean $p_for_screen Whether output is for screen view. * @param boolean $p_expanded Whether to display expanded. * @return void */ function filter_draw_selection_area2($p_page_number, $p_for_screen = true, $p_expanded = true) { $t_form_name_suffix = $p_expanded ? '_open' : '_closed'; $t_filter = current_user_get_bug_filter(); $t_filter = filter_ensure_valid_filter($t_filter === false ? array() : $t_filter); $t_project_id = helper_get_current_project(); $t_page_number = (int) $p_page_number; $t_view_type = $t_filter['_view_type']; $t_tdclass = 'small-caption'; $t_trclass = 'row-category2'; $t_action = 'view_all_set.php?f=3'; if ($p_for_screen == false) { $t_tdclass = 'print'; $t_trclass = ''; $t_action = 'view_all_set.php'; } ?> <div class="filter-box"> <form method="post" name="filters<?php echo $t_form_name_suffix; ?> " id="filters_form<?php echo $t_form_name_suffix; ?> " action="<?php echo $t_action; ?> "> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="hidden" name="type" value="1" /> <?php if ($p_for_screen == false) { echo '<input type="hidden" name="print" value="1" />'; echo '<input type="hidden" name="offset" value="0" />'; } ?> <input type="hidden" name="page_number" value="<?php echo $t_page_number; ?> " /> <input type="hidden" name="view_type" value="<?php echo $t_view_type; ?> " /> <?php $t_filter_cols = config_get('filter_custom_fields_per_row'); if ($p_expanded) { ?> <table width="100%" cellspacing="1"> <?php $t_custom_cols = $t_filter_cols; $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_values = array(); $t_num_custom_rows = 0; $t_per_row = 0; if (ON == config_get('filter_by_custom_fields')) { $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_field_info['filter_by']) { $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_accessible_custom_fields_values[] = custom_field_distinct_values($t_field_info); } } if (count($t_accessible_custom_fields_ids) > 0) { $t_per_row = config_get('filter_custom_fields_per_row'); $t_num_custom_rows = ceil(count($t_accessible_custom_fields_ids) / $t_per_row); } } $t_filters_url = 'view_filters_page.php?for_screen=' . $p_for_screen; if ('advanced' == $t_view_type) { $t_filters_url = $t_filters_url . '&view_type=advanced'; } $t_filters_url = $t_filters_url . '&target_field='; $t_show_product_version = version_should_show_product_version($t_project_id); $t_show_build = $t_show_product_version && config_get('enable_product_build') == ON; # overload handler_id setting if user isn't supposed to see them (ref #6189) if (!access_has_any_project(config_get('view_handler_threshold'))) { $t_filter[FILTER_PROPERTY_HANDLER_ID] = array(META_FILTER_ANY); } $t_dynamic_filter_expander_class = config_get('use_dynamic_filters') ? ' class="dynamic-filter-expander"' : ''; ?> <tr <?php echo 'class="' . $t_trclass . '"'; ?> > <td class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_REPORTER_ID . '[]'; ?> " id="reporter_id_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('reporter_label'); ?> </a> </td> <td class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_MONITOR_USER_ID . '[]'; ?> " id="user_monitor_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('monitored_by_label'); ?> </a> </td> <td class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HANDLER_ID . '[]'; ?> " id="handler_id_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('assigned_to_label'); ?> </a> </td> <td colspan="2" class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_CATEGORY_ID . '[]'; ?> " id="show_category_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('category_label'); ?> </a> </td> <td class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_SEVERITY . '[]'; ?> " id="show_severity_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('severity_label'); ?> </a> </td> <td class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_RESOLUTION . '[]'; ?> " id="show_resolution_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('resolution_label'); ?> </a> </td> <td class="small-caption"> <?php if (ON == config_get('enable_profiles')) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PROFILE_ID . '[]'; ?> " id="show_profile_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('profile_label'); ?> </a> <?php } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr class="row-1"> <td class="small-caption" id="reporter_id_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_REPORTER_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_REPORTER_ID] as $t_current) { $t_this_name = ''; echo '<input type="hidden" name="', FILTER_PROPERTY_REPORTER_ID, '[]" value="', string_attribute($t_current), '" />'; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_myself($t_current)) { if (access_has_project_level(config_get('report_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { if (filter_field_is_none($t_current)) { $t_this_name = lang_get('none'); } else { $t_this_name = user_get_name($t_current); } } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_name); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td class="small-caption" id="user_monitor_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_MONITOR_USER_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_MONITOR_USER_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_MONITOR_USER_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_name = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_myself($t_current)) { if (access_has_project_level(config_get('monitor_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { $t_this_name = user_get_name($t_current); } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_name); } if (true == $t_any_found) { echo lang_get('any'); } else { echo string_display($t_output); } } ?> </td> <td class="small-caption" id="handler_id_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_HANDLER_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_HANDLER_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_HANDLER_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_name = ''; if (filter_field_is_none($t_current)) { $t_this_name = lang_get('none'); } else { if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_myself($t_current)) { if (access_has_project_level(config_get('handle_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { $t_this_name = user_get_name($t_current); } } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_name); } if (true == $t_any_found) { echo lang_get('any'); } else { echo string_display($t_output); } } ?> </td> <td colspan="2" class="small-caption" id="show_category_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_CATEGORY_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_CATEGORY_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_CATEGORY_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_this_string = $t_current; } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td class="small-caption" id="show_severity_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_SEVERITY]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_SEVERITY] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_SEVERITY, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_this_string = get_enum_element('severity', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td class="small-caption" id="show_resolution_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_RESOLUTION]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_RESOLUTION] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_RESOLUTION, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_this_string = get_enum_element('resolution', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php if (ON == config_get('enable_profiles')) { ?> <td class="small-caption" id="show_profile_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_PROFILE_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_PROFILE_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_PROFILE_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_profile = profile_get_row_direct($t_current); $t_this_string = $t_profile['platform'] . ' ' . $t_profile['os'] . ' ' . $t_profile['os_build']; } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php } else { ?> <td></td> <?php } if ($t_filter_cols > 8) { echo '<td class="small-caption" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr <?php echo 'class="' . $t_trclass . '"'; ?> > <td class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_STATUS . '[]'; ?> " id="show_status_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('status_label'); ?> </a> </td> <td class="small-caption"> <?php if ('simple' == $t_view_type) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIDE_STATUS . '[]'; ?> " id="hide_status_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('hide_status_label'); ?> </a> <?php } ?> </td> <td class="small-caption"> <?php if ($t_show_build) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_BUILD . '[]'; ?> " id="show_build_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('product_build_label'); ?> </a> <?php } ?> </td> <?php if ($t_show_product_version) { ?> <td colspan="2" class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_VERSION . '[]'; ?> " id="show_version_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('product_version_label'); ?> </a> </td> <td colspan="1" class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_FIXED_IN_VERSION . '[]'; ?> " id="show_fixed_in_version_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('fixed_in_version_label'); ?> </a> </td> <?php } else { ?> <td colspan="2" class="small-caption">   </td> <td colspan="1" class="small-caption">   </td> <?php } ?> <td colspan="1" class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PRIORITY . '[]'; ?> " id="show_priority_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('priority_label'); ?> </a> </td> <?php if ($t_show_product_version) { ?> <td colspan="1" class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_TARGET_VERSION . '[]'; ?> " id="show_target_version_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('target_version_label'); ?> </a> </td> <?php } else { ?> <td colspan="1" class="small-caption">   </td> <?php } if ($t_filter_cols > 8) { echo '<td class="small-caption" colspan="' . ($t_filter_cols - 7) . '"> </td>'; } ?> </tr> <tr class="row-1"> <td class="small-caption" id="show_status_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_STATUS]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_STATUS] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_STATUS, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_this_string = get_enum_element('status', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td class="small-caption" id="hide_status_filter_target"> <?php if ('simple' == $t_view_type) { $t_output = ''; $t_none_found = false; if (count($t_filter[FILTER_PROPERTY_HIDE_STATUS]) == 0) { echo lang_get('none'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_HIDE_STATUS] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_HIDE_STATUS, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_none($t_current)) { $t_none_found = true; } else { $t_this_string = get_enum_element('status', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } $t_hide_status_post = ''; if (count($t_filter[FILTER_PROPERTY_HIDE_STATUS]) == 1) { $t_hide_status_post = ' (' . lang_get('and_above') . ')'; } if (true == $t_none_found) { echo lang_get('none'); } else { echo $t_output . string_display_line($t_hide_status_post); } } } ?> </td> <?php if ($t_show_build) { ?> <td class="small-caption" id="show_build_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_BUILD]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_BUILD] as $t_current) { $t_current = stripslashes($t_current); echo '<input type="hidden" name="', FILTER_PROPERTY_BUILD, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_none($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = $t_current; } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php } else { ?> <td class="small-caption"></td> <?php } if ($t_show_product_version) { ?> <td colspan="2" class="small-caption" id="show_version_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_VERSION]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_VERSION] as $t_current) { $t_current = stripslashes($t_current); echo '<input type="hidden" name="', FILTER_PROPERTY_VERSION, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_none($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = $t_current; } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <td colspan="1" class="small-caption" id="show_fixed_in_version_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_FIXED_IN_VERSION]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_FIXED_IN_VERSION] as $t_current) { $t_current = stripslashes($t_current); echo '<input type="hidden" name="', FILTER_PROPERTY_FIXED_IN_VERSION, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_none($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = $t_current; } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php } else { ?> <td colspan="2" class="small-caption">   </td> <td colspan="1" class="small-caption">   </td> <?php } ?> <td colspan="1" class="small-caption" id="show_priority_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_PRIORITY]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_PRIORITY] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_PRIORITY, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { $t_this_string = get_enum_element('priority', $t_current); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php if ($t_show_product_version) { ?> <td colspan="1" class="small-caption" id="show_target_version_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_TARGET_VERSION]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_TARGET_VERSION] as $t_current) { $t_current = stripslashes($t_current); echo '<input type="hidden" name="', FILTER_PROPERTY_TARGET_VERSION, '[]" value="', string_attribute($t_current), '" />'; $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_none($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = $t_current; } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <?php } else { ?> <td colspan="1" class="small-caption">   </td> <?php } if ($t_filter_cols > 8) { echo '<td class="small-caption" colspan="' . ($t_filter_cols - 7) . '"> </td>'; } ?> </tr> <tr <?php echo 'class="' . $t_trclass . '"'; ?> > <td class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_ISSUES_PER_PAGE; ?> " id="per_page_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('show_label'); ?> </a> </td> <td class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_VIEW_STATE; ?> " id="view_state_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('view_status_label'); ?> </a> </td> <td class="small-caption"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_STICKY; ?> " id="sticky_issues_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('sticky_label'); ?> </a> </td> <td class="small-caption" colspan="2"> </td> <td class="small-caption" > <a href="<?php echo $t_filters_url . FILTER_PROPERTY_FILTER_BY_DATE; ?> " id="do_filter_by_date_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('use_date_filters_label'); ?> </a> </td> <td class="small-caption" colspan="2"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_RELATIONSHIP_TYPE; ?> " id="relationship_type_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('bug_relationships_label'); ?> </a> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr class="row-1"> <td class="small-caption" id="per_page_filter_target"> <?php echo $t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE] == 0 ? lang_get('all') : string_display_line($t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE]); echo '<input type="hidden" name="', FILTER_PROPERTY_ISSUES_PER_PAGE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE]), '" />'; ?> </td> <td class="small-caption" id="view_state_filter_target"> <?php if (VS_PUBLIC === $t_filter[FILTER_PROPERTY_VIEW_STATE]) { echo lang_get('public'); } else { if (VS_PRIVATE === $t_filter[FILTER_PROPERTY_VIEW_STATE]) { echo lang_get('private'); } else { echo lang_get('any'); $t_filter[FILTER_PROPERTY_VIEW_STATE] = META_FILTER_ANY; } } echo '<input type="hidden" name="', FILTER_PROPERTY_VIEW_STATE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_VIEW_STATE]), '" />'; ?> </td> <td class="small-caption" id="sticky_issues_filter_target"> <?php $t_sticky_filter_state = gpc_string_to_bool($t_filter[FILTER_PROPERTY_STICKY]); print $t_sticky_filter_state ? lang_get('yes') : lang_get('no'); ?> <input type="hidden" name="<?php echo FILTER_PROPERTY_STICKY; ?> " value="<?php echo $t_sticky_filter_state ? 'on' : 'off'; ?> " /> </td> <td class="small-caption" colspan="2">  </td> <td class="small-caption" id="do_filter_by_date_filter_target"> <?php if ('on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE]) { echo '<input type="hidden" name="', FILTER_PROPERTY_FILTER_BY_DATE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_FILTER_BY_DATE]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_START_MONTH, '" value="', string_attribute($t_filter[FILTER_PROPERTY_START_MONTH]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_START_DAY, '" value="', string_attribute($t_filter[FILTER_PROPERTY_START_DAY]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_START_YEAR, '" value="', string_attribute($t_filter[FILTER_PROPERTY_START_YEAR]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_END_MONTH, '" value="', string_attribute($t_filter[FILTER_PROPERTY_END_MONTH]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_END_DAY, '" value="', string_attribute($t_filter[FILTER_PROPERTY_END_DAY]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_END_YEAR, '" value="', string_attribute($t_filter[FILTER_PROPERTY_END_YEAR]), '" />'; $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY); $t_time = mktime(0, 0, 0, $t_filter[FILTER_PROPERTY_START_MONTH], $t_filter[FILTER_PROPERTY_START_DAY], $t_filter[FILTER_PROPERTY_START_YEAR]); foreach ($t_chars as $t_char) { if (strcasecmp($t_char, 'M') == 0) { echo ' '; echo date('F', $t_time); } if (strcasecmp($t_char, 'D') == 0) { echo ' '; echo date('d', $t_time); } if (strcasecmp($t_char, 'Y') == 0) { echo ' '; echo date('Y', $t_time); } } echo ' - '; $t_time = mktime(0, 0, 0, $t_filter[FILTER_PROPERTY_END_MONTH], $t_filter[FILTER_PROPERTY_END_DAY], $t_filter[FILTER_PROPERTY_END_YEAR]); foreach ($t_chars as $t_char) { if (strcasecmp($t_char, 'M') == 0) { echo ' '; echo date('F', $t_time); } if (strcasecmp($t_char, 'D') == 0) { echo ' '; echo date('d', $t_time); } if (strcasecmp($t_char, 'Y') == 0) { echo ' '; echo date('Y', $t_time); } } } else { echo lang_get('no'); } ?> </td> <td class="small-caption" colspan="2" id="relationship_type_filter_target"> <?php echo '<input type="hidden" name="', FILTER_PROPERTY_RELATIONSHIP_TYPE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_RELATIONSHIP_BUG, '" value="', string_attribute($t_filter[FILTER_PROPERTY_RELATIONSHIP_BUG]), '" />'; $c_rel_type = $t_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE]; $c_rel_bug = $t_filter[FILTER_PROPERTY_RELATIONSHIP_BUG]; if (-1 == $c_rel_type || 0 == $c_rel_bug) { echo lang_get('any'); } else { echo relationship_get_description_for_history($c_rel_type) . ' ' . $c_rel_bug; } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr <?php echo 'class="' . $t_trclass . '"'; ?> > <td class="small-caption"> <?php if (ON == config_get('enable_profiles')) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PLATFORM; ?> " id="platform_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('platform_label'); ?> </a> <?php } ?> </td> <td class="small-caption"> <?php if (ON == config_get('enable_profiles')) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_OS; ?> " id="os_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('os_label'); ?> </a> <?php } ?> </td> <td class="small-caption"> <?php if (ON == config_get('enable_profiles')) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_OS_BUILD; ?> " id="os_build_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('os_version_label'); ?> </a> <?php } ?> </td> <td class="small-caption" colspan="5"> <?php if (access_has_global_level(config_get('tag_view_threshold'))) { ?> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_TAG_STRING; ?> " id="tag_string_filter"<?php echo $t_dynamic_filter_expander_class; ?> ><?php echo lang_get('tags_label'); ?> </a> <?php } ?> </td> <?php if ($t_filter_cols > 8) { echo '<td class="small-caption" colspan="' . ($t_filter_cols - 8) . '"> </td>'; } ?> </tr> <tr class="row-1"> <?php if (ON == config_get('enable_profiles')) { ?> <td class="small-caption" id="platform_filter_target"> <?php print_multivalue_field(FILTER_PROPERTY_PLATFORM, $t_filter[FILTER_PROPERTY_PLATFORM]); ?> </td> <td class="small-caption" id="os_filter_target"> <?php print_multivalue_field(FILTER_PROPERTY_OS, $t_filter[FILTER_PROPERTY_OS]); ?> </td> <td class="small-caption" id="os_build_filter_target"> <?php print_multivalue_field(FILTER_PROPERTY_OS_BUILD, $t_filter[FILTER_PROPERTY_OS_BUILD]); ?> </td> <?php } else { ?> <td colspan="3"> </td> <?php } ?> <td class="small-caption" id="tag_string_filter_target" colspan="5"> <?php $t_tag_string = $t_filter[FILTER_PROPERTY_TAG_STRING]; if ($t_filter[FILTER_PROPERTY_TAG_SELECT] != 0 && tag_exists($t_filter[FILTER_PROPERTY_TAG_SELECT])) { $t_tag_string .= is_blank($t_tag_string) ? '' : config_get('tag_separator'); $t_tag_string .= tag_get_field($t_filter[FILTER_PROPERTY_TAG_SELECT], 'name'); } echo string_html_entities($t_tag_string); echo '<input type="hidden" name="', FILTER_PROPERTY_TAG_STRING, '" value="', string_attribute($t_tag_string), '" />'; ?> </td> </tr> <?php # get plugin filters $t_plugin_filters = filter_get_plugin_filters(); $t_plugin_filter_links = array(); $t_plugin_filter_fields = array(); $t_column_count_by_row = array(); $t_row = 0; foreach ($t_plugin_filters as $t_field_name => $t_filter_object) { # be sure the colspan is an integer $t_colspan = (int) $t_filter_object->colspan; # prevent silliness. if ($t_colspan < 0) { $t_colspan = abs($t_colspan); } else { if ($t_colspan > $t_filter_cols) { $t_colspan = $t_filter_cols; } else { if ($t_colspan == 0) { $t_colspan = 1; } } } # the row may already have elements in it. find out. $t_columns_available = $t_filter_cols - $t_column_count_by_row[$t_row]; if ($t_columns_available == 0) { $t_row++; } # see if there is room in the current row if ($t_columns_available >= $t_colspan) { $t_assigned_row = $t_row; $t_column_count_by_row[$t_row] += $t_colspan; } else { $t_is_assigned = false; # find a row with space foreach ($t_column_count_by_row as $t_row_num => $t_col_count) { if ($t_colspan <= $t_filter_cols - $t_col_count) { $t_assigned_row = $t_row_num; $t_column_count_by_row[$t_row_num] += $t_colspan; $t_is_assigned = true; break; } } if (!$t_is_assigned) { # no space was found in existing rows. Add a new row for it. $t_assigned_row = count($t_plugin_filter_links); $t_column_count_by_row[$t_assigned_row] = $t_colspan; } } $t_colspan_attr = $t_colspan > 1 ? 'colspan="' . $t_colspan . '" ' : ''; $t_plugin_filter_links[$t_assigned_row][] = '<td ' . $t_colspan_attr . 'class="small-caption"> <a href="' . $t_filters_url . string_attribute($t_field_name) . '" id="' . string_attribute($t_field_name) . '_filter">' . string_display_line($t_filter_object->title) . '</a> </td>'; $t_values = '<td ' . $t_colspan_attr . 'class="small-caption" id="' . string_attribute($t_field_name) . '_filter_target"> '; if (!isset($t_filter[$t_field_name])) { $t_values .= lang_get('any'); } else { switch ($t_filter_object->type) { case FILTER_TYPE_STRING: case FILTER_TYPE_INT: if (filter_field_is_any($t_filter[$t_field_name])) { $t_values .= lang_get('any'); } else { $t_values .= string_display_line($t_filter[$t_field_name]); } $t_values .= '<input type="hidden" name="' . string_attribute($t_field_name) . '" value="' . string_attribute($t_filter[$t_field_name]) . '"/>'; break; case FILTER_TYPE_BOOLEAN: $t_values .= string_display_line($t_filter_object->display((bool) $t_filter[$t_field_name])); $t_values .= '<input type="hidden" name="' . string_attribute($t_field_name) . '" value="' . (bool) $t_filter[$t_field_name] . '"/>'; break; case FILTER_TYPE_MULTI_STRING: case FILTER_TYPE_MULTI_INT: $t_first = true; $t_output = ''; if (!is_array($t_filter[$t_field_name])) { $t_filter[$t_field_name] = array($t_filter[$t_field_name]); } foreach ($t_filter[$t_field_name] as $t_current) { if (filter_field_is_any($t_current)) { $t_output .= lang_get('any'); } else { $t_output .= ($t_first ? '' : '<br/>') . string_display_line($t_filter_object->display($t_current)); $t_first = false; } $t_values .= '<input type="hidden" name="' . string_attribute($t_field_name) . '[]" value="' . string_attribute($t_current) . '"/>'; } $t_values .= $t_output; break; } } $t_values .= '</td>'; $t_plugin_filter_fields[$t_assigned_row][] = $t_values; } $t_row_count = count($t_plugin_filter_links); for ($i = 0; $i < $t_row_count; $i++) { if ($t_column_count_by_row[$i] < $t_filter_cols) { $t_plugin_filter_links[$i][] = '<td class="small-caption" colspan="' . ($t_filter_cols - $t_column_count_by_row[$i]) . '"> </td>'; $t_plugin_filter_fields[$i][] = '<td class="small-caption" colspan="' . ($t_filter_cols - $t_column_count_by_row[$i]) . '"> </td>'; } $t_links_row = "\n\t\t" . join("\n\t\t", $t_plugin_filter_links[$i]); $t_values_row = "\n\t\t" . join("\n\t\t", $t_plugin_filter_fields[$i]); echo "\n\t" . '<tr class="', $t_trclass, '">', $t_links_row, "\n\t</tr>"; echo "\n\t" . '<tr class="row-1">', $t_values_row, "\n\t</tr>\n\t"; } if (ON == config_get('filter_by_custom_fields')) { # -- Custom Field Searching -- if (count($t_accessible_custom_fields_ids) > 0) { $t_per_row = config_get('filter_custom_fields_per_row'); $t_num_fields = count($t_accessible_custom_fields_ids); $t_row_idx = 0; $t_col_idx = 0; $t_fields = ''; $t_values = ''; for ($i = 0; $i < $t_num_fields; $i++) { if ($t_col_idx == 0) { $t_fields = '<tr class="' . $t_trclass . '">'; $t_values = '<tr class="row-1">'; } if (isset($t_accessible_custom_fields_names[$i])) { $t_fields .= '<td class="small-caption"> '; $t_fields .= '<a href="' . $t_filters_url . 'custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter"' . $t_dynamic_filter_expander_class . '>'; $t_fields .= string_display_line(lang_get_defaulted($t_accessible_custom_fields_names[$i])); $t_fields .= '</a> </td> '; } $t_output = ''; $t_any_found = false; $t_values .= '<td class="small-caption" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter_target"> '; if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]])) { $t_values .= lang_get('any'); } else { if ($t_accessible_custom_fields_types[$i] == CUSTOM_FIELD_TYPE_DATE) { $t_short_date_format = config_get('short_date_format'); if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1])) { $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1] = 0; } $t_start = date($t_short_date_format, $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1]); if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2])) { $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2] = 0; } $t_end = date($t_short_date_format, $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2]); switch ($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][0]) { case CUSTOM_FIELD_DATE_ANY: $t_values .= lang_get('any'); break; case CUSTOM_FIELD_DATE_NONE: $t_values .= lang_get('none'); break; case CUSTOM_FIELD_DATE_BETWEEN: $t_values .= lang_get('between_date') . '<br />'; $t_values .= $t_start . '<br />' . $t_end; break; case CUSTOM_FIELD_DATE_ONORBEFORE: $t_values .= lang_get('on_or_before_date') . '<br />'; $t_values .= $t_end; break; case CUSTOM_FIELD_DATE_BEFORE: $t_values .= lang_get('before_date') . '<br />'; $t_values .= $t_end; break; case CUSTOM_FIELD_DATE_ON: $t_values .= lang_get('on_date') . '<br />'; $t_values .= $t_start; break; case CUSTOM_FIELD_DATE_AFTER: $t_values .= lang_get('after_date') . '<br />'; $t_values .= $t_start; break; case CUSTOM_FIELD_DATE_ONORAFTER: $t_values .= lang_get('on_or_after_date') . '<br />'; $t_values .= $t_start; break; } } else { $t_first_flag = true; foreach ($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]] as $t_current) { $t_current = stripslashes($t_current); $t_this_string = ''; if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_none($t_current)) { $t_this_string = lang_get('none'); } else { $t_this_string = $t_current; } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_string); $t_values .= '<input type="hidden" name="custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]" value="' . string_attribute($t_current) . '" />'; } } if (true == $t_any_found) { $t_values .= lang_get('any'); } else { $t_values .= $t_output; } } $t_values .= ' </td>'; $t_col_idx++; if ($t_col_idx == $t_per_row) { if ($t_filter_cols > $t_per_row) { $t_fields .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; $t_values .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; } $t_fields .= '</tr>' . "\n"; $t_values .= '</tr>' . "\n"; echo $t_fields; echo $t_values; $t_col_idx = 0; $t_row_idx++; } } if ($t_col_idx > 0) { if ($t_col_idx < $t_per_row) { $t_fields .= '<td colspan="' . ($t_per_row - $t_col_idx) . '"> </td> '; $t_values .= '<td colspan="' . ($t_per_row - $t_col_idx) . '"> </td> '; } if ($t_filter_cols > $t_per_row) { $t_fields .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; $t_values .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '"> </td> '; } $t_fields .= '</tr>' . "\n"; $t_values .= '</tr>' . "\n"; echo $t_fields; echo $t_values; } } } ?> <tr class="row-1"> <td class="small-caption category2"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_NOTE_USER_ID; ?> " id="note_user_id_filter"<?php echo $t_dynamic_filter_expander_class; ?> > <?php echo lang_get('note_user_id_label'); ?> </a> </td> <td class="small-caption" id="note_user_id_filter_target"> <?php $t_output = ''; $t_any_found = false; if (count($t_filter[FILTER_PROPERTY_NOTE_USER_ID]) == 0) { echo lang_get('any'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_NOTE_USER_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_NOTE_USER_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_name = ''; if (filter_field_is_none($t_current)) { $t_this_name = lang_get('none'); } else { if (filter_field_is_any($t_current)) { $t_any_found = true; } else { if (filter_field_is_myself($t_current)) { if (access_has_project_level(config_get('handle_bug_threshold'))) { $t_this_name = '[' . lang_get('myself') . ']'; } else { $t_any_found = true; } } else { $t_this_name = user_get_name($t_current); } } } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_name); } if (true == $t_any_found) { echo lang_get('any'); } else { echo $t_output; } } ?> </td> <!-- Sort by --> <td class="small-caption category2"> <a href="<?php echo $t_filters_url . 'show_sort'; ?> " id="show_sort_filter"<?php echo $t_dynamic_filter_expander_class; ?> > <?php echo lang_get('sort_label'); ?> </a> </td> <td class="small-caption" id="show_sort_filter_target"> <?php $t_sort_fields = explode(',', $t_filter[FILTER_PROPERTY_SORT_FIELD_NAME]); $t_dir_fields = explode(',', $t_filter[FILTER_PROPERTY_SORT_DIRECTION]); for ($i = 0; $i < 2; $i++) { if (isset($t_sort_fields[$i])) { if (0 < $i) { echo ', '; } $t_sort = $t_sort_fields[$i]; if (strpos($t_sort, 'custom_') === 0) { $t_field_name = string_display(lang_get_defaulted(utf8_substr($t_sort, utf8_strlen('custom_')))); } else { $t_field_name = string_get_field_name($t_sort); } echo $t_field_name . ' ' . lang_get('bugnote_order_' . utf8_strtolower($t_dir_fields[$i])); echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_', $i, '" value="', string_attribute($t_sort_fields[$i]), '" />'; echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_DIRECTION, '_', $i, '" value="', string_attribute($t_dir_fields[$i]), '" />'; } } ?> </td> <?php if ('advanced' == $t_view_type) { ?> <!-- Project --> <td class="small-caption category2" colspan="2"> <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PROJECT_ID; ?> " id="project_id_filter"<?php echo $t_dynamic_filter_expander_class; ?> > <?php echo lang_get('email_project_label'); ?> </a> </td> <td class="small-caption" id="project_id_filter_target"> <?php $t_output = ''; if (!is_array($t_filter[FILTER_PROPERTY_PROJECT_ID])) { $t_filter[FILTER_PROPERTY_PROJECT_ID] = array($t_filter[FILTER_PROPERTY_PROJECT_ID]); } if (count($t_filter[FILTER_PROPERTY_PROJECT_ID]) == 0) { echo lang_get('current'); } else { $t_first_flag = true; foreach ($t_filter[FILTER_PROPERTY_PROJECT_ID] as $t_current) { echo '<input type="hidden" name="', FILTER_PROPERTY_PROJECT_ID, '[]" value="', string_attribute($t_current), '" />'; $t_this_name = ''; if (META_FILTER_CURRENT == $t_current) { $t_this_name = '[' . lang_get('current') . ']'; } else { $t_this_name = project_get_name($t_current, false); } if ($t_first_flag != true) { $t_output = $t_output . '<br />'; } else { $t_first_flag = false; } $t_output = $t_output . string_display_line($t_this_name); } echo $t_output; } ?> </td> <?php if ($t_filter_cols > 6) { echo '<td class="small-caption" colspan="' . ($t_filter_cols - 5) . '"> </td>'; } } else { if ($t_filter_cols > 3) { echo '<td class="small-caption" colspan="' . ($t_filter_cols - 2) . '"> </td>'; } } ?> </tr> <!-- Match Type --> <tr class="row-1"> <td class="small-caption category2"><a href="<?php echo $t_filters_url . FILTER_PROPERTY_MATCH_TYPE; ?> " id="match_type_filter"><?php echo lang_get('filter_match_type'); ?> :</a></td> <td class="small-caption" id="match_type_filter_target"> <?php switch ($t_filter[FILTER_PROPERTY_MATCH_TYPE]) { case FILTER_MATCH_ANY: echo lang_get('filter_match_any'); break; case FILTER_MATCH_ALL: default: echo lang_get('filter_match_all'); break; } ?> <input type="hidden" name="match_type" value="<?php echo $t_filter[FILTER_PROPERTY_MATCH_TYPE]; ?> "/> </td> <td class="small-caption category2"> <a id="highlight_changed_filter" href="<?php echo $t_filters_url . FILTER_PROPERTY_HIGHLIGHT_CHANGED; ?> " <?php #echo $t_dynamic_filter_expander_class; ?> > <?php echo lang_get('changed_label'); ?> </a> </td> <td class="small-caption" valign="top" id="highlight_changed_filter_target"> <?php echo $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED]; ?> <input type="hidden" name="<?php echo FILTER_PROPERTY_HIGHLIGHT_CHANGED; ?> " value="<?php echo string_attribute($t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED]); ?> " /> </td> <td colspan="4"> </td> </tr> </table> <?php } # expanded collapse_icon('filter'); echo '<div class="search-box">'; echo '<label>'; echo lang_get('search') . ' '; echo '<input type="text" size="16" name="', FILTER_PROPERTY_SEARCH, '" value="', string_attribute($t_filter[FILTER_PROPERTY_SEARCH]), '" />'; echo '</label>'; echo '</div>'; ?> <div class="submit-query"><input type="submit" name="filter" value="<?php echo lang_get('filter_button'); ?> " /></div> </form> <?php $t_stored_queries_arr = filter_db_get_available_queries(); if (access_has_project_level(config_get('stored_query_create_threshold'))) { ?> <div class="save-query"> <form method="post" name="save_query" action="query_store_page.php"> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="submit" name="save_query_button" class="button-small" value="<?php echo lang_get('save_query'); ?> " /> </form> </div><?php } if (count($t_stored_queries_arr) > 0) { ?> <div class="manage-queries"> <form method="post" name="open_queries" action="query_view_page.php"> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="submit" name="switch_to_query_button" class="button-small" value="<?php echo lang_get('open_queries'); ?> " /> </form> </div> <div class="stored-queries"> <form method="get" name="list_queries<?php echo $t_form_name_suffix; ?> " action="view_all_set.php"> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="hidden" name="type" value="3" /> <select name="source_query_id"> <option value="-1"><?php echo '[' . lang_get('reset_query') . ']'; ?> </option> <option value="-1"></option> <?php $t_source_query_id = isset($t_filter['_source_query_id']) ? (int) $t_filter['_source_query_id'] : -1; foreach ($t_stored_queries_arr as $t_query_id => $t_query_name) { echo '<option value="' . $t_query_id . '" '; check_selected($t_query_id, $t_source_query_id); echo '>' . string_display_line($t_query_name) . '</option>'; } ?> </select> <input type="submit" name="switch_to_query_button" class="button-small" value="<?php echo lang_get('use_query'); ?> " /> </form> </div> <?php } else { ?> <div class="reset-query"> <form method="get" name="reset_query" action="view_all_set.php"> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="hidden" name="type" value="3" /> <input type="hidden" name="source_query_id" value="-1" /> <input type="submit" name="reset_query_button" class="button-small" value="<?php echo lang_get('reset_query'); ?> " /> </form> </div><?php } ?> <div class="filter-links"> <?php if (access_has_project_level(config_get('create_permalink_threshold'))) { ?> <form method="get" action="permalink_page.php"> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="hidden" name="url" value="<?php echo urlencode(filter_get_url($t_filter)); ?> " /> <input type="submit" name="reset_query_button" class="button-small" value="<?php echo lang_get('create_filter_link'); ?> " /> </form> <?php } $t_view_filters = config_get('view_filters'); if (SIMPLE_ONLY != $t_view_filters && ADVANCED_ONLY != $t_view_filters) { ?> <form method="get" action="view_all_set.php"> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="hidden" name="type" value="<?php echo config_get('use_dynamic_filters') ? '6' : ''; ?> " /> <input type="hidden" name="view_type" value="<?php echo 'advanced' == $t_view_type ? 'simple' : 'advanced'; ?> " /> <input type="submit" name="reset_query_button" class="button-small" value="<?php echo 'advanced' == $t_view_type ? lang_get('simple_filters') : lang_get('advanced_filters'); ?> " /> </form> <?php } ?> </div> </div> <br /> <?php }
# Ensure that the user has permission to change the view status of the issue. if ($t_existing_bug->view_state !== $t_updated_bug->view_state) { access_ensure_bug_level(config_get('change_view_status_threshold'), $f_bug_id); } # Determine the custom field "require check" to use for validating # whether fields can be undefined during this bug update. if ($t_close_issue) { $t_cf_require_check = 'require_closed'; } else { if ($t_resolve_issue) { $t_cf_require_check = 'require_resolved'; } else { $t_cf_require_check = 'require_update'; } } $t_related_custom_field_ids = custom_field_get_linked_ids($t_existing_bug->project_id); $t_custom_fields_to_set = array(); foreach ($t_related_custom_field_ids as $t_cf_id) { $t_cf_def = custom_field_get_definition($t_cf_id); if (!gpc_isset_custom_field($t_cf_id, $t_cf_def['type'])) { if ($t_cf_def[$t_cf_require_check]) { # A value for the custom field was expected however # no value was given by the user. error_parameters(lang_get_defaulted(custom_field_get_field($t_cf_id, 'name'))); trigger_error(ERROR_EMPTY_FIELD, ERROR); } else { # The custom field isn't compulsory and the user did # not supply a value. Therefore we can just ignore this # custom field completely (ie. don't attempt to update # the field). continue;
</label> </th> <td> <textarea <?php echo helper_get_tab_index(); ?> id="additional_info" name="additional_info" cols="80" rows="10"><?php echo string_textarea($f_additional_info); ?> </textarea> </td> </tr> <?php } $t_custom_fields_found = false; $t_related_custom_field_ids = custom_field_get_linked_ids($t_project_id); foreach ($t_related_custom_field_ids as $t_id) { $t_def = custom_field_get_definition($t_id); if (($t_def['display_report'] || $t_def['require_report']) && custom_field_has_write_access_to_project($t_id, $t_project_id)) { $t_custom_fields_found = true; ?> <tr> <th class="category"> <?php if ($t_def['require_report']) { ?> <span class="required">*</span> <?php } ?> <?php
/** * Get the custom field values associated with the specified issue id. * * @param integer $p_issue_id Issue id to get the custom field values for. * * @return null if no custom field defined for the project that contains the issue, or if no custom * fields are accessible to the current user. */ function mci_issue_get_custom_fields($p_issue_id) { $t_project_id = bug_get_field($p_issue_id, 'project_id'); $t_custom_fields = array(); $t_related_custom_field_ids = custom_field_get_linked_ids($t_project_id); foreach ($t_related_custom_field_ids as $t_id) { $t_def = custom_field_get_definition($t_id); if (custom_field_has_read_access($t_id, $p_issue_id)) { # user has not access to read this custom field. $t_value = custom_field_get_value($t_id, $p_issue_id); if ($t_value === false) { continue; } # return a blank string if the custom field value is undefined if ($t_value === null) { $t_value = ''; } $t_custom_field_value = array(); $t_custom_field_value['field'] = array(); $t_custom_field_value['field']['id'] = $t_id; $t_custom_field_value['field']['name'] = $t_def['name']; $t_custom_field_value['value'] = $t_value; $t_custom_fields[] = $t_custom_field_value; } } return count($t_custom_fields) == 0 ? null : $t_custom_fields; }
/** * Get all accessible columns for the current project / current user.. * @param int $p_project_id project id * @return array array of columns * @access public */ function columns_get_all($p_project_id = null) { $t_columns = columns_get_standard(); # add plugin columns $t_columns = array_merge($t_columns, array_keys(columns_get_plugin_columns())); # Add project custom fields to the array. Only add the ones for which the current user has at least read access. if ($p_project_id === null) { $t_project_id = helper_get_current_project(); } else { $t_project_id = $p_project_id; } $t_related_custom_field_ids = custom_field_get_linked_ids($t_project_id); foreach ($t_related_custom_field_ids as $t_id) { if (!custom_field_has_read_access_by_project_id($t_id, $t_project_id)) { continue; } $t_def = custom_field_get_definition($t_id); $t_columns[] = 'custom_' . $t_def['name']; } return $t_columns; }
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')); $t_project_id = helper_get_current_project(); if (ALL_PROJECTS != $t_project_id) { $t_user_id = auth_get_current_user_id(); $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) { $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>"; } }