From 8019d362eb5d30c07ac4a47c21bb61916d0f6c3d Mon Sep 17 00:00:00 2001 From: Luca Bellenghi Date: Mon, 29 Jan 2024 14:57:07 +0100 Subject: [PATCH 01/15] Preparing release 6.1.11 --- CHANGES.rst | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0171ba0c..b29819e6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ Changelog ========= -6.1.11 (unreleased) +6.1.11 (2024-01-29) ------------------- - Added new indexer, catalog index and query operation for canale_digitale_link field of Servizio CT diff --git a/setup.py b/setup.py index 032f6104..94af5d76 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="design.plone.contenttypes", - version="6.1.11.dev0", + version="6.1.11", description="DesignItalia contenty types", long_description=long_description, long_description_content_type="text/markdown", From 841905814fce6105fa4757643e9e5e970b1afdb6 Mon Sep 17 00:00:00 2001 From: Luca Bellenghi Date: Mon, 29 Jan 2024 14:57:55 +0100 Subject: [PATCH 02/15] Back to development: 6.1.12 --- CHANGES.rst | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index b29819e6..a3a1e92b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changelog ========= +6.1.12 (unreleased) +------------------- + +- Nothing changed yet. + + 6.1.11 (2024-01-29) ------------------- diff --git a/setup.py b/setup.py index 94af5d76..1780e17d 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="design.plone.contenttypes", - version="6.1.11", + version="6.1.12.dev0", description="DesignItalia contenty types", long_description=long_description, long_description_content_type="text/markdown", From 75e0822db7f9a3827fbe19ef6f34b7d7775673bc Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Fri, 2 Feb 2024 10:34:02 +0100 Subject: [PATCH 03/15] remove commit in upgrade-step (#239) --- CHANGES.rst | 3 ++- src/design/plone/contenttypes/upgrades/upgrades.py | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index a3a1e92b..1696e49f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 6.1.12 (unreleased) ------------------- -- Nothing changed yet. +- Remove un-needed commit in upgrade-step. + [cekk] 6.1.11 (2024-01-29) diff --git a/src/design/plone/contenttypes/upgrades/upgrades.py b/src/design/plone/contenttypes/upgrades/upgrades.py index 709d931b..20eb5d7e 100644 --- a/src/design/plone/contenttypes/upgrades/upgrades.py +++ b/src/design/plone/contenttypes/upgrades/upgrades.py @@ -1576,8 +1576,6 @@ def update_pdc_with_pdc_desc(context): logger.info(f"Set pdc_desc for {pdc.absolute_url()}") pdc.value_punto_contatto = value_punto_contatto - - commit() logger.info("Ends of update") From 5d769f657db07bf9e4297c0eb26271afb21e5bb6 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Fri, 2 Feb 2024 10:35:08 +0100 Subject: [PATCH 04/15] Make footer columns auto-generation optional (#238) * initial work * Add new flag in settings needed to choose to show or not auto-generated footer columns and Customize @navigation endpoint to expose also the new flag for frontend * zpretty * update readme --- CHANGES.rst | 5 +- README.md | 9 +- .../contenttypes/controlpanels/settings.py | 10 +++ .../restapi/services/configure.zcml | 4 +- .../restapi/services/navigation/__init__.py | 0 .../services/navigation/configure.zcml | 22 +++++ .../restapi/services/navigation/get.py | 29 +++++++ .../tests/test_custom_service_navigation.py | 82 +++++++++++++++++++ .../contenttypes/upgrades/configure.zcml | 11 ++- 9 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 src/design/plone/contenttypes/restapi/services/navigation/__init__.py create mode 100644 src/design/plone/contenttypes/restapi/services/navigation/configure.zcml create mode 100644 src/design/plone/contenttypes/restapi/services/navigation/get.py create mode 100644 src/design/plone/contenttypes/tests/test_custom_service_navigation.py diff --git a/CHANGES.rst b/CHANGES.rst index 1696e49f..aaf37836 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -18,7 +18,10 @@ Changelog [eikichi18] - Add getObjSize info in File field serializer. [cekk] - +- Add new flag in settings needed to choose to show or not auto-generated footer columns. + [cekk] +- Customize @navigation endpoint to expose also the new flag for frontend. + [cekk] 6.1.10 (2024-01-16) ------------------- diff --git a/README.md b/README.md index c1580770..ab5124c1 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ - [Design Plone Content-types](#design-plone-content-types) - [Features](#features) -- [Compatibilità](#compatibilit%C3%A0) +- [Compatibilità](#compatibilità) - [Tipi di contenuto](#tipi-di-contenuto) - [Elenco tipi implementati](#elenco-tipi-implementati) - [Bando](#bando) @@ -30,10 +30,11 @@ - [Campi indicizzati nel SearchableText](#campi-indicizzati-nel-searchabletext-2) - [Servizio](#servizio) - [Campi indicizzati nel SearchableText](#campi-indicizzati-nel-searchabletext-3) - - [Unità Organizzativa](#unit%C3%A0-organizzativa) + - [Unità Organizzativa](#unità-organizzativa) - [Campi indicizzati nel SearchableText](#campi-indicizzati-nel-searchabletext-4) - [Pannello di controllo](#pannello-di-controllo) - [Gestione modulistica](#gestione-modulistica) +- [Viste verifica contentuti](#viste-verifica-contentuti) - [Data di modifica](#data-di-modifica) - [Endpoint restapi](#endpoint-restapi) - [Customizzazione dati relation field](#customizzazione-dati-relation-field) @@ -421,6 +422,10 @@ Endpoint ed expansion per la modulistica. Nei content-type CartellaModulistica, tra i vari expansion c'è anche `@modulistica_items`. Questo è utile per la vista di frontend, in quanto se richiamato, ritorna la struttura di dati da mostrare in visualizzazione. +## @navigation + +Endpoint customizzato da plone.restapi per esporre anche il valore show_in_footer per decidere se disegnare o meno le colonne dinamiche nel footer. + # Installazione Questo prodotto non è stato pensato per funzionare da solo, ma fa parte della suite "design.plone". diff --git a/src/design/plone/contenttypes/controlpanels/settings.py b/src/design/plone/contenttypes/controlpanels/settings.py index 60beed41..365b8135 100644 --- a/src/design/plone/contenttypes/controlpanels/settings.py +++ b/src/design/plone/contenttypes/controlpanels/settings.py @@ -88,6 +88,16 @@ class IDesignPloneSettings(Interface): default=True, required=False, ) + show_dynamic_folders_in_footer = Bool( + title=_("show_dynamic_folders_in_footer_label", default="Footer dinamico"), + description=_( + "show_dynamic_folders_in_footer_help", + default="Se selezionato, il footer verrà popolato automaticamente " + "con i contenuti di primo livello non esclusi dalla navigazione.", + ), + default=True, + required=False, + ) class DesignPloneControlPanelForm(RegistryEditForm): diff --git a/src/design/plone/contenttypes/restapi/services/configure.zcml b/src/design/plone/contenttypes/restapi/services/configure.zcml index 06d609df..e93dcc9d 100644 --- a/src/design/plone/contenttypes/restapi/services/configure.zcml +++ b/src/design/plone/contenttypes/restapi/services/configure.zcml @@ -6,9 +6,11 @@ + - + + + + + + + + diff --git a/src/design/plone/contenttypes/restapi/services/navigation/get.py b/src/design/plone/contenttypes/restapi/services/navigation/get.py new file mode 100644 index 00000000..70e42e12 --- /dev/null +++ b/src/design/plone/contenttypes/restapi/services/navigation/get.py @@ -0,0 +1,29 @@ +from design.plone.contenttypes.controlpanels.settings import IDesignPloneSettings +from design.plone.contenttypes.interfaces import IDesignPloneContenttypesLayer +from plone import api +from plone.restapi.interfaces import IExpandableElement +from plone.restapi.services import Service +from plone.restapi.services.navigation.get import Navigation as BaseNavigation +from zope.component import adapter +from zope.interface import implementer +from zope.interface import Interface + + +@implementer(IExpandableElement) +@adapter(Interface, IDesignPloneContenttypesLayer) +class Navigation(BaseNavigation): + def __call__(self, expand=False): + result = super().__call__(expand=expand) + show_dynamic_folders_in_footer = api.portal.get_registry_record( + "show_dynamic_folders_in_footer", + interface=IDesignPloneSettings, + default=False, + ) + result["navigation"]["show_in_footer"] = show_dynamic_folders_in_footer + return result + + +class NavigationGet(Service): + def reply(self): + navigation = Navigation(self.context, self.request) + return navigation(expand=True)["navigation"] diff --git a/src/design/plone/contenttypes/tests/test_custom_service_navigation.py b/src/design/plone/contenttypes/tests/test_custom_service_navigation.py new file mode 100644 index 00000000..014ad580 --- /dev/null +++ b/src/design/plone/contenttypes/tests/test_custom_service_navigation.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +from design.plone.contenttypes.controlpanels.settings import IDesignPloneSettings +from design.plone.contenttypes.testing import ( + DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING, +) +from plone import api +from plone.app.testing import setRoles +from plone.app.testing import SITE_OWNER_NAME +from plone.app.testing import SITE_OWNER_PASSWORD +from plone.app.testing import TEST_USER_ID +from plone.dexterity.utils import createContentInContainer +from plone.restapi.testing import RelativeSession +from transaction import commit + +import unittest + + +class CustomNavigationTest(unittest.TestCase): + layer = DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING + + def setUp(self): + self.app = self.layer["app"] + self.portal = self.layer["portal"] + self.portal_url = self.portal.absolute_url() + self.api_session = RelativeSession(self.portal_url) + self.api_session.headers.update({"Accept": "application/json"}) + self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD) + setRoles(self.portal, TEST_USER_ID, ["Manager"]) + + self.folder = createContentInContainer( + self.portal, "Folder", id="folder", title="Some Folder" + ) + self.folder2 = createContentInContainer( + self.portal, "Folder", id="folder2", title="Some Folder 2" + ) + self.subfolder1 = createContentInContainer( + self.folder, "Folder", id="subfolder1", title="SubFolder 1" + ) + self.subfolder2 = createContentInContainer( + self.folder, "Folder", id="subfolder2", title="SubFolder 2" + ) + self.thirdlevelfolder = createContentInContainer( + self.subfolder1, + "Folder", + id="thirdlevelfolder", + title="Third Level Folder", + ) + self.fourthlevelfolder = createContentInContainer( + self.thirdlevelfolder, + "Folder", + id="fourthlevelfolder", + title="Fourth Level Folder", + ) + createContentInContainer(self.folder, "Document", id="doc1", title="A document") + commit() + + def tearDown(self): + self.api_session.close() + + def test_return_show_in_footer_info_based_on_registry(self): + # by default is True + response = self.api_session.get( + "/@navigation", params={"expand.navigation.depth": 2} + ).json() + + self.assertIn("show_in_footer", response) + self.assertTrue(response["show_in_footer"]) + + # change it + api.portal.set_registry_record( + "show_dynamic_folders_in_footer", + False, + interface=IDesignPloneSettings, + ) + commit() + + response = self.api_session.get( + "/@navigation", params={"expand.navigation.depth": 2} + ).json() + + self.assertIn("show_in_footer", response) + self.assertFalse(response["show_in_footer"]) diff --git a/src/design/plone/contenttypes/upgrades/configure.zcml b/src/design/plone/contenttypes/upgrades/configure.zcml index f824c5c3..f7c06cd8 100644 --- a/src/design/plone/contenttypes/upgrades/configure.zcml +++ b/src/design/plone/contenttypes/upgrades/configure.zcml @@ -808,5 +808,14 @@ handler=".upgrades.add_canale_digitale_link_index" /> - + + + From 57239d42e1f2c571b85a4a21c4803eac610b594b Mon Sep 17 00:00:00 2001 From: Filippo Campi Date: Tue, 6 Feb 2024 12:32:32 +0100 Subject: [PATCH 05/15] Preparing release 6.1.12 --- CHANGES.rst | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index aaf37836..ddf53243 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ Changelog ========= -6.1.12 (unreleased) +6.1.12 (2024-02-06) ------------------- - Remove un-needed commit in upgrade-step. diff --git a/setup.py b/setup.py index 1780e17d..dba40f06 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="design.plone.contenttypes", - version="6.1.12.dev0", + version="6.1.12", description="DesignItalia contenty types", long_description=long_description, long_description_content_type="text/markdown", From 72aa179af162023ec5314cc13e69a19d8e106c0e Mon Sep 17 00:00:00 2001 From: Filippo Campi Date: Tue, 6 Feb 2024 12:32:47 +0100 Subject: [PATCH 06/15] Back to development: 6.1.13 --- CHANGES.rst | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index ddf53243..7d4bc397 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changelog ========= +6.1.13 (unreleased) +------------------- + +- Nothing changed yet. + + 6.1.12 (2024-02-06) ------------------- diff --git a/setup.py b/setup.py index dba40f06..de31b7cd 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="design.plone.contenttypes", - version="6.1.12", + version="6.1.13.dev0", description="DesignItalia contenty types", long_description=long_description, long_description_content_type="text/markdown", From c9739e7eee94a365340444e298eada699fad2274 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Thu, 8 Feb 2024 10:49:44 +0100 Subject: [PATCH 07/15] Handle missing new footer navigation option in registry entry (#240) --- CHANGES.rst | 3 ++- .../contenttypes/restapi/services/navigation/get.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 7d4bc397..3001c818 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 6.1.13 (unreleased) ------------------- -- Nothing changed yet. +- Handle missing `show_dynamic_folders_in_footer` in registry entry. + [cekk] 6.1.12 (2024-02-06) diff --git a/src/design/plone/contenttypes/restapi/services/navigation/get.py b/src/design/plone/contenttypes/restapi/services/navigation/get.py index 70e42e12..73550281 100644 --- a/src/design/plone/contenttypes/restapi/services/navigation/get.py +++ b/src/design/plone/contenttypes/restapi/services/navigation/get.py @@ -14,11 +14,14 @@ class Navigation(BaseNavigation): def __call__(self, expand=False): result = super().__call__(expand=expand) - show_dynamic_folders_in_footer = api.portal.get_registry_record( - "show_dynamic_folders_in_footer", - interface=IDesignPloneSettings, - default=False, - ) + try: + show_dynamic_folders_in_footer = api.portal.get_registry_record( + "show_dynamic_folders_in_footer", + interface=IDesignPloneSettings, + default=True, + ) + except KeyError: + show_dynamic_folders_in_footer = True result["navigation"]["show_in_footer"] = show_dynamic_folders_in_footer return result From 054d7d3db656d0a39896057f3e18afa5bbdcb41b Mon Sep 17 00:00:00 2001 From: Piero Nicolli Date: Thu, 8 Feb 2024 10:52:48 +0100 Subject: [PATCH 08/15] Preparing release 6.1.13 --- CHANGES.rst | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 3001c818..1010ecc5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ Changelog ========= -6.1.13 (unreleased) +6.1.13 (2024-02-08) ------------------- - Handle missing `show_dynamic_folders_in_footer` in registry entry. diff --git a/setup.py b/setup.py index de31b7cd..980ceefb 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="design.plone.contenttypes", - version="6.1.13.dev0", + version="6.1.13", description="DesignItalia contenty types", long_description=long_description, long_description_content_type="text/markdown", From 903161aaf71670f497b195e62a7ebe173675150e Mon Sep 17 00:00:00 2001 From: Piero Nicolli Date: Thu, 8 Feb 2024 10:53:09 +0100 Subject: [PATCH 09/15] Back to development: 6.1.14 --- CHANGES.rst | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 1010ecc5..c0d5ecc2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changelog ========= +6.1.14 (unreleased) +------------------- + +- Nothing changed yet. + + 6.1.13 (2024-02-08) ------------------- diff --git a/setup.py b/setup.py index 980ceefb..56dd1887 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="design.plone.contenttypes", - version="6.1.13", + version="6.1.14.dev0", description="DesignItalia contenty types", long_description=long_description, long_description_content_type="text/markdown", From 02afdaf920a597a525a66323f8cd82fc013c4eff Mon Sep 17 00:00:00 2001 From: Filippo Campi Date: Tue, 20 Feb 2024 10:15:33 +0100 Subject: [PATCH 10/15] updated CHANGES + fixed typo in update_note field description (#245) --- CHANGES.rst | 3 ++- src/design/plone/contenttypes/behaviors/update_note.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index c0d5ecc2..8c868dfe 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 6.1.14 (unreleased) ------------------- -- Nothing changed yet. +- Fixed typo in update_note field description. + [eikichi18] 6.1.13 (2024-02-08) diff --git a/src/design/plone/contenttypes/behaviors/update_note.py b/src/design/plone/contenttypes/behaviors/update_note.py index 113fe7f1..9e1d6f5b 100644 --- a/src/design/plone/contenttypes/behaviors/update_note.py +++ b/src/design/plone/contenttypes/behaviors/update_note.py @@ -18,7 +18,7 @@ class IUpdateNote(model.Schema): description=_( "help_update_note", default="Inserisci una nota per indicare che il contenuto corrente è stato aggiornato." # noqa - "Questo testo può essere visualizzato nei blocchi elenco con determinati layout per informare " # noqa + " Questo testo può essere visualizzato nei blocchi elenco con determinati layout per informare " # noqa "gli utenti che un determinato contenuto è stato aggiornato. " "Ad esempio se in un bando sono stati aggiunti dei documenti.", ), From 0c69406000d788b5e376af11c1a507614376f22f Mon Sep 17 00:00:00 2001 From: Filippo Campi Date: Tue, 20 Feb 2024 11:01:22 +0100 Subject: [PATCH 11/15] update description of sede field in UnitaOrganizzativa CT (#241) * updated CHANGES + update description of sede field in UnitaOrganizzativa CT --- CHANGES.rst | 1 + .../plone/contenttypes/interfaces/unita_organizzativa.py | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 8c868dfe..d551913c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,7 @@ Changelog 6.1.14 (unreleased) ------------------- +- Change description for field sede in UnitaOrganizzativa CT. - Fixed typo in update_note field description. [eikichi18] diff --git a/src/design/plone/contenttypes/interfaces/unita_organizzativa.py b/src/design/plone/contenttypes/interfaces/unita_organizzativa.py index 12e1bfad..b54570f1 100644 --- a/src/design/plone/contenttypes/interfaces/unita_organizzativa.py +++ b/src/design/plone/contenttypes/interfaces/unita_organizzativa.py @@ -97,10 +97,8 @@ class IUnitaOrganizzativa(model.Schema, IDesignPloneContentType): description=_( "sede_help", default="Seleziona il Luogo in cui questa struttura ha sede. " - "Se non è presente un contenuto di tipo Luogo a cui far " - "riferimento, puoi compilare i campi seguenti. Se selezioni un " - "Luogo, puoi usare comunque i campi seguenti per sovrascrivere " - "alcune informazioni.", + "Se non è presente creare il Luogo nella sezione dedicata " + "nell'alberatura del sito.", ), value_type=RelationChoice( title=_("Sede"), vocabulary="plone.app.vocabularies.Catalog" From 3801755c9b3adcbf4aa543676bbdccb63d3dfaec Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Tue, 20 Feb 2024 11:02:51 +0100 Subject: [PATCH 12/15] Fix news item view to not break on classic plone (#243) * set base views to ct with blocks * only set News view --- CHANGES.rst | 2 ++ ...contenttypes.browser.templates.newsitem.pt | 30 ------------------- .../profiles/default/metadata.xml | 2 +- .../profiles/default/types/Document.xml | 1 + .../profiles/default/types/Event.xml | 1 + .../profiles/default/types/News_Item.xml | 5 ++++ .../contenttypes/upgrades/configure.zcml | 10 +++++++ .../plone/contenttypes/upgrades/upgrades.py | 7 +++++ 8 files changed, 27 insertions(+), 31 deletions(-) delete mode 100644 src/design/plone/contenttypes/browser/overrides/plone.app.contenttypes.browser.templates.newsitem.pt diff --git a/CHANGES.rst b/CHANGES.rst index d551913c..0b2d5189 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ Changelog 6.1.14 (unreleased) ------------------- +- Set base view to News Item, to do not break on Classic Plone. + [cekk] - Change description for field sede in UnitaOrganizzativa CT. - Fixed typo in update_note field description. [eikichi18] diff --git a/src/design/plone/contenttypes/browser/overrides/plone.app.contenttypes.browser.templates.newsitem.pt b/src/design/plone/contenttypes/browser/overrides/plone.app.contenttypes.browser.templates.newsitem.pt deleted file mode 100644 index 53d14271..00000000 --- a/src/design/plone/contenttypes/browser/overrides/plone.app.contenttypes.browser.templates.newsitem.pt +++ /dev/null @@ -1,30 +0,0 @@ - - - - - -
-
-
- - - diff --git a/src/design/plone/contenttypes/profiles/default/metadata.xml b/src/design/plone/contenttypes/profiles/default/metadata.xml index 24726ddb..02602d3b 100644 --- a/src/design/plone/contenttypes/profiles/default/metadata.xml +++ b/src/design/plone/contenttypes/profiles/default/metadata.xml @@ -1,6 +1,6 @@ - 7023 + 7031 profile-redturtle.bandi:default profile-collective.venue:default diff --git a/src/design/plone/contenttypes/profiles/default/types/Document.xml b/src/design/plone/contenttypes/profiles/default/types/Document.xml index 56036477..30e528d3 100644 --- a/src/design/plone/contenttypes/profiles/default/types/Document.xml +++ b/src/design/plone/contenttypes/profiles/default/types/Document.xml @@ -4,6 +4,7 @@ name="Document" i18n:domain="plone" > + diff --git a/src/design/plone/contenttypes/profiles/default/types/Event.xml b/src/design/plone/contenttypes/profiles/default/types/Event.xml index 412101c9..5edb1552 100644 --- a/src/design/plone/contenttypes/profiles/default/types/Event.xml +++ b/src/design/plone/contenttypes/profiles/default/types/Event.xml @@ -14,6 +14,7 @@ + diff --git a/src/design/plone/contenttypes/profiles/default/types/News_Item.xml b/src/design/plone/contenttypes/profiles/default/types/News_Item.xml index 1c0f6d9b..0da6ce08 100644 --- a/src/design/plone/contenttypes/profiles/default/types/News_Item.xml +++ b/src/design/plone/contenttypes/profiles/default/types/News_Item.xml @@ -17,6 +17,11 @@ + view + + + + diff --git a/src/design/plone/contenttypes/upgrades/configure.zcml b/src/design/plone/contenttypes/upgrades/configure.zcml index f7c06cd8..cbb18bef 100644 --- a/src/design/plone/contenttypes/upgrades/configure.zcml +++ b/src/design/plone/contenttypes/upgrades/configure.zcml @@ -818,4 +818,14 @@ handler=".upgrades.update_registry" /> + + + diff --git a/src/design/plone/contenttypes/upgrades/upgrades.py b/src/design/plone/contenttypes/upgrades/upgrades.py index 20eb5d7e..bffa9c19 100644 --- a/src/design/plone/contenttypes/upgrades/upgrades.py +++ b/src/design/plone/contenttypes/upgrades/upgrades.py @@ -1589,3 +1589,10 @@ def add_canale_digitale_link_index(context): service.reindexObject(idxs=["canale_digitale_link"]) logger.info(f"Reindexed {service.absolute_url()}") logger.info("End of update, added index canale_digitale_link") + + +def to_7031(context): + portal_types = api.portal.get_tool(name="portal_types") + for ptype in ["News Item"]: + portal_types[ptype].default_view = "view" + portal_types[ptype].view_methods = ["view"] From 8695c3210d6c6ef040d2a506eb71c84b0d004a02 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Tue, 20 Feb 2024 11:08:07 +0100 Subject: [PATCH 13/15] Fix in @scadenziario endpoint: return future events if afterToday criteria is set (#242) --- CHANGES.rst | 3 + .../restapi/services/scadenziario/post.py | 8 +- .../tests/test_service_scadenziario.py | 89 +++++++++++++++++++ 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 src/design/plone/contenttypes/tests/test_service_scadenziario.py diff --git a/CHANGES.rst b/CHANGES.rst index 0b2d5189..5f08e5fe 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ Changelog 6.1.14 (unreleased) ------------------- +- Fix in @scadenziario endpoint: return future events if afterToday criteria is set. + [cekk] - Set base view to News Item, to do not break on Classic Plone. [cekk] - Change description for field sede in UnitaOrganizzativa CT. @@ -11,6 +13,7 @@ Changelog [eikichi18] + 6.1.13 (2024-02-08) ------------------- diff --git a/src/design/plone/contenttypes/restapi/services/scadenziario/post.py b/src/design/plone/contenttypes/restapi/services/scadenziario/post.py index 07ba6299..e19720c1 100644 --- a/src/design/plone/contenttypes/restapi/services/scadenziario/post.py +++ b/src/design/plone/contenttypes/restapi/services/scadenziario/post.py @@ -158,7 +158,13 @@ def reply(self): if "start" in query_for_catalog: start = query_for_catalog["start"]["query"] if "end" in query_for_catalog: - end = query_for_catalog["end"]["query"] + if query_for_catalog["end"].get("range", "") != "min": + # per esempio, è impostato il filtro "con fine evento da domani". + # se impostiamo un'end (la data di domani), poi nella generazione delle ricorrenze, + # vengono scartati tutti gli eventi che hanno una data di inizio nel futuro + # (https://github.com/plone/plone.event/blob/master/plone/event/recurrence.py#L141) + # perché la data della ricorrenza è maggiore di "until", che è quello che qui inviamo come end. + end = query_for_catalog["end"]["query"] expanded_events = self.expand_events(events, 3, start, end) all_results = not_events + expanded_events diff --git a/src/design/plone/contenttypes/tests/test_service_scadenziario.py b/src/design/plone/contenttypes/tests/test_service_scadenziario.py new file mode 100644 index 00000000..bdc56425 --- /dev/null +++ b/src/design/plone/contenttypes/tests/test_service_scadenziario.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +from datetime import datetime +from datetime import timedelta +from design.plone.contenttypes.testing import ( + DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING, +) +from plone import api +from plone.app.testing import setRoles +from plone.app.testing import SITE_OWNER_NAME +from plone.app.testing import SITE_OWNER_PASSWORD +from plone.app.testing import TEST_USER_ID +from plone.restapi.testing import RelativeSession +from transaction import commit + +import unittest + + +class ScadenziarioTest(unittest.TestCase): + layer = DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING + + def setUp(self): + self.app = self.layer["app"] + self.portal = self.layer["portal"] + self.request = self.layer["request"] + self.portal_url = self.portal.absolute_url() + + self.api_session = RelativeSession(self.portal_url) + self.api_session.headers.update({"Accept": "application/json"}) + self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD) + + setRoles(self.portal, TEST_USER_ID, ["Manager"]) + + commit() + + def tearDown(self): + self.api_session.close() + + def test_return_future_events_if_query_is_end_after_today(self): + now = datetime.now() + + # past event + api.content.create( + container=self.portal, + type="Event", + title="Past event", + start=now.replace(hour=8) + timedelta(days=-2), + end=now.replace(hour=18) + timedelta(days=-2), + ) + + future_event_1 = api.content.create( + container=self.portal, + type="Event", + title="Future event", + start=now.replace(hour=8) + timedelta(days=2), + end=now.replace(hour=18) + timedelta(days=4), + ) + future_event_2 = api.content.create( + container=self.portal, + type="Event", + title="Future event that starts in the past", + start=now.replace(hour=8) + timedelta(days=-4), + end=now.replace(hour=18) + timedelta(days=4), + ) + + commit() + + response = self.api_session.post( + f"{self.portal_url}/@scadenziario", + json={ + "query": [ + { + "i": "end", + "o": "plone.app.querystring.operation.date.afterToday", + "v": "", + } + ] + }, + ).json() + self.assertEqual(len(response["items"]), 2) + + # results are in asc order + self.assertEqual( + response["items"][0], + future_event_2.start.strftime("%Y/%m/%d"), + ) + self.assertEqual( + response["items"][1], + future_event_1.start.strftime("%Y/%m/%d"), + ) From 20bcdab869db46ff103b97cf7d7eee8278947a73 Mon Sep 17 00:00:00 2001 From: Luca Bellenghi Date: Tue, 20 Feb 2024 11:23:10 +0100 Subject: [PATCH 14/15] Preparing release 6.1.14 --- CHANGES.rst | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 5f08e5fe..a7f4777e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ Changelog ========= -6.1.14 (unreleased) +6.1.14 (2024-02-20) ------------------- - Fix in @scadenziario endpoint: return future events if afterToday criteria is set. diff --git a/setup.py b/setup.py index 56dd1887..7926b850 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="design.plone.contenttypes", - version="6.1.14.dev0", + version="6.1.14", description="DesignItalia contenty types", long_description=long_description, long_description_content_type="text/markdown", From 96a9e8ade686a5a8bbb2307d9170871199ce4c46 Mon Sep 17 00:00:00 2001 From: Luca Bellenghi Date: Tue, 20 Feb 2024 11:23:37 +0100 Subject: [PATCH 15/15] Back to development: 6.1.15 --- CHANGES.rst | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index a7f4777e..23247d69 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changelog ========= +6.1.15 (unreleased) +------------------- + +- Nothing changed yet. + + 6.1.14 (2024-02-20) ------------------- diff --git a/setup.py b/setup.py index 7926b850..b487d5c3 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="design.plone.contenttypes", - version="6.1.14", + version="6.1.15.dev0", description="DesignItalia contenty types", long_description=long_description, long_description_content_type="text/markdown",