changeset 100:f4ac675b2031

more members pages.
author casties
date Tue, 21 May 2013 18:50:05 +0200
parents 84fa3f62ed85
children a28e67fbdd31
files MPIWGRoot.py MPIWGStaff.py css/mpiwg.css zpt/project/project_index_html.zpt zpt/staff/edit_talks.zpt zpt/staff/edit_teaching.zpt zpt/staff/member_index_html.zpt zpt/staff/pubman/show_publications.zpt zpt/staff/talks_full_html.zpt zpt/staff/teaching_full_html.zpt
diffstat 10 files changed, 201 insertions(+), 113 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGRoot.py	Tue May 21 17:07:48 2013 +0200
+++ b/MPIWGRoot.py	Tue May 21 18:50:05 2013 +0200
@@ -137,7 +137,7 @@
     
         subsecs = sec.objectItems(spec=self.nav_meta_types)
         subsecs = [s for s in subsecs if s[1].title != ""]
-        subsecs.sort(key=lambda x:int(getattr(x[1],'weight','0')))
+        subsecs.sort(key=lambda x:getInt(getattr(x[1], 'weight', '0')))
         return subsecs
 
     # compatibility
@@ -147,7 +147,7 @@
     def getSections(self):
         """returns a list of all sections i.e. top-level MPIWGFolders"""
         items = self.objectValues(spec='MPIWGFolder')[:]
-        items.sort(key=lambda x:int(x.weight))
+        items.sort(key=lambda x:getInt(getattr(x, 'weight', '0')))
         return items
 
 
--- a/MPIWGStaff.py	Tue May 21 17:07:48 2013 +0200
+++ b/MPIWGStaff.py	Tue May 21 18:50:05 2013 +0200
@@ -220,7 +220,9 @@
     
     # templates
     mainEditFile=PageTemplateFile('zpt/staff/edit_main', globals())    
-    
+    talks_full_html = PageTemplateFile('zpt/staff/talks_full_html', globals())
+    teaching_full_html = PageTemplateFile('zpt/staff/teaching_full_html', globals())
+
 
     def __init__(self, folder, dbresult):
         """constructor: takes parent MPIWGStaffFolder and content (DB row)"""
@@ -297,13 +299,27 @@
         
     getUrl = MPIWGHelper.getUrl
     
-    def getTalks(self):
-        return self.folder.executeZSQL("SELECT oid,* FROM talks  WHERE  key_main = %s",[self.content.key]) 
-        #return self.folder.ZSQLInlineSearch(_table='talks',key_main=self.content.key)
+    def getTalks(self, published=True, sortBy='priority'):
+        """Return the list of talks"""
+        query = "SELECT oid,* FROM talks WHERE key_main = %s"
+        if published:
+            query += " and published = 'yes'"
+            
+        if sortBy == 'priority':
+            query += " order by priority"
+            
+        return self.folder.executeZSQL(query, [self.content.key])     
     
-    
-    def getTeaching(self):
-        return self.folder.executeZSQL("SELECT oid,* FROM teaching  WHERE  key_main = %s",[self.content.key]) 
+    def getTeaching(self, published=True, sortBy='priority'):
+        """Return the list of teaching activities"""
+        query = "SELECT oid,* FROM teaching WHERE key_main = %s"
+        if published:
+            query += " AND published = 'yes'"
+            
+        if sortBy == 'priority':
+            query += " ORDER BY priority"
+            
+        return self.folder.executeZSQL("SELECT oid,* FROM teaching WHERE key_main = %s",[self.content.key]) 
     
     
     def getLastUpdateCV(self):
@@ -668,13 +684,10 @@
         return {}
     
     
-    def publicationsFull(self,REQUEST):
+    def publications_full_html(self, REQUEST):
         """show publication"""
-        pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','show_publications.zpt')).__of__(self)
+        pt=PageTemplateFile('zpt/staff/pubman/show_publications.zpt', globals()).__of__(self)
         return pt(member=self.content)
-        
-
-        
 
         
     def addPublicationsFromPubman(self,REQUEST):
@@ -776,7 +789,7 @@
 
     def getSelectedPublications(self):
         """hole publications aus der datenbank"""
-        query="select * from pubmanbiblio where lower(key_main) = lower(%s) order by priority DESC"
+        query="select * from pubmanbiblio where lower(key_main) = lower(%s) order by priority ASC"
         return self.executeZSQL(query,[self.getKey()])
     
     
--- a/css/mpiwg.css	Tue May 21 17:07:48 2013 +0200
+++ b/css/mpiwg.css	Tue May 21 18:50:05 2013 +0200
@@ -106,6 +106,14 @@
     line-height: 1.5;
 }
 
+ul.plain {
+    list-style-type: none;
+    padding-left: 0.5em;
+}
+ul.plain > li {
+    margin-top: 0.5em;
+}
+
 ul.inline {
     display: inline;
     padding: 0;
@@ -828,6 +836,9 @@
 table.items td:last-child {
     padding-right: 0;
 }
+table.items.shorter td {
+    padding: 0.5em 0.5em 0.5em 0;
+}
 
 table.items th {
     font-family: Georgia, Times, serif;
--- a/zpt/project/project_index_html.zpt	Tue May 21 17:07:48 2013 +0200
+++ b/zpt/project/project_index_html.zpt	Tue May 21 18:50:05 2013 +0200
@@ -33,12 +33,11 @@
     <h1 class="mpiwg-title" tal:content="here/getProjectTitle">History of Scientific Objectivity, 18th-19th Cs</h1>
     <h3 class="authors mpiwg-authors">
       <tal:block tal:repeat="person here/getResponsibleScientistsList">
-          <a class="mpiwg-author" 
-            tal:define="username person/username|nothing; key person/key|nothing;" 
-            tal:omit-tag="python:not username or not here.getStaffFolder().isActiveMember(key=key)"
-            tal:attributes="href string:$root/${secmap/staff}/members/$username" tal:content="person/name">
-            Name of responsible person
-          </a><tal:block tal:condition="not:repeat/person/end">, </tal:block>
+        <a class="mpiwg-author" tal:define="username person/username|nothing; key person/key|nothing;"
+          tal:omit-tag="python:not username or not here.getStaffFolder().isActiveMember(key=key)"
+          tal:attributes="href string:$root/${secmap/staff}/members/$username" tal:content="person/name"> Name of responsible
+          person </a>
+        <tal:block tal:condition="not:repeat/person/end">, </tal:block>
       </tal:block>
     </h3>
 
--- a/zpt/staff/edit_talks.zpt	Tue May 21 17:07:48 2013 +0200
+++ b/zpt/staff/edit_talks.zpt	Tue May 21 18:50:05 2013 +0200
@@ -8,7 +8,7 @@
   <form action="" method="post">
   <input type="hidden" name="key_main" tal:attributes="value python:here.content.key">
   <input type="hidden" name="main_fields" value="talks__title">
-  <table tal:define="founds2 python:here.getTalks()">
+  <table tal:define="founds2 python:here.getTalks(published=False)">
     <tr>
       <th>Date</th>
       <th>Title/Place/Link</th>
--- a/zpt/staff/edit_teaching.zpt	Tue May 21 17:07:48 2013 +0200
+++ b/zpt/staff/edit_teaching.zpt	Tue May 21 18:50:05 2013 +0200
@@ -8,7 +8,7 @@
   <form action="" method="post">
   <input type="hidden" name="key_main" tal:attributes="value python:here.content.key">
   <input type="hidden" name="main_fields" value="teaching__title">
-  <table tal:define="founds2 python:here.getTeaching()">
+  <table tal:define="founds2 python:here.getTeaching(published=False)">
     <tr>
       <th>Date</th>
       <th>Title/Place/Link</th>
--- a/zpt/staff/member_index_html.zpt	Tue May 21 17:07:48 2013 +0200
+++ b/zpt/staff/member_index_html.zpt	Tue May 21 18:50:05 2013 +0200
@@ -34,6 +34,7 @@
         Residence: <span tal:replace="content/date_stay_at_mpiwg" />
       </p>
     </div>
+    
     <!-- profile -->
     <div>
       <tal:x tal:condition="not:content/profile">
@@ -41,69 +42,69 @@
       </tal:x>
       <tal:x tal:condition="content/profile">
         <h2>Profile</h2>
-        <tal:x tal:content="structure content/profile"> [FMP-Field: CV] </tal:x>
+        <div class="profile" tal:content="structure content/profile"> [FMP-Field: CV] </div>
       </tal:x>
     </div>
+    
     <!-- publications -->
     <tal:block
       tal:define="publications python:here.ZDBInlineSearch(_table='publications',key_main=key,_op_key_main='eq',publish='yes',_op_publish='eq')"
       tal:condition="publications">
       <h2>Selected publications</h2>
-      <p tal:repeat="publication python:member.getPublicationsFromPubman(limit=5)">
+      <p class="reference" tal:repeat="publication python:member.getPublicationsFromPubman(limit=5)">
         <a tal:attributes="href python:'http://pubman.mpiwg-berlin.mpg.de/pubman/faces/viewItemFullPage.jsp?itemId='+publication[0]"
           tal:content="structure python:publication[1]" />
       </p>
       <p tal:condition="python:len(publications)>5">
-        <a class="internal" tal:attributes="href string:$baseUrl/publicationsFull">More</a>
+        <a class="internal" tal:attributes="href string:$baseUrl/publications_full_html">More</a>
       </p>
-      <p>
+      <!-- <p>
         <a class="external" target="_blank" tal:attributes="href member/getConeId">See all publications (PubMan)</a>
-      </p>
+      </p> -->
     </tal:block>
+    
     <!-- Talks -->
-    <tal:block
-      tal:define="talks python:here.ZDBInlineSearch(_table='talks',key_main=key,_op_key_main='eq',_sort='priority',published='yes')"
-      tal:condition="talks">
+    <tal:block tal:define="talks member/getTalks" tal:condition="talks">
       <h2>Talks and presentations</h2>
-      <div class="namelist">
-        <tal:block tal:repeat="talk python:here.ZDBSlice(talks,size=5)">
-          <div class="name">
+      <table class="items shorter">
+        <tr tal:repeat="talk python:here.ZDBSlice(talks,size=5)">
+          <td>
             <a tal:omit-tag="not:talk/link" tal:attributes="href talk/link" tal:content="talk/date" />
-          </div>
-          <div class="definition">
+          </td>
+          <td>
             <a tal:omit-tag="not:talk/link" tal:attributes="href talk/link"> <span tal:replace="talk/place" /> &#150; <i><span
                 tal:replace="talk/title" /></i>
             </a>
-          </div>
-        </tal:block>
-      </div>
+          </td>
+        </tr>
+      </table>
       <p tal:condition="python:len(talks)>5">
-        <a class="internal" tal:attributes="href string:$baseUrl/talks_full">More</a>
+        <a class="internal" tal:attributes="href string:$baseUrl/talks_full_html">More</a>
       </p>
     </tal:block>
+    
     <!-- Teaching activities -->
-    <tal:block tal:define="teachings python:here.ZDBInlineSearch(_table='teaching',key_main=key,_op_key_main='eq',_sort='priority')"
-      tal:condition="teachings">
+    <tal:block tal:define="teachings member/getTeaching" tal:condition="teachings">
       <h2>Teaching activities</h2>
-      <div class="namelist">
-        <tal:block tal:repeat="teaching python:here.ZDBSlice(teachings, size=5)">
-          <div class="name">
+      <table class="items shorter">
+        <tr tal:repeat="teaching python:here.ZDBSlice(teachings, size=5)">
+          <td>
             <a tal:omit-tag="not:teaching/link" tal:attributes="href teaching/link"> <span tal:replace="teaching/date" />
             </a>
-          </div>
-          <div class="definition">
+          </td>
+          <td>
             <a tal:omit-tag="not:teaching/link" tal:attributes="href teaching/link"> <span tal:replace="teaching/place" />
               &#150; <i><span tal:replace="teaching/title" /></i>
             </a>
-          </div>
-        </tal:block>
-        <p tal:condition="python:len(teachings)>5">
-          <a class="internal" tal:attributes="href string:$baseUrl/teaching_full">More</a>
-        </p>
-      </div>
+          </td>
+        </tr>
+      </table>
+      <p tal:condition="python:len(teachings)>5">
+        <a class="internal" tal:attributes="href string:$baseUrl/teaching_full_html">More</a>
+      </p>
     </tal:block>
-  </div>
-  <!-- center -->
+    
+  </div><!-- /center -->
 
 
   <!--sidebar content -->
--- a/zpt/staff/pubman/show_publications.zpt	Tue May 21 17:07:48 2013 +0200
+++ b/zpt/staff/pubman/show_publications.zpt	Tue May 21 18:50:05 2013 +0200
@@ -1,74 +1,65 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 	  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" metal:use-macro="here/main_template/macros/page">
-  <head>
-    <tal:block metal:fill-slot="head">
-      </tal:block>
-  </head>
-  <body>
-   <div class="center" metal:fill-slot="center">
-  
-      <h1>
-        <span tal:replace="python:options['member'].title"/> <span tal:replace="python:options['member'].first_name"/> <span tal:replace="python:options['member'].last_name"/>
-      </h1>
-     
-      <p>
-	<a tal:attributes="href string:$root/$section/members/${here/getId}">main entry</a> 
-      </p>
+<head>
+<tal:block metal:fill-slot="head">
+</tal:block>
+</head>
+<body>
+  <div class="center" metal:fill-slot="center">
 
-      <h2>Selected publications</h2>
-      <tal:block tal:define="
+    <h1>
+      <span tal:replace="python:options['member'].title" /> <span tal:replace="python:options['member'].first_name" /> <span
+        tal:replace="python:options['member'].last_name" />
+    </h1>
+
+    <p>
+      <a tal:attributes="href string:$root/$section/members/${here/getId}">main entry</a>
+    </p>
+
+    <h2>Selected publications</h2>
+    <tal:block
+      tal:define="
 			     books python:here.getPublicationsFromPubman(publicationType='http://purl.org/eprint/type/Book');
 			     book_article python:here.getPublicationsFromPubman(publicationType='http://purl.org/eprint/type/BookItem');
 			     articles python:here.getPublicationsFromPubman(publicationType='http://purl.org/escidoc/metadata/ves/publication-types/article');
 				">
-       
-        <tal:block >
-          <h3>Books</h3>
-          <ul class="publicationlist">
-	    <li tal:repeat="found3 books">
-	     <span>
-	    <a tal:attributes="href python:''"><span tal:replace="structure python:found3[1]"/>
-            </a>
-	  </span>
-	
-            </li>
-          </ul>
-        </tal:block>
 
-        <tal:block >
-          <h3>Book Chapters</h3>
-	  <ul class="publicationlist">
-	   <li tal:repeat="found3 book_article">
-	     <span >
-	    <a tal:attributes="href python:''"><span tal:replace="structure python:found3[1]"/></a>
-	  </span>
-	
-            </li>
-          </ul>
-        </tal:block>
-
-        <tal:block>
-	  <h3>Articles</h3>
-	  <ul class="publicationlist">
-	    <li tal:repeat="found3 articles">
-	     <span ">
-	    <a tal:attributes="href python:''"><span tal:replace="structure python:found3[1]"/>
-            </a>
-	  </span>
-	  
-            </li>
-          </ul>
-        </tal:block>
-      
+      <tal:block>
+        <h3>Books</h3>
+        <ul class="plain">
+          <li class="reference" tal:repeat="book books"><a tal:attributes="href python:''"><span
+                tal:replace="structure python:book[1]" /> </a>
+          </li>
+        </ul>
       </tal:block>
 
-<!--
+      <tal:block>
+        <h3>Book Chapters</h3>
+        <ul class="plain">
+          <li class="reference" tal:repeat="book book_article"><a tal:attributes="href python:''"><span
+                tal:replace="structure python:book[1]" /></a>
+          </li>
+        </ul>
+      </tal:block>
+
+      <tal:block>
+        <h3>Articles</h3>
+        <ul class="plain">
+          <li class="reference" tal:repeat="book articles"><a tal:attributes="href python:''"><span
+                tal:replace="structure python:book[1]" /> </a>
+          </li>
+        </ul>
+      </tal:block>
+
+    </tal:block>
+
+    <!--
         <p> 
 	  <a href="/institutsbiblio/FMPro?-db=personal-www&amp;-max=1&amp;-Lay=ALL&amp;-format=search_inst_bib.html&amp;ID=[FMP-Field: ID]&amp;-Error=null.html&amp;-find" target="_new"> 
               search the institute's bibliography </a>
  -->
-   
-</div>
-  </body>
+
+  </div>
+</body>
 </html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/staff/talks_full_html.zpt	Tue May 21 18:50:05 2013 +0200
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" metal:use-macro="here/main_template/macros/page">
+<head>
+<tal:block metal:fill-slot="head">
+  <tal:x define="global member here/getContent" />
+</tal:block>
+</head>
+<body>
+  <div class="center" metal:fill-slot="center">
+    <h1>
+      <span tal:replace="member/title" /> <span tal:replace="python:here.decode(member.first_name)" /> <span
+        tal:replace="python:here.decode(member.last_name)" />
+    </h1>
+
+    <p>
+      <a tal:attributes="href python:here.getUrl(baseUrl=root+'/'+secmap['staff']+'/members')">main entry</a>
+    </p>
+
+    <h2>Talks and presentations</h2>
+    
+    <table class="items shorter" tal:define="talks here/getTalks">
+      <tr tal:repeat="talk talks">
+        <td>
+          <span tal:content="talk/date" />
+        </td>
+        <td>
+          <a tal:attributes="href talk/link" tal:omit-tag="not:talk/link">
+            <span tal:content="talk/place" /> &#150; <i tal:content="talk/title" />
+          </a>
+        </td>
+      </tr>
+    </table>
+  </div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/staff/teaching_full_html.zpt	Tue May 21 18:50:05 2013 +0200
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" metal:use-macro="here/main_template/macros/page">
+<head>
+<tal:block metal:fill-slot="head">
+  <tal:x define="global member here/getContent" />
+</tal:block>
+</head>
+<body>
+  <div class="center" metal:fill-slot="center">
+    <h1>
+      <span tal:replace="member/title" /> <span tal:replace="member/first_name" /> <span
+        tal:replace="member/last_name" />
+    </h1>
+
+    <p>
+      <a tal:attributes="href python:here.getUrl(baseUrl=root+'/'+secmap['staff']+'/members')">main entry</a>
+    </p>
+
+    <h2>Teaching activities</h2>
+    
+    <table class="items shorter" tal:define="teachings here/getTeaching">
+      <tr tal:repeat="teaching teachings">
+        <td>
+          <span tal:content="teaching/date" />
+        </td>
+        <td>
+          <a tal:attributes="href teaching/link" tal:omit-tag="not:teaching/link">
+            <span tal:content="teaching/place" /> &#150; <i tal:content="teaching/title" />
+          </a>
+        </td>
+      </tr>
+    </table>
+
+  </div>
+</body>
+</html>
\ No newline at end of file