version 1.1.2.5, 2008/09/03 21:16:40
|
version 1.1.2.7, 2008/09/08 08:40:05
|
Line 35 def getSection(self):
|
Line 35 def getSection(self):
|
|
|
return sec |
return sec |
|
|
|
def getSubSection(self): |
|
"""returns the current subsection name""" |
|
p = self |
|
sec = None |
|
subsec = None |
|
# descend parents to the root (and remember the last id) |
|
while p is not None and p.meta_type != 'MPIWGRoot': |
|
subsec = sec |
|
sec = p.getId() |
|
p = p.aq_parent |
|
|
|
return subsec |
|
|
|
|
class MPIWGTemplate(ZopePageTemplate): |
class MPIWGTemplate(ZopePageTemplate): |
"""Create a layout Template for different purposes""" |
"""Create a layout Template for different purposes""" |
Line 75 class MPIWGTemplate(ZopePageTemplate):
|
Line 88 class MPIWGTemplate(ZopePageTemplate):
|
return "" |
return "" |
|
|
getBreadcrumbs = getBreadcrumbs |
getBreadcrumbs = getBreadcrumbs |
|
|
getSection = getSection |
getSection = getSection |
|
getSubSection = getSubSection |
|
|
def harvest_page(self): |
def harvest_page(self): |
"""harvest main""" |
"""harvest main""" |
Line 184 class MPIWGFolder(Folder):
|
Line 197 class MPIWGFolder(Folder):
|
|
|
getSection = getSection |
getSection = getSection |
|
|
|
getSubSection = getSubSection |
|
|
|
|
def manage_addMPIWGFolderForm(self): |
def manage_addMPIWGFolderForm(self): |
"""Form for adding""" |
"""Form for adding""" |
Line 237 class MPIWGFeature(Folder):
|
Line 252 class MPIWGFeature(Folder):
|
"""default index page""" |
"""default index page""" |
return self.getMain() |
return self.getMain() |
|
|
|
def getFullTitle(self): |
|
"""returns the full title (from main.pt)""" |
|
# get Language from MPIWGRoot |
|
lang = self.getLang() |
|
dir = getattr(self, lang, self.en) |
|
pt = getattr(dir, 'main.pt') |
|
t = pt.title |
|
if not t: |
|
t = self.title |
|
|
|
return t |
|
|
def getIntro(self, **args): |
def getIntro(self, **args): |
"""returns the intro as PageTemplate""" |
"""returns the intro as PageTemplate""" |
pt = getattr(self.en, 'intro.pt') |
# get Language from MPIWGRoot |
|
lang = self.getLang() |
|
dir = getattr(self, lang, self.en) |
|
pt = getattr(dir, 'intro.pt') |
return pt(**args) |
return pt(**args) |
|
|
def getMain(self, **args): |
def getMain(self, **args): |
"""returns the main part as PageTemplate""" |
"""returns the main part as PageTemplate""" |
pt = getattr(self.en, 'main.pt') |
# get Language from MPIWGRoot |
|
lang = self.getLang() |
|
dir = getattr(self, lang, self.en) |
|
pt = getattr(dir, 'main.pt') |
return pt(**args) |
return pt(**args) |
|
|
def getFrontpageImg(self): |
def getFrontpageImg(self): |
Line 257 class MPIWGFeature(Folder):
|
Line 290 class MPIWGFeature(Folder):
|
img = getattr(self, 'img-frontpage.jpg') |
img = getattr(self, 'img-frontpage.jpg') |
return img.absolute_url() |
return img.absolute_url() |
|
|
def getThumbImg(self): |
def getFrontpageThumb(self): |
"""returns the image object for the frontpage thumbnail""" |
"""returns the image object for the frontpage thumbnail""" |
|
img = getattr(self, 'img-frontthumb.jpg') |
|
return img |
|
|
|
def getFrontpageThumbUrl(self): |
|
"""returns the URL of the image object for the frontpage thumbnail""" |
|
img = getattr(self, 'img-frontthumb.jpg') |
|
return img.absolute_url() |
|
|
|
def getThumbImg(self): |
|
"""returns the image object for the sidebar thumbnail""" |
img = getattr(self, 'img-thumb.jpg') |
img = getattr(self, 'img-thumb.jpg') |
return img |
return img |
|
|
def getThumbImgUrl(self): |
def getThumbImgUrl(self): |
"""returns the URL of the image object for the frontpage thumbnail""" |
"""returns the URL of the image object for the sidebar thumbnail""" |
img = getattr(self, 'img-thumb.jpg') |
img = getattr(self, 'img-thumb.jpg') |
return img.absolute_url() |
return img.absolute_url() |
|
|
|
|
def changeWeight(self,weight,RESPONSE=None): |
def changeWeight(self,weight,RESPONSE=None): |
"""change weight""" |
"""change weight""" |
self.weight=weight |
self.weight=weight |
if RESPONSE is not None: |
if RESPONSE is not None: |
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
|
|
def changeMPIWGFeature(self, title=None, weight=None, RESPONSE=None): |
def changeMPIWGFeature(self, title=None, weight=None, RESPONSE=None): |
"""change everything""" |
"""change everything""" |
if title is not None: |
if title is not None: |
Line 284 class MPIWGFeature(Folder):
|
Line 325 class MPIWGFeature(Folder):
|
if RESPONSE is not None: |
if RESPONSE is not None: |
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
getBreadcrumbs = getBreadcrumbs |
def getBreadcrumbs(self): |
|
"""return list of breadcrumbs from here to the root""" |
|
crumbs = [(self.getFullTitle(), self.absolute_url(), self)] |
|
parent = self.aq_parent |
|
if hasattr(parent, 'getBreadcrumbs'): |
|
if self.title: |
|
return parent.getBreadcrumbs() + crumbs |
|
else: |
|
# if there's no title, skip this level |
|
return parent.getBreadcrumbs() |
|
|
|
return crumbs |
|
|
getSection = getSection |
getSection = getSection |
|
|
|
getSubSection = getSubSection |
|
|
|
|
def manage_addMPIWGFeatureForm(self): |
def manage_addMPIWGFeatureForm(self): |
"""Form for adding""" |
"""Form for adding""" |