-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
981366d
commit 7d5bd98
Showing
17 changed files
with
838 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/iosanita/contenttypes/behaviors/additional_help_infos.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
from collective.volto.blocksfield.field import BlocksField | ||
from iosanita.contenttypes import _ | ||
from plone.app.dexterity import textindexer | ||
from plone.autoform.interfaces import IFormFieldProvider | ||
from plone.dexterity.interfaces import IDexterityContent | ||
from plone.supermodel import model | ||
from zope.component import adapter | ||
from zope.interface import implementer | ||
from zope.interface import provider | ||
|
||
|
||
# TODO: valutare se aggiungere 'box_aiuto', in alcuni CT e' obbligatorio | ||
# e bisognerebbe metterlo unifrme per tutti in barba alle linee guida | ||
@provider(IFormFieldProvider) | ||
class IAdditionalHelpInfos(model.Schema): | ||
ulteriori_informazioni = BlocksField( | ||
title=_("ulteriori_informazioni", default="Ulteriori informazioni"), | ||
description=_( | ||
"ulteriori_informazioni_help", | ||
default="Ulteriori informazioni non contemplate" " dai campi precedenti.", | ||
), | ||
required=False, | ||
) | ||
|
||
model.fieldset( | ||
"informazioni", | ||
label=_("informazioni_label", default="Ulteriori informazioni"), | ||
fields=["ulteriori_informazioni"], | ||
) | ||
|
||
textindexer.searchable("ulteriori_informazioni") | ||
|
||
|
||
@implementer(IAdditionalHelpInfos) | ||
@adapter(IDexterityContent) | ||
class AdditionalHelpInfos(object): | ||
""" """ | ||
|
||
def __init__(self, context): | ||
self.context = context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# -*- coding: utf-8 -*- | ||
from collective.address.behaviors import IAddress | ||
from iosanita.contenttypes import _ | ||
from plone.app.dexterity import textindexer | ||
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 | ||
|
||
|
||
class IAddressNomeSede(model.Schema): | ||
nome_sede = schema.TextLine( | ||
title=_("nome_sede", default="Nome sede"), | ||
description=_( | ||
"help_nome_sede", | ||
default="Inserisci il nome della " | ||
"sede, se non è presente tra i Luoghi del sito.", | ||
), | ||
required=False, | ||
) | ||
textindexer.searchable("nome_sede") | ||
|
||
|
||
class IAddressLocal(model.Schema): | ||
""" """ | ||
|
||
quartiere = schema.TextLine( | ||
title=_("quartiere", default="Quartiere"), | ||
description=_("help_quartiere", default=""), | ||
required=False, | ||
) | ||
|
||
circoscrizione = schema.TextLine( | ||
title=_("circoscrizione", default="Circoscrizione"), | ||
description=_("help_circoscrizione", default=""), | ||
required=False, | ||
) | ||
|
||
# searchabletext indexer | ||
textindexer.searchable("quartiere") | ||
textindexer.searchable("circoscrizione") | ||
|
||
|
||
@provider(IFormFieldProvider) | ||
class IAddressVenue(IAddress, IAddressLocal): | ||
"""""" | ||
|
||
model.fieldset( | ||
"dove", | ||
label=_("dove_label", default="Dove"), | ||
fields=[ | ||
"street", | ||
"zip_code", | ||
"city", | ||
"quartiere", | ||
"circoscrizione", | ||
"country", | ||
], | ||
) | ||
|
||
|
||
@provider(IFormFieldProvider) | ||
class IAddressEvent(IAddress, IAddressNomeSede, IAddressLocal): | ||
"""""" | ||
|
||
model.fieldset( | ||
"luogo", | ||
label=_("luogo_label", default="Luogo"), | ||
fields=[ | ||
"nome_sede", | ||
"street", | ||
"zip_code", | ||
"city", | ||
"quartiere", | ||
"circoscrizione", | ||
"country", | ||
], | ||
) | ||
|
||
|
||
@implementer(IAddressVenue) | ||
@adapter(IDexterityContent) | ||
class AddressVenue(object): | ||
""" """ | ||
|
||
def __init__(self, context): | ||
self.context = context | ||
|
||
|
||
@implementer(IAddressEvent) | ||
@adapter(IDexterityContent) | ||
class AddressEvent(object): | ||
""" """ | ||
|
||
def __init__(self, context): | ||
self.context = context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# -*- coding: utf-8 -*- | ||
from iosanita.contenttypes import _ | ||
from plone.app.contenttypes.interfaces import IEvent | ||
from plone.app.dexterity import textindexer | ||
from plone.app.z3cform.widget import RelatedItemsFieldWidget | ||
from plone.autoform import directives as form | ||
from plone.autoform.interfaces import IFormFieldProvider | ||
from plone.dexterity.interfaces import IDexterityContent | ||
from plone.supermodel import model | ||
from z3c.relationfield.schema import RelationChoice | ||
from z3c.relationfield.schema import RelationList | ||
from zope.component import adapter | ||
from zope.interface import implementer | ||
from zope.interface import provider | ||
|
||
|
||
class IArgomentiSchema(model.Schema): | ||
"""Marker interface for Argomenti""" | ||
|
||
tassonomia_argomenti = RelationList( | ||
title=_("tassonomia_argomenti_label", default="Argomenti"), | ||
description=_( | ||
"tassonomia_argomenti_help", | ||
default="Seleziona una lista di argomenti d'interesse per questo" | ||
" contenuto.", | ||
), | ||
value_type=RelationChoice( | ||
title=_("Argomenti correlati"), | ||
vocabulary="plone.app.vocabularies.Catalog", | ||
), | ||
required=False, | ||
default=[], | ||
) | ||
|
||
form.widget( | ||
"tassonomia_argomenti", | ||
RelatedItemsFieldWidget, | ||
vocabulary="plone.app.vocabularies.Catalog", | ||
pattern_options={ | ||
"selectableTypes": ["Pagina Argomento"], | ||
}, | ||
) | ||
|
||
textindexer.searchable("tassonomia_argomenti") | ||
|
||
|
||
@provider(IFormFieldProvider) | ||
class IArgomenti(IArgomentiSchema): | ||
""" """ | ||
|
||
|
||
@provider(IFormFieldProvider) | ||
class IArgomentiEvento(IArgomentiSchema): | ||
""" """ | ||
|
||
tassonomia_argomenti = RelationList( | ||
title=_("tassonomia_argomenti_label", default="Argomenti"), | ||
description=_( | ||
"tassonomia_argomenti_help", | ||
default="Seleziona una lista di argomenti d'interesse per questo" | ||
" contenuto.", | ||
), | ||
value_type=RelationChoice( | ||
title=_("Argomenti correlati"), | ||
vocabulary="plone.app.vocabularies.Catalog", | ||
), | ||
required=True, | ||
default=[], | ||
) | ||
|
||
|
||
@implementer(IArgomenti) | ||
@adapter(IDexterityContent) | ||
class Argomenti(object): | ||
"""""" | ||
|
||
def __init__(self, context): | ||
self.context = context | ||
|
||
|
||
@implementer(IArgomentiEvento) | ||
@adapter(IEvent) | ||
class ArgomentiEvento(object): | ||
"""""" | ||
|
||
def __init__(self, context): | ||
self.context = context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<configure | ||
xmlns="http://namespaces.zope.org/zope" | ||
xmlns:plone="http://namespaces.plone.org/plone" | ||
i18n_domain="iosanita.contenttypes" | ||
> | ||
|
||
<include | ||
package="plone.behavior" | ||
file="meta.zcml" | ||
/> | ||
|
||
<plone:behavior | ||
name="iosanita.contenttypes.behavior.evento" | ||
title="Metadati evento" | ||
description="Adds fields." | ||
factory=".evento.Evento" | ||
provides=".evento.IEvento" | ||
for="plone.event.interfaces.IEvent" | ||
marker=".evento.IEvento" | ||
/> | ||
|
||
<plone:behavior | ||
name="iosanita.contenttypes.behavior.argomenti" | ||
title="Argomenti" | ||
description="Tassonomia argomenti" | ||
factory=".argomenti.Argomenti" | ||
provides=".argomenti.IArgomenti" | ||
for="plone.dexterity.interfaces.IDexterityContent" | ||
marker=".argomenti.IArgomenti" | ||
/> | ||
|
||
<plone:behavior | ||
name="iosanita.contenttypes.behavior.argomenti_evento" | ||
title="Argomenti" | ||
description="Tassonomia argomenti evento" | ||
factory=".argomenti.ArgomentiEvento" | ||
provides=".argomenti.IArgomentiEvento" | ||
for="plone.dexterity.interfaces.IDexterityContent" | ||
marker=".argomenti.IArgomentiEvento" | ||
/> | ||
|
||
<!-- <plone:behavior | ||
name="iosanita.contenttypes.behavior.luoghi_correlati" | ||
title="Luoghi correlati" | ||
description="" | ||
factory=".luoghi_correlati.LuoghiCorrelati" | ||
provides=".luoghi_correlati.ILuoghiCorrelati" | ||
for="plone.dexterity.interfaces.IDexterityContent" | ||
marker=".luoghi_correlati.ILuoghiCorrelati" | ||
/> --> | ||
|
||
<!-- <plone:behavior | ||
name="iosanita.contenttypes.behavior.luoghi_correlati_evento" | ||
title="Luoghi correlati" | ||
description="" | ||
factory=".luoghi_correlati.LuoghiCorrelatiEvento" | ||
provides=".luoghi_correlati.ILuoghiCorrelatiEvento" | ||
for="plone.app.contenttypes.interfaces.IEvent" | ||
marker=".luoghi_correlati.ILuoghiCorrelatiEvento" | ||
/> --> | ||
|
||
<plone:behavior | ||
name="iosanita.contenttypes.behavior.strutture_correlate" | ||
title="Strutture correlate" | ||
description="" | ||
factory=".strutture_correlate.StruttureCorrelate" | ||
provides=".strutture_correlate.IStruttureCorrelate" | ||
for="plone.dexterity.interfaces.IDexterityContent" | ||
marker=".strutture_correlate.IStruttureCorrelate" | ||
/> | ||
|
||
<plone:behavior | ||
name="iosanita.contenttypes.behavior.additional_help_infos" | ||
title="Ulteriori campi aiuto testuali" | ||
description="" | ||
factory=".additional_help_infos.AdditionalHelpInfos" | ||
provides=".additional_help_infos.IAdditionalHelpInfos" | ||
for="plone.dexterity.interfaces.IDexterityContent" | ||
marker=".additional_help_infos.IAdditionalHelpInfos" | ||
/> | ||
<plone:behavior | ||
name="iosanita.contenttypes.behavior.address_event" | ||
title="Address Event" | ||
description="Behavior address per Event." | ||
factory=".address.AddressEvent" | ||
provides=".address.IAddressEvent" | ||
marker=".address.IAddressEvent" | ||
/> | ||
<plone:behavior | ||
name="iosanita.contenttypes.behavior.contatti_event" | ||
title="Contatti" | ||
description="Behavior contatti per Event." | ||
factory=".contatti.ContattiEvent" | ||
provides=".contatti.IContattiEvent" | ||
marker=".contatti.IContattiEvent" | ||
/> | ||
<plone:behavior | ||
name="iosanita.contenttypes.behavior.geolocation_event" | ||
title="Geolocatable" | ||
description="Behavior geolocatable per Event." | ||
factory=".geolocation.GeolocatableEvent" | ||
provides=".geolocation.IGeolocatableEvent" | ||
marker=".geolocation.IGeolocatableEvent" | ||
/> | ||
|
||
</configure> |
Oops, something went wrong.