Fusionado #22ImagenElemento con master

This commit is contained in:
2014-03-23 18:29:15 +01:00
16 changed files with 2172 additions and 38 deletions

1
.gitignore vendored
View File

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

View File

@@ -124,14 +124,14 @@ class AportaContenido {
public function __call($metodo, $parametros) {
switch ($metodo) { // Dependiendo del método invocado
case 'titulo': // devolvemos el título
return PROGRAMA.VERSION;
return PROGRAMA." v".VERSION;
case 'usuario':
if ($this->registrado)
return "Usuario=$this->usuario";
else
return '';
case 'fecha': return $this->fechaActual();
case 'aplicacion': return PROGRAMA.VERSION;
case 'aplicacion': return PROGRAMA." v".VERSION;
case 'menu': // el menú
if ($this->registrado) {
return $this->miMenu->insertaMenu();
@@ -187,7 +187,7 @@ class AportaContenido {
case 'ubicaciones':
case 'test':
case 'elementos':
$this->cargaDatosURL();
$this->DatosURL();
if ($this->datosURL['opc'] == "informe") {
if (!$this->pefil['Informe']) {
$this->procesaURL();
@@ -284,31 +284,19 @@ class AportaContenido {
}
case 'copiaseg':
if ($this->perfil['Config']) {
$archivo_sql = "tmp/copiaseg.sql";
$archivo = $archivo_sql . ".gz";
if (file_exists($archivo)) {
unlink($archivo);
}
$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($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";
$copia = new CopiaSeguridad();
if ($_GET['confirmado'] == "1") {
if (!$copia->creaCopia()) {
$tipo = "danger";
$cabecera = "ERROR";
} else {
$tipo = "info";
$cabecera = "INFORMACIÓN";
}
return $this->panel($cabecera, $copia->mensaje(), $tipo);
} else {
$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 $copia->dialogo();
}
return $this->panel($cabecera,$mensaje,$tipo);
} else {
return $this->mensajePermisos("Copias de seguridad");
}

131
CopiaSeguridad.php Normal file
View File

@@ -0,0 +1,131 @@
<?php
/**
* @package Inventario
* @copyright Copyright (c) 2014, Ricardo Montañana Gómez
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* This file is part of Inventario.
* Inventario is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Inventario is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Inventario. If not, see <http://www.gnu.org/licenses/>.
*
*/
class CopiaSeguridad {
private $mensaje;
private $baseDatos;
private $imagenes;
public function __construct()
{
$opcion = $_GET['opc'];
}
public function creaCopia()
{
if (!$this->copiaBaseDatos()) {
return false;
}
if (!$this->copiaImagenes()) {
return false;
}
if (!$this->empaqueta()) {
return false;
}
return true;
}
public function dialogo()
{
$dialogo = '<div class="container col-5"><div class="jumbotron">
<h1>Copia de Seguridad</h1>
<p>¿Desea realizar una copia de seguridad de todos los datos de la Base de Datos y de todas las Imágenes?</p>
<p><a class="btn btn-primary btn-lg" role="button" onClick="location.href=' . "'index.php'" . '">Volver</a>
<a class="btn btn-success btn-lg" role="button" onClick="location.href=' . "'index.php?copiaseg&confirmado=1'" . '">Continuar</a></p>
</div></div>';
return $dialogo;
}
private function copiaBaseDatos()
{
$archivo_sql = "tmp/baseDatos" . BASEDATOS . ".sql";
$baseDatosComprimida = $archivo_sql . ".gz";
$this->baseDatos = $baseDatosComprimida;
if (file_exists($baseDatosComprimida)) {
unlink($baseDatosComprimida);
}
$comando = escapeshellcmd(MYSQLDUMP . ' -h ' . SERVIDOR . ' -P ' . PUERTO . ' -u ' . USUARIO . ' --password=' . CLAVE . ' --result-file=' . $archivo_sql . ' ' . BASEDATOS);
$comando2 = escapeshellcmd(GZIP . ' -9f ' . $archivo_sql);
exec($comando);
exec($comando2);
if (filesize($baseDatosComprimida) < 1024) {
//No se ha realizado la copia de seguridad
$mensaje = "La copia de seguridad no se ha realizado correctamente.<br><br>";
$mensaje .= "Compruebe que las rutas a los programas mysqldump y gzip en configuraci&oacute;n est&aacute;n correctamente establecidas ";
$mensaje .= "y que los datos de acceso a la base de datos sean correctos.<br>";
$mensaje .= "mysqldump=[" . MYSQLDUMP . "]<br>";
$mensaje .= "gzip=[" . GZIP . "]";
$this->mensaje = $mensaje;
$this->error = true;
return false;
}
return true;
}
private function copiaImagenes()
{
$copiaImagenes = "tmp/Imagenes.tbz";
$this->imagenes = $copiaImagenes;
if (file_exists($copiaImagenes)) {
unlink($copiaImagenes);
}
$comando = escapeshellcmd('tar cf ' . $copiaImagenes . ' ' . IMAGEDATA);
exec($comando);
if (filesize($copiaImagenes) == 0) {
$this->error = true;
$mensaje = "No se ha podido comprimir el directorio de las imágenes " . IMAGEDATA . "<br>";
$mensaje .= "Compruebe que la ruta de acceso al programa tar en configuraci&oacute;n est&aacute; correctamente establecida";
$this->mensaje = $mensaje;
return false;
}
return true;
}
private function empaqueta()
{
// Empaqueta los dos archivos en el que va a devolver
$nombreCopia = "tmp/Copia" . BASEDATOS . strftime("%Y%m%d%H%M") . ".tar";
if (file_exists($nombreCopia)) {
unlink($nombreCopia);
}
$comando = escapeshellcmd('tar cf ' . $nombreCopia . ' ' . $this->baseDatos . ' ' . $this->imagenes);
exec($comando);
if (filesize($nombreCopia) ==0 || !file_exists($nombreCopia)) {
$this->error = true;
$mensaje = "No se ha creado el paquete con los archivos de imágenes en [<b>" . $this->imagenes . "</b>] y <br>";
$mensaje .= " con el archivo de Base de Datos [<b>" . $this->baseDatos . "</b>]<br><br>";
$mensaje .= "Compruebe que los datos de configuración están correctamente establecidos <br>";
$mensaje .= "El comando de copia fue [" . $comando . "]<br>";
$mensaje .= "gzip=[" . GZIP . "]";
$this->mensaje = $mensaje;
return false;
}
$this->error = false;
unlink ($this->baseDatos);
unlink ($this->imagenes);
$mensaje = 'Copia de seguridad realizada con &eacute;xito.<br><br>Pulse sobre el siguiente enlace para descargar:<br><br>';
$mensaje .= '<a href="' . $nombreCopia . '">Descargar Copia de Seguridad de Datos</a><br><br>';
$mensaje .= 'El paquete de copia contiene un archivo con la copia de la información de la base de datos y un archivo que contiene el directorio de las fotografías e imágenes asociadas a los datos';
$this->mensaje = $mensaje;
return true;
}
public function mensaje ()
{
return $this->mensaje;
}
}
?>

View File

@@ -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<EFBFBD>ximo la información antes de enviarla
// // y comprime al máximo la información antes de enviarla
// return gzencode($pagina, 9);
// }
return $pagina; // enviamos sin comprimir

170
Imagen.php Normal file
View File

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

View File

@@ -206,6 +206,11 @@ class Mantenimiento {
$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 . '>';
@@ -297,6 +302,8 @@ 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;
@@ -307,6 +314,7 @@ 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 == "") {
@@ -339,7 +347,21 @@ class Mantenimiento {
}
$valor = $_POST[$campo] == "on" ? '1' : $valor;
} else {
$valor = $_POST[$campo] == "" ? "null" : '"' . $_POST[$campo] . '"';
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
//procesa el envío de la imagen
$imagen = new Imagen();
$accion = $imagen->determinaAccion($campo);
if ($accion != NOHACERNADA) {
$mensaje = "";
if (!$imagen->procesaEnvio($campo, $mensaje)) {
return $this->panelMensaje($mensaje, "danger", "ERROR PROCESANDO IMAGEN");
}
$hayImagen = true;
$campoImagen = $campo;
}
} else {
$valor = $_POST[$campo] == "" ? "null" : '"' . $_POST[$campo] . '"';
}
}
$comando.="$coma " . $valor;
}
@@ -347,14 +369,25 @@ class Mantenimiento {
if (!$this->bdd->ejecuta($comando)) {
return $this->errorBD($comando);
}
$id = $this->bdd->ultimoId();
if ($hayImagen) {
//Tiene que recuperar el id del registro insertado y actualizar el archivo de imagen
if (!$imagen->mueveImagenId($this->tabla, $id, $mensaje)) {
return $this->panelMensaje($mensaje, "danger", "ERROR COMPRIMIENDO IMAGEN");
}
$comando = "update " . $this->tabla . " set " . $campoImagen . "='" . $imagen->archivoComprimido . "' where id='" . $id ."';";
if (!$this->bdd->ejecuta($comando)) {
return $this->errorBD($comando);
}
}
$this->datosURL['opc'] = 'inicial';
$this->datosURL['id'] = null;
$cabecera = "refresh:".PAUSA.";url=".$this->montaURL();
header($cabecera);
return $this->panelMensaje("Se ha insertado el registro con la clave " . $this->bdd->ultimoId(), "info", "Informaci&oacute;n");
return $this->panelMensaje("Se ha insertado el registro con la clave " . $id, "info", "Informaci&oacute;n");
//return "<h1><a href=\"".$this->montaURL()."\">Se ha insertado el registro con la clave " . $this->bdd->ultimoId() . "</a></h1>";
}
protected function modificar()
{
//Los datos a utilizar para actualizar la tupla vienen en $_POST.
@@ -382,10 +415,34 @@ class Mantenimiento {
$valor = $_POST[$campo] == "on" ? '1' : $valor;
$comando.=$coma . ' ' . $campo . '="' . $valor . '"';
} else {
if (strlen(trim($_POST[$campo])) == 0) {
$comando.="$coma $campo=null";
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 {
$comando.=$coma . ' ' . $campo . '="' . $_POST[$campo] . '"';
if (strlen(trim($_POST[$campo])) == 0) {
$comando.="$coma $campo=null";
} else {
$comando.=$coma . ' ' . $campo . '="' . $_POST[$campo] . '"';
}
}
}
}
@@ -532,7 +589,7 @@ class Mantenimiento {
break;
}
$accion = $this->montaURL();
$salida.='<div class="col-sm-8"><form name="mantenimiento.form" class="form-horizontal" role="form" method="post" action="' . $accion . '">' . "\n";
$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.="<fieldset style=\"width: 96%;\"><p><legend style=\"color: red;\"><b>$tipo</b></legend>\n";
foreach ($this->campos as $clave => $valor) {
if ($valor["Editable"] == "no") {
@@ -594,6 +651,14 @@ class Mantenimiento {
$salida .= '</div></div>';
continue;
}
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
$salida .= $this->creaCampoImagen($campo, $valorDato, $tipo);
continue;
}
if (stristr($this->campos[$campo]['Type'], "int")) {
$tipo_campo = "number";
$modoEfectivo .= ' onkeypress = "if ( isNaN(this.value + String.fromCharCode(event.keyCode) )) return false;" ';
}
//Si no es una clave foránea añade un campo de texto normal
$salida.='<input class="form-control" type="' . $tipo_campo . '" name="' . $campo . '" value="' . $valorDato .
'" maxlength="' . $tamano . '" size="' . (string) (intval($tamano) + 5) . '" ' . $modoEfectivo . " ><br><br>\n";
@@ -614,6 +679,58 @@ class Mantenimiento {
$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 = "", $tipo = "danger", $cabecera = "&iexcl;Atenci&oacute;n!")
{
@@ -633,7 +750,8 @@ class Mantenimiento {
$mensaje .= '</div>';
$mensaje .= '</div>';
return $mensaje;
}
}
}
?>

1707
Zebra_Image.php Normal file

File diff suppressed because it is too large Load Diff

7
css/jasny-bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

6
css/jasny-bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
img.data/1424.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

BIN
img/sinImagen.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

View File

@@ -39,4 +39,5 @@ 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
?>

View File

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

View File

@@ -16,6 +16,7 @@
<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">
<style type="text/css"></style>
<script type="text/javascript" src="./css/jquery.min.js"></script>
@@ -88,6 +89,7 @@
<script type="text/javascript" src="./css/moment.min.js"></script>
<script type="text/javascript" src="./css/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="./css/bootstrap-datetimepicker.es.js"></script>
<script type="text/javascript" src="./css/jquery.simplecolorpicker.js"></script>
<script type="text/javascript" src="./css/jquery.simplecolorpicker.js"></script>
<script type="text/javascript" src="./css/jasny-bootstrap.min.js"></script>
</body>
</html>

View File

@@ -27,6 +27,7 @@ CREATE TABLE `Articulos` (
`marca` varchar(20) default NULL COMMENT 'ordenable',
`modelo` varchar(20) default NULL COMMENT 'ordenable',
`cantidad` int(11) default NULL COMMENT 'ordenable',
`imagen` varchar(45) default NULL COMMENT 'imagen',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=785 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
@@ -46,6 +47,7 @@ CREATE TABLE `Elementos` (
`numserie` varchar(30) default NULL COMMENT 'ordenable',
`cantidad` int(10) unsigned default NULL COMMENT 'ordenable',
`fechaCompra` date NOT NULL COMMENT 'ordenable',
`imagen` varchar(45) default NULL COMMENT 'imagen',
PRIMARY KEY (`id`),
KEY `id` (`id`),
KEY `id_Articulo` (`id_Articulo`),

View File

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