# HG changeset patch # User Thierry Florac # Date 1531234703 -7200 # Node ID 1eb993e1adfdbc3ef8b0c1052c7f5fb7d9c7e782 # Parent eb16b1127e06b9898b496406637d243da16a5a4a Added illustration extension to thesaurus terms diff -r eb16b1127e06 -r 1eb993e1adfd src/pyams_content/component/illustration/thesaurus.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/component/illustration/thesaurus.py Tue Jul 10 16:58:23 2018 +0200 @@ -0,0 +1,37 @@ +# +# Copyright (c) 2008-2018 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.component.illustration import IBasicIllustrationTarget +from pyams_thesaurus.interfaces.extension import IThesaurusTermExtension + +# import packages +from pyams_utils.registry import utility_config + +from pyams_content import _ + + +@utility_config(name='illustration', provides=IThesaurusTermExtension) +class IllustrationThesaurusExtension(object): + """Illustration thesaurus extension""" + + label = _("Illustration") + + target_interface = IBasicIllustrationTarget + target_view = 'illustration-dialog.html' + + icon = '' diff -r eb16b1127e06 -r 1eb993e1adfd src/pyams_content/component/illustration/zmi/thesaurus.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/component/illustration/zmi/thesaurus.py Tue Jul 10 16:58:23 2018 +0200 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2008-2018 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.component.illustration.interfaces import IBasicIllustration, IIllustration +from pyams_skin.layer import IPyAMSLayer +from pyams_thesaurus.interfaces import MANAGE_THESAURUS_CONTENT_PERMISSION +from pyams_thesaurus.interfaces.term import IThesaurusTerm +from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION + +# import packages +from pyams_form.form import ajax_config +from pyams_pagelet.pagelet import pagelet_config +from pyams_zmi.form import AdminDialogEditForm +from z3c.form import field + +from pyams_content import _ + + +@pagelet_config(name='illustration-dialog.html', context=IThesaurusTerm, layer=IPyAMSLayer, + permission=VIEW_SYSTEM_PERMISSION) +@ajax_config(name='illustration-dialog.json', context=IThesaurusTerm, layer=IPyAMSLayer) +class ThesaurusTermIllustrationPropertiesEditForm(AdminDialogEditForm): + """Thesaurus term illustration properties edit form""" + + prefix = 'illustration_form.' + + legend = _("Edit illustration properties") + dialog_class = 'modal-large' + icon_css_class = 'fa fa-fw fa-file-image-o' + + fields = field.Fields(IBasicIllustration).omit('__parent__', '__name__') + edit_permission = MANAGE_THESAURUS_CONTENT_PERMISSION + + def getContent(self): + return IIllustration(self.context)