imio.smartweb.core 1.2.34__py3-none-any.whl → 1.2.37__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.
Files changed (92) hide show
  1. imio/smartweb/core/browser/sitemap.py +52 -46
  2. imio/smartweb/core/contents/rest/utils.py +99 -0
  3. imio/smartweb/core/contents/sections/external_content/configure.zcml +29 -0
  4. imio/smartweb/core/contents/sections/external_content/view.pt +25 -7
  5. imio/smartweb/core/contents/sections/external_content/view_idelux_waste.pt +50 -0
  6. imio/smartweb/core/contents/sections/external_content/view_inbw_containers_affluence.pt +91 -0
  7. imio/smartweb/core/contents/sections/external_content/view_odwb_widget.pt +20 -0
  8. imio/smartweb/core/contents/sections/external_content/views.py +303 -124
  9. imio/smartweb/core/contents/sections/text/view.pt +1 -1
  10. imio/smartweb/core/interfaces.py +7 -0
  11. imio/smartweb/core/profiles/default/metadata.xml +1 -1
  12. imio/smartweb/core/profiles/default/registry/plone.xml +21 -4
  13. imio/smartweb/core/profiles/default/types/Collection.xml +13 -0
  14. imio/smartweb/core/profiles/default/types/File.xml +13 -0
  15. imio/smartweb/core/profiles/default/types/Image.xml +13 -0
  16. imio/smartweb/core/profiles/default/types/imio.smartweb.BlockLink.xml +5 -0
  17. imio/smartweb/core/profiles/default/types/imio.smartweb.CirkwiView.xml +1 -0
  18. imio/smartweb/core/profiles/default/types/imio.smartweb.DirectoryView.xml +1 -0
  19. imio/smartweb/core/profiles/default/types/imio.smartweb.EventsView.xml +1 -0
  20. imio/smartweb/core/profiles/default/types/imio.smartweb.Folder.xml +1 -0
  21. imio/smartweb/core/profiles/default/types/imio.smartweb.NewsView.xml +1 -0
  22. imio/smartweb/core/profiles/default/types/imio.smartweb.Page.xml +1 -0
  23. imio/smartweb/core/profiles/default/types/imio.smartweb.PortalPage.xml +1 -0
  24. imio/smartweb/core/profiles/default/types/imio.smartweb.Procedure.xml +1 -0
  25. imio/smartweb/core/tests/test_section_external_content.py +23 -23
  26. imio/smartweb/core/tests/test_sections.py +3 -15
  27. imio/smartweb/core/tests/test_sitemap.py +41 -22
  28. imio/smartweb/core/upgrades/configure.zcml +36 -0
  29. imio/smartweb/core/upgrades/profiles/1053_to_1054/registry.xml +39 -0
  30. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/Collection.xml +13 -0
  31. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/File.xml +13 -0
  32. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/Image.xml +13 -0
  33. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.BlockLink.xml +12 -0
  34. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.CirkwiView.xml +12 -0
  35. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.DirectoryView.xml +12 -0
  36. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.EventsView.xml +12 -0
  37. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Folder.xml +12 -0
  38. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.NewsView.xml +12 -0
  39. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Page.xml +12 -0
  40. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.PortalPage.xml +12 -0
  41. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Procedure.xml +12 -0
  42. imio/smartweb/core/viewlets/configure.zcml +10 -0
  43. imio/smartweb/core/viewlets/external_content.py +13 -5
  44. imio/smartweb/core/viewlets/odwb_widget_header.pt +19 -0
  45. imio/smartweb/core/webcomponents/build/css/373.smartweb-webcomponents-compiled.css +1 -0
  46. imio/smartweb/core/webcomponents/build/css/486.smartweb-webcomponents-compiled.css +1 -0
  47. imio/smartweb/core/webcomponents/build/css/686.smartweb-webcomponents-compiled.css +1 -0
  48. imio/smartweb/core/webcomponents/build/css/919.smartweb-webcomponents-compiled.css +1 -0
  49. imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
  50. imio/smartweb/core/webcomponents/build/js/209.smartweb-webcomponents-compiled.js +2 -0
  51. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +2 -0
  52. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +1 -0
  53. imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -0
  54. imio/smartweb/core/webcomponents/build/js/568.smartweb-webcomponents-compiled.js +2 -0
  55. imio/smartweb/core/webcomponents/build/js/568.smartweb-webcomponents-compiled.js.LICENSE.txt +14 -0
  56. imio/smartweb/core/webcomponents/build/js/674.smartweb-webcomponents-compiled.js +2 -0
  57. imio/smartweb/core/webcomponents/build/js/686.smartweb-webcomponents-compiled.js +1 -0
  58. imio/smartweb/core/webcomponents/build/js/799.smartweb-webcomponents-compiled.js +2 -0
  59. imio/smartweb/core/webcomponents/build/js/804.smartweb-webcomponents-compiled.js +1 -0
  60. imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -0
  61. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
  62. imio/smartweb/core/webcomponents/src/utils/translation.js +2 -2
  63. {imio.smartweb.core-1.2.34.dist-info → imio.smartweb.core-1.2.37.dist-info}/METADATA +28 -1
  64. {imio.smartweb.core-1.2.34.dist-info → imio.smartweb.core-1.2.37.dist-info}/RECORD +74 -56
  65. imio/smartweb/core/webcomponents/build/css/323.smartweb-webcomponents-compiled.css +0 -1
  66. imio/smartweb/core/webcomponents/build/css/392.smartweb-webcomponents-compiled.css +0 -1
  67. imio/smartweb/core/webcomponents/build/css/528.smartweb-webcomponents-compiled.css +0 -1
  68. imio/smartweb/core/webcomponents/build/css/647.smartweb-webcomponents-compiled.css +0 -1
  69. imio/smartweb/core/webcomponents/build/js/143.smartweb-webcomponents-compiled.js +0 -2
  70. imio/smartweb/core/webcomponents/build/js/144.smartweb-webcomponents-compiled.js +0 -2
  71. imio/smartweb/core/webcomponents/build/js/323.smartweb-webcomponents-compiled.js +0 -1
  72. imio/smartweb/core/webcomponents/build/js/392.smartweb-webcomponents-compiled.js +0 -1
  73. imio/smartweb/core/webcomponents/build/js/493.smartweb-webcomponents-compiled.js +0 -2
  74. imio/smartweb/core/webcomponents/build/js/528.smartweb-webcomponents-compiled.js +0 -2
  75. imio/smartweb/core/webcomponents/build/js/528.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -1
  76. imio/smartweb/core/webcomponents/build/js/647.smartweb-webcomponents-compiled.js +0 -1
  77. imio/smartweb/core/webcomponents/build/js/729.smartweb-webcomponents-compiled.js +0 -2
  78. imio/smartweb/core/webcomponents/build/js/729.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -1
  79. imio/smartweb/core/webcomponents/build/js/9.smartweb-webcomponents-compiled.js +0 -2
  80. imio/smartweb/core/webcomponents/build/js/969.smartweb-webcomponents-compiled.js +0 -2
  81. imio/smartweb/core/webcomponents/build/js/969.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -642
  82. imio/smartweb/core/webcomponents/build/js/979.smartweb-webcomponents-compiled.js +0 -1
  83. /imio/smartweb/core/webcomponents/build/js/{9.smartweb-webcomponents-compiled.js.LICENSE.txt → 209.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  84. /imio/smartweb/core/webcomponents/build/js/{143.smartweb-webcomponents-compiled.js.LICENSE.txt → 218.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  85. /imio/smartweb/core/webcomponents/build/js/{493.smartweb-webcomponents-compiled.js.LICENSE.txt → 674.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  86. /imio/smartweb/core/webcomponents/build/js/{144.smartweb-webcomponents-compiled.js.LICENSE.txt → 799.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  87. /imio.smartweb.core-1.2.34-py3.10-nspkg.pth → /imio.smartweb.core-1.2.37-py3.10-nspkg.pth +0 -0
  88. {imio.smartweb.core-1.2.34.dist-info → imio.smartweb.core-1.2.37.dist-info}/LICENSE.GPL +0 -0
  89. {imio.smartweb.core-1.2.34.dist-info → imio.smartweb.core-1.2.37.dist-info}/LICENSE.rst +0 -0
  90. {imio.smartweb.core-1.2.34.dist-info → imio.smartweb.core-1.2.37.dist-info}/WHEEL +0 -0
  91. {imio.smartweb.core-1.2.34.dist-info → imio.smartweb.core-1.2.37.dist-info}/namespace_packages.txt +0 -0
  92. {imio.smartweb.core-1.2.34.dist-info → imio.smartweb.core-1.2.37.dist-info}/top_level.txt +0 -0
@@ -51,6 +51,7 @@
51
51
  <element value="imio.smartweb.listing"/>
52
52
  <element value="imio.smartweb.quickaccessselection"/>
53
53
  <element value="collective.autopublishing.behavior.IAutoPublishing"/>
54
+ <element value="solr.fields" />
54
55
  </property>
55
56
 
56
57
  <!-- View information -->
@@ -38,6 +38,7 @@
38
38
  <element value="imio.smartweb.iam"/>
39
39
  <element value="plone.categorization"/>
40
40
  <element value="collective.autopublishing.behavior.IAutoPublishing"/>
41
+ <element value="solr.fields" />
41
42
  </property>
42
43
 
43
44
  </object>
@@ -51,6 +51,7 @@
51
51
  <element value="imio.smartweb.iam"/>
52
52
  <element value="plone.categorization"/>
53
53
  <element value="collective.autopublishing.behavior.IAutoPublishing"/>
54
+ <element value="solr.fields" />
54
55
  </property>
55
56
 
56
57
  <!-- View information -->
@@ -54,6 +54,7 @@
54
54
  <element value="imio.smartweb.iam"/>
55
55
  <element value="plone.categorization"/>
56
56
  <element value="collective.autopublishing.behavior.IAutoPublishing"/>
57
+ <element value="solr.fields" />
57
58
  </property>
58
59
 
59
60
  <!-- View information -->
@@ -51,6 +51,7 @@
51
51
  <element value="imio.smartweb.iam"/>
52
52
  <element value="plone.categorization"/>
53
53
  <element value="collective.autopublishing.behavior.IAutoPublishing"/>
54
+ <element value="solr.fields" />
54
55
  </property>
55
56
 
56
57
  <!-- View information -->
@@ -28,28 +28,28 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
28
28
  sec.external_content_url = "https://kamoulox.be"
29
29
  section_view = queryMultiAdapter((sec, self.request), name="view")
30
30
  self.assertEqual(
31
- section_view.get_embed_external_content(),
31
+ section_view.contents,
32
32
  '<p class="unknow_service">Unknow service</p>',
33
33
  )
34
34
 
35
- # def test_eaglebe_plugin(self):
36
- # sec = api.content.create(
37
- # container=self.page, type="imio.smartweb.SectionExternalContent", id="sec"
38
- # )
35
+ def test_eaglebe_plugin(self):
36
+ sec = api.content.create(
37
+ container=self.page, type="imio.smartweb.SectionExternalContent", id="sec"
38
+ )
39
39
 
40
- # sec.external_content_url = ""
41
- # section_view = queryMultiAdapter((sec, self.request), name="view")
42
- # self.assertEqual(
43
- # section_view.get_embed_external_content(),
44
- # '<p class="unknow_service">Unknow service</p>',
45
- # )
40
+ sec.external_content_url = ""
41
+ section_view = queryMultiAdapter((sec, self.request), name="view")
42
+ self.assertEqual(
43
+ section_view.contents,
44
+ '<p class="unknow_service">Unknow service</p>',
45
+ )
46
46
 
47
- # sec.external_content_url = "https://app.eaglebe.com/auth/start"
48
- # section_view = queryMultiAdapter((sec, self.request), name="view")
49
- # self.assertEqual(
50
- # section_view.get_embed_external_content(),
51
- # '<iframe class="eaglebe" src="https://app.eaglebe.com/auth/start" scrolling="no" width="100%">',
52
- # )
47
+ sec.external_content_url = "https://app.eaglebe.com/auth/start"
48
+ section_view = queryMultiAdapter((sec, self.request), name="view")
49
+ self.assertEqual(
50
+ section_view.contents,
51
+ '<iframe class="eaglebe" src="https://app.eaglebe.com/auth/start" scrolling="no" width="100%">',
52
+ )
53
53
 
54
54
  def test_elloha_plugin(self):
55
55
  sec = api.content.create(
@@ -62,7 +62,7 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
62
62
  )
63
63
  section_view = queryMultiAdapter((sec, self.request), name="view")
64
64
  self.assertEqual(
65
- section_view.get_embed_external_content(),
65
+ section_view.contents,
66
66
  '<div class="elloha elloha_error">With an elloha plugin, extra params must contain a dictionary with two keys : ConstellationWidgetContainer, Idoi</div>',
67
67
  )
68
68
 
@@ -73,7 +73,7 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
73
73
  }"""
74
74
  section_view = queryMultiAdapter((sec, self.request), name="view")
75
75
  result = '<div class="elloha"><div id="ConstellationWidgetContainer11111111-1111-1111-1111-111111111111" style="width:100%" data-id-projet="11111111111111111111111111111111">...</div></div><script type="text/javascript" src="https://reservation.elloha.com/Scripts/widget-loader.min.js?v=42/Scripts/widget-loader.min.js?v=42"></script><script type="text/javascript">var constellationWidgetUrl11111111111111111111111111111111, constellationTypeModule11111111111111111111111111111111;constellationWidgetUrl11111111111111111111111111111111 = "https://reservation.elloha.com/Widget/BookingEngine/11111111-1111-1111-1111-111111111111?idoi=22222222-2222-2222-2222-222222222222&culture=fr-FR";constellationTypeModule11111111111111111111111111111111=1; constellationWidgetLoad("ConstellationWidgetContainer11111111-1111-1111-1111-111111111111");constellationWidgetAddEvent(window, "resize", function () {constellationWidgetSetAppearance("ConstellationWidgetContainer11111111-1111-1111-1111-111111111111");});</script>'
76
- self.assertEqual(section_view.get_embed_external_content(), result)
76
+ self.assertEqual(section_view.contents, result)
77
77
 
78
78
  # good extra params / dict keys are case insensitive
79
79
  sec.external_content_params = """{
@@ -82,20 +82,20 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
82
82
  }"""
83
83
  section_view = queryMultiAdapter((sec, self.request), name="view")
84
84
  result = '<div class="elloha"><div id="ConstellationWidgetContainer11111111-1111-1111-1111-111111111111" style="width:100%" data-id-projet="11111111111111111111111111111111">...</div></div><script type="text/javascript" src="https://reservation.elloha.com/Scripts/widget-loader.min.js?v=42/Scripts/widget-loader.min.js?v=42"></script><script type="text/javascript">var constellationWidgetUrl11111111111111111111111111111111, constellationTypeModule11111111111111111111111111111111;constellationWidgetUrl11111111111111111111111111111111 = "https://reservation.elloha.com/Widget/BookingEngine/11111111-1111-1111-1111-111111111111?idoi=22222222-2222-2222-2222-222222222222&culture=fr-FR";constellationTypeModule11111111111111111111111111111111=1; constellationWidgetLoad("ConstellationWidgetContainer11111111-1111-1111-1111-111111111111");constellationWidgetAddEvent(window, "resize", function () {constellationWidgetSetAppearance("ConstellationWidgetContainer11111111-1111-1111-1111-111111111111");});</script>'
85
- self.assertEqual(section_view.get_embed_external_content(), result)
85
+ self.assertEqual(section_view.contents, result)
86
86
 
87
87
  # with bad params
88
88
  sec.external_content_params = "kamoulox"
89
89
  section_view = queryMultiAdapter((sec, self.request), name="view")
90
90
  result = '<div class="elloha elloha_error">With an elloha plugin, extra params must contain a dictionary with two keys : ConstellationWidgetContainer, Idoi</div>'
91
- self.assertEqual(section_view.get_embed_external_content(), result)
91
+ self.assertEqual(section_view.contents, result)
92
92
 
93
93
  sec.external_content_params = """{
94
94
  "ConstellationWidgetContainer" : "11111111-1111-1111-1111-111111111111"
95
95
  }"""
96
96
  section_view = queryMultiAdapter((sec, self.request), name="view")
97
97
  result = '<div class="elloha elloha_error">With an elloha plugin, extra params must contain a dictionary with two keys : ConstellationWidgetContainer, Idoi</div>'
98
- self.assertEqual(section_view.get_embed_external_content(), result)
98
+ self.assertEqual(section_view.contents, result)
99
99
 
100
100
  sec.external_content_params = """{
101
101
  "CONSTELLATIONWIDGETCONTAINER" : "11111111-1111-1111-1111-111111111111",
@@ -103,4 +103,4 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
103
103
  """
104
104
  section_view = queryMultiAdapter((sec, self.request), name="view")
105
105
  result = '<div class="elloha elloha_error">With an elloha plugin, extra params must contain a dictionary with two keys : ConstellationWidgetContainer, Idoi</div>'
106
- self.assertEqual(section_view.get_embed_external_content(), result)
106
+ self.assertEqual(section_view.contents, result)
@@ -125,24 +125,12 @@ class TestSections(ImioSmartwebTestCase):
125
125
  type="imio.smartweb.SectionExternalContent",
126
126
  title="Section External Content",
127
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
128
 
140
129
  section.external_content_url = "http://www.perdu.com"
141
130
  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)
131
+ self.assertNotIn("iframe", view.contents)
132
+ self.assertNotIn("class='eaglebe'", view.contents)
133
+ self.assertIn('<p class="unknow_service">Unknow service</p>', view.contents)
146
134
 
147
135
  def test_map_section(self):
148
136
  section = api.content.create(
@@ -13,6 +13,7 @@ from plone.app.testing import TEST_USER_ID
13
13
  from plone.app.textfield.value import RichTextValue
14
14
  from plone.base.utils import safe_text
15
15
  from plone.namedfile.file import NamedBlobImage
16
+ from unittest.mock import patch
16
17
  from zope.component import getMultiAdapter
17
18
 
18
19
  import json
@@ -87,7 +88,7 @@ class TestPage(ImioSmartwebTestCase):
87
88
  (self.portal, self.portal.REQUEST), name="sitemap.xml.gz"
88
89
  )
89
90
  xml = self.uncompress(sitemap())
90
- self.assertIn("<lastmod >2024-02-02T08:00:00+00:00</lastmod>", xml)
91
+ self.assertIn("<lastmod >2024-02-02T08:00:00", xml)
91
92
  self.assertIn("<loc>http://nohost/plone/folder</loc>", xml)
92
93
  self.assertIn("http://nohost/plone/folder/page1", xml)
93
94
  self.assertNotIn(
@@ -115,7 +116,7 @@ class TestPage(ImioSmartwebTestCase):
115
116
  )
116
117
  # Gallery and image created 2024-02-02 10:00:00
117
118
  self.assertIn(
118
- "<loc>http://nohost/plone/folder/page1/gallery/image/view</loc>\n <lastmod >2024-02-02T10:00:00+00:00</lastmod>",
119
+ "<loc>http://nohost/plone/folder/page1/gallery/image/view</loc>\n <lastmod >2024-02-02T10:00:00",
119
120
  xml,
120
121
  )
121
122
 
@@ -124,28 +125,46 @@ class TestPage(ImioSmartwebTestCase):
124
125
  "events": self.rest_agenda,
125
126
  "news": self.rest_news,
126
127
  }
128
+ contact_search_url = news_search_url = events_search_url = (
129
+ "http://localhost:8080/Plone/@querystring-search"
130
+ )
127
131
  for k, v in rest_views.items():
128
132
  api.portal.set_registry_record(f"smartweb.default_{k}_view", v.UID())
129
-
130
- self.json_contacts = get_json("resources/json_contacts_raw_mock.json")
131
- self.json_news = get_json("resources/json_rest_news.json")
132
- self.json_events = get_json("resources/json_rest_events.json")
133
-
134
- contact_search_url = "http://localhost:8080/Plone/@search?selected_entities=396907b3b1b04a97896b12cc792c77f8&portal_type=imio.directory.Contact&fullobjects=0&sort_on=sortable_title"
135
- news_search_url = f"http://localhost:8080/Plone/@search?selected_news_folders={self.rest_news.selected_news_folder}&portal_type=imio.news.NewsItem&fullobjects=0&sort_on=sortable_title"
136
- events_search_url = f"http://localhost:8080/Plone/@events?selected_agendas={self.rest_agenda.selected_agenda}&portal_type=imio.events.Event&fullobjects=0&sort_on=sortable_title"
137
-
138
- m.get(contact_search_url, text=json.dumps(self.json_contacts))
139
- m.get(news_search_url, text=json.dumps(self.json_news))
140
- m.get(events_search_url, text=json.dumps(self.json_events))
141
-
142
- sitemap = getMultiAdapter(
143
- (self.portal, self.portal.REQUEST), name="sitemap.xml.gz"
144
- )
145
- xml = self.uncompress(sitemap())
146
- self.assertIn("<loc>http://nohost/plone/directory-view/contact1-title", xml)
147
- self.assertIn("<loc>http://nohost/plone/news-view/", xml)
148
- self.assertIn("<loc>http://nohost/plone/agenda-view/", xml)
133
+ with patch(
134
+ "imio.smartweb.core.contents.rest.utils.get_wca_token",
135
+ return_value="kamoulox",
136
+ ):
137
+ self.json_contacts = get_json("resources/json_contacts_raw_mock.json")
138
+ m.post(contact_search_url, text=json.dumps(self.json_contacts))
139
+ sitemap = getMultiAdapter(
140
+ (self.portal, self.portal.REQUEST), name="sitemap.xml.gz"
141
+ )
142
+ xml = self.uncompress(sitemap())
143
+ self.assertIn("<loc>http://nohost/plone/directory-view/contact1-title", xml)
144
+
145
+ with patch(
146
+ "imio.smartweb.core.contents.rest.utils.get_wca_token",
147
+ return_value="kamoulox",
148
+ ):
149
+ self.json_news = get_json("resources/json_rest_news.json")
150
+ m.post(news_search_url, text=json.dumps(self.json_news))
151
+ sitemap = getMultiAdapter(
152
+ (self.portal, self.portal.REQUEST), name="sitemap.xml.gz"
153
+ )
154
+ xml = self.uncompress(sitemap())
155
+ self.assertIn("<loc>http://nohost/plone/news-view/", xml)
156
+
157
+ with patch(
158
+ "imio.smartweb.core.contents.rest.utils.get_wca_token",
159
+ return_value="kamoulox",
160
+ ):
161
+ self.json_events = get_json("resources/json_rest_events.json")
162
+ m.post(events_search_url, text=json.dumps(self.json_events))
163
+ sitemap = getMultiAdapter(
164
+ (self.portal, self.portal.REQUEST), name="sitemap.xml.gz"
165
+ )
166
+ xml = self.uncompress(sitemap())
167
+ self.assertIn("<loc>http://nohost/plone/agenda-view/", xml)
149
168
 
150
169
  def uncompress(self, sitemapdata):
151
170
  sio = BytesIO(sitemapdata)
@@ -203,6 +203,22 @@
203
203
  provides="Products.GenericSetup.interfaces.EXTENSION"
204
204
  />
205
205
 
206
+ <genericsetup:registerProfile
207
+ name="upgrade_1053_to_1054"
208
+ title="Upgrade core from 1053 to 1054"
209
+ directory="profiles/1053_to_1054"
210
+ description="Exclude some content_types from search results"
211
+ provides="Products.GenericSetup.interfaces.EXTENSION"
212
+ />
213
+
214
+ <genericsetup:registerProfile
215
+ name="upgrade_1054_to_1055"
216
+ title="Upgrade core from 1054 to 1055"
217
+ directory="profiles/1054_to_1055"
218
+ description="Add solr.fields behavior to some content types"
219
+ provides="Products.GenericSetup.interfaces.EXTENSION"
220
+ />
221
+
206
222
  <genericsetup:upgradeStep
207
223
  title="Configure first official release"
208
224
  description="Run needed profiles steps and reindex catalog"
@@ -747,4 +763,24 @@
747
763
  />
748
764
  </genericsetup:upgradeSteps>
749
765
 
766
+ <genericsetup:upgradeSteps
767
+ source="1053"
768
+ destination="1054"
769
+ profile="imio.smartweb.core:default">
770
+ <genericsetup:upgradeDepends
771
+ title="Exclude some content_types from search results"
772
+ import_profile="imio.smartweb.core.upgrades:upgrade_1053_to_1054"
773
+ />
774
+ </genericsetup:upgradeSteps>
775
+
776
+ <genericsetup:upgradeSteps
777
+ source="1054"
778
+ destination="1055"
779
+ profile="imio.smartweb.core:default">
780
+ <genericsetup:upgradeDepends
781
+ title="Add solr.fields behavior to some content types"
782
+ import_profile="imio.smartweb.core.upgrades:upgrade_1054_to_1055"
783
+ />
784
+ </genericsetup:upgradeSteps>
785
+
750
786
  </configure>
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0"?>
2
+ <registry
3
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n"
4
+ i18n:domain="imio.smartweb">
5
+ <record name="plone.types_not_searched"
6
+ interface="Products.CMFPlone.interfaces.controlpanel.ISearchSchema"
7
+ field="types_not_searched">
8
+ <value purge="true">
9
+ <element>News Item</element>
10
+ <element>imio.smartweb.HeroBanner</element>
11
+ <element>Discussion Item</element>
12
+ <element>MessagesConfig</element>
13
+ <element>Folder</element>
14
+ <element>imio.smartweb.BlockLink</element>
15
+ <element>Message</element>
16
+ <element>Document</element>
17
+ <element>imio.smartweb.Footer</element>
18
+ <element>imio.smartweb.SectionHTML</element>
19
+ <element>imio.smartweb.SectionSendinblue</element>
20
+ <element>imio.smartweb.SectionNews</element>
21
+ <element>imio.smartweb.SectionCollection</element>
22
+ <element>imio.smartweb.SectionContact</element>
23
+ <element>imio.smartweb.SectionExternalContent</element>
24
+ <element>imio.smartweb.SectionSelections</element>
25
+ <element>imio.smartweb.SectionFiles</element>
26
+ <element>imio.smartweb.SectionLinks</element>
27
+ <element>imio.smartweb.SectionText</element>
28
+ <element>imio.smartweb.SectionGallery</element>
29
+ <element>imio.smartweb.SectionMap</element>
30
+ <element>imio.smartweb.SectionPostit</element>
31
+ <element>imio.smartweb.SectionSlide</element>
32
+ <element>imio.smartweb.SectionVideo</element>
33
+ <element>imio.smartweb.SectionEvents</element>
34
+ <element>Plone Site</element>
35
+ <element>TempFolder</element>
36
+ <element>Event</element>
37
+ </value>
38
+ </record>
39
+ </registry>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ meta_type="Dexterity FTI"
4
+ name="Collection"
5
+ i18n:domain="plone"
6
+ >
7
+
8
+ <!-- Enabled behaviors -->
9
+ <property name="behaviors" purge="false">
10
+ <element value="solr.fields" />
11
+ </property>
12
+
13
+ </object>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ meta_type="Dexterity FTI"
4
+ name="File"
5
+ i18n:domain="plone"
6
+ >
7
+
8
+ <!-- Enabled behaviors -->
9
+ <property name="behaviors" purge="false">
10
+ <element value="solr.fields" />
11
+ </property>
12
+
13
+ </object>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ meta_type="Dexterity FTI"
4
+ name="Image"
5
+ i18n:domain="plone"
6
+ >
7
+
8
+ <!-- Enabled behaviors -->
9
+ <property name="behaviors" purge="false">
10
+ <element value="solr.fields" />
11
+ </property>
12
+
13
+ </object>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ name="imio.smartweb.BlockLink"
4
+ meta_type="Dexterity FTI"
5
+ i18n:domain="imio.smartweb">
6
+
7
+ <!-- Enabled behaviors -->
8
+ <property name="behaviors" purge="false">
9
+ <element value="solr.fields" />
10
+ </property>
11
+
12
+ </object>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ name="imio.smartweb.CirkwiView"
4
+ meta_type="Dexterity FTI"
5
+ i18n:domain="imio.smartweb">
6
+
7
+ <!-- Enabled behaviors -->
8
+ <property name="behaviors" purge="false">
9
+ <element value="solr.fields" />
10
+ </property>
11
+
12
+ </object>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ name="imio.smartweb.DirectoryView"
4
+ meta_type="Dexterity FTI"
5
+ i18n:domain="imio.smartweb">
6
+
7
+ <!-- Enabled behaviors -->
8
+ <property name="behaviors" purge="false">
9
+ <element value="solr.fields" />
10
+ </property>
11
+
12
+ </object>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ name="imio.smartweb.EventsView"
4
+ meta_type="Dexterity FTI"
5
+ i18n:domain="imio.smartweb">
6
+
7
+ <!-- Enabled behaviors -->
8
+ <property name="behaviors" purge="false">
9
+ <element value="solr.fields" />
10
+ </property>
11
+
12
+ </object>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ name="imio.smartweb.Folder"
4
+ meta_type="Dexterity FTI"
5
+ i18n:domain="imio.smartweb">
6
+
7
+ <!-- Enabled behaviors -->
8
+ <property name="behaviors" purge="false">
9
+ <element value="solr.fields" />
10
+ </property>
11
+
12
+ </object>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ name="imio.smartweb.NewsView"
4
+ meta_type="Dexterity FTI"
5
+ i18n:domain="imio.smartweb">
6
+
7
+ <!-- Enabled behaviors -->
8
+ <property name="behaviors" purge="false">
9
+ <element value="solr.fields" />
10
+ </property>
11
+
12
+ </object>
@@ -0,0 +1,12 @@
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
+ <!-- Enabled behaviors -->
8
+ <property name="behaviors" purge="false">
9
+ <element value="solr.fields" />
10
+ </property>
11
+
12
+ </object>
@@ -0,0 +1,12 @@
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
+ <!-- Enabled behaviors -->
8
+ <property name="behaviors" purge="false">
9
+ <element value="solr.fields" />
10
+ </property>
11
+
12
+ </object>
@@ -0,0 +1,12 @@
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
+ <!-- Enabled behaviors -->
8
+ <property name="behaviors" purge="false">
9
+ <element value="solr.fields" />
10
+ </property>
11
+
12
+ </object>
@@ -36,6 +36,16 @@
36
36
  permission="zope.Public"
37
37
  />
38
38
 
39
+ <browser:viewlet
40
+ name="imio.smartweb.odwb_widget_header"
41
+ for="*"
42
+ manager="plone.app.layout.viewlets.interfaces.IHTTPHeaders"
43
+ layer="imio.smartweb.core.interfaces.IImioSmartwebCoreLayer"
44
+ template="odwb_widget_header.pt"
45
+ class=".external_content.OdwbWidgetHeaderViewlet"
46
+ permission="zope.Public"
47
+ />
48
+
39
49
  <browser:viewlet
40
50
  name="imio.smartweb.header_actions"
41
51
  for="*"
@@ -7,8 +7,16 @@ class ArcgisHeaderViewlet(HeaderViewlet):
7
7
  def update(self):
8
8
  super(ArcgisHeaderViewlet, self).update()
9
9
 
10
- # def getHeaders(self):
11
- # import pdb;pdb.set_trace()
12
- # result = super(ArcgisHeaderViewlet, self).getHeaders()
13
- # result.append(("prefix", "og: http://ogp.me/ns#"))
14
- # return result
10
+
11
+ class OdwbWidgetHeaderViewlet(HeaderViewlet):
12
+
13
+ def should_render(self):
14
+ view = self.view
15
+ if hasattr(view, "should_display_odwb_widget_viewlet"):
16
+ return view.should_display_odwb_widget_viewlet
17
+ return False
18
+
19
+ def render(self):
20
+ # if self.should_render():
21
+ return self.index()
22
+ # return ""
@@ -0,0 +1,19 @@
1
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css" />
2
+ <link rel="stylesheet" href="https://static.opendatasoft.com/ods-widgets/latest/ods-widgets.min.css" />
3
+
4
+
5
+ <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
6
+ <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.8.2/angular.min.js"></script>
7
+ <script src="//cdnjs.cloudflare.com/ajax/libs/angular-sanitize/1.8.2/angular-sanitize.min.js"></script>
8
+ <script type="text/javascript" src="//static.opendatasoft.com/ods-widgets/latest-v2/ods-widgets.min.js"></script>
9
+
10
+
11
+ <!--
12
+ <base href="/">
13
+ <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/fr.js"></script>
14
+
15
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
16
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.js"></script>
17
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular-sanitize.min.js"></script>
18
+ <script type="text/javascript" src="https://static.opendatasoft.com/ods-widgets/latest/ods-widgets.min.js"></script>
19
+ -->
@@ -0,0 +1 @@
1
+ .flexbin{display:flex;flex-wrap:wrap;margin:-2.5px;overflow:hidden}.flexbin:after{content:"";flex-grow:999999999;height:0;min-width:300px}.flexbin>*{display:block;flex-grow:1;height:300px;margin:2.5px;position:relative}.flexbin>*>img{height:300px;max-width:100%;min-width:100%;object-fit:cover;vertical-align:bottom}.flexbin.flexbin-margin{margin:2.5px}@media (max-width:980px){.flexbin{display:flex;flex-wrap:wrap;margin:-2.5px;overflow:hidden}.flexbin:after{content:"";flex-grow:999999999;height:0;min-width:150px}.flexbin>*{display:block;flex-grow:1;height:150px;margin:2.5px;position:relative}.flexbin>*>img{height:150px;max-width:100%;min-width:100%;object-fit:cover;vertical-align:bottom}.flexbin.flexbin-margin{margin:2.5px}}@media (max-width:400px){.flexbin{display:flex;flex-wrap:wrap;margin:-2.5px;overflow:hidden}.flexbin:after{content:"";flex-grow:999999999;height:0;min-width:100px}.flexbin>*{display:block;flex-grow:1;height:100px;margin:2.5px;position:relative}.flexbin>*>img{height:100px;max-width:100%;min-width:100%;object-fit:cover;vertical-align:bottom}.flexbin.flexbin-margin{margin:2.5px}}.breadcrumb{padding:0}.r-result-list{list-style:none;margin-top:50px;padding-left:0}#portal-column-content h1{font-size:0;position:absolute}#viewlet-below-content-description,#viewlet-below-content-title{display:none}.r-item-text{display:flex;flex-direction:column;margin:20px 30px;position:relative}.r-item-title{display:block}.r-results-numbers{margin-bottom:.5rem;width:100%}.r-results-numbers span{font-weight:700}.r-content-img{padding-bottom:60%}.new-content{margin:0 auto;max-width:700px}.r-load-more{margin-bottom:2rem;text-align:center}.r-load-more button{background:#000;border:1px solid #0000;border-radius:10px;border-bottom-left-radius:10px;border-bottom-left-radius:0;color:#fff;display:block;font-size:14px;font-weight:700;margin:0 auto;padding:.4rem 1rem}.r-load-more button:hover{background:rgba(0,0,0,.871)}.r-actu-wrapper{position:relative}.r-actu-wrapper:after{content:url(../assets/oeil-big.f32cd1df1274a9593de0c4bd8e344216.svg);display:block;position:absolute;right:0;top:0;transform:translateY(-20%);width:495px;z-index:-1}.r-actu-wrapper .r-list-item-group{background:#fff;border:1px solid #d1d1d1;border-radius:15px 15px 15px 0;margin:30px auto;max-width:900px}.r-item-title{font-size:18px;font-weight:700}.r-item-description{color:#444;font-size:16px;margin-top:10px}.r-item-img{border-radius:15px 15px 15px 0}.r-actu-wrapper .r-item-img{aspect-ratio:1.6741071429;background-position:top;background-repeat:no-repeat;background-size:cover;width:100%}@media screen and (min-width:775px){.r-actu-wrapper .r-item-img{width:323px}}.r-item-read-more{margin-top:auto}.r-item-arrow-more{align-self:center;background:#f9b331;background:url(../assets/next-react.17bc43ff4a6a86f4520f5782f6a89a72.svg);background-position:50%;background-repeat:no-repeat;background-size:20px;border-radius:50px;flex:0 0 50px;height:50px;margin-left:auto;margin-right:30px;width:50px}.r-list-item-group:hover .r-item-arrow-more{background:url(../assets/next-react-white.819cb069ac8eec300a9db6a7707712d6.svg),#f9b331;background-position:50%;background-repeat:no-repeat;background-size:20px}@media screen and (max-width:600px){.r-list-item{flex-direction:column}.r-item-read-more{position:relative}}.icon-baseline{align-self:center;display:inline-flex;margin-right:.4rem}.icon-baseline svg{height:1em;position:relative;top:.125em;width:1em}.dpinlb{display:inline-block;vertical-align:top}.r-content-news-info-social svg{height:30px;width:30px}.r-content-news-info-social ul{align-items:center;display:flex;margin:0}.r-content-news-info-social ul li{list-style:none}.r-content-news-info-social ul li a:hover{opacity:.7}