src/pyams_content/component/illustration/zmi/thesaurus.py
changeset 827 1eb993e1adfd
child 1218 9f8b56eeb149
--- /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 <tflorac AT ulthar.net>
+# 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)