From e5e96ef840cc262192ec29cfdbb2826c65e3d95a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Lahmann?= <lahmann@ub.uni-leipzig.de>
Date: Fri, 19 Aug 2016 10:17:11 +0200
Subject: [PATCH] refs #8447: * fixed Ezb constructor * added message to be
 shown if resolver returned no useful content

---
 local/languages/de.ini                             | 2 ++
 local/languages/en.ini                             | 2 ++
 module/finc/src/finc/Controller/AjaxController.php | 2 +-
 module/finc/src/finc/Resolver/Driver/Ezb.php       | 2 +-
 themes/finc/templates/ajax/resolverLinks.phtml     | 9 ++++++++-
 5 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/local/languages/de.ini b/local/languages/de.ini
index a53d75cfa66..8d560f8fd1f 100644
--- a/local/languages/de.ini
+++ b/local/languages/de.ini
@@ -1829,6 +1829,8 @@ Address-Contact-Hours = "Adresse, Kontakt"
 resolver_link_access_denied = "nicht verfügbar"
 resolver_link_access_limited = "Im Campusnetz verfügbar"
 resolver_link_access_open = "verfügbar"
+; message to be shown upon empty resolver response
+no_resolver_links = "Keine Online Links verfügbar."
 
 ; reset password
 reset_password_text = "Bitten füllen Sie dieses Formular aus, um Ihr Passwort zurücksetzen zu lassen. Sie erhalten an u.g. Email Adresse eine Benachrichtigung, nachdem wir das Passwort zurückgesetzt haben."
diff --git a/local/languages/en.ini b/local/languages/en.ini
index 11aa556ef30..fc4cff97d4b 100644
--- a/local/languages/en.ini
+++ b/local/languages/en.ini
@@ -1770,6 +1770,8 @@ Address-Contact-Hours = "Address, Contact"
 resolver_link_access_denied = "not available"
 resolver_link_access_limited = "Available in Campus LAN"
 resolver_link_access_open = "available"
+; message to be shown upon empty resolver response
+no_resolver_links = "No online links available."
 
 ; reset password
 reset_password_text = "Please complete the form below to reset your password. You will receive an email after we have completed resetting your password."
diff --git a/module/finc/src/finc/Controller/AjaxController.php b/module/finc/src/finc/Controller/AjaxController.php
index 4b98f2fe46d..f0e7bdbc6d2 100644
--- a/module/finc/src/finc/Controller/AjaxController.php
+++ b/module/finc/src/finc/Controller/AjaxController.php
@@ -119,7 +119,7 @@ class AjaxController extends \VuFind\Controller\AjaxController
             $view = [
                 'openUrlBase' => $base, 'openUrl' => $openUrl, 'print' => $print,
                 'electronic' => $electronic, 'services' => $services,
-                'searchClassId' => $searchClassId
+                'searchClassId' => $searchClassId, 'resolver' => $requestedResolver
             ];
         }
         $html = $this->getViewRenderer()->render('ajax/resolverLinks.phtml', $view);
diff --git a/module/finc/src/finc/Resolver/Driver/Ezb.php b/module/finc/src/finc/Resolver/Driver/Ezb.php
index 8969dd783c5..d8af5c33db6 100644
--- a/module/finc/src/finc/Resolver/Driver/Ezb.php
+++ b/module/finc/src/finc/Resolver/Driver/Ezb.php
@@ -80,7 +80,7 @@ class Ezb implements DriverInterface, TranslatorAwareInterface
      * @param string            $config    ezb configuration
      * @param \Zend\Http\Client $httpClient HTTP client
      */
-    public function __construct($config, \Zend\Http\Client $httpClient, $translator)
+    public function __construct($config, \Zend\Http\Client $httpClient)
     {
         $this->baseUrl = $config->url;
         $this->httpClient = $httpClient;
diff --git a/themes/finc/templates/ajax/resolverLinks.phtml b/themes/finc/templates/ajax/resolverLinks.phtml
index bb32e7d33e9..2be57d6f06c 100644
--- a/themes/finc/templates/ajax/resolverLinks.phtml
+++ b/themes/finc/templates/ajax/resolverLinks.phtml
@@ -1,6 +1,8 @@
 <!-- ajax - resolverlinks.phtml -->
 <div>
+  <? $noResolverContent = true; ?>
   <? if (!empty($this->electronic)): ?>
+    <? $noResolverContent = false; ?>
     <div class="openurls">
       <? /*<strong><?=$this->transEsc('Electronic')?></strong>*/ ?>
       <ul class="no-bullet">
@@ -23,6 +25,7 @@
     </div>
   <? endif; ?>
   <? /**<? if (!empty($this->print)): ?>
+    <? $noResolverContent = false; ?>
     <div class="openurls">
       <strong><?=$this->transEsc('Holdings')?></strong>
       <ul class="no-bullet">
@@ -52,6 +55,10 @@
       </ul>
     <? endif; ?>
   </div> */ ?>
-  <script type="text/javascript">$(document).foundation('tooltip', 'reflow');</script>
+  <? if ($noResolverContent): // no content to show, so tell the user ?>
+    <span><?=$this->resolver . ': ' . $this->translate('no_resolver_links')?></span>
+  <? else: // content to show, so do javascript to properly render tooltips?>
+    <script type="text/javascript">$(document).foundation('tooltip', 'reflow');</script>
+  <? endif; ?>
 </div>
 <!-- ajax - resolverlinks.phtml - END -->
\ No newline at end of file
-- 
GitLab