From 58695813ae5343c9c4d6cc8a0038b70edcb1092f Mon Sep 17 00:00:00 2001
From: Viola Elsenhans <elsenhans@ub.uni-leipzig.de>
Date: Thu, 23 Aug 2018 12:40:47 +0200
Subject: [PATCH] refs #13850 * adds property name to title in core-templates *
 adds schema tags for language and parent publication * removes double output
 of title and adapts output of multiple languages * adapts schema-mark-up in
 holdingsils.phtml * adds empty price and priceCurrency for product

---
 .../View/Helper/Root/RecordDataFormatterFactory.php  | 12 ++++++------
 themes/finc/templates/RecordDriver/SolrAI/core.phtml |  5 +++--
 .../templates/RecordDriver/SolrAI/data-jTitle.phtml  |  7 ++++++-
 .../templates/RecordDriver/SolrDefault/core.phtml    |  3 ++-
 .../RecordDriver/SolrDefault/data-titleDetails.phtml |  2 --
 .../SolrDefault/data-transEscCommaSepLang.phtml      | 12 ++++++++++++
 .../finc/templates/RecordDriver/SolrMarc/core.phtml  |  3 ++-
 themes/finc/templates/RecordTab/holdingsils.phtml    |  6 ++++--
 8 files changed, 35 insertions(+), 15 deletions(-)
 create mode 100644 themes/finc/templates/RecordDriver/SolrDefault/data-transEscCommaSepLang.phtml

diff --git a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php
index 031a26996d6..17691882768 100644
--- a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php
+++ b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php
@@ -114,7 +114,7 @@ class RecordDataFormatterFactory
             ['helperMethod' => 'getFormatList']
         );
         $spec->setTemplateLine(
-            'Language', 'getLanguages', 'data-transEscCommaSep.phtml'
+            'Language', 'getLanguages', 'data-transEscCommaSepLang.phtml'
         );
         $spec->setTemplateLine(
             'Published',
@@ -214,7 +214,7 @@ class RecordDataFormatterFactory
             ['helperMethod' => 'getFormatList']
         );
         $spec->setTemplateLine(
-            'Language', 'getLanguages', 'data-transEscCommaSep.phtml'
+            'Language', 'getLanguages', 'data-transEscCommaSepLang.phtml'
         );
         $spec->setTemplateLine(
             'Additionals',
@@ -250,7 +250,7 @@ class RecordDataFormatterFactory
             ]
         );
         $spec->setTemplateLine(
-            'Language', 'getLanguages', 'data-transEscCommaSep.phtml'
+            'Language', 'getLanguages', 'data-transEscCommaSepLang.phtml'
         );
         $spec->setLine(
             'Format', 'getFormats', 'RecordHelper',
@@ -316,7 +316,7 @@ class RecordDataFormatterFactory
             ['helperMethod' => 'getFormatList']
         );
         $spec->setTemplateLine(
-            'Language', 'getLanguages', 'data-transEscCommaSep.phtml'
+            'Language', 'getLanguages', 'data-transEscCommaSepLang.phtml'
         );
         $spec->setTemplateLine(
             'Published',
@@ -609,7 +609,7 @@ class RecordDataFormatterFactory
         );
         // , context: "recordEvents"
         $spec->setTemplateLine(
-            'Language', 'getLanguages','data-transEscCommaSep.phtml'
+            'Language', 'getLanguages','data-transEscCommaSepLang.phtml'
         );
         $spec->setTemplateLine(
             'Time of origin', 'getDateSpan', 'data-dateSpan.phtml'
@@ -701,7 +701,7 @@ class RecordDataFormatterFactory
             ['helperMethod' => 'getFormatList']
         );
         $spec->setTemplateLine(
-            'Language', 'getLanguages', 'data-transEscCommaSep.phtml'
+            'Language', 'getLanguages', 'data-transEscCommaSepLang.phtml'
         );
         $spec->setTemplateLine(
             'Published',
diff --git a/themes/finc/templates/RecordDriver/SolrAI/core.phtml b/themes/finc/templates/RecordDriver/SolrAI/core.phtml
index ae088dc6da9..2828594c460 100644
--- a/themes/finc/templates/RecordDriver/SolrAI/core.phtml
+++ b/themes/finc/templates/RecordDriver/SolrAI/core.phtml
@@ -1,6 +1,6 @@
 <!-- finc: recordDriver - solrAI - CORE -->
 <? /* Created in 4826, based on SolrDefault - core, compare with SolrDefault - core during updates! */ ?>
-<div class="row" vocab="http://schema.org/" resource="#record" typeof="<?=$this->driver->getSchemaOrgFormats()?> Product">
+<div class="media" vocab="http://schema.org/" resource="#record" typeof="<?=$this->driver->getSchemaOrgFormats()?> Product">
   <?
   $QRCode = $this->record($this->driver)->getQRCode("core");
   $coverDetails = $this->record($this->driver)->getCoverDetails('core', 'medium', $this->record($this->driver)->getThumbnail('large'));
@@ -42,7 +42,8 @@
           remove schema name tag here but keep in description, CK
        */
     ?>
-      <h3><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
+      <? /* finc: add schema tags for title #13850 - VE */ ?>
+      <h3 property="name"><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
 
       <? $summary = $this->driver->getSummary(); $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?>
       <? if ($summary): ?>
diff --git a/themes/finc/templates/RecordDriver/SolrAI/data-jTitle.phtml b/themes/finc/templates/RecordDriver/SolrAI/data-jTitle.phtml
index e2e39654125..f11fe9a3671 100644
--- a/themes/finc/templates/RecordDriver/SolrAI/data-jTitle.phtml
+++ b/themes/finc/templates/RecordDriver/SolrAI/data-jTitle.phtml
@@ -26,5 +26,10 @@
         }
     }
 ?>
-<?=implode(', ', $jtitle)?>
+<? /* finc: add schema tags for parent publication #13850 - VE */ ?>
+<span property="isPartOf" typeof="Periodical" resource="#periodical">
+  <span property="name">
+    <?=implode(', ', $jtitle)?>
+  </span>
+</span>
 <!-- finc: RecordDriver - SolrAi - data-jTitle - END -->
\ No newline at end of file
diff --git a/themes/finc/templates/RecordDriver/SolrDefault/core.phtml b/themes/finc/templates/RecordDriver/SolrDefault/core.phtml
index 961f931ef87..48462c26c31 100644
--- a/themes/finc/templates/RecordDriver/SolrDefault/core.phtml
+++ b/themes/finc/templates/RecordDriver/SolrDefault/core.phtml
@@ -41,7 +41,8 @@
           remove schema name tag here but keept in description, CK
        */
     ?>
-      <h3><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
+      <? /* finc: add schema tags for title #13850 - VE */ ?>
+      <h3 property="name"><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
 
     <? $summary = $this->driver->getSummary(); $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?>
     <? if ($summary): ?>
diff --git a/themes/finc/templates/RecordDriver/SolrDefault/data-titleDetails.phtml b/themes/finc/templates/RecordDriver/SolrDefault/data-titleDetails.phtml
index c903481e56b..fc6b44e3202 100644
--- a/themes/finc/templates/RecordDriver/SolrDefault/data-titleDetails.phtml
+++ b/themes/finc/templates/RecordDriver/SolrDefault/data-titleDetails.phtml
@@ -1,5 +1,4 @@
 <!-- finc: RecordDriver - solrDefault - data-titleDetails -->
-<span property="name">
 <? if (!empty($data)): ?>
     <? $i = 0; foreach ($data as $title): ?>
         <?=($i > 0 ? '<br />':'')?><?=$this->escapeHtml($title)?><? $i++ ;?>
@@ -12,5 +11,4 @@
         . ($this->driver->getTitleStatement() ? ' / ' . $this->driver->getTitleStatement() : '')?><br /><?=($this->driver->tryMethod('getTitleOrig') && $this->driver->getTitleOrig() != '' ? $this->escapeHtml($this->driver->getTitleOrig()) : '')
     ?>
 <? endif; ?>
-</span>
 <!-- finc: RecordDriver - solrDefault - data-titleDetails - END -->
diff --git a/themes/finc/templates/RecordDriver/SolrDefault/data-transEscCommaSepLang.phtml b/themes/finc/templates/RecordDriver/SolrDefault/data-transEscCommaSepLang.phtml
new file mode 100644
index 00000000000..ce46d2e8a46
--- /dev/null
+++ b/themes/finc/templates/RecordDriver/SolrDefault/data-transEscCommaSepLang.phtml
@@ -0,0 +1,12 @@
+<!-- finc: RecordDriver - solrDefault - data-transEscCommaSepLang -->
+<?if (!empty($data)): ?>
+    <? if(is_array($data)): ?>
+        <? /* finc: add schema tags for language #13850 - VE */ ?>
+        <span property="inLanguage">
+            <?=implode('</span>, <span property="inLanguage">', array_map(array($this, 'transEsc'), $data)); ?>
+        </span>
+    <? else: ?>
+        <?= $this->transEsc($data) ?>
+    <? endif; ?>
+<? endif; ?>
+<!-- finc: RecordDriver - solrDefault - data-transEscCommaSepLang - END -->
diff --git a/themes/finc/templates/RecordDriver/SolrMarc/core.phtml b/themes/finc/templates/RecordDriver/SolrMarc/core.phtml
index 6be3f73ba42..bbb181fc9bb 100644
--- a/themes/finc/templates/RecordDriver/SolrMarc/core.phtml
+++ b/themes/finc/templates/RecordDriver/SolrMarc/core.phtml
@@ -41,7 +41,8 @@
           remove schema name tag here but keept in description, CK
        */
     ?>
-      <h3><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
+      <? /* finc: add schema tags for title #13850 - VE */ ?>
+      <h3 property="name"><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
 
       <? $summary = $this->driver->getSummary(); $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?>
       <? if ($summary): ?>
diff --git a/themes/finc/templates/RecordTab/holdingsils.phtml b/themes/finc/templates/RecordTab/holdingsils.phtml
index f17b7b966cb..42faaa8d261 100644
--- a/themes/finc/templates/RecordTab/holdingsils.phtml
+++ b/themes/finc/templates/RecordTab/holdingsils.phtml
@@ -173,7 +173,7 @@ if (!empty($holdingTitleHold)): ?>
           <? endif; ?>
             <? /* Embed item structured data: library, barcode, call number */ ?>
             <? if ($row['location']): ?>
-              <meta property="seller" content="<?=$this->escapeHtmlAttr($row['location'])?>"/>
+              <meta property="offeredBy" content="<?=$this->escapeHtmlAttr($row['location'])?>"/>
             <? endif; ?>
             <? if ($row['barcode']): ?>
               <meta property="serialNumber" content="<?=$this->escapeHtmlAttr($row['barcode'])?>"/>
@@ -182,8 +182,10 @@ if (!empty($holdingTitleHold)): ?>
               <meta property="sku" content="<?=$this->escapeHtmlAttr($row['callnumber'])?>"/>
             <? endif; ?>
             <? /* Declare that the item is to be borrowed, not for sale */ ?>
-            <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut"/>
             <link property="itemOffered" href="#record"/>
+            <!-- finc: price tags can be anywhere but seem to be required for product -->
+            <meta property="price" content="0">
+            <meta property="priceCurrency" content="€">
           </td>
 
           <? /* finc: change separate <tr>-element to <td> with including <span> #13606 - VE */ ?>
-- 
GitLab