Dependency Graph
View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0009213 | mantisbt | filters | public | 2008-06-01 14:47 | 2017-01-31 04:02 | 
| Reporter | mkornatzki | Assigned To | cproensa | ||
| Priority | normal | Severity | feature | Reproducibility | have not tried | 
| Status | closed | Resolution | fixed | ||
| Target Version | 2.1.0 | Fixed in Version | 2.1.0 | ||
| Summary | 0009213: manage filter | ||||
| Description | hi, i missed the possibility to edit filter, so i made a patch for this. you can now edit the name and the properties of the filter. instructions
 | ||||
| Tags | patch | ||||
| Attached Files |  manage_filter.patch (39,268 bytes)   
 
Property changes on: .
___________________________________________________________________
Name: svn:ignore
   - !core
custom_constant_inc.php
custom_strings_inc.php
custom_functions_inc.php
config_inc.php
.#*
.project
project.index
.DS_Store
custom_relationships_inc.php
   + !core
custom_constant_inc.php
custom_strings_inc.php
custom_functions_inc.php
config_inc.php
.#*
.project
project.index
.DS_Store
custom_relationships_inc.php
jpgraph
avatar
Index: query_store_page.php
===================================================================
--- query_store_page.php	(revision 5305)
+++ query_store_page.php	(working copy)
@@ -40,6 +40,11 @@
 <?php
 	$t_query_to_store = filter_db_get_filter( gpc_get_cookie( config_get( 'view_all_cookie' ), '' ) );
 	$t_query_arr = filter_db_get_available_queries();
+	$f_source_query_id = gpc_get_string( 'source_query_id', null );
+	
+	if (!is_null($f_source_query_id)) {
+ 		$filter_row = filter_get_row($f_source_query_id);
+ 	}	
 
 	# Let's just see if any of the current filters are the
 	# same as the one we're about the try and save
@@ -58,21 +63,54 @@
 	print lang_get( 'query_name' ) . ': ';
 ?>
 	<form method="post" action="query_store.php">
-	<input type="text" name="query_name" /><br />
+	<input type="text" name="query_name" value="<?php echo $filter_row['name']; ?>"/><br />
 	<?php
 	if ( access_has_project_level( config_get( 'stored_query_create_shared_threshold' ) ) ) {
-		print '<input type="checkbox" name="is_public" value="on" /> ';
+		print '<input type="checkbox" name="is_public" ';
+		if ($filter_row['is_public'] == 1) {
+			print 'checked="checked"';
+		}		
+		print ' /> ';
 		print lang_get( 'make_public' );
 		print '<br />';
 	}
 	?>
-	<input type="checkbox" name="all_projects" value="on" <?php check_checked( ALL_PROJECTS == helper_get_current_project() ) ?> >
+	
+	<input type="checkbox" name="all_projects" <?php check_checked( $filter_row['project_id'] == ALL_PROJECTS ) ?> >
 	<?php print lang_get( 'all_projects' ); ?><br /><br />
+	<?php
+		if (!is_null($f_source_query_id)) {
+	?>	
+ 		<input type="hidden" name="edit" value="true" />
+		<input type="hidden" name="source_query_id" value="<?php echo $f_source_query_id; ?>" />
+	<?php
+		} 
+	?>
 	<input type="submit" class="button" value="<?php print lang_get( 'save_query' ); ?>" />
 	</form>
-	<form action="view_all_bug_page.php">
-	<input type="submit" class="button" value="<?php print lang_get( 'go_back' ); ?>" />
-	</form>
+	<?php
+		if (is_blank($filter_row)) {
+	?>		
+			<form action="view_all_bug_page.php">
+				<input type="submit" class="button" value="<?php print lang_get( 'go_back' ); ?>" />
+			</form>
+	<?php
+		} else {
+	?>
+			<form action="filter_edit_page.php">
+			<?php
+				if (!is_null($f_source_query_id)) {
+			?>	
+ 					<input type="hidden" name="edit" value="true" />
+					<input type="hidden" name="source_query_id" value="<?php echo $f_source_query_id; ?>" />
+			<?php
+				}
+			?>
+				<input type="submit" class="button" value="<?php print lang_get( 'go_back' ); ?>" />
+			</form>
+	<?php
+		}
+	?>
 <?php
 	echo '</div>';
 	html_page_bottom1( __FILE__ );
Index: view_filters_page.php
===================================================================
--- view_filters_page.php	(revision 5305)
+++ view_filters_page.php	(working copy)
@@ -97,6 +97,7 @@
 	$t_filter_cols = config_get( 'filter_custom_fields_per_row' );
 	$t_custom_cols = 1;
 	$t_custom_rows = 0;
+	$f_source_query_id = gpc_get_string( 'source_query_id' , null);
 
 	#get valid target fields
 	$t_fields = helper_get_columns_to_view();
@@ -180,7 +181,11 @@
 <tr>
 	<td class="right" colspan="<?php PRINT ( 8 * $t_custom_cols ); ?>">
 	<?php
-		$f_switch_view_link = 'view_filters_page.php?target_field=' . $t_target_field . '&view_type=';
+		$f_switch_view_link = 'view_filters_page.php?';
+		if (!is_null($f_source_query_id)) {
+			$f_switch_view_link = $f_switch_view_link . 'source_query_id=' . $f_source_query_id . '&';
+		}
+		$f_switch_view_link = $f_switch_view_link . 'target_field=' . $t_target_field . '&view_type=';
 
 		if ( ( SIMPLE_ONLY != config_get( 'view_filters' ) ) && ( ADVANCED_ONLY != config_get( 'view_filters' ) ) ) {
 			if ( 'advanced' == $f_view_type ) {
@@ -432,10 +437,18 @@
 
 	<!-- Submit button -->
 	<td class="right" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
+	<?php
+	 	if (!is_null($f_source_query_id)) {
+	 ?>	
+			<input type="hidden" name="source_query_id" value="<?php echo gpc_get_string( 'source_query_id' ) ?>" />
+			<input type="hidden" name="edit" value="true" />
+	 <?php		
+	 	}
+	 ?>	 	 
 		<input type="submit" name="filter" class="button" value="<?php echo lang_get( 'filter_button' ) ?>" />
 	</td>
 </tr>
 </table>
 </form>
 
-<?php html_page_bottom1( __FILE__ ) ?>
+<?php html_page_bottom1( __FILE__ ) ?>
\ No newline at end of file
Index: view_all_set.php
===================================================================
--- view_all_set.php	(revision 5305)
+++ view_all_set.php	(working copy)
@@ -28,6 +28,7 @@
 	$f_source_query_id		= gpc_get_int( 'source_query_id', -1 );
 	$f_print				= gpc_get_bool( 'print' );
 	$f_temp_filter			= gpc_get_bool( 'temporary' );
+	$f_edit	= gpc_get_bool( 'edit' );
 
 	# validate filter type
 	$f_default_view_type = 'simple';
@@ -519,11 +520,13 @@
 		gpc_set_cookie( config_get( 'view_all_cookie' ), $t_row_id, time()+config_get( 'cookie_time_length' ), config_get( 'cookie_path' ) );
 	}
 
-	# redirect to print_all or view_all page
-	if ( $f_print ) {
-		$t_redirect_url = 'print_all_bug_page.php';
+	# redirect to print_all, view_all page or filter_edit
+ 	if ($f_print && !$f_edit) {
+ 		$t_redirect_url = 'print_all_bug_page.php';
+ 	} else if (!$f_edit){
+ 		$t_redirect_url = 'view_all_bug_page.php';
 	} else {
-		$t_redirect_url = 'view_all_bug_page.php';
+		$t_redirect_url = 'filter_edit_page.php?source_query_id=' . $f_source_query_id;
 	}
 
 	if ( $f_temp_filter ) {
@@ -533,4 +536,4 @@
 	} else {
 		print_header_redirect( $t_redirect_url );
 	}
-?>
+?>
\ No newline at end of file
Index: query_store.php
===================================================================
--- query_store.php	(revision 5305)
+++ query_store.php	(working copy)
@@ -36,27 +36,35 @@
 	$f_query_name = strip_tags( gpc_get_string( 'query_name' ) );
 	$f_is_public = gpc_get_bool( 'is_public' );
 	$f_all_projects = gpc_get_bool( 'all_projects' );
+	$f_edit = gpc_get_bool( 'edit', false );
+	$f_source_query_id		= gpc_get_string( 'source_query_id', null);
 
-	$t_query_redirect_url = 'query_store_page.php';
+	$t_query_redirect_url = 'query_store_page.php?';
 
+	if (!is_blank($f_source_query_id)) {
+		$t_query_redirect_url = $t_query_redirect_url . 'edit=true&source_query_id=' . $f_source_query_id . '&';
+	}
+
 	# We can't have a blank name
 	if ( is_blank( $f_query_name ) ) {
-		$t_query_redirect_url = $t_query_redirect_url . '?error_msg='
+		$t_query_redirect_url = $t_query_redirect_url . 'error_msg='
 			. urlencode( lang_get( 'query_blank_name' ) );
 		print_header_redirect( $t_query_redirect_url );
 	}
 
 	# Check and make sure they don't already have a
 	# query with the same name
-	$t_query_arr = filter_db_get_available_queries();
-	foreach( $t_query_arr as $t_id => $t_name )	{
-		if ( $f_query_name == $t_name ) {
-			$t_query_redirect_url = $t_query_redirect_url . '?error_msg='
-				. urlencode( lang_get( 'query_dupe_name' ) );
-			print_header_redirect( $t_query_redirect_url );
-			exit;
+	if (is_null($f_source_query_id)) {
+		$t_query_arr = filter_db_get_available_queries();
+		foreach( $t_query_arr as $t_id => $t_name )	{
+			if ( $f_query_name == $t_name ) {
+				$t_query_redirect_url = $t_query_redirect_url . 'error_msg='
+					. urlencode( lang_get( 'query_dupe_name' ) );
+				print_header_redirect( $t_query_redirect_url );
+				exit;
+			}
 		}
-	}
+	}	
 
 	$t_project_id = helper_get_current_project();
 	if ( $f_all_projects ) {
@@ -66,13 +74,17 @@
 	$t_filter_string = filter_db_get_filter( gpc_get_cookie( config_get( 'view_all_cookie' ), '' ) );
 
 	$t_new_row_id = filter_db_set_for_current_user($t_project_id, $f_is_public,
-													$f_query_name, $t_filter_string);
+													$f_query_name, $t_filter_string, $f_source_query_id);
 
 	if ( $t_new_row_id == -1 ) {
 		$t_query_redirect_url = $t_query_redirect_url . '?error_msg='
 			. urlencode( lang_get( 'query_store_error' ) );
 		print_header_redirect( $t_query_redirect_url );
 	} else {
-		print_header_redirect( 'view_all_bug_page.php' );
+		if (!$f_edit) {
+			print_header_redirect( 'view_all_bug_page.php' );
+		} else {
+			print_header_redirect( 'filter_edit_page.php?edit=true&source_query_id=' . $f_source_query_id );
+		}			
 	}
 ?>
Index: view_all_bug_page.php
===================================================================
--- view_all_bug_page.php	(revision 5305)
+++ view_all_bug_page.php	(working copy)
@@ -73,4 +73,4 @@
 	include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'view_all_inc.php' );
 
 	html_page_bottom1( __FILE__ );
-?>
+?>
\ No newline at end of file
Index: filter_edit_page.php
===================================================================
--- filter_edit_page.php	(revision 0)
+++ filter_edit_page.php	(revision 0)
@@ -0,0 +1,90 @@
+<?php
+# Mantis - a php based bugtracking system
+
+# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
+# Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
+
+# Mantis is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# Mantis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
+
+	# --------------------------------------------------------
+	# $Revision: 1.62.2.1 $
+	# $Author: giallu $
+	# $Date: 2007-10-13 22:34:48 $
+	#
+	# $Id: view_all_bug_page.php,v 1.62.2.1 2007-10-13 22:34:48 giallu Exp $
+	# --------------------------------------------------------
+?>
+<?php
+	require_once( 'core.php' );
+
+	$t_core_path = config_get( 'core_path' );
+
+	require_once( $t_core_path.'compress_api.php' );
+	require_once( $t_core_path.'filter_api.php' );
+	require_once( $t_core_path.'last_visited_api.php' );
+?>
+<?php auth_ensure_user_authenticated() ?>
+<?php
+	$f_page_number		= gpc_get_int( 'page_number', 1 );
+	$f_source_query_id = gpc_get_string( 'source_query_id' );
+
+	$t_per_page = null;
+	$t_bug_count = null;
+	$t_page_count = null;
+
+#		print_header_redirect( 'view_all_set.php?type=0' );
+
+	$t_bugslist = Array();
+	$t_row_count = sizeof( $rows );
+	for($i=0; $i < $t_row_count; $i++) {
+		array_push($t_bugslist, $rows[$i]["id"] );
+	}
+
+	gpc_set_cookie( config_get( 'bug_list_cookie' ), implode( ',', $t_bugslist ) );
+
+	compress_enable();
+
+	html_page_top1( lang_get( 'view_bugs_link' ) );
+	html_page_top2();
+
+
+	#include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'view_all_inc.php' );
+	$t_filter = current_user_get_bug_filter();
+
+	if( $t_filter ) {
+		list( $t_sort, ) = split( ',', $t_filter['sort'] );
+		list( $t_dir, ) = split( ',', $t_filter['dir'] );
+	}
+	
+	$t_checkboxes_exist = false;
+
+	$t_icon_path = config_get( 'icon_path' );
+	$t_update_bug_threshold = config_get( 'update_bug_threshold' );
+
+	$t_columns = helper_get_columns_to_view( COLUMNS_TARGET_VIEW_PAGE );
+
+	$col_count = sizeof( $t_columns );
+
+
+
+	$t_filter_position = config_get( 'filter_position' );
+	# -- ====================== FILTER FORM ========================= --
+	if ( ( $t_filter_position & FILTER_POSITION_TOP ) == FILTER_POSITION_TOP ) {
+		filter_draw_selection_area( $f_page_number );
+	}
+	# -- ====================== end of FILTER FORM ================== --
+
+
+	html_page_bottom1( __FILE__ );
+?>
Index: query_view_page.php
===================================================================
--- query_view_page.php	(revision 5305)
+++ query_view_page.php	(working copy)
@@ -45,53 +45,96 @@
 
 	$t_use_query_url = 'view_all_set.php?type=3&source_query_id=';
 	$t_delete_query_url = 'query_delete_page.php?source_query_id=';
+	$t_edit_query_url = 'view_all_set.php?type=3&edit=true&advanced_view_type=true&source_query_id=';
 	
 	$t_rss_enabled = config_get( 'rss_enabled' );
 ?>
 <br />
 <div align="center">
 <table class="width75" cellspacing="0">
+	<tr>
+		<td></td>
+		<td>
+			<?php print lang_get_defaulted( 'id' );?>
+		</td>
+		<td>
+			<?php print lang_get_defaulted('query_name');?>
+		</td>
+		<td>
+			<?php print lang_get_defaulted('query_name_translated');?>
+		</td>
+		<td>
+			<?php print lang_get_defaulted('username');?>
+		</td>
+		<td>
+			<?php print lang_get_defaulted('query_project');?>
+		</td>
+		<td>
+			<?php print lang_get_defaulted( 'public' );?>
+		</td>
+		<td></td>
+		<td></td>
+	</tr>
 <?php
-	$t_column_count = 0;
-	$t_max_column_count = 2;
-
 	foreach( $t_query_arr as $t_id => $t_name ) {
-		if ( $t_column_count == 0 ) {
-			print '<tr ' . helper_alternate_class() . '>';
-		}
+		$filter_row = filter_get_row( $t_id );
 
+		print '<tr ' . helper_alternate_class() . '>';
+
 		print '<td>';
-
 		if ( OFF != $t_rss_enabled ) {
 			# Use the "new" RSS link style.
 			print_rss( rss_get_issues_feed_url( null, null, $t_id ), lang_get( 'rss' ) );
 			echo ' ';
 		}
+		print '</td>';
 
-		print '<a href="' . $t_use_query_url . db_prepare_int( $t_id ) . '">' . string_display( $t_name ) . '</a>';
+		print '<td>';
+		print string_display( $filter_row['id'] );
+		print '</td>';
 
+		print '<td>';
+		print string_display( $filter_row['name'] );
+		print '</td>';
+
+		print '<td>';
+		print '<a href="' . $t_use_query_url . db_prepare_int( $t_id ) . '">' . string_display( lang_get_defaulted($t_name) ) . '</a>';
+		print '</td>';
+
+		print '<td>';
+ 		print '<a href="manage_user_edit_page.php?user_id=' . $filter_row['user_id'] . '">' . string_display( user_get_name($filter_row['user_id']) ) . '</a>';
+		print '</td>';
+
+ 		print '<td>';
+ 		if ($filter_row['project_id'] == ALL_PROJECTS) {
+ 			print string_display( lang_get_defaulted(all_projects) );
+ 		} else {
+			print string_display( project_get_field($filter_row['project_id'], 'name'));
+ 		}
+ 		print '</td>';
+
+		print '<td style="text-align: center">';
+ 		print '<input type="checkbox" name="enabled" disabled ';
+ 		if ($filter_row['is_public'] == 1) {
+ 			print 'checked="checked"';
+ 		}
+ 		print '/>';
+ 		print '</td>';
+
+ 		print '<td>';
 		if ( filter_db_can_delete_filter( $t_id ) ) {
 			echo ' ';
 			print_button( $t_delete_query_url . db_prepare_int( $t_id ), lang_get( 'delete_query' ) );
 		}
-
 		print '</td>';
 
-		$t_column_count++;
-		if ( $t_column_count == $t_max_column_count ) {
-			print '</tr>';
-			$t_column_count = 0;
-		}
-	}
+ 		print '<td>';
+ 			print_button( $t_edit_query_url . db_prepare_int( $t_id ), lang_get( 'edit_query' ) );
+ 		print '</td>';
 
-	# Tidy up this row
-	if ( ( $t_column_count > 0 ) && ( $t_column_count < $t_max_column_count ) ) {
-		for ( $i = $t_column_count; $i < $t_max_column_count; $i++ ) {
-			print '<td> </td>';
-		}
 		print '</tr>';
 	}
 ?>
 </table>
 </div>
-<?php html_page_bottom1( __FILE__ ) ?>
+<?php html_page_bottom1( __FILE__ ) ?>
\ No newline at end of file
Index: set_project.php
===================================================================
--- set_project.php	(revision 5305)
+++ set_project.php	(working copy)
@@ -63,13 +63,15 @@
 		if ( strtolower( $t_path ) == strtolower( substr( $_SERVER['HTTP_REFERER'], 0, strlen( $t_path ) ) ) ) {
 			$t_referrer_page = substr( $_SERVER['HTTP_REFERER'], strlen( $t_path ) );
 			# if view_all_bug_page, pass on filter	
-			if ( eregi( 'view_all_bug_page.php', $t_referrer_page ) ) {
+			if ( eregi( 'view_all_bug_page.php', $t_referrer_page ) || eregi( 'filter_edit_page.php', $t_referrer_page ) ) {
 				$t_source_filter_id = filter_db_get_project_current( $f_project_id );
 				$t_redirect_url = 'view_all_set.php?type=4';
 
 				if ( $t_source_filter_id !== null ) {
 					$t_redirect_url = 'view_all_set.php?type=3&source_query_id=' . $t_source_filter_id;
 				}
+			} else if ( eregi( 'query_store_page.php', $t_referrer_page ) ) {
+					$t_redirect_url = $t_home_page;
 			} else if ( eregi( '_page.php', $t_referrer_page ) ) {
 				# get just the page component
 				if ( strpos( $t_referrer_page, '?' ) !== FALSE ) {
Index: core/filter_api.php
===================================================================
--- core/filter_api.php	(revision 5305)
+++ core/filter_api.php	(working copy)
@@ -1727,7 +1727,13 @@
 				}
 			}
 
-			$t_filters_url = 'view_filters_page.php?for_screen=' . $p_for_screen;
+ 			$t_filters_url = 'view_filters_page.php?';
+			$f_source_query_id = gpc_get_string('source_query_id', null);
+			if (!is_null($f_source_query_id)) {
+				$t_filters_url = $t_filters_url . 'source_query_id=' . $f_source_query_id . '&';
+			}	
+ 			$t_filters_url = $t_filters_url . 'for_screen=' . $p_for_screen;			
+			
 			if ( 'advanced' == $t_view_type ) {
 				$t_filters_url = $t_filters_url . '&view_type=advanced';
 			}
@@ -1742,6 +1748,16 @@
 			} 
 		?>
 
+		<?php if (!is_null($f_source_query_id)) {?>
+			<tr class="row-1">
+				<td class="filter-caption" valign="top" colspan="8">
+				<?php 
+					$filter_row = filter_get_row($f_source_query_id);
+					PRINT lang_get('edit_query') . ': ' .   $filter_row['name'];
+				?>
+				</td>
+			</tr>
+		<?php } ?>
 		<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>
@@ -2874,10 +2890,18 @@
 					<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 
+						$f_source_query_id = gpc_get_string('source_query_id', null);
+						if ($f_source_query_id > 0) {
+					?>
+							<form method="post" name="update_query" action="query_store_page.php" method="post">
+								<input type="hidden" name="source_query_id" value="<?php echo $f_source_query_id; ?>" />
+								<input type="submit" name="update_query_button" class="button-small" value="<?php PRINT lang_get( 'update_query' ) ?>" />
+							</form>
+					<?php
+						}
+					?>								
 			<?php
-			} else {
-			?>
-			<?php
 			}
 			?>
 			</td>
@@ -2888,7 +2912,7 @@
 
 	# Add a filter to the database for the current user
 	function filter_db_set_for_current_user( $p_project_id, $p_is_public,
-										$p_name, $p_filter_string ) {
+										$p_name, $p_filter_string, $p_source_query_id = null ) {
 		$t_user_id = auth_get_current_user_id();
 		$c_project_id = db_prepare_int( $p_project_id );
 		$c_is_public = db_prepare_bool( $p_is_public, false );
@@ -2912,6 +2936,9 @@
 					WHERE user_id=" . db_param(0) . "
 					AND project_id=" . db_param(1) . "
 					AND name=" . db_param(2);
+		if (!is_null($p_source_query_id)) {
+			$query = $query . " OR id=$p_source_query_id";
+ 		}							
 		$result = db_query_bound( $query, Array( $t_user_id, $c_project_id, $c_name ) );
 
 		if ( db_num_rows( $result ) > 0 ) {
@@ -2919,8 +2946,10 @@
 
 			$query = "UPDATE $t_filters_table
 					  SET is_public=" . db_param(0) . ",
-					  	filter_string=" . db_param(1) . "
-					  WHERE id=" . db_param(2);
+					  	filter_string=" . db_param(1) . ",
+					  	project_id=$c_project_id, 
+					    name='$c_name'
+					  	WHERE id=" . db_param(2);
 			db_query_bound( $query, Array( $c_is_public, $p_filter_string, $row['id'] ) );
 
 			return $row['id'];
Index: css/default.css
===================================================================
--- css/default.css	(revision 5305)
+++ css/default.css	(working copy)
@@ -63,6 +63,7 @@
 td.print-category	{ font-size: 8pt; color: #000000; font-weight: bold; text-align: right; padding: 2px; }
 td.print-bottom		{ border-bottom: 1px solid #000000; }
 td.print-spacer		{ background-color: #ffffff; color: #000000; font-size: 1pt; line-height: 0.1; padding: 0px;}
+td.filter-caption	{ font-size: 8pt; font-weight: bold;}
 
 tr					{}
 tr.spacer			{ background-color: #ffffff; color: #000000; height: 5px; }
Index: filter_edit_page.php
===================================================================
--- filter_edit_page.php	(revision 0)
+++ filter_edit_page.php	(revision 0)
@@ -0,0 +1,90 @@
+<?php
+# Mantis - a php based bugtracking system
+
+# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
+# Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
+
+# Mantis is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# Mantis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
+
+	# --------------------------------------------------------
+	# $Revision: 1.62.2.1 $
+	# $Author: giallu $
+	# $Date: 2007-10-13 22:34:48 $
+	#
+	# $Id: view_all_bug_page.php,v 1.62.2.1 2007-10-13 22:34:48 giallu Exp $
+	# --------------------------------------------------------
+?>
+<?php
+	require_once( 'core.php' );
+
+	$t_core_path = config_get( 'core_path' );
+
+	require_once( $t_core_path.'compress_api.php' );
+	require_once( $t_core_path.'filter_api.php' );
+	require_once( $t_core_path.'last_visited_api.php' );
+?>
+<?php auth_ensure_user_authenticated() ?>
+<?php
+	$f_page_number		= gpc_get_int( 'page_number', 1 );
+	$f_source_query_id = gpc_get_string( 'source_query_id' );
+
+	$t_per_page = null;
+	$t_bug_count = null;
+	$t_page_count = null;
+
+#		print_header_redirect( 'view_all_set.php?type=0' );
+
+	$t_bugslist = Array();
+	$t_row_count = sizeof( $rows );
+	for($i=0; $i < $t_row_count; $i++) {
+		array_push($t_bugslist, $rows[$i]["id"] );
+	}
+
+	gpc_set_cookie( config_get( 'bug_list_cookie' ), implode( ',', $t_bugslist ) );
+
+	compress_enable();
+
+	html_page_top1( lang_get( 'view_bugs_link' ) );
+	html_page_top2();
+
+
+	#include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'view_all_inc.php' );
+	$t_filter = current_user_get_bug_filter();
+
+	if( $t_filter ) {
+		list( $t_sort, ) = split( ',', $t_filter['sort'] );
+		list( $t_dir, ) = split( ',', $t_filter['dir'] );
+	}
+	
+	$t_checkboxes_exist = false;
+
+	$t_icon_path = config_get( 'icon_path' );
+	$t_update_bug_threshold = config_get( 'update_bug_threshold' );
+
+	$t_columns = helper_get_columns_to_view( COLUMNS_TARGET_VIEW_PAGE );
+
+	$col_count = sizeof( $t_columns );
+
+
+
+	$t_filter_position = config_get( 'filter_position' );
+	# -- ====================== FILTER FORM ========================= --
+	if ( ( $t_filter_position & FILTER_POSITION_TOP ) == FILTER_POSITION_TOP ) {
+		filter_draw_selection_area( $f_page_number );
+	}
+	# -- ====================== end of FILTER FORM ================== --
+
+
+	html_page_bottom1( __FILE__ );
+?>
Index: lang/strings_english.txt
===================================================================
--- lang/strings_english.txt	(revision 5305)
+++ lang/strings_english.txt	(working copy)
@@ -1190,15 +1190,19 @@
 $s_use_query = 'Use Filter';
 $s_delete_query = 'Delete Filter';
 $s_query_deleted = 'Filter Deleted';
+$s_edit_query = 'Edit Filter';
 $s_save_query = 'Save Current Filter';
+$s_update_query = 'Update Current Filter';
 $s_reset_query = 'Reset Filter';
 $s_query_name = 'Filter Name';
+$s_query_name_translated = 'Filter Name (translated)';
 $s_query_exists = 'This particular query appears to already exist.';
 $s_query_dupe_name = 'Another query already has this name. Please choose a different name for this query.';
 $s_query_blank_name = 'You cannot store a filter without a name. Please give this filter a name before saving it.';
 $s_query_store_error = 'There was an error saving this query.';
 $s_open_queries = 'Manage Filters';
 $s_query_delete_msg = 'Are you sure you wish to delete this query?';
+$s_query_project = 'Project';
 
 # view_bug_advanced_page.php
 $s_view_simple_link = 'View Simple';
Index: lang/strings_german.txt
===================================================================
--- lang/strings_german.txt	(revision 5305)
+++ lang/strings_german.txt	(working copy)
@@ -1177,12 +1177,14 @@
 $s_save_query = 'Filter speichern';
 $s_reset_query = 'Filter zurücksetzen';
 $s_query_name = 'Filtername';
+$s_query_name_translated = 'Filtername (übersetzt)';
 $s_query_exists = 'Ein Filter mit diesen Optionen existiert bereits.';
 $s_query_dupe_name = 'Ein Filter mit diesem Namen existiert bereits. Bitte geben Sie einen anderen Namen ein.';
 $s_query_blank_name = 'Bitte geben Sie einen Namen für diesen Filter ein.';
 $s_query_store_error = 'Ein Fehler ist beim Speichern des Filters aufgetreten.';
 $s_open_queries = 'Filter verwalten';
 $s_query_delete_msg = 'Möchten Sie diesen Filter wirklich löschen?';
+$s_query_project = 'Projekt';
 
 # view_bug_advanced_page.php
 $s_view_simple_link = 'einfache Anzeige';
Index: query_store.php
===================================================================
--- query_store.php	(revision 5305)
+++ query_store.php	(working copy)
@@ -36,27 +36,35 @@
 	$f_query_name = strip_tags( gpc_get_string( 'query_name' ) );
 	$f_is_public = gpc_get_bool( 'is_public' );
 	$f_all_projects = gpc_get_bool( 'all_projects' );
+	$f_edit = gpc_get_bool( 'edit', false );
+	$f_source_query_id		= gpc_get_string( 'source_query_id', null);
 
-	$t_query_redirect_url = 'query_store_page.php';
+	$t_query_redirect_url = 'query_store_page.php?';
 
+	if (!is_blank($f_source_query_id)) {
+		$t_query_redirect_url = $t_query_redirect_url . 'edit=true&source_query_id=' . $f_source_query_id . '&';
+	}
+
 	# We can't have a blank name
 	if ( is_blank( $f_query_name ) ) {
-		$t_query_redirect_url = $t_query_redirect_url . '?error_msg='
+		$t_query_redirect_url = $t_query_redirect_url . 'error_msg='
 			. urlencode( lang_get( 'query_blank_name' ) );
 		print_header_redirect( $t_query_redirect_url );
 	}
 
 	# Check and make sure they don't already have a
 	# query with the same name
-	$t_query_arr = filter_db_get_available_queries();
-	foreach( $t_query_arr as $t_id => $t_name )	{
-		if ( $f_query_name == $t_name ) {
-			$t_query_redirect_url = $t_query_redirect_url . '?error_msg='
-				. urlencode( lang_get( 'query_dupe_name' ) );
-			print_header_redirect( $t_query_redirect_url );
-			exit;
+	if (is_null($f_source_query_id)) {
+		$t_query_arr = filter_db_get_available_queries();
+		foreach( $t_query_arr as $t_id => $t_name )	{
+			if ( $f_query_name == $t_name ) {
+				$t_query_redirect_url = $t_query_redirect_url . 'error_msg='
+					. urlencode( lang_get( 'query_dupe_name' ) );
+				print_header_redirect( $t_query_redirect_url );
+				exit;
+			}
 		}
-	}
+	}	
 
 	$t_project_id = helper_get_current_project();
 	if ( $f_all_projects ) {
@@ -66,13 +74,17 @@
 	$t_filter_string = filter_db_get_filter( gpc_get_cookie( config_get( 'view_all_cookie' ), '' ) );
 
 	$t_new_row_id = filter_db_set_for_current_user($t_project_id, $f_is_public,
-													$f_query_name, $t_filter_string);
+													$f_query_name, $t_filter_string, $f_source_query_id);
 
 	if ( $t_new_row_id == -1 ) {
 		$t_query_redirect_url = $t_query_redirect_url . '?error_msg='
 			. urlencode( lang_get( 'query_store_error' ) );
 		print_header_redirect( $t_query_redirect_url );
 	} else {
-		print_header_redirect( 'view_all_bug_page.php' );
+		if (!$f_edit) {
+			print_header_redirect( 'view_all_bug_page.php' );
+		} else {
+			print_header_redirect( 'filter_edit_page.php?edit=true&source_query_id=' . $f_source_query_id );
+		}			
 	}
 ?>
Index: query_store_page.php
===================================================================
--- query_store_page.php	(revision 5305)
+++ query_store_page.php	(working copy)
@@ -40,6 +40,11 @@
 <?php
 	$t_query_to_store = filter_db_get_filter( gpc_get_cookie( config_get( 'view_all_cookie' ), '' ) );
 	$t_query_arr = filter_db_get_available_queries();
+	$f_source_query_id = gpc_get_string( 'source_query_id', null );
+	
+	if (!is_null($f_source_query_id)) {
+ 		$filter_row = filter_get_row($f_source_query_id);
+ 	}	
 
 	# Let's just see if any of the current filters are the
 	# same as the one we're about the try and save
@@ -58,21 +63,54 @@
 	print lang_get( 'query_name' ) . ': ';
 ?>
 	<form method="post" action="query_store.php">
-	<input type="text" name="query_name" /><br />
+	<input type="text" name="query_name" value="<?php echo $filter_row['name']; ?>"/><br />
 	<?php
 	if ( access_has_project_level( config_get( 'stored_query_create_shared_threshold' ) ) ) {
-		print '<input type="checkbox" name="is_public" value="on" /> ';
+		print '<input type="checkbox" name="is_public" ';
+		if ($filter_row['is_public'] == 1) {
+			print 'checked="checked"';
+		}		
+		print ' /> ';
 		print lang_get( 'make_public' );
 		print '<br />';
 	}
 	?>
-	<input type="checkbox" name="all_projects" value="on" <?php check_checked( ALL_PROJECTS == helper_get_current_project() ) ?> >
+	
+	<input type="checkbox" name="all_projects" <?php check_checked( $filter_row['project_id'] == ALL_PROJECTS ) ?> >
 	<?php print lang_get( 'all_projects' ); ?><br /><br />
+	<?php
+		if (!is_null($f_source_query_id)) {
+	?>	
+ 		<input type="hidden" name="edit" value="true" />
+		<input type="hidden" name="source_query_id" value="<?php echo $f_source_query_id; ?>" />
+	<?php
+		} 
+	?>
 	<input type="submit" class="button" value="<?php print lang_get( 'save_query' ); ?>" />
 	</form>
-	<form action="view_all_bug_page.php">
-	<input type="submit" class="button" value="<?php print lang_get( 'go_back' ); ?>" />
-	</form>
+	<?php
+		if (is_blank($filter_row)) {
+	?>		
+			<form action="view_all_bug_page.php">
+				<input type="submit" class="button" value="<?php print lang_get( 'go_back' ); ?>" />
+			</form>
+	<?php
+		} else {
+	?>
+			<form action="filter_edit_page.php">
+			<?php
+				if (!is_null($f_source_query_id)) {
+			?>	
+ 					<input type="hidden" name="edit" value="true" />
+					<input type="hidden" name="source_query_id" value="<?php echo $f_source_query_id; ?>" />
+			<?php
+				}
+			?>
+				<input type="submit" class="button" value="<?php print lang_get( 'go_back' ); ?>" />
+			</form>
+	<?php
+		}
+	?>
 <?php
 	echo '</div>';
 	html_page_bottom1( __FILE__ );
Index: query_view_page.php
===================================================================
--- query_view_page.php	(revision 5305)
+++ query_view_page.php	(working copy)
@@ -45,53 +45,96 @@
 
 	$t_use_query_url = 'view_all_set.php?type=3&source_query_id=';
 	$t_delete_query_url = 'query_delete_page.php?source_query_id=';
+	$t_edit_query_url = 'view_all_set.php?type=3&edit=true&advanced_view_type=true&source_query_id=';
 	
 	$t_rss_enabled = config_get( 'rss_enabled' );
 ?>
 <br />
 <div align="center">
 <table class="width75" cellspacing="0">
+	<tr>
+		<td></td>
+		<td>
+			<?php print lang_get_defaulted( 'id' );?>
+		</td>
+		<td>
+			<?php print lang_get_defaulted('query_name');?>
+		</td>
+		<td>
+			<?php print lang_get_defaulted('query_name_translated');?>
+		</td>
+		<td>
+			<?php print lang_get_defaulted('username');?>
+		</td>
+		<td>
+			<?php print lang_get_defaulted('query_project');?>
+		</td>
+		<td>
+			<?php print lang_get_defaulted( 'public' );?>
+		</td>
+		<td></td>
+		<td></td>
+	</tr>
 <?php
-	$t_column_count = 0;
-	$t_max_column_count = 2;
-
 	foreach( $t_query_arr as $t_id => $t_name ) {
-		if ( $t_column_count == 0 ) {
-			print '<tr ' . helper_alternate_class() . '>';
-		}
+		$filter_row = filter_get_row( $t_id );
 
+		print '<tr ' . helper_alternate_class() . '>';
+
 		print '<td>';
-
 		if ( OFF != $t_rss_enabled ) {
 			# Use the "new" RSS link style.
 			print_rss( rss_get_issues_feed_url( null, null, $t_id ), lang_get( 'rss' ) );
 			echo ' ';
 		}
+		print '</td>';
 
-		print '<a href="' . $t_use_query_url . db_prepare_int( $t_id ) . '">' . string_display( $t_name ) . '</a>';
+		print '<td>';
+		print string_display( $filter_row['id'] );
+		print '</td>';
 
+		print '<td>';
+		print string_display( $filter_row['name'] );
+		print '</td>';
+
+		print '<td>';
+		print '<a href="' . $t_use_query_url . db_prepare_int( $t_id ) . '">' . string_display( lang_get_defaulted($t_name) ) . '</a>';
+		print '</td>';
+
+		print '<td>';
+ 		print '<a href="manage_user_edit_page.php?user_id=' . $filter_row['user_id'] . '">' . string_display( user_get_name($filter_row['user_id']) ) . '</a>';
+		print '</td>';
+
+ 		print '<td>';
+ 		if ($filter_row['project_id'] == ALL_PROJECTS) {
+ 			print string_display( lang_get_defaulted(all_projects) );
+ 		} else {
+			print string_display( project_get_field($filter_row['project_id'], 'name'));
+ 		}
+ 		print '</td>';
+
+		print '<td style="text-align: center">';
+ 		print '<input type="checkbox" name="enabled" disabled ';
+ 		if ($filter_row['is_public'] == 1) {
+ 			print 'checked="checked"';
+ 		}
+ 		print '/>';
+ 		print '</td>';
+
+ 		print '<td>';
 		if ( filter_db_can_delete_filter( $t_id ) ) {
 			echo ' ';
 			print_button( $t_delete_query_url . db_prepare_int( $t_id ), lang_get( 'delete_query' ) );
 		}
-
 		print '</td>';
 
-		$t_column_count++;
-		if ( $t_column_count == $t_max_column_count ) {
-			print '</tr>';
-			$t_column_count = 0;
-		}
-	}
+ 		print '<td>';
+ 			print_button( $t_edit_query_url . db_prepare_int( $t_id ), lang_get( 'edit_query' ) );
+ 		print '</td>';
 
-	# Tidy up this row
-	if ( ( $t_column_count > 0 ) && ( $t_column_count < $t_max_column_count ) ) {
-		for ( $i = $t_column_count; $i < $t_max_column_count; $i++ ) {
-			print '<td> </td>';
-		}
 		print '</tr>';
 	}
 ?>
 </table>
 </div>
-<?php html_page_bottom1( __FILE__ ) ?>
+<?php html_page_bottom1( __FILE__ ) ?>
\ No newline at end of file
Index: set_project.php
===================================================================
--- set_project.php	(revision 5305)
+++ set_project.php	(working copy)
@@ -63,13 +63,15 @@
 		if ( strtolower( $t_path ) == strtolower( substr( $_SERVER['HTTP_REFERER'], 0, strlen( $t_path ) ) ) ) {
 			$t_referrer_page = substr( $_SERVER['HTTP_REFERER'], strlen( $t_path ) );
 			# if view_all_bug_page, pass on filter	
-			if ( eregi( 'view_all_bug_page.php', $t_referrer_page ) ) {
+			if ( eregi( 'view_all_bug_page.php', $t_referrer_page ) || eregi( 'filter_edit_page.php', $t_referrer_page ) ) {
 				$t_source_filter_id = filter_db_get_project_current( $f_project_id );
 				$t_redirect_url = 'view_all_set.php?type=4';
 
 				if ( $t_source_filter_id !== null ) {
 					$t_redirect_url = 'view_all_set.php?type=3&source_query_id=' . $t_source_filter_id;
 				}
+			} else if ( eregi( 'query_store_page.php', $t_referrer_page ) ) {
+					$t_redirect_url = $t_home_page;
 			} else if ( eregi( '_page.php', $t_referrer_page ) ) {
 				# get just the page component
 				if ( strpos( $t_referrer_page, '?' ) !== FALSE ) {
Index: view_all_bug_page.php
===================================================================
--- view_all_bug_page.php	(revision 5305)
+++ view_all_bug_page.php	(working copy)
@@ -73,4 +73,4 @@
 	include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'view_all_inc.php' );
 
 	html_page_bottom1( __FILE__ );
-?>
+?>
\ No newline at end of file
Index: view_all_set.php
===================================================================
--- view_all_set.php	(revision 5305)
+++ view_all_set.php	(working copy)
@@ -28,6 +28,7 @@
 	$f_source_query_id		= gpc_get_int( 'source_query_id', -1 );
 	$f_print				= gpc_get_bool( 'print' );
 	$f_temp_filter			= gpc_get_bool( 'temporary' );
+	$f_edit	= gpc_get_bool( 'edit' );
 
 	# validate filter type
 	$f_default_view_type = 'simple';
@@ -519,11 +520,13 @@
 		gpc_set_cookie( config_get( 'view_all_cookie' ), $t_row_id, time()+config_get( 'cookie_time_length' ), config_get( 'cookie_path' ) );
 	}
 
-	# redirect to print_all or view_all page
-	if ( $f_print ) {
-		$t_redirect_url = 'print_all_bug_page.php';
+	# redirect to print_all, view_all page or filter_edit
+ 	if ($f_print && !$f_edit) {
+ 		$t_redirect_url = 'print_all_bug_page.php';
+ 	} else if (!$f_edit){
+ 		$t_redirect_url = 'view_all_bug_page.php';
 	} else {
-		$t_redirect_url = 'view_all_bug_page.php';
+		$t_redirect_url = 'filter_edit_page.php?source_query_id=' . $f_source_query_id;
 	}
 
 	if ( $f_temp_filter ) {
@@ -533,4 +536,4 @@
 	} else {
 		print_header_redirect( $t_redirect_url );
 	}
-?>
+?>
\ No newline at end of file
Index: view_filters_page.php
===================================================================
--- view_filters_page.php	(revision 5305)
+++ view_filters_page.php	(working copy)
@@ -97,6 +97,7 @@
 	$t_filter_cols = config_get( 'filter_custom_fields_per_row' );
 	$t_custom_cols = 1;
 	$t_custom_rows = 0;
+	$f_source_query_id = gpc_get_string( 'source_query_id' , null);
 
 	#get valid target fields
 	$t_fields = helper_get_columns_to_view();
@@ -180,7 +181,11 @@
 <tr>
 	<td class="right" colspan="<?php PRINT ( 8 * $t_custom_cols ); ?>">
 	<?php
-		$f_switch_view_link = 'view_filters_page.php?target_field=' . $t_target_field . '&view_type=';
+		$f_switch_view_link = 'view_filters_page.php?';
+		if (!is_null($f_source_query_id)) {
+			$f_switch_view_link = $f_switch_view_link . 'source_query_id=' . $f_source_query_id . '&';
+		}
+		$f_switch_view_link = $f_switch_view_link . 'target_field=' . $t_target_field . '&view_type=';
 
 		if ( ( SIMPLE_ONLY != config_get( 'view_filters' ) ) && ( ADVANCED_ONLY != config_get( 'view_filters' ) ) ) {
 			if ( 'advanced' == $f_view_type ) {
@@ -432,10 +437,18 @@
 
 	<!-- Submit button -->
 	<td class="right" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
+	<?php
+	 	if (!is_null($f_source_query_id)) {
+	 ?>	
+			<input type="hidden" name="source_query_id" value="<?php echo gpc_get_string( 'source_query_id' ) ?>" />
+			<input type="hidden" name="edit" value="true" />
+	 <?php		
+	 	}
+	 ?>	 	 
 		<input type="submit" name="filter" class="button" value="<?php echo lang_get( 'filter_button' ) ?>" />
 	</td>
 </tr>
 </table>
 </form>
 
-<?php html_page_bottom1( __FILE__ ) ?>
+<?php html_page_bottom1( __FILE__ ) ?>
\ No newline at end of file
 | ||||
| if you want a translated filter name make an entry in your custom_strings_inc.php like  | |
| Looks like this feature my have some functionality in addition to 3803. Will review both for possible inclusion. | |
| Hi mkornatzki, looks great, but not usable for me, because you used a relative new base version for your patch. Which version of mantis was your base for the complete patch? | |
| Hi brody, sorry for the long time for my answer. | |
| Mkonrnatzki, | |
| Unassigned after having been assigned for a long time without progress. | |
 related to
					related to				 child of
					child of				 duplicate of
					duplicate of				