imio.smartweb.core 1.2.37__py3-none-any.whl → 1.2.79__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 (222) hide show
  1. imio/smartweb/core/behaviors/categorization.py +24 -0
  2. imio/smartweb/core/behaviors/configure.zcml +7 -0
  3. imio/smartweb/core/browser/controlpanel.py +43 -0
  4. imio/smartweb/core/browser/faceted/block_view.pt +4 -4
  5. imio/smartweb/core/browser/faceted/summary_view.pt +4 -4
  6. imio/smartweb/core/browser/sitemap.py +10 -3
  7. imio/smartweb/core/browser/static/icons/action-delete.svg +3 -0
  8. imio/smartweb/core/browser/static/icons/action-engagement-2.svg +4 -0
  9. imio/smartweb/core/browser/static/icons/action-panneaux.svg +3 -0
  10. imio/smartweb/core/browser/static/icons/action-vote.svg +3 -0
  11. imio/smartweb/core/browser/static/icons/categorie-attention.svg +3 -0
  12. imio/smartweb/core/browser/static/icons/categorie-infos-travaux-2.svg +4 -0
  13. imio/smartweb/core/browser/static/icons/categorie-nature.svg +3 -0
  14. imio/smartweb/core/browser/static/icons/categorie-parcs-a-conteneurs.svg +4 -0
  15. imio/smartweb/core/browser/static/icons/categorie-plus.svg +3 -0
  16. imio/smartweb/core/browser/static/icons/categorie-primes-2.svg +5 -0
  17. imio/smartweb/core/browser/static/icons/categorie-sport-natation.svg +4 -0
  18. imio/smartweb/core/browser/static/icons/organisation-ecole-sac.svg +4 -0
  19. imio/smartweb/core/browser/static/icons/organisation-scout.svg +3 -0
  20. imio/smartweb/core/browser/static/icons/reseausocial-behance.svg +3 -0
  21. imio/smartweb/core/browser/static/icons/reseausocial-linkedin.svg +3 -0
  22. imio/smartweb/core/browser/static/smartweb-edit-compiled.css +1 -1
  23. imio/smartweb/core/browser/static/smartweb-view-compiled.css +1 -1
  24. imio/smartweb/core/browser/static/src/edit.less +42 -0
  25. imio/smartweb/core/browser/static/src/view.less +109 -56
  26. imio/smartweb/core/browser/vocabulary.py +8 -3
  27. imio/smartweb/core/contents/__init__.py +2 -0
  28. imio/smartweb/core/contents/configure.zcml +1 -0
  29. imio/smartweb/core/contents/folder/block_view.pt +8 -8
  30. imio/smartweb/core/contents/folder/summary_view.pt +4 -4
  31. imio/smartweb/core/contents/pages/cirkwi/content.py +5 -0
  32. imio/smartweb/core/contents/pages/cirkwi/view.py +2 -1
  33. imio/smartweb/core/contents/pages/configure.zcml +1 -0
  34. imio/smartweb/core/contents/pages/portal_page/view.py +3 -0
  35. imio/smartweb/core/contents/pages/views.py +47 -1
  36. imio/smartweb/core/contents/publication/__init__.py +0 -0
  37. imio/smartweb/core/contents/publication/configure.zcml +5 -0
  38. imio/smartweb/core/contents/publication/content.py +23 -0
  39. imio/smartweb/core/contents/rest/base.py +9 -7
  40. imio/smartweb/core/contents/rest/directory/endpoint.py +2 -2
  41. imio/smartweb/core/contents/rest/directory/view.pt +2 -1
  42. imio/smartweb/core/contents/rest/events/content.py +13 -0
  43. imio/smartweb/core/contents/rest/events/endpoint.py +5 -3
  44. imio/smartweb/core/contents/rest/events/view.pt +5 -1
  45. imio/smartweb/core/contents/rest/events/view.py +12 -0
  46. imio/smartweb/core/contents/rest/news/content.py +6 -0
  47. imio/smartweb/core/contents/rest/news/endpoint.py +4 -2
  48. imio/smartweb/core/contents/rest/news/view.pt +4 -1
  49. imio/smartweb/core/contents/rest/news/view.py +8 -0
  50. imio/smartweb/core/contents/rest/utils.py +0 -1
  51. imio/smartweb/core/contents/rest/view.py +4 -0
  52. imio/smartweb/core/contents/sections/common_templates/carousel.pt +5 -1
  53. imio/smartweb/core/contents/sections/common_templates/table.pt +18 -4
  54. imio/smartweb/core/contents/sections/configure.zcml +18 -0
  55. imio/smartweb/core/contents/sections/contact/content.py +2 -2
  56. imio/smartweb/core/contents/sections/contact/macros.pt +28 -3
  57. imio/smartweb/core/contents/sections/contact/utils.py +2 -0
  58. imio/smartweb/core/contents/sections/contact/view.py +28 -12
  59. imio/smartweb/core/contents/sections/events/content.py +12 -4
  60. imio/smartweb/core/contents/sections/events/view.py +20 -2
  61. imio/smartweb/core/contents/sections/external_content/view.pt +4 -4
  62. imio/smartweb/core/contents/sections/external_content/views.py +6 -4
  63. imio/smartweb/core/contents/sections/files/content.py +7 -1
  64. imio/smartweb/core/contents/sections/files/view.py +43 -12
  65. imio/smartweb/core/contents/sections/links/view.py +5 -0
  66. imio/smartweb/core/contents/sections/macros.pt +26 -0
  67. imio/smartweb/core/contents/sections/news/content.py +11 -3
  68. imio/smartweb/core/contents/sections/news/view.py +20 -2
  69. imio/smartweb/core/contents/sections/text/views.py +2 -0
  70. imio/smartweb/core/contents/sections/views.py +73 -10
  71. imio/smartweb/core/interfaces.py +4 -0
  72. imio/smartweb/core/profiles/default/metadata.xml +1 -1
  73. imio/smartweb/core/profiles/default/taxonomies/page_category.xml +16 -0
  74. imio/smartweb/core/profiles/default/taxonomies/procedure_category.xml +26 -0
  75. imio/smartweb/core/profiles/default/types/imio.smartweb.EventsView.xml +1 -0
  76. imio/smartweb/core/profiles/default/types/imio.smartweb.NewsView.xml +1 -0
  77. imio/smartweb/core/profiles/default/types/imio.smartweb.Publication.xml +38 -0
  78. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionEvents.xml +1 -0
  79. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionFiles.xml +2 -0
  80. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionNews.xml +1 -0
  81. imio/smartweb/core/profiles/default/types.xml +1 -0
  82. imio/smartweb/core/profiles/icons/basic/registry.xml +120 -0
  83. imio/smartweb/core/rest/authentic_sources.py +17 -2
  84. imio/smartweb/core/subscribers.py +48 -0
  85. imio/smartweb/core/subscribers.zcml +12 -0
  86. imio/smartweb/core/tests/resources/json_iadeliberations_institutions.json +60 -0
  87. imio/smartweb/core/tests/resources/json_iadeliberations_publication.json +105 -0
  88. imio/smartweb/core/tests/resources/json_iadeliberations_publications.json +270 -0
  89. imio/smartweb/core/tests/resources/json_rest_events.json +6 -2
  90. imio/smartweb/core/tests/resources/json_rest_news.json +2 -2
  91. imio/smartweb/core/tests/resources/json_rest_specific_events.json +1 -1
  92. imio/smartweb/core/tests/test_htmx_in_sections.py +131 -0
  93. imio/smartweb/core/tests/test_iadeliberations.py +136 -0
  94. imio/smartweb/core/tests/test_icons.py +1 -1
  95. imio/smartweb/core/tests/test_rest.py +58 -17
  96. imio/smartweb/core/tests/test_section_contact.py +42 -10
  97. imio/smartweb/core/tests/test_section_events.py +28 -5
  98. imio/smartweb/core/tests/test_section_external_content.py +28 -2
  99. imio/smartweb/core/tests/test_section_news.py +30 -8
  100. imio/smartweb/core/tests/test_sections.py +17 -0
  101. imio/smartweb/core/tests/test_vocabularies.py +60 -3
  102. imio/smartweb/core/tests/test_vocabulary.py +43 -0
  103. imio/smartweb/core/upgrades/configure.zcml +108 -0
  104. imio/smartweb/core/upgrades/profiles/1055_to_1056/types/imio.smartweb.SectionFiles.xml +12 -0
  105. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.EventsView.xml +11 -0
  106. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.NewsView.xml +11 -0
  107. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionEvents.xml +11 -0
  108. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionNews.xml +11 -0
  109. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/page_category.cfg +9 -0
  110. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/page_category.xml +73 -0
  111. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/procedure_category.cfg +9 -0
  112. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/procedure_category.xml +118 -0
  113. imio/smartweb/core/upgrades/profiles/1058_to_1059/registry/linkedin-icon.xml +126 -0
  114. imio/smartweb/core/upgrades/profiles/1059_to_1060/registry/iadeliberation.xml +9 -0
  115. imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.Publication.xml +38 -0
  116. imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.SectionFiles.xml +11 -0
  117. imio/smartweb/core/upgrades/profiles/1060_to_1061/types.xml +4 -0
  118. imio/smartweb/core/upgrades/profiles/1060_to_1061/workflows.xml +6 -0
  119. imio/smartweb/core/utils.py +33 -2
  120. imio/smartweb/core/viewlets/configure.zcml +23 -1
  121. imio/smartweb/core/viewlets/footer.pt +5 -0
  122. imio/smartweb/core/viewlets/footer.py +5 -0
  123. imio/smartweb/core/viewlets/htmx.py +15 -0
  124. imio/smartweb/core/viewlets/htmx_js_header.pt +64 -0
  125. imio/smartweb/core/viewlets/ogptags.py +4 -3
  126. imio/smartweb/core/viewlets/social.py +23 -0
  127. imio/smartweb/core/vocabularies.py +65 -3
  128. imio/smartweb/core/vocabularies.zcml +18 -0
  129. imio/smartweb/core/webcomponents/build/1c1605a5fe9a2b10a88f.png +1 -0
  130. imio/smartweb/core/webcomponents/build/524db40e119aa11f4478.png +1 -0
  131. imio/smartweb/core/webcomponents/build/57d3b7cb1ab874660b39.svg +1 -0
  132. imio/smartweb/core/webcomponents/build/6cf03871df23ed2ee8b3.png +1 -0
  133. imio/smartweb/core/webcomponents/build/css/373.smartweb-webcomponents-compiled.css +1 -1
  134. imio/smartweb/core/webcomponents/build/css/486.smartweb-webcomponents-compiled.css +1 -1
  135. imio/smartweb/core/webcomponents/build/css/884.smartweb-webcomponents-compiled.css +1 -0
  136. imio/smartweb/core/webcomponents/build/css/919.smartweb-webcomponents-compiled.css +1 -1
  137. imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
  138. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +1 -1
  139. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js.LICENSE.txt +10 -8
  140. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +2 -1
  141. imio/smartweb/core/webcomponents/build/js/{568.smartweb-webcomponents-compiled.js.LICENSE.txt → 373.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -4
  142. imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -1
  143. imio/smartweb/core/webcomponents/build/js/499.smartweb-webcomponents-compiled.js +2 -0
  144. imio/smartweb/core/webcomponents/build/js/{674.smartweb-webcomponents-compiled.js.LICENSE.txt → 499.smartweb-webcomponents-compiled.js.LICENSE.txt} +1 -8
  145. imio/smartweb/core/webcomponents/build/js/799.smartweb-webcomponents-compiled.js +1 -1
  146. imio/smartweb/core/webcomponents/build/js/824.smartweb-webcomponents-compiled.js +2 -0
  147. imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js +2 -0
  148. imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js.LICENSE.txt +32 -0
  149. imio/smartweb/core/webcomponents/build/js/884.smartweb-webcomponents-compiled.js +1 -0
  150. imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -1
  151. imio/smartweb/core/webcomponents/build/js/{568.smartweb-webcomponents-compiled.js → 963.smartweb-webcomponents-compiled.js} +2 -2
  152. imio/smartweb/core/webcomponents/build/js/963.smartweb-webcomponents-compiled.js.LICENSE.txt +3 -0
  153. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
  154. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js.LICENSE.txt +11 -14
  155. imio/smartweb/core/webcomponents/package.json +42 -40
  156. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.jsx +146 -79
  157. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.scss +415 -351
  158. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactCard/ContactCard.jsx +95 -62
  159. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +328 -168
  160. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactList/ContactList.jsx +21 -4
  161. imio/smartweb/core/webcomponents/src/components/Annuaire/Filters/Filter.jsx +213 -100
  162. imio/smartweb/core/webcomponents/src/components/Annuaire/index.js +1 -1
  163. imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +76 -33
  164. imio/smartweb/core/webcomponents/src/components/Events/EventContent/EventContent.jsx +604 -377
  165. imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +29 -4
  166. imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +162 -88
  167. imio/smartweb/core/webcomponents/src/components/Events/Events.scss +496 -378
  168. imio/smartweb/core/webcomponents/src/components/Events/Filters/Filter.jsx +259 -91
  169. imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.jsx +62 -55
  170. imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.scss +68 -17
  171. imio/smartweb/core/webcomponents/src/components/Filters/IamData.jsx +42 -0
  172. imio/smartweb/core/webcomponents/src/components/Filters/MainFilter.scss +229 -0
  173. imio/smartweb/core/webcomponents/src/components/Filters/PublicTargetData.jsx +94 -0
  174. imio/smartweb/core/webcomponents/src/components/Filters/SelectStyles.js +58 -0
  175. imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.jsx +149 -0
  176. imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.scss +70 -0
  177. imio/smartweb/core/webcomponents/src/components/News/Filters/Filter.jsx +139 -83
  178. imio/smartweb/core/webcomponents/src/components/News/News.jsx +133 -67
  179. imio/smartweb/core/webcomponents/src/components/News/News.scss +170 -127
  180. imio/smartweb/core/webcomponents/src/components/News/NewsCard/NewsCard.jsx +76 -44
  181. imio/smartweb/core/webcomponents/src/components/News/NewsContent/NewsContent.jsx +261 -188
  182. imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +48 -9
  183. imio/smartweb/core/webcomponents/src/components/Search/ContactResult/ContactResult.jsx +21 -10
  184. imio/smartweb/core/webcomponents/src/components/Search/EventsResult/EventsResult.jsx +21 -10
  185. imio/smartweb/core/webcomponents/src/components/Search/Filters/Filter.jsx +8 -9
  186. imio/smartweb/core/webcomponents/src/components/Search/NewsResult/NewsResult.jsx +23 -12
  187. imio/smartweb/core/webcomponents/src/components/Search/Search.jsx +7 -6
  188. imio/smartweb/core/webcomponents/src/components/Search/Search.scss +115 -96
  189. imio/smartweb/core/webcomponents/src/components/Search/WebResult/WebResult.jsx +12 -3
  190. imio/smartweb/core/webcomponents/src/components/Search/index.js +1 -1
  191. imio/smartweb/core/webcomponents/src/hooks/ScrollContext.jsx +3 -0
  192. imio/smartweb/core/webcomponents/src/hooks/useAxios.js +3 -3
  193. imio/smartweb/core/webcomponents/src/hooks/useFilterQuery.js +1 -2
  194. imio/smartweb/core/webcomponents/src/index.scss +255 -211
  195. imio/smartweb/core/webcomponents/src/utils/Map.jsx +26 -19
  196. imio/smartweb/core/webcomponents/src/utils/Map.scss +2 -2
  197. imio/smartweb/core/webcomponents/src/utils/translation.js +129 -9
  198. imio.smartweb.core-1.2.79-py3.8-nspkg.pth +2 -0
  199. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/METADATA +413 -10
  200. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/RECORD +206 -160
  201. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/WHEEL +1 -1
  202. imio/smartweb/core/webcomponents/build/assets/location-bla.1423bcce16ddcb21141430cac1428dc1.svg +0 -1
  203. imio/smartweb/core/webcomponents/build/assets/next-react-white.819cb069ac8eec300a9db6a7707712d6.svg +0 -1
  204. imio/smartweb/core/webcomponents/build/assets/next-react.17bc43ff4a6a86f4520f5782f6a89a72.svg +0 -1
  205. imio/smartweb/core/webcomponents/build/assets/search.57bdbf5b191499cd77514097d1c4972c.svg +0 -1
  206. imio/smartweb/core/webcomponents/build/css/686.smartweb-webcomponents-compiled.css +0 -1
  207. imio/smartweb/core/webcomponents/build/js/209.smartweb-webcomponents-compiled.js +0 -2
  208. imio/smartweb/core/webcomponents/build/js/674.smartweb-webcomponents-compiled.js +0 -2
  209. imio/smartweb/core/webcomponents/build/js/686.smartweb-webcomponents-compiled.js +0 -1
  210. imio/smartweb/core/webcomponents/build/js/804.smartweb-webcomponents-compiled.js +0 -1
  211. imio/smartweb/core/webcomponents/src/assets/facebook-news.svg +0 -1
  212. imio/smartweb/core/webcomponents/src/assets/location-bla.svg +0 -1
  213. imio/smartweb/core/webcomponents/src/assets/next-react.svg +0 -1
  214. imio/smartweb/core/webcomponents/src/assets/search.svg +0 -1
  215. imio/smartweb/core/webcomponents/src/assets/skeleton.svg +0 -1
  216. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/download.svg +0 -1
  217. imio.smartweb.core-1.2.37-py3.10-nspkg.pth +0 -3
  218. /imio/smartweb/core/webcomponents/build/js/{209.smartweb-webcomponents-compiled.js.LICENSE.txt → 824.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  219. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/LICENSE.GPL +0 -0
  220. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/LICENSE.rst +0 -0
  221. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/namespace_packages.txt +0 -0
  222. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/top_level.txt +0 -0
@@ -1,12 +1,18 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ from Acquisition import aq_inner
4
+ from imio.smartweb.common.utils import get_vocabulary
5
+ from imio.smartweb.common.utils import is_log_active
6
+ from imio.smartweb.common.utils import translate_vocabulary_term
3
7
  from imio.smartweb.core.utils import hash_md5
8
+ from imio.smartweb.core.utils import reindexParent
4
9
  from imio.smartweb.locales import SmartwebMessageFactory as _
5
10
  from plone import api
6
11
  from plone.locking.browser.info import LockInfoViewlet
7
12
  from plone.protect.interfaces import IDisableCSRFProtection
8
13
  from Products.Five.browser import BrowserView
9
14
  from zope.annotation.interfaces import IAnnotations
15
+ from zope.i18n import translate
10
16
  from zope.interface import alsoProvides
11
17
  from zope.interface import Interface
12
18
  from zope.lifecycleevent import modified
@@ -52,14 +58,62 @@ class SectionView(BrowserView):
52
58
  api.portal.show_message(_("Section title has been shown"), self.request)
53
59
  self.redirect_to_section(self.context.id)
54
60
 
61
+ @property
62
+ def display_container_title(self):
63
+ return False
64
+
55
65
  @property
56
66
  def is_anonymous(self):
57
67
  return api.user.is_anonymous()
58
68
 
69
+ def get_section_size(self):
70
+ current_lang = api.portal.get_current_language()[:2]
71
+ if not self.context.bootstrap_css_class:
72
+ return translate(_("Define section size"), target_language=current_lang)
73
+ return translate_vocabulary_term(
74
+ "imio.smartweb.vocabulary.BootstrapCSS",
75
+ self.context.bootstrap_css_class,
76
+ current_lang,
77
+ )
78
+
79
+ @property
80
+ def get_sizes(self):
81
+ voc = get_vocabulary("imio.smartweb.vocabulary.BootstrapCSS")
82
+ sizes = [{"key": t.token, "value": _(t.title)} for t in voc]
83
+ return sizes
84
+
85
+ @property
86
+ def save_size(self):
87
+ select_name = f"select_{self.context.UID()}"
88
+ if not self.request.form.get(select_name):
89
+ return json.dumps({})
90
+ section_size = self.request.form.get(select_name)
91
+ context = aq_inner(self.context)
92
+ context.bootstrap_css_class = section_size
93
+ context.reindexObject()
94
+ reindexParent(context)
95
+ current_lang = api.portal.get_current_language()[:2]
96
+ size_txt = translate_vocabulary_term(
97
+ "imio.smartweb.vocabulary.BootstrapCSS",
98
+ section_size,
99
+ current_lang,
100
+ )
101
+ return json.dumps({"id": section_size, "title": size_txt})
102
+
59
103
 
60
104
  class CarouselOrTableSectionView(SectionView):
61
105
  """Section view that can display a carousel"""
62
106
 
107
+ def items(self):
108
+ items = self.context.listFolderContents()
109
+ for item in items:
110
+ item.smartweb_type = "Item"
111
+ item.container_id = ""
112
+ portal_type = getattr(item, "portal_type", None)
113
+ if portal_type:
114
+ item.smartweb_type = portal_type.split(".")[-1]
115
+ return items
116
+
63
117
  @property
64
118
  def image_scale(self):
65
119
  layout = self.context.getLayout()
@@ -67,40 +121,49 @@ class CarouselOrTableSectionView(SectionView):
67
121
  if layout == "carousel_view":
68
122
  return self.context.nb_results_by_batch == 1 and "affiche" or "vignette"
69
123
  elif layout == "table_view":
70
- return self.context.nb_results_by_batch == 1 and "liste" or "vignette"
124
+ return self.context.nb_results_by_batch == 1 and "affiche" or "vignette"
71
125
  else:
72
126
  return getattr(self.context, "image_scale", "")
73
127
 
74
- def datetime_format(self, item):
128
+ def datetime_format(self, item, datetime_field="effective"):
75
129
  """
76
130
  item.get("effective", None)
77
131
  => DateTime('YYYY/MM/DD HH:mm:ss.000000 GMT+1')
78
132
  convert to more conventional datetime format
79
133
  and return its string representation
80
134
  """
81
- effective = item.get("effective", None)
82
- if effective is None:
135
+ datetime_field = item.get(datetime_field, None)
136
+ if datetime_field is None:
83
137
  return ""
84
138
  target_timezone = pytz.timezone("Europe/Paris")
85
- if isinstance(effective, str):
86
- return effective
87
- dt = effective.asdatetime()
139
+ if isinstance(datetime_field, str):
140
+ return datetime_field
141
+ dt = datetime_field.asdatetime()
88
142
  target_datetime = dt.astimezone(target_timezone)
89
143
  output_format = "%Y-%m-%dT%H:%M:%S%z"
90
144
  formatted_datetime_str = target_datetime.strftime(output_format)
91
145
  return formatted_datetime_str
92
146
 
147
+ def retrieve_item_url(self, item):
148
+ return item.get("url")
149
+
93
150
 
94
151
  class HashableJsonSectionView(SectionView):
95
152
  json_data = None
96
153
 
97
154
  def refresh_modification_date(self):
98
- new_hash = None
99
- if self.json_data is not None:
100
- new_hash = hash_md5(json.dumps(self.json_data))
155
+ if self.json_data is None:
156
+ # Don't reindex section when we receive no JSON (ex: timeout)
157
+ return
158
+ new_hash = hash_md5(json.dumps(self.json_data))
101
159
  annotations = IAnnotations(self.context)
102
160
  stored_hash = annotations.get(SECTION_ITEMS_HASH_KEY)
103
161
  if stored_hash != new_hash:
104
162
  alsoProvides(self.request, IDisableCSRFProtection)
105
163
  modified(self.context)
106
164
  annotations[SECTION_ITEMS_HASH_KEY] = new_hash
165
+ if is_log_active():
166
+ if "JSONS" in annotations:
167
+ annotations["JSONS"].append(self.json_data)
168
+ else:
169
+ annotations["JSONS"] = [self.json_data]
@@ -42,3 +42,7 @@ class IOdwbViewUtils(Interface):
42
42
 
43
43
  def is_odwb_widget_plugins():
44
44
  """Return True if we are in the generic odwb widget plugins"""
45
+
46
+
47
+ class IHtmxViewUtils(Interface):
48
+ """ """
@@ -1,6 +1,6 @@
1
1
  <?xml version='1.0' encoding='UTF-8'?>
2
2
  <metadata>
3
- <version>1055</version>
3
+ <version>1061</version>
4
4
  <dependencies>
5
5
  <dependency>profile-plone.app.dexterity:default</dependency>
6
6
  <dependency>profile-plone.app.imagecropping:default</dependency>
@@ -3,6 +3,8 @@
3
3
  <vocabName>
4
4
  <langstring language="fr">Catégorie d'une page</langstring>
5
5
  <langstring language="en">Page category</langstring>
6
+ <langstring language="nl">Paginacategorie</langstring>
7
+ <langstring language="de">Seitenkategorie</langstring>
6
8
  </vocabName>
7
9
  <vocabIdentifier>page_category</vocabIdentifier>
8
10
  <term>
@@ -10,6 +12,8 @@
10
12
  <caption>
11
13
  <langstring language="fr">Avis et enquête</langstring>
12
14
  <langstring language="en">Advice and enquiry</langstring>
15
+ <langstring language="nl">Advies en onderzoek</langstring>
16
+ <langstring language="de">Gutachten und Untersuchung</langstring>
13
17
  </caption>
14
18
  </term>
15
19
  <term>
@@ -17,6 +21,8 @@
17
21
  <caption>
18
22
  <langstring language="fr">Emploi</langstring>
19
23
  <langstring language="en">Job</langstring>
24
+ <langstring language="nl">Werk</langstring>
25
+ <langstring language="de">Arbeit</langstring>
20
26
  </caption>
21
27
  </term>
22
28
  <term>
@@ -24,6 +30,8 @@
24
30
  <caption>
25
31
  <langstring language="fr">Info travaux</langstring>
26
32
  <langstring language="en">Works information</langstring>
33
+ <langstring language="nl">Werkinformatie</langstring>
34
+ <langstring language="de">Arbeitsinformation</langstring>
27
35
  </caption>
28
36
  </term>
29
37
  <term>
@@ -31,6 +39,8 @@
31
39
  <caption>
32
40
  <langstring language="fr">Presse</langstring>
33
41
  <langstring language="en">Press</langstring>
42
+ <langstring language="nl">Pers</langstring>
43
+ <langstring language="de">Presse</langstring>
34
44
  </caption>
35
45
  </term>
36
46
  <term>
@@ -38,6 +48,8 @@
38
48
  <caption>
39
49
  <langstring language="fr">Publication</langstring>
40
50
  <langstring language="en">Publication</langstring>
51
+ <langstring language="nl">Publicatie</langstring>
52
+ <langstring language="de">Veröffentlichung</langstring>
41
53
  </caption>
42
54
  </term>
43
55
  <term>
@@ -45,6 +57,8 @@
45
57
  <caption>
46
58
  <langstring language="fr">Règlement</langstring>
47
59
  <langstring language="en">Regulation</langstring>
60
+ <langstring language="nl">Regelgeving</langstring>
61
+ <langstring language="de">Vorschrift</langstring>
48
62
  </caption>
49
63
  </term>
50
64
  <term>
@@ -52,6 +66,8 @@
52
66
  <caption>
53
67
  <langstring language="fr">Taxe et redevance</langstring>
54
68
  <langstring language="en">Taxe and fee</langstring>
69
+ <langstring language="nl">Belasting en vergoeding</langstring>
70
+ <langstring language="de">Steuer und Gebühr</langstring>
55
71
  </caption>
56
72
  </term>
57
73
  </vdex>
@@ -3,6 +3,8 @@
3
3
  <vocabName>
4
4
  <langstring language="fr">Catégorie d'une démarche</langstring>
5
5
  <langstring language="en">Procedure category</langstring>
6
+ <langstring language="nl">Procedurecategorie</langstring>
7
+ <langstring language="de">Verfahrenskategorie</langstring>
6
8
  </vocabName>
7
9
  <vocabIdentifier>procedure_category</vocabIdentifier>
8
10
  <term>
@@ -10,6 +12,8 @@
10
12
  <caption>
11
13
  <langstring language="fr">Acte (naissance, mariage, décès, etc.)</langstring>
12
14
  <langstring language="en">Act (birth, marriage, death, etc.)</langstring>
15
+ <langstring language="nl">Akte (geboorte, huwelijk, overlijden, enz.)</langstring>
16
+ <langstring language="de">Urkunde (Geburt, Ehe, Tod, usw.)</langstring>
13
17
  </caption>
14
18
  </term>
15
19
  <term>
@@ -17,6 +21,8 @@
17
21
  <caption>
18
22
  <langstring language="fr">Autorisation et carte</langstring>
19
23
  <langstring language="en">Authorization and card</langstring>
24
+ <langstring language="nl">Vergunning en kaart</langstring>
25
+ <langstring language="de">Genehmigung und Karte</langstring>
20
26
  </caption>
21
27
  </term>
22
28
  <term>
@@ -24,6 +30,8 @@
24
30
  <caption>
25
31
  <langstring language="fr">Certificat (de vie, d'hérédité, etc.)</langstring>
26
32
  <langstring language="en">Certificate (of life, inheritance, etc.)</langstring>
33
+ <langstring language="nl">Certificaat (van leven, van erfenis, enz.)</langstring>
34
+ <langstring language="de">Bescheinigung (des Lebens, des Erbes, usw.)</langstring>
27
35
  </caption>
28
36
  </term>
29
37
  <term>
@@ -31,6 +39,8 @@
31
39
  <caption>
32
40
  <langstring language="fr">Déclaration</langstring>
33
41
  <langstring language="en">Statement</langstring>
42
+ <langstring language="nl">Verklaring</langstring>
43
+ <langstring language="de">Erklärung</langstring>
34
44
  </caption>
35
45
  </term>
36
46
  <term>
@@ -38,6 +48,8 @@
38
48
  <caption>
39
49
  <langstring language="fr">Demande (concession funéraire, changement de prénom, etc.)</langstring>
40
50
  <langstring language="en">Request (funeral concession, change of first name, etc.)</langstring>
51
+ <langstring language="nl">Aanvraag (begrafenisconcessie, naamsverandering, enz.)</langstring>
52
+ <langstring language="de">Antrag (Begräbnis Konzession, Namensänderung, usw.)</langstring>
41
53
  </caption>
42
54
  </term>
43
55
  <term>
@@ -45,6 +57,8 @@
45
57
  <caption>
46
58
  <langstring language="fr">Document d'identité</langstring>
47
59
  <langstring language="en">Identity document</langstring>
60
+ <langstring language="nl">Identiteitsdocument</langstring>
61
+ <langstring language="de">Ausweisdokument</langstring>
48
62
  </caption>
49
63
  </term>
50
64
  <term>
@@ -52,6 +66,8 @@
52
66
  <caption>
53
67
  <langstring language="fr">Extrait de registre</langstring>
54
68
  <langstring language="en">Register extract</langstring>
69
+ <langstring language="nl">Uittreksel uit het register</langstring>
70
+ <langstring language="de">Registerauszug</langstring>
55
71
  </caption>
56
72
  </term>
57
73
  <term>
@@ -59,6 +75,8 @@
59
75
  <caption>
60
76
  <langstring language="fr">Information pratique</langstring>
61
77
  <langstring language="en">Practical information</langstring>
78
+ <langstring language="nl">Praktische informatie</langstring>
79
+ <langstring language="de">Praktische Information</langstring>
62
80
  </caption>
63
81
  </term>
64
82
  <term>
@@ -66,6 +84,8 @@
66
84
  <caption>
67
85
  <langstring language="fr">Inscription</langstring>
68
86
  <langstring language="en">Registration</langstring>
87
+ <langstring language="nl">Inschrijving</langstring>
88
+ <langstring language="de">Anmeldung</langstring>
69
89
  </caption>
70
90
  </term>
71
91
  <term>
@@ -73,6 +93,8 @@
73
93
  <caption>
74
94
  <langstring language="fr">Permis</langstring>
75
95
  <langstring language="en">License</langstring>
96
+ <langstring language="nl">Vergunning</langstring>
97
+ <langstring language="de">Erlaubnis</langstring>
76
98
  </caption>
77
99
  </term>
78
100
  <term>
@@ -80,6 +102,8 @@
80
102
  <caption>
81
103
  <langstring language="fr">Plainte et réclamation</langstring>
82
104
  <langstring language="en">Complaint</langstring>
105
+ <langstring language="nl">Klacht</langstring>
106
+ <langstring language="de">Beschwerde</langstring>
83
107
  </caption>
84
108
  </term>
85
109
  <term>
@@ -87,6 +111,8 @@
87
111
  <caption>
88
112
  <langstring language="fr">Prime et aide</langstring>
89
113
  <langstring language="en">Bonus and aid</langstring>
114
+ <langstring language="nl">Premie en hulp</langstring>
115
+ <langstring language="de">Prämie und Hilfe</langstring>
90
116
  </caption>
91
117
  </term>
92
118
  </vdex>
@@ -32,6 +32,7 @@
32
32
  <element value="plone.locking"/>
33
33
  <element value="plone.leadimage"/>
34
34
  <element value="plone.imagecropping"/>
35
+ <element value="imio.smartweb.category_display"/>
35
36
  <element value="imio.smartweb.orientation"/>
36
37
  <element value="imio.smartweb.listing"/>
37
38
  <element value="imio.smartweb.topics"/>
@@ -32,6 +32,7 @@
32
32
  <element value="plone.locking"/>
33
33
  <element value="plone.leadimage"/>
34
34
  <element value="plone.imagecropping"/>
35
+ <element value="imio.smartweb.category_display"/>
35
36
  <element value="imio.smartweb.orientation"/>
36
37
  <element value="imio.smartweb.listing"/>
37
38
  <element value="imio.smartweb.topics"/>
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0"?>
2
+ <object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3
+ name="imio.smartweb.Publication"
4
+ meta_type="Dexterity FTI"
5
+ i18n:domain="imio.smartweb">
6
+
7
+ <!-- Basic properties -->
8
+ <property
9
+ i18n:translate=""
10
+ name="title">Publication</property>
11
+ <property
12
+ i18n:translate=""
13
+ name="description">IA.Deliberations : Publication</property>
14
+
15
+ <property name="icon_expr">string:bounding-box-circles</property>
16
+
17
+ <!-- Hierarchy control -->
18
+ <property name="global_allow">False</property>
19
+
20
+ <!-- Schema, class and security -->
21
+ <!-- if we can add a page, we can add a page section -->
22
+ <property name="add_permission">cmf.ManagePortal</property>
23
+ <property name="klass">imio.smartweb.core.contents.Publication</property>
24
+ <property name="schema">imio.smartweb.core.contents.IPublication</property>
25
+
26
+ <!-- Enabled behaviors -->
27
+ <property name="behaviors" purge="false">
28
+ <element value="plone.shortname"/>
29
+ <element value="plone.leadimage"/>
30
+ <element value="solr.fields" />
31
+ </property>
32
+
33
+ <!-- View information -->
34
+ <property name="default_view">view</property>
35
+ <property name="default_view_fallback">False</property>
36
+ <property name="immediate_view">view</property>
37
+
38
+ </object>
@@ -28,6 +28,7 @@
28
28
  <element value="plone.namefromtitle"/>
29
29
  <element value="plone.locking"/>
30
30
  <element value="plone.shortname"/>
31
+ <element value="imio.smartweb.category_display"/>
31
32
  <element value="imio.smartweb.orientation"/>
32
33
  </property>
33
34
 
@@ -19,6 +19,7 @@
19
19
  <property name="filter_content_types">True</property>
20
20
  <property name="allowed_content_types">
21
21
  <element value="File" />
22
+ <element value="imio.smartweb.Publication" />
22
23
  </property>
23
24
  <!-- Schema, class and security -->
24
25
  <!-- if we can add a page, we can add a page section -->
@@ -31,6 +32,7 @@
31
32
  <element value="plone.namefromtitle"/>
32
33
  <element value="plone.locking"/>
33
34
  <element value="plone.shortname"/>
35
+ <element value="imio.smartweb.orientation"/>
34
36
  </property>
35
37
 
36
38
  <!-- View information -->
@@ -28,6 +28,7 @@
28
28
  <element value="plone.namefromtitle"/>
29
29
  <element value="plone.locking"/>
30
30
  <element value="plone.shortname"/>
31
+ <element value="imio.smartweb.category_display"/>
31
32
  <element value="imio.smartweb.orientation"/>
32
33
  </property>
33
34
 
@@ -11,6 +11,7 @@
11
11
  <object meta_type="Dexterity FTI" name="imio.smartweb.Page"/>
12
12
  <object meta_type="Dexterity FTI" name="imio.smartweb.PortalPage"/>
13
13
  <object meta_type="Dexterity FTI" name="imio.smartweb.Procedure"/>
14
+ <object meta_type="Dexterity FTI" name="imio.smartweb.Publication"/>
14
15
  <object meta_type="Dexterity FTI" name="imio.smartweb.SectionCollection"/>
15
16
  <object meta_type="Dexterity FTI" name="imio.smartweb.SectionContact"/>
16
17
  <object meta_type="Dexterity FTI" name="imio.smartweb.SectionEvents"/>
@@ -3,6 +3,38 @@
3
3
  xmlns:i18n="http://xml.zope.org/namespaces/i18n"
4
4
  i18n:domain="imio.smartweb">
5
5
 
6
+ <record name="smartweb.icon.action.delete"
7
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
8
+ <field type="plone.registry.field.TextLine">
9
+ <title i18n:translate="">Action - Delete</title>
10
+ </field>
11
+ <value key="resource">++plone++imio.smartweb.core/icons/action-delete.svg</value>
12
+ </record>
13
+
14
+ <record name="smartweb.icon.action.hiring-2"
15
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
16
+ <field type="plone.registry.field.TextLine">
17
+ <title i18n:translate="">Action - Hiring-2</title>
18
+ </field>
19
+ <value key="resource">++plone++imio.smartweb.core/icons/action-engagement-2.svg</value>
20
+ </record>
21
+
22
+ <record name="smartweb.icon.action.signs"
23
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
24
+ <field type="plone.registry.field.TextLine">
25
+ <title i18n:translate="">Action - Signs</title>
26
+ </field>
27
+ <value key="resource">++plone++imio.smartweb.core/icons/action-panneaux.svg</value>
28
+ </record>
29
+
30
+ <record name="smartweb.icon.action.vote"
31
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
32
+ <field type="plone.registry.field.TextLine">
33
+ <title i18n:translate="">Action - Vote</title>
34
+ </field>
35
+ <value key="resource">++plone++imio.smartweb.core/icons/action-vote.svg</value>
36
+ </record>
37
+
6
38
  <record name="smartweb.icon.action.eguichet"
7
39
  interface="imio.smartweb.core.interfaces.ISmartwebIcon">
8
40
  <field type="plone.registry.field.TextLine">
@@ -91,6 +123,54 @@
91
123
  <value key="resource">++plone++imio.smartweb.core/icons/categorie-cinema.svg</value>
92
124
  </record>
93
125
 
126
+ <record name="smartweb.icon.category.attention"
127
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
128
+ <field type="plone.registry.field.TextLine">
129
+ <title i18n:translate="">Category - Attention</title>
130
+ </field>
131
+ <value key="resource">++plone++imio.smartweb.core/icons/categorie-attention.svg</value>
132
+ </record>
133
+
134
+ <record name="smartweb.icon.category.nature"
135
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
136
+ <field type="plone.registry.field.TextLine">
137
+ <title i18n:translate="">Category - Nature</title>
138
+ </field>
139
+ <value key="resource">++plone++imio.smartweb.core/icons/categorie-nature.svg</value>
140
+ </record>
141
+
142
+ <record name="smartweb.icon.category.containerpark"
143
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
144
+ <field type="plone.registry.field.TextLine">
145
+ <title i18n:translate="">Category - Containerpark</title>
146
+ </field>
147
+ <value key="resource">++plone++imio.smartweb.core/icons/categorie-parcs-a-conteneurs.svg</value>
148
+ </record>
149
+
150
+ <record name="smartweb.icon.category.more"
151
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
152
+ <field type="plone.registry.field.TextLine">
153
+ <title i18n:translate="">Category - More</title>
154
+ </field>
155
+ <value key="resource">++plone++imio.smartweb.core/icons/categorie-plus.svg</value>
156
+ </record>
157
+
158
+ <record name="smartweb.icon.category.bonuses-2"
159
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
160
+ <field type="plone.registry.field.TextLine">
161
+ <title i18n:translate="">Category - Bonuses - 2</title>
162
+ </field>
163
+ <value key="resource">++plone++imio.smartweb.core/icons/categorie-primes-2.svg</value>
164
+ </record>
165
+
166
+ <record name="smartweb.icon.category.sport.swim"
167
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
168
+ <field type="plone.registry.field.TextLine">
169
+ <title i18n:translate="">Category - Sport - Swim</title>
170
+ </field>
171
+ <value key="resource">++plone++imio.smartweb.core/icons/categorie-sport-natation.svg</value>
172
+ </record>
173
+
94
174
  <record name="smartweb.icon.category.shop"
95
175
  interface="imio.smartweb.core.interfaces.ISmartwebIcon">
96
176
  <field type="plone.registry.field.TextLine">
@@ -171,6 +251,14 @@
171
251
  <value key="resource">++plone++imio.smartweb.core/icons/categorie-infos-travaux.svg</value>
172
252
  </record>
173
253
 
254
+ <record name="smartweb.icon.category.works-2"
255
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
256
+ <field type="plone.registry.field.TextLine">
257
+ <title i18n:translate="">Category - Works - 2</title>
258
+ </field>
259
+ <value key="resource">++plone++imio.smartweb.core/icons/categorie-infos-travaux-2.svg</value>
260
+ </record>
261
+
174
262
  <record name="smartweb.icon.category.representative"
175
263
  interface="imio.smartweb.core.interfaces.ISmartwebIcon">
176
264
  <field type="plone.registry.field.TextLine">
@@ -259,6 +347,22 @@
259
347
  <value key="resource">++plone++imio.smartweb.core/icons/categorie-tourisme.svg</value>
260
348
  </record>
261
349
 
350
+ <record name="smartweb.icon.organization.school-2"
351
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
352
+ <field type="plone.registry.field.TextLine">
353
+ <title i18n:translate="">Organization - School - 2</title>
354
+ </field>
355
+ <value key="resource">++plone++imio.smartweb.core/icons/organisation-ecole-sac.svg</value>
356
+ </record>
357
+
358
+ <record name="smartweb.icon.organization.boyscout"
359
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
360
+ <field type="plone.registry.field.TextLine">
361
+ <title i18n:translate="">Organization - Boyscout</title>
362
+ </field>
363
+ <value key="resource">++plone++imio.smartweb.core/icons/organisation-scout.svg</value>
364
+ </record>
365
+
262
366
  <record name="smartweb.icon.organization.musicacademy"
263
367
  interface="imio.smartweb.core.interfaces.ISmartwebIcon">
264
368
  <field type="plone.registry.field.TextLine">
@@ -323,6 +427,14 @@
323
427
  <value key="resource">++plone++imio.smartweb.core/icons/organisation-police.svg</value>
324
428
  </record>
325
429
 
430
+ <record name="smartweb.icon.socialnetwork.behance"
431
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
432
+ <field type="plone.registry.field.TextLine">
433
+ <title i18n:translate="">Social network - Behance</title>
434
+ </field>
435
+ <value key="resource">++plone++imio.smartweb.core/icons/reseausocial-behance.svg</value>
436
+ </record>
437
+
326
438
  <record name="smartweb.icon.socialnetwork.facebookthumb"
327
439
  interface="imio.smartweb.core.interfaces.ISmartwebIcon">
328
440
  <field type="plone.registry.field.TextLine">
@@ -347,6 +459,14 @@
347
459
  <value key="resource">++plone++imio.smartweb.core/icons/reseausocial-instagram.svg</value>
348
460
  </record>
349
461
 
462
+ <record name="smartweb.icon.socialnetwork.linkedin"
463
+ interface="imio.smartweb.core.interfaces.ISmartwebIcon">
464
+ <field type="plone.registry.field.TextLine">
465
+ <title i18n:translate="">Social network - Linkedin</title>
466
+ </field>
467
+ <value key="resource">++plone++imio.smartweb.core/icons/reseausocial-linkedin.svg</value>
468
+ </record>
469
+
350
470
  <record name="smartweb.icon.socialnetwork.twitter"
351
471
  interface="imio.smartweb.core.interfaces.ISmartwebIcon">
352
472
  <field type="plone.registry.field.TextLine">
@@ -1,5 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ from imio.smartweb.common.utils import is_log_active
3
4
  from imio.smartweb.core.config import DIRECTORY_URL
4
5
  from imio.smartweb.core.config import EVENTS_URL
5
6
  from imio.smartweb.core.config import NEWS_URL
@@ -12,9 +13,12 @@ from zope.interface import alsoProvides
12
13
  from zope.interface import implementer
13
14
  from zope.publisher.interfaces import IPublishTraverse
14
15
 
16
+ import logging
15
17
  import os
16
18
  import requests
17
19
 
20
+ logger = logging.getLogger("imio.smartweb.core")
21
+
18
22
 
19
23
  @implementer(IPublishTraverse)
20
24
  class BaseRequestForwarder(Service):
@@ -25,6 +29,8 @@ class BaseRequestForwarder(Service):
25
29
  def reply(self):
26
30
  alsoProvides(self.request, IDisableCSRFProtection)
27
31
  url = "/".join(self.traversal_stack)
32
+ if self.request_type == "events":
33
+ url = url.replace("@search", "@events")
28
34
  auth_source_url = f"{self.base_url}/{url}"
29
35
  response = self.forward_request(auth_source_url)
30
36
  response = self.add_smartweb_urls(response)
@@ -36,8 +42,17 @@ class BaseRequestForwarder(Service):
36
42
 
37
43
  def forward_request(self, url):
38
44
  method = self.request.method
39
- token = get_wca_token(self.client_id, self.client_secret)
40
- headers = {"Accept": "application/json", "Authorization": token}
45
+ token = None
46
+ if method == "GET" and self.request.form.get("wcatoken") == "false":
47
+ headers = {"Accept": "application/json"}
48
+ else:
49
+ token = get_wca_token(self.client_id, self.client_secret)
50
+ headers = {"Accept": "application/json", "Authorization": token}
51
+ if is_log_active():
52
+ logger.info("======== Forwarding request to AUTHENTIC SOURCE =========")
53
+ logger.info(f"url to forward : {url} ({method})")
54
+ logger.info(f"token : {token}")
55
+ logger.info(f"headers : {headers}")
41
56
  params = self.request.form
42
57
  if method == "GET":
43
58
  params = self.add_missing_metadatas(params)