public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
* gnatsweb patches
@ 2001-01-10 14:48 Tom Tromey
  2001-02-08  2:50 ` Gerald Pfeifer
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2001-01-10 14:48 UTC (permalink / raw)
  To: gnats-devel

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  <tromey@cygnus.com>

	* 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  <tromey@cygnus.com>

	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_\$.+\!*\(\),;:\@\&=?~\#\/]*)/\<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);
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gnatsweb patches
  2001-01-10 14:48 gnatsweb patches Tom Tromey
@ 2001-02-08  2:50 ` Gerald Pfeifer
  2001-02-10 13:58   ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Gerald Pfeifer @ 2001-02-08  2:50 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gnats-devel

On 10 Jan 2001, Tom Tromey wrote:
> Gerald Pfeifer asked me to submit my gnatsweb.pl changes here.

Yup, thanks! And sorry for the delay; this merge stuff is not that
trivial, unfortunately. :-(

> 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 believe I've already fed all of the relevant ones back from gcc.gnu.org
to the GNATS CVS repository, and marked the others as GCC-LOCAL in the
gcc.gnu.org tree.

> 2000-01-17  Tom Tromey  <tromey@cygnus.com>
>
> 	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.

This is nice. It did not apply cleanly to the current gnatsweb sources,
but the update was simple (and correct, I hope). So I installed the
following:

Thanks for the contribution. And you said that you're not a web hacker!
;-)

Gerald

Index: gnatsweb.pl
===================================================================
RCS file: /cvs/gnats/gnats/contrib/gnatsweb/gnatsweb.pl,v
retrieving revision 2.23
diff -u -3 -p -r2.23 gnatsweb.pl
--- gnatsweb.pl	2001/02/03 12:49:56	2.23
+++ gnatsweb.pl	2001/02/08 10:44:16
@@ -951,6 +951,16 @@ sub get_mailto_link
         . "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_\$.+\!*\(\),;:\@\&=?~\#\/]*)/\<a href="$1">$1\<\/a\>/g;
+  return $val;
+}
+
 sub view
 {
   my($viewaudit, $tmp) = @_;
@@ -1006,6 +1016,7 @@ sub view
       $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";
@@ -1030,7 +1041,7 @@ sub view
   if($viewaudit)
   {
     print "<h3>Audit Trail:</h3>\n",
-          $q->pre($q->escapeHTML($fields{$AUDIT_TRAIL_FIELD}));
+          mark_urls($q->pre($q->escapeHTML($fields{$AUDIT_TRAIL_FIELD})));
   }

   page_end_html($page);
@@ -1161,7 +1172,7 @@ sub edit
   page_footer($page);

   print "<h3>Audit-Trail:</h3>\n",
-        $q->pre($q->escapeHTML($fields{$AUDIT_TRAIL_FIELD}));
+        mark_urls($q->pre($q->escapeHTML($fields{$AUDIT_TRAIL_FIELD})));
   page_end_html($page);
 }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gnatsweb patches
  2001-02-08  2:50 ` Gerald Pfeifer
@ 2001-02-10 13:58   ` Tom Tromey
  2001-02-11 18:43     ` Gerald Pfeifer
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2001-02-10 13:58 UTC (permalink / raw)
  To: Gerald Pfeifer; +Cc: gnats-devel

>>>>> "Gerald" == Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> writes:

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

Gerald> Yup, thanks! And sorry for the delay; this merge stuff is not
Gerald> that trivial, unfortunately. :-(

No sweat.

I notice you didn't install the patch to always show the audit trail.
Why not?  I think it makes sense.

Another option would be to find a way to make it so that this can be
configured on a per-site basis.  If the original patch isn't
acceptable, maybe that would be?  I could add it to my to-do list if
it sounds ok (I don't want to write it if it isn't ok).

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gnatsweb patches
  2001-02-10 13:58   ` Tom Tromey
@ 2001-02-11 18:43     ` Gerald Pfeifer
  0 siblings, 0 replies; 4+ messages in thread
From: Gerald Pfeifer @ 2001-02-11 18:43 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gnats-devel

On 10 Feb 2001, Tom Tromey wrote:
> I notice you didn't install the patch to always show the audit trail.
> Why not?  I think it makes sense.

I definitely agree, I was just trying to look for a ``cleaner'' way of
doing it...

> Another option would be to find a way to make it so that this can be
> configured on a per-site basis.  If the original patch isn't
> acceptable, maybe that would be?

...which the above certainly is. In fact, that's better than anything I
had thought about yet. ;-)

> I could add it to my to-do list if it sounds ok (I don't want to write
> it if it isn't ok).

That sounds great. I like that idea very much, and in fact I'd even
suggest to make the logs visible by default. May I accept your offer? :-)

Gerald
-- 
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-02-11 18:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-10 14:48 gnatsweb patches Tom Tromey
2001-02-08  2:50 ` Gerald Pfeifer
2001-02-10 13:58   ` Tom Tromey
2001-02-11 18:43     ` Gerald Pfeifer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).