Last change
on this file since 2188 was
2188,
checked in by mylan, 14 years ago
|
Initial import the package
|
File size:
1.2 KB
|
Line | |
---|
1 | from zope.component import adapts |
---|
2 | from zope.interface import implements |
---|
3 | from zope.component import getMultiAdapter |
---|
4 | |
---|
5 | from Acquisition import aq_inner, aq_parent |
---|
6 | |
---|
7 | from Products.ATContentTypes import interface |
---|
8 | from Products.Maps.adapters import FolderMap |
---|
9 | from Products.Maps.interfaces import IMapView |
---|
10 | from Products.Maps.browser.map import BaseMapView |
---|
11 | |
---|
12 | class DefaultPageMapView(BaseMapView): |
---|
13 | implements(IMapView) |
---|
14 | |
---|
15 | @property |
---|
16 | def enabled(self): |
---|
17 | if self.map is None: |
---|
18 | return False |
---|
19 | elif not self.isDefaultPage(): |
---|
20 | return False |
---|
21 | return True |
---|
22 | |
---|
23 | def isDefaultPage(self): |
---|
24 | context = aq_inner(self.context) |
---|
25 | container = aq_parent(context) |
---|
26 | if not container: |
---|
27 | return False |
---|
28 | view = getMultiAdapter((container, self.request), name='default_page') |
---|
29 | return view.isDefaultPage(context) |
---|
30 | |
---|
31 | |
---|
32 | class DefaultPageMap(FolderMap): |
---|
33 | adapts(interface.IATDocument) |
---|
34 | |
---|
35 | def __init__(self, context): |
---|
36 | context = aq_inner(context) |
---|
37 | container = aq_parent(context) |
---|
38 | self.context = container |
---|
39 | |
---|
40 | |
---|
41 | class FolderMapView(BaseMapView): |
---|
42 | implements(IMapView) |
---|
43 | |
---|
44 | @property |
---|
45 | def enabled(self): |
---|
46 | if self.map is None: |
---|
47 | return False |
---|
48 | return True |
---|
Note: See
TracBrowser
for help on using the repository browser.