changeset 578:024b75162437

displays context data on index page
author casties
date Fri, 19 Oct 2012 18:51:47 +0200
parents 9251719154a3
children fc861a6cef17
files documentViewer.py version.txt zpt/viewer_index.zpt
diffstat 3 files changed, 41 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Thu Oct 18 17:53:09 2012 +0200
+++ b/documentViewer.py	Fri Oct 19 18:51:47 2012 +0200
@@ -630,9 +630,14 @@
             # DRI (permanent ID)
             dri = self.metadataService.getDRI(dom=metaDom, type='escidoc')
             if dri:
-                logging.debug("getDRI: dri=%s"%repr(dri))
                 docinfo['DRI'] = dri
 
+            # (presentation) context
+            ctx = self.metadataService.getContextData(dom=metaDom, all=True)
+            if ctx:
+                logging.debug("getcontext: ctx=%s"%repr(ctx))
+                docinfo['presentationContext'] = ctx
+
         # image path
         if mode != 'texttool':
             # override image path from texttool with url parameter TODO: how about mode=auto?
--- a/version.txt	Thu Oct 18 17:53:09 2012 +0200
+++ b/version.txt	Fri Oct 19 18:51:47 2012 +0200
@@ -1,1 +1,1 @@
-DocumentViewer 2.2.5
\ No newline at end of file
+DocumentViewer 2.2.6
\ No newline at end of file
--- a/zpt/viewer_index.zpt	Thu Oct 18 17:53:09 2012 +0200
+++ b/zpt/viewer_index.zpt	Fri Oct 19 18:51:47 2012 +0200
@@ -15,14 +15,13 @@
 <link rel="stylesheet" tal:attributes="href string:$viewerUrl/template/docuviewer_css" type="text/css" />
 <script type="text/javascript" tal:attributes="src string:$viewerUrl/template/jquery_js"></script>
 <script type="text/javascript">
-// <!--
-  $(document).ready(function() {
-    // autosubmit forms
-    $('form.autosubmit').find('.autosubmit').change(function() {
-      this.form.submit();
-    });
-    $('form.autosubmit input[type="submit"]').hide();
-  });
+	$(document).ready(function() {
+		// autosubmit forms
+		$('form.autosubmit').find('.autosubmit').change(function() {
+			this.form.submit();
+		});
+		$('form.autosubmit input[type="submit"]').hide();
+	});
 // -->
 </script>
 <!--  layer headers (all available) -->
@@ -46,11 +45,12 @@
       <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>
+        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 --> 
+      <!-- main content column -->
       <div class="index-info">
         <h2>Bibliographic information</h2>
         <table border="0">
@@ -102,6 +102,14 @@
           </table>
         </tal:block>
 
+        <tal:block tal:define="ctxs docinfo/presentationContext | nothing">
+          <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">
@@ -120,19 +128,21 @@
             </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>
+              <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>
+    <!-- /main content column -->
+
     <div class="col buttons">
-      <!-- option block column --> 
+      <!-- option block column -->
       <div class="options">
         <h4>Browse</h4>
         <ul class="list">
@@ -145,11 +155,9 @@
         Download full document
         <ul class="list">
           <li><a target="_blank" rel="nofollow" class="download"
-            tal:attributes="href python:here.getTextDownloadUrl(type='html',docinfo=docinfo)"
-            target="_blank">as HTML</a></li>
+            tal:attributes="href python:here.getTextDownloadUrl(type='html',docinfo=docinfo)" target="_blank">as HTML</a></li>
           <li><a target="_blank" rel="nofollow" class="download"
-            tal:attributes="href python:here.getTextDownloadUrl(type='xml',docinfo=docinfo)" target="_blank">as
-              XML</a></li>
+            tal:attributes="href python:here.getTextDownloadUrl(type='xml',docinfo=docinfo)" target="_blank">as XML</a></li>
         </ul>
         (copyright and license see below)
       </div>
@@ -179,8 +187,8 @@
       <div class="options" tal:condition="availableLayers">
         <h4>Metadata</h4>
         <form tal:attributes="action viewerUrl" class="autosubmit">
-          <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None})"
-            tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
+          <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None})" tal:repeat="param params"
+            tal:attributes="name param; value python:params[param]" />
           <ul>
             <!-- text layer select buttons (rendered always) -->
             <tal:block tal:repeat="layer availableLayers">
@@ -193,7 +201,8 @@
           <input type="submit" value="Go!" />
         </form>
       </div>
-    </div> <!-- /option block column -->     
+    </div>
+    <!-- /option block column -->
   </div>
   <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     <!-- footer -->