imio.smartweb.core 1.2.65__py3-none-any.whl → 1.2.67__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.
- imio/smartweb/core/browser/controlpanel.py +41 -0
- imio/smartweb/core/browser/faceted/block_view.pt +4 -4
- imio/smartweb/core/browser/faceted/summary_view.pt +4 -4
- imio/smartweb/core/browser/static/smartweb-view-compiled.css +1 -1
- imio/smartweb/core/browser/static/src/view.less +4 -0
- imio/smartweb/core/contents/__init__.py +2 -0
- imio/smartweb/core/contents/configure.zcml +1 -0
- imio/smartweb/core/contents/folder/block_view.pt +8 -8
- imio/smartweb/core/contents/folder/summary_view.pt +4 -4
- imio/smartweb/core/contents/publication/__init__.py +0 -0
- imio/smartweb/core/contents/publication/configure.zcml +5 -0
- imio/smartweb/core/contents/publication/content.py +23 -0
- imio/smartweb/core/contents/rest/directory/view.pt +2 -1
- imio/smartweb/core/contents/rest/events/view.pt +2 -1
- imio/smartweb/core/contents/rest/news/view.pt +2 -1
- imio/smartweb/core/contents/rest/view.py +4 -0
- imio/smartweb/core/contents/sections/common_templates/table.pt +13 -3
- imio/smartweb/core/contents/sections/external_content/view.pt +1 -1
- imio/smartweb/core/contents/sections/files/content.py +7 -1
- imio/smartweb/core/contents/sections/files/view.py +38 -11
- imio/smartweb/core/contents/sections/views.py +19 -6
- imio/smartweb/core/profiles/default/metadata.xml +1 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.Publication.xml +38 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionFiles.xml +1 -0
- imio/smartweb/core/profiles/default/types.xml +1 -0
- imio/smartweb/core/subscribers.py +24 -0
- imio/smartweb/core/subscribers.zcml +4 -0
- imio/smartweb/core/tests/resources/json_iadeliberations_institutions.json +60 -0
- imio/smartweb/core/tests/resources/json_iadeliberations_publication.json +105 -0
- imio/smartweb/core/tests/resources/json_iadeliberations_publications.json +270 -0
- imio/smartweb/core/tests/test_iadeliberations.py +136 -0
- imio/smartweb/core/tests/test_vocabularies.py +54 -0
- imio/smartweb/core/upgrades/configure.zcml +37 -1
- imio/smartweb/core/upgrades/profiles/1059_to_1060/registry/iadeliberation.xml +9 -0
- imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.Publication.xml +38 -0
- imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.SectionFiles.xml +11 -0
- imio/smartweb/core/upgrades/profiles/1060_to_1061/types.xml +4 -0
- imio/smartweb/core/upgrades/profiles/1060_to_1061/workflows.xml +6 -0
- imio/smartweb/core/utils.py +27 -0
- imio/smartweb/core/vocabularies.py +44 -0
- imio/smartweb/core/vocabularies.zcml +12 -0
- imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
- imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/{324.smartweb-webcomponents-compiled.js → 828.smartweb-webcomponents-compiled.js} +2 -2
- imio/smartweb/core/webcomponents/build/js/884.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.jsx +12 -2
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactCard/ContactCard.jsx +88 -60
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +27 -1
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactList/ContactList.jsx +6 -2
- imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +69 -39
- imio/smartweb/core/webcomponents/src/components/Events/EventContent/EventContent.jsx +30 -3
- imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +10 -7
- imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +4 -2
- imio/smartweb/core/webcomponents/src/components/News/News.jsx +3 -0
- imio/smartweb/core/webcomponents/src/components/News/NewsCard/NewsCard.jsx +60 -48
- imio/smartweb/core/webcomponents/src/components/News/NewsContent/NewsContent.jsx +30 -3
- imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +28 -7
- imio/smartweb/core/webcomponents/src/index.scss +188 -174
- {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/METADATA +27 -1
- {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/RECORD +70 -57
- /imio/smartweb/core/webcomponents/build/js/{324.smartweb-webcomponents-compiled.js.LICENSE.txt → 828.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
- /imio.smartweb.core-1.2.65-py3.10-nspkg.pth → /imio.smartweb.core-1.2.67-py3.10-nspkg.pth +0 -0
- {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/LICENSE.GPL +0 -0
- {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/LICENSE.rst +0 -0
- {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/WHEEL +0 -0
- {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/namespace_packages.txt +0 -0
- {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/top_level.txt +0 -0
@@ -3,6 +3,7 @@
|
|
3
3
|
from collective.z3cform.datagridfield.datagridfield import DataGridFieldFactory
|
4
4
|
from collective.z3cform.datagridfield.registry import DictRow
|
5
5
|
from imio.smartweb.locales import SmartwebMessageFactory as _
|
6
|
+
from plone import api
|
6
7
|
from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper
|
7
8
|
from plone.app.registry.browser.controlpanel import RegistryEditForm
|
8
9
|
from plone.autoform import directives
|
@@ -165,12 +166,52 @@ class ISmartwebControlPanel(Interface):
|
|
165
166
|
required=False,
|
166
167
|
)
|
167
168
|
|
169
|
+
iadeliberations_url = schema.TextLine(
|
170
|
+
title=_("I.A. Deliberations' url"),
|
171
|
+
description=_(
|
172
|
+
"For staging : https://conseil.staging.imio.be | for production : https://www.deliberations.be"
|
173
|
+
),
|
174
|
+
required=False,
|
175
|
+
)
|
176
|
+
|
177
|
+
iadeliberations_api_username = schema.TextLine(
|
178
|
+
title=_("Username to consume I.A. Deliberations API"),
|
179
|
+
required=False,
|
180
|
+
)
|
181
|
+
|
182
|
+
iadeliberation_api_password = schema.Password(
|
183
|
+
title=_("Password to consume I.A. Deliberations API"),
|
184
|
+
required=False,
|
185
|
+
)
|
186
|
+
|
187
|
+
iadeliberations_institution = schema.Choice(
|
188
|
+
title=_("I.A. Deliberations : Institutions"),
|
189
|
+
source="imio.smartweb.vocabulary.IADeliberationsInstitutions",
|
190
|
+
required=False,
|
191
|
+
)
|
192
|
+
|
168
193
|
|
169
194
|
class SmartwebControlPanelForm(RegistryEditForm):
|
170
195
|
schema = ISmartwebControlPanel
|
171
196
|
schema_prefix = "smartweb"
|
172
197
|
label = _("Smartweb Settings")
|
173
198
|
|
199
|
+
def applyChanges(self, data):
|
200
|
+
# Get current registry value for (controlpanel) passwords
|
201
|
+
iadeliberation_pwd = api.portal.get_registry_record(
|
202
|
+
"smartweb.iadeliberation_api_password"
|
203
|
+
)
|
204
|
+
secret_key_api = api.portal.get_registry_record("smartweb.secret_key_api")
|
205
|
+
|
206
|
+
# if data is None when we apply changes for password fields we keep password from registry
|
207
|
+
if not data.get("iadeliberation_api_password"):
|
208
|
+
data["iadeliberation_api_password"] = iadeliberation_pwd
|
209
|
+
|
210
|
+
if not data.get("secret_key_api"):
|
211
|
+
data["secret_key_api"] = secret_key_api
|
212
|
+
|
213
|
+
return super().applyChanges(data)
|
214
|
+
|
174
215
|
|
175
216
|
SmartwebControlPanelView = layout.wrap_form(
|
176
217
|
SmartwebControlPanelForm, ControlPanelFormWrapper
|
@@ -22,12 +22,12 @@
|
|
22
22
|
orientation_class python:images_orientation and f'display-{images_orientation}' or '';
|
23
23
|
thumb_scale faceted_view/get_thumb_scale_summary">
|
24
24
|
|
25
|
-
<
|
25
|
+
<ul class="" id="block-menu"
|
26
26
|
tal:attributes="class string:row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-xl-4 g-4 ${orientation_class}">
|
27
|
-
<
|
27
|
+
<li class="block-menu-element col" tal:repeat="item batch">
|
28
28
|
<metal:macro use-macro="context/@@faceted-macros/block" />
|
29
|
-
</
|
30
|
-
</
|
29
|
+
</li>
|
30
|
+
</ul>
|
31
31
|
|
32
32
|
</tal:def>
|
33
33
|
|
@@ -22,12 +22,12 @@
|
|
22
22
|
orientation_class python:images_orientation and f'display-{images_orientation}' or '';
|
23
23
|
thumb_scale faceted_view/get_thumb_scale_list">
|
24
24
|
|
25
|
-
<
|
25
|
+
<ul class="" id="block-menu"
|
26
26
|
tal:attributes="class string:row ${orientation_class}">
|
27
|
-
<
|
27
|
+
<li class="list-menu-element col-12" tal:repeat="item batch">
|
28
28
|
<metal:macro use-macro="context/@@faceted-macros/summary" />
|
29
|
-
</
|
30
|
-
</
|
29
|
+
</li>
|
30
|
+
</ul>
|
31
31
|
|
32
32
|
</tal:def>
|
33
33
|
|
@@ -1 +1 @@
|
|
1
|
-
*{background-position:50%;background-size:cover}body,html{max-width:100%}body{overflow-x:hidden}.table_schedule--active{display:block!important}.card-img-top{padding-top:56.25%}.template-folder_contents table .actionmenu a.action.set-default-page{display:none}#banner{background-size:cover;grid-column-end:-1;grid-column-start:1;height:200px}.hidden-banner{height:55px!important}.pat-structure .pagination>.active>a{z-index:0}.carousel-image{padding-bottom:50%}.swiper-slide .swiper-image{padding-bottom:60%}.swiper-wrapper{padding-bottom:50px}.template-taxonomy-edit-data .taxonomy-tree{border:0 solid #fff}.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_item{border:none;font-size:1.25rem;padding:0 0 1rem;text-transform:uppercase}.template-taxonomy-edit-data .super-text{display:none}.template-taxonomy-edit-data .editable-divs{display:none!important}.template-taxonomy-edit-data div.info .super-text+.editable-divs:nth-child(2),.template-taxonomy-edit-data span .super-text+.editable-divs:nth-child(2){display:inline!important}.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.info,.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_item{border-bottom:2px solid #555}.template-taxonomy-edit-data .info,.template-taxonomy-edit-data .tree-view_item{border-bottom:1px dashed #d2d2d2}.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.info input,.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_item input{color:#303030;padding-top:.5rem!important;text-shadow:0 1px 0 #303030}.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.info:before,.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.tree-view>.tree-view_item:before{content:"⤷";float:left;font-weight:700;margin-top:.3rem}.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.info:before,.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.tree-view>.tree-view_item:before{content:"•";float:left;font-size:1.5rem;font-weight:700;margin-top:1px}.template-taxonomy-edit-data .taxonomy-tree .tree-view_arrow{display:none}.template-taxonomy-edit-data .taxonomy-tree .tree-view_children{margin-left:2rem}.smartweb_herobanner .section-slide,.smartweb_herobanner .section-slide .swiper-banner-image{height:100%}#portal-globalnav-collapse .nav_index_html,#subsite-navigation .nav_index_html{display:none}
|
1
|
+
*{background-position:50%;background-size:cover}body,html{max-width:100%}body{overflow-x:hidden}.table_schedule--active{display:block!important}.card-img-top{padding-top:56.25%}.template-folder_contents table .actionmenu a.action.set-default-page{display:none}#banner{background-size:cover;grid-column-end:-1;grid-column-start:1;height:200px}.hidden-banner{height:55px!important}.pat-structure .pagination>.active>a{z-index:0}.carousel-image{padding-bottom:50%}.swiper-slide .swiper-image{padding-bottom:60%}.swiper-wrapper{padding-bottom:50px}.template-taxonomy-edit-data .taxonomy-tree{border:0 solid #fff}.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_item{border:none;font-size:1.25rem;padding:0 0 1rem;text-transform:uppercase}.template-taxonomy-edit-data .super-text{display:none}.template-taxonomy-edit-data .editable-divs{display:none!important}.template-taxonomy-edit-data div.info .super-text+.editable-divs:nth-child(2),.template-taxonomy-edit-data span .super-text+.editable-divs:nth-child(2){display:inline!important}.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.info,.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_item{border-bottom:2px solid #555}.template-taxonomy-edit-data .info,.template-taxonomy-edit-data .tree-view_item{border-bottom:1px dashed #d2d2d2}.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.info input,.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_item input{color:#303030;padding-top:.5rem!important;text-shadow:0 1px 0 #303030}.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.info:before,.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.tree-view>.tree-view_item:before{content:"⤷";float:left;font-weight:700;margin-top:.3rem}.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.info:before,.template-taxonomy-edit-data .taxonomy-tree>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.tree-view>.tree-view_children>.tree-view>.tree-view_item:before{content:"•";float:left;font-size:1.5rem;font-weight:700;margin-top:1px}.template-taxonomy-edit-data .taxonomy-tree .tree-view_arrow{display:none}.template-taxonomy-edit-data .taxonomy-tree .tree-view_children{margin-left:2rem}.smartweb_herobanner .section-slide,.smartweb_herobanner .section-slide .swiper-banner-image{height:100%}#portal-globalnav-collapse .nav_index_html,#subsite-navigation .nav_index_html{display:none}.block-menu-element,.list-menu-element{list-style:none}
|
@@ -17,6 +17,8 @@ from .pages.portal_page.content import IPortalPage # NOQA
|
|
17
17
|
from .pages.portal_page.content import PortalPage # NOQA
|
18
18
|
from .pages.procedure.content import IProcedure # NOQA
|
19
19
|
from .pages.procedure.content import Procedure # NOQA
|
20
|
+
from .publication.content import Publication # NOQA
|
21
|
+
from .publication.content import IPublication # NOQA
|
20
22
|
from .rest.base import RestView # NOQA
|
21
23
|
from .rest.base import IRestView # NOQA
|
22
24
|
from .rest.directory.content import DirectoryView # NOQA
|
@@ -15,18 +15,18 @@
|
|
15
15
|
orientation_class python:images_orientation and f'display-{images_orientation}' or '';
|
16
16
|
thumb_scale view/get_thumb_scale_summary">
|
17
17
|
|
18
|
-
<
|
18
|
+
<ul class="" id="block-menu"
|
19
19
|
tal:attributes="class string:row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-xl-4 g-4 ${orientation_class}">
|
20
|
-
<
|
20
|
+
<li class="block-menu-element col" tal:repeat="item res/results">
|
21
21
|
<metal:macro use-macro="context/@@folder_macros/block" />
|
22
|
-
</
|
23
|
-
</
|
24
|
-
<
|
22
|
+
</li>
|
23
|
+
</ul>
|
24
|
+
<ul class="" id="block-quickaccess"
|
25
25
|
tal:attributes="class string:row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-xl-4 g-4 ${orientation_class}">
|
26
|
-
<
|
26
|
+
<li class="block-menu-element col" tal:repeat="item res/quick_access">
|
27
27
|
<metal:macro use-macro="context/@@folder_macros/block" />
|
28
|
-
</
|
29
|
-
</
|
28
|
+
</li>
|
29
|
+
</ul>
|
30
30
|
</tal:def>
|
31
31
|
</metal:content-core>
|
32
32
|
</metal:main>
|
@@ -17,12 +17,12 @@
|
|
17
17
|
images_orientation context/orientation | nothing;
|
18
18
|
orientation_class python:images_orientation and f'display-{images_orientation}' or ''">
|
19
19
|
|
20
|
-
<
|
20
|
+
<ul class="" id="block-menu"
|
21
21
|
tal:attributes="class string:row ${orientation_class}">
|
22
|
-
<
|
22
|
+
<li class="list-menu-element col-12" tal:repeat="item batch">
|
23
23
|
<metal:macro use-macro="context/@@folder_macros/summary" />
|
24
|
-
</
|
25
|
-
</
|
24
|
+
</li>
|
25
|
+
</ul>
|
26
26
|
|
27
27
|
</tal:def>
|
28
28
|
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
from imio.smartweb.locales import SmartwebMessageFactory as _
|
4
|
+
from plone.dexterity.content import Item
|
5
|
+
from zope import schema
|
6
|
+
from zope.interface import implementer
|
7
|
+
from zope.interface import Interface
|
8
|
+
|
9
|
+
|
10
|
+
class IPublication(Interface):
|
11
|
+
""" """
|
12
|
+
|
13
|
+
linked_publication = schema.Choice(
|
14
|
+
vocabulary="imio.smartweb.vocabulary.IADeliberationsPublications",
|
15
|
+
title=_("I.A. Deliberation publication"),
|
16
|
+
required=True,
|
17
|
+
default=None,
|
18
|
+
)
|
19
|
+
|
20
|
+
|
21
|
+
@implementer(IPublication)
|
22
|
+
class Publication(Item):
|
23
|
+
"""Publication class"""
|
@@ -11,7 +11,8 @@
|
|
11
11
|
orientation view/orientation;
|
12
12
|
current-language view/current_language;
|
13
13
|
display-map view/display_map;
|
14
|
-
view-path view/view_path;
|
14
|
+
view-path view/view_path;
|
15
|
+
context-authenticated-user view/context_authenticated_user;"></smartweb-annuaire>
|
15
16
|
</div>
|
16
17
|
</metal:main>
|
17
18
|
</body>
|
@@ -15,7 +15,8 @@
|
|
15
15
|
only-past-events view/only_past_events;
|
16
16
|
view-path view/view_path;
|
17
17
|
display_agendas_titles view/display_agendas_titles;
|
18
|
-
show-categories-or-topics view/show_categories_or_topics;
|
18
|
+
show-categories-or-topics view/show_categories_or_topics;
|
19
|
+
context-authenticated-user view/context_authenticated_user;"></smartweb-events>
|
19
20
|
</div>
|
20
21
|
</metal:main>
|
21
22
|
</body>
|
@@ -13,7 +13,8 @@
|
|
13
13
|
current-language view/current_language;
|
14
14
|
view-path view/view_path;
|
15
15
|
display_newsfolders_titles view/display_newsfolders_titles;
|
16
|
-
show-categories-or-topics view/show_categories_or_topics;
|
16
|
+
show-categories-or-topics view/show_categories_or_topics;
|
17
|
+
context-authenticated-user view/context_authenticated_user;"></smartweb-news>
|
17
18
|
</div>
|
18
19
|
</metal:main>
|
19
20
|
</body>
|
@@ -31,6 +31,10 @@ class BaseRestView(BrowserView):
|
|
31
31
|
def current_language(self):
|
32
32
|
return api.portal.get_current_language()[:2]
|
33
33
|
|
34
|
+
@property
|
35
|
+
def context_authenticated_user(self):
|
36
|
+
return api.user.is_anonymous()
|
37
|
+
|
34
38
|
@property
|
35
39
|
def view_path(self):
|
36
40
|
url = self.context.absolute_url()
|
@@ -56,10 +56,10 @@
|
|
56
56
|
show_lead_image python:getattr(context, 'show_items_lead_image', True);
|
57
57
|
portal context/@@plone_portal_state/portal;
|
58
58
|
open_in_new_tab item/open_in_new_tab | nothing;"
|
59
|
-
tal:attributes="class string:table_display ${item/container_id | nothing};"
|
59
|
+
tal:attributes="class string:table_display ${item/container_id | nothing} ${item/smartweb_type | nothing};"
|
60
60
|
>
|
61
61
|
<a tal:attributes="class python:'table_image no-image' if no_icon_no_image else 'table_image';
|
62
|
-
href item
|
62
|
+
href python:view.retrieve_item_url(item);
|
63
63
|
target python:'_blank' if (open_in_new_tab and not can_edit_sections) else '';">
|
64
64
|
<tal:if tal:condition="show_lead_image">
|
65
65
|
<div class="image d-block is-icon w-100"
|
@@ -85,7 +85,7 @@
|
|
85
85
|
</div>
|
86
86
|
|
87
87
|
<div class="table_date"
|
88
|
-
tal:condition="context/show_items_date | nothing">
|
88
|
+
tal:condition="context/show_items_date | context/has_publications | nothing">
|
89
89
|
<tal:if tal:condition="item/effective | nothing">
|
90
90
|
<span i18n:translate="">Published</span>
|
91
91
|
<span class="pat-display-time"
|
@@ -97,6 +97,9 @@
|
|
97
97
|
<metal:macro use-macro="context/@@macros/event_date" />
|
98
98
|
</tal:def>
|
99
99
|
</tal:if>
|
100
|
+
<tal:if tal:condition="item/publication_datetime | nothing">
|
101
|
+
<span class="publication_datetime" tal:content="python:view.datetime_format(item,'publication_datetime')"/>
|
102
|
+
</tal:if>
|
100
103
|
</div>
|
101
104
|
<div tal:condition="view/display_container_title"
|
102
105
|
class="auth_source_container_title"
|
@@ -115,6 +118,13 @@
|
|
115
118
|
tal:condition="item/item_infos | nothing"
|
116
119
|
tal:content="item/item_infos"/>
|
117
120
|
</a>
|
121
|
+
<!-- publication : attached file-->
|
122
|
+
<a
|
123
|
+
tal:condition="item/publication_attached_file | nothing"
|
124
|
+
tal:attributes="href item/publication_attached_file/download"
|
125
|
+
tal:content="item/publication_attached_file/filename"
|
126
|
+
target="_blank" ></a>
|
127
|
+
|
118
128
|
</div>
|
119
129
|
</li>
|
120
130
|
|
@@ -27,7 +27,7 @@
|
|
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
|
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
|
|
@@ -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,8 +1,9 @@
|
|
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
|
6
7
|
from zope.component import queryMultiAdapter
|
7
8
|
|
8
9
|
|
@@ -12,7 +13,7 @@ class FilesView(CarouselOrTableSectionView):
|
|
12
13
|
def items(self):
|
13
14
|
orientation = self.context.orientation
|
14
15
|
image_scale = self.image_scale
|
15
|
-
items = self.
|
16
|
+
items = super(FilesView, self).items()
|
16
17
|
results = []
|
17
18
|
for item in items:
|
18
19
|
url = item.absolute_url()
|
@@ -21,14 +22,40 @@ class FilesView(CarouselOrTableSectionView):
|
|
21
22
|
scale_url = get_scale_url(
|
22
23
|
item, self.request, "image", image_scale, orientation
|
23
24
|
)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
dict_item = {
|
26
|
+
"title": item.title,
|
27
|
+
"description": item.description,
|
28
|
+
"smartweb_type": item.smartweb_type,
|
29
|
+
"url": url,
|
30
|
+
"image": scale_url,
|
31
|
+
"has_image": has_image,
|
32
|
+
}
|
33
|
+
dict_item["item_infos"] = (
|
34
|
+
None if file_view is None else file_view.human_readable_size()
|
33
35
|
)
|
36
|
+
if IPublication.providedBy(item):
|
37
|
+
extra_properties = [
|
38
|
+
"linked_publication",
|
39
|
+
"publication_datetime",
|
40
|
+
"publication_url",
|
41
|
+
"publication_document_type",
|
42
|
+
"publication_attached_file",
|
43
|
+
]
|
44
|
+
dict_item = self.get_publication_extra_properties(
|
45
|
+
item, dict_item, extra_properties
|
46
|
+
)
|
47
|
+
|
48
|
+
results.append(dict_item)
|
34
49
|
return batch_results(results, self.context.nb_results_by_batch)
|
50
|
+
|
51
|
+
def retrieve_item_url(self, item):
|
52
|
+
if item.get("publication_url", None) is not None and api.user.is_anonymous():
|
53
|
+
# return "real" publication url in iadeliberation
|
54
|
+
return item.get("publication_url")
|
55
|
+
# return smartweb item url
|
56
|
+
return item.get("url")
|
57
|
+
|
58
|
+
def get_publication_extra_properties(self, item, dict_item, extra_properties):
|
59
|
+
for prop in extra_properties:
|
60
|
+
dict_item[prop] = getattr(item, prop, None)
|
61
|
+
return dict_item
|
@@ -103,6 +103,16 @@ class SectionView(BrowserView):
|
|
103
103
|
class CarouselOrTableSectionView(SectionView):
|
104
104
|
"""Section view that can display a carousel"""
|
105
105
|
|
106
|
+
def items(self):
|
107
|
+
items = self.context.listFolderContents()
|
108
|
+
for item in items:
|
109
|
+
item.smartweb_type = "Item"
|
110
|
+
item.container_id = ""
|
111
|
+
portal_type = getattr(item, "portal_type", None)
|
112
|
+
if portal_type:
|
113
|
+
item.smartweb_type = portal_type.split(".")[-1]
|
114
|
+
return items
|
115
|
+
|
106
116
|
@property
|
107
117
|
def image_scale(self):
|
108
118
|
layout = self.context.getLayout()
|
@@ -114,25 +124,28 @@ class CarouselOrTableSectionView(SectionView):
|
|
114
124
|
else:
|
115
125
|
return getattr(self.context, "image_scale", "")
|
116
126
|
|
117
|
-
def datetime_format(self, item):
|
127
|
+
def datetime_format(self, item, datetime_field="effective"):
|
118
128
|
"""
|
119
129
|
item.get("effective", None)
|
120
130
|
=> DateTime('YYYY/MM/DD HH:mm:ss.000000 GMT+1')
|
121
131
|
convert to more conventional datetime format
|
122
132
|
and return its string representation
|
123
133
|
"""
|
124
|
-
|
125
|
-
if
|
134
|
+
datetime_field = item.get(datetime_field, None)
|
135
|
+
if datetime_field is None:
|
126
136
|
return ""
|
127
137
|
target_timezone = pytz.timezone("Europe/Paris")
|
128
|
-
if isinstance(
|
129
|
-
return
|
130
|
-
dt =
|
138
|
+
if isinstance(datetime_field, str):
|
139
|
+
return datetime_field
|
140
|
+
dt = datetime_field.asdatetime()
|
131
141
|
target_datetime = dt.astimezone(target_timezone)
|
132
142
|
output_format = "%Y-%m-%dT%H:%M:%S%z"
|
133
143
|
formatted_datetime_str = target_datetime.strftime(output_format)
|
134
144
|
return formatted_datetime_str
|
135
145
|
|
146
|
+
def retrieve_item_url(self, item):
|
147
|
+
return item.get("url")
|
148
|
+
|
136
149
|
|
137
150
|
class HashableJsonSectionView(SectionView):
|
138
151
|
json_data = None
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
3
|
+
name="imio.smartweb.Publication"
|
4
|
+
meta_type="Dexterity FTI"
|
5
|
+
i18n:domain="imio.smartweb">
|
6
|
+
|
7
|
+
<!-- Basic properties -->
|
8
|
+
<property
|
9
|
+
i18n:translate=""
|
10
|
+
name="title">Publication</property>
|
11
|
+
<property
|
12
|
+
i18n:translate=""
|
13
|
+
name="description">IA.Deliberations : Publication</property>
|
14
|
+
|
15
|
+
<property name="icon_expr">string:bounding-box-circles</property>
|
16
|
+
|
17
|
+
<!-- Hierarchy control -->
|
18
|
+
<property name="global_allow">False</property>
|
19
|
+
|
20
|
+
<!-- Schema, class and security -->
|
21
|
+
<!-- if we can add a page, we can add a page section -->
|
22
|
+
<property name="add_permission">imio.smartweb.core.AddPage</property>
|
23
|
+
<property name="klass">imio.smartweb.core.contents.Publication</property>
|
24
|
+
<property name="schema">imio.smartweb.core.contents.IPublication</property>
|
25
|
+
|
26
|
+
<!-- Enabled behaviors -->
|
27
|
+
<property name="behaviors" purge="false">
|
28
|
+
<element value="plone.shortname"/>
|
29
|
+
<element value="plone.leadimage"/>
|
30
|
+
<element value="solr.fields" />
|
31
|
+
</property>
|
32
|
+
|
33
|
+
<!-- View information -->
|
34
|
+
<property name="default_view">view</property>
|
35
|
+
<property name="default_view_fallback">False</property>
|
36
|
+
<property name="immediate_view">view</property>
|
37
|
+
|
38
|
+
</object>
|
@@ -19,6 +19,7 @@
|
|
19
19
|
<property name="filter_content_types">True</property>
|
20
20
|
<property name="allowed_content_types">
|
21
21
|
<element value="File" />
|
22
|
+
<element value="imio.smartweb.Publication" />
|
22
23
|
</property>
|
23
24
|
<!-- Schema, class and security -->
|
24
25
|
<!-- if we can add a page, we can add a page section -->
|
@@ -11,6 +11,7 @@
|
|
11
11
|
<object meta_type="Dexterity FTI" name="imio.smartweb.Page"/>
|
12
12
|
<object meta_type="Dexterity FTI" name="imio.smartweb.PortalPage"/>
|
13
13
|
<object meta_type="Dexterity FTI" name="imio.smartweb.Procedure"/>
|
14
|
+
<object meta_type="Dexterity FTI" name="imio.smartweb.Publication"/>
|
14
15
|
<object meta_type="Dexterity FTI" name="imio.smartweb.SectionCollection"/>
|
15
16
|
<object meta_type="Dexterity FTI" name="imio.smartweb.SectionContact"/>
|
16
17
|
<object meta_type="Dexterity FTI" name="imio.smartweb.SectionEvents"/>
|
@@ -4,6 +4,8 @@ from imio.smartweb.common.faceted.utils import configure_faceted
|
|
4
4
|
from imio.smartweb.common.utils import is_log_active
|
5
5
|
from imio.smartweb.common.utils import remove_cropping
|
6
6
|
from imio.smartweb.core.behaviors.minisite import IImioSmartwebMinisite
|
7
|
+
from imio.smartweb.core.utils import get_iadeliberation_institution_from_registry
|
8
|
+
from imio.smartweb.core.utils import get_iadeliberation_json
|
7
9
|
from imio.smartweb.core.utils import safe_html
|
8
10
|
from imio.smartweb.locales import SmartwebMessageFactory as _
|
9
11
|
from plone import api
|
@@ -106,3 +108,25 @@ def modified_content(obj, event):
|
|
106
108
|
class_name = d.interface.__identifier__.split(".")[-1]
|
107
109
|
for field_name in d.attributes:
|
108
110
|
check_image_field(obj, d.interface, class_name, field_name)
|
111
|
+
|
112
|
+
|
113
|
+
def added_publication(obj, event):
|
114
|
+
"""save json attributes on object attributes"""
|
115
|
+
# query the deliberation API with the
|
116
|
+
# selected publication UID to retrieve all informations
|
117
|
+
iadeliberation_institution = get_iadeliberation_institution_from_registry()
|
118
|
+
url = f"{iadeliberation_institution}/publications/{obj.linked_publication}?fullobjects=y"
|
119
|
+
try:
|
120
|
+
json_publication = get_iadeliberation_json(url)
|
121
|
+
obj.title = json_publication.get("title")
|
122
|
+
obj.description = json_publication.get("description")
|
123
|
+
obj.publication_uid = json_publication.get("UID")
|
124
|
+
obj.publication_url = json_publication.get("@id")
|
125
|
+
obj.publication_datetime = json_publication.get("effective")
|
126
|
+
obj.publication_document_type = json_publication.get("document_type").get(
|
127
|
+
"title"
|
128
|
+
)
|
129
|
+
obj.publication_category = json_publication.get("category").get("title")
|
130
|
+
obj.publication_attached_file = json_publication.get("file")
|
131
|
+
except Exception:
|
132
|
+
logger.error(f"Error while trying to get publication data from {url}")
|
@@ -21,4 +21,8 @@
|
|
21
21
|
zope.lifecycleevent.interfaces.IObjectModifiedEvent"
|
22
22
|
handler=".subscribers.modified_content" />
|
23
23
|
|
24
|
+
<subscriber for="imio.smartweb.core.contents.IPublication
|
25
|
+
zope.lifecycleevent.interfaces.IObjectAddedEvent"
|
26
|
+
handler=".subscribers.added_publication" />
|
27
|
+
|
24
28
|
</configure>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
{
|
2
|
+
"@id": "https://conseil.staging.imio.be/@search?portal_type=Institution&metadata_fields=UID",
|
3
|
+
"batching": {
|
4
|
+
"@id": "https://conseil.staging.imio.be/@search?portal_type=Institution&metadata_fields=UID",
|
5
|
+
"first": "https://conseil.staging.imio.be/@search?b_start=0&portal_type=Institution&metadata_fields=UID",
|
6
|
+
"last": "https://conseil.staging.imio.be/@search?b_start=150&portal_type=Institution&metadata_fields=UID",
|
7
|
+
"next": "https://conseil.staging.imio.be/@search?b_start=25&portal_type=Institution&metadata_fields=UID"
|
8
|
+
},
|
9
|
+
"items": [
|
10
|
+
{
|
11
|
+
"@id": "https://conseil.staging.imio.be/quaregnon",
|
12
|
+
"@type": "Institution",
|
13
|
+
"UID": "8b7ee28aee6a4d17a796c198139bb477",
|
14
|
+
"description": "",
|
15
|
+
"review_state": "published",
|
16
|
+
"title": "Quaregnon"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"@id": "https://conseil.staging.imio.be/waremme",
|
20
|
+
"@type": "Institution",
|
21
|
+
"UID": "7a125baa06d844b4aaea97c73b9efddd",
|
22
|
+
"description": "",
|
23
|
+
"review_state": "published",
|
24
|
+
"title": "Waremme"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"@id": "https://conseil.staging.imio.be/jalhay",
|
28
|
+
"@type": "Institution",
|
29
|
+
"UID": "d04e1e724694450da535f57f0c0b0450",
|
30
|
+
"description": "",
|
31
|
+
"review_state": "published",
|
32
|
+
"title": "Jalhay"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"@id": "https://conseil.staging.imio.be/la-hulpe",
|
36
|
+
"@type": "Institution",
|
37
|
+
"UID": "970bb179557940d28a3751aa76e123c2",
|
38
|
+
"description": "",
|
39
|
+
"review_state": "published",
|
40
|
+
"title": "La Hulpe"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"@id": "https://conseil.staging.imio.be/ramillies",
|
44
|
+
"@type": "Institution",
|
45
|
+
"UID": "c85014aaec2d4b2a861911b8b6085b15",
|
46
|
+
"description": "",
|
47
|
+
"review_state": "published",
|
48
|
+
"title": "Ramillies"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"@id": "https://conseil.staging.imio.be/liege",
|
52
|
+
"@type": "Institution",
|
53
|
+
"UID": "970bb179557940d28a3751aa76edddd",
|
54
|
+
"description": "",
|
55
|
+
"review_state": "published",
|
56
|
+
"title": "Liège"
|
57
|
+
}
|
58
|
+
],
|
59
|
+
"items_total": 5
|
60
|
+
}
|