Mixed Updates

This commit is contained in:
MatMasIt 2021-03-21 11:46:26 +01:00 committed by GitHub
parent f610299b72
commit 3ff6b494e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 71 additions and 38 deletions

View File

@ -195,7 +195,8 @@ $docs[$i]["UID"]="d".$docs[$i]["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"]);
$docs[$i]["tags"]=explode(",",trim($docs[$i]["Tags"]));
if($docs[$i]["tags"]==[""]) $docs[$i]["tags"]=[];
unset($docs[$i]["Tags"]);
if(!empty($docs[$i]["URL Firma Digitale"])){
$docs[$i]["signatureUrl"]=$docs[$i]["URL Firma Digitale"];
@ -209,21 +210,21 @@ $docs[$i]["UID"]="d".$docs[$i]["ID"];
}
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=$pdo->prepare('SELECT * FROM "Contabilita" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" ASC');
$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=$pdo->prepare('SELECT * FROM "Contabilita" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") AND ID=:id ORDER BY "Data di pubblicazione" ASC');
$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=$pdo->prepare('SELECT * FROM "Feedbacks" WHERE "Data di pubblicazione" < DATETIME("NOW") ORDER BY "Data di pubblicazione" ASC');
$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=$pdo->prepare('SELECT * FROM "Domande" WHERE DATETIME("NOW") >= strftime("%s", "Data di pubblicazione") ORDER BY "Data di pubblicazione" ASC');
$t->execute();
$qts=$t->fetchAll(PDO::FETCH_ASSOC);
@ -248,7 +249,8 @@ $docs[$i]["amount"]=(float)$docs[$i]["amount"];
}
if(count($ta)) $docs[$i]["links"]["to"]["documents"]=$ta;
$docs[$i]["tags"]=explode(",",$docs[$i]["Tags"]);
$docs[$i]["tags"]=explode(",",trim($docs[$i]["Tags"]));
if($docs[$i]["tags"]==[""]) $docs[$i]["tags"]=[];
unset($docs[$i]["Tags"]);
unset($docs[$i]["Documenti collegati"]);
}
@ -300,6 +302,7 @@ function listEvents($pdo,$id=null){
}
if(count($ta)) $docs[$i]["links"]["to"]["documents"]=$ta;
$docs[$i]["tags"]=explode(",",$docs[$i]["Tags"]);
if($docs[$i]["tags"]==[""]) $docs[$i]["tags"]=[];
unset($docs[$i]["Tags"]);
unset($docs[$i]["Documenti collegati"]);
}
@ -324,7 +327,8 @@ function listDomande($pdo,$id=null){
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"]);
$docs[$i]["tags"]=explode(",",trim($docs[$i]["Tags"]));
if($docs[$i]["tags"]==[""]) $docs[$i]["tags"]=[];
unset($docs[$i]["Tags"]);
$ef=explode(",",$docs[$i]["Documenti collegati"]);
@ -406,7 +410,7 @@ $docs[$i]["UID"]="f".$docs[$i]["ID"];
$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($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"]);
@ -434,7 +438,8 @@ $docs[$i]["UID"]="f".$docs[$i]["ID"];
unset($docs[$i]["Contabilita collegata"]);
$docs[$i]["tags"]=explode(",",$docs[$i]["Tags"]);
$docs[$i]["tags"]=explode(",",trim($docs[$i]["Tags"]));
if($docs[$i]["tags"]==[""]) $docs[$i]["tags"]=[];
unset($docs[$i]["Tags"]);
}
return $docs;

View File

@ -9,8 +9,18 @@
<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="main.es6.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>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-145142703-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-145142703-1');
</script>
</head>
@ -185,14 +195,14 @@
<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><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Licenza Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />Quest'opera è distribuita con Licenza <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribuzione - Condividi allo stesso modo 4.0 Internazionale</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>
<a href="https://github.com/MatMasIt/Lens" target="_blank">Github Repo</a>
</div>
<div data-role="footer" >
<p>Lens - &copy; 2020, Mattia Mascarello </p>
<p><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Licenza Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />Quest'opera è distribuita con Licenza <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribuzione - Condividi allo stesso modo 4.0 Internazionale</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>
<a href="https://github.com/MatMasIt/Lens" target="_blank">Github Repo</a>
</div>
</div>
<table data-role="table" class="ui-responsive table-stroke">
     <thead>
@ -217,7 +227,7 @@
<p><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Licenza Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />Quest'opera è distribuita con Licenza <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribuzione - Condividi allo stesso modo 4.0 Internazionale</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>
<a href="https://www.innovationplaylist.eu/lens/app/api/view/all/rss" target="_blank">Feed RSS</a>
<a href="https://github.com/MatMasIt/Lens" target="_blank">Github Repo</a>
</div>
</div>
@ -265,4 +275,4 @@
</div>
</body>
</html>
</html>

18
lib.php
View File

@ -87,7 +87,7 @@ function humanFileSize($size,$unit="") {
function linkM($link,$text){
if(empty($link) || empty($text)) return "";
return '<a href="'.$link.'">'.htmlentities($text).'</a>';
return '<a href="'.$link.'" target="_blank">'.htmlentities($text).'</a>';
}
function titlePrn($title,$val,$head="h3"){
if(empty($title) || empty($val)) return "";
@ -374,6 +374,16 @@ function pageBuild($title,$body){
<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>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-145142703-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-145142703-1');
</script>
</head>
@ -412,7 +422,7 @@ function renderTag($data,$tag){
$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>';
$res.='<a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$r["UID"].'/render">'.htmlentities($r["title"]).'</a>';
$i++;
}
if($i==0) $res.="<i>Dati mancanti</i>";
@ -424,11 +434,11 @@ function renderTag($data,$tag){
$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>';
$res.='<a href="https://innovationplaylist.eu/lens/app/api/view/UID/'.$r["UID"].'/render">'.htmlentities($r["title"]).'</a>';
$i++;
}
if($i==0) $res.="<i>Dati mancanti</i>";
}
return pageBuild("Tag: ".$tag,$res);
}
}

View File

@ -29,34 +29,36 @@ class NodeLinks{
}
ks.forEach(category => {
list=dict[category];
this.html+="<div data-role=\"collapsible\"><h3>"+this.lookup[category]+"</h3>";
this.html+="<div><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){
if(ks.length>0&&flag){
this.html+="</div>";
}
}
flag=false;
list=[];
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">';
this.html+='<span>Fanno riferimento a questa risorsa:</span><div>';
flag=true;
}
ks.forEach(category => {
list=dict[category];
this.html+="<div data-role=\"collapsible\"><h3>"+this.lookup[category]+"</h3>";
this.html+="<div><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>';
// alert(JSON.stringify(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){
if(ks.length>0&&flag){
this.html+="</div>";
}
}
@ -64,6 +66,7 @@ class NodeLinks{
this.html+="</div>";
// alert(this.html);
return this.html;
}
}
@ -73,7 +76,7 @@ class Tags{
}
computeHTML(){
if(this.tags!=null&&this.tags.length>0){
this.html+="<div data-role=\"collapsible\"><h3>Tag</h3>";
this.html+="<div><h3>Tag</h3>";
this.tags.forEach(element => {
this.html+='<p><a href="api/view/tags/'+encodeURI(element)+'/render">'+htmlEntities(element)+'</a></p>';
});
@ -356,7 +359,6 @@ class ElementPreviewList{
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");
@ -534,4 +536,4 @@ function onKonamiCode(cb) {
});
}
onKonamiCode(function () { window.open('https://www.youtube.com/watch?v=9YG9INjO91Y', '_blank'); });
onKonamiCode(function () { window.open('https://www.youtube.com/watch?v=9YG9INjO91Y', '_blank'); });

View File

@ -17,10 +17,10 @@ function rss($a)
<?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 "\n<title><![CDATA[".($e["title"])."]]></title>\n";
echo "<description><![CDATA[".($e["shortDescription"])."]]></description>\n";
echo "<link>https://www.innovationplaylist.eu/lens/app/api/view/UID/".($e["UID"])."/render</link>\n";
echo "<pubDate>".($e["publishedDate"])."</pubDate>";
echo "</item>";
}
?>
@ -28,4 +28,4 @@ function rss($a)
<?php
return ob_get_contents();
}
?>
?>

View File

@ -28,6 +28,12 @@ switch($al[0]){
if($al[2]=="rss"){
$el=adjustFlow($o);
include("rssBuilder.php");
for($i=0;$i<count($el);$i++){
if(!empty($el[$i]["questionTitle"])){
$el[$i]["title"]=$el[$i]["questionTitle"];
$el[$i]["shortDescription"]=$el[$i]["questionTitle"]."\n----\n".$el[$i]["questionText"]."\n````````\n".$el[$i]["answerTitle"]."\n----\n".$el[$i]["answerText"];
}
}
$data=rss($el);
ob_clean();
header("Content-Type: application/xml");