15 |
15 |
16 # import standard library |
16 # import standard library |
17 |
17 |
18 # import interfaces |
18 # import interfaces |
19 from pyams_portal.interfaces import IPortalTemplateContainer, IPortalTemplate, IPortalContext, \ |
19 from pyams_portal.interfaces import IPortalTemplateContainer, IPortalTemplate, IPortalContext, \ |
20 MANAGE_TEMPLATE_PERMISSION |
20 MANAGE_TEMPLATE_PERMISSION, LOCAL_TEMPLATE_NAME |
21 from pyams_skin.interfaces import IPageHeader, IContentTitle |
21 from pyams_skin.interfaces import IPageHeader, IContentTitle |
22 from pyams_skin.interfaces.container import ITableElementName, ITableElementEditor |
22 from pyams_skin.interfaces.container import ITableElementName, ITableElementEditor |
23 from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager, IBreadcrumbItem |
23 from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager, IBreadcrumbItem |
24 from pyams_skin.layer import IPyAMSLayer |
24 from pyams_skin.layer import IPyAMSLayer |
25 from pyams_zmi.layer import IAdminLayer |
25 from pyams_zmi.layer import IAdminLayer |
51 |
51 |
52 @adapter_config(context=(IPortalTemplate, IPyAMSLayer), provides=IBreadcrumbItem) |
52 @adapter_config(context=(IPortalTemplate, IPyAMSLayer), provides=IBreadcrumbItem) |
53 class PortalTemplateBreadcrumbAdapter(BreadcrumbItem): |
53 class PortalTemplateBreadcrumbAdapter(BreadcrumbItem): |
54 """Portal template breadcrumb adapter""" |
54 """Portal template breadcrumb adapter""" |
55 |
55 |
56 label = _("Portal template") |
56 @property |
|
57 def label(self): |
|
58 name = self.context.name |
|
59 if name == LOCAL_TEMPLATE_NAME: |
|
60 return _("Presentation template") |
|
61 else: |
|
62 return name |
|
63 |
|
64 @property |
|
65 def url(self): |
|
66 name = self.context.name |
|
67 if name == LOCAL_TEMPLATE_NAME: |
|
68 parent = get_parent(self.context, IPortalContext) |
|
69 return absolute_url(parent, self.request, 'admin#template-properties.html') |
|
70 else: |
|
71 return super(PortalTemplateBreadcrumbAdapter, self).url |
57 |
72 |
58 |
73 |
59 @adapter_config(context=(IPortalTemplate, IPyAMSLayer), provides=ITableElementName) |
74 @adapter_config(context=(IPortalTemplate, IPyAMSLayer), provides=ITableElementName) |
60 class PortalTemplateTableElementNameAdapter(ContextRequestAdapter): |
75 class PortalTemplateTableElementNameAdapter(ContextRequestAdapter): |
61 """Portal template table element name adapter""" |
76 """Portal template table element name adapter""" |