Blame Identity/Webenv/App/Mantis/1.1.2-1.fc9/print_all_bug_options_inc.php

f2e824
f2e824
# Mantis - a php based bugtracking system
f2e824
f2e824
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
f2e824
# Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
f2e824
f2e824
# Mantis is free software: you can redistribute it and/or modify
f2e824
# it under the terms of the GNU General Public License as published by
f2e824
# the Free Software Foundation, either version 2 of the License, or
f2e824
# (at your option) any later version.
f2e824
#
f2e824
# Mantis is distributed in the hope that it will be useful,
f2e824
# but WITHOUT ANY WARRANTY; without even the implied warranty of
f2e824
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f2e824
# GNU General Public License for more details.
f2e824
#
f2e824
# You should have received a copy of the GNU General Public License
f2e824
# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
f2e824
f2e824
	# --------------------------------------------------------
f2e824
	# $Id: print_all_bug_options_inc.php,v 1.25.2.1 2007-10-13 22:34:11 giallu Exp $
f2e824
	# --------------------------------------------------------
f2e824
?>
f2e824
f2e824
	$t_core_path = config_get( 'core_path' );
f2e824
f2e824
	require_once( $t_core_path.'current_user_api.php' );
f2e824
?>
f2e824
f2e824
# this function only gets the field names, by appending strings
f2e824
function get_field_names()
f2e824
{
f2e824
	#currently 27 fields
f2e824
	return $t_arr = array (
f2e824
	                       	'id',
f2e824
	                       	'category',
f2e824
	                       	'severity',
f2e824
	                       	'reproducibility',
f2e824
	                       	'date_submitted',
f2e824
	                       	'last_update',
f2e824
	                       	'reporter',
f2e824
	                       	'assigned_to',
f2e824
	                      	'priority',
f2e824
	                       	'status',
f2e824
	                       	'build',
f2e824
	                       	'projection',
f2e824
	                       	'eta',
f2e824
	                       	'platform',
f2e824
	                       	'os',
f2e824
	                       	'os_version',
f2e824
	                       	'product_version',
f2e824
	                       	'resolution',
f2e824
	                       	'duplicate_id',
f2e824
	                       	'summary',
f2e824
	                       	'description',
f2e824
	                       	'steps_to_reproduce',
f2e824
	                       	'additional_information',
f2e824
	                       	'attached_files',
f2e824
	                       	'bugnote_title',
f2e824
	                       	'bugnote_date',
f2e824
	                       	'bugnote_description',
f2e824
				'time_tracking' );
f2e824
}
f2e824
f2e824
f2e824
function edit_printing_prefs( $p_user_id = null, $p_error_if_protected = true, $p_redirect_url = '' )
f2e824
{
f2e824
	if ( null === $p_user_id ) {
f2e824
		$p_user_id = auth_get_current_user_id();
f2e824
	}
f2e824
f2e824
	$c_user_id = db_prepare_int( $p_user_id );
f2e824
f2e824
	# protected account check
f2e824
	if ( $p_error_if_protected ) {
f2e824
		user_ensure_unprotected( $p_user_id );
f2e824
	}
f2e824
f2e824
	$t_user_print_pref_table = config_get( 'mantis_user_print_pref_table' );
f2e824
f2e824
	if ( is_blank( $p_redirect_url ) ) {
f2e824
		$p_redirect_url = 'print_all_bug_page.php';
f2e824
	}
f2e824
f2e824
	# get the fields list
f2e824
	$t_field_name_arr = get_field_names();
f2e824
	$field_name_count = count( $t_field_name_arr );
f2e824
f2e824
	# Grab the data
f2e824
	$query = "SELECT print_pref
f2e824
			FROM $t_user_print_pref_table
f2e824
			WHERE user_id='$c_user_id'";
f2e824
	$result = db_query( $query );
f2e824
f2e824
	## OOPS, No entry in the database yet.  Lets make one
f2e824
	if ( 0 == db_num_rows( $result ) ) {
f2e824
f2e824
		# create a default array, same size than $t_field_name
f2e824
		for ($i=0 ; $i<$field_name_count ; $i++) {
f2e824
			$t_default_arr[$i] = 1 ;
f2e824
		}
f2e824
		$t_default = implode( '', $t_default_arr ) ;
f2e824
f2e824
		# all fields are added by default
f2e824
		$query = "INSERT
f2e824
				INTO $t_user_print_pref_table
f2e824
				(user_id, print_pref)
f2e824
				VALUES
f2e824
				('$c_user_id','$t_default')";
f2e824
f2e824
		$result = db_query( $query );
f2e824
f2e824
		# Rerun select query
f2e824
		$query = "SELECT print_pref
f2e824
				FROM $t_user_print_pref_table
f2e824
				WHERE user_id='$c_user_id'";
f2e824
		$result = db_query( $query );
f2e824
	}
f2e824
f2e824
	# putting the query result into an array with the same size as $t_fields_arr
f2e824
	$row = db_fetch_array( $result );
f2e824
	$t_prefs = $row['print_pref'];
f2e824
f2e824
?>
f2e824
f2e824
f2e824
f2e824

f2e824
f2e824
<form method="post" action="print_all_bug_options_update.php">
f2e824
<input type="hidden" name="user_id" value="<?php echo $p_user_id ?>" />
f2e824
<input type="hidden" name="redirect_url" value="<?php echo string_attribute( $p_redirect_url ) ?>" />
f2e824
f2e824
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
	
f2e824
f2e824
f2e824
f2e824
f2e824
for ($i=0 ; $i <$field_name_count ; $i++) {
f2e824
f2e824
	printf ( '', helper_alternate_class( $i ) );
f2e824
?>
f2e824
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
		
f2e824
		 />
f2e824
	
f2e824
f2e824
f2e824
f2e824
}
f2e824
?>
f2e824
f2e824
	 
f2e824
	
f2e824
		<input type="submit" class="button" value="<?php echo lang_get( 'update_prefs_button' ) ?>" />
f2e824
	
f2e824
f2e824
f2e824
</form>
f2e824
f2e824
f2e824

f2e824
f2e824
f2e824
	<form method="post" action="print_all_bug_options_reset.php">
f2e824
	<input type="submit" class="button" value="<?php echo lang_get( 'reset_prefs_button' ) ?>" />
f2e824
	</form>
f2e824
f2e824
f2e824