diff --git a/local/languages/de.ini b/local/languages/de.ini index 8a06b4138e9a035bc28f5aeaba729ea3b3bab9d8..07a4c46a933050a3841d0c3e45c47ee3d257cf2b 100644 --- a/local/languages/de.ini +++ b/local/languages/de.ini @@ -2076,3 +2076,6 @@ select_item_storage_retrieval_request_cancel = "Titel auswählen, um Magazinbest ; #17915 toggle-dropdown = "Untermenü aufklappen" + +missing_record_redirect = "Der aufgerufene Titel ist nicht vorhanden. Stattdessen wurde eine Suche ausgelöst" +missing_record_exception = "Der aufgerufene Titel (%%id%%) ist nicht vorhanden." diff --git a/local/languages/en.ini b/local/languages/en.ini index 709dffd596567aa0449f4dfecca9cfca24db7aa2..01d63c1841d80d2e596bef345c59e56b4e175509 100644 --- a/local/languages/en.ini +++ b/local/languages/en.ini @@ -2155,3 +2155,6 @@ Start a new Basic Search = "New Basic Search" ; #17915 toggle-dropdown = "Toggle Dropdown" + +missing_record_redirect = "Record unavailable. You have been redirected to a search." +missing_record_exception = "Record %%id%% is unavailable." diff --git a/module/finc/src/finc/Controller/RecordController.php b/module/finc/src/finc/Controller/RecordController.php index ee9b3d49e75883ef2668a262f5024d94a658cbd5..be0586f12052331b212685c8fb24545d0ebd19ce 100644 --- a/module/finc/src/finc/Controller/RecordController.php +++ b/module/finc/src/finc/Controller/RecordController.php @@ -30,6 +30,7 @@ namespace finc\Controller; use finc\Rewrite\EblRewrite; +use VuFind\Exception\RecordMissing; use Zend\Log\LoggerAwareInterface as LoggerAwareInterface; use Zend\View\View; @@ -121,19 +122,25 @@ class RecordController extends \VuFind\Controller\RecordController implements */ public function homeAction() { - if ($this->params()->fromQuery('catchMissing', null)) { - try { - return parent::homeAction(); - } catch (\VuFind\Exception\RecordMissing $ex) { - $lookfor = $this->params()->fromQuery('catchMissing_lookfor',''); - if (empty($lookfor)) throw $ex; - $type = $this->params()->fromQuery('catchMissing_searchType','Allfields'); + try { + return parent::homeAction(); + } catch (\VuFind\Exception\RecordMissing $ex) { + if ( + $this->params()->fromQuery('catchMissing', null) + && + $lookfor = $this->params()->fromQuery('catchMissing_lookfor', '') + ) { + $type = $this->params()->fromQuery('catchMissing_searchType', 'Allfields'); $link = $this->redirect()->toRoute( 'search-results', [], - ['query' => compact('lookfor','type')] + ['query' => compact('lookfor', 'type')] ); + $this->flashMessenger()->addErrorMessage('missing_record_redirect'); return $link; + } else { + $id = $this->params()->fromRoute('id'); + throw new RecordMissing($id); } } diff --git a/themes/finc/templates/error/RecordMissing.phtml b/themes/finc/templates/error/RecordMissing.phtml new file mode 100644 index 0000000000000000000000000000000000000000..6cc0d7358a97bf8c9dc34b77e38896fa5299f44f --- /dev/null +++ b/themes/finc/templates/error/RecordMissing.phtml @@ -0,0 +1,46 @@ +<!-- finc: RuntimeException --> +<?php /* largely copied from /bootstrap3/templates/error/index.phtml #17035 - RL */?> +<?php + // Set page title. + $this->headTitle($this->translate('Missing Record')); + + $this->layout()->breadcrumbs = '<li class="active">Error</li>'; +?> +<div class="alert alert-danger"> + <p><?=$this->transEsc('An error has occurred')?></p> + <p><?=$this->transEsc( + 'missing_record_exception', + ['%%id%%' => $this->exception->getMessage()] + ) + ?></p> +</div> +<form> + <input type="button" class="btn" value="<?=$this->translate('navigate_back')?>" onclick="history.back()"> +</form> + +<?php if (isset($this->display_exceptions) && $this->display_exceptions): ?> + <h2><?=$this->transEsc('Exception')?>:</h2> + <p> + <b><?=$this->transEsc('Message')?>:</b> <?=$this->escapeHtml($this->exception->getMessage())?> + </p> + + <h2><?=$this->transEsc('Backtrace')?>:</h2> + <pre><?=$this->exception->getTraceAsString()?> + </pre> + + <?php if ($e = $this->exception->getPrevious()): ?> + <h3>Previous exceptions:</h3> + <?php while ($e): ?> + <h4><?php echo get_class($e); ?></h4> + <p><?=$e->getMessage()?></p> + <pre><?=$e->getTraceAsString()?></pre> + <?php $e = $e->getPrevious(); ?> + <?php endwhile; ?> + <?php endif; ?> + + <?php if (isset($this->request)): ?> + <h2><?=$this->transEsc('error_page_parameter_list_heading')?>:</h2> + <pre><?=$this->escapeHtml(var_export($this->request->getParams(), true))?></pre> + <?php endif; ?> +<?php endif ?> +<!-- finc: RuntimeException - END --> diff --git a/themes/finc/templates/myresearch/editlist.phtml b/themes/finc/templates/myresearch/editlist.phtml index 7495bb34897099b853bf25dd5d3ce31a43d3d6ac..929bb53ca801ed12daec205700970390de96cb04 100644 --- a/themes/finc/templates/myresearch/editlist.phtml +++ b/themes/finc/templates/myresearch/editlist.phtml @@ -13,6 +13,12 @@ <?=$this->flashmessages()?> +<?php if ($this->auth()->isLoggedIn() && $this->layout()->getTemplate() !== 'layout/lightbox') :?> + <div class="<?=$this->layoutClass('mainbody')?>"> + <a class="search-filter-toggle visible-xs" href="#myresearch-sidebar" data-toggle="offcanvas" aria-label="<?=$this->transEsc('sidebar_expand')?>"> + <?=$this->transEsc('Your Account') ?> + </a> +<?php endif; ?> <h1><?=$this->transEsc($pageTitle); ?></h1> <form class="form-edit-list" method="post" name="<?=empty($this->list->id) ? 'newList' : 'editListForm'?>"> @@ -50,4 +56,10 @@ <input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Save') ?>" aria-label="<?=$this->transEsc('Save') ?>"/> </div> </form> +<?php if ($this->auth()->isLoggedIn() && $this->layout()->getTemplate() !== 'layout/lightbox') :?> + </div> + <div class="<?=$this->layoutClass('sidebar')?>" id="myresearch-sidebar"> + <?=$this->context($this)->renderInContext("myresearch/menu.phtml", ['active' => 'editlist/NEW'])?> + </div> +<?php endif; ?> <!-- finc - templates - myresearch - editlist - END --> diff --git a/themes/finc/templates/myresearch/menu.phtml b/themes/finc/templates/myresearch/menu.phtml index ba5ca11b9db37de21f7586a64399db952ef139b6..32dd7c7cc725e4eb4a729bd3695345644e61b83c 100644 --- a/themes/finc/templates/myresearch/menu.phtml +++ b/themes/finc/templates/myresearch/menu.phtml @@ -111,7 +111,7 @@ $capabilityParams = $patron ? ['patron' => $patron] : []; </a> <?php endforeach; ?> - <a href="<?=$this->url('editList', ['id' => 'NEW'])?>"> + <a href="<?=$this->url('editList', ['id' => 'NEW'])?>"<?=$this->active == 'editlist/NEW' ? ' class="active"' : ''?>> <i class="fa fa-fw fa-plus" aria-hidden="true"></i> <?=$this->transEsc('Create a List')?> </a>