Skip to content
Snippets Groups Projects
Commit d87c488a authored by Claas Kazzer's avatar Claas Kazzer :speech_balloon: Committed by Robert Lange
Browse files

refs #19273 [fid_adlr] turns lists into semantic lists

* result list and favorites

co-authored by: Alexander Purr <purr@ub.uni-leipzig.de>
* adapt aria-lable translation for checkboxes
parent 93834799
No related merge requests found
......@@ -97,3 +97,5 @@ save_search_saved_in_account = Diese Suchanfrage ist bereits in Ihrem Konto gesp
#16984 customize title error messages
An error has occurred = "Entschuldigung, das hätte nicht passieren sollen."
Please contact the Library Reference Department for assistance = "Kontaktieren Sie uns, um weitere Hilfe zu erhalten."
select_item_favorite = "Titel zum Mailen oder Exportieren auswählen"
......@@ -99,3 +99,5 @@ save_search_saved_in_account = This search request is already saved in your acco
#16984 customize title error messages
An error has occurred = "Sorry, that shouldn't have happened."
Please contact the Library Reference Department for assistance = "Contact us for further assistance."
select_item_favorite = "Select item for mailing or exporting"
......@@ -21,7 +21,7 @@ $thumbnailAlignment = $this->record($this->driver)->getThumbnailAlignment('list'
/* #17046: use based style cover if is configure - GG */
if ($cover):
ob_start(); ?>
<div class="media-<?=$thumbnailAlignment?> <?=$this->escapeHtmlAttr($coverDetails['size'])?>">
<div class="media-<?=$thumbnailAlignment?> <?=$this->escapeHtmlAttr($coverDetails['size'])?>" aria-hidden="true">
<?=$cover?>
</div>
<?php $thumbnail = ob_get_contents(); ?>
......@@ -36,7 +36,7 @@ if ($cover):
<?php ob_end_clean(); ?>
<?php /* Show finc style-based icons - END */ ?>
<?php endif; ?>
<div class="result<?php if ($this->driver->supportsAjaxStatus()): ?> ajaxItem<?php endif ?>">
<li class="result<?php if ($this->driver->supportsAjaxStatus()): ?> ajaxItem<?php endif ?>">
<input type="hidden" value="<?=$this->escapeHtmlAttr($id)?>" class="hiddenId"/>
<input type="hidden" value="<?=$this->escapeHtmlAttr($source)?>" class="hiddenSource"/>
<?=$this->record($this->driver)->getCheckbox()?>
......@@ -48,14 +48,26 @@ if ($cover):
<div class="result-body">
<div class="resultItemLine1">
<?php $missing = $this->driver instanceof \VuFind\RecordDriver\Missing; ?>
<?php if (!$missing): ?><a href="<?=$this->recordLink()->getUrl($this->driver)?>" class="getFull" data-view="<?=$this->params->getOptions()->getListViewOption()?>"><?php endif; ?>
<span class="title"><?=$this->record($this->driver)->getTitleHtml()?></span>
<?php if (!$missing): ?></a><?php endif; ?>
<?php if ($missing && $this->driver->isCachedRecord()): ?>
<?php $describedById = $driver->getSourceIdentifier() . '|' . $driver->getUniqueId(); ?>
<span id="<?=$describedById?>" class="title" lang=""><?=$this->record($this->driver)->getTitleHtml()?></span>
<p class="alert alert-info">
<?= $this->translate('record_from_cache')?>
<?php if ($queryParams = $this->record($this->driver)->getAdvancedSearchQueryParams()): ?>
<br/><a href="<?=$this->url('search-results', [], ['query' => $queryParams])?>"><?=$this->transEsc('search_cached_record', ['%%title_full%%' => $this->driver->getTitle()])?></a>
<?php endif; ?>
</p>
<?php elseif (!$missing): ?>
<?php $describedById = $driver->getSourceIdentifier() . '|' . $driver->getUniqueId(); ?>
<a href="<?=$this->recordLink()->getUrl($this->driver)?>" class="getFull" data-view="<?=$this->params->getOptions()->getListViewOption() ?>">
<span id="<?=$describedById?>" class="title" lang=""><?=$this->record($this->driver)->getTitleHtml()?></span>
</a>
<?php endif;?>
</div>
<div class="resultItemLine2">
<?php if ($this->driver->isCollection()): ?>
<?=implode('<br>', array_map(array($this, 'escapeHtml'), $this->driver->getSummary()));?>
<?=implode('<br>', array_map([$this, 'escapeHtml'], $this->driver->getSummary())); ?>
<?php else: ?>
<?php $summAuthors = $this->driver->getPrimaryAuthors();
if (!empty($summAuthors)): ?>
......@@ -70,8 +82,7 @@ if ($cover):
$summDate = $this->driver->getPublicationDates(); ?>
<?php if (!empty($journalTitle)): ?>
<?=!empty($summAuthor) ? '<br/>' : ''?>
<?=/* TODO: handle highlighting more elegantly here */
$this->transEsc('Published in') . ' <a href="' . $this->record($this->driver)->getLink('journaltitle', str_replace(array('{{{{START_HILITE}}}}', '{{{{END_HILITE}}}}'), '', $journalTitle)) . '">' . $this->highlight($journalTitle) . '</a>';?>
<?=/* TODO: handle highlighting more elegantly here */ $this->transEsc('Published in') . ' <a href="' . $this->record($this->driver)->getLink('journaltitle', str_replace(['{{{{START_HILITE}}}}', '{{{{END_HILITE}}}}'], '', $journalTitle)) . '">' . $this->highlight($journalTitle) . '</a>';?>
<?=!empty($summDate) ? ' (' . $this->escapeHtml($summDate[0]) . ')' : ''?>
<?php elseif (!empty($summDate)): ?>
<?=!empty($summAuthor) ? '<br/>' : ''?>
......@@ -82,7 +93,7 @@ if ($cover):
<?php foreach ($summInCollection as $collId => $collText): ?>
<div>
<b><?=$this->transEsc("in_collection_label")?></b>
<a class="collectionLinkText" href="<?=$this->url('collection', array('id' => $collId))?>?recordID=<?=urlencode($this->driver->getUniqueID())?>">
<a class="collectionLinkText" href="<?=$this->url('collection', ['id' => $collId])?>?recordID=<?=urlencode($this->driver->getUniqueID())?>">
<?=$this->escapeHtml($collText)?>
</a>
</div>
......@@ -124,11 +135,11 @@ if ($cover):
<?php endforeach; ?>
<?php endif; ?>
<?php if (count($this->lists) > 0): ?>
<?php if (!empty($this->lists)): ?>
<strong><?=$this->transEsc('Saved in')?>:</strong>
<?php $i = 0;
foreach ($this->lists as $current): ?>
<a href="<?=$this->url('userList', array('id' => $current->id))?>"><?=$this->escapeHtml($current->title)?></a><?php if ($i++ < count($this->lists) - 1): ?>,<?php endif; ?>
<a href="<?=$this->url('userList', ['id' => $current->id])?>"><?=$this->escapeHtml($current->title)?></a><?php if ($i++ < count($this->lists) - 1): ?>,<?php endif; ?>
<?php endforeach; ?>
<br/>
<?php endif; ?>
......@@ -180,9 +191,13 @@ if ($cover):
}
if (!$this->driver->isCollection()):
foreach ($urls as $current): ?>
<a href="<?=$this->escapeHtmlAttr($this->proxyUrl($current['url']))?>" class="fulltext" target="new"><i class="fa fa-external-link"
aria-hidden="true"></i> <?=($current['url'] == $current['desc']) ? $this->transEsc('Get full text') : $this->escapeHtml($current['desc'])?>
</a>
<?= $this->externalLink(
$this->escapeHtmlAttr($this->proxyUrl($current['url'])),
'<i class="fa fa-external-link" aria-hidden="true"></i>'
. ($current['url'] == $current['desc'] ? $this->transEsc('Get full text') : $this->escapeHtml($current['desc'])),
['class' => 'fulltext'],
true
) ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
......@@ -203,22 +218,56 @@ if ($cover):
<?php if ($isEditable): ?>
<i class="fa fa-fw fa-edit" aria-hidden="true"></i> <a
href="<?=$this->url('myresearch-edit')?>?id=<?=urlencode($id)?>&amp;source=<?=urlencode($source)?><?php if (null !== $list_id): ?>&amp;list_id=<?=urlencode($list_id)?><?php endif; ?>"
class="edit tool"><?=$this->transEsc('Edit')?></a><br/>
class="edit tool" aria-label="<?=$this->transEsc('Edit').': '.$this->record($this->driver)->getTitleHtml()?>"><?=$this->transEsc('Edit')?></a><br/>
<?php /* Use a different delete URL if we're removing from a specific list or the overall favorites: */
$deleteUrl = null === $list_id
? $this->url('myresearch-favorites')
: $this->url('userList', ['id' => $list_id]);
$deleteUrlGet = $deleteUrl . '?delete=' . urlencode($id) . '&amp;source=' . urlencode($source);
/* #17712 not necessary to fetch items after deleting by ajax in controller */
$deleteUrl .= '?layout=lightbox';
$dLabel = 'delete-label-' . preg_replace('[\W]', '-', $id);
?>
<div class="dropdown">
<i class="fa fa-fw fa-trash-o" aria-hidden="true"></i> <a class="dropdown-toggle" id="<?=$dLabel?>" role="button" data-toggle="dropdown" href="<?=$deleteUrlGet?>">
<i class="fa fa-fw fa-trash-o" aria-hidden="true"></i>
<a class="dropdown-toggle" id="<?=$dLabel?>" role="button" data-toggle="dropdown" href="<?=$deleteUrlGet?>" aria-label="<?=$this->transEsc('Delete').': '.$this->record($this->driver)->getTitleHtml()?>">
<?=$this->transEsc('Delete')?>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="<?=$dLabel?>">
<li>
<a href="javascript:" onClick="$.post('<?=$deleteUrl?>', {'delete':'<?=$this->escapeJs($id)?>','source':'<?=$this->escapeJs($source)?>','confirm':true},function(){location.reload(true)})" title="<?=$this->transEsc('confirm_delete_brief')?>"><?=$this->transEsc('confirm_dialog_yes')?></a></li>
<?php /* #17711 give user feedback and dont reload page after deleting */ ?>
<a href="javascript:document.getElementById('<?=$dLabel?>').focus();" title="<?= $this->transEsc('confirm_delete_brief') ?>" onClick="
let next = $(this).closest('.result.ajaxItem').next('.result.ajaxItem').find('.del-button');
if (next.length === 0) {
next = $('[id^=delete_list_items_]').first();
}
VuFind.lightbox.setOrigin(next);
$.post(
'<?= $deleteUrl ?>',
{
'delete':'<?= $this->escapeJs($id) ?>',
'source':'<?= $this->escapeJs($source) ?>',
'confirm':true
}, function(){
$('input[value=<?=$id?>]').parent().remove(0);
<?php /* reset needed for possible old MyResearchController::mylistAction in instances withot clearMessages */ ?>
<?php if (null === $list_id) :?>
VuFind.lightbox.alert('<?= $this->transEsc('Item removed from favorites')?>', 'success');
<?php else :?>
VuFind.lightbox.alert('<?= $this->transEsc('Item removed from list')?>', 'success');
<?php endif; ?>
}).fail(function(data) {
$('.fa-spinner.fa-spin').removeClass('fa-spinner fa-spin').addClass('fa-trash-o');
VuFind.lightbox.alert(
'<?= $this->transEsc('Delete') . ' ' . $this->transEsc('of') . ' ' . htmlspecialchars($this->record($this->driver)->getTitleHtml()) . ': ' . $this->transEsc('errorcode_error')?>',
'danger'
)
});
$(this).closest('.dropdown').find('.fa-trash-o').removeClass('fa-trash-o').addClass('fa-spinner fa-spin');">
<?= $this->transEsc('confirm_dialog_yes') ?>
</a>
</li>
<li><a href="javascript:document.getElementById('<?=$dLabel?>').focus();"><?=$this->transEsc('confirm_dialog_no')?></a></li>
</ul>
</div>
......@@ -232,5 +281,5 @@ if ($cover):
<?=$thumbnail?>
<?php endif; ?>
</div>
</div>
<!-- fid_adlr: RecordDriver - DefaultRecord - list-entry - END -->
\ No newline at end of file
</li>
<!-- fid_adlr: RecordDriver - DefaultRecord - list-entry - END -->
<!-- fid_adlr: search - list-list -->
<?php /* #18535 - record listings - AP */ ?>
<?php if (!isset($this->indexStart)) $this->indexStart = 0; ?>
<?php $i = $this->indexStart; ?>
<?php $listStart = $this->results->getStartRecord() + $i - $this->indexStart; ?>
<ol class="record-list" start="<?=$listStart?>">
<?php foreach ($this->results->getResults() as $current): ?>
<?php $recordNumber = $this->results->getStartRecord() + $i - $this->indexStart; ?>
<div id="result<?=$i++ ?>" class="result<?=$current->supportsAjaxStatus()?' ajaxItem':''?>">
<li id="result<?=$i++ ?>" class="result<?=$current->supportsAjaxStatus()?' ajaxItem':''?>">
<?php if (isset($this->showCheckboxes) && $this->showCheckboxes): ?>
<?=$this->record($current)->getCheckbox('', 'search-cart-form', $recordNumber)?>
<?php endif; ?>
<?php /* fid_adlr: remove record number refs #15646 - GG */ ?>
<?php /* ?>
<?php /* fid_adlr: remove record number refs #15646 - GG */
/*
<div class="record-number">
<?=$recordNumber ?>
</div>
<?php */ ?>
*/ ?>
<?=$this->record($current)->getSearchResult('list')?>
</div>
</li>
<?php endforeach; ?>
</ol>
<!-- fid_adlr: search - list-list - END -->
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