| 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($cvs2clpath) = "/home/sites/www.i-scream.org.uk/bin/cvs2cl.pl"; |
| 30 |
|
|
my($cvsroot) = "/cvs/i-scream"; |
| 31 |
|
|
my($cvs2clargs) = "--stdout -r -b -t -w -U $cvsroot/CVSROOT/users -l \"-d'\>$firstdate'\" -g \"-d$cvsroot\" -g \"-Q\""; |
| 32 |
tdb |
1.6 |
my($updatecmd) = "/home/sites/www.i-scream.org.uk/bin/fullcvsupdate.sh"; |
| 33 |
tdb |
1.5 |
my($logcmd) = "cd /home/sites/www.i-scream.org.uk/cvsscripttemp && $cvs2clpath $cvs2clargs"; |
| 34 |
tdb |
1.1 |
|
| 35 |
|
|
print <<"END"; |
| 36 |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 37 |
|
|
|
| 38 |
|
|
<html> |
| 39 |
|
|
|
| 40 |
|
|
<head> |
| 41 |
tdb |
1.7 |
<title>The i-scream Project Commit Log</title> |
| 42 |
tdb |
1.1 |
</head> |
| 43 |
|
|
|
| 44 |
tdb |
1.7 |
<body bgcolor="#ffffff" link="#ffffff" alink="#ffffff" vlink="#ffffff" text="#000066"> |
| 45 |
tdb |
1.1 |
|
| 46 |
|
|
<a href="http://www.i-scream.org.uk"><img border="0" src="../i-scream.gif"></a> |
| 47 |
|
|
|
| 48 |
tdb |
1.8 |
<h2>$heading</h2> |
| 49 |
tdb |
1.1 |
|
| 50 |
tdb |
1.5 |
END |
| 51 |
tdb |
1.1 |
|
| 52 |
tdb |
1.5 |
print `$updatecmd`; |
| 53 |
|
|
|
| 54 |
tdb |
1.9 |
my($modulelist)=$query->param('module'); |
| 55 |
|
|
$modulelist = `ls $cvsroot` unless defined $modulelist; |
| 56 |
|
|
|
| 57 |
tdb |
1.5 |
my(@modules) = split (/\s+/, $modulelist); |
| 58 |
|
|
|
| 59 |
|
|
foreach my $module (@modules) { |
| 60 |
|
|
|
| 61 |
tdb |
1.7 |
print "<table border=\"0\" bgcolor=\"#000066\" cellpadding=\"5\" width=\"100%\">"; |
| 62 |
|
|
print "<tr><td><font size=\"4\"><b><a href=\"/cgi-bin/cvs/viewcvs.cgi/$module\">$module module</a></b></font></td></tr>"; |
| 63 |
tdb |
1.8 |
print "<tr><td bgcolor=\"white\">\n"; |
| 64 |
tdb |
1.5 |
|
| 65 |
|
|
my(@lines) = `$logcmd $module 2>&1`; |
| 66 |
|
|
if(@lines == 0) { |
| 67 |
tdb |
1.8 |
print "There have been no commits in this module during this period.\n"; |
| 68 |
tdb |
1.5 |
} |
| 69 |
|
|
else { |
| 70 |
|
|
foreach my $line (@lines) { |
| 71 |
tdb |
1.7 |
|
| 72 |
|
|
if ($line =~ /^([0-9]{4}-[0-9]{2}-[0-9]{2}.*?)([^\s]+)$/) { |
| 73 |
|
|
print "<font color=\"blue\"><b>"; |
| 74 |
|
|
print HTML_encode($1); |
| 75 |
|
|
print "</b><i>"; |
| 76 |
|
|
print HTML_encode("by $2"); |
| 77 |
|
|
print "</i></font>" |
| 78 |
|
|
} |
| 79 |
|
|
else { |
| 80 |
|
|
chop $line; |
| 81 |
|
|
print "<code>"; |
| 82 |
|
|
print HTML_encode($line); |
| 83 |
|
|
print "</code><br>" |
| 84 |
|
|
} |
| 85 |
tdb |
1.5 |
} |
| 86 |
|
|
} |
| 87 |
tdb |
1.8 |
print "</td></tr>\n"; |
| 88 |
tdb |
1.1 |
|
| 89 |
tdb |
1.7 |
print "</table><p>\n\n"; |
| 90 |
tdb |
1.1 |
} |
| 91 |
|
|
|
| 92 |
|
|
print <<"END"; |
| 93 |
tdb |
1.7 |
|
| 94 |
tdb |
1.1 |
</body> |
| 95 |
|
|
|
| 96 |
|
|
</html> |
| 97 |
|
|
END |
| 98 |
|
|
|
| 99 |
|
|
exit 0; |
| 100 |
|
|
|
| 101 |
|
|
#------------------------------------------------------ |
| 102 |
|
|
# sub HTML_encode |
| 103 |
|
|
# |
| 104 |
|
|
# escape HTML characters that may cause problems when |
| 105 |
|
|
# shown either in the <body> or within text fields. |
| 106 |
|
|
#------------------------------------------------------ |
| 107 |
|
|
sub HTML_encode ($){ |
| 108 |
|
|
my ($encoded) = @_; |
| 109 |
|
|
$encoded =~ s/&/&/g; |
| 110 |
|
|
$encoded =~ s/"/"/g; |
| 111 |
|
|
$encoded =~ s/</</g; |
| 112 |
|
|
$encoded =~ s/>/>/g; |
| 113 |
|
|
return $encoded; |
| 114 |
|
|
} |