SVN Alba r5150 - in prosistem/alba/trunk/alba/web/instalar: . images
Author: ftoledo Date: 2007-09-25 11:04:51 -0300 (Tue, 25 Sep 2007) New Revision: 5150 Added: prosistem/alba/trunk/alba/web/instalar/funciones.php prosistem/alba/trunk/alba/web/instalar/images/header.png prosistem/alba/trunk/alba/web/instalar/paso5.php prosistem/alba/trunk/alba/web/instalar/paso6.php Modified: prosistem/alba/trunk/alba/web/instalar/images/estilos.css prosistem/alba/trunk/alba/web/instalar/instalar.php prosistem/alba/trunk/alba/web/instalar/paso1.php prosistem/alba/trunk/alba/web/instalar/paso3.php prosistem/alba/trunk/alba/web/instalar/paso4.php Log: se movieron las funciones al otro archivo argegue paso 5 y 6 se cambiaron estilos Added: prosistem/alba/trunk/alba/web/instalar/funciones.php =================================================================== --- prosistem/alba/trunk/alba/web/instalar/funciones.php 2007-09-24 21:42:02 UTC (rev 5149) +++ prosistem/alba/trunk/alba/web/instalar/funciones.php 2007-09-25 14:04:51 UTC (rev 5150) @@ -0,0 +1,158 @@ +<?php +/** + * This file is part of Alba. + * + * Alba is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Alba is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Alba; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +/** + * instalador + * + * @package alba + * @author José Luis Di Biase <[email protected]> + * @author Héctor Sanchez <[email protected]> + * @author Fernando Toledo <[email protected]> + * @version SVN: $Id: instalar.php 4883 2007-07-30 21:41:42Z ftoledo $ + * @filesource + * @license GPL + */ + +function AlbaPath() { + return realpath(dirname(__FILE__) .DIRECTORY_SEPARATOR. ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR); +} + +function DebugLog($str) { + date_default_timezone_set('America/Argentina/Buenos_Aires'); + $log = AlbaPath() . DIRECTORY_SEPARATOR . "log" . DIRECTORY_SEPARATOR . "install.log"; + $fp = fopen($log,"a+"); + if ($fp) { + fwrite($fp,date('d/m/Y H:i:s') . " $str\n"); + fclose($fp); + } +} + +function dump2Array($file) { + $aSql = array(); + $res_sql = ""; + DebugLog ("dump2Array(): Comprobando si existe el archivo"); + if(file_exists($file)) { + $sql = file($file); + DebugLog("dump2Array(): Leyendo archivo .SQL"); + foreach($sql as $sql_line) { + $sql_line = trim($sql_line); + if (($sql_line != "") && (substr($sql_line, 0, 2) != "--") && (substr($sql_line, 0, 1) != "#") ) { + $res_sql .= $sql_line."\n"; + } + } + $aSql= array_slice(explode(";\n", $res_sql),0,-1); + DebugLog ("dump2Array(): Total de lineas :" . count($aSql)); + } + else { + DebugLog ("dump2Array(): El archivo no existe: $file"); + return array(); + } + + return $aSql; +} + +function executeDump($file, $host, $user, $pass, $db) { + DebugLog("executeDump(): file: $file"); + DebugLog("executeDump(): user: $user"); + DebugLog("executeDump(): db: $db"); + $aSql = dump2Array($file); + $error = false; + if(count($aSql) > 0 && file_exists($file)) { + if (mysql_connect($host,$user,$pass)) { + if(mysql_select_db($db)) { + DebugLog("executeDump(): ejecutando BEGIN" ); + mysql_query("BEGIN"); + foreach($aSql as $sql_line) { + $res = mysql_query(trim($sql_line)); + if(!$res) { + DebugLog("executeDump(): Fallo SQL: $sql_line"); + DebugLog("executeDump(): error:". mysql_error()); + $error = true; + } + } + if($error == true) { + DebugLog("executeDump(): Se encontraron errores ejecutando ROLLBACK y saliendo"); + mysql_query("ROLLBACK"); + return false; + } else { + DebugLog("executeDump(): Sin errores ejecutando COMMIT y saliendo"); + mysql_query("COMMIT"); + return true; + } + } + else { + DebugLog("executeDump(): Error al seleccionar la base: $db"); + return false; + } + + } + else { + DebugLog("excuteDump(): No se puede conectar ala base de datos. " . mysql_error()); + } + } else { + DebugLog("executeDump(): No hay instrucciones SQL en el archivo"); + return false; + } + +} +/** +* genera el archivo de conexion a la base de datos +*/ +function generate_databases_yml($host,$user,$pass,$db) { + $yml = AlbaPath() . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "databases.yml"; + DebugLog ("generate_databases_yml(): generando archivo de cnonexion $yml"); + if ($fp = @fopen ($yml,'w')) { + fwrite ($fp,"#Archivo generando por el instalador " . date('m/d/Y H:i:s') . "\n"); + fwrite ($fp,"all:\n"); + fwrite ($fp," propel:\n"); + fwrite ($fp," class: sfPropelDatabase\n"); + fwrite ($fp," param:\n"); + if ($pass != "") + fwrite ($fp," dsn: $user:$pass@$host/$db\n"); + else + fwrite ($fp," dsn: $user@$host/$db\n"); + fwrite ($fp," datasource: alba\n"); + fwrite ($fp, "\n"); + DebugLog("generate_databases_yml(): archivo yml generado"); + return true; + } + else { + DebugLog("generate_databases_yml(): no se puede abrir el archivo. "); + return false; + } + +} + +/** +* carga el schema a l abase de datos +*/ +function crear_schema ($filesql, $host, $user, $pass, $db) { + DebugLog ("crear_schema(): Agregando $filesql"); + return executeDump(AlbaPath() . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR .$filesql, $host, $user, $pass, $db); + +} + +/** +* caga los datos ejemplo/minima +*/ +function crear_base_modelo($filesql, $host, $user, $pass, $db) { + DebugLog("crear_base_modelo(): Creado base de datos modelo"); + return executeDump(AlbaPath() . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR .$filesql, $host, $user, $pass, $db); + +} +?> \ No newline at end of file Property changes on: prosistem/alba/trunk/alba/web/instalar/funciones.php ___________________________________________________________________ Name: svn:keywords + "Id Author Rev Date URL" Modified: prosistem/alba/trunk/alba/web/instalar/images/estilos.css =================================================================== --- prosistem/alba/trunk/alba/web/instalar/images/estilos.css 2007-09-24 21:42:02 UTC (rev 5149) +++ prosistem/alba/trunk/alba/web/instalar/images/estilos.css 2007-09-25 14:04:51 UTC (rev 5150) @@ -1,3 +1,44 @@ +body { + font-size: 12px; + font-family: Helvetica; +} div .error { color: red; -} \ No newline at end of file +} +#contenido { + padding-left: 25px; + +} +#cabeza { + padding-left: 25px; +} +#siguiente { + padding-left: 25px; +} +h1 { + font-size: 14px; +} +input:focus { + background-color: #ededed; +} +.boton { + background: #D4D0C8; + color: #000000; + font-size: 11px; + padding: 0px 5px; + font-weight: normal; + text-decoration: none; + border: 1px solid #000000; + font-family: Verdana, Arial, Helvetica, sans-serif; +} +.texto { + color: #000000; + font-size: 11px; + padding: 0px 5px; + font-weight: normal; + border: 1px solid gray; + font-family: Verdana, Arial, Helvetica, sans-serif; +} +.check { + border: 1px solid black; +} Added: prosistem/alba/trunk/alba/web/instalar/images/header.png =================================================================== (Binary files differ) Property changes on: prosistem/alba/trunk/alba/web/instalar/images/header.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: prosistem/alba/trunk/alba/web/instalar/instalar.php =================================================================== --- prosistem/alba/trunk/alba/web/instalar/instalar.php 2007-09-24 21:42:02 UTC (rev 5149) +++ prosistem/alba/trunk/alba/web/instalar/instalar.php 2007-09-25 14:04:51 UTC (rev 5150) @@ -35,6 +35,7 @@ define ('IMG_OK','<img src="images/ok.png" title="Correcto" alt="Correcto">'); define ('IMG_ERROR', '<img src="images/error.png" title="Incorrecto" alt="Incorrecto">'); +require ("funciones.php"); if (!isset($_GET['paso'])) $paso = 1; @@ -45,18 +46,6 @@ $completo = false; -function AlbaPath() { - return realpath(dirname(__FILE__) .DIRECTORY_SEPARATOR. ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR); -} - -function DebugLog($str) { - $log = AlbaPath() . DIRECTORY_SEPARATOR . "log" . DIRECTORY_SEPARATOR . "install.log"; - $fp = fopen($log,"a+"); - if ($fp) { - fwrite($fp,date('d/m/Y H:i:s') . " $str\n"); - fclose($fp); - } -} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-200000126/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es"> @@ -71,6 +60,8 @@ <link rel="StyleSheet" type="text/css" href="images/estilos.css"> </head> <body> + + <img src="images/header.png"> <div id="cabeza"> <h1>Instalación de ALBA</h1> </div> @@ -89,6 +80,15 @@ case 4: include ("paso4.php"); break; + case 5: + include ("paso5.php"); + break; + case 6: + include ("paso6.php"); + break; + default: + die("Uhmmm, error del instalador =("); + break; } ?> </div> @@ -97,7 +97,7 @@ <div id="siguiente"> <form method="get" action="instalar.php"> <input type="hidden" name="paso" value="<?php echo $paso?>"> - <input type="submit" name="btSiguiente" value="Siguiente"> + <input type="submit" name="b" value="Siguiente" class="boton"> </form> </div> <?php endif;?> Modified: prosistem/alba/trunk/alba/web/instalar/paso1.php =================================================================== --- prosistem/alba/trunk/alba/web/instalar/paso1.php 2007-09-24 21:42:02 UTC (rev 5149) +++ prosistem/alba/trunk/alba/web/instalar/paso1.php 2007-09-25 14:04:51 UTC (rev 5150) @@ -44,11 +44,13 @@ $alba_path = AlbaPath(); ?> <div id="detalle"> +<p>Bienvenidos al Sistema De Gestión para Unidades Educacionales Alba!</p> <p>Antes de continuar con la instalación, es necesario comprobar los permisos de algunos directorios en particular.<br/> Por favor, corrija los mismos y vuelva a recargar ésta página hasta que todos -esten correctos. +estén correctos. </p> +<p>Una vez que los permisos sean los necesarios, puede continuar con la instalación</p> </div> <p>Directorio base: <?php echo $alba_path?></p> Modified: prosistem/alba/trunk/alba/web/instalar/paso3.php =================================================================== --- prosistem/alba/trunk/alba/web/instalar/paso3.php 2007-09-24 21:42:02 UTC (rev 5149) +++ prosistem/alba/trunk/alba/web/instalar/paso3.php 2007-09-25 14:04:51 UTC (rev 5150) @@ -88,27 +88,27 @@ <table> <tr> <td>Servidor:</td> - <td><input type="text" name="host" value="<?php echo $host?>"></td> + <td><input type="text" name="host" value="<?php echo $host?>" class="texto"></td> </tr> <tr> <td>Usuario:</td> - <td><input type="text" name="user" value="<?php echo $user?>"></td> + <td><input type="text" name="user" value="<?php echo $user?>" class="texto"></td> </tr> <tr> <td>Clave:</td> - <td><input type="password" name="pass" value="<?php echo $pass?>"></td> + <td><input type="password" name="pass" value="<?php echo $pass?>" class="texto"></td> </tr> <tr> <td>Base de datos:</td> - <td><input type="text" name="db" value="<?php echo $db?>"></td> + <td><input type="text" name="db" value="<?php echo $db?>" class="texto"></td> </tr> <tr> <td>Crear base de datos:<br/><span style="font-size:9px">(debe tener los permisos para poder hacerlo)</style></td> - <td><input type="checkbox" name="creardb" value="1" <?php echo $creardb ? "checked" : ""?>></td> + <td><input type="checkbox" name="creardb" value="1" <?php echo $creardb ? "checked" : ""?> class="check"></td> </tr> </table> <br/> -<input type="submit" name="btTextConn" value="Comprobar conexión a la Base de Datos"> +<input type="submit" name="btTextConn" value="Comprobar conexión a la Base de Datos" class="boton"> </form> <?php // ir al siguiente paso Modified: prosistem/alba/trunk/alba/web/instalar/paso4.php =================================================================== --- prosistem/alba/trunk/alba/web/instalar/paso4.php 2007-09-24 21:42:02 UTC (rev 5149) +++ prosistem/alba/trunk/alba/web/instalar/paso4.php 2007-09-25 14:04:51 UTC (rev 5150) @@ -36,7 +36,20 @@ $user = $_SESSION['albainstall']['user']; $pass = $_SESSION['albainstall']['pass']; $db = $_SESSION['albainstall']['db']; - + + + if (isset($_POST['set_tipo_base']) && $_POST['set_tipo_base'] == 1) { + if(!isset($_POST['tipo_base'])) { + $error_flag= true; + $error_msg = "Por favor seleccione un tipo de base de datos"; + } + else { + $_SESSION['albainstall']['tipo_base'] = $_POST['tipo_base']; + $completo = false; + } + } + else + $completo = true; ?> <div id="detalle"> <p>Selección de base de datos inicial:</p> @@ -45,6 +58,33 @@ ó con una base de datos de Ejemplo (datos de prueba).</p> </div> +<?php if ($error_flag):?> +<div class="error"> + <p>Ocurrió el siguiente error:</p> + <p><?php echo $error_msg?></p> +</div> +<?php endif;?> + + +<div> +<form name="tipobase" method="post"> + <input type="hidden" name="set_tipo_base" value="1"> + <table> + <tr> + <td>Datos mínimos:</td> + <td><input type="radio" name="tipo_base" value="minima" <?php echo isset($_POST['tipo_base']) && $_POST['tipo_base'] == 'minima' ? 'checked' : ''?> ></td> + </tr> + <tr> + <td>Datos ejemplo:</td> + <td><input type="radio" name="tipo_base" value="ejemplo1" <?php echo isset($_POST['tipo_base']) && $_POST['tipo_base'] == 'ejemplo1' ? 'checked' : ''?>></td> + </tr> + + </table> + <br/> + <input type="submit" name="btEnviar" value="Seleccionar base de datos" class="boton"> +</form> +</div> + <?php // ir al siguiente paso $paso = 5; Added: prosistem/alba/trunk/alba/web/instalar/paso5.php =================================================================== --- prosistem/alba/trunk/alba/web/instalar/paso5.php 2007-09-24 21:42:02 UTC (rev 5149) +++ prosistem/alba/trunk/alba/web/instalar/paso5.php 2007-09-25 14:04:51 UTC (rev 5150) @@ -0,0 +1,84 @@ +<?php +/** + * This file is part of Alba. + * + * Alba is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Alba is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Alba; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +/** + * instalador + * + * @package alba + * @author José Luis Di Biase <[email protected]> + * @author Héctor Sanchez <[email protected]> + * @author Fernando Toledo <[email protected]> + * @version SVN: $Id: instalar.php 4883 2007-07-30 21:41:42Z ftoledo $ + * @filesource + * @license GPL + */ + +if (!defined('ALBA_INSTALLER')) die(); + + $host = $_SESSION['albainstall']['host']; + $user = $_SESSION['albainstall']['user']; + $pass = $_SESSION['albainstall']['pass']; + $db = $_SESSION['albainstall']['db']; + $tipo_base = $_SESSION ['albainstall']['tipo_base']; + +?> +<div id="detalle"> +<p>Finalizar instalación:</p> +<p>Ahora se procederá a instalar el sistema. <br/> +Los datos que se van a utilizar son los siguientes, si desea cambiar +alguno por favor haga click aquí. +</p> +</div> + +<?php if ($error_flag):?> +<div class="error"> + <p>Ocurrió el siguiente error:</p> + <p><?php echo $error_msg?></p> +</div> +<?php endif;?> + +<table> + <tr> + <td>Servidor:</td> + <td><?php echo $_SESSION['albainstall']['host']?></td> + </tr> + <tr> + <td>Usuario:</td> + <td><?php echo $_SESSION['albainstall']['user']?></td> + </tr> + <tr> + <td>Clave:</td> + <td><?php echo str_repeat('X',strlen($_SESSION['albainstall']['pass']))?></td> + </tr> + <tr> + <td>Base de datos:</td> + <td><?php echo $_SESSION['albainstall']['db']?></td> + </tr> + <tr> + <td>Modelo de Base:</td> + <td><?php echo $_SESSION['albainstall']['tipo_base']?></td> + </tr> +</table> + +<?php +// ir al siguiente paso + $paso = 6; + +?> \ No newline at end of file Property changes on: prosistem/alba/trunk/alba/web/instalar/paso5.php ___________________________________________________________________ Name: svn:keywords + "Id Author Rev Date URL" Added: prosistem/alba/trunk/alba/web/instalar/paso6.php =================================================================== --- prosistem/alba/trunk/alba/web/instalar/paso6.php 2007-09-24 21:42:02 UTC (rev 5149) +++ prosistem/alba/trunk/alba/web/instalar/paso6.php 2007-09-25 14:04:51 UTC (rev 5150) @@ -0,0 +1,83 @@ +<?php +/** + * This file is part of Alba. + * + * Alba is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Alba is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Alba; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +/** + * instalador + * + * @package alba + * @author José Luis Di Biase <[email protected]> + * @author Héctor Sanchez <[email protected]> + * @author Fernando Toledo <[email protected]> + * @version SVN: $Id: instalar.php 4883 2007-07-30 21:41:42Z ftoledo $ + * @filesource + * @license GPL + */ + +if (!defined('ALBA_INSTALLER')) die(); + + $host = $_SESSION['albainstall']['host']; + $user = $_SESSION['albainstall']['user']; + $pass = $_SESSION['albainstall']['pass']; + $db = $_SESSION['albainstall']['db']; + $tipo_base = $_SESSION ['albainstall']['tipo_base']; + +?> +<div id="detalle"> +<p>Resultado de la instalación:</p> + +<table> + <tr> + <td>Generando archivo de configuración:</td> + <td> + <?php echo generate_databases_yml($host,$user,$pass,$db) ? IMG_OK : IMG_ERROR?> + </td> + </tr> + <tr> + <td>Creando esquema de base de datos:</td> + <td> + <?php echo crear_schema('lib.model.schema.sql', $host, $user, $pass, $db) ? IMG_OK : IMG_ERROR?> + </td> + </tr> + <tr> + <td>Cargando modelo de base de datos <?php echo $_SESSION['albainstall']['tipo_base']?>:</td> + <td> + <?php + if ($_SESSION['albainstall']['tipo_base'] =='minima') + $archivo = "datos_desde_cero.sql"; + elseif ($_SESSION['albainstall']['tipo_base'] =='ejemplo1') + $archivo = "datos_ejemplo.sql"; + else + $archivo = ""; + ?> + <?php echo crear_base_modelo($archivo,$host,$user,$pass,$db) ? IMG_OK : IMG_ERROR?> + </td> + </tr> +</table> + +<p>La instalación ha finalizado!</p> + +<p><a href="../">Ingresar al Sistema de Gestión Educactiva Alba</a></p> +<p><i>* Recuerde que para ingresar al sistema el nombre de usuario por defecto es <b>admin</b> y la clave es <b>admin</b>.</i></p> +<?php +// ir al siguiente paso + $completo = true; + $paso = 7; + +?> \ No newline at end of file Property changes on: prosistem/alba/trunk/alba/web/instalar/paso6.php ___________________________________________________________________ Name: svn:keywords + "Id Author Rev Date URL"
participants (1)
-
commits@pressenter.com.ar