src/pyams_content/component/illustration/zmi/thesaurus.py
changeset 827 1eb993e1adfd
child 1218 9f8b56eeb149
equal deleted inserted replaced
826:eb16b1127e06 827:1eb993e1adfd
       
     1 #
       
     2 # Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
       
     3 # All Rights Reserved.
       
     4 #
       
     5 # This software is subject to the provisions of the Zope Public License,
       
     6 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    10 # FOR A PARTICULAR PURPOSE.
       
    11 #
       
    12 
       
    13 __docformat__ = 'restructuredtext'
       
    14 
       
    15 
       
    16 # import standard library
       
    17 
       
    18 # import interfaces
       
    19 from pyams_content.component.illustration.interfaces import IBasicIllustration, IIllustration
       
    20 from pyams_skin.layer import IPyAMSLayer
       
    21 from pyams_thesaurus.interfaces import MANAGE_THESAURUS_CONTENT_PERMISSION
       
    22 from pyams_thesaurus.interfaces.term import IThesaurusTerm
       
    23 from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
       
    24 
       
    25 # import packages
       
    26 from pyams_form.form import ajax_config
       
    27 from pyams_pagelet.pagelet import pagelet_config
       
    28 from pyams_zmi.form import AdminDialogEditForm
       
    29 from z3c.form import field
       
    30 
       
    31 from pyams_content import _
       
    32 
       
    33 
       
    34 @pagelet_config(name='illustration-dialog.html', context=IThesaurusTerm, layer=IPyAMSLayer,
       
    35                 permission=VIEW_SYSTEM_PERMISSION)
       
    36 @ajax_config(name='illustration-dialog.json', context=IThesaurusTerm, layer=IPyAMSLayer)
       
    37 class ThesaurusTermIllustrationPropertiesEditForm(AdminDialogEditForm):
       
    38     """Thesaurus term illustration properties edit form"""
       
    39 
       
    40     prefix = 'illustration_form.'
       
    41 
       
    42     legend = _("Edit illustration properties")
       
    43     dialog_class = 'modal-large'
       
    44     icon_css_class = 'fa fa-fw fa-file-image-o'
       
    45 
       
    46     fields = field.Fields(IBasicIllustration).omit('__parent__', '__name__')
       
    47     edit_permission = MANAGE_THESAURUS_CONTENT_PERMISSION
       
    48 
       
    49     def getContent(self):
       
    50         return IIllustration(self.context)