Skip to content

Commit

Permalink
Merge branch 'main' into blob
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Mar 19, 2024
2 parents c6aaf70 + 9953d00 commit eefa087
Show file tree
Hide file tree
Showing 72 changed files with 7,092 additions and 4,381 deletions.
50 changes: 48 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,58 @@
Changelog
=========

6.1.14 (unreleased)
-------------------
6.2.3 (unreleased)
------------------

- Nothing changed yet.


6.2.2 (2024-03-19)
------------------

- @@check-servizi: provides also the full list of servizi.
[daniele]
- UnitaOrganizzativa.assessore_riferimento title internationalize.
[folix-01]

6.2.1 (2024-03-07)
------------------

- Added check for blocks field in check_luoghi view.
[eikichi18]


6.2.0 (2024-03-06)
------------------

- Remove unused behavior (design.plone.contenttypes.behavior.geolocation_uo).
[cekk]
- Standardize subfolders creations in events.
[cekk]
- Do not return a fieldset if it has all fields hidden (maybe after a schema tweak).
[cekk]
- Improve types test for their schema, required fields, fieldsets.
[cekk]
- Add *exclude_from_search* indexer and behavior, and enable for Document and Folder.
[cekk]
- Add custom adapter for IZCatalogCompatibleQuery to force all anonymous @search calls to skip items excluded from search.
[cekk]
- Set *exclude_from_search* to True in all Documents/Folders automatically created in createSubfolders event handler,
and add an upgrade-step that fix already created ones.
[cekk]

6.1.14 (2024-02-20)
-------------------

- 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.
- Fixed typo in update_note field description.
[eikichi18]


6.1.13 (2024-02-08)
-------------------

Expand Down
2 changes: 2 additions & 0 deletions base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ eggs = createcoverage
[versions]
# Don't use a released version of design.plone.contenttypes
design.plone.contenttypes =
plone.restapi =

[sources]
#collective.volto.blocksfield = git https://github.com/collective/collective.volto.blocksfield.git [email protected]:collective/collective.volto.blocksfield.git branch=main
#redturtle.volto = git https://github.com/RedTurtle/redturtle.volto.git [email protected]:RedTurtle/redturtle.volto.git
#redturtle.bandi = git https://github.com/RedTurtle/redturtle.bandi.git [email protected]:RedTurtle/redturtle.bandi.git
#plone.restapi = git https://github.com/plone/plone.restapi.git
collective.volto.enhancedlinks = git https://github.com/RegioneER/collective.volto.enhancedlinks.git pushurl[email protected]:RegioneER/collective.volto.enhancedlinks.git branch=main
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setup(
name="design.plone.contenttypes",
version="6.1.14.dev0",
version="6.2.3.dev0",
description="DesignItalia contenty types",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down Expand Up @@ -66,6 +66,7 @@
"z3c.unconfigure",
"eea.api.taxonomy",
"openpyxl",
"collective.volto.enhancedlinks",
],
extras_require={
"test": [
Expand Down
3 changes: 3 additions & 0 deletions src/design/plone/contenttypes/adapters/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
factory=".searchabletext_indexers.TextBlockSearchableText"
name="text"
/>

<adapter factory=".query.ZCatalogCompatibleQueryAdapter" />

</configure>
26 changes: 26 additions & 0 deletions src/design/plone/contenttypes/adapters/query.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from design.plone.contenttypes.interfaces import IDesignPloneContenttypesLayer
from plone.restapi.interfaces import IZCatalogCompatibleQuery
from plone.restapi.search.query import ZCatalogCompatibleQueryAdapter as BaseAdapter
from zope.component import adapter
from zope.interface import implementer
from zope.interface import Interface
from plone import api


@implementer(IZCatalogCompatibleQuery)
@adapter(Interface, IDesignPloneContenttypesLayer)
class ZCatalogCompatibleQueryAdapter(BaseAdapter):
""" """

def __call__(self, query):
"""
Do not show excluded from search items when anonymous are performing
some catalog searches
"""
query = super().__call__(query=query)

if api.user.is_anonymous():
# For the anonymous user, only content that is not "excluded from the search" is found
query["exclude_from_search"] = False

return query
16 changes: 8 additions & 8 deletions src/design/plone/contenttypes/behaviors/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,6 @@
provides=".contatti.IContattiEvent"
marker=".contatti.IContattiEvent"
/>
<plone:behavior
name="design.plone.contenttypes.behavior.geolocation_uo"
title="Geolocatable"
description="Behavior geolocatable per UO."
factory=".geolocation.GeolocatableUnitaOrganizzativa"
provides=".geolocation.IGeolocatableUnitaOrganizzativa"
marker=".geolocation.IGeolocatableUnitaOrganizzativa"
/>
<plone:behavior
name="design.plone.contenttypes.behavior.geolocation_venue"
title="Geolocatable"
Expand Down Expand Up @@ -322,4 +314,12 @@
marker=".update_note.IUpdateNote"
/>

<plone:behavior
name="design.plone.contenttypes.behavior.exclude_from_search"
title="Exclude from search"
description="Campo per escludere un contenuto dalle ricerche del sito."
factory=".exclude_from_search.ExcludeFromSearch"
provides=".exclude_from_search.IExcludeFromSearch"
marker=".exclude_from_search.IExcludeFromSearch"
/>
</configure>
37 changes: 37 additions & 0 deletions src/design/plone/contenttypes/behaviors/exclude_from_search.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
from design.plone.contenttypes import _
from plone.autoform.interfaces import IFormFieldProvider
from plone.dexterity.interfaces import IDexterityContent
from plone.supermodel import model
from zope import schema
from zope.component import adapter
from zope.interface import implementer
from zope.interface import provider


@provider(IFormFieldProvider)
class IExcludeFromSearch(model.Schema):
""" """

exclude_from_search = schema.Bool(
title=_("exclude_from_search_label", default="Escludi dalla ricerca"),
description=_(
"help_exclude_from_search",
default="Se selezionato, questo contenuto non verrà mostrato nelle ricerche del sito per gli utenti anonimi.",
),
required=False,
default=False,
)
model.fieldset(
"settings",
fields=["exclude_from_search"],
)


@implementer(IExcludeFromSearch)
@adapter(IDexterityContent)
class ExcludeFromSearch(object):
""" """

def __init__(self, context):
self.context = context
2 changes: 1 addition & 1 deletion src/design/plone/contenttypes/behaviors/update_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def get_related_objects(self, obj, field):
return sorted(items, key=lambda k: k["title"])

def has_module(self, documento):

if [
x
for x in documento.listFolderContents()
Expand Down Expand Up @@ -74,7 +73,6 @@ def plone2volto(self, url):
return url

def get_documenti(self):

if self.is_anonymous():
return []
pc = api.portal.get_tool("portal_catalog")
Expand Down
11 changes: 7 additions & 4 deletions src/design/plone/contenttypes/browser/utils/check_luoghi.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ def information_dict(self, luogo):
if getattr(luogo, "zip_code", "") and luogo.zip_code.strip():
indirizzo = True

modalita_accesso = getattr(luogo, "modalita_accesso", "")
res = [x.get("text", "") for x in modalita_accesso["blocks"].values()]
if not [x for x in res if x]:
modalita_accesso = getattr(luogo, "modalita_accesso", {})
if not isinstance(modalita_accesso, dict):
modalita_accesso = ""
else:
modalita_accesso_blocks = modalita_accesso.get("blocks", {})
res = [x.get("text", "") for x in modalita_accesso_blocks.values()]
if not [x for x in res if x]:
modalita_accesso = ""

return {
"description": getattr(luogo, "description", "").strip(),
Expand All @@ -49,7 +53,6 @@ def plone2volto(self, url):
return url

def get_luoghi(self):

if self.is_anonymous():
return []
pc = api.portal.get_tool("portal_catalog")
Expand Down
3 changes: 0 additions & 3 deletions src/design/plone/contenttypes/browser/utils/check_persone.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def get_related_objects(self, obj, field):
return sorted(items, key=lambda k: k["title"])

def back_references(self, source_object, attribute_name):

catalog = getUtility(ICatalog)
intids = getUtility(IIntIds)
result = []
Expand All @@ -68,7 +67,6 @@ def information_dict(self, persona):

incarichi_persona = ""
if persona.incarichi_persona:

relations = self.get_related_objects(persona, "incarichi_persona")
if relations:
rel_data = relations[0]
Expand Down Expand Up @@ -96,7 +94,6 @@ def plone2volto(self, url):
return url

def get_persone(self):

if self.is_anonymous():
return []
pc = api.portal.get_tool("portal_catalog")
Expand Down
Loading

0 comments on commit eefa087

Please sign in to comment.