imio.smartweb.core 1.2.38__py3-none-any.whl → 1.2.80__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 (223) 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-mon-dossier.svg +1 -1
  14. imio/smartweb/core/browser/static/icons/categorie-nature.svg +3 -0
  15. imio/smartweb/core/browser/static/icons/categorie-parcs-a-conteneurs.svg +4 -0
  16. imio/smartweb/core/browser/static/icons/categorie-plus.svg +3 -0
  17. imio/smartweb/core/browser/static/icons/categorie-primes-2.svg +5 -0
  18. imio/smartweb/core/browser/static/icons/categorie-sport-natation.svg +4 -0
  19. imio/smartweb/core/browser/static/icons/organisation-ecole-sac.svg +4 -0
  20. imio/smartweb/core/browser/static/icons/organisation-scout.svg +3 -0
  21. imio/smartweb/core/browser/static/icons/reseausocial-behance.svg +3 -0
  22. imio/smartweb/core/browser/static/icons/reseausocial-linkedin.svg +3 -0
  23. imio/smartweb/core/browser/static/smartweb-edit-compiled.css +1 -1
  24. imio/smartweb/core/browser/static/smartweb-view-compiled.css +1 -1
  25. imio/smartweb/core/browser/static/src/edit.less +42 -0
  26. imio/smartweb/core/browser/static/src/view.less +109 -56
  27. imio/smartweb/core/browser/vocabulary.py +8 -3
  28. imio/smartweb/core/contents/__init__.py +2 -0
  29. imio/smartweb/core/contents/configure.zcml +1 -0
  30. imio/smartweb/core/contents/folder/block_view.pt +8 -8
  31. imio/smartweb/core/contents/folder/summary_view.pt +4 -4
  32. imio/smartweb/core/contents/pages/cirkwi/content.py +5 -0
  33. imio/smartweb/core/contents/pages/cirkwi/view.py +2 -1
  34. imio/smartweb/core/contents/pages/configure.zcml +1 -0
  35. imio/smartweb/core/contents/pages/portal_page/view.py +3 -0
  36. imio/smartweb/core/contents/pages/views.py +47 -1
  37. imio/smartweb/core/contents/publication/__init__.py +0 -0
  38. imio/smartweb/core/contents/publication/configure.zcml +5 -0
  39. imio/smartweb/core/contents/publication/content.py +23 -0
  40. imio/smartweb/core/contents/rest/base.py +9 -7
  41. imio/smartweb/core/contents/rest/directory/endpoint.py +2 -2
  42. imio/smartweb/core/contents/rest/directory/view.pt +2 -1
  43. imio/smartweb/core/contents/rest/events/content.py +13 -0
  44. imio/smartweb/core/contents/rest/events/endpoint.py +5 -3
  45. imio/smartweb/core/contents/rest/events/view.pt +5 -1
  46. imio/smartweb/core/contents/rest/events/view.py +12 -0
  47. imio/smartweb/core/contents/rest/news/content.py +6 -0
  48. imio/smartweb/core/contents/rest/news/endpoint.py +4 -2
  49. imio/smartweb/core/contents/rest/news/view.pt +4 -1
  50. imio/smartweb/core/contents/rest/news/view.py +8 -0
  51. imio/smartweb/core/contents/rest/utils.py +0 -1
  52. imio/smartweb/core/contents/rest/view.py +4 -0
  53. imio/smartweb/core/contents/sections/common_templates/carousel.pt +5 -1
  54. imio/smartweb/core/contents/sections/common_templates/table.pt +18 -4
  55. imio/smartweb/core/contents/sections/configure.zcml +18 -0
  56. imio/smartweb/core/contents/sections/contact/content.py +2 -2
  57. imio/smartweb/core/contents/sections/contact/macros.pt +28 -3
  58. imio/smartweb/core/contents/sections/contact/utils.py +2 -0
  59. imio/smartweb/core/contents/sections/contact/view.py +28 -12
  60. imio/smartweb/core/contents/sections/events/content.py +12 -4
  61. imio/smartweb/core/contents/sections/events/view.py +20 -2
  62. imio/smartweb/core/contents/sections/external_content/view.pt +4 -4
  63. imio/smartweb/core/contents/sections/external_content/views.py +6 -4
  64. imio/smartweb/core/contents/sections/files/content.py +7 -1
  65. imio/smartweb/core/contents/sections/files/view.py +43 -12
  66. imio/smartweb/core/contents/sections/links/view.py +5 -0
  67. imio/smartweb/core/contents/sections/macros.pt +26 -0
  68. imio/smartweb/core/contents/sections/news/content.py +11 -3
  69. imio/smartweb/core/contents/sections/news/view.py +20 -2
  70. imio/smartweb/core/contents/sections/text/views.py +2 -0
  71. imio/smartweb/core/contents/sections/views.py +73 -10
  72. imio/smartweb/core/interfaces.py +4 -0
  73. imio/smartweb/core/profiles/default/metadata.xml +1 -1
  74. imio/smartweb/core/profiles/default/taxonomies/page_category.xml +16 -0
  75. imio/smartweb/core/profiles/default/taxonomies/procedure_category.xml +26 -0
  76. imio/smartweb/core/profiles/default/types/imio.smartweb.EventsView.xml +1 -0
  77. imio/smartweb/core/profiles/default/types/imio.smartweb.NewsView.xml +1 -0
  78. imio/smartweb/core/profiles/default/types/imio.smartweb.Publication.xml +38 -0
  79. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionEvents.xml +1 -0
  80. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionFiles.xml +2 -0
  81. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionNews.xml +1 -0
  82. imio/smartweb/core/profiles/default/types.xml +1 -0
  83. imio/smartweb/core/profiles/icons/basic/registry.xml +120 -0
  84. imio/smartweb/core/rest/authentic_sources.py +17 -2
  85. imio/smartweb/core/subscribers.py +48 -0
  86. imio/smartweb/core/subscribers.zcml +12 -0
  87. imio/smartweb/core/tests/resources/json_iadeliberations_institutions.json +60 -0
  88. imio/smartweb/core/tests/resources/json_iadeliberations_publication.json +105 -0
  89. imio/smartweb/core/tests/resources/json_iadeliberations_publications.json +270 -0
  90. imio/smartweb/core/tests/resources/json_rest_events.json +6 -2
  91. imio/smartweb/core/tests/resources/json_rest_news.json +2 -2
  92. imio/smartweb/core/tests/resources/json_rest_specific_events.json +1 -1
  93. imio/smartweb/core/tests/test_htmx_in_sections.py +131 -0
  94. imio/smartweb/core/tests/test_iadeliberations.py +136 -0
  95. imio/smartweb/core/tests/test_icons.py +1 -1
  96. imio/smartweb/core/tests/test_rest.py +58 -17
  97. imio/smartweb/core/tests/test_section_contact.py +42 -10
  98. imio/smartweb/core/tests/test_section_events.py +28 -5
  99. imio/smartweb/core/tests/test_section_external_content.py +28 -2
  100. imio/smartweb/core/tests/test_section_news.py +30 -8
  101. imio/smartweb/core/tests/test_sections.py +17 -0
  102. imio/smartweb/core/tests/test_vocabularies.py +60 -3
  103. imio/smartweb/core/tests/test_vocabulary.py +43 -0
  104. imio/smartweb/core/upgrades/configure.zcml +108 -0
  105. imio/smartweb/core/upgrades/profiles/1055_to_1056/types/imio.smartweb.SectionFiles.xml +12 -0
  106. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.EventsView.xml +11 -0
  107. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.NewsView.xml +11 -0
  108. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionEvents.xml +11 -0
  109. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionNews.xml +11 -0
  110. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/page_category.cfg +9 -0
  111. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/page_category.xml +73 -0
  112. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/procedure_category.cfg +9 -0
  113. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/procedure_category.xml +118 -0
  114. imio/smartweb/core/upgrades/profiles/1058_to_1059/registry/linkedin-icon.xml +126 -0
  115. imio/smartweb/core/upgrades/profiles/1059_to_1060/registry/iadeliberation.xml +9 -0
  116. imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.Publication.xml +38 -0
  117. imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.SectionFiles.xml +11 -0
  118. imio/smartweb/core/upgrades/profiles/1060_to_1061/types.xml +4 -0
  119. imio/smartweb/core/upgrades/profiles/1060_to_1061/workflows.xml +6 -0
  120. imio/smartweb/core/utils.py +33 -2
  121. imio/smartweb/core/viewlets/configure.zcml +23 -1
  122. imio/smartweb/core/viewlets/footer.pt +5 -0
  123. imio/smartweb/core/viewlets/footer.py +5 -0
  124. imio/smartweb/core/viewlets/htmx.py +15 -0
  125. imio/smartweb/core/viewlets/htmx_js_header.pt +64 -0
  126. imio/smartweb/core/viewlets/ogptags.py +4 -3
  127. imio/smartweb/core/viewlets/social.py +23 -0
  128. imio/smartweb/core/vocabularies.py +65 -3
  129. imio/smartweb/core/vocabularies.zcml +18 -0
  130. imio/smartweb/core/webcomponents/build/1c1605a5fe9a2b10a88f.png +1 -0
  131. imio/smartweb/core/webcomponents/build/524db40e119aa11f4478.png +1 -0
  132. imio/smartweb/core/webcomponents/build/57d3b7cb1ab874660b39.svg +1 -0
  133. imio/smartweb/core/webcomponents/build/6cf03871df23ed2ee8b3.png +1 -0
  134. imio/smartweb/core/webcomponents/build/css/373.smartweb-webcomponents-compiled.css +1 -1
  135. imio/smartweb/core/webcomponents/build/css/486.smartweb-webcomponents-compiled.css +1 -1
  136. imio/smartweb/core/webcomponents/build/css/884.smartweb-webcomponents-compiled.css +1 -0
  137. imio/smartweb/core/webcomponents/build/css/919.smartweb-webcomponents-compiled.css +1 -1
  138. imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
  139. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +1 -1
  140. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js.LICENSE.txt +10 -8
  141. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +2 -1
  142. imio/smartweb/core/webcomponents/build/js/{568.smartweb-webcomponents-compiled.js.LICENSE.txt → 373.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -4
  143. imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -1
  144. imio/smartweb/core/webcomponents/build/js/499.smartweb-webcomponents-compiled.js +2 -0
  145. imio/smartweb/core/webcomponents/build/js/{674.smartweb-webcomponents-compiled.js.LICENSE.txt → 499.smartweb-webcomponents-compiled.js.LICENSE.txt} +1 -8
  146. imio/smartweb/core/webcomponents/build/js/799.smartweb-webcomponents-compiled.js +1 -1
  147. imio/smartweb/core/webcomponents/build/js/824.smartweb-webcomponents-compiled.js +2 -0
  148. imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js +2 -0
  149. imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js.LICENSE.txt +32 -0
  150. imio/smartweb/core/webcomponents/build/js/884.smartweb-webcomponents-compiled.js +1 -0
  151. imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -1
  152. imio/smartweb/core/webcomponents/build/js/{568.smartweb-webcomponents-compiled.js → 963.smartweb-webcomponents-compiled.js} +2 -2
  153. imio/smartweb/core/webcomponents/build/js/963.smartweb-webcomponents-compiled.js.LICENSE.txt +3 -0
  154. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
  155. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js.LICENSE.txt +11 -14
  156. imio/smartweb/core/webcomponents/package.json +42 -40
  157. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.jsx +146 -79
  158. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.scss +415 -351
  159. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactCard/ContactCard.jsx +95 -62
  160. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +328 -168
  161. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactList/ContactList.jsx +21 -4
  162. imio/smartweb/core/webcomponents/src/components/Annuaire/Filters/Filter.jsx +213 -100
  163. imio/smartweb/core/webcomponents/src/components/Annuaire/index.js +1 -1
  164. imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +76 -33
  165. imio/smartweb/core/webcomponents/src/components/Events/EventContent/EventContent.jsx +604 -377
  166. imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +29 -4
  167. imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +162 -88
  168. imio/smartweb/core/webcomponents/src/components/Events/Events.scss +496 -378
  169. imio/smartweb/core/webcomponents/src/components/Events/Filters/Filter.jsx +259 -91
  170. imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.jsx +62 -55
  171. imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.scss +68 -17
  172. imio/smartweb/core/webcomponents/src/components/Filters/IamData.jsx +42 -0
  173. imio/smartweb/core/webcomponents/src/components/Filters/MainFilter.scss +229 -0
  174. imio/smartweb/core/webcomponents/src/components/Filters/PublicTargetData.jsx +94 -0
  175. imio/smartweb/core/webcomponents/src/components/Filters/SelectStyles.js +58 -0
  176. imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.jsx +149 -0
  177. imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.scss +70 -0
  178. imio/smartweb/core/webcomponents/src/components/News/Filters/Filter.jsx +139 -83
  179. imio/smartweb/core/webcomponents/src/components/News/News.jsx +133 -67
  180. imio/smartweb/core/webcomponents/src/components/News/News.scss +170 -127
  181. imio/smartweb/core/webcomponents/src/components/News/NewsCard/NewsCard.jsx +76 -44
  182. imio/smartweb/core/webcomponents/src/components/News/NewsContent/NewsContent.jsx +261 -188
  183. imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +48 -9
  184. imio/smartweb/core/webcomponents/src/components/Search/ContactResult/ContactResult.jsx +21 -10
  185. imio/smartweb/core/webcomponents/src/components/Search/EventsResult/EventsResult.jsx +21 -10
  186. imio/smartweb/core/webcomponents/src/components/Search/Filters/Filter.jsx +8 -9
  187. imio/smartweb/core/webcomponents/src/components/Search/NewsResult/NewsResult.jsx +23 -12
  188. imio/smartweb/core/webcomponents/src/components/Search/Search.jsx +7 -6
  189. imio/smartweb/core/webcomponents/src/components/Search/Search.scss +115 -96
  190. imio/smartweb/core/webcomponents/src/components/Search/WebResult/WebResult.jsx +12 -3
  191. imio/smartweb/core/webcomponents/src/components/Search/index.js +1 -1
  192. imio/smartweb/core/webcomponents/src/hooks/ScrollContext.jsx +3 -0
  193. imio/smartweb/core/webcomponents/src/hooks/useAxios.js +3 -3
  194. imio/smartweb/core/webcomponents/src/hooks/useFilterQuery.js +1 -2
  195. imio/smartweb/core/webcomponents/src/index.scss +255 -211
  196. imio/smartweb/core/webcomponents/src/utils/Map.jsx +26 -19
  197. imio/smartweb/core/webcomponents/src/utils/Map.scss +2 -2
  198. imio/smartweb/core/webcomponents/src/utils/translation.js +129 -9
  199. imio.smartweb.core-1.2.80-py3.8-nspkg.pth +2 -0
  200. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.80.dist-info}/METADATA +410 -10
  201. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.80.dist-info}/RECORD +207 -161
  202. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.80.dist-info}/WHEEL +1 -1
  203. imio/smartweb/core/webcomponents/build/assets/location-bla.1423bcce16ddcb21141430cac1428dc1.svg +0 -1
  204. imio/smartweb/core/webcomponents/build/assets/next-react-white.819cb069ac8eec300a9db6a7707712d6.svg +0 -1
  205. imio/smartweb/core/webcomponents/build/assets/next-react.17bc43ff4a6a86f4520f5782f6a89a72.svg +0 -1
  206. imio/smartweb/core/webcomponents/build/assets/search.57bdbf5b191499cd77514097d1c4972c.svg +0 -1
  207. imio/smartweb/core/webcomponents/build/css/686.smartweb-webcomponents-compiled.css +0 -1
  208. imio/smartweb/core/webcomponents/build/js/209.smartweb-webcomponents-compiled.js +0 -2
  209. imio/smartweb/core/webcomponents/build/js/40.smartweb-webcomponents-compiled.js +0 -1
  210. imio/smartweb/core/webcomponents/build/js/674.smartweb-webcomponents-compiled.js +0 -2
  211. imio/smartweb/core/webcomponents/build/js/686.smartweb-webcomponents-compiled.js +0 -1
  212. imio/smartweb/core/webcomponents/src/assets/facebook-news.svg +0 -1
  213. imio/smartweb/core/webcomponents/src/assets/location-bla.svg +0 -1
  214. imio/smartweb/core/webcomponents/src/assets/next-react.svg +0 -1
  215. imio/smartweb/core/webcomponents/src/assets/search.svg +0 -1
  216. imio/smartweb/core/webcomponents/src/assets/skeleton.svg +0 -1
  217. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/download.svg +0 -1
  218. imio.smartweb.core-1.2.38-py3.8-nspkg.pth +0 -3
  219. /imio/smartweb/core/webcomponents/build/js/{209.smartweb-webcomponents-compiled.js.LICENSE.txt → 824.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  220. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.80.dist-info}/LICENSE.GPL +0 -0
  221. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.80.dist-info}/LICENSE.rst +0 -0
  222. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.80.dist-info}/namespace_packages.txt +0 -0
  223. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.80.dist-info}/top_level.txt +0 -0
@@ -61,7 +61,8 @@
61
61
  i18n:translate="">Contact</h3>
62
62
 
63
63
  <span tal:replace="python:contact.vat_number"></span>
64
- <ul tal:define="phones python:contact.phones;
64
+ <ul class="contact_informations_genral"
65
+ tal:define="phones python:contact.phones;
65
66
  mails python:contact.mails;
66
67
  urls python:contact.urls">
67
68
  <li class="phones"
@@ -78,13 +79,37 @@
78
79
  <a tal:attributes="href python:'mailto:{}'.format(mail.get('mail_address'))"
79
80
  tal:content="python:'{}'.format(mail.get('mail_address'))" />
80
81
  </li>
82
+ </ul>
83
+ <ul class="contact_informations_social"
84
+ tal:define="urls python:contact.urls">
81
85
  <li class="urls"
82
86
  tal:repeat="url urls"
83
87
  tal:attributes="class python:url.get('type') or ''">
84
88
  <a tal:attributes="href python:url.get('url');
85
89
  title python:contact.get_translated_url_type(url.get('type'))"
86
- tal:content="python:url.get('url')"
87
- target="_blank" />
90
+ target="_blank">
91
+ <tal:condition tal:condition="python:url.get('type') == 'facebook'">
92
+ <i class="bi bi-facebook"></i>
93
+ </tal:condition>
94
+ <tal:condition tal:condition="python:url.get('type') == 'twitter'">
95
+ <i class="bi bi-twitter"></i>
96
+ </tal:condition>
97
+ <tal:condition tal:condition="python:url.get('type') == 'instagram'">
98
+ <i class="bi bi-instagram"></i>
99
+ </tal:condition>
100
+ <tal:condition tal:condition="python:url.get('type') == 'youtube'">
101
+ <i class="bi bi-youtube"></i>
102
+ </tal:condition>
103
+ <tal:condition tal:condition="python:url.get('type') == 'pinterest'">
104
+ <i class="bi bi-pinterest"></i>
105
+ </tal:condition>
106
+ <tal:condition tal:condition="python:url.get('type') == 'linkedin'">
107
+ <i class="bi bi-linkedin"></i>
108
+ </tal:condition>
109
+
110
+ <span tal:attributes="class python:'sr-only' if url.get('type') != 'website' else ''"
111
+ tal:content="python:url.get('url')"/>
112
+ </a>
88
113
  </li>
89
114
  </ul>
90
115
  </div>
@@ -69,6 +69,8 @@ class ContactProperties(ContactSchedule):
69
69
  return json.dumps(geo_json)
70
70
 
71
71
  def images(self, image_scale, nb_results_by_batch):
72
+ if "gallery" not in self.context.visible_blocks:
73
+ return
72
74
  contact_url = self.contact["@id"]
73
75
  query = "@search?portal_type=Image&path.depth=1&metadata_fields=modified"
74
76
  images_url_request = "{}/{}".format(contact_url, query)
@@ -4,30 +4,46 @@ from imio.smartweb.core.config import DIRECTORY_URL
4
4
  from imio.smartweb.core.contents.sections.contact.utils import ContactProperties
5
5
  from imio.smartweb.core.contents.sections.views import HashableJsonSectionView
6
6
  from imio.smartweb.core.utils import batch_results
7
- from imio.smartweb.core.utils import get_json
8
7
  from plone import api
8
+ from zope.component import queryMultiAdapter
9
9
 
10
10
 
11
11
  class ContactView(HashableJsonSectionView):
12
12
  """Contact Section view"""
13
13
 
14
14
  def contacts(self):
15
- if self.context.related_contacts is None:
16
- return
17
- related_contacts = self.context.related_contacts
18
- uids = "&UID=".join(related_contacts)
15
+ # Firstly, try to get contact from the container view
16
+ container_view = queryMultiAdapter(
17
+ (self.context.aq_parent, self.request), name="full_view"
18
+ )
19
+ self.json_data = container_view.get_page_contacts()
20
+ if self.json_data is None or len(self.json_data.get("items", [])) == 0:
21
+ return []
22
+
23
+ container_contacts = self.json_data.get("items")
24
+ results_items = [
25
+ contact
26
+ for contact in container_contacts
27
+ if contact["UID"] in self.context.related_contacts
28
+ ]
29
+ index_map = {
30
+ value: index for index, value in enumerate(self.context.related_contacts)
31
+ }
32
+ results_items = sorted(results_items, key=lambda x: index_map[x["UID"]])
33
+
34
+ # construct JSON data as before WEBBDC-1265 to avoid hash differences
35
+ uids = "&UID=".join(self.context.related_contacts)
19
36
  url = "{}/@search?UID={}&fullobjects=1".format(DIRECTORY_URL, uids)
20
37
  current_lang = api.portal.get_current_language()[:2]
21
38
  if current_lang != "fr":
22
39
  url = f"{url}&translated_in_{current_lang}=1"
23
- self.json_data = get_json(url)
40
+ self.json_data = {
41
+ "@id": url,
42
+ "items": results_items,
43
+ "items_total": len(results_items),
44
+ }
24
45
  self.refresh_modification_date()
25
- if self.json_data is None or len(self.json_data.get("items", [])) == 0: # NOQA
26
- return
27
- results = self.json_data.get("items")
28
- index_map = {value: index for index, value in enumerate(related_contacts)}
29
- results = sorted(results, key=lambda x: index_map[x["UID"]])
30
- return batch_results(results, self.context.nb_contact_by_line)
46
+ return batch_results(results_items, self.context.nb_contact_by_line)
31
47
 
32
48
  def get_contact_properties(self, json_dict):
33
49
  return ContactProperties(json_dict, self.context)
@@ -1,10 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ from imio.smartweb.common.widgets.select import TranslatedAjaxSelectWidget
3
4
  from imio.smartweb.core.contents.sections.base import ISection
4
5
  from imio.smartweb.core.contents.sections.base import Section
5
6
  from imio.smartweb.locales import SmartwebMessageFactory as _
6
7
  from plone.app.z3cform.widget import RelatedItemsFieldWidget
7
- from plone.app.z3cform.widget import AjaxSelectFieldWidget
8
8
  from plone.app.z3cform.widget import SelectFieldWidget
9
9
  from plone.autoform import directives
10
10
  from plone.supermodel import model
@@ -13,8 +13,8 @@ from zope import schema
13
13
  from zope.globalrequest import getRequest
14
14
  from zope.i18n import translate
15
15
  from zope.interface import implementer
16
- from zope.schema.interfaces import IContextAwareDefaultFactory
17
16
  from zope.interface import provider
17
+ from zope.schema.interfaces import IContextAwareDefaultFactory
18
18
 
19
19
 
20
20
  @provider(IContextAwareDefaultFactory)
@@ -40,8 +40,9 @@ class ISectionEvents(ISection):
40
40
  )
41
41
  directives.widget(
42
42
  "specific_related_events",
43
- AjaxSelectFieldWidget,
44
- source="imio.smartweb.vocabulary.EventsFromEntity",
43
+ TranslatedAjaxSelectWidget,
44
+ vocabulary="imio.smartweb.vocabulary.EventsFromEntity",
45
+ pattern_options={"multiple": True},
45
46
  )
46
47
 
47
48
  directives.widget(
@@ -85,6 +86,13 @@ class ISectionEvents(ISection):
85
86
  title=_("Show items description"), required=False
86
87
  )
87
88
 
89
+ model.fieldset("layout", fields=["display_agendas_titles"])
90
+ display_agendas_titles = schema.Bool(
91
+ title=_("Display agendas titles"),
92
+ description=_("If checked, display agendas titles in the carousel view."),
93
+ required=False,
94
+ )
95
+
88
96
 
89
97
  @implementer(ISectionEvents)
90
98
  class SectionEvents(Section):
@@ -2,6 +2,7 @@
2
2
 
3
3
  from datetime import date
4
4
  from dateutil.parser import parse
5
+ from imio.smartweb.common.utils import translate_vocabulary_term
5
6
  from imio.smartweb.core.config import EVENTS_URL
6
7
  from imio.smartweb.core.contents.sections.views import CarouselOrTableSectionView
7
8
  from imio.smartweb.core.contents.sections.views import HashableJsonSectionView
@@ -27,7 +28,10 @@ class EventsView(CarouselOrTableSectionView, HashableJsonSectionView):
27
28
  )
28
29
  params = [
29
30
  selected_item,
31
+ "metadata_fields=container_uid",
30
32
  "metadata_fields=category_title",
33
+ "metadata_fields=local_category",
34
+ "metadata_fields=topics",
31
35
  "metadata_fields=start",
32
36
  "metadata_fields=end",
33
37
  "metadata_fields=has_leadimage",
@@ -47,7 +51,7 @@ class EventsView(CarouselOrTableSectionView, HashableJsonSectionView):
47
51
  url = "{}/@events?{}".format(EVENTS_URL, "&".join(params))
48
52
  self.json_data = get_json(url)
49
53
  self.refresh_modification_date()
50
- if self.json_data is None or len(self.json_data.get("items", [])) == 0: # NOQA
54
+ if self.json_data is None or len(self.json_data.get("items", [])) == 0:
51
55
  return []
52
56
  linking_view_url = self.context.linking_rest_view.to_object.absolute_url()
53
57
  image_scale = self.image_scale
@@ -62,13 +66,23 @@ class EventsView(CarouselOrTableSectionView, HashableJsonSectionView):
62
66
  end = item["end"] and parse(item["end"]) or None
63
67
  date_dict = {"start": start, "end": end}
64
68
  modified_hash = hash_md5(item["modified"])
69
+ category = ""
70
+ if self.context.show_categories_or_topics == "category":
71
+ category = item.get("local_category") or item.get("category_title", "")
72
+ elif self.context.show_categories_or_topics == "topic":
73
+ topic = item.get("topics") and item["topics"][0] or None
74
+ category = translate_vocabulary_term(
75
+ "imio.smartweb.vocabulary.Topics", topic
76
+ )
65
77
  dict_item = {
66
78
  "uid": item_uid,
67
79
  "title": item["title"],
68
80
  "description": item["description"],
69
- "category": item["category_title"],
81
+ "category": category,
70
82
  "event_date": date_dict,
71
83
  "url": f"{linking_view_url}/{item_id}?u={item_uid}",
84
+ "container_id": item.get("usefull_container_id", None),
85
+ "container_title": item.get("usefull_container_title", None),
72
86
  "has_image": item["has_leadimage"],
73
87
  "image": f"{item_url}/@@images/image/{orientation}_{image_scale}?cache_key={modified_hash}",
74
88
  }
@@ -85,3 +99,7 @@ class EventsView(CarouselOrTableSectionView, HashableJsonSectionView):
85
99
 
86
100
  def is_multi_dates(self, start, end):
87
101
  return start and end and start.date() != end.date()
102
+
103
+ @property
104
+ def display_container_title(self):
105
+ return self.context.display_agendas_titles
@@ -27,20 +27,20 @@
27
27
 
28
28
  <div tal:condition="not:which_plugin"
29
29
  tal:define="collapse_klass python: 'collapse' if context.collapsible_section else ''"
30
- tal:attributes="class string:body-section ratio ${collapse_klass};
30
+ tal:attributes="class string:body-section ${collapse_klass};
31
31
  id string:body-section-${context/id}"
32
32
  tal:content="structure view/contents" />
33
33
 
34
34
  <div tal:condition="python:which_plugin == 'ideluxwasteplugin'">
35
- <metal:block use-macro="context/@@view_idelux_waste/embeded_datas" tal:define="datas view/contents">
35
+ <metal:block use-macro="context/@@view_idelux_waste/embeded_datas" tal:define="datas view/contents"></metal:block>
36
36
  </div>
37
37
 
38
38
  <div tal:condition="python:which_plugin == 'inbwcontainersaffluenceplugin'">
39
- <metal:block use-macro="context/@@view_inbw_container_affluence/embeded_datas" tal:define="datas view/contents">
39
+ <metal:block use-macro="context/@@view_inbw_container_affluence/embeded_datas" tal:define="datas view/contents"></metal:block>
40
40
  </div>
41
41
 
42
42
  <div tal:condition="python:which_plugin == 'odwbwidgetplugin'">
43
- <metal:block use-macro="context/@@view_odwb_widget/embeded_datas" tal:define="datas view/contents">
43
+ <metal:block use-macro="context/@@view_odwb_widget/embeded_datas" tal:define="datas view/contents"></metal:block>
44
44
  </div>
45
45
 
46
46
  </div>
@@ -139,7 +139,7 @@ class EaglebePlugin(BasePlugin):
139
139
 
140
140
  class EllohaPlugin(BasePlugin):
141
141
  def __call__(self, parts, config={}):
142
- if "reservation.elloha.com" in parts.netloc:
142
+ if "elloha.com" in parts.netloc:
143
143
  self.parts = parts
144
144
  self.config = config
145
145
  return self
@@ -173,14 +173,15 @@ class EllohaPlugin(BasePlugin):
173
173
  cw1 = res.get("constellationwidgetcontainer")
174
174
  cw2 = cw1.replace("-", "")
175
175
  idoi = res.get("idoi")
176
+ internal_url = "https://reservation.elloha.com"
176
177
  return (
177
- f'<div class="elloha">'
178
+ f'<div class="elloha" style="position:relative;">'
178
179
  f'<div id="ConstellationWidgetContainer{cw1}" '
179
180
  f'style="width:100%" data-id-projet="{cw2}">...</div></div>'
180
- f'<script type="text/javascript" src="{self.parts.geturl()}/Scripts/widget-loader.min.js?v=42"></script>'
181
+ f'<script type="text/javascript" src="{internal_url}/Scripts/widget-loader.min.js?v=42"></script>'
181
182
  f'<script type="text/javascript">var constellationWidgetUrl{cw2}, '
182
183
  f"constellationTypeModule{cw2};"
183
- f'constellationWidgetUrl{cw2} = "https://reservation.elloha.com/Widget/BookingEngine/{cw1}?idoi={idoi}&culture=fr-FR";'
184
+ f'constellationWidgetUrl{cw2} = "{internal_url}/Widget/BookingEngine/{cw1}?idoi={idoi}&culture=fr-FR";'
184
185
  f'constellationTypeModule{cw2}=1; constellationWidgetLoad("ConstellationWidgetContainer{cw1}");'
185
186
  f'constellationWidgetAddEvent(window, "resize", function () {{constellationWidgetSetAppearance("ConstellationWidgetContainer{cw1}");}});</script>'
186
187
  )
@@ -230,6 +231,7 @@ class ArcgisPlugin(BasePlugin):
230
231
  if "arcgis" in parts.netloc:
231
232
  self.parts = parts
232
233
  self.config = config
234
+ return self
233
235
  return None
234
236
 
235
237
  @property
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
-
2
+ from imio.smartweb.core.contents import IPublication
3
3
  from imio.smartweb.core.contents.sections.base import ISection
4
4
  from imio.smartweb.core.contents.sections.base import Section
5
5
  from imio.smartweb.locales import SmartwebMessageFactory as _
@@ -30,3 +30,9 @@ class SectionFiles(Section):
30
30
  """SectionText class"""
31
31
 
32
32
  manage_content = True
33
+
34
+ def has_publications(self):
35
+ for item in self.items():
36
+ if IPublication.providedBy(item[1]):
37
+ return True
38
+ return False
@@ -1,33 +1,64 @@
1
1
  # -*- coding: utf-8 -*-
2
-
2
+ from imio.smartweb.core.contents import IPublication
3
3
  from imio.smartweb.core.contents.sections.views import CarouselOrTableSectionView
4
4
  from imio.smartweb.core.utils import batch_results
5
5
  from imio.smartweb.core.utils import get_scale_url
6
+ from plone import api
7
+ from plone.protect.interfaces import IDisableCSRFProtection
6
8
  from zope.component import queryMultiAdapter
9
+ from zope.interface import alsoProvides
7
10
 
8
11
 
9
12
  class FilesView(CarouselOrTableSectionView):
10
13
  """Files Section view"""
11
14
 
12
15
  def items(self):
16
+ alsoProvides(self.request, IDisableCSRFProtection)
17
+ orientation = self.context.orientation
13
18
  image_scale = self.image_scale
14
- items = self.context.listFolderContents()
19
+ items = super(FilesView, self).items()
15
20
  results = []
16
21
  for item in items:
17
22
  url = item.absolute_url()
18
23
  has_image = True if getattr(item.aq_base, "image", None) else False
19
24
  file_view = queryMultiAdapter((item, self.request), name="file_view")
20
25
  scale_url = get_scale_url(
21
- item, self.request, "image", image_scale, orientation="paysage"
26
+ item, self.request, "image", image_scale, orientation
22
27
  )
23
- results.append(
24
- {
25
- "title": item.title,
26
- "description": item.description,
27
- "url": url,
28
- "image": scale_url,
29
- "has_image": has_image,
30
- "item_infos": file_view.human_readable_size(),
31
- }
28
+ dict_item = {
29
+ "title": item.title,
30
+ "description": item.description,
31
+ "smartweb_type": item.smartweb_type,
32
+ "url": url,
33
+ "image": scale_url,
34
+ "has_image": has_image,
35
+ }
36
+ dict_item["item_infos"] = (
37
+ None if file_view is None else file_view.human_readable_size()
32
38
  )
39
+ if IPublication.providedBy(item):
40
+ extra_properties = [
41
+ "linked_publication",
42
+ "publication_datetime",
43
+ "publication_url",
44
+ "publication_document_type",
45
+ "publication_attached_file",
46
+ ]
47
+ dict_item = self.get_publication_extra_properties(
48
+ item, dict_item, extra_properties
49
+ )
50
+
51
+ results.append(dict_item)
33
52
  return batch_results(results, self.context.nb_results_by_batch)
53
+
54
+ def retrieve_item_url(self, item):
55
+ if item.get("publication_url", None) is not None and api.user.is_anonymous():
56
+ # return "real" publication url in iadeliberation
57
+ return item.get("publication_url")
58
+ # return smartweb item url
59
+ return item.get("url")
60
+
61
+ def get_publication_extra_properties(self, item, dict_item, extra_properties):
62
+ for prop in extra_properties:
63
+ dict_item[prop] = getattr(item, prop, None)
64
+ return dict_item
@@ -3,6 +3,7 @@
3
3
  from imio.smartweb.core.contents.sections.views import CarouselOrTableSectionView
4
4
  from imio.smartweb.core.utils import batch_results
5
5
  from imio.smartweb.core.utils import get_scale_url
6
+ from plone import api
6
7
 
7
8
 
8
9
  class LinksView(CarouselOrTableSectionView):
@@ -15,6 +16,10 @@ class LinksView(CarouselOrTableSectionView):
15
16
  results = []
16
17
  for item in items:
17
18
  url = item.absolute_url()
19
+ is_anon = api.user.is_anonymous()
20
+ if hasattr(item, "remoteUrl") and item.remoteUrl is not None and is_anon:
21
+ portal_url = api.portal.get().absolute_url()
22
+ url = item.remoteUrl.replace("${portal_url}", portal_url)
18
23
  has_icon = has_image = False
19
24
  if getattr(item.aq_base, "svg_icon", None):
20
25
  has_icon = True
@@ -53,6 +53,32 @@
53
53
  <a tal:attributes="href string:${context/absolute_url}/delete_confirmation"
54
54
  i18n:translate="">Delete section</a>
55
55
 
56
+ <form class="form_section_size"
57
+ style="display: none;"
58
+ hx-swap="innerHTML"
59
+ hx-trigger="change"
60
+ tal:attributes="name string:sizesForm_${context/UID};
61
+ id string:sizesForm_${context/UID};
62
+ hx-boost string:${context/UID};
63
+ hx-post string:${context/absolute_url}/@@savesize;
64
+ hx-target string:#selected_size_${context/UID}">
65
+ <select name="sectionSize"
66
+ class="form-select select_section_size"
67
+ hx-vals="serialize"
68
+ tal:attributes="name string:select_${context/UID};
69
+ id string:select_${context/UID}">
70
+ <option tal:repeat="size view/get_sizes"
71
+ tal:attributes="title size/value; value size/key; class string:icon_${size/key}"
72
+ >
73
+ </option>
74
+ </select>
75
+ </form>
76
+ <a class="section_size"
77
+ href="#"
78
+ tal:attributes="id string:selected_size_${context/UID};
79
+ uid string:${context/UID}"
80
+ tal:content="string:${view/get_section_size}"></a>
81
+
56
82
  <tal:dates define="modified context/ModificationDate">
57
83
  <span class="documentModified"
58
84
  tal:condition="modified">
@@ -1,10 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ from imio.smartweb.common.widgets.select import TranslatedAjaxSelectWidget
3
4
  from imio.smartweb.core.contents.sections.base import ISection
4
5
  from imio.smartweb.core.contents.sections.base import Section
5
6
  from imio.smartweb.locales import SmartwebMessageFactory as _
6
7
  from plone.app.z3cform.widget import RelatedItemsFieldWidget
7
- from plone.app.z3cform.widget import AjaxSelectFieldWidget
8
8
  from plone.app.z3cform.widget import SelectFieldWidget
9
9
  from plone.autoform import directives
10
10
  from plone.supermodel import model
@@ -40,8 +40,9 @@ class ISectionNews(ISection):
40
40
  )
41
41
  directives.widget(
42
42
  "specific_related_newsitems",
43
- AjaxSelectFieldWidget,
44
- source="imio.smartweb.vocabulary.NewsItemsFromEntity",
43
+ TranslatedAjaxSelectWidget,
44
+ vocabulary="imio.smartweb.vocabulary.NewsItemsFromEntity",
45
+ pattern_options={"multiple": True},
45
46
  )
46
47
 
47
48
  directives.widget(
@@ -85,6 +86,13 @@ class ISectionNews(ISection):
85
86
  title=_("Show items description"), required=False
86
87
  )
87
88
 
89
+ model.fieldset("layout", fields=["display_newsfolders_titles"])
90
+ display_newsfolders_titles = schema.Bool(
91
+ title=_("Display news folders titles"),
92
+ description=_("If checked, display news folders titles in the carousel view."),
93
+ required=False,
94
+ )
95
+
88
96
 
89
97
  @implementer(ISectionNews)
90
98
  class SectionNews(Section):
@@ -1,5 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ from imio.smartweb.common.utils import translate_vocabulary_term
3
4
  from imio.smartweb.core.config import NEWS_URL
4
5
  from imio.smartweb.core.contents.sections.views import CarouselOrTableSectionView
5
6
  from imio.smartweb.core.contents.sections.views import HashableJsonSectionView
@@ -25,7 +26,10 @@ class NewsView(CarouselOrTableSectionView, HashableJsonSectionView):
25
26
  params = [
26
27
  selected_item,
27
28
  "portal_type=imio.news.NewsItem",
29
+ "metadata_fields=container_uid",
28
30
  "metadata_fields=category_title",
31
+ "metadata_fields=local_category",
32
+ "metadata_fields=topics",
29
33
  "metadata_fields=has_leadimage",
30
34
  "metadata_fields=modified",
31
35
  "metadata_fields=effective",
@@ -43,7 +47,7 @@ class NewsView(CarouselOrTableSectionView, HashableJsonSectionView):
43
47
  url = "{}/@search?{}".format(NEWS_URL, "&".join(params))
44
48
  self.json_data = get_json(url)
45
49
  self.refresh_modification_date()
46
- if self.json_data is None or len(self.json_data.get("items", [])) == 0: # NOQA
50
+ if self.json_data is None or len(self.json_data.get("items", [])) == 0:
47
51
  return []
48
52
  linking_view_url = self.context.linking_rest_view.to_object.absolute_url()
49
53
  image_scale = self.image_scale
@@ -55,13 +59,23 @@ class NewsView(CarouselOrTableSectionView, HashableJsonSectionView):
55
59
  item_url = item["@id"]
56
60
  item_uid = item["UID"]
57
61
  modified_hash = hash_md5(item["modified"])
62
+ category = ""
63
+ if self.context.show_categories_or_topics == "category":
64
+ category = item.get("local_category") or item.get("category_title", "")
65
+ elif self.context.show_categories_or_topics == "topic":
66
+ topic = item.get("topics") and item["topics"][0] or None
67
+ category = translate_vocabulary_term(
68
+ "imio.smartweb.vocabulary.Topics", topic
69
+ )
58
70
  dict_item = {
59
71
  "uid": item_uid,
60
72
  "title": item["title"],
61
73
  "description": item["description"],
62
- "category": item["category_title"],
74
+ "category": category,
63
75
  "effective": item["effective"],
64
76
  "url": f"{linking_view_url}/{item_id}?u={item_uid}",
77
+ "container_id": item.get("usefull_container_id", None),
78
+ "container_title": item.get("usefull_container_title", None),
65
79
  "has_image": item["has_leadimage"],
66
80
  "image": f"{item_url}/@@images/image/{orientation}_{image_scale}?cache_key={modified_hash}",
67
81
  }
@@ -75,3 +89,7 @@ class NewsView(CarouselOrTableSectionView, HashableJsonSectionView):
75
89
  @property
76
90
  def see_all_url(self):
77
91
  return self.context.linking_rest_view.to_object.absolute_url()
92
+
93
+ @property
94
+ def display_container_title(self):
95
+ return self.context.display_newsfolders_titles
@@ -10,4 +10,6 @@ class TextView(SectionView):
10
10
  def get_scale_url(self, item):
11
11
  request = self.request
12
12
  scale = self.context.image_size
13
+ if self.context.image._height > self.context.image._width:
14
+ return get_scale_url(item, request, "image", scale, "portrait")
13
15
  return get_scale_url(item, request, "image", scale, "paysage")