#!/usr/bin/perl -w
use strict;
use diagnostics;
use LinuxFocus::SDB;

my $VERSION = "0.4";

my $db = LinuxFocus::SDB->new();
$db->load("../../data/lfdb.nl.xml");
$db->load("../../data/lfdb.en.xml");
$db->load("../../data/lfdb.persons.xml");
$db->setLang("nl");
my $to = "nl";

my $arts = 0;
my $translatedarts = 0;

print << "EOF";
<HTML>
<HEAD>
<TITLE>LinuxFocus - NL: Status Vertaalslag</TITLE>
</HEAD>
<BODY bgcolor="#ffffff" text="#000000" alink="#336633" link="#336699">

<!-- MAP voor bovenste navigatiebalk -->  
<MAP name="top">  
<AREA shape="rect" coords="367,9,418,30" alt="Home" href="index.html">  
<AREA shape="rect" coords="423,9,457,30" alt="Map" href="map.html">  
<AREA shape="rect" coords="463,9,508,30" alt="Index" href="indice.html">  
<AREA shape="rect" coords="514,9,558,30" alt="Zoek" href="Search/index.html"> 
</MAP>  
  
<!-- MAP voor onderste navigatiebalk -->  
<MAP name="bottom">  
<AREA shape="rect" coords="78,0,163,15"  alt="Nieuws" href="News/index.html">  
<AREA shape="rect" coords="189,0,284,15" alt="Archieven" href="Archives/index.html">  
<AREA shape="rect" coords="319,0,395,15" alt="Links" href="Links/index.html">  
<AREA shape="rect" coords="436,0,523,15" alt="Over LinuxFocus" href="aboutus.html">  
</MAP>  
  
<!-- NAVIGATIEBALK -->  
<CENTER>  
<IMG src="../common/images/Topbar-nl.gif" width="600" height="40" border="0"  ismap usemap="#top" ><BR>  
<IMG src="../common/images/Bottombar-nl.gif" width="600" height="21" border="0"  ismap usemap="#bottom"><BR>  
</CENTER>

<H1>LinuxFocus Overzicht</H1>
<p>Dit is een overzicht van alle LinuxFocus artikels. Artikels die al
vertaald zijn, hebben een witte achtergrond. Een grijze achtergrond
betekent 'nog niet vertaald' en artikels met een blauwe achtergrond
zijn reeds gereserveerd voor vertaling, maar nog niet afgewerkt. Artikelen 
die een *M* voor hun naam hebben staan, zijn nog niet omgezet naar het 
.meta.html formaat.</P>

<P><B>U kan <FONT COLOR=#BB1100>LinuxFocus</FONT> helpen!</B>
Als je een artikel ziet dat nog niet vertaald is en
je graag zelf zou vertalen, reserveer het dan voor u door een e-mail te
sturen naar de Nederlandse mailing list op 
<A href="mailto:dutch\@linuxfocus.org">dutch\@linuxfocus.org</A>.
</P>

<H1>LinuxFocus translators page</H1>
<p>This is an index of all LinuxFocus articles. Already translated
articles are shown with white background. Articles that are grayed 
are not translated yet and articles with blue background are reserved
for translation but not yet ready.</P>
<P><B>You can help <FONT COLOR=#BB1100>LinuxFocus</FONT>!</B> 
If you see an article that is not yet 
translated and you would like to translate it then reserve it for
you by sending an e-mail to the person mentioned as maintainer
at the end of this page.</P>
EOF

foreach my $month ($db->getMonthIDs(sort => "desc")) {
    if ($month =~ /2English/) {
        $db->setLang("en");
        $to = "en";
    } else {
        $db->setLang("nl");
        $to = "nl";
    } 
    my $monthname = $db->getMonthName($month, "nl");

    print << "EOF";
<TABLE CELLSPACING=0 CELLPADDING=2 BORDER=2 WIDTH=100% BGCOLOR=#000000>
<TR>
<TD>
<TABLE CELLSPACING=0 CELLPADDING=3 BORDER=0 WIDTH=100% BGCOLOR=#FFFFFF>
<TR>
<!-- FIRST COLUMN -->
    <TD BGCOLOR=#000000>
    <FONT COLOR=#FFFFFF SIZE=+2>
    &nbsp;
    </FONT>
    </TD>
    <TD BGCOLOR=#000000>
    <FONT COLOR=#FFFFFF SIZE=+2>$monthname</FONT>
    </TD>
    <TD BGCOLOR=#000000>
    <FONT COLOR=#FFFFFF SIZE=+2>
    Vertaald door
    </FONT>
    </TD>

    <TD BGCOLOR=#000000>
    <FONT COLOR=#FFFFFF SIZE=+2>
    Gecontroleerd
    </FONT>
    </TD>

</TR>
<!-- TABLE BODY -->
EOF
    foreach my $id ($db->getArticleIDs(month => $month, sort => "desc",
                                       coverpages => "yes")) {
        $arts++;
        $db->selectArticle($id);
        my $emurl = $db->getArticleRL("en", meta => "meta");
        my $url = $db->getArticleRL("en");
        my $murl = $db->getArticleRL("nl", meta => "meta");
        my $title = $db->getArticleTitle();
        my $color = "#C2C2C2";
        my $translator = "&nbsp;";
        my $proofread = "&nbsp;";
        if ($db->getArticleTranslationDate(to => $to ) ne "") {
            $translatedarts++;
            $color = "#FFFFFF";
            $translator = "<a href=\"mailto:" . 
                          $db->getArticleTranslationPersonEmail(to => $to ) .
                          "\">" .
                          $db->getArticleTranslationPerson(to => $to ) .
			  "</a>";
            $title = "<a href=\"../" . $db->getArticleRL("nl") .
 		     "\">" . $title . "</a>";
        } elsif ($db->getArticleTranslationReservationDate(to => $to ) ne "") {
            $color = "#AAAAFF";
            $translator = "<a href=\"mailto:" . 
                          $db->getArticleTranslationPersonEmail(to => $to) .
                          "\">" .
                          $db->getArticleTranslationPerson(to => $to) . 
			  "</a>";
	}
        if ($db->getArticleTranslationProofreadDate(to => $to) ne "") {
            $proofread = "<a href=\"mailto:" . 
                          $db->getArticleTranslationProofreadPersonEmail(to => $to) .
                          "\">" .
                          $db->getArticleTranslationProofreadPerson(to => $to) . 
			  "</a>";
	}
        print << "EOF";
<TR>
  <TD BGCOLOR="$color"><A HREF="../$url">$id</A> (<A HREF="../$emurl">meta</A>)</TD>
  <TD BGCOLOR="$color">$title (<A HREF="../$murl">meta</A>)</TD>
  <TD BGCOLOR="$color">$translator</TD>
  <TD BGCOLOR="$color">$proofread</TD>
</TR>
EOF
    }
    print << "EOF";
<!-- END TABLE BODY -->
</TABLE>
</TD>
</TR>
</TABLE>
<br>
EOF
}

my $percentage = int (($translatedarts / $arts)*100);
print << "EOF";
<!-- ========================== -->

<HR width="100%" size=4 NOSHADE>
<P>Deze pagina is gemaakt met <B><FONT COLOR="#008000">genmainindex, version $VERSION</FONT></B>.
<P>Deze pagina wordt onderhouden door: <A href="mailto:dutch\@linuxocus.org?subject=lfmainindex">het Nederlandse LinuxFocus team</A></P>
<P>$translatedarts artikelen van de $arts =  $percentage % vertaald</P>
<BR clear=all>
<!-- start of footer -->
<hr WIDTH="85%" noshade size="1">
 <CENTER> 
<table WIDTH="85%" >
 <TR bgcolor="#666666">
   <TD align="center">
   <FONT color="#FFFFFF">
    <B>&copy; 2000 LinuxFocus</B><BR>
    </FONT>
    <A href="../common/lfteam.html"><FONT color="#FFFFFF">Ga naar de LinuxFocus Contact Personen Pagina</FONT></A>
   </TD>
 </TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
EOF


