diff --git a/web/admin/dafa.txt b/web/admin/dafa.txt
index 94d3af4..edc2204 100644
--- a/web/admin/dafa.txt
+++ b/web/admin/dafa.txt
@@ -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
diff --git a/web/admin/instances.php b/web/admin/instances.php
index 65fa3b6..9d4e922 100644
--- a/web/admin/instances.php
+++ b/web/admin/instances.php
@@ -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 dell’admin','type'=>'text'),
- 'AdmAvatar'=>array('name'=>'Avatar admin','type'=>'text'),
+ 'AdmURL'=>array('name'=>'Pagina dell’admin','type'=>'text','ord'=>false),
+ 'AdmAvatar'=>array('name'=>'Avatar admin','type'=>'text','search'=>false,'ord'=>false),
'AdmNote'=>array('name'=>'Note dell’admin','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.='';
- } else {
- $fieldselopts.='';
+ if (!array_key_exists('search',$val)) {
+ if ($val['type']=='joini') {
+ $fieldselopts.='';
+ } else {
+ $fieldselopts.='';
+ }
+ }
+ if (!array_key_exists('ord',$val)) {
+ if ($val['type']=='joini') {
+ $ordfieldselopts.='';
+ } else {
+ $ordfieldselopts.='';
+ }
}
}
-/*
-[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.'
'.N;
$tini=microtime(true);
$res=mysqli_query($link,$query)
- or muoribene($dbg.'
'.$query.': '.mysqli_error($link),true);
+ or muoribene($dbg.'
'.$query.': '.mysqli_error($link).'
'.'La query è fallita. Resetta.',true);
$dbg.='Durata esecuzione query: '.round(microtime(true)-$tini,4).' sec.
'.N;
if (mysqli_num_rows($res)<1) {
@@ -352,7 +343,15 @@ if (mysqli_num_rows($res)<1) {
$out.='