-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added Documento ct #5
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# -*- coding: utf-8 -*- | ||
from iosanita.contenttypes import _ | ||
from plone.autoform.interfaces import IFormFieldProvider | ||
from plone.dexterity.interfaces import IDexterityContent | ||
from plone.namedfile import field | ||
from plone.supermodel import model | ||
from zope.component import adapter | ||
from zope.interface import implementer | ||
from zope.interface import provider | ||
|
||
|
||
class IMultiFileSchema(model.Schema): | ||
"""""" | ||
|
||
file_principale = field.NamedBlobFile( | ||
title=_("file_principale_label", default="Vai al documento"), | ||
description=_( | ||
"file_principale_help", | ||
default="Inserisci il file principale di questo contenuto.", | ||
), | ||
required=True, | ||
) | ||
|
||
formato_alternativo_1 = field.NamedBlobFile( | ||
title=_("formato_alternativo_1_label", default="Formato alternativo 1"), | ||
description=_( | ||
"formato_alternativo_1_help", | ||
default="Inserisci un eventuale formato alternativo del " | ||
"file principale.", | ||
), | ||
required=False, | ||
) | ||
|
||
formato_alternativo_2 = field.NamedBlobFile( | ||
title=_("formato_alternativo_2_label", default="Formato alternativo 2"), | ||
description=_( | ||
"formato_alternativo_2_help", | ||
default="Inserisci un eventuale formato alternativo del " | ||
"file principale.", | ||
), | ||
required=False, | ||
) | ||
|
||
model.primary("file_principale") | ||
|
||
model.fieldset( | ||
"formati", | ||
label=_("formati_label", default="Formati"), | ||
fields=[ | ||
"file_principale", | ||
"formato_alternativo_1", | ||
"formato_alternativo_2", | ||
], | ||
) | ||
|
||
|
||
@provider(IFormFieldProvider) | ||
class IMultiFile(IMultiFileSchema): | ||
"""""" | ||
|
||
|
||
@implementer(IMultiFile) | ||
@adapter(IDexterityContent) | ||
class MultiFile(object): | ||
"""""" | ||
|
||
def __init__(self, context): | ||
self.context = context |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
from iosanita.contenttypes.interfaces.documento import IDocumento | ||
from plone.dexterity.content import Container | ||
from zope.interface import implementer | ||
|
||
|
||
@implementer(IDocumento) | ||
class Documento(Container): | ||
""" """ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from collective.volto.blocksfield.field import BlocksField | ||
from iosanita.contenttypes import _ | ||
from iosanita.contenttypes.interfaces import IIosanitaContenttypes | ||
from plone.app.z3cform.widget import RelatedItemsFieldWidget | ||
from plone.autoform import directives as form | ||
from plone.supermodel import model | ||
from z3c.relationfield.schema import RelationChoice | ||
from z3c.relationfield.schema import RelationList | ||
from zope import schema | ||
|
||
|
||
class IDocumento(model.Schema, IIosanitaContenttypes): | ||
"""Marker interface for content type""" | ||
|
||
protocollo = schema.TextLine( | ||
title=_( | ||
"protocollo_documento_label", | ||
default="Numero di protocollo", | ||
), | ||
description=_( | ||
"protocollo_documento_help", | ||
default="Il numero di protocollo del documento.", | ||
), | ||
max_length=255, | ||
required=False, | ||
) | ||
|
||
data_protocollo = schema.Date( | ||
title=_("data_protocollo", default="Data del protocollo"), | ||
required=False, | ||
) | ||
|
||
descrizione_estesa = BlocksField( | ||
title=_("descrizione_estesa_label", default="Cos'è"), | ||
required=True, | ||
description=_( | ||
"descrizione_estesa_documento_help", | ||
default="Descrizione estesa e completa del Documento.", | ||
), | ||
) | ||
|
||
# formati_alternativi = BlocksField( | ||
# title=_("formati_alternativi_label", default="Formati disponibili"), | ||
# description=_( | ||
# "formati_alternativi_help", | ||
# default="Lista dei formati in cui è disponibile il documento", | ||
# ), | ||
# required=True, | ||
# ) | ||
|
||
servizio_procedura_riferimento = RelationList( | ||
title=_( | ||
"servizio_procedura_riferimento_label", | ||
default="Servizio di riferimento / Procedura di riferimento", | ||
), | ||
description=_( | ||
"servizio_procedura_riferimento_help", | ||
default="Indicazione del servizio, la prestazione o la procedura (Come fare per) a cui fa riferimento il documento.", | ||
), | ||
default=[], | ||
value_type=RelationChoice(vocabulary="plone.app.vocabularies.Catalog"), | ||
required=False, | ||
missing_value=(), | ||
) | ||
|
||
uo_correlata = RelationList( | ||
title=_("uo_correlata_documento_label", default="Responsabile del documento"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metti una descrizione per dire che si fa riferimento ad una UO There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fatto. |
||
description=_( | ||
"uo_correlata_documento_help", | ||
default="Indicazione dell'unità organizzativa responsabile del documento.", | ||
), | ||
default=[], | ||
value_type=RelationChoice(vocabulary="plone.app.vocabularies.Catalog"), | ||
required=True, | ||
missing_value=(), | ||
) | ||
|
||
autori = RelationList( | ||
title=_( | ||
"autori_label", | ||
default="Autore/i", | ||
), | ||
description=_( | ||
"autori_help", | ||
default="Seleziona una lista di autori che hanno pubblicato " | ||
"il documento.", | ||
), | ||
value_type=RelationChoice(vocabulary="plone.app.vocabularies.Catalog"), | ||
required=False, | ||
default=[], | ||
) | ||
|
||
# widgets | ||
form.widget( | ||
"uo_correlata", | ||
RelatedItemsFieldWidget, | ||
vocabulary="plone.app.vocabularies.Catalog", | ||
pattern_options={ | ||
"maximumSelectionSize": 1, | ||
"selectableTypes": ["UnitaOrganizzativa"], | ||
}, | ||
) | ||
form.widget( | ||
"autori", | ||
RelatedItemsFieldWidget, | ||
vocabulary="plone.app.vocabularies.Catalog", | ||
pattern_options={ | ||
"selectableTypes": ["Persona"], | ||
}, | ||
) | ||
form.widget( | ||
"servizio_procedura_riferimento", | ||
RelatedItemsFieldWidget, | ||
vocabulary="plone.app.vocabularies.Catalog", | ||
pattern_options={ | ||
"selectableTypes": ["ComeFarePer", "Servizio"], | ||
}, | ||
) | ||
|
||
model.fieldset( | ||
"cosa_e", | ||
label=_("cosa_e_fieldset", default="Cos'è"), | ||
fields=["descrizione_estesa"], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
meta_type="Dexterity FTI" | ||
name="Documento" | ||
i18n:domain="iosanita.contenttypes" | ||
> | ||
|
||
<!-- Basic properties --> | ||
<property name="title" | ||
i18n:translate="" | ||
>Documento</property> | ||
<property name="description" | ||
i18n:translate="" | ||
/> | ||
|
||
<property name="allow_discussion">False</property> | ||
<property name="factory">Documento</property> | ||
<property name="icon_expr" /> | ||
<property name="link_target" /> | ||
|
||
<!-- Hierarchy control --> | ||
<property name="global_allow">True</property> | ||
<property name="filter_content_types">True</property> | ||
<property name="allowed_content_types" | ||
purge="False" | ||
> | ||
<element value="Document" /> | ||
|
||
</property> | ||
<!-- Schema, class and security --> | ||
<property name="add_permission">iosanita.contenttypes.AddDocumento</property> | ||
<property name="klass">iosanita.contenttypes.content.documento.Documento</property> | ||
<property name="model_file" /> | ||
<property name="model_source" /> | ||
<property name="schema">iosanita.contenttypes.interfaces.documento.IDocumento</property> | ||
|
||
<!-- Enabled behaviors --> | ||
<property name="behaviors" | ||
purge="false" | ||
> | ||
<element value="plone.namefromtitle" /> | ||
<element value="plone.allowdiscussion" /> | ||
<element value="plone.excludefromnavigation" /> | ||
<element value="plone.shortname" /> | ||
<element value="plone.ownership" /> | ||
<element value="plone.publication" /> | ||
<element value="plone.categorization" /> | ||
<element value="plone.basic" /> | ||
<element value="plone.locking" /> | ||
<element value="plone.constraintypes" /> | ||
<element value="plone.leadimage" /> | ||
<element value="volto.preview_image" /> | ||
<element value="plone.relateditems" /> | ||
<element value="plone.textindexer" /> | ||
<element value="plone.translatable" /> | ||
<element value="kitconcept.seo" /> | ||
<element value="plone.versioning" /> | ||
<element value="iosanita.contenttypes.behavior.a_chi_si_rivolge" /> | ||
<element value="collective.taxonomy.generated.a_chi_si_rivolge_tassonomia" /> | ||
<element value="collective.taxonomy.generated.parliamo_di" /> | ||
<element value="iosanita.contenttypes.behavior.multi_file" /> | ||
</property> | ||
|
||
<!-- View information --> | ||
<property name="add_view_expr">string:${folder_url}/++add++Documento</property> | ||
<property name="default_view">view</property> | ||
<property name="default_view_fallback">False</property> | ||
<property name="immediate_view">view</property> | ||
<property name="view_methods"> | ||
<element value="view" /> | ||
</property> | ||
|
||
<!-- Method aliases --> | ||
<alias from="(Default)" | ||
to="(dynamic view)" | ||
/> | ||
<alias from="edit" | ||
to="@@edit" | ||
/> | ||
<alias from="sharing" | ||
to="@@sharing" | ||
/> | ||
<alias from="view" | ||
to="(selected layout)" | ||
/> | ||
|
||
<!-- Actions --> | ||
<action action_id="view" | ||
category="object" | ||
condition_expr="" | ||
title="View" | ||
url_expr="string:${object_url}" | ||
visible="True" | ||
i18n:attributes="title" | ||
> | ||
<permission value="View" /> | ||
</action> | ||
<action action_id="edit" | ||
category="object" | ||
condition_expr="not:object/@@plone_lock_info/is_locked_for_current_user|python:True" | ||
title="Edit" | ||
url_expr="string:${object_url}/edit" | ||
visible="True" | ||
i18n:attributes="title" | ||
> | ||
<permission value="Modify portal content" /> | ||
</action> | ||
|
||
</object> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,12 @@ class FieldsetsMismatchError(Exception): | |
"utenti", | ||
"ulteriori_informazioni", | ||
], | ||
"Documento": [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non so se i file (principale e alternativi) li metterei in un fieldest a parte, subito dopo default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Li ho messi nel fieldset "Formati". |
||
"default", | ||
"formati", | ||
"cosa_e", | ||
"a_chi_si_rivolge", | ||
], | ||
"Event": [ | ||
"default", | ||
"cosa_e", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direi che qui ci vanno 3 campi file come questi: https://github.com/RedTurtle/design.plone.contenttypes/blob/main/src/design/plone/contenttypes/behaviors/multi_file.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fatto.