11 Commits
1.17 ... 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
115 changed files with 18653 additions and 22741 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
nbproject
tmp/*
.DS_Store

View File

@@ -1,88 +0,0 @@
<?php
/**
* @package Inventario
* @copyright Copyright (c) 2008, 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/>.
*
*/
//Clase encargada de procesar las peticiones ajax
require_once 'inc/configuracion.inc';
require_once 'Sql.php';
$ajax = new Ajax();
echo $ajax->procesa();
class Ajax {
private $sql;
private $tabla;
public function __construct()
{
$this->sql = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
if ($this->sql->error()) {
return $this->respuesta($this->mensaje(false, 'Error conectando con la Base de Datos'));
};
$this->tabla = $_GET['tabla'];
}
private function respuesta($mensaje)
{
header('Content-Type: application/json', true, 200);
return $mensaje;
}
public function procesa()
{
$opc = $_GET['opc'];
switch ($opc) {
case "get": return $this->obtiene();
case "put": return $this->actualiza();
}
}
private function mensaje($exito, $texto)
{
return json_encode(array("success" => $exito, "msj" => $texto));
}
private function actualiza()
{
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$comando = "update " . mysql_escape_string($this->tabla) . " set " . mysql_escape_string($_POST['name']) . " = '" . mysql_escape_string($_POST['value']) . "' where id = '" . mysql_escape_string($_POST['pk']). "';";
$this->sql->ejecuta($comando);
$exito = !$this->sql->error();
$mensaje = $this->sql->mensajeError();
$resp = $this->mensaje($exito, $mensaje);
return $this->respuesta($resp);
}
}
private function obtiene()
{
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$comando = "select id, descripcion from " . $this->tabla . " order by descripcion asc;";
$this->sql->ejecuta($comando);
$exito = !$this->sql->error();
$mensaje = $this->sql->mensajeError();
if (!$exito) {
return $this->respuesta($this->mensaje($exito, $mensaje));
}
$filas = array();
while($r = $this->sql->procesaResultado()) {
$filas[] = array($r['id'] => $r['descripcion']);
}
$resp = json_encode($filas);
return $this->respuesta($resp);
}
}
}
?>

View File

@@ -1,4 +1,5 @@
<?php
/**
* @package Inventario
* @copyright Copyright (c) 2008, Ricardo Montañana Gómez
@@ -24,30 +25,9 @@ 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>');
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" />' .
'<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('USUARIO_INCORRECTO', '<label class="bg-danger">Usuario y clave incorrectos!</label><br><br>');
define('CREDITOS_CABECERA', '<div class="modal fade" tabindex="-1" id="creditos" role="dialog" aria-labelledby="modalCreditos" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4>Créditos</h4>
</div>
<div class="modal-body">
<div class="jumbotron">
<img src="img/qrlogo.png" class="img-responsive img-rounded" style="float:left">
<h1>Inventario2</h1>
<p> Aplicación para controlar el inventario de un centro educativo.</p>
<p>En la aplicación se hace uso de los siguientes módulos y/o bibliotecas</p>');
define('CREDITOS_PIE', ' <p><h5>Copyright &copy; 2008-2014 Ricardo Montañana Gómez</h5>
<h5><small>Esta aplicación se distribuye con licencia <a target="_blank" href="http://www.gnu.org/licenses/gpl-3.0.html">GPLv3 </a></small></h5></p>
</div>
</div>
</div>
</div>
</div>');
define('USUARIO_INCORRECTO', '<label class="error">Usuario y clave incorrectos!</label><br><br>');
// Esta clase aportará el contenido a la plantilla
class AportaContenido {
@@ -88,12 +68,6 @@ class AportaContenido {
*/
private $perfil;
/**
*
* @var array Datos pasados en la URL
*/
private $datosURL = array();
// El constructor necesita saber cuál es la opción actual
/**
* Constructor de la clase.
@@ -103,8 +77,7 @@ class AportaContenido {
* @param array $perfil Permisos de acceso del usuario
* @param String $opcion Opción elegida por el usuario
*/
public function __construct($baseDatos, $registrado, $usuario, $perfil, $opcion)
{
public function __construct($baseDatos, $registrado, $usuario, $perfil, $opcion) {
$this->bdd = $baseDatos;
$this->miMenu = new Menu('inc/inventario.menu');
$this->registrado = $registrado;
@@ -113,43 +86,13 @@ class AportaContenido {
$this->opcionActual = $opcion;
}
/**
* Devuelve una tabla HTML con el contenido de las bibliotecas/módulos utilizadas en la aplicación
* Si el perfil del usuario es de Configuración devuelve también las versiones de las bibliotecas
* @return string
*/
public function creaTablaAcercaDe()
{
$poner = $this->perfil['Config'];
$tabla = '<table class="table table-condensed">';
$tabla .='<thead><tr><th>Biblioteca/Módulo</th>'.($poner?'<th>Versión</th>':'').'<th>Licencia</th></tr></thead>';
$tabla .='<tbody>';
$tabla .='<tr><td><a href="http://jquery.com/" target="_blank">jquery</a></td>'.($poner?'<td>2.1.0</td>':'').'<td><a target="_blank" href="https://jquery.org/license/">MIT</a></td>';
$tabla .='<tr><td><a href="http://getbootstrap.com/" target="_blank">Twitter Bootstrap</a></td>'.($poner?'<td>3.1.1</td>':'').'<td><a target="_blank" href="https://github.com/twbs/bootstrap/blob/master/LICENSE">MIT</a></td>';
$tabla .='<tr><td><a href="http://www.fpdf.org/" target="_blank">FPDF</a></td>'.($poner?'<td>1.7</td>':'').'<td>Libre</td>';
$tabla .='<tr><td><a href="http://phpqrcode.sourceforge.net/" target="_blank">PHP QR Code Enconder</a></td>'.($poner?'<td>1.1.4</td>':'').'<td><a target="_blank" href="http://www.gnu.org/licenses/lgpl-3.0.txt">LGPL</a></td>';
$tabla .='<tr><td><a href="http://stefangabos.ro/php-libraries/zebra-image/" target="_blank">Zebra_Image</a></td>'.($poner?'<td>2.2.3</td>':'').'<td><a target="_blank" href="http://www.gnu.org/licenses/lgpl-3.0.txt">LGPL</a></td>';
$tabla .='<tr><td><a href="http://jasny.github.io/bootstrap/" target="_blank">Jasny Bootstrap</a></td>'.($poner?'<td>3.1.0</td>':'').'<td><a target="_blank" href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a></td>';
$tabla .='<tr><td><a href="http://1000hz.github.io/bootstrap-validator/" target="_blank">Bootstrap Validator</a></td>'.($poner?'<td>0.2.1</td>':'').'<td><a target="_blank" href="https://github.com/1000hz/bootstrap-validator/blob/master/LICENSE">MIT</a></td>';
$tabla .='<tr><td><a href="https://github.com/tkrotoff/jquery-simplecolorpicker" target="_blank">jquery-simplecolorpicker</a></td>'.($poner?'<td>0.3.0</td>':'').'<td><a target="_blank" href="https://github.com/tkrotoff/jquery-simplecolorpicker/blob/master/LICENSE.txt">MIT</a></td>';
$tabla .='<tr><td><a href="http://eonasdan.github.io/bootstrap-datetimepicker/" target="_blank">Bootstrap datetimepicker</a></td>'.($poner?'<td>2.1.32</td>':'').'<td><a target="_blank" href="https://github.com/Eonasdan/bootstrap-datetimepicker/blob/master/src/js/bootstrap-datetimepicker.js">MIT</a></td>';
$tabla .='<tr><td><a href="http://silviomoreto.github.io/bootstrap-select/" target="_blank">Bootstrap-select</a></td>'.($poner?'<td>1.5.4</td>':'').'<td><a target="_blank" href="https://github.com/silviomoreto/bootstrap-select">MIT</a></td>';
$tabla .='<tr><td><a href="https://github.com/vitalets/x-editable" target="_blank">X-editable</a></td>'.($poner?'<td>1.5.1</td>':'').'<td><a target="_blank" href="https://github.com/vitalets/x-editable/blob/master/LICENSE-MIT">MIT</a></td>';
$tabla .='<tr><td><a href="http://momentjs.com/" target="_blank">Moment.js</a></td>'.($poner?'<td>2.5.1</td>':'').'<td><a target="_blank" href="https://github.com/moment/moment/blob/develop/LICENSE">MIT</a></td>';
$tabla .='</tbody>';
$tabla .='</table>';
return $tabla;
}
/**
* Devuelve la fecha actual
* @param string $formato formato de devolución de la fecha
* @param string $idioma idioma para formatear la fecha, p.ej. es_ES
* @return string
*/
public function fechaActual($formato = '', $idioma = 'es_ES')
{
public function fechaActual($formato = '', $idioma = 'es_ES') {
if ($formato == '')
$formato = "%d-%b-%y";
setlocale(LC_TIME, $idioma);
@@ -160,8 +103,7 @@ class AportaContenido {
*
* @return string Mensaje el usuario debe registrarse.
*/
private function mensajeRegistro()
{
private function mensajeRegistro() {
return 'Debe registrarse para acceder a este apartado';
}
@@ -173,31 +115,17 @@ class AportaContenido {
* @param string $parametros Parámetros del método
* @return string Contenido devuelto por el método
*/
public function __call($metodo, $parametros)
{
public function __call($metodo, $parametros) {
switch ($metodo) { // Dependiendo del método invocado
case 'titulo': // devolvemos el título
return PROGRAMA.VERSION;
case 'usuario':
if ($this->registrado)
return "Usuario=$this->usuario";
else
return '';
case 'fecha':
$script = '<script type="text/javascript">
$(function () {
$(' . "'#fechaCabecera'" . ").datetimepicker({
pick12HourFormat: false,
language: 'es',
pickTime: false
});
});
</script>";
$campo = '<input type="hidden" name="fechaCabecera" id="fechaCabecera" value="' . $this->fechaActual("%d/%m/%Y") . '">';
$etiqueta = '<label for="fechaCabecera" onClick="$(' . "'#fechaCabecera'" . ").data('DateTimePicker').show();" . '">' . $this->fechaActual() . '</label>';
return $etiqueta . $campo . $script;
case 'aplicacion':
$nombre = explode(" ", PROGRAMA);
$nombre = $nombre[2];
return $nombre . " v" . VERSION;
case 'fecha': return $this->fechaActual();
case 'aplicacion': return PROGRAMA.VERSION;
case 'menu': // el menú
if ($this->registrado) {
return $this->miMenu->insertaMenu();
@@ -210,11 +138,7 @@ class AportaContenido {
return $salida;
}
case 'opcion':
if (strstr($this->opcionActual, "&")) {
list($opcion, $parametro) = explode("&", $this->opcionActual);
} else {
$opcion = $this->opcionActual; $parametro = "";
}
switch ($opcion) {
case 'bienvenido':
return "Men&uacute; Principal";
@@ -225,9 +149,9 @@ class AportaContenido {
case 'ubicaciones':
case 'usuarios':
case 'test':
return "Mantenimiento " . ucfirst($opcion);
return "Mantenimiento de " . ucfirst($opcion) . ".";
case 'configuracion':
return 'Configuraci&oacute;n y Preferencias';
return 'Configuraci&oacute;n y Preferencias.';
case 'informeInventario':return "Informe de Inventario";
case 'descuadres':return 'Informe de descuadres';
case 'importacion': return 'Importaci&oacute;n de datos';
@@ -236,7 +160,7 @@ class AportaContenido {
return '';
case 'control':
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
return '';
// Para incluir el contenido central de la página
@@ -248,50 +172,15 @@ class AportaContenido {
// if (!$this->registrado) {
// return $this->mensajeRegistro();
// }
if (strstr($this->opcionActual, "&")) {
list($opcion, $parametro) = explode("&", $this->opcionActual);
} else {
$opcion = $this->opcionActual; $parametro = "";
}
switch ($opcion) {
case 'bienvenido':
$mensaje = '<div class="alert alert-success">';
$mensaje .= 'Bienvenid@ ' . $this->usuario . '</div>';
case 'principal': // contenido inicial
$mensaje = "";
$creditos = "$('#creditos').modal({keyboard: false});";
$centro = '<div class="well well-sm">' . CENTRO . '</div>';
$tabla = $this->creaTablaAcercaDe();
$rama_texto = trim(substr(file_get_contents('.git/HEAD'), 16));
$rama = ($rama_texto != 'master' ? '<br><button class="btn btn-warning btn-xs" type="button"onClick="' . $creditos . '"><span class="glyphicon glyphicon-cog"></span> '.$rama_texto.'</button></center>':'');
return $mensaje . '<br><br><center><img src="img/qrlogo.png" alt="' . PROGRAMA . '" onClick="' . $creditos . '" >' .
'<br><br><label onClick="' . $creditos . '">' . $centro . '</label>' . $rama . '</center>' . CREDITOS_CABECERA . $tabla . CREDITOS_PIE;
return '<br><br><center><img src="img/logo.png" alt="' . PROGRAMA . '">' .
'<br><label>' . CENTRO . '</label></center><br><br>' . PIE;
case 'articulos':
case 'ubicaciones':
case 'test':
case 'elementos':
$this->cargaDatosURL();
if ($this->datosURL['opc'] == "informe") {
if ($this->perfil['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();
return $this->devuelveInforme($informe);
} else {
return $this->mensajePermisos("Informes");
}
}
if ($this->perfil['Consulta']) {
$ele = new Mantenimiento($this->bdd, $this->perfil, $opcion);
return $ele->ejecuta();
@@ -300,33 +189,15 @@ class AportaContenido {
}
case '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();
return $this->devuelveInforme($informe);
} else {
return $this->mensajePermisos("Informes");
}
}
$ele = new Mantenimiento($this->bdd, $this->perfil, $opcion);
return $ele->ejecuta();
} else {
return $this->mensajePermisos('Usuarios');
}
case 'bienvenido': // El usuario quiere iniciar sesión
return 'Bienvenid@ ' . $this->usuario . '<br><br><center><img src="img/codigoBarras.png" alt="' . PROGRAMA . '">' .
'<br><label>' . CENTRO . '</label></center><br><br>' . PIE;
case 'configuracion':
if ($this->perfil['Config']) {
$conf = new Configuracion();
@@ -341,6 +212,17 @@ class AportaContenido {
} else {
return $this->mensajePermisos('Informes');
}
case 'descuadres':
if ($this->perfil['Informe']) {
$enlace = 'xml/informe' . ucfirst($opcion) . '.xml';
$informe = new InformePDF($this->bdd, $enlace, $this->registrado);
$informe->crea($enlace);
$informe->cierraPDF();
$informe->imprimeInforme();
return;
} else {
return $this->mensajePermisos('Informes');
}
case 'importacion':
if ($this->perfil['Modificacion'] && $this->perfil['Borrado']) {
$import = new Importacion($this->bdd, $this->registrado);
@@ -350,19 +232,31 @@ class AportaContenido {
}
case 'copiaseg':
if ($this->perfil['Config']) {
$copia = new CopiaSeguridad();
if (isset($_GET['confirmado']) && $_GET['confirmado'] == "1") {
if (!$copia->creaCopia()) {
$tipo = "danger";
$archivo_sql = "tmp/copiaseg.sql";
$archivo = $archivo_sql . ".gz";
if (file_exists($archivo)) {
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";
$tipo = "danger";
} else {
$tipo = "info";
$cabecera = "INFORMACIÓN";
}
return $this->panel($cabecera, $copia->mensaje(), $tipo);
} else {
return $copia->dialogo();
$mensaje .= 'Copia de seguridad realizada con &eacute;xito.<br><br>Pulse sobre el siguiente enlace para descargar:<br><br>';
$mensaje .= '<a href="' . $archivo . '">Descargar Copia de Seguridad de Datos</a><br>';
$cabecera = "Informaci&oacute;n";
$tipo = "success";
}
return $this->panel($cabecera,$mensaje,$tipo);
} else {
return $this->mensajePermisos("Copias de seguridad");
}
@@ -383,40 +277,16 @@ class AportaContenido {
}
}
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
* @return string
*/
public function mensajePermisos($tipo)
{
public function mensajePermisos($tipo) {
return $this->panel("ERROR", "No tiene permiso para acceder a $tipo", "danger");
}
private function devuelveInforme($informe)
{
$letras = "abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
$nombre = TMP."/informe" . substr(str_shuffle($letras), 0, 10) . ".pdf";
$informe->guardaArchivo($nombre);
return '<div class="container">
<!--<a href="' . $nombre . '" target="_blank"><span class="glyphicon glyphicon-cloud-download" style="font-size:1.5em;"></span>Descargar Informe</a>-->
<object data="' . $nombre . '" type="application/pdf" width="100%" height="700" style="float:left;">
</object>
</div>';
}
public function panel($cabecera, $mensaje, $tipo)
{
public function panel($cabecera, $mensaje, $tipo) {
$panel = '<div class="panel panel-' . $tipo . '"><div class="panel-heading">';
$panel .= '<h3 class="panel-title">' . $cabecera . '</h3></div>';
$panel .= '<div class="panel-body">';
@@ -424,5 +294,7 @@ class AportaContenido {
$panel .= '</div>';
return $panel;
}
}
?>

101
CHANGELOG
View File

@@ -1,101 +0,0 @@
Version 1.17 29-07-2014
-Eliminados los mensajes de aviso de php en todos los archivos php
Versión 1.16 28-07-2014
-Fix #41. Arregla las llamadas a Instalar.php que se hacían desde Inventario.php y desde Instalar.php
Versión 1.15 29-06-2014
-Crear la opción de clonar registro en Mantenimiento.
-Crear iconos de clonado en todos los estilos.
-Corregido determinaAccion en Imagen para aceptar el clonado
-Corregido codificación/decodificación de la cadena de búsqueda en la URL
Versión 1.14.1 02-06-2014
-Añadidos enlaces a manual y a aplicación de ejemplo en readme.md
-Arreglado que los créditos salgan centrados en lugar de alineados a la derecha
-Añadido la 'v' para indicar la versión en la cabecera de los informes
-Acortado el nombre de la aplicación en la página principal para que en dispositivos pequeños se visualice bien con el icono nuevo del manual
Versión 1.14 01-06-2014
-Añadido icono de acceso a la documentación en la barra superior
-Corregido cierre etiqueta h5 en pie de créditos
-Añade la rama git en la pantalla de inicio en caso de que no sea la rama master, con un botón que al pulsarlo salen los créditos
-Fix #39. Devuelve la versión de las bibliotecas/módulos utilizados en la aplicación si el usuario tiene perfil de Configuración, en caso contrario tan sólo el listado de bibliotecas y su licencia.
-Corregido el nombre de la clase base en Pdf_mysql para que no haya problemas en sistemas que diferencian mayúsculas/minúsculas
-Añadido el botón volver en Configuración
-Fix #36. Añadido límite caracteres en los campos de texto a 35 caracteres en Configuración. Añadido el número de columnas en resoluciones pequeñas y grandes en Configuración.
Versión 1.12 06-05-2014
-Mantenimiento muestra el 'Titulo' del campo tanto en Consulta como en el formulario de edición
-Muestra cuadro de búsqueda y mensaje correcto cuando no se encuentra la cadena de búsqueda en Mantenimiento
-Añadidos mensajes de ayuda en los campos de configuración
-Añadida la columna de cantidad ubicada en mantenimiento de artículos
-Fix #35. Cambiados los informes de Articulos y Ubicaciones para recoger el campo Nº de elementos
-Fix #35. Añadido el campo Nº de elementos en el mantenimiento de Articulos y Ubicaciones a través de archivo xml
-Fix #31. Añadido el directorio temporal en el archivo de configuración
Versión 1.11b 26-04-2014
-Cambiada la referencia de etiquetas Apli
Versión 1.11 26-04-2014
-Fix #34 Corregido que salga una etiqueta por cada elemento reflejado en cantidad.
-Fix #33 Hay que hacer doble click para editar ajax
-Fix #32 Añadido mensaje y enlace al tipo de etiquetas que utiliza y corregido mensaje de error de conexión a base de datos de SQL
-Añadido diálogo antes de realizar el inventario total.
-Añadido cuadro para resaltar el nombre del centro en la pantalla inicial.
-Cambiada la alineación de los campos en Mantenimiento para utilizar el atributo Ajuste
Versión 1.10 21-04-2014
-Corregido error en el nombre del archivo de la clase ajax que estaba en minúsculas
-Añadidos botones de acción tipo bootstrap en Mantenimiento y añadido a configuración en estilo
-Informe de inventario de Artículo o Ubicación desde id y edición ajax de la descripción
-Cambiado mensaje de usuario/clave incorrectos para poner un fondo de color rojo
Versión 1.09 16-04-2014
-Añadida la biblioteca X-Edit
-Añadida actualización Ajax en Mantenimiento
Versión 1.082 09-04-2014
-Ahora git tiene en cuenta los directorios tmp e img.data y no tiene en cuenta su contenido
-Fix #30. Arreglado el botón de buscar que no enviaba los datos. Cambiado el texto por la lupa.
Versión 1.081 08-04-2014
-Fix #29. Añade el programa instalar.php en el proceso de instalación en README.md
-Fix #29. Añadida la tabla de módulos/bibliotecas utilizados en los créditos.
-Fix #28. Corrige que el informe pedido desde matenimiento salga en una ventana nueva.
Versión 1.08 07-04-2014
-Los informes aparecen ahora en la pantalla de la aplicación embebidos.
-Añadido un calendario al pulsar sobre la fecha en la cabecera de la aplicación.
-Corregido pequeño problema de margen en resoluciones pequeñas donde se solapaba parte del menú.
-Quitados los logos de GPLv3, MySQL y Apache
-Inventario.php llama al instalador si la aplicación no está instalada
-Añadido dialogo modal de Créditos cuando se pulsa sobre el gráfico de código de barras de la aplicación o sobre el nombre del centro
-Quitados los usuarios de ejemplo en el archivo setup.sql
-Creado el programa instalar.php que permitirá configurar el acceso a la base de datos, comprobar la configuración del servidor y la creación del usuario administrador
-Añadido un parámetro en el archivo configuracion.inc que permite o no ejecutar el programa instalar.php
Versión 1.07 31-03-2014
-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

@@ -1,4 +1,5 @@
<?php
/**
* @package Inventario
* @copyright Copyright (c) 2008, Ricardo Montañana Gómez
@@ -24,7 +25,7 @@ class Configuracion {
private $confAnterior = "inc/configuracion.ant";
private $datosConf;
//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', 'TMP');
private $lista = array('SERVIDOR', 'BASEDATOS', 'BASEDATOSTEST', 'USUARIO', 'CLAVE', 'CENTRO', 'NUMFILAS', 'ESTILO', 'PLANTILLA', 'COLORLAT', 'COLORFON', 'MYSQLDUMP', 'GZIP');
private $campos;
public function __construct()
@@ -53,11 +54,6 @@ class Configuracion {
$valor = trim($valor);
}
private function creaTitulo($titulo, $ayuda)
{
return '<td style="vertical-align:middle"><a class="dato" href="#" data-placement="right" data-content="'.$ayuda.'">'.$titulo.'</a></td>';
}
public function ejecuta() {
$fichero = $this->obtieneFichero();
$datos = explode("\n", $fichero);
@@ -82,9 +78,9 @@ class Configuracion {
fwrite($fsalida, $registro);
}
}
$salida = $this->formulario();
$salida.=$this->formulario();
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);
//unlink($this->confAnterior);
rename($this->configuracion, $this->confAnterior);
@@ -104,24 +100,22 @@ class Configuracion {
$personal = $this->datosConf['ESTILO'] == "personal" ? 'selected' : ' ';
$bluecurve = $this->datosConf['ESTILO'] == "bluecurve" ? 'selected' : ' ';
$cristal = $this->datosConf['ESTILO'] == "cristal" ? 'selected' : ' ';
$bootst = $this->datosConf['ESTILO'] == "bootstrap" ? 'selected' : ' ';
$normal = $this->datosConf['PLANTILLA'] == "normal" ? 'selected' : ' ';
$bootstrap = $this->datosConf['PLANTILLA'] == "bootstrap" ? 'selected' : ' ';
$salida = '<center><div class="col-sm-4 col-md-8"><form name="configura" method="post">';
$salida = '<center><div class="col-sm-4 col-md-6"><form name="configura" method="post">';
//$salida.='<p align="center"><table border=1 class="tablaDatos"><tbody>';
$salida.='<p align="center"><table border=2 class="table table-hover"><tbody>';
$salida.='<th colspan=2 class="info"><center><b>Preferencias</b></center></th>';
$salida.='<tr>'.$this->creaTitulo("Nombre del Centro","Nombre que aparecerá en los informes y en la página principal de la aplicación").'<td><input type="text" name="CENTRO" value="' . $this->datosConf['CENTRO'] . '" maxlength="35" size="35" /></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Número de filas","Número de filas que aparecerán en la pantalla de consulta de los maestros. Valor entre 10 y 25.").'<td><input type="number" max="25" min="10" name="NUMFILAS" value="' . $this->datosConf['NUMFILAS'] . '" size="3" /></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Plantilla","Plantilla html utilizada para mostrar el contenido de la aplicación.").'<td><select name="PLANTILLA" class="form-control">';
$salida.='<tr><td>Nombre del Centro</td><td><input type="text" name="CENTRO" value="' . $this->datosConf['CENTRO'] . '" size="30" /></td></tr>';
$salida.='<tr><td>N&uacute;mero de filas</td><td><input type="text" name="NUMFILAS" value="' . $this->datosConf['NUMFILAS'] . '" size="3" /></td></tr>';
$salida.='<tr><td style="vertical-align:middle">Plantilla</td><td><select name="PLANTILLA" class="form-control">';
$salida.='<option value="normal" ' . $normal . '>normal</option>';
$salida.='<option ' . $bootstrap . '>bootstrap</option></select></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Estilo","Estilo de los botones de control en los mantenimientos de los maestros").'<td><select name="ESTILO" class="form-control">';
$salida.='<tr><td style="vertical-align:middle">Estilo</td><td><select name="ESTILO" class="form-control">';
$salida.='<option value="personal" ' . $personal . '>personal</option>';
$salida.='<option ' . $bluecurve . '>bluecurve</option>';
$salida.='<option ' . $bootst . '>bootstrap</option>';
$salida.='<option ' . $cristal . '>cristal</option></select></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Color Lateral","Color que se aplicará a la parte izquierda de la aplicación donde aparece el menú").'<td style="vertical-align:middle"><select name="COLORLAT" id="COLORLAT" class="form-control">';
$salida.='<tr><td style="vertical-align:middle">Color Lateral (bootstrap)</td><td style="vertical-align:middle"><select name="COLORLAT" id="COLORLAT" class="form-control">';
foreach ($coloresLateral as $color => $codigo) {
$selec = "";
if (trim($this->datosConf['COLORLAT']) == $codigo) {
@@ -130,7 +124,7 @@ class Configuracion {
$salida.='<option value="' . $codigo . '" ' . $selec . ' >' . $color . '</option>';
}
$salida.='</select></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Color Fondo","Color que aparecerá como fondo en todas las pantallas de la aplicación").'<td style="vertical-align:middle"><select name="COLORFON" id="COLORFON" class="form-control">';
$salida.='<tr><td style="vertical-align:middle">Color Fondo (bootstrap)</td><td style="vertical-align:middle"><select name="COLORFON" id="COLORFON" class="form-control">';
foreach ($coloresFondo as $color => $codigo) {
$selec = "";
if (trim($this->datosConf['COLORFON']) == $codigo) {
@@ -139,19 +133,15 @@ class Configuracion {
$salida.='<option value="' . $codigo . '" ' . $selec . ' >' . $color . '</option>';
}
$salida.='</select></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Directorio tmp","Directorio donde se almacenarán los archivos temporales de la aplicación y también los archivos e informes que genera").'<td><input type="text" name="TMP" value="' . $this->datosConf['TMP'] . '" maxlength="35" size="35" /></td></tr>';
$salida.='<th colspan=2 class="danger"><center><b>Base de datos</b></center></th>';
$salida.='<tr>'.$this->creaTitulo("Servidor","Nombre o dirección IP del servidor MySQL. Normalmente localhost").'<td><input type="text" name="SERVIDOR" value="' . $this->datosConf['SERVIDOR'] . '" maxlength="35" size="35" /></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Puerto","Número de puerto donde el servidor admite conexiones MySQL. Normalmente 3306").'<td><input type="text" name="PUERTO" value="' . $this->datosConf['PUERTO'] . '" maxlength="35" size="35" /></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Base de datos","Nombre de la base de datos donde se almacenarán los datos de la aplicación").'<td><input type="text" name="BASEDATOS" value="' . $this->datosConf['BASEDATOS'] . '" maxlength="35" size="35" /></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Base de datos Tests","Nombre de la base de datos donde se almacenarán los datos de prueba de la aplicación").'<td><input type="text" name="BASEDATOSTEST" value="' . $this->datosConf['BASEDATOSTEST'] . '" maxlength="35" size="35" /></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Usuario","Usuario con permisos de lectura/escritura en la base de datos").'<td><input type="text" name="USUARIO" value="' . $this->datosConf['USUARIO'] . '" maxlength="35" size="35" /></td></tr>';
$salida.='<tr>'.$this->creaTitulo("Clave","Contraseña del usuario con permisos sobre la base de datos").'<td><input type="text" name="CLAVE" value="' . $this->datosConf['CLAVE'] . '" maxlength="35" size="35" /></td></tr>';
$salida.='<tr>'.$this->creaTitulo("mysqldump","Ruta completa a la utilidad mysqldump. Este programa es necesario para que se puedan hacer las copias de seguridad de la aplicación").'<td><input type="text" name="MYSQLDUMP" value="' . $this->datosConf['MYSQLDUMP'] . '" maxlength="35" size="35" /></td></tr>';
$salida.='<tr>'.$this->creaTitulo("gzip","Ruta completa a la utilidad gzip. Este programa es necesario para que se puedan comprimir las copias de seguridad de la aplicación").'<td><input type="text" name="GZIP" value="' . $this->datosConf['GZIP'] . '" maxlength="35" size="35" /></td></tr>';
$salida.='<tr align=center><td colspan=2>
<a class="btn btn-info" role="button" onClick="location.href=' . "'index.php'" . '"><span class="glyphicon glyphicon-arrow-left"></span> Volver</a>
<button type="submit" class="btn btn-primary" name="aceptar"><span class="glyphicon glyphicon-ok"></span> Aceptar</td></tr></p>';
$salida.='<tr><td>Servidor</td><td><input type="text" name="SERVIDOR" value="' . $this->datosConf['SERVIDOR'] . '" 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>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>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 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.="<script>
$(document).ready(function() {
@@ -164,10 +154,11 @@ class Configuracion {
});
$('select[name=" . '"COLORLAT"' . "]').simplecolorpicker({theme: 'glyphicons'});
$('select[name=" . '"COLORFON"' . "]').simplecolorpicker({theme: 'glyphicons'});
$('.dato').popover({trigger: 'hover'});
});
</script>";
return $salida;
}
}
?>

View File

@@ -1,128 +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 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;
}
}
?>

57
Csv.php
View File

@@ -76,8 +76,7 @@ class Csv {
* Constructor de la clase.
* @param BaseDatos $baseDatos Manejador de la base de datos
*/
public function __construct($baseDatos)
{
public function __construct($baseDatos) {
$this->bdd = $baseDatos;
}
@@ -85,8 +84,7 @@ class Csv {
* Crea un fichero csv con el nombre especificado
* @param String $fichero Nombre del fichero
*/
public function crea($fichero)
{
public function crea($fichero) {
$this->nombre = $fichero;
$this->fichero = fopen($this->nombre, "w") or die("No puedo abrir " . $this->nombre . " para escritura.");
}
@@ -95,18 +93,15 @@ class Csv {
*
* @param array $datos escribe la línea en el archivo
*/
public function escribeLinea($datos)
{
public function escribeLinea($datos) {
fputcsv($this->fichero, $datos, ',', '"') or die("No puedo escribir en el fichero csv");
}
public function __destruct()
{
public function __destruct() {
$this->cierra();
}
public function cierra()
{
public function cierra() {
fclose($this->fichero) or die("No puedo cerrar el archivo csv");
}
@@ -114,8 +109,7 @@ class Csv {
*
* @param String $fichero Archivo xml que contiene la definición de la consulta
*/
public function ejecutaConsulta($fichero)
{
public function ejecutaConsulta($fichero) {
$consulta = simplexml_load_file($fichero) or die("No puedo cargar el fichero xml " . $fichero . " al csv");
// Escribe la cabecera del fichero
$this->escribeLinea(array($consulta->Pagina->Cabecera, $consulta->Titulo['id'], $consulta->Titulo['Texto']));
@@ -138,8 +132,7 @@ class Csv {
*
* @param String $ficheroCSV Nombre del archivo csv
*/
public function cargaCSV($ficheroCSV)
{
public function cargaCSV($ficheroCSV) {
$this->nombre = $ficheroCSV;
$this->fichero = fopen($this->nombre, "r") or die('No puedo abrir el archivo ' . $this->nombre . " para lectura.");
list($archivo, $idCabecera, $cabecera) = fgetcsv($this->fichero);
@@ -156,8 +149,7 @@ class Csv {
* Muestra un resumen de los datos del fichero csv cargado por pantalla
*
*/
public function resumen()
{
public function resumen() {
//$mensaje .=
$mensaje = "<center><h1>Archivo [inventario" . $this->cabecera[0] . "]</h1>";
$mensaje .= "<h2>id=[" . $this->cabecera[1] . "] Descripci&oacute;n=[" . $this->cabecera[2] . "]</h2><br>";
@@ -206,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 .= '<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>
<button type="submit" name="Aceptar" class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Aceptar</button>
<input type="button" name="Cancelar" value="Cancelar" onClick="location.href=' . "'index.php'" . '" class="btn btn-danger">
<input type="submit" name="Aceptar" value="Aceptar" class="btn btn-primary">
<input type="hidden" name="ficheroCSV" value="' . $this->nombre . '">
</form></center>';
@@ -219,14 +211,12 @@ class Csv {
* @param $array línea de datos del fichero csv para comprobar las cantidades si se han modificado o no
* @return string
*/
private function compruebaCantidades($i)
{
//$ultimo = count($datos);
private function compruebaCantidades($i) {
$ultimo = count($datos);
return $this->datosFichero[$i][$this->cantidadReal] - $this->datosFichero[$i][$this->cantidad];
}
private function panelMensaje($info, $tipo = "danger", $cabecera = "&iexcl;Atenci&oacute;n!")
{
private function panelMensaje($info, $tipo = "danger", $cabecera = "&iexcl;Atenci&oacute;n!") {
$mensaje = '<div class="panel panel-' . $tipo . '"><div class="panel-heading">';
$mensaje .= '<h3 class="panel-title">' . $cabecera . '</h3></div>';
$mensaje .= '<div class="panel-body">';
@@ -236,16 +226,14 @@ class Csv {
return $mensaje;
}
private function escribeLog($comando)
{
private function escribeLog($comando) {
$fp = fopen($this->nombre.".log", "a");
$linea = strftime("%Y/%m/%d")."|".$this->nombre."|".$comando;
fputs($fp, $linea . "\n");
fclose($fp);
}
private function bajaElemento($i)
{
private function bajaElemento($i) {
$id = $this->datosFichero[$i][$this->idElemento];
$comando = 'delete from Elementos where id="' . $id . '";';
$this->escribeLog($comando);
@@ -254,8 +242,7 @@ class Csv {
}
}
private function modificaElemento($i)
{
private function modificaElemento($i) {
$id = $this->datosFichero[$i][$this->idElemento];
$comando = 'update Elementos set Cantidad=' . $this->datosFichero[$i][$this->cantidadReal] . ' where id="' . $id . '";';
$this->escribeLog($comando);
@@ -264,8 +251,7 @@ class Csv {
}
}
private function altaElemento($i)
{
private function altaElemento($i) {
if ($this->cabecera[0] == "Articulo") {
$idUbicacion = $this->datosFichero[$i][$this->idUbicacion];
$idArticulo = $this->cabecera[1];
@@ -283,8 +269,7 @@ class Csv {
}
}
private function cargaIndices($campos)
{
private function cargaIndices($campos) {
for ($i = 0; $i < count($campos); $i++) {
switch ($campos[$i]) {
case "Cant. Real": $this->cantidadReal = $i;
@@ -310,8 +295,7 @@ class Csv {
/**
* Procesa contra la base de datos todas las acciones del archivo
*/
public function ejecutaFichero()
{
public function ejecutaFichero() {
$this->cargaIndices($this->datosFichero[0]);
//Realiza una transacción para que no se ejecute parcialmente una actualización
try {
@@ -346,8 +330,7 @@ class Csv {
}
}
private function ejecutaFichero2()
{
private function ejecutaFichero2() {
echo '<script>visualizaProgreso();</script>';
for ($i = 1; $i < 80; $i++) {
//sleep(1);

View File

@@ -70,7 +70,7 @@ class Distribucion {
// if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip')) {
// // introducimos la cabecera que indica que el contenido está comprimido
// 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 $pagina; // enviamos sin comprimir

View File

@@ -1,3 +1,4 @@
<?php
/**
@@ -36,7 +37,7 @@ class EtiquetasPDF {
private $docu;
private $pdf;
private $def;
private $nombreFichero;
private $nombreFichero = "tmp/informeEtiquetas.pdf";
/**
* El constructor recibe como argumento el nombre del archivo XML con la definición, encargándose de recuperarla y guardar toda la información localmente
@@ -51,7 +52,6 @@ class EtiquetasPDF {
if (!$registrado) {
return 'Debe registrarse para acceder a este apartado';
}
$this->nombreFichero = TMP."/informeEtiquetas.pdf";
// Recuperamos la definición del informe
$this->def = simplexml_load_file($definicion);
$this->bdd = $bdd;
@@ -84,8 +84,6 @@ class EtiquetasPDF {
$protocolo = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
$enlace = $protocolo . $_SERVER['SERVER_NAME'] . "/" . $aplicacion . "/index.php?elementos&opc=editar&id=";
while($tupla = $this->bdd->procesaResultado()) {
for ($j = 0; $j < $tupla['cantidad']; $j++) {
//Hay que generar tantas etiquetas como ponga la cantidad de cada elemento
if ($i % 2) {
//Columna 2
$etiq1 = 136;
@@ -105,7 +103,7 @@ class EtiquetasPDF {
}
$py = 6 + 41 * $fila;
$enlace2=$enlace.$tupla['idEl'];
$fichero = TMP."/etiq".rand(1000,9999).".png";
$fichero = "tmp/etiq".rand(1000,9999).".png";
QRcode::png($enlace2, $fichero);
$this->pdf->image($fichero, $etiq2, $py, 30, 30);
unlink($fichero);
@@ -132,7 +130,6 @@ class EtiquetasPDF {
$this->pdf->Cell(30, 10, $cadena);
$i++;
}
}
//$this->pdf->MultiCell(0,30,var_export($filas,true));
}
@@ -155,7 +152,7 @@ class EtiquetasPDF {
return $cabecera;
}
public function guardaArchivo($nombre)
public function guardaArchivo($nombre = "tmp/Informe.pdf")
{
$fichero = fopen($nombre, "w");
fwrite($fichero, $this->getCabecera());

View File

View File

@@ -1,183 +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 $archivoCopiado;
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 (isset($_FILES[$campo]['error']) && $_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 copiaImagenId($valorImagen, $tabla, $id, &$mensaje)
{
$extension = strrchr($valorImagen, ".");
$nombre = $this->dirData . "/" . $tabla . "_" . $id . $extension;
if (!@copy($valorImagen, $nombre)) {
$errors= error_get_last();
$mensaje = "No pudo copiar el archivo " . $valorImagen . " en " . $nombre . " Error = [" . $errors['message'] . "]";
return false;
}
$this->archivoCopiado = $nombre;
return true;
}
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

@@ -44,7 +44,7 @@ class Importacion {
}
private function importarFichero() {
$uploadfile = TMP."/" . basename($_FILES['fichero']['name']);
$uploadfile = "tmp/" . basename($_FILES['fichero']['name']);
if (!move_uploaded_file($_FILES['fichero']['tmp_name'], $uploadfile)) {
die('No se pudo subir el fichero ' . $_FILES['userfile']['tmp_name']);
}
@@ -55,32 +55,12 @@ class Importacion {
private function formulario() {
$accion = "index.php?importacion&opc=importar";
$salida = "";
//$salida .= '<script type="text/javascript" src="css/bootstrap-filestyle.min.js"> </script>';
$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></p>\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" class="filestyle" data-input="false">';
$salida .= '<div class="fileinput fileinput-new" data-provides="fileinput">
<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></fieldset>';
$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'>"."
$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 .= '<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";
$mensaje = utf8_decode('Sólo se permiten archivos con extensión CSV');
$salida .= "<script type='text/javascript'>
function seleccionFichero(obj) {
var filePath = obj.value;

View File

@@ -23,61 +23,35 @@ class InformeInventario {
private $bdd;
public function __construct($baseDatos)
{
public function __construct($baseDatos) {
$this->bdd = $baseDatos;
}
public function ejecuta()
{
public function ejecuta() {
$opc = $_GET['opc'];
switch ($opc) {
case 'Ubicacion':return $this->formularioUbicacion();
case 'listarUbicacion':return $this->listarUbicacion();
case 'listarArticulo':return $this->listarArticulo();
case 'listarTotal': return $this->listarTotal();
case 'Articulo':return $this->formularioArticulo();
case 'Total':return $this->inventarioTotal();
case 'descuadres': return $this->inventarioDescuadres();
}
}
private function inventarioDescuadres()
{
$enlace = 'xml/informeDescuadres.xml';
$informe = new InformePDF($this->bdd, $enlace, true);
$informe->crea($enlace);
$informe->cierraPDF();
return $this->devuelveInforme($informe);
}
private function devuelveInforme($informe)
{
$letras = "abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
$nombre = TMP."/informe" . substr(str_shuffle($letras), 0, 10) . ".pdf";
$informe->guardaArchivo($nombre);
return '<div class="container">
<!--<a href="' . $nombre . '" target="_blank"><span class="glyphicon glyphicon-cloud-download" style="font-size:1.5em;"></span>Descargar Informe</a>-->
<object data="' . $nombre . '" type="application/pdf" width="100%" height="700" style="float:left;">
</object>
</div>';
}
private function listarUbicacion()
{
private function listarUbicacion() {
$salidaInforme = isset($_POST['salida']) ? $_POST['salida'] : 'pantalla';
switch ($salidaInforme) {
case "pantalla":
$fichero = "xml/inventarioUbicacion.xml";
$salida = TMP."/inventarioUbicacion.xml";
$salida = "tmp/inventarioUbicacion.xml";
break;
case "csv":
$fichero = "xml/inventarioUbicacionCSV.xml";
$salida = TMP."/inventarioUbicacionCSV.xml";
$salida = "tmp/inventarioUbicacionCSV.xml";
break;
case "etiquetas":
$fichero = "xml/inventarioUbicacionEtiquetas.xml";
$salida = TMP."/inventarioUbicacionEtiquetas.xml";
$salida = "tmp/inventarioUbicacionEtiquetas.xml";
break;
}
$plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
@@ -96,10 +70,12 @@ class InformeInventario {
$informe = new InformePDF($this->bdd, $salida, true);
$informe->crea($salida);
$informe->cierraPDF();
return $this->devuelveInforme($informe);
$informe->guardaArchivo("tmp/Informe.pdf");
echo '<script type="text/javascript"> window.open( "tmp/Informe.pdf" ) </script>';
break;
case "csv":
//Genera una hoja de cálculo en formato csv
$nombre = TMP."/Ubicacion" . strftime("%Y%m%d") . rand(100, 999) . ".csv";
$nombre = "tmp/Ubicacion" . strftime("%Y%m%d") . rand(100, 999) . ".csv";
$hoja = new Csv($this->bdd);
$hoja->crea($nombre);
$hoja->ejecutaConsulta($salida);
@@ -109,25 +85,26 @@ class InformeInventario {
$etiquetas = new EtiquetasPDF($this->bdd, $salida, true);
$etiquetas->crea($salida);
$etiquetas->cierraPDF();
return $this->devuelveInforme($etiquetas);
$etiquetas->guardaArchivo("tmp/EtiquetasUbicacion.pdf");
echo '<script type="text/javascript"> window.open( "tmp/EtiquetasUbicacion.pdf" ) </script>';
break;
}
}
private function listarArticulo()
{
private function listarArticulo() {
$salidaInforme = isset($_POST['salida']) ? $_POST['salida'] : 'pantalla';
switch ($salidaInforme) {
case "pantalla":
$fichero = "xml/inventarioArticulo.xml";
$salida = TMP."/inventarioArticulo.xml";
$salida = "tmp/inventarioArticulo.xml";
break;
case "csv":
$fichero = "xml/inventarioArticuloCSV.xml";
$salida = TMP."/inventarioArticuloCSV.xml";
$salida = "tmp/inventarioArticuloCSV.xml";
break;
case "etiquetas":
$fichero = "xml/inventarioArticuloEtiquetas.xml";
$salida = TMP."/inventarioArticuloEtiquetas.xml";
$salida = "tmp/inventarioArticuloEtiquetas.xml";
break;
}
$plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
@@ -148,10 +125,12 @@ class InformeInventario {
$informe = new InformePDF($this->bdd, $salida, true);
$informe->crea($salida);
$informe->cierraPDF();
return $this->devuelveInforme($informe);
$informe->guardaArchivo("tmp/Informe.pdf");
echo '<script type="text/javascript"> window.open( "tmp/Informe.pdf" ) </script>';
break;
case "csv":
//Genera una hoja de cálculo en formato csv
$nombre = TMP."/Articulo" . strftime("%Y%m%d") . rand(100, 999) . ".csv";
$nombre = "tmp/Articulo" . strftime("%Y%m%d") . rand(100, 999) . ".csv";
$hoja = new Csv($this->bdd);
$hoja->crea($nombre);
$hoja->ejecutaConsulta($salida);
@@ -161,13 +140,14 @@ class InformeInventario {
$etiquetas = new EtiquetasPDF($this->bdd, $salida, true);
$etiquetas->crea($salida);
$etiquetas->cierraPDF();
return $this->devuelveInforme($etiquetas);
$etiquetas->guardaArchivo("tmp/EtiquetasArticulo.pdf");
echo '<script type="text/javascript"> window.open( "tmp/EtiquetasArticulo.pdf" ) </script>';
break;
}
}
private function listaUbicaciones()
{
$salida = "<select class=\"selectpicker show-tick\" name=\"id\" data-live-search=\"true\" data-width=\"auto\">\n";
private function listaUbicaciones() {
$salida = "<select class=\"form-control\" name=\"id\">\n";
$comando = "select * from Ubicaciones order by Descripcion";
$resultado = $this->bdd->ejecuta($comando);
if (!$resultado) {
@@ -180,9 +160,8 @@ class InformeInventario {
return $salida;
}
private function listaArticulos()
{
$salida = "<select class=\"selectpicker show-tick\" name=\"id\" data-live-search=\"true\" data-width=\"auto\">\n";
private function listaArticulos() {
$salida = "<select class=\"form-control\" name=\"id\">\n";
$comando = "select * from Articulos order by descripcion, marca, modelo";
$resultado = $this->bdd->ejecuta($comando);
if (!$resultado) {
@@ -195,57 +174,34 @@ class InformeInventario {
return $salida;
}
private function formulario($accion, $etiqueta, $lista)
{
$salida = '<div class="col-sm-6 col-md-6"><form name="informeInventario.form" method="post" action="' . $accion . '">' . "\n";
private function formulario($accion, $etiqueta, $lista) {
$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.="<br><br><label>$etiqueta</label>";
$salida.=$lista;
$salida.="<br><br>
<label for='salida'>Salida del informe por:</label>";
$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"><span class="glyphicon glyphicon-cloud-download"></span> Archivo CSV</label></div>';
$salida.='<div class="radio"><label><input type="radio" name="salida" value="etiquetas"><span class="glyphicon glyphicon-qrcode"></span> Etiquetas (<a target="_new" href="http://www.apli.es/producto/ficha_producto.aspx?referencia=01275&stype=referencia&referenciaValue=01275&q=01275">Apli 1275</a>)</label></div>';
$salida.="<br><br><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="csv">Archivo CSV</label></div>';
$salida.='<div class="radio"><label><input type="radio" name="salida" value="etiquetas">Etiquetas</label></div>';
$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.="<script>$('.selectpicker').selectpicker();</script>";
$salida.='<p align="center"><button type=submit class="btn btn-primary">Aceptar</button></p><br></div>' . "\n";
return $salida;
}
private function formularioUbicacion()
{
private function formularioUbicacion() {
//Genera un formulario con las ubicaciones disponibles.
$accion = "index.php?informeInventario&opc=listarUbicacion";
return $this->formulario($accion, 'Ubicaci&oacute;n', $this->listaUbicaciones());
}
private function formularioArticulo()
{
private function formularioArticulo() {
$accion = "index.php?informeInventario&opc=listarArticulo";
return $this->formulario($accion, 'Art&iacute;culo', $this->listaArticulos());
}
private function inventarioTotal()
{
return $this->dialogo();
}
private function dialogo()
{
$dialogo = '<div class="container col-5"><div class="jumbotron">
<h1>Inventario Total</h1>
<p>¿Desea obtener el inventario de todo el centro?</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?informeInventario&opc=listarTotal'" . '">
<span class="glyphicon glyphicon-list-alt"></span> Continuar</a></p>
</div></div>';
return $dialogo;
}
private function listarTotal()
{
private function inventarioTotal() {
$fichero = "xml/inventarioUbicacion.xml";
$salida = TMP."/inventarioUbicacion.xml";
$salida = "tmp/inventarioUbicacion.xml";
$comando = "select * from Ubicaciones ;";
$resultado = $this->bdd->ejecuta($comando);
if (!$resultado) {
@@ -255,6 +211,7 @@ class InformeInventario {
$bdatos = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
$primero = true;
while ($fila = $this->bdd->procesaResultado()) {
//$fila=$this->bdd->procesaResultado();
$plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
$plantilla = str_replace("{id}", $fila['id'], $plantilla);
$plantilla = str_replace("{Descripcion}", $fila['Descripcion'], $plantilla);
@@ -265,10 +222,10 @@ class InformeInventario {
}
$informe->crea($salida);
}
$nombre = "tmp/total.pdf";
$informe->cierraPDF();
return $this->devuelveInforme($informe);
$informe->imprimeInforme();
}
}
?>

View File

@@ -1,3 +1,4 @@
<?php
/**
@@ -54,7 +55,7 @@ class InformePDF {
//echo $def->Titulo.$def->Cabecera;
$this->pdf->Open();
$this->pdf->setAuthor(AUTOR,true);
$creador = CENTRO . " " . PROGRAMA . " v" . VERSION;
$creador = CENTRO . " " . PROGRAMA.VERSION;
$this->pdf->setCreator(html_entity_decode($creador),true);
$this->pdf->setSubject($this->def->Titulo,true);
$this->pdf->setAutoPageBreak(true, 10);
@@ -93,13 +94,11 @@ class InformePDF {
public function getCabecera() {
$cabecera = "Content-type: application/pdf";
$cabecera = $cabecera . "Content-length: " . strlen($this->docu);
$cabecera = $cabecera . "Content-Disposition: inline; filename=".TMP."/Informe.pdf";
$cabecera = $cabecera . "Content-Disposition: inline; filename=tmp/Informe.pdf";
return $cabecera;
}
public function guardaArchivo($nombre) {
if (!isset($nombre))
$nombre = TMP . "/Informe.pdf";
public function guardaArchivo($nombre = "tmp/Informe.pdf") {
$fichero = fopen($nombre, "w");
fwrite($fichero, $this->getCabecera());
fwrite($fichero, $this->getContenido(), strlen($this->getContenido()));
@@ -110,7 +109,7 @@ class InformePDF {
header("Content-type: application/pdf");
$longitud = strlen($this->docu);
header("Content-length: $longitud");
header("Content-Disposition: inline; filename=".TMP."/Informe.pdf");
header("Content-Disposition: inline; filename=tmp/Informe.pdf");
}
public function imprimeInforme() {

View File

@@ -1,558 +0,0 @@
<?php
/**
* Programa de instalación que genera el entorno de ejecución
* tanto el fichero de configuración como la base de datos
* @package Inventario
* @copyright Copyright (c) 2008, 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/>.
*
*/
//Se incluyen los módulos necesarios
function __autoload($class_name) {
require_once $class_name . '.php';
}
require_once 'inc/configuracion.inc';
define('NUMPASOS', 3);
//Para el Paso 1
define('MINBYTES', 4096000); // post_max_size y max_upload van con esto
define('CADENAMINBYTES', '4M');
define('CONFIGURACION', 'inc/configuracion.inc');
define('CONFIGTMP', TMP.'/config.tmp');
define('INC', './inc');
$instalar = new Instalar();
if ($instalar->error) {
echo $instalar->panelError();
return;
}
echo $instalar->ejecuta();
class Instalar {
private $contenido;
private $plant;
public $error;
public $error_msj;
public function __construct()
{
//Selecciona la plantilla a utilizar
$this->plant='plant/';
$this->plant.=PLANTILLA;
$this->plant.='.html';
$this->error = false;
$this->eror_msj = '';
if (INSTALADO != 'no') {
$this->error = true;
$this->error_msj = 'El programa ya está instalado';
}
/*if ($this->existenDatos()) {
$this->error = true;
$this->error_msj = "El indicador de instalación tiene 'no' pero la base de datos " . BASEDATOS . " contiene la tabla Articulos.";
}*/
}
private function existenDatos()
{
//Comprueba si existe la tabla Articulos
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
if ($sql->error())
return false;
$sql->ejecuta('select * from Articulos;');
if ($sql->error())
return false;
return true;
}
public function ejecuta()
{
$paso = isset($_GET['paso']) ? $_GET['paso'] : 0;
$paso = $paso > NUMPASOS ? '0' : $paso;
$i=0;
//Si quiere ir a un determinado paso se asegura que estén completos los anteriores
for ($i = 0; $i < $paso; $i++) {
$funcion = "validaPaso" . $i;
if (!$this->$funcion()) {
break;
}
}
$funcion = "paso" . $i;
$this->contenido = $this->$funcion();
$salida = new Distribucion($this->plant, $this);
return $salida->procesaPlantilla();
}
// Cuestiones relacionadas con el servidor
private function paso0()
{
$info = '<ul class="list-group">';
$info .= '<li class="list-group-item list-group-item-info">Configuración de PHP (php.ini)</li>';
// display_errors
$displayErr = ini_get('display_errors');
$displayErr = $displayErr == "1" || $displayErr == "on" ? "on" : "off";
$mensaje = $displayErr == "off" ? $this->retornaLabel(false,'Se debe deshabilitar la impresión de errores') :
$this->retornaLabel(true, 'Se debe deshabilitar la impresión de errores', "warning");
$info .= $this->retornaElemento($mensaje, 'display_errors', $displayErr);
// post_max_size
$postMax = ini_get('post_max_size');
$mensaje = $this->retornaBytes($postMax) >= MINBYTES ? $this->retornaLabel(false, 'Mínimo: ' . CADENAMINBYTES) :
$this->retornaLabel(true, 'Mínimo: ' . CADENAMINBYTES);
$info .= $this->retornaElemento($mensaje, 'post_max_size', $postMax);
// upload_max_filesize
$uploadMax = ini_get('upload_max_filesize');
$mensaje = $this->retornaBytes($uploadMax) >= MINBYTES ? $this->retornaLabel(false, 'Mínimo: ' . CADENAMINBYTES) :
$this->retornaLabel(true, 'Mínimo: ' . CADENAMINBYTES);
$info .= $this->retornaElemento($mensaje, 'upload_max_filesize', $uploadMax);
// mysqli
$mysql = extension_loaded('mysqli');
$mysql = $mysql ? "on" : "off";
$mensaje = $mysql ? $this->retornaLabel(false, 'Tiene que estar cargada la extensión MySQLi para poder funcionar') :
$this->retornaLabel(true, 'Tiene que estar cargada la extensión MySQLi para poder funcionar');
$info .= $this->retornaElemento($mensaje, 'extensión MySQLi', $mysql);
$info .= '<li class="list-group-item list-group-item-info">Configuración de la Aplicación</li>';
// img.dat
$mensaje = is_writable(IMAGEDATA) ? $this->retornaLabel(false, "Se debe poder escribir en el directorio " . IMAGEDATA) :
$this->retornaLabel(true, "Se debe poder escribir en el directorio " . IMAGEDATA);
$valor = is_writable(IMAGEDATA) ? "" : "No";
$info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . IMAGEDATA, $valor);
// tmp
$mensaje = is_writable(TMP) ? $this->retornaLabel(false, "Se debe poder escribir en el directorio " . TMP) :
$this->retornaLabel(true, "Se debe poder escribir en el directorio " . TMP);
$valor = is_writable(TMP) ? "" : "No";
$info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . TMP, $valor);
// inc
$mensaje = is_writable(INC) ? $this->retornaLabel(false, "Se debe poder escribir en el directorio " . INC) :
$this->retornaLabel(true, "Se debe poder escribir en el directorio " . INC);
$valor = is_writable(INC) ? "" : "No";
$info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . INC, $valor);
// configuracion.inc
$mensaje = is_writable(CONFIGURACION) ? $this->retornaLabel(false, "Se debe poder escribir en el fichero de configuración ". CONFIGURACION) :
$this->retornaLabel(true, "Se debe poder escribir en el fichero de configuración ". CONFIGURACION);
$valor = is_writable(CONFIGURACION) ? "" : "No";
$info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . CONFIGURACION, $valor);
// Final del paso
$info .='</ul>';
$info .= $this->validaPaso0() ? $this->retornaBoton(false, "Instalar.php?paso=1") : $this->retornaBoton(true, "Instalar.php");
$panel = $this->panelMensaje($info, 'primary', 'PASO 1: Configuración del servidor y la aplicación');
return $panel;
}
private function retornaElemento($validacion, $mensaje, $valor)
{
$info = '<li class="list-group-item">';
$info .= $validacion . ' ' . $mensaje . ': <span class="badge">' . $valor . '</span>';
$info .= '</li>';
return $info;
}
private function retornaBoton($error, $paso, $javascript = true)
{
$anadido = $javascript ? 'onclick="location.href=' . "'" . $paso . "'". '"' : '';
if (!$error) {
return '<button ' . $anadido . ' type="submit" class="btn btn-success btn-lg pull-right">Continuar <span class="glyphicon glyphicon-arrow-right"></span></button>';
} else {
return '<button ' . $anadido . ' type="submit" class="btn btn-danger btn-lg pull-right">Comprobar de nuevo <span class="glyphicon glyphicon-repeat"></span></button>';
}
}
private function botonVolver($enlace)
{
$boton = '<button type="button" onClick="location.href=' . "'$enlace'" . '" class="btn btn-success btn-lg pull-left">Paso anterior <span class="glyphicon glyphicon-arrow-left"></span></button>';
return $boton;
}
private function retornaLabel($error, $mensaje, $tipo = "danger")
{
if ($error) {
$nombre1 = $tipo; $nombre2 = "remove";
} else {
$nombre1 = "success"; $nombre2 = "ok";
}
$mensaje = '<a href="#" data-placement="right" data-toggle="popover" data-content="' . $mensaje .
'"><span class="label label-' . $nombre1 . '"><span class="glyphicon glyphicon-' . $nombre2 .
'"></span></a>';
$mensaje .='<script>$(function () { $("[data-toggle=\'popover\']").popover(); });</script>';
return $mensaje;
}
private function retornaBytes($val)
{
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
switch($last) {
// El modificador 'G' está disponble desde PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}
return $val;
}
private function validaPaso0()
{
$validar = true;
$postMax = ini_get('post_max_size');
$uploadMax = ini_get('upload_max_filesize');
$mysql = extension_loaded('mysqli');
$escConfig = is_writable(CONFIGURACION);
$escInc = is_writable(INC);
$escTMP = is_writable(TMP);
$escIMG = is_writable(IMAGEDATA);
if ($this->retornaBytes($postMax) < MINBYTES)
$validar = false;
if ($this->retornaBytes($uploadMax) < MINBYTES)
$validar = false;
if (!$mysql)
$validar = false;
if (!$escConfig)
$validar = false;
if (!$escTMP)
$validar = false;
if (!$escIMG)
$validar = false;
if (!$escInc)
$validar = false;
return $validar;
}
private function actualizaConfiguracion($grabar, $campos, &$datos)
{
$conf = new Configuracion();
$fichero = $conf->obtieneFichero();
$datosFichero = explode("\n", $fichero);
if ($grabar) {
$fsalida = @fopen(CONFIGTMP, "wb");
}
foreach ($datosFichero as $linea) {
if (stripos($linea, "DEFINE") !== false) {
$conf->obtieneDatos($linea, $clave, $valor);
if (stripos($campos, $clave) !== false) {
if ($grabar) {
$linea = str_replace($valor, $datos[$clave], $linea);
$valor = $datos[$clave];
}
}
$datos[$clave] = $valor;
}
$registro = substr($linea, 0, 2) == "?>" ? $linea : $linea . "\n";
if ($grabar) {
fwrite($fsalida, $registro);
}
}
if ($grabar) {
fclose($fsalida);
unlink(CONFIGURACION);
rename(CONFIGTMP, CONFIGURACION);
}
}
// Cuestiones de la base de datos
private function paso1()
{
$grabar = isset($_POST['SERVIDOR']);
$campos = 'SERVIDOR,PUERTO,BASEDATOS,USUARIO,CLAVE';
//Lee y si hace falta actualiza los datos del formulario en el fichero de configuración
if ($grabar) {
foreach ($_POST as $clave => $valor) {
$datos[$clave] = $valor;
}
} else {
$datos = array();
}
$this->actualizaConfiguracion($grabar, $campos, $datos);
if ($grabar && $this->validaPaso1()) {
//Pasa al paso siguiente
return $this->paso2();
}
$info = '<form method="post" name="conf" action="Instalar.php?paso=1">';
$info .= '<ul class="list-group">';
$info .= '<li class="list-group-item list-group-item-info">Datos de configuración</li>';
$info .= '<li class="list-group-item">Servidor <input type="text" name="SERVIDOR" class="form-control" placeholder="Nombre del servidor o dirección IP" value="'. $datos['SERVIDOR'] .'"></li>';
$info .= '<li class="list-group-item">Puerto <input type="text" name="PUERTO" class="form-control" placeholder="Puerto de conexión" value="'. $datos['PUERTO'] .'"></li>';
$info .= '<li class="list-group-item">Base de Datos <input type="text" name="BASEDATOS" class="form-control" placeholder="Nombre de la Base de Datos" value="'. $datos['BASEDATOS'] .'"></li>';
$info .= '<li class="list-group-item">Usuario <input type="text" name="USUARIO" class="form-control" placeholder="Usuario" value="'. $datos['USUARIO'] .'"></li>';
$info .= '<li class="list-group-item">Contraseña <input type="text" name="CLAVE" class="form-control" placeholder="Contraseña" value="'. $datos['CLAVE'] .'"></li>';
$info .= '</ul>';
$info .= $this->botonVolver("Instalar.php");
$info .= $this->validaPaso1() ? $this->retornaBoton(false, "Instalar.php?paso=1", false) : $this->retornaBoton(true, "Instalar.php?paso=1", false);
$info .= '</form>';
$panel = $this->panelMensaje($info, 'primary', 'PASO 2: Configuración de la Base de Datos.');
return $panel;
}
private function validaPaso1()
{
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, '');
if ($sql->error())
return false;
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
if ($sql->error()) {
return false;
}
$comando = 'create table test2 (id int(10));';
$sql->ejecuta($comando);
if ($sql->error()) {
return false;
}
$comando = 'drop table test2;';
$sql->ejecuta($comando);
if ($sql->error()) {
return false;
}
return true;
}
// Usuario administrador
private function paso2()
{
if (isset($_POST['usuario'])) {
//ha enviado el formulario.
//Crea la base de datos
$borra_database = "DROP DATABASE " . BASEDATOS . " ;";
$database = "CREATE DATABASE " . BASEDATOS . " DEFAULT CHARACTER SET utf8;";
$articulos = "CREATE TABLE `Articulos` (
`id` smallint(6) NOT NULL auto_increment COMMENT 'ordenable,link/Articulo',
`descripcion` varchar(60) NOT NULL COMMENT 'ordenable,ajax/text',
`marca` varchar(20) default NULL COMMENT 'ordenable,ajax/text',
`modelo` varchar(20) default NULL COMMENT 'ordenable,ajax/text',
`cantidad` int(11) default NULL COMMENT 'ordenable,ajax/number',
`imagen` varchar(45) default NULL COMMENT 'imagen',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=769 DEFAULT CHARSET=utf8;
";
$ubicaciones = "CREATE TABLE `Ubicaciones` (
`id` smallint(5) unsigned NOT NULL auto_increment COMMENT 'ordenable,link/Ubicacion',
`Descripcion` varchar(50) NOT NULL COMMENT 'ordenable,ajax/text',
`imagen` varchar(45) DEFAULT NULL COMMENT 'imagen',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=179 DEFAULT CHARSET=utf8;
";
$elementos = "CREATE TABLE `Elementos` (
`id` int(10) unsigned NOT NULL auto_increment COMMENT 'ordenable',
`id_Articulo` smallint(6) NOT NULL COMMENT 'foreign(Articulos;id),ordenable',
`id_Ubicacion` smallint(5) unsigned NOT NULL COMMENT 'foreign(Ubicaciones;id),ordenable',
`numserie` varchar(30) default NULL COMMENT 'ordenable,ajax/text',
`cantidad` int(10) unsigned default NULL COMMENT 'ordenable,ajax/number',
`fechaCompra` date NOT NULL COMMENT 'ordenable,ajax/combodate',
`imagen` varchar(45) default NULL COMMENT 'imagen',
PRIMARY KEY (`id`),
KEY `id` (`id`),
KEY `id_Articulo` (`id_Articulo`),
KEY `id_Ubicacion` (`id_Ubicacion`),
CONSTRAINT `Elementos_ibfk_1` FOREIGN KEY (`id_Articulo`) REFERENCES `Articulos` (`id`) ON DELETE CASCADE,
CONSTRAINT `Elementos_ibfk_2` FOREIGN KEY (`id_Ubicacion`) REFERENCES `Ubicaciones` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1789 DEFAULT CHARSET=utf8;
";
$usuarios = "CREATE TABLE `Usuarios` (
`id` int(10) unsigned NOT NULL auto_increment COMMENT 'ordenable',
`nombre` varchar(16) NOT NULL default '' COMMENT 'ajax/text',
`clave` varchar(32) NOT NULL default '' COMMENT 'ajax/text',
`idSesion` varchar(20) NOT NULL default '' COMMENT 'ajax/text',
`alta` tinyint(1) NOT NULL default '0',
`modificacion` tinyint(1) NOT NULL default '0',
`borrado` tinyint(1) NOT NULL default '0',
`consulta` tinyint(1) NOT NULL default '1',
`informe` tinyint(1) NOT NULL default '1',
`usuarios` tinyint(1) NOT NULL default '0',
`config` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `nombre` (`nombre`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
";
$letras = "abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
$sesion = substr(str_shuffle($letras), 0, 8);
$usuario = $_POST['usuario'];
$clave = $_POST['clave'];
$administrador = "insert into Usuarios values (null,'$usuario','$clave','$sesion','1','1','1','1','1','1','1');";
@mysqli_query($borra_database);
@mysqli_query($database);
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
$sql->ejecuta($ubicaciones);
if ($sql->error()) {
return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
}
$sql->ejecuta($articulos);
if ($sql->error()) {
return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
}
$sql->ejecuta($elementos);
if ($sql->error()) {
return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
}
$sql->ejecuta($usuarios);
if ($sql->error()) {
return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
}
$sql->ejecuta($administrador);
if ($sql->error()) {
return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
}
$campos="INSTALADO";
$datos['INSTALADO'] = "";
$this->actualizaConfiguracion(true, $campos, $datos);
return $this->resumen();
}
$info = '
<form data-toggle="validator" role="form" class="form-horizontal" method="post" action="Instalar.php?paso=2">
<div class="form-group">
<label for="usuario" class="control-label col-sm-2">Usuario</label>
<div class="form-group col-sm-10">
<input type="text" class="form-control" id="usuario" name="usuario" placeholder="nombre de usuario" data-minlength="5" data-minlength-error="Mínimo 5 caracteres" required>
<div class="help-block with-errors">Mínimo 5 caracteres</div>
</div>
</div>
<div class="form-group">
<label for="clave" class="control-label col-sm-2">Contraseña</label>
<div class="form-group col-sm-10">
<input type="password" data-toggle="validator" data-minlength="6" class="form-control" id="clave" name="clave" placeholder="Contraseña" data-minlength-error="Mínimo 6 caracteres" required>
<span class="help-block with-errors">Mínimo 6 caracteres</span>
<input type="password" class="form-control" id="claverepetida" data-match="#clave" data-match-error="No coincide" data-minlength-error="Mínimo 6 caracteres" placeholder="Confirmar contraseña" required>
<div class="help-block with-errors">Mínimo 6 caracteres</div>
</div>
</div>
<div class="form-group col-sm-12">
' . $this->botonVolver("Instalar.php?paso=1") . '
<button type="submit" class="btn btn-primary pull-right btn-lg" disabled="disabled">Crear base de datos y usuario <span class="glyphicon glyphicon-arrow-right"></button>
</div>
</div>
</form>
<script type="text/javascript" src="./css/validator.min.js"></script>';
$panel = $this->panelMensaje($info, 'primary', 'PASO 3: Creación de la base de datos y el usuario administrador.');
return $panel;
}
private function validaPaso2()
{
//La validación de este paso se hace con la del formulario en javascript
return true;
}
public function panelMensaje($info, $tipo = "info", $cabecera = "&iexcl;Atenci&oacute;n!") {
$mensaje = '<div class="panel panel-' . $tipo . ' col-sm-6"><div class="panel-heading">';
$mensaje .= '<h3 class="panel-title">' . $cabecera . '</h3></div>';
$mensaje .= '<div class="panel-body">';
$mensaje .= $info;
$mensaje .= '</div>';
$mensaje .= '</div>';
return $mensaje;
}
public function contenido()
{
return $this->contenido;
}
public function menu()
{
return '';
}
public function opcion()
{
return 'INSTALACI&Oacute;N';
}
public function control()
{
return '';
}
public function aplicacion()
{
return PROGRAMA . ' v' . VERSION;
}
public function usuario()
{
return '';
}
public function fecha()
{
$idioma = 'es_ES';
$formato = "%d-%b-%y";
setlocale(LC_TIME, $idioma);
return strftime($formato);
}
public function cabecera()
{
return '<!DOCTYPE html>
<html lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="Ricardo Montañana">
<link rel="shortcut icon" href="img/tux.ico">
<title>Inventario</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/dashboard.php" 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-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>
<script type="text/javascript" src="./css/jquery.min.js"></script>
<script type="text/javascript" src="./css/bootstrap-select/bootstrap-select.min.js"></script>
</head>
<body>';
}
public function panelError()
{
$mensaje = $this->cabecera();
$mensaje .= $this->panelMensaje($this->error_msj, "danger", "&iexcl;ERROR!");
$mensaje .= "</body></html>";
return $mensaje;
}
private function resumen()
{
$info = '<ul class="list-group">';
$info .= '<li class="list-group-item list-group-item-info">Paso 1</li>';
$info .= $this->retornaElemento($this->retornaLabel(false, ""), "Configuración de PHP");
$info .= $this->retornaElemento($this->retornaLabel(false, ""), "Configuración de la aplicación");
$info .= '<li class="list-group-item list-group-item-info">Paso 2</li>';
$info .= $this->retornaElemento($this->retornaLabel(false, ""), "Configuración de la base de datos");
$info .= '<li class="list-group-item list-group-item-info">Paso 3</li>';
$info .= $this->retornaElemento($this->retornaLabel(false, ""), "Creación de Base de datos");
$info .= $this->retornaElemento($this->retornaLabel(false, ""), "Creación del usuario administrador");
$info .= '</ul>';
$info .= $this->retornaBoton(false, "index.php", true);
$panel = $this->panelMensaje($info, 'success', 'Instalación finalizada.');
return $panel;
}
}
?>

View File

@@ -40,19 +40,14 @@ class Inventario {
// Analizamos la cadena de solicitud para saber
// qué opción es la actual
$this->opcActual = $_SERVER['QUERY_STRING'] == '' ? 'principal' : $_SERVER['QUERY_STRING'];
//Si el programa no está instalado, llama al instalador.
if (INSTALADO == "no") {
header('location: Instalar.php');
return;
}
// Iniciamos una sesión
session_start();
//Conexión con la base de datos.
$this->bdd = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
if ($this->bdd->error()) {
echo '<h1>Fallo al conectar con el servidor MySQL.</h1>';
echo "Servidor [ " . SERVIDOR . " ] base de datos [" . BASEDATOS . "]";
echo SERVIDOR;
echo "Servidor [ " . SERVIDOR . " ] usuario [" . USUARIO . "] clave [" . CLAVE . "] base [" . BASEDATOS . "]";
$this->estado = false;
return;
} else {
@@ -109,7 +104,7 @@ class Inventario {
$_SESSION['Usuario'] = $this->usuario;
$_SESSION['Perfil'] = $this->perfil;
// 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
header('Location: index.php?bienvenido');
exit;
@@ -129,10 +124,22 @@ class Inventario {
// Creamos un objeto Distribución facilitándole el
// nombre del archivo plantilla y el objeto que aportará
// 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());
echo $salida->procesaPlantilla();
break;
}
}
}
@@ -203,6 +210,7 @@ class Inventario {
$_SESSION['Perfil'] = $this->perfil;
}
}
}
?>

View File

@@ -23,7 +23,6 @@
define('EDICION', 'Edici&oacute;n');
define('BORRADO', '<i>Borrado</i>');
define('ANADIR', 'Inserci&oacute;n');
define('CLONAR', 'Clonar');
class Mantenimiento {
@@ -92,10 +91,7 @@ class Mantenimiento {
$sentido = "&sentido=" . $this->datosURL['sentido'];
$pag = "&pag=" . $this->datosURL['pag'];
//Ahora los datos opcionales
//$buscar = isset($this->cadenaBusqueda) ? '&buscar="'.$this->cadenaBusqueda.'"' : null;
//$buscar = isset($this->cadenaBusqueda) ? "&buscar='$this->cadenaBusqueda'" : null;
//$buscar = isset($this->cadenaBusqueda) ? "&buscar=$this->cadenaBusqueda" : null;
$buscar = isset($this->cadenaBusqueda) ? "&buscar=" . urlencode($this->cadenaBusqueda) : null;
$buscar = isset($this->cadenaBusqueda) ? "&buscar=$this->cadenaBusqueda" : null;
$id = isset($this->datosURL['id']) ? "&id=" . $this->datosURL['id'] : null;
$enlace = $this->url . $opc . $orden . $sentido . $pag . $buscar . $id;
return $enlace;
@@ -113,15 +109,10 @@ class Mantenimiento {
case 'insertar':return $this->insertar();
case 'modificar':return $this->modificar();
case 'borrar':return $this->borrar();
case 'clonar': return $this->muestra(CLONAR);
default: return "La clase Mantenimiento No entiende lo solicitado [" . $this->datosURL['opc'] . "]";
}
}
private function clonar()
{
}
protected function obtieneClavesForaneas()
{
$salida = null;
@@ -155,7 +146,7 @@ class Mantenimiento {
$cabecera = $this->cabeceraTabla();
//Trata con la cadena de búsqueda si viene del post debe quedarse con ella sino con la del get y si no está definida => vacía
if (isset($this->cadenaBusqueda) && strlen($this->cadenaBusqueda)) {
$sufijo = " where $this->campoBusca like '%" . $this->bdd->filtra(urldecode($this->cadenaBusqueda)) . "%'";
$sufijo = " where $this->campoBusca like '%" . $this->bdd->filtra($this->cadenaBusqueda) . "%'";
$comando = str_replace('{buscar}', $sufijo, $this->comandoConsulta);
} else {
$comando = str_replace('{buscar}', '', $this->comandoConsulta);
@@ -167,9 +158,9 @@ class Mantenimiento {
} else {
$comando = str_replace('{orden}', ' ', $comando);
}
$salida = $this->cargaComplementos();
//Introduce un botón para hacer búsquedas y el número de la página
$salida.= $this->enlaceBusqueda($pagSigte);
$salida = $this->enlaceBusqueda($pagSigte);
$salida.= $cabecera;
//Consulta paginada de todas las tuplas
$comando = str_replace('{inferior}', $pagina * NUMFILAS, $comando);
$comando = str_replace('{superior}', NUMFILAS, $comando);
@@ -193,23 +184,16 @@ class Mantenimiento {
$this->datosURL['pag'] = $totalPags;
header('Location: ' . $this->montaURL());
} else {
$salida .= '<br><br><div class="alert alert-danger">No hay registros</div>';
$salida = "<p align=\"center\"><center><h2>No hay registros</h2></center></p><br>";
}
} else {
$salida.= $cabecera;
}
//$salida.=$comando;
//$salida.=var_export($this->campos,true);
$cant = 0;
while ($fila = $this->bdd->procesaResultado()) {
$salida.='<tr bottom="middle">';
$salida.='<tr align="center" bottom="middle">';
foreach ($fila as $clave => $valor) {
if ($clave == "id") {
$id = $valor;
}
if ($this->campos[$clave]['Visible'] == "no") {
continue;
}
// Comprueba si tiene que añadir el enlace de inventario
if (strstr($this->campos[$clave]['Comment'], "link")) {
$comen = explode(",", $this->campos[$clave]['Comment']);
@@ -219,78 +203,31 @@ class Mantenimiento {
$datoEnlace = $tmpco[1];
}
}
$this->campoBusca = isset($dato[1]) ? $dato[1] : "";
$this->campoBusca = $dato[1];
$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)") {
$checked = $valor == '1' ? 'checked' : '';
$valor = '<input type="checkbox" disabled ' . $checked . '>';
}
if (strstr($this->campos[$clave]['Comment'], "ajax") && $this->perfil['Modificacion']) {
$comen = explode(",", $this->campos[$clave]['Comment']);
foreach ($comen as $co) {
if (strstr($co, "ajax")) {
$tmpco = explode("/", $co);
$tipo = $tmpco[1];
}
}
$cant++;
$valor = $this->campoAjax($id, $clave, $tipo, $valor, $cant, $fila);
}
$alineacion = '';
if (isset($this->campos[$clave]['Ajuste'])) {
switch ($this->campos[$clave]['Ajuste']) {
case 'D': $alineacion = 'align="right"'; break;
case 'L': $alineacion = 'align="left"'; break;
case 'C': $alineacion = 'align="center"'; break;
}
}
$salida.="<td $alineacion >$valor</td>\n";
}
//Añade los botones de acciones
$salida .= '<td align="center">';
//Añade el icono de clonar
if ($this->perfil['Alta']) {
//$salida.='<a href="index.php?' . $tabla . '&opc=editar&id=' . $id . "&pag=" . $pagina . $sufijoOrden . $sufijoEnlace .
$this->backupURL(); $this->datosURL['opc'] = "clonar"; $this->datosURL['id'] = $id;
if (ESTILO == 'bootstrap') {
$salida.='<a href="'.$this->montaURL() . '" title="Clonar"><span class="glyphicon glyphicon-copyright-mark"></span></a>&nbsp;&nbsp;';
} else {
$salida.='<a href="' . $this->montaURL() .
'"><img title="Clonar" src="img/' . ESTILO . '/clonar.png" alt="clonar"></a>&nbsp;&nbsp;';
}
$this->restoreURL();
$salida.="<td>$valor</td>\n";
}
//Añade el icono de editar
if ($this->perfil['Modificacion']) {
//$salida.='<a href="index.php?' . $tabla . '&opc=editar&id=' . $id . "&pag=" . $pagina . $sufijoOrden . $sufijoEnlace .
//$salida.='<td><a href="index.php?' . $tabla . '&opc=editar&id=' . $id . "&pag=" . $pagina . $sufijoOrden . $sufijoEnlace .
$this->backupURL(); $this->datosURL['opc'] = "editar"; $this->datosURL['id'] = $id;
if (ESTILO == 'bootstrap') {
$salida.='<a href="'.$this->montaURL() . '" title="Editar"><span class="glyphicon glyphicon-pencil"></span></a>';
} else {
$salida.='<a href="' . $this->montaURL() .
$salida.='<td><a href="' . $this->montaURL() .
'"><img title="Editar" src="img/' . ESTILO . '/editar.png" alt="editar"></a>';
}
$this->restoreURL();
}
//Añade el icono de eliminar
if ($this->perfil['Borrado']) {
//$salida.='&nbsp;&nbsp;<a href="index.php?' . $tabla . '&opc=eliminar&id=' . $id . $sufijoEnlace .
$this->backupURL(); $this->datosURL['opc'] = "eliminar"; $this->datosURL['id'] = $id;
if (ESTILO == 'bootstrap') {
$salida.='&nbsp;&nbsp;<a href="'. $this->montaURL() . '" title="Eliminar"><span class="glyphicon glyphicon-remove"></span></a>';
} else {
$salida.='&nbsp;&nbsp;<a href="' . $this->montaURL() .
'"><img title="Eliminar" src="img/' . ESTILO . '/eliminar.png" alt="eliminar"></a>' . "\n";
}
'"><img title="Eliminar" src="img/' . ESTILO . '/eliminar.png" alt="eliminar"></a></td></tr>' . "\n";
$this->restoreURL();
}
$salida .= "</td></tr>";
}
$salida.="</tbody></table></center></p>";
//Añade botones de comandos
@@ -305,58 +242,29 @@ class Mantenimiento {
$fwd = $this->montaURL();
$this->datosURL['pag'] = $pagRew;
$rew = $this->montaURL();
$this->restoreURL();
$this->datosURL['sentido'] = "asc";
$az = $this->montaURL();
//
//$az = '<a href="' . $az . '" title="Orden ascendente"><h1><span class="glyphicon glyphicon-sort-by-alphabet"></span></h1></a>';
$this->datosURL['sentido'] = "desc";
$za = $this->montaURL();
//
//$za = '<a href="' . $za . '" title="Orden descendente"><h1><span class="glyphicon glyphicon-sort-by-alphabet-alt"></span></h1></a>';
if (ESTILO == 'bootstrap') {
$anterior = '<button type="button" class="btn btn-default btn-lg" title="Pag. anterior" onClick="location.href='."'$anterior'".'"><span class="glyphicon glyphicon-chevron-left"></span></button>';
$siguiente = '<button type="button" class="btn btn-default btn-lg" title="Pag. siguiente" onClick="location.href='."'$siguiente'".'"><span class="glyphicon glyphicon-chevron-right"></span></button>';
$fwd = '<button type="button" class="btn btn-default btn-lg" title="+4 páginas" onClick="location.href='."'$fwd'".'"><span class="glyphicon glyphicon-forward"></span></button>';
$rew = '<button type="button" class="btn btn-default btn-lg" title="-4 páginas" onClick="location.href='."'$rew'".'"><span class="glyphicon glyphicon-backward"></span></button>';
$az = '<button type="button" class="btn btn-default btn-lg" title="Orden ascendente" onClick="location.href='."'$az'".'"><span class="glyphicon glyphicon-sort-by-alphabet"></span></button>';
$za = '<button type="button" class="btn btn-default btn-lg" title="Orden descendente" onClick="location.href='."'$za'".'"><span class="glyphicon glyphicon-sort-by-alphabet-alt"></span></button>';
} else {
$anterior = '<a href="' . $anterior . "\"><img title=\"Pag. Anterior\" alt=\"anterior\" src=\"img/" . ESTILO . "/anterior.png\"></a>\n";
$siguiente = '<a href="' . $siguiente . "\"><img title=\"Pag. Siguiente\" alt=\"siguiente\" src=\"img/" . ESTILO . "/siguiente.png\"></a>\n";
$fwd = '<a href="' . $fwd . "\"><img title=\"+4 Pags.\" alt=\"mas4pags\" src=\"img/" . ESTILO . "/fwd.png\"></a>\n";
$rew = '<a href="' . $rew . "\"><img title=\"-4 Pags.\" alt=\"menos4pags\" src=\"img/" . ESTILO . "/rew.png\"></a>\n";
$this->restoreURL();
$this->datosURL['sentido'] = "asc";
$az = $this->montaURL();
$az = '<a href="' . $az . '"><img alt="asc" title="Orden ascendente" src="img/' . ESTILO . '/ascendente.png"></a>';
$this->datosURL['sentido'] = "desc";
$za = $this->montaURL();
$za = '<a href="' . $za . '"><img alt="desc" title="Orden descendente" src="img/' . ESTILO . '/descendente.png"></a>';
}
$this->restoreURL();
if ($this->perfil['Informe']) {
$this->datosURL['opc'] = "informe";
$inf = $this->montaURL();
if (ESTILO == 'bootstrap') {
$informe = '<button type="button" class="btn btn-default btn-lg" title="Informe de '.$this->tabla.'" onClick="location.href='."'$inf.'".'"><span class="glyphicon glyphicon-list-alt"></span></button>';
} else {
$informe = '<a href="' . $inf . '"><img src="img/' . ESTILO . '/informe.png" alt="informe" title="Informe pdf"></a>';
}
//
//$informe = '<a href="'.$inf.'" title="Informe de '.$this->tabla.'"><h1><span class="glyphicon glyphicon-list-alt"></span></h1></a>';
$informe = '<a href="index.php?' . $tabla . '&opc=informe" target="_blank"><img src="img/' . ESTILO . '/informe.png" alt="informe" title="Informe pdf"></a>';
} else {
$informe = "";
}
$this->restoreURL();
} else {
$anterior = $rew = $az = $informe = $za = $siguiente = $fwd = "";
}
if ($this->perfil['Alta']) {
$this->datosURL['opc'] = 'nuevo';
if (ESTILO == 'bootstrap') {
$anadir = '<button type="button" class="btn btn-default btn-lg" title="Añade '.$this->tabla.'" onClick="location.href='."'".$this->montaURL()."'".'"><span class="glyphicon glyphicon-plus-sign"></span></button>';
} else {
$anadir = '<a href="' . $this->montaURL() . '">' .
'<img title="A&ntilde;adir registro" alt="nuevo" src="img/' . ESTILO . '/nuevo.png"></a>';
}
//$anadir = '<a href="'.$this->montaURL() . '"title="Añade '.$this->tabla.'"><h1><span class="glyphicon glyphicon-plus-sign"></span></h1></a>';
} else {
$anadir = "";
}
@@ -370,7 +278,7 @@ class Mantenimiento {
$valor = isset($this->cadenaBusqueda) ? 'value="' . $this->cadenaBusqueda . '"' : '';
$salida = '<form name="busqueda" method="POST"><div class="col-xs-6 col-sm-4 col-md-6 col-lg-6"><div class="input-group">
<input type="text" name="buscar" placeholder="Descripci&oacute;n" class="form-control" ' . $valor . '>
<span class="input-group-btn"><button class="btn btn-primary" type="submit"><span class="glyphicon glyphicon-search"></span></button>
<span class="input-group-btn"><button class="btn btn-primary" type="button">Buscar</button>
</span></div></div></form>';
$salida .= '<button class="btn btn-info pull-right" type="button">P&aacute;gina <span class="badge">'
. $pagina . '</span></button>';
@@ -387,8 +295,6 @@ class Mantenimiento {
}
$this->datosURL['opc'] = 'inicial';
$this->datosURL['id'] = null;
//Comprueba si existe la imagen en datos para borrarla.
Imagen::borraImagenId($this->tabla, $id);
$url = $this->montaURL();
header('Location: ' . $url);
return;
@@ -399,7 +305,6 @@ class Mantenimiento {
$comando = "insert into " . $this->tabla . " (";
$lista = explode("&", $_POST['listacampos']);
$primero = true;
$hayImagen = false;
//Añade la lista de campos
foreach ($lista as $campo) {
if ($campo == "") {
@@ -425,43 +330,14 @@ class Mantenimiento {
} else {
$coma = ",";
}
if (isset($this->campos[$campo]['Type']) && $this->campos[$campo]['Type'] == 'Boolean(1)') {
if ($this->campos[$campo]['Type'] == 'Boolean(1)') {
$valor = "";
if (empty($_POST[$campo])) {
$valor = "0";
}
$valor = $_POST[$campo] == "on" ? '1' : $valor;
} else {
if (isset($this->campos[$campo]['Comment']) && stristr($this->campos[$campo]['Comment'], "imagen")) {
//procesa el envío de la imagen
$imagen = new Imagen();
$accion = $imagen->determinaAccion($campo);
if ($accion != NOHACERNADA) { // && $_POST['tipoOperacion'] != CLONAR) {
$mensaje = "";
if (!$imagen->procesaEnvio($campo, $mensaje)) {
return $this->panelMensaje($mensaje, "danger", "ERROR PROCESANDO IMAGEN");
}
$hayImagen = true;
$campoImagen = $campo;
} else {
//Comprobamos si hay clonación y hay imagen a clonar.
if (isset($_POST[$campo])) {
$valor = $_POST[$campo];
} else {
$valor = "";
}
if ($_POST['tipoOperacion'] == CLONAR && file_exists($valor)) {
$hayImagen = true;
$campoImagen = $campo;
$valorImagen = $valor;
$valor = "null";
} else {
$valor = "null";
}
}
} else {
$valor = $_POST[$campo] == "" ? "null" : '"' . $this->bdd->filtra($_POST[$campo]) . '"';
}
$valor = $_POST[$campo] == "" ? "null" : '"' . $_POST[$campo] . '"';
}
$comando.="$coma " . $valor;
}
@@ -469,33 +345,11 @@ class Mantenimiento {
if (!$this->bdd->ejecuta($comando)) {
return $this->errorBD($comando);
}
$id = $this->bdd->ultimoId();
if ($hayImagen) {
$mensaje = " ";
//Tiene que recuperar el id del registro insertado y actualizar el archivo de imagen
if ($_POST['tipoOperacion'] == CLONAR) {
//Tiene que copiar el archivo original.
if (!$imagen->copiaImagenId($valorImagen, $this->tabla, $id, $mensaje)) {
return $this->panelMensaje($mensaje, "danger", "ERROR COPIANDO IMAGEN");
}
$archivoImagen = $imagen->archivoCopiado;
} else {
//Crea el archivo de imagen
if (!$imagen->mueveImagenId($this->tabla, $id, $mensaje)) {
return $this->panelMensaje($mensaje, "danger", "ERROR COMPRIMIENDO IMAGEN");
}
$archivoImagen = $imagen->archivoComprimido;
}
$comando = "update " . $this->tabla . " set " . $campoImagen . "='" . $archivoImagen . "' where id='" . $id ."';";
if (!$this->bdd->ejecuta($comando)) {
return $this->errorBD($comando);
}
}
$this->datosURL['opc'] = 'inicial';
$this->datosURL['id'] = null;
$cabecera = "refresh:".PAUSA.";url=".$this->montaURL();
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>";
}
@@ -525,35 +379,11 @@ class Mantenimiento {
}
$valor = $_POST[$campo] == "on" ? '1' : $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 {
if (strlen(trim($_POST[$campo])) == 0) {
$comando.="$coma $campo=null";
} else {
$comando.=$coma . ' ' . $campo . '="' . $this->bdd->filtra($_POST[$campo]) . '"';
}
$comando.=$coma . ' ' . $campo . '="' . $_POST[$campo] . '"';
}
}
}
@@ -588,8 +418,7 @@ class Mantenimiento {
//tabla a la cual pertenece la clave foránea.
protected function generaLista($datos, $campo, $valorInicial, $modo)
{
$modoEfectivo = $modo == "readonly" ? "disabled" : "";
$salida = "<select class=\"selectpicker show-tick\" data-live-search=\"true\" data-width=\"auto\" name=\"$campo\" $modoEfectivo>\n";
$salida = "<select class=\"form-control\" name=\"$campo\">\n";
list($tabla, $atributos) = explode(",", $datos);
$atributos = str_replace("/", ",", $atributos);
// Elimina las llaves
@@ -599,6 +428,7 @@ class Mantenimiento {
if (!$resultado) {
return $this->errorBD($comando);
}
$modoEfectivo = $modo == "readonly" ? "disabled" : "";
$primero = true;
while ($fila = $this->bdd->procesaResultado()) {
foreach ($fila as $clave => $valor) {
@@ -617,7 +447,6 @@ class Mantenimiento {
}
}
$salida.="</select>\n<br><br>";
$salida.="<script>$('.selectpicker').selectpicker();</script>";
return $salida;
}
@@ -629,9 +458,7 @@ class Mantenimiento {
$def = simplexml_load_file($nombre);
foreach ($def->Campos->Col as $columna) {
$this->campos[(string) $columna['Nombre']] = array("Field" => (string) $columna['Titulo'], "Comment" => (string) $columna['Varios'],
"Type" => (string) $columna['Tipo'] . "(" . $columna['Ancho'] . ")", "Editable" => (string) $columna['Editable'],
"Campo" => (string) $columna['Campo'], "Visible" => (string) $columna['Visible'], "Ajuste" => (string) $columna['Ajuste'],
"Titulo" => (string) $columna['Titulo']);
"Type" => (string) $columna['Tipo'] . "(" . $columna['Ancho'] . ")", "Editable" => (string) $columna['Editable'], "Campo" => (string) $columna['Campo']);
}
$this->comandoConsulta = $def->Consulta;
} else {
@@ -642,15 +469,6 @@ class Mantenimiento {
$this->campos[$datos[$i]["Field"]] = $this->campos[$datos[$i]["Field"]][0];
$this->campos[$datos[$i]["Field"]]["Campo"] = $datos[$i]["Field"];
$this->campos[$datos[$i]["Field"]]["Editable"] = "si";
if (strstr($datos[$i]["Type"],"int")) {
$ajuste = "D";
} else if (strstr($datos[$i]["Type"],"char")) {
$ajuste = "L";
}
if (strstr($datos[$i]["Comment"],"imagen")) {
$ajuste = "C";
}
$this->campos[$datos[$i]["Field"]]["Ajuste"] = $ajuste;
}
$this->comandoConsulta = "select SQL_CALC_FOUND_ROWS * from " . $this->tabla . " {buscar} {orden} limit {inferior},{superior}";
}
@@ -660,16 +478,7 @@ class Mantenimiento {
{
//$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>';
if ($this->datosURL['sentido'] == 'asc') {
$sentidoFlecha = 'down';
} else {
$sentidoFlecha = 'up';
}
$flecha = '<span class="glyphicon glyphicon-chevron-'.$sentidoFlecha.'"></span>';
foreach ($this->campos as $clave => $datos) {
if ($this->campos[$clave]['Visible'] == "no") {
continue;
}
$comen = explode(",", $datos["Comment"]);
$ordenable = false;
foreach ($comen as $co) {
@@ -682,20 +491,16 @@ class Mantenimiento {
}
}
$clave2 = $clave;
/*$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("articulo", "Art&iacute;culo", $clave);*/
$ordenActual = $this->datosURL['orden'];
$clave = str_ireplace("articulo", "Art&iacute;culo", $clave);
if ($ordenable) {
$this->backupURL();
$this->datosURL['orden'] = $clave2;
$resFlecha = $clave2 == $ordenActual ? $flecha : '';
$salida.="<th><b><a title=\"Establece orden por $clave \" href=\"". $this->montaURL() . "\"> " . $datos["Titulo"] . $resFlecha . " </a></b></th>\n";
//$salida.="<th><b><a title=\"Establece orden por $clave \" href=\"". $this->montaURL() . "\"> " . ucfirst($clave) . $resFlecha . " </a></b></th>\n";
$salida.="<th><b><a title=\"Establece orden por $clave \" href=\"". $this->montaURL() . "\"> " . ucfirst($clave) . " </a></b></th>\n";
$this->restoreURL();
} else {
$salida.='<th><b>' . $datos["Titulo"] . '</b></th>' . "\n";
//$salida.='<th><b>' . ucfirst($clave) . '</b></th>' . "\n";
$salida.='<th><b>' . ucfirst($clave) . '</b></th>' . "\n";
}
}
@@ -705,7 +510,7 @@ class Mantenimiento {
/**
*
* @param string $tipo ANADIR,EDICION,BORRADO,CLONAR
* @param string $tipo ANADIR,EDICION,BORRADO
* @param array $datos Vector con los datos del registro
* @return array lista de campos y formulario de entrada
*/
@@ -714,7 +519,6 @@ class Mantenimiento {
$modo = $tipo == BORRADO ? "readonly" : "";
$nfechas = 0;
switch ($tipo) {
case CLONAR:
case ANADIR:
$this->datosURL['opc'] = "insertar"; $this->datosURL['id'] = null;
break;
@@ -726,10 +530,8 @@ class Mantenimiento {
break;
}
$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.= var_export($datos,true);
$campos = "";
foreach ($this->campos as $clave => $valor) {
if ($valor["Editable"] == "no") {
//Se salta los campos que no deben aparecer
@@ -739,13 +541,12 @@ class Mantenimiento {
$salida .='<div class="form-group">';
$campo = $valor['Campo'];
$campos.="$campo&";
$salida.='<label class="col-sm-2 control-label" for="' . $campo . '">' . $valor['Titulo'] . "</label> ";
//$salida.='<label class="col-sm-2 control-label" for="' . $campo . '">' . ucfirst($clave) . "</label> ";
$salida.='<label class="col-sm-2 control-label" for="' . $campo . '">' . ucfirst($clave) . "</label> ";
$salida.='<div class="col-sm-5">';
//Se asegura que el id no se pueda modificar.
$modoEfectivo = $clave == 'id' ? "readonly" : $modo;
$valorDato = $datos == null ? "" : $datos[$campo];
if ($clave == 'id' && ($tipo == ANADIR || $tipo == CLONAR)) {
if ($clave == 'id' && $tipo == ANADIR) {
$valorDato = null;
}
if (!isset($this->foraneas[$valor['Campo']])) {
@@ -766,7 +567,6 @@ class Mantenimiento {
<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>
</div>';
if ($modo != "readonly") {
$salida .= '<script type="text/javascript">
$(function () {
$(' . "'#datetimepicker" . $nfechas . "').datetimepicker({
@@ -776,7 +576,6 @@ class Mantenimiento {
});
});
</script>";
}
$salida .= "</div></div>";
continue;
} else {
@@ -793,18 +592,6 @@ class Mantenimiento {
$salida .= '</div></div>';
continue;
}
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
/*if ($tipo == CLONAR) {
// De momento no deja clonar las imágenes
$valorDato = null;
}*/
$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
$salida.='<input class="form-control" type="' . $tipo_campo . '" name="' . $campo . '" value="' . $valorDato .
'" maxlength="' . $tamano . '" size="' . (string) (intval($tamano) + 5) . '" ' . $modoEfectivo . " ><br><br>\n";
@@ -816,79 +603,24 @@ class Mantenimiento {
}
//genera un campo oculto con la lista de campos a modificar.
$salida .= '<input name="listacampos" type="hidden" value="' . $campos . "\">\n";
//genera un campo oculto con el tipo de operación asociado al formulario
$salida .= '<input name="tipoOperacion" type="hidden" value="' . $tipo . "\">\n";
$salida .= "</fieldset><p>";
$salida .= '<center>';
$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 .= '&nbsp;&nbsp;<button type="reset" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Cancelar</button>';
$salida .= '&nbsp;&nbsp;<button type=submit class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Aceptar</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">Cancelar</button>';
$salida .= '&nbsp;&nbsp;<button type=submit class="btn btn-primary">Aceptar</button>';
$salida .= '<br></center></div>';
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 = "")
protected function errorBD($comando, $texto = "", $tipo = "danger", $cabecera = "&iexcl;Atenci&oacute;n!")
{
if (!$texto) {
$texto = "No pudo ejecutar correctamente el comando $comando error=" . $this->bdd->mensajeError();
} else {
$texto = "$texto error=" . $this->bdd->mensajeError();
}
$cabecera="&iexcl;Error!";
return $this->panelMensaje($texto, "danger", $cabecera);
return $this->panelMensaje($texto, "danger", $cabecera="&iexcl;Error!");
}
private function panelMensaje($info, $tipo = "danger", $cabecera = "&iexcl;Atenci&oacute;n!") {
@@ -900,56 +632,6 @@ class Mantenimiento {
$mensaje .= '</div>';
return $mensaje;
}
private function cargaComplementos()
{
$mensaje = '<link href="css/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet"/>';
//$mensaje .= '<script src="css/bootstrap3-editable/js/bootstrap-editable.min.js"></script>';
return $mensaje;
}
private function campoAjax($id, $clave, $tipo, $valor, $num, $datosFila)
{
//url: 'ajax.php?tabla=". $this->tabla . "',
//url: '" . $this->montaURL() . "&tabla=" . $this->tabla "',
$formato = $tipo == "combodate" ? 'data-format="YYYY-MM-DD" data-viewformat="DD/MM/YYYY"' : '';
$remoto = ""; $select2 = "";
$titulo = $clave;
if (strstr($tipo, "select")) {
$datos = explode("-", $tipo);
$tipo = $datos[0];
$tabla2 = $datos[1];
$clave = "id_".$clave;
$indice = "id".$tabla2;
$valorDato = $datosFila[$indice];
$valorSelect = 'data-value="'.$valorDato.'" ';
$remoto = $valorSelect . ' data-sourceCache="true" data-sourceError="Error cargando datos" data-source="Ajax.php?opc=get&tabla='.$tabla2.'"';
}
$mensaje = '<a href="#" data-toggle="dblclick" data-title="Modifica '.$titulo.'" id="'.$clave.'" name="'.$clave.$num.'" data-type="'.$tipo.
'" data-min="1" data-placement="top" '.$formato.' data-pk="'.$id.'" '.$remoto.' >'.
'<div title="doble click para editar">' . $valor . '</div></a>
<script>
$(function(){' . "
$('[name=\"".$clave.$num."\"]').editable({
url: 'Ajax.php?opc=put&tabla=". $this->tabla . "',
emptytext: 'Vacío',
title: 'lll',
mode: 'popup',
success: function(respuesta, newValue) {
if (respuesta.success === false) {
return respuesta.msj; //msj will be shown in editable form
}
},
validate: function(value) {
if($.trim(value) == '') {
return 'No se puede dejar vacío';
}
}
});
});
</script>";
return $mensaje;
}
}
?>

View File

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

View File

@@ -20,7 +20,7 @@
*
*/
class Pdf_mysql_table extends FPDF
class Pdf_mysql_table extends Fpdf
{
/**
* Modificado por Ricardo Montañana 05/2008 para añadir la posibilidad de cálculo de totales
@@ -61,7 +61,7 @@ class Pdf_mysql_table extends FPDF
//Titulo
$fecha=strftime("%d-%b-%Y %H:%M");
$this->SetFont('Arial','',8);
$this->Cell(0,4,html_entity_decode(CENTRO . " " . PROGRAMA . " v" . VERSION,ENT_COMPAT | ENT_HTML401,'ISO-8859-1'),0,1,'L');
$this->Cell(0,4,html_entity_decode(CENTRO . " " . PROGRAMA . VERSION,ENT_COMPAT | ENT_HTML401,'ISO-8859-1'),0,1,'L');
$this->SetFont('Arial','',18);
$this->Cell(0,6,utf8_decode($this->titulo),0,1,'C');
$this->SetFont('Arial','',8);
@@ -111,8 +111,7 @@ class Pdf_mysql_table extends FPDF
if ($this->procesandoTotales) {
$this->SetFont('Arial','B',12);
}
$dato = isset($data[$col['f']]) ? $data[$col['f']] : "";
$this->Cell($col['w'],5,utf8_decode($dato),1,0,$alin,$fill);
$this->Cell($col['w'],5,utf8_decode($data[$col['f']]),1,0,$alin,$fill);
//$this->Cell($col['w'],5,utf8_decode($data[$col['f']]),1,0,$alin,$fill);
//$this->Cell($col['w'],5,utf8_decode($data['proveedor']),1,0,$alin,$fill);
//$this->Write(5,"nombre=".$col['f'].",titulo=".$col['c'].",ancho=".$col['w'].",alin=".$col['a']);
@@ -120,10 +119,7 @@ class Pdf_mysql_table extends FPDF
//print_r($data);
//print_r($this->aCols);
if ($col['t']=='S' && !$this->procesandoTotales) {
if (isset($this->totales[$col['f']]))
$this->totales[$col['f']]+=$data[$col['f']];
else
$this->totales[$col['f']] = $data[$col['f']];
}
}
@@ -165,7 +161,7 @@ class Pdf_mysql_table extends FPDF
function Table($query,$prop=array())
{
//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
if(count($this->aCols)==0)
{

View File

@@ -1,4 +1,4 @@
# Inventario de Centro Educativo [![Project Stats](https://www.ohloh.net/p/inventario2/widgets/project_thin_badge.gif)](https://www.ohloh.net/p/inventario2)
# Inventario de Centro Educativo
Copyright (c) 2008-2014, Ricardo Montañana Gómez
Inventario2 is free software: you can redistribute it and/or modify
@@ -13,12 +13,6 @@ Utiliza:
*MySQL v. 5.1.x
*Apache
[Manual de Usuario](http://rmontanana.gitbooks.io/inventario2/)
[Instalación de ejemplo](http://inventario2.rmontanana.es)
[Estadísticas del proyecto](https://www.ohloh.net/p/inventario2)
##Instalación
Para instalar la aplicación basta con seguir estos pasos:
###1. Copiar los archivos en una ubicación a la que tenga acceso el usuario con el que se ejecuta el servidor Apache (apache, _www, etc.).
@@ -32,8 +26,7 @@ Para instalar la aplicación basta con seguir estos pasos:
###2. Crear un directorio temporal y dar derechos de escritura a los ficheros de configuración.
mkdir tmp
mkdir img.data
chown apache tmp img.data
chown apache tmp
chown apache inc/configuracion.inc
chown apache inc
@@ -45,12 +38,14 @@ Para instalar la aplicación basta con seguir estos pasos:
grant all on Inventario.* to usuario identified by "contraseña";
###5. Conectarse a la aplicación en la url donde se ha instalado:
###5. Crear la estructura de la base de datos para poder comenzar a trabajar:
http://<url>
mysql -u usuario --password=contraseña <sql/setup.sql
Al hacer esto se arrancará automáticamente el programa de instalación con el que terminaremos de configurar la aplicación.
Con esto queda instalado el programa. Se crean en este proceso dos usuarios:
Usuario: admin Usuario: demo
Contraseña: pruebas Contraseña: pruebas
##Modelo de datos
El modelo de datos que se ha utilizado ha sido:

View File

@@ -63,10 +63,10 @@ class Sql {
*/
public function __construct($servidor,$usuario,$clave,$baseDatos)
{
$this->bdd = @new mysqli($servidor,$usuario,$clave,$baseDatos);
$this->bdd=new mysqli($servidor,$usuario,$clave,$baseDatos);
if (mysqli_connect_errno()) {
$this->mensajeError='<h1>Fallo al conectar con el servidor MySQL.</h1>';
$this->mensajeError.="Servidor [".$servidor ."] base de datos [".$baseDatos."]";
$this->mensajeError.="Servidor [".$servidor ."] usuario=[".$usuario."] clave [".$clave."] base [".$baseDatos."]";
$this->error=true;
$this->estado=false;
} else {

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="&#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>
</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)
*/
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
@@ -43,8 +45,13 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function(duration) {
var called = false, $el = this
$(this).one($.support.transition.end, function () { called = true })
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
$(this).one($.support.transition.end, function() {
called = true
})
var callback = function() {
if (!called)
$($el).trigger($.support.transition.end)
}
setTimeout(callback, duration)
return this
}
@@ -86,7 +93,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $parent = $(selector)
if (e) e.preventDefault()
if (e)
e.preventDefault()
if (!$parent.length) {
$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'))
if (e.isDefaultPrevented()) return
if (e.isDefaultPrevented())
return
$parent.removeClass('in')
@@ -120,8 +129,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $this = $(this)
var data = $this.data('bs.alert')
if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
if (!data)
$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'
if (!data.resetText) $el.data('resetText', $el[val]())
if (!data.resetText)
$el.data('resetText', $el[val]())
$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) {
var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') {
if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
else $parent.find('.active').removeClass('active')
if ($input.prop('checked') && this.$element.hasClass('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 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()
else if (option) data.setState(option)
if (option == 'toggle')
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) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
if (!$btn.hasClass('btn'))
$btn = $btn.closest('.btn')
$btn.button('toggle')
e.preventDefault()
})
@@ -311,10 +331,15 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var that = this
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 (activeIndex == pos) return this.pause().cycle()
if (this.sliding)
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]))
}
@@ -333,12 +358,14 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}
Carousel.prototype.next = function() {
if (this.sliding) return
if (this.sliding)
return
return this.slide('next')
}
Carousel.prototype.prev = function() {
if (this.sliding) return
if (this.sliding)
return
return this.slide('prev')
}
@@ -351,15 +378,18 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var that = this
if (!$next.length) {
if (!this.options.wrap) return
if (!this.options.wrap)
return
$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})
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
if (e.isDefaultPrevented())
return
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')
$active.removeClass(['active', direction].join(' '))
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)
} 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 action = typeof option == 'string' ? option : options.slide
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
if (typeof option == 'number') data.to(option)
else if (action) data[action]()
else if (options.interval) data.pause().cycle()
if (!data)
$this.data('bs.carousel', (data = new Carousel(this, options)))
if (typeof option == 'number')
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 options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to')
if (slideIndex) options.interval = false
if (slideIndex)
options.interval = false
$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.transitioning = null
if (this.options.parent) this.$parent = $(this.options.parent)
if (this.options.toggle) this.toggle()
if (this.options.parent)
this.$parent = $(this.options.parent)
if (this.options.toggle)
this.toggle()
}
Collapse.DEFAULTS = {
@@ -492,17 +531,20 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}
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')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
if (startEvent.isDefaultPrevented())
return
var actives = this.$parent && this.$parent.find('> .panel > .in')
if (actives && actives.length) {
var hasData = actives.data('bs.collapse')
if (hasData && hasData.transitioning) return
if (hasData && hasData.transitioning)
return
actives.collapse('hide')
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')
}
if (!$.support.transition) return complete.call(this)
if (!$.support.transition)
return complete.call(this)
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() {
if (this.transitioning || !this.$element.hasClass('in')) return
if (this.transitioning || !this.$element.hasClass('in'))
return
var startEvent = $.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
if (startEvent.isDefaultPrevented())
return
var dimension = this.dimension()
@@ -563,7 +608,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
.addClass('collapse')
}
if (!$.support.transition) return complete.call(this)
if (!$.support.transition)
return complete.call(this)
this.$element
[dimension](0)
@@ -587,9 +633,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var data = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data && options.toggle && option == 'show') option = !option
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
if (!data && options.toggle && option == 'show')
option = !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)
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')
}
@@ -653,7 +703,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
Dropdown.prototype.toggle = function(e) {
var $this = $(this)
if ($this.is('.disabled, :disabled')) return
if ($this.is('.disabled, :disabled'))
return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
@@ -669,7 +720,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var relatedTarget = {relatedTarget: this}
$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
if (e.isDefaultPrevented())
return
$parent
.toggleClass('open')
@@ -682,33 +734,40 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}
Dropdown.prototype.keydown = function(e) {
if (!/(38|40|27)/.test(e.keyCode)) return
if (!/(38|40|27)/.test(e.keyCode))
return
var $this = $(this)
e.preventDefault()
e.stopPropagation()
if ($this.is('.disabled, :disabled')) return
if ($this.is('.disabled, :disabled'))
return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
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()
}
var desc = ' li:not(.divider):visible a'
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'))
if (e.keyCode == 38 && index > 0) index-- // up
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0
if (e.keyCode == 38 && index > 0)
index-- // up
if (e.keyCode == 40 && index < $items.length - 1)
index++ // down
if (!~index)
index = 0
$items.eq(index).focus()
}
@@ -718,9 +777,11 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
$(toggle).each(function() {
var $parent = getParent($(this))
var relatedTarget = {relatedTarget: this}
if (!$parent.hasClass('open')) return
if (!$parent.hasClass('open'))
return
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
if (e.isDefaultPrevented())
return
$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 data = $this.data('bs.dropdown')
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
if (!data)
$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)
.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('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)
if (this.isShown || e.isDefaultPrevented()) return
if (this.isShown || e.isDefaultPrevented())
return
this.isShown = true
@@ -865,13 +931,15 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}
Modal.prototype.hide = function(e) {
if (e) e.preventDefault()
if (e)
e.preventDefault()
e = $.Event('hide.bs.modal')
this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return
if (!this.isShown || e.isDefaultPrevented())
return
this.isShown = false
@@ -935,17 +1003,20 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
.appendTo(document.body)
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.$element[0].focus.call(this.$element[0])
: this.hide.call(this)
}, this))
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
if (doAnimate)
this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
if (!callback) return
if (!callback)
return
doAnimate ?
this.$backdrop
@@ -979,9 +1050,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var data = $this.data('bs.modal')
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option](_relatedTarget)
else if (options.show) data.show(_relatedTarget)
if (!data)
$this.data('bs.modal', (data = new Modal(this, options)))
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 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
.modal(option, this)
@@ -1016,8 +1091,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
})
$(document)
.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
.on('show.bs.modal', '.modal', function() {
$(document.body).addClass('modal-open')
})
.on('hidden.bs.modal', '.modal', function() {
$(document.body).removeClass('modal-open')
})
}(jQuery);
@@ -1109,7 +1188,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var defaults = this.getDefaults()
this._options && $.each(this._options, function(key, value) {
if (defaults[key] != value) options[key] = value
if (defaults[key] != value)
options[key] = value
})
return options
@@ -1123,10 +1203,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
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() {
if (self.hoverState == 'in') self.show()
if (self.hoverState == 'in')
self.show()
}, self.options.delay.show)
}
@@ -1138,10 +1220,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
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() {
if (self.hoverState == 'out') self.hide()
if (self.hoverState == 'out')
self.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) {
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
if (e.isDefaultPrevented())
return
var that = this;
var $tip = this.tip()
this.setContent()
if (this.options.animation) $tip.addClass('fade')
if (this.options.animation)
$tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ?
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 autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
if (autoPlace)
placement = placement.replace(autoToken, '') || 'top'
$tip
.detach()
@@ -1227,8 +1314,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
if (isNaN(marginTop))
marginTop = 0
if (isNaN(marginLeft))
marginLeft = 0
offset.top = offset.top + marginTop
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')
}
if (replace) $tip.offset(offset)
if (replace)
$tip.offset(offset)
}
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)
function complete() {
if (that.hoverState != 'in') $tip.detach()
if (that.hoverState != 'in')
$tip.detach()
that.$element.trigger('hidden.bs.' + that.type)
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
if (e.isDefaultPrevented())
return
$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 options = typeof option == 'object' && option
if (!data && option == 'destroy') return
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
if (!data && option == 'destroy')
return
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)
}
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, {
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
// 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() {
@@ -1497,7 +1594,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}
Popover.prototype.tip = function() {
if (!this.$tip) this.$tip = $(this.options.template)
if (!this.$tip)
this.$tip = $(this.options.template)
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 options = typeof option == 'object' && option
if (!data && option == 'destroy') return
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
if (!data && option == 'destroy')
return
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[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() {
self.offsets.push(this[0])
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 options = typeof option == 'object' && option
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
if (!data)
$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
}
if ($this.parent('li').hasClass('active')) return
if ($this.parent('li').hasClass('active'))
return
var previous = $ul.find('.active:last a')[0]
var e = $.Event('show.bs.tab', {
@@ -1724,7 +1830,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
$this.trigger(e)
if (e.isDefaultPrevented()) return
if (e.isDefaultPrevented())
return
var $target = $(selector)
@@ -1785,8 +1892,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $this = $(this)
var data = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
if (!data)
$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() {
if (this.pinnedOffset) return this.pinnedOffset
if (this.pinnedOffset)
return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$window.scrollTop()
var position = this.$element.offset()
@@ -1860,7 +1970,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}
Affix.prototype.checkPosition = function() {
if (!this.$element.is(':visible')) return
if (!this.$element.is(':visible'))
return
var scrollHeight = $(document).height()
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 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 offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
if (typeof offset != 'object')
offsetBottom = offsetTop = offset
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 :
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
if (this.affixed === affix) return
if (this.unpin) this.$element.css('top', '')
if (this.affixed === affix)
return
if (this.unpin)
this.$element.css('top', '')
var affixType = 'affix' + (affix ? '-' + affix : '')
var e = $.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
if (e.isDefaultPrevented())
return
this.affixed = affix
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 options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
if (!data)
$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 || {}
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
if (data.offsetTop) data.offset.top = data.offsetTop
if (data.offsetBottom)
data.offset.bottom = data.offsetBottom
if (data.offsetTop)
data.offset.top = data.offsetTop
$spy.affix(data)
})

File diff suppressed because one or more lines are too long

View File

@@ -1,663 +0,0 @@
/*! X-editable - v1.5.1
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
.editableform {
margin-bottom: 0; /* overwrites bootstrap margin */
}
.editableform .control-group {
margin-bottom: 0; /* overwrites bootstrap margin */
white-space: nowrap; /* prevent wrapping buttons on new line */
line-height: 20px; /* overwriting bootstrap line-height. See #133 */
}
/*
BS3 width:1005 for inputs breaks editable form in popup
See: https://github.com/vitalets/x-editable/issues/393
*/
.editableform .form-control {
width: auto;
}
.editable-buttons {
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
vertical-align: top;
margin-left: 7px;
/* inline-block emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-buttons.editable-buttons-bottom {
display: block;
margin-top: 7px;
margin-left: 0;
}
.editable-input {
vertical-align: top;
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
white-space: normal; /* reset white-space decalred in parent*/
/* display-inline emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-buttons .editable-cancel {
margin-left: 7px;
}
/*for jquery-ui buttons need set height to look more pretty*/
.editable-buttons button.ui-button-icon-only {
height: 24px;
width: 30px;
}
.editableform-loading {
background: url('../img/loading.gif') center center no-repeat;
height: 25px;
width: auto;
min-width: 25px;
}
.editable-inline .editableform-loading {
background-position: left 5px;
}
.editable-error-block {
max-width: 300px;
margin: 5px 0 0 0;
width: auto;
white-space: normal;
}
/*add padding for jquery ui*/
.editable-error-block.ui-state-error {
padding: 3px;
}
.editable-error {
color: red;
}
/* ---- For specific types ---- */
.editableform .editable-date {
padding: 0;
margin: 0;
float: left;
}
/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */
.editable-inline .add-on .icon-th {
margin-top: 3px;
margin-left: 1px;
}
/* checklist vertical alignment */
.editable-checklist label input[type="checkbox"],
.editable-checklist label span {
vertical-align: middle;
margin: 0;
}
.editable-checklist label {
white-space: nowrap;
}
/* set exact width of textarea to fit buttons toolbar */
.editable-wysihtml5 {
width: 566px;
height: 250px;
}
/* clear button shown as link in date inputs */
.editable-clear {
clear: both;
font-size: 0.9em;
text-decoration: none;
text-align: right;
}
/* IOS-style clear button for text inputs */
.editable-clear-x {
background: url('../img/clear.png') center center no-repeat;
display: block;
width: 13px;
height: 13px;
position: absolute;
opacity: 0.6;
z-index: 100;
top: 50%;
right: 6px;
margin-top: -6px;
}
.editable-clear-x:hover {
opacity: 1;
}
.editable-pre-wrapped {
white-space: pre-wrap;
}
.editable-container.editable-popup {
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
}
.editable-container.popover {
width: auto; /* without this rule popover does not stretch */
}
.editable-container.editable-inline {
display: inline-block;
vertical-align: middle;
width: auto;
/* inline-block emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-container.ui-widget {
font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */
z-index: 9990; /* should be less than select2 dropdown z-index to close dropdown first when click */
}
.editable-click,
a.editable-click,
a.editable-click:hover {
text-decoration: none;
border-bottom: dashed 1px #0088cc;
}
.editable-click.editable-disabled,
a.editable-click.editable-disabled,
a.editable-click.editable-disabled:hover {
color: #585858;
cursor: default;
border-bottom: none;
}
.editable-empty, .editable-empty:hover, .editable-empty:focus{
font-style: italic;
color: #DD1144;
/* border-bottom: none; */
text-decoration: none;
}
.editable-unsaved {
font-weight: bold;
}
.editable-unsaved:after {
/* content: '*'*/
}
.editable-bg-transition {
-webkit-transition: background-color 1400ms ease-out;
-moz-transition: background-color 1400ms ease-out;
-o-transition: background-color 1400ms ease-out;
-ms-transition: background-color 1400ms ease-out;
transition: background-color 1400ms ease-out;
}
/*see https://github.com/vitalets/x-editable/issues/139 */
.form-horizontal .editable
{
padding-top: 5px;
display:inline-block;
}
/*!
* Datepicker for Bootstrap
*
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.datepicker {
padding: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
direction: ltr;
/*.dow {
border-top: 1px solid #ddd !important;
}*/
}
.datepicker-inline {
width: 220px;
}
.datepicker.datepicker-rtl {
direction: rtl;
}
.datepicker.datepicker-rtl table tr td span {
float: right;
}
.datepicker-dropdown {
top: 0;
left: 0;
}
.datepicker-dropdown:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
top: -7px;
left: 6px;
}
.datepicker-dropdown:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
position: absolute;
top: -6px;
left: 7px;
}
.datepicker > div {
display: none;
}
.datepicker.days div.datepicker-days {
display: block;
}
.datepicker.months div.datepicker-months {
display: block;
}
.datepicker.years div.datepicker-years {
display: block;
}
.datepicker table {
margin: 0;
}
.datepicker td,
.datepicker th {
text-align: center;
width: 20px;
height: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
border: none;
}
.table-striped .datepicker table tr td,
.table-striped .datepicker table tr th {
background-color: transparent;
}
.datepicker table tr td.day:hover {
background: #eeeeee;
cursor: pointer;
}
.datepicker table tr td.old,
.datepicker table tr td.new {
color: #999999;
}
.datepicker table tr td.disabled,
.datepicker table tr td.disabled:hover {
background: none;
color: #999999;
cursor: default;
}
.datepicker table tr td.today,
.datepicker table tr td.today:hover,
.datepicker table tr td.today.disabled,
.datepicker table tr td.today.disabled:hover {
background-color: #fde19a;
background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
background-image: linear-gradient(top, #fdd49a, #fdf59a);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
border-color: #fdf59a #fdf59a #fbed50;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #000;
}
.datepicker table tr td.today:hover,
.datepicker table tr td.today:hover:hover,
.datepicker table tr td.today.disabled:hover,
.datepicker table tr td.today.disabled:hover:hover,
.datepicker table tr td.today:active,
.datepicker table tr td.today:hover:active,
.datepicker table tr td.today.disabled:active,
.datepicker table tr td.today.disabled:hover:active,
.datepicker table tr td.today.active,
.datepicker table tr td.today:hover.active,
.datepicker table tr td.today.disabled.active,
.datepicker table tr td.today.disabled:hover.active,
.datepicker table tr td.today.disabled,
.datepicker table tr td.today:hover.disabled,
.datepicker table tr td.today.disabled.disabled,
.datepicker table tr td.today.disabled:hover.disabled,
.datepicker table tr td.today[disabled],
.datepicker table tr td.today:hover[disabled],
.datepicker table tr td.today.disabled[disabled],
.datepicker table tr td.today.disabled:hover[disabled] {
background-color: #fdf59a;
}
.datepicker table tr td.today:active,
.datepicker table tr td.today:hover:active,
.datepicker table tr td.today.disabled:active,
.datepicker table tr td.today.disabled:hover:active,
.datepicker table tr td.today.active,
.datepicker table tr td.today:hover.active,
.datepicker table tr td.today.disabled.active,
.datepicker table tr td.today.disabled:hover.active {
background-color: #fbf069 \9;
}
.datepicker table tr td.today:hover:hover {
color: #000;
}
.datepicker table tr td.today.active:hover {
color: #fff;
}
.datepicker table tr td.range,
.datepicker table tr td.range:hover,
.datepicker table tr td.range.disabled,
.datepicker table tr td.range.disabled:hover {
background: #eeeeee;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.datepicker table tr td.range.today,
.datepicker table tr td.range.today:hover,
.datepicker table tr td.range.today.disabled,
.datepicker table tr td.range.today.disabled:hover {
background-color: #f3d17a;
background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a);
background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a));
background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a);
background-image: -o-linear-gradient(top, #f3c17a, #f3e97a);
background-image: linear-gradient(top, #f3c17a, #f3e97a);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0);
border-color: #f3e97a #f3e97a #edde34;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.datepicker table tr td.range.today:hover,
.datepicker table tr td.range.today:hover:hover,
.datepicker table tr td.range.today.disabled:hover,
.datepicker table tr td.range.today.disabled:hover:hover,
.datepicker table tr td.range.today:active,
.datepicker table tr td.range.today:hover:active,
.datepicker table tr td.range.today.disabled:active,
.datepicker table tr td.range.today.disabled:hover:active,
.datepicker table tr td.range.today.active,
.datepicker table tr td.range.today:hover.active,
.datepicker table tr td.range.today.disabled.active,
.datepicker table tr td.range.today.disabled:hover.active,
.datepicker table tr td.range.today.disabled,
.datepicker table tr td.range.today:hover.disabled,
.datepicker table tr td.range.today.disabled.disabled,
.datepicker table tr td.range.today.disabled:hover.disabled,
.datepicker table tr td.range.today[disabled],
.datepicker table tr td.range.today:hover[disabled],
.datepicker table tr td.range.today.disabled[disabled],
.datepicker table tr td.range.today.disabled:hover[disabled] {
background-color: #f3e97a;
}
.datepicker table tr td.range.today:active,
.datepicker table tr td.range.today:hover:active,
.datepicker table tr td.range.today.disabled:active,
.datepicker table tr td.range.today.disabled:hover:active,
.datepicker table tr td.range.today.active,
.datepicker table tr td.range.today:hover.active,
.datepicker table tr td.range.today.disabled.active,
.datepicker table tr td.range.today.disabled:hover.active {
background-color: #efe24b \9;
}
.datepicker table tr td.selected,
.datepicker table tr td.selected:hover,
.datepicker table tr td.selected.disabled,
.datepicker table tr td.selected.disabled:hover {
background-color: #9e9e9e;
background-image: -moz-linear-gradient(top, #b3b3b3, #808080);
background-image: -ms-linear-gradient(top, #b3b3b3, #808080);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080));
background-image: -webkit-linear-gradient(top, #b3b3b3, #808080);
background-image: -o-linear-gradient(top, #b3b3b3, #808080);
background-image: linear-gradient(top, #b3b3b3, #808080);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0);
border-color: #808080 #808080 #595959;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker table tr td.selected:hover,
.datepicker table tr td.selected:hover:hover,
.datepicker table tr td.selected.disabled:hover,
.datepicker table tr td.selected.disabled:hover:hover,
.datepicker table tr td.selected:active,
.datepicker table tr td.selected:hover:active,
.datepicker table tr td.selected.disabled:active,
.datepicker table tr td.selected.disabled:hover:active,
.datepicker table tr td.selected.active,
.datepicker table tr td.selected:hover.active,
.datepicker table tr td.selected.disabled.active,
.datepicker table tr td.selected.disabled:hover.active,
.datepicker table tr td.selected.disabled,
.datepicker table tr td.selected:hover.disabled,
.datepicker table tr td.selected.disabled.disabled,
.datepicker table tr td.selected.disabled:hover.disabled,
.datepicker table tr td.selected[disabled],
.datepicker table tr td.selected:hover[disabled],
.datepicker table tr td.selected.disabled[disabled],
.datepicker table tr td.selected.disabled:hover[disabled] {
background-color: #808080;
}
.datepicker table tr td.selected:active,
.datepicker table tr td.selected:hover:active,
.datepicker table tr td.selected.disabled:active,
.datepicker table tr td.selected.disabled:hover:active,
.datepicker table tr td.selected.active,
.datepicker table tr td.selected:hover.active,
.datepicker table tr td.selected.disabled.active,
.datepicker table tr td.selected.disabled:hover.active {
background-color: #666666 \9;
}
.datepicker table tr td.active,
.datepicker table tr td.active:hover,
.datepicker table tr td.active.disabled,
.datepicker table tr td.active.disabled:hover {
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker table tr td.active:hover,
.datepicker table tr td.active:hover:hover,
.datepicker table tr td.active.disabled:hover,
.datepicker table tr td.active.disabled:hover:hover,
.datepicker table tr td.active:active,
.datepicker table tr td.active:hover:active,
.datepicker table tr td.active.disabled:active,
.datepicker table tr td.active.disabled:hover:active,
.datepicker table tr td.active.active,
.datepicker table tr td.active:hover.active,
.datepicker table tr td.active.disabled.active,
.datepicker table tr td.active.disabled:hover.active,
.datepicker table tr td.active.disabled,
.datepicker table tr td.active:hover.disabled,
.datepicker table tr td.active.disabled.disabled,
.datepicker table tr td.active.disabled:hover.disabled,
.datepicker table tr td.active[disabled],
.datepicker table tr td.active:hover[disabled],
.datepicker table tr td.active.disabled[disabled],
.datepicker table tr td.active.disabled:hover[disabled] {
background-color: #0044cc;
}
.datepicker table tr td.active:active,
.datepicker table tr td.active:hover:active,
.datepicker table tr td.active.disabled:active,
.datepicker table tr td.active.disabled:hover:active,
.datepicker table tr td.active.active,
.datepicker table tr td.active:hover.active,
.datepicker table tr td.active.disabled.active,
.datepicker table tr td.active.disabled:hover.active {
background-color: #003399 \9;
}
.datepicker table tr td span {
display: block;
width: 23%;
height: 54px;
line-height: 54px;
float: left;
margin: 1%;
cursor: pointer;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.datepicker table tr td span:hover {
background: #eeeeee;
}
.datepicker table tr td span.disabled,
.datepicker table tr td span.disabled:hover {
background: none;
color: #999999;
cursor: default;
}
.datepicker table tr td span.active,
.datepicker table tr td span.active:hover,
.datepicker table tr td span.active.disabled,
.datepicker table tr td span.active.disabled:hover {
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker table tr td span.active:hover,
.datepicker table tr td span.active:hover:hover,
.datepicker table tr td span.active.disabled:hover,
.datepicker table tr td span.active.disabled:hover:hover,
.datepicker table tr td span.active:active,
.datepicker table tr td span.active:hover:active,
.datepicker table tr td span.active.disabled:active,
.datepicker table tr td span.active.disabled:hover:active,
.datepicker table tr td span.active.active,
.datepicker table tr td span.active:hover.active,
.datepicker table tr td span.active.disabled.active,
.datepicker table tr td span.active.disabled:hover.active,
.datepicker table tr td span.active.disabled,
.datepicker table tr td span.active:hover.disabled,
.datepicker table tr td span.active.disabled.disabled,
.datepicker table tr td span.active.disabled:hover.disabled,
.datepicker table tr td span.active[disabled],
.datepicker table tr td span.active:hover[disabled],
.datepicker table tr td span.active.disabled[disabled],
.datepicker table tr td span.active.disabled:hover[disabled] {
background-color: #0044cc;
}
.datepicker table tr td span.active:active,
.datepicker table tr td span.active:hover:active,
.datepicker table tr td span.active.disabled:active,
.datepicker table tr td span.active.disabled:hover:active,
.datepicker table tr td span.active.active,
.datepicker table tr td span.active:hover.active,
.datepicker table tr td span.active.disabled.active,
.datepicker table tr td span.active.disabled:hover.active {
background-color: #003399 \9;
}
.datepicker table tr td span.old,
.datepicker table tr td span.new {
color: #999999;
}
.datepicker th.datepicker-switch {
width: 145px;
}
.datepicker thead tr:first-child th,
.datepicker tfoot tr th {
cursor: pointer;
}
.datepicker thead tr:first-child th:hover,
.datepicker tfoot tr th:hover {
background: #eeeeee;
}
.datepicker .cw {
font-size: 10px;
width: 12px;
padding: 0 2px 0 5px;
vertical-align: middle;
}
.datepicker thead tr:first-child th.cw {
cursor: default;
background-color: transparent;
}
.input-append.date .add-on i,
.input-prepend.date .add-on i {
display: block;
cursor: pointer;
width: 16px;
height: 16px;
}
.input-daterange input {
text-align: center;
}
.input-daterange input:first-child {
-webkit-border-radius: 3px 0 0 3px;
-moz-border-radius: 3px 0 0 3px;
border-radius: 3px 0 0 3px;
}
.input-daterange input:last-child {
-webkit-border-radius: 0 3px 3px 0;
-moz-border-radius: 0 3px 3px 0;
border-radius: 0 3px 3px 0;
}
.input-daterange .add-on {
display: inline-block;
width: auto;
min-width: 16px;
height: 18px;
padding: 4px 5px;
font-weight: normal;
line-height: 18px;
text-align: center;
text-shadow: 0 1px 0 #ffffff;
vertical-align: middle;
background-color: #eeeeee;
border: 1px solid #ccc;
margin-left: -5px;
margin-right: -5px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -33,7 +33,7 @@ display: none;
}
@media (max-width: 767px) {
.sidebar {
top: 60px;
top: 50px;
bottom: 150px;
background-color: <?php echo COLORLAT; ?>
}

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

794
css/moment.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +0,0 @@
/*!
* Validator v0.2.1 for Bootstrap 3, by @1000hz
* Copyright 2014 Spiceworks, Inc.
* Licensed under http://opensource.org/licenses/MIT
*
* https://github.com/1000hz/bootstrap-validator
*/
+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=c,this.toggleSubmit(),this.$element.on("input.bs.validator blur.bs.validator",":input",a.proxy(this.validateInput,this)),this.$element.find("[data-match]").each(function(){var b=a(this),c=b.data("match");a(c).on("input.bs.validator",function(){b.val()&&b.trigger("input")})})};b.DEFAULTS={delay:500,errors:{match:"Does not match",minlength:"Not long enough"}},b.VALIDATORS={"native":function(a){var b=a[0];return b.checkValidity?b.checkValidity():!0},match:function(b){var c=b.data("match");return!b.val()||b.val()===a(c).val()},minlength:function(a){var b=a.data("minlength");return!a.val()||a.val().length>=b}},b.prototype.validateInput=function(b){var c,d=a(b.target),e=d.data("bs.errors");this.$element.trigger(b=a.Event("validate.bs.validator",{relatedTarget:d[0]})),b.isDefaultPrevented()||(d.data("bs.errors",c=this.runValidators(d)),c.length?this.showErrors(d):this.clearErrors(d),e&&c.toString()===e.toString()||(b=c.length?a.Event("invalid.bs.validator",{relatedTarget:d[0],detail:c}):a.Event("valid.bs.validator",{relatedTarget:d[0],detail:e}),this.$element.trigger(b)),this.toggleSubmit(),this.$element.trigger(a.Event("validated.bs.validator",{relatedTarget:d[0]})))},b.prototype.runValidators=function(c){{var d=[];[b.VALIDATORS.native]}return a.each(b.VALIDATORS,a.proxy(function(a,b){if((c.data(a)||"native"==a)&&!b.call(this,c)){var e=c.data(a+"-error")||c.data("error")||"native"==a&&c[0].validationMessage||this.options.errors[a];!~d.indexOf(e)&&d.push(e)}},this)),d},b.prototype.validate=function(){var a=this.options.delay;return this.options.delay=0,this.$element.find(":input").trigger("input"),this.options.delay=a,this},b.prototype.showErrors=function(b){function c(){var c=b.closest(".form-group"),d=c.find(".help-block.with-errors"),e=b.data("bs.errors");e.length&&(e=a("<ul/>").addClass("list-unstyled").append(a.map(e,function(b){return a("<li/>").text(b)})),void 0===d.data("bs.originalContent")&&d.data("bs.originalContent",d.html()),d.empty().append(e),c.addClass("has-error"))}this.options.delay?(window.clearTimeout(b.data("bs.timeout")),b.data("bs.timeout",window.setTimeout(c,this.options.delay))):c()},b.prototype.clearErrors=function(a){var b=a.closest(".form-group"),c=b.find(".help-block.with-errors");c.html(c.data("bs.originalContent")),b.removeClass("has-error")},b.prototype.hasErrors=function(){function b(){return!!(a(this).data("bs.errors")||[]).length}return!!this.$element.find(":input").filter(b).length},b.prototype.isIncomplete=function(){function b(){return""===a.trim(this.value)}return!!this.$element.find("[required]").filter(b).length},b.prototype.toggleSubmit=function(){var a=this.$element.find(":submit");a.attr("disabled",this.isIncomplete()||this.hasErrors())};var c=a.fn.validator;a.fn.validator=function(c){return this.each(function(){var d=a(this),e=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),f=d.data("bs.validator");f||d.data("bs.validator",f=new b(this,e)),"string"==typeof c&&f[c]()})},a.fn.validator.Constructor=b,a.fn.validator.noConflict=function(){return a.fn.validator=c,this},a(window).on("load",function(){a('form[data-toggle="validator"]').each(function(){var b=a(this);b.validator(b.data())})})}(jQuery);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

1804
fpdf.php Normal file

File diff suppressed because it is too large Load Diff

5
img.data/.gitignore vendored
View File

@@ -1,5 +0,0 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

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: 560 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: 3.8 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: 635 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: 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: 642 B

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: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 661 B

View File

@@ -24,7 +24,6 @@
require_once 'version.inc';
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('BASEDATOSTEST', 'Inventario_test'); //Base de datos para los tests.
define('USUARIO', 'test'); //Usuario con permisos de lectura/escritura en la base de datos
@@ -33,13 +32,10 @@ define('PROGRAMA', 'Gesti&oacute;n de Inventario.');
define('CENTRO', 'I.E.S.O. Pascual Serrano');
define('NUMFILAS', '17'); // Número de registros a mostrar en las pantallas de consulta iniciales
define('PAUSA', '2'); //Nº segundos de pausa para mostrar mensaje id insertado
define('ESTILO', 'bootstrap'); //Estilo de los iconos de edición (bootstrap, bootstrap, bootstrap)
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('COLORLAT', '#a4bdfc'); //Color de la barra de menú lateral
define('COLORFON', '#ffb878'); //Color del fondo de la pantalla
define('COLORLAT', '#46d6db'); //Color de la barra de menú lateral
define('COLORFON', '#a4bdfc'); //Color del fondo de la pantalla
define('MYSQLDUMP', '/usr/local/bin/mysqldump'); //camino a mysqldump
define('GZIP', '/usr/bin/gzip'); //Camino a gzip
define('IMAGEDATA', 'img.data'); //Directorio donde se almacenarán las imágenes
define('TMP', './tmp'); //Directorio para archivos temporales
define('INSTALADO', 'sí'); //Indicador que permite ejecutar instalar.php
?>

View File

@@ -6,8 +6,8 @@
1|Inventario|||
2|Ubicaci&oacute;n|index.php?informeInventario&opc=Ubicacion|_self|Inventario de una ubicaci&oacute;n
2|Art&iacute;culo|index.php?informeInventario&opc=Articulo|_self|Inventario de un Art&iacute;culo
2|Total|index.php?informeInventario&opc=Total|_self|Inventario de todas las ubicaciones
2|Descuadres|index.php?informeInventario&opc=descuadres|_self|Diferencias entre art&iacute;culos y elementos
2|Total|index.php?informeInventario&opc=Total|_blank|Inventario de todas las ubicaciones
2|Descuadres|index.php?descuadres|_blank|Diferencias entre art&iacute;culos y elementos
1|Varios|||
2|Configuraci&oacute;n|index.php?configuracion|_self|Opciones configurables de la aplicaci&oacute;n
2|Importaci&oacute;n|index.php?importacion&opc=form|_self|Importa datos de una hoja de c&aacute;lculo

View File

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

View File

@@ -16,16 +16,12 @@
<link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/jquery.simplecolorpicker.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>
<script type="text/javascript" src="./css/jquery.min.js"></script>
<script type="text/javascript" src="./css/bootstrap-select/bootstrap-select.min.js"></script>
</head>
<body>
<!--<body style="background-image:url(img/fondos/old_map.png); background-repeat:repeat">-->
<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="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar">
@@ -34,11 +30,10 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://rmontanana.gitbooks.io/Inventario2/" target="_blank" title="Ayuda"><span class="glyphicon glyphicon-book"></span></a>
<a class="navbar-brand" href="index.php">{aplicacion}</a>
</div>
<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>-->
</div>
<div class="navbar-collapse collapse">
@@ -51,11 +46,6 @@
<input type="text" class="form-control" placeholder="Buscar...">
</form>-->
</div>
<div class="visible-xs">
<ul class="nav navbar-nav navbar-right">
<li>{control}</li>
</ul>
</div>
</div>
</div>
<div class="container-fluid">
@@ -67,7 +57,25 @@
{menu}
</ul>
</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}
</div>
</div>
@@ -81,7 +89,5 @@
<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/jquery.simplecolorpicker.js"></script>
<script type="text/javascript" src="./css/jasny-bootstrap.min.js"></script>
<script src="css/bootstrap3-editable/js/bootstrap-editable.min.js"></script>
</body>
</html>

View File

@@ -15,6 +15,23 @@
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `Articulos`
--
DROP TABLE IF EXISTS `Articulos`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `Articulos` (
`id` smallint(6) NOT NULL auto_increment,
`descripcion` varchar(60) NOT NULL COMMENT 'ordenable,link/Articulo',
`marca` varchar(20) default NULL COMMENT 'ordenable',
`modelo` varchar(20) default NULL COMMENT 'ordenable',
`cantidad` int(11) default NULL COMMENT 'ordenable',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=785 DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
--
-- Dumping data for table `Articulos`
--
@@ -25,6 +42,29 @@ INSERT INTO `Articulos` VALUES (589,'Armario con puertas y cajones','M. E. C.','
/*!40000 ALTER TABLE `Articulos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Elementos`
--
DROP TABLE IF EXISTS `Elementos`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `Elementos` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_Articulo` smallint(6) NOT NULL COMMENT 'foreign(Articulos;id),ordenable',
`id_Ubicacion` smallint(5) unsigned NOT NULL COMMENT 'foreign(Ubicaciones;id),ordenable',
`numserie` varchar(30) default NULL COMMENT 'ordenable',
`cantidad` int(10) unsigned default NULL COMMENT 'ordenable',
`fechaCompra` date NOT NULL COMMENT 'ordenable',
PRIMARY KEY (`id`),
KEY `id` (`id`),
KEY `id_Articulo` (`id_Articulo`),
KEY `id_Ubicacion` (`id_Ubicacion`),
CONSTRAINT `Elementos_ibfk_1` FOREIGN KEY (`id_Articulo`) REFERENCES `Articulos` (`id`) ON DELETE CASCADE,
CONSTRAINT `Elementos_ibfk_2` FOREIGN KEY (`id_Ubicacion`) REFERENCES `Ubicaciones` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1884 DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
--
-- Dumping data for table `Elementos`
--
@@ -35,6 +75,20 @@ INSERT INTO `Elementos` VALUES (1414,589,140,'',1,'2004-12-07 00:00:00'),(1415,5
/*!40000 ALTER TABLE `Elementos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Ubicaciones`
--
DROP TABLE IF EXISTS `Ubicaciones`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `Ubicaciones` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`Descripcion` varchar(50) NOT NULL COMMENT 'ordenable,link/Ubicacion',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
--
-- Dumping data for table `Ubicaciones`
--
@@ -45,6 +99,30 @@ INSERT INTO `Ubicaciones` VALUES (140,'Secretario'),(141,'Aula Althia'),(142,'Al
/*!40000 ALTER TABLE `Ubicaciones` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Usuarios`
--
DROP TABLE IF EXISTS `Usuarios`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `Usuarios` (
`id` int(10) unsigned NOT NULL auto_increment,
`nombre` varchar(16) NOT NULL default '',
`clave` varchar(32) NOT NULL default '',
`idSesion` varchar(20) NOT NULL default '',
`alta` tinyint(1) NOT NULL default '0',
`modificacion` tinyint(1) NOT NULL default '0',
`borrado` tinyint(1) NOT NULL default '0',
`consulta` tinyint(1) NOT NULL default '1',
`informe` tinyint(1) NOT NULL default '1',
`usuarios` tinyint(1) NOT NULL default '0',
`config` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `nombre` (`nombre`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
--
-- Dumping data for table `Usuarios`
--
@@ -55,7 +133,28 @@ INSERT INTO `Usuarios` VALUES (2,'admin','galeote','s3LUSqxg{s',1,1,1,1,1,1,1),(
/*!40000 ALTER TABLE `Usuarios` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `test`
--
DROP TABLE IF EXISTS `test`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `test` (
`id` smallint(6) NOT NULL auto_increment,
`Descripcion` varchar(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
--
-- Dumping data for table `test`
--
LOCK TABLES `test` WRITE;
/*!40000 ALTER TABLE `test` DISABLE KEYS */;
/*!40000 ALTER TABLE `test` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;

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 character_set_client = utf8;
CREATE TABLE `Articulos` (
`id` smallint(6) NOT NULL auto_increment COMMENT 'ordenable,link/Articulo',
`descripcion` varchar(60) NOT NULL COMMENT 'ordenable,ajax/text',
`marca` varchar(20) default NULL COMMENT 'ordenable,ajax/text',
`modelo` varchar(20) default NULL COMMENT 'ordenable,ajax/text',
`cantidad` int(11) default NULL COMMENT 'ordenable,ajax/number',
`imagen` varchar(45) default NULL COMMENT 'imagen',
`id` smallint(6) NOT NULL auto_increment,
`descripcion` varchar(60) NOT NULL COMMENT 'ordenable,link/Articulo',
`marca` varchar(20) default NULL COMMENT 'ordenable',
`modelo` varchar(20) default NULL COMMENT 'ordenable',
`cantidad` int(11) default NULL COMMENT 'ordenable',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=785 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
@@ -41,13 +40,12 @@ DROP TABLE IF EXISTS `Elementos`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
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_Ubicacion` smallint(5) unsigned NOT NULL COMMENT 'foreign(Ubicaciones;id),ordenable',
`numserie` varchar(30) default NULL COMMENT 'ordenable,ajax/text',
`cantidad` int(10) unsigned default NULL COMMENT 'ordenable,ajax/number',
`fechaCompra` date NOT NULL COMMENT 'ordenable,ajax/combodate',
`imagen` varchar(45) default NULL COMMENT 'imagen',
`numserie` varchar(30) default NULL COMMENT 'ordenable',
`cantidad` int(10) unsigned default NULL COMMENT 'ordenable',
`fechaCompra` date NOT NULL COMMENT 'ordenable',
PRIMARY KEY (`id`),
KEY `id` (`id`),
KEY `id_Articulo` (`id_Articulo`),
@@ -66,9 +64,8 @@ DROP TABLE IF EXISTS `Ubicaciones`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `Ubicaciones` (
`id` smallint(5) unsigned NOT NULL auto_increment COMMENT 'ordenable,link/Ubicacion',
`Descripcion` varchar(50) NOT NULL COMMENT 'ordenable,ajax/text',
`imagen` varchar(45) DEFAULT NULL COMMENT 'imagen',
`id` smallint(5) unsigned NOT NULL auto_increment,
`Descripcion` varchar(50) NOT NULL COMMENT 'ordenable,link/Ubicacion',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
@@ -82,10 +79,10 @@ DROP TABLE IF EXISTS `Usuarios`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `Usuarios` (
`id` int(10) unsigned NOT NULL auto_increment COMMENT 'ordenable',
`nombre` varchar(16) NOT NULL default '' COMMENT 'ajax/text',
`clave` varchar(32) NOT NULL default '' COMMENT 'ajax/text',
`idSesion` varchar(20) NOT NULL default '' COMMENT 'ajax/text',
`id` int(10) unsigned NOT NULL auto_increment,
`nombre` varchar(16) NOT NULL default '',
`clave` varchar(32) NOT NULL default '',
`idSesion` varchar(20) NOT NULL default '',
`alta` tinyint(1) NOT NULL default '0',
`modificacion` tinyint(1) NOT NULL default '0',
`borrado` tinyint(1) NOT NULL default '0',
@@ -98,7 +95,15 @@ CREATE TABLE `Usuarios` (
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Usuarios iniciales
--
LOCK TABLES `Usuarios` WRITE;
/*!40000 ALTER TABLE `Usuarios` DISABLE KEYS */;
INSERT INTO `Usuarios` VALUES (1,'admin','pruebas','s3LUSqxg{s',1,1,1,1,1,1,1),(2,'demo','pruebas','NogP_U0Byi',0,0,0,1,1,0,0);
/*!40000 ALTER TABLE `Usuarios` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

View File

@@ -22,8 +22,8 @@
$host="localhost";
$baseAnt="Inventario";
$baseNueva="Inventario2";
$usuario="test";
$claveUsuario="tset";
$usuario="root";
$claveUsuario="galeote";
$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.'
);
}
}
?>

5
tmp/.gitignore vendored
View File

@@ -1,5 +0,0 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -2,21 +2,16 @@
<Informe>
<Titulo Texto="Informe de Artículos" />
<Datos>
<Consulta>
select A.id as id,A.descripcion as descripcion, A.marca as marca, A.modelo as modelo, A.cantidad as cantidad,
(select count(E.id) from Elementos E where E.id_Articulo=A.id) as Numero from Articulos A
where A.descripcion like '%{filtro}%' order by {orden};
</Consulta>
<Consulta>select * from Articulos order by descripcion;</Consulta>
</Datos>
<Pagina Orientacion="P" Formato="A4">
<Cabecera>Relación Artículos</Cabecera>
<Cabecera>Relación alfabética</Cabecera>
<Cuerpo>
<Col Nombre="id" Ancho="10" Ajuste="D" Titulo="id"/>
<Col Nombre="descripcion" Ancho="70" Ajuste="I" Titulo="Descripción"/>
<Col Nombre="marca" Ancho="40" Ajuste="I" Titulo="Marca"/>
<Col Nombre="modelo" Ancho="40" Ajuste="I" Titulo="Modelo"/>
<Col Nombre="cantidad" Ancho="20" Ajuste="D" Titulo="Cantidad"/>
<Col Nombre="Numero" Ancho="15" Ajuste="D" Titulo="NºElem"/>
<Col Nombre="modelo" Ancho="50" Ajuste="I" Titulo="Modelo"/>
<Col Nombre="cantidad" Ancho="20" Ajuste="D" Titulo="cantidad"/>
</Cuerpo>
</Pagina>
</Informe>

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,
DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra
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>
</Datos>
<Pagina Orientacion="L" Formato="A4">

View File

@@ -2,16 +2,13 @@
<Informe>
<Titulo Texto="Informe de Ubicaciones" />
<Datos>
<Consulta>select U.id as id, U.Descripcion as Descripcion,(select count(E.id) from Elementos E where E.id_Ubicacion=U.id) as Numero
from Ubicaciones U where U.descripcion like '%{filtro}%' order by {orden};
</Consulta>
<Consulta>select * from Ubicaciones order by Descripcion;</Consulta>
</Datos>
<Pagina Orientacion="P" Formato="A4">
<Cabecera>Relación de Ubicaciones</Cabecera>
<Cabecera>Relación alfabética</Cabecera>
<Cuerpo>
<Col Nombre="id" Ancho="10" Ajuste="D" Titulo="id"/>
<Col Nombre="Descripcion" Ancho="80" Ajuste="I" Titulo="Descripción"/>
<Col Nombre="Numero" Ancho="15" Ajuste="D" Titulo="Nº Elem"/>
</Cuerpo>
</Pagina>
</Informe>

Some files were not shown because too many files have changed in this diff Show More