added a number of new template files:

instead of just "htmlhead" and "htmltail" there are now:

    "sourcehead" and "sourcetail"
    "sourcedirhead" and "sourcedirtail"
    "findhead" and "findtail"
    "identhead" and "identtail"
    "searchhead" and "searchtail"

so that each CGI can have its own custom headers and footers.
If (for example) identhead isn't configured in lxr.conf, then
htmlhead will be used instead.

"sourcedir*" is used in preference to "source*" when the output
of the "source" script is a CGI.  If sourcedir* aren't configured,
then it falls back to "source*" (and from there to "html*")
This commit is contained in:
jwz 1998-06-16 00:51:27 +00:00
Родитель 5d77951415
Коммит 29748e5b2f
8 изменённых файлов: 388 добавлений и 56 удалений

Просмотреть файл

@ -1,4 +1,4 @@
# $Id: Common.pm,v 1.3 1998/06/15 17:15:35 jwz Exp $
# $Id: Common.pm,v 1.4 1998/06/16 00:51:27 jwz Exp $
package LXR::Common;
@ -369,16 +369,20 @@ sub expandtemplate {
# The first one is simple, the "banner" template is empty, so we
# simply return an appropriate value.
sub bannerexpand {
if ($who eq 'source' || $who eq 'diff') {
if ($who eq 'source' || $who eq 'sourcedir' || $who eq 'diff') {
return($Path->{'xref'});
} else {
return('');
}
}
sub pathname {
return $Path->{'virtf'};
}
sub titleexpand {
if ($who eq 'source' || $who eq 'diff') {
if ($who eq 'source' || $who eq 'sourcedir' || $who eq 'diff') {
return($Conf->sourcerootname.$Path->{'virtf'});
} elsif ($who eq 'ident') {
@ -420,7 +424,7 @@ sub modeexpand {
my @mlist = ();
local $mode;
if ($who eq 'source') {
if ($who eq 'source' || $who eq 'sourcedir') {
push(@mlist, "<b><i>source navigation</i></b>");
} else {
push(@mlist, &fileref("source navigation", $Path->{'virtf'}));
@ -429,7 +433,7 @@ sub modeexpand {
if ($who eq 'diff') {
push(@mlist, "<b><i>diff markup</i></b>");
} elsif ($who eq 'source' && $Path->{'file'}) {
} elsif (($who eq 'source' || $who eq 'sourcedir') && $Path->{'file'}) {
push(@mlist, &diffref("diff markup", $Path->{'virtf'}));
}
@ -475,7 +479,7 @@ sub varlinks {
if ($val eq $oldval) {
$vallink = "<b><i>$val</i></b>";
} else {
if ($who eq 'source') {
if ($who eq 'source' || $who eq 'sourcedir') {
$vallink = &fileref($val,
$Conf->mappath($Path->{'virtf'},
"$var=$val"),
@ -526,11 +530,42 @@ sub varexpand {
sub makeheader {
local $who = shift;
$template = undef;
my $def_templ = "<html><body>\n<hr>\n";
if ($Conf->htmlhead && !open(TEMPL, $Conf->htmlhead)) {
&warning("Template ".$Conf->htmlhead." does not exist.");
$template ||= "<html><body>\n<hr>\n";
} else {
if ($who eq "sourcedir" && $Conf->sourcedirhead) {
if (!open(TEMPL, $Conf->sourcedirhead)) {
&warning("Template ".$Conf->sourcedirhead." does not exist.");
$template = $def_templ;
}
} elsif (($who eq "source" || $who eq 'sourcedir') && $Conf->sourcehead) {
if (!open(TEMPL, $Conf->sourcehead)) {
&warning("Template ".$Conf->sourcehead." does not exist.");
$template = $def_templ;
}
} elsif ($who eq "find" && $Conf->findhead) {
if (!open(TEMPL, $Conf->findhead)) {
&warning("Template ".$Conf->findhead." does not exist.");
$template = $def_templ;
}
} elsif ($who eq "ident" && $Conf->identhead) {
if (!open(TEMPL, $Conf->identhead)) {
&warning("Template ".$Conf->identhead." does not exist.");
$template = $def_templ;
}
} elsif ($who eq "search" && $Conf->searchhead) {
if (!open(TEMPL, $Conf->searchhead)) {
&warning("Template ".$Conf->searchhead." does not exist.");
$template = $def_templ;
}
} elsif ($Conf->htmlhead) {
if (!open(TEMPL, $Conf->htmlhead)) {
&warning("Template ".$Conf->htmlhead." does not exist.");
$template = $def_templ;
}
}
if (!$template) {
$save = $/; undef($/);
$template = <TEMPL>;
$/ = $save;
@ -550,6 +585,7 @@ sub makeheader {
('banner', \&bannerexpand),
('baseurl', \&baseurl),
('thisurl', \&thisurl),
('pathname', \&pathname),
('modes', \&modeexpand),
('variables', \&varexpand)));
}
@ -557,11 +593,42 @@ sub makeheader {
sub makefooter {
local $who = shift;
$template = undef;
my $def_templ = "<hr>\n</body>\n";
if ($Conf->htmltail && !open(TEMPL, $Conf->htmltail)) {
&warning("Template ".$Conf->htmltail." does not exist.");
$template = "<hr>\n</body>\n";
} else {
if ($who eq "sourcedir" && $Conf->sourcedirtail) {
if (!open(TEMPL, $Conf->sourcedirtail)) {
&warning("Template ".$Conf->sourcedirtail." does not exist.");
$template = $def_templ;
}
} elsif (($who eq "source" || $who eq 'sourcedir') && $Conf->sourcetail) {
if (!open(TEMPL, $Conf->sourcetail)) {
&warning("Template ".$Conf->sourcetail." does not exist.");
$template = $def_templ;
}
} elsif ($who eq "find" && $Conf->findtail) {
if (!open(TEMPL, $Conf->findtail)) {
&warning("Template ".$Conf->findtail." does not exist.");
$template = $def_templ;
}
} elsif ($who eq "ident" && $Conf->identtail) {
if (!open(TEMPL, $Conf->identtail)) {
&warning("Template ".$Conf->identtail." does not exist.");
$template = $def_templ;
}
} elsif ($who eq "search" && $Conf->searchtail) {
if (!open(TEMPL, $Conf->searchtail)) {
&warning("Template ".$Conf->searchtail." does not exist.");
$template = $def_templ;
}
} elsif ($Conf->htmltail) {
if (!open(TEMPL, $Conf->htmltail)) {
&warning("Template ".$Conf->htmltail." does not exist.");
$template = $def_templ;
}
}
if (!$template) {
$save = $/; undef($/);
$template = <TEMPL>;
$/ = $save;

Просмотреть файл

@ -1,4 +1,4 @@
# $Id: Config.pm,v 1.1 1998/06/11 23:56:23 jwz Exp $
# $Id: Config.pm,v 1.2 1998/06/16 00:51:27 jwz Exp $
package LXR::Config;
@ -104,6 +104,16 @@ sub _initialize {
$dir eq 'glimpsebin' ||
$dir eq 'htmlhead' ||
$dir eq 'htmltail' ||
$dir eq 'sourcehead' ||
$dir eq 'sourcetail' ||
$dir eq 'sourcedirhead' ||
$dir eq 'sourcedirtail' ||
$dir eq 'findhead' ||
$dir eq 'findtail' ||
$dir eq 'identhead' ||
$dir eq 'identtail' ||
$dir eq 'searchhead' ||
$dir eq 'searchtail' ||
$dir eq 'htmldir') {
if ($arg =~ /(\S+)/) {
$self->{$dir} = $1;
@ -213,6 +223,56 @@ sub htmltail {
return($self->varexpand($self->{'htmltail'}));
}
sub sourcehead {
my $self = shift;
return($self->varexpand($self->{'sourcehead'}));
}
sub sourcetail {
my $self = shift;
return($self->varexpand($self->{'sourcetail'}));
}
sub sourcedirhead {
my $self = shift;
return($self->varexpand($self->{'sourcedirhead'}));
}
sub sourcedirtail {
my $self = shift;
return($self->varexpand($self->{'sourcedirtail'}));
}
sub findhead {
my $self = shift;
return($self->varexpand($self->{'findhead'}));
}
sub findtail {
my $self = shift;
return($self->varexpand($self->{'findtail'}));
}
sub identhead {
my $self = shift;
return($self->varexpand($self->{'identhead'}));
}
sub identtail {
my $self = shift;
return($self->varexpand($self->{'identtail'}));
}
sub searchhead {
my $self = shift;
return($self->varexpand($self->{'searchhead'}));
}
sub searchtail {
my $self = shift;
return($self->varexpand($self->{'searchtail'}));
}
sub htmldir {
my $self = shift;

Просмотреть файл

@ -12,9 +12,14 @@ baseurl: http://cvs-mirror.mozilla.org/webtools/lxr/
# These are the templates for the HTML heading, directory listing and
# footer, respectively.
htmlhead: ./template-head
htmltail: ./template-tail
htmldir: ./template-dir
htmlhead: template-head
htmltail: template-tail
htmldir: template-dir
sourcehead: template-source-head
sourcetail: template-source-tail
sourcedirhead: template-sourcedir-head
# The source is here.
sourceroot: /opt/lxr-data/mozilla/

Просмотреть файл

@ -1,5 +1,5 @@
#!/usr/bonsaitools/bin/perl
# $Id: source,v 1.3 1998/06/15 22:18:06 jwz Exp $
# $Id: source,v 1.4 1998/06/16 00:51:20 jwz Exp $
# source -- Present sourcecode as html, complete with references
#
@ -314,11 +314,22 @@ sub printfile {
#if the file is html then don't print a header because the file
#has its own -dme
if (!($Path->{'file'} =~ /\.(html)$/)) {
&makeheader('source');
if ($Path->{'file'}) {
&makeheader('source');
} else {
&makeheader('sourcedir');
}
}
&printfile;
if (!($Path->{'file'} =~ /\.(html)$/)) {
&makefooter('source');
if ($Path->{'file'}) {
&makefooter('source');
} else {
&makefooter('sourcedir');
}
}
#$len = length($file);
#print ("length is: ", $len) ;

Просмотреть файл

@ -0,0 +1,102 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META NAME="GENERATOR" CONTENT="lxr-0.3: http://lxr.linux.no">
<META NAME="AUTHOR" CONTENT="Dawn Endico dawn@cannibal.mi.org">
<title>$title</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
var event = 0
function js_dir_menu() {}
function js_file_menu() {}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
function js_dir_menu(dir,d) {
if( parseInt(navigator.appVersion) < 4 ){
return true;
}
l = document.layers['popup'];
urlmonth="/webtools/bonsai/cvsquery.cgi?module=MozillaSource&branch=HEAD&dir=mozilla"+dir+"&file=&who=&sortby=Date&hours=2&date=month&mindate=&maxdate=&cvsroot=%2Fcvsroot";
urlweek="/webtools/bonsai/cvsquery.cgi?module=MozillaSource&branch=HEAD&dir=mozilla"+dir+"&file=&who=&sortby=Date&hours=2&date=week&mindate=&maxdate=&cvsroot=%2Fcvsroot";
text="<table border><tr><td><a href=\"mozilla/source"+dir+"\"><a href=\""+urlweek+"\">Checkins to mozilla"+dir+" in the last week</a> <br><a href=\""+urlmonth+"\">Checkins to mozilla"+dir+" in the last month</a> </td></tr> </table>"
l.document.write(text);
l.top = d.target.y;
l.left = d.target.x + 110;
if( (l.left + l.clipWidth) > window.width ){
l.left = window.width - l.clipWidth;
}
l.visibility="show";
l.document.close();
return false;
}
function js_file_menu(file,d) {
if( parseInt(navigator.appVersion) < 4 ){
return true;
}
l = document.layers['popup'];
text="<table border><tr><td><a href=\"/webtools/bonsai/cvslog.cgi?file=/mozilla"+file+"&root=/cvsroot\">mozilla"+file+" change log</a><br><a href=\"http://cvs1.mozilla.org/webtools/bonsai/cvsblame.cgi?&file=mozilla"+file+"&root=/cvsroot\">mozilla"+file+" with change log annotations</a></td></tr></table>"
l.document.write(text);
l.top = d.target.y;
l.left = d.target.x + 110;
if( (l.left + l.clipWidth) > window.width ){
l.left = window.width - l.clipWidth;
}
l.visibility="show";
l.document.close();
return false;
}
// end script -->
</script>
<layer name="popup" onMouseOut="this.visibility='hide';" left=0 top=0 bgcolor="#dddddd" visibility="hide">
</layer>
</head>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000"
LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
<TABLE BGCOLOR="#000000" WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR><TD><A HREF="http://www.mozilla.org/"><IMG
SRC="http://www.mozilla.org/images/mozilla-banner.gif" ALT=""
BORDER=0 WIDTH=600 HEIGHT=58></A></TD></TR></TABLE>
<TABLE BORDER=0 CELLPADDING=12 CELLSPACING=0 WIDTH="100%">
<TR>
<TD ALIGN=LEFT VALIGN=CENTER>
<NOBR><FONT SIZE="+2"><B>
<A HREF="/webtools/lxr/">Mozilla Cross Reference:</A>
</B></FONT></NOBR>
<BR><B>$banner</B>
</TD>
<TD ALIGN=RIGHT VALIGN=TOP WIDTH="1%">
<TABLE BORDER CELLPADDING=6 CELLSPACING=0>
<TR>
<TD BGCOLOR="#FAFAFA">
<TABLE BORDER=0 CELLPADDING=6 CELLSPACING=0>
<TR>
<TD NOWRAP ALIGN=LEFT>
changes to<BR>this file in<BR>the last:
</TD>
<TD NOWRAP>
<A HREF="$baseurl../bonsai/cvsquery.cgi?file=mozilla$pathname&date=day">day</A><BR>
<A HREF="$baseurl../bonsai/cvsquery.cgi?file=mozilla$pathname&date=week">week</A><BR>
<A HREF="$baseurl../bonsai/cvsquery.cgi?file=mozilla$pathname&date=month">month</A><BR>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>

Просмотреть файл

@ -0,0 +1,19 @@
<P>
<BR>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=4 WIDTH="100%">
<TR>
<TD WIDTH="50%" ALIGN=LEFT VALIGN=TOP>
This page was automatically generated by the
<A HREF="http://lxr.linux.no/">LXR engine</A>
written by
<A HREF="mailto:lxr@linux.no">Arne Georg Gleditsch</A> and
<A HREF="mailto:lxr@linux.no">Per Kristian Gjermshus</A>.
</TD>
<TD WIDTH="50%" ALIGN=LEFT VALIGN=TOP>
Contact
<A HREF="mailto:dawn@cannibal.mi.org,jwz@netscape.com">Dawn Endico</A> and
<A HREF="mailto:dawn@cannibal.mi.org,jwz@netscape.com">Jamie Zawinski</A>
with any comments or questions about this site.
</TD>
</TR>
</TABLE>

Просмотреть файл

@ -0,0 +1,102 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META NAME="GENERATOR" CONTENT="lxr-0.3: http://lxr.linux.no">
<META NAME="AUTHOR" CONTENT="Dawn Endico dawn@cannibal.mi.org">
<title>$title</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
var event = 0
function js_dir_menu() {}
function js_file_menu() {}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
function js_dir_menu(dir,d) {
if( parseInt(navigator.appVersion) < 4 ){
return true;
}
l = document.layers['popup'];
urlmonth="/webtools/bonsai/cvsquery.cgi?module=MozillaSource&branch=HEAD&dir=mozilla"+dir+"&file=&who=&sortby=Date&hours=2&date=month&mindate=&maxdate=&cvsroot=%2Fcvsroot";
urlweek="/webtools/bonsai/cvsquery.cgi?module=MozillaSource&branch=HEAD&dir=mozilla"+dir+"&file=&who=&sortby=Date&hours=2&date=week&mindate=&maxdate=&cvsroot=%2Fcvsroot";
text="<table border><tr><td><a href=\"mozilla/source"+dir+"\"><a href=\""+urlweek+"\">Checkins to mozilla"+dir+" in the last week</a> <br><a href=\""+urlmonth+"\">Checkins to mozilla"+dir+" in the last month</a> </td></tr> </table>"
l.document.write(text);
l.top = d.target.y;
l.left = d.target.x + 110;
if( (l.left + l.clipWidth) > window.width ){
l.left = window.width - l.clipWidth;
}
l.visibility="show";
l.document.close();
return false;
}
function js_file_menu(file,d) {
if( parseInt(navigator.appVersion) < 4 ){
return true;
}
l = document.layers['popup'];
text="<table border><tr><td><a href=\"/webtools/bonsai/cvslog.cgi?file=/mozilla"+file+"&root=/cvsroot\">mozilla"+file+" change log</a><br><a href=\"http://cvs1.mozilla.org/webtools/bonsai/cvsblame.cgi?&file=mozilla"+file+"&root=/cvsroot\">mozilla"+file+" with change log annotations</a></td></tr></table>"
l.document.write(text);
l.top = d.target.y;
l.left = d.target.x + 110;
if( (l.left + l.clipWidth) > window.width ){
l.left = window.width - l.clipWidth;
}
l.visibility="show";
l.document.close();
return false;
}
// end script -->
</script>
<layer name="popup" onMouseOut="this.visibility='hide';" left=0 top=0 bgcolor="#dddddd" visibility="hide">
</layer>
</head>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000"
LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
<TABLE BGCOLOR="#000000" WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR><TD><A HREF="http://www.mozilla.org/"><IMG
SRC="http://www.mozilla.org/images/mozilla-banner.gif" ALT=""
BORDER=0 WIDTH=600 HEIGHT=58></A></TD></TR></TABLE>
<TABLE BORDER=0 CELLPADDING=12 CELLSPACING=0 WIDTH="100%">
<TR>
<TD ALIGN=LEFT VALIGN=CENTER>
<NOBR><FONT SIZE="+2"><B>
<A HREF="/webtools/lxr/">Mozilla Cross Reference:</A>
</B></FONT></NOBR>
<BR><B>$banner</B>
</TD>
<TD ALIGN=RIGHT VALIGN=TOP WIDTH="1%">
<TABLE BORDER CELLPADDING=6 CELLSPACING=0>
<TR>
<TD BGCOLOR="#FAFAFA">
<TABLE BORDER=0 CELLPADDING=6 CELLSPACING=0>
<TR>
<TD NOWRAP ALIGN=LEFT>
changes to<BR>this directory<BR>in the last:
</TD>
<TD NOWRAP>
<A HREF="$baseurl../bonsai/cvsquery.cgi?file=mozilla$pathname&date=day">day</A><BR>
<A HREF="$baseurl../bonsai/cvsquery.cgi?file=mozilla$pathname&date=week">week</A><BR>
<A HREF="$baseurl../bonsai/cvsquery.cgi?file=mozilla$pathname&date=month">month</A><BR>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>

Просмотреть файл

@ -1,39 +1,5 @@
<P>
<HR>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="100%">
<TR>
<TD ALIGN=RIGHT VALIGN=CENTER>
<TABLE CELLPADDING=0 CELLSPACING=0>
<TR>
<TD NOWRAP ID="ident">
<FORM METHOD=GET ACTION="/webtools/lxr/ident">
<A HREF="/webtools/lxr/ident">Identifier</A>:
<INPUT TYPE=TEXT NAME="i" VALUE="" SIZE=6>
<INPUT TYPE=SUBMIT VALUE="Find">
</FORM>
</TD>
<TD NOWRAP ID="string">
<FORM METHOD=GET ACTION="/webtools/lxr/search">
<A HREF="/webtools/lxr/search">Text</A>:
<INPUT TYPE=TEXT NAME="string" VALUE="" SIZE=6>
<INPUT TYPE=SUBMIT VALUE="Find">
</FORM>
</TD>
<TD NOWRAP ID="find">
<FORM METHOD=GET ACTION="/webtools/lxr/find">
<A HREF="/webtools/lxr/find">File</A>:
<INPUT TYPE=TEXT NAME="string" VALUE="" SIZE=6>
<INPUT TYPE=SUBMIT VALUE="Find">
</FORM>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<HR>
<P>
<BR>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=4 WIDTH="100%">
<TR>
<TD WIDTH="50%" ALIGN=LEFT VALIGN=TOP>