Skip to content

Commit

Permalink
added Documento ct
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-andreotti committed Jul 26, 2024
1 parent 5352259 commit 58806bb
Show file tree
Hide file tree
Showing 8 changed files with 379 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/iosanita/contenttypes/content/documento.py
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):
""" """
122 changes: 122 additions & 0 deletions src/iosanita/contenttypes/interfaces/documento.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# -*- 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"),
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"],
)
4 changes: 4 additions & 0 deletions src/iosanita/contenttypes/permissions.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
id="iosanita.contenttypes.AddServizio"
title="iosanita.contenttypes: Add Servizio"
/>
<permission
id="iosanita.contenttypes.AddDocumento"
title="iosanita.contenttypes: Add Documento"
/>
</configure>

</configure>
6 changes: 6 additions & 0 deletions src/iosanita/contenttypes/profiles/default/rolemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,11 @@
<role name="Owner" />
<role name="Contributor" />
</permission>
<permission acquire="True" name="iosanita.contenttypes: Add Documento">
<role name="Manager" />
<role name="Site Administrator" />
<role name="Owner" />
<role name="Contributor" />
</permission>
</permissions>
</rolemap>
1 change: 1 addition & 0 deletions src/iosanita/contenttypes/profiles/default/types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
name="Struttura"
/>
<object meta_type="Dexterity FTI" name="Servizio" />
<object meta_type="Dexterity FTI" name="Documento" />

</object>
108 changes: 108 additions & 0 deletions src/iosanita/contenttypes/profiles/default/types/Documento.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?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" />
</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>
5 changes: 5 additions & 0 deletions src/iosanita/contenttypes/restapi/services/types/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class FieldsetsMismatchError(Exception):
"utenti",
"ulteriori_informazioni",
],
"Documento": [
"default",
"cosa_e",
"a_chi_si_rivolge",
],
"Event": [
"default",
"cosa_e",
Expand Down
Loading

0 comments on commit 58806bb

Please sign in to comment.