ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/web/cgi-bin/cvslog.cgi
Revision: 1.5
Committed: Tue Jun 5 16:19:00 2001 UTC (23 years, 5 months ago) by tdb
Branch: MAIN
Changes since 1.4: +57 -24 lines
Log Message:
Now been "updated" to support some more funky features :)

Firstly the output is grouped by module, making it clearer to see what commits
belong where.
Secondly, query strings allow you to specify the period, rather than just the
current day that the old one did. This are:

Current Day: period=today
Current Week: period=thisweek
Last n Days: period=days&days=n

There are also subtle location changes to suit the location on the new webserver
rather than raptor.

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     print "Content-type: text/html\n\n";
28    
29 tdb 1.5 my($cvs) = "/usr/bin/cvs";
30     my($cvs2clpath) = "/home/sites/www.i-scream.org.uk/bin/cvs2cl.pl";
31     my($cvsroot) = "/cvs/i-scream";
32     #my($cvs2clargs) = "--stdout -r -b -t -w -U $cvsroot/CVSROOT/users -l \"-d'\>$today'\" -g \"-d$cvsroot\" -g \"-Q\"";
33     my($cvs2clargs) = "--stdout -r -b -t -w -U $cvsroot/CVSROOT/users -l \"-d'\>$firstdate'\" -g \"-d$cvsroot\" -g \"-Q\"";
34     my($updatecmd) = "cd /home/sites/www.i-scream.org.uk/cvsscripttemp && $cvs -d $cvsroot -Q update -d";
35     my($logcmd) = "cd /home/sites/www.i-scream.org.uk/cvsscripttemp && $cvs2clpath $cvs2clargs";
36 tdb 1.1
37     print <<"END";
38     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
39    
40     <html>
41    
42     <head>
43 tdb 1.2 <title>The i-scream Project Daily Commit Log</title>
44 tdb 1.1 </head>
45    
46 tdb 1.5 <body bgcolor="#ffffff" link="#0000ff" alink="#3333cc" vlink="#3333cc" text="#000066">
47 tdb 1.1
48     <a href="http://www.i-scream.org.uk"><img border="0" src="../i-scream.gif"></a>
49    
50 tdb 1.5 <h2>$heading</h2>
51 tdb 1.1
52 tdb 1.5 END
53 tdb 1.1
54 tdb 1.5 print `$updatecmd`;
55    
56     my $modulelist = `ls $cvsroot`;
57     my(@modules) = split (/\s+/, $modulelist);
58    
59     foreach my $module (@modules) {
60    
61     print "<p><h3>$module module</h3>\n";
62     print "<a href=\"/cgi-bin/cvs/viewcvs.cgi/$module\">";
63     print "Browse i-scream &quot;$module&quot; cvs module</a>\n";
64     print "<pre>\n";
65    
66     my(@lines) = `$logcmd $module 2>&1`;
67     if(@lines == 0) {
68     print "There have been no commits in this module during this period.";
69     }
70     else {
71     foreach my $line (@lines) {
72     print HTML_encode($line);
73     }
74     }
75 tdb 1.1
76 tdb 1.5 print "</pre></p>\n\n";
77 tdb 1.1 }
78    
79     print <<"END";
80     </body>
81    
82     </html>
83     END
84    
85     exit 0;
86    
87     #------------------------------------------------------
88     # sub HTML_encode
89     #
90     # escape HTML characters that may cause problems when
91     # shown either in the <body> or within text fields.
92     #------------------------------------------------------
93     sub HTML_encode ($){
94     my ($encoded) = @_;
95     $encoded =~ s/&/&amp;/g;
96     $encoded =~ s/"/&quot;/g;
97     $encoded =~ s/</&lt;/g;
98     $encoded =~ s/>/&gt;/g;
99     return $encoded;
100     }