imio.smartweb.core 1.2.12__py3-none-any.whl → 1.2.68__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 (361) 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/configure.zcml +41 -1
  4. imio/smartweb/core/browser/controlpanel.py +41 -0
  5. imio/smartweb/core/browser/dashboards/configure.zcml +0 -2
  6. imio/smartweb/core/browser/dashboards/plausible.py +4 -4
  7. imio/smartweb/core/browser/faceted/block_view.pt +4 -4
  8. imio/smartweb/core/browser/faceted/summary_view.pt +4 -4
  9. imio/smartweb/core/browser/forms.py +3 -3
  10. imio/smartweb/core/browser/redirect_to_main_react_view.py +52 -0
  11. imio/smartweb/core/browser/search/search.pt +2 -1
  12. imio/smartweb/core/browser/search/search.py +4 -0
  13. imio/smartweb/core/browser/sitemap.py +148 -0
  14. imio/smartweb/core/browser/static/icons/action-delete.svg +3 -0
  15. imio/smartweb/core/browser/static/icons/action-e-guichet.svg +1 -1
  16. imio/smartweb/core/browser/static/icons/action-email.svg +1 -1
  17. imio/smartweb/core/browser/static/icons/action-engagement-2.svg +4 -0
  18. imio/smartweb/core/browser/static/icons/action-engagement.svg +1 -1
  19. imio/smartweb/core/browser/static/icons/action-nous-contacter.svg +1 -1
  20. imio/smartweb/core/browser/static/icons/action-nous-rejoindre.svg +2 -1
  21. imio/smartweb/core/browser/static/icons/action-organiser-un-evenement.svg +1 -1
  22. imio/smartweb/core/browser/static/icons/action-panneaux.svg +3 -0
  23. imio/smartweb/core/browser/static/icons/action-signaler-un-probleme.svg +1 -1
  24. imio/smartweb/core/browser/static/icons/action-voir-plan.svg +1 -1
  25. imio/smartweb/core/browser/static/icons/action-vote.svg +3 -0
  26. imio/smartweb/core/browser/static/icons/categorie-associations.svg +1 -1
  27. imio/smartweb/core/browser/static/icons/categorie-attention.svg +3 -0
  28. imio/smartweb/core/browser/static/icons/categorie-avis-et-enquetes.svg +1 -1
  29. imio/smartweb/core/browser/static/icons/categorie-cinema.svg +1 -1
  30. imio/smartweb/core/browser/static/icons/categorie-commerce.svg +1 -1
  31. imio/smartweb/core/browser/static/icons/categorie-concert.svg +1 -1
  32. imio/smartweb/core/browser/static/icons/categorie-culture.svg +1 -1
  33. imio/smartweb/core/browser/static/icons/categorie-demarches.svg +1 -1
  34. imio/smartweb/core/browser/static/icons/categorie-enfance.svg +1 -1
  35. imio/smartweb/core/browser/static/icons/categorie-enseignement.svg +1 -1
  36. imio/smartweb/core/browser/static/icons/categorie-environnement-gestion-des-dechets.svg +1 -1
  37. imio/smartweb/core/browser/static/icons/categorie-exposition.svg +1 -1
  38. imio/smartweb/core/browser/static/icons/categorie-horaires.svg +1 -1
  39. imio/smartweb/core/browser/static/icons/categorie-infos-travaux-2.svg +4 -0
  40. imio/smartweb/core/browser/static/icons/categorie-infos-travaux.svg +1 -1
  41. imio/smartweb/core/browser/static/icons/categorie-mandataires.svg +1 -1
  42. imio/smartweb/core/browser/static/icons/categorie-mobilite.svg +1 -1
  43. imio/smartweb/core/browser/static/icons/categorie-mon-dossier.svg +1 -1
  44. imio/smartweb/core/browser/static/icons/categorie-nature.svg +3 -0
  45. imio/smartweb/core/browser/static/icons/categorie-parc-de-stationnement.svg +1 -1
  46. imio/smartweb/core/browser/static/icons/categorie-parcs-a-conteneurs.svg +4 -0
  47. imio/smartweb/core/browser/static/icons/categorie-parcs-et-jardins.svg +1 -1
  48. imio/smartweb/core/browser/static/icons/categorie-plus.svg +3 -0
  49. imio/smartweb/core/browser/static/icons/categorie-primes-2.svg +5 -0
  50. imio/smartweb/core/browser/static/icons/categorie-primes.svg +1 -1
  51. imio/smartweb/core/browser/static/icons/categorie-sport-courir.svg +1 -1
  52. imio/smartweb/core/browser/static/icons/categorie-sport-natation.svg +4 -0
  53. imio/smartweb/core/browser/static/icons/categorie-sport-velo.svg +1 -1
  54. imio/smartweb/core/browser/static/icons/categorie-tourisme.svg +1 -1
  55. imio/smartweb/core/browser/static/icons/organisation-academie-musique.svg +1 -1
  56. imio/smartweb/core/browser/static/icons/organisation-centre-sportif.svg +1 -1
  57. imio/smartweb/core/browser/static/icons/organisation-cpas.svg +1 -1
  58. imio/smartweb/core/browser/static/icons/organisation-ecole-des-arts.svg +1 -1
  59. imio/smartweb/core/browser/static/icons/organisation-ecole-sac.svg +4 -0
  60. imio/smartweb/core/browser/static/icons/organisation-ecole.svg +1 -1
  61. imio/smartweb/core/browser/static/icons/organisation-mobilite.svg +1 -1
  62. imio/smartweb/core/browser/static/icons/organisation-scout.svg +3 -0
  63. imio/smartweb/core/browser/static/icons/reseausocial-behance.svg +3 -0
  64. imio/smartweb/core/browser/static/icons/reseausocial-facebook.svg +1 -1
  65. imio/smartweb/core/browser/static/icons/reseausocial-linkedin.svg +3 -0
  66. imio/smartweb/core/browser/static/icons/reseausocial-twitter.svg +3 -13
  67. imio/smartweb/core/browser/static/icons/reseausocial-vimeo.svg +1 -1
  68. imio/smartweb/core/browser/static/icons/reseausocial-youtube.svg +1 -1
  69. imio/smartweb/core/browser/static/icons/vue-actualites.svg +1 -1
  70. imio/smartweb/core/browser/static/icons/vue-agenda.svg +1 -1
  71. imio/smartweb/core/browser/static/icons/vue-annuaire.svg +1 -1
  72. imio/smartweb/core/browser/static/smartweb-edit-compiled.css +1 -1
  73. imio/smartweb/core/browser/static/smartweb-edit-compiled.js +1 -1
  74. imio/smartweb/core/browser/static/smartweb-view-compiled.css +1 -1
  75. imio/smartweb/core/browser/static/smartweb-view-compiled.js +1 -1
  76. imio/smartweb/core/browser/static/src/edit.js +5 -0
  77. imio/smartweb/core/browser/static/src/edit.less +42 -0
  78. imio/smartweb/core/browser/static/src/view.js +11 -0
  79. imio/smartweb/core/browser/static/src/view.less +4 -0
  80. imio/smartweb/core/browser/utils.py +5 -32
  81. imio/smartweb/core/browser/vocabulary.py +40 -0
  82. imio/smartweb/core/contents/__init__.py +4 -0
  83. imio/smartweb/core/contents/configure.zcml +1 -0
  84. imio/smartweb/core/contents/cropping.py +1 -1
  85. imio/smartweb/core/contents/folder/block_view.pt +8 -8
  86. imio/smartweb/core/contents/folder/summary_view.pt +4 -4
  87. imio/smartweb/core/contents/pages/cirkwi/content.py +5 -0
  88. imio/smartweb/core/contents/pages/cirkwi/view.py +2 -1
  89. imio/smartweb/core/contents/pages/portal_page/view.py +3 -0
  90. imio/smartweb/core/contents/pages/views.py +3 -1
  91. imio/smartweb/core/contents/publication/configure.zcml +5 -0
  92. imio/smartweb/core/contents/publication/content.py +23 -0
  93. imio/smartweb/core/contents/rest/base.py +24 -10
  94. imio/smartweb/core/contents/rest/configure.zcml +7 -0
  95. imio/smartweb/core/contents/rest/directory/content.py +2 -2
  96. imio/smartweb/core/contents/rest/directory/endpoint.py +2 -2
  97. imio/smartweb/core/contents/rest/directory/view.pt +3 -1
  98. imio/smartweb/core/contents/rest/directory/view.py +3 -0
  99. imio/smartweb/core/contents/rest/events/content.py +15 -2
  100. imio/smartweb/core/contents/rest/events/endpoint.py +5 -7
  101. imio/smartweb/core/contents/rest/events/view.pt +6 -1
  102. imio/smartweb/core/contents/rest/events/view.py +15 -0
  103. imio/smartweb/core/contents/rest/news/content.py +8 -2
  104. imio/smartweb/core/contents/rest/news/endpoint.py +4 -2
  105. imio/smartweb/core/contents/rest/news/view.pt +5 -1
  106. imio/smartweb/core/contents/rest/news/view.py +11 -0
  107. imio/smartweb/core/contents/rest/search/endpoint.py +4 -4
  108. imio/smartweb/core/contents/rest/traversal.py +18 -0
  109. imio/smartweb/core/contents/rest/utils.py +98 -0
  110. imio/smartweb/core/contents/rest/view.py +11 -0
  111. imio/smartweb/core/contents/sections/common_templates/carousel.pt +6 -2
  112. imio/smartweb/core/contents/sections/common_templates/table.pt +22 -8
  113. imio/smartweb/core/contents/sections/configure.zcml +18 -0
  114. imio/smartweb/core/contents/sections/contact/content.py +2 -2
  115. imio/smartweb/core/contents/sections/contact/utils.py +2 -154
  116. imio/smartweb/core/contents/sections/events/content.py +12 -4
  117. imio/smartweb/core/contents/sections/events/view.py +20 -2
  118. imio/smartweb/core/contents/sections/external_content/configure.zcml +29 -0
  119. imio/smartweb/core/contents/sections/external_content/view.pt +25 -7
  120. imio/smartweb/core/contents/sections/external_content/view_idelux_waste.pt +50 -0
  121. imio/smartweb/core/contents/sections/external_content/view_inbw_containers_affluence.pt +91 -0
  122. imio/smartweb/core/contents/sections/external_content/view_odwb_widget.pt +20 -0
  123. imio/smartweb/core/contents/sections/external_content/views.py +306 -125
  124. imio/smartweb/core/contents/sections/files/content.py +7 -1
  125. imio/smartweb/core/contents/sections/files/view.py +40 -12
  126. imio/smartweb/core/contents/sections/links/view.py +5 -0
  127. imio/smartweb/core/contents/sections/macros.pt +39 -9
  128. imio/smartweb/core/contents/sections/news/content.py +11 -3
  129. imio/smartweb/core/contents/sections/news/view.py +20 -2
  130. imio/smartweb/core/contents/sections/text/view.pt +5 -4
  131. imio/smartweb/core/contents/sections/text/views.py +2 -0
  132. imio/smartweb/core/contents/sections/views.py +81 -4
  133. imio/smartweb/core/interfaces.py +15 -0
  134. imio/smartweb/core/profiles/default/actions.xml +15 -0
  135. imio/smartweb/core/profiles/default/diff_tool.xml +8 -0
  136. imio/smartweb/core/profiles/default/metadata.xml +1 -1
  137. imio/smartweb/core/profiles/default/registry/plone.xml +21 -4
  138. imio/smartweb/core/profiles/default/repositorytool.xml +1 -0
  139. imio/smartweb/core/profiles/default/taxonomies/page_category.xml +16 -0
  140. imio/smartweb/core/profiles/default/taxonomies/procedure_category.xml +26 -0
  141. imio/smartweb/core/profiles/default/types/Collection.xml +13 -0
  142. imio/smartweb/core/profiles/default/types/File.xml +13 -0
  143. imio/smartweb/core/profiles/default/types/Image.xml +13 -0
  144. imio/smartweb/core/profiles/default/types/imio.smartweb.BlockLink.xml +5 -0
  145. imio/smartweb/core/profiles/default/types/imio.smartweb.CirkwiView.xml +1 -0
  146. imio/smartweb/core/profiles/default/types/imio.smartweb.DirectoryView.xml +1 -0
  147. imio/smartweb/core/profiles/default/types/imio.smartweb.EventsView.xml +2 -0
  148. imio/smartweb/core/profiles/default/types/imio.smartweb.Folder.xml +1 -0
  149. imio/smartweb/core/profiles/default/types/imio.smartweb.NewsView.xml +2 -0
  150. imio/smartweb/core/profiles/default/types/imio.smartweb.Page.xml +1 -0
  151. imio/smartweb/core/profiles/default/types/imio.smartweb.PortalPage.xml +1 -0
  152. imio/smartweb/core/profiles/default/types/imio.smartweb.Procedure.xml +1 -0
  153. imio/smartweb/core/profiles/default/types/imio.smartweb.Publication.xml +38 -0
  154. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionEvents.xml +1 -0
  155. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionFiles.xml +2 -0
  156. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionHTML.xml +0 -1
  157. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionNews.xml +1 -0
  158. imio/smartweb/core/profiles/default/types.xml +1 -0
  159. imio/smartweb/core/profiles/icons/basic/registry.xml +120 -0
  160. imio/smartweb/core/profiles/testing/types/imio.smartweb.DirectoryView.xml +11 -0
  161. imio/smartweb/core/profiles/testing/types/imio.smartweb.EventsView.xml +11 -0
  162. imio/smartweb/core/profiles/testing/types/imio.smartweb.NewsView.xml +11 -0
  163. imio/smartweb/core/profiles/validation/contentrules.xml +102 -0
  164. imio/smartweb/core/profiles.zcml +8 -0
  165. imio/smartweb/core/rest/authentic_sources.py +23 -11
  166. imio/smartweb/core/subscribers.py +24 -0
  167. imio/smartweb/core/subscribers.zcml +4 -0
  168. imio/smartweb/core/tests/resources/json_iadeliberations_institutions.json +60 -0
  169. imio/smartweb/core/tests/resources/json_iadeliberations_publication.json +105 -0
  170. imio/smartweb/core/tests/resources/json_iadeliberations_publications.json +270 -0
  171. imio/smartweb/core/tests/resources/json_rest_events.json +6 -2
  172. imio/smartweb/core/tests/resources/json_rest_news.json +2 -2
  173. imio/smartweb/core/tests/resources/json_rest_specific_events.json +1 -1
  174. imio/smartweb/core/tests/test_cropping.py +4 -4
  175. imio/smartweb/core/tests/test_htmx_in_sections.py +131 -0
  176. imio/smartweb/core/tests/test_iadeliberations.py +136 -0
  177. imio/smartweb/core/tests/test_icons.py +1 -1
  178. imio/smartweb/core/tests/test_redirect_to_main_react_view.py +79 -0
  179. imio/smartweb/core/tests/test_rest.py +283 -22
  180. imio/smartweb/core/tests/test_section_contact.py +2 -2
  181. imio/smartweb/core/tests/test_section_events.py +28 -5
  182. imio/smartweb/core/tests/test_section_external_content.py +26 -25
  183. imio/smartweb/core/tests/test_section_news.py +30 -8
  184. imio/smartweb/core/tests/test_sections.py +38 -15
  185. imio/smartweb/core/tests/test_sitemap.py +174 -0
  186. imio/smartweb/core/tests/test_vocabularies.py +61 -4
  187. imio/smartweb/core/tests/test_vocabulary.py +43 -0
  188. imio/smartweb/core/tests/utils.py +15 -0
  189. imio/smartweb/core/upgrades/configure.zcml +180 -0
  190. imio/smartweb/core/upgrades/profiles/1051_to_1052/actions.xml +20 -0
  191. imio/smartweb/core/upgrades/profiles/1052_to_1053/diff_tool.xml +8 -0
  192. imio/smartweb/core/upgrades/profiles/1052_to_1053/repositorytool.xml +9 -0
  193. imio/smartweb/core/upgrades/profiles/1052_to_1053/types/imio.smartweb.SectionHTML.xml +14 -0
  194. imio/smartweb/core/upgrades/profiles/1053_to_1054/registry.xml +39 -0
  195. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/Collection.xml +13 -0
  196. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/File.xml +13 -0
  197. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/Image.xml +13 -0
  198. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.BlockLink.xml +12 -0
  199. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.CirkwiView.xml +12 -0
  200. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.DirectoryView.xml +12 -0
  201. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.EventsView.xml +12 -0
  202. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Folder.xml +12 -0
  203. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.NewsView.xml +12 -0
  204. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Page.xml +12 -0
  205. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.PortalPage.xml +12 -0
  206. imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Procedure.xml +12 -0
  207. imio/smartweb/core/upgrades/profiles/1055_to_1056/types/imio.smartweb.SectionFiles.xml +12 -0
  208. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.EventsView.xml +11 -0
  209. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.NewsView.xml +11 -0
  210. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionEvents.xml +11 -0
  211. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionNews.xml +11 -0
  212. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/page_category.cfg +9 -0
  213. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/page_category.xml +73 -0
  214. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/procedure_category.cfg +9 -0
  215. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/procedure_category.xml +118 -0
  216. imio/smartweb/core/upgrades/profiles/1058_to_1059/registry/linkedin-icon.xml +126 -0
  217. imio/smartweb/core/upgrades/profiles/1059_to_1060/registry/iadeliberation.xml +9 -0
  218. imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.Publication.xml +38 -0
  219. imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.SectionFiles.xml +11 -0
  220. imio/smartweb/core/upgrades/profiles/1060_to_1061/types.xml +4 -0
  221. imio/smartweb/core/upgrades/profiles/1060_to_1061/workflows.xml +6 -0
  222. imio/smartweb/core/utils.py +65 -3
  223. imio/smartweb/core/viewlets/configure.zcml +43 -0
  224. imio/smartweb/core/viewlets/external_content.py +13 -5
  225. imio/smartweb/core/viewlets/footer.pt +5 -0
  226. imio/smartweb/core/viewlets/footer.py +5 -0
  227. imio/smartweb/core/viewlets/htmx.py +15 -0
  228. imio/smartweb/core/viewlets/htmx_js_header.pt +59 -0
  229. imio/smartweb/core/viewlets/httpheaders.py +13 -0
  230. imio/smartweb/core/viewlets/odwb_widget_header.pt +19 -0
  231. imio/smartweb/core/viewlets/offcanvas.pt +2 -1
  232. imio/smartweb/core/viewlets/ogp_tag_header.pt +19 -0
  233. imio/smartweb/core/viewlets/ogptags.py +144 -0
  234. imio/smartweb/core/viewlets/social.py +23 -0
  235. imio/smartweb/core/vocabularies.py +66 -2
  236. imio/smartweb/core/vocabularies.zcml +18 -0
  237. imio/smartweb/core/webcomponents/build/1c1605a5fe9a2b10a88f.png +1 -0
  238. imio/smartweb/core/webcomponents/build/524db40e119aa11f4478.png +1 -0
  239. imio/smartweb/core/webcomponents/build/57d3b7cb1ab874660b39.svg +1 -0
  240. imio/smartweb/core/webcomponents/build/6cf03871df23ed2ee8b3.png +1 -0
  241. imio/smartweb/core/webcomponents/build/css/373.smartweb-webcomponents-compiled.css +1 -0
  242. imio/smartweb/core/webcomponents/build/css/486.smartweb-webcomponents-compiled.css +1 -0
  243. imio/smartweb/core/webcomponents/build/css/884.smartweb-webcomponents-compiled.css +1 -0
  244. imio/smartweb/core/webcomponents/build/css/919.smartweb-webcomponents-compiled.css +1 -0
  245. imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
  246. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +2 -0
  247. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js.LICENSE.txt +16 -0
  248. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +2 -0
  249. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js.LICENSE.txt +10 -0
  250. imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -0
  251. imio/smartweb/core/webcomponents/build/js/499.smartweb-webcomponents-compiled.js +2 -0
  252. imio/smartweb/core/webcomponents/build/js/{212.smartweb-webcomponents-compiled.js.LICENSE.txt → 499.smartweb-webcomponents-compiled.js.LICENSE.txt} +1 -8
  253. imio/smartweb/core/webcomponents/build/js/799.smartweb-webcomponents-compiled.js +2 -0
  254. imio/smartweb/core/webcomponents/build/js/824.smartweb-webcomponents-compiled.js +2 -0
  255. imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js +2 -0
  256. imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js.LICENSE.txt +32 -0
  257. imio/smartweb/core/webcomponents/build/js/884.smartweb-webcomponents-compiled.js +1 -0
  258. imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -0
  259. imio/smartweb/core/webcomponents/build/js/963.smartweb-webcomponents-compiled.js +2 -0
  260. imio/smartweb/core/webcomponents/build/js/963.smartweb-webcomponents-compiled.js.LICENSE.txt +3 -0
  261. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
  262. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js.LICENSE.txt +11 -14
  263. imio/smartweb/core/webcomponents/package.json +46 -44
  264. imio/smartweb/core/webcomponents/src/assets/contentIcon/download.svg +1 -0
  265. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.jsx +160 -92
  266. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.scss +250 -157
  267. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactCard/ContactCard.jsx +113 -81
  268. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +394 -188
  269. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactList/ContactList.jsx +26 -9
  270. imio/smartweb/core/webcomponents/src/components/Annuaire/Filters/Filter.jsx +213 -100
  271. imio/smartweb/core/webcomponents/src/components/Annuaire/index.js +1 -1
  272. imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +86 -0
  273. imio/smartweb/core/webcomponents/src/components/Events/EventContent/EventContent.jsx +615 -0
  274. imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +67 -0
  275. imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +181 -103
  276. imio/smartweb/core/webcomponents/src/components/Events/Events.scss +316 -182
  277. imio/smartweb/core/webcomponents/src/components/Events/Filters/Filter.jsx +275 -80
  278. imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.jsx +136 -0
  279. imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.scss +104 -0
  280. imio/smartweb/core/webcomponents/src/components/Filters/IamData.jsx +42 -0
  281. imio/smartweb/core/webcomponents/src/components/Filters/MainFilter.scss +227 -0
  282. imio/smartweb/core/webcomponents/src/components/Filters/PublicTargetData.jsx +94 -0
  283. imio/smartweb/core/webcomponents/src/components/Filters/SelectStyles.js +58 -0
  284. imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.jsx +149 -0
  285. imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.scss +70 -0
  286. imio/smartweb/core/webcomponents/src/components/News/Filters/Filter.jsx +139 -83
  287. imio/smartweb/core/webcomponents/src/components/News/News.jsx +141 -74
  288. imio/smartweb/core/webcomponents/src/components/News/News.scss +41 -15
  289. imio/smartweb/core/webcomponents/src/components/News/NewsCard/NewsCard.jsx +96 -0
  290. imio/smartweb/core/webcomponents/src/components/News/NewsContent/NewsContent.jsx +309 -0
  291. imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +76 -0
  292. imio/smartweb/core/webcomponents/src/components/Search/ContactResult/ContactResult.jsx +28 -14
  293. imio/smartweb/core/webcomponents/src/components/Search/EventsResult/EventsResult.jsx +28 -14
  294. imio/smartweb/core/webcomponents/src/components/Search/Filters/Filter.jsx +51 -32
  295. imio/smartweb/core/webcomponents/src/components/Search/NewsResult/NewsResult.jsx +29 -15
  296. imio/smartweb/core/webcomponents/src/components/Search/Search.jsx +18 -13
  297. imio/smartweb/core/webcomponents/src/components/Search/Search.scss +125 -105
  298. imio/smartweb/core/webcomponents/src/components/Search/WebResult/WebResult.jsx +19 -6
  299. imio/smartweb/core/webcomponents/src/components/Search/index.js +1 -1
  300. imio/smartweb/core/webcomponents/src/hooks/ScrollContext.jsx +3 -0
  301. imio/smartweb/core/webcomponents/src/hooks/useAxios.js +3 -6
  302. imio/smartweb/core/webcomponents/src/hooks/useFilterQuery.js +1 -2
  303. imio/smartweb/core/webcomponents/src/index.scss +246 -211
  304. imio/smartweb/core/webcomponents/src/utils/Map.jsx +159 -0
  305. imio/smartweb/core/webcomponents/src/{components/Annuaire/ContactMap/ContactMap.scss → utils/Map.scss} +2 -2
  306. imio/smartweb/core/webcomponents/src/utils/translation.js +283 -14
  307. imio.smartweb.core-1.2.68-py3.11-nspkg.pth +2 -0
  308. {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/METADATA +548 -3
  309. {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/RECORD +317 -240
  310. {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/WHEEL +1 -1
  311. imio/smartweb/core/webcomponents/build/assets/location-bla.1423bcce16ddcb21141430cac1428dc1.svg +0 -1
  312. imio/smartweb/core/webcomponents/build/assets/next-react-white.819cb069ac8eec300a9db6a7707712d6.svg +0 -1
  313. imio/smartweb/core/webcomponents/build/assets/next-react.17bc43ff4a6a86f4520f5782f6a89a72.svg +0 -1
  314. imio/smartweb/core/webcomponents/build/assets/search.57bdbf5b191499cd77514097d1c4972c.svg +0 -1
  315. imio/smartweb/core/webcomponents/build/css/267.smartweb-webcomponents-compiled.css +0 -1
  316. imio/smartweb/core/webcomponents/build/css/323.smartweb-webcomponents-compiled.css +0 -1
  317. imio/smartweb/core/webcomponents/build/css/552.smartweb-webcomponents-compiled.css +0 -1
  318. imio/smartweb/core/webcomponents/build/css/779.smartweb-webcomponents-compiled.css +0 -1
  319. imio/smartweb/core/webcomponents/build/js/144.smartweb-webcomponents-compiled.js +0 -2
  320. imio/smartweb/core/webcomponents/build/js/212.smartweb-webcomponents-compiled.js +0 -2
  321. imio/smartweb/core/webcomponents/build/js/267.smartweb-webcomponents-compiled.js +0 -1
  322. imio/smartweb/core/webcomponents/build/js/323.smartweb-webcomponents-compiled.js +0 -2
  323. imio/smartweb/core/webcomponents/build/js/323.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -1
  324. imio/smartweb/core/webcomponents/build/js/552.smartweb-webcomponents-compiled.js +0 -2
  325. imio/smartweb/core/webcomponents/build/js/552.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -1
  326. imio/smartweb/core/webcomponents/build/js/565.smartweb-webcomponents-compiled.js +0 -1
  327. imio/smartweb/core/webcomponents/build/js/612.smartweb-webcomponents-compiled.js +0 -2
  328. imio/smartweb/core/webcomponents/build/js/612.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -1
  329. imio/smartweb/core/webcomponents/build/js/779.smartweb-webcomponents-compiled.js +0 -1
  330. imio/smartweb/core/webcomponents/build/js/9.smartweb-webcomponents-compiled.js +0 -2
  331. imio/smartweb/core/webcomponents/build/js/969.smartweb-webcomponents-compiled.js +0 -2
  332. imio/smartweb/core/webcomponents/build/js/969.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -642
  333. imio/smartweb/core/webcomponents/pnpm-lock.yaml +0 -7066
  334. imio/smartweb/core/webcomponents/src/assets/facebook-news.svg +0 -1
  335. imio/smartweb/core/webcomponents/src/assets/location-bla.svg +0 -1
  336. imio/smartweb/core/webcomponents/src/assets/next-react.svg +0 -1
  337. imio/smartweb/core/webcomponents/src/assets/search.svg +0 -1
  338. imio/smartweb/core/webcomponents/src/assets/skeleton.svg +0 -1
  339. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactMap/ContactMap.jsx +0 -156
  340. imio/smartweb/core/webcomponents/src/components/Annuaire/Skeleton/LoaderCss.jsx +0 -7
  341. imio/smartweb/core/webcomponents/src/components/Annuaire/Skeleton/Skeleton.jsx +0 -20
  342. imio/smartweb/core/webcomponents/src/components/Events/ContactCard/ContactCard.jsx +0 -49
  343. imio/smartweb/core/webcomponents/src/components/Events/ContactContent/ContactContent.jsx +0 -400
  344. imio/smartweb/core/webcomponents/src/components/Events/ContactList/ContactList.jsx +0 -42
  345. imio/smartweb/core/webcomponents/src/components/Events/ContactMap/ContactMap.jsx +0 -156
  346. imio/smartweb/core/webcomponents/src/components/Events/Skeleton/Skeleton.jsx +0 -20
  347. imio/smartweb/core/webcomponents/src/components/News/ContactCard/ContactCard.jsx +0 -78
  348. imio/smartweb/core/webcomponents/src/components/News/ContactContent/ContactContent.jsx +0 -261
  349. imio/smartweb/core/webcomponents/src/components/News/ContactList/ContactList.jsx +0 -37
  350. imio/smartweb/core/webcomponents/src/components/News/ContactMap/ContactMap.jsx +0 -127
  351. imio/smartweb/core/webcomponents/src/components/News/ContactMap/ContactMap.scss +0 -4
  352. imio/smartweb/core/webcomponents/src/components/News/Skeleton/Skeleton.jsx +0 -20
  353. imio/smartweb/core/webcomponents/src/components/Search/Skeleton/Skeleton.jsx +0 -20
  354. imio.smartweb.core-1.2.12-py3.10-nspkg.pth +0 -3
  355. /imio/smartweb/core/{webcomponents/src/components/Events/ContactMap/ContactMap.scss → contents/publication/__init__.py} +0 -0
  356. /imio/smartweb/core/webcomponents/build/js/{144.smartweb-webcomponents-compiled.js.LICENSE.txt → 799.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  357. /imio/smartweb/core/webcomponents/build/js/{9.smartweb-webcomponents-compiled.js.LICENSE.txt → 824.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  358. {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/LICENSE.GPL +0 -0
  359. {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/LICENSE.rst +0 -0
  360. {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/namespace_packages.txt +0 -0
  361. {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/top_level.txt +0 -0
@@ -53,7 +53,7 @@ class TestSectionNews(ImioSmartwebTestCase):
53
53
  self.assertIn("My news", view())
54
54
  news_view = queryMultiAdapter((self.news, self.request), name="carousel_view")
55
55
  self.assertEqual(news_view.items, [])
56
- url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
56
+ url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=container_uid&metadata_fields=category_title&metadata_fields=local_category&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
57
57
  m.get(url, text=json.dumps(self.json_news))
58
58
  self.assertEqual(news_view.items[0][0].get("title"), "Première actualité")
59
59
  self.assertEqual(len(news_view.items[0]), 3)
@@ -62,7 +62,7 @@ class TestSectionNews(ImioSmartwebTestCase):
62
62
  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
63
63
  "bfe2b4391a0f4a8db6d8b7fed63d1c4a",
64
64
  ]
65
- url = "http://localhost:8080/Plone/@search?UID=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&UID=bfe2b4391a0f4a8db6d8b7fed63d1c4a&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1"
65
+ url = "http://localhost:8080/Plone/@search?UID=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&UID=bfe2b4391a0f4a8db6d8b7fed63d1c4a&portal_type=imio.news.NewsItem&metadata_fields=container_uid&metadata_fields=category_title&metadata_fields=local_category&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1"
66
66
  m.get(url, text=json.dumps(self.json_specific_news))
67
67
  self.assertEqual(len(news_view.items[0]), 2)
68
68
  self.assertEqual(
@@ -87,7 +87,7 @@ class TestSectionNews(ImioSmartwebTestCase):
87
87
  self.assertIsNone(annotations.get(SECTION_ITEMS_HASH_KEY))
88
88
 
89
89
  news_view = queryMultiAdapter((self.news, self.request), name="carousel_view")
90
- url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
90
+ url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=container_uid&metadata_fields=category_title&metadata_fields=local_category&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
91
91
  m.get(url, text=json.dumps(self.json_news))
92
92
  self.assertEqual(len(news_view.items[0]), 3)
93
93
  hash_1 = annotations.get(SECTION_ITEMS_HASH_KEY)
@@ -95,7 +95,7 @@ class TestSectionNews(ImioSmartwebTestCase):
95
95
  first_modification = self.portalpage.ModificationDate()
96
96
 
97
97
  sleep(1)
98
- url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
98
+ url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=container_uid&metadata_fields=category_title&metadata_fields=local_category&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
99
99
  m.get(url, text="{}")
100
100
  self.assertEqual(len(news_view.items), 0)
101
101
  next_modification = self.portalpage.ModificationDate()
@@ -110,18 +110,40 @@ class TestSectionNews(ImioSmartwebTestCase):
110
110
  self.assertEqual(hash_2, hash_3)
111
111
  self.assertEqual(next_modification, last_modification)
112
112
 
113
+ sleep(1)
114
+ url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=container_uid&metadata_fields=category_title&metadata_fields=local_category&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
115
+ m.get(url, text=None)
116
+ self.assertEqual(len(news_view.items), 0)
117
+ no_modification = self.portalpage.ModificationDate()
118
+ hash_4 = annotations.get(SECTION_ITEMS_HASH_KEY)
119
+ self.assertEqual(hash_3, hash_4)
120
+ self.assertEqual(last_modification, no_modification)
121
+
113
122
  @requests_mock.Mocker()
114
123
  def test_orientation(self, m):
115
124
  intids = getUtility(IIntIds)
116
125
  self.news.related_news = "64f4cbee9a394a018a951f6d94452914"
117
126
  self.news.linking_rest_view = RelationValue(intids.getId(self.rest_news_view))
118
- annotations = IAnnotations(self.news)
119
- self.assertIsNone(annotations.get(SECTION_ITEMS_HASH_KEY))
120
-
121
127
  news_view = queryMultiAdapter((self.news, self.request), name="carousel_view")
122
- url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
128
+ url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=container_uid&metadata_fields=category_title&metadata_fields=local_category&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
123
129
  m.get(url, text=json.dumps(self.json_news))
124
130
 
125
131
  self.assertIn("paysage_vignette", news_view.items[0][0]["image"])
126
132
  self.news.orientation = "portrait"
127
133
  self.assertIn("portrait_vignette", news_view.items[0][0]["image"])
134
+
135
+ @requests_mock.Mocker()
136
+ def test_show_categories_or_topics(self, m):
137
+ intids = getUtility(IIntIds)
138
+ self.news.related_news = "64f4cbee9a394a018a951f6d94452914"
139
+ self.news.linking_rest_view = RelationValue(intids.getId(self.rest_news_view))
140
+ news_view = queryMultiAdapter((self.news, self.request), name="carousel_view")
141
+ url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=container_uid&metadata_fields=category_title&metadata_fields=local_category&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
142
+ m.get(url, text=json.dumps(self.json_news))
143
+ self.assertEqual(news_view.items[0][0]["category"], "Presse")
144
+ self.news.show_categories_or_topics = "category"
145
+ self.assertEqual(news_view.items[0][0]["category"], "Presse")
146
+ self.news.show_categories_or_topics = "topic"
147
+ self.assertEqual(news_view.items[0][0]["category"], "Education")
148
+ self.news.show_categories_or_topics = ""
149
+ self.assertEqual(news_view.items[0][0]["category"], "")
@@ -32,6 +32,12 @@ from zope.lifecycleevent import modified
32
32
  class TestSections(ImioSmartwebTestCase):
33
33
  layer = IMIO_SMARTWEB_CORE_INTEGRATION_TESTING
34
34
 
35
+ def _changeUser(self, loginName):
36
+ logout()
37
+ login(self.portal, loginName)
38
+ self.member = api.user.get_current()
39
+ self.request["AUTHENTICATED_USER"] = self.member
40
+
35
41
  def setUp(self):
36
42
  # Number of sections where there is a title if section is empty.
37
43
  # sectionHTML,...
@@ -125,24 +131,12 @@ class TestSections(ImioSmartwebTestCase):
125
131
  type="imio.smartweb.SectionExternalContent",
126
132
  title="Section External Content",
127
133
  )
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
134
 
140
135
  section.external_content_url = "http://www.perdu.com"
141
136
  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)
137
+ self.assertNotIn("iframe", view.contents)
138
+ self.assertNotIn("class='eaglebe'", view.contents)
139
+ self.assertIn('<p class="unknow_service">Unknow service</p>', view.contents)
146
140
 
147
141
  def test_map_section(self):
148
142
  section = api.content.create(
@@ -557,6 +551,17 @@ class TestSections(ImioSmartwebTestCase):
557
551
  '<a class="table_image" href="http://nohost/plone/page/section-links/my-link" target="_blank">',
558
552
  view(),
559
553
  )
554
+ link.remoteUrl = "http://www.perdu.com"
555
+ view = getMultiAdapter((self.page, self.request), name="full_view")
556
+ self.assertIn("www.perdu.com", view())
557
+ self.assertNotIn(
558
+ 'href="http://nohost/plone/page/section-links/my-link"', view()
559
+ )
560
+ clear_cache(self.request)
561
+ self._changeUser("test")
562
+ view = getMultiAdapter((self.page, self.request), name="full_view")
563
+ self.assertNotIn("www.perdu.com", view())
564
+ self.assertIn('href="http://nohost/plone/page/section-links/my-link"', view())
560
565
 
561
566
  def test_background_style(self):
562
567
  section = api.content.create(
@@ -588,3 +593,21 @@ class TestSections(ImioSmartwebTestCase):
588
593
  self.assertEqual(
589
594
  view.get_class(section), "sectiontext my-css col-sm-3 with-background"
590
595
  )
596
+
597
+ def test_sections_history(self):
598
+ api.content.transition(self.page, "publish")
599
+ section_types = get_sections_types()
600
+ page_view = queryMultiAdapter((self.page, self.request), name="full_view")()
601
+ count_historyview_link = page_view.count("@@historyview")
602
+ self.assertEqual(count_historyview_link, 1)
603
+ for section_type in section_types:
604
+ api.content.create(
605
+ container=self.page,
606
+ type=section_type,
607
+ title="Title of my {}".format(section_type),
608
+ )
609
+ page_view = queryMultiAdapter((self.page, self.request), name="full_view")()
610
+ section_text = api.content.find(portal_type="imio.smartweb.SectionText")[0]
611
+ self.assertIn(f"{section_text.getURL()}/@@historyview", page_view)
612
+ # One more history view link on SectionText
613
+ self.assertEqual(page_view.count("@@historyview"), count_historyview_link + 1)
@@ -0,0 +1,174 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ from freezegun import freeze_time
4
+ from gzip import GzipFile
5
+ from io import BytesIO
6
+ from imio.smartweb.core.testing import IMIO_SMARTWEB_CORE_FUNCTIONAL_TESTING
7
+ from imio.smartweb.core.testing import ImioSmartwebTestCase
8
+ from imio.smartweb.core.tests.utils import get_json
9
+ from imio.smartweb.core.tests.utils import make_named_image
10
+ from plone import api
11
+ from plone.app.testing import setRoles
12
+ from plone.app.testing import TEST_USER_ID
13
+ from plone.app.textfield.value import RichTextValue
14
+ from plone.base.utils import safe_text
15
+ from plone.namedfile.file import NamedBlobImage
16
+ from unittest.mock import patch
17
+ from zope.component import getMultiAdapter
18
+
19
+ import json
20
+ import requests_mock
21
+
22
+
23
+ class TestPage(ImioSmartwebTestCase):
24
+ layer = IMIO_SMARTWEB_CORE_FUNCTIONAL_TESTING
25
+
26
+ @freeze_time("2024-02-02 8:00:00")
27
+ def setUp(self):
28
+ self.request = self.layer["request"]
29
+ self.portal = self.layer["portal"]
30
+ setRoles(self.portal, TEST_USER_ID, ["Manager"])
31
+ api.portal.set_registry_record("plone.enable_sitemap", True)
32
+
33
+ self.default_page = api.content.create(
34
+ container=self.portal,
35
+ type="imio.smartweb.PortalPage",
36
+ title="Portal page",
37
+ id="portal-page",
38
+ )
39
+ self.portal.setDefaultPage("portal-page")
40
+
41
+ self.folder = api.content.create(
42
+ container=self.portal,
43
+ type="imio.smartweb.Folder",
44
+ title="Folder",
45
+ id="folder",
46
+ )
47
+ self.page = api.content.create(
48
+ container=self.folder,
49
+ type="imio.smartweb.Page",
50
+ title="Page 1",
51
+ id="page1",
52
+ )
53
+ self.section_text = api.content.create(
54
+ container=self.page,
55
+ type="imio.smartweb.SectionText",
56
+ title="Section text",
57
+ )
58
+ self.section_text.text = RichTextValue(
59
+ "<p>Kamoulox</p>", "text/html", "text/html"
60
+ )
61
+
62
+ self.rest_directory = api.content.create(
63
+ container=self.portal,
64
+ type="imio.smartweb.DirectoryView",
65
+ title="directory view",
66
+ )
67
+ self.rest_agenda = api.content.create(
68
+ container=self.portal,
69
+ type="imio.smartweb.EventsView",
70
+ title="agenda view",
71
+ )
72
+ self.rest_agenda.selected_agenda = "64f4cbee9a394a018a951f6d94452914"
73
+ self.rest_news = api.content.create(
74
+ container=self.portal,
75
+ type="imio.smartweb.NewsView",
76
+ title="news view",
77
+ )
78
+ self.rest_news.selected_news_folder = "64f4cbee9a394a018a951f6d94452914"
79
+ api.content.transition(self.rest_directory, "publish")
80
+ api.content.transition(self.rest_agenda, "publish")
81
+ api.content.transition(self.rest_news, "publish")
82
+
83
+ # 'http://localhost:8080/Plone/@search?selected_entities=396907b3b1b04a97896b12cc792c77f8&portal_type=imio.directory.Contact&fullobjects=0&sort_on=sortable_title'
84
+ @freeze_time("2024-02-02 10:00:00")
85
+ @requests_mock.Mocker()
86
+ def test_sitemap(self, m):
87
+ sitemap = getMultiAdapter(
88
+ (self.portal, self.portal.REQUEST), name="sitemap.xml.gz"
89
+ )
90
+ xml = self.uncompress(sitemap())
91
+ self.assertIn("<lastmod >2024-02-02T08:00:00", xml)
92
+ self.assertIn("<loc>http://nohost/plone/folder</loc>", xml)
93
+ self.assertIn("http://nohost/plone/folder/page1", xml)
94
+ self.assertNotIn(
95
+ "<loc>http://nohost/plone/folder/page1/gallery/image/view</loc>", xml
96
+ )
97
+
98
+ # Gallery and image created 2024-02-02 10:00:00
99
+ gallery = api.content.create(
100
+ container=self.page,
101
+ type="imio.smartweb.SectionGallery",
102
+ title="Gallery",
103
+ )
104
+ image = api.content.create(
105
+ container=gallery,
106
+ type="Image",
107
+ title="Image",
108
+ )
109
+ image.image = NamedBlobImage(**make_named_image())
110
+ sitemap = getMultiAdapter(
111
+ (self.portal, self.portal.REQUEST), name="sitemap.xml.gz"
112
+ )
113
+ xml = self.uncompress(sitemap())
114
+ self.assertIn(
115
+ "<loc>http://nohost/plone/folder/page1/gallery/image/view</loc>", xml
116
+ )
117
+ # Gallery and image created 2024-02-02 10:00:00
118
+ self.assertIn(
119
+ "<loc>http://nohost/plone/folder/page1/gallery/image/view</loc>\n <lastmod >2024-02-02T10:00:00",
120
+ xml,
121
+ )
122
+
123
+ rest_views = {
124
+ "directory": self.rest_directory,
125
+ "events": self.rest_agenda,
126
+ "news": self.rest_news,
127
+ }
128
+ contact_search_url = news_search_url = events_search_url = (
129
+ "http://localhost:8080/Plone/@querystring-search"
130
+ )
131
+ for k, v in rest_views.items():
132
+ api.portal.set_registry_record(f"smartweb.default_{k}_view", v.UID())
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)
168
+
169
+ def uncompress(self, sitemapdata):
170
+ sio = BytesIO(sitemapdata)
171
+ unzipped = GzipFile(fileobj=sio)
172
+ xml = unzipped.read()
173
+ unzipped.close()
174
+ return safe_text(xml)
@@ -31,7 +31,7 @@ class TestVocabularies(ImioSmartwebTestCase):
31
31
  self.contact_search_url = "http://localhost:8080/Plone/@search?portal_type=imio.directory.Contact&selected_entities=396907b3b1b04a97896b12cc792c77f8&sort_on=breadcrumb&b_size=1000000&metadata_fields=UID&metadata_fields=breadcrumb"
32
32
 
33
33
  def test_icons(self):
34
- self.assertVocabularyLen("imio.smartweb.vocabulary.Icons", 49)
34
+ self.assertVocabularyLen("imio.smartweb.vocabulary.Icons", 64)
35
35
  vocabulary = get_vocabulary("imio.smartweb.vocabulary.Icons")
36
36
  term = vocabulary.getTerm("action.email")
37
37
  self.assertEqual(term.title, "Action - Email")
@@ -81,11 +81,14 @@ class TestVocabularies(ImioSmartwebTestCase):
81
81
  m.get(GUICHET_URL, text=json.dumps(self.json_procedures_raw_mock))
82
82
  self.assertVocabularyLen("imio.smartweb.vocabulary.PublikProcedures", 0)
83
83
 
84
+ def test_categories_display(self):
85
+ self.assertVocabularyLen("imio.smartweb.vocabulary.CategoriesDisplay", 3)
86
+
84
87
  def test_bootstrap_css(self):
85
88
  self.assertVocabularyLen("imio.smartweb.vocabulary.BootstrapCSS", 6)
86
89
 
87
90
  def test_orientation(self):
88
- self.assertVocabularyLen("imio.smartweb.vocabulary.Orientation", 2)
91
+ self.assertVocabularyLen("imio.smartweb.vocabulary.Orientation", 3)
89
92
 
90
93
  def test_subsite_display_mode(self):
91
94
  self.assertVocabularyLen("imio.smartweb.vocabulary.SubsiteDisplayMode", 3)
@@ -262,7 +265,7 @@ class TestVocabularies(ImioSmartwebTestCase):
262
265
  json_agendas_raw_mock = get_json("resources/json_events_agendas_raw_mock.json")
263
266
  url = f"{config.EVENTS_URL}/imio-events-entity/@search?portal_type=imio.events.Agenda&sort_on=sortable_title&b_size=1000000&metadata_fields=UID"
264
267
  m.get(url, text=json.dumps(json_agendas_raw_mock))
265
- url = f"{config.EVENTS_URL}/@search?selected_agendas=64f4cbee9a394a018a951f6d94452914&selected_agendas=96d3e3299dc74386943e12c4f4fd0b8a&portal_type=imio.events.Event&metadata_fields=category&metadata_fields=topics&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=breadcrumb&metadata_fields=UID&event_dates.query=2021-11-15&event_dates.range=min&b_size=1000000"
268
+ url = f"{config.EVENTS_URL}/@search?selected_agendas=64f4cbee9a394a018a951f6d94452914&selected_agendas=96d3e3299dc74386943e12c4f4fd0b8a&portal_type=imio.events.Event&metadata_fields=category_title&metadata_fields=topics&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=breadcrumb&metadata_fields=UID&event_dates.query=2021-11-15&event_dates.range=min&b_size=1000000"
266
269
  json_rest_events = get_json("resources/json_rest_events_with_breadcrumbs.json")
267
270
  m.get(url, text=json.dumps(json_rest_events))
268
271
  vocabulary = get_vocabulary("imio.smartweb.vocabulary.EventsFromEntity")
@@ -281,7 +284,7 @@ class TestVocabularies(ImioSmartwebTestCase):
281
284
  )
282
285
  url = f"{config.NEWS_URL}/imio-news-entity/@search?portal_type=imio.news.NewsFolder&sort_on=sortable_title&b_size=1000000&metadata_fields=UID"
283
286
  m.get(url, text=json.dumps(json_newsfolders_raw_mock))
284
- url = f"{config.NEWS_URL}/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&selected_news_folders=96d3e3299dc74386943e12c4f4fd0b8a&portal_type=imio.news.NewsItem&metadata_fields=category&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=breadcrumb&metadata_fields=UID&b_size=1000000"
287
+ url = f"{config.NEWS_URL}/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&selected_news_folders=96d3e3299dc74386943e12c4f4fd0b8a&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=breadcrumb&metadata_fields=UID&b_size=1000000"
285
288
  json_rest_news = get_json("resources/json_rest_news.json")
286
289
  m.get(url, text=json.dumps(json_rest_news))
287
290
  vocabulary = get_vocabulary("imio.smartweb.vocabulary.NewsItemsFromEntity")
@@ -292,3 +295,57 @@ class TestVocabularies(ImioSmartwebTestCase):
292
295
 
293
296
  def test_sendinblue_button_position(self):
294
297
  self.assertVocabularyLen("imio.smartweb.vocabulary.SendInBlueButtonPosition", 2)
298
+
299
+ @patch("imio.smartweb.core.vocabularies.get_iadeliberation_url_from_registry")
300
+ @requests_mock.Mocker()
301
+ def test_remote_iadeliberations_institutions(self, m_url, m):
302
+ json_institutions_raw_mock = get_json(
303
+ "resources/json_iadeliberations_institutions.json"
304
+ )
305
+ m_url.return_value = "https://conseil.staging.imio.be"
306
+ url_institutions = f"{m_url.return_value}/@search?portal_type=Institution&metadata_fields=UID&sort_on=sortable_title"
307
+ m.get(url_institutions, text=json.dumps(json_institutions_raw_mock))
308
+ self.assertVocabularyLen(
309
+ "imio.smartweb.vocabulary.IADeliberationsInstitutions", 6
310
+ )
311
+ vocabulary = get_vocabulary(
312
+ "imio.smartweb.vocabulary.IADeliberationsInstitutions"
313
+ )
314
+ self.assertEqual(
315
+ vocabulary.getTerm("https://conseil.staging.imio.be/waremme").title,
316
+ "Waremme",
317
+ )
318
+
319
+ @patch(
320
+ "imio.smartweb.core.vocabularies.get_iadeliberation_institution_from_registry"
321
+ )
322
+ @patch("imio.smartweb.core.vocabularies.get_iadeliberation_url_from_registry")
323
+ @requests_mock.Mocker()
324
+ def test_remote_iadeliberations_publications(self, m_url, m_institution, m):
325
+ json_institutions_raw_mock = get_json(
326
+ "resources/json_iadeliberations_institutions.json"
327
+ )
328
+ m_url.return_value = "https://conseil.staging.imio.be"
329
+ m_institution.return_value = "https://conseil.staging.imio.be/liege"
330
+ url_institutions = (
331
+ f"{m_url.return_value}/@search?portal_type=Institution&metadata_fields=UID"
332
+ )
333
+ m.get(url_institutions, text=json.dumps(json_institutions_raw_mock))
334
+ json_publications_raw_mock = get_json(
335
+ "resources/json_iadeliberations_publications.json"
336
+ )
337
+ url_institution = m_institution.return_value
338
+ url_publications = f"{url_institution}/@search?portal_type=Publication&metadata_fields=UID&review_state=published"
339
+ m.get(url_publications, text=json.dumps(json_publications_raw_mock))
340
+ self.assertVocabularyLen(
341
+ "imio.smartweb.vocabulary.IADeliberationsPublications", 22
342
+ )
343
+ vocabulary = get_vocabulary(
344
+ "imio.smartweb.vocabulary.IADeliberationsPublications"
345
+ )
346
+ self.assertEqual(
347
+ vocabulary.getTerm(
348
+ "autorisation-de-deroger-temporairement-aux-normes-de-bruit-fete-de-la-musique-2023"
349
+ ).title,
350
+ "Autorisation de déroger temporairement aux normes de bruit - Fête de la Musique 2023",
351
+ )
@@ -0,0 +1,43 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ from imio.smartweb.core.testing import IMIO_SMARTWEB_CORE_INTEGRATION_TESTING
4
+ from imio.smartweb.core.testing import ImioSmartwebTestCase
5
+ from plone import api
6
+ from plone.app.testing import setRoles
7
+ from plone.app.testing import TEST_USER_ID
8
+ from unittest.mock import patch
9
+ from zope.component import queryMultiAdapter
10
+
11
+ import json
12
+
13
+
14
+ class TestVocabulary(ImioSmartwebTestCase):
15
+ layer = IMIO_SMARTWEB_CORE_INTEGRATION_TESTING
16
+
17
+ def setUp(self):
18
+ """Custom shared utility setup for tests"""
19
+ self.request = self.layer["request"]
20
+ self.portal = self.layer["portal"]
21
+ setRoles(self.portal, TEST_USER_ID, ["Manager"])
22
+ self.page = api.content.create(
23
+ container=self.portal,
24
+ type="imio.smartweb.Page",
25
+ title="My Page",
26
+ )
27
+
28
+ def test_getvocabulary(self):
29
+ self.request.form = {
30
+ "name": "imio.smartweb.vocabulary.Topics",
31
+ "field": "topics",
32
+ }
33
+ view = queryMultiAdapter((self.page, self.request), name="getVocabulary")
34
+ result = json.loads(view())
35
+ self.assertEqual(result["results"][0]["id"], "entertainment")
36
+ self.assertEqual(result["results"][0]["text"], "Entertainment")
37
+ with patch("plone.api.portal.get_current_language", return_value="fr"):
38
+ view = queryMultiAdapter((self.page, self.request), name="getVocabulary")
39
+ result = json.loads(view())
40
+ self.assertEqual(result["results"][0]["id"], "entertainment")
41
+ self.assertEqual(
42
+ result["results"][0]["text"], "Activités et divertissement"
43
+ )
@@ -94,3 +94,18 @@ def make_named_image(filename="plone.png"):
94
94
  with open(path, "rb") as f:
95
95
  image_data = f.read()
96
96
  return {"filename": filename, "data": image_data}
97
+
98
+
99
+ class FakeResponse:
100
+ status_code = 404
101
+ headers = {}
102
+ text = "{}"
103
+
104
+ def __init__(self, status_code=None, headers=None):
105
+ if status_code:
106
+ self.status_code = status_code
107
+ if headers:
108
+ self.headers = headers
109
+
110
+ def json(self):
111
+ return json.loads(self.text)