13 __docformat__ = 'restructuredtext' |
13 __docformat__ = 'restructuredtext' |
14 |
14 |
15 |
15 |
16 # import standard library |
16 # import standard library |
17 |
17 |
18 # import interfaces |
18 from pyramid.decorator import reify |
19 from pyams_form.interfaces.form import IInnerTabForm, IFormHelp |
19 from z3c.form import field |
20 from pyams_portal.interfaces import IPortlet, IPortalTemplate, IPortalPage, MANAGE_TEMPLATE_PERMISSION, \ |
|
21 IPortletSettings, IPortletRendererSettings |
|
22 from pyams_skin.layer import IPyAMSLayer |
|
23 from pyams_zmi.interfaces import IPropertiesEditForm |
|
24 from pyams_zmi.layer import IAdminLayer |
|
25 from z3c.form.interfaces import INPUT_MODE |
20 from z3c.form.interfaces import INPUT_MODE |
|
21 from zope.interface import implementer, Interface |
26 |
22 |
27 # import packages |
23 # import packages |
28 from pyams_form.form import ajax_config |
24 from pyams_form.form import ajax_config |
29 from pyams_form.help import FormHelp |
25 from pyams_form.help import FormHelp |
|
26 # import interfaces |
|
27 from pyams_form.interfaces.form import IInnerTabForm, IFormHelp |
30 from pyams_pagelet.pagelet import pagelet_config |
28 from pyams_pagelet.pagelet import pagelet_config |
|
29 from pyams_portal import _ |
|
30 from pyams_portal.interfaces import IPortlet, IPortalTemplate, IPortalPage, MANAGE_TEMPLATE_PERMISSION, \ |
|
31 IPortletSettings, IPortletRendererSettings, LOCAL_TEMPLATE_NAME |
31 from pyams_portal.zmi.widget import PortletRendererFieldWidget |
32 from pyams_portal.zmi.widget import PortletRendererFieldWidget |
32 from pyams_skin.event import get_json_widget_refresh_event |
33 from pyams_skin.event import get_json_widget_refresh_event |
|
34 from pyams_skin.layer import IPyAMSLayer |
33 from pyams_template.template import template_config |
35 from pyams_template.template import template_config |
34 from pyams_utils.adapter import adapter_config |
36 from pyams_utils.adapter import adapter_config |
35 from pyams_utils.url import absolute_url |
37 from pyams_utils.url import absolute_url |
36 from pyams_zmi.form import AdminDialogEditForm, InnerAdminEditForm |
38 from pyams_zmi.form import AdminDialogEditForm, InnerAdminEditForm |
37 from pyramid.decorator import reify |
39 from pyams_zmi.interfaces import IPropertiesEditForm |
38 from z3c.form import field |
40 from pyams_zmi.layer import IAdminLayer |
39 from zope.interface import implementer, Interface |
|
40 |
|
41 from pyams_portal import _ |
|
42 |
41 |
43 |
42 |
44 @template_config(template='templates/portlet.pt', layer=IPyAMSLayer) |
43 @template_config(template='templates/portlet.pt', layer=IPyAMSLayer) |
45 class PortletSettingsEditor(AdminDialogEditForm): |
44 class PortletSettingsEditor(AdminDialogEditForm): |
46 """Portlet settings edit form""" |
45 """Portlet settings edit form""" |
51 def title(self): |
50 def title(self): |
52 translate = self.request.localizer.translate |
51 translate = self.request.localizer.translate |
53 parent = self.configuration.__parent__ |
52 parent = self.configuration.__parent__ |
54 if not IPortalTemplate.providedBy(parent): |
53 if not IPortalTemplate.providedBy(parent): |
55 parent = IPortalPage(parent).template |
54 parent = IPortalPage(parent).template |
56 return translate(_("« {0} » portal template - {1}")).format(parent.name, |
55 if parent.name == LOCAL_TEMPLATE_NAME: |
57 translate(self.portlet.label)) |
56 return translate(_("Local portal template - {0}")).format(translate(self.portlet.label)) |
|
57 else: |
|
58 return translate(_("« {0} » portal template - {1}")).format(parent.name, |
|
59 translate(self.portlet.label)) |
58 |
60 |
59 legend = _("Edit portlet settings") |
61 legend = _("Edit portlet settings") |
60 dialog_class = 'modal-large' |
62 dialog_class = 'modal-large' |
61 |
63 |
62 settings = None |
64 settings = None |