<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" omit-xml-declaration="yes" indent="yes" encoding="ISO-8859-1"/>

<xsl:variable name="persondb" select="document('../db/lfdb.persons.xml')"/>
<xsl:variable name="englishdb" select="document('../db/lfdb.en.xml')"/>
<xsl:variable name="localdb" select="document('../db/lfdb.nl.xml')"/>

<xsl:variable name="version" select="'0.7'"/>
<xsl:variable name="stylesheetname" select="'mainindex.xslt'"/>
<xsl:variable name="lfroot" select="''"/>

<xsl:include href="header.nl.xslt"/>

<xsl:template match="/">
<html>
  <head>
    <title>LinuxFocus - Nederlandse Mainindex</title>
    <LINK REL="StyleSheet" HREF="../common/style_article.css" TYPE="text/css" />
  </head>
<body bgcolor="#ffffff" text="#000000" alink="#336633" link="#336699">

<xsl:call-template name="header"/>

<H1>LinuxFocus-NL Mainindex</H1>
<P>Dit is een overzicht van alle LinuxFocus artikelen. Artikelen die al
vertaald zijn, hebben een witte achtergrond. Een grijze achtergrond
betekent 'nog niet vertaald' en een blauwe achtergrond
duidt erop dat de vertaler ermee bezig is (of zou moeten zijn :).</P>

<P>De op stapel staande veranderingen aan deze databank worden bijgehouden in de <a href="http://patat.org/LinuxFocus">LinuxFocus-NL wiki</a>. Controleer in het bijzonder de <a href="http://patat.org/LinuxFocus/ToDo">ToDo</a>.</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>

<xsl:variable name="assigned" select="count($englishdb/database/articles/article)"/>
<xsl:variable name="published" select="count($englishdb/database/articles/article[not(notpublished)])"/>
<xsl:variable name="issues" select="count($englishdb/database/issues/issue/published)"/>
<xsl:variable name="translated" select="count($localdb/database/articles/article/translation[@to='nl']/finished)"/>
<xsl:variable name="original" select="count($englishdb/database/articles/article[@xml:lang='nl'][not(./notpublished)])"/>
<xsl:variable name="proofread" select="count($localdb/database/articles/article/translation[@to='nl']/proofread/finished)"/>
<xsl:variable name="orig_proofread" select="count($localdb/database/articles/article/proofread/finished)"/>

Statistiekjes over de vertalers zijn te lezen in <A href="medewerkers.html">medewerkers.html</A>.<br />
Statistiekjes over de artikelen:

<table bgcolor="#FFFFFF" border="0" cellpadding="6" cellspacing="0" width="100%">
 <tr>
  <td align="left">
<UL>
 <b><xsl:value-of select="$assigned"/></b> artikelen (of titelpagina's) hebben een nummer toegewezen gekregen. <br />
 <b><xsl:value-of select="$published"/></b> daarvan zijn er al gepubliceerd in <b><xsl:value-of select="$issues"/></b> nummers.<br />
 <b><xsl:value-of select="$translated"/></b> artikelen hebben al een Nederlanse vertaling gekregen, terwijl <br />
 <b><xsl:value-of select="$original"/></b> artikelen geschreven zijn in het Nederlands.<br />
 <b><xsl:value-of select="$proofread"/></b> vertalingen en <b><xsl:value-of select="$orig_proofread"/></b> originelen zijn nagelezen.<br />
 <b><xsl:value-of select="count($localdb/database/articles/article/translation[@to='nl'][not(finished)])"/></b> nieuwe vertalingen zijn gereserveerd.
</UL>
  </td>
  <td align="center">
<b><font size="+2"><xsl:value-of select="format-number(($translated + $original) div $published,'#00.0%','')"/></font></b><br />vertaald<sup>(1)</sup>
  </td>
  <td align="center">
<b><font size="+2"><xsl:value-of select="format-number(($proofread + $orig_proofread) div ($translated + $original),'#00.0%','')"/></font></b><br />nagelezen<sup>(2)</sup>
  </td>
 </tr>
</table>

<table bgcolor="#FFFFFF" border="0" cellpadding="4" cellspacing="0" width="100%">
 <tr>
  <td align="center">(1)</td>
  <td align="left">: afgerond percentage van het aantal vertaalde artikelen tegenover het aantal <i>gepubliceerde</i>.</td>
 </tr>
 <tr>
  <td align="center">(2)</td>
  <td align="left">: afgerond percentage van het aantal nagelezen artikelen onder de in het Nederlands gepubliceerde.</td>
 </tr>
 <tr>
  <td align="center">(3)</td>
  <td align="left">: de vertaler is niet de vertaler, maar de auteur! Hij/zij heeft het artikel gewoon in het Nederlands geschreven.</td>
 </tr>
 <tr>
  <td align="center">(4)</td>
  <td align="left">: deze nalezing is nog niet afgewerkt.</td>
 </tr>
 <tr>
  <td align="center">(5)</td>
  <td align="left">: geen <A href="http://main.linuxfocus.org/~guido/dev/lfparser-2.27/Examples/article/newtemplate101.meta.html">.meta.html</A> versie beschikbaar.</td>
 </tr>
 <tr>
  <td align="center">(6)</td>
  <td align="left">: proeflezer gezocht voor deze vertaling!</td>
 </tr>
</table>

    <xsl:for-each select="database/issues/issue">
      <xsl:sort select="@code" data-type="number" order="ascending"/>
        <xsl:apply-templates select="."/>
    </xsl:for-each>

<xsl:call-template name="footer"/>
  </body>
</html>
</xsl:template>

<xsl:template match="issue">
  <xsl:param name="issueid"><xsl:value-of select="@id"/></xsl:param>

<table border="1" width="100%" bgcolor="#C2C2C2" bordercolor="#2E2292"><tr><td>

<table border="0" cellpadding="4" cellspacing="0" width="100%">
  <tr bgcolor="#2E2292">
    <td colspan="4" align="center"><b><font color="white"><xsl:value-of select="title"/></font></b></td>
  </tr>
  <tr bgcolor="#666666">
    <td align="center" width="14%"><font color="white">ID (taal)</font></td>
    <td><font color="white">titel</font></td>
    <td><font color="white">vertaler</font></td>
    <td><font color="white">nalezer</font></td>
  </tr>
  <xsl:for-each select="$englishdb/database/articles/article/issueref[@href=$issueid]">
    <xsl:sort select="@id" data-type="number" order="ascending"/>
    <xsl:variable name="id" select="@id"/>
    <xsl:apply-templates select="..">
        <xsl:with-param name="issueid" select="$issueid"/>
    </xsl:apply-templates>
  </xsl:for-each>
</table>
</td></tr></table><br />
</xsl:template>

<xsl:template match="article">
  <xsl:param name="issueid"/>
  <xsl:variable name="artid" select="@id"/>
  <xsl:variable name="article" select="$localdb/database/articles/article[@id=$artid]"/>
  <xsl:variable name="enarticle" select="$englishdb/database/articles/article[@id=$artid]"/>
  <xsl:variable name="authorid" select="$enarticle/personref/@href"/>
  <xsl:variable name="artlang" select="@xml:lang"/>
  <xsl:element name="tr">
    <xsl:choose>
      <xsl:when test="$article/translation/finished or $artlang='nl'">
        <xsl:attribute name="bgcolor">white</xsl:attribute>
      </xsl:when>
      <xsl:when test="$article/translation/reserved">
        <xsl:attribute name="bgcolor">#AAAAFF</xsl:attribute>
      </xsl:when>
    </xsl:choose>
    <td>
      <xsl:value-of select="$artid"/> (<xsl:value-of select="$artlang"/>)
    </td>
    <td>
      <xsl:choose>
        <!-- use this priority list: (modified by FLO : use <file> also in cat. 1 )

             1. Title pages -> a. try <file>
                               b. link to subdir/index.html directly
             2. Translation -> a. check <no[html|meta]>
                               b. try <file> first
                               c. use default
             3. 'Original'  -> a. try english original/translation first:
                                  I.   check <no[html|meta]>
                                  II.  try <file>
                               b. try 'real' original (if applicable)
                                  I.   check <no[html|meta]>
                                  II.  try <file>
                                  III. use default
          -->

        <!-- option 1 -->
        <xsl:when test="substring(@id,1,3)='cov'">
          <xsl:choose>
            <xsl:when test="not($enarticle/nohtml)">
              <xsl:choose>
                <xsl:when test="$article/file[@xml:lang='nl']">
                  <xsl:variable name="artfilename"><xsl:value-of select="$article/file[@xml:lang='nl']"/></xsl:variable>
                  <a href="../{$artfilename}"><xsl:value-of select="$article/title"/></a>
                </xsl:when>
                <xsl:otherwise>
                  <a href="../Nederlands/{$issueid}/index.shtml"><xsl:value-of select="$article/title"/></a>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$article/title"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:when>

        <!-- option 2 -->
        <xsl:when test="$article/translation/finished or $artlang='nl'">
          <xsl:choose>
            <xsl:when test="not($enarticle/nohtml)">
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:text>../</xsl:text>
                  <xsl:choose>
                    <xsl:when test="$article/file[@xml:lang='nl' and not(@type='meta')]">
                      <xsl:value-of select="$article/file[@xml:lang='nl' and not(@type='meta')]"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:text>Nederlands/</xsl:text>
                      <xsl:value-of select="$issueid"/>
                      <xsl:text>/</xsl:text>
                      <xsl:value-of select="$artid"/>
                      <xsl:text>.shtml</xsl:text>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:attribute>
                <xsl:value-of select="$article/title"/>
              </xsl:element>
            </xsl:when>
            <xsl:otherwise><xsl:value-of select="$article/title"/></xsl:otherwise>
          </xsl:choose>
          <xsl:choose>
            <xsl:when test="not($article/nometa)">
              (<xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:text>../</xsl:text>
                  <xsl:choose>
                    <xsl:when test="$article/file[@xml:lang='nl' and @type='meta']">
                      <xsl:value-of select="$article/file[@xml:lang='nl' and @type='meta']"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:text>Nederlands/</xsl:text>
                      <xsl:value-of select="$issueid"/>
                      <xsl:text>/</xsl:text>
                      <xsl:value-of select="$artid"/>
                      <xsl:text>.meta.shtml</xsl:text>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:attribute>
                <xsl:text>meta</xsl:text>
              </xsl:element>)
            </xsl:when>
            <xsl:otherwise><sup>(5)</sup></xsl:otherwise>
          </xsl:choose>
        </xsl:when>
        <!-- option 3 -->
        <xsl:otherwise>
          <xsl:choose>
            <xsl:when test="not(nohtml)">
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:text>../</xsl:text>
                  <xsl:choose>
                    <xsl:when test="file[@xml:lang='en' and not(@type='meta')]">
                      <xsl:value-of select="file[@xml:lang='en' and not(@type='meta')]"/>
                    </xsl:when>
                    <xsl:when test="file[@xml:lang=$artlang and not(@type='meta')]">
                      <xsl:value-of select="file[@xml:lang=$artlang and not(@type='meta')]"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:text>English/</xsl:text>
                      <xsl:value-of select="$issueid"/>
                      <xsl:text>/</xsl:text>
                      <xsl:value-of select="$artid"/>
                      <xsl:text>.shtml</xsl:text>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:attribute>
                <xsl:value-of select="title[@xml:lang='en']"/>
              </xsl:element>
            </xsl:when>
            <xsl:otherwise><xsl:value-of select="title"/></xsl:otherwise>
          </xsl:choose>
          <xsl:choose>
            <xsl:when test="not(nometa)">
              (<xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:text>../</xsl:text>
                  <xsl:choose>
                    <xsl:when test="file[@xml:lang='en' and @type='meta']">
                      <xsl:value-of select="file[@xml:lang='en' and @type='meta']"/>
                    </xsl:when>
                    <xsl:when test="file[@xml:lang=$artlang and @type='meta']">
                      <xsl:value-of select="file[@xml:lang=$artlang and @type='meta']"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:text>English/</xsl:text>
                      <xsl:value-of select="$issueid"/>
                      <xsl:text>/</xsl:text>
                      <xsl:value-of select="$artid"/>
                      <xsl:text>.meta.shtml</xsl:text>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:attribute>
                <xsl:text>meta</xsl:text>
              </xsl:element>)
            </xsl:when>
            <xsl:otherwise><sup>(5)</sup></xsl:otherwise>
          </xsl:choose>
        </xsl:otherwise>
      </xsl:choose>
    </td>
    <td>
    <xsl:choose>
      <xsl:when test="$article/translation/finished">
        <xsl:if test="$article/translation[@to='nl']/personref">
          <xsl:apply-templates select="$article/translation/personref"/>
        </xsl:if>
      </xsl:when>
      <xsl:when test="$article/translation/reserved">
        <xsl:apply-templates select="$article/translation/personref"/>
      </xsl:when>
      <xsl:when test="$artlang='nl'">
        <xsl:value-of select="$persondb/database/persons/person[@id=$authorid]/name" /><sup><xsl:text>(3)</xsl:text></sup>
      </xsl:when>
    </xsl:choose>
    </td>

    <!--
Test proofread info
  translation exists AND proofread info available => go on
    => print name of proofreader
    not finished? => print (4)
  original AND proofread info available ?
    => print name
    not finished => print (4)
    -->

    <xsl:element name="td">
     <xsl:attribute name="bgcolor">
      <xsl:choose>
       <!-- proofread is reserved but not yet finished -->
       <xsl:when test="$article/translation[@to='nl']/proofread/reserved and not($article/translation[@to='nl']/proofread/finished)">
        <xsl:text>#AAAAFF</xsl:text>
       </xsl:when>
       <!-- translation is available, but nobody reserved it for proofreading -->
       <xsl:when test="$article/translation[@to='nl']/finished and (not($article/translation[@to='nl']/proofread/reserved) and not($article/translation[@to='nl']/proofread/finished))">
        <xsl:text>red</xsl:text>
       </xsl:when>
       <!-- proofread is finished for original NL article -->
       <xsl:when test="$artlang='nl' and $article/proofread/finished">
        <xsl:text>white</xsl:text>
       </xsl:when>
       <!-- proofread is not yet reserved, but translation is not yet done -->
       <xsl:when test="not($article/translation[@to='nl']/finished) and not($article/translation[@to='nl']/proofread/reserved)">
        <xsl:text>#C2C2C2</xsl:text>
       </xsl:when>
       <!-- proofread is finished -->
       <xsl:when test="$article/translation/proofread/finished">
        <xsl:text>white</xsl:text>
       </xsl:when>
       <xsl:otherwise>
        <xsl:text>green</xsl:text>
       </xsl:otherwise>
      </xsl:choose>
     </xsl:attribute>
     <xsl:choose>
      <xsl:when test="$article/translation/proofread">
       <xsl:apply-templates select="$article/translation/proofread/personref"/>
      <xsl:if test="not($article/translation/proofread/finished)">
        <sup><xsl:text>(4)</xsl:text></sup>
       </xsl:if>
      </xsl:when>
      <xsl:when test="$artlang='nl' and $article/proofread">
       <xsl:apply-templates select="$article/proofread/personref"/>
       <xsl:if test="not($article/proofread/finished)">
        <sup><xsl:text>(4)</xsl:text></sup>
       </xsl:if>
      </xsl:when>
      <xsl:otherwise>
       <xsl:if test="$article/translation[@to='nl']/finished and not($article/translation[@to='nl']/proofread/reserved)">
        <sup><xsl:text> (6)</xsl:text></sup>
       </xsl:if>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:element>
  </xsl:element>
</xsl:template>

<xsl:template match="personref">
  <xsl:variable name="pers_id" select="@href"/>
  <xsl:variable name="nick" select="$localdb/database/persons/person[@id=$pers_id]/nickname"/>
  <xsl:choose>
    <xsl:when test="$nick">
      <xsl:value-of select="$nick"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$persondb/database/persons/person[@id=$pers_id]/name"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

</xsl:stylesheet>
