From d23cf5dde37c1ff3f54dd2f6833b50567cdb3093 Mon Sep 17 00:00:00 2001
From: Kornel <kornel@aardvarkmedia.co.uk>
Date: Tue, 4 May 2010 16:08:27 +0100
Subject: [PATCH 1/2] Option to linkify bug summaries on My View page

---
 config_defaults_inc.php |    8 +++++++-
 my_view_inc.php         |    9 ++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index 7fb5225..b7a3f79 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -871,7 +871,7 @@ $g_severity_significant_threshold = MAJOR;
  * they conflict with other configuration. Or if the current user doesn't have
  * the necessary access level to view them. For example, sponsorship_total will
  * be removed if sponsorships are disabled. To include custom field 'xyz',
- include the column name as 'custom_xyz'.
+ * include the column name as 'custom_xyz'.
  *
  * Standard Column Names (i.e. names to choose from):
  * selection, edit, id, project_id, reporter_id, handler_id, priority,
@@ -1032,6 +1032,12 @@ $g_show_changelog_dates = ON;
  */
 $g_show_roadmap_dates = ON;
 
+/**
+ * Show summaries on My View page as links to bugs
+ * @global int $g_show_summary_as_link
+ */
+$g_show_summary_as_link = ON;
+
 /**************************
  * MantisBT Time Settings *
  **************************/
diff --git a/my_view_inc.php b/my_view_inc.php
index 21284a5..c730974 100644
--- a/my_view_inc.php
+++ b/my_view_inc.php
@@ -508,7 +508,14 @@ echo "<span class=\"my-buglist-count\">($v_start - $v_end / $t_bug_count)</span>
 		 	if( ON == config_get( 'show_bug_project_links' ) && helper_get_current_project() != $t_bug->project_id ) {
 				echo '<span class="small project">[', string_display_line( project_get_name( $t_bug->project_id ) ), '] </span>';
 			}
-			echo '<span class="small summary">', $t_summary, '<br /></span>';
+
+			echo '<span class="small summary">';
+			if ( ON == config_get( 'show_summary_as_link' ) ) {
+			    echo '<a href="' . string_get_bug_view_url( $t_bug->id, null ) . '">', $t_summary, '</a>';
+		    } else {
+			    echo $t_summary;
+	        }
+			echo '<br /></span>';
 	?>
 		<?php
 	# type project name if viewing 'all projects' or bug is in subproject
-- 
1.7.0.2


From 12a9b47db6332f9f70bee3155cfc134baf3cefd6 Mon Sep 17 00:00:00 2001
From: Kornel <kornel@aardvarkmedia.co.uk>
Date: Wed, 5 May 2010 12:03:38 +0100
Subject: [PATCH 2/2] Added config option to disable showing of new window links ([^]).

---
 config_defaults_inc.php |    5 +++++
 core/html_api.php       |    9 ++++++++-
 core/print_api.php      |    6 +++++-
 core/string_api.php     |    8 +++++++-
 my_view_inc.php         |    4 +++-
 5 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index b7a3f79..2303cb8 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -1038,6 +1038,11 @@ $g_show_roadmap_dates = ON;
  */
 $g_show_summary_as_link = ON;
 
+/**
+ * Append [ ^ ] new-window link to some links
+ */
+$g_show_new_window_links = ON;
+
 /**************************
  * MantisBT Time Settings *
  **************************/
diff --git a/core/html_api.php b/core/html_api.php
index dc3f65c..1e99f61 100644
--- a/core/html_api.php
+++ b/core/html_api.php
@@ -605,7 +605,14 @@ function html_footer( $p_file = null ) {
 	echo '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr valign="top"><td>';
 	if( ON == config_get( 'show_version' ) ) {
 		$t_version_suffix = config_get_global( 'version_suffix' );
-		echo "\t", '<span class="timer"><a href="http://www.mantisbt.org/" title="Free Web Based Bug Tracker">MantisBT ', MANTIS_VERSION, ( $t_version_suffix ? " $t_version_suffix" : '' ), '</a>', '[<a href="http://www.mantisbt.org/"  title="Free Web Based Bug Tracker" target="_blank">^</a>]</span>', "\n";
+
+		if ( ON === config_get('show_new_window_links') ) {
+		    $t_new_window_link = '[<a href="http://www.mantisbt.org/"  title="Free Web Based Bug Tracker" target="_blank">^</a>]</span>';
+	    } else {
+	        $t_new_window_link = '';
+        }
+
+		echo "\t", '<span class="timer"><a href="http://www.mantisbt.org/" title="Free Web Based Bug Tracker">MantisBT ', MANTIS_VERSION, ( $t_version_suffix ? " $t_version_suffix" : '' ), '</a>', $t_new_window_link , "\n";
 	}
 	echo "\t", '<address>Copyright &copy; 2000 - 2010 MantisBT Group</address>', "\n";
 
diff --git a/core/print_api.php b/core/print_api.php
index 7a7486a..0127c93 100644
--- a/core/print_api.php
+++ b/core/print_api.php
@@ -1677,7 +1677,11 @@ function print_bug_attachments_list( $p_bug_id ) {
 			$t_href_start = "<a href=\"file_download.php?file_id={$t_attachment['id']}&amp;type=bug\">";
 			$t_href_end = '</a>';
 
-			$t_href_clicket = " <span class=\"bracket-link bracket-link-new-window\">[<a class=\"new-window\" href=\"file_download.php?file_id={$t_attachment['id']}&amp;type=bug\" target=\"_blank\">^</a>]</span>";
+            if ( ON === config_get('show_new_window_links') ) {
+			    $t_href_clicket = " <span class=\"bracket-link bracket-link-new-window\">[<a class=\"new-window\" href=\"file_download.php?file_id={$t_attachment['id']}&amp;type=bug\" target=\"_blank\">^</a>]</span>";
+		    } else {
+		        $t_href_clicket = '';
+	        }
 		} else {
 			$t_href_start = '';
 			$t_href_end = '';
diff --git a/core/string_api.php b/core/string_api.php
index 8f1367f..ac015d9 100644
--- a/core/string_api.php
+++ b/core/string_api.php
@@ -473,7 +473,13 @@ function string_insert_hrefs( $p_string ) {
 		$s_url_regex = "/(([[:alpha:]][-+.[:alnum:]]*):\/\/(${t_url_part1}*?${t_url_part2}+))/sue";
 	}
 
-	$p_string = preg_replace( $s_url_regex, "'<a href=\"'.rtrim('\\1','.').'\">\\1</a> <span class=\"bracket-link bracket-link-new-window\">[<a class=\"new-window\" href=\"'.rtrim('\\1','.').'\" target=\"_blank\">^</a>]</span>'", $p_string );
+    if ( ON === config_get('show_new_window_links') ) {
+        $t_new_window_link_regex = " <span class=\"bracket-link bracket-link-new-window\">[<a class=\"new-window\" href=\"'.rtrim('\\1','.').'\" target=\"_blank\">^</a>]</span>";
+    } else {
+        $t_new_window_link_regex = '';
+    }
+
+	$p_string = preg_replace( $s_url_regex, "'<a href=\"'.rtrim('\\1','.').'\">\\1</a>$t_new_window_link_regex'", $p_string );
 	if( $t_change_quotes ) {
 		ini_set( 'magic_quotes_sybase', true );
 	}
diff --git a/my_view_inc.php b/my_view_inc.php
index c730974..62e8d86 100644
--- a/my_view_inc.php
+++ b/my_view_inc.php
@@ -423,7 +423,9 @@ $box_title = lang_get( 'my_view_title_' . $t_box_title );
 <?php
 print_link( 'view_all_set.php?type=1&temporary=y&' . $url_link_parameters[$t_box_title], $box_title, false, 'subtle' );
 echo '&nbsp;';
-print_bracket_link( 'view_all_set.php?type=1&temporary=y&' . $url_link_parameters[$t_box_title], '^', true, 'subtle' );
+if ( ON === config_get('show_new_window_links') ) {
+    print_bracket_link( 'view_all_set.php?type=1&temporary=y&' . $url_link_parameters[$t_box_title], '^', true, 'subtle' );
+}
 
 if( count( $rows ) > 0 ) {
 	$v_start = $t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE] * ( $f_page_number - 1 ) + 1;
-- 
1.7.0.2

