changeset 283:37b89e8a8828

merging...
author casties
date Thu, 25 Jun 2015 13:43:50 +0200
parents d83971b49b26 (current diff) a1edd65c8ab7 (diff)
children 1a103b073c72
files MPIWGStaff.py
diffstat 5 files changed, 107 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGFeature.py	Thu May 21 09:22:11 2015 +0200
+++ b/MPIWGFeature.py	Thu Jun 25 13:43:50 2015 +0200
@@ -29,6 +29,7 @@
     changeWeightForm = PageTemplateFile('zpt/feature/manage_change_weight', globals())
     changeForm = PageTemplateFile('zpt/feature/manage_config', globals())
     feature_main = PageTemplateFile('zpt/feature/feature_template', globals())
+    index_xml = PageTemplateFile('zpt/feature/feature_index_xml', globals())
 
     def __init__(self, id, title=None, weight=0, date=None, title_en=None, title_de=None, author=None, author_id=None):
         self.id = str(id)
--- a/MPIWGProjects.py	Thu May 21 09:22:11 2015 +0200
+++ b/MPIWGProjects.py	Thu Jun 25 13:43:50 2015 +0200
@@ -380,6 +380,7 @@
     # templates
     #
     project_html = PageTemplateFile('zpt/project/project_index_html', globals())
+    project_xml = PageTemplateFile('zpt/project/project_index_xml', globals())
     # edit templates
     edit_css = ImageFile('css/edit.css', globals())
     # make css refreshable for development
@@ -443,6 +444,13 @@
         # render template
         return pt()
 
+    def index_xml(self):
+        """default xml representation"""
+        # get template
+        pt = self.project_xml
+        # render template
+        return pt()
+
 
     redirect =  MPIWGHelper.redirect
 
@@ -1928,6 +1936,8 @@
     meta_type = "MPIWGProjectFolder"
     security = ClassSecurityInfo()
     
+    allprojects_xml = PageTemplateFile('zpt/project/all_projects_xml', globals())
+    
     # cached HashTree with project hierarchy
     _v_projectTree = None
                     
@@ -1949,6 +1959,14 @@
         return tree
     
     
+    def index_xml(self):
+        """default xml representation"""
+        # get template
+        pt = self.allprojects_xml
+        # render template
+        return pt()
+
+    
     def getProjectsAsList(self, start=None, active=1, archived=1, depthFirst=True, filter=None):
         """Return flattened list of projects, starting from start.
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/feature/feature_index_xml.zpt	Thu Jun 25 13:43:50 2015 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<feature xmlns:tal="http://xml.zope.org/namespaces/tal"
+  xmlns:metal="http://xml.zope.org/namespaces/metal">
+  <id tal:content="here/getId"/>
+  <title>
+    <en tal:content="python:here.getFullTitle(lang='en')"/>
+    <de tal:content="python:here.getFullTitle(lang='de')"/>
+  </title>
+  <author>
+    <name tal:content="here/author|nothing"/>
+    <id tal:content="here/author_id|nothing"/>
+  </author>
+  <date tal:content="python:here.getDateString(lang='iso')"/>
+  <sort-weight tal:content="here/weight|string:0"/>
+  <frontpage>
+    <image tal:content="here/getFrontpageImgUrl"/>
+    <teaser>
+      <en tal:content="python:getattr(here.en.get('teaser.pt'), 'source.html')(request, request.response)"/>
+      <de tal:content="python:getattr(here.de.get('teaser.pt'), 'source.html')(request, request.response)"/>
+    </teaser>
+  </frontpage>
+  <mainpage>
+    <image tal:content="here/img.jpg/absolute_url|nothing"/>
+    <main>
+      <en tal:content="python:getattr(here.en.get('main.pt'), 'source.html')(request, request.response)"/>
+      <de tal:content="python:getattr(here.de.get('main.pt'), 'source.html')(request, request.response)"/>
+    </main>
+  </mainpage>  
+</feature>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/project/all_projects_xml.zpt	Thu Jun 25 13:43:50 2015 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<projects xmlns:tal="http://xml.zope.org/namespaces/tal"
+  xmlns:metal="http://xml.zope.org/namespaces/metal">
+  <project tal:define="start python:int(request.get('start', 0)); end python:int(request.get('end', 10000));" 
+    tal:repeat="project python:here.getProjectsAsList(start=None, active=0, archived=0)[start:end]"
+    tal:replace="structure python:project.index_xml()[22:]"/>
+</projects>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/project/project_index_xml.zpt	Thu Jun 25 13:43:50 2015 +0200
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<project xmlns:tal="http://xml.zope.org/namespaces/tal"
+  xmlns:metal="http://xml.zope.org/namespaces/metal"
+  tal:define="rootUrl here/en/MPIWGrootURL;">
+  <id tal:content="here/getId"/>
+  <title tal:content="here/getProjectTitle">History of Scientific Objectivity, 18th-19th Cs</title>
+  <label tal:content="here/getLabel"/>
+  <projectstarted tal:content="here/getStartedAt"/>
+  <projectcompleted tal:content="here/getCompletedAt"/>
+  <type tal:content="here/getProjectType"/>
+  <number tal:content="here/getNumber"/>
+  <active tal:content="here/isActiveProject"/>
+  <responsiblescientists tal:attributes="textlist here/getResponsibleScientists">
+    <scientist tal:repeat="person here/getResponsibleScientistsList" 
+      tal:attributes="username person/username|nothing; key person/key|nothing"/>
+  </responsiblescientists>
+  <involvedscholars tal:content="here/getInvolvedScholars"/>
+  <cooperationpartners tal:content="here/getCooperationPartners"/>
+  <images>
+    <image tal:repeat="image here/getImageList">
+      <src tal:content="python:image.getUrl(baseUrl=here.getId())"/>
+      <link tal:content="image/getLink"/>
+      <caption tal:content="image/caption"/>
+    </image>
+  </images>
+  <description tal:content="python:here.getDescription(filter=True)">Project description</description>
+  <relatedprojects>
+    <project tal:repeat="project here/getRelatedProjectList" 
+      tal:attributes="id project/getProjectId" tal:content="project/getProjectLabel"/>
+  </relatedprojects>
+  <relatedpublications>
+    <publication tal:repeat="publication here/getPublicationList"
+      tal:attributes="bookid publication/getBookId|nothing; image publication/publicationImage1/absolute_url|nothing; link publication/link; description publication/description|nothing;"
+      tal:content="publication/text|nothing"/>
+  </relatedpublications>
+  <pubmanpublications>
+    <pubmanid tal:repeat="pub here/getAdditionalPublicationList" 
+      tal:attributes="weight pub/priority" tal:content="pub/escidocid"/>
+  </pubmanpublications>
+  <infoblocks>
+    <infoblock tal:repeat="block here/getInfoBlockList">
+      <title tal:content="block/getTitle"></title>
+      <item tal:repeat="item block/getItems"
+        tal:attributes="link item/link" tal:content="item/text"/>
+    </infoblock>
+  </infoblocks>
+  <tal:block tal:define="cal here/getProjectCalendar">
+  <projectcalendar tal:condition="cal" 
+    tal:attributes="url cal/url; only_upcoming python:cal.getFlag('only_upcoming'); num python:cal.getFlag('show_num', 5)"/>
+  </tal:block>
+  <fundinginstitutions tal:content="here/getFundingInstitutions"/>
+</project>
\ No newline at end of file