diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/list-entry.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/list-entry.phtml index c3381f131baaa6724b1c7ca2ea84bad9af34e510..cc227fd420549b4874138436ba4f132c7ccc1f82 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/list-entry.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/list-entry.phtml @@ -4,11 +4,11 @@ $id = $this->driver->getUniqueId(); $source = $this->driver->getSourceIdentifier(); if (isset($this->list) && is_object($this->list)) { - $list_id = $this->list->id; - $user_id = $this->list->user_id; + $list_id = $this->list->id; + $user_id = $this->list->user_id; } else { - $list_id = null; - $user_id = $this->user ? $this->user->id : null; + $list_id = null; + $user_id = $this->user ? $this->user->id : null; } // finc: next line finc-specific; required to display public favorites lists, #12052, see also below - CK $isEditable = $this->user && $this->user->id === $user_id; @@ -91,15 +91,15 @@ if ($cover): <div class="last"> <?php if (!$this->driver->isCollection()) { - if ($snippet = $this->driver->getHighlightedSnippet()) { - if (!empty($snippet['caption'])) { - echo '<strong>' . $this->transEsc($snippet['caption']) . ':</strong> '; - } - if (!empty($snippet['snippet'])) { - echo '<span class="quotestart">“</span>...' . $this->highlight($snippet['snippet']) . '...<span class="quoteend">”</span><br/>'; - } - } - } ?> + if ($snippet = $this->driver->getHighlightedSnippet()) { + if (!empty($snippet['caption'])) { + echo '<strong>' . $this->transEsc($snippet['caption']) . ':</strong> '; + } + if (!empty($snippet['snippet'])) { + echo '<span class="quotestart">“</span>...' . $this->highlight($snippet['snippet']) . '...<span class="quoteend">”</span><br/>'; + } + } + } ?> <?php $listTags = ($this->usertags()->getMode() !== 'disabled') ? $this->driver->getTags( null === $list_id ? true : $list_id, // get tags for all lists if no single list is selected @@ -126,7 +126,7 @@ if ($cover): <strong><?=$this->transEsc('Saved in')?>:</strong> <?php $i = 0; foreach ($this->lists as $current): ?> - <a href="<?=$this->url('userList', ['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; ?> @@ -174,8 +174,8 @@ if ($cover): <?php endif; ?> <?php if (!is_array($urls)) { - $urls = []; - } + $urls = []; + } 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" @@ -211,13 +211,40 @@ if ($cover): $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?>"> - <?=$this->transEsc('Delete')?> + <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 ?>"> + <?= $this->transEsc('Delete') ?> </a> - <ul class="dropdown-menu" role="menu" aria-labelledby="<?=$dLabel?>"> + <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> - <li><a href="javascript:document.getElementById('<?=$dLabel?>').focus();"><?=$this->transEsc('confirm_dialog_no')?></a></li> + <?php /* #17711 give user feedback and dont reload page after deleting */ ?> + <a title="<?= $this->transEsc('confirm_delete_brief') ?>" onClick="$.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> </ul> </div>