changeset 247:5584046a6a04

Merge with 878de95fb6a2313d9cd132941bde8f341af94616
author dwinter
date Tue, 25 Feb 2014 08:12:12 +0100
parents 8fca81581883 (current diff) 878de95fb6a2 (diff)
children a14e462fca1c 065c4284238f
files MPIWGRoot.py MPIWGStaff.py zpt/staff/edit_publications.zpt
diffstat 9 files changed, 88 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGRoot.py	Tue Feb 25 08:07:59 2014 +0100
+++ b/MPIWGRoot.py	Tue Feb 25 08:12:12 2014 +0100
@@ -49,7 +49,7 @@
     # make mpiwg_js refreshable for development
     mpiwg_js.index_html = refreshingImageFileIndexHtml
     # ZMI
-    changeMPIWGRootForm = PageTemplateFile('zpt/root/manage_change')
+    changeMPIWGRootForm = PageTemplateFile('zpt/root/manage_change', globals())
 
 
 
--- a/MPIWGStaff.py	Tue Feb 25 08:07:59 2014 +0100
+++ b/MPIWGStaff.py	Tue Feb 25 08:12:12 2014 +0100
@@ -593,29 +593,43 @@
         if REQUEST:
             argv=REQUEST.form
             
-            # ICS URL driven talks
             url = argv.get('ics_url', None)
             if url:
+                #
+                # ICS URL driven talks
+                #
                 cal_id = "%s_talks"%self.getUsername()
                 # use ICS calendar
                 cal = self.getTalksCal()
-                if cal is not None:
+                if cal is None:
+                    # create new calendar
+                    cal = MPIWGIcsManager(cal_id, '', url, defaultProps=calendar_props)
+                    self.folder.get('calendars')[cal_id] = cal
+                    
+                else:
                     # calendar exists
-                    if cal.url == url:
-                        # same url
-                        return pt()
-                    else:
-                        # remove
+                    if cal.url != url:
+                        # remove and re-create
                         del self.folder.get('calendars')[cal_id]
+                        cal = MPIWGIcsManager(cal_id, '', url, defaultProps=calendar_props)
+                        self.folder.get('calendars')[cal_id] = cal
 
-                # create new calendar
-                cal = MPIWGIcsManager(cal_id, '', url, defaultProps=calendar_props)
-                self.folder.get('calendars')[cal_id] = cal
+                # show only upcoming
+                upcoming = argv.get('only_upcoming', None)
+                cal.setFlag('only_upcoming', (upcoming == 'yes'))
+                # number of events
+                talks_num = int(argv.get('talks_num', 5))
+                self.changeData({'talks_num': talks_num})
                 
-            # manually edited talks
             elif argv.has_key('main_fields'): #got data to change
+                #
+                # manually edited talks
+                #
                 self.invalidate_cache()
                 self.changeAdditionalData(argv);
+                # number of events
+                talks_num = int(argv.get('talks_num', 5))
+                self.changeData({'talks_num': talks_num})
                        
         return pt()
      
@@ -629,6 +643,9 @@
             if argv.has_key('main_fields'): #got data to change
                 self.invalidate_cache()
                 self.changeAdditionalData(argv);
+                # number of items
+                teachings_num = int(argv.get('teachings_num', 5))
+                self.changeData({'teachings_num': teachings_num})
                        
         pt=PageTemplateFile('zpt/staff/edit_teaching.zpt', globals()).__of__(self)
         return pt()
@@ -658,13 +675,16 @@
     def editPublications(self,REQUEST):    
         """editiere die Publications von der Webseite"""
         data=REQUEST.form
+        newData = {}
         
-        if data.has_key('selectionMode'):
-            query="UPDATE personal_www SET publications_mode=%s WHERE key=%s" 
+        if 'selectionMode' in data:
+            newData['publications_mode'] = data['selectionMode']
             
-            self.executeZSQL(query,[data['selectionMode'],self.getKey()])
-            
-            self.refresh_content()
+        if 'publications_num' in data:
+            newData['publications_num'] = int(data['publications_num'])
+
+        if len(newData) > 0:
+            self.changeData(newData)
             
         pt=PageTemplateFile('zpt/staff/edit_publications.zpt', globals()).__of__(self)
         return pt()
--- a/css/mpiwg.css	Tue Feb 25 08:07:59 2014 +0100
+++ b/css/mpiwg.css	Tue Feb 25 08:12:12 2014 +0100
@@ -1231,7 +1231,13 @@
 div.image_small img {
     width: 230px;
 }
-div.banner_large img {
+
+div.banner_large,
+div.image_large {
+    padding: 0.5em 0;
+}
+div.banner_large img,
+div.image_large img {
     width: 460px;
 }
 
--- a/zpt/feature/feature_template.zpt	Tue Feb 25 08:07:59 2014 +0100
+++ b/zpt/feature/feature_template.zpt	Tue Feb 25 08:12:12 2014 +0100
@@ -8,7 +8,8 @@
 <title tal:content="here/getFullTitle"></title>
 </meta:block>
 <metal:block metal:fill-slot="head">
-  <meta name="description" content="feature"/> 
+  <meta name="description" content="feature"/>
+  <metal:block metal:define-slot="head"/>
 </metal:block>
 </head>
 <body>
@@ -58,4 +59,4 @@
   <!-- sidebar -->
 </body>
   </html>
-</metal:block>
\ No newline at end of file
+</metal:block>
--- a/zpt/staff/edit_publications.zpt	Tue Feb 25 08:07:59 2014 +0100
+++ b/zpt/staff/edit_publications.zpt	Tue Feb 25 08:12:12 2014 +0100
@@ -11,10 +11,13 @@
     <p>
      <input type="radio" name="selectionMode" value="year" 
       tal:attributes="checked python:here.content.publications_mode=='year'" />
-      Show the five most recent publications. (no further action needed)<br/>
+      Show the publications sorted by Date. (no further action needed)<br/>
       <input type="radio" name="selectionMode" value="priority"
         tal:attributes="checked python:here.content.publications_mode=='priority'" />
-      Show selected publications.
+      Show only selected publications by priority.
+    </p>
+    <p>
+      Number of items on profile page: <input name="publications_num" size="2" tal:attributes="value python:here.content.publications_num or 5"/>
     </p>
     <p>
       <input type="submit" value="Set mode" />
--- a/zpt/staff/edit_talks.zpt	Tue Feb 25 08:07:59 2014 +0100
+++ b/zpt/staff/edit_talks.zpt	Tue Feb 25 08:12:12 2014 +0100
@@ -70,7 +70,14 @@
   <p tal:condition="cal">
   Remove the calendar URL to enter talks manually.
   </p>
-  
+  <p tal:condition="cal">
+    <tal:block tal:define="name string:only_upcoming; value python:test(cal.getFlag('only_upcoming'), 'yes', 'no');">
+      Show only upcoming events in the calendar: <span metal:use-macro="here/common_template/macros/yesno_input_radio"/>
+    </tal:block>    
+  </p>
+  <p>
+    Number of items on profile page: <input name="talks_num" size="2" tal:attributes="value python:here.content.talks_num or 5"/>
+  </p>
   <p>
     <input type="submit" value="submit"/>
   </p>
--- a/zpt/staff/edit_teaching.zpt	Tue Feb 25 08:07:59 2014 +0100
+++ b/zpt/staff/edit_teaching.zpt	Tue Feb 25 08:12:12 2014 +0100
@@ -6,8 +6,8 @@
 
 <tal:block metal:fill-slot="body">
   <form tal:attributes="action string:$root/editTeaching" method="post">
-  <input type="hidden" name="key_main" tal:attributes="value python:here.content.key">
-  <input type="hidden" name="main_fields" value="teaching__title">
+  <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="teachings python:here.getTeaching(published=False)">
     <tr>
       <th>Date</th>
@@ -53,6 +53,9 @@
     </tr>
   </table>
   <p>
+      Number of items on profile page: <input name="teachings_num" size="2" tal:attributes="value python:here.content.teachings_num or 5"/>
+  </p>
+  <p>
     <input type="submit" value="submit"/>
   </p>
 
--- a/zpt/staff/member_index_html.zpt	Tue Feb 25 08:07:59 2014 +0100
+++ b/zpt/staff/member_index_html.zpt	Tue Feb 25 08:12:12 2014 +0100
@@ -1,6 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 	  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html metal:use-macro="here/main_template/macros/page">
+<html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal"
+      xmlns="http://www.w3.org/1999/xhtml" metal:use-macro="here/main_template/macros/page">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <metal:block metal:fill-slot="head">
@@ -50,9 +51,8 @@
     </div>
     
     <!-- publications -->
-  <!--       tal:define="publications python:here.ZDBInlineSearch(_table='pubmanbiblio',key_main=key,_op_key_main='eq')" -->
     <tal:block
-      tal:define="publications python:member.getPublicationsFromPubman(limit=6)"
+      tal:define="show_num python:content.publications_num or 5; publications python:member.getPublicationsFromPubman(limit=show_num+1)"
       tal:condition="publications">
 
       <h2 class="line">Selected publications</h2>
@@ -67,29 +67,31 @@
           <span tal:repeat="ident python:publication[4]"><a class="external" target="_blank" tal:attributes="href python:ident[1]" tal:content="python:ident[0]">See also</a></span>
         </li>
       </ul>
-      <p tal:condition="python:len(publications)>5">
+      <p tal:condition="python:len(publications)>show_num">
         <a class="internal" tal:attributes="href string:$baseUrl/publications_full_html">More publications</a>
       </p>
     </tal:block>
 
     <!-- Talks -->
-    <tal:block tal:define="calendar member/getTalksCal">
+    <tal:block tal:define="calendar member/getTalksCal; show_num python:content.talks_num or 5">
       <tal:block tal:condition="calendar">
-        <tal:block tal:define="talks python:calendar.getNext(6)" tal:condition="talks">
+        <tal:block tal:define="upcoming python:calendar.getFlag('only_upcoming', False);
+            talks python:test(upcoming, calendar.getAllItemsFromTodayOn()[:show_num], calendar.getNext(show_num, reverse=True))" tal:condition="talks">
         
-          <h2 class="line">Talks and presentations</h2>
+          <h2 class="line" tal:condition="upcoming">Upcoming talks and presentations</h2>
+          <h2 class="line" tal:condition="not:upcoming">Talks and presentations</h2>
 
           <table class="items shorter">
             <tr tal:repeat="talk talks">
               <tal:block tal:define="url python:talk.getValue('url')">
                 <td width="25%" tal:content="python:talk.getDate()" />
-                <td><a tal:omit-tag="not:url" tal:attributes="href url"> <span tal:replace="python:talk.getValue('location')" />
+                <td><a class="external" target="_blank" tal:omit-tag="not:url" tal:attributes="href url"><span tal:replace="python:talk.getValue('location')" />
                     &#150; <i><span tal:replace="python:talk.getValue('title')" /></i>
                 </a></td>
               </tal:block>
             </tr>
           </table>
-          <p tal:condition="python:len(talks)>5">
+          <p tal:condition="python:len(calendar.getItems())>show_num">
             <a class="internal" tal:attributes="href string:$baseUrl/talks_full_html">More</a>
           </p>
         </tal:block>
@@ -100,14 +102,14 @@
           <h2 class="line">Talks and presentations</h2>
 
           <table class="items shorter">
-            <tr tal:repeat="talk python:here.ZDBSlice(talks,size=5)">
+            <tr tal:repeat="talk python:here.ZDBSlice(talks,size=show_num)">
               <td width="25%" tal:content="talk/date" />
-              <td><a tal:omit-tag="not:talk/link" tal:attributes="href talk/link"> <span tal:replace="talk/place" /> &#150; <i><span
+              <td><a class="external" target="_blank" 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></td>
             </tr>
           </table>
-          <p tal:condition="python:len(talks)>5">
+          <p tal:condition="python:len(talks)>show_num">
             <a class="internal" tal:attributes="href string:$baseUrl/talks_full_html">More</a>
           </p>
         </tal:block>
@@ -115,12 +117,12 @@
     </tal:block>
 
     <!-- Teaching activities -->
-    <tal:block tal:define="teachings member/getTeaching" tal:condition="teachings">
+    <tal:block tal:define="teachings member/getTeaching; show_num python:content.teachings_num or 5" tal:condition="teachings">
 
       <h2 class="line">Teaching activities</h2>
 
       <table class="items shorter">
-        <tr tal:repeat="teaching python:here.ZDBSlice(teachings, size=5)">
+        <tr tal:repeat="teaching python:here.ZDBSlice(teachings, size=show_num)">
           <td width="25%">
             <a tal:omit-tag="not:teaching/link" tal:attributes="href teaching/link"> <span tal:replace="teaching/date" />
             </a>
@@ -132,7 +134,7 @@
           </td>
         </tr>
       </table>
-      <p tal:condition="python:len(teachings)>5">
+      <p tal:condition="python:len(teachings)>show_num">
         <a class="internal" tal:attributes="href string:$baseUrl/teaching_full_html">More</a>
       </p>
     </tal:block>
--- a/zpt/staff/talks_full_html.zpt	Tue Feb 25 08:07:59 2014 +0100
+++ b/zpt/staff/talks_full_html.zpt	Tue Feb 25 08:12:12 2014 +0100
@@ -1,6 +1,7 @@
 <!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">
+<html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal"
+      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" />
@@ -21,12 +22,12 @@
 
     <tal:block tal:define="calendar here/getTalksCal">
       <tal:block tal:condition="calendar">
-        <tal:block tal:define="talks python:calendar.getSortedItems()">
+        <tal:block tal:define="talks python:calendar.getSortedItems(reverse=True)">
           <table class="items shorter">
             <tr tal:repeat="talk talks">
               <tal:block tal:define="url python:talk.getValue('url')">
-                <td width="25%" tal:content="python:talk.getDate()" />
-                <td><a tal:omit-tag="not:url" tal:attributes="href url"> <span
+                <td tal:content="python:talk.getDate()" />
+                <td><a class="external" target="_blank" tal:omit-tag="not:url" tal:attributes="href url"> <span
                     tal:replace="python:talk.getValue('location')" /> &#150; <i><span
                       tal:replace="python:talk.getValue('title')" /></i>
                 </a></td>
@@ -41,7 +42,7 @@
           <table class="items shorter">
             <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" />
+              <td><a class="external" target="_blank" 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>