Git development
 help / color / mirror / Atom feed
From: Alan Chandler <alan@chandlerfamily.org.uk>
To: kay.sievers@vrfy.org
Cc: git@vger.kernel.org
Subject: [Patch] gitweb added site css, header and footer
Date: Sat, 12 Nov 2005 17:50:30 +0000	[thread overview]
Message-ID: <200511121750.30477.alan@chandlerfamily.org.uk> (raw)

I wanted to include gitweb on my site - but with the ability to keep my own 
site header and footer.  I have therefore made a few changes to enable this 
to happen.  I also had a problem in that I had installed gitweb.cgi 
in /usr/lib/cgi-bin, and it was attempting to read indextext.html from this 
directory rather than the projectroot.

I have therefore changed it to pick up this file from projectroot, and also 
two other files header.html and footer.html which contain the html for the 
header and footer of each page.

Lastly, I have made a paramter at the top of the file for the the url to my 
site wide css file.

Signed-off-by: Alan Chandler <alan@chandlerfamily.org.uk>

I am not sure what the netiquette is with regards these changes.

I have published them as the master branch at 

http://www.chandlerfamily.org.uk/git/gitweb.git

but I have also attached a patch below (and someone can tell me if kmail does 
the "right thing")

What should one do about the changes to the variables at the top of the file, 
you will see I have changed $projectroot and $gitbin

---------

diff --git a/gitweb.cgi b/gitweb.cgi
index b8f1537..d16def4 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -22,10 +22,10 @@ my $rss_link = "";
 
 # absolute fs-path which will be prepended to the project path
 #my $projectroot =	"/pub/scm";
-my $projectroot = "/home/kay/public_html/pub/scm";
+my $projectroot = "/var/lib/git";
 
 # location of the git-core binaries
-my $gitbin =		"/usr/bin";
+my $gitbin =		"/usr/local/bin";
 
 # location for temporary files needed for diffs
 my $git_temp =		"/tmp/gitweb";
@@ -33,12 +33,25 @@ my $git_temp =		"/tmp/gitweb";
 # target of the home link on top of all pages
 my $home_link =		$my_uri;
 
+#css url for overall site
+
+my $site_css_url = "/style/site.css";
+
+#page header and footer for all pages on this site
+
+my $site_header=	$projectroot."/header.html";
+my $site_footer=	$projectroot."/footer.html";
+
 # html text to include at home page
-my $home_text =		"indextext.html";
+my $home_text =		$projectroot."/indextext.html";
 
 # source of projects list
-#my $projects_list = $projectroot;
-my $projects_list = "index/index.aux";
+my $projects_list = $projectroot;
+#my $projects_list = "index/index.aux";
+
+
+
+
 
 # input validation and dispatch
 my $action = $cgi->param('a');
@@ -217,6 +230,12 @@ sub git_header_html {
 			$title .= "/$action";
 		}
 	}
+
+	my $site_css = "";
+	if (defined $site_css_url) {
+		$site_css="<link rel=\"stylesheet\" text=\"text/css\" 
href=\"$site_css_url\"/>";
+	}
+	
 	print $cgi->header(-type=>'text/html',  -charset => 'utf-8', -status=> 
$status, -expires => $expires);
 	print <<EOF;
 <?xml version="1.0" encoding="utf-8"?>
@@ -228,6 +247,7 @@ sub git_header_html {
 <meta name="robots" content="index, nofollow"/>
 <title>$title</title>
 $rss_link
+$site_css
 <style type="text/css">
 body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid 
#d9d8d1; border-width:1px; margin:10px; }
 a { color:#0000cc; }
@@ -284,6 +304,13 @@ a.rss_logo:hover { background-color:#ee5
 </head>
 <body>
 EOF
+
+	if (-f $site_header) {
+		open (my $fd, $site_header);
+		print <$fd>;
+		close $fd;
+	}
+
 	print "<div class=\"page_header\">\n" .
 	      "<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" 
title=\"git documentation\">" .
 	      "<img src=\"$my_uri?a=git-logo.png\" width=\"72\" height=\"27\" 
alt=\"git\" style=\"float:right; border-width:0px;\"/>" .
@@ -329,8 +356,15 @@ sub git_footer_html {
 	} else {
 		print $cgi->a({-href => "$my_uri?a=opml", -class => "rss_logo"}, "OPML") . 
"\n";
 	}
-	print "</div>\n" .
-	      "</body>\n" .
+	print "</div>\n";
+	if (-f $site_footer) {
+		open (my $fd, $site_footer);
+		print <$fd>;
+		close $fd;
+	}
+
+
+	print "</body>\n" .
 	      "</html>";
 }
 

-- 
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.

                 reply	other threads:[~2005-11-12 17:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200511121750.30477.alan@chandlerfamily.org.uk \
    --to=alan@chandlerfamily.org.uk \
    --cc=git@vger.kernel.org \
    --cc=kay.sievers@vrfy.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox