[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PATCH: Gnatsweb help page
From: |
Yngve Svendsen |
Subject: |
PATCH: Gnatsweb help page |
Date: |
Thu, 05 Apr 2001 01:56:30 +0200 |
Changes Gnatsweb to display the gnatsweb.html page as help text when the
main menu Help button is clicked.
Yngve Svendsen
IS Engineer
Clustra AS, Trondheim, Norway
address@hidden
2001-04-05 Yngve Svendsen <address@hidden>
* gnatsweb.pl (help_page): If present, return the gnatsweb.html
document installed with Gnatsweb, stripped with send_html, as
help text. Ported from Gnatsweb 2.7 beta.
* gnatsweb.pl (send_html): New subroutine that strips off
everything outside <BODY> and </BODY> in an HTML document and
returns the contents. Ported from Gnatsweb 2.7 beta.
Index: gnatsweb.pl
===================================================================
RCS file: /cvs/gnats/gnats/contrib/gnatsweb/gnatsweb.pl,v
retrieving revision 2.31
diff -u -p -r2.31 gnatsweb.pl
--- gnatsweb.pl 2001/04/04 22:16:28 2.31
+++ gnatsweb.pl 2001/04/04 22:56:10
@@ -2064,17 +2064,51 @@ sub delete_stored_query
}
}
+# send_html -
+# Send HTML help file, after first trimming out everything but
+# <body>..</body>. This is done in this way for convenience of
+# installation. If the gnatsweb.html is installed into the cgi-bin
+# directory along with the gnatsweb.pl file, then it can't be loaded
+# directly by Apache. So, we send it indirectly through gnatsweb.pl.
+# This approach has the benefit that the resulting page has the
+# customized gnatsweb look.
+#
+sub send_html
+{
+ my $file = shift;
+ open(HTML, "$file") || die "Can't open $file: $!";
+ undef $/; # slurp file whole
+ my $html = <HTML>;
+ close(HTML);
+
+ # send just the stuff inside <body>..</body>
+ $html =~ s/.*<body>//is;
+ $html =~ s/<\/body>.*//is;
+
+ print $html;
+}
+
sub help_page
{
- my $page = 'Help';
+ my $html_file = $q->param('help_file') || 'gnatsweb.html';
+ my $page = $q->param('help_title') || 'Help';
+ my $heading = $page;
page_start_html($page);
- page_heading($page, 'Help', 1);
+ page_heading($page, $heading);
- print p('Welcome to our problem report database.');
- print p('This web interface is called gnatsweb, ',
- 'the database system itself is called gnats.');
- print p('For details, please ',
- a({-href=>"$gnats_info_top"}, 'refer to our documentation'));
+ # If send_html doesn't work, print some default, very limited, help text.
+ if (!send_html($html_file))
+ {
+ print p('Welcome to our problem report database. ',
+ 'You\'ll notice that here we call them "problem reports" ',
+ 'or "PR\'s", not "bugs".');
+ print p('This web interface is called "gnatsweb". ',
+ 'The database system itself is called "gnats".',
+ 'You may want to peruse ',
+ a({-href=>"$gnats_info_top"}, 'the gnats manual'),
+ 'to read about bug lifecycles and the like, ',
+ 'but then again, you may not.');
+ }
page_footer($page);
page_end_html($page);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- PATCH: Gnatsweb help page,
Yngve Svendsen <=