rer.pubblicazioni 3.0.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.
- rer/pubblicazioni/__init__.py +9 -0
- rer/pubblicazioni/browser/__init__.py +0 -0
- rer/pubblicazioni/browser/configure.zcml +48 -0
- rer/pubblicazioni/browser/interfaces.py +7 -0
- rer/pubblicazioni/browser/settings.py +36 -0
- rer/pubblicazioni/browser/templates/pubblicazione_view.pt +118 -0
- rer/pubblicazioni/browser/templates/pubblicazioni_collection_view.pt +110 -0
- rer/pubblicazioni/browser/utils_view.py +31 -0
- rer/pubblicazioni/browser/views.py +48 -0
- rer/pubblicazioni/configure.zcml +76 -0
- rer/pubblicazioni/indexers.py +73 -0
- rer/pubblicazioni/interfaces.py +112 -0
- rer/pubblicazioni/locales/it/LC_MESSAGES/rer.pubblicazioni.mo +0 -0
- rer/pubblicazioni/locales/it/LC_MESSAGES/rer.pubblicazioni.po +206 -0
- rer/pubblicazioni/locales/rer.pubblicazioni.pot +209 -0
- rer/pubblicazioni/locales/update.sh +12 -0
- rer/pubblicazioni/profiles/default/browserlayer.xml +7 -0
- rer/pubblicazioni/profiles/default/catalog.xml +20 -0
- rer/pubblicazioni/profiles/default/controlpanel.xml +20 -0
- rer/pubblicazioni/profiles/default/metadata.xml +6 -0
- rer/pubblicazioni/profiles/default/registry.xml +70 -0
- rer/pubblicazioni/profiles/default/types/Collection.xml +13 -0
- rer/pubblicazioni/profiles/default/types/Pubblicazione.xml +99 -0
- rer/pubblicazioni/profiles/default/types.xml +4 -0
- rer/pubblicazioni/profiles/uninstall/browserlayer.xml +7 -0
- rer/pubblicazioni/profiles/uninstall/registry.xml +3 -0
- rer/pubblicazioni/restapi/__init__.py +0 -0
- rer/pubblicazioni/restapi/configure.zcml +14 -0
- rer/pubblicazioni/restapi/controlpanel.py +16 -0
- rer/pubblicazioni/setuphandlers.py +23 -0
- rer/pubblicazioni/testing.py +49 -0
- rer/pubblicazioni/tests/__init__.py +0 -0
- rer/pubblicazioni/tests/robot/test_example.robot +66 -0
- rer/pubblicazioni/tests/robot/test_pubblicazione.robot +87 -0
- rer/pubblicazioni/tests/test_pubblicazione.py +45 -0
- rer/pubblicazioni/tests/test_robot.py +28 -0
- rer/pubblicazioni/tests/test_setup.py +55 -0
- rer/pubblicazioni/upgrades/__init__.py +0 -0
- rer/pubblicazioni/upgrades/configure.zcml +49 -0
- rer/pubblicazioni/upgrades/upgrades.py +164 -0
- rer/pubblicazioni/vocabularies.py +117 -0
- rer.pubblicazioni-3.0.2-py3.10-nspkg.pth +1 -0
- rer.pubblicazioni-3.0.2.dist-info/LICENSE.GPL +339 -0
- rer.pubblicazioni-3.0.2.dist-info/LICENSE.rst +15 -0
- rer.pubblicazioni-3.0.2.dist-info/METADATA +233 -0
- rer.pubblicazioni-3.0.2.dist-info/RECORD +50 -0
- rer.pubblicazioni-3.0.2.dist-info/WHEEL +5 -0
- rer.pubblicazioni-3.0.2.dist-info/entry_points.txt +2 -0
- rer.pubblicazioni-3.0.2.dist-info/namespace_packages.txt +1 -0
- rer.pubblicazioni-3.0.2.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<configure
|
|
2
|
+
xmlns="http://namespaces.zope.org/zope"
|
|
3
|
+
xmlns:browser="http://namespaces.zope.org/browser"
|
|
4
|
+
xmlns:plone="http://namespaces.plone.org/plone"
|
|
5
|
+
i18n_domain="rer.pubblicazioni">
|
|
6
|
+
|
|
7
|
+
<!-- Pannello di controllo -->
|
|
8
|
+
<browser:page
|
|
9
|
+
name="rer-pubblicazioni-settings"
|
|
10
|
+
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
|
|
11
|
+
class=".settings.RerPubblicazioniSettingsView"
|
|
12
|
+
permission="cmf.ManagePortal"
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
<!-- Vista di aiuto/supporto -->
|
|
16
|
+
<browser:page
|
|
17
|
+
for="*"
|
|
18
|
+
name="rer-pubblicazioni-utils-view"
|
|
19
|
+
class=".utils_view.RerPubblicazioniUtilsView"
|
|
20
|
+
allowed_interface="rer.pubblicazioni.browser.interfaces.IRerPubblicazioniUtilsView"
|
|
21
|
+
permission="zope2.View"
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<!-- vista per il tipo: Pubblicazione -->
|
|
25
|
+
<browser:page
|
|
26
|
+
name="view"
|
|
27
|
+
for="rer.pubblicazioni.interfaces.IPubblicazione"
|
|
28
|
+
class=".views.PubblicazioneView"
|
|
29
|
+
template="templates/pubblicazione_view.pt"
|
|
30
|
+
layer="rer.pubblicazioni.interfaces.IRerPubblicazioniLayer"
|
|
31
|
+
permission="zope2.View"
|
|
32
|
+
menu="plone_displayviews"
|
|
33
|
+
title="Pubblicazione - view"
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<browser:page
|
|
37
|
+
name="pubblicazioni_collection_view"
|
|
38
|
+
for="plone.app.contenttypes.interfaces.ICollection"
|
|
39
|
+
class=".views.PubblicazioniCollectionView"
|
|
40
|
+
template="templates/pubblicazioni_collection_view.pt"
|
|
41
|
+
layer="rer.pubblicazioni.interfaces.IRerPubblicazioniLayer"
|
|
42
|
+
permission="zope2.View"
|
|
43
|
+
menu="plone_displayviews"
|
|
44
|
+
title="Archivio pubblicazioni"
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
</configure>
|
|
48
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper
|
|
3
|
+
from plone.app.registry.browser.controlpanel import RegistryEditForm
|
|
4
|
+
from plone.supermodel import model
|
|
5
|
+
from zope import schema
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class IRerPubblicazioniSettings(model.Schema):
|
|
9
|
+
lingue = schema.Tuple(
|
|
10
|
+
title="Lingue",
|
|
11
|
+
description="Lingue per le pubblicazioni",
|
|
12
|
+
required=True,
|
|
13
|
+
value_type=schema.TextLine(),
|
|
14
|
+
missing_value=None,
|
|
15
|
+
default=(),
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
tipologie = schema.Tuple(
|
|
19
|
+
title="Tipologie",
|
|
20
|
+
description="Tipologie delle pubblicazioni",
|
|
21
|
+
required=True,
|
|
22
|
+
value_type=schema.TextLine(),
|
|
23
|
+
missing_value=None,
|
|
24
|
+
default=(),
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class RerPubblicazioniSettingsEditForm(RegistryEditForm):
|
|
29
|
+
schema = IRerPubblicazioniSettings
|
|
30
|
+
label = "Configurazione Pubblicazioni"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class RerPubblicazioniSettingsView(ControlPanelFormWrapper):
|
|
34
|
+
"""This is the actual view that get called in the control panel."""
|
|
35
|
+
|
|
36
|
+
form = RerPubblicazioniSettingsEditForm
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
|
|
2
|
+
xmlns:tal="http://xml.zope.org/namespaces/tal"
|
|
3
|
+
xmlns:metal="http://xml.zope.org/namespaces/metal"
|
|
4
|
+
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
|
5
|
+
lang="en"
|
|
6
|
+
metal:use-macro="context/main_template/macros/master"
|
|
7
|
+
i18n:domain="rer.pubblicazioni">
|
|
8
|
+
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<metal:content-core fill-slot="content-core">
|
|
12
|
+
<metal:block define-macro="content-core">
|
|
13
|
+
<dl class="publicationWrapper">
|
|
14
|
+
|
|
15
|
+
<div class="abstractwrapper publicationItem" tal:condition="context/abstract">
|
|
16
|
+
<dt>
|
|
17
|
+
<strong i18n:translate="rer_description_abstract">Description/Abstract</strong>:
|
|
18
|
+
</dt>
|
|
19
|
+
<dd>
|
|
20
|
+
<div tal:replace="structure context/abstract/output|nothing" />
|
|
21
|
+
</dd>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="authorWrapper publicationItem" tal:condition="context/publicationAuthor">
|
|
25
|
+
<dt>
|
|
26
|
+
<strong i18n:translate="rer_pub_author_tags">Author/Authors</strong>:
|
|
27
|
+
</dt>
|
|
28
|
+
<tal:author tal:repeat="author context/publicationAuthor">
|
|
29
|
+
<dd>
|
|
30
|
+
<a href="${context/portal_url}/@@search?authors=${author}">
|
|
31
|
+
${author}
|
|
32
|
+
</a>
|
|
33
|
+
</dd>
|
|
34
|
+
</tal:author>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div class="publicationDateWrapper publicationItem" tal:condition="context/publicationDate">
|
|
38
|
+
<dt>
|
|
39
|
+
<strong i18n:translate="rer_publication_date">Publication date</strong>:
|
|
40
|
+
</dt>
|
|
41
|
+
<dd>
|
|
42
|
+
${python: view.toLocalizedTime(context.publicationDate) or ''}
|
|
43
|
+
</dd>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div class="publicationTypeWrapper publicationItem" tal:condition="context/publicationType">
|
|
47
|
+
<dt>
|
|
48
|
+
<strong i18n:translate="rer_publication_type"> Publication type</strong>:
|
|
49
|
+
</dt>
|
|
50
|
+
<tal:author tal:repeat="type context/publicationType">
|
|
51
|
+
<dd>${type}</dd>
|
|
52
|
+
</tal:author>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div class="publicationLanguageWrapper publicationItem" tal:condition="context/publicationLanguage">
|
|
56
|
+
<dt>
|
|
57
|
+
<strong i18n:translate="rer_publication_language">Language</strong>:
|
|
58
|
+
</dt>
|
|
59
|
+
<dd>
|
|
60
|
+
${context/publicationLanguage}
|
|
61
|
+
</dd>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div class="publicationSeriesWrapper publicationItem" tal:condition="context/publicationSeries">
|
|
65
|
+
<dt>
|
|
66
|
+
<strong i18n:translate="rer_published_in">Published in</strong>:
|
|
67
|
+
</dt>
|
|
68
|
+
<dd>
|
|
69
|
+
${context/publicationSeries}
|
|
70
|
+
</dd>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="publicationEditorWrapper publicationItem" tal:condition="context/publicationEditor">
|
|
74
|
+
<dt>
|
|
75
|
+
<strong i18n:translate="rer_publication_editor">Editor</strong>:
|
|
76
|
+
</dt>
|
|
77
|
+
<dd>
|
|
78
|
+
${context/publicationEditor}
|
|
79
|
+
</dd>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div class="publicationRightsWrapper publicationItem" tal:condition="context/publicationRights">
|
|
83
|
+
<dt>
|
|
84
|
+
<strong i18n:translate="rer_publication_rights">Copyrights</strong>:
|
|
85
|
+
</dt>
|
|
86
|
+
<dd>
|
|
87
|
+
${context/publicationRights}
|
|
88
|
+
</dd>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<div class="urlWrapper publicationItem" tal:condition="python: context.publicationURL and context.publicationURL != 'http://'">
|
|
92
|
+
<dt>
|
|
93
|
+
<strong i18n:translate="rer_publication_url">URL</strong>:
|
|
94
|
+
</dt>
|
|
95
|
+
<dd tal:define="pubURL context/publicationURL">
|
|
96
|
+
<a href="${pubURL}">${pubURL}</a>
|
|
97
|
+
</dd>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div class="fileWrapper publicationItem" tal:condition="context/publicationFile">
|
|
101
|
+
<tal:fileinfo tal:define="file_size python: view.get_file_size(context);
|
|
102
|
+
file_content_type python: view.get_mime_type(context);">
|
|
103
|
+
<dt>
|
|
104
|
+
<strong i18n:translate="rer_publication_download">Scarica la pubblicazione</strong>:
|
|
105
|
+
</dt>
|
|
106
|
+
<dd>
|
|
107
|
+
<a tal:attributes="href string:${context/absolute_url}/@@download/publicationFile/${context/publicationFile/filename}">download</a>
|
|
108
|
+
<span class="file_info" tal:content="string: (${file_content_type}, ${file_size} MB)"></span>
|
|
109
|
+
</dd>
|
|
110
|
+
</tal:fileinfo>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
</dl>
|
|
114
|
+
|
|
115
|
+
</metal:block>
|
|
116
|
+
</metal:content-core>
|
|
117
|
+
</body>
|
|
118
|
+
</html>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
|
|
2
|
+
xmlns:tal="http://xml.zope.org/namespaces/tal"
|
|
3
|
+
xmlns:metal="http://xml.zope.org/namespaces/metal"
|
|
4
|
+
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
|
5
|
+
lang="en"
|
|
6
|
+
metal:use-macro="context/main_template/macros/master"
|
|
7
|
+
i18n:domain="plone">
|
|
8
|
+
<body>
|
|
9
|
+
|
|
10
|
+
<metal:content-core fill-slot="content-core">
|
|
11
|
+
<metal:block define-macro="content-core">
|
|
12
|
+
|
|
13
|
+
<div metal:define-macro="text-field-view"
|
|
14
|
+
id="parent-fieldname-text" class="stx"
|
|
15
|
+
tal:define="text view/text"
|
|
16
|
+
tal:condition="text"
|
|
17
|
+
tal:attributes="class view/text_class">
|
|
18
|
+
<div metal:define-slot="inside" tal:replace="structure text">The body</div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<metal:listingmacro define-macro="listing">
|
|
22
|
+
<tal:results define="batch view/batch;
|
|
23
|
+
thumb_scale_list view/get_thumb_scale_list;
|
|
24
|
+
thumb_scale_table view/get_thumb_scale_table;
|
|
25
|
+
thumb_scale_summary view/get_thumb_scale_summary;
|
|
26
|
+
img_class python:'thumb-%s pull-left' % thumb_scale_list;
|
|
27
|
+
showicons view/show_icons">
|
|
28
|
+
<tal:listing condition="batch">
|
|
29
|
+
<div class="entries" metal:define-slot="entries"
|
|
30
|
+
tal:define="portal context/@@plone_portal_state/portal;
|
|
31
|
+
image_scale portal/@@image_scale">
|
|
32
|
+
<tal:repeat repeat="item batch" metal:define-macro="entries">
|
|
33
|
+
<tal:block tal:define="obj item/getObject;
|
|
34
|
+
item_url item/getURL;
|
|
35
|
+
item_id item/getId;
|
|
36
|
+
item_title item/Title;
|
|
37
|
+
item_description item/Description;
|
|
38
|
+
item_type item/PortalType;
|
|
39
|
+
item_modified item/ModificationDate;
|
|
40
|
+
item_created item/CreationDate;
|
|
41
|
+
item_wf_state item/review_state;
|
|
42
|
+
item_wf_state_class python:'state-' + view.normalizeString(item_wf_state);
|
|
43
|
+
item_creator item/Creator;
|
|
44
|
+
item_link python:item_type in view.use_view_action and item_url+'/view' or item_url;
|
|
45
|
+
item_is_event python:view.is_event(obj);
|
|
46
|
+
item_has_image python:item.getIcon;
|
|
47
|
+
item_type_class python:('contenttype-' + view.normalizeString(item_type)) if showicons else '' ;
|
|
48
|
+
publication_author obj/publicationAuthor|nothing;
|
|
49
|
+
publication_date obj/publicationDate|nothing;
|
|
50
|
+
publication_type obj/publicationType|nothing;">
|
|
51
|
+
<metal:block define-slot="entry">
|
|
52
|
+
<div class="entry" metal:define-macro="listitem">
|
|
53
|
+
<div class="item-image"
|
|
54
|
+
tal:condition="python: item_has_image and thumb_scale_list">
|
|
55
|
+
<a tal:attributes="href item_link; title item_type">
|
|
56
|
+
<img tal:replace="structure python:image_scale.tag(item, 'image', scale='newshome', css_class=img_class)" />
|
|
57
|
+
</a>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="publicationDetails">
|
|
60
|
+
<div tal:attributes="class string:$item_type_class $item_wf_state_class item-title">
|
|
61
|
+
<a tal:attributes="href item_link; title item_type">
|
|
62
|
+
<h2><span tal:content="item_title">Item Title</span></h2>
|
|
63
|
+
</a>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="publicationDateAuthor" tal:condition="python:publication_author or publication_date or publication_type">
|
|
66
|
+
<div class="publicationAuthor" tal:condition="publication_author">
|
|
67
|
+
<span class="publication-label">Autore:</span>
|
|
68
|
+
<div class="publication-content">
|
|
69
|
+
<tal:authors repeat="author publication_author">
|
|
70
|
+
<a href="${context/portal_url}/@@search?authors=${author}"><span tal:content="author">Author</span></a>
|
|
71
|
+
<tal:comma tal:condition="not:repeat/author/end">, </tal:comma>
|
|
72
|
+
</tal:authors>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="publicationDate" tal:condition="publication_date">
|
|
76
|
+
<span class="publication-label">Data:</span>
|
|
77
|
+
<span class="publication-content" tal:content="python:view.toLocalizedTime(publication_date)" />
|
|
78
|
+
</div>
|
|
79
|
+
<div class="publicationTypes" tal:condition="publication_type">
|
|
80
|
+
<span class="publication-label">Tipo:</span>
|
|
81
|
+
<span class="publication-content" tal:content="python:', '.join(publication_type)" />
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</metal:block>
|
|
87
|
+
</tal:block>
|
|
88
|
+
</tal:repeat>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<div metal:use-macro="context/batch_macros/macros/navigation" />
|
|
92
|
+
|
|
93
|
+
</tal:listing>
|
|
94
|
+
|
|
95
|
+
<metal:empty metal:define-slot="no_items_in_listing">
|
|
96
|
+
<p class="discreet"
|
|
97
|
+
tal:condition="not: view/batch"
|
|
98
|
+
tal:content="view/no_items_message">
|
|
99
|
+
There are currently no items in this folder.
|
|
100
|
+
</p>
|
|
101
|
+
</metal:empty>
|
|
102
|
+
|
|
103
|
+
</tal:results>
|
|
104
|
+
</metal:listingmacro>
|
|
105
|
+
|
|
106
|
+
</metal:block>
|
|
107
|
+
</metal:content-core>
|
|
108
|
+
|
|
109
|
+
</body>
|
|
110
|
+
</html>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
from plone import api
|
|
4
|
+
from plone.api.exc import InvalidParameterError
|
|
5
|
+
from plone.memoize import view
|
|
6
|
+
from Products.Five import BrowserView
|
|
7
|
+
from rer.pubblicazioni.browser.interfaces import IRerPubblicazioniUtilsView
|
|
8
|
+
from zope.interface import implementer
|
|
9
|
+
from rer.pubblicazioni import logger
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@implementer(IRerPubblicazioniUtilsView)
|
|
13
|
+
class RerPubblicazioniUtilsView(BrowserView):
|
|
14
|
+
""" """
|
|
15
|
+
|
|
16
|
+
@view.memoize
|
|
17
|
+
def extract_value_from_settings(self, entry_name):
|
|
18
|
+
""" this one is the one to get a simple value"""
|
|
19
|
+
setting_name = "{}{}{}".format(
|
|
20
|
+
'rer.pubblicazioni.browser.',
|
|
21
|
+
'settings.IRerPubblicazioniSettings.',
|
|
22
|
+
entry_name
|
|
23
|
+
)
|
|
24
|
+
try:
|
|
25
|
+
value = api.portal.get_registry_record(setting_name)
|
|
26
|
+
except (InvalidParameterError, AttributeError) as err:
|
|
27
|
+
logger.exception(err)
|
|
28
|
+
return ""
|
|
29
|
+
if not value:
|
|
30
|
+
return ""
|
|
31
|
+
return value
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
from DateTime import DateTime
|
|
4
|
+
from plone.app.contenttypes.browser.collection import CollectionView
|
|
5
|
+
from Products.Five import BrowserView
|
|
6
|
+
from plone import api
|
|
7
|
+
from Products.CMFCore.utils import getToolByName
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PubblicazioneView(BrowserView):
|
|
11
|
+
"""
|
|
12
|
+
Vista del contenuto Pubblicazione
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def toLocalizedTime(self, publication_date):
|
|
16
|
+
plone_view = api.content.get_view(
|
|
17
|
+
name='plone',
|
|
18
|
+
context=self.context,
|
|
19
|
+
request=self.request
|
|
20
|
+
)
|
|
21
|
+
time = DateTime(publication_date.strftime('%Y-%m-%d'))
|
|
22
|
+
return plone_view.toLocalizedTime(time, False, False)
|
|
23
|
+
|
|
24
|
+
def get_mime_type(self, context):
|
|
25
|
+
portal = api.portal.get()
|
|
26
|
+
mimereg = getToolByName(portal, 'mimetypes_registry')
|
|
27
|
+
filename = context.publicationFile.filename
|
|
28
|
+
return mimereg.lookupExtension(filename).extensions[0].upper()
|
|
29
|
+
|
|
30
|
+
def get_file_size(self, context):
|
|
31
|
+
return format(
|
|
32
|
+
context.publicationFile.getSize()/float(1024*1024), '.2f'
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class PubblicazioniCollectionView(CollectionView):
|
|
37
|
+
"""
|
|
38
|
+
Vista del contenuto Pubblicazione
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
def toLocalizedTime(self, publication_date):
|
|
42
|
+
plone_view = api.content.get_view(
|
|
43
|
+
name='plone',
|
|
44
|
+
context=self.context,
|
|
45
|
+
request=self.request
|
|
46
|
+
)
|
|
47
|
+
time = DateTime(publication_date.strftime('%Y-%m-%d'))
|
|
48
|
+
return plone_view.toLocalizedTime(time, False, False)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<configure
|
|
2
|
+
xmlns="http://namespaces.zope.org/zope"
|
|
3
|
+
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
|
|
4
|
+
xmlns:i18n="http://namespaces.zope.org/i18n"
|
|
5
|
+
i18n_domain="rer.pubblicazioni">
|
|
6
|
+
|
|
7
|
+
<i18n:registerTranslations directory="locales" />
|
|
8
|
+
|
|
9
|
+
<include package=".browser" />
|
|
10
|
+
<include package=".restapi" />
|
|
11
|
+
<include package=".upgrades" />
|
|
12
|
+
|
|
13
|
+
<genericsetup:registerProfile
|
|
14
|
+
name="default"
|
|
15
|
+
title="rer.pubblicazioni"
|
|
16
|
+
directory="profiles/default"
|
|
17
|
+
description="Installs the rer.pubblicazioni add-on."
|
|
18
|
+
provides="Products.GenericSetup.interfaces.EXTENSION"
|
|
19
|
+
post_handler=".setuphandlers.post_install"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<genericsetup:registerProfile
|
|
23
|
+
name="uninstall"
|
|
24
|
+
title="rer.pubblicazioni (uninstall)"
|
|
25
|
+
directory="profiles/uninstall"
|
|
26
|
+
description="Uninstalls the rer.pubblicazioni add-on."
|
|
27
|
+
provides="Products.GenericSetup.interfaces.EXTENSION"
|
|
28
|
+
post_handler=".setuphandlers.uninstall"
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<utility
|
|
32
|
+
factory=".setuphandlers.HiddenProfiles"
|
|
33
|
+
name="rer.pubblicazioni-hiddenprofiles" />
|
|
34
|
+
|
|
35
|
+
<!-- VOCABOLARI -->
|
|
36
|
+
<utility
|
|
37
|
+
factory=".vocabularies.Lingue"
|
|
38
|
+
name="rer.pubblicazioni.lingue"
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<utility
|
|
42
|
+
factory=".vocabularies.Tipologie"
|
|
43
|
+
name="rer.pubblicazioni.tipologie"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<utility
|
|
47
|
+
component=".vocabularies.KeywordsVocabularyFactory"
|
|
48
|
+
provides="zope.schema.interfaces.IVocabularyFactory"
|
|
49
|
+
name="rer.pubblicazioni.autori"
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
<utility
|
|
53
|
+
component=".vocabularies.PublicationUsedAuthorsVocabularyFactory"
|
|
54
|
+
provides="zope.schema.interfaces.IVocabularyFactory"
|
|
55
|
+
name="rer.pubblicazioni.used_authors"
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
<utility
|
|
59
|
+
component=".vocabularies.PublicationUsedTypesVocabularyFactory"
|
|
60
|
+
provides="zope.schema.interfaces.IVocabularyFactory"
|
|
61
|
+
name="rer.pubblicazioni.used_types"
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<utility
|
|
65
|
+
component=".vocabularies.PublicationUsedLanguagesVocabularyFactory"
|
|
66
|
+
provides="zope.schema.interfaces.IVocabularyFactory"
|
|
67
|
+
name="rer.pubblicazioni.used_languages"
|
|
68
|
+
/>
|
|
69
|
+
<!-- INDEXER -->
|
|
70
|
+
<adapter name="authors" factory=".indexers.author_indexer" />
|
|
71
|
+
<adapter name="publication_types" factory=".indexers.publication_types_indexer" />
|
|
72
|
+
<adapter name="publication_language" factory=".indexers.publication_language_indexer" />
|
|
73
|
+
<adapter name="publication_date" factory=".indexers.publication_date_indexer" />
|
|
74
|
+
<adapter name="SearchableText" factory=".indexers.publication_searchable_text" />
|
|
75
|
+
|
|
76
|
+
</configure>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from plone.indexer.decorator import indexer
|
|
3
|
+
from .interfaces import IPubblicazione
|
|
4
|
+
from plone.app.contenttypes.indexers import _unicode_save_string_concat
|
|
5
|
+
from plone.app.textfield.value import IRichTextValue
|
|
6
|
+
from Products.CMFCore.utils import getToolByName
|
|
7
|
+
from Products.CMFPlone.utils import safe_unicode
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def SearchableText(obj):
|
|
11
|
+
text = ""
|
|
12
|
+
if obj.abstract:
|
|
13
|
+
textvalue = obj.abstract
|
|
14
|
+
if IRichTextValue.providedBy(textvalue):
|
|
15
|
+
transforms = getToolByName(obj, "portal_transforms")
|
|
16
|
+
text = (
|
|
17
|
+
transforms.convertTo(
|
|
18
|
+
"text/plain",
|
|
19
|
+
safe_unicode(textvalue.raw),
|
|
20
|
+
mimetype=textvalue.mimeType,
|
|
21
|
+
)
|
|
22
|
+
.getData()
|
|
23
|
+
.strip()
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
subject = " ".join([safe_unicode(s) for s in obj.Subject()])
|
|
27
|
+
|
|
28
|
+
return " ".join(
|
|
29
|
+
(
|
|
30
|
+
safe_unicode(obj.id),
|
|
31
|
+
safe_unicode(obj.title) or "",
|
|
32
|
+
safe_unicode(obj.description) or "",
|
|
33
|
+
safe_unicode(text),
|
|
34
|
+
safe_unicode(subject),
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@indexer(IPubblicazione)
|
|
40
|
+
def author_indexer(obj, **kw):
|
|
41
|
+
"""Factory method per l'indicizzazione del campo autori di una
|
|
42
|
+
pubblicazione.
|
|
43
|
+
"""
|
|
44
|
+
return getattr(obj, "publicationAuthor", ())
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@indexer(IPubblicazione)
|
|
48
|
+
def publication_types_indexer(obj, **kw):
|
|
49
|
+
"""
|
|
50
|
+
index the publication type
|
|
51
|
+
"""
|
|
52
|
+
return obj.publicationType
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@indexer(IPubblicazione)
|
|
56
|
+
def publication_language_indexer(obj, **kw):
|
|
57
|
+
"""
|
|
58
|
+
index the publication language
|
|
59
|
+
"""
|
|
60
|
+
return obj.publicationLanguage
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@indexer(IPubblicazione)
|
|
64
|
+
def publication_date_indexer(obj, **kw):
|
|
65
|
+
"""
|
|
66
|
+
index the publication date
|
|
67
|
+
"""
|
|
68
|
+
return obj.publicationDate
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@indexer(IPubblicazione)
|
|
72
|
+
def publication_searchable_text(obj, **kw):
|
|
73
|
+
return _unicode_save_string_concat(SearchableText(obj))
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Module where all interfaces, events and exceptions live."""
|
|
3
|
+
|
|
4
|
+
from plone.app.textfield import RichText
|
|
5
|
+
from plone.app.z3cform.widget import AjaxSelectFieldWidget
|
|
6
|
+
from plone.autoform import directives
|
|
7
|
+
from plone.namedfile.field import NamedBlobFile
|
|
8
|
+
from rer.pubblicazioni import _
|
|
9
|
+
from zope import schema
|
|
10
|
+
from zope.interface import Interface
|
|
11
|
+
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
|
|
12
|
+
from plone.restapi.controlpanels.interfaces import IControlpanel
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class IRerPubblicazioniLayer(IDefaultBrowserLayer):
|
|
16
|
+
"""Marker interface that defines a browser layer."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class IRerPubblicazioniRestapiControlpanel(IControlpanel):
|
|
20
|
+
"""
|
|
21
|
+
Marker interface for controlpanel
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class IPubblicazione(Interface):
|
|
26
|
+
abstract = RichText(
|
|
27
|
+
title=_("rer_description_abstract", default="Description/Abstract"),
|
|
28
|
+
description=_(
|
|
29
|
+
"help_rer_description_abstract", default="An abstract of the publication."
|
|
30
|
+
),
|
|
31
|
+
required=False,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
publicationAuthor = schema.Tuple(
|
|
35
|
+
title=_("rer_pub_author_tags", default="Author/Authors"),
|
|
36
|
+
description=_(
|
|
37
|
+
"help_rer_pub_author_tags",
|
|
38
|
+
default="Autore/autori della pubblicazione",
|
|
39
|
+
),
|
|
40
|
+
value_type=schema.TextLine(),
|
|
41
|
+
required=False,
|
|
42
|
+
missing_value=(),
|
|
43
|
+
default=(),
|
|
44
|
+
)
|
|
45
|
+
directives.widget(
|
|
46
|
+
"publicationAuthor",
|
|
47
|
+
AjaxSelectFieldWidget,
|
|
48
|
+
vocabulary="rer.pubblicazioni.autori",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
publicationDate = schema.Date(
|
|
52
|
+
title=_("rer_publication_date", default="Publication date"),
|
|
53
|
+
description=_(
|
|
54
|
+
"help_rer_publication_date", default="Insert the date for this publication"
|
|
55
|
+
),
|
|
56
|
+
required=True,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
publicationType = schema.List(
|
|
60
|
+
title=_("rer_publication_type", default="Publication type"),
|
|
61
|
+
description=_(
|
|
62
|
+
"help_rer_publication_type",
|
|
63
|
+
default="Insert a list of types for this publication",
|
|
64
|
+
),
|
|
65
|
+
required=False,
|
|
66
|
+
default=[],
|
|
67
|
+
missing_value=[],
|
|
68
|
+
value_type=schema.Choice(vocabulary="rer.pubblicazioni.tipologie"),
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
publicationLanguage = schema.Choice(
|
|
72
|
+
title=_("rer_publication_language", default="Language"),
|
|
73
|
+
description=_(
|
|
74
|
+
"help_rer_publication_language",
|
|
75
|
+
default="Select the language of this publication",
|
|
76
|
+
),
|
|
77
|
+
required=False,
|
|
78
|
+
default=None,
|
|
79
|
+
vocabulary="rer.pubblicazioni.lingue",
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
# "Pubblicato in" - era "Collana"
|
|
83
|
+
publicationSeries = schema.Text(
|
|
84
|
+
title=_("rer_published_in", default="Published in"),
|
|
85
|
+
description=_("help_rer_publication_series", default=""),
|
|
86
|
+
required=False,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
publicationEditor = schema.Text(
|
|
90
|
+
title=_("rer_publication_editor", default="Editor"),
|
|
91
|
+
description=_("help_rer_publication_editor", default=""),
|
|
92
|
+
required=False,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
publicationRights = schema.Text(
|
|
96
|
+
title=_("rer_publication_rights", default="Copyrights"),
|
|
97
|
+
description=_("help_rer_rer_publication_rights", default=""),
|
|
98
|
+
required=False,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
publicationFile = NamedBlobFile(
|
|
102
|
+
title=_("rer_publication_file", default="File"),
|
|
103
|
+
description=_("help_rer_publication_file", default=""),
|
|
104
|
+
required=False,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
publicationURL = schema.TextLine(
|
|
108
|
+
title=_("rer_publication_url", default="URL"),
|
|
109
|
+
description=_("help_rer_publication_url", default=""),
|
|
110
|
+
default="",
|
|
111
|
+
required=False,
|
|
112
|
+
)
|