From owner-svn-src-user@FreeBSD.ORG Tue Feb 19 02:25:06 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D9F1590; Tue, 19 Feb 2013 02:25:06 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BD8A4629; Tue, 19 Feb 2013 02:25:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1J2P6Bq015523; Tue, 19 Feb 2013 02:25:06 GMT (envelope-from linimon@svn.freebsd.org) Received: (from linimon@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1J2P6uV015522; Tue, 19 Feb 2013 02:25:06 GMT (envelope-from linimon@svn.freebsd.org) Message-Id: <201302190225.r1J2P6uV015522@svn.freebsd.org> From: Mark Linimon Date: Tue, 19 Feb 2013 02:25:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246961 - user/bugmeister/gnats/tools X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 02:25:06 -0000 Author: linimon (doc,ports committer) Date: Tue Feb 19 02:25:06 2013 New Revision: 246961 URL: http://svnweb.freebsd.org/changeset/base/246961 Log: Production copy of www/en/cgi/cgi-style.pl. Added: user/bugmeister/gnats/tools/cgi-style.pl (contents, props changed) Added: user/bugmeister/gnats/tools/cgi-style.pl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/cgi-style.pl Tue Feb 19 02:25:06 2013 (r246961) @@ -0,0 +1,224 @@ +# $FreeBSD$ +# +# Perl routines to encapsulate various elements of HTML page style. + +# For future reference, when is now? +($se,$mn,$hr,$md,$mo,$yr,$wd,$yd,$dst) = localtime(time); +$yr += 1900; +$mo += 1; +$timestamp = "$mo-$md-$yr"; + +if (!defined($hsty_base)) { + # $hsty_base should be relative if possible, so that mirrors + # serve their local copy instead of going to the main site. + # However, if we aren't running as a cgi, or if we're + # running on cgi, hub, docs or people, use the absolute home path. + if (!defined($ENV{'HTTP_HOST'}) || + $ENV{'HTTP_HOST'} =~ /(cgi|hub|docs|people).freebsd.org/i) { + + $hsty_base = 'http://www.FreeBSD.org' + } else { + $hsty_base = '..'; + } +} +if (!defined($hsty_email)) { + $hsty_email = 'www@FreeBSD.org'; +} +if (!defined($hsty_author)) { + $hsty_author = "$hsty_email"; +} + +if (!defined($hsty_date)) { + $hsty_date = ''; +} + +# This can be set to either a string containing an inline CSS stylesheet +# or to a element that references an external CSS stylesheet, to +# make local modifications to the style of a CGI script's output. +$t_style = ""; # Don't allow script to override completely, just + # let the script's setting cascade with the master. + +$i_topbar = qq` +
+
+ Skip site + navigation (1)Skip section navigation (2) + +
+ + +

Site Navigation

+ + +
+ +
+`; + +#XXX does anyone use this? I don't know what it should be in the new style. +if (!defined($hsty_home)) { + $hsty_home = "FreeBSD Home Page"; +} + +sub html_header { + local ($title, $xhtml) = @_; + + # XXX MCL refactored + return qq`Content-type: text/html + +` . short_html_header($title, $xhtml) . "

$title

\n"; +} + +# XXX MCL added +sub noninteractive_html_header { + local ($title, $xhtml) = @_; + + return short_html_header($title, $xhtml) . "

$title

\n"; +} + +sub short_html_header { + local ($title, $xhtml) = @_; + + $xhtml = 1 unless defined($xhtml); + $doctype = $xhtml ? '' : ''; + $html = $xhtml ? '' : ''; + $endslash = $xhtml ? '/' : ''; + $csshack = (1 || $xhtml) ? '' : q` +`; + + return qq`$doctype +$html + +$title + + + + +$csshack + +$t_style + + +$i_topbar +`; +} + +sub html_footer { + return qq` +
+ +
+
+ + +`; + + +} + +sub get_the_source { + return if $ENV{'PATH_INFO'} ne '/get_the_source'; + + open(R, $0) || do { + print "Oops! open $0: $!\n"; # should not reached + exit; + }; + + print "Content-type: text/plain\n\n"; + while() { print } + close R; + exit; +} + +1;