source: products/quintagroup.portlet.map/trunk/quintagroup/portlet/map/map_fix.py @ 2188

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 
1from zope.component import adapts
2from zope.interface import implements
3from zope.component import getMultiAdapter
4
5from Acquisition import aq_inner, aq_parent
6
7from Products.ATContentTypes import interface
8from Products.Maps.adapters import FolderMap
9from Products.Maps.interfaces import IMapView
10from Products.Maps.browser.map import BaseMapView
11
12class 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
32class 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
41class 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.