

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Description" content="CECONEA - UNNE" />
<title>HPC-CECONEA</title>
<style media="all" type="text/css">
@import url("./css/estiloP.css");
@import url("./css/fuentes.css");
@import url("./css/menu.css");
</style>

<script language="JavaScript"> 
    function habilita(){ 
    document.form1.Otro.disabled = false; 
    document.form1.Otro.value = "¿Cuál?";
    document.form1.Otro.style.visibility = 'visible';
   } 
 
   function deshabilita(){ 
    document.form1.Otro.disabled = true; 
    document.form1.Otro.value = "¿Cuál?";
    document.form1.Otro.style.visibility = 'hidden';
   }
</script>

<script type="text/javascript">
function habilita(){
    document.form1.Otro.disabled = false; 
    document.form1.Otro.value = "¿Cuál?";
    document.form1.Otro.style.visibility = 'visible';
}

function activarcasilla(check){
if(document.form1.check.checked==true){
document.form1.submit.style.visibility="visible";
}else{
document.form1.submit.style.visibility="hidden";
}
}

</script>

<script type="text/javascript">
function show_alert(variable)
{
alert(variable);
}
</script>


</head>

<body bgcolor="#5C6350" onload="javascript:selectcero()">

<?php
if($_POST["varx"] == 1){

$camposfaltantes = array();

$institucion = $_POST["Institucion"];
$nombre = $_POST["Nombre"];
$apellido = $_POST["Apellido"];
$email = $_POST["Email"];
$grupo = $_POST["Grupo"];
$investigacion = $_POST["investigacion"];
$software_requeridos = $_POST["Softwares_requeridos"];
$cores = $_POST["cores"];
$horas = $_POST["horas"];

if($institucion == NULL){
   $camposfaltantes[] = $institucion;
}
if($institucion == "Otro"){
   $otro = $_POST["otro"];
   if($otro == NULL){
      $camposfaltantes[] = $otro;
   }
}
if(empty($nombre)){
   $camposfaltantes[] = "Nombre";
}
if($apellido == NULL){
   $camposfaltantes[] = "Apellido";
}
if($email == NULL){
   $camposfaltantes[] = "Email";
}
if($grupo == NULL){
   $camposfaltantes[] = "Grupo";
}
if($investigacion == NULL){
   $camposfaltantes[] = "Proyecto de Investigración";
}
if($software_requeridos == NULL){
   $camposfaltantes[] = "Softwares requeridos";
}
if($cores == NULL){
   $camposfaltantes[] = "Cores";
}
if($horas == NULL){
   $camposfaltantes[] = "Horas";
}
if(empty($camposfaltantes)){

$dbh = mysql_connect("localhost", "root", "dev0r4k") or die(mysql_error());
$db = mysql_select_db("bd_gica", $dbh);

$insertar = 'INSERT INTO  registros(Institucion,otro,Nombre,Apellido,Email,Grupo,investigacion,Softwares_requeridos,cores,horas) VALUES ("'.$institucion.'","'.$otro.'","'.$nombre.'","'.$apellido.'","'.$email.'","'.$grupo.'","'.$investigacion.'","'.$software_requeridos.'","'.$cores.'","'.$horas.'")';

$resultado_op = mysql_query($insertar, $dbh) or die(mysql_error());

if ($resultado_op){
        echo "<script>alert('Su solicitud se ha enviado correctamente.')</script>";
$_POST["Institucion"] = "";
$_POST["Nombre"] = "";
$_POST["Apellido"] = "";
$_POST["Email"] = "";
$_POST["Grupo"] = "";
$_POST["investigacion"] = "";
$_POST["Softwares_requeridos"] = "";
$_POST["cores"] = "";
$_POST["horas"] = "";
$_POST["otro"] = "";
}
else{
        echo "<script>alert('Error, intente nuevamente')</script>";
}
}
else{
$sizearreglo= sizeof($camposfaltantes);
   for($i=0; $i< $sizearreglo; $i++){
     if($i!=0 & $i!=1){
	if($i == (($sizearreglo)-1)){
	   $imprimir = $imprimir." y ".$camposfaltantes[$i].".";
	}
	else{
	   $imprimir = $imprimir.", ".$camposfaltantes[$i];
	}
     }
     else{
        $imprimir = $imprimir.$camposfaltantes[$i];
     }
   }


if($sizearreglo==1){
   $imprimir = "Falta el campo ".$imprimir;
}
else{
   $imprimir = "Faltan los campos ".$imprimir;
}

echo "<script>alert('".$imprimir."')</script>";

}

}
?>



<table id="tabla" align="center" cellspacing="0" cellpadding="0"  >
  <tr>
    <td>
       <?php
	 include "titulo.php";
      ?>     
    </td>
  </tr>
  <tr>
    <td valign="bottom">
      <?php
	 include "menu.php";
      ?>
    </td>
  <tr>
    <td padding="10px" margin="3px" bgcolor="#FFFFFF" valign="top">
      
      <table width="652px" height="320px" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
	<tr>
	  <td style="vertical-align: top;">
	    
	    <table style="margin: 10px 0px 10px 36px;">
	      <tr>
		<td style="color: #4E4E4E; font-size:16pt;">
		  <br>
		  <b>
		  <br>
		  <div align="center"><u>Solicitud de Utilización del Clúster</u></div>
		  <br>
		  </b>
		</td>
	      </tr>
	      <tr>
		<td style="color: #4E4E4E; font-size:12pt;">
		  <b>
		  Para hacer uso de los servidores primero deberá registrarse completando esta solicitud.
		  <br>
		  <br>
		  </b>
		</td>
	      </tr>
	    </table>

	    <form name="form1" action="solicitud.php" method="post" >
	      <div align="center">
		<table style="margin:1px 2px 3px 4px; text-align: left;  height: 24px; width:580px; font-size:12pt;" border="0" cellpadding="2" cellspacing="2" align="center">
		  <tbody>
		    <tr>
		      <td   nowrap style="color: #4E4E4E "> 
			<strong>
			  Datos del Solicitante
			</strong>
			
			<table  border="0" cellpadding="2" cellspacing="2" style="width:580px; color: #4E4E4E; background-color:#e4e4e4; font-size:14px" >
			  <tbody>
		    	    <tr>
			      <td nowrap style="color: #4E4E4E; vertical-align:top; width:275px;">
				Institución 
			      </td>
			      <td nowrap style="color: #4E4E4E ">
				
				
				<?php
				   $array = array("FaCENA - Física","FaCENA - Informática","FaCENA - Ingeniería","FaCENA - Química","Ingeniería","IMIT","IBONE","CECOAL");
				   echo '<select name="Institucion" style="width:227px;">';
					    echo '<option value="'.$_POST['Institucion'].'" onclick="deshabilita()">'.$_POST["Institucion"].'</option>';

				   for($i=0; $i < sizeof($array); $i++){
   					  if($array[$i] <> $_POST['Institucion']){
					    echo '<option value="'.$array[$i].'" onclick="deshabilita()">'.$array[$i].'</option>';
					  }
				   }
					  if("Otro" <> $_POST['Institucion']){
					    echo '<option value="Otro" onclick="habilita()">Otro</option>';
				          }

				  echo '</select>';
				?>

				<br>
				  
				<input type="text" onclick="this.value='';" onblur="this.value=(this.value=='')?'¿Cuál?':this.value;"  style="visibility:hidden" name='Otro' size="30" value="¿Cuál?">
				    
			      </td>
			    </tr>
			    <tr>
			      <td   nowrap style="color: #4E4E4E ">
				Nombre 
			      </td>
			      <td   nowrap style="color: #4E4E4E ">
				<input type="text" maxlength="60" size="30" name="Nombre" value= <?php echo '"'.$_POST['Nombre'].'"'; ?>>
			      </td>
			    </tr>
			    <tr>
			      <td   nowrap style="color: #4E4E4E ">
				Apellido 
			      </td>
			      <td   nowrap style="color: #4E4E4E ">
				<input maxlength="60" size="30" name="Apellido" value=<?php echo '"'.$_POST['Apellido'].'"'; ?>>
			      </td>
			    </tr>
			    <tr>
			      <td   nowrap style="color: #4E4E4E ">
				Correo electr&oacute;nico
			      </td>
			      <td   nowrap style="color: #4E4E4E ">
				<input maxlength="60" size="30" name="Email" value=<?php echo '"'.$_POST['Email'].'"'; ?>>
			      </td>
			    </tr>
			    <tr>
			      <td   nowrap style="color: #4E4E4E ">
				Grupo de investigación al que pertenece 
			      </td>
			      <td   nowrap style="color: #4E4E4E ">
				<input maxlength="60" size="30" name="Grupo" value=<?php echo '"'.$_POST['Grupo'].'"'; ?>>
			      </td>
			    </tr>
			    <tr>
			      <td   nowrap style="color: #4E4E4E; vertical-align:top;">
				Breve descripcion de su proyecto de
				<br>
				investigación 
				<i>
				  (máx 500 caracteres)
				</i>
			      </td>
			      <td   nowrap style="color: #4E4E4E ">
				<textarea cols="29" rows="3" name="investigacion"><?php echo $_POST['investigacion']; ?></textarea>
			      </td>
			    </tr>
			</table>
			<br>
		 
			<table  border="0" cellpadding="2" cellspacing="2" style="width:580px; color: #4E4E4E; background-color:#e4e4e4; font-size:14px" >
			  <strong>Detalles del uso pretendido</strong>
			  <tr>
			    <td   nowrap style="color: #4E4E4E; vertical-align:top;width:275px;">
			      Softwares del Cluster a utilizar 
			    </td>
			    <td   nowrap style="color: #4E4E4E ">
			      <textarea cols="29" name="Softwares_requeridos"><?php echo trim($_POST["Softwares_requeridos"]); ?></textarea>
			    </td>
			  </tr>
			  <tr>
			    <td   nowrap style="color: #4E4E4E;">
			      Número estimado de cores a utilizar 
			    </td>
			    <td   nowrap style="color: #4E4E4E ">
			      <input maxlength="60" size="30" name="cores" value=<?php echo '"'.$_POST['cores'].'"'; ?>>
			    </td>
			  </tr>
			  <tr>
			    <td   nowrap style="color: #4E4E4E;">
			      Cantidad de horas de cálculo estimadas 
			    </td>
			    <td   nowrap style="color: #4E4E4E ">
			      <input maxlength="60" size="30" name="horas" value=<?php echo '"'.$_POST['horas'].'"'; ?>>
			    </td>
			  </tr>
		        </table>
			
			<br>
		    	  
			<a style="color: #4E4E4E;" href="politicas.php" target="_blank">
			  <strong>
			    Pol&iacute;ticas de uso
			  </strong>
			</a>
			
			<table  border="0" cellpadding="2" cellspacing="2" style="color: #4E4E4E; background-color:#e4e4e4; width:580px;" >
			  <tbody>
			    <tr>
			      <td   nowrap style="color: #4E4E4E; width: 100%;"> 
				<input name="check" type="checkbox" id="check" value="checkbox" onclick="activarcasilla(this)" value='1'>He le&iacute;do y acepto las pol&iacute;ticas de uso.</checkbox>
			      </td>
			    </tr>
			  </tbody>
			</table>

			</tr>
			<tr>
			  <td>

			  <table style="margin: 10px 0px 10px 36px;">
			    <tr>
			      <td style="color: #4E4E4E; font-size:12pt;">
				<b>
				  <br>
				  <u>IMPORTANTE</u>: Todos los campos son estrictamente necesarios.
			        </b>
			      </td>
			    </tr>
			  </table>
			  </td>
			</tr>
			<tr>
			  <input type="hidden" name="varx" value="1">
			  <td align="center" nowrap style="color: #4E4E4E ">
			    <input type="submit" name="submit" value="Enviar Solicitud" style="visibility:hidden;">
			  </td>
			</tr>
		</table>
	    </form>
	    <br>
	    <br>
	    </td>
	    </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td colspan="3" align="center" style="background-color:rgb(180,180,180); color:rgb(255,255,255); font-size:11px; font-weight:bold;">
      Desarrolado por Lorenzón Matías: 
      <i>
	<a style="text-decoration:underline; color:#ffffff;" href="mailto:matias.12003@gmail.com">
	  matias.12003@gmail.com
        </a>
      </i>
    </td>
  </tr>
</table>
	      
</body>
</html>
