ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/web/cgi-bin/cvslog.cgi
Revision: 1.13
Committed: Wed Jun 13 17:44:03 2001 UTC (22 years, 11 months ago) by tdb
Branch: MAIN
Changes since 1.12: +18 -7 lines
Log Message:
Added the title and bottom in the correct fashion. This is inline with the i-scream
layout and style.

File Contents

# User Rev Content
1 tdb 1.5 #!/usr/bin/perl -w
2    
3     use CGI;
4     $query=new CGI;
5     my($period)=$query->param('period');
6     $period = "today" unless defined $period;
7    
8     my($firstdate);
9     if($period eq "days") {
10     my($days)=$query->param('days');
11     $days = 1 unless defined $days;
12     if ($days < 1) {$days = 1};
13     $heading = "i-scream CVS commits in the past $days day(s)";
14     $days--;
15     $firstdate = `date --date \"$days days ago\" \"+%Y/%m/%d\"`;
16     }
17     elsif($period eq "thisweek") {
18     $firstdate = "last Sunday";
19     $heading = "i-scream CVS commits this week";
20     }
21     else {
22     # default to "today only"
23     $firstdate = `/bin/date \"+%Y/%m/%d\"`;
24     $heading = "Today's i-scream CVS commits";
25     }
26 tdb 1.1
27 tdb 1.10 my($cvsroot) = "/cvs/i-scream";
28    
29     my($modulelist)=$query->param('module');
30     $modulelist = `ls $cvsroot` unless defined $modulelist;
31 tdb 1.1
32 tdb 1.5 my($cvs2clpath) = "/home/sites/www.i-scream.org.uk/bin/cvs2cl.pl";
33     my($cvs2clargs) = "--stdout -r -b -t -w -U $cvsroot/CVSROOT/users -l \"-d'\>$firstdate'\" -g \"-d$cvsroot\" -g \"-Q\"";
34 tdb 1.10 my($updatecmd) = "/home/sites/www.i-scream.org.uk/bin/fullcvsupdate.sh $modulelist";
35 tdb 1.5 my($logcmd) = "cd /home/sites/www.i-scream.org.uk/cvsscripttemp && $cvs2clpath $cvs2clargs";
36 tdb 1.13
37     my ($left) = "../left.inc" ;
38     my ($title) = "../title.inc";
39     my ($bottom) = "../bottom.inc";
40 tdb 1.1
41 tdb 1.10 print "Content-type: text/html\n\n";
42    
43 tdb 1.1 print <<"END";
44     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
45    
46     <html>
47    
48     <head>
49 tdb 1.7 <title>The i-scream Project Commit Log</title>
50 tdb 1.1 </head>
51    
52 tdb 1.7 <body bgcolor="#ffffff" link="#ffffff" alink="#ffffff" vlink="#ffffff" text="#000066">
53 tdb 1.1
54 tdb 1.12 <table border="0" cellpadding="2" cellspacing="2">
55     <tr>
56     <td valign="top">
57 tdb 1.13 END
58    
59     &print_html($left);
60 tdb 1.12
61     print <<"END";
62     </td>
63     <td valign="top">
64 tdb 1.13 END
65 tdb 1.12
66 tdb 1.13 &print_html($title);
67 tdb 1.12
68 tdb 1.13 print <<"END";
69 tdb 1.8 <h2>$heading</h2>
70 tdb 1.5 END
71 tdb 1.1
72 tdb 1.5 print `$updatecmd`;
73 tdb 1.9
74 tdb 1.5 my(@modules) = split (/\s+/, $modulelist);
75    
76     foreach my $module (@modules) {
77    
78 tdb 1.11 print "<table border=\"0\" bgcolor=\"#000066\" cellpadding=\"5\" width=\"100%\">\n\n";
79     print "<tr><td>\n<font size=\"4\"><b><a href=\"/cgi-bin/cvs/viewcvs.cgi/$module\">$module module</a></b></font>\n</td></tr>\n\n";
80 tdb 1.8 print "<tr><td bgcolor=\"white\">\n";
81 tdb 1.5
82     my(@lines) = `$logcmd $module 2>&1`;
83     if(@lines == 0) {
84 tdb 1.8 print "There have been no commits in this module during this period.\n";
85 tdb 1.5 }
86     else {
87     foreach my $line (@lines) {
88 tdb 1.7
89     if ($line =~ /^([0-9]{4}-[0-9]{2}-[0-9]{2}.*?)([^\s]+)$/) {
90 tdb 1.11 print "\n<font color=\"blue\"><b>";
91 tdb 1.7 print HTML_encode($1);
92     print "</b><i>";
93     print HTML_encode("by $2");
94 tdb 1.11 print "</i></font>\n"
95 tdb 1.7 }
96     else {
97     chop $line;
98     print "<code>";
99     print HTML_encode($line);
100 tdb 1.11 print "</code><br>\n"
101 tdb 1.7 }
102 tdb 1.5 }
103     }
104 tdb 1.8 print "</td></tr>\n";
105 tdb 1.1
106 tdb 1.7 print "</table><p>\n\n";
107 tdb 1.1 }
108    
109 tdb 1.13 &print_html($bottom);
110    
111 tdb 1.1 print <<"END";
112 tdb 1.12
113     </td>
114     </tr>
115     </table>
116 tdb 1.7
117 tdb 1.1 </body>
118    
119     </html>
120     END
121    
122     exit 0;
123    
124     #------------------------------------------------------
125     # sub HTML_encode
126     #
127     # escape HTML characters that may cause problems when
128     # shown either in the <body> or within text fields.
129     #------------------------------------------------------
130     sub HTML_encode ($){
131     my ($encoded) = @_;
132     $encoded =~ s/&/&amp;/g;
133     $encoded =~ s/"/&quot;/g;
134     $encoded =~ s/</&lt;/g;
135     $encoded =~ s/>/&gt;/g;
136     return $encoded;
137 tdb 1.13 }
138    
139     # Print a file without escaping HTML: -
140     sub print_html ($) {
141     my ($filename) = @_;
142     print `cat $filename 2>&1`;
143 tdb 1.1 }