11 Commits
1.07 ... tests

Author SHA1 Message Date
d4b4429232 #9 Corregido el problema de detectar http y https en el enlace de la url de llamada. 2014-03-17 23:39:28 +01:00
rmontanana
5c403c5313 Caducidad de la cookie a 24h 2014-03-17 14:17:24 +01:00
rmontanana
8d0fffb04b El menú ahora funciona colapsado en resoluciones pequeñas. Corrección en el tamaño de la barra de búsqueda del mantenimiento en resoluciones pequeñas 2014-03-17 13:47:50 +01:00
rmontanana
d78333ae6a ref #9 Crear etiquetas de un artículo. Cambiar el nombre del archivo por omisión del informe de etiquetas. Ajuste para cuadrar con etiquetas del centro. 2014-03-15 03:36:28 +01:00
e1d50a74dc resolve#9 Creadas las etiquetas de artículos con código qr y paginación.
Sacada la versión y el autor del fichero de configuración.
2014-03-14 01:14:06 +01:00
rmontanana
c33a6edaa1 Arreglado que salía mantenimiento de Artículos cuando se solicitaba Matenimiento de Elementos. 2014-03-12 09:13:53 +01:00
rmontanana
78bd313fd3 Terminado el mantenimiento con:
-Control de la url de vuelta
-funcionamiento correcto de la cadena de búsqueda con la ordenación, edición, etc.
-funcionamiento correcto de la paginación y el orden con la edición, borrado, etc.
-mensaje de inserción de registros con nuevo formato y redirección con tiempo.
2014-03-12 09:09:58 +01:00
bd2f0ed4b8 En mantenimiento puesta la gestión de URL para que vuelva siempre a donde estaba tanto desde altas, modificaciones o bajas
Reformateado de ficheros
2014-03-11 23:58:20 +01:00
rmontanana
5444378aa4 Pequeños cambios en el mantenimiento para lo de la cadena de búsqueda 2014-03-10 16:49:26 +01:00
a266e85d39 Añadido que mantenga la cadena de búsqueda en su cuadro una vez pulsada la opción de buscar. Quedan cosas por hacer 2014-03-10 00:27:08 +01:00
8647d08d51 Primera aproximación para realizar los tests con phpunit
Configuración cambiada totalmente para optimizar el código y prepararlo para los tests.
Quitada la clave APLICACION del fichero de configuración y de las clases que lo utilizaban (Aportacontenido, InformePDF y PDF_mysql_table)
Creados los esqueletos de test para: Configuración, Menu y Sql
Casi terminado el conjunto de pruebas de Configuración. Pendiente en @todo
2014-03-10 00:17:05 +01:00
91 changed files with 18201 additions and 13879 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,3 @@
nbproject nbproject
tmp/* tmp/*
.DS_Store .DS_Store
/img.data/

View File

@@ -25,7 +25,7 @@ define('PIE', '<center><a target="_blank" href="http://www.gnu.org/licenses/gpl-
'<a target="_blank" href="http://www.php.net"><img src="img/php.gif" alt="PHP Language" /></a> </center>'); '<a target="_blank" href="http://www.php.net"><img src="img/php.gif" alt="PHP Language" /></a> </center>');
define('FORMULARIO_ACCESO', '<form name="formulario_acceso" action="index.php?registrarse" method="POST">' . define('FORMULARIO_ACCESO', '<form name="formulario_acceso" action="index.php?registrarse" method="POST">' .
'Usuario<br><input type="text" name="usuario" value="" size="8" /><br><br>Clave<br><input type="password" name="clave" value="" size="8" />' . 'Usuario<br><input type="text" name="usuario" value="" size="8" /><br><br>Clave<br><input type="password" name="clave" value="" size="8" />' .
'<br><br><button type="submit" name="iniciar" class="btn btn-primary">Iniciar <span class="glyphicon glyphicon-log-in"></span></button></form>'); '<br><br><input type="submit" value="Iniciar" name="iniciar" /></form>');
define('MENSAJE_DEMO', 'Puede Iniciar sesi&oacute;n con<br>usuario <i><b>demo</b></i><br>contrase&ntilde;a <i>demo</i><br>'); define('MENSAJE_DEMO', 'Puede Iniciar sesi&oacute;n con<br>usuario <i><b>demo</b></i><br>contrase&ntilde;a <i>demo</i><br>');
define('USUARIO_INCORRECTO', '<label class="error">Usuario y clave incorrectos!</label><br><br>'); define('USUARIO_INCORRECTO', '<label class="error">Usuario y clave incorrectos!</label><br><br>');
@@ -68,12 +68,6 @@ class AportaContenido {
*/ */
private $perfil; private $perfil;
/**
*
* @var array Datos pasados en la URL
*/
private $datosURL = array();
// El constructor necesita saber cuál es la opción actual // El constructor necesita saber cuál es la opción actual
/** /**
* Constructor de la clase. * Constructor de la clase.
@@ -124,14 +118,14 @@ class AportaContenido {
public function __call($metodo, $parametros) { public function __call($metodo, $parametros) {
switch ($metodo) { // Dependiendo del método invocado switch ($metodo) { // Dependiendo del método invocado
case 'titulo': // devolvemos el título case 'titulo': // devolvemos el título
return PROGRAMA." v".VERSION; return PROGRAMA.VERSION;
case 'usuario': case 'usuario':
if ($this->registrado) if ($this->registrado)
return "Usuario=$this->usuario"; return "Usuario=$this->usuario";
else else
return ''; return '';
case 'fecha': return $this->fechaActual(); case 'fecha': return $this->fechaActual();
case 'aplicacion': return PROGRAMA." v".VERSION; case 'aplicacion': return PROGRAMA.VERSION;
case 'menu': // el menú case 'menu': // el menú
if ($this->registrado) { if ($this->registrado) {
return $this->miMenu->insertaMenu(); return $this->miMenu->insertaMenu();
@@ -155,9 +149,9 @@ class AportaContenido {
case 'ubicaciones': case 'ubicaciones':
case 'usuarios': case 'usuarios':
case 'test': case 'test':
return "Mantenimiento " . ucfirst($opcion); return "Mantenimiento de " . ucfirst($opcion) . ".";
case 'configuracion': case 'configuracion':
return 'Configuraci&oacute;n y Preferencias'; return 'Configuraci&oacute;n y Preferencias.';
case 'informeInventario':return "Informe de Inventario"; case 'informeInventario':return "Informe de Inventario";
case 'descuadres':return 'Informe de descuadres'; case 'descuadres':return 'Informe de descuadres';
case 'importacion': return 'Importaci&oacute;n de datos'; case 'importacion': return 'Importaci&oacute;n de datos';
@@ -166,7 +160,7 @@ class AportaContenido {
return ''; return '';
case 'control': case 'control':
if ($this->registrado) if ($this->registrado)
return '<a href="index.php?cerrarSesion">Cerrar Sesi&oacute;n <span class="glyphicon glyphicon-log-out"></span></a>'; return '<a href="index.php?cerrarSesion">Cerrar Sesi&oacute;n</a>';
else else
return ''; return '';
// Para incluir el contenido central de la página // Para incluir el contenido central de la página
@@ -187,29 +181,6 @@ class AportaContenido {
case 'ubicaciones': case 'ubicaciones':
case 'test': case 'test':
case 'elementos': case 'elementos':
$this->DatosURL();
if ($this->datosURL['opc'] == "informe") {
if (!$this->pefil['Informe']) {
$this->procesaURL();
$fichero = 'xml/informe' . ucfirst($opcion) . '.xml';
$salida = 'tmp/informe' . ucfirst($opcion) . '.xml';
//Establece los posibles parámetros del listado.
$orden = $this->datosURL['orden'];
$sentido = $this->datosURL['sentido'] == "asc" ? ' ' : ' desc ';
$filtro = isset($this->datosURL['buscar']) ? $this->bdd->filtra($this->datosURL['buscar']) : '';
$plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
$plantilla = str_replace("{filtro}", $filtro, $plantilla);
$plantilla = str_replace("{orden}", $orden . $sentido, $plantilla);
file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla ' . $salida);
$informe = new InformePDF($this->bdd, $salida, $this->registrado);
$informe->crea($salida);
$informe->cierraPDF();
$informe->imprimeInforme();
return;
} else {
return $this->mensajePermisos("Informes");
}
}
if ($this->perfil['Consulta']) { if ($this->perfil['Consulta']) {
$ele = new Mantenimiento($this->bdd, $this->perfil, $opcion); $ele = new Mantenimiento($this->bdd, $this->perfil, $opcion);
return $ele->ejecuta(); return $ele->ejecuta();
@@ -218,29 +189,6 @@ class AportaContenido {
} }
case 'usuarios': case 'usuarios':
if ($this->perfil['Usuarios']) { if ($this->perfil['Usuarios']) {
$this->cargaDatosURL();
if ($this->datosURL['opc'] == "informe") {
if (!$this->pefil['Informe']) {
$this->procesaURL();
$fichero = 'xml/informe' . ucfirst($opcion) . '.xml';
$salida = 'tmp/informe' . ucfirst($opcion) . '.xml';
//Establece los posibles parámetros del listado.
$orden = $this->datosURL['orden'];
$sentido = $this->datosURL['sentido'] == "asc" ? ' ' : ' desc ';
$filtro = isset($this->datosURL['buscar']) ? $this->bdd->filtra($this->datosURL['buscar']) : '';
$plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
$plantilla = str_replace("{filtro}", $filtro, $plantilla);
$plantilla = str_replace("{orden}", $orden . $sentido, $plantilla);
file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla ' . $salida);
$informe = new InformePDF($this->bdd, $salida, $this->registrado);
$informe->crea($salida);
$informe->cierraPDF();
$informe->imprimeInforme();
return;
} else {
return $this->mensajePermisos("Informes");
}
}
$ele = new Mantenimiento($this->bdd, $this->perfil, $opcion); $ele = new Mantenimiento($this->bdd, $this->perfil, $opcion);
return $ele->ejecuta(); return $ele->ejecuta();
} else { } else {
@@ -248,10 +196,8 @@ class AportaContenido {
} }
case 'bienvenido': // El usuario quiere iniciar sesión case 'bienvenido': // El usuario quiere iniciar sesión
$mensaje = '<div class="alert alert-success">'; return 'Bienvenid@ ' . $this->usuario . '<br><br><center><img src="img/codigoBarras.png" alt="' . PROGRAMA . '">' .
$mensaje .= 'Bienvenid@ ' . $this->usuario . '</div><br><br><center><img src="img/codigoBarras.png" alt="' . PROGRAMA . '">' . '<br><label>' . CENTRO . '</label></center><br><br>' . PIE;
'<br><label>' . CENTRO . '</label></center><br><br>' . PIE;;
return $mensaje;
case 'configuracion': case 'configuracion':
if ($this->perfil['Config']) { if ($this->perfil['Config']) {
$conf = new Configuracion(); $conf = new Configuracion();
@@ -286,19 +232,31 @@ class AportaContenido {
} }
case 'copiaseg': case 'copiaseg':
if ($this->perfil['Config']) { if ($this->perfil['Config']) {
$copia = new CopiaSeguridad(); $archivo_sql = "tmp/copiaseg.sql";
if ($_GET['confirmado'] == "1") { $archivo = $archivo_sql . ".gz";
if (!$copia->creaCopia()) { if (file_exists($archivo)) {
$tipo = "danger"; unlink($archivo);
}
$comando = escapeshellcmd(MYSQLDUMP . ' -u ' . USUARIO . ' --password=' . CLAVE . ' --result-file=' . $archivo_sql . ' ' . BASEDATOS);
$comando2 = escapeshellcmd(GZIP . ' -9f ' . $archivo_sql);
exec($comando);
exec($comando2);
if (filesize($archivo) < 1024) {
//No se ha realizado la copia de seguridad
$mensaje = "La copia de seguridad no se ha realizado correctamente.<br><br>";
$mensaje .= "Compruebe que las rutas a los programas mysqldump y gzip en configuraci&oacute;n est&aacute;n correctamente establecidas ";
$mensaje .= "y que los datos de acceso a la base de datos sean correctos.<br>";
$mensaje .= "mysqldump=[" . MYSQLDUMP . "]<br>";
$mensaje .= "gzip=[" . GZIP . "]";
$cabecera = "ERROR"; $cabecera = "ERROR";
$tipo = "danger";
} else { } else {
$tipo = "info"; $mensaje .= 'Copia de seguridad realizada con &eacute;xito.<br><br>Pulse sobre el siguiente enlace para descargar:<br><br>';
$cabecera = "INFORMACIÓN"; $mensaje .= '<a href="' . $archivo . '">Descargar Copia de Seguridad de Datos</a><br>';
} $cabecera = "Informaci&oacute;n";
return $this->panel($cabecera, $copia->mensaje(), $tipo); $tipo = "success";
} else {
return $copia->dialogo();
} }
return $this->panel($cabecera,$mensaje,$tipo);
} else { } else {
return $this->mensajePermisos("Copias de seguridad"); return $this->mensajePermisos("Copias de seguridad");
} }
@@ -318,15 +276,7 @@ class AportaContenido {
return "Marca {$metodo} queda sin procesar"; return "Marca {$metodo} queda sin procesar";
} }
} }
public function cargaDatosURL()
{
$this->datosURL['opc'] = isset($_GET['opc']) ? $_GET['opc'] : 'inicial';
$this->datosURL['orden'] = isset($_GET['orden']) ? $_GET['orden'] : 'id';
$this->datosURL['sentido'] = isset($_GET['sentido']) ? $_GET['sentido'] : 'asc';
$this->datosURL['pag'] = isset($_GET['pag']) ? $_GET['pag'] : '0';
$this->datosURL['buscar'] = isset($_GET['buscar']) ? $_GET['buscar'] : null;
$this->datosURL['id'] = isset($_GET['id']) ? $_GET['id'] : null;
}
/** /**
* *
* @param string $tipo * @param string $tipo

View File

@@ -1,24 +0,0 @@
Versión 1.07
-Añadido bootstrap-select a la solicitud de informes de inventario de esta forma se pueden buscar artículos o ubicaciones en el select
-Añadido bootstrap-select al mantenimiento para que en el alta de elementos se puedan buscar artículos o ubicaciones en el el select
-Corregido un problema que permitía cambiar fechas en el formulario de bajas
Versión 1.06 28-03-2014
-Configuracion: Añadido icono en el botón de aceptar.
Cambiado el mensaje de éxito en la grabación de los cambios.
-CopiaSeguridad: Añadidos iconos en los botones de aceptar y volver.
-Csv: Añadidos iconos en los botones de acción.
-Importacion: Añadidos iconos en los botones de acción.
Cambiado el control de subida de fichero por el de Jasny.
Cambiado el formato para controlar las columnas que ocupa el formulario de subida para que sea 'responsive'
-AportaContenido: Quitado 'de' del mensaje de opción actual en Mantenimiento para acortar mensaje.
-InformeInventario: Añadidos iconos en los botones de acción.
Cambiado el formato para que sea correcto en todas las resoluciones de pantalla.
-Mantenimiento: Añadidos iconos en los botones de acción.
Añadidas flechas para indicar el campo que marca el orden de visualización.
-bootstrap.html: Añadida la opción de cerrar sesión en resolución pequeña.
Añadida una textura al fondo de la cabecera.
Cambios en las dimensiones de los contenedores para mejorar la visualización.
-img/fondos: Añadidos algunos ficheros de texturas para poder utilizarlos en el futuro.
-CHANGELOG: Añadido este fichero para llevar un registro de cambios entre versiones.
-img: Cambiadas las flechas de sentido ascendente y descendente (intercambiar) para ser coherente con las indicaciones en la cabecra de la tabla.

View File

@@ -25,7 +25,7 @@ class Configuracion {
private $confAnterior = "inc/configuracion.ant"; private $confAnterior = "inc/configuracion.ant";
private $datosConf; private $datosConf;
//Campos del fichero de configuración que se van a editar. //Campos del fichero de configuración que se van a editar.
private $lista = array('SERVIDOR', 'PUERTO', 'BASEDATOS', 'BASEDATOSTEST', 'USUARIO', 'CLAVE', 'CENTRO', 'NUMFILAS', 'ESTILO', 'PLANTILLA', 'COLORLAT', 'COLORFON', 'MYSQLDUMP', 'GZIP'); private $lista = array('SERVIDOR', 'BASEDATOS', 'BASEDATOSTEST', 'USUARIO', 'CLAVE', 'CENTRO', 'NUMFILAS', 'ESTILO', 'PLANTILLA', 'COLORLAT', 'COLORFON', 'MYSQLDUMP', 'GZIP');
private $campos; private $campos;
public function __construct() public function __construct()
@@ -80,7 +80,7 @@ class Configuracion {
} }
$salida.=$this->formulario(); $salida.=$this->formulario();
if ($grabar) { if ($grabar) {
$salida.='<div class="alert alert-success">Configuraci&oacute;n guardada correctamente</div>'; $salida.='<p class="bg-primary">Configuraci&oacute;n guardada correctamente</p>';
fclose($fsalida); fclose($fsalida);
//unlink($this->confAnterior); //unlink($this->confAnterior);
rename($this->configuracion, $this->confAnterior); rename($this->configuracion, $this->confAnterior);
@@ -135,14 +135,13 @@ class Configuracion {
$salida.='</select></td></tr>'; $salida.='</select></td></tr>';
$salida.='<th colspan=2 class="danger"><center><b>Base de datos</b></center></th>'; $salida.='<th colspan=2 class="danger"><center><b>Base de datos</b></center></th>';
$salida.='<tr><td>Servidor</td><td><input type="text" name="SERVIDOR" value="' . $this->datosConf['SERVIDOR'] . '" size="30" /></td></tr>'; $salida.='<tr><td>Servidor</td><td><input type="text" name="SERVIDOR" value="' . $this->datosConf['SERVIDOR'] . '" size="30" /></td></tr>';
$salida.='<tr><td>Puerto</td><td><input type="text" name="PUERTO" value="' . $this->datosConf['PUERTO'] . '" size="30" /></td></tr>';
$salida.='<tr><td>Base de datos</td><td><input type="text" name="BASEDATOS" value="' . $this->datosConf['BASEDATOS'] . '" size="30" /></td></tr>'; $salida.='<tr><td>Base de datos</td><td><input type="text" name="BASEDATOS" value="' . $this->datosConf['BASEDATOS'] . '" size="30" /></td></tr>';
$salida.='<tr><td>Base de datos Tests</td><td><input type="text" name="BASEDATOSTEST" value="' . $this->datosConf['BASEDATOSTEST'] . '" size="30" /></td></tr>'; $salida.='<tr><td>Base de datos Tests</td><td><input type="text" name="BASEDATOSTEST" value="' . $this->datosConf['BASEDATOSTEST'] . '" size="30" /></td></tr>';
$salida.='<tr><td>Usuario</td><td><input type="text" name="USUARIO" value="' . $this->datosConf['USUARIO'] . '" size="30" /></td></tr>'; $salida.='<tr><td>Usuario</td><td><input type="text" name="USUARIO" value="' . $this->datosConf['USUARIO'] . '" size="30" /></td></tr>';
$salida.='<tr><td>Clave</td><td><input type="text" name="CLAVE" value="' . $this->datosConf['CLAVE'] . '" size="30" /></td></tr>'; $salida.='<tr><td>Clave</td><td><input type="text" name="CLAVE" value="' . $this->datosConf['CLAVE'] . '" size="30" /></td></tr>';
$salida.='<tr><td>mysqldump</td><td><input type="text" name="MYSQLDUMP" value="' . $this->datosConf['MYSQLDUMP'] . '" size="30" /></td></tr>'; $salida.='<tr><td>mysqldump</td><td><input type="text" name="MYSQLDUMP" value="' . $this->datosConf['MYSQLDUMP'] . '" size="30" /></td></tr>';
$salida.='<tr><td>gzip</td><td><input type="text" name="GZIP" value="' . $this->datosConf['GZIP'] . '" size="30" /></td></tr>'; $salida.='<tr><td>gzip</td><td><input type="text" name="GZIP" value="' . $this->datosConf['GZIP'] . '" size="30" /></td></tr>';
$salida.='<tr align=center><td colspan=2><button type="submit" class="btn btn-primary" name="aceptar"><span class="glyphicon glyphicon-ok"></span> Aceptar</td></tr></p>'; $salida.='<tr align=center><td colspan=2><input type="submit" class="btn btn-primary" align="center" value="Aceptar" name="aceptar" /></td></tr></p>';
$salida.='</form></div></center>'; $salida.='</form></div></center>';
$salida.="<script> $salida.="<script>
$(document).ready(function() { $(document).ready(function() {

View File

@@ -1,132 +0,0 @@
<?php
/**
* @package Inventario
* @copyright Copyright (c) 2014, Ricardo Montañana Gómez
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* This file is part of Inventario.
* Inventario 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 3 of the License, or
* (at your option) any later version.
*
* Inventario 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 Inventario. If not, see <http://www.gnu.org/licenses/>.
*
*/
class CopiaSeguridad {
private $mensaje;
private $baseDatos;
private $imagenes;
public function __construct()
{
$opcion = $_GET['opc'];
}
public function creaCopia()
{
if (!$this->copiaBaseDatos()) {
return false;
}
if (!$this->copiaImagenes()) {
return false;
}
if (!$this->empaqueta()) {
return false;
}
return true;
}
public function dialogo()
{
$dialogo = '<div class="container col-5"><div class="jumbotron">
<h1>Copia de Seguridad</h1>
<p>¿Desea realizar una copia de seguridad de todos los datos de la Base de Datos y de todas las Imágenes?</p>
<p><a class="btn btn-primary btn-lg" role="button" onClick="location.href=' . "'index.php'" . '"><span class="glyphicon glyphicon-arrow-left"></span> Volver</a>
<a class="btn btn-success btn-lg" role="button" onClick="location.href=' . "'index.php?copiaseg&confirmado=1'" . '">
<span class="glyphicon glyphicon-cloud-download"></span> Continuar</a></p>
</div></div>';
return $dialogo;
}
private function copiaBaseDatos()
{
$archivo_sql = "tmp/baseDatos" . BASEDATOS . ".sql";
$baseDatosComprimida = $archivo_sql . ".gz";
$this->baseDatos = $baseDatosComprimida;
if (file_exists($baseDatosComprimida)) {
unlink($baseDatosComprimida);
}
$comando = escapeshellcmd(MYSQLDUMP . ' -h ' . SERVIDOR . ' -P ' . PUERTO . ' -u ' . USUARIO . ' --password=' . CLAVE . ' --result-file=' . $archivo_sql . ' ' . BASEDATOS);
$comando2 = escapeshellcmd(GZIP . ' -9f ' . $archivo_sql);
exec($comando);
exec($comando2);
if (filesize($baseDatosComprimida) < 1024) {
//No se ha realizado la copia de seguridad
$mensaje = "La copia de seguridad no se ha realizado correctamente.<br><br>";
$mensaje .= "Compruebe que las rutas a los programas mysqldump y gzip en configuraci&oacute;n est&aacute;n correctamente establecidas ";
$mensaje .= "y que los datos de acceso a la base de datos sean correctos.<br>";
$mensaje .= "mysqldump=[" . MYSQLDUMP . "]<br>";
$mensaje .= "gzip=[" . GZIP . "]";
$this->mensaje = $mensaje;
$this->error = true;
return false;
}
return true;
}
private function copiaImagenes()
{
$copiaImagenes = "tmp/Imagenes.tbz";
$this->imagenes = $copiaImagenes;
if (file_exists($copiaImagenes)) {
unlink($copiaImagenes);
}
$comando = escapeshellcmd('tar cf ' . $copiaImagenes . ' ' . IMAGEDATA);
exec($comando);
if (filesize($copiaImagenes) == 0) {
$this->error = true;
$mensaje = "No se ha podido comprimir el directorio de las imágenes " . IMAGEDATA . "<br>";
$mensaje .= "Compruebe que la ruta de acceso al programa tar en configuraci&oacute;n est&aacute; correctamente establecida";
$this->mensaje = $mensaje;
return false;
}
return true;
}
private function empaqueta()
{
// Empaqueta los dos archivos en el que va a devolver
$nombreCopia = "tmp/Copia" . BASEDATOS . strftime("%Y%m%d%H%M") . ".tar";
if (file_exists($nombreCopia)) {
unlink($nombreCopia);
}
$comando = escapeshellcmd('tar cf ' . $nombreCopia . ' ' . $this->baseDatos . ' ' . $this->imagenes);
exec($comando);
if (filesize($nombreCopia) ==0 || !file_exists($nombreCopia)) {
$this->error = true;
$mensaje = "No se ha creado el paquete con los archivos de imágenes en [<b>" . $this->imagenes . "</b>] y <br>";
$mensaje .= " con el archivo de Base de Datos [<b>" . $this->baseDatos . "</b>]<br><br>";
$mensaje .= "Compruebe que los datos de configuración están correctamente establecidos <br>";
$mensaje .= "El comando de copia fue [" . $comando . "]<br>";
$mensaje .= "gzip=[" . GZIP . "]";
$this->mensaje = $mensaje;
return false;
}
$this->error = false;
unlink ($this->baseDatos);
unlink ($this->imagenes);
$mensaje = 'Copia de seguridad realizada con &eacute;xito.<br><br>Pulse sobre el siguiente enlace para descargar:<br><br>';
$mensaje .= '<a href="' . $nombreCopia . '">Descargar Copia de Seguridad de Datos</a><br><br>';
$mensaje .= 'El paquete de copia contiene un archivo con la copia de la información de la base de datos y un archivo que contiene el directorio de las fotografías e imágenes asociadas a los datos';
$this->mensaje = $mensaje;
return true;
}
public function mensaje ()
{
return $this->mensaje;
}
}
?>

View File

@@ -198,8 +198,8 @@ class Csv {
$mensaje .= $this->panelMensaje('Si se produce cualquier error en el procesamiento del fichero, no se aplicar&aacute; ning&uacute;n cambio en la base de datos.'); $mensaje .= $this->panelMensaje('Si se produce cualquier error en el procesamiento del fichero, no se aplicar&aacute; ning&uacute;n cambio en la base de datos.');
$mensaje .= '<form method="post" name="Aceptar" action="index.php?importacion&opc=ejecutar"> $mensaje .= '<form method="post" name="Aceptar" action="index.php?importacion&opc=ejecutar">
<button type="button" name="Cancelar" value="Cancelar" onClick="location.href=' . "'index.php'" . '" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Cancelar</button> <input type="button" name="Cancelar" value="Cancelar" onClick="location.href=' . "'index.php'" . '" class="btn btn-danger">
<button type="submit" name="Aceptar" class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Aceptar</button> <input type="submit" name="Aceptar" value="Aceptar" class="btn btn-primary">
<input type="hidden" name="ficheroCSV" value="' . $this->nombre . '"> <input type="hidden" name="ficheroCSV" value="' . $this->nombre . '">
</form></center>'; </form></center>';

View File

@@ -70,7 +70,7 @@ class Distribucion {
// if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip')) { // if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip')) {
// // introducimos la cabecera que indica que el contenido está comprimido // // introducimos la cabecera que indica que el contenido está comprimido
// header('Content-Encoding: gzip'); // header('Content-Encoding: gzip');
// // y comprime al máximo la información antes de enviarla // // y comprime al m<EFBFBD>ximo la información antes de enviarla
// return gzencode($pagina, 9); // return gzencode($pagina, 9);
// } // }
return $pagina; // enviamos sin comprimir return $pagina; // enviamos sin comprimir

View File

View File

@@ -1,170 +0,0 @@
<?php
/**
* @package Inventario
* @copyright Copyright (c) 2014, Ricardo Montañana Gómez
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* This file is part of Inventario.
* Inventario 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 3 of the License, or
* (at your option) any later version.
*
* Inventario 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 Inventario. If not, see <http://www.gnu.org/licenses/>.
*
*/
//Para comprimir las imágenes
require_once('Zebra_Image.php');
define("HAYQUEGRABAR", 1);
define("HAYQUEBORRAR", 2);
define("NOHACERNADA", 3);
class Imagen {
private $archivoSubido;
public $archivoComprimido;
private $extension;
private $dirData;
public function __construct()
{
$this->dirData = IMAGEDATA;
}
public function determinaAccion($campo)
{
if (isset($_POST[$campo]) && $_POST[$campo] == "") {
return HAYQUEBORRAR; //Hay que borrar el archivo de imagen
} elseif ($_FILES[$campo]['error'] == 0) {
return HAYQUEGRABAR; //Hay que guardar el archivo de imagen enviado
} else {
return NOHACERNADA; //No hay que hacer nada
}
}
public function procesaEnvio($campo, &$mensaje)
{
try {
// Undefined | Multiple Files | $_FILES Corruption Attack
// If this request falls under any of them, treat it invalid.
if (
!isset($_FILES[$campo]['error']) ||
is_array($_FILES[$campo]['error'])
) {
throw new RuntimeException('Parámetros inválidos.');
}
// Check $_FILES['upfile']['error'] value.
switch ($_FILES[$campo]['error']) {
case UPLOAD_ERR_OK:
break;
case UPLOAD_ERR_NO_FILE:
throw new RuntimeException('No se ha enviado ningún fichero.');
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
throw new RuntimeException('Se ha excedido el tamaño máximo.');
default:
throw new RuntimeException('Error desconocido.');
}
// DO NOT TRUST $_FILES['upfile']['mime'] VALUE !!
// Check MIME Type by yourself.
$finfo = new finfo(FILEINFO_MIME_TYPE);
if (false === $ext = array_search(
$finfo->file($_FILES[$campo]['tmp_name']),
array(
'jpg' => 'image/jpeg',
'png' => 'image/png',
'gif' => 'image/gif',
),
true
)) {
throw new RuntimeException('Formato de imagen inválido, no es {jpg, png, gif}');
}
$this->extension = $ext;
// You should name it uniquely.
// DO NOT USE $_FILES['upfile']['name'] WITHOUT ANY VALIDATION !!
// On this example, obtain safe unique name from its binary data.
$this->archivoSubido = sprintf('tmp/%s.%s', sha1_file($_FILES[$campo]['tmp_name']), $ext);
if (!move_uploaded_file($_FILES[$campo]['tmp_name'], $this->archivoSubido)) {
throw new RuntimeException('Fallo moviendo el archivo subido.');
}
//Todo ha ido correcto
return true;
} catch (RuntimeException $e) {
$mensaje = $e->getMessage();
return false;
}
}
public static function borraImagenId($tabla, $id)
{
$extensiones = array ("png", "gif", "jpg");
foreach ($extensiones as $extension) {
$archivo = IMAGEDATA . "/" . $tabla . "_" . $id . "." . $extension;
if (file_exists($archivo)) {
unlink ($archivo);
}
}
}
public function mueveImagenId($tabla, $id, &$mensaje)
{
if (!$this->comprimeArchivo($tabla . "_" . $id, $mensaje)) {
return false;
} else {
return true;
}
}
private function comprimeArchivo($id, &$mensaje)
{
$zebra = new Zebra_Image();
$zebra->source_path = $this->archivoSubido;
$this->archivoComprimido = $this->dirData . "/" . $id . "." . $this->extension;
$zebra->target_path = $this->archivoComprimido;
$zebra->jpeg_quality = 100;
// some additional properties that can be set
// read about them in the documentation
$zebra->preserve_aspect_ratio = true;
$zebra->enlarge_smaller_images = true;
$zebra->preserve_time = true;
// resize the image to exactly 100x100 pixels by using the "crop from center" method
// (read more in the overview section or in the documentation)
// and if there is an error, check what the error is about
if (!$zebra->resize(640, 480, ZEBRA_IMAGE_CROP_CENTER)) {
// if there was an error, let's see what the error is about
switch ($zebra->error) {
case 1: $mensaje = 'El fichero origen no se ha encontrado!';
break;
case 2: $mensaje = 'No se puede leer el archivo origen ' . $this->archivoSubido;
break;
case 3: $mensaje = 'No se pudo escribir el archivo destino ' . $this->archivoComprimido;
break;
case 4: $mensaje = 'Formato de fichero origen no soportado ' . $this->archivoSubido;
break;
case 5: $mensaje = 'Formato de fichero destino no soportado ' . $this->archivoComprimido;
break;
case 6: $mensaje = 'La versión de la biblioteca GD no soporta el formato de destino ' . $this->archivoComprimido;
break;
case 7: $mensaje = 'La biblioteca GD no está instalada';
break;
case 8: $mensaje = 'el comando "chmod" está deshabilitado por configuración';
break;
}
return false;
} else {
//Borra el archivo subido
unlink($this->archivoSubido);
return true;
}
}
}
?>

View File

@@ -55,32 +55,12 @@ class Importacion {
private function formulario() { private function formulario() {
$accion = "index.php?importacion&opc=importar"; $accion = "index.php?importacion&opc=importar";
$salida .= '<script type="text/javascript" src="css/bootstrap-filestyle.min.js"> </script>'; $salida = '<form enctype="multipart/form-data" name="importacion.form" method="post" action="' . $accion . '">' . "\n";
$salida .='<div class="col-sm-6 col-md-6">';
$salida .= '<form enctype="multipart/form-data" name="importacion.form" method="post" action="' . $accion . '">' . "\n";
$salida .= "<fieldset style=\"width: 96%;\"><p><legend style=\"color: red;\"><b>Elige Archivo</b></legend>\n"; $salida .= "<fieldset style=\"width: 96%;\"><p><legend style=\"color: red;\"><b>Elige Archivo</b></legend>\n";
//$salida .= '<input type="file" name="fichero" id="fichero" onChange="seleccionFichero(this);" class="filestyle" data-classButton="btn btn-primary">'; $salida .= '<input type="file" name="fichero" id="fichero" onChange="seleccionFichero(this);">';
//$salida .= '<input type="file" name="fichero" id="fichero" onChange="seleccionFichero(this);">'; $salida .= '<p align="center"><button class="btn btn-primary" type=submit>Aceptar</button></p><br>' . "\n";
//$salida .= '<input type="file" class="filestyle" data-input="false">'; $mensaje = utf8_decode('Sólo se permiten archivos con extensión CSV');
$salida .= '<div class="fileinput fileinput-new" data-provides="fileinput"> $salida .= "<script type='text/javascript'>
<div class="input-group">
<div class="form-control" data-trigger="fileinput">
<i class="glyphicon glyphicon-file fileinput-exists"></i>
<span class="fileinput-filename"></span>
</div>
<span class="input-group-addon btn btn-default btn-file">
<span class="fileinput-new">
<span class="glyphicon glyphicon-folder-open"></span> Selecciona fichero</span>
<span class="fileinput-exists">Cambiar</span><input type="file" name="fichero" id="fichero" onChange="seleccionFichero(this);"></span>
<a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Eliminar</a>
</div>
</div>';
$salida .= '<p align="center"><button class="btn btn-primary" type=submit><span class="glyphicon glyphicon-cloud-upload"></span> Aceptar</button></p><br>' . "\n";
$salida .= '</div>';
$mensaje = 'Sólo se permiten archivos con extensión CSV';
$salida .= "<script type='text/javascript'>".'
//$(":file").filestyle({classButton: "btn btn-primary"});'."
function seleccionFichero(obj) { function seleccionFichero(obj) {
var filePath = obj.value; var filePath = obj.value;

View File

@@ -147,7 +147,7 @@ class InformeInventario {
} }
private function listaUbicaciones() { private function listaUbicaciones() {
$salida = "<select class=\"selectpicker show-tick\" name=\"id\" data-live-search=\"true\" data-width=\"auto\">\n"; $salida = "<select class=\"form-control\" name=\"id\">\n";
$comando = "select * from Ubicaciones order by Descripcion"; $comando = "select * from Ubicaciones order by Descripcion";
$resultado = $this->bdd->ejecuta($comando); $resultado = $this->bdd->ejecuta($comando);
if (!$resultado) { if (!$resultado) {
@@ -161,7 +161,7 @@ class InformeInventario {
} }
private function listaArticulos() { private function listaArticulos() {
$salida = "<select class=\"selectpicker show-tick\" name=\"id\" data-live-search=\"true\" data-width=\"auto\">\n"; $salida = "<select class=\"form-control\" name=\"id\">\n";
$comando = "select * from Articulos order by descripcion, marca, modelo"; $comando = "select * from Articulos order by descripcion, marca, modelo";
$resultado = $this->bdd->ejecuta($comando); $resultado = $this->bdd->ejecuta($comando);
if (!$resultado) { if (!$resultado) {
@@ -175,18 +175,16 @@ class InformeInventario {
} }
private function formulario($accion, $etiqueta, $lista) { private function formulario($accion, $etiqueta, $lista) {
$salida ='<div class="col-sm-6 col-md-6"><form name="informeInventario.form" method="post" action="' . $accion . '">' . "\n"; $salida = '<div class="col-sm-2 col-md-6"><form name="informeInventario.form" method="post" action="' . $accion . '">' . "\n";
$salida.="<fieldset style=\"width: 96%;\"><p><legend style=\"color: red;\"><b>Elige $etiqueta</b></legend>\n"; $salida.="<fieldset style=\"width: 96%;\"><p><legend style=\"color: red;\"><b>Elige $etiqueta</b></legend>\n";
$salida.="<br><br><label>$etiqueta</label>"; $salida.="<br><br><label>$etiqueta</label>";
$salida.=$lista; $salida.=$lista;
$salida.="<br><br> $salida.="<br><br><label for='salida'>Salida del informe por:</label>";
<label for='salida'>Salida del informe por:</label>"; $salida.='<div class="radio"><label><input type="radio" name="salida" value="pantalla" checked>Pantalla</label></div>';
$salida.='<div class="radio"><label><input type="radio" name="salida" value="pantalla" checked><span class="glyphicon glyphicon-list-alt"></span> Pantalla</label></div>'; $salida.='<div class="radio"><label><input type="radio" name="salida" value="csv">Archivo CSV</label></div>';
$salida.='<div class="radio"><label><input type="radio" name="salida" value="csv"><span class="glyphicon glyphicon-cloud-download"></span> Archivo CSV</label></div>'; $salida.='<div class="radio"><label><input type="radio" name="salida" value="etiquetas">Etiquetas</label></div>';
$salida.='<div class="radio"><label><input type="radio" name="salida" value="etiquetas"><span class="glyphicon glyphicon-qrcode"></span> Etiquetas</label></div>';
$salida.="<br><br></fieldset><p>"; $salida.="<br><br></fieldset><p>";
$salida.='<p align="center"><button type=submit class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Aceptar</button></p><br></div>' . "\n"; $salida.='<p align="center"><button type=submit class="btn btn-primary">Aceptar</button></p><br></div>' . "\n";
$salida.="<script>$('.selectpicker').selectpicker();</script>";
return $salida; return $salida;
} }

View File

@@ -104,7 +104,7 @@ class Inventario {
$_SESSION['Usuario'] = $this->usuario; $_SESSION['Usuario'] = $this->usuario;
$_SESSION['Perfil'] = $this->perfil; $_SESSION['Perfil'] = $this->perfil;
// y enviamos la cookie para reconocerlo la próxima vez // y enviamos la cookie para reconocerlo la próxima vez
setcookie('InventarioId', $resultado, time() + 3600 * 24 * 365); setcookie('InventarioId', $resultado, time() + 3600 * 24);
// Lo enviamos a la página de bienvenida // Lo enviamos a la página de bienvenida
header('Location: index.php?bienvenido'); header('Location: index.php?bienvenido');
exit; exit;
@@ -124,10 +124,22 @@ class Inventario {
// Creamos un objeto Distribución facilitándole el // Creamos un objeto Distribución facilitándole el
// nombre del archivo plantilla y el objeto que aportará // nombre del archivo plantilla y el objeto que aportará
// el contenido // el contenido
$opc = $_GET['opc'];
list($opcion, $parametro) = explode("&", $this->opcActual);
switch ($opc) {
case 'informe':
$enlace = 'xml/informe' . ucfirst($opcion) . '.xml';
//$enlace="tmp/inventarioUbicacion.xml";
$informe = new InformePDF($this->bdd, $enlace, $this->registrado);
$informe->crea($enlace);
$informe->cierraPDF();
$informe->imprimeInforme();
return;
default:
$salida = new Distribucion($this->plant, $this->creaContenido()); $salida = new Distribucion($this->plant, $this->creaContenido());
echo $salida->procesaPlantilla(); echo $salida->procesaPlantilla();
break; break;
}
} }
} }

View File

@@ -206,11 +206,6 @@ class Mantenimiento {
$this->campoBusca = $dato[1]; $this->campoBusca = $dato[1];
$valor = '<a title="Inventario de ' . $valor . '" $target="_blank" href="index.php?informeInventario&opc=listar' . $datoEnlace . '&id=' . $id . '">' . $valor; $valor = '<a title="Inventario de ' . $valor . '" $target="_blank" href="index.php?informeInventario&opc=listar' . $datoEnlace . '&id=' . $id . '">' . $valor;
} }
if (strstr($this->campos[$clave]['Comment'], "imagen") && isset($valor)) {
$msj = '<button class="btn btn-info btn-xs" type="button" data-toggle="modal" data-target="#mensajeModal' . $id .'">Imagen</button>';
$msj .= $this->creaModal($valor, $id);
$valor = $msj;
}
if ($this->campos[$clave]['Type'] == "Boolean(1)") { if ($this->campos[$clave]['Type'] == "Boolean(1)") {
$checked = $valor == '1' ? 'checked' : ''; $checked = $valor == '1' ? 'checked' : '';
$valor = '<input type="checkbox" disabled ' . $checked . '>'; $valor = '<input type="checkbox" disabled ' . $checked . '>';
@@ -260,9 +255,7 @@ class Mantenimiento {
$za = '<a href="' . $za . '"><img alt="desc" title="Orden descendente" src="img/' . ESTILO . '/descendente.png"></a>'; $za = '<a href="' . $za . '"><img alt="desc" title="Orden descendente" src="img/' . ESTILO . '/descendente.png"></a>';
$this->restoreURL(); $this->restoreURL();
if ($this->perfil['Informe']) { if ($this->perfil['Informe']) {
$this->datosURL['opc'] = "informe"; $informe = '<a href="index.php?' . $tabla . '&opc=informe" target="_blank"><img src="img/' . ESTILO . '/informe.png" alt="informe" title="Informe pdf"></a>';
$inf = $this->montaURL();
$informe = '<a href="' . $inf . '" target="_blank"><img src="img/' . ESTILO . '/informe.png" alt="informe" title="Informe pdf"></a>';
} else { } else {
$informe = ""; $informe = "";
} }
@@ -302,8 +295,6 @@ class Mantenimiento {
} }
$this->datosURL['opc'] = 'inicial'; $this->datosURL['opc'] = 'inicial';
$this->datosURL['id'] = null; $this->datosURL['id'] = null;
//Comprueba si existe la imagen en datos para borrarla.
Imagen::borraImagenId($this->tabla, $id);
$url = $this->montaURL(); $url = $this->montaURL();
header('Location: ' . $url); header('Location: ' . $url);
return; return;
@@ -314,7 +305,6 @@ class Mantenimiento {
$comando = "insert into " . $this->tabla . " ("; $comando = "insert into " . $this->tabla . " (";
$lista = explode("&", $_POST['listacampos']); $lista = explode("&", $_POST['listacampos']);
$primero = true; $primero = true;
$hayImagen = false;
//Añade la lista de campos //Añade la lista de campos
foreach ($lista as $campo) { foreach ($lista as $campo) {
if ($campo == "") { if ($campo == "") {
@@ -346,47 +336,20 @@ class Mantenimiento {
$valor = "0"; $valor = "0";
} }
$valor = $_POST[$campo] == "on" ? '1' : $valor; $valor = $_POST[$campo] == "on" ? '1' : $valor;
} else {
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
//procesa el envío de la imagen
$imagen = new Imagen();
$accion = $imagen->determinaAccion($campo);
if ($accion != NOHACERNADA) {
$mensaje = "";
if (!$imagen->procesaEnvio($campo, $mensaje)) {
return $this->panelMensaje($mensaje, "danger", "ERROR PROCESANDO IMAGEN");
}
$hayImagen = true;
$campoImagen = $campo;
} else {
$valor = "null";
}
} else { } else {
$valor = $_POST[$campo] == "" ? "null" : '"' . $_POST[$campo] . '"'; $valor = $_POST[$campo] == "" ? "null" : '"' . $_POST[$campo] . '"';
} }
}
$comando.="$coma " . $valor; $comando.="$coma " . $valor;
} }
$comando.=")"; $comando.=")";
if (!$this->bdd->ejecuta($comando)) { if (!$this->bdd->ejecuta($comando)) {
return $this->errorBD($comando); return $this->errorBD($comando);
} }
$id = $this->bdd->ultimoId();
if ($hayImagen) {
//Tiene que recuperar el id del registro insertado y actualizar el archivo de imagen
if (!$imagen->mueveImagenId($this->tabla, $id, $mensaje)) {
return $this->panelMensaje($mensaje, "danger", "ERROR COMPRIMIENDO IMAGEN");
}
$comando = "update " . $this->tabla . " set " . $campoImagen . "='" . $imagen->archivoComprimido . "' where id='" . $id ."';";
if (!$this->bdd->ejecuta($comando)) {
return $this->errorBD($comando);
}
}
$this->datosURL['opc'] = 'inicial'; $this->datosURL['opc'] = 'inicial';
$this->datosURL['id'] = null; $this->datosURL['id'] = null;
$cabecera = "refresh:".PAUSA.";url=".$this->montaURL(); $cabecera = "refresh:".PAUSA.";url=".$this->montaURL();
header($cabecera); header($cabecera);
return $this->panelMensaje("Se ha insertado el registro con la clave " . $id, "info", "Informaci&oacute;n"); return $this->panelMensaje("Se ha insertado el registro con la clave " . $this->bdd->ultimoId(), "info", "Informaci&oacute;n");
//return "<h1><a href=\"".$this->montaURL()."\">Se ha insertado el registro con la clave " . $this->bdd->ultimoId() . "</a></h1>"; //return "<h1><a href=\"".$this->montaURL()."\">Se ha insertado el registro con la clave " . $this->bdd->ultimoId() . "</a></h1>";
} }
@@ -416,29 +379,6 @@ class Mantenimiento {
} }
$valor = $_POST[$campo] == "on" ? '1' : $valor; $valor = $_POST[$campo] == "on" ? '1' : $valor;
$comando.=$coma . ' ' . $campo . '="' . $valor . '"'; $comando.=$coma . ' ' . $campo . '="' . $valor . '"';
} else {
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
$valor = $_POST[$campo];
$imagen = new Imagen();
$accion = $imagen->determinaAccion($campo);
if ($accion != NOHACERNADA) {
if ($accion == HAYQUEGRABAR) {
$mensaje = "";
if (!$imagen->procesaEnvio($campo, $mensaje)) {
return $this->panelMensaje($mensaje, "danger", "ERROR PROCESANDO IMAGEN");
}
$mensaje = "";
if (!$imagen->mueveImagenId($this->tabla, $this->datosURL['id'], $mensaje)) {
return $this->panelMensaje($mensaje, "danger", "ERROR COMPRIMIENDO IMAGEN");
}
$comando .= "$coma $campo='" . $imagen->archivoComprimido . "'";
} else {
//Hay que borrar
Imagen::borraImagenId($this->tabla, $this->datosURL['id']);
$extensiones = array("png", "jpg", "gif");
$comando .= "$coma $campo=null";
}
}
} else { } else {
if (strlen(trim($_POST[$campo])) == 0) { if (strlen(trim($_POST[$campo])) == 0) {
$comando.="$coma $campo=null"; $comando.="$coma $campo=null";
@@ -447,7 +387,6 @@ class Mantenimiento {
} }
} }
} }
}
$comando.=" where id=\"" . $this->datosURL['id'] . "\""; $comando.=" where id=\"" . $this->datosURL['id'] . "\"";
if (!$this->bdd->ejecuta($comando)) { if (!$this->bdd->ejecuta($comando)) {
return $this->errorBD($comando); return $this->errorBD($comando);
@@ -479,8 +418,7 @@ class Mantenimiento {
//tabla a la cual pertenece la clave foránea. //tabla a la cual pertenece la clave foránea.
protected function generaLista($datos, $campo, $valorInicial, $modo) protected function generaLista($datos, $campo, $valorInicial, $modo)
{ {
$modoEfectivo = $modo == "readonly" ? "disabled" : ""; $salida = "<select class=\"form-control\" name=\"$campo\">\n";
$salida = "<select class=\"selectpicker show-tick\" data-live-search=\"true\" data-width=\"auto\" name=\"$campo\" $modoEfectivo>\n";
list($tabla, $atributos) = explode(",", $datos); list($tabla, $atributos) = explode(",", $datos);
$atributos = str_replace("/", ",", $atributos); $atributos = str_replace("/", ",", $atributos);
// Elimina las llaves // Elimina las llaves
@@ -490,6 +428,7 @@ class Mantenimiento {
if (!$resultado) { if (!$resultado) {
return $this->errorBD($comando); return $this->errorBD($comando);
} }
$modoEfectivo = $modo == "readonly" ? "disabled" : "";
$primero = true; $primero = true;
while ($fila = $this->bdd->procesaResultado()) { while ($fila = $this->bdd->procesaResultado()) {
foreach ($fila as $clave => $valor) { foreach ($fila as $clave => $valor) {
@@ -508,7 +447,6 @@ class Mantenimiento {
} }
} }
$salida.="</select>\n<br><br>"; $salida.="</select>\n<br><br>";
$salida.="<script>$('.selectpicker').selectpicker();</script>";
return $salida; return $salida;
} }
@@ -540,12 +478,6 @@ class Mantenimiento {
{ {
//$salida = '<p align="center"><table border=1 class="tablaDatos"><tbody>'; //$salida = '<p align="center"><table border=1 class="tablaDatos"><tbody>';
$salida = '<p align="center"><table border=1 class="table table-striped table-bordered table-condensed table-hover"><tbody>'; $salida = '<p align="center"><table border=1 class="table table-striped table-bordered table-condensed table-hover"><tbody>';
if ($this->datosURL['sentido'] == 'asc') {
$sentidoFlecha = 'down';
} else {
$sentidoFlecha = 'up';
}
$flecha = '<span class="glyphicon glyphicon-chevron-'.$sentidoFlecha.'"></span>';
foreach ($this->campos as $clave => $datos) { foreach ($this->campos as $clave => $datos) {
$comen = explode(",", $datos["Comment"]); $comen = explode(",", $datos["Comment"]);
$ordenable = false; $ordenable = false;
@@ -562,12 +494,10 @@ class Mantenimiento {
$clave = str_ireplace("descripcion", "Descripci&oacute;n", $clave); $clave = str_ireplace("descripcion", "Descripci&oacute;n", $clave);
$clave = str_ireplace("ubicacion", "Ubicaci&oacute;n", $clave); $clave = str_ireplace("ubicacion", "Ubicaci&oacute;n", $clave);
$clave = str_ireplace("articulo", "Art&iacute;culo", $clave); $clave = str_ireplace("articulo", "Art&iacute;culo", $clave);
$ordenActual = $this->datosURL['orden'];
if ($ordenable) { if ($ordenable) {
$this->backupURL(); $this->backupURL();
$this->datosURL['orden'] = $clave2; $this->datosURL['orden'] = $clave2;
$resFlecha = $clave2 == $ordenActual ? $flecha : ''; $salida.="<th><b><a title=\"Establece orden por $clave \" href=\"". $this->montaURL() . "\"> " . ucfirst($clave) . " </a></b></th>\n";
$salida.="<th><b><a title=\"Establece orden por $clave \" href=\"". $this->montaURL() . "\"> " . ucfirst($clave) . $resFlecha . " </a></b></th>\n";
$this->restoreURL(); $this->restoreURL();
} else { } else {
$salida.='<th><b>' . ucfirst($clave) . '</b></th>' . "\n"; $salida.='<th><b>' . ucfirst($clave) . '</b></th>' . "\n";
@@ -600,7 +530,7 @@ class Mantenimiento {
break; break;
} }
$accion = $this->montaURL(); $accion = $this->montaURL();
$salida.='<div class="col-sm-8"><form name="mantenimiento.form" enctype="multipart/form-data" class="form-horizontal" role="form" method="post" action="' . $accion . '">' . "\n"; $salida.='<div class="col-sm-8"><form name="mantenimiento.form" class="form-horizontal" role="form" method="post" action="' . $accion . '">' . "\n";
$salida.="<fieldset style=\"width: 96%;\"><p><legend style=\"color: red;\"><b>$tipo</b></legend>\n"; $salida.="<fieldset style=\"width: 96%;\"><p><legend style=\"color: red;\"><b>$tipo</b></legend>\n";
foreach ($this->campos as $clave => $valor) { foreach ($this->campos as $clave => $valor) {
if ($valor["Editable"] == "no") { if ($valor["Editable"] == "no") {
@@ -637,7 +567,6 @@ class Mantenimiento {
<input type="text" name="' . $campo . '" data-format="YYYY/MM/DD" value="' . $valorDato . '" ' . $modoEfectivo . ' class="form-control" /> <input type="text" name="' . $campo . '" data-format="YYYY/MM/DD" value="' . $valorDato . '" ' . $modoEfectivo . ' class="form-control" />
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span> <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>'; </div>';
if ($modo != "readonly") {
$salida .= '<script type="text/javascript"> $salida .= '<script type="text/javascript">
$(function () { $(function () {
$(' . "'#datetimepicker" . $nfechas . "').datetimepicker({ $(' . "'#datetimepicker" . $nfechas . "').datetimepicker({
@@ -647,7 +576,6 @@ class Mantenimiento {
}); });
}); });
</script>"; </script>";
}
$salida .= "</div></div>"; $salida .= "</div></div>";
continue; continue;
} else { } else {
@@ -664,14 +592,6 @@ class Mantenimiento {
$salida .= '</div></div>'; $salida .= '</div></div>';
continue; continue;
} }
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
$salida .= $this->creaCampoImagen($campo, $valorDato, $tipo);
continue;
}
if (stristr($this->campos[$campo]['Type'], "int")) {
$tipo_campo = "number";
$modoEfectivo .= ' onkeypress = "if ( isNaN(this.value + String.fromCharCode(event.keyCode) )) return false;" ';
}
//Si no es una clave foránea añade un campo de texto normal //Si no es una clave foránea añade un campo de texto normal
$salida.='<input class="form-control" type="' . $tipo_campo . '" name="' . $campo . '" value="' . $valorDato . $salida.='<input class="form-control" type="' . $tipo_campo . '" name="' . $campo . '" value="' . $valorDato .
'" maxlength="' . $tamano . '" size="' . (string) (intval($tamano) + 5) . '" ' . $modoEfectivo . " ><br><br>\n"; '" maxlength="' . $tamano . '" size="' . (string) (intval($tamano) + 5) . '" ' . $modoEfectivo . " ><br><br>\n";
@@ -686,65 +606,13 @@ class Mantenimiento {
$salida .= "</fieldset><p>"; $salida .= "</fieldset><p>";
$salida .= '<center>'; $salida .= '<center>';
$this->datosURL['opc'] = 'inicial'; $this->datosURL['opc'] = 'inicial';
$salida .= '<button type="button" onClick="location.href=' . "'" . $this->montaURL() . "'" . '" class="btn btn-info"><span class="glyphicon glyphicon-arrow-left"></span> Volver</button>'; $salida .= '<button type="button" onClick="location.href=' . "'" . $this->montaURL() . "'" . '" class="btn btn-info">Volver</button>';
$salida .= '&nbsp;&nbsp;<button type="reset" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Cancelar</button>'; $salida .= '&nbsp;&nbsp;<button type="reset" class="btn btn-danger">Cancelar</button>';
$salida .= '&nbsp;&nbsp;<button type=submit class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Aceptar</button>'; $salida .= '&nbsp;&nbsp;<button type=submit class="btn btn-primary">Aceptar</button>';
$salida .= '<br></center></div>'; $salida .= '<br></center></div>';
return $salida; return $salida;
} }
protected function creaCampoImagen($campo, $valor, $tipoAccion)
{
if (file_exists($valor)) {
//El fichero existe.
$existe = true;
$tipo = "fileinput-exists";
} else {
$tipo = "fileinput-new";
$existe = false;
}
$mensaje = '
<div class="fileinput ' . $tipo . '" data-provides="fileinput">
<div class="fileinput-new thumbnail" style="width: 200px; height: 150px;"><img src="img/sinImagen.gif" /></div>
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;">';
if ($existe) {
$mensaje .= '<img src="' . $valor . '" onclick="$('."'#mensajeModal1'".').modal();">';
}
$mensaje .= '</div>';
if ($tipoAccion == ANADIR || $tipoAccion == EDICION) {
$mensaje .= '<div>
<span class="btn btn-default btn-file" ><span class="fileinput-new">Añadir</span><span class="fileinput-exists">Cambiar</span><input type="file" name="imagen" /></span>
<a href="#" class="btn btn-default fileinput-exists" data-dismiss="fileinput">Eliminar</a>';
}
if ($existe) {
$mensaje .='<input type="hidden" name="' . $campo . '" value="' . $valor . '">';
}
$mensaje .='</div>';
if ($tipoAccion == ANADIR || $tipoAccion == EDICION) {
$mensaje .= '</div>';
}
$mensaje .= $this->creaModal($valor, 1);
return $mensaje;
}
private function creaModal($valor, $id)
{
$mensaje .= '
<div id="mensajeModal'.$id.'" class="modal fade " tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog text-center">
<div class="modal-content text-center">
<img src="' . $valor . '" class="img-responsive">
<label>Archivo: ' . $valor . '</label>
</div>
</div>
</div>';
return $mensaje;
}
protected function errorBD($comando, $texto = "", $tipo = "danger", $cabecera = "&iexcl;Atenci&oacute;n!") protected function errorBD($comando, $texto = "", $tipo = "danger", $cabecera = "&iexcl;Atenci&oacute;n!")
{ {
if (!$texto) { if (!$texto) {
@@ -764,7 +632,6 @@ class Mantenimiento {
$mensaje .= '</div>'; $mensaje .= '</div>';
return $mensaje; return $mensaje;
} }
} }
?> ?>

View File

@@ -44,9 +44,7 @@ class Menu {
if ($tipo==2) if ($tipo==2)
$salida.='<li class="active"><a href="'.$enlace.'" target="'.$destino.'" title="'.$titulo.'">'.$opcion.'</a><br /></li>'; $salida.='<li class="active"><a href="'.$enlace.'" target="'.$destino.'" title="'.$titulo.'">'.$opcion.'</a><br /></li>';
else else
$salida.= $salida.='<label class="key">'.$opcion.'</label><br/>';
//'<span class="label label-default">'.$opcion.'</span><br>';
'<label class="">'.$opcion.'</label><br/>';
} }
return $salida; return $salida;
} }

View File

@@ -161,7 +161,7 @@ class Pdf_mysql_table extends Fpdf
function Table($query,$prop=array()) function Table($query,$prop=array())
{ {
//Issue query //Issue query
$res=$this->bdd->query($query) or die('Error: '.$this->bdd->error."<BR>Query: $query"); $res=$this->bdd->query($query) or die('Error: '.$this->bdd->mysql_error()."<BR>Query: $query");
//Add all columns if none was specified //Add all columns if none was specified
if(count($this->aCols)==0) if(count($this->aCols)==0)
{ {

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,29 +0,0 @@
/*
* Translated default messages for bootstrap-select.
* Locale: ES (Spanish)
* Region: CL (Chile)
*/
(function($) {
$.fn.selectpicker.defaults = {
style: 'btn-default',
size: 'auto',
title: null,
selectedTextFormat : 'values',
noneSelectedText : 'No hay selección',
noneResultsText : 'No hay resultados',
countSelectedText : 'Seleccionados {0} de {1}',
maxOptionsText: ['Límite alcanzado ({n} {var} max)', 'Límite del grupo alcanzado({n} {var} max)', ['elementos','element']],
width: false,
container: false,
hideDisabled: false,
showSubtext: false,
showIcon: true,
showContent: true,
dropupAuto: true,
header: false,
liveSearch: false,
multipleSeparator: ', ',
iconBase: 'glyphicon',
tickIcon: 'glyphicon-ok'
};
}(jQuery));

View File

@@ -1,6 +0,0 @@
/*
* Translated default messages for bootstrap-select.
* Locale: ES (Spanish)
* Region: CL (Chile)
*/
(function(e){e.fn.selectpicker.defaults={style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",noneSelectedText:"No hay selección",noneResultsText:"No hay resultados",countSelectedText:"Seleccionados {0} de {1}",maxOptionsText:["Límite alcanzado ({n} {var} max)","Límite del grupo alcanzado({n} {var} max)",["elementos","element"]],width:false,container:false,hideDisabled:false,showSubtext:false,showIcon:true,showContent:true,dropupAuto:true,header:false,liveSearch:false,multipleSeparator:", ",iconBase:"glyphicon",tickIcon:"glyphicon-ok"}})(jQuery)

View File

@@ -1,30 +0,0 @@
/*
* Translated default messages for bootstrap-select.
* Locale: EU (Basque)
* Region:
*/
(function($) {
$.fn.selectpicker.defaults = {
style: 'btn-default',
size: 'auto',
title: null,
selectedTextFormat : 'values',
noneSelectedText : 'Hautapenik ez',
noneResultsText : 'Emaitzarik ez',
countSelectedText : '{1}(e)tik {0} hautatuta',
maxOptionsText: ['Mugara iritsita ({n} {var} gehienez)', 'Taldearen mugara iritsita ({n} {var} gehienez)', ['elementu','elementu']],
width: false,
container: false,
hideDisabled: false,
showSubtext: false,
showIcon: true,
showContent: true,
dropupAuto: true,
header: false,
liveSearch: false,
multipleSeparator: ', ',
iconBase: 'glyphicon',
tickIcon: 'glyphicon-ok'
};
}(jQuery));

View File

@@ -1,6 +0,0 @@
/*
* Translated default messages for bootstrap-select.
* Locale: EU (Basque)
* Region:
*/
(function(e){e.fn.selectpicker.defaults={style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",noneSelectedText:"Hautapenik ez",noneResultsText:"Emaitzarik ez",countSelectedText:"{1}(e)tik {0} hautatuta",maxOptionsText:["Mugara iritsita ({n} {var} gehienez)","Taldearen mugara iritsita ({n} {var} gehienez)",["elementu","elementu"]],width:false,container:false,hideDisabled:false,showSubtext:false,showIcon:true,showContent:true,dropupAuto:true,header:false,liveSearch:false,multipleSeparator:", ",iconBase:"glyphicon",tickIcon:"glyphicon-ok"}})(jQuery)

View File

@@ -1,33 +0,0 @@
/*
* Translated default messages for bootstrap-select.
* Locale: PT (Portuguese; português)
* Region: BR (Brazil; Brasil)
* Author: Rodrigo de Avila <rodrigo@avila.net.br>
*/
(function($) {
$.fn.selectpicker.defaults = {
style: 'btn-default',
size: 'auto',
title: null,
selectedTextFormat : 'values',
noneSelectedText : 'Nada selecionado',
noneResultsText : 'Nada encontrado contendo',
countSelectedText : 'Selecionado {0} de {1}',
maxOptionsText: ['Limite excedido (máx. {n} {var})', 'Limite do grupo excedido (máx. {n} {var})', ['itens','item']],
width: false,
container: false,
hideDisabled: false,
showSubtext: false,
showIcon: true,
showContent: true,
dropupAuto: true,
header: false,
liveSearch: false,
actionsBox: false,
multipleSeparator: ', ',
iconBase: 'glyphicon',
tickIcon: 'glyphicon-ok',
maxOptions: false
};
}(jQuery));

View File

@@ -1,7 +0,0 @@
/*
* Translated default messages for bootstrap-select.
* Locale: PT (Portuguese; português)
* Region: BR (Brazil; Brasil)
* Author: Rodrigo de Avila <rodrigo@avila.net.br>
*/
!function(a){a.fn.selectpicker.defaults={style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",noneSelectedText:"Nada selecionado",noneResultsText:"Nada encontrado contendo",countSelectedText:"Selecionado {0} de {1}",maxOptionsText:["Limite excedido (m\xe1x. {n} {var})","Limite do grupo excedido (m\xe1x. {n} {var})",["itens","item"]],width:!1,container:!1,hideDisabled:!1,showSubtext:!1,showIcon:!0,showContent:!0,dropupAuto:!0,header:!1,liveSearch:!1,actionsBox:!1,multipleSeparator:", ",iconBase:"glyphicon",tickIcon:"glyphicon-ok",maxOptions:!1}}(jQuery);

View File

@@ -1,31 +0,0 @@
/*
* Translated default messages for bootstrap-select.
* Locale: RU (Russian; русский)
* Region: RU (Russian Federation)
*/
(function($) {
$.fn.selectpicker.defaults = {
style: 'btn-default',
size: 'auto',
title: null,
selectedTextFormat : 'values',
noneSelectedText : 'Ничего не выбрано',
noneResultsText : 'Не нейдено совпадений',
countSelectedText : 'Выбрано {0} из {1}',
maxOptionsText: ['Достигнут предел ({n} {var} максимум)', 'Достигнут предел в группе ({n} {var} максимум)', ['items','item']],
width: false,
container: false,
hideDisabled: false,
showSubtext: false,
showIcon: true,
showContent: true,
dropupAuto: true,
header: false,
liveSearch: false,
actionsBox: false,
multipleSeparator: ', ',
iconBase: 'glyphicon',
tickIcon: 'glyphicon-ok',
maxOptions: false
};
}(jQuery));

View File

@@ -1,6 +0,0 @@
/*
* Translated default messages for bootstrap-select.
* Locale: RU (Russian; русский)
* Region: RU (Russian Federation)
*/
(function(e){e.fn.selectpicker.defaults={style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",noneSelectedText:"Ничего не выбрано",noneResultsText:"Не нейдено совпадений",countSelectedText:"Выбрано {0} из {1}",maxOptionsText:["Достигнут предел ({n} {var} максимум)","Достигнут предел в группе ({n} {var} максимум)",["items","item"]],width:false,container:false,hideDisabled:false,showSubtext:false,showIcon:true,showContent:true,dropupAuto:true,header:false,liveSearch:false,actionsBox:false,multipleSeparator:", ",iconBase:"glyphicon",tickIcon:"glyphicon-ok",maxOptions:false}})(jQuery)

View File

@@ -226,4 +226,5 @@
<glyph unicode="&#xe199;" d="M100 200h400v-155l-75 -45h350l-75 45v155h400l-270 300h170l-270 300h170l-300 333l-300 -333h170l-270 -300h170z" /> <glyph unicode="&#xe199;" d="M100 200h400v-155l-75 -45h350l-75 45v155h400l-270 300h170l-270 300h170l-300 333l-300 -333h170l-270 -300h170z" />
<glyph unicode="&#xe200;" d="M121 700q0 -53 28.5 -97t75.5 -65q-4 -16 -4 -38q0 -74 52.5 -126.5t126.5 -52.5q56 0 100 30v-306l-75 -45h350l-75 45v306q46 -30 100 -30q74 0 126.5 52.5t52.5 126.5q0 24 -9 55q50 32 79.5 83t29.5 112q0 90 -61.5 155.5t-150.5 71.5q-26 89 -99.5 145.5 t-167.5 56.5q-116 0 -197.5 -81.5t-81.5 -197.5q0 -4 1 -11.5t1 -11.5q-14 2 -23 2q-74 0 -126.5 -52.5t-52.5 -126.5z" /> <glyph unicode="&#xe200;" d="M121 700q0 -53 28.5 -97t75.5 -65q-4 -16 -4 -38q0 -74 52.5 -126.5t126.5 -52.5q56 0 100 30v-306l-75 -45h350l-75 45v306q46 -30 100 -30q74 0 126.5 52.5t52.5 126.5q0 24 -9 55q50 32 79.5 83t29.5 112q0 90 -61.5 155.5t-150.5 71.5q-26 89 -99.5 145.5 t-167.5 56.5q-116 0 -197.5 -81.5t-81.5 -197.5q0 -4 1 -11.5t1 -11.5q-14 2 -23 2q-74 0 -126.5 -52.5t-52.5 -126.5z" />
</font> </font>
</defs></svg> </defs>
</svg>

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

@@ -4,7 +4,9 @@
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/ */
if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') } if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
/* ======================================================================== /* ========================================================================
* Bootstrap: transition.js v3.1.1 * Bootstrap: transition.js v3.1.1
@@ -43,8 +45,13 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
// http://blog.alexmaccaw.com/css-transitions // http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function(duration) { $.fn.emulateTransitionEnd = function(duration) {
var called = false, $el = this var called = false, $el = this
$(this).one($.support.transition.end, function () { called = true }) $(this).one($.support.transition.end, function() {
var callback = function () { if (!called) $($el).trigger($.support.transition.end) } called = true
})
var callback = function() {
if (!called)
$($el).trigger($.support.transition.end)
}
setTimeout(callback, duration) setTimeout(callback, duration)
return this return this
} }
@@ -86,7 +93,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $parent = $(selector) var $parent = $(selector)
if (e) e.preventDefault() if (e)
e.preventDefault()
if (!$parent.length) { if (!$parent.length) {
$parent = $this.hasClass('alert') ? $this : $this.parent() $parent = $this.hasClass('alert') ? $this : $this.parent()
@@ -94,7 +102,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
$parent.trigger(e = $.Event('close.bs.alert')) $parent.trigger(e = $.Event('close.bs.alert'))
if (e.isDefaultPrevented()) return if (e.isDefaultPrevented())
return
$parent.removeClass('in') $parent.removeClass('in')
@@ -120,8 +129,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $this = $(this) var $this = $(this)
var data = $this.data('bs.alert') var data = $this.data('bs.alert')
if (!data) $this.data('bs.alert', (data = new Alert(this))) if (!data)
if (typeof option == 'string') data[option].call($this) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string')
data[option].call($this)
}) })
} }
@@ -177,7 +188,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
state = state + 'Text' state = state + 'Text'
if (!data.resetText) $el.data('resetText', $el[val]()) if (!data.resetText)
$el.data('resetText', $el[val]())
$el[val](data[state] || this.options[state]) $el[val](data[state] || this.options[state])
@@ -200,13 +212,17 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
if ($parent.length) { if ($parent.length) {
var $input = this.$element.find('input') var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') { if ($input.prop('type') == 'radio') {
if ($input.prop('checked') && this.$element.hasClass('active')) changed = false if ($input.prop('checked') && this.$element.hasClass('active'))
else $parent.find('.active').removeClass('active') changed = false
else
$parent.find('.active').removeClass('active')
} }
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') if (changed)
$input.prop('checked', !this.$element.hasClass('active')).trigger('change')
} }
if (changed) this.$element.toggleClass('active') if (changed)
this.$element.toggleClass('active')
} }
@@ -221,10 +237,13 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var data = $this.data('bs.button') var data = $this.data('bs.button')
var options = typeof option == 'object' && option var options = typeof option == 'object' && option
if (!data) $this.data('bs.button', (data = new Button(this, options))) if (!data)
$this.data('bs.button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle() if (option == 'toggle')
else if (option) data.setState(option) data.toggle()
else if (option)
data.setState(option)
}) })
} }
@@ -245,7 +264,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
$(document).on('click.bs.button.data-api', '[data-toggle^=button]', function(e) { $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function(e) {
var $btn = $(e.target) var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') if (!$btn.hasClass('btn'))
$btn = $btn.closest('.btn')
$btn.button('toggle') $btn.button('toggle')
e.preventDefault() e.preventDefault()
}) })
@@ -311,10 +331,15 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var that = this var that = this
var activeIndex = this.getActiveIndex() var activeIndex = this.getActiveIndex()
if (pos > (this.$items.length - 1) || pos < 0) return if (pos > (this.$items.length - 1) || pos < 0)
return
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) if (this.sliding)
if (activeIndex == pos) return this.pause().cycle() return this.$element.one('slid.bs.carousel', function() {
that.to(pos)
})
if (activeIndex == pos)
return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
} }
@@ -333,12 +358,14 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
} }
Carousel.prototype.next = function() { Carousel.prototype.next = function() {
if (this.sliding) return if (this.sliding)
return
return this.slide('next') return this.slide('next')
} }
Carousel.prototype.prev = function() { Carousel.prototype.prev = function() {
if (this.sliding) return if (this.sliding)
return
return this.slide('prev') return this.slide('prev')
} }
@@ -351,15 +378,18 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var that = this var that = this
if (!$next.length) { if (!$next.length) {
if (!this.options.wrap) return if (!this.options.wrap)
return
$next = this.$element.find('.item')[fallback]() $next = this.$element.find('.item')[fallback]()
} }
if ($next.hasClass('active')) return this.sliding = false if ($next.hasClass('active'))
return this.sliding = false
var e = $.Event('slide.bs.carousel', {relatedTarget: $next[0], direction: direction}) var e = $.Event('slide.bs.carousel', {relatedTarget: $next[0], direction: direction})
this.$element.trigger(e) this.$element.trigger(e)
if (e.isDefaultPrevented()) return if (e.isDefaultPrevented())
return
this.sliding = true this.sliding = true
@@ -383,7 +413,9 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
$next.removeClass([type, direction].join(' ')).addClass('active') $next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' ')) $active.removeClass(['active', direction].join(' '))
that.sliding = false that.sliding = false
setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) setTimeout(function() {
that.$element.trigger('slid.bs.carousel')
}, 0)
}) })
.emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000) .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
} else { } else {
@@ -411,10 +443,14 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
var action = typeof option == 'string' ? option : options.slide var action = typeof option == 'string' ? option : options.slide
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) if (!data)
if (typeof option == 'number') data.to(option) $this.data('bs.carousel', (data = new Carousel(this, options)))
else if (action) data[action]() if (typeof option == 'number')
else if (options.interval) data.pause().cycle() data.to(option)
else if (action)
data[action]()
else if (options.interval)
data.pause().cycle()
}) })
} }
@@ -438,7 +474,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
var options = $.extend({}, $target.data(), $this.data()) var options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to') var slideIndex = $this.attr('data-slide-to')
if (slideIndex) options.interval = false if (slideIndex)
options.interval = false
$target.carousel(options) $target.carousel(options)
@@ -478,8 +515,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
this.options = $.extend({}, Collapse.DEFAULTS, options) this.options = $.extend({}, Collapse.DEFAULTS, options)
this.transitioning = null this.transitioning = null
if (this.options.parent) this.$parent = $(this.options.parent) if (this.options.parent)
if (this.options.toggle) this.toggle() this.$parent = $(this.options.parent)
if (this.options.toggle)
this.toggle()
} }
Collapse.DEFAULTS = { Collapse.DEFAULTS = {
@@ -492,17 +531,20 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
} }
Collapse.prototype.show = function() { Collapse.prototype.show = function() {
if (this.transitioning || this.$element.hasClass('in')) return if (this.transitioning || this.$element.hasClass('in'))
return
var startEvent = $.Event('show.bs.collapse') var startEvent = $.Event('show.bs.collapse')
this.$element.trigger(startEvent) this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return if (startEvent.isDefaultPrevented())
return
var actives = this.$parent && this.$parent.find('> .panel > .in') var actives = this.$parent && this.$parent.find('> .panel > .in')
if (actives && actives.length) { if (actives && actives.length) {
var hasData = actives.data('bs.collapse') var hasData = actives.data('bs.collapse')
if (hasData && hasData.transitioning) return if (hasData && hasData.transitioning)
return
actives.collapse('hide') actives.collapse('hide')
hasData || actives.data('bs.collapse', null) hasData || actives.data('bs.collapse', null)
} }
@@ -525,7 +567,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
this.$element.trigger('shown.bs.collapse') this.$element.trigger('shown.bs.collapse')
} }
if (!$.support.transition) return complete.call(this) if (!$.support.transition)
return complete.call(this)
var scrollSize = $.camelCase(['scroll', dimension].join('-')) var scrollSize = $.camelCase(['scroll', dimension].join('-'))
@@ -536,11 +579,13 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
} }
Collapse.prototype.hide = function() { Collapse.prototype.hide = function() {
if (this.transitioning || !this.$element.hasClass('in')) return if (this.transitioning || !this.$element.hasClass('in'))
return
var startEvent = $.Event('hide.bs.collapse') var startEvent = $.Event('hide.bs.collapse')
this.$element.trigger(startEvent) this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return if (startEvent.isDefaultPrevented())
return
var dimension = this.dimension() var dimension = this.dimension()
@@ -563,7 +608,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
.addClass('collapse') .addClass('collapse')
} }
if (!$.support.transition) return complete.call(this) if (!$.support.transition)
return complete.call(this)
this.$element this.$element
[dimension](0) [dimension](0)
@@ -587,9 +633,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var data = $this.data('bs.collapse') var data = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data && options.toggle && option == 'show') option = !option if (!data && options.toggle && option == 'show')
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) option = !option
if (typeof option == 'string') data[option]() if (!data)
$this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string')
data[option]()
}) })
} }
@@ -620,7 +669,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $parent = parent && $(parent) var $parent = parent && $(parent)
if (!data || !data.transitioning) { if (!data || !data.transitioning) {
if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed') if ($parent)
$parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
} }
@@ -653,7 +703,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
Dropdown.prototype.toggle = function(e) { Dropdown.prototype.toggle = function(e) {
var $this = $(this) var $this = $(this)
if ($this.is('.disabled, :disabled')) return if ($this.is('.disabled, :disabled'))
return
var $parent = getParent($this) var $parent = getParent($this)
var isActive = $parent.hasClass('open') var isActive = $parent.hasClass('open')
@@ -669,7 +720,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var relatedTarget = {relatedTarget: this} var relatedTarget = {relatedTarget: this}
$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return if (e.isDefaultPrevented())
return
$parent $parent
.toggleClass('open') .toggleClass('open')
@@ -682,33 +734,40 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
} }
Dropdown.prototype.keydown = function(e) { Dropdown.prototype.keydown = function(e) {
if (!/(38|40|27)/.test(e.keyCode)) return if (!/(38|40|27)/.test(e.keyCode))
return
var $this = $(this) var $this = $(this)
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
if ($this.is('.disabled, :disabled')) return if ($this.is('.disabled, :disabled'))
return
var $parent = getParent($this) var $parent = getParent($this)
var isActive = $parent.hasClass('open') var isActive = $parent.hasClass('open')
if (!isActive || (isActive && e.keyCode == 27)) { if (!isActive || (isActive && e.keyCode == 27)) {
if (e.which == 27) $parent.find(toggle).focus() if (e.which == 27)
$parent.find(toggle).focus()
return $this.click() return $this.click()
} }
var desc = ' li:not(.divider):visible a' var desc = ' li:not(.divider):visible a'
var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc) var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)
if (!$items.length) return if (!$items.length)
return
var index = $items.index($items.filter(':focus')) var index = $items.index($items.filter(':focus'))
if (e.keyCode == 38 && index > 0) index-- // up if (e.keyCode == 38 && index > 0)
if (e.keyCode == 40 && index < $items.length - 1) index++ // down index-- // up
if (!~index) index = 0 if (e.keyCode == 40 && index < $items.length - 1)
index++ // down
if (!~index)
index = 0
$items.eq(index).focus() $items.eq(index).focus()
} }
@@ -718,9 +777,11 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
$(toggle).each(function() { $(toggle).each(function() {
var $parent = getParent($(this)) var $parent = getParent($(this))
var relatedTarget = {relatedTarget: this} var relatedTarget = {relatedTarget: this}
if (!$parent.hasClass('open')) return if (!$parent.hasClass('open'))
return
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return if (e.isDefaultPrevented())
return
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget) $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
}) })
} }
@@ -749,8 +810,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $this = $(this) var $this = $(this)
var data = $this.data('bs.dropdown') var data = $this.data('bs.dropdown')
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) if (!data)
if (typeof option == 'string') data[option].call($this) $this.data('bs.dropdown', (data = new Dropdown(this)))
if (typeof option == 'string')
data[option].call($this)
}) })
} }
@@ -771,7 +834,9 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
$(document) $(document)
.on('click.bs.dropdown.data-api', clearMenus) .on('click.bs.dropdown.data-api', clearMenus)
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.bs.dropdown.data-api', '.dropdown form', function(e) {
e.stopPropagation()
})
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown) .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)
@@ -823,7 +888,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
this.$element.trigger(e) this.$element.trigger(e)
if (this.isShown || e.isDefaultPrevented()) return if (this.isShown || e.isDefaultPrevented())
return
this.isShown = true this.isShown = true
@@ -865,13 +931,15 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
} }
Modal.prototype.hide = function(e) { Modal.prototype.hide = function(e) {
if (e) e.preventDefault() if (e)
e.preventDefault()
e = $.Event('hide.bs.modal') e = $.Event('hide.bs.modal')
this.$element.trigger(e) this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return if (!this.isShown || e.isDefaultPrevented())
return
this.isShown = false this.isShown = false
@@ -935,17 +1003,20 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
.appendTo(document.body) .appendTo(document.body)
this.$element.on('click.dismiss.bs.modal', $.proxy(function(e) { this.$element.on('click.dismiss.bs.modal', $.proxy(function(e) {
if (e.target !== e.currentTarget) return if (e.target !== e.currentTarget)
return
this.options.backdrop == 'static' this.options.backdrop == 'static'
? this.$element[0].focus.call(this.$element[0]) ? this.$element[0].focus.call(this.$element[0])
: this.hide.call(this) : this.hide.call(this)
}, this)) }, this))
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow if (doAnimate)
this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in') this.$backdrop.addClass('in')
if (!callback) return if (!callback)
return
doAnimate ? doAnimate ?
this.$backdrop this.$backdrop
@@ -979,9 +1050,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var data = $this.data('bs.modal') var data = $this.data('bs.modal')
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.modal', (data = new Modal(this, options))) if (!data)
if (typeof option == 'string') data[option](_relatedTarget) $this.data('bs.modal', (data = new Modal(this, options)))
else if (options.show) data.show(_relatedTarget) if (typeof option == 'string')
data[option](_relatedTarget)
else if (options.show)
data.show(_relatedTarget)
}) })
} }
@@ -1006,7 +1080,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
var option = $target.data('bs.modal') ? 'toggle' : $.extend({remote: !/#/.test(href) && href}, $target.data(), $this.data()) var option = $target.data('bs.modal') ? 'toggle' : $.extend({remote: !/#/.test(href) && href}, $target.data(), $this.data())
if ($this.is('a')) e.preventDefault() if ($this.is('a'))
e.preventDefault()
$target $target
.modal(option, this) .modal(option, this)
@@ -1016,8 +1091,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}) })
$(document) $(document)
.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') }) .on('show.bs.modal', '.modal', function() {
.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') }) $(document.body).addClass('modal-open')
})
.on('hidden.bs.modal', '.modal', function() {
$(document.body).removeClass('modal-open')
})
}(jQuery); }(jQuery);
@@ -1109,7 +1188,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var defaults = this.getDefaults() var defaults = this.getDefaults()
this._options && $.each(this._options, function(key, value) { this._options && $.each(this._options, function(key, value) {
if (defaults[key] != value) options[key] = value if (defaults[key] != value)
options[key] = value
}) })
return options return options
@@ -1123,10 +1203,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
self.hoverState = 'in' self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show() if (!self.options.delay || !self.options.delay.show)
return self.show()
self.timeout = setTimeout(function() { self.timeout = setTimeout(function() {
if (self.hoverState == 'in') self.show() if (self.hoverState == 'in')
self.show()
}, self.options.delay.show) }, self.options.delay.show)
} }
@@ -1138,10 +1220,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
self.hoverState = 'out' self.hoverState = 'out'
if (!self.options.delay || !self.options.delay.hide) return self.hide() if (!self.options.delay || !self.options.delay.hide)
return self.hide()
self.timeout = setTimeout(function() { self.timeout = setTimeout(function() {
if (self.hoverState == 'out') self.hide() if (self.hoverState == 'out')
self.hide()
}, self.options.delay.hide) }, self.options.delay.hide)
} }
@@ -1151,14 +1235,16 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
if (this.hasContent() && this.enabled) { if (this.hasContent() && this.enabled) {
this.$element.trigger(e) this.$element.trigger(e)
if (e.isDefaultPrevented()) return if (e.isDefaultPrevented())
return
var that = this; var that = this;
var $tip = this.tip() var $tip = this.tip()
this.setContent() this.setContent()
if (this.options.animation) $tip.addClass('fade') if (this.options.animation)
$tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ? var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement.call(this, $tip[0], this.$element[0]) :
@@ -1166,7 +1252,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var autoToken = /\s?auto?\s?/i var autoToken = /\s?auto?\s?/i
var autoPlace = autoToken.test(placement) var autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top' if (autoPlace)
placement = placement.replace(autoToken, '') || 'top'
$tip $tip
.detach() .detach()
@@ -1227,8 +1314,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var marginLeft = parseInt($tip.css('margin-left'), 10) var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9 // we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0 if (isNaN(marginTop))
if (isNaN(marginLeft)) marginLeft = 0 marginTop = 0
if (isNaN(marginLeft))
marginLeft = 0
offset.top = offset.top + marginTop offset.top = offset.top + marginTop
offset.left = offset.left + marginLeft offset.left = offset.left + marginLeft
@@ -1273,7 +1362,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
this.replaceArrow(actualHeight - height, actualHeight, 'top') this.replaceArrow(actualHeight - height, actualHeight, 'top')
} }
if (replace) $tip.offset(offset) if (replace)
$tip.offset(offset)
} }
Tooltip.prototype.replaceArrow = function(delta, dimension, position) { Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
@@ -1294,13 +1384,15 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var e = $.Event('hide.bs.' + this.type) var e = $.Event('hide.bs.' + this.type)
function complete() { function complete() {
if (that.hoverState != 'in') $tip.detach() if (that.hoverState != 'in')
$tip.detach()
that.$element.trigger('hidden.bs.' + that.type) that.$element.trigger('hidden.bs.' + that.type)
} }
this.$element.trigger(e) this.$element.trigger(e)
if (e.isDefaultPrevented()) return if (e.isDefaultPrevented())
return
$tip.removeClass('in') $tip.removeClass('in')
@@ -1402,9 +1494,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var data = $this.data('bs.tooltip') var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option var options = typeof option == 'object' && option
if (!data && option == 'destroy') return if (!data && option == 'destroy')
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) return
if (typeof option == 'string') data[option]() if (!data)
$this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string')
data[option]()
}) })
} }
@@ -1440,7 +1535,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
this.init('popover', element, options) this.init('popover', element, options)
} }
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') if (!$.fn.tooltip)
throw new Error('Popover requires tooltip.js')
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right', placement: 'right',
@@ -1475,7 +1571,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents. // this manually by checking the contents.
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() if (!$tip.find('.popover-title').html())
$tip.find('.popover-title').hide()
} }
Popover.prototype.hasContent = function() { Popover.prototype.hasContent = function() {
@@ -1497,7 +1594,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
} }
Popover.prototype.tip = function() { Popover.prototype.tip = function() {
if (!this.$tip) this.$tip = $(this.options.template) if (!this.$tip)
this.$tip = $(this.options.template)
return this.$tip return this.$tip
} }
@@ -1513,9 +1611,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var data = $this.data('bs.popover') var data = $this.data('bs.popover')
var options = typeof option == 'object' && option var options = typeof option == 'object' && option
if (!data && option == 'destroy') return if (!data && option == 'destroy')
if (!data) $this.data('bs.popover', (data = new Popover(this, options))) return
if (typeof option == 'string') data[option]() if (!data)
$this.data('bs.popover', (data = new Popover(this, options)))
if (typeof option == 'string')
data[option]()
}) })
} }
@@ -1589,7 +1690,9 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
&& $href.is(':visible') && $href.is(':visible')
&& [[$href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href]]) || null && [[$href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href]]) || null
}) })
.sort(function (a, b) { return a[0] - b[0] }) .sort(function(a, b) {
return a[0] - b[0]
})
.each(function() { .each(function() {
self.offsets.push(this[0]) self.offsets.push(this[0])
self.targets.push(this[1]) self.targets.push(this[1])
@@ -1657,8 +1760,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var data = $this.data('bs.scrollspy') var data = $this.data('bs.scrollspy')
var options = typeof option == 'object' && option var options = typeof option == 'object' && option
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) if (!data)
if (typeof option == 'string') data[option]() $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string')
data[option]()
}) })
} }
@@ -1715,7 +1820,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
} }
if ($this.parent('li').hasClass('active')) return if ($this.parent('li').hasClass('active'))
return
var previous = $ul.find('.active:last a')[0] var previous = $ul.find('.active:last a')[0]
var e = $.Event('show.bs.tab', { var e = $.Event('show.bs.tab', {
@@ -1724,7 +1830,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
$this.trigger(e) $this.trigger(e)
if (e.isDefaultPrevented()) return if (e.isDefaultPrevented())
return
var $target = $(selector) var $target = $(selector)
@@ -1785,8 +1892,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $this = $(this) var $this = $(this)
var data = $this.data('bs.tab') var data = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this))) if (!data)
if (typeof option == 'string') data[option]() $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string')
data[option]()
}) })
} }
@@ -1848,7 +1957,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
} }
Affix.prototype.getPinnedOffset = function() { Affix.prototype.getPinnedOffset = function() {
if (this.pinnedOffset) return this.pinnedOffset if (this.pinnedOffset)
return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix') this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$window.scrollTop() var scrollTop = this.$window.scrollTop()
var position = this.$element.offset() var position = this.$element.offset()
@@ -1860,7 +1970,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
} }
Affix.prototype.checkPosition = function() { Affix.prototype.checkPosition = function() {
if (!this.$element.is(':visible')) return if (!this.$element.is(':visible'))
return
var scrollHeight = $(document).height() var scrollHeight = $(document).height()
var scrollTop = this.$window.scrollTop() var scrollTop = this.$window.scrollTop()
@@ -1869,25 +1980,32 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var offsetTop = offset.top var offsetTop = offset.top
var offsetBottom = offset.bottom var offsetBottom = offset.bottom
if (this.affixed == 'top') position.top += scrollTop if (this.affixed == 'top')
position.top += scrollTop
if (typeof offset != 'object') offsetBottom = offsetTop = offset if (typeof offset != 'object')
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) offsetBottom = offsetTop = offset
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) if (typeof offsetTop == 'function')
offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function')
offsetBottom = offset.bottom(this.$element)
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
if (this.affixed === affix) return if (this.affixed === affix)
if (this.unpin) this.$element.css('top', '') return
if (this.unpin)
this.$element.css('top', '')
var affixType = 'affix' + (affix ? '-' + affix : '') var affixType = 'affix' + (affix ? '-' + affix : '')
var e = $.Event(affixType + '.bs.affix') var e = $.Event(affixType + '.bs.affix')
this.$element.trigger(e) this.$element.trigger(e)
if (e.isDefaultPrevented()) return if (e.isDefaultPrevented())
return
this.affixed = affix this.affixed = affix
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
@@ -1914,8 +2032,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var data = $this.data('bs.affix') var data = $this.data('bs.affix')
var options = typeof option == 'object' && option var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options))) if (!data)
if (typeof option == 'string') data[option]() $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string')
data[option]()
}) })
} }
@@ -1941,8 +2061,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
data.offset = data.offset || {} data.offset = data.offset || {}
if (data.offsetBottom) data.offset.bottom = data.offsetBottom if (data.offsetBottom)
if (data.offsetTop) data.offset.top = data.offsetTop data.offset.bottom = data.offsetBottom
if (data.offsetTop)
data.offset.top = data.offsetTop
$spy.affix(data) $spy.affix(data)
}) })

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2309
css/jquery.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -22,7 +22,6 @@
*/ */
SimpleColorPicker.prototype = { SimpleColorPicker.prototype = {
constructor: SimpleColorPicker, constructor: SimpleColorPicker,
init: function(type, select, options) { init: function(type, select, options) {
var self = this; var self = this;
@@ -103,7 +102,6 @@
} }
}); });
}, },
/** /**
* Changes the selected color. * Changes the selected color.
* *
@@ -122,7 +120,6 @@
console.error("The given color '" + color + "' could not be found"); console.error("The given color '" + color + "' could not be found");
} }
}, },
showPicker: function() { showPicker: function() {
var pos = this.$icon.offset(); var pos = this.$icon.offset();
this.$picker.css({ this.$picker.css({
@@ -133,11 +130,9 @@
this.$picker.show(this.options.pickerDelay); this.$picker.show(this.options.pickerDelay);
}, },
hidePicker: function() { hidePicker: function() {
this.$picker.hide(this.options.pickerDelay); this.$picker.hide(this.options.pickerDelay);
}, },
/** /**
* Selects the given span inside $colorList. * Selects the given span inside $colorList.
* *
@@ -161,7 +156,6 @@
// Change HTML select value // Change HTML select value
this.$select.val(color); this.$select.val(color);
}, },
/** /**
* The user clicked on a color inside $colorList. * The user clicked on a color inside $colorList.
*/ */
@@ -172,7 +166,6 @@
this.$select.trigger('change'); this.$select.trigger('change');
} }
}, },
/** /**
* Prevents the mousedown event from "eating" the click event. * Prevents the mousedown event from "eating" the click event.
*/ */
@@ -180,7 +173,6 @@
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
}, },
destroy: function() { destroy: function() {
if (this.options.picker === true) { if (this.options.picker === true) {
this.$icon.off('.' + this.type); this.$icon.off('.' + this.type);
@@ -224,10 +216,8 @@
$.fn.simplecolorpicker.defaults = { $.fn.simplecolorpicker.defaults = {
// No theme by default // No theme by default
theme: '', theme: '',
// Show the picker or make it inline // Show the picker or make it inline
picker: false, picker: false,
// Animation delay in milliseconds // Animation delay in milliseconds
pickerDelay: 0 pickerDelay: 0
}; };

794
css/moment.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Courier'; $name = 'Courier';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Courier-Bold'; $name = 'Courier-Bold';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Courier-BoldOblique'; $name = 'Courier-BoldOblique';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Courier-Oblique'; $name = 'Courier-Oblique';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Helvetica'; $name = 'Helvetica';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Helvetica-Bold'; $name = 'Helvetica-Bold';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Helvetica-BoldOblique'; $name = 'Helvetica-BoldOblique';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Helvetica-Oblique'; $name = 'Helvetica-Oblique';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
/* * ***************************************************************************** /* * *****************************************************************************
* Utility to generate font definition files * * Utility to generate font definition files *
* * * *
@@ -15,18 +16,15 @@ function ReadMap($enc)
if (empty($a)) if (empty($a))
die('<b>Error:</b> encoding not found: ' . $enc); die('<b>Error:</b> encoding not found: ' . $enc);
$cc2gn = array(); $cc2gn = array();
foreach($a as $l) foreach ($a as $l) {
{ if ($l[0] == '!') {
if($l[0]=='!')
{
$e = preg_split('/[ \\t]+/', rtrim($l)); $e = preg_split('/[ \\t]+/', rtrim($l));
$cc = hexdec(substr($e[0], 1)); $cc = hexdec(substr($e[0], 1));
$gn = $e[2]; $gn = $e[2];
$cc2gn[$cc] = $gn; $cc2gn[$cc] = $gn;
} }
} }
for($i=0;$i<=255;$i++) for ($i = 0; $i <= 255; $i++) {
{
if (!isset($cc2gn[$i])) if (!isset($cc2gn[$i]))
$cc2gn[$i] = '.notdef'; $cc2gn[$i] = '.notdef';
} }
@@ -49,37 +47,30 @@ function ReadAFM($file, &$map)
'Tcedilla' => 'Tcommaaccent', 'tcedilla' => 'tcommaaccent', 'Dslash' => 'Dcroat', 'dslash' => 'dcroat', 'Dmacron' => 'Dcroat', 'dmacron' => 'dcroat', 'Tcedilla' => 'Tcommaaccent', 'tcedilla' => 'tcommaaccent', 'Dslash' => 'Dcroat', 'dslash' => 'dcroat', 'Dmacron' => 'Dcroat', 'dmacron' => 'dcroat',
'combininggraveaccent' => 'gravecomb', 'combininghookabove' => 'hookabovecomb', 'combiningtildeaccent' => 'tildecomb', 'combininggraveaccent' => 'gravecomb', 'combininghookabove' => 'hookabovecomb', 'combiningtildeaccent' => 'tildecomb',
'combiningacuteaccent' => 'acutecomb', 'combiningdotbelow' => 'dotbelowcomb', 'dongsign' => 'dong'); 'combiningacuteaccent' => 'acutecomb', 'combiningdotbelow' => 'dotbelowcomb', 'dongsign' => 'dong');
foreach($a as $l) foreach ($a as $l) {
{
$e = explode(' ', rtrim($l)); $e = explode(' ', rtrim($l));
if (count($e) < 2) if (count($e) < 2)
continue; continue;
$code = $e[0]; $code = $e[0];
$param = $e[1]; $param = $e[1];
if($code=='C') if ($code == 'C') {
{
//Character metrics //Character metrics
$cc = (int) $e[1]; $cc = (int) $e[1];
$w = $e[4]; $w = $e[4];
$gn = $e[7]; $gn = $e[7];
if (substr($gn, -4) == '20AC') if (substr($gn, -4) == '20AC')
$gn = 'Euro'; $gn = 'Euro';
if(isset($fix[$gn])) if (isset($fix[$gn])) {
{
//Fix incorrect glyph name //Fix incorrect glyph name
foreach($map as $c=>$n) foreach ($map as $c => $n) {
{
if ($n == $fix[$gn]) if ($n == $fix[$gn])
$map[$c] = $gn; $map[$c] = $gn;
} }
} }
if(empty($map)) if (empty($map)) {
{
//Symbolic font: use built-in encoding //Symbolic font: use built-in encoding
$widths[$cc] = $w; $widths[$cc] = $w;
} } else {
else
{
$widths[$gn] = $w; $widths[$gn] = $w;
if ($gn == 'X') if ($gn == 'X')
$fm['CapXHeight'] = $e[13]; $fm['CapXHeight'] = $e[13];
@@ -112,17 +103,14 @@ function ReadAFM($file, &$map)
} }
if (!isset($fm['FontName'])) if (!isset($fm['FontName']))
die('FontName not found'); die('FontName not found');
if(!empty($map)) if (!empty($map)) {
{
if (!isset($widths['.notdef'])) if (!isset($widths['.notdef']))
$widths['.notdef'] = 600; $widths['.notdef'] = 600;
if (!isset($widths['Delta']) && isset($widths['increment'])) if (!isset($widths['Delta']) && isset($widths['increment']))
$widths['Delta'] = $widths['increment']; $widths['Delta'] = $widths['increment'];
//Order widths according to map //Order widths according to map
for($i=0;$i<=255;$i++) for ($i = 0; $i <= 255; $i++) {
{ if (!isset($widths[$map[$i]])) {
if(!isset($widths[$map[$i]]))
{
echo '<b>Warning:</b> character ' . $map[$i] . ' is missing<br>'; echo '<b>Warning:</b> character ' . $map[$i] . ' is missing<br>';
$widths[$i] = $widths['.notdef']; $widths[$i] = $widths['.notdef'];
} }
@@ -190,8 +178,7 @@ function MakeWidthArray($fm)
//Make character width array //Make character width array
$s = "array(\n\t"; $s = "array(\n\t";
$cw = $fm['Widths']; $cw = $fm['Widths'];
for($i=0;$i<=255;$i++) for ($i = 0; $i <= 255; $i++) {
{
if (chr($i) == "'") if (chr($i) == "'")
$s.="'\\''"; $s.="'\\''";
elseif (chr($i) == "\\") elseif (chr($i) == "\\")
@@ -216,10 +203,8 @@ function MakeFontEncoding($map)
$ref = ReadMap('cp1252'); $ref = ReadMap('cp1252');
$s = ''; $s = '';
$last = 0; $last = 0;
for($i=32;$i<=255;$i++) for ($i = 32; $i <= 255; $i++) {
{ if ($map[$i] != $ref[$i]) {
if($map[$i]!=$ref[$i])
{
if ($i != $last + 1) if ($i != $last + 1)
$s.=$i . ' '; $s.=$i . ' ';
$last = $i; $last = $i;
@@ -262,17 +247,14 @@ function CheckTTF($file)
fseek($f, 6, SEEK_CUR); fseek($f, 6, SEEK_CUR);
//Seek OS/2 table //Seek OS/2 table
$found = false; $found = false;
for($i=0;$i<$nb;$i++) for ($i = 0; $i < $nb; $i++) {
{ if (fread($f, 4) == 'OS/2') {
if(fread($f,4)=='OS/2')
{
$found = true; $found = true;
break; break;
} }
fseek($f, 12, SEEK_CUR); fseek($f, 12, SEEK_CUR);
} }
if(!$found) if (!$found) {
{
fclose($f); fclose($f);
return; return;
} }
@@ -297,14 +279,14 @@ function CheckTTF($file)
* patch: optional patch for encoding * * patch: optional patch for encoding *
* type: font type if fontfile is empty * * type: font type if fontfile is empty *
* ***************************************************************************** */ * ***************************************************************************** */
function MakeFont($fontfile, $afmfile, $enc = 'cp1252', $patch = array(), $type = 'TrueType') function MakeFont($fontfile, $afmfile, $enc = 'cp1252', $patch = array(), $type = 'TrueType')
{ {
//Generate a font definition file //Generate a font definition file
if (get_magic_quotes_runtime()) if (get_magic_quotes_runtime())
@set_magic_quotes_runtime(0); @set_magic_quotes_runtime(0);
ini_set('auto_detect_line_endings', '1'); ini_set('auto_detect_line_endings', '1');
if($enc) if ($enc) {
{
$map = ReadMap($enc); $map = ReadMap($enc);
foreach ($patch as $cc => $gn) foreach ($patch as $cc => $gn)
$map[$cc] = $gn; $map[$cc] = $gn;
@@ -320,8 +302,7 @@ function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='Tru
$diff = ''; $diff = '';
$fd = MakeFontDescriptor($fm, empty($map)); $fd = MakeFontDescriptor($fm, empty($map));
//Find font type //Find font type
if($fontfile) if ($fontfile) {
{
$ext = strtolower(substr($fontfile, -3)); $ext = strtolower(substr($fontfile, -3));
if ($ext == 'ttf') if ($ext == 'ttf')
$type = 'TrueType'; $type = 'TrueType';
@@ -330,8 +311,7 @@ function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='Tru
else else
die('<b>Error:</b> unrecognized font file extension: ' . $ext); die('<b>Error:</b> unrecognized font file extension: ' . $ext);
} }
else else {
{
if ($type != 'TrueType' && $type != 'Type1') if ($type != 'TrueType' && $type != 'Type1')
die('<b>Error:</b> incorrect font type: ' . $type); die('<b>Error:</b> incorrect font type: ' . $type);
} }
@@ -351,8 +331,7 @@ function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='Tru
$s.='$enc=\'' . $enc . "';\n"; $s.='$enc=\'' . $enc . "';\n";
$s.='$diff=\'' . $diff . "';\n"; $s.='$diff=\'' . $diff . "';\n";
$basename = substr(basename($afmfile), 0, -4); $basename = substr(basename($afmfile), 0, -4);
if($fontfile) if ($fontfile) {
{
//Embedded font //Embedded font
if (!file_exists($fontfile)) if (!file_exists($fontfile))
die('<b>Error:</b> font file not found: ' . $fontfile); die('<b>Error:</b> font file not found: ' . $fontfile);
@@ -363,12 +342,10 @@ function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='Tru
die('<b>Error:</b> Can\'t open ' . $fontfile); die('<b>Error:</b> Can\'t open ' . $fontfile);
$file = fread($f, filesize($fontfile)); $file = fread($f, filesize($fontfile));
fclose($f); fclose($f);
if($type=='Type1') if ($type == 'Type1') {
{
//Find first two sections and discard third one //Find first two sections and discard third one
$header = (ord($file[0]) == 128); $header = (ord($file[0]) == 128);
if($header) if ($header) {
{
//Strip first binary header //Strip first binary header
$file = substr($file, 6); $file = substr($file, 6);
} }
@@ -376,8 +353,7 @@ function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='Tru
if (!$pos) if (!$pos)
die('<b>Error:</b> font file does not seem to be valid Type1'); die('<b>Error:</b> font file does not seem to be valid Type1');
$size1 = $pos + 6; $size1 = $pos + 6;
if($header && ord($file[$size1])==128) if ($header && ord($file[$size1]) == 128) {
{
//Strip second binary header //Strip second binary header
$file = substr($file, 0, $size1) . substr($file, $size1 + 6); $file = substr($file, 0, $size1) . substr($file, $size1 + 6);
} }
@@ -387,28 +363,23 @@ function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='Tru
$size2 = $pos - $size1; $size2 = $pos - $size1;
$file = substr($file, 0, $size1 + $size2); $file = substr($file, 0, $size1 + $size2);
} }
if(function_exists('gzcompress')) if (function_exists('gzcompress')) {
{
$cmp = $basename . '.z'; $cmp = $basename . '.z';
SaveToFile($cmp, gzcompress($file), 'b'); SaveToFile($cmp, gzcompress($file), 'b');
$s.='$file=\'' . $cmp . "';\n"; $s.='$file=\'' . $cmp . "';\n";
echo 'Font file compressed (' . $cmp . ')<br>'; echo 'Font file compressed (' . $cmp . ')<br>';
} } else {
else
{
$s.='$file=\'' . basename($fontfile) . "';\n"; $s.='$file=\'' . basename($fontfile) . "';\n";
echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>'; echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>';
} }
if($type=='Type1') if ($type == 'Type1') {
{
$s.='$size1=' . $size1 . ";\n"; $s.='$size1=' . $size1 . ";\n";
$s.='$size2=' . $size2 . ";\n"; $s.='$size2=' . $size2 . ";\n";
} }
else else
$s.='$originalsize=' . filesize($fontfile) . ";\n"; $s.='$originalsize=' . filesize($fontfile) . ";\n";
} }
else else {
{
//Not embedded font //Not embedded font
$s.='$file=' . "'';\n"; $s.='$file=' . "'';\n";
} }
@@ -416,4 +387,5 @@ function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='Tru
SaveToFile($basename . '.php', $s, 't'); SaveToFile($basename . '.php', $s, 't');
echo 'Font definition file generated (' . $basename . '.php' . ')<br>'; echo 'Font definition file generated (' . $basename . '.php' . ')<br>';
} }
?> ?>

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Symbol'; $name = 'Symbol';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Times-Roman'; $name = 'Times-Roman';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Times-Bold'; $name = 'Times-Bold';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Times-BoldItalic'; $name = 'Times-BoldItalic';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'Times-Italic'; $name = 'Times-Italic';
$up = -100; $up = -100;

View File

@@ -1,4 +1,5 @@
<?php <?php
$type = 'Core'; $type = 'Core';
$name = 'ZapfDingbats'; $name = 'ZapfDingbats';
$up = -100; $up = -100;

1804
fpdf.php Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 B

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 769 B

After

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 661 B

View File

@@ -24,7 +24,6 @@
require_once 'version.inc'; require_once 'version.inc';
define('SERVIDOR', 'localhost'); //Ubicación del servidor MySQL define('SERVIDOR', 'localhost'); //Ubicación del servidor MySQL
define('PUERTO', '3306'); //Puerto donde se conecta a MySQL
define('BASEDATOS', 'Inventario2'); //Nombre de la base de datos. define('BASEDATOS', 'Inventario2'); //Nombre de la base de datos.
define('BASEDATOSTEST', 'Inventario_test'); //Base de datos para los tests. define('BASEDATOSTEST', 'Inventario_test'); //Base de datos para los tests.
define('USUARIO', 'test'); //Usuario con permisos de lectura/escritura en la base de datos define('USUARIO', 'test'); //Usuario con permisos de lectura/escritura en la base de datos
@@ -35,9 +34,8 @@ define('NUMFILAS', '17'); // Número de registros a mostrar en las pantallas de
define('PAUSA', '2'); //Nº segundos de pausa para mostrar mensaje id insertado define('PAUSA', '2'); //Nº segundos de pausa para mostrar mensaje id insertado
define('ESTILO', 'personal'); //Estilo de los iconos de edición (personal, personal, personal) define('ESTILO', 'personal'); //Estilo de los iconos de edición (personal, personal, personal)
define('PLANTILLA', 'bootstrap'); //Estilo de la plantilla y recursos a utilizar define('PLANTILLA', 'bootstrap'); //Estilo de la plantilla y recursos a utilizar
define('COLORLAT', '#a4bdfc'); //Color de la barra de menú lateral define('COLORLAT', '#46d6db'); //Color de la barra de menú lateral
define('COLORFON', '#ffb878'); //Color del fondo de la pantalla define('COLORFON', '#a4bdfc'); //Color del fondo de la pantalla
define('MYSQLDUMP', '/usr/local/bin/mysqldump'); //camino a mysqldump define('MYSQLDUMP', '/usr/local/bin/mysqldump'); //camino a mysqldump
define('GZIP', '/usr/bin/gzip'); //Camino a gzip define('GZIP', '/usr/bin/gzip'); //Camino a gzip
define('IMAGEDATA', 'img.data'); //Directorio donde se almacenarán las imágenes
?> ?>

View File

@@ -23,5 +23,5 @@
*/ */
define('AUTOR', 'Ricardo Montañana Gómez'); define('AUTOR', 'Ricardo Montañana Gómez');
define('VERSION', '1.07'); define('VERSION', '1.03b');
?> ?>

View File

@@ -16,16 +16,12 @@
<link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet"> <link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/jquery.simplecolorpicker.css"> <link rel="stylesheet" href="css/jquery.simplecolorpicker.css">
<link rel="stylesheet" href="css/jquery.simplecolorpicker-glyphicons.css"> <link rel="stylesheet" href="css/jquery.simplecolorpicker-glyphicons.css">
<link rel="stylesheet" href="css/jasny-bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-select/bootstrap-select.min.css">
<style type="text/css"></style> <style type="text/css"></style>
<script type="text/javascript" src="./css/jquery.min.js"></script> <script type="text/javascript" src="./css/jquery.min.js"></script>
<script type="text/javascript" src="./css/bootstrap-select/bootstrap-select.min.js"></script>
</head> </head>
<body> <body>
<!--<body style="background-image:url(img/fondos/old_map.png); background-repeat:repeat">--> <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation" style="background-image: url(img/fondos/bo_play_pattern.png); background-repeat: repeat">
<div class="container-fluid"> <div class="container-fluid">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar">
@@ -37,7 +33,7 @@
<a class="navbar-brand" href="index.php">{aplicacion}</a> <a class="navbar-brand" href="index.php">{aplicacion}</a>
</div> </div>
<div class="navbar-brand"> <div class="navbar-brand">
<span class="label label-primary col-sm-12 col-sm-offset-2 col-xs-12 col-xs-offset-0">{opcion}</span> <span class="label label-primary col-sm-14 col-sm-offset-3">{opcion}</span>
<!--<label class="warn">{opcion}</label>--> <!--<label class="warn">{opcion}</label>-->
</div> </div>
<div class="navbar-collapse collapse"> <div class="navbar-collapse collapse">
@@ -50,11 +46,6 @@
<input type="text" class="form-control" placeholder="Buscar..."> <input type="text" class="form-control" placeholder="Buscar...">
</form>--> </form>-->
</div> </div>
<div class="visible-xs">
<ul class="nav navbar-nav navbar-right">
<li>{control}</li>
</ul>
</div>
</div> </div>
</div> </div>
<div class="container-fluid"> <div class="container-fluid">
@@ -66,7 +57,25 @@
{menu} {menu}
</ul> </ul>
</div> </div>
<div class="col-sm-10 col-sm-offset-2 col-md-11 col-md-offset-1 main"> <div class="col-sm-10 col-sm-offset-1 col-md-11 col-md-offset-1 main">
<!--<h1 class="page-header">{opcion}</h1>-->
<!--<div id="divBarra" class="progress progress-striped active">
<div class="progress-bar" id="barra" role="progressbar" aria-valuenow="0" aria-valuemin="40" aria-valuemax="100" style="width: 0%">
<span id="barra-valor">0% Completado</span>
</div>
</div>
<script>
function actProgreso(valor) {
$('.progress-bar').width(valor+"%")
$("#barra-valor").text(valor+"% Completado");
}
function visualizaProgreso() {
$('#divBarra').style.visibility = "visible";
}
function escondeProgreso() {
$('#divBara').style.visibility = "hidden";
}
</script>-->
{contenido} {contenido}
</div> </div>
</div> </div>
@@ -80,6 +89,5 @@
<script type="text/javascript" src="./css/bootstrap-datetimepicker.min.js"></script> <script type="text/javascript" src="./css/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="./css/bootstrap-datetimepicker.es.js"></script> <script type="text/javascript" src="./css/bootstrap-datetimepicker.es.js"></script>
<script type="text/javascript" src="./css/jquery.simplecolorpicker.js"></script> <script type="text/javascript" src="./css/jquery.simplecolorpicker.js"></script>
<script type="text/javascript" src="./css/jasny-bootstrap.min.js"></script>
</body> </body>
</html> </html>

File diff suppressed because one or more lines are too long

View File

@@ -22,12 +22,11 @@ DROP TABLE IF EXISTS `Articulos`;
SET @saved_cs_client = @@character_set_client; SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8; SET character_set_client = utf8;
CREATE TABLE `Articulos` ( CREATE TABLE `Articulos` (
`id` smallint(6) NOT NULL auto_increment COMMENT 'ordenable', `id` smallint(6) NOT NULL auto_increment,
`descripcion` varchar(60) NOT NULL COMMENT 'ordenable,link/Articulo', `descripcion` varchar(60) NOT NULL COMMENT 'ordenable,link/Articulo',
`marca` varchar(20) default NULL COMMENT 'ordenable', `marca` varchar(20) default NULL COMMENT 'ordenable',
`modelo` varchar(20) default NULL COMMENT 'ordenable', `modelo` varchar(20) default NULL COMMENT 'ordenable',
`cantidad` int(11) default NULL COMMENT 'ordenable', `cantidad` int(11) default NULL COMMENT 'ordenable',
`imagen` varchar(45) default NULL COMMENT 'imagen',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=785 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=785 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client; SET character_set_client = @saved_cs_client;
@@ -41,13 +40,12 @@ DROP TABLE IF EXISTS `Elementos`;
SET @saved_cs_client = @@character_set_client; SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8; SET character_set_client = utf8;
CREATE TABLE `Elementos` ( CREATE TABLE `Elementos` (
`id` int(10) unsigned NOT NULL auto_increment COMMENT 'ordenable', `id` int(10) unsigned NOT NULL auto_increment,
`id_Articulo` smallint(6) NOT NULL COMMENT 'foreign(Articulos;id),ordenable', `id_Articulo` smallint(6) NOT NULL COMMENT 'foreign(Articulos;id),ordenable',
`id_Ubicacion` smallint(5) unsigned NOT NULL COMMENT 'foreign(Ubicaciones;id),ordenable', `id_Ubicacion` smallint(5) unsigned NOT NULL COMMENT 'foreign(Ubicaciones;id),ordenable',
`numserie` varchar(30) default NULL COMMENT 'ordenable', `numserie` varchar(30) default NULL COMMENT 'ordenable',
`cantidad` int(10) unsigned default NULL COMMENT 'ordenable', `cantidad` int(10) unsigned default NULL COMMENT 'ordenable',
`fechaCompra` date NOT NULL COMMENT 'ordenable', `fechaCompra` date NOT NULL COMMENT 'ordenable',
`imagen` varchar(45) default NULL COMMENT 'imagen',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id` (`id`), KEY `id` (`id`),
KEY `id_Articulo` (`id_Articulo`), KEY `id_Articulo` (`id_Articulo`),
@@ -66,9 +64,8 @@ DROP TABLE IF EXISTS `Ubicaciones`;
SET @saved_cs_client = @@character_set_client; SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8; SET character_set_client = utf8;
CREATE TABLE `Ubicaciones` ( CREATE TABLE `Ubicaciones` (
`id` smallint(5) unsigned NOT NULL auto_increment COMMENT 'ordenable', `id` smallint(5) unsigned NOT NULL auto_increment,
`Descripcion` varchar(50) NOT NULL COMMENT 'ordenable,link/Ubicacion', `Descripcion` varchar(50) NOT NULL COMMENT 'ordenable,link/Ubicacion',
`imagen` varchar(45) DEFAULT NULL COMMENT 'imagen',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client; SET character_set_client = @saved_cs_client;
@@ -82,7 +79,7 @@ DROP TABLE IF EXISTS `Usuarios`;
SET @saved_cs_client = @@character_set_client; SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8; SET character_set_client = utf8;
CREATE TABLE `Usuarios` ( CREATE TABLE `Usuarios` (
`id` int(10) unsigned NOT NULL auto_increment COMMENT 'ordenable', `id` int(10) unsigned NOT NULL auto_increment,
`nombre` varchar(16) NOT NULL default '', `nombre` varchar(16) NOT NULL default '',
`clave` varchar(32) NOT NULL default '', `clave` varchar(32) NOT NULL default '',
`idSesion` varchar(20) NOT NULL default '', `idSesion` varchar(20) NOT NULL default '',

View File

@@ -22,8 +22,8 @@
$host="localhost"; $host="localhost";
$baseAnt="Inventario"; $baseAnt="Inventario";
$baseNueva="Inventario2"; $baseNueva="Inventario2";
$usuario="test"; $usuario="root";
$claveUsuario="tset"; $claveUsuario="galeote";
$probar=false; $probar=false;

View File

@@ -0,0 +1,75 @@
<?php
require_once 'Configuracion.php';
/**
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-03-07 at 23:58:14.
*/
class ConfiguracionTest extends PHPUnit_Framework_TestCase {
/**
* @var Configuracion
*/
protected $config;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->config = new Configuracion;
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @covers Configuracion::ejecuta
*/
public function testEjecuta()
{
$this->assertFileExists('inc/Configuracion.inc', "El fichero de configuración no existe");
$permisos = fileperms('inc/Configuracion.inc');
//Comprueba que el propietario o el grupo tengan derecho de escritura
$test = $permisos & 0x0080 || $permisos & 0x0010;
$this->assertTrue($test, "El fichero de configuración no tiene los permisos adecuados");
//Comprueba que existan todas las claves editables en el fichero de configuración.
$fichero = $this->config->obtieneFichero();
$this->assertNotNull($fichero, "El fichero de configuración no se ha leído o no tiene contenido");
$lineas = explode("\n", $fichero);
$campos = $this->config->obtieneLista();
$numero = 0;
$lista = implode(",", $campos);
//var_dump($campos);
//var_dump($lista);
foreach ($lineas as $linea) {
if (stripos($linea, "DEFINE") !== false) {
$this->assertStringMatchesFormat("define('%s', '%s');%S", $linea, "La línea [" . $linea . "] del fichero de configuración no tiene el formato correcto");
$this->config->obtieneDatos($linea, $clave, $valor);
if (stripos($lista, $clave) !== false) {
$this->assertContains($clave, $campos, "El fichero de configuración no tiene la clave [" . $clave . "]");
$numero++;
$verificados[] = $clave;
}
}
}
$this->assertCount($numero, $campos, "No se han verificado todas las claves");
if ($numero != count($campos)) {
echo "Las claves verificadas han sido: \n";
var_export($verificados);
}
// @todo comprobar que la salida incluye una tabla con todos los campos editables.
// @todo comprobar que los valores seleccionados se corresponden co los del fichero
$salida = $this->config->ejecuta();
}
}
?>

47
tests/MenuTest.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
require_once('Menu.php');
/**
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-03-08 at 17:47:42.
*/
class MenuTest extends PHPUnit_Framework_TestCase {
/**
* @var Menu
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new Menu('inc/inventario.menu');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @covers Menu::insertaMenu
* @todo Implement testInsertaMenu().
*/
public function testInsertaMenu()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}
?>

204
tests/SqlTest.php Normal file
View File

@@ -0,0 +1,204 @@
<?php
require_once('inc/configuracion.inc');
require_once('Sql.php');
/**
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-03-08 at 01:19:34.
*/
class SqlTest extends PHPUnit_Framework_TestCase {
/**
* @var Sql
*/
protected $bd;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
* @covers Sql::__construct
* @uses Sql
*/
protected function setUp()
{
$this->bd = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOSTEST);
$this->assertFalse($this->bd->error(), "No se ha conectado a la base de datos de pruebas [" . BASEDATOSTEST . "]");
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @covers Sql::__destruct
* @todo Implement test__destruct().
*/
public function test__destruct()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::filtra
* @todo Implement testFiltra().
*/
public function testFiltra()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::ejecuta
* @todo Implement testEjecuta().
*/
public function testEjecuta()
{
}
/**
* @covers Sql::procesaResultado
* @todo Implement testProcesaResultado().
*/
public function testProcesaResultado()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::camposResultado
* @todo Implement testCamposResultado().
*/
public function testCamposResultado()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::numeroTuplas
* @todo Implement testNumeroTuplas().
*/
public function testNumeroTuplas()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::error
* @todo Implement testError().
*/
public function testError()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::mensajeError
* @todo Implement testMensajeError().
*/
public function testMensajeError()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::estructura
* @todo Implement testEstructura().
*/
public function testEstructura()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::ultimoId
* @todo Implement testUltimoId().
*/
public function testUltimoId()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::obtieneManejador
* @todo Implement testObtieneManejador().
*/
public function testObtieneManejador()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::comienzaTransaccion
* @todo Implement testComienzaTransaccion().
*/
public function testComienzaTransaccion()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::abortaTransaccion
* @todo Implement testAbortaTransaccion().
*/
public function testAbortaTransaccion()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Sql::confirmaTransaccion
* @todo Implement testConfirmaTransaccion().
*/
public function testConfirmaTransaccion()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}
?>

View File

@@ -2,10 +2,10 @@
<Informe> <Informe>
<Titulo Texto="Informe de Artículos" /> <Titulo Texto="Informe de Artículos" />
<Datos> <Datos>
<Consulta>select * from Articulos where descripcion like '%{filtro}%' order by {orden};</Consulta> <Consulta>select * from Articulos order by descripcion;</Consulta>
</Datos> </Datos>
<Pagina Orientacion="P" Formato="A4"> <Pagina Orientacion="P" Formato="A4">
<Cabecera>Relación Artículos</Cabecera> <Cabecera>Relación alfabética</Cabecera>
<Cuerpo> <Cuerpo>
<Col Nombre="id" Ancho="10" Ajuste="D" Titulo="id"/> <Col Nombre="id" Ancho="10" Ajuste="D" Titulo="id"/>
<Col Nombre="descripcion" Ancho="70" Ajuste="I" Titulo="Descripción"/> <Col Nombre="descripcion" Ancho="70" Ajuste="I" Titulo="Descripción"/>

View File

@@ -6,7 +6,7 @@
SELECT E.id as id,U.Descripcion as ubicacion,A.Descripcion as articulo,A.Marca as marca,A.Modelo as modelo,E.numserie as numserie,E.cantidad, SELECT E.id as id,U.Descripcion as ubicacion,A.Descripcion as articulo,A.Marca as marca,A.Modelo as modelo,E.numserie as numserie,E.cantidad,
DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra
FROM Elementos E inner join Articulos A on E.id_articulo=A.id inner join FROM Elementos E inner join Articulos A on E.id_articulo=A.id inner join
Ubicaciones U on E.id_ubicacion=U.id where A.Descripcion like '%{filtro}%' order by {orden}; Ubicaciones U on E.id_ubicacion=U.id order by ubicacion,articulo,marca,modelo,numserie;
</Consulta> </Consulta>
</Datos> </Datos>
<Pagina Orientacion="L" Formato="A4"> <Pagina Orientacion="L" Formato="A4">

View File

@@ -2,10 +2,10 @@
<Informe> <Informe>
<Titulo Texto="Informe de Ubicaciones" /> <Titulo Texto="Informe de Ubicaciones" />
<Datos> <Datos>
<Consulta>select * from Ubicaciones where descripcion like '%{filtro}%' order by {orden};</Consulta> <Consulta>select * from Ubicaciones order by Descripcion;</Consulta>
</Datos> </Datos>
<Pagina Orientacion="P" Formato="A4"> <Pagina Orientacion="P" Formato="A4">
<Cabecera>Relación de Ubicaciones</Cabecera> <Cabecera>Relación alfabética</Cabecera>
<Cuerpo> <Cuerpo>
<Col Nombre="id" Ancho="10" Ajuste="D" Titulo="id"/> <Col Nombre="id" Ancho="10" Ajuste="D" Titulo="id"/>
<Col Nombre="Descripcion" Ancho="80" Ajuste="I" Titulo="Descripción"/> <Col Nombre="Descripcion" Ancho="80" Ajuste="I" Titulo="Descripción"/>

View File

@@ -2,7 +2,7 @@
<Informe> <Informe>
<Titulo Texto="Informe de Usuarios" /> <Titulo Texto="Informe de Usuarios" />
<Datos> <Datos>
<Consulta>select * from Usuarios where nombre like '%{filtro}%' order by {orden};</Consulta> <Consulta>select * from Usuarios order by Nombre;</Consulta>
</Datos> </Datos>
<Pagina Orientacion="P" Formato="A4"> <Pagina Orientacion="P" Formato="A4">
<Cabecera>Relación alfabética</Cabecera> <Cabecera>Relación alfabética</Cabecera>

View File

@@ -3,12 +3,12 @@
<Titulo>Mantenimiento de Elementos</Titulo> <Titulo>Mantenimiento de Elementos</Titulo>
<Consulta> <Consulta>
SELECT SQL_CALC_FOUND_ROWS E.id as id,U.Descripcion as ubicacion,A.Descripcion as articulo,A.Marca as marca,A.Modelo as modelo,E.numserie as numserie, SELECT SQL_CALC_FOUND_ROWS E.id as id,U.Descripcion as ubicacion,A.Descripcion as articulo,A.Marca as marca,A.Modelo as modelo,E.numserie as numserie,
DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra,E.cantidad as cantidad, E.imagen as imagen DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra,E.cantidad as cantidad
FROM Elementos E inner join Articulos A on E.id_articulo=A.id inner join FROM Elementos E inner join Articulos A on E.id_articulo=A.id inner join
Ubicaciones U on E.id_ubicacion=U.id {buscar} {orden} limit {inferior},{superior}; Ubicaciones U on E.id_ubicacion=U.id {buscar} {orden} limit {inferior},{superior};
</Consulta> </Consulta>
<Campos> <Campos>
<Col Campo="id" Nombre="id" Ancho="5" Ajuste="D" Titulo="id" Tipo="smallint(6)" Varios="ordenable"/> <Col Campo="id" Nombre="id" Ancho="5" Ajuste="D" Titulo="id" Tipo="smallint(6)"/>
<Col Campo="id_Ubicacion" Nombre="ubicacion" Ancho="40" Ajuste="L" Titulo="Ubicación" Varios="ordenable,foreign(Ubicaciones->id;{Descripcion})" Editable="si"/> <Col Campo="id_Ubicacion" Nombre="ubicacion" Ancho="40" Ajuste="L" Titulo="Ubicación" Varios="ordenable,foreign(Ubicaciones->id;{Descripcion})" Editable="si"/>
<Col Campo="id_Articulo" Nombre="articulo" Ancho="40" Ajuste="L" Titulo="Artículo" Varios="ordenable,buscable/A.Descripcion,foreign(Articulos->id;{Descripcion/Marca/Modelo})" Editable="si"/> <Col Campo="id_Articulo" Nombre="articulo" Ancho="40" Ajuste="L" Titulo="Artículo" Varios="ordenable,buscable/A.Descripcion,foreign(Articulos->id;{Descripcion/Marca/Modelo})" Editable="si"/>
<Col Nombre="marca" Ancho="40" Ajuste="L" Titulo="Marca" Varios="ordenable" Editable="no"/> <Col Nombre="marca" Ancho="40" Ajuste="L" Titulo="Marca" Varios="ordenable" Editable="no"/>
@@ -16,6 +16,5 @@
<Col Campo="numserie" Nombre="numserie" Ancho="30" Ajuste="L" Titulo="Nº Serie" Varios="ordenable" Editable="si"/> <Col Campo="numserie" Nombre="numserie" Ancho="30" Ajuste="L" Titulo="Nº Serie" Varios="ordenable" Editable="si"/>
<Col Campo="fechaCompra" Nombre="fechaCompra" Ancho="25" Ajuste="L" Titulo="Compra" Varios="ordenable" Tipo="fecha" Editable="si"/> <Col Campo="fechaCompra" Nombre="fechaCompra" Ancho="25" Ajuste="L" Titulo="Compra" Varios="ordenable" Tipo="fecha" Editable="si"/>
<Col Campo="cantidad" Nombre="cantidad" Ancho="15" Ajuste="D" Titulo="Cant." Tipo="Int(11)" Editable="si"/> <Col Campo="cantidad" Nombre="cantidad" Ancho="15" Ajuste="D" Titulo="Cant." Tipo="Int(11)" Editable="si"/>
<Col Campo="imagen" Nombre="imagen" Ancho="10" Titulo="Imagen" Tipo="imagen" Editable="si" Varios="imagen"/>
</Campos> </Campos>
</Mantenimiento> </Mantenimiento>

View File

@@ -6,8 +6,8 @@
FROM Usuarios {buscar} {orden} limit {inferior}, {superior}; FROM Usuarios {buscar} {orden} limit {inferior}, {superior};
</Consulta> </Consulta>
<Campos> <Campos>
<Col Campo="id" Nombre="id" Ancho="5" Ajuste="D" Titulo="id" Tipo="int(6)" Varios="ordenable"/> <Col Campo="id" Nombre="id" Ancho="5" Ajuste="D" Titulo="id" Tipo="int(6)"/>
<Col Campo="nombre" Nombre="nombre" Ancho="8" Ajuste="L" Titulo="Nombre" Varios="ordenable,buscable/nombre" Editable="si"/> <Col Campo="nombre" Nombre="nombre" Ancho="8" Ajuste="L" Titulo="Nombre" Varios="ordenable" Editable="si"/>
<Col Campo="clave" Nombre="clave" Ancho="16" Ajuste="L" Titulo="Clave" Tipo="Password" Editable="si"/> <Col Campo="clave" Nombre="clave" Ancho="16" Ajuste="L" Titulo="Clave" Tipo="Password" Editable="si"/>
<Col Campo="idSesion" Nombre="idSesion" Ancho="32" Ajuste="L" Titulo="id Sesión" Editable="si"/> <Col Campo="idSesion" Nombre="idSesion" Ancho="32" Ajuste="L" Titulo="id Sesión" Editable="si"/>
<Col Campo="alta" Nombre="alta" Ancho="1" Ajuste="R" Tipo="Boolean" Titulo="Altas" Editable="si"/> <Col Campo="alta" Nombre="alta" Ancho="1" Ajuste="R" Tipo="Boolean" Titulo="Altas" Editable="si"/>