1
0
Fork 0
This commit is contained in:
pezcurrel 2020-01-11 20:05:15 +01:00
parent 5d6d4d8fb7
commit ee5097b537
6 changed files with 152 additions and 117 deletions

View file

@ -1,2 +1,9 @@
- ripristinare le colonne descrittive in Languages: una per la locale impostata (it), una per en, una per fr, una per sp...
- dafa
? dafa?
* fatto
~ più o meno
* 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
? quando si seleziona definito/non definito, oltre a disabilitare il campo valsel/valinp, farlo sparire proprio? assegnargli un css che da disabilitato lo fa diventare tuttonero? tipo

View file

@ -100,7 +100,7 @@ $cols=array(
'LongDesc'=>array('name'=>'Descrizione lunga','type'=>'text'),
'OurDesc'=>array('name'=>'Descrizione nostra','type'=>'text'),
'PlaceID'=>array('name'=>'[Località]','type'=>'join','join'=>array()),
'PlaceID'=>array('name'=>'[Località]','type'=>'join','join'=>array(),'ord'=>false),
'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'),
@ -111,86 +111,68 @@ $cols=array(
'DomainCount'=>array('name'=>'Istanze note','type'=>'int'),
'ActiveUsersMonth'=>array('name'=>'Utenti attivi (mese)','type'=>'int'),
'ActiveUsersHalfYear'=>array('name'=>'Utenti attivi (6 mesi)','type'=>'int'),
'Thumb'=>array('name'=>'Logo','type'=>'text'),
'Thumb'=>array('name'=>'Logo','type'=>'text','search'=>false,'ord'=>false),
'RegOpen'=>array('name'=>'Registrazioni aperte','type'=>'bool'),
'RegReqApproval'=>array('name'=>'Approvazione registrazioni','type'=>'bool'),
'MaxTootChars'=>array('name'=>'Limite caratteri','type'=>'int'),
'AdmAccount'=>array('name'=>'Account admin','type'=>'text'),
'AdmDisplayName'=>array('name'=>'Nome account admin','type'=>'text'),
'AdmCreatedAt'=>array('name'=>'Data creazione account admin','type'=>'time'),
'AdmURL'=>array('name'=>'Pagina delladmin','type'=>'text'),
'AdmAvatar'=>array('name'=>'Avatar admin','type'=>'text'),
'AdmURL'=>array('name'=>'Pagina delladmin','type'=>'text','ord'=>false),
'AdmAvatar'=>array('name'=>'Avatar admin','type'=>'text','search'=>false,'ord'=>false),
'AdmNote'=>array('name'=>'Note delladmin','type'=>'text'),
'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'),
'LangID'=>array('name'=>'[Lingue dichiarate]','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID'),'ord'=>false),
'Languages.Code'=>array('name'=>'Lingue dichiarate','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','ord'=>false),
'InstLangs.LangID'=>array('name'=>'[Lingua primaria dichiarata]','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID'),'wheremore'=>'AND InstLangs.Pos=1','ord'=>false),
'Languages.NameIT'=>array('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'),
'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'),
'OurLangID'=>array('name'=>'[Lingue impostate da noi]','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID'),'ord'=>false),
'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','ord'=>false),
'InstOurLangs.OurLangID'=>array('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'=>array('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'),
'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'),
'FinID'=>array('name'=>'[Modalità di finanziamento]','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID'),'ord'=>false),
'Financing.Type'=>array('name'=>'Modalità di finanziamento','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text'),
'InstFinancing.FinID'=>array('name'=>'[Modalità di finanziamento primaria]','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID'),'wheremore'=>'AND InstFinancing.Pos=1','ord'=>false),
'XFinancing.Type'=>array('name'=>'Modalità di finanziamento primaria','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing AS XFinancing ON XFinancing.ID=InstFinancing.FinID'),'subtype'=>'text','wheremore'=>'AND InstFinancing.Pos=1'),
'PolID'=>array('name'=>'[Restrizioni sui contenuti]','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID')),
'PolID'=>array('name'=>'[Restrizioni sui contenuti]','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID'),'ord'=>false),
'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'),
'InstPolicies.PolID'=>array('name'=>'[Restrizione sui contenuti primaria]','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID'),'wheremore'=>'AND InstPolicies.Pos=1','ord'=>false),
'XPolicies.Name'=>array('name'=>'Restrizione sui contenuti primaria','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies AS XPolicies ON XPolicies.ID=InstPolicies.PolID'),'subtype'=>'text','wheremore'=>'AND InstPolicies.Pos=1'),
'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'),
'TagID'=>array('name'=>'[Tags]','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID'),'ord'=>false),
'Tags.Name'=>array('name'=>'Tags','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text'),
'InstTags.TagID'=>array('name'=>'[Tag primaria]','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID'),'wheremore'=>'AND InstTags.Pos=1','ord'=>false),
'XTags.Name'=>array('name'=>'Tag primaria','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags AS XTags ON XTags.ID=InstTags.TagID'),'subtype'=>'text','wheremore'=>'AND InstTags.Pos=1'),
/*'Statuses'=>array('name'=>'Stati ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','select'=>'MAX(Week) AS maxweek'),
'Logins'=>array('name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','select'=>'MAX(Week) AS maxweek'),
'Registrations'=>array('name'=>'Registrazioni ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','select'=>'MAX(Week) AS maxweek'),*/
/*'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'),
'Registrations'=>array('name'=>'Registrazioni ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','selmore'=>'MAX(Week) AS maxweek'),*/
);
$types=array('bool','int','time','text','join','joini');
$fieldselopts='';
$ordfieldselopts='';
foreach ($cols as $key=>$val) {
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>';
if (!array_key_exists('search',$val)) {
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>';
}
}
if (!array_key_exists('ord',$val)) {
if ($val['type']=='joini') {
$ordfieldselopts.='<option value="'.$key.':'.$val['type'].':'.$val['subtype'].'">'.$val['name'].'</option>';
} else {
$ordfieldselopts.='<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
[andor-6] => AND
*/
$i=0;
$jsaddrows='';
$jssetrows='';
@ -206,19 +188,21 @@ foreach ($_POST as $key=>$val) {
$jsaddrows.='addrow('.$i.',false);'.N;
$jssetrows.='setrow('.$i.','.json_encode($val);
}
if (preg_match('/^fieldsel-\d+/',$key)===1 && preg_match('/^(.+)§(.+)§(.+)$/',$val,$buf)===1) {
if (preg_match('/^fieldsel-\d+/',$key)===1 && preg_match('/^(.+):(.+):(.+)$/',$val,$buf)===1) {
$col=$buf[1];
$type=$buf[2];
$subtype=$buf[3];
if (array_key_exists($col,$cols) && in_array($type,$types)) {
if (array_key_exists('wheremore',$cols[$col]))
$where.='(';
$where.=$col;
if ($type=='join' || $type=='joini') {
foreach ($cols[$col]['join'] as $join) {
if (!in_array($join,$joins))
$joins[]=$join;
}
if ($type=='joini' && array_key_exists('select',$cols[$col]) && !in_array($cols[$col]['select'],$sels))
$sels[]=$cols[$col]['select'];
if (array_key_exists('selmore',$cols[$col]) && !in_array($cols[$col]['selmore'],$sels))
$sels[]=$cols[$col]['selmore'];
}
$jssetrows.=','.json_encode($val);
} else {
@ -229,9 +213,14 @@ foreach ($_POST as $key=>$val) {
$where.=' '.$val.' ';
$cond=$val;
$jssetrows.=','.json_encode($val);
// nel caso qui sotto, valuesel e valueinp sono entrambi disabilitati (non ci sono in $_POST), quindi li riempio di introvabile e nulla
if (preg_match('/^(IS NULL|IS NOT NULL)$/',$val)===1)
$jssetrows.=',"NOMMITROVI!",""';
}
if (preg_match('/^valuesel-\d+/',$key)===1) {
$where.=$val;
if (array_key_exists('wheremore',$cols[$col]))
$where.=' '.$cols[$col]['wheremore'].')';
$jssetrows.=','.json_encode($val);
$jssetrows.=',""';
}
@ -240,7 +229,9 @@ foreach ($_POST as $key=>$val) {
$where.='\'%'.myesc($link,$val).'%\'';
else
$where.='\''.myesc($link,$val).'\'';
$jssetrows.=',""';
if (array_key_exists('wheremore',$cols[$col]))
$where.=' '.$cols[$col]['wheremore'].')';
$jssetrows.=',"NOMMITROVIHODETTO!"';
$jssetrows.=','.json_encode($val);
}
if (preg_match('/^closepar-\d+/',$key)===1) {
@ -274,7 +265,7 @@ $query='SELECT *, Instances.ID AS IID'.$sels.' FROM Instances '.$joins.' '.$wher
$dbg.='QUERONA: '.$query.'<br>'.N;
$tini=microtime(true);
$res=mysqli_query($link,$query)
or muoribene($dbg.'<br>'.$query.': '.mysqli_error($link),true);
or muoribene($dbg.'<br>'.$query.': '.mysqli_error($link).'<br>'.'La query è fallita. <a href="instances.php">Resetta</a>.',true);
$dbg.='Durata esecuzione query: '.round(microtime(true)-$tini,4).' sec.<br>'.N;
if (mysqli_num_rows($res)<1) {
@ -352,7 +343,15 @@ if (mysqli_num_rows($res)<1) {
$out.='<div class="baloo"><span class="field">'.$cols['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['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;
$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'])
or muoribene(mysqli_error($link),true);
$srow=mysqli_fetch_assoc($sres);
$out.=hspech($srow['Locality']).'</div>'.N;
} else {
$out.='<span class="nully">Non definita</span></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),true);
if (mysqli_num_rows($sres)>0) {
@ -362,9 +361,9 @@ 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['LangID']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Languages.Code']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else {
$out.='<div class="baloo"><span class="field">'.$cols['LangID']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Languages.Code']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
}
$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);
@ -375,9 +374,9 @@ 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['OurLangID']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLanguages.Code']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else {
$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLangID']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLanguages.Code']['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),true);
@ -386,11 +385,11 @@ if (mysqli_num_rows($res)<1) {
$buf=array();
while ($srow=mysqli_fetch_assoc($sres)) {
$i++;
$buf[]=$i.': '.hspech($srow['Type']).' ('.hspech($row['Details']).')';
$buf[]=$i.': '.hspech($srow['Type']);
}
$out.='<div class="baloo"><span class="ourfield">'.$cols['FinID']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['Financing.Type']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else {
$out.='<div class="baloo"><span class="ourfield">'.$cols['FinID']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['Financing.Type']['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),true);
@ -401,9 +400,9 @@ if (mysqli_num_rows($res)<1) {
$i++;
$buf[]=$i.': '.hspech($srow['Name']);
}
$out.='<div class="baloo"><span class="ourfield">'.$cols['PolID']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['Policies.Name']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else {
$out.='<div class="baloo"><span class="ourfield">'.$cols['PolID']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['Policies.Name']['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),true);
@ -414,9 +413,9 @@ if (mysqli_num_rows($res)<1) {
$i++;
$buf[]=$i.': '.hspech($srow['Name']);
}
$out.='<div class="baloo"><span class="ourfield">'.$cols['TagID']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['Tags.Name']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else {
$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="ourfield">'.$cols['Tags.Name']['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;
@ -490,13 +489,13 @@ function golang(lang) {
function shideplancia() {
var plancia=document.getElementById('plancia');
var rightdiv=document.getElementById('rightdiv');
var plctrl=document.getElementById('plctrl');
if (plancia.style.display=='block') {
plancia.style.display='none';
rightdiv.innerHTML='Mostra plancia';
plctrl.innerHTML='Mostra plancia';
} else {
plancia.style.display='block';
rightdiv.innerHTML='Nascondi plancia';
plctrl.innerHTML='Nascondi plancia';
}
}
@ -525,9 +524,9 @@ function inpdisif(index) {
function popusels(index,valselval) {
console.log('Index: '+index);
var key=document.getElementById('fieldsel-'+index).value;
var type=key.replace(/^.*§(.*)§.*$/,'$1');
var subtype=key.replace(/^.*§.*§(.*)$/,'$1');
key=key.replace(/^(.*)§.*§.*$/,'$1');
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);
@ -541,6 +540,8 @@ function popusels(index,valselval) {
addselopt(valsel,'FALSE','falso');
addselopt(valsel,'NOT NULL','definito');
addselopt(valsel,'NULL','non definito');
if (valselval!==false)
selind('valuesel-'+index,valselval);
valinp.style='display:none';
valinp.disabled=true;
valsel.style='display:block';
@ -697,7 +698,7 @@ function selind(id,val) {
i++;
}
if (!found)
console.log(val+' non è stato trovato in '+id);
console.log('"'+val+'" non è stato trovato in "'+id+'"');
}
function setrow(index,openparv,fieldselv,condselv,valueselv,valueinpv,closeparv,andorv) {
selind('openpar-'+index,openparv);
@ -706,6 +707,10 @@ function setrow(index,openparv,fieldselv,condselv,valueselv,valueinpv,closeparv,
selind('condsel-'+index,condselv);
// selind('valuesel-'+index,valueselv);
document.getElementById('valueinp-'+index).value=valueinpv;
if (condselv=='IS NULL' || condselv=='IS NOT NULL') {
document.getElementById('valueinp-'+index).disabled=true;
document.getElementById('valuesel-'+index).disabled=true;
}
selind('closepar-'+index,closeparv);
selind('andor-'+index,andorv);
}
@ -767,11 +772,12 @@ function ckpar() {
function ckf() {
var emsg='';
if (!ckpar()) emsg+='Qualcosa non va con le parentesi!<br>\n';
emsg+='Comunque NO!<br>\n';
// emsg+='Comunque NO!<br>\n';
if (emsg=='') {
var table=document.getElementById('planciafil');
var crows=table.rows.length;
document.getElementById('andor-'+(crows-1)).disabled=false;
if (crows>1)
document.getElementById('andor-'+(crows-1)).disabled=false;
document.getElementById('f').submit();
} else {
alerta(emsg);
@ -787,7 +793,9 @@ function ckf() {
<ul>
<?php echo($menuout); ?>
</ul>
<div id="rightdiv" onclick="shideplancia();">Mostra plancia</div>
<div id="rightdiv">
<div id="plctrl" class="rlinks" onclick="shideplancia();">Mostra plancia</div>
<div id="logout" class="rlinks"><a href="logout.php">Esci</a></div>
</div>
</nav>

View file

@ -7,12 +7,28 @@ 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'),
'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'),
'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'),
'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 WHERE InstLangs.Pos=1 GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
'OurLangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', 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'),
'InstOurLangs.OurLangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID WHERE InstOurLangs.Pos=1 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'),
'InstFinancing.FinID'=>array('select'=>'SELECT Financing.ID AS Fid, CONCAT(Type,\' (\',COUNT(Financing.ID),\')\') AS Txt FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID WHERE InstFinancing.Pos=1 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'),
'InstPolicies.PolID'=>array('select'=>'SELECT Policies.ID AS Pid, CONCAT(Name,\' (\',COUNT(Policies.ID),\')\') AS Txt FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID WHERE InstPolicies.Pos=1 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'),
'InstTags.TagID'=>array('select'=>'SELECT Tags.ID AS Tid, CONCAT(Name,\' (\',COUNT(Tags.ID),\')\') AS Txt FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID WHERE InstTags.Pos=1 GROUP BY (Tags.ID) ORDER BY Name ASC','optcol'=>'Tid','txtcol'=>'Txt'),
);
if (array_key_exists('key',$_GET) && array_key_exists($_GET['key'],$cols)) {

9
web/admin/logout.php Normal file
View file

@ -0,0 +1,9 @@
<?php
session_name('mastostartadmin');
session_start();
$_SESSION=array();
session_destroy();
header('Location: index.php');
?>

View file

@ -293,21 +293,6 @@ input {
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;
@ -369,6 +354,29 @@ input {
text-decoration: none;
}
#rightdiv {
position: absolute;
top: 0;
right: 0;
color: #78b1e2;
height: 32px;
line-height: 32px;
vertical-align: middle;
}
.rlinks {
float: left;
padding-left: 10px;
padding-right: 10px;
text-align: center;
}
.rlinks a {
color: #78b1e2;
}
.rlinks:hover {
cursor: pointer;
background-color: rgba(255,255,255,0.10);
}
#plancia {
position: fixed;
left: 50%;

View file

@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Creato il: Gen 11, 2020 alle 00:49
-- Creato il: Gen 11, 2020 alle 19:59
-- Versione del server: 10.4.11-MariaDB
-- Versione PHP: 7.4.1
@ -161,7 +161,6 @@ CREATE TABLE `InstLangs` (
--
CREATE TABLE `InstOurLangs` (
`ID` bigint(20) UNSIGNED NOT NULL,
`InstID` bigint(20) UNSIGNED NOT NULL,
`OurLangID` int(10) UNSIGNED NOT NULL,
`Pos` tinyint(3) UNSIGNED NOT NULL
@ -332,12 +331,6 @@ ALTER TABLE `Financing`
ALTER TABLE `Instances`
ADD PRIMARY KEY (`ID`);
--
-- Indici per le tabelle `InstOurLangs`
--
ALTER TABLE `InstOurLangs`
ADD PRIMARY KEY (`ID`);
--
-- Indici per le tabelle `Languages`
--
@ -414,12 +407,6 @@ ALTER TABLE `Financing`
ALTER TABLE `Instances`
MODIFY `ID` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT per la tabella `InstOurLangs`
--
ALTER TABLE `InstOurLangs`
MODIFY `ID` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT per la tabella `Languages`
--