Skip to content
Snippets Groups Projects
Commit 8af3c6c4 authored by André Lahmann's avatar André Lahmann Committed by Demian Katz
Browse files

AJAX ILS offline status check.

parent 05e9010b
No related merge requests found
......@@ -1500,4 +1500,32 @@ class AjaxController extends AbstractBase
{
return $this->getServiceLocator()->get('VuFind\SearchResultsPluginManager');
}
/**
* Get Ils Status
*
* This will check the ILS for being online and will return the ils-offline
* template upon failure.
*
* @return \Zend\Http\Response
* @author André Lahmann <lahmann@ub.uni-leipzig.de>
*/
protected function getIlsStatusAjax()
{
$this->disableSessionWrites(); // avoid session write timing bug
if ($this->getILS()->getOfflineMode(true) == 'ils-offline') {
$offlineModeMsg = $this->params()->fromPost(
'offlineModeMsg',
$this->params()->fromQuery('offlineModeMsg')
);
return $this->output(
$this->getViewRenderer()->render(
'Helpers/ils-offline.phtml',
compact('offlineModeMsg')
),
self::STATUS_OK
);
}
return $this->output('', self::STATUS_OK);
}
}
......@@ -19,7 +19,22 @@
?>
<div class="searchHomeContent">
<?=($this->ils()->getOfflineMode() == "ils-offline") ? $this->render('Helpers/ils-offline.phtml', ['offlineModeMsg' => 'ils_offline_home_message']) : ''?>
<?
$ilsStatusScript = <<<JS
$(document).ready(function() {
$.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);
}
});
});
JS;
?>
<?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $ilsStatusScript, 'SET'); ?>
<div class="well well-lg clearfix" role="search">
<?=$this->context($this)->renderInContext("search/searchbox.phtml", ['ignoreHiddenFilterMemory' => true])?>
</div>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment