From b69ff142f14ac40f90bd51627391cce5b1785fee Mon Sep 17 00:00:00 2001 From: Pav Lucistnik Date: Tue, 29 Nov 2005 23:10:59 +0000 Subject: [PATCH] - Apply new design to it (really, convert to use cgi-style.pl) - Reshuffle to look as much as possible like ports listings - Make it a valid HTML --- en/cgi/ports.cgi | 78 +++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 47 deletions(-) diff --git a/en/cgi/ports.cgi b/en/cgi/ports.cgi index 82494eae07..4edd26fb96 100755 --- a/en/cgi/ports.cgi +++ b/en/cgi/ports.cgi @@ -24,7 +24,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $FreeBSD: www/en/cgi/ports.cgi,v 1.88 2005/11/29 22:09:53 pav Exp $ +# $FreeBSD: www/en/cgi/ports.cgi,v 1.89 2005/11/29 22:19:31 pav Exp $ # # ports.cgi - search engine for FreeBSD ports # o search for a port by name or description @@ -32,6 +32,8 @@ use POSIX qw(strftime); use Time::Local; +require "./cgi-style.pl"; + sub init_variables { $localPrefix = '/usr/ports'; # ports prefix @@ -192,10 +194,6 @@ sub dec { return($_); } -sub header { - print "Content-type: text/html\n"; - print "\n"; -} # $indent is a bit of optional data processing I put in for @@ -336,16 +334,25 @@ sub out { $comment =~ s//\>/g; - print qq{
$version\n}; + local($l) = $path; + $l =~ s%^$remotePrefixFtp%$remotePrefixCvs%o; + + print qq{
$version\n}; print qq{
$comment
\n}; - local($l) = $path; - $l =~ s%^$remotePrefixFtp%$remotePrefixCvs%o; - #$l .= '/Makefile'; + print qq[Long description :\n]; + print qq[Sources :\n]; + + # Link package in "default" arch/release. Verify it's existence on ftp-master. + if ($packages{"$version.$packageExt"}) { + print qq[Package :\n]; + } + + print qq[Changes : Download
\n]; print qq{Maintained by: $email
}; local(@s) = split(/\s+/, $sections); @@ -369,23 +376,12 @@ sub out { print ", " if $flag; $flag++; - print qq{$_}; + print qq{$_}; } print "
\n"; } - print qq[Description : -Sources :\n]; - - # Link package in "default" arch/release. Verify it's existence on ftp-master. - if ($packages{"$version.$packageExt"}) { - print qq[Package :\n]; - } - -print qq[Changes : -Download -

-]; + print q[

]; }; @@ -425,17 +421,9 @@ sub search_ports { sub forms { - print qq{ - -FreeBSD Ports Search - - - -

FreeBSD Ports Search $daemonGif

- -

+ print qq{

FreeBSD Ports [short description followed ...] -FAQ +FAQ

}; @@ -492,7 +480,7 @@ sub footer { Powered by FreeBSD © 1996-2005 by Wolfram Schneider. All rights reserved.
}; - #print q{$FreeBSD: www/en/cgi/ports.cgi,v 1.88 2005/11/29 22:09:53 pav Exp $} . "
\n"; + #print q{$FreeBSD: www/en/cgi/ports.cgi,v 1.89 2005/11/29 22:19:31 pav Exp $} . "
\n"; print qq{Please direct questions about this service to $mailto
\n}; print qq{General questions about FreeBSD ports should be sent to } . @@ -502,10 +490,6 @@ sub footer { print "


\n

\n"; } -sub footer2 { - print "\n\n\n"; -} - sub check_input { if ($query) { @@ -524,9 +508,7 @@ sub check_input { } sub faq { - print qq{\nFreeBSD Ports Search FAQ\n - -

FreeBSD Ports Search FAQ

+ print qq{

FreeBSD Ports Search FAQ

Keywords

@@ -571,6 +553,7 @@ $stype = $form{'stype'}; $script_name = &env('SCRIPT_NAME'); if ($path_info eq "/source") { + # XXX print "Content-type: text/plain\n\n"; open(R, $0) || do { print "ick!\n"; &exit; }; while() { print } @@ -584,16 +567,17 @@ if ($stype eq 'pkgdescr') { 'http://www.FreeBSD.org/cgi/search.cgi?source=pkgdescr&max=25'; $query =~ s/\s+/+/g; print "Location: $url&words=$query\n"; - print "Content-type: text/plain\n\n"; &exit; } -&header; -if ($path_info eq "/faq.html") { +if ($stype eq "faq") { + print &short_html_header("FreeBSD Ports Search FAQ", 0); &faq; - &footer; &footer2; &exit(0); + &footer; print &html_footer; &exit(0); } +print &html_header("FreeBSD Ports Search", 0); + # allow `/ports.cgi?netscape' where 'netscape' is the query port to search # this make links to this script shorter if (!$query && $query_string =~ /^([^=&]+)$/) { @@ -608,7 +592,7 @@ $query =~ s/^\s+//; $query =~ s/\s+$//; if ($query_string eq "" || !$query) { - &footer; &footer2; &exit(0); + &footer; print &html_footer; &exit(0); } &check_input; @@ -631,4 +615,4 @@ if (!$counter) { print "
\n"; &footer; -&footer2; +print &html_footer;