#!/usr/bin/perl

###########################################################################
#
#
# Auteur: Guy Tremblay
# Creation: Automne 1998
#
###########################################################################

#----------------------------------------------------------------------

# Variable globale a utiliser comme prefixe pour acceder a ma BD.

#$machine = "arabica";
$machine = "saturne";

$home = $machine eq "arabica" ? "home" : "home2";

$prefixeBD = "/$home/tremblay_gu/public_html/INF4110/presentations";

#----------------------------------------------------------------------

require "/$home/tremblay_gu/public_html/cgi-bin/cgi-lib.pl";
require "/$home/tremblay_gu/public_html/INF4110/presentations/obtenirLignes.pl";
require "/$home/tremblay_gu/public_html/INF4110/presentations/supprimerLigne.pl";
require "/$home/tremblay_gu/public_html/INF4110/presentations/supprimerSujet.pl";

goto MAIN;

exit;


MAIN:
{

    &ShowForm;
}

###############################################
#Sous-routine qui affiche le formulaire
###############################################
sub ShowForm
{
    print &PrintHeader;
    print &HtmlTop("Liste des sujets d&eacute;j&agrave; choisis.");
    print <<EOTF;
<P>
<P>
<UL>
EOTF
    &afficherSujetsChoisis;
    print <<EOTAD;
</UL>
<P><HR><P><P><P>
<B> R&eacute;alisation</B>: Ce script a &eacute;t&eacute; d&eacute;velopp&eacute; par <A HREF="http://www.labunix.uqam.ca/~tremblay"> Guy Tremblay</A>, professeur au d&eacute;partement d'informatique de l'UQAM.
EOTAD
    print "<P><P>\n";
    print &HtmlBot;
}


sub afficherSujetsChoisis
{
    local($numLigne);
    $nomFich = "$prefixeBD/sujets-choisis";
    local($nbLignes);
    local(*sujets);
    if( ($nbLignes = &obtenirLignes($nomFich, *sujets)) < 0 ) {
	CgiDie("Erreur lecture des sujets choisis",
	       "Le fichier $nomFich ne semble pas exister.");
	return;
    }
    $numLigne = 1;
    while ($numLigne <= $nbLignes) {
	$nomComplet = $sujets{$numLigne};
	local($leSujet, $leNom, $leCp, $laDate) = split( "\t", $nomComplet );
	print "<LI>$laDate: $leSujet ($leNom)\n";
	$numLigne += 1;
    }
print <<EOTF;
</SELECT>
EOTF
}
