Ordinamento, CSS
This commit is contained in:
parent
a8a72189f2
commit
0eb77c4cfd
6 changed files with 176 additions and 51 deletions
|
@ -3,6 +3,7 @@
|
|||
* fatto
|
||||
~ più o meno
|
||||
|
||||
* quando ordinamento è su una "1 a molti", eseguirlo su "GROUP_CONCAT" di questi molti ordinati per "Pos" della joinosa tabella
|
||||
* 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 ()
|
||||
* instances.php: definito/non definito non vengono riprodotte bene dalla plancia dopo post
|
||||
|
|
|
@ -88,18 +88,7 @@ function booly($pre,$val,$nottoobad=false,$invcol=false) {
|
|||
|
||||
$dbg.='<pre>'.print_r($_POST,1).'</pre>';
|
||||
|
||||
function aske($key,&$arr) {
|
||||
$count=count($arr);
|
||||
$found=false;
|
||||
$i=0;
|
||||
while (!$found && $i<$count) {
|
||||
if (array_key_exists($key,$arr[$i]))
|
||||
$found=true;
|
||||
else
|
||||
$i++;
|
||||
}
|
||||
return($found);
|
||||
}
|
||||
/*SELECT *, Instances.ID AS IID, GROUP_CONCAT(OrdOurLanguages.NameIt ORDER BY OrdInstOurLangs.Pos ASC SEPARATOR '; ') AS OrdOurLangs FROM Instances LEFT JOIN InstOurLangs ON InstOurLangs.InstID=Instances.ID LEFT JOIN Languages AS OurLanguages ON OurLanguages.ID=InstOurLangs.OurLangID LEFT JOIN InstOurLangs AS OrdInstOurLangs ON OrdInstOurLangs.InstID=Instances.ID LEFT JOIN Languages AS OrdOurLanguages ON OrdOurLanguages.ID=OrdInstOurLangs.OurLangID WHERE OurLanguages.NameIT LIKE '%italiano%' GROUP BY IID LIMIT 50*/
|
||||
|
||||
$cols=array(
|
||||
'Instances.New'=>array('field'=>'Instances.New','name'=>'Nuova','type'=>'bool'),
|
||||
|
@ -113,8 +102,17 @@ $cols=array(
|
|||
'Instances.LongDesc'=>array('field'=>'Instances.LongDesc','name'=>'Descrizione lunga','type'=>'text'),
|
||||
'Instances.OurDesc'=>array('field'=>'Instances.OurDesc','name'=>'Descrizione nostra','type'=>'text'),
|
||||
|
||||
'Instances.PlaceID'=>array('field'=>'Instances.PlaceID','name'=>'Località ⮞','type'=>'join','join'=>array(),'ord'=>false),
|
||||
'Places.Locality'=>array('field'=>'Places.Locality','name'=>'Località','type'=>'joini','join'=>array('Places ON Places.ID=Instances.PlaceID'),'subtype'=>'text'),
|
||||
'Instances.LocalityID'=>array('field'=>'Instances.LocalityID','name'=>'Località ⮞','type'=>'join','join'=>array(),'ord'=>false),
|
||||
'Localities.Locality'=>array('field'=>'Localities.Locality','name'=>'Località','type'=>'joini','join'=>array('Localities ON Localities.ID=Instances.LocalityID'),'subtype'=>'text'),
|
||||
|
||||
'Provinces.ID'=>array('field'=>'Provinces.ID','name'=>'Provincia ⮞','type'=>'join','join'=>array('Localities ON Localities.ID=Instances.LocalityID','Provinces ON Provinces.ID=Localities.ProvinceID'),'ord'=>false),
|
||||
'Provinces.Province'=>array('field'=>'Provinces.Province','name'=>'Provincia','type'=>'joini','join'=>array('Localities ON Localities.ID=Instances.LocalityID','Provinces ON Provinces.ID=Localities.ProvinceID'),'subtype'=>'text'),
|
||||
|
||||
'Regions.ID'=>array('field'=>'Regions.ID','name'=>'Regione ⮞','type'=>'join','join'=>array('Localities ON Localities.ID=Instances.LocalityID','Provinces ON Provinces.ID=Localities.ProvinceID','Regions ON Regions.ID=Provinces.RegionID'),'ord'=>false),
|
||||
'Regions.Region'=>array('field'=>'Regions.Region','name'=>'Regione','type'=>'joini','join'=>array('Localities ON Localities.ID=Instances.LocalityID','Provinces ON Provinces.ID=Localities.ProvinceID','Regions ON Regions.ID=Provinces.RegionID'),'subtype'=>'text'),
|
||||
|
||||
'States.ID'=>array('field'=>'States.ID','name'=>'Stato ⮞','type'=>'join','join'=>array('Localities ON Localities.ID=Instances.LocalityID','Provinces ON Provinces.ID=Localities.ProvinceID','Regions ON Regions.ID=Provinces.RegionID','States ON States.ID=Regions.StateID'),'ord'=>false),
|
||||
'States.State'=>array('field'=>'States.State','name'=>'Stato','type'=>'joini','join'=>array('Localities ON Localities.ID=Instances.LocalityID','Provinces ON Provinces.ID=Localities.ProvinceID','Regions ON Regions.ID=Provinces.RegionID','States ON States.ID=Regions.StateID'),'subtype'=>'text'),
|
||||
|
||||
'Instances.Email'=>array('field'=>'Instances.Email','name'=>'Email di contatto','type'=>'text'),
|
||||
'Instances.Software'=>array('field'=>'Instances.Software','name'=>'Software','type'=>'text'),
|
||||
|
@ -136,29 +134,29 @@ $cols=array(
|
|||
'Instances.AdmNote'=>array('field'=>'Instances.AdmNote','name'=>'Note dell’admin','type'=>'text'),
|
||||
|
||||
'InstLangs.LangID'=>array('field'=>'InstLangs.LangID','name'=>'Lingue dichiarate ⮞','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID'),'ord'=>false),
|
||||
'Languages.NameIT'=>array('field'=>'Languages.NameIT','name'=>'Lingue dichiarate','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','ord'=>false),
|
||||
'Languages.NameIT'=>array('field'=>'Languages.NameIT','name'=>'Lingue dichiarate','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','ord'=>true,'ordjoin'=>array('InstLangs AS OrdInstLangs ON OrdInstLangs.InstID=Instances.ID','Languages AS OrdLanguages ON OrdLanguages.ID=OrdInstLangs.LangID'),'ordselmore'=>'GROUP_CONCAT(OrdLanguages.NameIT ORDER BY OrdInstLangs.Pos ASC SEPARATOR \'\') AS xOrdLangs','ordby'=>'xOrdLangs'),
|
||||
'InstLangs.LangID.First'=>array('field'=>'InstLangs.LangID','name'=>'Lingua primaria dichiarata ⮞','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID'),'wheremore'=>'AND InstLangs.Pos=1','ord'=>false),
|
||||
'Languages.NameIT.First'=>array('field'=>'Languages.NameIT','name'=>'Lingua primaria dichiarata','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','wheremore'=>'AND InstLangs.Pos=1'),
|
||||
'Languages.NameIT.First'=>array('field'=>'Languages.NameIT','name'=>'Lingua primaria dichiarata','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','wheremore'=>'AND InstLangs.Pos=1','ord'=>false),
|
||||
|
||||
'InstOurLangs.OurLangID'=>array('field'=>'InstOurLangs.OurLangID','name'=>'Lingue impostate da noi ⮞','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID'),'ord'=>false),
|
||||
'OurLanguages.NameIT'=>array('field'=>'OurLanguages.NameIT','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','ord'=>false),
|
||||
'OurLanguages.NameIT'=>array('field'=>'OurLanguages.NameIT','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','ord'=>true,'ordjoin'=>array('InstOurLangs AS OrdInstOurLangs ON OrdInstOurLangs.InstID=Instances.ID','Languages AS OrdOurLanguages ON OrdOurLanguages.ID=OrdInstOurLangs.OurLangID'),'ordselmore'=>'GROUP_CONCAT(OrdOurLanguages.NameIT ORDER BY OrdInstOurLangs.Pos ASC SEPARATOR \'\') AS xOrdOurLangs','ordby'=>'xOrdOurLangs'),
|
||||
'InstOurLangs.OurLangID.First'=>array('field'=>'InstOurLangs.OurLangID','name'=>'Lingua primaria impostata da noi ⮞','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID'),'wheremore'=>'AND InstOurLangs.Pos=1','ord'=>false),
|
||||
'OurLanguages.NameIT.First'=>array('field'=>'OurLanguages.NameIT','name'=>'Lingua primaria impostata da noi','type'=>'joini','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID','Languages AS OurLanguages ON OurLanguages.ID=InstOurLangs.OurLangID'),'subtype'=>'text','wheremore'=>'AND InstOurLangs.Pos=1'),
|
||||
'OurLanguages.NameIT.First'=>array('field'=>'OurLanguages.NameIT','name'=>'Lingua primaria impostata da noi','type'=>'joini','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID','Languages AS OurLanguages ON OurLanguages.ID=InstOurLangs.OurLangID'),'subtype'=>'text','wheremore'=>'AND InstOurLangs.Pos=1','ord'=>false),
|
||||
|
||||
'InstFinancing.FinID'=>array('field'=>'InstFinancing.FinID','name'=>'Modalità di finanziamento ⮞','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID'),'ord'=>false),
|
||||
'Financing.Type'=>array('field'=>'Financing.Type','name'=>'Modalità di finanziamento','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text'),
|
||||
'Financing.Type'=>array('field'=>'Financing.Type','name'=>'Modalità di finanziamento','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text','ord'=>true,'ordjoin'=>array('InstFinancing AS OrdInstFinancing ON OrdInstFinancing.InstID=Instances.ID','Financing AS OrdFinancing ON OrdFinancing.ID=OrdInstFinancing.FinID'),'ordselmore'=>'GROUP_CONCAT(OrdFinancing.Type ORDER BY OrdInstFinancing.Pos ASC SEPARATOR \'\') AS xOrdFinancing','ordby'=>'xOrdFinancing'),
|
||||
'InstFinancing.FinID.First'=>array('field'=>'InstFinancing.FinID','name'=>'Modalità di finanziamento primaria ⮞','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID'),'wheremore'=>'AND InstFinancing.Pos=1','ord'=>false),
|
||||
'Financing.Type.First'=>array('field'=>'Financing.Type','name'=>'Modalità di finanziamento primaria','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text','wheremore'=>'AND InstFinancing.Pos=1'),
|
||||
'Financing.Type.First'=>array('field'=>'Financing.Type','name'=>'Modalità di finanziamento primaria','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text','wheremore'=>'AND InstFinancing.Pos=1','ord'=>false),
|
||||
|
||||
'InstPolicies.PolID'=>array('field'=>'InstPolicies.PolID','name'=>'Restrizioni sui contenuti ⮞','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID'),'ord'=>false),
|
||||
'Policies.Name'=>array('field'=>'Policies.Name','name'=>'Restrizioni sui contenuti','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies ON Policies.ID=InstPolicies.PolID'),'subtype'=>'text'),
|
||||
'Policies.Name'=>array('field'=>'Policies.Name','name'=>'Restrizioni sui contenuti','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies ON Policies.ID=InstPolicies.PolID'),'subtype'=>'text','ord'=>true,'ordjoin'=>array('InstPolicies AS OrdInstPolicies ON OrdInstPolicies.InstID=Instances.ID','Policies AS OrdPolicies ON OrdPolicies.ID=OrdInstPolicies.PolID'),'ordselmore'=>'GROUP_CONCAT(OrdPolicies.Name ORDER BY OrdInstPolicies.Pos ASC SEPARATOR \'\') AS xOrdPolicies','ordby'=>'xOrdPolicies'),
|
||||
'InstPolicies.PolID.First'=>array('field'=>'InstPolicies.PolID','name'=>'Restrizione sui contenuti primaria ⮞','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID'),'wheremore'=>'AND InstPolicies.Pos=1','ord'=>false),
|
||||
'Policies.Name.First'=>array('field'=>'Policies.Name','name'=>'Restrizione sui contenuti primaria','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies ON Policies.ID=InstPolicies.PolID'),'subtype'=>'text','wheremore'=>'AND InstPolicies.Pos=1'),
|
||||
'Policies.Name.First'=>array('field'=>'Policies.Name','name'=>'Restrizione sui contenuti primaria','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies ON Policies.ID=InstPolicies.PolID'),'subtype'=>'text','wheremore'=>'AND InstPolicies.Pos=1','ord'=>false),
|
||||
|
||||
'InstTags.TagID'=>array('field'=>'InstTags.TagID','name'=>'Tags ⮞','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID'),'ord'=>false),
|
||||
'Tags.Name'=>array('field'=>'Tags.Name','name'=>'Tags','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text'),
|
||||
'Tags.Name'=>array('field'=>'Tags.Name','name'=>'Tags','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text','ord'=>true,'ordjoin'=>array('InstTags AS OrdInstTags ON OrdInstTags.InstID=Instances.ID','Tags AS OrdTags ON OrdTags.ID=OrdInstTags.TagID'),'ordselmore'=>'GROUP_CONCAT(OrdTags.Name ORDER BY OrdInstTags.Pos ASC SEPARATOR \'\') AS xOrdTags','ordby'=>'xOrdTags'),
|
||||
'InstTags.TagID.First'=>array('field'=>'InstTags.TagID','name'=>'Tag primaria ⮞','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID'),'wheremore'=>'AND InstTags.Pos=1','ord'=>false),
|
||||
'Tags.Name.First'=>array('field'=>'Tags.Name','name'=>'Tag primaria','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text','wheremore'=>'AND InstTags.Pos=1'),
|
||||
'Tags.Name.First'=>array('field'=>'Tags.Name','name'=>'Tag primaria','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text','wheremore'=>'AND InstTags.Pos=1','ord'=>false),
|
||||
|
||||
/*'Statuses'=>array('name'=>'Stati ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','selmore'=>'MAX(Week) AS maxweek'),
|
||||
'Logins'=>array('name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','selmore'=>'MAX(Week) AS maxweek'),
|
||||
|
@ -191,11 +189,15 @@ foreach ($_POST as $key=>$val)
|
|||
if (preg_match('/^openpar-\d+$/',$key)===1)
|
||||
$pblocks++;
|
||||
$i=0;
|
||||
$ii=0;
|
||||
$jsaddrows='';
|
||||
$jssetrows='';
|
||||
$jsordaddrows='';
|
||||
$jsordsetrows='';
|
||||
$sels=array();
|
||||
$joins=array();
|
||||
$where='';
|
||||
$order='';
|
||||
foreach ($_POST as $key=>$val) {
|
||||
if (preg_match('/^openpar-\d+$/',$key)===1) {
|
||||
$i++;
|
||||
|
@ -217,8 +219,6 @@ foreach ($_POST as $key=>$val) {
|
|||
if (!in_array($join,$joins))
|
||||
$joins[]=$join;
|
||||
}
|
||||
/* if (array_key_exists('selmore',$cols[$col]) && !in_array($cols[$col]['selmore'],$sels))
|
||||
$sels[]=$cols[$col]['selmore'];*/
|
||||
}
|
||||
$jssetrows.=','.json_encode($val);
|
||||
} else {
|
||||
|
@ -260,11 +260,49 @@ foreach ($_POST as $key=>$val) {
|
|||
$where.=' '.$val.' ';
|
||||
$jssetrows.=','.json_encode($val).');'.N;
|
||||
}
|
||||
|
||||
if (preg_match('/^ordfieldsel-\d+$/',$key)===1 && preg_match('/^(.+):(.+):(.+)$/',$val,$buf)===1) {
|
||||
$ii++;
|
||||
$col=$buf[1];
|
||||
$type=$buf[2];
|
||||
$subtype=$buf[3];
|
||||
if (array_key_exists($col,$cols) && in_array($type,$types)) {
|
||||
if (!array_key_exists('ordby',$cols[$col])) {
|
||||
$order.=$cols[$col]['field'];
|
||||
if ($type=='join' || $type=='joini') {
|
||||
foreach ($cols[$col]['join'] as $join)
|
||||
if (!in_array($join,$joins))
|
||||
$joins[]=$join;
|
||||
}
|
||||
} else {
|
||||
// qui si dà per scontato che se 'ordby' esiste esistono anche 'ordselmore' e 'ordjoin'
|
||||
if (!in_array($cols[$col]['ordselmore'],$sels))
|
||||
$sels[]=$cols[$col]['ordselmore'];
|
||||
foreach ($cols[$col]['ordjoin'] as $join)
|
||||
if (!in_array($join,$joins))
|
||||
$joins[]=$join;
|
||||
$order.=$cols[$col]['ordby'];
|
||||
}
|
||||
$jsordaddrows.='ordaddrow('.$ii.',false);'.N;
|
||||
$jsordsetrows.='ordsetrow('.$ii.','.json_encode($val);
|
||||
} else {
|
||||
muoribene($dbg.'<br>Dati POST corrotti.<br>Puoi <a href="instances.php">riprovare resettando i parametri</a> o <a href="index.php">tornare al login</a>.',true);
|
||||
}
|
||||
}
|
||||
if (preg_match('/^ascdesc-\d+$/',$key)===1 && preg_match('/^ASC|DESC$/',$val)===1) {
|
||||
$order.=' '.$val.', ';
|
||||
$jsordsetrows.=','.json_encode($val).');'.N;
|
||||
}
|
||||
|
||||
}
|
||||
if ($jsaddrows!='') {
|
||||
$jsaddrows.='document.getElementById("filbut").value="Rimuovi tutti i criteri di ricerca";'.N;
|
||||
$jsaddrows.='synctai();'.N;
|
||||
}
|
||||
if ($jsordaddrows!='') {
|
||||
$jsordaddrows.='document.getElementById("ordbut").value="Rimuovi tutti i criteri di ordinamento";'.N;
|
||||
$jsordaddrows.='synctoi();'.N;
|
||||
}
|
||||
|
||||
if (count($sels)>0)
|
||||
$sels=', '.implode(', ',$sels);
|
||||
|
@ -272,12 +310,15 @@ else
|
|||
$sels='';
|
||||
if ($where!='')
|
||||
$where='WHERE '.$where;
|
||||
if ($order!='')
|
||||
$order='ORDER BY '.substr($order,0,-2);
|
||||
$dbg.='ORDER: '.$order.'<br>';
|
||||
if (count($joins)>0)
|
||||
$joins='LEFT JOIN '.implode(' LEFT JOIN ',$joins);
|
||||
else
|
||||
$joins='';
|
||||
|
||||
$query='SELECT *, Instances.ID AS IID'.$sels.' FROM Instances '.$joins.' '.$where.' GROUP BY IID ORDER BY Instances.URI ASC LIMIT 50';
|
||||
$query='SELECT *, Instances.ID AS IID'.$sels.' FROM Instances '.$joins.' '.$where.' GROUP BY IID '.$order.' LIMIT 50';
|
||||
$dbg.='QUERONA: '.$query.'<br>'.N;
|
||||
$tini=microtime(true);
|
||||
$res=mysqli_query($link,$query)
|
||||
|
@ -359,12 +400,12 @@ if (mysqli_num_rows($res)<1) {
|
|||
$out.='<div class="baloo"><span class="field">'.$cols['Instances.LongDesc']['name'].':</span> '.nully($row['LongDesc'],true,'strip').'</div>'.N;
|
||||
// 'strip' o 'htmlent' per la descrizione nostra?
|
||||
$out.='<div class="baloo"><span class="ourfield">'.$cols['Instances.OurDesc']['name'].':</span> '.nully($row['OurDesc'],true,'strip').'</div>'.N;
|
||||
$out.='<div class="baloo"><span class="ourfield">'.$cols['Places.Locality']['name'].':</span> ';
|
||||
if (!is_null($row['PlaceID'])) {
|
||||
$sres=mysqli_query($link,'SELECT * FROM Places WHERE Places.ID='.$row['PlaceID'])
|
||||
$out.='<div class="baloo"><span class="ourfield">'.$cols['Localities.Locality']['name'].':</span> ';
|
||||
if (!is_null($row['LocalityID'])) {
|
||||
$sres=mysqli_query($link,'SELECT * FROM Localities LEFT JOIN Provinces ON Provinces.ID=Localities.ProvinceID LEFT JOIN Regions ON Regions.ID=Provinces.RegionID LEFT JOIN States ON States.ID=Regions.StateID WHERE Localities.ID='.$row['LocalityID'])
|
||||
or muoribene(mysqli_error($link),true);
|
||||
$srow=mysqli_fetch_assoc($sres);
|
||||
$out.=hspech($srow['Locality']).'</div>'.N;
|
||||
$out.=hspech($srow['Locality']).' ('.$srow['Province'].', '.$srow['Region'].', '.$srow['State'].')</div>'.N;
|
||||
} else {
|
||||
$out.='<span class="nully">Non definita</span></div>'.N;
|
||||
}
|
||||
|
@ -648,6 +689,24 @@ function addrow(index,refresh) {
|
|||
popusels(index,false);
|
||||
}
|
||||
}
|
||||
function ordaddrow(index,refresh) {
|
||||
var table=document.getElementById('planciaord');
|
||||
var newrow=table.insertRow(index);
|
||||
var newcell0=newrow.insertCell(0);
|
||||
var newcell1=newrow.insertCell(1);
|
||||
var newcell2=newrow.insertCell(2);
|
||||
var newcell3=newrow.insertCell(3);
|
||||
newcell0.style.width='97%';
|
||||
newcell1.style.width='1%';
|
||||
newcell2.style.width='1%';
|
||||
newcell3.style.width='1%';
|
||||
newcell0.innerHTML='<select class="ordfieldsel"><?php echo($ordfieldselopts); ?></select>';
|
||||
newcell1.innerHTML='<select class="ascdesc"><option value="ASC">Crescente</option><option value="DESC">Decrescente</option></select>';
|
||||
newcell2.innerHTML='<img class="plus" src="imgs/plus.svg">';
|
||||
newcell3.innerHTML='<img class="minus" src="imgs/minus.svg">';
|
||||
if (refresh)
|
||||
synctoi();
|
||||
}
|
||||
function synctai() {
|
||||
var i=0;
|
||||
var table=document.getElementById('planciafil');
|
||||
|
@ -703,6 +762,31 @@ function synctai() {
|
|||
if (cnodes>=0)
|
||||
nodes[cnodes].disabled=true;
|
||||
}
|
||||
function synctoi() {
|
||||
var i=0;
|
||||
var table=document.getElementById('planciaord');
|
||||
var nodes=table.querySelectorAll('.minus');
|
||||
var cnodes=nodes.length;
|
||||
for (i=0; i<cnodes; i++)
|
||||
// +1 sempre per via della row iniziale
|
||||
nodes[i].setAttribute('onclick','ordremrow('+(i+1)+');');
|
||||
nodes=table.querySelectorAll('.plus');
|
||||
for (i=0; i<cnodes; i++)
|
||||
// +2 perché la devi aggiungere dopo la corrente
|
||||
nodes[i].setAttribute('onclick','ordaddrow('+(i+2)+',true);');
|
||||
// da qui in poi faccio a scendere per non avere mai id e nomi duplicati
|
||||
cnodes--;
|
||||
nodes=table.querySelectorAll('.ordfieldsel');
|
||||
for (i=cnodes; i>-1; i--) {
|
||||
nodes[i].setAttribute('id','ordfieldsel-'+(i+1));
|
||||
nodes[i].setAttribute('name','ordfieldsel-'+(i+1));
|
||||
}
|
||||
nodes=table.querySelectorAll('.ascdesc');
|
||||
for (i=cnodes; i>-1; i--) {
|
||||
nodes[i].setAttribute('id','ascdesc-'+(i+1));
|
||||
nodes[i].setAttribute('name','ascdesc-'+(i+1));
|
||||
}
|
||||
}
|
||||
function selind(id,val) {
|
||||
var el=document.getElementById(id), i=0, found=false;
|
||||
while (!found && i<el.length) {
|
||||
|
@ -729,6 +813,10 @@ function setrow(index,openparv,fieldselv,condselv,valueselv,valueinpv,closeparv,
|
|||
selind('closepar-'+index,closeparv);
|
||||
selind('andor-'+index,andorv);
|
||||
}
|
||||
function ordsetrow(index,ordfieldselv,ascdescv) {
|
||||
selind('ordfieldsel-'+index,ordfieldselv);
|
||||
selind('ascdesc-'+index,ascdescv);
|
||||
}
|
||||
function remrow(index) {
|
||||
var table=document.getElementById('planciafil');
|
||||
table.deleteRow(index);
|
||||
|
@ -736,11 +824,23 @@ function remrow(index) {
|
|||
if (table.rows.length<2)
|
||||
document.getElementById('filbut').value='Aggiungi criteri di ricerca';
|
||||
}
|
||||
function ordremrow(index) {
|
||||
var table=document.getElementById('planciaord');
|
||||
table.deleteRow(index);
|
||||
synctoi();
|
||||
if (table.rows.length<2)
|
||||
document.getElementById('ordbut').value='Aggiungi criteri di ordinamento';
|
||||
}
|
||||
function truncfil() {
|
||||
var table=document.getElementById('planciafil');
|
||||
while (table.rows.length>1)
|
||||
remrow(1);
|
||||
}
|
||||
function truncord() {
|
||||
var table=document.getElementById('planciaord');
|
||||
while (table.rows.length>1)
|
||||
ordremrow(1);
|
||||
}
|
||||
function manfil() {
|
||||
var filbut=document.getElementById('filbut');
|
||||
var table=document.getElementById('planciafil');
|
||||
|
@ -749,7 +849,18 @@ function manfil() {
|
|||
addrow(1,true);
|
||||
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\'');
|
||||
confirma('<p>Confermi di voler rimuovere tutti i criteri di ricerca?</p>','truncfil();filbut.value=\'Aggiungi criteri di ricerca\'');
|
||||
}
|
||||
}
|
||||
function manord() {
|
||||
var ordbut=document.getElementById('ordbut');
|
||||
var table=document.getElementById('planciaord');
|
||||
var crows=table.rows.length;
|
||||
if (crows<2) {
|
||||
ordaddrow(1,true);
|
||||
ordbut.value='Rimuovi tutti i criteri di ordinamento';
|
||||
} else {
|
||||
confirma('<p>Confermi di voler rimuovere tutti i criteri di ordinamento?</p>','truncord();ordbut.value=\'Aggiungi criteri di ordinamento\'');
|
||||
}
|
||||
}
|
||||
function ckpar() {
|
||||
|
@ -795,7 +906,7 @@ function ckf() {
|
|||
document.getElementById('andor-'+(crows-1)).disabled=false;
|
||||
document.getElementById('f').submit();
|
||||
} else {
|
||||
alerta(emsg);
|
||||
alerta('<p>'+emsg+'</p>');
|
||||
}
|
||||
}
|
||||
//-->
|
||||
|
@ -838,7 +949,7 @@ function ckf() {
|
|||
<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>
|
||||
<tr><td colspan="4"><input type="button" id="ordbut" value="Aggiungi criteri di ordinamento" class="ctrlbut" onclick="manord();"></td></tr>
|
||||
</table>
|
||||
<table id="planciaothers" class="planciatab">
|
||||
<tr><td><input type="button" id="subbut" value="Applica" class="ctrlbut" onclick="ckf();"></td></tr>
|
||||
|
@ -851,6 +962,8 @@ function ckf() {
|
|||
<?php
|
||||
echo($jsaddrows);
|
||||
echo($jssetrows);
|
||||
echo($jsordaddrows);
|
||||
echo($jsordsetrows);
|
||||
?>
|
||||
//-->
|
||||
</script>
|
||||
|
|
|
@ -8,7 +8,13 @@ require('include/sessionstart.php');
|
|||
|
||||
$cols=array(
|
||||
|
||||
'Instances.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 GROUP BY Pid ORDER BY Locality ASC','optcol'=>'Pid','txtcol'=>'Txt'),
|
||||
'Instances.LocalityID'=>array('select'=>'SELECT Localities.ID AS Lid, CONCAT(Locality,\' (\',Province,\', \',Region,\', \',State,\') (\',COUNT(Localities.ID),\')\') AS Txt FROM Instances LEFT JOIN Localities ON Localities.ID=Instances.LocalityID LEFT JOIN Provinces ON Provinces.ID=Localities.ProvinceID LEFT JOIN Regions ON Regions.ID=Provinces.RegionID LEFT JOIN States ON States.ID=Regions.StateID WHERE Instances.LocalityID IS NOT NULL GROUP BY Lid ORDER BY Localities.Locality ASC, Provinces.Province ASC, Regions.Region ASC, States.State ASC','optcol'=>'Lid','txtcol'=>'Txt'),
|
||||
|
||||
'Provinces.ID'=>array('select'=>"SELECT Provinces.ID AS Pid, CONCAT(Province,' (',Region,', ',State,') (',COUNT(Localities.ID),')') AS Txt FROM Instances LEFT JOIN Localities ON Localities.ID=Instances.LocalityID LEFT JOIN Provinces ON Provinces.ID=Localities.ProvinceID LEFT JOIN Regions ON Regions.ID=Provinces.RegionID LEFT JOIN States ON States.ID=Regions.StateID WHERE Instances.LocalityID IS NOT NULL GROUP BY Pid ORDER BY Provinces.Province ASC, Regions.Region ASC, States.State ASC",'optcol'=>'Pid','txtcol'=>'Txt'),
|
||||
|
||||
'Regions.ID'=>array('select'=>"SELECT Regions.ID AS Rid, CONCAT(Region,' (',State,') (',COUNT(Regions.ID),')') AS Txt FROM Instances LEFT JOIN Localities ON Localities.ID=Instances.LocalityID LEFT JOIN Provinces ON Provinces.ID=Localities.ProvinceID LEFT JOIN Regions ON Regions.ID=Provinces.RegionID LEFT JOIN States ON States.ID=Regions.StateID WHERE Instances.LocalityID IS NOT NULL GROUP BY Rid ORDER BY Regions.Region ASC, States.State ASC",'optcol'=>'Rid','txtcol'=>'Txt'),
|
||||
|
||||
'States.ID'=>array('select'=>"SELECT States.ID AS Sid, CONCAT(State,' (',COUNT(States.ID),')') AS Txt FROM Instances LEFT JOIN Localities ON Localities.ID=Instances.LocalityID LEFT JOIN Provinces ON Provinces.ID=Localities.ProvinceID LEFT JOIN Regions ON Regions.ID=Provinces.RegionID LEFT JOIN States ON States.ID=Regions.StateID WHERE Instances.LocalityID IS NOT NULL GROUP BY Sid ORDER BY States.State ASC",'optcol'=>'Sid','txtcol'=>'Txt'),
|
||||
|
||||
'InstLangs.LangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', 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'),
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function alerta(msg) {
|
||||
document.getElementById('popupcont').innerHTML='<h3>Attenzione</h3>'+msg+'<input type="button" class="pupbut" value="Ok" onClick="document.getElementById(\'popup\').style.display=\'none\'">';
|
||||
document.getElementById('popupcont').innerHTML='<h2>Attenzione</h2>'+msg+'<input type="button" value="Ok" onClick="document.getElementById(\'popup\').style.display=\'none\'">';
|
||||
document.getElementById('popup').style.display='table';
|
||||
}
|
||||
|
|
|
@ -1,4 +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('popupcont').innerHTML='<h2>Attenzione</h2>'+msg+'<input type="button" value="No" onClick="document.getElementById(\'popup\').style.display=\'none\'"><input type="button" style="margin-top:2px;" value="Si" onClick="'+act+';document.getElementById(\'popup\').style.display=\'none\'">';
|
||||
document.getElementById('popup').style.display='table';
|
||||
}
|
||||
|
|
|
@ -249,17 +249,23 @@ input {
|
|||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
border: 1px solid gray;
|
||||
width: 200px;
|
||||
width: 260px;
|
||||
background-color: white;
|
||||
border-radius: 9px;
|
||||
color: black;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
.pupbut {
|
||||
margin-top: 5px;
|
||||
#popupcont input {
|
||||
width: 100%;
|
||||
height: 24px;
|
||||
font-size: 9pt;
|
||||
}
|
||||
#popupcont p {
|
||||
font-size: 10pt;
|
||||
margin-top: 3px;
|
||||
margin-bottom: 5px;
|
||||
padding: 0;
|
||||
}
|
||||
#footer {
|
||||
color: white;
|
||||
|
@ -330,7 +336,7 @@ input {
|
|||
top: -32px;
|
||||
display: none;
|
||||
}
|
||||
#hmenu .ula li, .ulb li {
|
||||
#hmenu .ula li, #hmenu .ulb li {
|
||||
width: 80px;
|
||||
height: 32px;
|
||||
display: block;
|
||||
|
@ -339,7 +345,7 @@ input {
|
|||
line-height: 32px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#hmenu .ula li:hover, .ulb li:hover {
|
||||
#hmenu .ula li:hover, #hmenu .ulb li:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
#hmenu .hil {
|
||||
|
@ -350,7 +356,7 @@ input {
|
|||
cursor: default;
|
||||
text-decoration: none;
|
||||
}
|
||||
#hmenu .ula li.hil:hover, .ulb li.hil:hover {
|
||||
#hmenu .ula li.hil:hover, #hmenu .ulb li.hil:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
@ -393,8 +399,9 @@ input {
|
|||
#plancia .planciatab {
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
width: 100%;
|
||||
}
|
||||
#plancia select, input, button {
|
||||
#plancia select, #plancia input, #plancia button {
|
||||
margin: 0;
|
||||
height: 24px;
|
||||
font-size: 8pt;
|
||||
|
@ -403,18 +410,15 @@ input {
|
|||
width: 120px;
|
||||
}
|
||||
/* 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 .valuesel:disabled, .valueinp:disabled {
|
||||
#plancia .openpar, #plancia .fieldsel, #plancia .condsel, #plancia .valuesel, #plancia .valueinp, #plancia .andor, #plancia .plusminus, #plancia .closepar, #plancia .ordfieldsel, #plancia .ascdesc { min-width: 100%; }
|
||||
#plancia .valuesel:disabled, #plancia .valueinp:disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
#plancia .minus, .plus {
|
||||
#plancia .minus, #plancia .plus {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
#plancia .minus:hover, .plus:hover {
|
||||
#plancia .minus:hover, #plancia .plus:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
#plancia .ctrlbut {
|
||||
|
@ -430,6 +434,7 @@ input {
|
|||
width: 320px;
|
||||
height: 240px;
|
||||
font-size: 8pt;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
@media only screen and (max-width:720px) {
|
||||
|
|
Loading…
Reference in a new issue