imio.smartweb.core 1.2.33__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 (104) hide show
  1. imio/smartweb/core/browser/sitemap.py +52 -48
  2. imio/smartweb/core/browser/utils.py +1 -2
  3. imio/smartweb/core/contents/rest/utils.py +99 -0
  4. imio/smartweb/core/contents/sections/contact/utils.py +0 -4
  5. imio/smartweb/core/contents/sections/external_content/configure.zcml +29 -0
  6. imio/smartweb/core/contents/sections/external_content/view.pt +25 -7
  7. imio/smartweb/core/contents/sections/external_content/view_idelux_waste.pt +50 -0
  8. imio/smartweb/core/contents/sections/external_content/view_inbw_containers_affluence.pt +91 -0
  9. imio/smartweb/core/contents/sections/external_content/view_odwb_widget.pt +20 -0
  10. imio/smartweb/core/contents/sections/external_content/views.py +303 -124
  11. imio/smartweb/core/contents/sections/macros.pt +13 -9
  12. imio/smartweb/core/contents/sections/text/view.pt +1 -1
  13. imio/smartweb/core/interfaces.py +7 -0
  14. imio/smartweb/core/profiles/default/diff_tool.xml +8 -0
  15. imio/smartweb/core/profiles/default/metadata.xml +1 -1
  16. imio/smartweb/core/profiles/default/registry/plone.xml +21 -4
  17. imio/smartweb/core/profiles/default/repositorytool.xml +1 -0
  18. imio/smartweb/core/profiles/default/types/Collection.xml +13 -0
  19. imio/smartweb/core/profiles/default/types/File.xml +13 -0
  20. imio/smartweb/core/profiles/default/types/Image.xml +13 -0
  21. imio/smartweb/core/profiles/default/types/imio.smartweb.BlockLink.xml +5 -0
  22. imio/smartweb/core/profiles/default/types/imio.smartweb.CirkwiView.xml +1 -0
  23. imio/smartweb/core/profiles/default/types/imio.smartweb.DirectoryView.xml +1 -0
  24. imio/smartweb/core/profiles/default/types/imio.smartweb.EventsView.xml +1 -0
  25. imio/smartweb/core/profiles/default/types/imio.smartweb.Folder.xml +1 -0
  26. imio/smartweb/core/profiles/default/types/imio.smartweb.NewsView.xml +1 -0
  27. imio/smartweb/core/profiles/default/types/imio.smartweb.Page.xml +1 -0
  28. imio/smartweb/core/profiles/default/types/imio.smartweb.PortalPage.xml +1 -0
  29. imio/smartweb/core/profiles/default/types/imio.smartweb.Procedure.xml +1 -0
  30. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionHTML.xml +0 -1
  31. imio/smartweb/core/profiles/validation/contentrules.xml +102 -0
  32. imio/smartweb/core/profiles.zcml +8 -0
  33. imio/smartweb/core/tests/test_section_external_content.py +23 -23
  34. imio/smartweb/core/tests/test_sections.py +21 -15
  35. imio/smartweb/core/tests/test_sitemap.py +41 -22
  36. imio/smartweb/core/upgrades/configure.zcml +54 -0
  37. imio/smartweb/core/upgrades/profiles/1052_to_1053/diff_tool.xml +8 -0
  38. imio/smartweb/core/upgrades/profiles/1052_to_1053/repositorytool.xml +9 -0
  39. imio/smartweb/core/upgrades/profiles/1052_to_1053/types/imio.smartweb.SectionHTML.xml +14 -0
  40. imio/smartweb/core/upgrades/profiles/1053_to_1054/registry.xml +39 -0
  41. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/Collection.xml +13 -0
  42. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/File.xml +13 -0
  43. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/Image.xml +13 -0
  44. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.BlockLink.xml +12 -0
  45. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.CirkwiView.xml +12 -0
  46. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.DirectoryView.xml +12 -0
  47. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.EventsView.xml +12 -0
  48. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Folder.xml +12 -0
  49. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.NewsView.xml +12 -0
  50. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Page.xml +12 -0
  51. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.PortalPage.xml +12 -0
  52. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Procedure.xml +12 -0
  53. imio/smartweb/core/viewlets/configure.zcml +10 -0
  54. imio/smartweb/core/viewlets/external_content.py +13 -5
  55. imio/smartweb/core/viewlets/odwb_widget_header.pt +19 -0
  56. imio/smartweb/core/viewlets/ogptags.py +1 -2
  57. imio/smartweb/core/webcomponents/build/css/373.smartweb-webcomponents-compiled.css +1 -0
  58. imio/smartweb/core/webcomponents/build/css/486.smartweb-webcomponents-compiled.css +1 -0
  59. imio/smartweb/core/webcomponents/build/css/686.smartweb-webcomponents-compiled.css +1 -0
  60. imio/smartweb/core/webcomponents/build/css/919.smartweb-webcomponents-compiled.css +1 -0
  61. imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
  62. imio/smartweb/core/webcomponents/build/js/209.smartweb-webcomponents-compiled.js +2 -0
  63. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +2 -0
  64. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +1 -0
  65. imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -0
  66. imio/smartweb/core/webcomponents/build/js/568.smartweb-webcomponents-compiled.js +2 -0
  67. imio/smartweb/core/webcomponents/build/js/568.smartweb-webcomponents-compiled.js.LICENSE.txt +14 -0
  68. imio/smartweb/core/webcomponents/build/js/674.smartweb-webcomponents-compiled.js +2 -0
  69. imio/smartweb/core/webcomponents/build/js/686.smartweb-webcomponents-compiled.js +1 -0
  70. imio/smartweb/core/webcomponents/build/js/799.smartweb-webcomponents-compiled.js +2 -0
  71. imio/smartweb/core/webcomponents/build/js/804.smartweb-webcomponents-compiled.js +1 -0
  72. imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -0
  73. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
  74. imio/smartweb/core/webcomponents/src/utils/translation.js +2 -2
  75. {imio.smartweb.core-1.2.33.dist-info → imio.smartweb.core-1.2.37.dist-info}/METADATA +38 -1
  76. {imio.smartweb.core-1.2.33.dist-info → imio.smartweb.core-1.2.37.dist-info}/RECORD +86 -63
  77. imio/smartweb/core/webcomponents/build/css/323.smartweb-webcomponents-compiled.css +0 -1
  78. imio/smartweb/core/webcomponents/build/css/392.smartweb-webcomponents-compiled.css +0 -1
  79. imio/smartweb/core/webcomponents/build/css/528.smartweb-webcomponents-compiled.css +0 -1
  80. imio/smartweb/core/webcomponents/build/css/647.smartweb-webcomponents-compiled.css +0 -1
  81. imio/smartweb/core/webcomponents/build/js/143.smartweb-webcomponents-compiled.js +0 -2
  82. imio/smartweb/core/webcomponents/build/js/144.smartweb-webcomponents-compiled.js +0 -2
  83. imio/smartweb/core/webcomponents/build/js/323.smartweb-webcomponents-compiled.js +0 -1
  84. imio/smartweb/core/webcomponents/build/js/392.smartweb-webcomponents-compiled.js +0 -1
  85. imio/smartweb/core/webcomponents/build/js/493.smartweb-webcomponents-compiled.js +0 -2
  86. imio/smartweb/core/webcomponents/build/js/528.smartweb-webcomponents-compiled.js +0 -2
  87. imio/smartweb/core/webcomponents/build/js/528.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -1
  88. imio/smartweb/core/webcomponents/build/js/647.smartweb-webcomponents-compiled.js +0 -1
  89. imio/smartweb/core/webcomponents/build/js/729.smartweb-webcomponents-compiled.js +0 -2
  90. imio/smartweb/core/webcomponents/build/js/729.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -1
  91. imio/smartweb/core/webcomponents/build/js/9.smartweb-webcomponents-compiled.js +0 -2
  92. imio/smartweb/core/webcomponents/build/js/969.smartweb-webcomponents-compiled.js +0 -2
  93. imio/smartweb/core/webcomponents/build/js/969.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -642
  94. imio/smartweb/core/webcomponents/build/js/979.smartweb-webcomponents-compiled.js +0 -1
  95. /imio/smartweb/core/webcomponents/build/js/{9.smartweb-webcomponents-compiled.js.LICENSE.txt → 209.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  96. /imio/smartweb/core/webcomponents/build/js/{143.smartweb-webcomponents-compiled.js.LICENSE.txt → 218.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  97. /imio/smartweb/core/webcomponents/build/js/{493.smartweb-webcomponents-compiled.js.LICENSE.txt → 674.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  98. /imio/smartweb/core/webcomponents/build/js/{144.smartweb-webcomponents-compiled.js.LICENSE.txt → 799.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  99. /imio.smartweb.core-1.2.33-py3.10-nspkg.pth → /imio.smartweb.core-1.2.37-py3.10-nspkg.pth +0 -0
  100. {imio.smartweb.core-1.2.33.dist-info → imio.smartweb.core-1.2.37.dist-info}/LICENSE.GPL +0 -0
  101. {imio.smartweb.core-1.2.33.dist-info → imio.smartweb.core-1.2.37.dist-info}/LICENSE.rst +0 -0
  102. {imio.smartweb.core-1.2.33.dist-info → imio.smartweb.core-1.2.37.dist-info}/WHEEL +0 -0
  103. {imio.smartweb.core-1.2.33.dist-info → imio.smartweb.core-1.2.37.dist-info}/namespace_packages.txt +0 -0
  104. {imio.smartweb.core-1.2.33.dist-info → imio.smartweb.core-1.2.37.dist-info}/top_level.txt +0 -0
@@ -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>
@@ -38,4 +38,9 @@
38
38
  <property name="view_methods">
39
39
  <element value="link_redirect_view"/>
40
40
  </property>
41
+
42
+ <!-- Enabled behaviors -->
43
+ <property name="behaviors" purge="false">
44
+ <element value="solr.fields" />
45
+ </property>
41
46
  </object>
@@ -37,6 +37,7 @@
37
37
  <element value="imio.smartweb.iam"/>
38
38
  <element value="plone.categorization"/>
39
39
  <element value="collective.autopublishing.behavior.IAutoPublishing"/>
40
+ <element value="solr.fields" />
40
41
  </property>
41
42
 
42
43
  </object>
@@ -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>
@@ -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.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 -->
@@ -32,7 +32,6 @@
32
32
  <element value="plone.namefromtitle"/>
33
33
  <element value="plone.locking"/>
34
34
  <element value="plone.shortname"/>
35
- <element value="plone.versioning" />
36
35
  </property>
37
36
 
38
37
  </object>
@@ -0,0 +1,102 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <contentrules>
3
+ <rule name="rule-1" title="Notification de contenu à valider"
4
+ cascading="False" description="" enabled="True"
5
+ event="Products.CMFCore.interfaces.IActionSucceededEvent"
6
+ stop-after="False">
7
+ <conditions>
8
+ <condition type="plone.conditions.PortalType">
9
+ <property name="check_types">
10
+ <element>imio.smartweb.Page</element>
11
+ <element>imio.smartweb.PortalPage</element>
12
+ <element>imio.smartweb.Procedure</element>
13
+ </property>
14
+ </condition>
15
+ <condition type="plone.conditions.WorkflowState">
16
+ <property name="wf_states">
17
+ <element>pending</element>
18
+ </property>
19
+ </condition>
20
+ </conditions>
21
+ <actions>
22
+ <action type="plone.actions.Mail">
23
+ <property name="subject">Nouveau contenu sur le site</property>
24
+ <property name="source"/>
25
+ <property name="recipients">${reviewer_emails}</property>
26
+ <property name="exclude_actor">False</property>
27
+ <property name="message">Un nouveau contenu a été soumis à validation. Cliquez sur le lien pour aller le valider ou le refuser : ${absolute_url}</property>
28
+ </action>
29
+ <action type="plone.actions.Logger">
30
+ <property name="targetLogger">imio.smartweb.core</property>
31
+ <property name="loggingLevel">20</property>
32
+ <property
33
+ name="message">Content to review notification sent for &amp;c.</property>
34
+ </action>
35
+ </actions>
36
+ </rule>
37
+ <rule name="rule-2" title="Notification de modification de section de contenu publié"
38
+ cascading="False" description="" enabled="True"
39
+ event="zope.lifecycleevent.interfaces.IObjectModifiedEvent"
40
+ stop-after="False">
41
+ <conditions>
42
+ <condition type="plone.conditions.PortalType">
43
+ <property name="check_types">
44
+ <element>imio.smartweb.SectionText</element>
45
+ </property>
46
+ </condition>
47
+ <condition type="plone.conditions.TalesExpression">
48
+ <property
49
+ name="tales_expression">python: hasattr(here, &quot;aq_parent&quot;) and portal.portal_workflow.getInfoFor(here.aq_parent, &quot;review_state&quot;, &quot;&quot;) == &quot;published&quot;</property>
50
+ </condition>
51
+ </conditions>
52
+ <actions>
53
+ <action type="plone.actions.Mail">
54
+ <property name="subject">Contenu publié modifié sur le site</property>
55
+ <property name="source"/>
56
+ <property name="recipients">${reviewer_emails}</property>
57
+ <property name="exclude_actor">False</property>
58
+ <property name="message">Une section texte d&#x27;un contenu déjà publié a été modifiée. Cliquez sur le lien pour consulter la modification effectuée : ${absolute_url}/@@historyview</property>
59
+ </action>
60
+ <action type="plone.actions.Logger">
61
+ <property name="targetLogger">imio.smartweb.core</property>
62
+ <property name="loggingLevel">20</property>
63
+ <property
64
+ name="message">Published content change notification sent for &amp;c (user: &amp;u).</property>
65
+ </action>
66
+ </actions>
67
+ </rule>
68
+ <rule name="rule-3" title="Notification d'ajout de section à un contenu publié"
69
+ cascading="False" description="" enabled="True"
70
+ event="zope.lifecycleevent.interfaces.IObjectAddedEvent"
71
+ stop-after="False">
72
+ <conditions>
73
+ <condition type="plone.conditions.PortalType">
74
+ <property name="check_types">
75
+ <element>imio.smartweb.SectionText</element>
76
+ </property>
77
+ </condition>
78
+ <condition type="plone.conditions.TalesExpression">
79
+ <property
80
+ name="tales_expression">python: hasattr(here, &quot;aq_parent&quot;) and portal.portal_workflow.getInfoFor(here.aq_parent, &quot;review_state&quot;, &quot;&quot;) == &quot;published&quot;</property>
81
+ </condition>
82
+ </conditions>
83
+ <actions>
84
+ <action type="plone.actions.Mail">
85
+ <property name="subject">Contenu publié modifié sur le site</property>
86
+ <property name="source"/>
87
+ <property name="recipients">${reviewer_emails}</property>
88
+ <property name="exclude_actor">False</property>
89
+ <property name="message">Une section texte a été ajoutée à un contenu déjà publié. Cliquez sur le lien pour consulter la section texte ajoutée : ${absolute_url}</property>
90
+ </action>
91
+ <action type="plone.actions.Logger">
92
+ <property name="targetLogger">imio.smartweb.core</property>
93
+ <property name="loggingLevel">20</property>
94
+ <property
95
+ name="message">Published content add notification sent for &amp;c (user: &amp;u).</property>
96
+ </action>
97
+ </actions>
98
+ </rule>
99
+ <assignment name="rule-1" bubbles="True" enabled="True" location=""/>
100
+ <assignment name="rule-2" bubbles="True" enabled="True" location=""/>
101
+ <assignment name="rule-3" bubbles="True" enabled="True" location=""/>
102
+ </contentrules>
@@ -45,6 +45,14 @@
45
45
  provides="Products.GenericSetup.interfaces.EXTENSION"
46
46
  />
47
47
 
48
+ <genericsetup:registerProfile
49
+ name="validation"
50
+ title="imio.smartweb.core validation"
51
+ directory="profiles/validation"
52
+ description="Installs smartweb validation content rules"
53
+ provides="Products.GenericSetup.interfaces.EXTENSION"
54
+ />
55
+
48
56
  <genericsetup:registerProfile
49
57
  name="last-compilation"
50
58
  title="imio.smartweb.core last compilation dates"
@@ -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(
@@ -588,3 +576,21 @@ class TestSections(ImioSmartwebTestCase):
588
576
  self.assertEqual(
589
577
  view.get_class(section), "sectiontext my-css col-sm-3 with-background"
590
578
  )
579
+
580
+ def test_sections_history(self):
581
+ api.content.transition(self.page, "publish")
582
+ section_types = get_sections_types()
583
+ page_view = queryMultiAdapter((self.page, self.request), name="full_view")()
584
+ count_historyview_link = page_view.count("@@historyview")
585
+ self.assertEqual(count_historyview_link, 1)
586
+ for section_type in section_types:
587
+ api.content.create(
588
+ container=self.page,
589
+ type=section_type,
590
+ title="Title of my {}".format(section_type),
591
+ )
592
+ page_view = queryMultiAdapter((self.page, self.request), name="full_view")()
593
+ section_text = api.content.find(portal_type="imio.smartweb.SectionText")[0]
594
+ self.assertIn(f"{section_text.getURL()}/@@historyview", page_view)
595
+ # One more history view link on SectionText
596
+ self.assertEqual(page_view.count("@@historyview"), count_historyview_link + 1)
@@ -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 = f"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)
@@ -195,6 +195,30 @@
195
195
  provides="Products.GenericSetup.interfaces.EXTENSION"
196
196
  />
197
197
 
198
+ <genericsetup:registerProfile
199
+ name="upgrade_1052_to_1053"
200
+ title="Upgrade core from 1052 to 1053"
201
+ directory="profiles/1052_to_1053"
202
+ description="Fix versioning on imio.smartweb.SectionText"
203
+ provides="Products.GenericSetup.interfaces.EXTENSION"
204
+ />
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
+
198
222
  <genericsetup:upgradeStep
199
223
  title="Configure first official release"
200
224
  description="Run needed profiles steps and reindex catalog"
@@ -729,4 +753,34 @@
729
753
  />
730
754
  </genericsetup:upgradeSteps>
731
755
 
756
+ <genericsetup:upgradeSteps
757
+ source="1052"
758
+ destination="1053"
759
+ profile="imio.smartweb.core:default">
760
+ <genericsetup:upgradeDepends
761
+ title="Fix versioning on imio.smartweb.SectionText"
762
+ import_profile="imio.smartweb.core.upgrades:upgrade_1052_to_1053"
763
+ />
764
+ </genericsetup:upgradeSteps>
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
+
732
786
  </configure>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <object>
3
+ <difftypes>
4
+ <type portal_type="imio.smartweb.SectionText">
5
+ <field name="any" difftype="Compound Diff for Dexterity types"/>
6
+ </type>
7
+ </difftypes>
8
+ </object>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <repositorytool>
3
+ <policymap purge="false">
4
+ <type name="imio.smartweb.SectionText">
5
+ <policy name="at_edit_autoversion" />
6
+ <policy name="version_on_revert" />
7
+ </type>
8
+ </policymap>
9
+ </repositorytool>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ name="imio.smartweb.SectionHTML"
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,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>