1
0
Fork 0

il sistema di costruzione delle query è più duttile; abbozzo di sistema gestione presets di ricerca-ordinamento

This commit is contained in:
pezcurrel 2020-01-20 21:23:02 +01:00
parent d2e9bc5f95
commit aa75b75277
3 changed files with 182 additions and 78 deletions

View file

@ -3,8 +3,9 @@
* fatto * fatto
~ più o meno ~ più o meno
* quando ordinamento è su una "1 a molti", eseguirlo su "GROUP_CONCAT" di questi molti ordinati per "Pos" della joinosa tabella - instances.php: ckf: controllare che non venga eseguito ordinamento su una stessa colonna più volte (non rompe query ma è ridondante)
* instances.php: 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... * 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 () * 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 * 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 * instances.php: 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

@ -91,6 +91,7 @@ $dbg.='<pre>'.print_r($_POST,1).'</pre>';
/*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*/ /*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( $cols=array(
'Instances.New'=>array('field'=>'Instances.New','name'=>'Nuova','type'=>'bool'), 'Instances.New'=>array('field'=>'Instances.New','name'=>'Nuova','type'=>'bool'),
'Instances.Good'=>array('field'=>'Instances.Good','name'=>'Papabile','type'=>'bool'), 'Instances.Good'=>array('field'=>'Instances.Good','name'=>'Papabile','type'=>'bool'),
'Instances.Chosen'=>array('field'=>'Instances.Chosen','name'=>'Scelta','type'=>'bool'), 'Instances.Chosen'=>array('field'=>'Instances.Chosen','name'=>'Scelta','type'=>'bool'),
@ -102,6 +103,8 @@ $cols=array(
'Instances.LongDesc'=>array('field'=>'Instances.LongDesc','name'=>'Descrizione lunga','type'=>'text'), 'Instances.LongDesc'=>array('field'=>'Instances.LongDesc','name'=>'Descrizione lunga','type'=>'text'),
'Instances.OurDesc'=>array('field'=>'Instances.OurDesc','name'=>'Descrizione nostra','type'=>'text'), 'Instances.OurDesc'=>array('field'=>'Instances.OurDesc','name'=>'Descrizione nostra','type'=>'text'),
//--------------------------------
'Instances.LocalityID'=>array('field'=>'Instances.LocalityID','name'=>'Località ⮞','type'=>'join','join'=>array(),'ord'=>false), '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'), 'Localities.Locality'=>array('field'=>'Localities.Locality','name'=>'Località','type'=>'joini','join'=>array('Localities ON Localities.ID=Instances.LocalityID'),'subtype'=>'text'),
@ -114,6 +117,8 @@ $cols=array(
'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.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'), '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.Email'=>array('field'=>'Instances.Email','name'=>'Email di contatto','type'=>'text'),
'Instances.Software'=>array('field'=>'Instances.Software','name'=>'Software','type'=>'text'), 'Instances.Software'=>array('field'=>'Instances.Software','name'=>'Software','type'=>'text'),
'Instances.Version'=>array('field'=>'Instances.Version','name'=>'Versione','type'=>'text'), 'Instances.Version'=>array('field'=>'Instances.Version','name'=>'Versione','type'=>'text'),
@ -133,35 +138,75 @@ $cols=array(
'Instances.AdmAvatar'=>array('field'=>'Instances.AdmAvatar','name'=>'Avatar admin','type'=>'text','search'=>false,'ord'=>false), 'Instances.AdmAvatar'=>array('field'=>'Instances.AdmAvatar','name'=>'Avatar admin','type'=>'text','search'=>false,'ord'=>false),
'Instances.AdmNote'=>array('field'=>'Instances.AdmNote','name'=>'Note delladmin','type'=>'text'), 'Instances.AdmNote'=>array('field'=>'Instances.AdmNote','name'=>'Note delladmin','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'=>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'=>'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'=>'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), 'InstLangs'=>array('name'=>'Lingue dichiarate','search'=>false,'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'=>'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'=>'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), 'InstLangs.LangID'=>array('field'=>'InstLangs%.LangID','name'=>'Una lingua dichiarata ⮞','type'=>'join','join'=>array('InstLangs AS InstLangs% ON InstLangs%.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','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'=>'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'=>'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), 'Languages.NameIT'=>array('field'=>'Languages%.NameIT','name'=>'Una lingua dichiarata','type'=>'joini','join'=>array('InstLangs AS InstLangs% ON InstLangs%.InstID=Instances.ID','Languages AS Languages% ON Languages%.ID=InstLangs%.LangID'),'subtype'=>'text','ord'=>true,'ordname'=>'Lingue dichiarate','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'),
'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'=>'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'=>'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), 'InstLangs.LangID.First'=>array('field'=>'InstLangs%.LangID','name'=>'Lingua primaria dichiarata ⮞','type'=>'join','join'=>array('InstLangs AS InstLangs% ON InstLangs%.InstID=Instances.ID AND InstLangs%.Pos=1'),'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','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'=>'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'=>'InstTags.Pos=1','ord'=>false),
// queste 3 qui sotto se si usano sia per ricerca sia per ordinamento e/o se si usano congiuntamente per più ricerche e/o ordinamenti, producono query un po' sporche, con ridondanza di where clause "InstActivity.Pos=1", ma viva l'ottimizzatore :)) 'Languages.NameIT.First'=>array('field'=>'Languages%.NameIT','name'=>'Lingua primaria dichiarata','type'=>'joini','join'=>array('InstLangs AS InstLangs% ON InstLangs%.InstID=Instances.ID AND InstLangs%.Pos=1','Languages AS Languages% ON Languages%.ID=InstLangs%.LangID'),'subtype'=>'text','ord'=>false),
'InstActivity.Statuses.First'=>array('field'=>'InstActivity.Statuses','name'=>'Stati ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','wheremore'=>'InstActivity.Pos=1'),
'InstActivity.Logins.First'=>array('field'=>'InstActivity.Logins','name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','wheremore'=>'InstActivity.Pos=1'), //--------------------------------
'IntstActivity.Registrations.First'=>array('field'=>'InstActivity.Registrations','name'=>'Registrazioni ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','wheremore'=>'InstActivity.Pos=1'),
'InstOurLangs'=>array('name'=>'Lingue impostate da noi','search'=>false,'ord'=>false),
'InstOurLangs.OurLangID'=>array('field'=>'InstOurLangs%.OurLangID','name'=>'Una lingua impostata da noi ⮞','type'=>'join','join'=>array('InstOurLangs AS InstOurLangs% ON InstOurLangs%.InstID=Instances.ID'),'ord'=>false),
'OurLanguages.NameIT'=>array('field'=>'OurLanguages%.NameIT','name'=>'Una lingua impostata da noi','type'=>'joini','join'=>array('InstOurLangs AS InstOurLangs% ON InstOurLangs%.InstID=Instances.ID','Languages AS OurLanguages% ON OurLanguages%.ID=InstOurLangs%.OurLangID'),'subtype'=>'text','ord'=>true,'ordname'=>'Lingue impostate da noi','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 AS InstOurLangs% ON InstOurLangs%.InstID=Instances.ID AND InstOurLangs%.Pos=1'),'ord'=>false),
'OurLanguages.NameIT.First'=>array('field'=>'OurLanguages%.NameIT','name'=>'Lingua primaria impostata da noi','type'=>'joini','join'=>array('InstOurLangs AS InstOurLangs% ON InstOurLangs%.InstID=Instances.ID AND InstOurLangs%.Pos=1','Languages AS OurLanguages% ON OurLanguages%.ID=InstOurLangs%.OurLangID'),'subtype'=>'text','ord'=>false),
//--------------------------------
'InstFinancing'=>array('name'=>'Modalità di finanziamento','search'=>false,'ord'=>false),
'InstFinancing.FinID'=>array('field'=>'InstFinancing%.FinID','name'=>'Una modalità di finanziamento ⮞','type'=>'join','join'=>array('InstFinancing AS InstFinancing% ON InstFinancing%.InstID=Instances.ID'),'ord'=>false),
'Financing.Type'=>array('field'=>'Financing%.Type','name'=>'Una modalità di finanziamento','type'=>'joini','join'=>array('InstFinancing AS InstFinancing% ON InstFinancing%.InstID=Instances.ID','Financing AS Financing% ON Financing%.ID=InstFinancing%.FinID'),'subtype'=>'text','ord'=>true,'ordname'=>'Modalità di finanziamento','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 AS InstFinancing% ON InstFinancing%.InstID=Instances.ID AND InstFinancing%.Pos=1'),'ord'=>false),
'Financing.Type.First'=>array('field'=>'Financing%.Type','name'=>'Modalità di finanziamento primaria','type'=>'joini','join'=>array('InstFinancing AS InstFinancing% ON InstFinancing%.InstID=Instances.ID AND InstFinancing%.Pos=1','Financing AS Financing% ON Financing%.ID=InstFinancing%.FinID'),'subtype'=>'text','ord'=>false),
//--------------------------------
'InstPolicies'=>array('name'=>'Restrizioni sui contenuti','search'=>false,'ord'=>false),
'InstPolicies.PolID'=>array('field'=>'InstPolicies%.PolID','name'=>'Una restrizione sui contenuti ⮞','type'=>'join','join'=>array('InstPolicies AS InstPolicies% ON InstPolicies%.InstID=Instances.ID'),'ord'=>false),
'Policies.Name'=>array('field'=>'Policies%.Name','name'=>'Una restrizione sui contenuti','type'=>'joini','join'=>array('InstPolicies AS InstPolicies% ON InstPolicies%.InstID=Instances.ID','Policies AS Policies% ON Policies%.ID=InstPolicies%.PolID'),'subtype'=>'text','ord'=>true,'ordname'=>'Restrizioni sui contenuti','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 AS InstPolicies% ON InstPolicies%.InstID=Instances.ID AND InstPolicies%.Pos=1'),'ord'=>false),
'Policies.Name.First'=>array('field'=>'Policies%.Name','name'=>'Restrizione sui contenuti primaria','type'=>'joini','join'=>array('InstPolicies AS InstPolicies% ON InstPolicies%.InstID=Instances.ID AND InstPolicies%.Pos=1','Policies AS Policies% ON Policies%.ID=InstPolicies%.PolID'),'subtype'=>'text','ord'=>false),
//--------------------------------
'InstTags'=>array('name'=>'Tags','search'=>false,'ord'=>false),
'InstTags.TagID'=>array('field'=>'InstTags%.TagID','name'=>'Una tag ⮞','type'=>'join','join'=>array('InstTags% ON InstTags%.InstID=Instances.ID'),'ord'=>false),
'Tags.Name'=>array('field'=>'Tags%.Name','name'=>'Una tag','type'=>'joini','join'=>array('InstTags AS InstTags% ON InstTags%.InstID=Instances.ID','Tags AS Tags% ON Tags%.ID=InstTags%.TagID'),'subtype'=>'text','ord'=>true,'ordname'=>'Tags','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 AS InstTags% ON InstTags%.InstID=Instances.ID AND InstTags%.Pos=1'),'ord'=>false),
'Tags.Name.First'=>array('field'=>'Tags%.Name','name'=>'Tag primaria','type'=>'joini','join'=>array('InstTags AS InstTags% ON InstTags%.InstID=Instances.ID AND InstTags%.Pos=1','Tags AS Tags% ON Tags%.ID=InstTags%.TagID'),'subtype'=>'text','ord'=>false),
//--------------------------------
'InstActivity.Statuses.First'=>array('field'=>'InstActivity.Statuses','name'=>'Stati ultima settimana','type'=>'joini','join'=>array('InstActivity AS InstActivity ON InstActivity.InstID=Instances.ID AND InstActivity.Pos=1'),'subtype'=>'int','ord'=>true,'ordjoin'=>array('InstActivity AS OrdInstActivity ON OrdInstActivity.InstID=Instances.ID AND OrdInstActivity.Pos=1'),'ordselmore'=>1,'ordby'=>'OrdInstActivity.Statuses'),
'InstActivity.Logins.First'=>array('field'=>'InstActivity.Logins','name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity AS InstActivity ON InstActivity.InstID=Instances.ID AND InstActivity.Pos=1'),'subtype'=>'int','ord'=>true,'ordjoin'=>array('InstActivity AS OrdInstActivity ON OrdInstActivity.InstID=Instances.ID AND OrdInstActivity.Pos=1'),'ordselmore'=>1,'ordby'=>'OrdInstActivity.Logins'),
'IntstActivity.Registrations.First'=>array('field'=>'InstActivity.Registrations','name'=>'Registrazioni ultima settimana','type'=>'joini','join'=>array('InstActivity AS InstActivity ON InstActivity.InstID=Instances.ID AND InstActivity.Pos=1'),'subtype'=>'int','ord'=>true,'ordjoin'=>array('InstActivity AS OrdInstActivity ON OrdInstActivity.InstID=Instances.ID AND OrdInstActivity.Pos=1'),'ordselmore'=>1,'ordby'=>'OrdInstActivity.Registrations'),
//--------------------------------
/*'InstActivity.Statuses.AVG'=>array('field'=>'InstActivity.Statuses','name'=>'Media stati ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','ord'=>true,'ordjoin'=>array('InstActivity AS OrdInstActivity ON OrdInstActivity.InstID=Instances.ID'),'ordselmore'=>'AVG(InstActivity.Statuses) AS avgstatuses'), /*'InstActivity.Statuses.AVG'=>array('field'=>'InstActivity.Statuses','name'=>'Media stati ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','ord'=>true,'ordjoin'=>array('InstActivity AS OrdInstActivity ON OrdInstActivity.InstID=Instances.ID'),'ordselmore'=>'AVG(InstActivity.Statuses) AS avgstatuses'),
'InstActivity.Logins.AVG'=>array('field'=>'InstActivity.Logins','name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','wheremore'=>'InstActivity.Pos=1','ord'=>false), 'InstActivity.Logins.AVG'=>array('field'=>'InstActivity.Logins','name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','wheremore'=>'InstActivity.Pos=1','ord'=>false),
@ -182,10 +227,14 @@ foreach ($cols as $key=>$arr) {
} }
} }
if (!array_key_exists('ord',$arr) || $arr['ord']==true) { if (!array_key_exists('ord',$arr) || $arr['ord']==true) {
if (!array_key_exists('ordname',$arr))
$name=$arr['name'];
else
$name=$arr['ordname'];
if ($arr['type']=='joini') { if ($arr['type']=='joini') {
$ordfieldselopts.='<option value="'.$key.':'.$arr['type'].':'.$arr['subtype'].'">'.$arr['name'].'</option>'; $ordfieldselopts.='<option value="'.$key.':'.$arr['type'].':'.$arr['subtype'].'">'.$name.'</option>';
} else { } else {
$ordfieldselopts.='<option value="'.$key.':'.$arr['type'].':null">'.$arr['name'].'</option>'; $ordfieldselopts.='<option value="'.$key.':'.$arr['type'].':null">'.$name.'</option>';
} }
} }
} }
@ -194,8 +243,9 @@ $pblocks=0;
foreach ($_POST as $key=>$val) foreach ($_POST as $key=>$val)
if (preg_match('/^openpar-\d+$/',$key)===1) if (preg_match('/^openpar-\d+$/',$key)===1)
$pblocks++; $pblocks++;
$i=0; $fi=0;
$ii=0; $ji=0;
$oi=0;
$jsaddrows=''; $jsaddrows='';
$jssetrows=''; $jssetrows='';
$jsordaddrows=''; $jsordaddrows='';
@ -207,22 +257,23 @@ $where='';
$order=''; $order='';
foreach ($_POST as $key=>$val) { foreach ($_POST as $key=>$val) {
if (preg_match('/^openpar-\d+$/',$key)===1) { if (preg_match('/^openpar-\d+$/',$key)===1) {
$i++; $fi++;
if (preg_match('/^\(+$/',$val)===1) if (preg_match('/^\(+$/',$val)===1)
$where.=$val; $where.=$val;
$jsaddrows.='addrow('.$i.',false);'.N; $jsaddrows.='addrow('.$fi.',false);'.N;
$jssetrows.='setrow('.$i.','.json_encode($val); $jssetrows.='setrow('.$fi.','.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) {
$tagk=$buf[1]; $tagk=$buf[1];
$type=$buf[2]; $type=$buf[2];
$subtype=$buf[3]; $subtype=$buf[3];
if (array_key_exists($tagk,$cols) && in_array($type,$types)) { if (array_key_exists($tagk,$cols) && in_array($type,$types)) {
if (array_key_exists('wheremore',$cols[$tagk])) if (strpos($cols[$tagk]['field'],'%')!==false)
$where.='('; $ji++;
$where.=$cols[$tagk]['field']; $where.=str_replace('%',$ji,$cols[$tagk]['field']);
if ($type=='join' || $type=='joini') { if ($type=='join' || $type=='joini') {
foreach ($cols[$tagk]['join'] as $join) { foreach ($cols[$tagk]['join'] as $join) {
$join=str_replace('%',$ji,$join);
if (!in_array($join,$joins)) if (!in_array($join,$joins))
$joins[]=$join; $joins[]=$join;
} }
@ -246,8 +297,6 @@ foreach ($_POST as $key=>$val) {
} }
if (preg_match('/^valuesel-\d+$/',$key)===1) { if (preg_match('/^valuesel-\d+$/',$key)===1) {
$where.=$val; $where.=$val;
if (array_key_exists('wheremore',$cols[$tagk]))
$where.=' AND '.$cols[$tagk]['wheremore'].')';
$jssetrows.=','.json_encode($val); $jssetrows.=','.json_encode($val);
$jssetrows.=',""'; $jssetrows.=',""';
} }
@ -256,9 +305,7 @@ foreach ($_POST as $key=>$val) {
$where.='\'%'.myesc($link,$val).'%\''; $where.='\'%'.myesc($link,$val).'%\'';
else else
$where.='\''.myesc($link,$val).'\''; $where.='\''.myesc($link,$val).'\'';
if (array_key_exists('wheremore',$cols[$tagk])) $jssetrows.=',"NOMMITROVI!"';
$where.=' AND '.$cols[$tagk]['wheremore'].')';
$jssetrows.=',"NOMMITROVIHODETTO!"';
$jssetrows.=','.json_encode($val); $jssetrows.=','.json_encode($val);
} }
if (preg_match('/^closepar-\d+$/',$key)===1) { if (preg_match('/^closepar-\d+$/',$key)===1) {
@ -267,45 +314,41 @@ foreach ($_POST as $key=>$val) {
$jssetrows.=','.json_encode($val); $jssetrows.=','.json_encode($val);
} }
if (preg_match('/^andor-\d+$/',$key)===1 && preg_match('/^AND|OR$/',$val)===1) { if (preg_match('/^andor-\d+$/',$key)===1 && preg_match('/^AND|OR$/',$val)===1) {
if ($i<$pblocks) if ($fi<$pblocks)
$where.=' '.$val.' '; $where.=' '.$val.' ';
$jssetrows.=','.json_encode($val).');'.N; $jssetrows.=','.json_encode($val).');'.N;
} }
if (preg_match('/^ordfieldsel-\d+$/',$key)===1 && preg_match('/^(.+):(.+):(.+)$/',$val,$buf)===1) { if (preg_match('/^ordfieldsel-\d+$/',$key)===1 && preg_match('/^(.+):(.+):(.+)$/',$val,$buf)===1) {
$ii++; $oi++;
$tagk=$buf[1]; $tagk=$buf[1];
$type=$buf[2]; $type=$buf[2];
$subtype=$buf[3]; $subtype=$buf[3];
if (array_key_exists($tagk,$cols) && in_array($type,$types)) { if (array_key_exists($tagk,$cols) && in_array($type,$types)) {
if (!array_key_exists('ordby',$cols[$tagk])) { if ($type=='join' || $type=='joini') {
$order.=$cols[$tagk]['field']; if (!array_key_exists('ordjoin',$cols[$tagk])) {
if ($type=='join' || $type=='joini') {
foreach ($cols[$tagk]['join'] as $join) foreach ($cols[$tagk]['join'] as $join)
if (!in_array($join,$joins)) if (!in_array($join,$joins))
$joins[]=$join; $joins[]=$join;
} else {
foreach ($cols[$tagk]['ordjoin'] as $join)
if (!in_array($join,$joins))
$joins[]=$join;
} }
}
if (!array_key_exists('ordby',$cols[$tagk])) {
$order.=$cols[$tagk]['field'];
} else { } else {
// qui si dà per scontato che se 'ordby' esiste esistono anche 'ordjoin' e 'ordselmore'
foreach ($cols[$tagk]['ordjoin'] as $join)
if (!in_array($join,$joins))
$joins[]=$join;
if (!in_array($cols[$tagk]['ordselmore'],$sels)) if (!in_array($cols[$tagk]['ordselmore'],$sels))
$sels[]=$cols[$tagk]['ordselmore']; $sels[]=$cols[$tagk]['ordselmore'];
$order.=$cols[$tagk]['ordby']; $order.=$cols[$tagk]['ordby'];
} }
if (array_key_exists('wheremore',$cols[$tagk])) {
if ($where!='')
$where.=' AND '.$cols[$tagk]['wheremore'];
else
$where.=$cols[$tagk]['wheremore'];
}
if (array_key_exists('havings',$cols[$tagk]) && !in_array($cols[$tagk]['havings'],$havings)) if (array_key_exists('havings',$cols[$tagk]) && !in_array($cols[$tagk]['havings'],$havings))
$havings[]=$cols[$tagk]['havings']; $havings[]=$cols[$tagk]['havings'];
if (array_key_exists('selmore',$cols[$tagk]) && !in_array($cols[$tagk]['selmore'],$sels)) if (array_key_exists('selmore',$cols[$tagk]) && !in_array($cols[$tagk]['selmore'],$sels))
$sels[]=$cols[$tagk]['selmore']; $sels[]=$cols[$tagk]['selmore'];
$jsordaddrows.='ordaddrow('.$ii.',false);'.N; $jsordaddrows.='ordaddrow('.$oi.',false);'.N;
$jsordsetrows.='ordsetrow('.$ii.','.json_encode($val); $jsordsetrows.='ordsetrow('.$oi.','.json_encode($val);
} else { } 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); 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);
} }
@ -443,9 +486,9 @@ if (mysqli_num_rows($res)<1) {
$i++; $i++;
$buf[]=$i.': '.hspech($srow['Code'].' ['.$srow['NameIT'].']'); $buf[]=$i.': '.hspech($srow['Code'].' ['.$srow['NameIT'].']');
} }
$out.='<div class="baloo"><span class="field">'.$cols['Languages.NameIT']['name'].':</span> '.implode('; ',$buf).'</div>'.N; $out.='<div class="baloo"><span class="field">'.$cols['InstLangs']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else { } else {
$out.='<div class="baloo"><span class="field">'.$cols['Languages.NameIT']['name'].':</span> <span class="nully">Non definite</span></div>'.N; $out.='<div class="baloo"><span class="field">'.$cols['InstLangs']['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') $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); or muoribene(mysqli_error($link),true);
@ -456,9 +499,9 @@ if (mysqli_num_rows($res)<1) {
$i++; $i++;
$buf[]=$i.': '.hspech($srow['Code'].' ['.$srow['NameIT'].']'); $buf[]=$i.': '.hspech($srow['Code'].' ['.$srow['NameIT'].']');
} }
$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLanguages.NameIT']['name'].':</span> '.implode('; ',$buf).'</div>'.N; $out.='<div class="baloo"><span class="ourfield">'.$cols['InstOurLangs']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else { } else {
$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLanguages.NameIT']['name'].':</span> <span class="nully">Non definite</span></div>'.N; $out.='<div class="baloo"><span class="ourfield">'.$cols['InstOurLangs']['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') $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); or muoribene(mysqli_error($link),true);
@ -469,9 +512,9 @@ if (mysqli_num_rows($res)<1) {
$i++; $i++;
$buf[]=$i.': '.hspech($srow['Type']); $buf[]=$i.': '.hspech($srow['Type']);
} }
$out.='<div class="baloo"><span class="ourfield">'.$cols['Financing.Type']['name'].':</span> '.implode('; ',$buf).'</div>'.N; $out.='<div class="baloo"><span class="ourfield">'.$cols['InstFinancing']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else { } else {
$out.='<div class="baloo"><span class="ourfield">'.$cols['Financing.Type']['name'].':</span> <span class="nully">Non definite</span></div>'.N; $out.='<div class="baloo"><span class="ourfield">'.$cols['InstFinancing']['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') $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); or muoribene(mysqli_error($link),true);
@ -482,9 +525,9 @@ if (mysqli_num_rows($res)<1) {
$i++; $i++;
$buf[]=$i.': '.hspech($srow['Name']); $buf[]=$i.': '.hspech($srow['Name']);
} }
$out.='<div class="baloo"><span class="ourfield">'.$cols['Policies.Name']['name'].':</span> '.implode('; ',$buf).'</div>'.N; $out.='<div class="baloo"><span class="ourfield">'.$cols['InstPolicies']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else { } else {
$out.='<div class="baloo"><span class="ourfield">'.$cols['Policies.Name']['name'].':</span> <span class="nully">Non definite</span></div>'.N; $out.='<div class="baloo"><span class="ourfield">'.$cols['InstPolicies']['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') $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); or muoribene(mysqli_error($link),true);
@ -495,9 +538,9 @@ if (mysqli_num_rows($res)<1) {
$i++; $i++;
$buf[]=$i.': '.hspech($srow['Name']); $buf[]=$i.': '.hspech($srow['Name']);
} }
$out.='<div class="baloo"><span class="ourfield">'.$cols['Tags.Name']['name'].':</span> '.implode('; ',$buf).'</div>'.N; $out.='<div class="baloo"><span class="ourfield">'.$cols['InstTags']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else { } else {
$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="ourfield">'.$cols['InstTags']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
} }
$out.='<div class="baloo"><span class="field">'.$cols['Instances.Email']['name'].':</span> '.nully($row['Email'],true,'email').'</div>'.N; $out.='<div class="baloo"><span class="field">'.$cols['Instances.Email']['name'].':</span> '.nully($row['Email'],true,'email').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.Software']['name'].':</span> '.nully($row['Software'],false,'strip').'</div>'.N; $out.='<div class="baloo"><span class="field">'.$cols['Instances.Software']['name'].':</span> '.nully($row['Software'],false,'strip').'</div>'.N;
@ -523,6 +566,12 @@ if (mysqli_num_rows($res)<1) {
$out.='<div class="bigtabfoot"></div>'; $out.='<div class="bigtabfoot"></div>';
} }
$filtpresopts='<option value="null"></option>'.N;
$res=mysqli_query($link,'SELECT * FROM FilterPresets')
or muoribene(mysqli_error($link),true);
while ($row=mysqli_fetch_assoc($res))
$filtpresopts.='<option value="'.$row['ID'].'">'.hspech($row['Name']).'</option>'.N;
mysqli_close($link); mysqli_close($link);
?> ?>
@ -709,8 +758,10 @@ function addrow(index,refresh) {
newcell3.innerHTML='<select class="valuesel" style="display:none;"></select><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>'; 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>'; 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">'; newcell6.innerHTML='<img class="plus" src="imgs/plus.svg" title="Aggiungi un criterio sotto questo">';
newcell7.innerHTML='<img class="minus" src="imgs/minus.svg">'; newcell6.style.width='22px';
newcell7.innerHTML='<img class="minus" src="imgs/minus.svg" title="Rimuovi questo criterio">';
newcell7.style.width='22px';
if (refresh) { if (refresh) {
synctai(); synctai();
popusels(index,false); popusels(index,false);
@ -729,8 +780,8 @@ function ordaddrow(index,refresh) {
newcell3.style.width='1%'; newcell3.style.width='1%';
newcell0.innerHTML='<select class="ordfieldsel"><?php echo($ordfieldselopts); ?></select>'; 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>'; 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">'; newcell2.innerHTML='<img class="plus" src="imgs/plus.svg" title="Aggiungi un criterio sotto questo">';
newcell3.innerHTML='<img class="minus" src="imgs/minus.svg">'; newcell3.innerHTML='<img class="minus" src="imgs/minus.svg" title="Rimuovi questo criterio">';
if (refresh) if (refresh)
synctoi(); synctoi();
} }
@ -950,6 +1001,54 @@ function pupwait(on) {
pup.style.display='none'; pup.style.display='none';
} }
} }
//function setrow(index,openparv,fieldselv,condselv,valueselv,valueinpv,closeparv,andorv)
function loadfiltpres() {
pupwait(true);
truncfil();
let formdata=new FormData();
formdata.append('act','loadfil');
formdata.append('fid',document.getElementById('filtpres').value);
let xhr=new XMLHttpRequest();
xhr.open('POST','loadsavepres.php');
xhr.responseType='json';
xhr.send(formdata);
xhr.onload=function() {
let jarr=xhr.response;
for (i=0; i<jarr.length; i++) {
console.log(jarr[i]);
addrow(i+1,false);
}
synctai();
for (i=0; i<jarr.length; i++) {
setrow(i+1, jarr[i]['OpenPar'], jarr[i]['Field'], jarr[i]['Cond'], jarr[i]['ValueSel'], jarr[i]['ValueInp'], jarr[i]['ClosePar'], jarr[i]['AndOr']);
}
if (jarr.length>0)
document.getElementById('filbut').value='Rimuovi tutti i criteri di ricerca';
pupwait(false);
};
xhr.onerror=function() {
alert('Request failed');
};
}
function savefiltpres() {
pupwait(true);
let formdata=new FormData(document.forms.f);
formdata.append('act','savefil');
formdata.append('fid',document.getElementById('filtpres').value);
let xhr=new XMLHttpRequest();
xhr.open('POST','loadsavepres.php');
xhr.responseType='json';
xhr.send(formdata);
xhr.onload=function() {
console.log(xhr.response);
pupwait(false);
};
xhr.onerror=function() {
alert('Request failed');
};
}
//--> //-->
</script> </script>
</head> </head>
@ -984,19 +1083,20 @@ function pupwait(on) {
<?php echo($dbg); ?> <?php echo($dbg); ?>
</div> </div>
<form method="post" id="f" onsubmit="ckf();">
<div id="plancia"> <div id="plancia">
<form method="post" id="f" onsubmit="ckf();">
<table id="planciafil" class="planciatab"> <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> <tr><td colspan="8"><input type="button" id="filbut" value="Aggiungi criteri di ricerca" class="ctrlbut" onclick="manfil();"></td></tr>
</table> </table>
<table class="planciatab"><tr><td style="width:1%">Preset&nbsp;di&nbsp;ricerca:&nbsp;</td><td style="width:96%"><select name="filtpres" id="filtpres" class="preset" onchange="loadfiltpres();"><?php echo($filtpresopts); ?></select></td><td style="width:1%"><img src="imgs/salva.svg" class="lilbut" onclick="savefiltpres(false);" title="Salva i criteri impostati nel preset selezionato sovrascrivendolo"></td><td style="width:1%"><img src="imgs/salvacome.svg" class="lilbut" onclick="savefiltpres(true);" title="Salva i criteri impostati come nuovo preset ..."></td><td style="width:1%"><img src="imgs/minus.svg" class="lilbut" onclick="remfiltpres();" title="Elimina il preset selezionato"></td></tr></table>
<table id="planciaord" class="planciatab"> <table id="planciaord" class="planciatab">
<tr><td colspan="4"><input type="button" id="ordbut" value="Aggiungi criteri di ordinamento" class="ctrlbut" onclick="manord();"></td></tr> <tr><td colspan="4"><input type="button" id="ordbut" value="Aggiungi criteri di ordinamento" class="ctrlbut" onclick="manord();"></td></tr>
</table> </table>
<table id="planciaothers" class="planciatab"> <table id="planciaothers" class="planciatab">
<tr><td><input type="button" id="subbut" value="Applica" class="ctrlbut" onclick="ckf();"></td></tr> <tr><td><input type="button" id="subbut" value="Applica" class="ctrlbut" onclick="ckf();"></td></tr>
</table> </table>
</div>
</form> </form>
</div>
<script language="JavaScript"> <script language="JavaScript">
<!-- <!--

View file

@ -403,7 +403,7 @@ input {
padding: 1px; padding: 1px;
border-radius: 0 0 7px 7px; border-radius: 0 0 7px 7px;
font-size: 9pt; font-size: 9pt;
color: #3088D4; color: #78b1e2;
display: none; display: none;
} }
#plancia .planciatab { #plancia .planciatab {
@ -420,15 +420,18 @@ input {
width: 120px; width: 120px;
} }
/* questi li definisco e li applico solo per avere qualcosa su cui fare "querySelectorAll" */ /* questi li definisco e li applico solo per avere qualcosa su cui fare "querySelectorAll" */
#plancia .openpar, #plancia .fieldsel, #plancia .condsel, #plancia .valuesel, #plancia .valueinp, #plancia .andor, #plancia .plusminus, #plancia .closepar, #plancia .ordfieldsel, #plancia .ascdesc { min-width: 100%; } #plancia .openpar, #plancia .fieldsel, #plancia .condsel, #plancia .valuesel, #plancia .valueinp, #plancia .andor, #plancia .closepar, #plancia .ordfieldsel, #plancia .ascdesc, #plancia .preset { min-width: 100%; }
#plancia .valuesel:disabled, #plancia .valueinp:disabled { #plancia .valuesel:disabled, #plancia .valueinp:disabled {
opacity: 0.5; opacity: 0.5;
} }
#plancia .minus, #plancia .plus { #plancia .preset {
max-width: 400px;
}
#plancia .minus, #plancia .plus, #plancia .lilbut {
width: 22px; width: 22px;
height: 22px; height: 22px;
} }
#plancia .minus:hover, #plancia .plus:hover { #plancia .minus:hover, #plancia .plus:hover, #plancia .lilbut:hover {
cursor: pointer; cursor: pointer;
} }
#plancia .ctrlbut { #plancia .ctrlbut {