imio.smartweb.core 1.4__py3-none-any.whl → 1.4.2__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 (38) hide show
  1. imio/smartweb/core/browser/static/smartweb-edit-compiled.css +1 -1
  2. imio/smartweb/core/browser/static/src/edit.less +20 -11
  3. imio/smartweb/core/contents/rest/events/endpoint.py +51 -3
  4. imio/smartweb/core/subscribers.py +10 -0
  5. imio/smartweb/core/tests/test_cropping.py +53 -0
  6. imio/smartweb/core/tests/test_rest.py +47 -5
  7. imio/smartweb/core/viewlets/ogptags.py +6 -12
  8. imio/smartweb/core/webcomponents/build/js/141.smartweb-webcomponents-compiled.js +1 -1
  9. imio/smartweb/core/webcomponents/build/js/141.smartweb-webcomponents-compiled.js.LICENSE.txt +3 -3
  10. imio/smartweb/core/webcomponents/build/js/21.smartweb-webcomponents-compiled.js +1 -1
  11. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +1 -1
  12. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +1 -1
  13. imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -1
  14. imio/smartweb/core/webcomponents/build/js/491.smartweb-webcomponents-compiled.js +2 -0
  15. imio/smartweb/core/webcomponents/build/js/666.smartweb-webcomponents-compiled.js +1 -1
  16. imio/smartweb/core/webcomponents/build/js/824.smartweb-webcomponents-compiled.js +1 -1
  17. imio/smartweb/core/webcomponents/build/js/884.smartweb-webcomponents-compiled.js +1 -1
  18. imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -1
  19. imio/smartweb/core/webcomponents/build/js/922.smartweb-webcomponents-compiled.js +1 -1
  20. imio/smartweb/core/webcomponents/build/js/963.smartweb-webcomponents-compiled.js +1 -1
  21. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
  22. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +57 -0
  23. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactList/ContactList.jsx +47 -0
  24. imio/smartweb/core/webcomponents/src/components/Events/EventContent/EventContent.jsx +69 -0
  25. imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +47 -0
  26. imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +0 -1
  27. imio/smartweb/core/webcomponents/src/components/News/NewsContent/NewsContent.jsx +69 -0
  28. imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +48 -0
  29. {imio_smartweb_core-1.4.dist-info → imio_smartweb_core-1.4.2.dist-info}/METADATA +29 -1
  30. {imio_smartweb_core-1.4.dist-info → imio_smartweb_core-1.4.2.dist-info}/RECORD +37 -37
  31. {imio_smartweb_core-1.4.dist-info → imio_smartweb_core-1.4.2.dist-info}/WHEEL +1 -1
  32. imio/smartweb/core/webcomponents/build/js/15.smartweb-webcomponents-compiled.js +0 -2
  33. /imio/smartweb/core/webcomponents/build/js/{15.smartweb-webcomponents-compiled.js.LICENSE.txt → 491.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  34. /imio.smartweb.core-1.4-py3.12-nspkg.pth → /imio.smartweb.core-1.4.2-py3.12-nspkg.pth +0 -0
  35. {imio_smartweb_core-1.4.dist-info → imio_smartweb_core-1.4.2.dist-info}/licenses/LICENSE.GPL +0 -0
  36. {imio_smartweb_core-1.4.dist-info → imio_smartweb_core-1.4.2.dist-info}/licenses/LICENSE.rst +0 -0
  37. {imio_smartweb_core-1.4.dist-info → imio_smartweb_core-1.4.2.dist-info}/namespace_packages.txt +0 -0
  38. {imio_smartweb_core-1.4.dist-info → imio_smartweb_core-1.4.2.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- #contentview-preview .icon-preview:before{content:"\e833"}.pat-sortable>:hover{cursor:move}.pat-sortable{display:block;position:relative}.pat-sortable .sortable-section{border:1px solid #dee2e6!important;margin-bottom:1rem;margin-top:1rem;padding:.5rem}.hidden-section-title{opacity:.3}.section-title{vertical-align:middle}.content-section h2,.section-title,.show-hide-banner{display:inline-block}.show-hide-banner{background:#fff;border:1px solid #e6e6e6;padding:15px}.header-section{background:#f2f2f2;line-height:1.9;margin-bottom:1rem!important;margin-top:1rem!important;padding:0 1rem}table.table_schedule{cursor:default}ul.plonetoolbar-authentic-sources-menu,ul.plonetoolbar-smartweb-help-menu{padding-inline-start:0;width:100%}a.manage[class*=contenttype-imio-smartweb-]:before{display:none}a.manage[class*=contenttype-imio-smartweb-] svg{margin-right:5px}.manage-section .form_section_size option{font-size:15px}.manage-section .form_section_size option:before{aspect-ratio:16/9;content:"";display:block;width:40px}.form_section_size .icon_col-sm-3:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h40v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M45 5v90H5V5h40m5-5H0v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M45 5h40v90H45z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M85 5v90H45V5h40m5-5H40v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M85 5h40v90H85z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M125 5v90H85V5h40m5-5H80v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M125 5h40v90h-40z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-40V5h40m5-5h-50v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-4:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h53.36v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M58.36 5v90H5V5h53.36m5-5H0v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M58.27 5h53.36v90H58.27z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M111.64 5v90H58.28V5h53.36m5-5H53.28v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M111.64 5H165v90h-53.36z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-53.36V5H165m5-5h-63.36v100H170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-6:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h160v90H5z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90H5V5h160m5-5H0v100h170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M5 5h80v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M85 5v90H5V5h80m5-5H0v100h90V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-8:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h53.36v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M58.36 5v90H5V5h53.36m5-5H0v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M58.27 5h53.36v90H58.27z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M111.64 5v90H58.28V5h53.36m5-5H53.28v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M111.64 5H165v90h-53.36z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-53.36V5H165m5-5h-63.36v100H170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-9:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h40v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M45 5v90H5V5h40m5-5H0v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M45 5h40v90H45z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M85 5v90H45V5h40m5-5H40v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M85 5h40v90H85z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M125 5v90H85V5h40m5-5H80v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M125 5h40v90h-40z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-40V5h40m5-5h-50v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-12:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h160v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M165 5v90H5V5h160m5-5H0v100h170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}
1
+ .modal-wrapper .pattern-modal-buttons{display:flex;gap:0 10px}div#formfield-form-widgets-basic_analytics{order:0!important}#contentview-preview .icon-preview:before{content:"\e833"}.pat-sortable>:hover{cursor:move}.pat-sortable{display:block;position:relative}.pat-sortable .sortable-section{border:1px solid #dee2e6!important;margin-bottom:1rem;margin-top:1rem;padding:.5rem}.hidden-section-title{opacity:.3}.section-title{vertical-align:middle}.content-section h2,.section-title,.show-hide-banner{display:inline-block}.show-hide-banner{background:#fff;border:1px solid #e6e6e6;padding:15px}.header-section{background:#f2f2f2;line-height:1.9;margin-bottom:1rem!important;margin-top:1rem!important;padding:0 1rem}table.table_schedule{cursor:default}ul.plonetoolbar-authentic-sources-menu,ul.plonetoolbar-smartweb-help-menu{padding-inline-start:0;width:100%}a.manage[class*=contenttype-imio-smartweb-]:before{display:none}a.manage[class*=contenttype-imio-smartweb-] svg{margin-right:5px}.manage-section .form_section_size option{font-size:15px}.manage-section .form_section_size option:before{aspect-ratio:16/9;content:"";display:block;width:40px}.form_section_size .icon_col-sm-3:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h40v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M45 5v90H5V5h40m5-5H0v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M45 5h40v90H45z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M85 5v90H45V5h40m5-5H40v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M85 5h40v90H85z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M125 5v90H85V5h40m5-5H80v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M125 5h40v90h-40z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-40V5h40m5-5h-50v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-4:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h53.36v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M58.36 5v90H5V5h53.36m5-5H0v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M58.27 5h53.36v90H58.27z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M111.64 5v90H58.28V5h53.36m5-5H53.28v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M111.64 5H165v90h-53.36z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-53.36V5H165m5-5h-63.36v100H170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-6:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h160v90H5z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90H5V5h160m5-5H0v100h170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M5 5h80v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M85 5v90H5V5h80m5-5H0v100h90V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-8:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h53.36v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M58.36 5v90H5V5h53.36m5-5H0v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M58.27 5h53.36v90H58.27z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M111.64 5v90H58.28V5h53.36m5-5H53.28v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M111.64 5H165v90h-53.36z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-53.36V5H165m5-5h-63.36v100H170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-9:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h40v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M45 5v90H5V5h40m5-5H0v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M45 5h40v90H45z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M85 5v90H45V5h40m5-5H40v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M85 5h40v90H85z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M125 5v90H85V5h40m5-5H80v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M125 5h40v90h-40z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-40V5h40m5-5h-50v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-12:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h160v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M165 5v90H5V5h160m5-5H0v100h170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}
@@ -1,8 +1,17 @@
1
+ .modal-wrapper .pattern-modal-buttons {
2
+ display: flex;
3
+ gap: 0 10px;
4
+ }
5
+
6
+ div#formfield-form-widgets-basic_analytics {
7
+ order: initial !important;
8
+ }
9
+
1
10
  #contentview-preview .icon-preview:before {
2
- content: '\e833';
11
+ content: "\e833";
3
12
  }
4
13
 
5
- .pat-sortable> :hover {
14
+ .pat-sortable > :hover {
6
15
  cursor: move;
7
16
  }
8
17
 
@@ -63,21 +72,21 @@ ul.plonetoolbar-smartweb-help-menu {
63
72
  }
64
73
 
65
74
  a.manage[class*="contenttype-imio-smartweb-"] {
66
- &:before {
67
- display: none;
68
- }
69
- svg {
70
- margin-right: 5px;
71
- }
75
+ &:before {
76
+ display: none;
77
+ }
78
+ svg {
79
+ margin-right: 5px;
80
+ }
72
81
  }
73
82
 
74
83
  // layout select
75
84
 
76
85
  .manage-section .form_section_size option {
77
- font-size: 15px;
86
+ font-size: 15px;
78
87
  }
79
88
  .manage-section .form_section_size option:before {
80
- content:"";
89
+ content: "";
81
90
  display: block;
82
91
  width: 40px;
83
92
  aspect-ratio: 16/9;
@@ -111,4 +120,4 @@ a.manage[class*="contenttype-imio-smartweb-"] {
111
120
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h160v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M165 5v90H5V5h160m5-5H0v100h170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");
112
121
  background-size: contain;
113
122
  background-repeat: no-repeat;
114
- }
123
+ }
@@ -11,6 +11,12 @@ from zope.interface import Interface
11
11
 
12
12
 
13
13
  class BaseEventsEndpoint(BaseEndpoint):
14
+ def __init__(self, context, request, fullobjects=0, batch_size=0):
15
+ self.fullobjects = fullobjects
16
+ super(BaseEventsEndpoint, self).__init__(
17
+ context, request, fullobjects=fullobjects, batch_size=batch_size
18
+ )
19
+
14
20
  def __call__(self):
15
21
  results = super(BaseEventsEndpoint, self).__call__() or {}
16
22
  if not results or not results.get("items"):
@@ -34,14 +40,56 @@ class BaseEventsEndpoint(BaseEndpoint):
34
40
  def query_url(self):
35
41
  params = [
36
42
  "selected_agendas={}".format(self.context.selected_agenda),
43
+ "metadata_fields=title_nl",
44
+ "metadata_fields=title_en",
45
+ "metadata_fields=title_de",
46
+ "metadata_fields=title_fr",
47
+ "metadata_fields=description",
48
+ "metadata_fields=description_nl",
49
+ "metadata_fields=description_en",
50
+ "metadata_fields=description_de",
51
+ "metadata_fields=description_fr",
52
+ "metadata_fields=latitude",
53
+ "metadata_fields=longitude",
54
+ "metadata_fields=city",
55
+ "metadata_fields=number",
56
+ "metadata_fields=street",
57
+ "metadata_fields=zipcode",
58
+ "metadata_fields=complement",
59
+ "metadata_fields=country",
60
+ "metadata_fields=contact_name",
61
+ "metadata_fields=contact_phone",
62
+ "metadata_fields=contact_email",
63
+ "metadata_fields=event_type",
64
+ "metadata_fields=event_url",
65
+ "metadata_fields=video_url",
66
+ "metadata_fields=facebook",
67
+ "metadata_fields=instagram",
68
+ "metadata_fields=twitter",
69
+ "metadata_fields=free_entry",
70
+ "metadata_fields=online_participation",
71
+ "metadata_fields=open_end",
72
+ "metadata_fields=topics",
37
73
  "metadata_fields=category",
38
74
  "metadata_fields=local_category",
39
- "metadata_fields=container_uid",
40
- "metadata_fields=topics",
75
+ "metadata_fields=iam",
76
+ "metadata_fields=usefull_container_id",
77
+ "metadata_fields=usefull_container_title",
78
+ "metadata_fields=whole_day",
79
+ "metadata_fields=created",
80
+ "metadata_fields=effective",
81
+ "metadata_fields=modified",
41
82
  "metadata_fields=start",
42
83
  "metadata_fields=end",
84
+ "metadata_fields=first_end",
85
+ "metadata_fields=first_start",
86
+ "metadata_fields=expires",
87
+ "metadata_fields=exclude_from_nav",
88
+ "metadata_fields=container_uid",
89
+ "metadata_fields=image_caption",
43
90
  "metadata_fields=has_leadimage",
44
91
  "metadata_fields=UID",
92
+ "metadata_fields=language",
45
93
  "sort_on=event_dates",
46
94
  "fullobjects={}".format(self.fullobjects),
47
95
  ]
@@ -73,7 +121,7 @@ class EventsEndpointGet(BaseService):
73
121
  def reply(self):
74
122
  return EventsEndpoint(self.context, self.request)()
75
123
 
76
- def reply_for_given_object(self, obj, request, fullobjects=1, batch_size=0):
124
+ def reply_for_given_object(self, obj, request, fullobjects=0, batch_size=0):
77
125
  return EventsEndpoint(
78
126
  obj, request, fullobjects=fullobjects, batch_size=batch_size
79
127
  )()
@@ -108,9 +108,19 @@ def check_image_field(obj, interface, class_name, field_name):
108
108
  logger.info(f"No existing cropping to purge for {field_name}.")
109
109
 
110
110
 
111
+ def clear_image_scales(obj, event):
112
+ if not hasattr(obj, "image"):
113
+ return
114
+ if obj.image is None:
115
+ annotations = IAnnotations(obj)
116
+ if "plone.scale" in annotations:
117
+ del annotations["plone.scale"]
118
+
119
+
111
120
  def modified_content(obj, event):
112
121
  if not hasattr(event, "descriptions") or not event.descriptions:
113
122
  return
123
+ clear_image_scales(obj, event)
114
124
  for d in event.descriptions:
115
125
  if not IAttributes.providedBy(d):
116
126
  # we do not have fields change description, but maybe a request
@@ -12,13 +12,20 @@ from plone.app.dexterity.behaviors.metadata import IBasic
12
12
  from plone.app.imagecropping import PAI_STORAGE_KEY
13
13
  from plone.app.imagecropping.interfaces import IImageCroppingUtils
14
14
  from plone.app.testing import TEST_USER_ID
15
+ from plone.app.testing import TEST_USER_NAME
16
+ from plone.app.testing import TEST_USER_PASSWORD
15
17
  from plone.app.testing import setRoles
16
18
  from plone.namedfile.file import NamedBlobImage
19
+ from plone.testing.zope import Browser
20
+ from unittest.mock import patch
21
+ from urllib.error import HTTPError
17
22
  from zope.annotation.interfaces import IAnnotations
18
23
  from zope.component import getMultiAdapter
19
24
  from zope.lifecycleevent import Attributes
20
25
  from zope.lifecycleevent import modified
21
26
 
27
+ import transaction
28
+
22
29
 
23
30
  class TestCropping(ImioSmartwebTestCase):
24
31
  layer = IMIO_SMARTWEB_CORE_FUNCTIONAL_TESTING
@@ -148,3 +155,49 @@ class TestCropping(ImioSmartwebTestCase):
148
155
  )
149
156
  annotation = IAnnotations(self.folder).get(PAI_STORAGE_KEY)
150
157
  self.assertEqual(annotation, {})
158
+
159
+ def test_removing_image_and_scales(self):
160
+ self.folder.image = NamedBlobImage(**make_named_image("plone.png"))
161
+ modified(
162
+ self.folder, Attributes(ILeadImageBehavior, "ILeadImageBehavior.image")
163
+ )
164
+ scales = self.folder.restrictedTraverse("@@images")
165
+ image = scales.scale("image", scale="paysage_vignette")
166
+ image_url = image.url
167
+ transaction.commit()
168
+ browser = Browser(self.layer["app"])
169
+ browser.addHeader(
170
+ "Authorization",
171
+ "Basic %s:%s"
172
+ % (
173
+ TEST_USER_NAME,
174
+ TEST_USER_PASSWORD,
175
+ ),
176
+ )
177
+ browser.open(image_url)
178
+ content = browser.contents
179
+ # Got picture.
180
+ self.assertIsInstance(content, bytes)
181
+
182
+ # Old situation before fix
183
+ # Ensure browser still can access the image URL
184
+ # Situation BEFORE we make clear_image_scales function
185
+ self.folder.image = None # remive image from object
186
+ with patch("imio.smartweb.core.subscribers.clear_image_scales") as mock_clear:
187
+ modified(
188
+ self.folder, Attributes(ILeadImageBehavior, "ILeadImageBehavior.image")
189
+ )
190
+ transaction.commit()
191
+ browser.open(image_url)
192
+ content = browser.contents
193
+ self.assertIsInstance(content, bytes)
194
+
195
+ # New situation with fix
196
+ # Call subrscriber and pass in "real" clear_image_scales function
197
+ modified(
198
+ self.folder, Attributes(ILeadImageBehavior, "ILeadImageBehavior.image")
199
+ )
200
+ transaction.commit()
201
+ with self.assertRaises(HTTPError) as context:
202
+ browser.open(image_url)
203
+ self.assertIn("NotFound", str(context.exception))
@@ -378,20 +378,62 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
378
378
  endpoint = EventsEndpoint(self.rest_events, self.request)
379
379
  url = endpoint.query_url
380
380
  self.maxDiff = None
381
+
381
382
  self.assertEqual(
382
383
  url,
383
- "http://localhost:8080/Plone/@events?"
384
- "selected_agendas={}&"
384
+ "http://localhost:8080/Plone/@events?selected_agendas={}&"
385
+ "metadata_fields=title_nl&"
386
+ "metadata_fields=title_en&"
387
+ "metadata_fields=title_de&"
388
+ "metadata_fields=title_fr&"
389
+ "metadata_fields=description&"
390
+ "metadata_fields=description_nl&"
391
+ "metadata_fields=description_en&"
392
+ "metadata_fields=description_de&"
393
+ "metadata_fields=description_fr&"
394
+ "metadata_fields=latitude&"
395
+ "metadata_fields=longitude&"
396
+ "metadata_fields=city&"
397
+ "metadata_fields=number&"
398
+ "metadata_fields=street&"
399
+ "metadata_fields=zipcode&"
400
+ "metadata_fields=complement&"
401
+ "metadata_fields=country&"
402
+ "metadata_fields=contact_name&"
403
+ "metadata_fields=contact_phone&"
404
+ "metadata_fields=contact_email&"
405
+ "metadata_fields=event_type&"
406
+ "metadata_fields=event_url&"
407
+ "metadata_fields=video_url&"
408
+ "metadata_fields=facebook&"
409
+ "metadata_fields=instagram&"
410
+ "metadata_fields=twitter&"
411
+ "metadata_fields=free_entry&"
412
+ "metadata_fields=online_participation&"
413
+ "metadata_fields=open_end&"
414
+ "metadata_fields=topics&"
385
415
  "metadata_fields=category&"
386
416
  "metadata_fields=local_category&"
387
- "metadata_fields=container_uid&"
388
- "metadata_fields=topics&"
417
+ "metadata_fields=iam&"
418
+ "metadata_fields=usefull_container_id&"
419
+ "metadata_fields=usefull_container_title&"
420
+ "metadata_fields=whole_day&"
421
+ "metadata_fields=created&"
422
+ "metadata_fields=effective&"
423
+ "metadata_fields=modified&"
389
424
  "metadata_fields=start&"
390
425
  "metadata_fields=end&"
426
+ "metadata_fields=first_end&"
427
+ "metadata_fields=first_start&"
428
+ "metadata_fields=expires&"
429
+ "metadata_fields=exclude_from_nav&"
430
+ "metadata_fields=container_uid&"
431
+ "metadata_fields=image_caption&"
391
432
  "metadata_fields=has_leadimage&"
392
433
  "metadata_fields=UID&"
434
+ "metadata_fields=language&"
393
435
  "sort_on=event_dates&"
394
- "fullobjects=1&"
436
+ "fullobjects=0&"
395
437
  "b_size=20&"
396
438
  "event_type=event-driven&"
397
439
  "translated_in_en=1".format(self.rest_events.selected_agenda),
@@ -31,7 +31,7 @@ class OgpTagsViewlet(HeaderViewlet):
31
31
 
32
32
  def set_ogp_informations_for_view(self):
33
33
  self._item = {
34
- "title": self.context.Title,
34
+ "title": self.context.Title(),
35
35
  "description": self.context.description,
36
36
  "url": self.context.absolute_url(),
37
37
  }
@@ -68,24 +68,15 @@ class OgpTagsViewlet(HeaderViewlet):
68
68
  if IDirectoryView.providedBy(self.context):
69
69
  params = "fullobjects=1"
70
70
  auth_source_url = DIRECTORY_URL
71
- client_id = os.environ.get("RESTAPI_DIRECTORY_CLIENT_ID")
72
- client_secret = os.environ.get("RESTAPI_DIRECTORY_CLIENT_SECRET")
73
71
  elif IEventsView.providedBy(self.context):
74
72
  params = "metadata_fields=category&metadata_fields=local_category&metadata_fields=container_uid&metadata_fields=topics&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=UID&fullobjects=1"
75
73
  auth_source_url = EVENTS_URL
76
74
  endpoint = "@events"
77
- client_id = os.environ.get("RESTAPI_EVENTS_CLIENT_ID")
78
- client_secret = os.environ.get("RESTAPI_EVENTS_CLIENT_SECRET")
79
75
  elif INewsView.providedBy(self.context):
80
76
  params = "fullobjects=1"
81
77
  auth_source_url = NEWS_URL
82
- client_id = os.environ.get("RESTAPI_NEWS_CLIENT_ID")
83
- client_secret = os.environ.get("RESTAPI_NEWS_CLIENT_SECRET")
84
- auth = get_wca_token(client_id, client_secret)
85
- if not auth:
86
- return
87
78
  auth_source_url = f"{auth_source_url}/{endpoint}?UID={uid}&{params}"
88
- result_json = get_json(auth_source_url, auth=auth)
79
+ result_json = get_json(auth_source_url)
89
80
  if result_json:
90
81
  self._item = result_json["items"][0]
91
82
  self._set_image()
@@ -118,7 +109,10 @@ class OgpTagsViewlet(HeaderViewlet):
118
109
  def description(self):
119
110
  if not self._item:
120
111
  return ""
121
- return self._item.get("description", "")
112
+ subtitle = self._item.get("subtitle", "")
113
+ description = self._item.get("description", "")
114
+ result = " - ".join(filter(None, [subtitle, description]))
115
+ return result
122
116
 
123
117
  @property
124
118
  def url(self):