changeset 0:6f6e07baad80 default tip

initial
author Dirk Wintergruen <dwinter@mpiwg-berlin.mpg.de>
date Tue, 02 Jun 2015 08:57:48 +0200
parents
children
files Copy of digitalobjects-item.tpl.php chooser.js digitalobject_reader.php digitalobject_reader.php~ digitalobjects-collection-nodeLink.tpl.php digitalobjects-collection-simple.tpl.php digitalobjects-collection-usedIn.tpl.php digitalobjects-current-collection.tpl.php digitalobjects-image_src_link_viewer.tpl.php digitalobjects-image_src_link_viewer_large.tpl.php digitalobjects-item-objid.tpl.php digitalobjects-item-short.tpl.php digitalobjects-item-short.tpl.php~ digitalobjects-item-thumbnail.tpl.php digitalobjects-item-thumbnail.tpl.php~ digitalobjects-item-tools.tpl.php digitalobjects-item-tools.tpl.php~ digitalobjects-item-usage.tpl.php digitalobjects-item-xml.tpl.php digitalobjects-item-xml.tpl.php~ digitalobjects-item.tpl.php digitalobjects-item.tpl.php~ digitalobjects-items.tpl.php digitalobjects-pdf_link_viewer.tpl.php digitalobjects-user-admin-form.tpl.php digitalobjects.admin.inc digitalobjects.collections.inc digitalobjects.css digitalobjects.import.php digitalobjects.info digitalobjects.install digitalobjects.item.inc digitalobjects.module digitalobjects.user.inc maybedeprecated-Copy of digitalobjects-item.tpl.php
diffstat 33 files changed, 2861 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Copy of digitalobjects-item.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,105 @@
+
+
+<h2> Hello </h2>
+
+<?php print $objid ?>
+  <h3 class="title"<?php print $title_attributes; ?>>
+    <a href="<?php print $objdata['viewerurl']; ?>"><?php print $title ?> </a>
+  </h3>
+<a href="<?php print $objdata['viewerurl']; ?>"><img src="<?php print $objdata['thumburl']; ?>"/></a>
+
+
+ <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:block condition="exists:docinfo/bib">
+              <tal:block tal:define="bibinfo docinfo/bib" tal:repeat="bib bibinfo">
+                <tr tal:condition="python:bib[0]!='@'">
+                  <td class="type" tal:content="python:bib.capitalize().replace('_',' ') + ':'" />
+                  <td class="content" tal:content="python:bibinfo[bib]" />
+                </tr>
+              </tal:block>
+            </tal:block>
+
+            <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>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobject_reader.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,216 @@
+<?php
+
+/* function reads the metadata from index meta and gives it back to the
+ * template.
+ */
+
+#http://localhost:18080/ECHOdocuView/getDocinfo?mode=imagepath&url=http://md.mpiwg-berlin.mpg.de/indexMeta/MPIWG:WEBVEZ22
+function digitalobject_getMetadata($objid){
+
+  $base = variable_get('digitalobjects_docuviewer_path');
+  #$path="http://localhost:18080/ECHOdocuView/getDocinfoJSON?mode=texttool&url=http://md.mpiwg-berlin.mpg.de/indexMeta/" . $objid;
+  $path = $base . "/getDocinfoJSON?mode=texttool&url=http://md.mpiwg-berlin.mpg.de/indexMeta/" . $objid;
+  $request = drupal_http_request($path);
+  #TODO give out a status message  reports if servers is not available
+
+  if (isset($request->data)){
+    return drupal_json_decode($request->data);
+  }
+  else {
+    return null;
+  }
+
+}
+
+function digitalobjects_getBibFormattedMetaData($bibdata){
+  $bd = drupal_json_encode($bibdata);
+
+  $base = variable_get('digitalobjects_bibdata_path');
+  #$path="http://localhost:18080/metadata/getBibFormattedMetaDataJSON";
+  $path = $base ."/getBibFormattedMetaDataJSON";
+  $options = array(
+
+      'method' => 'POST',
+      'data' => 'bibdata=' . $bd
+  );
+  $request = drupal_http_request($path,  $options);
+  return drupal_json_decode($request->data);
+
+}
+
+
+function digitalobjects_getBibFormattedDC($bibdata){
+  $bd = drupal_json_encode($bibdata);
+
+  $base = variable_get('digitalobjects_bibdata_path');
+  #$path="http://localhost:18080/metadata/getDCMappedDataJSON";
+  $path = $base ."/getDCMappedData";
+  $options = array(
+
+      'method' => 'POST',
+      'data' => 'bibdata=' . $bd
+  );
+  $request = drupal_http_request($path,  $options);
+  #return drupal_json_decode($request->data);
+
+  return  drupal_json_decode($request->data);
+
+}
+
+
+function digitalobjects_getBibFormattedLabel($bibdata){
+  $bd = drupal_json_encode($bibdata);
+
+  $base = variable_get('digitalobjects_bibdata_path');
+  #$path="http://localhost:18080/metadata/getBibFormattedMetaDataJSON";
+  $path = $base ."/getBibFormattedLabelJSON";
+  $options = array(
+
+      'method' => 'POST',
+      'data' => 'bibdata=' . $bd
+  );
+  $request = drupal_http_request($path,  $options);
+  return drupal_json_decode($request->data);
+
+}
+
+
+
+function digitalobjects_getBibMappedData($bibdata){
+  $bd = drupal_json_encode($bibdata);
+
+  $base = variable_get('digitalobjects_bibdata_path');
+  #$path="http://localhost:18080/metadata/getBibFormattedMetaDataJSON";
+  $path = $base ."/getBibMappedDataJSON";
+
+  $options = array(
+
+      'method' => 'POST',
+      'data' => 'bibdata=' . $bd
+  );
+  $request = drupal_http_request($path,  $options);
+  return drupal_json_decode($request->data);
+
+}
+#here.metadata.getBibFormattedMetaData(bibdata=docinfo.get('bib', None))
+
+
+
+function digitalobjects_readMetadata($objid_full,$format="long"){
+
+  //objid_full can have the structure ID/Pagenumber
+
+
+  $objid_parts = explode("/",$objid_full);
+
+  $objid=$objid_parts[0];
+
+
+  if (isset($objid_parts[1])){
+    $pn=$objid_parts[1];
+    $pn_set=true;
+  } else {
+    $pn="1";
+    $pn_set=false;
+  }
+
+
+
+  $md = digitalobject_getMetadata($objid);
+
+  switch($format){
+    case "long":
+      $bib = isset($md['bib']) ?digitalobjects_getBibFormattedMetaData($md['bib']): null;
+    break;
+
+    case "short":
+      $bib = isset($md['bib']) ?digitalobjects_getBibFormattedLabel($md['bib']): null;
+
+    break;
+
+    case "DC":
+      $bibArray = isset($md['bib']) ?digitalobjects_getBibFormattedDC($md['bib']): null;
+
+
+
+      if (count($bibArray) == 0) {
+        $bibArray = array (
+            "creator" => $md['creator'],
+            "title" => $md['title'],
+            "date" => $md['date']
+        );
+      }
+
+      
+      $bib = '<metadata xmlns:DC="http://purl.org/dc/terms/" xlink:href="http://md.mpiwg-berlin.mpg.de/purls/indexMeta/'. $objid . '">';
+
+      foreach ($bibArray as $key => $value){
+        $bib = $bib . "<DC:" . $key .">" . $value . "</DC:" . $key . ">";
+      }
+      $bib = $bib . '</metadata>';
+
+
+
+
+    } // close switch
+
+
+    if ($bib == null) {
+      $bibdata = array (
+          "Author" => $md['creator'],
+          "Title" => $md['title'],
+          "Date" => $md['date']
+      );
+      $bib="";
+      /*foreach ($bibdata as $key => $content){
+        $bib = $bib . '<tr><td class="type">' . $key . '</td>
+                  <td class="content">' . $content . '</td></tr>';
+      }
+  */
+      foreach ($bibdata as $key => $content){
+       $bib = $bib . '<span class="type">' . $key . ':</span>
+      <span class="content">' . $content . ' </span>';
+      }
+    }
+
+
+
+  $access_type = isset($md['accessType']) ? $md['accessType'] : 'mpiwg';
+
+  if ($pn_set){
+    $titlepage=$pn; // im parameter war die Seitenzahl gesetzt.
+  } else
+  {
+  $titlepage = isset($md['titlePage']) ? $md['titlePage'] : 1;
+  }
+
+
+  $data =  array(
+      "thumburl" => create_thumburl_from_dri($objid,$titlepage=$titlepage),
+      "viewerurl" => create_url_from_dri($objid,$access_type = $access_type,$titlepage=$titlepage),
+      "md" => $md,
+      "bibdata" => $bib,
+      "access_type" => $access_type,
+  );
+
+
+  return $data;
+}
+
+
+function create_library_path($id){
+  return "http://141.14.236.36/fmi/xsl/katalog/browserecord.xsl?-db=katalog&-lay=fullrecord&-encoding=UTF-8&-grammar=fmresultset&-max=1&Biblio::ID=" . $id . "&-find=";
+}
+
+function create_url_from_dri($dri,$access_type = "closed",$pn="1"){
+
+  if ($access_type=="free"){
+    return "http://echo.mpiwg-berlin.mpg.de/".$dri . "?pn=" . $pn;
+  }
+  else
+    return "http://libcoll.mpiwg-berlin.mpg.de/".$dri . "?pn=" . $pn;
+}
+
+function create_thumburl_from_dri($dri,$titlepage=1){
+  return "http://md.mpiwg-berlin.mpg.de/purls/image/".$dri."?pn=" . $titlepage;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobject_reader.php~	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,215 @@
+<?php
+
+/* function reads the metadata from index meta and gives it back to the
+ * template.
+ */
+
+#http://localhost:18080/ECHOdocuView/getDocinfo?mode=imagepath&url=http://md.mpiwg-berlin.mpg.de/indexMeta/MPIWG:WEBVEZ22
+function digitalobject_getMetadata($objid){
+
+  $base = variable_get('digitalobjects_docuviewer_path');
+  #$path="http://localhost:18080/ECHOdocuView/getDocinfoJSON?mode=texttool&url=http://md.mpiwg-berlin.mpg.de/indexMeta/" . $objid;
+  $path = $base . "/getDocinfoJSON?mode=texttool&url=http://md.mpiwg-berlin.mpg.de/indexMeta/" . $objid;
+  $request = drupal_http_request($path);
+  #TODO give out a status message  reports if servers is not available
+
+  if (isset($request->data)){
+    return drupal_json_decode($request->data);
+  }
+  else {
+    return null;
+  }
+
+}
+
+function digitalobjects_getBibFormattedMetaData($bibdata){
+  $bd = drupal_json_encode($bibdata);
+
+  $base = variable_get('digitalobjects_bibdata_path');
+  #$path="http://localhost:18080/metadata/getBibFormattedMetaDataJSON";
+  $path = $base ."/getBibFormattedMetaDataJSON";
+  $options = array(
+
+      'method' => 'POST',
+      'data' => 'bibdata=' . $bd
+  );
+  $request = drupal_http_request($path,  $options);
+  return drupal_json_decode($request->data);
+
+}
+
+
+function digitalobjects_getBibFormattedDC($bibdata){
+  $bd = drupal_json_encode($bibdata);
+
+  $base = variable_get('digitalobjects_bibdata_path');
+  #$path="http://localhost:18080/metadata/getDCMappedDataJSON";
+  $path = $base ."/getDCMappedData";
+  $options = array(
+
+      'method' => 'POST',
+      'data' => 'bibdata=' . $bd
+  );
+  $request = drupal_http_request($path,  $options);
+  #return drupal_json_decode($request->data);
+
+  return  drupal_json_decode($request->data);
+
+}
+
+
+function digitalobjects_getBibFormattedLabel($bibdata){
+  $bd = drupal_json_encode($bibdata);
+
+  $base = variable_get('digitalobjects_bibdata_path');
+  #$path="http://localhost:18080/metadata/getBibFormattedMetaDataJSON";
+  $path = $base ."/getBibFormattedLabelJSON";
+  $options = array(
+
+      'method' => 'POST',
+      'data' => 'bibdata=' . $bd
+  );
+  $request = drupal_http_request($path,  $options);
+  return drupal_json_decode($request->data);
+
+}
+
+
+
+function digitalobjects_getBibMappedData($bibdata){
+  $bd = drupal_json_encode($bibdata);
+
+  $base = variable_get('digitalobjects_bibdata_path');
+  #$path="http://localhost:18080/metadata/getBibFormattedMetaDataJSON";
+  $path = $base ."/getBibMappedDataJSON";
+
+  $options = array(
+
+      'method' => 'POST',
+      'data' => 'bibdata=' . $bd
+  );
+  $request = drupal_http_request($path,  $options);
+  return drupal_json_decode($request->data);
+
+}
+#here.metadata.getBibFormattedMetaData(bibdata=docinfo.get('bib', None))
+
+
+
+function digitalobjects_readMetadata($objid_full,$format="long"){
+
+  //objid_full can have the structure ID/Pagenumber
+
+
+  $objid_parts = explode("/",$objid_full);
+
+  $objid=$objid_parts[0];
+
+
+  if (isset($objid_parts[1])){
+    $pn=$objid_parts[1];
+    $pn_set=true;
+  } else {
+    $pn="1";
+    $pn_set=false;
+  }
+
+
+
+  $md = digitalobject_getMetadata($objid);
+
+  switch($format){
+    case "long":
+      $bib = isset($md['bib']) ?digitalobjects_getBibFormattedMetaData($md['bib']): null;
+    break;
+
+    case "short":
+      $bib = isset($md['bib']) ?digitalobjects_getBibFormattedLabel($md['bib']): null;
+
+    break;
+
+    case "DC":
+      $bibArray = isset($md['bib']) ?digitalobjects_getBibFormattedDC($md['bib']): null;
+
+
+
+      if (count($bibArray) == 0) {
+        $bibArray = array (
+            "creator" => $md['creator'],
+            "title" => $md['title'],
+            "date" => $md['date']
+        );
+      }
+
+      $bib = '<metadata xmlns:DC="http://purl.org/dc/terms/">';
+
+      foreach ($bibArray as $key => $value){
+        $bib = $bib . "<DC:" . $key .">" . $value . "</DC:" . $key . ">";
+      }
+      $bib = $bib . '</metadata>';
+
+
+
+
+    } // close switch
+
+
+    if ($bib == null) {
+      $bibdata = array (
+          "Author" => $md['creator'],
+          "Title" => $md['title'],
+          "Date" => $md['date']
+      );
+      $bib="";
+      /*foreach ($bibdata as $key => $content){
+        $bib = $bib . '<tr><td class="type">' . $key . '</td>
+                  <td class="content">' . $content . '</td></tr>';
+      }
+  */
+      foreach ($bibdata as $key => $content){
+       $bib = $bib . '<span class="type">' . $key . ':</span>
+      <span class="content">' . $content . ' </span>';
+      }
+    }
+
+
+
+  $access_type = isset($md['accessType']) ? $md['accessType'] : 'mpiwg';
+
+  if ($pn_set){
+    $titlepage=$pn; // im parameter war die Seitenzahl gesetzt.
+  } else
+  {
+  $titlepage = isset($md['titlePage']) ? $md['titlePage'] : 1;
+  }
+
+
+  $data =  array(
+      "thumburl" => create_thumburl_from_dri($objid,$titlepage=$titlepage),
+      "viewerurl" => create_url_from_dri($objid,$access_type = $access_type,$titlepage=$titlepage),
+      "md" => $md,
+      "bibdata" => $bib,
+      "access_type" => $access_type,
+  );
+
+
+  return $data;
+}
+
+
+function create_library_path($id){
+  return "http://141.14.236.36/fmi/xsl/katalog/browserecord.xsl?-db=katalog&-lay=fullrecord&-encoding=UTF-8&-grammar=fmresultset&-max=1&Biblio::ID=" . $id . "&-find=";
+}
+
+function create_url_from_dri($dri,$access_type = "closed",$pn="1"){
+
+  if ($access_type=="free"){
+    return "http://echo.mpiwg-berlin.mpg.de/".$dri . "?pn=" . $pn;
+  }
+  else
+    return "http://libcoll.mpiwg-berlin.mpg.de/".$dri . "?pn=" . $pn;
+}
+
+function create_thumburl_from_dri($dri,$titlepage=1){
+  return "http://md.mpiwg-berlin.mpg.de/purls/image/".$dri."?pn=" . $titlepage;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-collection-nodeLink.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,8 @@
+<?php foreach($entities as $entity): ?>
+    <div>
+        <a href="<?php print $GLOBALS['base_path']?>/node/<?php print $entity->nid ?>">
+        <?php print $entity->title ?>
+        </a>
+    </div>
+<?php endforeach;?>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-collection-simple.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,6 @@
+<div class="digitalobjects_item digitalobjects_item_short">
+    <a href="../<?php print $objid; ?>" class="digitalobjects_item_image">
+        <?php print $objid ?>
+    </a>
+</div>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-collection-usedIn.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,10 @@
+<?php if (sizeof($entities)>0): ?>
+    <h3>Used in</h3>
+    <?php foreach($entities as $entity): ?>
+        <div>
+            <a href="../node/<?php print $entity->nid ?>">
+                <?php print $entity->title ?>
+            </a>
+        </div>
+    <?php endforeach;?>
+<?php endif;?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-current-collection.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,2 @@
+<h3>Current collection</h3>
+<p><?php print l($node->title,"node/".$node->nid) ?></p>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-image_src_link_viewer.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,1 @@
+<a href="<?php print $link?>"><img width="100px" src="<?php print $src?>"/></a>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-image_src_link_viewer_large.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,1 @@
+<a href="<?php print $link?>"><img width="200px" src="<?php print $src?>"/></a>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item-objid.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,3 @@
+<p> <?php print $objid ?></p>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item-short.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,22 @@
+<?php if($access): ?>
+    <div class="digitalobjects_item digitalobjects_item_short">
+        <div class="digitalobjects_item_image thumbnail">
+        <?php if ($objdata['access_type'] !="free"):?>
+            <a href="<?php print $objdata['viewerurl']; ?>">
+                <img src="<?php print $objdata['thumburl']; ?>"/>
+                <p class="solrsearch_internal">internal</p>
+            </a>
+        <?php else: ?>
+            <a href="<?php print $objdata['viewerurl']; ?>">
+                <img src="<?php print $objdata['thumburl']; ?>"/>
+            </a>
+        <?php endif ;?>
+        </div>
+
+        <div class="object-data">
+            <?php print $objdata['bibdata']; ?>
+        </div>
+    </div>
+<?php else: ?>
+<p class="copyright"> <?php print $objid ?>: restricted - due to copyright reasons </p>
+<?php endif; ?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item-short.tpl.php~	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,26 @@
+
+
+<?php if($access): ?>
+
+<div class="digitalobjects_item">
+<table class="digitalobjects_item_short">
+<tr>
+<td class="digitalobjects_item_image">
+<?php if ($objdata['access_type'] !="free"):?>
+<span class="solrsearch_internal" >
+intern
+</span>
+<?php endif ;?>
+<a href="<?php print $objdata['viewerurl']; ?>"><img src="<?php print $objdata['thumburl']; ?>"/></a>
+
+</td>
+<td align="top">
+<?php print $objdata['bibdata']; ?>
+</td>
+</tr>
+</table>
+</div>
+<?php else: ?>
+<p> <?php print $objid ?>: restricted - due to copyright reasons </p>
+
+<?php endif; ?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item-thumbnail.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,19 @@
+<?php if($access): ?>
+    <div class="digitalobjects_item digitalobjects_item_short">
+        <div class="digitalobjects_item_image thumbnail">
+            <?php if ($objdata['access_type'] !="free"):?>
+                <a href="<?php print $objdata['viewerurl']; ?>">
+                    <img src="<?php print $objdata['thumburl']; ?>"/>
+                    <p class="solrsearch_internal">internal</p>
+                </a>
+            <?php else: ?>
+                <a href="<?php print $objdata['viewerurl']; ?>">
+                    <img src="<?php print $objdata['thumburl']; ?>"/>
+                </a>
+            <?php endif ;?>
+        </div>
+    </div>
+<?php else: ?>
+    <p class="copyright"> <?php print $objid ?>: restricted - due to copyright reasons </p>
+
+<?php endif; ?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item-thumbnail.tpl.php~	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,22 @@
+
+
+<?php if($access): ?>
+
+<div class="digitalobjects_item">
+<table class="digitalobjects_item_short">
+<tr>
+<td class="digitalobjects_item_image">
+<?php if ($objdata['access_type'] !="free"):?>
+<span class="solrsearch_internal" >
+intern
+</span>
+<?php endif ;?>
+<a href="<?php print $objdata['viewerurl']; ?>"><img src="<?php print $objdata['thumburl']; ?>"/></a>
+</td>
+</tr>
+</table>
+</div>
+<?php else: ?>
+<p> <?php print $objid ?>: restricted - due to copyright reasons </p>
+
+<?php endif; ?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item-tools.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,29 @@
+<!--<div class="digitalobjects_item_tools">-->
+<!-- TODO: add to basket function, put checkbox in here (if any) -->
+    <div class="add-annotate-tools">
+        <?php if (user_access('manage private collections')):?>
+            <div class="addbasket">
+                <?php print l(t("+ add to basket"),"digitalobject/". $variables['objid'] ."/add") ?>
+            </div>
+        <?php endif;?>
+    <!-- TODO: annotate function -->
+        <?php if (user_access('manage private collections')):?>
+            <div class="annotateitem">
+                <?php print l(t("+ annotate item"),"digitalobject/". $variables['objid'] ."/add") ?>
+            </div>
+        <?php endif;?>
+    </div>
+    <div class="moredetails">
+        <?php print l(t("details"),"digitalobject/". $variables['objid'], array('attributes' => array('class' => 'ajax-link', 'rel' => 'div.details-'. digitalobjects_clean_css_identifier($variables['objid'])))) ?>
+    </div>
+    <div class="relatedcollections">
+        <?php print l(t("related collections"),"digitalobject/". $variables['objid'] ."/usage", array('attributes' => array('class' => 'ajax-link', 'rel' => 'div.details-'. digitalobjects_clean_css_identifier($variables['objid'])))) ?>
+    </div>
+    <!-- TODO: where to put this in layout?-->
+    <?php if (user_access('administrate digitalobjects')):?>
+        <div class="edititem">
+            <?php print l(t("edit"),"digitalobject/". $variables['objid'] ."/edit") ?>
+        </div>
+    <?php endif;?>
+<!--</div>-->
+<div class="itemdetails details-<?php print digitalobjects_clean_css_identifier($variables['objid'])?>" id="content-ajax"></div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item-tools.tpl.php~	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,17 @@
+<div class="digitalobjects_item_tools">
+<span>
+<?php print l(t("more"),"digitalobject/". $variables['objid']) ?>
+</span>
+<?php if (user_access('administrate digitalobjects')):?>
+<span><?php print l(t("edit"),"digitalobject/". $variables['objid'] ."/edit") ?>
+</span>
+<?php endif;?>
+<span id="relatedcollections">
+<?php print l(t("show related collections"),"digitalobject/". $variables['objid'] ."/usage") ?>
+</span>
+<?php if (user_access('manage private collections')):?>
+<span>
+<?php print l(t("add"),"digitalobject/". $variables['objid'] ."/add") ?>
+</span>
+<?php endif;?>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item-usage.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,9 @@
+<h2>Collections where the object is used</h2>
+<div class="collection-usage">
+    <ul>
+    <?php foreach ($variables['data'] as $nid => $title):?>
+        <li><?php print l(t($title), "node/$nid");?></li>
+    <?php endforeach ?>
+    </ul>
+
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item-xml.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,10 @@
+
+<object xmlns:xlink="www.w3.org/1999/xlink" xmlns:art="http://simile.mit.edu/2003/10/ontologies/artstor#" xmlns:DC="http://purl.org/dc/terms/" xlink:href="<?php print $objdata['viewerurl']; ?>">
+<DC:identifier><?php print $objid ?></DC:identifier>
+<?php if($access): ?>
+<art:thumburl  xlink:href="<?php print $objdata['thumburl']; ?>"/>
+<?php print $objdata['bibdata']; ?>
+<?php else: ?>
+<error> <?php print $objid ?>: restricted - due to copyright reasons </error>
+<?php endif; ?>
+</object>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item-xml.tpl.php~	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,10 @@
+
+<object xmlns:xlink="www.w3.org/1999/xlink" xmlns:art="http://simile.mit.edu/2003/10/ontologies/artstor#" xmlns:DC="http://purl.org/dc/terms/" xlink:href="<?php print $objdata['viewerurl']; ?>">
+<DC:identifier><?php print $objid ?></DC:identifier>
+<?php if($access): ?>
+<art:thumburl  xlink:href="<?php print $objdata['thumburl']; ?>"/>
+<?php print $objdata['bibdata']; ?>
+<?php else: ?>
+<error> <?php print $objid ?>: restricted - do to copyright reasons </error>
+<?php endif; ?>
+</object>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,35 @@
+<?php if($access): ?>
+    <div class="digitalobjects_item digitalobjects_item_full">
+        <div class="digitalobjects_item_image thumbnail">
+            <?php if ($objdata['access_type'] !="free"):?>
+                <a href="<?php print $objdata['viewerurl']; ?>">
+                    <img src="<?php print $objdata['thumburl']; ?>"/>
+                    <p class="solrsearch_internal">internal</p>
+                </a>
+            <?php else:?>
+                <a href="<?php print $objdata['viewerurl']; ?>">
+                    <img src="<?php print $objdata['thumburl']; ?>"/>
+                </a>
+            <?php endif ;?>
+        </div>
+
+        <div class="object-data">
+            <?php print $objdata['bibdata']; ?>
+        </div>
+
+        <div class="object-ID">
+            <div class="title-ID">Document ID</div>
+            <div class="content-objid"> <?php print $objid ?></div>
+        </div>
+        <div class="object-permanent-url">
+            <div class="title-url">Permanent URL</div>
+            <div class="content-url"> 
+                <a href="<?php print $objdata['viewerurl']; ?>">
+                <?php print $objdata['viewerurl']; ?>
+                </a>
+            </div>
+        </div>
+    </div>
+<?php else: ?>
+    <p class="copyright"> <?php print $objid ?>: restricted - due to copyright reasons </p>
+<?php endif; ?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-item.tpl.php~	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,38 @@
+<?php if($access): ?>
+
+<div class="digitalobjects_item">
+<table class="digitalobjects_item_full">
+<tr>
+<td class="digitalobjects_item_image">
+<?php if ($objdata['access_type'] !="free"):?>
+<span class="solrsearch_internal" >
+intern
+</span>
+<?php endif ;?>
+<a href="<?php print $objdata['viewerurl']; ?>"><img src="<?php print $objdata['thumburl']; ?>"/></a>
+
+</td>
+<td>
+<table><?php print $objdata['bibdata']; ?></table>
+
+
+          <table>
+              <tr>
+                <td class="type">Document ID:</td>
+              <td class="content"> <?php print $objid ?></td>
+            </tr>
+            <tr>
+              <td   class="type">Permanent URL:</td>
+              <td class="content"> <a href="<?php print $objdata['viewerurl']; ?>"><?php print $objdata['viewerurl']; ?> </a></td>
+            </tr>
+          </table>
+
+</table>
+</td>
+</tr>
+</table>
+</div>
+<?php else: ?>
+<p> <?php print $objid ?>: restricted - do to copyright reasons </p>
+
+<?php endif; ?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-items.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * @file
+ * Default theme implementation for displaying search results.
+ *
+ * This template collects each invocation of theme_search_result(). This and
+ * the child template are dependent to one another sharing the markup for
+ * definition lists.
+ *
+ * Note that modules may implement their own search type and theme function
+ * completely bypassing this template.
+ *
+ * Available variables:
+ * - $search_results: All results as it is rendered through
+ *   search-result.tpl.php
+ * - $module: The machine-readable name of the module (tab) being searched, such
+ *   as "node" or "user".
+ *
+ *
+ * @see template_preprocess_search_results()
+ *
+ * @ingroup themeable
+ */
+?>
+<?php if ($search_results): ?>
+  <!--<h2><?php print t('Search results');?></h2>-->
+   <?php print $pager; ?>
+  <ol class="items">
+    <?php print $search_results; ?>
+  </ol>
+ <?php print $pager; ?>
+<?php else : ?>
+  <h2><?php print t('Your search yielded no results');?></h2>
+<?php endif; ?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-pdf_link_viewer.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,1 @@
+<a href="<?php print $link?>"><?php print $title?></a>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects-user-admin-form.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,6 @@
+<h2> <?php print t('Set current collection');?></h2>
+<div class="solrsearch_search_form">
+    <?php print $digitalobjects_user_admin ?>
+</div>
+<div><?php print $uid ?>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects.admin.inc	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,124 @@
+<?php
+/**
+ * Form builder for general settings used as a menu callback.
+ *
+ * @param array $form
+ * @param array $form_state
+ *
+ * @return array Output of the system_settings_form()
+ */
+function digitalobjects_settings(array $form, array &$form_state) {
+
+
+  $form['digitalobjects_bibdata_path'] = array(
+      '#type' => 'textfield',
+      '#title' => t('bibdataprovider URL'),
+      '#default_value' => variable_get('digitalobjects_bibdata_path',"http://localhost:18080/metadata"),
+      '#maxlength' => 255,
+      '#description' => t('URL to the bibdataprovider  (no "/" at the end!)'),
+
+  );
+
+  $form['digitalobjects_docuviewer_path'] = array(
+      '#type' => 'textfield',
+      '#title' => t('docuviewer URL'),
+      '#default_value' => variable_get('digitalobjects_docuviewer_path',"http://localhost:18080/ECHOdocuView"),
+      '#maxlength' => 255,
+      '#description' => t('URL to the docuviewer (no "/" at the end!)'),
+
+  );
+
+
+
+  $scal="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?";
+
+  $form['digitalobjects_scaler_path'] = array(
+      '#type' => 'textfield',
+      '#title' => t('scaler URL'),
+      '#default_value' => variable_get('digitalobjects_scaler_path',$scal),
+      '#maxlength' => 255,
+      '#description' => t('Url to digilib scaler'),
+
+  );
+
+  $digilibjs="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/jquery/digilib.html?";
+
+  $form['digitalobjects_digilib_path'] = array(
+      '#type' => 'textfield',
+      '#title' => t('scaler URL'),
+      '#default_value' => variable_get('digitalobjects_digilib_path',$digilibjs),
+      '#maxlength' => 255,
+      '#description' => t('Url to digilib'),
+
+  );
+
+
+
+
+
+  $pdfViewer="http://content.mpiwg-berlin.mpg.de/pdfViewer/pdf.js-master/web/viewer.html?file=";
+
+  $form['digitalobjects_pdfviewer_path'] = array(
+      '#type' => 'textfield',
+      '#title' => t('pdf viewer URL'),
+      '#default_value' => variable_get('digitalobjects_pdfviewer_path',$pdfViewer),
+      '#maxlength' => 255,
+      '#description' => t('URL to the pdfViewer, used for "View PDF in external viewer"'),
+
+  );
+
+  $repPath="http://content.mpiwg-berlin.mpg.de/mpiwg/online/permanent/";
+
+  $form['digitalobjects_repository_path'] = array(
+      '#type' => 'textfield',
+      '#title' => t('default repository path'),
+      '#default_value' => variable_get('digitalobjects_repository_path',$repPath),
+      '#maxlength' => 255,
+      '#description' => t('Default repository path, used for "View PDF in external viewer"'),
+
+  );
+
+
+  $linkbase="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/jquery/digilib.html?fn=/permanent/library/VAQGXTWH/pageimg/";
+  $form['digitalobjects_imagebase_digilib_path'] = array(
+      '#type' => 'textfield',
+      '#title' => t('EXPERIMENTAL -- default image folder path (digilib)'),
+      '#default_value' => variable_get('digitalobjects_imagebase_digilib_path',$linkbase),
+      '#maxlength' => 255,
+      '#description' => t('Default image folder  path, used for "View filename as image with link to digilib"'),
+
+  );
+
+  $srcbase="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?dw=100&fn=";
+
+  $form['digitalobjects_imagebase_scaler_path'] = array(
+      '#type' => 'textfield',
+      '#title' => t('EXPERIMENTAL -- default image folder path (scaler)'),
+      '#default_value' => variable_get('digitalobjects_imagebase_scaler_path',$srcbase),
+      '#maxlength' => 255,
+      '#description' => t('Default image folder  path, used for "View filename as image with link to digilib"'),
+
+  );
+
+
+  $srcbase_large="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?dw=200&fn=";
+
+  $form['digitalobjects_imagebase_scaler_path_large'] = array(
+      '#type' => 'textfield',
+      '#title' => t('EXPERIMENTAL -- default image folder path (scaler/large)'),
+      '#default_value' => variable_get('digitalobjects_imagebase_scaler_path_large',$srcbase_large),
+      '#maxlength' => 255,
+      '#description' => t('Default image folder  path, used for "View filename (200px) as image with link to digilib"'),
+
+  );
+
+
+
+
+
+
+  return system_settings_form($form);
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects.collections.inc	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,262 @@
+<?php
+
+
+
+function digitalobjects_user_admin_collection_submit($form,$formstate){
+  $userid = $formstate['values']['userid'];
+
+
+
+  drupal_goto("user/".$userid.'/collections');
+
+}
+function digitalobjects_user_admin_collection($key){
+
+  ctools_add_js('auto-submit');
+
+
+  $form['digitalobjects_user_admin_form'] = drupal_get_form("digitalobjects_user_admin_form");
+  #$form = drupal_get_form("digitalobjects_user_admin_form");
+
+  $user_full=user_load($key);
+  if (isset($user_full->field_digitalobjects_cid[LANGUAGE_NONE])){
+  $val = $user_full->field_digitalobjects_cid[LANGUAGE_NONE][0]['objid'];
+  } else {
+    $val="";
+  }
+
+  $form['digitalobjects_user_admin_form']['digitalcollection']['#default_value']="";
+  $form['digitalobjects_user_admin_form']['digitalcollection']['#value']=$val;
+  $form['digitalobjects_user_admin_form']['userid']['#value']=$key;
+
+  //$form['digitalcollection_chooser'] =  drupal_get_form("digitalcollection_chooser");
+
+
+ # $element = $form;
+
+  $form['chooser']=drupal_get_form("digitalcollection_chooser");
+
+  $form['chooser']['pager'] = array('#markup' => theme('pager'));
+  $form['chooser']['userid']['#value']=$key;
+
+  #$element += $form3;
+
+ #
+  #$element += $form2;
+
+  return $form;
+}
+
+function digitalcollection_chooser(array $form){
+  // Build the sortable table header.
+  $header = array(
+      'title' => array('data' => t('Title'), 'field' => 'n.title'),
+      'nid' => array('data' => t('nid'), 'field' => 'n.nid')
+  );
+
+
+  #$result = db_query("SELECT nid FROM node WHERE type = :ntype ", array ('ntype' => 'digitalcollection'))->extend('PagerDefault');
+  $query = db_select("node","n")->fields('n',array("nid"))->condition('type', 'digitalcollection')->orderby("n.title")->extend('PagerDefault')->limit(20);
+  $result = $query->execute();
+  #$result = db_query("SELECT n.nid FROM {node} n ");
+
+  $nids = array();
+  foreach ($result as $record) {
+    $nids[] = $record->nid;
+  }
+  //Get the node data.
+  //$nids = $query
+  //->fields('n',array('nid'))
+  //->limit(50)
+  //->orderByHeader($header)
+  //->execute()
+  //->fetchCol();
+
+
+  $nodes = node_load_multiple($nids);
+
+  //Build the rows.
+  $options = array();
+  $l_options=array("");
+  $destination = drupal_get_destination();
+  $languages = language_list();
+  foreach ($nodes as $node) {
+    $langcode = entity_language('node', $node);
+    $l_options = $langcode != LANGUAGE_NONE && isset($languages[$langcode]) ? array('language' => $languages[$langcode]) : array();
+
+    $options[$node->nid] = array(
+        'title' => array(
+            'data' => array(
+                '#type' => 'link',
+                '#title' => $node->title,
+                '#href' => 'node/' . $node->nid,
+                '#options' => $l_options,
+                '#suffix' => ' ' ,
+            ),
+        ),
+        'nid' => $node->nid,
+    );
+
+  }
+
+  $destination = drupal_get_destination();
+
+  /*
+   $operations = array();
+  if (node_access('update', $node)) {
+  $operations['edit'] = array(
+      'title' => t('edit'),
+      'href' => 'node/' . $node->nid . '/edit',
+      'query' => $destination,
+  );
+  }
+  if (node_access('delete', $node)) {
+  $operations['delete'] = array(
+      'title' => t('delete'),
+      'href' => 'node/' . $node->nid . '/delete',
+      'query' => $destination,
+  );
+  }
+  $options[$node->nid]['operations'] = array();
+  $options[$node->nid]['operations'] = array(
+      'data' => array(
+          '#theme' => 'links__node_operations',
+          '#links' => $operations,
+          '#attributes' => array('class' => array('links', 'inline')),
+      ),
+  );
+
+
+  */
+
+
+
+
+  $form['digitalcollection_chooser'] = array(
+      '#type' => 'tableselect',
+      '#header' => $header,
+      '#options' => $options,
+      '#empty' => t('No content available.'),
+      '#attributes' => array('class' => array('search-form', 'ctools-auto-submit-full-form')),
+      '#multiple' => False,
+
+  );
+
+  #form['chooser']['change'] = array('#type' => 'actions');
+  $form+= $form['submit2'] = array('#type' => 'submit', '#value' => t('Choose'));
+  #$form['chooser']['#submit'][] = 'digitalobjects_user_change_form_submit';
+  $form['submit2']['#submit'][] = 'digitalobjects_user_change_form_submit';
+  #$form['chooser']['#attributes']= array('class' => array('ctools-use-ajax', 'ctools-auto-submit-click'));
+
+  $form['userid'] = array(
+      '#type' => 'hidden',
+  );
+
+  return $form;
+}
+
+
+function digitalobjects_user_change_form_submit($form,$formstate){
+  $input = $formstate['input']['digitalcollection_chooser'];
+  $userid = $formstate['values']['userid'];
+
+  $user=user_load($userid);
+
+
+  $user->field_digitalobjects_cid['und'][0]['objid'] = $input;
+
+  user_save($user);
+
+}
+#füge objid zur aktuelle sammlung hinzu
+function digitalobjects_addToCurrentCollection($objid){
+
+  global $user;
+  #hole current collection
+  $user_full = user_load($user->uid);
+  $val = $user_full->field_digitalobjects_cid['und'][0]['objid'];
+
+  #hole sammlung
+
+  $node = node_load($val);
+
+  foreach ( $node->field_objid['und'] as $obj){
+    if ($obj['objid']==$objid){
+      return drupal_set_message(t("Already in the current collection"),"error");
+    }
+
+  }
+
+  $node->field_objid['und'][]['objid']=$objid;
+
+  $node = node_submit($node);
+
+  node_save($node);
+
+  drupal_goto("node/".$node->nid);
+}
+
+
+
+function digitalobjects_digitalcollectionsManage($data = NULL){
+
+  $data = ($data==NULL) ?  $_GET : $data;
+
+
+  global $user;
+  #hole current collection
+  $user_full = user_load($user->uid);
+  $val = $user_full->field_digitalobjects_cid['und'][0]['objid'];
+
+  #hole sammlung
+
+  $node = node_load($val);
+
+  foreach ($data['digitalobjects_items_select'] as $objid){
+    /*foreach ( $node->field_objid['und'] as $obj){
+      if ($obj['objid']==$objid){
+        return drupal_set_message(t("Already in the current collection"),"error");
+      }
+
+    }
+  */
+    $node->field_objid['und'][]['objid']=$objid;
+
+  }
+
+
+  $node = node_submit($node);
+
+  node_save($node);
+
+  if (isset($data['redirect'])){
+
+  drupal_goto(urldecode($data['redirect']));
+  } else {
+    drupal_goto("node/".$node->nid);
+  }
+
+/*
+  $output['digitalobjects_item']= array(
+      '#theme' => 'digitalobjects_item',
+      '#objid' => '');
+  return $output;
+  */
+}
+
+/* suche wo wo eine digitalecollection benutzt wird */
+function digitalcollection_used_id($nid){
+  $results = db_query("SELECT * FROM {field_data_field_collid} n where field_collid_objid  ='node/" . $nid . "'");
+
+  $nids = array();
+  foreach($results as $result){
+
+
+     $nids[] = $result->entity_id;
+  }
+
+  $entities = entity_load("node",$nids);
+
+  return $entities;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects.css	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,35 @@
+/*
+Cascading Style Sheets, level 2 revision 1. 
+CSS 2.1 Specification is available at 
+http://www.w3.org/TR/2006/WD-CSS21-20061106/
+*/
+
+td.digitalobjects_item_image {
+vertical-align:top;
+}
+
+div.digitalobjects_item {
+	padding-top: 10px;
+	padding-bottom: 10px;
+}
+
+table.digitalobjects_item_short td{
+	vertical-align:top;
+}
+
+
+div.digitalobjects_item_tools{
+	display:inline;
+}
+
+
+/* CSS fuer ARB */
+
+div.group-more-details{
+	padding-bottom: 5px;
+	padding-top: 5px;
+}
+div.group-more-details div{
+	display:inline;
+	padding-left: 5px;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects.import.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,251 @@
+<?php
+
+function digitalcollection_import_from_file($filename,$nid){
+
+
+  $handle = fopen($filename, "r");
+  $contents = fread($handle, filesize($filename));
+  fclose($handle);
+
+  $node = node_load($nid);
+
+  foreach(explode("\n",$contents) as $line){
+    $node->field_objid[LANGUAGE_NONE][]['objid']=$line;
+    print $line;
+  }
+
+  node_save($node);
+}
+
+
+
+function digitalobjects_importPagesFromFile(){
+  $filename = "/tmp/maps.json";
+  # $filename = "/tmp/echo.json";
+  $handle = fopen($filename, "r");
+  $contents = fread($handle, filesize($filename));
+  fclose($handle);
+
+  $pages = drupal_json_decode($contents);
+
+  $cnt=0;
+  foreach ($pages as $key => $page){
+
+    $page = base64_decode($page);
+    digitalobjects_importPage($page,$key);
+    $cnt++;
+
+  }
+
+
+}
+
+
+function digitalobjects_importPage($page,$key){
+
+  $baseUrl = "http://localhost:18080/echo_nav/echo_pages/content/scientific_revolution/harriot/maps/";
+
+  $fnames = explode("/",$key);
+
+  if ($fnames[1] != "maps"){
+    dpm($fnames[0]);
+    return;
+  }
+
+  $fname = str_replace(".pt","1_1.png",$fnames[sizeof($fnames)-1]);
+
+  $image = file_get_contents($baseUrl . $fname); // string
+  $file = file_save_data($image, 'public://' . $fname,FILE_EXISTS_REPLACE);
+
+
+
+
+  $node = new stdClass();
+  $node->type = 'map_page';
+  node_object_prepare($node);
+
+  $node->body['und'][0]['value'] = check_markup($page,'full_html');
+
+  $node->body['und'][0]['format']  = 'full_html';
+
+  $node->path['alias']="harriot/maps/" . $fnames[sizeof($fnames)-1];
+
+  $node->title = "_".$key;
+
+
+  $node->language = LANGUAGE_NONE;
+
+
+  $node->field_echopath['und'][0]['value']=$key;
+
+  $node->field_image[LANGUAGE_NONE]['0']['fid'] = $file->fid;
+  $node = node_submit($node);
+
+
+
+
+  /*$node->field_admintag['und'][0] = array (
+      'tid' => $tid,
+
+  );*/
+  // Try to set your custom field
+
+  $node = node_submit($node);
+
+  node_save($node);
+
+  }
+
+
+
+function digitalobjects_importCollectionFromFile() {
+
+
+  $filename = "/tmp/china.json";
+  $handle = fopen($filename, "r");
+  $contents = fread($handle, filesize($filename));
+  fclose($handle);
+
+  $collection = drupal_json_decode($contents);
+  digitalobjects_importCollection($collection);
+}
+
+function digitalobjects_importCollection($collection,$tid){
+
+
+  //schaue ob die collection schon gibt
+  $qs = "select count(*) as n from field_data_field_echopath where field_echopath_value='". $collection['echo_path']   ."'";
+  $results = db_query($qs);
+  foreach($results as $result){
+
+    if ($result->n> 0){
+    return;
+  }
+  }
+  dpm($collection['echo_path']);
+  $node = new stdClass();
+  $node->type = 'digitalcollection';
+  node_object_prepare($node);
+
+  $node->body['und'][0]['value'] = check_markup($collection['description'],'full_html');
+
+  $node->body['und'][0]['format']  = 'full_html';
+
+
+  $node->title = $collection['title'];
+
+
+  $node->language = LANGUAGE_NONE;
+
+
+  $node->field_echopath['und'][0]['value']=$collection['echo_path'];
+  $node->field_label['und'][0]['value']=$collection['label'];
+  $node = node_submit($node);
+
+
+  $cnt=0;
+  foreach ($collection['content'] as $cont){
+    print $cont;
+    if (($cont != "") && ($cont !=null)){
+      $node->field_objid['und'][$cnt]['objid']=$cont;
+      $cnt++;
+
+
+    }
+  }
+
+  $node->field_admintag['und'][0] = array (
+      'tid' => $tid,
+
+  );
+  // Try to set your custom field
+
+  $node = node_submit($node);
+
+  node_save($node);
+
+}
+
+function digitalobjects_importCollections($tid) {
+  #filename = "/tmp/export.json";
+  $filename = "/tmp/groups.json";
+ # $filename = "/tmp/echo.json";
+  $handle = fopen($filename, "r");
+  $contents = fread($handle, filesize($filename));
+  fclose($handle);
+
+  $collections = drupal_json_decode($contents);
+
+  $cnt=0;
+  foreach ($collections as $key => $collection){
+    digitalobjects_importCollection($collection,$tid);
+    $cnt++;
+
+  }
+
+}
+
+/* suche all e nodes mit echopath = $path */
+function digitalobjects_searchCollectionByPath($path){
+  $results = db_query("SELECT * FROM {field_data_field_echopath} n where field_echopath_value ='" . $path . "'");
+
+  return $results;
+  }
+
+function digitalobjects_importStructure(){
+  $filename = "/Library/WebServer/Documents/drupal-dev/testData/exportAllCollectionsAndSubCollectionAsJSON";
+  # $filename = "/tmp/echo.json";
+  $handle = fopen($filename, "r");
+  $contents = fread($handle, filesize($filename));
+  fclose($handle);
+
+  $collections = drupal_json_decode($contents);
+
+  foreach ($collections as $parentCollection => $value){
+    /* finde node id von parent */
+    $nodes = digitalobjects_searchCollectionByPath($parentCollection);
+    if (sizeof($nodes) == 0){ //parent existiert nicht
+      //generate parent
+    } else {
+      foreach($nodes as $node){ // sollte eigentlich nur eine geben aber wenn mehrere gibt, dann eben überall die entsprechenden einträge machen.
+        // gehe jetzt durch content
+
+        $cnt=0;
+        foreach($value['content'] as $content){
+          $childnodes = digitalobjects_searchCollectionByPath($content);
+          if (sizeof($nodes) == 0){ // gibt es nicht
+           //erzeuge
+          }else{
+
+            $nodeid = $node->entity_id;
+            $entities = entity_load("node",array($nodeid)); // hole die entities
+            foreach($entities as $entity){
+              foreach($childnodes as $childnode){ // trage jetzt die childnodes ein.
+
+                $newnode ="node/".$childnode->entity_id;
+                $qs = "SELECT count(*) as n FROM {field_data_field_collid} n where field_collid_objid ='" . $newnode . "' and entity_id ='". $nodeid . "'";
+                $res = db_query($qs);
+
+                foreach($res as $result){
+                  dpm($result);
+                  dpm($qs);
+                  if ($result->n == 0){ //gibt es noch nicht
+
+                    $entity->field_collid['und'][]['objid']=$newnode;
+                  }
+                }
+              }
+
+              $entity = node_submit($entity);
+
+              node_save($entity);
+            }
+          }
+        }
+        }
+
+      }
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects.info	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,19 @@
+name = digitalobjects
+description = Allows access to the digital library  for more see /* zur Dokumentation siehe: https://it-dev.mpiwg-berlin.mpg.de/tracs/echo/wiki/drupal-echo */
+core = 7.x
+
+
+configure = admin/config/media/digitalobjects/settings
+
+files[] = 
+files[] = digitalobjects.module
+files[] = digitalobjects.install
+files[] = digitalobjects.item.inc
+files[] = digitalobjects.admin.inc
+files[] = digitalobjects-item.tpl.php
+files[] = digitalobject_reader.php
+files[] = digitalobjects.collections.inc
+
+
+stylesheets[all][] = digitalobjects.css
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects.install	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,35 @@
+<?php
+/**
+ * @file
+ * Install, update, and uninstall functions for the field_example module.
+ */
+
+/**
+ * Implements hook_field_schema().
+ *
+ * Defines the database schema of the field, using the format used by the
+ * Schema API.
+ *
+ *
+ * All implementations of hook_field_schema() must be in the module's
+ * .install file.
+ *
+ * @see http://drupal.org/node/146939
+ * @see schemaapi
+ * @see hook_field_schema()
+ * @ingroup field_example
+ */
+
+function digitalobjects_field_schema($field) {
+
+  $columns = array(
+      'objid' => array('type' => 'varchar', 'length' => 20, 'not null' => FALSE), //contains id for digitalobjects or collections
+  );
+  $indexes = array(
+      'objid' => array('objid'),
+  );
+  return array(
+      'columns' => $columns,
+      'indexes' => $indexes,
+  );
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects.item.inc	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,72 @@
+<?php
+
+
+
+/**
+ * Process variables for digitalobject-item.tpl.php.
+ *
+ * The $variables array contains the following arguments:
+ * - $results: Search results array.
+ * - $module: Module the search results came from (module implementing
+ *   hook_search_info()).
+ *
+ * @see search-results.tpl.php
+ */
+function template_preprocess_digitalobjects_item(&$variables) {
+
+  $variables['objdata'] = digitalobjects_readMetadata($variables['objid']);
+
+  $accessType=isset($variables['objdata']['md']['accessType']) ?$variables['objdata']['md']['accessType']: 'mpiwg';
+  if (!user_access("view restricted content") && $accessType!="free"){
+    $variables['access']=false;
+  } else {
+    $variables['access']=true;
+  }
+
+
+}
+
+function template_preprocess_digitalobjects_item_short(&$variables) {
+
+  $variables['objdata'] = digitalobjects_readMetadata($variables['objid'],$format="short");
+
+
+  $accessType=isset($variables['objdata']['md']['accessType']) ?$variables['objdata']['md']['accessType']: 'mpiwg';
+  if (!user_access("view restricted content") && $accessType!="free"){
+    $variables['access']=false;
+  } else {
+    $variables['access']=true;
+  }
+
+
+}
+
+function template_preprocess_digitalobjects_item_thumbnail(&$variables) {
+
+  $variables['objdata'] = digitalobjects_readMetadata($variables['objid'],$format="short");
+
+
+  $accessType=isset($variables['objdata']['md']['accessType']) ?$variables['objdata']['md']['accessType']: 'mpiwg';
+  if (!user_access("view restricted content") && $accessType!="free"){
+    $variables['access']=false;
+  } else {
+    $variables['access']=true;
+  }
+
+
+}
+
+function template_preprocess_digitalobjects_item_xml(&$variables) {
+
+  $variables['objdata'] = digitalobjects_readMetadata($variables['objid'],$format="DC");
+
+
+  $accessType=isset($variables['objdata']['md']['accessType']) ?$variables['objdata']['md']['accessType']: 'mpiwg';
+  if (!user_access("view restricted content") && $accessType!="free"){
+    $variables['access']=false;
+  } else {
+    $variables['access']=true;
+  }
+
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digitalobjects.module	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,1112 @@
+<?php
+/* Implements hook_menu */
+
+
+/* TODOS
+ *
+ *
+ */
+include('digitalobject_reader.php');
+include('digitalobjects.import.php');
+include('digitalobjects.collections.inc');
+
+
+
+/** implement hook init experimental**/
+
+
+
+#function digitalobjects_init() {
+#  dpm("HUH");
+#  drupal_add_js(drupal_get_path('module', 'digitalobjects') .'/chooser.js');
+#}
+
+/**
+ * Implementation of hook_enable().
+ */
+
+function digitalobjects_enable() {
+
+  #adds a field for the current collection to the user bundle
+  #every user can select a current collection, where objects are added to
+  // Check if our field is not already created.
+  if (!field_info_field('field_digitalobjects_cid')) {
+    dpm("create field:field_digitalobjects_cidfor user");
+    $field = array(
+        'field_name' => 'field_digitalobjects_cid',
+        'type' => 'digitalobjects_digitalcollection',
+    );
+    field_create_field($field);
+
+    // Create the instance on the bundle.
+    $instance = array(
+        'field_name' => 'field_digitalobjects_cid',
+        'entity_type' => 'user',
+        'label' => 'Current collection',
+        'bundle' => 'user',
+        // If you don't set the "required" property then the field wont be required by default.
+        'required' => False,
+        'settings' => array(
+            // Here you inform either or not you want this field showing up on the registration form.
+            'user_register_form' => 1,
+        ),
+        'widget' => array(
+            'type' => 'digitalcollection_default_textfield',
+        ),
+    );
+    field_create_instance($instance);
+  }
+}
+
+function digitalobjects_menu(){
+
+    $items['digitalcollections/manageCurrent'] = array(
+        'description' => 'show an object.',
+        'page callback' => 'digitalobjects_digitalcollectionsManage',
+        'access arguments'   => array('access content'),
+        'file'               => 'digitalobjects.collections.inc',
+
+    );
+
+
+    $items['digitalobject'] = array(
+        'description' => 'show an object.',
+        'page callback' => 'digitalobjects_page',
+        'access arguments'   => array('access content'),
+
+    );
+     $items['admin/config/media/digitalobjects'] = array(
+            'title'              => 'Digitalobject',
+            'description'        => 'Set path to the metadaprovider for digitalobjects',
+            'weight'             => 10,
+            'page callback'      => 'drupal_get_form',
+            'page arguments'     => array('digitalobjects_settings'),
+            'access arguments'   => array('administrate digitalobjects'),
+            'file'               => 'digitalobjects.admin.inc',
+
+        );
+
+
+
+
+
+     $items['user/%/collections'] = array(
+         'title'              => 'Collections',
+         'description'        => 'Set path to the metadaprovider for digitalobjects',
+         'weight'             => 10,
+         'page callback'      => 'digitalobjects_user_admin_collection',
+         'page arguments'     => array(1),
+         'access arguments'   => array('manage private collections'),
+         'file'               => 'digitalobjects.collections.inc',
+         'type' => MENU_LOCAL_TASK,
+     );
+
+
+
+     $items['digitalobject/%/view'] = array(
+        'title'              => 'View',
+               'description' => 'show an object.',
+        'page callback' => 'digitalobjects_page',
+        'access arguments'   => array('access content'),
+            'page arguments'     => array(1),
+
+         'access arguments'   => array('access content'),
+          'type' => MENU_LOCAL_TASK,
+
+     );
+
+     $items['digitalobject/%/edit'] = array(
+         'title'              => 'Edit',
+         'description'        => 'Set path to the metadaprovider for digitalobjects',
+         'weight'             => 10,
+         'page callback'      => 'digitalobjects_edit',
+         'page arguments'     => array(1),
+
+         'access arguments'   => array('administrate digitalobjects'),
+         'type' => MENU_LOCAL_TASK,
+
+     );
+
+     $items['digitalobject/%/usage'] = array(
+         'title'              => 'Usage',
+         'description'        => 'Set path to the metadaprovider for digitalobjects',
+         'weight'             => 10,
+         'page callback'      => 'digitalobjects_show_usage',
+         'page arguments'     => array(1),
+
+         'access arguments'   => array('access content'),
+         'type' => MENU_LOCAL_TASK,
+
+     );
+
+     $items['digitalobject/%/add'] = array(
+         'title'              => 'Add',
+         'description'        => 'Add an object to the current collection',
+         'weight'             => 10,
+         'page callback'      => 'digitalobjects_addToCurrentCollection',
+         'page arguments'     => array(1),
+
+         'access arguments'   => array('administrate digitalobjects'),
+         'file'               => 'digitalobjects.collections.inc',
+         'type' => MENU_LOCAL_TASK,
+
+     );
+    return $items;
+
+}
+
+
+function  digitalobjects_create_primary_node($objid){
+$node = new stdClass();
+$node->type = 'digitalobject';
+node_object_prepare($node);
+global $user;
+#dpm($user);
+#$node->uid=$user->uid;
+$node->field_single_objid['und'][0]['objid']=$objid;
+
+$node->title = $objid;
+
+$node->language = LANGUAGE_NONE;
+#$node = node_submit($node);
+
+#$node->field_object_type['und'][0]=array('tid'=> '6');
+
+$foo = taxonomy_get_term_by_name('primary');
+foreach($foo as $term) {
+
+  if(($term->vocabulary_machine_name) == 'digitalobject_types') {
+
+    $node->field_object_type['und'][]['tid'] = $term->tid;
+  }
+}
+$node = node_submit($node);
+
+node_save($node);
+
+return $node;
+}
+
+function digitalobjects_edit($objid){
+  #suche ob es schon ein locales object zu dieser id gibt.
+  $query = new EntityFieldQuery();
+  $entities = $query->entityCondition('entity_type', 'node')
+  ->entityCondition('bundle', 'digitalobject')
+  ->fieldCondition('field_single_objid', 'objid', $objid,"=")
+  ->execute();
+
+  if ($entities == null) #existiert noch nicht, dann anlegen
+  {
+    $node =digitalobjects_create_primary_node($objid);
+    #$node->field_object_type['und'][0]=array('tid'=> 'autocreate',
+    #'name' => "primary",
+    #'vocabulary_machine_name' => 'digitialobject_types');
+
+  } else {
+
+
+  $nodes = node_load_multiple(array_keys($entities['node']));
+
+  #gibt es eins, dann gib dieses zum editieren zurück
+  #TODO falls mehrere existieren, was dann??
+
+  #gehe durch alle gefundene
+  foreach ($nodes as $node){
+    #$typeTag = $entity->object_type['und']
+
+    if (isset($node->field_object_type['und'])){
+    $tid = $node->field_object_type['und'][0]['tid'];
+    $tax =taxonomy_term_load($tid);
+    if ($tax->name == "primary"){ #'primary gefunden'
+      module_load_include('inc', 'node', 'node.pages');
+      return drupal_get_form('digitalobject_node_form', $node);
+    }}
+  } # keine primary dann lege diese an:
+
+  $node =digitalobjects_create_primary_node($objid);
+
+  #$vals = array_values($nodes);
+  #$node= array_shift($vals);
+  }
+
+  $node = node_submit($node);
+
+  #node_save($node);
+  module_load_include('inc', 'node', 'node.pages');
+
+  return drupal_get_form('digitalobject_node_form', $node);
+
+}
+
+
+function digitalobjects_show_usage($objid){
+  $query = new EntityFieldQuery();
+  $entities = $query->entityCondition('entity_type', 'node')
+  ->fieldCondition('field_objid', 'objid', $objid,"=")
+  ->execute();
+
+
+  $data = array();
+
+  #treffer gefunden
+  if (isset($entities['node'])){
+
+  $nodes = node_load_multiple(array_keys($entities['node']));
+
+
+  foreach ($nodes as $node){
+    $data[$node->nid] = $node->title;
+
+  }
+
+
+  $output['digitalobjects_item_usage']= array(
+      '#theme' => 'digitalobjects_item_usage',
+      '#data' => $data);
+
+  return $output;
+  }
+
+  return "<h2> object not used in a collection </h2>";
+  }
+
+
+function digitalobjects_page($keys = ''){
+
+
+  #suche ob es schon ein locales object zu dieser id gibt.
+  $query = new EntityFieldQuery();
+  $entities = $query->entityCondition('entity_type', 'node')
+  ->entityCondition('bundle', 'digitalobject')
+  ->fieldCondition('field_single_objid', 'objid', $keys,"=")
+  ->execute();
+
+  if ($entities == null) #existiert noch nicht, dann generische Anzeige
+  {
+
+  $output['digitalobjects_item']= array(
+  '#theme' => 'digitalobjects_item',
+  '#objid' => $keys);
+
+  return $output;
+  } else {
+    $nodes = node_load_multiple(array_keys($entities['node']));
+
+    #gibt es eins, dann gib dieses zum editieren zurück
+    #TODO falls mehrere existieren, was dann??
+
+    #gehe durch alle gefundene
+    foreach ($nodes as $node){
+      if (isset($node->field_object_type['und'])){
+        $tid = $node->field_object_type['und'][0]['tid'];
+        $tax =taxonomy_term_load($tid);
+
+        if ($tax->name == "primary"){ #'primary gefunden'
+          return node_view($node, $view_mode = 'full');
+        }
+      }
+    }
+    #keine primary node gefunden, generische ausgabe
+    $output['digitalobjects_item']= array(
+        '#theme' => 'digitalobjects_item',
+        '#objid' => $keys);
+    return $output;
+  }
+}
+
+/* implements digitalobject_theme */
+
+function digitalobjects_theme(){
+
+    return array(
+        'digitalobjects_item'  => array(
+            'variables' => array('objid' => NULL),
+            'file' => 'digitalobjects.item.inc',
+            'template' => 'digitalobjects-item',
+        ),
+        'digitalobjects_item_short'  => array(
+            'variables' => array('objid' => NULL),
+            'file' => 'digitalobjects.item.inc',
+            'template' => 'digitalobjects-item-short',
+        ),
+
+        'digitalobjects_item_thumbnail'  => array(
+            'variables' => array('objid' => NULL),
+            'file' => 'digitalobjects.item.inc',
+            'template' => 'digitalobjects-item-thumbnail',
+        ),
+
+	'digitalobjects_item_thumbnail_large'  => array(
+            'variables' => array('objid' => NULL),
+            'file' => 'digitalobjects.item.inc',
+            'template' => 'digitalobjects-item-thumbnail',
+        ),
+
+        'digitalobjects_item_objid'  => array(
+            'variables' => array('objid' => NULL),
+            'template' => 'digitalobjects-item-objid',
+        ),
+        'digitalobjects_item_tools'  => array(
+            'variables' => array('objid' => NULL),
+            'template' => 'digitalobjects-item-tools',
+        ),
+        'digitalobjects_item_usage'  => array(
+            'variables' => array('data' => NULL),
+            'template' => 'digitalobjects-item-usage',
+        ),
+        'digitalobjects_collection_simple'  => array(
+            'variables' => array('objid' => NULL),
+            'template' => 'digitalobjects-collection-simple',
+        ),
+        'digitalobjects_currentCollection_block'  => array(
+            'variables' => array('node' => NULL),
+            'template' => 'digitalobjects-current-collection',
+        ),
+        'digitalobjects_collection_nodeLink'  => array(
+            'variables' => array("entities" => $NULL),
+            'template' => 'digitalobjects-collection-nodeLink',
+        ),
+
+
+
+        'digitalobjects_item_xml'  => array(
+            'variables' => array('objid' => NULL),
+            'file' => 'digitalobjects.item.inc',
+            'template' => 'digitalobjects-item-xml',
+        ),
+
+        'digitalobjects_collection_usedIn'  => array(
+
+            'template' => 'digitalobjects-collection-usedIn',
+        ),
+
+        'digitalobjects_items'  => array(
+            'variables' => array('search_results' => NULL),
+            'template' => 'digitalobjects-items',
+        ),
+
+        'digitalobjects_image_src_link_viewer'  => array(
+            'variables' => array('src' => NULL,'link' => NULL),
+            'template' => 'digitalobjects-image_src_link_viewer',
+        ),
+
+        'digitalobjects_image_src_link_viewer_large'  => array(
+            'variables' => array('src' => NULL,'link' => NULL),
+            'template' => 'digitalobjects-image_src_link_viewer_large',
+        ),
+
+        'digitalobjects_pdf_link_viewer'  => array(
+            'variables' => array('title' => NULL,'link' => NULL),
+            'template' => 'digitalobjects-pdf_link_viewer',
+        ),
+
+     /*   'digitalobjects_user_admin_page' => array(
+         'variables' => array('digitalobjects_user_admin','uid' =>1),
+        'template'  => 'digitalobjects-user-admin-form'
+         ),*/
+            );
+}
+
+function digitalobjects_forms($form_id, $args) {
+
+  $forms['digitalobjects_user_admin_form']= array(
+      'callback' => 'digitalobjects_user_admin',
+      'callback arguments' => array('digitalobjects_user_admin_page'),
+  );
+  return $forms;
+};
+
+
+
+
+function digitalobjects_user_admin(array $form, array &$form_state) {
+
+  $form['digitalcollection'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Active collection'),
+      '#size' => 15,
+      '#default_value' => 'xxxx',
+      '#attributes' => array('title' => t('Enter the terms id of the current collection.')),
+  );
+
+
+  $form['userid'] = array(
+      '#type' => 'hidden',
+  );
+  #$form['actions'] = array('#type' => 'actions');
+  $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
+  $form['submit']['#submit'][] = 'digitalobjects_user_admin_form_submit';
+
+  return $form;
+}
+/* implements a new field type for the digitalobject id */
+
+function digitalobjects_field_info(){
+
+  return array('digitalobjects_digitalobject' => array (
+      'label' => t('Digital Object ID'),
+      'description' => t('This field stores a digital object ID'),
+      'settings' => array('max_length' =>20),
+     'instance_settings' => array('text_processing' => 0),
+      'default_widget' => 'digitalobject_default_textfield',
+      'default_formatter' => 'digitalobjects_fullmetadata',
+    ),
+      'digitalobjects_digitalcollection' => array (
+          'label' => t('Digital Collection ID'),
+          'description' => t('This field stores a digital collection ID'),
+          'settings' => array('max_length' =>20),
+          'instance_settings' => array('text_processing' => 0),
+          'default_widget' => 'digitalcollection_default_textfield',
+          'default_formatter' => 'digitalcollection_fullmetadata',
+          ),
+
+
+  );
+
+
+}
+
+
+
+
+function digitalobjects_field_formatter_info() {
+
+  return array(
+      // This formatter shows the obejct with fullmetadata
+      'digitalobjects_fullmetadata' => array(
+          'label' => t('Fullmetadata formatter'),
+          'field types' => array('digitalobjects_digitalobject'),
+      ),
+      'digitalobjects_label' => array(
+          'label' => t('Label formatter'),
+          'field types' => array('digitalobjects_digitalobject'),
+      ),
+      'digitalobjects_thumbnail' => array(
+          'label' => t('Thumbnail formatter (100px'),
+          'field types' => array('digitalobjects_digitalobject'),
+      ),
+
+      'digitalobjects_thumbnail_large' => array(
+          'label' => t('Thumbnail formatter (l200px)'),
+          'field types' => array('digitalobjects_digitalobject'),
+      ),
+      'digitalobjects_objid' => array(
+          'label' => t('Objid as String formatter'),
+          'field types' => array('digitalobjects_digitalobject'),
+      ),
+
+      'digitalobjects_xml' => array(
+          'label' => t('Objids as XML formatter'),
+          'field types' => array('digitalobjects_digitalobject'),
+      ),
+
+      'digitalobjects_collection_simple' => array(
+          'label' => t('Simple formatter'),
+          'field types' => array('digitalobjects_digitalcollection'),
+      ),
+      'digitalobjects_image_src_link_viewer' => array(
+          'label' => t('View Image and Link from URL'),
+          'field types' => array('link_field'),
+      ),
+
+      'digitalobjects_image_src_link_viewer_large' => array(
+          'label' => t('View Image and Link from URL (200px)'),
+          'field types' => array('link_field'),
+      ),
+  	'digitalobjects_image_viewer' => array(
+  				'label' => t('View filename as image with link to digilib'),
+  				'field types' => array('text'),
+  		),
+	'digitalobjects_image_viewer_large' => array(
+  				'label' => t('View filename as image (200px) with link to digilib'),
+  				'field types' => array('text'),
+  		),
+      'digitalobjects_pdf_link_viewer' => array(
+          'label' => t('View PDF in external viewer'),
+          'field types' => array('link_field'),
+      ),
+
+  );
+  }
+
+
+
+
+
+
+ function digitalobjects_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
+    $element = array();
+
+
+    switch ($display['type']) {
+
+      case 'digitalobjects_image_viewer':
+        foreach ($items as $delta => $item) {
+
+          $value = $item['value'];
+
+          $linkbase= variable_get('digitalobjects_imagebase_digilib_path');
+          
+          $value = str_replace(' ', '_', $value);
+
+          $link = $linkbase . $value;
+
+          $srcbase=variable_get('digitalobjects_imagebase_scaler_path');
+
+          $src= $srcbase . $value;
+
+
+          $element[$delta]['#markup'] = theme('digitalobjects_image_src_link_viewer', array("src" => $src,"link" => $link));
+
+
+        }
+        break;
+
+  case 'digitalobjects_image_viewer_large':
+        foreach ($items as $delta => $item) {
+
+          $value = $item['value'];
+
+          $linkbase= variable_get('digitalobjects_imagebase_digilib_path');
+          
+          $value = str_replace(' ', '_', $value);
+
+          $link = $linkbase . $value;
+
+          $srcbase=variable_get('digitalobjects_imagebase_scaler_path_large');
+
+          $src= $srcbase . $value;
+
+
+          $element[$delta]['#markup'] = theme('digitalobjects_image_src_link_viewer_large', array("src" => $src,"link" => $link));
+
+
+        }
+        break;
+
+
+
+
+      case 'digitalobjects_fullmetadata':
+        foreach ($items as $delta => $item) {
+          if ($item['objid']!=""){
+            $element[$delta]['#markup'] = theme('digitalobjects_item_tools', array("objid" => $item['objid']));
+            $element[$delta]['#markup'] .= theme('digitalobjects_item', array("objid" => $item['objid']));
+
+          }
+        }
+
+        break;
+
+      case 'digitalobjects_label':
+        foreach ($items as $delta => $item) {
+          if ($item['objid']!=""){
+
+            $element[$delta]['#markup'] = theme('digitalobjects_item_short', array("objid" => $item['objid']));
+            $element[$delta]['#markup'] .= theme('digitalobjects_item_tools', array("objid" => $item['objid']));
+          }
+        }
+        break;
+
+        case 'digitalobjects_thumbnail':
+          foreach ($items as $delta => $item) {
+            if ($item['objid']!=""){
+
+              $element[$delta]['#markup'] = theme('digitalobjects_item_thumbnail', array("objid" => $item['objid']));
+              #$element[$delta]['#markup'] .= theme('digitalobjects_item_tools', array("objid" => $item['objid']));
+            }
+          }
+          break;
+
+  case 'digitalobjects_thumbnail_large':
+          foreach ($items as $delta => $item) {
+            if ($item['objid']!=""){
+
+              $element[$delta]['#markup'] = theme('digitalobjects_item_thumbnail_large', array("objid" => $item['objid']));
+              #$element[$delta]['#markup'] .= theme('digitalobjects_item_tools', array("objid" => $item['objid']));
+            }
+          }
+          break;
+
+
+          case 'digitalobjects_objid':
+            foreach ($items as $delta => $item) {
+              if ($item['objid']!=""){
+
+                $element[$delta]['#markup'] = theme('digitalobjects_item_objid', array("objid" => $item['objid']));
+                #$element[$delta]['#markup'] .= theme('digitalobjects_item_tools', array("objid" => $item['objid']));
+              }
+            }
+            break;
+
+        case 'digitalobjects_xml':
+          foreach ($items as $delta => $item) {
+            if ($item['objid']!=""){
+              $element[$delta]['#markup'] = theme('digitalobjects_item_xml', array("objid" => $item['objid']));
+          }
+          }
+          break;
+
+         case 'digitalobjects_collection_xml':
+            foreach ($items as $delta => $item) {
+              if ($item['objid']!=""){
+
+                $path=$item['objid'];
+                //path is node, d.h. beginnt mit node/
+
+                if (!strncmp($path, "node/", strlen("node/"))){
+                  $nid = str_replace("node/","",$path);
+                  $entities = entity_load("node",array($nid));
+
+                  $element[$delta]['#markup'] = theme('digitalobjects_collection_nodeLink_xml', array("entities" => $entities));
+
+                } else {
+
+
+                  $element[$delta]['#markup'] = theme('digitalobjects_collection_simple_xml', array("objid" => $item['objid']));
+
+                }
+              }
+            }
+            break;
+
+
+          case 'digitalobjects_image_src_link_viewer':
+	  case 'digitalobjects_image_src_link_viewer_large':
+            #nimmt den link aus dem link feld und macht unter der Annahme er geht auf diglib ein Bild daraus
+            foreach ($items as $delta => $item) {
+
+                #title feld ist leer, dann:
+                #$scal="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?";
+
+                $scal = variable_get('digitalobjects_scaler_path');
+
+                #$img="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/jquery/digilib.html?";
+
+                $img=variable_get('digitalobjects_digilib_path');
+                $src= str_replace($img, $scal, $item['url']);
+
+                $src=$src . "&dw=500";
+
+		
+
+              $element[$delta]['#markup'] = theme($display['type'], array("src" => $src,"link" => $item['url']));
+
+
+            }
+            break;
+
+          case 'digitalobjects_pdf_link_viewer':
+            #nimmt link aus link field und zeigt dieses mit externem pdf viewer an
+            foreach ($items as $delta => $item) {
+              #$pdfViewer="http://content.mpiwg-berlin.mpg.de/pdfViewer/pdf.js-master/web/viewer.html?file=";
+              $pdfViewer=variable_get('digitalobjects_pdfviewer_path');
+              $pdfpath=variable_get('digitalobjects_repository_path');
+
+              #url contains $base root should be removed
+              global $base_root;
+
+              $url = str_replace($base_root,"",$item['url']);
+              $pdfLink=$pdfViewer . $pdfpath . $url;
+
+              $element[$delta]['#markup'] = theme('digitalobjects_pdf_link_viewer', array("title" => $item['title'],"link" => $pdfLink));
+            }
+            break;
+
+
+
+
+
+    }
+    return $element;
+ }
+
+function template_preprocess_digitalobjects_items(&$variables) {
+   $variables['search_results'] = '';
+
+   $viewMode="shortX";
+
+   foreach ($variables['results'] as $result) {
+
+   switch ($viewMode) {
+
+     case "short":
+       $variables['search_results']  .= theme('digitalobjects_item_tools', array("objid" => $result['objid']));
+       $variables['search_results'] .= theme('digitalobjects_item_short', array('objid' => $result['objid']));
+
+       break;
+
+
+     default:
+         $variables['search_results']  .= theme('digitalobjects_item_tools', array("objid" => $result['objid'], 'objidcss' => digitalobjects_clean_css_identifier($result['objid'])));
+         $variables['search_results'] .= theme('digitalobjects_item', array('objid' => $result['objid']));
+
+         break;
+   }
+
+   }
+   $variables['pager'] = theme('pager', array('tags' => NULL,'quantity'=> 2));
+
+ }
+
+
+
+function digitalobjects_field_widget_info() {
+  #TODO:both types should check if field is valid
+   return array(
+       'digitalobject_default_textfield' => array(
+           'label' => t('digitalobject id'),
+           'field types' => array('digitalobjects_digitalobject'),
+       ),
+       'digitalcollection_default_textfield' => array(
+           'label' => t('digital collection id'),
+           'field types' => array('digitalobjects_digitalcollection'),
+       ),
+       'digitalobjects_objpager_default' => array(
+           'label' => t('No edit widget'),
+           'field types' => array('digitalobjects_itemView'),
+           'behaviors' => array(
+               'multiple values' => FIELD_BEHAVIOR_CUSTOM,
+               )
+       ),
+
+       );
+  }
+
+ function digitalobjects_field_postrender($string){
+  /* String is:
+   * <div class="form-item form-type-textfield form-item-field-objid-und-0-objid">
+  <input type="text" id="edit-field-objid-und-0-objid" name="field_objid[und][0][objid]" value="" size="20" maxlength="20" class="form-text" />
+</div>
+*/
+
+   // get value:
+
+   preg_match('/value="([^"]*)"/',$string,$matches);
+   $value = $matches[1];
+   $bib = digitalobjects_readMetadata($value,"short");
+   $string = $string . "<div>" . $bib['bibdata'] . "</div>";
+   return $string;
+ }
+
+ function digitalobjects_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
+
+
+   $field_name = $field['field_name'];
+   $field_type = $field['type'];
+
+
+   $value = isset($items[$delta]['objid']) ? $items[$delta]['objid'] : '';
+
+   $widget = $element;
+   $widget['#delta'] = $delta;
+
+   switch ($instance['widget']['type']) {
+
+
+
+     case 'digitalobject_default_textfield':
+       $widget += array(
+       '#type' => 'textfield',
+       '#default_value' => $value,
+       '#size' => 20,
+       '#maxlength' => 20,
+       '#post_render' => array('digitalobjects_field_postrender'),
+           );
+
+
+
+       $element['objid'] = $widget;
+
+           break;
+
+     case 'digitalcollection_default_textfield':
+             $widget += array(
+             '#type' => 'textfield',
+             '#default_value' => $value,
+             '#size' => 20,
+             '#maxlength' => 20,
+             );
+
+             $element['objid'] = $widget;
+             break;
+
+
+   }
+
+
+
+
+   return $element;
+ }
+
+
+ function digitalobjects_field_is_empty($item, $field){
+
+   return empty($item['objid']);
+ }
+
+
+
+ /*admin current collection for a user */
+
+function digitalobjects_user_admin_form_submit($form,$formstate){
+  $value = $formstate['values']['digitalcollection'];
+  $userid = $formstate['values']['userid'];
+
+  $user=user_load($userid);
+
+
+  $user->field_digitalobjects_cid['und'][0]['objid'] = $value;
+
+  user_save($user);
+
+}
+
+
+/* show current collection of the current user as block */
+function digitalobjects_block_info(){
+  $blocks['digitalobjects_currentCollection'] = array(
+      'info' => t('Current Collection'),
+      'visibility' => BLOCK_VISIBILITY_PHP,
+      'pages' => '<?php global $user; if ($user->uid == 0) return FALSE; else return TRUE; ?>'
+  );
+
+  $blocks['digitalobjects_collection_usedIn'] = array(
+      'info' => t('Collection used in')
+  );
+
+  $blocks['digitalobjects_block_items'] = array(
+      'info' => t('Items of a collection (if page is a collection)')
+  );
+
+
+  return $blocks;
+}
+
+function digitalobjects_block_view($delta){
+
+  switch($delta){
+
+  case 'digitalobjects_currentCollection':
+    /* display current cullection */
+
+    global $user;
+
+    $user_full=user_load($user->uid);
+
+    if (isset($user_full->field_digitalobjects_cid['und'][0]['objid'])){
+    $val = $user_full->field_digitalobjects_cid['und'][0]['objid'];
+    } else {
+      return;
+    }
+    $node = node_load($val);
+
+    #$title = $node=>title;
+
+   $block['content'] = theme('digitalobjects_currentCollection_block',array('node' => $node));
+
+   $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
+   $form['submit']['#submit'][] = 'digitalobjects_user_admin_collection';
+
+   $submitForm=drupal_get_form('digitalobjects_change_collection_button_form');
+   $block['content'] .= drupal_render($submitForm);
+   return $block;
+   break;
+
+
+  case 'digitalobjects_collection_usedIn':
+    if ($node = menu_get_object()) {
+      // Get the nid
+      $nid = $node->nid;
+      $entities = digitalcollection_used_id($nid);
+
+      $block['content'] = theme('digitalobjects_collection_usedIn',array('entities'=> $entities));
+      return $block;
+    }
+
+  case 'digitalobjects_block_items':
+    if ($entity = menu_get_object()) {
+
+    #$element[$delta]['prefix']['#markup'] = '<ol class="search-results">';
+
+      if(!isset($entity->field_objid[LANGUAGE_NONE])){
+        break;
+      }
+
+      $resultsAll = $entity->field_objid[LANGUAGE_NONE];
+
+
+
+      $nums_per_page = 10;
+
+      $params = drupal_get_query_parameters();
+      if (isset($params['page'])){
+        $page = $params['page'];
+      } else {
+        $page = 0;
+      }
+
+
+      $start=$nums_per_page * intval($page);
+
+      if ($resultsAll==null){
+        break;
+      }
+
+      $results = array_slice($resultsAll,$start,$nums_per_page);
+
+
+
+      pager_default_initialize(sizeof($resultsAll),$nums_per_page);
+
+
+
+      #foreach ($results as $entry) {
+      #  $element[$delta][]['#markup'] = $entry;
+      #}
+
+      #$element[$delta]['suffix']['#markup'] = '</ol>' . theme('pager');
+
+       $block['content']  = theme('digitalobjects_items', array('results' => $results));
+
+      // Finally, display the pager controls, and return.
+      #$element[$delta]['#markup']  .= theme('pager');
+
+
+    #dpm(theme('pager'));
+    return $block;
+    break;
+    }
+
+
+  }
+
+  //return $block;
+}
+
+function digitalobjects_change_collection_button_form(){
+  include_once 'digitalobjects.collections.inc';
+  global $user;
+  $form['userid'] = array(
+
+      '#type' => 'hidden',
+      '#value' => $user->uid
+  );
+
+  $form['submit'] = array('#type' => 'submit', '#value' => t('change'));
+  $form['submit']['#submit'][] = 'digitalobjects_user_admin_collection_submit';
+
+  return $form;
+}
+
+function digitalobjects_permission() {
+  return array(
+      'manage private collections' => array(
+          'title' => t('Manage private collections'),
+          'description' => t('Allow users create and manage private collections.'),
+      ),
+      'administrate digitalobjects' => array(
+          'title' => t('Administrate digitalobjects'),
+          'description' => t('Can add commentaries to digital objects.'),
+      ),
+  );
+}
+
+
+function digitalobjects_pathologic_alter(&$url_params, $parts, $settings){
+#bilder ohne jegliche pfad angaben werden auf sites/default/files/..
+  if (preg_match('~^([^/]*)\.(png|gif|jpe?g)$~', $url_params['path'])){
+
+    $url_params['path'] = 'sites/default/files/' . $url_params['path'];
+  }
+
+  if (preg_match('~^./([^/]*)\.pt$~', $url_params['path'],$matches)){
+
+    $url_params['path'] = 'harriot/maps/' . $matches[1] . '.pt';
+  }
+
+}
+
+function digitalobjects_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
+
+    foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
+        $info = field_info_field($name);
+        #map the whole attr
+
+        if ($info['type'] == 'digitalobjects_digitalobject') {
+            $targets[$name] = array(
+                    'name' => t('@name', array('@name' => $instance['label'])),
+                    'callback' => 'digitalobjects_feeds_set_target',
+                    'description' => t('The @label field of the entity.', array('@label' => $instance['label'])),
+                    'real_target' => $name,
+            );
+        }
+    }
+}
+
+function digitalobjects_feeds_set_target($source, $entity, $target, $value) {
+
+    if (empty($value)) {
+        return;
+    }
+
+    // Handle non-multiple value fields.
+    if (!is_array($value)) {
+        $value = array($value);
+    }
+
+    // Iterate over all values.
+    #list($field_name, $column) = explode(':', $target);
+
+    $field_name=$target;
+    $info = field_info_field($field_name);
+
+    $field = isset($entity->$field_name) ? $entity->$field_name : array();
+    $delta = 0;
+
+    foreach ($value as $v) {
+
+        if ($info['cardinality'] == $delta) {
+            break;
+        }
+
+        if (is_object($v) && ($v instanceof FeedsElement)) {
+            $v = $v->getValue();
+        }
+
+        if (is_scalar($v)) {
+            $field['und'][$delta]['objid'] = $v;
+            $delta++;
+        }
+
+        if (is_array($v)){
+            $newVal = array();
+
+            $newVal['objid'] = $v;
+            $field['und'][$delta]= $newVal;
+            $delta++;
+        }
+    }
+    $entity->$field_name = $field;
+}
+
+//Provide a function to generate a valid identifier from the objectid
+//taken from views module
+
+function digitalobjects_clean_css_identifier($identifier, $filter = array(' ' => '-', '/' => '-', '[' => '-', ']' => '')) {
+  // By default, we filter using Drupal's coding standards.
+  $identifier = strtr($identifier, $filter);
+
+  // Valid characters in a CSS identifier are:
+  // - the hyphen (U+002D)
+  // - a-z (U+0030 - U+0039)
+  // - A-Z (U+0041 - U+005A)
+  // - the underscore (U+005F)
+  // - 0-9 (U+0061 - U+007A)
+  // - ISO 10646 characters U+00A1 and higher
+  // We strip out any character not in the above list.
+  $identifier = preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $identifier);
+
+  return $identifier;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/maybedeprecated-Copy of digitalobjects-item.tpl.php	Tue Jun 02 08:57:48 2015 +0200
@@ -0,0 +1,105 @@
+
+
+<h2> Hello </h2>
+
+<?php print $objid ?>
+  <h3 class="title"<?php print $title_attributes; ?>>
+    <a href="<?php print $objdata['viewerurl']; ?>"><?php print $title ?> </a>
+  </h3>
+<a href="<?php print $objdata['viewerurl']; ?>"><img src="<?php print $objdata['thumburl']; ?>"/></a>
+
+
+ <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:block condition="exists:docinfo/bib">
+              <tal:block tal:define="bibinfo docinfo/bib" tal:repeat="bib bibinfo">
+                <tr tal:condition="python:bib[0]!='@'">
+                  <td class="type" tal:content="python:bib.capitalize().replace('_',' ') + ':'" />
+                  <td class="content" tal:content="python:bibinfo[bib]" />
+                </tr>
+              </tal:block>
+            </tal:block>
+
+            <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>