help-gnats
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnatsweb patches


From: Tom Tromey
Subject: gnatsweb patches
Date: 10 Jan 2001 16:09:19 -0700

Gerald Pfeifer asked me to submit my gnatsweb.pl changes here.

Gerald, note that some of the local changes were made by Jason
Molenda.  I can tell you how to get to these.  I don't know too much
about them, except from the log entries.

I've made two separate patches.

The first one is this:

2000-08-30  Tom Tromey  <address@hidden>

        * cgi-bin/gnatsweb.pl (view): Force audit trail to be shown.

This makes it so the audit trail is always shown.  In practice I found
it to be annoying to always have to explicitly request the audit
trail.  I couldn't find a case where seeing it was harmful.  Usually
the audit trails are not very large.

I think this patch should be the default.  (Of course you'll want to
remove the reference to sources.redhat.com.)


This is the second patch:

2000-01-17  Tom Tromey  <address@hidden>

        Turn URLs in PR text into real URLs:
        * cgi-bin/gnatsweb.pl (mark_urls): New function.
        (view): Use it.
        (edit): Likewise.

This patch recognizes URLs in PR text and turns them into links in the
generated html.

Tom

Index: gnatsweb.pl
===================================================================
RCS file: /cvs/sourceware/cgi-bin/gnatsweb.pl,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- gnatsweb.pl 2000/07/07 22:27:26     1.20
+++ gnatsweb.pl 2000/08/30 17:02:59     1.21
@@ -897,6 +897,9 @@
 {
   my($viewaudit, $tmp) = @_;
 
+  # For sources.redhat.com, force audit trail to always be shown.
+  $viewaudit = 1;
+
   my $page = 'View PR';
   page_start_html($page);
 



Index: gnatsweb.pl
===================================================================
RCS file: /cvs/sourceware/cgi-bin/gnatsweb.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- gnatsweb.pl 1999/12/01 08:39:32     1.18
+++ gnatsweb.pl 2000/01/18 00:10:25     1.19
@@ -883,6 +883,16 @@
         . "send email to interested parties</a>\n";
 }
 
+# Look for text that looks like URLs and turn it into actual links.
+sub mark_urls
+{
+  my ($val) = @_;
+  # This probably doesn't catch all URLs, but one hopes it catches the
+  # majority.
+  $val =~ 
s/\b((s?https?|ftp):\/\/[-a-zA-Z0-9_.]+(:[0-9]+)?[-a-zA-Z0-9_\$.+\!*\(\),;:address@hidden&=?~\#\/]*)/\<a
 href="$1">$1\<\/a\>/g;
+  return $val;
+}
+
 sub view
 {
   my($viewaudit, $tmp) = @_;
@@ -934,6 +944,7 @@
       $valign = 'valign=top';
       $val =~ s/$/<br>/gm;
       $val =~ s/<br>$//; # previous substitution added one too many <br>'s
+      $val = mark_urls($val);
     }
     print "<tr><td nowrap $valign><b>$_:</b><td>",
           $q->tt($val), "\n";
@@ -958,7 +969,7 @@
   if($viewaudit)
   {
     print "<h3>Audit Trail:</h3>\n",
-          $q->pre($q->escapeHTML($fields{'Audit-Trail'}));
+          mark_urls($q->pre($q->escapeHTML($fields{'Audit-Trail'})));
   }
 
   page_end_html($page);
@@ -1090,7 +1101,7 @@
   page_footer($page);
 
   print "<h3>Audit-Trail:</h3>\n",
-        $q->pre($q->escapeHTML($fields{'Audit-Trail'}));
+        mark_urls($q->pre($q->escapeHTML($fields{'Audit-Trail'})));
   page_end_html($page);
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]