pezcurrel 4 years ago
parent
commit
93692a43ed

+ 2 - 0
web/admin/dafa.txt

@@ -0,0 +1,2 @@
+- ripristinare le colonne descrittive in Languages: una per la locale impostata (it), una per en, una per fr, una per sp...
+* instancesh.php: ritornare di tutte solo quelle che effettivamente sono usate, magari con un count tra ()

+ 83 - 0
web/admin/imgs/minus.svg

@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="22"
+   height="22"
+   viewBox="0 0 5.8208332 5.8208335"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.4 5da689c313, 2019-01-14"
+   sodipodi:docname="minus.svg">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="44.8"
+     inkscape:cx="14.735076"
+     inkscape:cy="11.083731"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     units="px"
+     inkscape:snap-bbox="true"
+     inkscape:snap-page="true"
+     inkscape:bbox-nodes="true"
+     inkscape:window-width="3840"
+     inkscape:window-height="2037"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Livello 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-291.17916)">
+    <rect
+       style="opacity:1;vector-effect:none;fill:#d35f5f;fill-opacity:1;stroke:none;stroke-width:0.37526914;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
+       id="rect861"
+       width="5.8208332"
+       height="5.8208265"
+       x="-1.110223e-16"
+       y="291.17917"
+       ry="0.78214943" />
+    <g
+       id="g836"
+       transform="matrix(0.91666672,0,0,0.91666267,4.7781508,25.660128)"
+       style="fill:#ffffff">
+      <rect
+         transform="rotate(90)"
+         ry="0.5610584"
+         y="-0.18603504"
+         x="292.27234"
+         height="4.4471259"
+         width="1.1221168"
+         id="rect817-9"
+         style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458335;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
+    </g>
+  </g>
+</svg>

+ 91 - 0
web/admin/imgs/plus.svg

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="22"
+   height="22"
+   viewBox="0 0 5.8208332 5.8208335"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.4 5da689c313, 2019-01-14"
+   sodipodi:docname="plus.svg">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="44.8"
+     inkscape:cx="14.735076"
+     inkscape:cy="11.083731"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     units="px"
+     inkscape:snap-bbox="true"
+     inkscape:snap-page="true"
+     inkscape:bbox-nodes="true"
+     inkscape:window-width="3840"
+     inkscape:window-height="2037"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Livello 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-291.17916)">
+    <rect
+       style="opacity:1;vector-effect:none;fill:#3088d4;fill-opacity:1;stroke:none;stroke-width:0.37526914;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
+       id="rect861"
+       width="5.8208332"
+       height="5.8208265"
+       x="-1.110223e-16"
+       y="291.17917"
+       ry="0.78214943" />
+    <g
+       id="g836"
+       transform="matrix(0.91666672,0,0,0.91666267,4.7781508,25.660128)"
+       style="fill:#ffffff">
+      <rect
+         ry="0.5610584"
+         y="290.60983"
+         x="-2.5985863"
+         height="4.4471259"
+         width="1.1221168"
+         id="rect817"
+         style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458335;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
+      <rect
+         transform="rotate(90)"
+         ry="0.5610584"
+         y="-0.18603504"
+         x="292.27234"
+         height="4.4471259"
+         width="1.1221168"
+         id="rect817-9"
+         style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458335;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
+    </g>
+  </g>
+</svg>

+ 3 - 4
web/admin/include/menu.php

@@ -3,12 +3,11 @@
 $menu=array(
 	'istanze'=>array('liadd'=>null, 'href'=>'istanze.php', 'title'=>'Istanze', 'selected'=>false, 'submenu'=>
 			array(
-			'aggiungi'=>array('liadd'=>'onclick="golang(\'en\')" onmouseover="this.style.cursor=\'pointer\'"', 'href'=>null, 'title'=>'English', 'selected'=>false, 'submenu'=>null),
-			'italiano'=>array('liadd'=>'onclick="golang(\'it\')" onmouseover="this.style.cursor=\'pointer\'"', 'href'=>null, 'title'=>'Italiano', 'selected'=>false, 'submenu'=>null)
+			'aggiungi'=>array('liadd'=>null, 'href'=>'editinst?m=new', 'title'=>'Aggiungi', 'selected'=>false, 'submenu'=>null),
 			)
 		),
-	'boh'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Non saprei', 'selected'=>false, 'submenu'=>null),
-	'vedremo'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Vedremo', 'selected'=>false, 'submenu'=>null),
+	'blacklist'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Blacklist', 'selected'=>false, 'submenu'=>null),
+	'magari'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Chissà', 'selected'=>false, 'submenu'=>null),
 	'forse'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Forse', 'selected'=>false, 'submenu'=>null)
 );
 

+ 2 - 2
web/admin/include/muoribene.php

@@ -1,8 +1,8 @@
 <?php
 
 function muoribene($msg,$close) {
-	global $mylink;
-	if ($close) mysqli_close($mylink);
+	global $link;
+	if ($close) mysqli_close($link);
 	echo('<!DOCTYPE HTML>
 <html lang="it">
 <head>

+ 260 - 69
web/admin/instances.php

@@ -3,11 +3,18 @@
 require('include/glob.php');
 require('include/muoribene.php');
 require('include/sessionstart.php');
+
 require('include/menu.php');
+$menu['istanze']['href']=null;
+$menu['istanze']['selected']=true;
 buildmenu($menu);
 
 require('include/myconn.php');
 
+$dbg='';
+
+use function mysqli_real_escape_string as myesc;
+
 // praticamente una macro
 function hspech($str) {
 	return(htmlspecialchars($str,ENT_QUOTES|ENT_HTML5,'UTF-8'));
@@ -79,6 +86,8 @@ function booly($pre,$val,$nottoobad=false,$invcol=false) {
 	}
 }
 
+$dbg.='<pre>'.print_r($_POST,1).'</pre>';
+
 $cols=array(
 	'New'=>array('name'=>'Nuova','type'=>'bool'),
 	'Good'=>array('name'=>'Papabile','type'=>'bool'),
@@ -90,7 +99,10 @@ $cols=array(
 	'ShortDesc'=>array('name'=>'Descrizione breve','type'=>'text'),
 	'LongDesc'=>array('name'=>'Descrizione lunga','type'=>'text'),
 	'OurDesc'=>array('name'=>'Descrizione nostra','type'=>'text'),
-	'PlaceID'=>array('name'=>'Località','type'=>'select'),
+
+	'PlaceID'=>array('name'=>'[Località]','type'=>'join','join'=>array()),
+	'Places.Locality'=>array('name'=>'Località','type'=>'joini','join'=>array('Places ON Places.ID=Instances.PlaceID'),'subtype'=>'text'),
+
 	'Email'=>array('name'=>'Email di contatto','type'=>'text'),
 	'Software'=>array('name'=>'Software','type'=>'text'),
 	'Version'=>array('name'=>'Versione','type'=>'text'),
@@ -109,20 +121,124 @@ $cols=array(
 	'AdmURL'=>array('name'=>'Pagina dell’admin','type'=>'text'),
 	'AdmAvatar'=>array('name'=>'Avatar admin','type'=>'text'),
 	'AdmNote'=>array('name'=>'Note dell’admin','type'=>'text'),
-	'InstLangs'=>array('name'=>'Lingue dichiarate','type'=>'select'),
-	'InstOurLangs'=>array('name'=>'Lingue impostate da noi','type'=>'select'),
-	'InstFinancing'=>array('name'=>'Modalità di finanziamento','type'=>'select'),
-	'InstPolicies'=>array('name'=>'Restrizioni sui contenuti','type'=>'select'),
-	'InstTags'=>array('name'=>'Tags','type'=>'select'),
+
+	'LangID'=>array('name'=>'[Lingue dichiarate]','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID')),
+	'Languages.Code'=>array('name'=>'Lingue dichiarate','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text'),
+
+	'OurLangID'=>array('name'=>'[Lingue impostate da noi]','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID')),
+	'OurLanguages.Code'=>array('name'=>'Lingue impostate da noi','type'=>'joini','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID','Languages AS OurLanguages ON OurLanguages.ID=InstOurLangs.OurLangID'),'subtype'=>'text'),
+
+	'FinID'=>array('name'=>'[Modalità di finanziamento]','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instnces.ID')),
+	'Financing.Type'=>array('name'=>'Modalità di finanziamento','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instnces.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text'),
+
+	'PolID'=>array('name'=>'[Restrizioni sui contenuti]','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID')),
+	'Policies.Name'=>array('name'=>'Restrizioni sui contenuti','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies ON Policies.ID=InstPolicies.PolID'),'subtype'=>'text'),
+
+	'TagID'=>array('name'=>'[Tags]','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID')),
+	'Tags.Name'=>array('name'=>'Tags','type'=>'join','joini'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text'),
+
+	'Statuses'=>array('name'=>'Stati ultima settimana','type'=>'int','join'=>'LEFT JOIN InstActivity ON InstActivity.InstID=Instances.ID','select'=>'MAX(Week) AS maxweek'),
+	'Logins'=>array('name'=>'Logins ultima settimana','type'=>'int','join'=>'LEFT JOIN InstActivity ON InstActivity.InstID=Instances.ID','select'=>'MAX(Week) AS maxweek'),
+	'Registrations'=>array('name'=>'Registrazioni ultima settimana','type'=>'int','join'=>'LEFT JOIN InstActivity ON InstActivity.InstID=Instances.ID','select'=>'MAX(Week) AS maxweek'),
 );
 
+$types=array('bool','int','time','text','join','joini');
+
 $fieldselopts='';
 foreach ($cols as $key=>$val) {
-	$fieldselopts.='<option value="'.$key.'§'.$val['type'].'">'.$val['name'].'</option>';
+	if ($val['type']=='joini') {
+		$fieldselopts.='<option value="'.$key.'§'.$val['type'].'§'.$val['subtype'].'">'.$val['name'].'</option>';
+	} else {
+		$fieldselopts.='<option value="'.$key.'§'.$val['type'].'§null">'.$val['name'].'</option>';
+	}
+}
+
+/*
+[openpar-1] => null
+[fieldsel-1] => New§bool
+[condsel-1] => IS
+[valuesel-1] => TRUE
+[closepar-1] => null
+[andor-1] => AND
+[openpar-2] => (
+[fieldsel-2] => URI§text
+[condsel-2] => LIKE
+[valueinp-2] => bida
+[closepar-2] => null
+[andor-2] => OR
+[openpar-3] => null
+[fieldsel-3] => URI§text
+[condsel-3] => IS NULL
+[closepar-3] => )
+[andor-3] => AND
+[openpar-4] => null
+[fieldsel-4] => PlaceID§join
+[condsel-4] => =
+[valuesel-4] => 1
+[closepar-4] => null
+[andor-4] => AND
+[openpar-5] => null
+[fieldsel-5] => UserCount§int
+[condsel-5] => >=
+[valueinp-5] => 123
+[closepar-5] => null
+[andor-5] => AND
+[openpar-6] => null
+[fieldsel-6] => LangID§join
+[condsel-6] => =
+[valuesel-6] => 20
+[closepar-6] => null
+*/
+
+$joins=array();
+$where='';
+foreach ($_POST as $key=>$val) {
+	if (preg_match('/^openpar-\d+/',$key)===1 && preg_match('/^\(+$/',$val)===1)
+		$where.=$val;
+	if (preg_match('/^fieldsel-\d+/',$key)===1 && preg_match('/^(.+)§(.+)§(.+)$/',$val,$buf)===1) {
+		if (array_key_exists($buf[1],$cols) && in_array($buf[2],$types)) {
+			$where.=$buf[1];
+			if ($buf[2]=='join' || $buf[2]=='joini') {
+				foreach ($cols[$buf[1]]['join'] as $join) {
+					if (!in_array($join,$joins))
+						$joins[]=$join;
+				}
+			}
+		} else {
+			muoribene($dbg.'<br>Dati POST corrotti.<br>Puoi <a href="instances.php">riprovare</a> o <a href="index.php">tornare al login</a>.',true);
+		}
+	}
+	if (preg_match('/^condsel-\d+/',$key)===1) {
+		$where.=' '.$val.' ';
+		$cond=$val;
+	}
+	if (preg_match('/^valuesel-\d+/',$key)===1)
+		$where.=$val;
+	if (preg_match('/^valueinp-\d+/',$key)===1) {
+		if (preg_match('/^(LIKE|NOT LIKE)$/',$cond)===1)
+			$where.='\'%'.myesc($link,$val).'%\'';
+		else
+			$where.='\''.myesc($link,$val).'\'';
+	}
+	if (preg_match('/^closepar-\d+/',$key)===1 && preg_match('/^\)+$/',$val)===1)
+		$where.=$val;
+	if (preg_match('/^andor-\d+/',$key)===1 && preg_match('/^(AND|OR)$/',$val)===1)
+		$where.=' '.$val.' ';
 }
+if ($where!='')
+	$where='WHERE '.$where;
+if (count($joins)>0)
+	$joins='LEFT JOIN '.implode(' LEFT JOIN ',$joins);
+else
+	$joins='';
+
+$query='SELECT *, Instances.ID AS IID FROM Instances '.$joins.' '.$where.' GROUP BY IID ORDER BY Instances.URI ASC LIMIT 50';
+$dbg.='QUERONA: '.$query.'<br>'.N;
+$res=mysqli_query($link,$query)
+	or muoribene($dbg.'<br>'.$query.': '.mysqli_error($link),true);
+
+
 
-$res=mysqli_query($link,'SELECT *, Instances.ID AS IID FROM Instances LEFT JOIN Places ON Places.ID=PlaceID ORDER BY URI ASC LIMIT 50')
-	or muoribene(mysqli_error($link),false);
 if (mysqli_num_rows($res)<1) {
 	$out='<p>Nessuna istanza da mostrare.</p>'.N;
 } else {
@@ -131,7 +247,7 @@ if (mysqli_num_rows($res)<1) {
 		$out.='<table class="bigtab">'.N;
 //		$out.='<thead><tr><th class="tdattr">Attributi</th><th>Info</th></thead>'.N;
 		$out.='<tbody>'.N;
-		$out.='<tr><td colspan="2" class="insthead">'.$row['URI'].'</td></tr>'.N;
+		$out.='<tr><td colspan="2" class="insthead">'.$row['URI'].' {'.$row['IID'].'}</td></tr>'.N;
 		$attr=booly($cols['Blacklisted']['name'].': ',$row['Blacklisted'],false,true).N;
 		$attr.=booly($cols['New']['name'].': ',$row['New'],true).N;
 		$attr.=booly($cols['Good']['name'].': ',$row['Good']).N;
@@ -140,7 +256,7 @@ if (mysqli_num_rows($res)<1) {
 /*		$attr.=booly($cols['RegOpen']['name'].': ',$row['RegOpen']).N;
 		$attr.=booly($cols['RegReqApproval']['name'].': ',$row['RegReqApproval'],true,true).N;*/
 		$sres=mysqli_query($link,'SELECT * FROM InstChecks WHERE InstID='.$row['IID'].' ORDER BY Time DESC')
-			or muoribene(mysqli_error($link),false);
+			or muoribene(mysqli_error($link),true);
 		$csres=mysqli_num_rows($sres);
 		if ($csres>0) {
 			$bene=0;
@@ -160,10 +276,10 @@ if (mysqli_num_rows($res)<1) {
 		}
 		$attr.='<div class="colsectheader">Attività delle ultime 12 settimane</div>'.N;
 		$sres=mysqli_query($link,'SELECT SUM(Statuses) AS tstatuses, SUM(Logins) AS tlogins, SUM(Registrations) AS tregs FROM InstActivity WHERE InstID='.$row['IID'])
-			or muoribene(mysqli_error($link),false);
+			or muoribene(mysqli_error($link),true);
 		$tot=mysqli_fetch_assoc($sres);
 		$sres=mysqli_query($link,'SELECT * FROM InstActivity WHERE InstID='.$row['IID'].' ORDER BY Week DESC')
-			or muoribene(mysqli_error($link),false);
+			or muoribene(mysqli_error($link),true);
 		if (mysqli_num_rows($sres)>0) {
 			$attr.='<div class="colsectcont">Stati: '.$tot['tstatuses'].'<br>Accessi: '.$tot['tlogins'].'<br>Registrazioni: '.$tot['tregs'].'</div>'.N;
 			while ($srow=mysqli_fetch_assoc($sres)) {
@@ -180,7 +296,7 @@ if (mysqli_num_rows($res)<1) {
 		}
 		$attr.='<div class="colsectheader">Hashtags più usati durante l’ultima settimana</div>'.N;
 		$sres=mysqli_query($link,'SELECT * FROM InstTrends WHERE InstID='.$row['IID'].' ORDER BY Pos ASC')
-			or muoribene(mysqli_error($link),false);
+			or muoribene(mysqli_error($link),true);
 		if (mysqli_num_rows($sres)>0) {
 			$attr.='<div class="colsectcont"><ol>'.N;
 			while ($srow=mysqli_fetch_assoc($sres)) {
@@ -200,7 +316,7 @@ if (mysqli_num_rows($res)<1) {
 		$out.='<div class="baloo"><span class="ourfield">'.$cols['OurDesc']['name'].':</span> '.nully($row['OurDesc'],true,'strip').'</div>'.N;
 		$out.='<div class="baloo"><span class="ourfield">'.$cols['PlaceID']['name'].':</span> '.nully($row['PlaceID'],true,'strip').'</div>'.N;
 		$sres=mysqli_query($link,'SELECT * FROM InstLangs LEFT JOIN Languages ON Languages.ID=LangID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC')
-			or muoribene(mysqli_error($link),false);
+			or muoribene(mysqli_error($link),true);
 		if (mysqli_num_rows($sres)>0) {
 			$i=0;
 			$buf=array();
@@ -208,12 +324,12 @@ if (mysqli_num_rows($res)<1) {
 				$i++;
 				$buf[]=$i.': '.hspech($srow['Code'].' ['.ucfirst(locale_get_display_name($srow['Code'])).']');
 			}
-			$out.='<div class="baloo"><span class="field">'.$cols['InstLangs']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
+			$out.='<div class="baloo"><span class="field">'.$cols['LangID']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
 		} else {
-			$out.='<div class="baloo"><span class="field">'.$cols['InstLangs']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
+			$out.='<div class="baloo"><span class="field">'.$cols['LangID']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
 		}
-		$sres=mysqli_query($link,'SELECT * FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=LangID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC')
-			or muoribene(mysqli_error($link),false);
+		$sres=mysqli_query($link,'SELECT * FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC')
+			or muoribene(mysqli_error($link),true);
 		if (mysqli_num_rows($sres)>0) {
 			$i=0;
 			$buf=array();
@@ -221,12 +337,12 @@ if (mysqli_num_rows($res)<1) {
 				$i++;
 				$buf[]=$i.': '.hspech($srow['Code'].' ['.ucfirst(locale_get_display_name($srow['Code'],'it')).']');
 			}
-			$out.='<div class="baloo"><span class="ourfield">'.$cols['InstOurLangs']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
+			$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLangID']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
 		} else {
-			$out.='<div class="baloo"><span class="ourfield">'.$cols['InstOurLangs']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
+			$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLangID']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
 		}
 		$sres=mysqli_query($link,'SELECT * FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC')
-			or muoribene(mysqli_error($link),false);
+			or muoribene(mysqli_error($link),true);
 		if (mysqli_num_rows($sres)>0) {
 			$i=0;
 			$buf=array();
@@ -234,12 +350,12 @@ if (mysqli_num_rows($res)<1) {
 				$i++;
 				$buf[]=$i.': '.hspech($srow['Type']).' ('.hspech($row['Details']).')';
 			}
-			$out.='<div class="baloo"><span class="ourfield">'.$cols['InstFinancing']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
+			$out.='<div class="baloo"><span class="ourfield">'.$cols['FinID']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
 		} else {
-			$out.='<div class="baloo"><span class="ourfield">'.$cols['InstFinancing']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
+			$out.='<div class="baloo"><span class="ourfield">'.$cols['FinID']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
 		}
 		$sres=mysqli_query($link,'SELECT * FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC')
-			or muoribene(mysqli_error($link),false);
+			or muoribene(mysqli_error($link),true);
 		if (mysqli_num_rows($sres)>0) {
 			$i=0;
 			$buf=array();
@@ -247,12 +363,12 @@ if (mysqli_num_rows($res)<1) {
 				$i++;
 				$buf[]=$i.': '.hspech($srow['Name']);
 			}
-			$out.='<div class="baloo"><span class="ourfield">'.$cols['InstPolicies']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
+			$out.='<div class="baloo"><span class="ourfield">'.$cols['PolID']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
 		} else {
-			$out.='<div class="baloo"><span class="ourfield">'.$cols['InstPolicies']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
+			$out.='<div class="baloo"><span class="ourfield">'.$cols['PolID']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
 		}
 		$sres=mysqli_query($link,'SELECT * FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC')
-			or muoribene(mysqli_error($link),false);
+			or muoribene(mysqli_error($link),true);
 		if (mysqli_num_rows($sres)>0) {
 			$i=0;
 			$buf=array();
@@ -260,9 +376,9 @@ if (mysqli_num_rows($res)<1) {
 				$i++;
 				$buf[]=$i.': '.hspech($srow['Name']);
 			}
-			$out.='<div class="baloo"><span class="ourfield">'.$cols['InstTags']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
+			$out.='<div class="baloo"><span class="ourfield">'.$cols['TagID']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
 		} else {
-			$out.='<div class="baloo"><span class="ourfield">'.$cols['InstTags']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
+			$out.='<div class="baloo"><span class="ourfield">'.$cols['TagID']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
 		}
 		$out.='<div class="baloo"><span class="field">'.$cols['Email']['name'].':</span> '.nully($row['Email'],true,'email').'</div>'.N;
 		$out.='<div class="baloo"><span class="field">'.$cols['Software']['name'].':</span> '.nully($row['Software'],false,'strip').'</div>'.N;
@@ -285,7 +401,7 @@ if (mysqli_num_rows($res)<1) {
 		$out.='</tbody>'.N;
 		$out.='</table>'.N;
 	}
-	$out.='<div style="height:36px;"></div>';
+	$out.='<div class="bigtabfoot"></div>';
 }
 
 mysqli_close($link);
@@ -302,6 +418,7 @@ mysqli_close($link);
 <link rel="icon" type="image/png" href="imgs/icona-192.png" sizes="192x192">
 <link rel="icon" type="image/png" href="imgs/icona-512.png" sizes="512x512">
 <link rel="apple-touch-icon-precomposed" href="imgs/icona-180.png">
+<script language="JavaScript" src="js/confirma.js?v=<?php echo($cjrand); ?>"></script>
 <link rel="stylesheet" type="text/css" href="theme.css?v=<?php echo($cjrand); ?>">
 <script language="JavaScript">
 <!--
@@ -331,43 +448,61 @@ function golang(lang) {
 			document.location.href=loc.substr(0,loc.length-3);
 	}
 }
+
+function shideplancia() {
+	var plancia=document.getElementById('plancia');
+	var rightdiv=document.getElementById('rightdiv');
+	if (plancia.style.display=='block') {
+		plancia.style.display='none';
+		rightdiv.innerHTML='Mostra plancia';
+	} else {
+		plancia.style.display='block';
+		rightdiv.innerHTML='Nascondi plancia';
+	}
+}
+
 function truncsel(el) {
 	var sel=document.getElementById(el), len=sel.length, i=0;
 	for (i=len-1; i>=0; i--)
 		sel.remove(i);
 }
 function addselopt(el,val,txt) {
-	option=document.createElement('option');
-	option.value=val;
-	option.text=txt;
+	option=new Option(txt,val);
 	el.add(option);
 }
 function inpdisif(index) {
-	var source=document.getElementById('condsel'+index);
-	var dest=document.getElementById('valueinp'+index);
+	var source=document.getElementById('condsel-'+index);
+	var dest1=document.getElementById('valueinp-'+index);
+	var dest2=document.getElementById('valuesel-'+index);
 	var conds=['IS NULL','IS NOT NULL'];
 	if (conds.includes(source.value)) {
-		dest.disabled=true;
+		dest1.disabled=true;
+		dest2.disabled=true;
 //		dest.style='display:none';
 	} else {
-		dest.disabled=false;
+		dest1.disabled=false;
+		dest2.disabled=false;
 //		dest.style='display:block';
 	}
 }
 function popusels(index) {
 	console.log('Index: '+index);
-	var val=document.getElementById('fieldsel'+index).value, type=val.replace(/^.*§/,''), option;
-	val=val.replace(/§.*$/,'');
-	var condsel=document.getElementById('condsel'+index);
-	var valsel=document.getElementById('valuesel'+index);
-	var valinp=document.getElementById('valueinp'+index);
+	var key=document.getElementById('fieldsel-'+index).value;
+	var type=key.replace(/^.*§(.*)§.*$/,'$1');
+	var subtype=key.replace(/^.*§.*§(.*)$/,'$1');
+	key=key.replace(/^(.*)§.*§.*$/,'$1');
+	var condsel=document.getElementById('condsel-'+index);
+	var valsel=document.getElementById('valuesel-'+index);
+	var valinp=document.getElementById('valueinp-'+index);
+	if (type=='joini')
+		type=subtype;
 	if (type=='bool') {
-		truncsel('condsel'+index);
+		truncsel('condsel-'+index);
 		addselopt(condsel,'IS','è');
-		addselopt(condsel,'IS NOT','non è');
-		truncsel('valuesel'+index);
+		truncsel('valuesel-'+index);
 		addselopt(valsel,'TRUE','vero');
 		addselopt(valsel,'FALSE','falso');
+		addselopt(valsel,'NOT NULL','definito');
 		addselopt(valsel,'NULL','non definito');
 		valinp.style='display:none';
 		valinp.disabled=true;
@@ -375,7 +510,7 @@ function popusels(index) {
 		valsel.disabled=false;
 		condsel.removeAttribute('onchange');
 	} else if (type=='text') {
-		truncsel('condsel'+index);
+		truncsel('condsel-'+index);
 		addselopt(condsel,'LIKE','contiene');
 		addselopt(condsel,'NOT LIKE','non contiene');
 		addselopt(condsel,'=','è uguale a');
@@ -388,7 +523,7 @@ function popusels(index) {
 		valinp.disabled=false;
 		condsel.setAttribute('onchange','inpdisif('+index+');');
 	} else if (type=='int' || type=='time') {
-		truncsel('condsel'+index);
+		truncsel('condsel-'+index);
 		addselopt(condsel,'>=','maggiore o uguale a');
 		addselopt(condsel,'<=','minore o uguale a');
 		addselopt(condsel,'>','maggiore di');
@@ -402,12 +537,25 @@ function popusels(index) {
 		valinp.style='display:block';
 		valinp.disabled=false;
 		condsel.setAttribute('onchange','inpdisif('+index+');');
+	} else if (type=='join') {
+		truncsel('condsel-'+index);
+		addselopt(condsel,'=','uguale a');
+		addselopt(condsel,'!=','diverso da');
+		addselopt(condsel,'IS NOT NULL','è definito');
+		addselopt(condsel,'IS NULL','non è definito');
+		valsel.style='display:block';
+		valsel.disabled=false;
+		valinp.style='display:none';
+		valinp.disabled=true;
+		condsel.setAttribute('onchange','inpdisif('+index+');');
+		truncsel('valuesel-'+index);
+		document.getElementById('helper').setAttribute('src','instancesh.php?key='+key+'&parsel=valuesel-'+index);
 	} else {
 		alert('Attenziò: non so che farmene del tipo "'+type+'": diglielo, al programmatore.');
 	}
 }
 function addrow(index) {
-	var table=document.getElementById('plancia');
+	var table=document.getElementById('planciafil');
 	var newrow=table.insertRow(index);
 	var newcell0=newrow.insertCell(0);
 	var newcell1=newrow.insertCell(1);
@@ -420,7 +568,7 @@ function addrow(index) {
 	newcell0.innerHTML='<select class="openpar"><option value="null"></option><option value="(">(</option><option value="((">((</option><option value="(((">(((</option></select>';
 	newcell1.innerHTML='<select class="fieldsel"><?php echo($fieldselopts); ?></select>';
 	newcell2.innerHTML='<select class="condsel"></select>';
-	newcell3.innerHTML='<select class="valuesel" style="display:none;"></select>\n<input type="text" class="valueinp" maxlength="256" style="display:none;">';
+	newcell3.innerHTML='<select class="valuesel" style="display:none;"></select><input type="text" class="valueinp" maxlength="256" style="display:none;">';
 	newcell4.innerHTML='<select class="closepar"><option value="null"></option><option value=")">)</option><option value="))">))</option><option value=")))">)))</option></select>';
 	newcell5.innerHTML='<select class="andor"><option value="AND">E</option><option value="OR">O</option></select>';
 	newcell6.innerHTML='<img class="plus" src="imgs/plus.svg">';
@@ -430,7 +578,7 @@ function addrow(index) {
 }
 function synctai() {
 	var i=0;
-	var table=document.getElementById('plancia');
+	var table=document.getElementById('planciafil');
 	var nodes=table.querySelectorAll('.minus');
 	var cnodes=nodes.length;
 	for (i=0; i<cnodes; i++)
@@ -444,48 +592,69 @@ function synctai() {
 	cnodes--;
 	nodes=table.querySelectorAll('.openpar');
 	for (i=cnodes; i>-1; i--) {
-		nodes[i].setAttribute('id','openpar'+(i+1));
-		nodes[i].setAttribute('name','openpar'+(i+1));
+		nodes[i].setAttribute('id','openpar-'+(i+1));
+		nodes[i].setAttribute('name','openpar-'+(i+1));
 	}
 	nodes=table.querySelectorAll('.fieldsel');
 	for (i=cnodes; i>-1; i--) {
-		nodes[i].setAttribute('id','fieldsel'+(i+1));
-		nodes[i].setAttribute('name','fieldsel'+(i+1));
+		nodes[i].setAttribute('id','fieldsel-'+(i+1));
+		nodes[i].setAttribute('name','fieldsel-'+(i+1));
 		nodes[i].setAttribute('onchange','popusels('+(i+1)+');');
 	}
 	nodes=table.querySelectorAll('.condsel');
 	for (i=cnodes; i>-1; i--) {
-		nodes[i].setAttribute('id','condsel'+(i+1));
-		nodes[i].setAttribute('name','condsel'+(i+1));
+		nodes[i].setAttribute('id','condsel-'+(i+1));
+		nodes[i].setAttribute('name','condsel-'+(i+1));
 	}
 	nodes=table.querySelectorAll('.valuesel');
 	for (i=cnodes; i>-1; i--) {
-		nodes[i].setAttribute('id','valuesel'+(i+1));
-		nodes[i].setAttribute('name','valuesel'+(i+1));
+		nodes[i].setAttribute('id','valuesel-'+(i+1));
+		nodes[i].setAttribute('name','valuesel-'+(i+1));
 	}
 	nodes=table.querySelectorAll('.valueinp');
 	for (i=cnodes; i>-1; i--) {
-		nodes[i].setAttribute('id','valueinp'+(i+1));
-		nodes[i].setAttribute('name','valueinp'+(i+1));
+		nodes[i].setAttribute('id','valueinp-'+(i+1));
+		nodes[i].setAttribute('name','valueinp-'+(i+1));
 	}
 	nodes=table.querySelectorAll('.closepar');
 	for (i=cnodes; i>-1; i--) {
-		nodes[i].setAttribute('id','closepar'+(i+1));
-		nodes[i].setAttribute('name','closepar'+(i+1));
+		nodes[i].setAttribute('id','closepar-'+(i+1));
+		nodes[i].setAttribute('name','closepar-'+(i+1));
 	}
 	nodes=table.querySelectorAll('.andor');
 	for (i=cnodes; i>-1; i--) {
-		nodes[i].setAttribute('id','andor'+(i+1));
-		nodes[i].setAttribute('name','andor'+(i+1));
+		nodes[i].setAttribute('id','andor-'+(i+1));
+		nodes[i].setAttribute('name','andor-'+(i+1));
 		nodes[i].disabled=false;
 	}
-	if (cnodes>0)
+	if (cnodes>=0)
 		nodes[cnodes].disabled=true;
 }
 function remrow(index) {
-	var table=document.getElementById('plancia');
+	var table=document.getElementById('planciafil');
 	table.deleteRow(index);
 	synctai();
+	if (table.rows.length<2)
+		document.getElementById('filbut').value='Aggiungi criteri di ricerca';
+}
+function truncfil() {
+	var table=document.getElementById('planciafil');
+	while (table.rows.length>1)
+		remrow(1);
+}
+function manfil() {
+	var filbut=document.getElementById('filbut');
+	var table=document.getElementById('planciafil');
+	var crows=table.rows.length;
+	if (crows<2) {
+		addrow(1);
+		filbut.value='Rimuovi tutti i criteri di ricerca';
+	} else {
+		confirma('Confermi di voler rimuovere tutti i criteri di ricerca?','truncfil();filbut.value=\'Aggiungi criteri di ricerca\'');
+	}
+}
+function ckf() {
+	document.getElementById('f').submit();
 }
 //-->
 </script>
@@ -497,23 +666,45 @@ function remrow(index) {
 <ul>
 <?php echo($menuout); ?>
 </ul>
+<div id="rightdiv" onclick="shideplancia();">Mostra plancia</div>
 </div>
 </nav>
 
+<div id="popup">
+<div id="inpopup">
+<div id="popupcont">
+...
+</div>
+</div>
+</div>
+
+<iframe name="helper" id="helper"></iframe>
+
 <div id="footer">
 <form action="edinst.php" name="addinst" method="post">
 <table><tr><td>Aggiungi un’istanza:</td><td><input type="text" name="URI" maxlength="512"></td><td><input type="button" value="Vai" onClick="ckaif();"></td></tr></table>
 </form>
 </div>
 
+<div id="debug">
+<?php echo($dbg); ?>
+</div>
 
 <div id="fullscreen">
 <div id="middlerow">
 
 <form method="post" id="f">
-<table id="plancia">
-<tr><td colspan="8"><input type="button" value="Aggiungi condizioni" class="ctrlbut" onclick="addrow(document.getElementById('plancia').rows.length);"></td></tr>
+<div id="plancia">
+<table id="planciafil" class="planciatab">
+<tr><td colspan="8"><input type="button" id="filbut" value="Aggiungi criteri di ricerca" class="ctrlbut" onclick="manfil();"></td></tr>
 </table>
+<table id="planciaord" class="planciatab">
+<tr><td colspan="8"><input type="button" id="ordbut" value="Aggiungi criteri di ordinamento" class="ctrlbut" onclick="alert('Aspetta!')"></td></tr>
+</table>
+<table id="planciaothers" class="planciatab">
+<tr><td><input type="button" id="subbut" value="Applica" class="ctrlbut" onclick="ckf();"></td></tr>
+</table>
+</div>
 </form>
 
 <?php echo($out); ?>

+ 44 - 0
web/admin/instancesh.php

@@ -0,0 +1,44 @@
+<?php
+
+require('include/glob.php');
+require('include/muoribene.php');
+require('include/sessionstart.php');
+
+$cols=array(
+	'PlaceID'=>array('select'=>'SELECT Places.ID AS Pid, CONCAT(Locality,\' (\',COUNT(Places.ID),\')\') AS Txt FROM Instances LEFT JOIN Places ON Places.ID=PlaceID WHERE PlaceID IS NOT NULL ORDER BY Locality ASC','optcol'=>'Pid','txtcol'=>'Txt'),
+	'LangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code,\' (\',COUNT(Languages.ID),\')\') AS Txt FROM InstLangs LEFT JOIN Languages ON Languages.ID=LangID GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
+	'OurLangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code,\' (\',COUNT(Languages.ID),\')\') AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
+	'FinID'=>array('select'=>'SELECT Financing.ID AS Fid, CONCAT(Type,\' (\',COUNT(Financing.ID),\')\') AS Txt FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID GROUP BY Financing.ID ORDER BY Type ASC ','optcol'=>'Fid','txtcol'=>'Txt'),
+	'PolID'=>array('select'=>'SELECT Policies.ID AS Pid, CONCAT(Name,\' (\',COUNT(Policies.ID),\')\') AS Txt FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID GROUP BY Policies.ID ORDER BY Name ASC','optcol'=>'Pid','txtcol'=>'Txt'),
+	'TagID'=>array('select'=>'SELECT Tags.ID AS Tid, CONCAT(Name,\' (\',COUNT(Tags.ID),\')\') AS Txt FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID GROUP BY (Tags.ID) ORDER BY Name ASC','optcol'=>'Tid','txtcol'=>'Txt'),
+);
+
+if (array_key_exists('key',$_GET) && array_key_exists('parsel',$_GET) && array_key_exists($_GET['key'],$cols)) {
+	require('include/myconn.php');
+	$res=mysqli_query($link,$cols[$_GET['key']]['select'])
+		or muoribene(mysqli_error($link),true);
+	mysqli_close($link);
+	$jsout='e=window.parent.document.getElementById(\''.$_GET['parsel'].'\');'.N;
+	while ($row=mysqli_fetch_assoc($res)) {
+		$jsout.='o=new Option('.json_encode($row[$cols[$_GET['key']]['txtcol']]).','.$row[$cols[$_GET['key']]['optcol']].');e.add(o);'.N;
+	}
+}
+
+$out='Ciao!';
+
+?>
+<!DOCTYPE HTML>
+<html lang="it">
+<head>
+<title>Mastodon Startpage Admin - Istanze - Helper</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<script language="JavaScript">
+<!--
+<?php echo($jsout); ?>
+//-->
+</script>
+</head>
+<body>
+<?php echo($out); ?>
+</body>
+</html>

+ 4 - 0
web/admin/js/confirma.js

@@ -0,0 +1,4 @@
+function confirma(msg,act) {
+	document.getElementById('popupcont').innerHTML='<h3>Attenzione</h3>'+msg+'<input type="button" class="pupbut" value="No" onClick="document.getElementById(\'popup\').style.display=\'none\'"><input type="button" class="pupbut" style="margin-top:3pt;" value="Si" onClick="'+act+';document.getElementById(\'popup\').style.display=\'none\'">';
+	document.getElementById('popup').style.display='table';
+}

+ 71 - 25
web/admin/theme.css

@@ -34,18 +34,21 @@ ul {
 p {
 	margin-bottom: 10px;
 }
+.bigtabfoot {
+	height: 32px;
+}
 .bigtab {
 	background-color: white;
 	font-size: 10pt;
 	margin-left: auto;
 	margin-right: auto;
 	/*max-width: 100%;*/
-	margin-top: 36px;
+	margin-top: 32px;
 }
 .bigtab thead {
 	padding: 3px;
 /*	position: sticky;
-	top: 36px;*/
+	top: 32px;*/
 	color: white;
 	height: 30px;
 }
@@ -226,7 +229,7 @@ input {
 	height: 36px;
 }
 #popup {
-	z-index: 1;
+	z-index: 2;
 	display: none;
 	top: 0px;
 	position: fixed;
@@ -235,7 +238,7 @@ input {
 	background-color: rgba(0,0,0,0.75);
 	color: white;
 	padding: 0;
-	font-size: 12pt;
+	font-size: 9pt;
 }
 #inpopup {
 	display: table-cell;
@@ -253,15 +256,20 @@ input {
 	padding: 5px;
 	text-align: left;
 }
+.pupbut {
+	margin-top: 5px;
+	width: 100%;
+	height: 24px;
+}
 #footer {
 	color: white;
 	position: fixed;
-	height: 36px;
+	height: 32px;
 	width: 100%;
 	bottom: 0;
 	left: 0;
 	background-color: rgba(0,0,0,0.85);
-	line-height: 36px;
+	line-height: 32px;
 	vertical-align: middle;
 }
 .nully {
@@ -270,21 +278,36 @@ input {
 }
 
 #hmenu {
-	font-size: 12pt;
+	font-size: 10pt;
 	background-color: rgba(0,0,0,0.85);
 	color: white;
 	position: fixed;
 	top: 0;
 	left: 0;
 	width: 100%;
-	height: 36px;
+	height: 32px;
 	margin: 0;
 	padding: 0;
 	/*box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.4);*/
-	/*padding-left: 36px;*/
-	z-index: 2;
+	/*padding-left: 32px;*/
+	z-index: 1;
 	/*display: none;*/
 }
+#hmenu #rightdiv {
+	position: absolute;
+	top: 0;
+	right: 0;
+	color: #78b1e2;
+	height: 32px;
+	line-height: 32px;
+	vertical-align: middle;
+	padding-right: 10px;
+	padding-left: 10px;
+}
+#hmenu #rightdiv:hover {
+	cursor: pointer;
+	background-color: rgba(255,255,255,0.10);
+}
 #hmenu ul {
 	list-style-type: none;
 	margin: 0;
@@ -292,51 +315,51 @@ input {
 	overflow: visible;
 }
 #hmenu ul li {
-	width: 80pt;
-	height: 36px;
+	width: 80px;
+	height: 32px;
 	text-align: center;
 	display: table-cell;
 	vertical-align: middle;
-	color: #3088D4;
+	color: #78b1e2;
 }
 #hmenu ul li:hover {
 	background-color: rgba(255,255,255,0.10);
 	cursor: default;
 }
 #hmenu ul li a {
-	width: 80pt;
-	line-height: 36px;
+	width: 80px;
+	line-height: 32px;
 	display: block;
-	color: #3088D4;
+	color: #78b1e2;
 }
 #hmenu .ula {
 	position: absolute;
-	top: 36px;
+	top: 32px;
 	background-color: rgba(0,0,0,0.85);
 	display: none;
 }
 #hmenu .ulb {
 	background-color: rgba(0,0,0,0.85);
-	left: 80pt;
+	left: 80px;
 	position: relative;
-	top: -36px;
+	top: -32px;
 	display: none;
 }
 #hmenu .ula li, .ulb li {
-	width: 80pt;
-	height: 36px;
+	width: 80px;
+	height: 32px;
 	display: block;
 	float: none;
 	text-align: center;
-	line-height: 36px;
+	line-height: 32px;
 	vertical-align: middle;
 }
 #hmenu .ula li:hover, .ulb li:hover {
 	text-decoration: underline;
 }
 #hmenu .hil {
-	background-color: rgba(255,255,255,0.10);
-	color: #97C3E9;
+	background-color: rgba(34,104,170,0.40);
+	color: white;
 }
 #hmenu .hil:hover {
 	cursor: default;
@@ -350,13 +373,18 @@ input {
 	position: fixed;
 	left: 50%;
 	transform: translateX(-50%);
-	margin-top: 36px;
+	top: 32px;
 	max-width: 100%;
 	background-color: rgba(0,0,0,0.85);
 	padding: 1px;
 	border-radius: 0 0 7px 7px;
 	font-size: 9pt;
 	color: #3088D4;
+	display: none;
+}
+#plancia .planciatab {
+	margin-right: auto;
+	margin-left: auto;
 }
 #plancia select, input, button {
 	margin: 0;
@@ -368,6 +396,9 @@ input {
 }
 /* questi li definisco e li applico solo per avere qualcosa su cui fare "querySelectorAll" */
 #plancia .openpar, .fieldsel, .condsel, .valuesel, .valueinp, .andor, .plusminus, .closepar { }
+#plancia .valuesel {
+	min-width: 120px;
+}
 #plancia .minus, .plus {
 	width: 22px;
 	height: 22px;
@@ -376,7 +407,22 @@ input {
 	cursor: pointer;
 }
 #plancia .ctrlbut {
+	font-weight: bold;
 	width: 100%;
+	min-width: 320px;
+}
+
+#helper, #debug {
+	position: fixed;
+	right: 0;
+	top: 32px;
+	width: 320px;
+	height: 240px;
+}
+
+#debug {
+	left: 0;
+	font-size: 8pt;
 }
 
 @media only screen and (max-width:720px) {

+ 5 - 5
web/admin/zzz-materiali/mastostart.sql

@@ -1,9 +1,9 @@
 -- phpMyAdmin SQL Dump
--- version 4.9.2
+-- version 5.0.0
 -- https://www.phpmyadmin.net/
 --
 -- Host: localhost
--- Creato il: Gen 01, 2020 alle 20:19
+-- Creato il: Gen 08, 2020 alle 14:46
 -- Versione del server: 10.4.11-MariaDB
 -- Versione PHP: 7.4.1
 
@@ -61,8 +61,7 @@ CREATE TABLE `Blacklist` (
 
 CREATE TABLE `Financing` (
   `ID` int(10) UNSIGNED NOT NULL,
-  `Type` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
-  `Details` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL
+  `Type` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 -- --------------------------------------------------------
@@ -164,7 +163,7 @@ CREATE TABLE `InstLangs` (
 CREATE TABLE `InstOurLangs` (
   `ID` bigint(20) UNSIGNED NOT NULL,
   `InstID` bigint(20) UNSIGNED NOT NULL,
-  `LangID` int(10) UNSIGNED NOT NULL,
+  `OurLangID` int(10) UNSIGNED NOT NULL,
   `Pos` tinyint(3) UNSIGNED NOT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
@@ -468,3 +467,4 @@ COMMIT;
 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+