changeset 128:11b7f98c7ed1

added book links aus pubman
author dwinter
date Thu, 30 May 2013 22:00:15 +0200
parents 4a8a532a05ba
children 741ddaf604b1
files MPIWGRoot.py MPIWGStaff.py zpt/staff/pubman/show_publications.zpt
diffstat 3 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGRoot.py	Thu May 30 20:55:07 2013 +0200
+++ b/MPIWGRoot.py	Thu May 30 22:00:15 2013 +0200
@@ -520,7 +520,28 @@
                 
             fw.close()
             
+    def getBookLinkFromID(self,ident):
+        """holt die url auf eine buchseite, bekommt identifier MPIWG-Book:XXXX"""
+       
+        splitted = ident.split(":")
+        if len(splitted)!=2:
+            logging.debug("getBookLinkFromID: %s not a valid book id, should be MPIWG-Book:XXXX"%ident)
+            return
+        
+        books = getattr(self,'books',None)
+        if books is None:
+            logging.debug("getBookLinkFromID: cannot find books page folder")
+            return
+        
+        
+        bookobj = getattr(books,splitted[1],None)
+        
+        if bookobj is None:
+            logging.debug("getBookLinkFromID: %s not a valid book id"%ident)
+            return
+        
     
+        return "books/"+splitted[1]
     
 
 def manage_addMPIWGRootForm(self):
--- a/MPIWGStaff.py	Thu May 30 20:55:07 2013 +0200
+++ b/MPIWGStaff.py	Thu May 30 22:00:15 2013 +0200
@@ -761,7 +761,7 @@
                     if not ((entry[1] == publicationType) or  (entry[1] == typesLongShort.get(publicationType,''))) : #stimmt nicht dann weiter
                         continue;
                     
-                pubs.append((selPub.escidocid,entry[0]));
+                pubs.append((selPub.escidocid,entry[0],entry[2]));
                 count+=1
                 
             return pubs
--- a/zpt/staff/pubman/show_publications.zpt	Thu May 30 20:55:07 2013 +0200
+++ b/zpt/staff/pubman/show_publications.zpt	Thu May 30 22:00:15 2013 +0200
@@ -29,8 +29,10 @@
       <tal:block>
         <h3>Books</h3>
         <ul class="plain">
-          <li class="reference" tal:repeat="book books"><a tal:attributes="href python:'http://pubman.mpiwg-berlin.mpg.de/pubman/faces/viewItemFullPage.jsp?itemId='+book[0]"><span
-                tal:replace="structure python:book[1]" /> </a>
+          <li class="reference" tal:repeat="book books"><div><a tal:attributes="href python:'http://pubman.mpiwg-berlin.mpg.de/pubman/faces/viewItemFullPage.jsp?itemId='+book[0]"><span
+                tal:replace="structure python:book[1]" /> </a></div>
+                <div tal:condition="python:book[2] is not None"><a tal:attributes="href python:'/en/resources/publications/'+here.getBookLinkFromID(book[2])">Book page</a></div>
+                
           </li>
         </ul>
       </tal:block>