Add files via upload

This commit is contained in:
MatMasIt 2021-02-01 23:17:02 +01:00 committed by GitHub
parent 22b972fbb1
commit 771b2a8978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 10120 additions and 0 deletions

View File

@ -0,0 +1,287 @@
<?php
// Italian language
// file by FRANCO TASSI - franco7tassi@gmail.com
// (http://www.linkedin.com/profile/view?id=73367896)
// (http://www.facebook.com/franco.tassi)
// Rev.0 - 25.3.2013
// Read our wiki on how to translate: http://code.google.com/p/phpliteadmin/wiki/Localization
$lang = array(
"direction" => "LTR",
"date_format" => 'G:i \d\e\l j M, Y \A\.\D\. (T)', // see http://php.net/manual/en/function.date.php for what the letters stand for
"ver" => "versione",
"for" => "per",
"to" => "a",
"go" => "Vai",
"yes" => "Si",
"sql" => "SQL",
"csv" => "CSV",
"csv_tbl" => "Table that CSV pertains to",
"srch" => "Ricerca",
"srch_again" => "Nuova ricerca",
"login" => "Log In",
"logout" => "Logout",
"view" => "Vista",
"confirm" => "Conferma",
"cancel" => "Cancella",
"save_as" => "Salva con nome",
"options" => "Opzioni",
"no_opt" => "Nessuna opzione",
"help" => "Help",
"installed" => "installato",
"not_installed" => "non installato",
"done" => "fatto",
"insert" => "Inserisci",
"export" => "Esporta",
"import" => "Importa",
"rename" => "Rinomina",
"empty" => "Vuoto",
"drop" => "Elimina",
"tbl" => "Tabella",
"chart" => "Chart",
"err" => "ERRORE",
"act" => "Azione",
"rec" => "Records",
"col" => "Colonna",
"cols" => "Colonna(e)",
"rows" => "riga(e)",
"edit" => "Modifica",
"del" => "Cancella",
"add" => "Aggiungi",
"backup" => "Backup database file",
"before" => "Prima",
"after" => "Dopo",
"passwd" => "Password",
"passwd_incorrect" => "Password errata.",
"chk_ext" => "Controlla le estensioni SQLite PHP supportate",
"autoincrement" => "Autoincremento",
"not_null" => "Not NULL",
"attention" => "Attenzione",
"sqlite_ext" => "Estensione di SQLite",
"sqlite_ext_support" => "Sembra che nessuna delle librerie SQLite supportate sono disponibili nella tua installazione di PHP. Potresti non essere in grado di usare %s finchè non ne installi almeno una.",
"sqlite_v" => "Versione di SQLite",
"sqlite_v_error" => "Sembra che il tuo database è un versione di SQLite %s ma la tua installazione PHP non contiene le estensioni necessarie per gestire questa versione. Per risolvere il problema, cancella il database and consenti a %s di crearlo automaticamente oppure ricrealo manualmente nella versione SQLite %s.",
"report_issue" => "Il problema non può essere digniosticato The problem cannot be diagnosticato correttamente. Si prega di inviare un resoconto del problema a",
"sqlite_limit" => "A causa delle limitazioni di SQLite, solo i campi nome e tipo di data possono essere modificati.",
"php_v" => "Versione di PHP",
"db_dump" => "database dump",
"db_f" => "database file",
"db_ch" => "Cambia Database",
"db_event" => "Database Event",
"db_name" => "Nome del database",
"db_rename" => "Rinomina il Database",
"db_renamed" => "Il Database '%s' è stato rinominato in",
"db_del" => "Cancella il Database",
"db_path" => "Percorso del database",
"db_size" => "Dimensione del database",
"db_mod" => "Ultima modifica del database",
"db_create" => "Crea un nuovo database",
"db_vac" => "Il database, '%s', è stato ridotto.",
"db_not_writeable" => "Il database, '%s', non esiste e non può essere creato perchè la directory che lo ospita, '%s', non ha il permesso di scrittura. Il programma non è utilizzabile finchè non modifi i permessi di scrittura.",
"db_setup" => "C'è stato un problema con il tuo database, %s. Verrà fatto un tentativo per scoprire cosa succede in modo da consentirti di sistemare il problema più facilemtne",
"db_exists" => "Un database, un latro file oppure il nome di una directory '%s' già esiste.",
"exported" => "Esportato",
"struct" => "Struttura",
"struct_for" => "struttura per",
"on_tbl" => "Sulla tabella",
"data_dump" => "Dump dei dati per",
"backup_hint" => "Suggerimento: Per eseguire il backup del tuo database, la via più semplice è %s.",
"backup_hint_linktext" => "scaricare il file del database",
"total_rows" => "un totale di %s righe",
"total" => "In Totale",
"not_dir" => "La directory che hai specificato per eseguire la scansione del database non esiste oppure non è una directory.",
"bad_php_directive" => "sembra che la direttiva PHP, 'register_globals' è abilitata. Questo è male. Hai bisogno di disabilitarla prima di continuare.",
"page_gen" => "Pagina generata in %s secondi.",
"powered" => "Powered by",
"remember" => "Ricordami",
"no_db" => "Benvenuto in %s. Sembra che tu abbia scelto di scansionare una directory per gestire i database. Comunque, %s potrebbe non trovare alcun valido database SQLite. Puoi usare la forma sottostante per creare il tuo primo database.",
"no_db2" => "La directory che hai specificato non contiene alcun database da gestire, e la directory non è scrivibile. Questo significa che non puoi creare nessun nuovo database usando %s. Rendi la directory scrivibile oppure aggiungi manualmente del databases nella directory.",
"create" => "Crea",
"created" => "è stata creata",
"create_tbl" => "Crea una nuova tabella",
"create_tbl_db" => "Crea una nuova tabella sul database",
"create_trigger" => "Crea un nuovo trigger sulla tabella",
"create_index" => "Crea un nuovo indice sulla tabella",
"create_index1" => "Crea Indice",
"create_view" => "Crea una nuova view sul database",
"trigger" => "Trigger",
"triggers" => "Triggers",
"trigger_name" => "Nome del Trigger",
"trigger_act" => "Azione del Trigger",
"trigger_step" => "Trigger Steps (semicolon terminated)",
"when_exp" => "WHEN expression (type expression without 'WHEN')",
"index" => "Indice",
"indexes" => "Indici",
"index_name" => "Nome dell'indice",
"name" => "Nome",
"unique" => "Unique",
"seq_no" => "Seq. No.",
"emptied" => "has been emptied",
"dropped" => "è stato cancellato",
"renamed" => "è stato(a) rinominato(a) in",
"altered" => "è stata alterata con successo",
"inserted" => "inserita",
"deleted" => "cancellata",
"affected" => "interessata",
"blank_index" => "Il nome dell'indice non deve essere vuoto.",
"one_index" => "Devi specificare una colonna indice.",
"docu" => "Documentazione",
"license" => "Licenza",
"proj_site" => "Sito del progetto",
"bug_report" => "Questo potrebbe essere un bug che necessita di essere riportato a",
"return" => "Return",
"browse" => "Browse",
"fld" => "Campo",
"fld_num" => "Numero di campi",
"fields" => "Campi",
"type" => "Tipo",
"operator" => "Operatore",
"val" => "Valore",
"update" => "Update",
"comments" => "Commmenti",
"specify_fields" => "Devi specificare il numero di campi della tabella.",
"specify_tbl" => "Devi specificare il nome della tabella.",
"specify_col" => "Devi specificare una colonna.",
"tbl_exists" => "Esiste già una tabella con lo stesso nome.",
"show" => "Mostra",
"show_rows" => "Mostra %s row(s). ",
"showing" => "Showing",
"showing_rows" => "Mostra righe",
"query_time" => "(Query elaborata in %s sec)",
"syntax_err" => "C'è un problema con la sintassi della tua query (La query non è stata eseguita)",
"run_sql" => "Esegui la(e) query SQL sul database '%s'",
"ques_empty" => "Sei sicuro di voler svuotare la tabella '%s'?",
"ques_drop" => "Sei sicuro di voler eliminare la tabella '%s'?",
"ques_drop_view" => "Sei sicuro di voler eliminare la view '%s'?",
"ques_del_rows" => "Sei sicuro di voler cancellare la(e) riga(e) %s dalla tabella '%s'?",
"ques_del_db" => "Sei sicuro di voler cancellare il database '%s'?",
"ques_del_col" => "Sei sicuro di voler cancellare la(e) coonna(e) \"%s\" dalla tabella '%s'?",
"ques_del_index" => "Sei sicuro di vole cancellare l'indice '%s'?",
"ques_del_trigger" => "Sei sicuro di voler cancellare il trigger '%s'?",
"export_struct" => "Export with structure",
"export_data" => "Export with data",
"add_drop" => "Add DROP TABLE",
"add_transact" => "Add TRANSACTION",
"fld_terminated" => "Fields terminated by",
"fld_enclosed" => "Fields enclosed by",
"fld_escaped" => "Fields escaped by",
"fld_names" => "Nome del campo nella prima riga",
"rep_null" => "Sostituisci NULL con",
"rem_crlf" => "Rimuovi i caratteri CRLF all'interno dei campi",
"put_fld" => "Metti i nomi dei campi nella prima riga",
"null_represent" => "NULL represented by",
"import_suc" => "Importato con successo.",
"import_into" => "Importa dentro",
"import_f" => "File da importare",
"rename_tbl" => "Rinomina la tabella '%s' in",
"rows_records" => "riga(e) partendo dal record # ",
"rows_aff" => "riga(e) interessate. ",
"as_a" => "as a",
"readonly_tbl" => "'%s' è una view, questo significa che si tratta di un istruzione SELECT trattata come una tabella di sola lettura. Non puoi ne editarla ne inserire nuovi record.",
"chk_all" => "Seleziona tutto",
"unchk_all" => "Deseleziona tutto",
"with_sel" => "Operazione selezionata",
"no_tbl" => "Nessuna tabella nel database.",
"no_chart" => "Se leggi questo, significa che il grafico potrebbe non essere generato. I dati che stai cercando di visualizzare potrebbero essere non appropriati per il grafico.",
"no_rows" => "Non ci sono righe nella tabella per il range che hai selezionato.",
"no_sel" => "Non hai selezionato nulla.",
"chart_type" => "Tipo di grafico",
"chart_bar" => "Grafico a barre",
"chart_pie" => "Grafico a torta",
"chart_line" => "Spezzata",
"lbl" => "Etichette",
"empty_tbl" => "Questa tabella è vuota.",
"click" => "Clicca qui",
"insert_rows" => "Per inserire righe.",
"restart_insert" => "Ricomincia l'inserimento con ",
"ignore" => "Ignora",
"func" => "Funzione",
"new_insert" => "Insierisci come Riga Nuova",
"save_ch" => "Salva le Modifiche",
"def_val" => "Valore di Default",
"prim_key" => "Chiave Primaria",
"tbl_end" => "campo(i) alla fine della tabella",
"query_used_table" => "Query usata per creare questa tabella",
"query_used_view" => "Query usata per creare questa view",
"create_index2" => "Crea un indice su",
"create_trigger2" => "Crea un nuovo trigger",
"new_fld" => "Adding new field(s) to table '%s'",
"add_flds" => "Aggiungi il campo",
"edit_col" => "Editing column '%s'",
"vac" => "Vacuum",
"vac_desc" => "Large databases sometimes need to be VACUUMed per ridurre l'impronta sul server. Clicca il bottone sotto per eseguire il VACUUM del database '%s'.",
"event" => "Event",
"each_row" => "Per ogni riga",
"define_index" => "Define index properties",
"dup_val" => "Duplica i valori",
"allow" => "Consentito",
"not_allow" => "Con consentito",
"asc" => "Ascendente",
"desc" => "Discendente",
"warn0" => "Sei stato avvisato.",
"warn_passwd" => "Stai usando la password di default, può essere pericoloso. Puoi cambiarla facilmente editando %s.",
"warn_dumbass" => "Non hai cambiato dumbass ;-)",
"sel_state" => "Seleziona l'istruzione",
"delimit" => "Delimitatore",
"back_top" => "Torna in cima",
"choose_f" => "Scegli il File",
"instead" => "Invece di",
"define_in_col" => "Definisci index column(s)",
"delete_only_managed" => "Puoi cancellare solamente i database gestiti da questo strumento!",
"rename_only_managed" => "Puoi rinominare solamente i database gestiti da questo strumento!",
"db_moved_outside" => "Hai certato di spotare dentro una direcotry dove non può essere gestita anylonger, oppure il controllo è fallito per la mancanza di diritti.",
"extension_not_allowed" => "L'estensione che hai fornito non è contenuta nella lista delle estensioni consentire. Per favore usa una delle seguenti estensioni",
"add_allowed_extension" => "Puoi aggiungere estensioni per questa lista aggiungendo la tua estensione to \$allowed_extensions nella configurazione.",
"directory_not_writable" => "Il file del database è di per se editabile, ma per poterci scrivere, anche la direcotory che lo ospita deve essere aggiornabile. Questo perchè SQLite ha bisogno di inserirvi file temporanei per il locking.",
"tbl_inexistent" => "La tabella %s non esiste",
// errors that can happen when ALTER TABLE fails. You don't necessarily have to translate these.
"alter_failed" => "Altering of Table %s failed",
"alter_tbl_name_not_replacable" => "could not replace the table name with the temporary one",
"alter_no_def" => "nessuna definzione ALTER",
"alter_parse_failed" =>"fallito il parsing (controllo) della definzione ALTER",
"alter_action_not_recognized" => "l'azione ALTER non è stata riconosciuta",
"alter_no_add_col" => "non è stata rilevata nessuna colonna da aggiungere nell'istruzione ALTER",
"alter_pattern_mismatch"=>"La sequenza non ha combaciato sulla tua istruzione originale CREATE TABLE",
"alter_col_not_recognized" => "non è stata rilevato il nome della nuova o della vecchia colonna",
"alter_unknown_operation" => "L'operazione ALTER non è riconosciuta!",
/* Help documentation */
"help_doc" => "Documentazione",
"help1" => "SQLite Librerie di Estensioni",
"help1_x" => "%s usa Librerie di Estensioni di PHP che consentono di interagire con i database SQLite. Attualmente, %s supporta PDO, SQLite3, e SQLiteDatabase. Sia PDO che SQLite3 trattano la versione 3 di SQLite, mentre SQLiteDatabase tratta con la versione 2. Così, se la tua installazione PHP include più di una libreria di estesione SQLite, PDO e SQLite3 avranno la precedenza nel fare uso della tecnologia migliore. Comunque, se possiedi database che sono nella versione 2 di SQLite, %s forzerà ad usare SQLiteDatabase solamente per quei database. Non tutti i database hanno bisogno di essere della stessa versione. Durante la creazione del database, comunque, l'estenzione verrà utilizzata l'estenzione più avanzata.",
"help2" => "Creare un Nuovo Database",
"help2_x" => "Quando crei un nuovo database, il nome che inserisci sarà appeso con l'estensione del file appropriata (.db, .db3, .sqlite, etc.) se non la includi tu stesso. Il database verrà creato nella directory che tu specifichi come directory \$directory variable.",
"help3" => "Tabelle vs. Viste",
"help3_x" => "Sulla pagina del database principale, c'è una lista di tabele e viste. Poichè le view sono di sola lettura, certe operazioni verranno disabilitate. Al posto di queste operazioni disabilitate verranno mostrati spazi vuoti (omissioni) nella righa di comando della vista. Se vuoi cambiare il dato di una vista, devi cancellare la vista e crearne una nuova con l'istruzione SELECT desiderata che interroga altre tabelle esistenti. Per maggiori informazioni, guarda <a href='http://en.wikipedia.org/wiki/View_(database)' target='_blank'>http://en.wikipedia.org/wiki/View_(database)</a>",
"help4" => "Scrivere un'istruzione di selezione per una nuova View",
"help4_x" => "Quando crei una nuova view, devi scrivere un istruzione SQL SELECT che verrà usata come suo dato. Una view è semplicemente una tabella di sola lettura alla quale si può accedere e porre interrogazioni come una normale tabella , ad eccezione del fatto che non può essere modificata con inserimenti, editing di colonna, or editing di riga. E' usata soltamente per estrapolare dati.",
"help5" => "Exportazione della Struttura verso il file SQL",
"help5_x" => "Durante il processo di esportazione verso un file SQL, puoi scegliere di includere le istruzioni (query) che consentono di creare tabella e colonne.",
"help6" => "Esporta i dati verso il File SQL",
"help6_x" => "Durante il processo di esportazione verso un file SQL, puoi scegliere di includere le istruzioni (query) che popolano la tabella(e) with the current records of the table(s).",
"help7" => "Aggiungi Drop Table (cancella tabella) al File SQL esportato",
"help7_x" => "Durante il processo di esportazione verso un file SQL, puoi scegliere di includere le istruzioni (query) per cancellare (DROP) le tabelle esistenti prima di aggiungerle così che non occorreranno problemi cercando di crearetabelle che già esistono.",
"help8" => "Aggiungi Transaction al File SQLto esportato",
"help8_x" => "Durante il processo di esportazione verso un file SQL, puoi scegliere di includere le istruzioni (query) around a TRANSACTION so that if an error occurs at any time during the importation process using the exported file, the database can be reverted to its previous state, preventing partially updated data from populating the database.",
"help9" => "Aggiungi commenti al File esportato",
"help9_x" => "Durante il processo di esportazione verso un file SQL, puoi includere commenti spiegano ogni passo del processo così che umano può comprendere meglio cosa sta succedendo."
);
?>

View File

@ -0,0 +1,81 @@
<?php
//
// This is sample configuration file
//
// You can configure phpliteadmin in one of 2 ways:
// 1. Rename phpliteadmin.config.sample.php to phpliteadmin.config.php and change parameters in there.
// You can set only your custom settings in phpliteadmin.config.php. All other settings will be set to defaults.
// 2. Change parameters directly in main phpliteadmin.php file
//
// Please see https://bitbucket.org/phpliteadmin/public/wiki/Configuration for more details
//password to gain access
$password = '[REDACTED]';
//directory relative to this file to search for databases (if false, manually list databases in the $databases variable)
$directory = '../..';
//whether or not to scan the subdirectories of the above directory infinitely deep
$subdirectories = false;
//if the above $directory variable is set to false, you must specify the databases manually in an array as the next variable
//if any of the databases do not exist as they are referenced by their path, they will be created automatically
$databases = array(
array(
'path'=> 'database1.sqlite',
'name'=> 'Database 1'
),
array(
'path'=> 'database2.sqlite',
'name'=> 'Database 2'
),
);
/* ---- Interface settings ---- */
// Theme! If you want to change theme, save the CSS file in same folder of phpliteadmin or in folder "themes"
$theme = 'phpliteadmin.css';
// the default language! If you want to change it, save the language file in same folder of phpliteadmin or in folder "languages"
// More about localizations (downloads, how to translate etc.): https://bitbucket.org/phpliteadmin/public/wiki/Localization
$language = 'it';
// set default number of rows. You need to relog after changing the number
$rowsNum = 30;
// reduce string characters by a number bigger than 10
$charsNum = 300;
// maximum number of SQL queries to save in the history
$maxSavedQueries = 10;
/* ---- Custom functions ---- */
//a list of custom functions that can be applied to columns in the databases
//make sure to define every function below if it is not a core PHP function
$custom_functions = array(
'md5', 'sha1', 'time', 'strtotime',
// add the names of your custom functions to this array
/* 'leet_text', */
);
// define your custom functions here
/*
function leet_text($value)
{
return strtr($value, 'eaAsSOl', '344zZ01');
}
*/
/* ---- Advanced options ---- */
//changing the following variable allows multiple phpLiteAdmin installs to work under the same domain.
$cookie_name = 'pla3419342';
//whether or not to put the app in debug mode where errors are outputted
$debug = false;
// the user is allowed to create databases with only these extensions
$allowed_extensions = array('db','db3','sqlite','sqlite3');

291
admin/db/phpliteadmin.css Normal file
View File

@ -0,0 +1,291 @@
/*
phpLiteAdmin Modern Theme
Created by Petar Koretic on 01/04/2013
*/
html,body
{
font: 81.25% arial, helvetica, sans-serif;
}
/* overall styles for entire page */
body
{
margin: 0px;
padding: 0px;
font-size: 1em;
color: #000;
background:#F5F5FA;
}
/* general styles for hyperlink */
a
{
color: #15c;
text-decoration: none;
cursor :pointer;
text-shadow: 0 1px 1px #FFF;
}
a:hover
{
color: #00A;
}
/* horizontal rule */
hr
{
height:1px;
border: 0;
color: #d2d2d2;
background: #d2d2d2;
width: 100%;
}
/* logo text containing name of project */
h1
{
margin: 0px;
padding: 5px;
font-size: 1.85em;
text-align: center;
margin-bottom: 10px;
}
/* version text within the logo */
h1 #version
{
font-size: 0.65em;
color:#FFF;
text-shadow: 0 1px 1px #194B7E;
}
/* logo text within logo */
h1 #logo
{
color:#FFF;
text-shadow: 0 1px 1px #194B7E;
}
/* general header for various views */
h2
{
margin:0px;
padding:0px;
font-size:1em;
margin-bottom:20px;
}
select
{
background: #FFF;
border: 1px solid #CCC;
height:27px;
line-height:27px;
vertical-align:middle;
}
[multiple]
{
height:100%;
}
/* input buttons and areas for entering text */
textarea
{
background:#FBFBFF;
padding:5px;
margin:0;
outline: none;
border:1px solid #FFF;
border-color:#D2D2DC #E6E6F0 #E6E6F0 #D2D2DC;
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
input[type=text],
input[type=password]
{
background:#FBFBFF;
display: inline-block;
height: 25px;
line-height:25px;
margin: 0;
padding: 0 8px;
vertical-align:middle;
border:1px solid #FFF;
border-color:#D2D2DC #E6E6F0 #E6E6F0 #D2D2DC;
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
/* just input buttons */
input.btn
{
cursor:pointer;
vertical-align:middle;
display:inline-block;
margin: 0;
outline:none;
border:1px solid #C8C8C8;
border-bottom-color:#B4B4B4;
border-right-color:#AAAAAA;
height:27px;
padding:0 10px;
}
input.btn:hover
{
border-color:#D2D2D2;
}
/* general styles for hyperlink */
fieldset,.confirm
{
padding:15px;
background:#f9f9f9;
border: 1px solid #B4B4FA;
}
/* outer div that holds everything */
#container
{
padding:10px;
}
/* div of left box with log, list of databases, etc. */
#leftNav
{
float:left;
width:250px;
padding:0px;
padding-bottom:15px;
border:1px solid #B4B4FA;
background:#FFF;
}
/* div holding the content to the right of the leftNav */
#content
{
overflow:hidden;
padding-left:10px;
}
/* div holding the login fields */
#loginBox
{
width:500px;
margin-left:auto;
margin-right:auto;
margin-top:50px;
border:1px solid #B4B4FA;
background:#FFF;
}
/* div under tabs with tab-specific content */
#main
{
border:1px solid #B4B4FA;
padding:15px;
overflow:auto;
background:#FFF;
}
/* odd-numbered table rows */
.td1
{
background:#fff;
text-align:right;
font-size:0.9em;
padding-left:10px;
padding-right:10px;
}
/* even-numbered table rows */
.td2
{
background:#F9F9F9;
text-align:right;
font-size:0.9em;
padding-left:10px;
padding-right:10px;
}
/* table column headers */
.tdheader
{
border:1px solid #B4B4FA;
font-weight:bold;
font-size:0.9em;
padding-left:10px;
padding-right:10px;
}
/* tab navigation for each table */
.tab
{
display:block;
padding:5px;
padding-right:8px;
padding-left:8px;
border:1px solid #B4B4FA;
margin-right:1px;
float:left;
position:relative;
top:1px;
padding-bottom:4px;
background:#eaeaea;
}
/* pressed state of tab */
.tab_pressed
{
display:block;
padding:5px 8px;
border:1px solid #B4B4FA;
margin-right:1px;
float:left;
border-bottom-style:none;
position:relative;
top:1px;
background:#FFF;
cursor:default;
}
/* tooltip styles */
#tt
{
position:absolute;
display:block;
}
#tttop
{
display:block;
height:5px;
margin-left:5px;
overflow:hidden
}
#ttcont
{
display:block;
padding:2px 12px 3px 7px;
margin-left:5px;
background:#f3cece;
color:#333
}
#ttbot
{
display:block;
height:5px;
margin-left:5px;
overflow:hidden
}
h1
{
background: #81a8ce; /* Old browsers */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzgxYThjZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM1ZTg3YjAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: linear-gradient(#81a8ce,#5e87b0); /* W3C */
}
input.btn, .tab, .tdheader
{
background: #fdfdfd; /* Old browsers */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZkZmRmZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZWVlZWUiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: linear-gradient(#fdfdfd,#eeeeee); /* W3C */
}
table
{
border-collapse: collapse;
}
table td
{
border: 1px solid #eee;
padding:5px;
}
#headerlinks
{
text-align:center; }

6181
admin/db/phpliteadmin.php Normal file

File diff suppressed because it is too large Load Diff

174
admin/db/readme.md Normal file
View File

@ -0,0 +1,174 @@
# phpLiteAdmin
Website: https://www.phpliteadmin.org/
Bitbucket: https://bitbucket.org/phpliteadmin/public/
## What is phpLiteAdmin?
phpLiteAdmin is a web-based SQLite database admin tool written in PHP with
support for SQLite3 and SQLite2. Following in the spirit of the flat-file system
used by SQLite, phpLiteAdmin consists of a single source file, phpliteadmin.php,
that is dropped into a directory on a server and then visited in a browser.
There is no installation required. The available operations, feature set,
interface, and user experience is comparable to that of phpMyAdmin.
## News
**05.09.2019: phpLiteAdmin 1.9.8.2 released [Download now](https://www.phpliteadmin.org/download/)**
**03.09.2019: phpLiteAdmin 1.9.8.1 released [Download now](https://www.phpliteadmin.org/download/)**
**30.08.2019: phpLiteAdmin 1.9.8 released [Download now](https://www.phpliteadmin.org/download/)**
**17.08.2017: [Security alert: phpLiteAdmin 1.9.8-dev](https://www.phpliteadmin.org/2017/08/17/security-alert-1-9-8-dev/) (stable versions not affected)**
**14.12.2016: Just released phpLiteAdmin 1.9.7.1 as 1.9.7 was built incorrectly [Download now](https://www.phpliteadmin.org/download/)**
**13.12.2016: Just released phpLiteAdmin 1.9.7! [Download now](https://www.phpliteadmin.org/download/)**
**05.07.2015: Just released phpLiteAdmin 1.9.6! [Download now](https://www.phpliteadmin.org/download/)**
## Features
- Lightweight - consists of a single 200KB source file for portability
- Supports SQLite3 and SQLite2 databases
- Translated and available in over 10 languages - and counting
- Specify and manage an unlimited number of databases
- Specify a directory and optionally its subdirectories to scan for databases
- Create and delete databases
- Add, delete, rename, empty, and drop tables
- Browse, add, edit, and delete records
- Add, delete, and edit table columns
- Manage table indexes
- Manage table triggers
- Import and export tables, structure, indexes, and data (SQL, CSV)
- View data as bar, pie, and line charts
- Graphical search tool to find records based on specified field values
- Create and run your own custom SQL queries in the free-form query editor/builder
- Easily apply core SQLite functions to column values using the GUI
- Write your own PHP functions to be available to apply to column values
- Design your own theme using CSS or install a pre-made theme from the community
- All presented in an intuitive, easy-to-use GUI that allows non-technical, SQL-illiterate users to fully manage databases
- Allows multiple installations on the same server, each with a different password
- Secure password-protected interface with login screen and cookies
## Demo
A live demo of phpLiteAdmin can be found here:
https://demo.phpliteadmin.org/
## Requirements
- a server with PHP >= 5.2.4 installed
- at least one PHP SQLite library extension installed and enabled: PDO,
SQLite3, or SQLiteDatabase
PHP version 5.3.0 and greater usually comes with the SQLite3 extension installed
and enabled by default so no custom action is necessary.
## Download
The files in the source repositories are meant for development, not for use in production.
You can find the latest downloads here:
https://www.phpliteadmin.org/download/
## Installation
See https://bitbucket.org/phpliteadmin/public/wiki/Installation
## Configuration
**NEW** as of 1.9.4: You can now configure phpLiteAdmin in an external file. If
you want to do this:
- rename `phpliteadmin.config.sample.php` into `phpliteadmin.config.php`
- do not change the settings in `phpliteadmin.php` but in
`phpliteadmin.config.php`
See https://bitbucket.org/phpliteadmin/public/wiki/Configuration for details.
1. Open `phpliteadmin.config.php` (or `phpliteadmin.php` before 1.9.4) in
a text editor.
2. If you want to have a directory scanned for your databases instead of
listing them manually, specify the directory as the value of the
`$directory` variable and skip to step 4.
3. If you want to specify your databases manually, set the value of the
`$directory` variable as false and modify the `$databases` array to
hold the databases you would like to manage.
- The path field is the file path of the database relative to where
`phpliteadmin.php` will be located on the server. For example, if
`phpliteadmin.php` is located at "databases/manager/phpliteadmin.php" and
you want to manage "databases/yourdatabase.sqlite", the path value
would be "../yourdatabase.sqlite".
- The name field is the human-friendly way of referencing the database
within the application. It can be anything you want.
4. Modify the `$password` variable to be the password used for gaining access
to the phpLiteAdmin tool.
5. If you want to have multiple installations of phpLiteAdmin on the same
server, change the `$cookie_name` variable to be unique for each installation
(optional).
6. Save and upload `phpliteadmin.php` to your web server.
7. Open a web browser and navigate to the uploaded `phpliteadmin.php` file. You
will be prompted to enter a password. Use the same password you set in step 4.
## Code Repository and pull requests
The code repository is available both on bitbucket and github:
Github: https://github.com/phpLiteAdmin/pla
Bitbucket: https://bitbucket.org/phpliteadmin/public/src
You are welcome to fork the project and send us pull requests on any of these
platforms.
## Installing a theme
1. Download the themes package from the [project Downloads page](https://www.phpliteadmin.org/download/).
2. Unzip the file and choose your desired theme.
3. Upload `phpliteadmin.css` from the theme's directory alongside
`phpliteadmin.php`.
4. Your theme will automatically override the default.
## Getting help
The project's wiki provides information on how to do certain things and is
located at https://bitbucket.org/phpliteadmin/public/wiki/Home .
In addition, the project's discussion group is located at
https://groups.google.com/group/phpliteadmin .
## Reporting errors and bugs
If you find any issues while using the tool, please report them at
https://bitbucket.org/phpliteadmin/public/issues?status=new&status=open .
## License
This program 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.
This program 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 this program. If not, see <[https://www.gnu.org/licenses/](https://www.gnu.org/licenses/)>.

1
apicache/lastDbUpdate Normal file
View File

@ -0,0 +1 @@
1612211673

4
bigliettaggio/README.md Normal file
View File

@ -0,0 +1,4 @@
#Bigliettaggio
This is a separate ticketing system that was merged with lens
it's not open source and so this folder is empty
(trust me, you are not missing anything)

BIN
database.db Normal file

Binary file not shown.

17
dialog.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Invia Domanda</title>
<meta name="viewport" content="width=device-width, initial-scale=1, can-resize=no">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head><body>
<div data-role="page" data-dialog="true">
<div data-role="header" data-theme="b"> <h1>Nuova domanda</h1> </div>
<div role="main" class="ui-content">
<iframe src="https://docs.google.com/forms/d/e/1FAIpQLSecKIdooyZz2CStogBEauf1PyuCdNbCFd0hWpKz1mfsrprbSw/viewform?embedded=true" style="width:100%;height:50vh;" frameborder="0" marginheight="0" marginwidth="0">Caricamento…</iframe>
</div> </div>
</body></html>

528
dlib.php Normal file
View File

@ -0,0 +1,528 @@
<?php
function delete(&$array,$index){
unset($array[$index]); // remove item at index 0
$array= array_values($array); // 'reindex' array
}
function conditionalDatePosting(&$array,$post,$dateKey){
$start=$post["start"];
$end=$post["end"];
if($start!="false" || $end!="false"){
$start=$start?strtotime($start):0;
$end=$end?strtotime($end):100000000000;
$array=dateRangeFilter($array,$dateKey,$start,$end);
/*
var_dump($array);
var_dump($post);
*/
}
}
function dateRangeFilter($array,$dateKey,$start,$end){
$new=[];
for($i=0;$i<count($array);$i++){
if(strtotime($array[$i][$dateKey])>=$start && strtotime($array[$i][$dateKey])<=$end) $new[]=$array[$i];
}
return $new;
}
function adjustFlow($aa){
$f=[];
foreach(array_keys($aa) as $k){
foreach($aa[$k] as $r){
$r["objectType"]=substr($k, 0, -1);
$f[]=$r;
}
}
sortByDateAll($f);
array_reverse($f);
return $f;
}
function sortByDateAll(&$ar){
usort($ar, function ($item1, $item2) {
return strtotime($item1['publishedDate']) <=> strtotime($item2['publishedDate']);
});
}
function iten($n){
$sos=[
"previsto il"=>"planned",
"effettuato il"=>"executed",
"importo"=>"amount",
"titolo"=>"title",
"descrizione breve"=>"shortDescription",
"descrizione in html"=>"htmlDescription",
"data di creazione"=>"createdDate",
"data di pubblicazione"=>"publishedDate",
"data di ultima modifica"=>"lastEditedDate",
"url anteprima"=>"thumbnailUrl",
"url documento"=>"documentUrl",
"data di inizio"=>"startDate",
"data di fine"=>"endDate",
"partecipanti"=>"participants",
"tipo"=>"isAssembly",
"data inizio raccolta risposte"=>"startDate",
"data fine raccolta risposte"=>"endDate",
"data pubblicazione dei risultati"=>"publishResultsDate",
"testo in html"=>"htmlDescription",
"titolo domanda"=>"questionTitle",
"domanda"=>"questionText",
"titolo risposta"=>"answerTitle",
"risposta"=>"answerText",
"data richiesta"=>"askDate",
"data risposta"=>"answerDate",
"richiedente"=>"asker",
"rispondente"=>"replier"
];
return $sos[strtolower($n)]?:$n;
}
function contains($string, $array, $caseSensitive = true)
{
$stripedString = $caseSensitive ? str_replace($array, '', $string) : str_ireplace($array, '', $string);
return strlen($stripedString) !== strlen($string);
}
function AAdateRect($array,$prase=["date","planned","executed"]){
foreach (array_keys($array) as $k){
if(contains($k,$prase)){
$array[$k]=dateRectify($array[$k]);
}
}
return $array;
}
function AALRect(&$list){
for($i=0;$i<count($list);$i++){
$list[$i]=AAdateRect($list[$i]);
}
}
function dateRectify($dateAll){
list($date,$time)=explode(" ",$dateAll,2);
$d=explode("-",$date);
if(count($d)<3) $d=explode("/",$date);
if($d[0]<13) return trim($d[2]."-".$d[1]."-".$d[0]." ".$time); //d m y to y-m-d
return trim($d[0]."-".$d[1]."-".$d[2]." ".$time);
}
function uid($t,$pdo){
$id=substr($t, 1);
$type=strtolower($t[0]);
if(!is_numeric($id)) return (-1);
switch($type){
case "t":
$re=listCont($pdo,$id);
break;
case "q":
$re=listDomande($pdo,$id);
break;
case "d":
$re=listDocs($pdo,$id);
break;
case "e":
$re=listEvents($pdo,$id);
break;
case "f":
$re=listFeedbacks($pdo,$id);
break;
default:
return (-1);
break;
}
return $re;
}
function aritenWrap($mix){
for($i=0;$i<count($mix);$i++){
$mix[$i]=ariten($mix[$i]);
}
return $mix;
}
function ariten($arr){
foreach($arr as $k=>$v){
if( ($nk=iten($k)) != $k){
$arr[$nk]=$v;
unset($arr[$k]);
}
}
return $arr;
}
use Spatie\ArrayToXml\ArrayToXml;
function listDocs($pdo,$id=null){
if(!$id){
$q=$pdo->prepare('SELECT * FROM "Documenti" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$q->execute();
$docs=$q->fetchAll(PDO::FETCH_ASSOC);
}
else{
$q=$pdo->prepare('SELECT * FROM "Documenti" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$q->execute([":id"=>$id]);
$docs=$q->fetchAll(PDO::FETCH_ASSOC);
}
$docs=aritenWrap($docs);
$t=$pdo->prepare('SELECT * FROM "Eventi" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$t->execute();
$evs=$t->fetchAll(PDO::FETCH_ASSOC);
$t=$pdo->prepare('SELECT * FROM "Contabilita" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$t->execute();
$cnts=$t->fetchAll(PDO::FETCH_ASSOC);
$t=$pdo->prepare('SELECT * FROM "Domande" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$t->execute();
$qts=$t->fetchAll(PDO::FETCH_ASSOC);
$t=$pdo->prepare('SELECT * FROM "Feedbacks" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$t->execute();
$fbs=$t->fetchAll(PDO::FETCH_ASSOC);
for($i=0;$i<count($docs);$i++){
$docs[$i]["ID"]=(int) $docs[$i]["ID"];
$docs[$i]["UID"]="d".$docs[$i]["ID"];
for($j=0;$j<count($evs);$j++){
if(in_array($docs[$i]["ID"],explode(",",$evs[$j]["Documenti collegati"]) )) $docs[$i]["links"]["from"]["events"][]=["title"=>$evs[$j]["Titolo"],"ID"=>(int)$evs[$j]["ID"],"UID"=>"e".$evs[$j]["ID"]];
}
for($j=0;$j<count($cnts);$j++){
if(in_array($docs[$i]["ID"],explode(",",$cnts[$j]["Documenti collegati"]) )) $docs[$i]["links"]["from"]["transactions"][]=["title"=>$cnts[$j]["Titolo"],"ID"=>(int)$cnts[$j]["ID"],"UID"=>"t".$cnts[$j]["ID"]];
}
for($j=0;$j<count($qts);$j++){
if(in_array($qts[$i]["ID"],explode(",",$qts[$j]["Documenti collegati"]) )) $docs[$i]["links"]["from"]["questions"][]=["title"=>$qts[$j]["Titolo Domanda"],"ID"=>(int)$qts[$j]["ID"],"UID"=>"q".$qts[$j]["ID"]];
}
for($j=0;$j<count($fbs);$j++){
if(in_array($docs[$i]["ID"],explode(",",$fbs[$j]["Documenti collegati"]) )) $docs[$i]["links"]["from"]["feedbacks"][]=["title"=>$fbs[$j]["Titolo"],"ID"=>(int)$fbs[$j]["ID"],"UID"=>"f".$fbs[$j]["ID"]];
}
$docs[$i]["tags"]=explode(",",$docs[$i]["Tags"]);
unset($docs[$i]["Tags"]);
if(!empty($docs[$i]["URL Firma Digitale"])){
$docs[$i]["signatureUrl"]=$docs[$i]["URL Firma Digitale"];
}
unset($docs[$i]["URL Firma Digitale"]);
$docs[$i]["format"]=["type"=>$docs[$i]["Tipo documento"],"description"=>DOCTypeDescr($docs[$i]["Tipo documento"]),"uiColor"=>colorByTypeDOC($docs[$i]["Tipo documento"])];
unset($docs[$i]["Tipo documento"]);
}
return $docs;
}
function listCont($pdo,$id=null){
if(!$id){
$q=$pdo->prepare('SELECT * FROM "Contabilita" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$q->execute();
$docs=$q->fetchAll(PDO::FETCH_ASSOC);
}
else{
$q=$pdo->prepare('SELECT * FROM "Contabilita" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$q->execute([":id"=>$id]);
$docs=$q->fetchAll(PDO::FETCH_ASSOC);
}
$docs=aritenWrap($docs);
$t=$pdo->prepare('SELECT * FROM "Feedbacks" WHERE "Data di pubblicazione" < DATETIME("NOW") ORDER BY "Data di pubblicazione" DESC');
$t->execute();
$fbs=$t->fetchAll(PDO::FETCH_ASSOC);
$t=$pdo->prepare('SELECT * FROM "Domande" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$t->execute();
$qts=$t->fetchAll(PDO::FETCH_ASSOC);
for($i=0;$i<count($docs);$i++){
$docs[$i]["ID"]=(int) $docs[$i]["ID"];
$docs[$i]["UID"]="t".$docs[$i]["ID"];
$docs[$i]["amount"]=(float)$docs[$i]["amount"];
for($j=0;$j<count($qts);$j++){
if(in_array($qts[$i]["ID"],explode(",",$qts[$j]["Contabilita collegata"]) )) $docs[$i]["links"]["from"]["questions"][]=["title"=>$qts[$j]["Titolo Domanda"],"ID"=>(int)$qts[$j]["ID"],"UID"=>"q".$qts[$j]["ID"]];
}
for($j=0;$j<count($fbs);$j++){
if(in_array($docs[$i]["ID"],explode(",",$fbs[$j]["Feedback collegati"]) )) $docs[$i]["links"]["from"]["feedbacks"][]=["title"=>$fbs[$j]["Titolo"],"ID"=>(int)$fbs[$j]["ID"],"UID"=>"f".$fbs[$j]["ID"]];
}
$ef=explode(",",$docs[$i]["Documenti collegati"]);
$ta=[];
foreach($ef as $d){
$t=$pdo->prepare('SELECT * FROM "Documenti" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$t->execute([":id"=>$d]);
$tu=$t->fetch(PDO::FETCH_ASSOC);
if($tu) $ta[]=["ID"=>(int)$d,"title"=>$tu["Titolo"],"UID"=>"d".$d];
}
if(count($ta)) $docs[$i]["links"]["to"]["documents"]=$ta;
$docs[$i]["tags"]=explode(",",$docs[$i]["Tags"]);
unset($docs[$i]["Tags"]);
unset($docs[$i]["Documenti collegati"]);
}
return $docs;
}
function listEvents($pdo,$id=null){
if(!$id){
$q=$pdo->prepare('SELECT * FROM "Eventi" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$q->execute();
$docs=$q->fetchAll(PDO::FETCH_ASSOC);
}
else{
$q=$pdo->prepare('SELECT * FROM "Eventi" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$q->execute([":id"=>$id]);
$docs=$q->fetchAll(PDO::FETCH_ASSOC);
}
$docs=aritenWrap($docs);
$t=$pdo->prepare('SELECT * FROM "Feedbacks" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$t->execute();
$fbs=$t->fetchAll(PDO::FETCH_ASSOC);
$t=$pdo->prepare('SELECT * FROM "Domande" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$t->execute();
$qts=$t->fetchAll(PDO::FETCH_ASSOC);
for($i=0;$i<count($docs);$i++){
$docs[$i]["participants"]=explode(",",$docs[$i]["participants"]);
$docs[$i]["ID"]=(int) $docs[$i]["ID"];
$docs[$i]["UID"]="e".(int) $docs[$i]["ID"];
$docs[$i]["isAssembly"]=(bool)$docs[$i]["isAssembly"];
for($j=0;$j<count($qts);$j++){
if(in_array($qts[$i]["ID"],explode(",",$qts[$j]["Eventi collegati"]) )) $docs[$i]["links"]["from"]["questions"][]=["title"=>$qts[$j]["Titolo Domanda"],"ID"=>(int)$qts[$j]["ID"],"UID"=>"q".$qts[$j]["ID"]];
}
for($j=0;$j<count($fbs);$j++){
if(in_array($docs[$i]["ID"],explode(",",$fbs[$j]["Eventi collegati"]) )) $docs[$i]["links"]["from"]["feedbacks"][]=["title"=>$fbs[$j]["Titolo"],"ID"=>(int)$fbs[$j]["ID"],"UID"=>"f".$fbs[$j]["ID"]];
}
$ef=explode(",",$docs[$i]["Documenti collegati"]);
$ta=[];
foreach($ef as $d){
$t=$pdo->prepare('SELECT * FROM "Documenti" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$t->execute([":id"=>$d]);
$tu=$t->fetch(PDO::FETCH_ASSOC);
if($tu) $ta[]=["ID"=>(int)$d,"title"=>$tu["Titolo"],"UID"=>"d".$d];
}
if(count($ta)) $docs[$i]["links"]["to"]["documents"]=$ta;
$docs[$i]["tags"]=explode(",",$docs[$i]["Tags"]);
unset($docs[$i]["Tags"]);
unset($docs[$i]["Documenti collegati"]);
}
return $docs;
}
function listDomande($pdo,$id=null){
if(!$id){
$q=$pdo->prepare('SELECT * FROM "Domande" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$q->execute();
$docs=$q->fetchAll(PDO::FETCH_ASSOC);
}
else{
$q=$pdo->prepare('SELECT * FROM "Domande" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$q->execute([":id"=>$id]);
$docs=$q->fetchAll(PDO::FETCH_ASSOC);
}
$docs=aritenWrap($docs);
for($i=0;$i<count($docs);$i++){
$docs[$i]["ID"]=(int) $docs[$i]["ID"];
$docs[$i]["UID"]="q".$docs[$i]["ID"];
$docs[$i]["tags"]=explode(",",$docs[$i]["Tags"]);
unset($docs[$i]["Tags"]);
$ef=explode(",",$docs[$i]["Documenti collegati"]);
$ta=[];
foreach($ef as $d){
$t=$pdo->prepare('SELECT * FROM "Documenti" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$t->execute([":id"=>$d]);
$tu=$t->fetch(PDO::FETCH_ASSOC);
if($tu) $ta[]=["ID"=>(int)$d,"title"=>$tu["Titolo"],"UID"=>"d".$d];
}
if(count($ta)) $docs[$i]["links"]["to"]["documents"]=$ta;
unset($docs[$i]["Documenti collegati"]);
$ef=explode(",",$docs[$i]["Eventi collegati"]);
$ta=[];
foreach($ef as $d){
$t=$pdo->prepare('SELECT * FROM "Eventi" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$t->execute([":id"=>$d]);
$tu=$t->fetch(PDO::FETCH_ASSOC);
if($tu) $ta[]=["ID"=>(int)$d,"title"=>$tu["Titolo"],"UID"=>"e".$d];
}
if(count($ta)) $docs[$i]["links"]["to"]["events"]=$ta;
unset($docs[$i]["Eventi collegati"]);
$ef=explode(",",$docs[$i]["Contabilita collegata"]);
$ta=[];
foreach($ef as $d){
$t=$pdo->prepare('SELECT * FROM "Contabilita" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$t->execute([":id"=>$d]);
$tu=$q->fetch(PDO::FETCH_ASSOC);
if($tu) $ta[]=["ID"=>(int)$d,"title"=>$tu["Titolo"],"UID"=>"t".$d];
}
if(count($ta)) $docs[$i]["links"]["to"]["transactions"]=$ta;
unset($docs[$i]["Contabilita collegata"]);
$ef=explode(",",$docs[$i]["Feedback collegati"]);
$ta=[];
foreach($ef as $d){
$t=$pdo->prepare('SELECT * FROM "Feedbacks" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$t->execute([":id"=>$d]);
$tu=$q->fetch(PDO::FETCH_ASSOC);
if($tu) $ta[]=["ID"=>(int)$d,"Titolo"=>$tu["Titolo"],"UID"=>"f".$d];
}
if(count($ta)) $docs[$i]["links"]["to"]["feedbacks"]=$ta;
unset($docs[$i]["Feedback collegati"]);
}
return $docs;
}
function listFeedbacks($pdo,$id=null){
if(!$id){
$q=$pdo->prepare('SELECT * FROM "Feedbacks" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$q->execute();
$docs=$q->fetchAll(PDO::FETCH_ASSOC);
}
else{
$q=$pdo->prepare('SELECT * FROM "Feedbacks" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$q->execute([":id"=>$id]);
$docs=$q->fetchAll(PDO::FETCH_ASSOC);
}
$docs=aritenWrap($docs);
$t=$pdo->prepare('SELECT * FROM "Domande" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" DESC');
$t->execute();
$qts=$t->fetchAll(PDO::FETCH_ASSOC);
for($i=0;$i<count($docs);$i++){
$docs[$i]["ID"]=(int) $docs[$i]["ID"];
$docs[$i]["UID"]="f".$docs[$i]["ID"];
for($j=0;$j<count($qts);$j++){
if(in_array($qts[$i]["ID"],explode(",",$qts[$j]["Feedback collegati"]) )) $docs[$i]["links"]["from"]["questions"][]=["title"=>$qts[$j]["Titolo Domanda"],"ID"=>(int)$qts[$j]["ID"],"UID"=>"q".$qts[$j]["ID"]];
}
$ef=explode(",",$docs[$i]["Eventi collegati"]);
$ta=[];
foreach($ef as $d){
$t=$pdo->prepare('SELECT * FROM "Eventi" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$t->execute([":id"=>$d]);
$tu=$t->fetch(PDO::FETCH_ASSOC);
if($tu) $ta[]=["ID"=>(int)$d,"title"=>$tu["Titolo"],"UID"=>"q".$d];
}
if(count($ta)) $docs[$i]["links"]["to"]["events"]=$ta;
unset($docs[$i]["Eventi collegati"]);
$ef=explode(",",$docs[$i]["Documenti collegati"]);
$ta=[];
foreach($ef as $d){
$t=$pdo->prepare('SELECT * FROM "Documenti" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$t->execute([":id"=>$d]);
$tu=$t->fetch(PDO::FETCH_ASSOC);
if($tu) $ta[]=["ID"=>(int)$d,"title"=>$tu["Titolo"],"UID"=>"d".$d];
}
if(count($ta)) $docs[$i]["links"]["to"]["documents"]=$ta;
unset($docs[$i]["Documenti collegati"]);
$ef=explode(",",$docs[$i]["Contabilita collegata"]);
$ta=[];
foreach($ef as $d){
$t=$pdo->prepare('SELECT * FROM "Contabilita" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" DESC');
$t->execute([":id"=>$d]);
$tu=$t->fetch(PDO::FETCH_ASSOC);
if($tu) $ta[]=["ID"=>(int)$d,"title"=>$tu["Titolo"],"UID"=>"t".$d];
}
if(count($ta)) $docs[$i]["links"]["to"]["transactions"]=$ta;
unset($docs[$i]["Contabilita collegata"]);
$docs[$i]["tags"]=explode(",",$docs[$i]["Tags"]);
unset($docs[$i]["Tags"]);
}
return $docs;
}
function listAll($pdo){
$a=[];
$a["documents"]=listDocs($pdo);
$a["transactions"]=listCont($pdo);
$a["feedbacks"]=listFeedbacks($pdo);
$a["questions"]=listDomande($pdo);
$a["events"]=listEvents($pdo);
return $a;
}
function listTagsDetail($pdo){
$tagsList=[];
$heap=listAll($pdo);
foreach($heap as $cat=>$list){
foreach($list as $el){
foreach($el["tags"] as $t){
if(!$el["title"]) continue;
$tagsList[$t]["usage"]["categories"][$cat][]=["title"=>$el["title"],"ID"=>$el["ID"],"UID"=>$el["UID"]];
$tagsList[$t]["usage"]["timePoints"][dateRectify($el["publishedDate"])][]=["title"=>$el["title"],"ID"=>$el["ID"],"UID"=>$el["UID"]];
}
}
}
return $tagsList;
}
function listTags($pdo){
$tagsList=[];
$heap=listAll($pdo);
foreach($heap as $cat=>$list){
foreach($list as $el){
foreach($el["tags"] as $t){
$tagsList[$t]["usage"]["categories"][$cat]++;
$tagsList[$t]["usage"]["timePoints"][$el["publishedDate"]]++;
}
}
}
return $tagsList;
}
function jsonSave($file,$data){
file_put_contents($file,json_encode($data,JSON_PRETTY_PRINT));
}
class Reply{
private $enableCache,$cacheDir,$cacheTime,$ap;
function __construct($enableCache,$cacheDir,$cacheTime,$ap){
$this->enableCache=$enableCache;
$this->cacheDir=$cacheDir;
$this->cacheTime=$cacheTime;
$this->ap=$ap;
}
function die($errorName="GENERIC_ERROR",$description="Un errore non identificato si è verificato",$httpStatusCode=400){
http_response_code($httpStatusCode);
$this->sendJson(["ok"=>false,"errorName"=>$errorName,"description"=>$description],true);
}
function send($data){
$this->sendJson(["ok"=>true,"data"=>$data]);
}
function sendJson($data,$isError=false){
$json=json_encode($data,JSON_PRETTY_PRINT);
if($this->enableCache&&!$isError){
$contFile =$this->cacheDir."/".str_replace("/","-",$this->ap);
$data["cache"]["last"]=date("d-m-Y H:i:s");
jsonSave($contFile,$data);
}
header("Content-type: application/json");
header("Content-Length: ".strlen($json));
echo $json;
exit;
}
}
function cachedReplier($enableCache,$cacheDir,$cacheTime,$ap){
if(!$enableCache) return false;
$contFile =$cacheDir."/".str_replace("/","-",$ap);
if(!file_exists($contFile)) return false;
$fc=file_get_contents($contFile);
$fcc=json_decode($fc,true);
if( strtotime($fcc["cache"]["last"])< (int) file_get_contents($cacheDir."/lastDbUpdate") ){
return false;
}
header("Content-type: application/json");
header("Content-Length: ".strlen($fc));
echo $fc;
exit;
}

BIN
docs/arcigay.pdf Normal file

Binary file not shown.

BIN
docs/arcigay.pdf.sig Normal file

Binary file not shown.

BIN
docs/email.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

262
index.html Normal file
View File

@ -0,0 +1,262 @@
<!DOCTYPE html>
<html>
<head>
<title>Lens</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, can-resize=no">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link href="https://fonts.googleapis.com/css2?family=Caveat&display=swap" rel="stylesheet">
<script src="main.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment-with-locales.min.js" integrity="sha512-LGXaggshOkD/at6PFNcp2V2unf9LzFq6LE+sChH7ceMTDP0g2kn6Vxwgg7wkPP7AAtX+lmPqPdxB47A0Nz0cMQ==" crossorigin="anonymous"></script>
</head>
<body>
<div data-role="page" id="main">
<div data-role="header" >
<h1 style="font-family: 'Caveat', cursive;font-size:40px;">Lens</h1>
<a href="bigliettaggio/login.html" data-icon="user" class="ui-btn-right">Account personale</a>
<div data-role="navbar">
<ul>
<li><a href="#main" class="ui-btn-active ui-state-persist"  data-icon="calendar" >Eventi</a></li>
<li><a href="#documents" data-icon="bars">Documenti</a></li>
<li><a href="#feedbacks" data-icon="recycle">Feedback</a></li>
<li><a href="https://trello.com/b/pRcVr2FN/rappresentanti-di-istituto" target="_blank" data-icon="check">Progetti</a></li>
<li><a href="#accounting" data-icon="clock">Contabilit&agrave;</a></li>
<li><a href="#questions" data-icon="edit">Domande &amp; Risposte</a></li>
</ul>
</div><!-- /navbar -->
</div>
<div data-role="collapsible" id="set1" data-collapsed="true" data-collapsed-icon="carat-d" data-expanded-icon="eye">
<h2>Ricerca avanzata</h2>
<form data-act="search">
<input type="date" name="start" placeholder="Inizio">
<input type="date" name="end" value="fine" placeholder="Fine">
<input type="hidden" name="search" value="events">
<input type="submit" data-icon="eye" value="Cerca">
</form>
<form onsubmit="location.reload();">
<input type="submit" name="clear" value="Resetta" data-icon="delete">
</form>
</div>
<ul data-role="listview" data-inset="true" data-divider-theme="a" id="eventsList" data-filter="true" data-filter-placeholder="Ricerca eventi">
</ul>
<div data-role="footer" >
<p>Lens - &copy; 2020, Mattia Mascarello </p>
<p>Contenuto rilasciato sotto licenza <a href="https://creativecommons.org/licenses/by/2.0/it/">CC BY 2.0 IT</a></p>
<a href="https://lens.stoplight.io/docs/lens/docs/Lens-Api.md">REST API</a>
<a href="https://www.innovationplaylist.eu/lens/app/public.gpg.pgpInnovationplaylist.eu.asc" target="_blank">Chiave pubblica PGP per le firme digitali</a>
<a href="https://www.innovationplaylist.eu/lens/app/api/view/all/rss" target="_blank">Feed RSS</a>
</div>
</div>
<div data-role="page" id="documents">
<div data-role="header" >
<h1 style="font-family: 'Caveat', cursive;font-size:40px;">Lens</h1>
<a href="bigliettaggio/login.html" data-icon="user" class="ui-btn-right">Account personale</a>
<div data-role="navbar">
<ul>
<li><a href="#main" data-icon="calendar" >Eventi</a></li>
<li><a href="#documents" class="ui-btn-active ui-state-persist"  data-icon="bars">Documenti</a></li>
<li><a href="#feedbacks" data-icon="recycle">Feedback</a></li>
<li><a href="https://trello.com/b/pRcVr2FN/rappresentanti-di-istituto" target="_blank" data-icon="check">Progetti</a></li>
<li><a href="#accounting" data-icon="clock">Contabilit&agrave;</a></li>
<li><a href="#questions" data-icon="edit">Domande &amp; Risposte</a></li>
</ul>
</div><!-- /navbar -->
</div>
 <div data-role="collapsible" id="set1" data-collapsed="true" data-collapsed-icon="carat-d" data-expanded-icon="eye">
<h2>Ricerca avanzata</h2>
<form data-act="search">
<input type="date" name="start" placeholder="Inizio">
<input type="date" name="end" value="fine" placeholder="Fine">
<input type="hidden" name="search" value="documents">
<input type="submit" data-icon="eye" value="Cerca">
</form>
<form onsubmit="location.reload();">
<input type="submit" name="clear" value="Resetta" data-icon="delete">
</form>
</div>
<ul data-role="listview" data-inset="true" data-divider-theme="a" id="documentsList" data-filter="true" data-filter-placeholder="Ricerca documenti">
</ul>
<div data-role="footer" >
<p>Lens - &copy; 2020, Mattia Mascarello </p>
<p>Contenuto rilasciato sotto licenza <a href="https://creativecommons.org/licenses/by/2.0/it/">CC BY 2.0 IT</a></p>
<a href="https://lens.stoplight.io/docs/lens/docs/Lens-Api.md">REST API</a>
<a href="https://www.innovationplaylist.eu/lens/app/public.gpg.pgpInnovationplaylist.eu.asc" target="_blank">Chiave pubblica PGP per le firme digitali</a>
<a href="https://www.innovationplaylist.eu/lens/app/api/view/all/rss" target="_blank">Feed RSS</a>
</div>
</div>
<div data-role="page" id="feedbacks">
<div data-role="header" >
<h1 style="font-family: 'Caveat', cursive;font-size:40px;">Lens</h1>
<a href="bigliettaggio/login.html" data-icon="user" class="ui-btn-right">Account personale</a>
<div data-role="navbar">
<ul>
<li><a href="#main" data-icon="calendar" >Eventi</a></li>
<li><a href="#documents"data-icon="bars">Documenti</a></li>
<li><a href="#feedbacks" class="ui-btn-active ui-state-persist"  data-icon="recycle">Feedback</a></li>
<li><a href="https://trello.com/b/pRcVr2FN/rappresentanti-di-istituto" target="_blank" data-icon="check">Progetti</a></li>
<li><a href="#accounting" data-icon="clock">Contabilit&agrave;</a></li>
<li><a href="#questions" data-icon="edit">Domande &amp; Risposte</a></li>
</ul>
</div><!-- /navbar -->
</div>
<div data-role="collapsible" id="set1" data-collapsed="true" data-collapsed-icon="carat-d" data-expanded-icon="eye">
<h2>Ricerca avanzata</h2>
<form data-act="search">
<input type="date" name="start" placeholder="Inizio">
<input type="date" name="end" value="fine" placeholder="Fine">
<input type="hidden" name="search" value="feedbacks">
<input type="submit" data-icon="eye" value="Cerca">
</form>
<form onsubmit="location.reload();">
<input type="submit" name="clear" value="Resetta" data-icon="delete">
</form>
</div>
<ul data-role="listview" data-inset="true" data-divider-theme="a" id="feedbacksList">
</ul>
<div data-role="footer" >
<p>Lens - &copy; 2020, Mattia Mascarello </p>
<p>Contenuto rilasciato sotto licenza <a href="https://creativecommons.org/licenses/by/2.0/it/">CC BY 2.0 IT</a></p>
<a href="https://lens.stoplight.io/docs/lens/docs/Lens-Api.md">REST API</a>
<a href="https://www.innovationplaylist.eu/lens/app/public.gpg.pgpInnovationplaylist.eu.asc" target="_blank">Chiave pubblica PGP per le firme digitali</a>
<a href="https://www.innovationplaylist.eu/lens/app/api/view/all/rss" target="_blank">Feed RSS</a>
</div>
</div>
<!-- <div data-role="page" id="projects">
<div data-role="header" >
<h1 style="font-family: 'Caveat', cursive;font-size:40px;">Lens</h1>
<a href="bigliettaggio/login.html" data-icon="user" class="ui-btn-right">Account personale</a>
<div data-role="navbar">
<ul>
<li><a href="#main" data-icon="calendar" >Eventi</a></li>
<li><a href="#documents"data-icon="bars">Documenti</a></li>
<li><a href="#feedbacks" data-icon="recycle">Feedback</a></li>
<li><a href="#projects" class="ui-btn-active ui-state-persist" data-icon="check">Progetti</a></li>
<li><a href="#accounting" data-icon="clock">Contabilit&agrave;</a></li>
<li><a href="#questions" data-icon="edit">Domande &amp; Risposte</a></li>
</ul>
</div> /navbar
</div>
Trello embed
https://trello.com/b/pRcVr2FN/rappresentanti-di-istituto
-->
<div data-role="page" id="accounting">
<div data-role="header" >
<h1 style="font-family: 'Caveat', cursive;font-size:40px;">Lens</h1>
<a href="bigliettaggio/login.html" data-icon="user" class="ui-btn-right">Account personale</a>
<div data-role="navbar">
<ul>
<li><a href="#main" data-icon="calendar" >Eventi</a></li>
<li><a href="#documents"data-icon="bars">Documenti</a></li>
<li><a href="#feedbacks" data-icon="recycle">Feedback</a></li>
<li><a href="https://trello.com/b/pRcVr2FN/rappresentanti-di-istituto" target="_blank" data-icon="check">Progetti</a></li>
<li><a href="#accounting" class="ui-btn-active ui-state-persist" data-icon="clock">Contabilit&agrave;</a></li>
<li><a href="#questions" data-icon="edit">Domande &amp; Risposte</a></li>
</ul>
</div><!-- /navbar -->
</div>
<div data-role="collapsible" id="set1" data-collapsed="true" data-collapsed-icon="carat-d" data-expanded-icon="eye">
<h2>Ricerca avanzata</h2>
<form data-act="search">
<input type="date" name="start" placeholder="Inizio">
<input type="date" name="end" value="fine" placeholder="Fine">
<input type="hidden" name="search" value="accounting">
<input type="submit" data-icon="eye" value="Cerca">
</form>
<form onsubmit="location.reload();">
<input type="submit" name="clear" value="Resetta" data-icon="delete">
</form>
<div data-role="footer" >
<p>Lens - &copy; 2020, Mattia Mascarello </p>
<p>Contenuto rilasciato sotto licenza <a href="https://creativecommons.org/licenses/by/2.0/it/">CC BY 2.0 IT</a></p>
<a href="https://lens.stoplight.io/docs/lens/docs/Lens-Api.md">REST API</a>
<a href="https://www.innovationplaylist.eu/lens/app/public.gpg.pgpInnovationplaylist.eu.asc" target="_blank">Chiave pubblica PGP per le firme digitali</a>
<a href="https://www.innovationplaylist.eu/lens/app/api/view/all/rss" target="_blank">Feed RSS</a>
</div>
</div>
<table data-role="table" class="ui-responsive table-stroke">
     <thead>
<tr>
<th></th>
<th>Titolo</th>
<th>Pianificato</th>
<th>Eseguito</th>
<th>Importo</th>
<th>Descrizione breve</th>
<th>Data di pubblicazione</th>
<th>Tags</th>
<th>Dettagli</th>
</tr>
</thead>
<tbody id="accountingList">
</tbody>
</table>
<div data-role="footer" >
<p>Lens - &copy; 2020, Mattia Mascarello </p>
<p>Contenuto rilasciato sotto licenza <a href="https://creativecommons.org/licenses/by/2.0/it/">CC BY 2.0 IT</a></p>
<a href="https://lens.stoplight.io/docs/lens/docs/Lens-Api.md">REST API</a>
<a href="https://www.innovationplaylist.eu/lens/app/public.gpg.pgpInnovationplaylist.eu.asc" target="_blank">Chiave pubblica PGP per le firme digitali</a>
<a href="https://www.innovationplaylist.eu/lens/app/api/view/all/rss" target="_blank">Feed RSS/<a>
</div>
</div>
<div data-role="page" id="questions">
<div data-role="header" >
<h1 style="font-family: 'Caveat', cursive;font-size:40px;">Lens</h1>
<a href="bigliettaggio/login.html" data-icon="user" class="ui-btn-right">Account personale</a>
<div data-role="navbar">
<ul>
<li><a href="#main" data-icon="calendar" >Eventi</a></li>
<li><a href="#documents"data-icon="bars">Documenti</a></li>
<li><a href="#feedbacks" data-icon="recycle">Feedback</a></li>
<li><a href="https://trello.com/b/pRcVr2FN/rappresentanti-di-istituto" target="_blank" data-icon="check">Progetti</a></li>
<li><a href="#accounting"data-icon="clock">Contabilit&agrave;</a></li>
<li><a href="#questions" class="ui-btn-active ui-state-persist" data-icon="edit">Domande &amp; Risposte</a></li>
</ul>
</div><!-- /navbar -->
</div>
<a href="dialog.html" class="ui-shadow ui-btn ui-corner-all ui-btn-inline" data-transition="pop">Invia Domanda</a>
<div data-role="collapsible" id="set1" data-collapsed="true" data-collapsed-icon="carat-d" data-expanded-icon="eye">
<h2>Ricerca avanzata</h2>
<form data-act="questions">
<input type="date" name="start" placeholder="Inizio">
<input type="date" name="end" value="fine" placeholder="Fine">
<input type="hidden" name="search" value="questions">
<input type="submit" data-icon="eye" value="Cerca">
</form>
<form onsubmit="location.reload();">
<input type="submit" name="clear" value="Resetta" data-icon="delete">
</form>
</div>
<ul data-role="listview" data-inset="true" data-divider-theme="a" id="questionsList">
</ul>
<div data-role="footer" >
<p>Lens - &copy; 2020, Mattia Mascarello </p>
<p>Contenuto rilasciato sotto licenza <a href="https://creativecommons.org/licenses/by/2.0/it/">CC BY 2.0 IT</a></p>
<a href="https://lens.stoplight.io/docs/lens/docs/Lens-Api.md">REST API</a>
<a href="https://www.innovationplaylist.eu/lens/app/public.gpg.pgpInnovationplaylist.eu.asc" target="_blank">Chiave pubblica PGP per le firme digitali</a>
<a href="https://www.innovationplaylist.eu/lens/app/api/view/all/rss" target="_blank">Feed RSS</a>
</div>
</div>
</body>
</html>

434
lib.php Normal file
View File

@ -0,0 +1,434 @@
<?php
function ITDate($UNIX){
$mesi = array(1=>'gennaio', 'Febbraio', 'Marzo', 'Aprile',
'Maggio', 'Giugno', 'Luglio', 'Agosto',
'Settembre', 'Ottobre', 'Novembre','Dicembre');
$giorni = array('Domenica','Lunedì','Martedì','Mercoledì',
'Giovedì','Venerdì','Sabato');
list($sett,$giorno,$mese,$anno) = explode('-',date('w-d-n-Y',$UNIX));
return $giorni[$sett].' '.$giorno.' '.$mesi[$mese].' '.$anno;
}
function pdomake(){
$p= new PDO("sqlite:database.db");
$p->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$p->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE,PDO::FETCH_ASSOC);
$p->setAttribute(PDO::ATTR_EMULATE_PREPARES,false);
return $p;
}
function DOCTypeDescr($type){
$type=strtolower(trim($type));
switch($type){
case "pdf":
return "Documento pdf";
case "word":
return "Documento di Microsoft Word";
case "excel":
return "Documento di Microsoft Excel";
case "ppt";
return "Documento di Microsoft Power Point";
}
return "Documento di formato sconosciuto";
}
function colorByTypeDOC($type){
$type=strtolower(trim($type));
switch($type){
case "pdf":
return "red";
case "word":
return "blue";
case "excel":
return "green";
case "ppt";
return "yellow";
}
return "gray";
}
function size($path){
if(filter_var($path, FILTER_VALIDATE_URL)){
$ch = curl_init($path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
$data = curl_exec($ch);
$size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
curl_close($ch);
return $size;
}
return @filesize($path)?:0;
}
function filename($path){
if(filter_var($path, FILTER_VALIDATE_URL)){
$ft = parse_url($path, PHP_URL_PATH);
return basename($ft);
}
return basename($path);
}
function eur($i){
return "".number_format($i, 2, ',', '\'');
}
function humanFileSize($size,$unit="") {
if( (!$unit && $size >= 1<<30) || $unit == "GB")
return number_format($size/(1<<30),2)."GB";
if( (!$unit && $size >= 1<<20) || $unit == "MB")
return number_format($size/(1<<20),2)."MB";
if( (!$unit && $size >= 1<<10) || $unit == "KB")
return number_format($size/(1<<10),2)."KB";
return number_format($size)." bytes";
}
function linkM($link,$text){
if(empty($link) || empty($text)) return "";
return '<a href="'.$link.'">'.htmlentities($text).'</a>';
}
function titlePrn($title,$val,$head="h3"){
if(empty($title) || empty($val)) return "";
return "<p><".$head.">".htmlentities($title)."</".$head."><br />".htmlentities($val)."</p>";
}
function thumbnailGen($url,$MAXheight=200,$MAXwidth=200,$alt="thumbnail"){
return '<br /><img src="'.$url.'" onclick="location.href=\''.$url.'\';" style="max-width:'.$MAXwidth.'px;max-heght:'.$MAXheight.'px;" alt="'.htmlentities($alt).'" />';
}
function cats(){
return [
"documents"=>"Documenti",
"transactions"=>"Contabilit&agrave;",
"questions"=>"Domande",
"events"=>"Eventi",
"feedbacks"=>"Feedbacks"
];
}
function buildDoc($data){
$res="";
$res.=$data["htmlDescription"];
$res.=thumbnailGen($data["thumbnailUrl"])."<br />";
$res.="<h4>".linkM($data["documentUrl"],"File")."</h4>";
if(!empty($data["signatureUrl"])) $res.="<h4>".linkM($data["signatureUrl"],"Firma digitale")."</h4>";
$res.=titlePrn("Data di pubblicazione",ITDate(strtotime($data["publishedDate"])));
$res.=titlePrn("Data di creazione",ITDate(strtotime($data["createdDate"])));
$res.=titlePrn("Data di ultima modifica",ITDate(strtotime($data["lastEditedDate"])));
foreach ($data["tags"] as $v) {
$res.='<a href="https://innovationplaylist.eu/lens/app/api/view/tags/'.urlencode($v).'/detailed/render"><span class="w3-tag w3-black">'.htmlentities($v)."</span></a>";
}
$res.='<br /><span class="w3-tag w3-'.$data["format"]["uiColor"].'">'.htmlentities($data["format"]["description"])."</span>";
if(count($data["links"]["to"]) >0){
$res.='<br /><h2>Risorse collegate:</h2>';
foreach(array_keys($data["links"]["to"]) as $category){
$res.="<div><h3>".cats()[$category]."</h3>";
foreach($data["links"]["to"][$category] as $el){
$res.='<p><a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$el["UID"].'/render">'.htmlEntities($el["title"]).'</a></p>';
}
$res.="</div>";
}
}
if(count($data["links"]["from"]) >0){
$res.='<br /><h2>Fanno riferimento a questa risorsa:</h2>';
foreach(array_keys($data["links"]["to"]) as $category){
$res.="<div><h3>".cats()[$category]."</h3>";
foreach($data["links"]["to"][$category] as $el){
$res.='<p><a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$el["UID"].'/render">'.htmlEntities($el["title"]).'</a></p>';
}
$res.="</div>";
}
}
return pageBuild($data["title"],$res);
}
function eurC($i){
if($i>0) return '<h2 style="color:green">'.eur($i).'</h2>';
if($i<0) return '<h2 style="color:red">'.eur($i).'</h2>';
return '<h2 style="color:yellow">'.eur($i).'</h2>';
}
function buildTransaction($data){
$res="";
$res.=$data["htmlDescription"];
$res.=thumbnailGen($data["thumbnailUrl"])."<br />";
$res.=titlePrn("Data di pianificazione",ITDate(strtotime($data["planned"])));
$res.=titlePrn("Data di esecuzione",ITDate(strtotime($data["executed"])));
$res.='<h3>Importo: '.eurC($data["amount"]).'</h3>';
$res.=titlePrn("Data di pubblicazione",ITDate(strtotime($data["publishedDate"])));
$res.=titlePrn("Data di creazione",ITDate(strtotime($data["createdDate"])));
$res.=titlePrn("Data di ultima modifica",ITDate(strtotime($data["lastEditedDate"])));
foreach ($data["tags"] as $v) {
$res.='<a href="https://innovationplaylist.eu/lens/app/api/view/tags/'.urlencode($v).'/detailed/render"><span class="w3-tag w3-black">'.htmlentities($v)."</span></a>";
}
$res.='<br /><span class="w3-tag w3-'.$data["format"]["uiColor"].'">'.htmlentities($data["format"]["description"])."</span>";
if(count($data["links"]["to"]) >0){
$res.='<br /><h2>Risorse collegate:</h2>';
foreach(array_keys($data["links"]["to"]) as $category){
$res.="<div><h3>".cats()[$category]."</h3>";
foreach($data["links"]["to"][$category] as $el){
$res.='<p><a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$el["UID"].'/render">'.htmlEntities($el["title"]).'</a></p>';
}
$res.="</div>";
}
}
if(count($data["links"]["from"]) >0){
$res.='<br /><h2>Fanno riferimento a questa risorsa:</h2>';
foreach(array_keys($data["links"]["to"]) as $category){
$res.="<div><h3>".cats()[$category]."</h3>";
foreach($data["links"]["to"][$category] as $el){
$res.='<p><a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$el["UID"].'/render">'.htmlEntities($el["title"]).'</a></p>';
}
$res.="</div>";
}
}
return pageBuild($data["title"],$res);
}
function buildEvents($data){
$res="";
$res.=$data["htmlDescription"];
$res.=thumbnailGen($data["thumbnailUrl"])."<br />";
$res.=titlePrn("Data di inizio",ITDate(strtotime($data["startDate"])));
$res.=titlePrn("Data di fine",ITDate(strtotime($data["endDate"])));
if($data["isAssembly"]){
$res.="<h2 style=\"color:green\">&Egrave; un&apos;assemblea</h2>";
}
$res.=titlePrn("Data di pubblicazione",ITDate(strtotime($data["publishedDate"])));
$res.=titlePrn("Data di creazione",ITDate(strtotime($data["createdDate"])));
$res.=titlePrn("Data di ultima modifica",ITDate(strtotime($data["lastEditedDate"])));
foreach ($data["tags"] as $v) {
$res.='<a href="https://innovationplaylist.eu/lens/app/api/view/tags/'.urlencode($v).'/detailed/render"><span class="w3-tag w3-black">'.htmlentities($v)."</span></a>";
}
$res.='<br /><span class="w3-tag w3-'.$data["format"]["uiColor"].'">'.htmlentities($data["format"]["description"])."</span>";
if(count($data["links"]["to"]) >0){
$res.='<br /><h2>Risorse collegate:</h2>';
foreach(array_keys($data["links"]["to"]) as $category){
$res.="<div><h3>".cats()[$category]."</h3>";
foreach($data["links"]["to"][$category] as $el){
$res.='<p><a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$el["UID"].'/render">'.htmlEntities($el["title"]).'</a></p>';
}
$res.="</div>";
}
}
if(count($data["participants"])){
$res.="<h3>Partecipanti</h3>";
}
foreach ($data["participants"] as $v) {
$res.='<span class="w3-tag w3-white">'.htmlentities($v)."</span>";
}
if(count($data["links"]["from"]) >0){
$res.='<br /><h2>Fanno riferimento a questa risorsa:</h2>';
foreach(array_keys($data["links"]["to"]) as $category){
$res.="<div><h3>".cats()[$category]."</h3>";
foreach($data["links"]["to"][$category] as $el){
$res.='<p><a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$el["UID"].'/render">'.htmlEntities($el["title"]).'</a></p>';
}
$res.="</div>";
}
}
return pageBuild($data["title"],$res);
}
function buildFeedback($data){
$res="";
$res.=$data["htmlDescription"]."<br />";
$res.=thumbnailGen($data["thumbnailUrl"])."<br />";
$res.=titlePrn("Data di inizio",ITDate(strtotime($data["startDate"])));
$res.=titlePrn("Data di fine",ITDate(strtotime($data["endDate"])));
$res.=titlePrn("Data di pubblicazione dei risultati",ITDate(strtotime($data["publishResultsDate"])));
$res.=titlePrn("Data di pubblicazione",ITDate(strtotime($data["publishedDate"])));
$res.=titlePrn("Data di creazione",ITDate(strtotime($data["createdDate"])));
$res.=titlePrn("Data di ultima modifica",ITDate(strtotime($data["lastEditedDate"])));
foreach ($data["tags"] as $v) {
$res.='<a href="https://innovationplaylist.eu/lens/app/api/view/tags/'.urlencode($v).'/detailed/render"><span class="w3-tag w3-black">'.htmlentities($v)."</span></a>";
}
$res.='<br /><span class="w3-tag w3-'.$data["format"]["uiColor"].'">'.htmlentities($data["format"]["description"])."</span>";
if(count($data["links"]["to"]) >0){
$res.='<br /><h2>Risorse collegate:</h2>';
foreach(array_keys($data["links"]["to"]) as $category){
$res.="<div><h3>".cats()[$category]."</h3>";
foreach($data["links"]["to"][$category] as $el){
$res.='<p><a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$el["UID"].'/render">'.htmlEntities($el["title"]).'</a></p>';
}
$res.="</div>";
}
}
if(count($data["links"]["from"]) >0){
$res.='<br /><h2>Fanno riferimento a questa risorsa:</h2>';
foreach(array_keys($data["links"]["to"]) as $category){
$res.="<div><h3>".cats()[$category]."</h3>";
foreach($data["links"]["to"][$category] as $el){
$res.='<p><a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$el["UID"].'/render">'.htmlEntities($el["title"]).'</a></p>';
}
$res.="</div>";
}
}
return pageBuild($data["title"],$res);
}
function buildQuestions($data){
$res="";
$res.=htmlentities($data["questionText"])."<br />";
$res.=thumbnailGen($data["thumbnailUrl"])."<br />";
$res.="<h3>".htmlentities($data["answerTitle"])."</h3>";
$res.=htmlentities($data["answerText"]);
$res.=titlePrn("Chiesta da",$data["asker"]);
$res.=titlePrn("Risposta da",$data["replier"]);
$res.=titlePrn("Data di ricezione",ITDate(strtotime($data["askDate"])));
$res.=titlePrn("Data di risposta",ITDate(strtotime($data["answerDate"])));
$res.=titlePrn("Data di pubblicazione",ITDate(strtotime($data["publishedDate"])));
foreach ($data["tags"] as $v) {
$res.='<a href="https://innovationplaylist.eu/lens/app/api/view/tags/'.urlencode($v).'/detailed/render"><span class="w3-tag w3-black">'.htmlentities($v)."</span></a>";
}
$res.='<br /><span class="w3-tag w3-'.$data["format"]["uiColor"].'">'.htmlentities($data["format"]["description"])."</span>";
if(count($data["links"]["to"]) >0){
$res.='<br /><h2>Risorse collegate:</h2>';
foreach(array_keys($data["links"]["to"]) as $category){
$res.="<div><h3>".cats()[$category]."</h3>";
foreach($data["links"]["to"][$category] as $el){
$res.='<p><a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$el["UID"].'/render">'.htmlEntities($el["title"]).'</a></p>';
}
$res.="</div>";
}
}
if(count($data["links"]["from"]) >0){
$res.='<br /><h2>Fanno riferimento a questa risorsa:</h2>';
foreach(array_keys($data["links"]["to"]) as $category){
$res.="<div><h3>".cats()[$category]."</h3>";
foreach($data["links"]["to"][$category] as $el){
$res.='<p><a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$el["UID"].'/render">'.htmlEntities($el["title"]).'</a></p>';
}
$res.="</div>";
}
}
return pageBuild($data["questionTitle"],$res);
}
function pageMake($UID,$pdo){
$data=uid($UID,$pdo);
if($data==(-1)|| empty($UID)){
return pageBuild("Errore","<h3>La risorsa richiesta non &egrave; stata trovata</h3>");
}
switch($UID[0]){
case "d":
return buildDoc($data[0]);
break;
case "t":
return buildTransaction($data[0]);
break;
case "e":
return buildEvents($data[0]);
break;
case "q":
return buildQuestions($data[0]);
break;
case "f":
return buildFeedback($data[0]);
break;
}
}
function pageBuild($title,$body){
ob_start();
?><!DOCTYPE html>
<html>
<head>
<title>Lens - <?php echo htmlentities($title)?></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, can-resize=no">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link href="https://fonts.googleapis.com/css2?family=Caveat&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment-with-locales.min.js" integrity="sha512-LGXaggshOkD/at6PFNcp2V2unf9LzFq6LE+sChH7ceMTDP0g2kn6Vxwgg7wkPP7AAtX+lmPqPdxB47A0Nz0cMQ==" crossorigin="anonymous"></script>
</head>
<body>
<div data-role="page" id="main">
<div data-role="header" data-position="fixed">
<h1 style="font-family: 'Caveat', cursive;font-size:40px;">Lens</h1>
<a href="https://innovationplaylist.eu/lens/app" data-icon="home" class="ui-btn-right"></a>
</div>
<h1><?php echo htmlentities($title)?></h1>
<?php
echo $body;
?>
<br />
<a href="https://innovationplaylist.eu/lens/app" >Home</a>
</div>
</body>
</html>
<?php
return ob_get_contents();
}
function renderTag($data,$tag){
$lk=[
"documents"=>"Documenti",
"transactions"=>"Contabilit&agrave;",
"questions"=>"Domande",
"events"=>"Eventi",
"feedbacks"=>"Feedbacks"
];
$res="";
$res.="<h3>Utilizzo</h3>";
$res.="<h2>Per risorsa</h2>";
foreach(array_keys($data["usage"]["categories"]) as $k ){
$res.="<h4>".htmlentities($lk[$k])."</h4>";
$i=0;
foreach($data["usage"]["categories"][$k] as $r){
if(!$r["title"]) continue;
$res.='<a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$r["UID"].'">'.htmlentities($r["title"]).'</a>';
$i++;
}
if($i==0) $res.="<i>Dati mancanti</i>";
}
$res.="<hr /><br /><h2>Per periodo di utilizzo</h2>";
foreach(array_keys($data["usage"]["timePoints"]) as $k ){
$i=0;
$res.="<h4>".htmlentities(ITDate(strtotime($k)))."</h4>";
foreach($data["usage"]["timePoints"][$k] as $r){
if(!$r["title"]) continue;
$res.='<a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$r["UID"].'">'.htmlentities($r["title"]).'</a>';
$i++;
}
if($i==0) $res.="<i>Dati mancanti</i>";
}
return pageBuild("Tag: ".$tag,$res);
}

537
main.es6.js Normal file
View File

@ -0,0 +1,537 @@
function htmlEntities(str) {
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
class NodeLinks{
constructor(elLinks){
// is APIobj["links"]
this.elLinks=elLinks;
this.lookup={
"documents":"Documenti",
"transactions":"Contabilit&agrave;",
"questions":"Domande",
"events":"Eventi",
"feedbacks":"Feedbacks"
}
}
computeHTML(){
if(!this.elLinks) return "";
this.html='<div class="linkList">'
var flag=false,list=[];
var dict=null;
if(Object.keys(this.elLinks).includes("to")) dict=this.elLinks["to"];
if(dict!=null){
var ks=Object.keys(dict);
if(ks.length>0&&!flag){
this.html+='<span>Risorse collegate:</span><div data-role="collapsibleset" data-theme="a" data-content-theme="a">';
flag=true;
}
ks.forEach(category => {
list=dict[category];
this.html+="<div data-role=\"collapsible\"><h3>"+this.lookup[category]+"</h3>";
list.forEach(obj => {
this.html+='<p><button type="button" onclick="location.href=\'api/view/UID/'+obj["UID"]+'/render\';">'+htmlEntities(obj["title"])+'</button></p>';
});
this.html+="</div>";
});
if(ks.length>0&&!flag){
this.html+="</div>";
}
}
flag=false;
dict=this.elLinks["from"]
if(dict!=null){
ks=Object.keys(dict);
if(ks.length>0&&!flag){
this.html+='<span>Fanno riferimento a questa risorsa:</span><div data-role="collapsibleset" data-theme="a" data-content-theme="a">';
flag=true;
}
ks.forEach(category => {
list=dict[category];
this.html+="<div data-role=\"collapsible\"><h3>"+this.lookup[category]+"</h3>";
list.forEach(obj => {
this.html+='<p><button type="button" onclick="location.href=\'api/view/UID/'+obj["UID"]+'/render\';">'+htmlEntities(obj["title"])+'</a></p>';
});
this.html+="</div>";
});
if(ks.length>0&&!flag){
this.html+="</div>";
}
}
this.html+="</div>";
return this.html;
}
}
class Tags{
constructor(tags){
this.tags=tags;
}
computeHTML(){
if(this.tags!=null&&this.tags.length>0){
this.html+="<div data-role=\"collapsible\"><h3>Tag</h3>";
this.tags.forEach(element => {
this.html+='<p><a href="api/view/tags/'+encodeURI(element)+'/render">'+htmlEntities(element)+'</a></p>';
});
}
}
}
function eurSet(eur) {
}
class ElementPreviewList{
constructor(){
this.k2it={
"planned": "Previsto il",
"executed": "Effettuato il",
"amount": "Importo",
"title": "Titolo",
"shortDescription": "Descrizione breve",
"htmlDescription": "Testo in html",
"createdDate": "Data di creazione",
"publishedDate": "Data di pubblicazione",
"lastEditedDate": "Data di ultima modifica",
"thumbnailUrl": "Url anteprima",
"documentUrl": "Url documento",
"startDate": "Data inizio",
"endDate": "Data fine",
"participants": "Partecipanti",
"isAssembly": "Tipo",
"publishResultsDate": "Data pubblicazione dei risultati",
"questionTitle": "Titolo domanda",
"questionText": "Domanda",
"answerTitle": "Titolo risposta",
"answerText": "Risposta",
"askDate": "Data richiesta",
"answerDate": "Data risposta",
"asker": "Richiedente",
"replier": "Rispondente"
};
}
itLookup(key){
return this.k2it[key]?this.k2it[key]:key;
}
itLookupPairDict(dict,key){
return {
"value":dict[key]?dict[key]:"",
"name":this.itLookup(key)
};
}
textGen(title,value){
if(value && title){
return "<span><h3>"+htmlEntities(title)+"</h3><br/><p>"+htmlEntities(value)+"</p></span>";
}
return "";
}
listgen(title,values=[],colors=[],uids=[]){
var html="";
if(title && values.length>0){
html+="<h3>"+htmlEntities(title)+"</h3><br />";
for (let i = 0; i < values.length; i++) {
if(!values[i]) continue;
var color=colors[i]? colors[i]: (colors[0] ? colors[0] : "white");
var a="<span>";
if(uids[i]) a='<span style="text-decoration: underline;" onclick="location.href=\'api/view/UID/'+uids[i]+'\';">';
html+=a+'<span class="w3-tag w3-'+color+'">'+htmlEntities(values[i])+'</span></span>';
}
return html;
}
}
conditonalTextGen(title,bool,yes,no=""){
return this.textGen(title,bool?yes:no);
}
boolGen(title,value){
var res= value?"S&igrave;":"No";
var color= value?"green":"red";
return this.listgen(title,[res],[color],[]);
}
thumbnailGen(url,MAXheight=200,MAXwidth=200,alt="thumbnail"){
return '<img src="'+url+'" onclick="location.href=\''+url+'\';" style="max-width:'+MAXwidth+'px;max-heght:'+MAXheight+'px;" alt="'+htmlEntities(alt)+'" />';
}
tagsgen(title,values=[],colors=[]){
var html="";
if(title && values.length>0){
html+="<h3>"+htmlEntities(title)+"</h3><br />";
for (let i = 0; i < values.length; i++) {
if(!values[i]) continue;
var color=colors[i]? colors[i]: (colors[0] ? colors[0] : "black");
var a='<span style="text-decoration: underline;" onclick="location.href=\'api/view/tags/'+values[i]+'/detailed/render\';">';
html+=a+'<span class="w3-tag w3-'+color+'">'+htmlEntities(values[i])+'</span></span>';
}
return html;
}
}
generateLi(type,array){
var tLihtml="",t;
switch (type) {
case "document":
array.forEach(element => {
tLihtml+='<li>\n<a href="api/view/UID/'+element["UID"]+'/render">';
tLihtml+="<h1 style=\"font-size:30px;\">"+htmlEntities(element["title"])+"</h1>";
tLihtml+="<br /><hr />";
tLihtml+="<span> "+this.thumbnailGen(element["thumbnailUrl"],200,200,element["title"])+"</span>";
tLihtml+="<br /><hr />";
tLihtml+="<h4>"+htmlEntities(element["shortDescription"])+"</h4>";
tLihtml+="<br /><hr />";
tLihtml+= "<span>"+this.listgen("Formato",[ element["format"]["type"],element["format"]["description"] ],[element["format"]["uiColor"]] )+"</span>";
tLihtml+="<br /><hr />";
t=this.itLookupPairDict(element,"publishedDate");
tLihtml+="<span> "+this.textGen(t["name"],(new TimeFormatter(t["value"])).compute("LLLL") )+"</span>";
tLihtml+="<br /><hr />";
tLihtml+= "<span>"+this.tagsgen("Tag",element["tags"])+"</span>";
tLihtml+="<br /><hr />";
var nl=new NodeLinks(element["links"]);
tLihtml+= nl.computeHTML();
tLihtml+='</a></li>';
});
break;
case "event":
array.forEach(element => {
tLihtml+='<li>\n<a href="api/view/UID/'+element["UID"]+'/render">';
tLihtml+="<h1 style=\"font-size:30px;\">"+htmlEntities(element["title"])+"</h1>";
tLihtml+="<br /><hr />";
tLihtml+="<span> "+this.thumbnailGen(element["thumbnailUrl"],200,200,element["title"])+"</span>";
tLihtml+="<br /><hr />";
tLihtml+="<h4>"+htmlEntities(element["shortDescription"])+"</h4>";
tLihtml+="<br /><hr />";
tLihtml+= this.conditonalTextGen(" ",element["isAssembly"],"È un assemblea");
tLihtml+="<br /><hr />";
t=this.itLookupPairDict(element,"startDate");
tLihtml+="<span> "+this.textGen(t["name"],(new TimeFormatter(t["value"])).compute("LLLL") )+"</span>";
tLihtml+="<br /><hr />";
t=this.itLookupPairDict(element,"endDate");
tLihtml+="<span> "+this.textGen(t["name"],(new TimeFormatter(t["value"])).compute("LLLL") )+"</span>";
tLihtml+="<br /><hr />";
tLihtml+= "<span> "+this.listgen("Partecipanti",element["participants"])+"</span>";
tLihtml+="<br /><hr />";
t=this.itLookupPairDict(element,"publishedDate");
tLihtml+="<span> "+this.textGen(t["name"],(new TimeFormatter(t["value"])).compute("LLLL") )+"</span>";
tLihtml+="<br /><hr />";
tLihtml+= "<span> "+this.tagsgen("Tag",element["tags"])+"</span>";
tLihtml+="<br /><hr />";
var nl=new NodeLinks(element["links"]);
tLihtml+= nl.computeHTML();
tLihtml+='</a></li>';
});
break;
case "feedback":
array.forEach(element => {
tLihtml+='<li>\n<a href="api/view/UID/'+element["UID"]+'/render">';
tLihtml+="<h1 style=\"font-size:30px;\">"+htmlEntities(element["title"])+"</h1>";
tLihtml+="<br /><hr />";
tLihtml+="<br /><hr />";
tLihtml+="<span> "+this.thumbnailGen(element["thumbnailUrl"],200,200,element["title"])+"</span>";
tLihtml+="<br /><hr />";
tLihtml+="<h4>"+htmlEntities(element["shortDescription"])+"</h4>";
tLihtml+="<br /><hr />";
tLihtml+="<br /><hr />";
t=this.itLookupPairDict(element,"startDate");
tLihtml+="<span> "+this.textGen(t["name"],(new TimeFormatter(t["value"])).compute("LLLL") )+"</span>";
tLihtml+="<br /><hr />";
t=this.itLookupPairDict(element,"endDate");
tLihtml+="<span> "+this.textGen(t["name"],(new TimeFormatter(t["value"])).compute("LLLL") )+"</span>";
tLihtml+="<br /><hr />";
t=this.itLookupPairDict(element,"publishResultsDate");
tLihtml+="<span> "+this.textGen(t["name"],(new TimeFormatter(t["value"])).compute("LLLL") )+"</span>";
tLihtml+="<br /><hr />";
this.itLookupPairDict(element,"publishedDate")
tLihtml+="<span> "+this.textGen(t["name"],(new TimeFormatter(t["value"])).compute("LLLL") )+"</span>";
tLihtml+="<br /><hr />";
tLihtml+= "<span> "+this.tagsgen("Tag",element["tags"])+"</span>";
var nl=new NodeLinks(element["links"]);
tLihtml+= nl.computeHTML();
tLihtml+='</a></li>';
});
break;
case "question":
array.forEach(element => {
tLihtml+='<li>\n<a href="api/view/UID/'+element["UID"]+'/render">';
tLihtml+="<h1 style=\"font-size:30px;\">"+htmlEntities(element["questionTitle"])+"</h1>";
tLihtml+="<br /><hr />";
tLihtml+="<br /><hr />";
tLihtml+="<span> "+this.thumbnailGen(element["thumbnailUrl"],200,200,element["title"])+"</span>";
tLihtml+="<br /><hr />";
t=this.itLookupPairDict(element,"publishedDate")
tLihtml+="<span> "+this.textGen(t["name"],(new TimeFormatter(t["value"])).compute("LLLL") )+"</span>";
tLihtml+="<br /><hr />";
tLihtml+= "<span> "+this.tagsgen("Tag",element["tags"])+"</span>";
var nl=new NodeLinks(element["links"]);
tLihtml+= nl.computeHTML();
tLihtml+='</a></li>';
});
break;
case "transaction":
array.forEach(element => {
tLihtml+='<tr>';
tLihtml+="<td> "+this.thumbnailGen(element["thumbnailUrl"],200,200,element["title"])+"</td>";
t=this.itLookupPairDict(element,"title");
tLihtml+="<td> "+this.textGen(" ",t["value"])+"</td>";
t=this.itLookupPairDict(element,"planned")
tLihtml+="<td> "+this.textGen(" ",(new TimeFormatter(t["value"])).compute("LLLL") )+"</td>";
t=this.itLookupPairDict(element,"executed")
tLihtml+="<td> "+this.textGen(" ",(new TimeFormatter(t["value"])).compute("LLLL") )+"</td>";
tLihtml+="<td>"+eurS(element["amount"])+"</td>";
tLihtml+="<td> "+this.textGen(" ",t["value"])+"</td>";
t=this.itLookupPairDict(element,"shortDescription");
tLihtml+="<td> "+this.textGen(" ",t["value"])+"</td>";
t=this.itLookupPairDict(element,"publishedDate")
tLihtml+="<td> "+this.textGen(" ",(new TimeFormatter(t["value"])).compute("LLLL") )+"</td>";
tLihtml+= "<td> "+this.tagsgen(" ",element["tags"])+"</td>";
tLihtml+= '<td><a href="api/view/UID/'+element["UID"]+'/render">link</a></td>';
tLihtml+"<td></td>";
/*var nl=new NodeLinks(element["links"]);
tLihtml+= nl.computeHTML();*/
tLihtml+='</tr>';
});
break;
}
return tLihtml;
}
}
class TimeFormatter{
constructor(timeString=null){
if(timeString) this.m=moment(timeString);
else this.m=moment();
if(this.m.locale()!="it") this.m.locale("it",null);
}
compute(format){
return this.m.format(format);
}
}
class APIfetch{
constructor(epl){
this.epl=epl;
}
fetchDocs(start=false,end=false){
$.post("api/view/documents/all/",{"start":start,"end":end}, function(data){
this.renderDocs(data);
}.bind(this),"json");
}
fetchEvents(start=false,end=false){
$.post("api/view/events/all/",{"start":start,"end":end}, function(data){
this.renderEvents(data);
}.bind(this),"json");
}
fetchFeedbacks(start=false,end=false){
$.post("api/view/feedbacks/all/",{"start":start,"end":end}, function(data){
this.renderFeedbacks(data);
}.bind(this),"json");
}
fetchQuestions(start=false,end=false){
$.post("api/view/questions/all/",{"start":start,"end":end}, function(data){
this.renderQuestions(data);
}.bind(this),"json");
}
fetchTransactions(start=false,end=false){
$.post("api/view/transactions/all/",{"start":start,"end":end}, function(data){
this.renderTransactions(data);
}.bind(this),"json");
}
renderTransactions(data){
var a= (new ElementPreviewList()).generateLi("transaction",data["data"]);
console.log(a);
$("#accountingList").html(a);
$("#accountingList").enhanceWithin();
$("#accountingList").listview('refresh');
}
renderFeedbacks(data){
var a= (new ElementPreviewList()).generateLi("feedback",data["data"]);
$("#feedbacksList").html(a);
$("#feedbacksList").enhanceWithin();
$("#feedbacksList").listview('refresh');
}
renderQuestions(data){
var a= (new ElementPreviewList()).generateLi("question",data["data"]);
$("#questionsList").html(a);
$("#questionsList").enhanceWithin();
$("#questionsList").listview('refresh');
}
renderDocs(data){
var a= (new ElementPreviewList()).generateLi("document",data["data"]);
$("#documentsList").html(a);
$("#documentsList").enhanceWithin();
$("#documentsList").listview('refresh');
}
renderEvents(data){
var a= (new ElementPreviewList()).generateLi("event",data["data"]);
$("#eventsList").html(a);
$("#eventsList").enhanceWithin();
$("#eventsList").listview('refresh');
}
}
function eurS(val){
if(val==0) return "<h2 style=\"color:yellow\">&euro;"+formatMoney(val,2,",","'")+"</h2>";
if(val<0) return "<h2 style=\"color:red\">&euro;"+formatMoney(val,2,",","'")+"</h2>";
return "<h2 style=\"color:green\">&euro;"+formatMoney(val,2,",","'")+"</h2>";
}
function formatMoney(number, decPlaces, decSep, thouSep) {
decPlaces = isNaN(decPlaces = Math.abs(decPlaces)) ? 2 : decPlaces,
decSep = typeof decSep === "undefined" ? "." : decSep;
thouSep = typeof thouSep === "undefined" ? "," : thouSep;
var sign = number < 0 ? "-" : "";
var i = String(parseInt(number = Math.abs(Number(number) || 0).toFixed(decPlaces)));
var j = (j = i.length) > 3 ? j % 3 : 0;
return sign +
(j ? i.substr(0, j) + thouSep : "") +
i.substr(j).replace(/(\decSep{3})(?=\decSep)/g, "$1" + thouSep) +
(decPlaces ? decSep + Math.abs(number - i).toFixed(decPlaces).slice(2) : "");
}
function searchE(listArr,key){
for (let i = 0; i < listArr.length; i++) {
var e = listArr[i];
if(e["name"]==key) return e["value"];
}
}
var epl= new ElementPreviewList();
var api= new APIfetch(epl);
api.fetchDocs();
api.fetchEvents();
api.fetchFeedbacks();
api.fetchQuestions();
api.fetchTransactions();
var start,end;
$(document).delegate("form[data-act=search]","submit",function(){
var data=$(this).serializeArray();
start=searchE(data,"start")? searchE(data,"start"):"false";
end=searchE(data,"end")? searchE(data,"start") :"false";
switch(searchE(data,"search")){
case "events":
api.fetchEvents(start,end);
break;
case "documents":
api.fetchDocs(start,end);
break;
case "feedbacks":
api.fetchFeedbacks(start,end);
break;
case "questions":
api.fetchQuestions(start,end);
break;
case "transactions":
api.fetchTransactions(start,end);
break;
}
return false;
});
function onKonamiCode(cb) {
var input = '';
var key = '38384040373937396665';
document.addEventListener('keydown', function (e) {
input += ("" + e.keyCode);
if (input === key) {
return cb();
}
if (!key.indexOf(input)) return;
input = ("" + e.keyCode);
});
}
onKonamiCode(function () { window.open('https://www.youtube.com/watch?v=9YG9INjO91Y', '_blank'); });

983
main.js Normal file
View File

@ -0,0 +1,983 @@
function _instanceof(left, right) {
if (
right != null &&
typeof Symbol !== "undefined" &&
right[Symbol.hasInstance]
) {
return !!right[Symbol.hasInstance](left);
} else {
return left instanceof right;
}
}
function _classCallCheck(instance, Constructor) {
if (!_instanceof(instance, Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function htmlEntities(str) {
return String(str)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");
}
var NodeLinks = /*#__PURE__*/ (function () {
"use strict";
function NodeLinks(elLinks) {
_classCallCheck(this, NodeLinks);
// is APIobj["links"]
this.elLinks = elLinks;
this.lookup = {
documents: "Documenti",
transactions: "Contabilit&agrave;",
questions: "Domande",
events: "Eventi",
feedbacks: "Feedbacks"
};
}
_createClass(NodeLinks, [
{
key: "computeHTML",
value: function computeHTML() {
var _this = this;
if (!this.elLinks) return "";
this.html = '<div class="linkList">';
var flag = false,
list = [];
var dict = null;
if (Object.keys(this.elLinks).includes("to")) dict = this.elLinks["to"];
if (dict != null) {
var ks = Object.keys(dict);
if (ks.length > 0 && !flag) {
this.html +=
'<span>Risorse collegate:</span><div data-role="collapsibleset" data-theme="a" data-content-theme="a">';
flag = true;
}
ks.forEach(function (category) {
list = dict[category];
_this.html +=
'<div data-role="collapsible"><h3>' +
_this.lookup[category] +
"</h3>";
list.forEach(function (obj) {
_this.html +=
'<p><button type="button" onclick="location.href=\'api/view/UID/' +
obj["UID"] +
"/render';\">" +
htmlEntities(obj["title"]) +
"</button></p>";
});
_this.html += "</div>";
});
if (ks.length > 0 && !flag) {
this.html += "</div>";
}
}
flag = false;
dict = this.elLinks["from"];
if (dict != null) {
ks = Object.keys(dict);
if (ks.length > 0 && !flag) {
this.html +=
'<span>Fanno riferimento a questa risorsa:</span><div data-role="collapsibleset" data-theme="a" data-content-theme="a">';
flag = true;
}
ks.forEach(function (category) {
list = dict[category];
_this.html +=
'<div data-role="collapsible"><h3>' +
_this.lookup[category] +
"</h3>";
list.forEach(function (obj) {
_this.html +=
'<p><button type="button" onclick="location.href=\'api/view/UID/' +
obj["UID"] +
"/render';\">" +
htmlEntities(obj["title"]) +
"</a></p>";
});
_this.html += "</div>";
});
if (ks.length > 0 && !flag) {
this.html += "</div>";
}
}
this.html += "</div>";
return this.html;
}
}
]);
return NodeLinks;
})();
var Tags = /*#__PURE__*/ (function () {
"use strict";
function Tags(tags) {
_classCallCheck(this, Tags);
this.tags = tags;
}
_createClass(Tags, [
{
key: "computeHTML",
value: function computeHTML() {
var _this2 = this;
if (this.tags != null && this.tags.length > 0) {
this.html += '<div data-role="collapsible"><h3>Tag</h3>';
this.tags.forEach(function (element) {
_this2.html +=
'<p><a href="api/view/tags/' +
encodeURI(element) +
'/render">' +
htmlEntities(element) +
"</a></p>";
});
}
}
}
]);
return Tags;
})();
function eurSet(eur) {}
var ElementPreviewList = /*#__PURE__*/ (function () {
"use strict";
function ElementPreviewList() {
_classCallCheck(this, ElementPreviewList);
this.k2it = {
planned: "Previsto il",
executed: "Effettuato il",
amount: "Importo",
title: "Titolo",
shortDescription: "Descrizione breve",
htmlDescription: "Testo in html",
createdDate: "Data di creazione",
publishedDate: "Data di pubblicazione",
lastEditedDate: "Data di ultima modifica",
thumbnailUrl: "Url anteprima",
documentUrl: "Url documento",
startDate: "Data inizio",
endDate: "Data fine",
participants: "Partecipanti",
isAssembly: "Tipo",
publishResultsDate: "Data pubblicazione dei risultati",
questionTitle: "Titolo domanda",
questionText: "Domanda",
answerTitle: "Titolo risposta",
answerText: "Risposta",
askDate: "Data richiesta",
answerDate: "Data risposta",
asker: "Richiedente",
replier: "Rispondente"
};
}
_createClass(ElementPreviewList, [
{
key: "itLookup",
value: function itLookup(key) {
return this.k2it[key] ? this.k2it[key] : key;
}
},
{
key: "itLookupPairDict",
value: function itLookupPairDict(dict, key) {
return {
value: dict[key] ? dict[key] : "",
name: this.itLookup(key)
};
}
},
{
key: "textGen",
value: function textGen(title, value) {
if (value && title) {
return (
"<span><h3>" +
htmlEntities(title) +
"</h3><br/><p>" +
htmlEntities(value) +
"</p></span>"
);
}
return "";
}
},
{
key: "listgen",
value: function listgen(title) {
var values =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: [];
var colors =
arguments.length > 2 && arguments[2] !== undefined
? arguments[2]
: [];
var uids =
arguments.length > 3 && arguments[3] !== undefined
? arguments[3]
: [];
var html = "";
if (title && values.length > 0) {
html += "<h3>" + htmlEntities(title) + "</h3><br />";
for (var i = 0; i < values.length; i++) {
if (!values[i]) continue;
var color = colors[i] ? colors[i] : colors[0] ? colors[0] : "white";
var a = "<span>";
if (uids[i])
a =
'<span style="text-decoration: underline;" onclick="location.href=\'api/view/UID/' +
uids[i] +
"';\">";
html +=
a +
'<span class="w3-tag w3-' +
color +
'">' +
htmlEntities(values[i]) +
"</span></span>";
}
return html;
}
}
},
{
key: "conditonalTextGen",
value: function conditonalTextGen(title, bool, yes) {
var no =
arguments.length > 3 && arguments[3] !== undefined
? arguments[3]
: "";
return this.textGen(title, bool ? yes : no);
}
},
{
key: "boolGen",
value: function boolGen(title, value) {
var res = value ? "S&igrave;" : "No";
var color = value ? "green" : "red";
return this.listgen(title, [res], [color], []);
}
},
{
key: "thumbnailGen",
value: function thumbnailGen(url) {
var MAXheight =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: 200;
var MAXwidth =
arguments.length > 2 && arguments[2] !== undefined
? arguments[2]
: 200;
var alt =
arguments.length > 3 && arguments[3] !== undefined
? arguments[3]
: "thumbnail";
return (
'<img src="' +
url +
'" onclick="location.href=\'' +
url +
'\';" style="max-width:' +
MAXwidth +
"px;max-heght:" +
MAXheight +
'px;" alt="' +
htmlEntities(alt) +
'" />'
);
}
},
{
key: "tagsgen",
value: function tagsgen(title) {
var values =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: [];
var colors =
arguments.length > 2 && arguments[2] !== undefined
? arguments[2]
: [];
var html = "";
if (title && values.length > 0) {
html += "<h3>" + htmlEntities(title) + "</h3><br />";
for (var i = 0; i < values.length; i++) {
if (!values[i]) continue;
var color = colors[i] ? colors[i] : colors[0] ? colors[0] : "black";
var a =
'<span style="text-decoration: underline;" onclick="location.href=\'api/view/tags/' +
values[i] +
"/detailed/render';\">";
html +=
a +
'<span class="w3-tag w3-' +
color +
'">' +
htmlEntities(values[i]) +
"</span></span>";
}
return html;
}
}
},
{
key: "generateLi",
value: function generateLi(type, array) {
var _this3 = this;
var tLihtml = "",
t;
switch (type) {
case "document":
array.forEach(function (element) {
tLihtml +=
'<li>\n<a href="api/view/UID/' + element["UID"] + '/render">';
tLihtml +=
'<h1 style="font-size:30px;">' +
htmlEntities(element["title"]) +
"</h1>";
tLihtml += "<br /><hr />";
tLihtml +=
"<span> " +
_this3.thumbnailGen(
element["thumbnailUrl"],
200,
200,
element["title"]
) +
"</span>";
tLihtml += "<br /><hr />";
tLihtml +=
"<h4>" + htmlEntities(element["shortDescription"]) + "</h4>";
tLihtml += "<br /><hr />";
tLihtml +=
"<span>" +
_this3.listgen(
"Formato",
[element["format"]["type"], element["format"]["description"]],
[element["format"]["uiColor"]]
) +
"</span>";
tLihtml += "<br /><hr />";
t = _this3.itLookupPairDict(element, "publishedDate");
tLihtml +=
"<span> " +
_this3.textGen(
t["name"],
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</span>";
tLihtml += "<br /><hr />";
tLihtml +=
"<span>" + _this3.tagsgen("Tag", element["tags"]) + "</span>";
tLihtml += "<br /><hr />";
var nl = new NodeLinks(element["links"]);
tLihtml += nl.computeHTML();
tLihtml += "</a></li>";
});
break;
case "event":
array.forEach(function (element) {
tLihtml +=
'<li>\n<a href="api/view/UID/' + element["UID"] + '/render">';
tLihtml +=
'<h1 style="font-size:30px;">' +
htmlEntities(element["title"]) +
"</h1>";
tLihtml += "<br /><hr />";
tLihtml +=
"<span> " +
_this3.thumbnailGen(
element["thumbnailUrl"],
200,
200,
element["title"]
) +
"</span>";
tLihtml += "<br /><hr />";
tLihtml +=
"<h4>" + htmlEntities(element["shortDescription"]) + "</h4>";
tLihtml += "<br /><hr />";
tLihtml += _this3.conditonalTextGen(
" ",
element["isAssembly"],
"È un assemblea"
);
tLihtml += "<br /><hr />";
t = _this3.itLookupPairDict(element, "startDate");
tLihtml +=
"<span> " +
_this3.textGen(
t["name"],
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</span>";
tLihtml += "<br /><hr />";
t = _this3.itLookupPairDict(element, "endDate");
tLihtml +=
"<span> " +
_this3.textGen(
t["name"],
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</span>";
tLihtml += "<br /><hr />";
tLihtml +=
"<span> " +
_this3.listgen("Partecipanti", element["participants"]) +
"</span>";
tLihtml += "<br /><hr />";
t = _this3.itLookupPairDict(element, "publishedDate");
tLihtml +=
"<span> " +
_this3.textGen(
t["name"],
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</span>";
tLihtml += "<br /><hr />";
tLihtml +=
"<span> " + _this3.tagsgen("Tag", element["tags"]) + "</span>";
tLihtml += "<br /><hr />";
var nl = new NodeLinks(element["links"]);
tLihtml += nl.computeHTML();
tLihtml += "</a></li>";
});
break;
case "feedback":
array.forEach(function (element) {
tLihtml +=
'<li>\n<a href="api/view/UID/' + element["UID"] + '/render">';
tLihtml +=
'<h1 style="font-size:30px;">' +
htmlEntities(element["title"]) +
"</h1>";
tLihtml += "<br /><hr />";
tLihtml += "<br /><hr />";
tLihtml +=
"<span> " +
_this3.thumbnailGen(
element["thumbnailUrl"],
200,
200,
element["title"]
) +
"</span>";
tLihtml += "<br /><hr />";
tLihtml +=
"<h4>" + htmlEntities(element["shortDescription"]) + "</h4>";
tLihtml += "<br /><hr />";
tLihtml += "<br /><hr />";
t = _this3.itLookupPairDict(element, "startDate");
tLihtml +=
"<span> " +
_this3.textGen(
t["name"],
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</span>";
tLihtml += "<br /><hr />";
t = _this3.itLookupPairDict(element, "endDate");
tLihtml +=
"<span> " +
_this3.textGen(
t["name"],
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</span>";
tLihtml += "<br /><hr />";
t = _this3.itLookupPairDict(element, "publishResultsDate");
tLihtml +=
"<span> " +
_this3.textGen(
t["name"],
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</span>";
tLihtml += "<br /><hr />";
_this3.itLookupPairDict(element, "publishedDate");
tLihtml +=
"<span> " +
_this3.textGen(
t["name"],
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</span>";
tLihtml += "<br /><hr />";
tLihtml +=
"<span> " + _this3.tagsgen("Tag", element["tags"]) + "</span>";
var nl = new NodeLinks(element["links"]);
tLihtml += nl.computeHTML();
tLihtml += "</a></li>";
});
break;
case "question":
array.forEach(function (element) {
tLihtml +=
'<li>\n<a href="api/view/UID/' + element["UID"] + '/render">';
tLihtml +=
'<h1 style="font-size:30px;">' +
htmlEntities(element["questionTitle"]) +
"</h1>";
tLihtml += "<br /><hr />";
tLihtml += "<br /><hr />";
tLihtml +=
"<span> " +
_this3.thumbnailGen(
element["thumbnailUrl"],
200,
200,
element["title"]
) +
"</span>";
tLihtml += "<br /><hr />";
t = _this3.itLookupPairDict(element, "publishedDate");
tLihtml +=
"<span> " +
_this3.textGen(
t["name"],
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</span>";
tLihtml += "<br /><hr />";
tLihtml +=
"<span> " + _this3.tagsgen("Tag", element["tags"]) + "</span>";
var nl = new NodeLinks(element["links"]);
tLihtml += nl.computeHTML();
tLihtml += "</a></li>";
});
break;
case "transaction":
array.forEach(function (element) {
tLihtml += "<tr>";
tLihtml +=
"<td> " +
_this3.thumbnailGen(
element["thumbnailUrl"],
200,
200,
element["title"]
) +
"</td>";
t = _this3.itLookupPairDict(element, "title");
tLihtml += "<td> " + _this3.textGen(" ", t["value"]) + "</td>";
t = _this3.itLookupPairDict(element, "planned");
tLihtml +=
"<td> " +
_this3.textGen(
" ",
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</td>";
t = _this3.itLookupPairDict(element, "executed");
tLihtml +=
"<td> " +
_this3.textGen(
" ",
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</td>";
tLihtml += "<td>" + eurS(element["amount"]) + "</td>";
tLihtml += "<td> " + _this3.textGen(" ", t["value"]) + "</td>";
t = _this3.itLookupPairDict(element, "shortDescription");
tLihtml += "<td> " + _this3.textGen(" ", t["value"]) + "</td>";
t = _this3.itLookupPairDict(element, "publishedDate");
tLihtml +=
"<td> " +
_this3.textGen(
" ",
new TimeFormatter(t["value"]).compute("LLLL")
) +
"</td>";
tLihtml +=
"<td> " + _this3.tagsgen(" ", element["tags"]) + "</td>";
tLihtml +=
'<td><a href="api/view/UID/' +
element["UID"] +
'/render">link</a></td>';
tLihtml + "<td></td>";
/*var nl=new NodeLinks(element["links"]);
tLihtml+= nl.computeHTML();*/
tLihtml += "</tr>";
});
break;
}
return tLihtml;
}
}
]);
return ElementPreviewList;
})();
var TimeFormatter = /*#__PURE__*/ (function () {
"use strict";
function TimeFormatter() {
var timeString =
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
_classCallCheck(this, TimeFormatter);
if (timeString) this.m = moment(timeString);
else this.m = moment();
if (this.m.locale() != "it") this.m.locale("it", null);
}
_createClass(TimeFormatter, [
{
key: "compute",
value: function compute(format) {
return this.m.format(format);
}
}
]);
return TimeFormatter;
})();
var APIfetch = /*#__PURE__*/ (function () {
"use strict";
function APIfetch(epl) {
_classCallCheck(this, APIfetch);
this.epl = epl;
}
_createClass(APIfetch, [
{
key: "fetchDocs",
value: function fetchDocs() {
var start =
arguments.length > 0 && arguments[0] !== undefined
? arguments[0]
: false;
var end =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: false;
$.post(
"api/view/documents/all/",
{
start: start,
end: end
},
function (data) {
this.renderDocs(data);
}.bind(this),
"json"
);
}
},
{
key: "fetchEvents",
value: function fetchEvents() {
var start =
arguments.length > 0 && arguments[0] !== undefined
? arguments[0]
: false;
var end =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: false;
$.post(
"api/view/events/all/",
{
start: start,
end: end
},
function (data) {
this.renderEvents(data);
}.bind(this),
"json"
);
}
},
{
key: "fetchFeedbacks",
value: function fetchFeedbacks() {
var start =
arguments.length > 0 && arguments[0] !== undefined
? arguments[0]
: false;
var end =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: false;
$.post(
"api/view/feedbacks/all/",
{
start: start,
end: end
},
function (data) {
this.renderFeedbacks(data);
}.bind(this),
"json"
);
}
},
{
key: "fetchQuestions",
value: function fetchQuestions() {
var start =
arguments.length > 0 && arguments[0] !== undefined
? arguments[0]
: false;
var end =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: false;
$.post(
"api/view/questions/all/",
{
start: start,
end: end
},
function (data) {
this.renderQuestions(data);
}.bind(this),
"json"
);
}
},
{
key: "fetchTransactions",
value: function fetchTransactions() {
var start =
arguments.length > 0 && arguments[0] !== undefined
? arguments[0]
: false;
var end =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: false;
$.post(
"api/view/transactions/all/",
{
start: start,
end: end
},
function (data) {
this.renderTransactions(data);
}.bind(this),
"json"
);
}
},
{
key: "renderTransactions",
value: function renderTransactions(data) {
var a = new ElementPreviewList().generateLi(
"transaction",
data["data"]
);
console.log(a);
$("#accountingList").html(a);
$("#accountingList").enhanceWithin();
$("#accountingList").listview("refresh");
}
},
{
key: "renderFeedbacks",
value: function renderFeedbacks(data) {
var a = new ElementPreviewList().generateLi("feedback", data["data"]);
$("#feedbacksList").html(a);
$("#feedbacksList").enhanceWithin();
$("#feedbacksList").listview("refresh");
}
},
{
key: "renderQuestions",
value: function renderQuestions(data) {
var a = new ElementPreviewList().generateLi("question", data["data"]);
$("#questionsList").html(a);
$("#questionsList").enhanceWithin();
$("#questionsList").listview("refresh");
}
},
{
key: "renderDocs",
value: function renderDocs(data) {
var a = new ElementPreviewList().generateLi("document", data["data"]);
$("#documentsList").html(a);
$("#documentsList").enhanceWithin();
$("#documentsList").listview("refresh");
}
},
{
key: "renderEvents",
value: function renderEvents(data) {
var a = new ElementPreviewList().generateLi("event", data["data"]);
$("#eventsList").html(a);
$("#eventsList").enhanceWithin();
$("#eventsList").listview("refresh");
}
}
]);
return APIfetch;
})();
function eurS(val) {
if (val == 0)
return (
'<h2 style="color:yellow">&euro;' +
formatMoney(val, 2, ",", "'") +
"</h2>"
);
if (val < 0)
return (
'<h2 style="color:red">&euro;' + formatMoney(val, 2, ",", "'") + "</h2>"
);
return (
'<h2 style="color:green">&euro;' + formatMoney(val, 2, ",", "'") + "</h2>"
);
}
function formatMoney(number, decPlaces, decSep, thouSep) {
(decPlaces = isNaN((decPlaces = Math.abs(decPlaces))) ? 2 : decPlaces),
(decSep = typeof decSep === "undefined" ? "." : decSep);
thouSep = typeof thouSep === "undefined" ? "," : thouSep;
var sign = number < 0 ? "-" : "";
var i = String(
parseInt((number = Math.abs(Number(number) || 0).toFixed(decPlaces)))
);
var j = (j = i.length) > 3 ? j % 3 : 0;
return (
sign +
(j ? i.substr(0, j) + thouSep : "") +
i.substr(j).replace(/(\decSep{3})(?=\decSep)/g, "$1" + thouSep) +
(decPlaces
? decSep +
Math.abs(number - i)
.toFixed(decPlaces)
.slice(2)
: "")
);
}
function searchE(listArr, key) {
for (var i = 0; i < listArr.length; i++) {
var e = listArr[i];
if (e["name"] == key) return e["value"];
}
}
var epl = new ElementPreviewList();
var api = new APIfetch(epl);
api.fetchDocs();
api.fetchEvents();
api.fetchFeedbacks();
api.fetchQuestions();
api.fetchTransactions();
var start, end;
$(document).delegate("form[data-act=search]", "submit", function () {
var data = $(this).serializeArray();
start = searchE(data, "start") ? searchE(data, "start") : "false";
end = searchE(data, "end") ? searchE(data, "start") : "false";
switch (searchE(data, "search")) {
case "events":
api.fetchEvents(start, end);
break;
case "documents":
api.fetchDocs(start, end);
break;
case "feedbacks":
api.fetchFeedbacks(start, end);
break;
case "questions":
api.fetchQuestions(start, end);
break;
case "transactions":
api.fetchTransactions(start, end);
break;
}
return false;
});
function onKonamiCode(cb) {
var input = "";
var key = "38384040373937396665";
document.addEventListener("keydown", function (e) {
input += "" + e.keyCode;
if (input === key) {
return cb();
}
if (!key.indexOf(input)) return;
input = "" + e.keyCode;
});
}
onKonamiCode(function () {
window.open("https://www.youtube.com/watch?v=9YG9INjO91Y", "_blank");
});

1
main.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,111 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
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
5v6hhM2YeFQq1qiTxrDGWixkMCvzJzKFdeJKq64=
=3NTv
-----END PGP PUBLIC KEY BLOCK-----

31
rssBuilder.php Normal file
View File

@ -0,0 +1,31 @@
<?php
function rss($a)
{
ob_start();
echo '<?xml version="1.0" encoding="UTF-8" ?>';
?>
<rss version="2.0">
<channel>
<title>Lens - Innovationplaylist.eu</title>
<link>https://innovationplaylist.eu/lens</link>
<description>Piattaforma di trasparenza di Innovationplaylist.eu</description>
<author>mascarello.mattia@innovationplaylist.eu</author>
<language>IT_it</language>
</channel>
<?php
foreach($a as $e){
echo "<item>";
echo "\n<title>".htmlentities($e["title"])."</title>\n";
echo "<description>".htmlentities($e["shortDescription"])."</description>\n";
echo "<link>https://www.innovationplaylist.eu/lens/app/api/view/UID/".htmlentities($e["UID"])."/render</link>\n";
echo "<pubDate>".htmlentities($e["publishedDate"])."</pubDate>";
echo "</item>";
}
?>
</rss>
<?php
return ob_get_contents();
}
?>

197
view.php Normal file
View File

@ -0,0 +1,197 @@
<?php
header("Access-Control-Allow-Origin: *");
error_reporting(E_ERROR | E_PARSE);
$cacheDir="apicache";
$cacheTime=5*60;
$enableCache= false; //!$_POST["start"] && !$_POST["end"] ; //true;
require("lib.php");
require("dlib.php");
$ap=str_replace("/lens/app/api/","",$_SERVER['REQUEST_URI']);
cachedReplier($enableCache,$cacheDir,$cacheTime,$ap);
$al=explode("/",$ap);
$pdo=pdomake();
switch($al[0]){
case "view":
switch($al[1]){
case "all";
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$o=listAll($pdo);
for($i=0;$i<count(array_keys($o));$i++){
AALRect($o[array_keys($o)[$i]]);
}
//sort all by date
if($al[2]=="chronology"){
$el=adjustFlow($o);
$r->send($el);
}
if($al[2]=="rss"){
$el=adjustFlow($o);
include("rssBuilder.php");
$data=rss($el);
ob_clean();
header("Content-Type: application/xml");
echo $data;
exit;
}
else $r->send($o);
break;
case "transactions":
switch($al[2]){
case "all":
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$data=listCont($pdo);
conditionalDatePosting($data,$_POST,"publishedDate");
AALRect($data);
$r->send($data);
break;
default:
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
if($al[2]==null) $r->die("MISSING_PARAMETER","Missing parameter \"ID\"",400);
$data=listCont($pdo,$al[2]);
if(!count($data)) $r->die("RESOURCE_NOT_FOUND","The specified resource was not found",404);
AALRect($data);
$r->send($data[0]);
break;
}
break;
case "documents":
switch($al[2]){
case "all":
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$data=listDocs($pdo);
conditionalDatePosting($data,$_POST,"publishedDate");
AALRect($data);
$r->send($data);
break;
default:
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
if($al[2]==null) $r->die("MISSING_PARAMETER","Missing parameter \"ID\"",400);
$data=listDocs($pdo,$al[2]);
if(!count($data)) $r->die("RESOURCE_NOT_FOUND","The specified resource was not found",404);
AALRect($data);
$r->send($data[0]);
break;
}
break;
case "events":
switch($al[2]){
case "all":
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$data=listEvents($pdo);
conditionalDatePosting($data,$_POST,"publishedDate");
AALRect($data);
$r->send($data);
break;
default:
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
if($al[2]==null) $r->die("MISSING_PARAMETER","Missing parameter \"ID\"",400);
$data=listEvents($pdo,$al[2]);
if(!count($data)) $r->die("RESOURCE_NOT_FOUND","The specified resource was not found",404);
AALRect($data);
$r->send($data[0]);
break;
}
break;
case "questions":
switch($al[2]){
case "all":
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$data=listDomande($pdo);
conditionalDatePosting($data,$_POST,"publishedDate");
AALRect($data);
$r->send($data);
break;
default:
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
if($al[2]==null) $r->die("MISSING_PARAMETER","Missing parameter \"ID\"",400);
$data=listDomande($pdo,$al[2]);
if(!count($data)) $r->die("RESOURCE_NOT_FOUND","The specified resource was not found",404);
AALRect($data);
$r->send($data[0]);
break;
}
break;
case "feedbacks":
switch($al[2]){
case "all":
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$data=listFeedbacks($pdo);
conditionalDatePosting($data,$_POST,"publishedDate");
AALRect($data);
$r->send($data);
break;
default:
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
if($al[2]==null) $r->die("MISSING_PARAMETER","Missing parameter \"ID\"",400);
$data=listFeedbacks($pdo,$al[2]);
if(!count($data)) $r->die("RESOURCE_NOT_FOUND","The specified resource was not found",404);
AALRect($data);
$r->send($data[0]);
break;
}
break;
case "UID":
if($al[3]=="render"){
echo pageMake($al[2],$pdo);
exit;
}
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
if($al[2]==null) $r->die("MISSING_PARAMETER","Missing parameter \"UID\"",400);
$data=uid($al[2],$pdo);
if($data===(-1)) $r->die("INVALID_UID_FORMAT","The specified UID is invalid",404);
if(!count($data)) $r->die("RESOURCE_NOT_FOUND","The specified resource was not found",404);
$r->send($data[0]);
break;
case "tags":
switch($al[2]){
case "all":
switch($al[3]){
case "detailed":
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$data=listTagsDetail($pdo);
$r->send($data);
break;
case "summary":
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$data=listTags($pdo);
$r->send($data);
break;
}
break;
default:
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
if($al[2]==null) $r->die("MISSING_PARAMETER","Missing parameter \"ID\"",400);
switch($al[3]){
case "detailed":
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$data=listTagsDetail($pdo)[$al[2]];
if($data==null) $r->die("RESOURCE_NOT_FOUND","The specified resource was not found",404);
if($al[4]=="render"){
echo renderTag($data,$al[2]);
exit;
}
$r->send($data);
break;
case "summary":
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$data=listTags($pdo)[$al[2]];
if($data==null) $r->die("RESOURCE_NOT_FOUND","The specified resource was not found",404);
$r->send($data);
break;
default:
break;
}
if(!$data) $r->die("RESOURCE_NOT_FOUND","The specified resource was not found",404);
$r->send($data);
break;
}
break;
}
break;
}
$r=new Reply($enableCache,$cacheDir,$cacheTime,$ap);
$r->die("UNKNOWN_ENDPOINT","The endpoint specified is not valid",400);