From cce01a2f5165f9cd4a4cb00955128db3cfef270c Mon Sep 17 00:00:00 2001
From: Gregor Gawol <gawol@ub.uni-leipzig.de>
Date: Fri, 26 Nov 2021 12:53:56 +0100
Subject: [PATCH] refs #20945 [de_105] w3c validation - syntax fixes

* urlEncode links for additional authors and subjects, also remove escaping
* use record view helper in data-authors.phtml and result-list.phtml
* use <a> instead of <div> as container for data-toggler in EbscoResults.phtml
* use <div> instead of <span> and set <noscript> within <form> in cart-buttons.phtml
* encode url in footer links
* use <button> instead of <a> for submit button in header
* remove aria-labelledby="modal-title" from layout.phtml

co-authored by: Robert Lange <robert.lange@uni-leipzig.de>
* urlEncode links for additional authors and subjects, also remove escaping
---
 themes/de_105/scss/compiled.scss                    |  5 +++++
 .../de_105/templates/Recommend/EbscoResults.phtml   |  4 ++--
 .../RecordDriver/DefaultRecord/data-authors.phtml   |  2 +-
 .../RecordDriver/DefaultRecord/result-list.phtml    |  2 +-
 .../templates/RecordDriver/SolrAI/result-list.phtml |  2 +-
 .../SolrMarc/data-additionalAuthors.phtml           |  2 +-
 .../RecordDriver/SolrMarc/data-subject.phtml        |  4 ++--
 themes/de_105/templates/footer.phtml                |  2 +-
 themes/de_105/templates/header.phtml                |  4 ++--
 themes/de_105/templates/layout/layout.phtml         |  2 +-
 themes/de_105/templates/record/cart-buttons.phtml   | 13 +++++++------
 11 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/themes/de_105/scss/compiled.scss b/themes/de_105/scss/compiled.scss
index 2f49efa8fcc..bf3070a7e05 100644
--- a/themes/de_105/scss/compiled.scss
+++ b/themes/de_105/scss/compiled.scss
@@ -513,6 +513,11 @@ a {
   }
 }
 
+.language button {
+  background-color: $white;
+  color: $brand-primary;
+}
+
 .navbar-toggle {
   color: $white;
   padding-top: 1em;
diff --git a/themes/de_105/templates/Recommend/EbscoResults.phtml b/themes/de_105/templates/Recommend/EbscoResults.phtml
index 8fb99b68fde..ad426aee371 100644
--- a/themes/de_105/templates/Recommend/EbscoResults.phtml
+++ b/themes/de_105/templates/Recommend/EbscoResults.phtml
@@ -4,9 +4,9 @@ $data = $this->recommend->getResult();
 if (is_array($data['results']) && count($data['results']) > 0): ?>
   <?php /* Design should follow structure of recommend - sidefacets - CK */ ?>
   <div id="side-panel-ebsco" class="facet-group">
-    <div class="facet title" data-toggle="collapse" href="#side-collapse-ebsco">
+    <a class="title" data-toggle="collapse" href="#side-collapse-ebsco">
         <?= $this->transEsc('Ebsco::title_hits_databases') ?>
-    </div>
+    </a>
     <ul id="side-collapse-ebsco" class="collapse in">
         <?php foreach ($data['results'] as $result): ?>
       <li class="facet">
diff --git a/themes/de_105/templates/RecordDriver/DefaultRecord/data-authors.phtml b/themes/de_105/templates/RecordDriver/DefaultRecord/data-authors.phtml
index 773d5ba19a8..2457fb8f8f4 100644
--- a/themes/de_105/templates/RecordDriver/DefaultRecord/data-authors.phtml
+++ b/themes/de_105/templates/RecordDriver/DefaultRecord/data-authors.phtml
@@ -24,7 +24,7 @@ $types = [
             <?php ob_start(); ?>
             <span class="author-data" property="<?=$this->escapeHtml($schemaLabel)?>" typeof="Person">
               <span property="name">
-                <a href="<?=$this->url('search-results')?>?lookfor=&quot;<?=trim($this->escapeHtml($author))?>&quot;&amp;type=Author">
+                <a href="<?=$this->record($this->driver)->getLink('author', $author)?>">
             <?=$this->escapeHtml($author)?>
                 </a>
               </span>
diff --git a/themes/de_105/templates/RecordDriver/DefaultRecord/result-list.phtml b/themes/de_105/templates/RecordDriver/DefaultRecord/result-list.phtml
index 99455b65243..51bdebfea84 100644
--- a/themes/de_105/templates/RecordDriver/DefaultRecord/result-list.phtml
+++ b/themes/de_105/templates/RecordDriver/DefaultRecord/result-list.phtml
@@ -56,7 +56,7 @@ $describedById = $driver->getSourceIdentifier() . '|' . $driver->getUniqueId();
             <?php $authorCount = count($summAuthors);
             foreach ($summAuthors as $i => $summAuthor): ?>
               <?php /* de_105: do not show more than 4 authors in resultlist #13763 - VE */ ?>
-              <a href="<?=$this->url('search-results')?>?lookfor=&quot;<?=trim($this->escapeHtml($summAuthor))?>&quot;&amp;type=Author" class="author"><?=$this->highlight($summAuthor)?></a><?=$i + 1 < $authorCount ? ';' : ''?>
+              <a href="<?=$this->record($this->driver)->getLink('author', $this->highlight($summAuthor, null, true, false))?>" class="author"><?=$this->highlight($summAuthor)?></a><?=$i + 1 < $authorCount ? ';' : ''?>
             <?php endforeach; ?>
                 <?php if ($summAuthorCount > 3): ?> et al. <?php endif; ?>
           <?php endif; ?>
diff --git a/themes/de_105/templates/RecordDriver/SolrAI/result-list.phtml b/themes/de_105/templates/RecordDriver/SolrAI/result-list.phtml
index df854c67796..b229ee2c82f 100644
--- a/themes/de_105/templates/RecordDriver/SolrAI/result-list.phtml
+++ b/themes/de_105/templates/RecordDriver/SolrAI/result-list.phtml
@@ -49,7 +49,7 @@ if ($cover):
             foreach ($summAuthors as $i => $summAuthor): ?>
               <?php /* de_105: do not show more than 4 authors in resultlist #13763 - VE */ ?>
               <?php if ($i <= $maxAuthorCount): ?>
-                <a href="<?=$this->url('search-results')?>?lookfor=&quot;<?=trim($this->escapeHtml($summAuthor))?>&quot;&amp;type=Author" class="author"><?=$this->highlight($summAuthor)?></a><?=$i + 1 < $authorCount ? ',' : ''?>
+                <a href="<?=$this->record($this->driver)->getLink('author', $this->highlight($summAuthor, null, true, false))?>" class="author"><?=$this->highlight($summAuthor)?></a><?=$i + 1 < $authorCount ? ',' : ''?>
               <?php else: ?>
               ...<?php break; ?>
               <?php endif; ?>
diff --git a/themes/de_105/templates/RecordDriver/SolrMarc/data-additionalAuthors.phtml b/themes/de_105/templates/RecordDriver/SolrMarc/data-additionalAuthors.phtml
index 9b8089b8e25..f7953709413 100644
--- a/themes/de_105/templates/RecordDriver/SolrMarc/data-additionalAuthors.phtml
+++ b/themes/de_105/templates/RecordDriver/SolrMarc/data-additionalAuthors.phtml
@@ -3,7 +3,7 @@
 <?php if (!empty($data)): ?>
     <?php $i = 0; foreach ($data as $subject => $values): ?>
       <?= ($i++ == 0) ? '' : ', '; ?>
-      <?php if (!empty($values['name'])): ?><a href="<?=$this->url('search-results')?>?lookfor=&quot;<?=trim($this->escapeHtml($values['name']))?>&quot;&amp;type=Author"><?=trim($this->escapeHtml($values['name']))?></a>
+      <?php if (!empty($values['name'])): ?><a href="<?=$this->url('search-results')?>?lookfor=%22<?=urlencode(trim($values['name']))?>%22&amp;type=Author"><?=trim($this->escapeHtml($values['name']))?></a>
         <?php if (!empty($values['relator'])): ?>(<?=$this->escapeHtml($values['relator'])?>)<?php endif; ?>
         <?php if (!empty($values['dates'])): ?> <?=$this->escapeHtml($values['dates'])?><?php endif; ?>
       <?php endif; ?>
diff --git a/themes/de_105/templates/RecordDriver/SolrMarc/data-subject.phtml b/themes/de_105/templates/RecordDriver/SolrMarc/data-subject.phtml
index 7ddf9c6e23b..c00f72218a9 100644
--- a/themes/de_105/templates/RecordDriver/SolrMarc/data-subject.phtml
+++ b/themes/de_105/templates/RecordDriver/SolrMarc/data-subject.phtml
@@ -4,8 +4,8 @@
         <?php if (!empty($field)): ?>
             <?php foreach ($field as $subfield): ?>
               <?php /* replace blanks with question marks for search-links #13158 - VE */ ?>
-              <?php $link = $subfield;//mb_strtolower(str_replace(" ","?", $subfield)); ?>
-              <a href="<?=$this->url('search-results')?>?lookfor=<?=trim($this->escapeHtml($link))?>&amp;type=udk_raw_de105"><?=trim($this->escapeHtml($subfield))?></a><br/>
+              <?php $link = $subfield; /* mb_strtolower(str_replace(" ","?", $subfield)); */?>
+              <a href="<?=$this->url('search-results')?>?lookfor=<?=urlencode(trim($link))?>&amp;type=udk_raw_de105"><?=trim($this->escapeHtml($subfield))?></a><br/>
             <?php endforeach; ?>
         <?php endif; ?>
     <?php endforeach; ?>
diff --git a/themes/de_105/templates/footer.phtml b/themes/de_105/templates/footer.phtml
index a0d417f15d7..0c5546b2fa8 100644
--- a/themes/de_105/templates/footer.phtml
+++ b/themes/de_105/templates/footer.phtml
@@ -20,7 +20,7 @@
           // 30 days ago
           $newDate = date('Y-m-d\TH:i:s\Z', mktime(0, 0, 0, date('m'), date('d')-30, date('Y')));
           ?>
-        <li><a href="<?=$this->url('search-results')?>?type=AllFields&daterange[]=de105_date&de105_datefrom=<?=$newDate ?>&de105_dateto=<?=$currDate ?>&amp;sort=de105_date+desc&amp;limit=20"><?=$this->transEsc('New Items')?></a></li>
+        <li><a href="<?=$this->url('search-results')?>?type=AllFields&daterange%5b%5d=de105_date&de105_datefrom=<?=$newDate ?>&de105_dateto=<?=$currDate ?>&amp;sort=de105_date+desc&amp;limit=20"><?=$this->transEsc('New Items')?></a></li>
         <li><?=$this->externalLink('https://fernleihe.boss.bsz-bw.de/Bsz/saveIsil/DE-105', $this->transEsc('Interlibrary loan')) ?></li>
         <?php /* Custom finc - CK */ ?>
         <li><?=$this->externalLink('https://tu-freiberg.de/ub/service/anschaffungsvorschlag', $this->transEsc('Suggestions for acquisition')) ?></li>
diff --git a/themes/de_105/templates/header.phtml b/themes/de_105/templates/header.phtml
index 4778d3022f3..00bc8202e09 100644
--- a/themes/de_105/templates/header.phtml
+++ b/themes/de_105/templates/header.phtml
@@ -119,10 +119,10 @@
                     </form>
                     <?php foreach ($this->layout()->allLangs as $langCode => $langName): ?>
                           <?php if ($langCode !== $this->layout()->userLang) : ?>
-                          <a type="submit" class="btn btn-transparent" href="#" onClick="document.langForm.mylang.value='<?=$langCode?>';document.langForm.submit()" title="<?=$this->displayLanguageOption($langName)?>">
+                          <button type="submit" class="btn btn-transparent" data-href="#" onClick="document.langForm.mylang.value='<?=$langCode?>';document.langForm.submit()" title="<?=$this->displayLanguageOption($langName)?>">
                             <span class="visible-sm-only"><?=$langCode?></span>
                             <span class="hidden-sm"><?=$this->displayLanguageOption($langName)?></span>
-                          </a>
+                          </button>
                           <?php endif; ?>
                     <?php endforeach; ?>
                   </li>
diff --git a/themes/de_105/templates/layout/layout.phtml b/themes/de_105/templates/layout/layout.phtml
index cc3977f4925..eb08f125c72 100644
--- a/themes/de_105/templates/layout/layout.phtml
+++ b/themes/de_105/templates/layout/layout.phtml
@@ -213,7 +213,7 @@ if (!isset($this->layout()->searchbox)) {
 
 <!-- MODAL IN CASE WE NEED ONE -->
 <?php /* move X button to logical pos. in structure + make accessible via tab - CK */ ?>
-<div id="modal" class="modal fade hidden-print" tabindex="-1" role="dialog" aria-modal="true" aria-labelledby="modal-title" aria-hidden="true" aria-describedby="modal-description">
+<div id="modal" class="modal fade hidden-print" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" aria-describedby="modal-description">
   <div class="modal-dialog">
     <div class="modal-content">
       <button type="button" class="close" data-dismiss="modal" tabindex="0" aria-label="<?= $this->transEsc('CloseModal') ?>">
diff --git a/themes/de_105/templates/record/cart-buttons.phtml b/themes/de_105/templates/record/cart-buttons.phtml
index b0bf07f4a27..e3bbd837512 100644
--- a/themes/de_105/templates/record/cart-buttons.phtml
+++ b/themes/de_105/templates/record/cart-buttons.phtml
@@ -5,7 +5,7 @@
 
 <?php /* refs 19059: Remove link label/text - GG */ ?>
     <?php $cartId = $this->source . '|' . $this->id; ?>
-    <span class="btn-bookbag-toggle" data-cart-id="<?=$this->escapeHtmlAttr($this->id)?>" data-cart-source="<?=$this->escapeHtmlAttr($this->source)?>">
+    <div class="btn-bookbag-toggle" data-cart-id="<?=$this->escapeHtmlAttr($this->id)?>" data-cart-source="<?=$this->escapeHtmlAttr($this->source)?>">
       <?php /* Make add-to/remove-from bookbag accessible for keyboard navigation - CK */ ?>
     <a <?php if($hideText ?? false) :?>data-toggle="tooltip"<?php endif; ?>  class="cart-add hidden<?php if (!$cart->contains($cartId)): ?> correct<?php endif ?>" href="javascript:" tabindex="0" role="button" aria-label="<?=$this->transEsc('Add to Book Bag')?>" <?php if($hideText ?? false) :?>title="<?=$this->transEsc('Add to Book Bag')?>"<?php endif; ?>>
       <i class="cart-link-icon fa fa-plus" aria-hidden="true"></i><span class="cart-link-label"> <?php if(!($hideText ?? false)) :?><?=$this->transEsc('Add to Book Bag') ?><?php endif ?></span>
@@ -13,16 +13,17 @@
     <a <?php if(!empty($hideText ?? false)) :?>data-toggle="tooltip"<?php endif; ?> class="cart-remove hidden<?php if ($cart->contains($cartId)): ?> correct<?php endif ?>" href="javascript:" tabindex="0" role="button" aria-label="<?=$this->transEsc('Remove from Book Bag')?>" <?php if($hideText ?? false) :?>title="<?=$this->transEsc('Remove from Book Bag')?>"<?php endif; ?>>
       <i class="cart-link-icon fa fa-minus-circle" aria-hidden="true"></i> <span class="cart-link-label"> <?php if(!($hideText ?? false)) :?><?=$this->transEsc('Remove from Book Bag') ?><?php endif ?></span>
     </a>
-    <noscript>
-      <form method="post" name="addForm" action="<?=$this->url('cart-processor')?>">
+    <form class="cartProcessorNoJs" method="post" name="addForm" action="<?=$this->url('cart-processor')?>">
+      <noscript>
         <input type="hidden" name="ids[]" value="<?=$this->escapeHtmlAttr($cartId)?>"/>
         <?php if ($cart->contains($cartId)): ?>
           <input class="btn btn-default" type="submit" name="delete" value="<?=$this->transEsc('Remove from Book Bag')?>"/>
         <?php else: ?>
           <input class="btn btn-default" type="submit" name="add" value="<?=$this->transEsc('Add to Book Bag')?>"/>
         <?php endif; ?>
-      </form>
-    </noscript>
-  </span>
+      </noscript>
+    </form>
+    <script>$(document).ready(function() { $(".cartProcessorNoJs").css('display', 'none'); });</script>
+  </div>
 <?php endif; ?>
 <!-- de_105: record - cart-buttons END -->
-- 
GitLab