changeset 204:670b3507509d

fix breadcrumbs for features.
author casties
date Thu, 27 Jun 2013 15:39:44 +0200
parents 9ce5816e89b2
children 2b27332c9545
files MPIWGFeature.py MPIWGProjects.py MPIWGStaff.py zpt/feature/feature_template.zpt
diffstat 4 files changed, 25 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGFeature.py	Thu Jun 27 13:03:04 2013 +0200
+++ b/MPIWGFeature.py	Thu Jun 27 15:39:44 2013 +0200
@@ -2,6 +2,7 @@
 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
 from OFS.Folder import Folder
 from Globals import package_home
+from Acquisition import aq_parent
 
 import os
 import logging
@@ -223,8 +224,10 @@
        
     def getBreadcrumbs(self):
         """return list of breadcrumbs from here to the root"""
-        crumbs = [{'text':self.getFullTitle(), 'url':self.absolute_url(), 'object':self}]
-        parent = self.aq_parent
+        # get acquisition parent (skipping folder "features")
+        parent = aq_parent(aq_parent(self))
+        baseUrl = parent.absolute_url() + '/features'
+        crumbs = [{'text':self.getFullTitle(), 'url':self.getUrl(baseUrl=baseUrl), 'object':self}]
         if hasattr(parent, 'getBreadcrumbs'):
             if self.title:
                 return parent.getBreadcrumbs() + crumbs
--- a/MPIWGProjects.py	Thu Jun 27 13:03:04 2013 +0200
+++ b/MPIWGProjects.py	Thu Jun 27 15:39:44 2013 +0200
@@ -10,6 +10,7 @@
 from OFS.SimpleItem import SimpleItem
 from OFS.Folder import Folder
 from AccessControl import ClassSecurityInfo
+from Acquisition import aq_parent
 from Globals import package_home
 import urllib
 import re
@@ -1109,7 +1110,7 @@
     def copyObjectToArchive(self):
         """kopiere aktuelles objekt ins archiv"""
         logging.info("copytoarchive 1")
-        cb = self.aq_parent.manage_copyObjects(self.getId())
+        cb = aq_parent(self).manage_copyObjects(self.getId())
         logging.info("copytoarchive 2")
         self.manage_pasteObjects(cb)
         logging.info("copytoarchive 3")
@@ -1341,7 +1342,7 @@
         """return list of breadcrumbs from here to the root"""
         crumbs = []
         # skip direct parent Folder /projects/
-        parent = self.aq_parent.aq_parent
+        parent = aq_parent(aq_parent(self))
         # get parents breadcrumbs
         if hasattr(parent, 'getBreadcrumbs'):
             crumbs = parent.getBreadcrumbs()
--- a/MPIWGStaff.py	Thu Jun 27 13:03:04 2013 +0200
+++ b/MPIWGStaff.py	Thu Jun 27 15:39:44 2013 +0200
@@ -1,7 +1,5 @@
 """This file contains the classes for the organization of the staff"""
 
-from zExceptions import Redirect
-
 from OFS.Folder import Folder
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 
--- a/zpt/feature/feature_template.zpt	Thu Jun 27 13:03:04 2013 +0200
+++ b/zpt/feature/feature_template.zpt	Thu Jun 27 15:39:44 2013 +0200
@@ -24,42 +24,36 @@
     <tal:block metal:define-slot="sideblock" />
 
     <div class="sideblock">
-      <h2>Research Topics Archive</h2>
+      <h2 tal:condition="python:lang!='de'">Research Topics Archive</h2>
+      <h2 tal:condition="python:lang=='de'">Archiv der Forschungsthemen</h2>
 
       <div class="item noline" tal:condition="python:lang!='de'">
-        <b>In this archive</b> you can find present and past research topics.
+        <a class="internal" tal:attributes="href string:$root/${secmap/news}/featurearchive.html">In the archive</a>
+        you can find present and past research topics.
       </div>
       <div class="item noline" tal:condition="python:lang=='de'">
-        <b>In diesem Archiv</b> finden Sie aktuelle und fr&uuml;here Forschungsthemen.
+        <a class="internal" tal:attributes="href string:$root/${secmap/news}/featurearchive.html">Im Archiv</a> 
+        finden Sie aktuelle und fr&uuml;here Forschungsthemen.
       </div>
 
-      <tal:block define="features python:here.getFeatures()">
-        <tal:block define="dummy python:features.reverse()">
-          <!-- workaround for inverting the order of the elements -->
-
-          <div class="item thumb" tal:repeat="feature python:features">
-            <div class="row" tal:define="url python:feature.getUrl(baseUrl='%s/%s/features'%(root,secmap['news']))">
-              <div class="col thumb">
-                <a tal:attributes="href url"> 
-                  <img tal:attributes="src feature/getThumbUrl" />
-                </a>
-              </div>
-              <div class="col text">
-                <a tal:attributes="href url">
-                  <b>Feature <span tal:replace="python: len(features)-features.index(feature)" />:</b>
-                </a> 
-                <span tal:content="feature/getFullTitle"/>
-              </div>
+      <tal:block define="features python:here.getFeatures(reverse=True)">
+        <div class="item thumb" tal:repeat="feature python:features">
+          <div class="row" tal:define="url python:feature.getUrl(baseUrl='%s/%s/features'%(root,secmap['news']))">
+            <div class="col thumb">
+              <a tal:attributes="href url"> <img tal:attributes="src feature/getThumbUrl" />
+              </a>
+            </div>
+            <div class="col text">
+              <a tal:attributes="href url"><b><span tal:replace="python:len(features)-features.index(feature)" />:</b></a> 
+              <span tal:content="feature/getFullTitle" />
             </div>
           </div>
-
-        </tal:block>
+        </div>
       </tal:block>
 
     </div>
     <!-- /sideblock -->
 
-
   </div>
   <!-- sidebar -->
 </body>