View Issue Details

IDProjectCategoryView StatusLast Update
0006430mantisbtcustomizationpublic2006-05-30 16:23
Reporterbobeid Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Summary0006430: Statuses, resolutions, severity, priority, reproductibility, workflow ... other dictionaries in the database, not hardcoded
Description

Theese dictionaries should be in the database and customized through administration menu.

TagsNo tags attached.
Attached Files
mantisbt.patch (20,238 bytes)   
diff -r -u mantisbt/admin/db_stats.php mymantisbt/admin/db_stats.php
--- mantisbt/admin/db_stats.php	2005-05-03 16:16:42.000000000 +0200
+++ mymantisbt/admin/db_stats.php	2006-04-13 16:55:07.000000000 +0200
@@ -49,6 +49,7 @@
 	print_table_stats( config_get( 'mantis_custom_field_string_table' ) );
 	print_table_stats( config_get( 'mantis_custom_field_table' ) );
 	print_table_stats( config_get( 'mantis_filters_table' ) );
+	print_table_stats( config_get( 'mantis_lang_table' ) );
 	print_table_stats( config_get( 'mantis_news_table' ) );
 	print_table_stats( config_get( 'mantis_project_category_table' ) );
 	print_table_stats( config_get( 'mantis_project_file_table' ) );
@@ -66,4 +67,4 @@
 
 	# echo '</table>';
 	echo '</body></html>';
-?>
\ Pas de fin de ligne � la fin du fichier.
+?>
diff -r -u mantisbt/admin/db_table_names_inc.php mymantisbt/admin/db_table_names_inc.php
--- mantisbt/admin/db_table_names_inc.php	2005-07-14 23:38:00.000000000 +0200
+++ mymantisbt/admin/db_table_names_inc.php	2006-04-13 16:55:21.000000000 +0200
@@ -36,4 +36,5 @@
 	$t_tokens_table					= config_get_global( 'mantis_tokens_table' );
 	$t_project_hierarchy_table		= config_get_global( 'mantis_project_hierarchy_table' );
 	$t_config_table					= config_get_global( 'mantis_config_table' );
+	$t_lang_table					= config_get_global( 'mantis_lang_table' );
 ?>
diff -r -u mantisbt/admin/schema.php mymantisbt/admin/schema.php
--- mantisbt/admin/schema.php	2005-08-03 16:20:34.000000000 +0200
+++ mymantisbt/admin/schema.php	2006-04-13 17:30:24.000000000 +0200
@@ -30,6 +30,16 @@
 Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));
 $upgrade[] = Array('CreateIndexSQL',Array('idx_config',config_get('mantis_config_table'),'config_id'));
 
+$upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_lang_table'),"
+			  id C(64) NOTNULL PRIMARY,
+			  lang_id C(64) NOTNULL PRIMARY,
+			  project_id I DEFAULT '0' PRIMARY,
+			  user_id I DEFAULT '0' PRIMARY,
+			  access_reqd I DEFAULT '0',
+			  value XS NOTNULL",
+Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));
+$upgrade[] = Array('CreateIndexSQL',Array('idx_lang',config_get('mantis_lang_table'),'id'));
+
 $upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_bug_file_table'),"
   id			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
   bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
diff -r -u mantisbt/config_defaults_inc.php mymantisbt/config_defaults_inc.php
--- mantisbt/config_defaults_inc.php	2006-03-28 04:05:24.000000000 +0200
+++ mymantisbt/config_defaults_inc.php	2006-04-13 18:51:56.000000000 +0200
@@ -1236,6 +1236,7 @@
 	$g_mantis_tokens_table					= '%db_table_prefix%_tokens%db_table_suffix%';
 	$g_mantis_project_hierarchy_table		= '%db_table_prefix%_project_hierarchy%db_table_suffix%';
 	$g_mantis_config_table					= '%db_table_prefix%_config%db_table_suffix%';
+	$g_mantis_lang_table					= '%db_table_prefix%_lang%db_table_suffix%';
 	$g_mantis_database_table					= '%db_table_prefix%_database%db_table_suffix%';
 
 	###########################
@@ -1257,7 +1258,7 @@
 	  # @@@ for documentation, the values in this list are also used to define variables in the language files
 	  #  (e.g., $s_new_bug_title referenced in bug_change_status_page.php )
 	  # Embedded spaces are converted to underscores (e.g., "working on" references $s_working_on_bug_title).
-	  # they are also expected to be english names for the states
+	  # they are also expected to be english names for the status
 	$g_resolution_enum_string			= '10:open,20:fixed,30:reopened,40:unable to duplicate,50:not fixable,60:duplicate,70:not a bug,80:suspended,90:wont fix';
 	$g_projection_enum_string			= '10:none,30:tweak,50:minor fix,70:major rework,90:redesign';
 	$g_eta_enum_string					= '10:none,20:< 1 day,30:2-3 days,40:< 1 week,50:< 1 month,60:> 1 month';
Seulement dans mymantisbt/: config_inc.php
diff -r -u mantisbt/core/constant_inc.php mymantisbt/core/constant_inc.php
--- mantisbt/core/constant_inc.php	2005-12-18 00:08:52.000000000 +0100
+++ mymantisbt/core/constant_inc.php	2006-04-13 18:43:38.000000000 +0200
@@ -118,6 +118,9 @@
 	# all users
 	define( 'ALL_USERS',    0 );
 
+        # all languages
+	define( 'ALL_LANGUAGES',	'en' );
+
 	# no user
 	define( 'NO_USER',		0 );
 
diff -r -u mantisbt/core/html_api.php mymantisbt/core/html_api.php
--- mantisbt/core/html_api.php	2006-03-21 14:28:31.000000000 +0100
+++ mymantisbt/core/html_api.php	2006-04-13 19:00:16.000000000 +0200
@@ -665,6 +665,7 @@
 		$t_manage_work_threshold     = 'manage_config_work_threshold_page.php';
 		$t_manage_email 		= 'manage_config_email_page.php';
 		$t_manage_workflow 		= 'manage_config_workflow_page.php';
+		$t_manage_status 		= 'manage_config_status_page.php';
 
 		switch ( $p_page ) {
 			case $t_permissions_summary_report:
@@ -676,6 +677,9 @@
 			case $t_manage_email:
 				$t_manage_email = '';
 				break;
+			case $t_manage_status:
+				$t_manage_status = '';
+				break;
 			case $t_manage_workflow:
 				$t_manage_workflow = '';
 				break;
@@ -685,6 +689,7 @@
 		if ( access_has_project_level( config_get( 'view_configuration_threshold' ) ) ) {
 			print_bracket_link( $t_permissions_summary_report, lang_get( 'permissions_summary_report' ) );
 			print_bracket_link( $t_manage_work_threshold, lang_get( 'manage_threshold_config' ) );
+			print_bracket_link( $t_manage_status, lang_get( 'manage_status_config' ) );
 			print_bracket_link( $t_manage_workflow, lang_get( 'manage_workflow_config' ) );
 			print_bracket_link( $t_manage_email, lang_get( 'manage_email_config' ) );
 		}
diff -r -u mantisbt/core/lang_api.php mymantisbt/core/lang_api.php
--- mantisbt/core/lang_api.php	2005-10-29 11:52:52.000000000 +0200
+++ mymantisbt/core/lang_api.php	2006-04-13 19:07:42.000000000 +0200
@@ -21,6 +21,10 @@
 	# To be used in custom_strings_inc.php :
 	$g_active_language  = '';
 
+        $g_cache_lang = array();
+        $g_cache_lang_access = array();
+        $g_cache_lang_filled = false;
+
 	# ------------------
 	# Loads the specified language and stores it in $g_lang_strings,
 	# to be used by lang_get
@@ -192,22 +196,114 @@
 	#  This function will return one of (in order of preference):
 	#    1. The string in the current user's preferred language (if defined)
 	#    2. The string in English
-	function lang_get( $p_string, $p_lang = null ) {
-		global $g_lang_strings;
+	function lang_get( $p_string, $p_lang = null, $p_user = null, $p_project = null ) {
+		global $g_lang_strings, $g_cache_lang_filled, $g_cache_lang, $g_cache_lang_access;
 
 		# If no specific language is requested, we'll
 		#  try to determine the language from the users
 		#  preferences
 
-		$t_lang = $p_lang;
-
-		if ( null === $t_lang ) {
-			$t_lang = lang_get_current();
+		if ( null === $p_lang ) {
+			$p_lang = lang_get_current();
 		}
 
 		# Now we'll make sure that the requested language is loaded
 
-		lang_ensure_loaded( $t_lang );
+		lang_ensure_loaded( $p_lang );
+
+                # Now we'll search in the database if the requested string is overloaded
+                # either in the requested language or in default language
+                # XXX : I don't make the bypass lookup as in config_get() should I ?
+                $t_lang_table = config_get_global( 'mantis_lang_table' );
+                if ( ! $g_cache_db_table_exists ) {
+                        $g_cache_db_table_exists = ( TRUE === db_is_connected() ) && db_table_exists( $t_lang_table );
+                }
+
+                # Same as in config_get()
+                if ( $g_cache_db_table_exists ) {
+                        # prepare the user's list
+                        $t_users = array();
+                        if ( null === $p_user ) {
+                                $t_users[] = auth_is_user_authenticated() ? auth_get_current_user_id() : ALL_USERS;
+                        } else {
+                                $t_users[] = $p_user;
+                        }
+                        if ( ! in_array( ALL_USERS, $t_users ) ) {
+                                $t_users[] = ALL_USERS;
+                        }
+
+                        # prepare the projects list
+                        $t_projects = array();
+                        if ( ( null === $p_project )  ) {
+                                $t_projects[] = auth_is_user_authenticated() ? helper_get_current_project() : ALL_PROJECTS;
+                        } else {
+                                $t_projects[] = $p_project;
+                        }
+                        if ( ! in_array( ALL_PROJECTS, $t_projects ) ) {
+                                $t_projects[] = ALL_PROJECTS;
+                        }
+                        # @@ debug @@ echo 'pr= '; var_dump($t_projects);
+                        # @@ debug @@ echo 'u= '; var_dump($t_users);
+
+                        if ( ! $g_cache_lang_filled ) {
+                                $query = "SELECT id, lang_id, user_id, project_id, value, access_reqd FROM $t_lang_table";
+                                $result = db_query( $query );
+                                while ( false <> ( $row = db_fetch_array( $result ) ) ) {
+                                        $t_item = $row['id'];
+                                        $t_lang = $row['lang_id'];
+                                        $t_user = $row['user_id'];
+                                        $t_project = $row['project_id'];
+                                        $g_cache_lang[$t_item][$t_lang][$t_user][$t_project] = $row['value'];
+                                        $g_cache_lang_access[$t_item][$t_lang][$t_user][$t_project] = $row['access_reqd'];
+                                        # If it doesn't exist, we set the value in the table to 
+                                        # this value (it's just for lang_exists, it will never be used however)
+                                        if ( !isset ( $g_lang_strings[ $p_lang ] ) || 
+                                            !isset ( $g_lang_strings[ $p_lang ][ $p_string ] ) )
+                                        {
+                                                $g_lang_strings[ $p_lang ][ $p_string ] = $row['value'];
+                                        }
+                                }
+                                $g_cache_lang_filled = true;
+                        }
+
+                }
+
+                if( isset( $g_cache_lang[$p_string] ) ) {
+                        $t_found = false;
+                        reset( $t_users );
+                        while ( ( list( , $t_user ) = each( $t_users ) ) && ! $t_found ) {
+                                reset( $t_projects );
+                                while ( ( list( , $t_project ) = each( $t_projects ) ) && ! $t_found ) {
+                                        if ( isset( $g_cache_lang[$p_string][$p_lang][$t_user][$t_project] ) ) {
+                                                $t_value = $g_cache_lang[$p_string][$p_lang][$t_user][$t_project];
+                                                $t_found = true;
+                                                # @@ debug @@ echo "clu found u=$t_user, p=$t_project, v=$t_value ";
+                                        }
+                                }
+                        }
+
+                        if ( $t_found ) {
+                                return $t_value;
+                        } 
+
+                        # If we didn't found the value for the requested language, we try 
+                        # with default language :
+                        reset( $t_users );
+                        while ( ( list( , $t_user ) = each( $t_users ) ) && ! $t_found ) {
+                                reset( $t_projects );
+                                while ( ( list( , $t_project ) = each( $t_projects ) ) && ! $t_found ) {
+                                        if ( isset( $g_cache_lang[$p_string][ALL_LANGUAGES][$t_user][$t_project] ) ) {
+                                                $t_value = $g_cache_lang[$p_string][ALL_LANGUAGES][$t_user][$t_project];
+                                                $t_found = true;
+                                                # @@ debug @@ echo "clu found u=$t_user, p=$t_project, v=$t_value ";
+                                        }
+                                }
+                        }
+
+                        if ( $t_found ) {
+                                return $t_value;
+                        }
+                }
 
 		# note in the current implementation we always return the same value
 		#  because we don't have a concept of falling back on a language.  The
@@ -216,10 +312,10 @@
 		# @@@ thraxisp - not sure if this is still true. Strings from last language loaded
 		#      may still be in memeory if a new language is loaded.
 
-		if ( lang_exists( $p_string, $t_lang ) ) {
-			return $g_lang_strings[ $t_lang ][ $p_string];
+		if ( lang_exists( $p_string, $p_lang ) ) {
+			return $g_lang_strings[ $p_lang ][ $p_string];
 		} else {
-			if ( $t_lang == 'english' ) {
+			if ( $p_lang == 'english' ) {
 				error_parameters( $p_string );
 				trigger_error( ERROR_LANG_STRING_NOT_FOUND, WARNING );
 				return '';
@@ -245,16 +341,14 @@
 	# - If not found, no default supplied, return the supplied string as is.
 	# - If not found, default supplied, return default.
 	function lang_get_defaulted( $p_string, $p_default = null, $p_lang = null ) {
-		$t_lang = $p_lang;
-
-		if ( null === $t_lang ) {
-			$t_lang = lang_get_current();
+		if ( null === $p_lang ) {
+			$p_lang = lang_get_current();
 		}
 
 		# Now we'll make sure that the requested language is loaded
-		lang_ensure_loaded( $t_lang );
+		lang_ensure_loaded( $p_lang );
 
-		if ( lang_exists( $p_string, $t_lang ) ) {
+		if ( lang_exists( $p_string, $p_lang ) ) {
 			return lang_get( $p_string );
 		} else {
 			if ( null === $p_default ) {
@@ -264,4 +358,98 @@
 			}
 		}
 	}
+
+	function lang_set( $p_string, $p_value, $p_lang = ALL_LANGUAGES, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = ADMINISTRATOR ) {
+		$c_string = db_prepare_string( $p_string );
+                $c_lang = db_prepare_string( $p_lang );
+		$c_user = db_prepare_int( $p_user );
+		$c_project = db_prepare_int( $p_project );
+		$c_access = db_prepare_int( $p_access );
+                $c_value = db_prepare_string ( $p_value );
+
+		$t_lang_table = config_get_global( 'mantis_lang_table' );
+		$query = "SELECT COUNT(*) from $t_lang_table
+			WHERE id = '$c_string' AND
+                                lang_id = '$c_lang' AND
+				project_id = $c_project AND
+				user_id = $c_user";
+		$result = db_query( $query );
+
+		if ( 0 < db_result( $result ) ) {
+			$t_set_query = "UPDATE $t_lang_table
+				SET value='$c_value', access_reqd=$c_access
+				WHERE id = '$c_string' AND
+                                        lang_id = '$c_lang' AND
+					project_id = $c_project AND
+					user_id = $c_user";
+		} else {
+			$t_set_query = "INSERT INTO $t_lang_table
+				( value, access_reqd, id, lang_id, project_id, user_id )
+				VALUES 
+				('$c_value', $c_access, '$c_string', '$c_lang', $c_project, $c_user )";
+		}
+
+                print "\nQuery : $t_set_query\n";
+		$result = db_query( $t_set_query );
+		
+		lang_set_cache( $p_string, $p_value, $p_lang, $p_user, $p_project, $p_access );
+
+		return true;
+	}
+	
+	function lang_set_cache( $p_string, $p_value, $p_lang, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = ADMINISTRATOR ) {
+		global $g_cache_lang, $g_cache_lang_access;
+		$g_cache_lang[$p_string][$p_lang][$p_user][$p_project] = $p_value;
+		$g_cache_lang_access[$p_string][$p_lang][$p_user][$p_project] = $p_access;
+
+		return true;
+	}
+
+        function lang_delete( $p_string, $p_lang = ALL_LANGUAGES, $p_user = ALL_USERS, $p_project = ALL_PROJECTS ) {
+                global $g_cache_config, $g_cache_config_access;
+                if( ( TRUE === db_is_connected() ) && ( db_table_exists( config_get_global( 'mantis_lang_table' ) ) ) ) {
+			$t_lang_table = config_get_global( 'mantis_lang_table' );
+			# @@ debug @@ echo "lu table=" . ( db_table_exists( $t_config_table ) ? "yes" : "no" );
+			# @@ debug @@ error_print_stack_trace();
+
+			$c_string = db_prepare_string( $p_string );
+			$c_lang = db_prepare_string( $p_lang );
+			$c_user = db_prepare_int( $p_user );
+			$c_project = db_prepare_int( $p_project );
+			$query = "DELETE FROM $t_lang_table
+				WHERE id = '$c_string' AND
+                                        lang_id = '$c_lang' AND
+					project_id=$c_project AND
+					user_id=$c_user";
+
+			$result = @db_query( $query);
+                        }
+                        lang_flush_cache( $p_string, $p_lang, $p_user, $p_project );
+                }
+
+	function lang_delete_project( $p_project = ALL_PROJECTS ) {
+		global $g_cache_lang, $g_cache_lang_access;
+		$t_lang_table = config_get_global( 'mantis_lang_table' );
+		$c_project = db_prepare_int( $p_project );
+		$query = "DELETE FROM $t_lang_table
+				WHERE project_id=$c_project";
+
+		$result = @db_query( $query);
+		
+		# flush cache here in case some of the deleted configs are in use.
+		config_flush_cache(); 
+	}		
+	function lang_flush_cache( $p_string='', $p_lang = ALL_LANGUAGES, $p_user = ALL_USERS, $p_project = ALL_PROJECTS ) {
+		global $g_cache_lang, $g_cache_lang_access, $g_cache_lang_filled;
+	
+		if ( '' !== $p_string ) {
+			unset( $GLOBALS['g_cache_lang'][$p_string][$p_lang][$p_user][$p_project] );
+			unset( $GLOBALS['g_cache_lang_access'][$p_string][$p_lang][$p_user][$p_project] );
+		} else {
+			unset( $GLOBALS['g_cache_lang'] );
+			unset( $GLOBALS['g_cache_lang_access'] );
+			$g_cache_lang_filled = false;
+		}
+			
+	}
 ?>
diff -r -u mantisbt/core/project_api.php mymantisbt/core/project_api.php
--- mantisbt/core/project_api.php	2005-10-29 11:52:52.000000000 +0200
+++ mymantisbt/core/project_api.php	2006-04-13 18:48:49.000000000 +0200
@@ -269,6 +269,7 @@
 		
 		# Delete project specific configurations
 		config_delete_project( $p_project_id );
+                lang_delete_project( $p_project_id );
 		
 		# Delete any user prefs that are project specific
 		user_pref_delete_project( $p_project_id );
diff -r -u mantisbt/lang/strings_english.txt mymantisbt/lang/strings_english.txt
--- mantisbt/lang/strings_english.txt	2005-12-18 00:08:52.000000000 +0100
+++ mymantisbt/lang/strings_english.txt	2006-04-13 18:51:11.000000000 +0200
@@ -662,6 +662,7 @@
 $s_manage_config_link = 'Manage Configuration';
 $s_manage_threshold_config = 'Workflow Thresholds';
 $s_manage_email_config = 'Email Notifications';
+$s_manage_status_config = 'Workflow Status';
 $s_manage_workflow_config = 'Workflow Transitions';
 $s_create_new_account_link = 'Create New Account';
 $s_projects_link = 'Projects';
@@ -695,6 +696,16 @@
 $s_revert_to_system = "Delete All Projects Settings";
 $s_revert_to_all_project = "Delete Project Specific Settings";
 
+# manage_config_status_page
+$s_delete_state = "Delete";
+$s_add_state = "Add state";
+$s_save_state = "Save";
+$s_status_list = "List of status";
+$s_state = "State";
+$s_color = "Color";
+$s_action = "Action";
+$s_state_index = "Index";
+
 # manage_config_workflow_page
 $s_non_existent = 'non-existent';
 $s_current_status = 'Current Status';
diff -r -u mantisbt/lang/strings_french.txt mymantisbt/lang/strings_french.txt
--- mantisbt/lang/strings_french.txt	2006-02-20 10:08:44.000000000 +0100
+++ mymantisbt/lang/strings_french.txt	2006-04-13 18:28:25.000000000 +0200
@@ -684,7 +684,7 @@
 $s_edit_user_link = 'Modifier l\'utilisateur';
 
 # manage_config_email_page
-$s_config_all_projects = 'Note: ces configurations affectent TOUT LES PROJETS.';
+$s_config_all_projects = 'Note: ces configurations affectent TOUS LES PROJETS.';
 $s_config_project = 'Note: ces configurations affectent seulement le projet %s.';
 $s_colour_coding = 'Dans le tableau suivant, les codes de couleurs suivants s\'appliquent:';
 $s_colour_project = 'Les param�tres du Projet sont prioritaires.';
Seulement dans mymantisbt/: manage_config_status_page.php
Seulement dans mymantisbt/: manage_config_status_set.php
Seulement dans mymantisbt/: tags
mantisbt.patch (20,238 bytes)   
manage_config_status_set.php.txt (3,774 bytes)   
<?php
	# Mantis - a php based bugtracking system
	# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
	# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
	# This program is distributed under the terms and conditions of the GPL
	# See the README and LICENSE files for details

	# --------------------------------------------------------
	# $Id: manage_config_workflow_set.php,v 1.8 2005/08/16 01:49:57 thraxisp Exp $
	# --------------------------------------------------------

	require_once( 'core.php' );

	$t_core_path = config_get( 'core_path' );
	require_once( $t_core_path.'email_api.php' );

	$t_can_change_level = min( config_get_access( 'notify_flags' ), config_get_access( 'default_notify_flags' ) );
	access_ensure_project_level( $t_can_change_level );

	$t_redirect_url = 'manage_config_status_page.php';
	$t_project = helper_get_current_project();
	$t_access = current_user_get_access_level();

	html_page_top1( lang_get( 'manage_workflow_config' ) );
	html_meta_redirect( $t_redirect_url );
	html_page_top2();

        $revert_action = gpc_get ( 'revert', 0 );
        $add_action = gpc_get( 'add' , 0 );
        if($revert_action)
        {
                config_delete ( 'status_enum_string', NO_USER, $t_project, $t_access );
                config_delete ( 'status_colors', NO_USER, $t_project, $t_access );
        }
        else
        {
            // XXX
            // There's a problem with status' names because they are defined
            // in the s_status_enum_string variable that we can't modify as
            // far as i know
            $names = gpc_get( 'name' );
            $indexes = gpc_get( 'index' );
            $colors = gpc_get( 'color' );
            for($i = 0; $i < count($names); $i++)
            {
                $del_action = gpc_get( 'del' , 0 );
                if(!$del_action[$i])
                {
                        $t_status_color[$names[$i]] = $colors[$i];
                        $indexes[$i] .= ":$names[$i]";
                        config_set( $names[$i].'_bug_title' , 'Set to '.$names[$i] , ALL_LANGUAGES, NO_USER, $t_project, $t_access );
                        config_set( $names[$i].'_bug_button' , 'Set to '.$names[$i] , ALL_LANGUAGES, NO_USER, $t_project, $t_access );
                }
                else
                {
                        unset($indexes[$i]);
                        config_delete( $names[$i].'_bug_title' , NO_USER, $t_project, $t_access );
                        config_delete( $names[$i].'_bug_button', NO_USER, $t_project, $t_access );
                }
            }
            if($add_action)
            {
                $t_status_color[gpc_get( 'statetoadd' )] = gpc_get( 'colortoadd' );
                $indexes[$i+1] = gpc_get( 'indextoadd' ).":".gpc_get( 'statetoadd' );
                config_set( $names[$i+1].'_bug_title' , 'Set to '.$names[$i+1] , ALL_LANGUAGES, NO_USER, $t_project, $t_access );
                config_set( $names[$i+1].'_bug_button' , 'Set to '.$names[$i+1] , ALL_LANGUAGES, NO_USER, $t_project, $t_access );
            }
            $t_status_enum_string = implode($indexes,',');
            config_set( 'status_enum_string', $t_status_enum_string, NO_USER, $t_project, $t_access );
            lang_set( 'status_enum_string', $t_status_enum_string, ALL_LANGUAGES, NO_USER, $t_project, $t_access );
            config_set( 'status_colors', $t_status_color, NO_USER, $t_project, $t_access );
        }
?>

<br />
<div align="center">
<?php
	echo lang_get( 'operation_successful' ) . '<br />';
	print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
?>
</div>

<?php html_page_bottom1( __FILE__ ) ?>
manage_config_status_page.php.txt (4,126 bytes)   
<?php
	# Mantis - a php based bugtracking system
	# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
	# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
	# This program is distributed under the terms and conditions of the GPL
	# See the README and LICENSE files for details

	# --------------------------------------------------------
	# $Id: manage_config_workflow_page.php,v 1.16.6.1 2006/01/01 02:58:50 thraxisp Exp $
	# --------------------------------------------------------

	require_once( 'core.php' );

	$t_core_path = config_get( 'core_path' );
	require_once( $t_core_path . 'email_api.php' );

	html_page_top1( lang_get( 'manage_status_config' ) );
	html_page_top2();

	print_manage_menu( 'adm_permissions_report.php' );
	print_manage_config_menu( 'manage_config_status_page.php' );

	$t_access = current_user_get_access_level();
	$t_project = helper_get_current_project();
	$t_can_change_workflow = $t_access >= config_get_access( 'status_enum_string' );
	$t_can_change_flags = $t_can_change_workflow;
	$t_overrides = array();

        function status_begin( $p_section_name )
        {
            PRINT '<table class="width100">';
            PRINT '<tr><td class="form-title" colspan="3">' . strtoupper( $p_section_name ) . '</td></tr>' . "\n";
            PRINT '<tr><td class="form-title">'. lang_get('state') . '</td>';
            PRINT '<td class="form-title">' . lang_get('state_index')
.'</td>';
            PRINT '<td class="form-title">'. lang_get('color') .'</td>';
            PRINT '<td class="form-title">'. lang_get('action') . '</td></tr>' . "\n";
        }

        function status_end()
        {
            global $t_project;
            PRINT '</table><br/>';
            PRINT "<input type=\"submit\" class=\"button\" value=\"" . lang_get('save_state') . "\" name=\"save\"/>\n";
            PRINT "<div class=\"right\"><input type=\"submit\" class=\"button\" value=\"";
            if ( ALL_PROJECTS == $t_project ) {
                    echo lang_get( 'revert_to_system' );
            } else {
                    echo lang_get( 'revert_to_all_project' );
            }
            PRINT "\" name=\"revert\"/></div>\n";
            PRINT "</form>";
        }
	
	echo "<form name=\"status_config_action\" method=\"post\" action=\"manage_config_status_set.php\">\n";

	if ( ALL_PROJECTS == $t_project ) {
	    $t_project_title = lang_get( 'config_all_projects' );
	} else {
	    $t_project_title = sprintf( lang_get( 'config_project' ) , string_display( project_get_name( $t_project ) ) );
	}
	echo '<p class="bold">' . $t_project_title . '</p>' . "\n";

        $t_project_status = explode_enum_string ( config_get ( 'status_enum_string' ) );
        $t_project_status_count = count ($t_project_status);

        status_begin( lang_get('status_list') );

        for ( $i = 0; $i < $t_project_status_count; $i++)
        {
            $t_s = explode_enum_arr( $t_project_status[$i] );
            $t_val = get_enum_element( 'status', $t_s[0] );
            $t_col = get_status_color( $t_s[0] );
            PRINT "<tr ".helper_alternate_class()."><td><input type=\"text\"name=\"name[".$i."]\" value=\"$t_val\"/></td>";
            PRINT "<td><input type=\"text\" name=\"index[".$i."]\" value=\"$t_s[0]\"/></td>";
            PRINT "<td ";
            if($t_col) PRINT "bgcolor=\"$t_col\"";
            PRINT "><input type=\"text\" name=\"color[".$i."]\" value=\"$t_col\"/></td>";
            PRINT "<td><input type=\"submit\" class=\"button\" value=\"" . lang_get('delete_state') . "\" name=\"del[".$i."]\"/>\n</td></tr>";
        }
        PRINT "<tr ".helper_alternate_class()."><td><input type=\"text\" name=\"statetoadd\"/></td>";
        PRINT "<td><input type=\"text\" name=\"indextoadd\"/></td>";
        PRINT "<td><input type=\"text\" name=\"colortoadd\"/></td>";
        PRINT "<td><input type=\"submit\" class=\"button\" value=\"" . lang_get('add_state') . "\" name=\"add\"/></td></tr>";

        status_end();

	html_page_bottom1( __FILE__ );
?>

Activities

lifo2

lifo2

2006-04-13 08:18

reporter   ~0012497

This problem prevent progression in per project configuration (having some status/severities/priorities... in a project that are not in others, or that haven't the same name).

lifo2

lifo2

2006-04-13 12:22

reporter   ~0012498

Last edited: 2006-04-14 04:51

Here is a patch I made that allow it. I also added a page to test it on status (I added .txt as extension because .php is not allowed, you have to rename it before you can use it).
Let me know what you think about it ...

bobeid

bobeid

2006-04-17 02:36

reporter   ~0012510

Hello! Can you give me some instructions how to run the files? I'm not so master at theese thing.

lifo2

lifo2

2006-04-17 10:01

reporter   ~0012521

Last edited: 2006-04-17 10:05

The 2 txt files should be renamed (just remove the .txt) and placed in mantis main directory (with all the others php files).
The mantisbt.patch should be applied with a command like
"patch -p0 < mantisbt.patch"
if you're under unix. I don't know how it works with windows.

bobeid

bobeid

2006-04-17 10:19

reporter   ~0012524

Unfortunatelly I'm under windows. Tell me what should do this patch .. maybe i'll find a solution under windows.

lifo2

lifo2

2006-04-17 11:20

reporter   ~0012532

The unified diff file format is quite simple. You can edit it with any text editor (one with syntax coloration for this type of file would be better, you can use vim if you know it).

You will see some stuff like this (it's just an example) :
diff -r -u mantisbt/admin/db_stats.php mymantisbt/admin/db_stats.php
--- mantisbt/admin/db_stats.php 2005-05-03 16:16:42.000000000 +0200
+++ mymantisbt/admin/db_stats.php 2006-04-13 16:55:07.000000000 +0200
@@ -49,6 +49,7 @@
print_table_stats( config_get( 'mantis_filters_table' ) );

  • print_table_stats( config_get( 'mantis_lang_table' ) );
  • print_table_stats( config_get( 'mantis_noexist_table' ) );
    print_table_stats( config_get( 'mantis_project_category_table' ) );

The 3 first lines tell you which file it is (here db_stats.php). It tells you that lines with + before are from mymantisbt/.../db_stats.php whereas lines with - before are from mantisbt/.../db_stats.php. So all you have to do is suppress lines with - and add lines with + in your version of mantis respecting what is written is the path file. But there's certainly a program that do it in windows.

lifo2

lifo2

2006-04-17 11:21

reporter   ~0012533

Of course there is, and I found it :
http://gnuwin32.sourceforge.net/packages/patch.htm