src/pyams_content/features/thesaurus/zmi/__init__.py
changeset 1132 f1276d7bc4ce
equal deleted inserted replaced
1131:64747fd623b3 1132:f1276d7bc4ce
       
     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 from z3c.form import field
       
    16 
       
    17 from pyams_content.features.thesaurus import IThesaurusTermHTMLTarget
       
    18 from pyams_content.features.thesaurus.interfaces import IThesaurusTermHTMLInfo
       
    19 from pyams_form.form import ajax_config
       
    20 from pyams_pagelet.pagelet import pagelet_config
       
    21 from pyams_skin.layer import IPyAMSLayer
       
    22 from pyams_thesaurus.interfaces import MANAGE_THESAURUS_CONTENT_PERMISSION
       
    23 from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
       
    24 from pyams_zmi.form import AdminDialogEditForm
       
    25 
       
    26 from pyams_content import _
       
    27 
       
    28 
       
    29 @pagelet_config(name='html-description.html', context=IThesaurusTermHTMLTarget, layer=IPyAMSLayer,
       
    30                 permission=VIEW_SYSTEM_PERMISSION)
       
    31 @ajax_config(name='html-description.json', context=IThesaurusTermHTMLTarget, layer=IPyAMSLayer)
       
    32 class ThesaurusTermHTMLDescriptionPropertiesEditForm(AdminDialogEditForm):
       
    33     """Thesaurus term HTML description properties edit form"""
       
    34 
       
    35     prefix = 'html_description_form.'
       
    36 
       
    37     legend = _("Edit rich text description")
       
    38     dialog_class = 'modal-max'
       
    39     icon_css_class = 'fa fa-fw fa-font'
       
    40 
       
    41     fields = field.Fields(IThesaurusTermHTMLInfo)
       
    42     edit_permission = MANAGE_THESAURUS_CONTENT_PERMISSION
       
    43 
       
    44     def getContent(self):
       
    45         return IThesaurusTermHTMLInfo(self.context)