From d00c50fc03124a5a41f1108060977f8e564883f7 Mon Sep 17 00:00:00 2001 From: Thomas Zilio Date: Sat, 10 Feb 2018 10:53:00 +0100 Subject: [PATCH] Miglioramenti vari Introduzione costante BASEURL e relativa variabile (#145). Miglioramento della gestione delle anteprime dei PDF, ora unificate sotto PDFJS e la classe Prints. --- core.php | 6 ++-- gulpfile.js | 4 +-- modules/interventi/add_firma.php | 45 +++++++++---------------- src/App.php | 56 ++++++++++++++++++++++++++++++++ src/Prints.php | 7 ++++ 5 files changed, 85 insertions(+), 33 deletions(-) create mode 100644 src/App.php diff --git a/core.php b/core.php index 1b3a6d5f1..8cec68f49 100644 --- a/core.php +++ b/core.php @@ -27,8 +27,6 @@ $rootdir = str_replace('%2F', '/', rawurlencode($rootdir)); define('DOCROOT', $docroot); define('ROOTDIR', $rootdir); -$pdfjs = '../../../..'; - // Caricamento delle dipendenze e delle librerie del progetto require_once __DIR__.'/vendor/autoload.php'; @@ -39,6 +37,10 @@ if (!empty($redirectHTTPS) && !isHTTPS(true)) { exit(); } +// Individuazione del percorso BASEURL +$baseurl = (isHTTPS(true) ? 'https' : 'http').'://'.$_SERVER['SERVER_NAME'].$rootdir; +define('BASEURL', $baseurl); + // Forzamento del debug // $debug = true; diff --git a/gulpfile.js b/gulpfile.js index 23c163be6..76d0ef16b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -208,8 +208,8 @@ gulp.task('chartjs', function () { gulp.task('pdfjs', function () { gulp.src([ - config.main.bowerDirectory + '/pdfjs/web/*', - '!' + config.main.bowerDirectory + '/pdfjs/web/cmaps/', + config.main.bowerDirectory + '/pdfjs/web/**/*', + '!' + config.main.bowerDirectory + '/pdfjs/web/cmaps/*', '!' + config.main.bowerDirectory + '/pdfjs/web/*.map', '!' + config.main.bowerDirectory + '/pdfjs/web/*.pdf', ]) diff --git a/modules/interventi/add_firma.php b/modules/interventi/add_firma.php index 168282ea5..45af3bf39 100644 --- a/modules/interventi/add_firma.php +++ b/modules/interventi/add_firma.php @@ -5,7 +5,7 @@ $module_name = 'Interventi'; if (get('anteprima') !== null) { // Lettura dati intervento - $query = "SELECT id, codice, idanagrafica, (SELECT MIN(DATE_FORMAT(`orario_inizio`, '%d/%m/%Y')) FROM in_interventi_tecnici WHERE in_interventi_tecnici.`idintervento`=in_interventi.id ) AS data_inizio, (SELECT MAX(DATE_FORMAT(`orario_inizio`, '%d/%m/%Y')) FROM in_interventi_tecnici WHERE in_interventi_tecnici.`idintervento`=in_interventi.id ) AS data_fine FROM in_interventi WHERE in_interventi.id=".prepare($id_record); + $query = 'SELECT codice FROM in_interventi WHERE id='.prepare($id_record); $rs = $dbo->fetchArray($query); if (empty($rs)) { @@ -13,40 +13,27 @@ if (get('anteprima') !== null) { exit(); } - $idanagrafica = $rs[0]['idanagrafica']; - $idcliente = $rs[0]['idanagrafica']; - $data_intervento = $rs[0]['data_inizio']; - // Gestione della stampa $rapportino_nome = sanitizeFilename('Rapportino'.$rs[0]['codice'].'.pdf'); $filename = $docroot.'/files/interventi/'.$rapportino_nome; - $id_print = Prints::getModuleMainPrint($id_record)['id']; - - Prints::render($id_print, $id_record, $filename); + $id_print = Prints::getModuleMainPrint($id_module)['id']; // HTML per la visualizzazione echo ' - -
'; +
+ +
- echo '
'; +
- if (isMobile()) { - echo ''; - } else { - echo ' - alt : '.$rapportino_nome.' - '.tr('Plugin PDF mancante').' - '; - } - - echo '
'; + +
'; } ?> -
+ @@ -76,11 +63,11 @@ if (get('anteprima') !== null) {