diff --git a/src/iosanita/policy/browser/__init__.py b/src/iosanita/policy/browser/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/iosanita/policy/browser/configure.zcml b/src/iosanita/policy/browser/configure.zcml
new file mode 100644
index 0000000..ae51cd2
--- /dev/null
+++ b/src/iosanita/policy/browser/configure.zcml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
diff --git a/src/iosanita/policy/browser/controlpanel.py b/src/iosanita/policy/browser/controlpanel.py
new file mode 100644
index 0000000..80bc69a
--- /dev/null
+++ b/src/iosanita/policy/browser/controlpanel.py
@@ -0,0 +1,12 @@
+from iosanita.policy import _
+from iosanita.policy.interfaces import IIoSanitaSettings
+from plone.app.registry.browser import controlpanel
+
+
+class IoSanitaSettingsForm(controlpanel.RegistryEditForm):
+ schema = IIoSanitaSettings
+ label = _("iosanita_settings_label", default="Io-Sanità Settings")
+
+
+class IoSanitaControlPanel(controlpanel.ControlPanelFormWrapper):
+ form = IoSanitaSettingsForm
diff --git a/src/iosanita/policy/configure.zcml b/src/iosanita/policy/configure.zcml
index 4b13a73..342d771 100644
--- a/src/iosanita/policy/configure.zcml
+++ b/src/iosanita/policy/configure.zcml
@@ -14,6 +14,7 @@
-->
+
diff --git a/src/iosanita/policy/interfaces.py b/src/iosanita/policy/interfaces.py
index c1b6c69..a083340 100644
--- a/src/iosanita/policy/interfaces.py
+++ b/src/iosanita/policy/interfaces.py
@@ -1,8 +1,88 @@
-# -*- coding: utf-8 -*-
-"""Module where all interfaces, events and exceptions live."""
-
+from iosanita.policy import _
+from plone.restapi.controlpanels.interfaces import IControlpanel
+from zope.interface import Interface
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+from zope.schema import Bool
+from zope.schema import List
+from zope.schema import SourceText
+from zope.schema import TextLine
class IIosanitaPolicyLayer(IDefaultBrowserLayer):
"""Marker interface that defines a browser layer."""
+
+
+class IIoSanitaSettingsControlpanel(IControlpanel):
+ """ """
+
+
+class IIoSanitaSettings(Interface):
+ """
+ Control panel settings
+ """
+
+ lead_image_dimension = List(
+ title=_(
+ "lead_image_dimension_label",
+ default="Dimensioni lead image",
+ ),
+ description=_(
+ "lead_image_dimension_help",
+ default="Se un content-type deve avere una dimensione della "
+ "leadimage particolare, indicarle qui. "
+ "Inserire le dimensioni nella forma di esempio "
+ "PortalType|900x900",
+ ),
+ required=True,
+ default=[
+ "News Item|1920x600",
+ "Servizio|1920x600",
+ "UnitaOrganizzativa|1920x600",
+ "Persona|180x100",
+ ],
+ value_type=TextLine(),
+ )
+
+ search_sections = SourceText(
+ title=_("search_sections_label", default="Sezioni ricerca"),
+ description=_(
+ "search_sections_help",
+ default="Inserire una lista di sezioni per la ricerca.",
+ ),
+ default="",
+ required=False,
+ )
+
+ show_modified_default = Bool(
+ title=_("show_modified_default_label", default="Mostra la data di modifica"),
+ description=_(
+ "show_modified_default_help",
+ default="Questo è il valore di default per decidere se mostrare "
+ "o meno la data di modifica nei contenuti che hanno la behavior "
+ "abilitata. E' poi possibile sovrascrivere il default nei singoli "
+ 'contenuti (nel tab "Impostazioni").',
+ ),
+ 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,
+ )
+
+ contatti_testata = SourceText(
+ title=_("contatti_testata_label", default="Contatti in testata"),
+ description=_(
+ "contatti_testatas_help",
+ default="Inserire i contatti.",
+ ),
+ default="",
+ required=False,
+ )
diff --git a/src/iosanita/policy/profiles/default/controlpanel.xml b/src/iosanita/policy/profiles/default/controlpanel.xml
new file mode 100644
index 0000000..44e897d
--- /dev/null
+++ b/src/iosanita/policy/profiles/default/controlpanel.xml
@@ -0,0 +1,20 @@
+
+
diff --git a/src/iosanita/policy/profiles/default/registry/settings.xml b/src/iosanita/policy/profiles/default/registry/settings.xml
new file mode 100644
index 0000000..09632af
--- /dev/null
+++ b/src/iosanita/policy/profiles/default/registry/settings.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+ gallery 250:65536
+
+
+
diff --git a/src/iosanita/policy/restapi/configure.zcml b/src/iosanita/policy/restapi/configure.zcml
index 64be82b..e4b3d68 100644
--- a/src/iosanita/policy/restapi/configure.zcml
+++ b/src/iosanita/policy/restapi/configure.zcml
@@ -3,10 +3,13 @@
xmlns:plone="http://namespaces.plone.org/plone"
>
-
+
+
+
diff --git a/src/iosanita/policy/restapi/controlpanel.py b/src/iosanita/policy/restapi/controlpanel.py
new file mode 100644
index 0000000..f2b71bb
--- /dev/null
+++ b/src/iosanita/policy/restapi/controlpanel.py
@@ -0,0 +1,16 @@
+from iosanita.policy.interfaces import IIosanitaPolicyLayer
+from iosanita.policy.interfaces import IIoSanitaSettings
+from iosanita.policy.interfaces import IIoSanitaSettingsControlpanel
+from plone.restapi.controlpanels import RegistryConfigletPanel
+from zope.component import adapter
+from zope.interface import implementer
+from zope.interface import Interface
+
+
+@adapter(Interface, IIosanitaPolicyLayer)
+@implementer(IIoSanitaSettingsControlpanel)
+class IoSanitaSettingsControlpanel(RegistryConfigletPanel):
+ schema = IIoSanitaSettings
+ configlet_id = "IoSanitaSettings"
+ configlet_category_id = "Products"
+ schema_prefix = None
diff --git a/src/iosanita/policy/testing.py b/src/iosanita/policy/testing.py
index e2435cf..04b37da 100644
--- a/src/iosanita/policy/testing.py
+++ b/src/iosanita/policy/testing.py
@@ -11,8 +11,8 @@
import collective.volto.slimheader
import iosanita.contenttypes
import iosanita.policy
-import souper.plone
import plone.app.caching
+import souper.plone
class TestLayer(ContentTypesTestLayer):
diff --git a/src/iosanita/policy/tests/test_controlpanel_api.py b/src/iosanita/policy/tests/test_controlpanel_api.py
new file mode 100644
index 0000000..44a22bb
--- /dev/null
+++ b/src/iosanita/policy/tests/test_controlpanel_api.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+from iosanita.policy.testing import RESTAPI_TESTING
+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
+
+import unittest
+
+
+class ControlpanelTest(unittest.TestCase):
+ layer = RESTAPI_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"])
+
+ def test_controlpanel_exists(self):
+ response = self.api_session.get("/@controlpanels/iosanita-settings")
+
+ import pdb
+
+ pdb.set_trace()
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.headers.get("Content-Type"), "application/json")
+
+ def test_controlpanel_listed(self):
+ response = self.api_session.get("/@controlpanels")
+
+ titles = [x.get("title") for x in response.json()]
+ self.assertIn("Impostazioni IoSanita", titles)
diff --git a/test_plone60.cfg b/test_plone60.cfg
index cc7aa50..bf7eed7 100644
--- a/test_plone60.cfg
+++ b/test_plone60.cfg
@@ -131,33 +131,4 @@ souper.plone = 1.3.1
# iosanita.contenttypes==2.0.0.dev0
# iosanita.policy==1.0.0.dev0
# redturtle.volto==5.5.0
-z3c.jbot = 2.0
-
-# Added by buildout at 2024-08-14 17:13:10.027495
-
-# Required by:
-# iosanita.policy==1.0.0.dev0
-collective.volto.slimheader = 1.0.1
-
-# Required by:
-# iosanita.policy==1.0.0.dev0
-iw.rejectanonymous = 1.2.7
-
-# Added by buildout at 2024-08-14 17:14:55.049853
-plone.formwidget.autocomplete = 1.4.1
-
-# Required by:
-# redturtle.bandi==1.4.5
-collective.tiles.collection = 2.0.0
-
-# Required by:
-# collective.tiles.collection==2.0.0
-plone.app.tiles = 4.0.1
-
-# Required by:
-# collective.tiles.collection==2.0.0
-plone.formwidget.contenttree = 1.2.0
-
-# Required by:
-# iosanita.contenttypes==2.0.0.dev0
-redturtle.bandi = 1.4.5
+z3c.jbot = 2.0
\ No newline at end of file