From 41fc9af3e8b164c845606478c45078043a7edf75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Lahmann?= <lahmann@ub.uni-leipzig.de>
Date: Tue, 13 Sep 2016 17:35:58 +0200
Subject: [PATCH] refs #8733: * added context specific content to ILS-Offline
 messages

---
 module/finc/src/finc/Controller/AjaxController.php  | 9 ++++++++-
 themes/finc/templates/Helpers/ils-offline.phtml     | 2 +-
 themes/finc/templates/RecordTab/holdingsils.phtml   | 2 +-
 themes/finc/templates/myresearch/cataloglogin.phtml | 2 +-
 themes/finc/templates/myresearch/login.phtml        | 2 +-
 themes/finc/templates/search/home.phtml             | 1 +
 6 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/module/finc/src/finc/Controller/AjaxController.php b/module/finc/src/finc/Controller/AjaxController.php
index f0e7bdbc6d2..d3f3b3b9edf 100644
--- a/module/finc/src/finc/Controller/AjaxController.php
+++ b/module/finc/src/finc/Controller/AjaxController.php
@@ -283,9 +283,16 @@ class AjaxController extends \VuFind\Controller\AjaxController
     protected function getIlsStatusAjax()
     {
         $this->disableSessionWrites();  // avoid session write timing bug
+        $offlineModeMsg = $this->params()->fromPost(
+            'offlineModeMsg',
+            $this->params()->fromQuery('offlineModeMsg')
+        );
         if ($this->getILS()->getOfflineMode() == 'ils-offline') {
             return $this->output(
-                $this->getViewRenderer()->render('Helpers/ils-offline.phtml'),
+                $this->getViewRenderer()->render(
+                    'Helpers/ils-offline.phtml',
+                    ['offlineModeMsg' => $offlineModeMsg]
+                ),
                 self::STATUS_OK
             );
         }
diff --git a/themes/finc/templates/Helpers/ils-offline.phtml b/themes/finc/templates/Helpers/ils-offline.phtml
index a0c35739867..b99244a06af 100644
--- a/themes/finc/templates/Helpers/ils-offline.phtml
+++ b/themes/finc/templates/Helpers/ils-offline.phtml
@@ -1,7 +1,7 @@
   <div data-alert class="alert-box warning" tabindex="0" aria-live="assertive" role="dialogalert">
     <h2><?=$this->transEsc('ils_offline_title')?></h2>
     <p><strong><?=$this->transEsc('ils_offline_status')?></strong></p>
-    <p><?=$this->transEsc('ils_offline_home_message')?></p>
+    <p><?=$this->transEsc($this->offlineModeMsg)?></p>
     <? $supportEmail = $this->escapeHtmlAttr($this->systemEmail()); ?>
     <p><a href="mailto:<?=$supportEmail?>"><?=$supportEmail?></a></p>
   </div>
\ No newline at end of file
diff --git a/themes/finc/templates/RecordTab/holdingsils.phtml b/themes/finc/templates/RecordTab/holdingsils.phtml
index c7e92db0c1a..cdf8d70db36 100644
--- a/themes/finc/templates/RecordTab/holdingsils.phtml
+++ b/themes/finc/templates/RecordTab/holdingsils.phtml
@@ -26,7 +26,7 @@
 
 <?=$this->context($this)->renderInContext('librarycards/selectcard.phtml', array('user' => $this->auth()->isLoggedIn())); ?>
 
-<?=($offlineMode == "ils-offline") ? $this->render('Helpers/ils-offline.phtml') : ''?>
+<?=($offlineMode == "ils-offline") ? $this->render('Helpers/ils-offline.phtml', ['offlineModeMsg' => 'ils_offline_holdings_message']) : ''?>
 <? if (($this->ils()->getHoldsMode() == 'driver' && !empty($holdings)) || $this->ils()->getTitleHoldsMode() == 'driver'): ?>
   <? if ($account->loginEnabled() && $offlineMode != 'ils-offline'): ?>
     <? if (!$user): ?>
diff --git a/themes/finc/templates/myresearch/cataloglogin.phtml b/themes/finc/templates/myresearch/cataloglogin.phtml
index 2c4cdeeecbb..95477735388 100644
--- a/themes/finc/templates/myresearch/cataloglogin.phtml
+++ b/themes/finc/templates/myresearch/cataloglogin.phtml
@@ -10,7 +10,7 @@
     $offlineMode = $this->ils()->getOfflineMode();
 ?>
 <? if ($offlineMode == "ils-offline"): ?>
-  <?=$this->render('Helpers/ils-offline.phtml')?>
+  <?=$this->render('Helpers/ils-offline.phtml', ['offlineModeMsg' => 'ils_offline_login_message'])?>
 <? else: ?>
   <h3><?=$this->transEsc('Library Catalog Profile')?></h3>
   <?=$this->flashmessages()?>
diff --git a/themes/finc/templates/myresearch/login.phtml b/themes/finc/templates/myresearch/login.phtml
index 9f042be87e3..ad394da1d35 100644
--- a/themes/finc/templates/myresearch/login.phtml
+++ b/themes/finc/templates/myresearch/login.phtml
@@ -12,7 +12,7 @@
 ?>
 
 <? if ($offlineMode == "ils-offline"): ?>
-  <?=$this->render('Helpers/ils-offline.phtml')?>
+  <?=$this->render('Helpers/ils-offline.phtml', ['offlineModeMsg' => 'ils_offline_login_message'])?>
 <? else: ?>
   <h2><?=$this->transEsc('Login')?></h2>
   <?=$this->flashmessages()?>
diff --git a/themes/finc/templates/search/home.phtml b/themes/finc/templates/search/home.phtml
index 9907e573ada..9f0cf95d8ec 100644
--- a/themes/finc/templates/search/home.phtml
+++ b/themes/finc/templates/search/home.phtml
@@ -26,6 +26,7 @@ $this->layout()->breadcrumbs = false;
         $.ajax({
             dataType: 'json',
             method: 'GET',
+            data: {'offlineModeMsg':'ils_offline_home_message'},
             url: VuFind.path + '/AJAX/JSON?method=getIlsStatus',
             success: function(response) {
                 $('.searchHomeContent').append(response.data);
-- 
GitLab