#!/usr/bin/perl
# temas.cgi
# Octavio Martinez de la Vega
# Presenta temas de las presentaciones libres y da las ligas a esos archivos.

use CGI qw(:standard);
use DBI;

print "Content-Type: text/html\n\n";
print '<meta http-equiv=Content-Type content="text/html; charset=macintosh">';
print "\n<head>\n","<title>&Iacute;ndice Tem&aacute;tico</title>\n","</head>\n","<body>\n";
print '<IMG SRC="GUIRNALDAREDBIO2010.gif" WIDTH=150 HEIGHT=150 ALIGN=RIGHT>',"\n";
print h2("REDBIO M&eacute;xico 2010<br>&Iacute;ndice Tem&aacute;tico de Presentaciones Libres<hr>");

if (param()) { # Ya se tienen datos
 my $tema = param("tema"); # AQUI VOY
# Necesito entrar a la base de datos y poner TODOS los folios que 
# correspondan al tema con sus respectivos titulos y ligas para
# acceder al resumen
$dbh = DBI->connect ("DBI:mysql:host=localhost;database=redbio","omartine", "password",
 {PrintError => 1, RaiseError => 1});
print h2("Tema: $tema");
print h3("(puede ver el resumen del trabajo haciendo \'click\' con el rat&oacute;n en la liga del t&iacute;tulo)<hr>");
$orden = "select titulo, folio, tipo_a from trabajos where tema like \'$tema%\'  and aceptado='1' order by tipo_a desc, titulo;";
$sth = $dbh->prepare ($orden); $sth->execute ();
while ( @row = $sth->fetchrow_array ) {
           print "<a href=$row[1].html>$row[0]</a> ($row[2]) Folio: $row[1]:<hr>\n";
         }

print h2("<a href=_indice.html>Regresar al Indice</a>");

} else {
 print start_form();
 print p("Tema: ", popup_menu('tema',[
'Alimentos Funcionales y Biofortificaci—n',
'Biocombustibles',
'Biodiversidad',
'Bionegocios',
'Bioseguridad',
'Biotecnolog’a Acu’cola',
'Biotecnolog’a Forestal',
'Biotecnolog’a Pecuaria',
'Control Biol—gico',
'Educaci—n en Biotecnolog’a',
'EstrŽs Abi—tico',
'EstrŽs Bi—tico',
'Gen—mica',
'Marcadores Moleculares',
'Mejoramiento GenŽtico Animal',
'Mejoramiento GenŽtico Vegetal',
'Metabol—mica',
'Micropropagaci—n y Cultivo De Tejidos',
'Otro',
'Propiedad Intelectual y Patentes',
'Transcript—mica',
'Transformaci—n GenŽtica de Plantas',
]), "<br>");

 print p(submit("ENVIAR"), reset("BORRAR"));
 print end_form(), hr();
 print h2("<a href=_indice.html>Regresar al Indice</a>");

}
print end_html;
