changeset 584:011905457a5f

new viewmode=indexonly as coverpage for pdf-generation.
author casties
date Mon, 12 Nov 2012 18:13:33 +0100
parents ca0274423382
children 83eeed69793f
files documentViewer.py zpt/common_template.zpt zpt/viewer_indexonly.zpt
diffstat 3 files changed, 134 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Mon Nov 12 18:12:33 2012 +0100
+++ b/documentViewer.py	Mon Nov 12 18:13:33 2012 +0100
@@ -133,6 +133,7 @@
     viewer_images = PageTemplateFile('zpt/viewer_images', globals())
     viewer_index = PageTemplateFile('zpt/viewer_index', globals())
     viewer_thumbs = PageTemplateFile('zpt/viewer_thumbs', globals())
+    viewer_indexonly = PageTemplateFile('zpt/viewer_indexonly', globals())
     # available layer types (annotator not default)
     builtinLayers = {'text': ['dict','search','gis'],
                      'xml': None, 'images': None, 'index': ['extended']}
--- a/zpt/common_template.zpt	Mon Nov 12 18:12:33 2012 +0100
+++ b/zpt/common_template.zpt	Mon Nov 12 18:13:33 2012 +0100
@@ -24,7 +24,7 @@
           tal:content="string:[no bibliographical information for this document (type ${bibType})]" />
       </div>
       <div class="title" tal:condition="formattedLabel" tal:content="structure formattedLabel" />
-      <ul class="view-switcher">
+      <ul class="view-switcher" metal:define-slot="view-switcher">
         <li tal:condition="docpath" tal:attributes="class python:here.getStyle(viewMode, 'text')"><a
           tal:omit-tag="python:viewMode=='text'" tal:attributes="href python:here.getLink('viewMode','text')">Text</a></li>
         <li tal:condition="python:docinfo.get('imagePath',None)" tal:attributes="class python:here.getStyle(viewMode, 'images')"><a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer_indexonly.zpt	Mon Nov 12 18:13:33 2012 +0100
@@ -0,0 +1,132 @@
+<!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"
+  tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode pageinfo/viewMode;
+                  tocMode pageinfo/tocMode; viewerUrl docinfo/viewerUrl;
+                  docpath docinfo/textURLPath | nothing;
+                  query nothing;
+                  numPages docinfo/numPages | nothing;
+                  global formattedData python:here.metadata.getBibFormattedMetaData(bibdata=docinfo.get('bib', None));">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
+<link rel="stylesheet" tal:attributes="href string:$viewerUrl/template/docuviewer_css" type="text/css" />
+</head>
+<body tal:condition="numPages">
+  <!-- header -->
+  <div class="page-head">
+    <metal:block metal:use-macro="here/template/common_template/macros/head">
+      <div metal:fill-slot="view-switcher"></div>
+    </metal:block>
+  </div>
+
+  <!-- main -->
+  <div class="page-body">
+
+    <div class="col index-image">
+      <!-- image -->
+      <a tal:define="tp docinfo/titlePage | string:1"
+        tal:attributes="href python:context.getLink(params={'viewMode':'auto','pn':tp})"><img tal:condition="tp" border="0"
+        tal:attributes="src python:'%s&pn=%s&dw=300&dh=500'%(docinfo.get('imageURL',None),tp)" /><img
+        tal:condition="python:not docinfo.get('titlePage',None) and exists('here/template/book.png')" border="0"
+        src="template/book.png" /></a>
+    </div>
+
+    <div class="col main">
+      <!-- main content column -->
+      <div class="index-info">
+        <h2>Bibliographic information</h2>
+        <table border="0">
+          <tal:x condition="python:formattedData">
+            <!-- wenn es bibinfo in docinfo gibt -->
+            <tr tal:replace="structure python:formattedData" />
+          </tal:x>
+
+          <tal:x condition="not:formattedData">
+            <!-- kein template fuer die daten -->
+            <tal:x condition="exists:docinfo/bib">
+              <tr tal:define="bibinfo docinfo/bib" tal:repeat="bib bibinfo">
+                <td class="type" tal:content="python:bib.capitalize().replace('_',' ') + ':'" />
+                <td class="content" tal:content="bibinfo/bib" />
+              </tr>
+            </tal:x>
+
+            <tal:y condition="not:exists:docinfo/bib">
+              <!-- wenn es kein bibinfo gibt (archimedes-texte) -->
+              <tr>
+                <td class="type">Author:</td>
+                <td class="content" tal:content="docinfo/creator" />
+              </tr>
+              <tr>
+                <td class="type">Title:</td>
+                <td class="content" tal:content="docinfo/title" />
+              </tr>
+              <tr>
+                <td class="type">Date:</td>
+                <td class="content" tal:content="docinfo/date" />
+              </tr>
+            </tal:y>
+          </tal:x>
+          <!-- ende kein template fuer die daten -->
+        </table>
+
+        <tal:block tal:define="dri docinfo/DRI | nothing" tal:condition="dri">
+          <h2>Permanent URL</h2>
+          <table>
+            <tr>
+              <td class="type">Document ID:</td>
+              <td class="content" tal:content="dri" />
+            </tr>
+            <tr>
+              <td class="type">Permanent URL:</td>
+              <td class="content"><a target="_blank" tal:attributes="href string:http://echo.mpiwg-berlin.mpg.de/$dri"
+                tal:content="string:http://echo.mpiwg-berlin.mpg.de/$dri" /></td>
+            </tr>
+          </table>
+        </tal:block>
+
+        <tal:block tal:define="ctxs docinfo/presentationContext | nothing" tal:condition="ctxs">
+          <h2>Presentation context</h2>
+          <ul>
+            <li tal:repeat="ctx ctxs"><a tal:define="link ctx/link | nothing; name ctx/name | link;" tal:content="name"
+              tal:attributes="href link" target="_blank" tal:omit-tag="not:link" /></li>
+          </ul>
+        </tal:block>
+
+        <tal:block tal:define="attribution docinfo/attribution | nothing; copyright docinfo/copyright | nothing">
+          <h2>Copyright information</h2>
+          <table border="0" tal:condition="attribution | copyright">
+            <!-- attribution -->
+            <tr tal:condition="attribution"
+              tal:replace="structure python:here.metadataService.getAttributionFormatted('metadata_template', data=attribution)" />
+            <!-- copyright -->
+            <tr tal:condition="copyright"
+              tal:replace="structure python:here.metadataService.getCopyrightFormatted('metadata_template', data=copyright)" />
+          </table>
+          <table border="0" tal:condition="not:attribution | copyright">
+            <tr>
+              <td class="type">Copyright:</td>
+              <td class="content"><a target="_blank" href="http://www.mpiwg-berlin.mpg.de">Max Planck Institute for the
+                  History of Science</a> (unless stated otherwise)</td>
+            </tr>
+            <tr tal:define="accType python:docinfo.get('accessType', None)">
+              <td class="type">License:</td>
+              <td tal:condition="python:accType == 'free'" class="content"><a target="_blank"
+                href="http://creativecommons.org/licenses/by-sa/3.0/de/">CC-BY-SA</a> (unless stated otherwise)</td>
+              <td tal:condition="python:accType != 'free'" class="content">Internal use only<span tal:condition="accType"
+                tal:content="string: ($accType)" />, please contact <a href="mailto:library@mpiwg-berlin.mpg.de">library@mpiwg-berlin.mpg.de</a>
+                (unless stated otherwise)
+              </td>
+            </tr>
+          </table>
+        </tal:block>
+      </div>
+    </div>
+    <!-- /main content column -->
+  </div>
+
+</body>
+<body tal:condition="not:numPages">
+  <div class="errortext">Sorry, document doesn't exist.</div>
+</body>
+</html>
\ No newline at end of file