imio.smartweb.core 1.1.15__py3-none-any.whl → 1.1.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- imio/smartweb/core/browser/configure.zcml +1 -0
- imio/smartweb/core/browser/controlpanel.py +24 -0
- imio/smartweb/core/browser/dashboards/__init__.py +0 -0
- imio/smartweb/core/browser/dashboards/configure.zcml +17 -0
- imio/smartweb/core/browser/dashboards/plausible.pt +29 -0
- imio/smartweb/core/browser/dashboards/plausible.py +21 -0
- imio/smartweb/core/browser/faceted/map.pt +3 -7
- imio/smartweb/core/browser/utils.py +33 -0
- imio/smartweb/core/contents/__init__.py +4 -0
- imio/smartweb/core/contents/cropping.py +2 -5
- imio/smartweb/core/contents/folder/content.py +1 -0
- imio/smartweb/core/contents/rest/base.py +16 -0
- imio/smartweb/core/contents/rest/directory/endpoint.py +8 -15
- imio/smartweb/core/contents/rest/events/endpoint.py +6 -12
- imio/smartweb/core/contents/rest/news/endpoint.py +6 -11
- imio/smartweb/core/contents/rest/search/endpoint.py +26 -6
- imio/smartweb/core/contents/sections/configure.zcml +1 -0
- imio/smartweb/core/contents/sections/contact/view.pt +1 -2
- imio/smartweb/core/contents/sections/external_content/__init__.py +0 -0
- imio/smartweb/core/contents/sections/external_content/configure.zcml +14 -0
- imio/smartweb/core/contents/sections/external_content/content.py +32 -0
- imio/smartweb/core/contents/sections/external_content/view.pt +31 -0
- imio/smartweb/core/contents/sections/external_content/views.py +31 -0
- imio/smartweb/core/contents/sections/gallery/view.pt +1 -2
- imio/smartweb/core/contents/sections/macros.pt +0 -4
- imio/smartweb/core/contents/sections/text/configure.zcml +0 -6
- imio/smartweb/core/contents/sections/text/content.py +0 -12
- imio/smartweb/core/contents/sections/text/forms.py +2 -0
- imio/smartweb/core/permissions.zcml +6 -0
- imio/smartweb/core/profiles/default/metadata.xml +1 -1
- imio/smartweb/core/profiles/default/rolemap.xml +6 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.Page.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.PortalPage.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.Procedure.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionContact.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionEvents.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionExternalContent.xml +35 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionFiles.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionGallery.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionHTML.xml +1 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionLinks.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionMap.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionNews.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionPostit.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionSelections.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionSendinblue.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionSlide.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionText.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionVideo.xml +0 -1
- imio/smartweb/core/profiles/default/types.xml +1 -0
- imio/smartweb/core/profiles/default/workflows.xml +1 -0
- imio/smartweb/core/tests/resources/json_rest_directory.json +1099 -0
- imio/smartweb/core/tests/resources/json_rest_events.json +1099 -0
- imio/smartweb/core/tests/resources/json_rest_news.json +1103 -4
- imio/smartweb/core/tests/test_cropping.py +2 -24
- imio/smartweb/core/tests/test_folder.py +17 -0
- imio/smartweb/core/tests/test_plausibleview.py +83 -0
- imio/smartweb/core/tests/test_rest.py +40 -0
- imio/smartweb/core/tests/test_section_news.py +0 -1
- imio/smartweb/core/tests/test_sections.py +34 -0
- imio/smartweb/core/upgrades/configure.zcml +90 -0
- imio/smartweb/core/upgrades/profiles/1037_to_1038/registry/plausible.xml +9 -0
- imio/smartweb/core/upgrades/profiles/1038_to_1039/rolemap.xml +12 -0
- imio/smartweb/core/upgrades/profiles/1038_to_1039/types/imio.smartweb.Page.xml +11 -0
- imio/smartweb/core/upgrades/profiles/1038_to_1039/types/imio.smartweb.PortalPage.xml +11 -0
- imio/smartweb/core/upgrades/profiles/1038_to_1039/types/imio.smartweb.Procedure.xml +11 -0
- imio/smartweb/core/upgrades/profiles/1038_to_1039/types/imio.smartweb.SectionExternalContent.xml +36 -0
- imio/smartweb/core/upgrades/profiles/1038_to_1039/types.xml +4 -0
- imio/smartweb/core/upgrades/profiles/1038_to_1039/workflows.xml +6 -0
- imio/smartweb/core/upgrades/profiles/1039_to_1040/types/imio.smartweb.SectionSlide.xml +14 -0
- imio/smartweb/core/upgrades/profiles/1040_to_1041/types/imio.smartweb.SectionText.xml +17 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionContact.xml +14 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionEvents.xml +14 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionExternalContent.xml +15 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionFiles.xml +14 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionGallery.xml +15 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionLinks.xml +14 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionMap.xml +15 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionNews.xml +14 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionPostit.xml +14 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionSelections.xml +14 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionSendinblue.xml +14 -0
- imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionVideo.xml +15 -0
- imio/smartweb/core/webcomponents/build/css/195.smartweb-webcomponents-compiled.css +1 -1
- imio/smartweb/core/webcomponents/build/css/552.smartweb-webcomponents-compiled.css +1 -1
- imio/smartweb/core/webcomponents/build/js/195.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/212.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/323.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/510.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/552.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/{462.smartweb-webcomponents-compiled.js → 565.smartweb-webcomponents-compiled.js} +1 -1
- imio/smartweb/core/webcomponents/build/js/{842.smartweb-webcomponents-compiled.js → 729.smartweb-webcomponents-compiled.js} +2 -2
- imio/smartweb/core/webcomponents/build/js/9.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/9.smartweb-webcomponents-compiled.js.LICENSE.txt +2 -2
- imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactCard/ContactCard.jsx +2 -3
- imio/smartweb/core/webcomponents/src/components/Events/ContactCard/ContactCard.jsx +1 -2
- imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +0 -1
- imio/smartweb/core/webcomponents/src/components/News/ContactCard/ContactCard.jsx +1 -2
- imio/smartweb/core/webcomponents/src/components/News/ContactContent/ContactContent.jsx +1 -1
- {imio.smartweb.core-1.1.15.dist-info → imio.smartweb.core-1.1.19.dist-info}/METADATA +63 -1
- {imio.smartweb.core-1.1.15.dist-info → imio.smartweb.core-1.1.19.dist-info}/RECORD +110 -78
- imio/smartweb/core/webcomponents/build/assets/img-placeholder-bla.a2b8b384c46ce56c99f042dc4625d309.png +0 -0
- imio/smartweb/core/webcomponents/build/js/650.smartweb-webcomponents-compiled.js +0 -2
- /imio/smartweb/core/webcomponents/build/js/{650.smartweb-webcomponents-compiled.js.LICENSE.txt → 212.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
- /imio/smartweb/core/webcomponents/build/js/{842.smartweb-webcomponents-compiled.js.LICENSE.txt → 729.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
- /imio.smartweb.core-1.1.15-py3.10-nspkg.pth → /imio.smartweb.core-1.1.19-py3.10-nspkg.pth +0 -0
- {imio.smartweb.core-1.1.15.dist-info → imio.smartweb.core-1.1.19.dist-info}/LICENSE.GPL +0 -0
- {imio.smartweb.core-1.1.15.dist-info → imio.smartweb.core-1.1.19.dist-info}/LICENSE.rst +0 -0
- {imio.smartweb.core-1.1.15.dist-info → imio.smartweb.core-1.1.19.dist-info}/WHEEL +0 -0
- {imio.smartweb.core-1.1.15.dist-info → imio.smartweb.core-1.1.19.dist-info}/namespace_packages.txt +0 -0
- {imio.smartweb.core-1.1.15.dist-info → imio.smartweb.core-1.1.19.dist-info}/top_level.txt +0 -0
@@ -41,9 +41,7 @@ class TestCropping(ImioSmartwebTestCase):
|
|
41
41
|
contentFilter={"portal_type": "imio.smartweb.Footer"}
|
42
42
|
)[0]
|
43
43
|
adapter = ICropping(footer, alternate=None)
|
44
|
-
self.assertEqual(
|
45
|
-
["affiche"], adapter.get_scales("background_image", self.request)
|
46
|
-
)
|
44
|
+
self.assertEqual([], adapter.get_scales("background_image", self.request))
|
47
45
|
|
48
46
|
# minisite cropping
|
49
47
|
view = getMultiAdapter((self.folder, self.request), name="minisite_settings")
|
@@ -89,21 +87,8 @@ class TestCropping(ImioSmartwebTestCase):
|
|
89
87
|
)
|
90
88
|
adapter = ICropping(section, alternate=None)
|
91
89
|
self.assertIsNotNone(adapter)
|
92
|
-
self.
|
93
|
-
"affiche", adapter.get_scales("background_image", self.request)
|
94
|
-
)
|
90
|
+
self.assertEqual([], adapter.get_scales("background_image", self.request))
|
95
91
|
self.assertNotIn("banner", adapter.get_scales("image", self.request))
|
96
|
-
if section_type == "imio.smartweb.SectionText":
|
97
|
-
self.assertEqual(
|
98
|
-
["affiche"], adapter.get_scales("background_image", self.request)
|
99
|
-
)
|
100
|
-
section.image = NamedBlobImage(**make_named_image())
|
101
|
-
section.image_size = "preview"
|
102
|
-
self.assertEqual(["preview"], adapter.get_scales("image", self.request))
|
103
|
-
section.image_size = "large"
|
104
|
-
self.assertEqual(["large"], adapter.get_scales("image", self.request))
|
105
|
-
section.image_size = "mini"
|
106
|
-
self.assertEqual(["mini"], adapter.get_scales("image", self.request))
|
107
92
|
|
108
93
|
def test_cropping_view(self):
|
109
94
|
cropping_view = getMultiAdapter(
|
@@ -115,10 +100,3 @@ class TestCropping(ImioSmartwebTestCase):
|
|
115
100
|
(self.page, self.request), name="croppingeditor"
|
116
101
|
)
|
117
102
|
self.assertEqual(len(list(cropping_view._scales("image"))), 3)
|
118
|
-
section = api.content.create(
|
119
|
-
container=self.page,
|
120
|
-
type="imio.smartweb.SectionText",
|
121
|
-
title="Text section",
|
122
|
-
)
|
123
|
-
cropping_view = getMultiAdapter((section, self.request), name="croppingeditor")
|
124
|
-
self.assertEqual(len(list(cropping_view._scales("image"))), 1)
|
@@ -366,3 +366,20 @@ class TestFolder(ImioSmartwebTestCase):
|
|
366
366
|
uuid = IUUID(page2)
|
367
367
|
brains = api.content.find(UID=uuid)
|
368
368
|
self.assertEqual(len(brains), 0)
|
369
|
+
|
370
|
+
def test_select_view_template(self):
|
371
|
+
folder = api.content.create(
|
372
|
+
container=self.portal,
|
373
|
+
type="imio.smartweb.Folder",
|
374
|
+
title="My folder",
|
375
|
+
)
|
376
|
+
self.request.form = {
|
377
|
+
"templateId": "block_view_with_images",
|
378
|
+
"form.buttons.apply": "Apply",
|
379
|
+
}
|
380
|
+
creation_date = folder.ModificationDate()
|
381
|
+
view = getMultiAdapter((folder, self.request), name="selectViewTemplate")
|
382
|
+
sleep(1)
|
383
|
+
view.selectViewTemplate()
|
384
|
+
new_date = folder.ModificationDate()
|
385
|
+
self.assertNotEqual(creation_date, new_date)
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
from plone import api
|
4
|
+
from imio.smartweb.core.testing import IMIO_SMARTWEB_CORE_INTEGRATION_TESTING
|
5
|
+
from imio.smartweb.core.testing import ImioSmartwebTestCase
|
6
|
+
from imio.smartweb.core.browser.dashboards.plausible import PlausibleView
|
7
|
+
from unittest import mock
|
8
|
+
from zope.component import queryMultiAdapter
|
9
|
+
|
10
|
+
import os
|
11
|
+
|
12
|
+
|
13
|
+
class Testplausible(ImioSmartwebTestCase):
|
14
|
+
layer = IMIO_SMARTWEB_CORE_INTEGRATION_TESTING
|
15
|
+
|
16
|
+
def setUp(self):
|
17
|
+
"""Custom shared utility setup for tests"""
|
18
|
+
self.request = self.layer["request"]
|
19
|
+
self.portal = self.layer["portal"]
|
20
|
+
|
21
|
+
def set_registry_records(self):
|
22
|
+
api.portal.set_registry_record("smartweb.plausible_site", "site-registry.be")
|
23
|
+
api.portal.set_registry_record("smartweb.plausible_token", "token-registry")
|
24
|
+
api.portal.set_registry_record("smartweb.plausible_url", "url-registry.be")
|
25
|
+
|
26
|
+
@mock.patch.dict(
|
27
|
+
os.environ,
|
28
|
+
{
|
29
|
+
"SMARTWEB_PLAUSIBLE_SITE": "",
|
30
|
+
"SMARTWEB_PLAUSIBLE_TOKEN": "",
|
31
|
+
"SMARTWEB_PLAUSIBLE_URL": "",
|
32
|
+
},
|
33
|
+
)
|
34
|
+
def test_noenv(self):
|
35
|
+
view = PlausibleView(self.portal, self.request)
|
36
|
+
self.assertFalse(view.is_plausible_set)
|
37
|
+
self.set_registry_records()
|
38
|
+
self.assertTrue(view.is_plausible_set)
|
39
|
+
self.assertEqual(
|
40
|
+
view.get_iframe_src,
|
41
|
+
"https://url-registry.be/share/site-registry.be?auth=token-registry&embed=true&theme=light&background=transparent",
|
42
|
+
)
|
43
|
+
self.assertEqual(
|
44
|
+
view.get_embedhostjs_src,
|
45
|
+
"https://url-registry.be/js/embed.host.js",
|
46
|
+
)
|
47
|
+
|
48
|
+
@mock.patch.dict(
|
49
|
+
os.environ,
|
50
|
+
{
|
51
|
+
"SMARTWEB_PLAUSIBLE_SITE": "site-varenv.be",
|
52
|
+
"SMARTWEB_PLAUSIBLE_TOKEN": "token-varenv",
|
53
|
+
"SMARTWEB_PLAUSIBLE_URL": "url-varenv.be",
|
54
|
+
},
|
55
|
+
)
|
56
|
+
def test_env(self):
|
57
|
+
view = PlausibleView(self.portal, self.request)
|
58
|
+
self.assertTrue(view.is_plausible_set)
|
59
|
+
self.assertEqual(
|
60
|
+
view.get_iframe_src,
|
61
|
+
"https://url-varenv.be/share/site-varenv.be?auth=token-varenv&embed=true&theme=light&background=transparent",
|
62
|
+
)
|
63
|
+
self.assertEqual(
|
64
|
+
view.get_embedhostjs_src,
|
65
|
+
"https://url-varenv.be/js/embed.host.js",
|
66
|
+
)
|
67
|
+
self.set_registry_records()
|
68
|
+
self.assertEqual(
|
69
|
+
view.get_iframe_src,
|
70
|
+
"https://url-varenv.be/share/site-varenv.be?auth=token-varenv&embed=true&theme=light&background=transparent",
|
71
|
+
)
|
72
|
+
self.assertEqual(
|
73
|
+
view.get_embedhostjs_src,
|
74
|
+
"https://url-varenv.be/js/embed.host.js",
|
75
|
+
)
|
76
|
+
|
77
|
+
def test_plausible_view(self):
|
78
|
+
view = queryMultiAdapter((self.portal, self.request), name="stats")
|
79
|
+
self.assertNotIn("iframe", view())
|
80
|
+
self.assertIn("Plausible analytics is not set", view())
|
81
|
+
self.set_registry_records()
|
82
|
+
self.assertIn("iframe", view())
|
83
|
+
self.assertNotIn("Plausible analytics is not set", view())
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
from freezegun import freeze_time
|
4
4
|
from imio.smartweb.core import config
|
5
|
+
from imio.smartweb.core.contents.rest.base import BaseEndpoint
|
5
6
|
from imio.smartweb.core.contents.rest.directory.endpoint import DirectoryEndpoint
|
6
7
|
from imio.smartweb.core.contents.rest.events.endpoint import EventsEndpoint
|
7
8
|
from imio.smartweb.core.contents.rest.news.endpoint import NewsEndpoint
|
@@ -72,6 +73,45 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
|
|
72
73
|
def tearDown(self):
|
73
74
|
self.api_session.close()
|
74
75
|
|
76
|
+
@freeze_time("2021-09-14 8:00:00")
|
77
|
+
def test_convert_cached_image_scales(self):
|
78
|
+
endpoint = BaseEndpoint(self.portal, self.request)
|
79
|
+
modified_hash = "78fd1bab198354b6877aed44e2ea0b4d"
|
80
|
+
|
81
|
+
item = {"@id": "http://host.com/content", "image": {"scales": {}}}
|
82
|
+
endpoint.convert_cached_image_scales(item, modified_hash)
|
83
|
+
self.assertNotIn("image", item.keys())
|
84
|
+
self.assertEqual(
|
85
|
+
item["image_preview_scale"],
|
86
|
+
"http://host.com/content/@@images/image/preview?cache_key=78fd1bab198354b6877aed44e2ea0b4d",
|
87
|
+
)
|
88
|
+
self.assertEqual(
|
89
|
+
item["image_extralarge_scale"],
|
90
|
+
"http://host.com/content/@@images/image/extralarge?cache_key=78fd1bab198354b6877aed44e2ea0b4d",
|
91
|
+
)
|
92
|
+
self.assertEqual(
|
93
|
+
item["image_affiche_scale"],
|
94
|
+
"http://host.com/content/@@images/image/affiche?cache_key=78fd1bab198354b6877aed44e2ea0b4d",
|
95
|
+
)
|
96
|
+
|
97
|
+
item = {"@id": "http://host.com/content", "logo": {"scales": {}}}
|
98
|
+
endpoint.convert_cached_image_scales(item, modified_hash, "logo", ["thumb"])
|
99
|
+
self.assertNotIn("logo", item.keys())
|
100
|
+
self.assertEqual(
|
101
|
+
item["logo_thumb_scale"],
|
102
|
+
"http://host.com/content/@@images/logo/thumb?cache_key=78fd1bab198354b6877aed44e2ea0b4d",
|
103
|
+
)
|
104
|
+
|
105
|
+
item = {
|
106
|
+
"@id": "http://host.com/content",
|
107
|
+
"image": {"scales": {}},
|
108
|
+
"logo": {"scales": {}},
|
109
|
+
}
|
110
|
+
endpoint.convert_cached_image_scales(item, modified_hash, "logo", ["thumb"])
|
111
|
+
self.assertEqual(len(item.keys()), 3)
|
112
|
+
endpoint.convert_cached_image_scales(item, modified_hash)
|
113
|
+
self.assertEqual(len(item.keys()), 5)
|
114
|
+
|
75
115
|
def test_get_extra_params(self):
|
76
116
|
request = TestRequest(
|
77
117
|
form={"taxonomy_contact_category": '("token")', "topics": "education"}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
-
from datetime import datetime
|
4
3
|
from imio.smartweb.core.contents.sections.views import SECTION_ITEMS_HASH_KEY
|
5
4
|
from imio.smartweb.core.testing import IMIO_SMARTWEB_CORE_FUNCTIONAL_TESTING
|
6
5
|
from imio.smartweb.core.testing import ImioSmartwebTestCase
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
+
from AccessControl.unauthorized import Unauthorized
|
3
4
|
from bs4 import BeautifulSoup
|
4
5
|
from collective.geolocationbehavior.geolocation import IGeolocatable
|
5
6
|
from functools import reduce
|
@@ -110,6 +111,39 @@ class TestSections(ImioSmartwebTestCase):
|
|
110
111
|
"https://www.youtube.com/embed/_dOAthafoGQ?feature=oembed", embedded_video
|
111
112
|
)
|
112
113
|
|
114
|
+
def test_external_content_section(self):
|
115
|
+
setRoles(self.portal, TEST_USER_ID, ["Contributor"])
|
116
|
+
with self.assertRaises(Unauthorized):
|
117
|
+
api.content.create(
|
118
|
+
container=self.page,
|
119
|
+
type="imio.smartweb.SectionExternalContent",
|
120
|
+
title="Section External Content",
|
121
|
+
)
|
122
|
+
setRoles(self.portal, TEST_USER_ID, ["Manager"])
|
123
|
+
section = api.content.create(
|
124
|
+
container=self.page,
|
125
|
+
type="imio.smartweb.SectionExternalContent",
|
126
|
+
title="Section External Content",
|
127
|
+
)
|
128
|
+
section.external_content_url = (
|
129
|
+
"https://app.eaglebe.com/fr-be/map/la%20louvi%C3%A8re"
|
130
|
+
)
|
131
|
+
view = queryMultiAdapter((section, self.request), name="view")
|
132
|
+
embedded_content = view.get_embed_external_content()
|
133
|
+
self.assertIn("iframe", embedded_content)
|
134
|
+
self.assertIn('class="eaglebe"', embedded_content)
|
135
|
+
self.assertIn('scrolling="no"', embedded_content)
|
136
|
+
self.assertIn(
|
137
|
+
"https://app.eaglebe.com/fr-be/map/la%20louvi%C3%A8re", embedded_content
|
138
|
+
)
|
139
|
+
|
140
|
+
section.external_content_url = "http://www.perdu.com"
|
141
|
+
view = queryMultiAdapter((section, self.request), name="view")
|
142
|
+
embedded_content = view.get_embed_external_content()
|
143
|
+
self.assertNotIn("iframe", embedded_content)
|
144
|
+
self.assertNotIn("class='eaglebe'", embedded_content)
|
145
|
+
self.assertIn("<p class='unknow_service'>Unknow service</p>", embedded_content)
|
146
|
+
|
113
147
|
def test_map_section(self):
|
114
148
|
section = api.content.create(
|
115
149
|
container=self.page,
|
@@ -123,6 +123,46 @@
|
|
123
123
|
provides="Products.GenericSetup.interfaces.EXTENSION"
|
124
124
|
/>
|
125
125
|
|
126
|
+
<genericsetup:registerProfile
|
127
|
+
name="upgrade_1037_to_1038"
|
128
|
+
title="Upgrade core from 1037 to 1038"
|
129
|
+
directory="profiles/1037_to_1038"
|
130
|
+
description="Add plausible registry keys"
|
131
|
+
provides="Products.GenericSetup.interfaces.EXTENSION"
|
132
|
+
/>
|
133
|
+
|
134
|
+
<genericsetup:registerProfile
|
135
|
+
name="upgrade_1038_to_1039"
|
136
|
+
title="Upgrade core from 1038 to 1039"
|
137
|
+
directory="profiles/1038_to_1039"
|
138
|
+
description="Add new content type : imio.smartweb.SectionExternalContent"
|
139
|
+
provides="Products.GenericSetup.interfaces.EXTENSION"
|
140
|
+
/>
|
141
|
+
|
142
|
+
<genericsetup:registerProfile
|
143
|
+
name="upgrade_1039_to_1040"
|
144
|
+
title="Upgrade core from 1039 to 1040"
|
145
|
+
directory="profiles/1039_to_1040"
|
146
|
+
description="Disable image cropping on Slide content type"
|
147
|
+
provides="Products.GenericSetup.interfaces.EXTENSION"
|
148
|
+
/>
|
149
|
+
|
150
|
+
<genericsetup:registerProfile
|
151
|
+
name="upgrade_1040_to_1041"
|
152
|
+
title="Upgrade core from 1040 to 1041"
|
153
|
+
directory="profiles/1040_to_1041"
|
154
|
+
description="Disable image cropping on section text"
|
155
|
+
provides="Products.GenericSetup.interfaces.EXTENSION"
|
156
|
+
/>
|
157
|
+
|
158
|
+
<genericsetup:registerProfile
|
159
|
+
name="upgrade_1041_to_1042"
|
160
|
+
title="Upgrade core from 1041 to 1042"
|
161
|
+
directory="profiles/1041_to_1042"
|
162
|
+
description="Disable image cropping on background_image field"
|
163
|
+
provides="Products.GenericSetup.interfaces.EXTENSION"
|
164
|
+
/>
|
165
|
+
|
126
166
|
<genericsetup:upgradeStep
|
127
167
|
title="Configure first official release"
|
128
168
|
description="Run needed profiles steps and reindex catalog"
|
@@ -515,4 +555,54 @@
|
|
515
555
|
/>
|
516
556
|
</genericsetup:upgradeSteps>
|
517
557
|
|
558
|
+
<genericsetup:upgradeSteps
|
559
|
+
source="1037"
|
560
|
+
destination="1038"
|
561
|
+
profile="imio.smartweb.core:default">
|
562
|
+
<genericsetup:upgradeDepends
|
563
|
+
title="Add plausible registry keys"
|
564
|
+
import_profile="imio.smartweb.core.upgrades:upgrade_1037_to_1038"
|
565
|
+
/>
|
566
|
+
</genericsetup:upgradeSteps>
|
567
|
+
|
568
|
+
<genericsetup:upgradeSteps
|
569
|
+
source="1038"
|
570
|
+
destination="1039"
|
571
|
+
profile="imio.smartweb.core:default">
|
572
|
+
<genericsetup:upgradeDepends
|
573
|
+
title="Add new content type : imio.smartweb.SectionExternalContent"
|
574
|
+
import_profile="imio.smartweb.core.upgrades:upgrade_1038_to_1039"
|
575
|
+
/>
|
576
|
+
</genericsetup:upgradeSteps>
|
577
|
+
|
578
|
+
<genericsetup:upgradeSteps
|
579
|
+
source="1039"
|
580
|
+
destination="1040"
|
581
|
+
profile="imio.smartweb.core:default">
|
582
|
+
<genericsetup:upgradeDepends
|
583
|
+
title="Disable image cropping on Slide content type"
|
584
|
+
import_profile="imio.smartweb.core.upgrades:upgrade_1039_to_1040"
|
585
|
+
/>
|
586
|
+
</genericsetup:upgradeSteps>
|
587
|
+
|
588
|
+
<genericsetup:upgradeSteps
|
589
|
+
source="1040"
|
590
|
+
destination="1041"
|
591
|
+
profile="imio.smartweb.core:default">
|
592
|
+
<genericsetup:upgradeDepends
|
593
|
+
title="Disable image cropping on section text"
|
594
|
+
import_profile="imio.smartweb.core.upgrades:upgrade_1040_to_1041"
|
595
|
+
/>
|
596
|
+
</genericsetup:upgradeSteps>
|
597
|
+
|
598
|
+
<genericsetup:upgradeSteps
|
599
|
+
source="1041"
|
600
|
+
destination="1042"
|
601
|
+
profile="imio.smartweb.core:default">
|
602
|
+
<genericsetup:upgradeDepends
|
603
|
+
title="Disable image cropping on background_image field"
|
604
|
+
import_profile="imio.smartweb.core.upgrades:upgrade_1041_to_1042"
|
605
|
+
/>
|
606
|
+
</genericsetup:upgradeSteps>
|
607
|
+
|
518
608
|
</configure>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<rolemap>
|
3
|
+
|
4
|
+
<permissions>
|
5
|
+
<permission name="imio.smartweb.core: Can add section External Content" acquire="True">
|
6
|
+
<role name="Manager"/>
|
7
|
+
<role name="Site Administrator"/>
|
8
|
+
<role name="Local Manager" />
|
9
|
+
</permission>
|
10
|
+
</permissions>
|
11
|
+
|
12
|
+
</rolemap>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.Page"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<property name="allowed_content_types" purge="false">
|
8
|
+
<element value="imio.smartweb.SectionExternalContent" />
|
9
|
+
</property>
|
10
|
+
|
11
|
+
</object>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.PortalPage"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<property name="allowed_content_types" purge="false">
|
8
|
+
<element value="imio.smartweb.SectionExternalContent" />
|
9
|
+
</property>
|
10
|
+
|
11
|
+
</object>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.Procedure"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<property name="allowed_content_types" purge="false">
|
8
|
+
<element value="imio.smartweb.SectionExternalContent" />
|
9
|
+
</property>
|
10
|
+
|
11
|
+
</object>
|
imio/smartweb/core/upgrades/profiles/1038_to_1039/types/imio.smartweb.SectionExternalContent.xml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionExternalContent"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Basic properties -->
|
8
|
+
<property
|
9
|
+
i18n:translate=""
|
10
|
+
name="title">External content section</property>
|
11
|
+
<property
|
12
|
+
i18n:translate=""
|
13
|
+
name="description">External content section for a page</property>
|
14
|
+
|
15
|
+
<property name="icon_expr">string:file-play</property>
|
16
|
+
|
17
|
+
<!-- Hierarchy control -->
|
18
|
+
<property name="global_allow">False</property>
|
19
|
+
<property name="filter_content_types">True</property>
|
20
|
+
|
21
|
+
<!-- Schema, class and security -->
|
22
|
+
<!-- if we can add a page, we can add a page section -->
|
23
|
+
<property name="add_permission">imio.smartweb.core.CanManageSectionExternalContent</property>
|
24
|
+
<property name="klass">imio.smartweb.core.contents.SectionExternalContent</property>
|
25
|
+
<property name="schema">imio.smartweb.core.contents.ISectionExternalContent</property>
|
26
|
+
|
27
|
+
<!-- Enabled behaviors -->
|
28
|
+
<property name="behaviors" purge="false">
|
29
|
+
<element value="plone.namefromtitle"/>
|
30
|
+
<element value="plone.locking"/>
|
31
|
+
<element value="plone.shortname"/>
|
32
|
+
<element value="plone.imagecropping"/>
|
33
|
+
<element value="imio.smartweb.topics"/>
|
34
|
+
</property>
|
35
|
+
|
36
|
+
</object>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionSlide"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
</property>
|
13
|
+
|
14
|
+
</object>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionText"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
<element value="plone.versioning" />
|
13
|
+
<element value="plone.richtext"/>
|
14
|
+
<element value="plone.leadimage"/>
|
15
|
+
</property>
|
16
|
+
|
17
|
+
</object>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionContact"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
</property>
|
13
|
+
|
14
|
+
</object>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionEvents"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
</property>
|
13
|
+
|
14
|
+
</object>
|
imio/smartweb/core/upgrades/profiles/1041_to_1042/types/imio.smartweb.SectionExternalContent.xml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionExternalContent"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
<element value="imio.smartweb.topics"/>
|
13
|
+
</property>
|
14
|
+
|
15
|
+
</object>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionFiles"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
</property>
|
13
|
+
|
14
|
+
</object>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionGallery"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
<element value="imio.smartweb.topics"/>
|
13
|
+
</property>
|
14
|
+
|
15
|
+
</object>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionLinks"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
</property>
|
13
|
+
|
14
|
+
</object>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionMap"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
<element value="geolocatable"/>
|
13
|
+
</property>
|
14
|
+
|
15
|
+
</object>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionNews"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
</property>
|
13
|
+
|
14
|
+
</object>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.SectionPostit"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Enabled behaviors -->
|
8
|
+
<property name="behaviors" purge="true">
|
9
|
+
<element value="plone.namefromtitle"/>
|
10
|
+
<element value="plone.locking"/>
|
11
|
+
<element value="plone.shortname"/>
|
12
|
+
</property>
|
13
|
+
|
14
|
+
</object>
|