Blame Extras/Mantis/1.1.2-1.fc9/print_all_bug_options_inc.php

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

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

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