script and template for generating the LDP Weekly News

This commit is contained in:
david 2001-09-01 17:58:23 +00:00
parent 5127f98b67
commit 5ad2b43334
2 changed files with 176 additions and 0 deletions

View File

@ -0,0 +1,97 @@
#!/usr/bin/perl
use CGI qw(:standard);
use Pg;
$baseurl = "http://www.linuxdoc.org";
$basesql = "SELECT doc_id, title, class, url, version, format FROM document ";
$dbmain='ldp';
@row;
$pubdate1 = $ARGV[0];
$pubdate2 = $ARGV[1];
$conn=Pg::connectdb("dbname=$dbmain");
#Determine the tuples to load
$sql = $basesql . "WHERE pub_status = 'N' AND pub_date >= '$pubdate1' AND pub_date <= '$pubdate2' ORDER BY title";
# Connect and load the tuples
$result=$conn->exec($sql);
die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus;
print h2('New Documents');
printf "\n\n";
printf "<ul>\n";
while (@row = $result->fetchrow) {
read_document(@row);
print_document();
}
printf "</ul>\n\n";
print h2('Updated Documents');
printf "\n\n";
printf "<ul>\n";
$sql = $basesql . "WHERE pub_status = 'N' AND pub_date < '$pubdate1' AND last_update >= '$pubdate1' AND last_update <= '$pubdate2' ORDER BY title";
$result=$conn->exec($sql);
die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus;
while (@row = $result->fetchrow) {
read_document (@row);
print_document();
}
printf "</ul>\n\n";
sub read_document (@row) {
$doc_id = $row[0];
$title = $row[1];
$class = $row[2];
$class =~ s/\s*$//;
$refurl = $row[3];
$version = $row[4];
$version =~ s/\s*$//;
$format = $row[5];
$format =~ s/\s*$//;
$url = $refurl;
}
sub print_document() {
print "<p><li><b>";
print $title;
printf "</b><br>\n";
print a({href=>$url},$url);
print br;
printf "\n";
print "Version " . $version;
$sql = "SELECT maintainer_name, document_maintainer.email FROM document_maintainer, maintainer where document_maintainer.doc_id = " . $doc_id . " AND document_maintainer.maintainer_id = maintainer.maintainer_id AND active AND role = 'Author' ORDER BY maintainer_name";
$author_result=$conn->exec($sql);
die $conn->errorMessage unless PGRES_TUPLES_OK eq $author_result->resultStatus;
while (@author_row = $author_result->fetchrow) {
read_author ();
print_author();
}
printf "\n\n";
}
sub read_author() {
$author = $author_row[0];
$email = $author_row[1];
}
sub print_author() {
print ", " . $author;
if (not ($email eq "")) {
print ", ";
print a({href=>"mailto:" . $email}, $email);
}
}

View File

@ -0,0 +1,79 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>The Linux Documentation Project: Weekly News for 2001-03-06</TITLE>
<META NAME="description" CONTENT="Linux Documentation Project: LDP Weekly News">
</HEAD>
<BODY BGCOLOR="#F9F9F9" BACKGROUND="../images/bg.jpg" LEFTMARGIN=0 TOPMARGIN=0>
<DIV align=center>
<TABLE WIDTH="100%" BORDER="0" HEIGHT="8" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD COLSPAN="9" ALIGN="center" VALIGN="top"><A HREF="../index.html"><IMG SRC="../images/crdempsey2.jpg" WIDTH="300" HEIGHT="100" ALIGN="absmiddle" BORDER="0" ALT="The Linux Documentation Project"></A>
</TR>
<TR BGCOLOR="#2B63A2">
<TD ALIGN="center">&nbsp;|&nbsp;</TD>
<TD HEIGHT="2" ALIGN="center" VALIGN="top"><FONT COLOR="#2B63A2"><B><A HREF="../docs.html#howto"><IMG SRC="../images/howtos.jpg" WIDTH="60" HEIGHT="18" BORDER="0" ALT="HOWTOS"></A></B></FONT></TD>
<TD ALIGN="center">&nbsp;|&nbsp;</TD>
<TD HEIGHT="2" ALIGN="center" VALIGN="top"><FONT COLOR="#2B63A2"><B><A HREF="../guides.html"><IMG SRC="../images/guides.jpg" WIDTH="60" HEIGHT="18" BORDER="0" ALT="Guides"></A></B></FONT></TD>
<TD ALIGN="center">&nbsp;|&nbsp;</TD>
<TD HEIGHT="2" ALIGN="center" VALIGN="top"><FONT COLOR="#2B63A2"><A HREF="../docs.html#man"><IMG SRC="../images/manpages.jpg" WIDTH="80" HEIGHT="18" BORDER="0" ALT="Man Pages"></A></FONT></TD>
<TD ALIGN="center">&nbsp;|&nbsp;</TD>
<TD HEIGHT="2" ALIGN="center" VALIGN="top"><FONT COLOR="#2B63A2"><A HREF="../docs.html#lg"><IMG SRC="../images/lgazette.jpg" WIDTH="103" HEIGHT="18" BORDER="0" ALT="Linux Gazette"></A></FONT></TD>
<TD ALIGN="center">&nbsp;|&nbsp;</TD>
</TR>
<TR BGCOLOR="#CC9933"><TD COLSPAN="9">&nbsp;</TD></TR>
<TR BGCOLOR="#CC9933">
<TD COLSPAN="9" ALIGN="center" VALIGN="top">
<H1><FONT FACE="Arial, Helvetica, sans-serif">
LDP Weekly News<br>
2001-03-06
</FONT></H1>
</TD>
</TR>
</TABLE>
</DIV>
<P>
<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="10" WIDTH="100%">
<tr align="left" valign="top" bgcolor="#ffffff">
<td>
<h2>About the LDP</h2>
<p>The Linux Documentation Project is developing free, high quality documentation
for the GNU/Linux operating system. This includes the creation of HOWTOs and Guides,
and collaboration with other documentation groups.
<p>If you've always wanted to help Linux reach
Total World Domination(tm), but you're not a programmer,
there's still something you can do. Help the LDP!
<p>The LDP keeps a page of resources for authors at
<a href="http://www.linuxdoc.org/authors/">http://www.linuxdoc.org/authors/</a>.
Contributions are always welcome.
<p>For more LDP Weekly News, go to
<a href="http://www.linuxdoc.org/ldpwn/">http://www.linuxdoc.org/ldpwn/</a>
<h2>New Documents</h2>
<ul>
</ul>
<h2>Updated Documents</h2>
<ul>
</ul>
</td>
</tr>
</TABLE>
</body></html>