Skip to content
Snippets Groups Projects
Commit 5e2ec98d authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Include searchClassId in getResolverLinks call so that the results can be tweaked for each backend.

parent 09703615
Branches
Tags
No related merge requests found
...@@ -1115,6 +1115,7 @@ class AjaxController extends AbstractBase ...@@ -1115,6 +1115,7 @@ class AjaxController extends AbstractBase
{ {
$this->writeSession(); // avoid session write timing bug $this->writeSession(); // avoid session write timing bug
$openUrl = $this->params()->fromQuery('openurl', ''); $openUrl = $this->params()->fromQuery('openurl', '');
$searchClassId = $this->params()->fromQuery('searchClassId', '');
$config = $this->getConfig(); $config = $this->getConfig();
$resolverType = isset($config->OpenURL->resolver) $resolverType = isset($config->OpenURL->resolver)
...@@ -1169,7 +1170,8 @@ class AjaxController extends AbstractBase ...@@ -1169,7 +1170,8 @@ class AjaxController extends AbstractBase
// Render the links using the view: // Render the links using the view:
$view = [ $view = [
'openUrlBase' => $base, 'openUrl' => $openUrl, 'print' => $print, 'openUrlBase' => $base, 'openUrl' => $openUrl, 'print' => $print,
'electronic' => $electronic, 'services' => $services 'electronic' => $electronic, 'services' => $services,
'searchClassId' => $searchClassId
]; ];
$html = $this->getViewRenderer()->render('ajax/resolverLinks.phtml', $view); $html = $this->getViewRenderer()->render('ajax/resolverLinks.phtml', $view);
......
/*global extractClassParams, VuFind */ /*global extractClassParams, VuFind */
function loadResolverLinks($target, openUrl) { function loadResolverLinks($target, openUrl, searchClassId) {
$target.addClass('ajax_availability'); $target.addClass('ajax_availability');
var url = VuFind.getPath() + '/AJAX/JSON?' + $.param({method:'getResolverLinks',openurl:openUrl}); var url = VuFind.getPath() + '/AJAX/JSON?' + $.param({method:'getResolverLinks',openurl:openUrl,searchClassId:searchClassId});
$.ajax({ $.ajax({
dataType: 'json', dataType: 'json',
url: url url: url
...@@ -31,7 +31,7 @@ function embedOpenUrlLinks(element) { ...@@ -31,7 +31,7 @@ function embedOpenUrlLinks(element) {
// If the target is already visible, a previous click has populated it; // If the target is already visible, a previous click has populated it;
// don't waste time doing redundant work. // don't waste time doing redundant work.
if (target.hasClass('hidden')) { if (target.hasClass('hidden')) {
loadResolverLinks(target.removeClass('hidden'), openUrl); loadResolverLinks(target.removeClass('hidden'), openUrl, element.data('search-class-id'));
} }
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<span class="openUrlControls<? if ($this->openUrlEmbed): ?> openUrlEmbed<? if ($this->openUrlEmbedAutoLoad): ?> openUrlEmbedAutoLoad<? endif; ?><? endif; ?>"> <span class="openUrlControls<? if ($this->openUrlEmbed): ?> openUrlEmbed<? if ($this->openUrlEmbedAutoLoad): ?> openUrlEmbedAutoLoad<? endif; ?><? endif; ?>">
<? if (!$this->openUrlImageBasedSrc || $this->openUrlImageBasedMode == 'both'): ?> <? if (!$this->openUrlImageBasedSrc || $this->openUrlImageBasedMode == 'both'): ?>
<a href="<?=$this->escapeHtmlAttr($this->openUrlBase . '?' . $this->openUrl)?>"<?=$class?>> <a href="<?=$this->escapeHtmlAttr($this->openUrlBase . '?' . $this->openUrl)?>"<?=$class?> data-search-class-id="<?=$this->escapeHtmlAttr($this->searchClassId) ?>">
<? /* put the openUrl here in a span (COinS almost) so we can retrieve it later */ ?> <? /* put the openUrl here in a span (COinS almost) so we can retrieve it later */ ?>
<span title="<?=$this->escapeHtmlAttr($this->openUrl)?>" class="openUrl"></span> <span title="<?=$this->escapeHtmlAttr($this->openUrl)?>" class="openUrl"></span>
<? if ($this->openUrlGraphic): ?> <? if ($this->openUrlGraphic): ?>
......
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