diff --git a/config/vufind/Summon.ini b/config/vufind/Summon.ini index 741c425b98092fcede9d25bea14973446c119439..75af312285cd7dee17b34acc4072d74c09de03cb 100644 --- a/config/vufind/Summon.ini +++ b/config/vufind/Summon.ini @@ -169,4 +169,10 @@ PublicationDate:asc = "sort_year asc" ; This section controls spell checking -- it can be disabled if desired. [Spelling] -enabled = true \ No newline at end of file +enabled = true + +; This section controls the behavior of the SummonRecord module. +[Record] +; Set this to true in order to enable "next" and "previous" links to navigate +; through the current result set from within the record view. +next_prev_navigation = false diff --git a/config/vufind/WorldCat.ini b/config/vufind/WorldCat.ini index b7f3da645cbdd8c36f3bfb5ca78c9a43da1e6bb4..f223bc6a8f256cda1cb07f79c5a0cb567179e1b2 100644 --- a/config/vufind/WorldCat.ini +++ b/config/vufind/WorldCat.ini @@ -49,5 +49,9 @@ Title = sort_title ; This section controls the behavior of the WorldCatRecord module. See the ; [Record] section of the main config.ini for more detailed documentation. [Record] +; Because the WorldCat database changes frequently, this feature sometimes +; behaves unpredictably; it is recommended that you leave it disabled: +next_prev_navigation = false + related[] = "WorldCatSimilar" related[] = "WorldCatEditions" diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 92806792c769d68e0ffad346a9391f8c5996ff7f..2172f69990fc0c07a74052ce17d62b489d65d6e2 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -125,18 +125,13 @@ $config = array( && $config->Reserves->search_enabled; return new \VuFind\Controller\Plugin\Reserves($useIndex); }, - 'result-scroller' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - $enabled = (isset($config->Record->next_prev_navigation) - && $config->Record->next_prev_navigation); - return new \VuFind\Controller\Plugin\ResultScroller($enabled); - }, ), 'invokables' => array( 'db-upgrade' => 'VuFind\Controller\Plugin\DbUpgrade', 'favorites' => 'VuFind\Controller\Plugin\Favorites', 'followup' => 'VuFind\Controller\Plugin\Followup', 'renewals' => 'VuFind\Controller\Plugin\Renewals', + 'result-scroller' => 'VuFind\Controller\Plugin\ResultScroller', ) ), 'service_manager' => array( diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php index 71f61efdd846f7957b8051d3897f2813479646ac..35e07b053b1322592a6d263fc72e962f46b78be3 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php +++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php @@ -61,13 +61,6 @@ class AbstractRecord extends AbstractBase */ protected $searchClassId = 'Solr'; - /** - * Should we use the result scroller? - * - * @var bool - */ - protected $useResultScroller = true; - /** * Should we log statistics? * @@ -563,6 +556,17 @@ class AbstractRecord extends AbstractBase return $this->allTabs; } + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + // Disabled by default: + return false; + } + /** * Display a particular tab. * @@ -592,7 +596,7 @@ class AbstractRecord extends AbstractBase $view->defaultTab = strtolower($this->defaultTab); // Set up next/previous record links (if appropriate) - if ($this->useResultScroller) { + if ($this->resultScrollerActive()) { $driver = $this->loadRecord(); $view->scrollData = $this->resultScroller()->getScrollData($driver); } diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php index 3f4d20bea382a24dc4d05190f07ddcdfd48ae687..6978ccfbf893f23b44171ba1b04765c82dc42c56 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php +++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php @@ -67,13 +67,6 @@ class AbstractSearch extends AbstractBase */ protected $rememberSearch = true; - /** - * Should we use the result scroller? - * - * @var bool - */ - protected $useResultScroller = true; - /** * Constructor */ @@ -160,6 +153,17 @@ class AbstractSearch extends AbstractBase } } + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + // Disabled by default: + return false; + } + /** * Send search results to results view * @@ -227,7 +231,7 @@ class AbstractSearch extends AbstractBase } // Set up results scroller: - if ($this->useResultScroller) { + if ($this->resultScrollerActive()) { $this->resultScroller()->init($results); } } catch (\VuFindSearch\Backend\Exception\RequestParseErrorException $e) { diff --git a/module/VuFind/src/VuFind/Controller/AuthorController.php b/module/VuFind/src/VuFind/Controller/AuthorController.php index 259d4043aa52052213f1fe3420342d23fad869c1..68c54b240b1049be4c22e900661df062ef62dd94 100644 --- a/module/VuFind/src/VuFind/Controller/AuthorController.php +++ b/module/VuFind/src/VuFind/Controller/AuthorController.php @@ -59,7 +59,6 @@ class AuthorController extends AbstractSearch { $this->searchClassId = 'SolrAuthorFacets'; $this->saveToHistory = false; - $this->useResultScroller = false; $this->rememberSearch = false; return parent::resultsAction(); } diff --git a/module/VuFind/src/VuFind/Controller/AuthorityController.php b/module/VuFind/src/VuFind/Controller/AuthorityController.php index b9e7e467196acdf626ccb61e4eac8b47a3af8ca4..b44a39562374459f228135ed8505d9e112f47552 100644 --- a/module/VuFind/src/VuFind/Controller/AuthorityController.php +++ b/module/VuFind/src/VuFind/Controller/AuthorityController.php @@ -44,7 +44,6 @@ class AuthorityController extends AbstractSearch public function __construct() { $this->searchClassId = 'SolrAuth'; - $this->useResultScroller = false; parent::__construct(); } diff --git a/module/VuFind/src/VuFind/Controller/RecordController.php b/module/VuFind/src/VuFind/Controller/RecordController.php index bfa7bc0a93b23b5b453bb6e9a1c6602b276cd53f..2bd185156d01c9391cc560d2ad48b96a55e9fd1f 100644 --- a/module/VuFind/src/VuFind/Controller/RecordController.php +++ b/module/VuFind/src/VuFind/Controller/RecordController.php @@ -162,4 +162,16 @@ class RecordController extends AbstractRecord ) ); } + + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + $config = $this->getServiceLocator()->get('VuFind\Config')->get('config'); + return (isset($config->Record->next_prev_navigation) + && $config->Record->next_prev_navigation); + } } diff --git a/module/VuFind/src/VuFind/Controller/RecordsController.php b/module/VuFind/src/VuFind/Controller/RecordsController.php index ac56e47aba7fe9426b71c5ac52b096e73efd454b..f4ed7f0d454ff0a958a801336f0a96598a1b8831 100644 --- a/module/VuFind/src/VuFind/Controller/RecordsController.php +++ b/module/VuFind/src/VuFind/Controller/RecordsController.php @@ -44,7 +44,6 @@ class RecordsController extends AbstractSearch public function __construct() { $this->searchClassId = 'MixedList'; - $this->useResultScroller = false; parent::__construct(); } diff --git a/module/VuFind/src/VuFind/Controller/SearchController.php b/module/VuFind/src/VuFind/Controller/SearchController.php index f081a100016fda24eff5004db50307959a93dbd6..4d42b631bcb34e4a442b88e19de9f7ddb43c381d 100644 --- a/module/VuFind/src/VuFind/Controller/SearchController.php +++ b/module/VuFind/src/VuFind/Controller/SearchController.php @@ -659,4 +659,16 @@ class SearchController extends AbstractSearch ); return $response; } + + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + $config = $this->getServiceLocator()->get('VuFind\Config')->get('config'); + return (isset($config->Record->next_prev_navigation) + && $config->Record->next_prev_navigation); + } } diff --git a/module/VuFind/src/VuFind/Controller/SummonController.php b/module/VuFind/src/VuFind/Controller/SummonController.php index f03f622e84cc6b2b80f90ae70305b849ca325dc0..ff25373ab1c5d3c75911972962607532f132b936 100644 --- a/module/VuFind/src/VuFind/Controller/SummonController.php +++ b/module/VuFind/src/VuFind/Controller/SummonController.php @@ -46,10 +46,21 @@ class SummonController extends AbstractSearch public function __construct() { $this->searchClassId = 'Summon'; - $this->useResultScroller = false; parent::__construct(); } + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + $config = $this->getServiceLocator()->get('VuFind\Config')->get('Summon'); + return (isset($config->Record->next_prev_navigation) + && $config->Record->next_prev_navigation); + } + /** * preDispatch -- block access when appropriate. * diff --git a/module/VuFind/src/VuFind/Controller/SummonrecordController.php b/module/VuFind/src/VuFind/Controller/SummonrecordController.php index d6f8e825f18deda8605459092f29c8fc071b665e..8dade919a651673c94334a474a085f7572ea8903 100644 --- a/module/VuFind/src/VuFind/Controller/SummonrecordController.php +++ b/module/VuFind/src/VuFind/Controller/SummonrecordController.php @@ -47,13 +47,24 @@ class SummonrecordController extends AbstractRecord { // Override some defaults: $this->searchClassId = 'Summon'; - $this->useResultScroller = false; $this->defaultTab = 'Description'; // Call standard record controller initialization: parent::__construct(); } + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + $config = $this->getServiceLocator()->get('VuFind\Config')->get('Summon'); + return (isset($config->Record->next_prev_navigation) + && $config->Record->next_prev_navigation); + } + /** * preDispatch -- block access when appropriate. * diff --git a/module/VuFind/src/VuFind/Controller/TagController.php b/module/VuFind/src/VuFind/Controller/TagController.php index 6376c241850ac5eeca6d0d17505c1a6e957e90b4..18d4a50420d63c7f94edc0919526838fbe38b0dd 100644 --- a/module/VuFind/src/VuFind/Controller/TagController.php +++ b/module/VuFind/src/VuFind/Controller/TagController.php @@ -44,7 +44,6 @@ class TagController extends AbstractSearch public function __construct() { $this->searchClassId = 'Tags'; - $this->useResultScroller = false; parent::__construct(); } diff --git a/module/VuFind/src/VuFind/Controller/WorldcatController.php b/module/VuFind/src/VuFind/Controller/WorldcatController.php index 6c5aca78cd0703350665553b6c306003a24b07d7..b5f5eba6a3c153db1c6eae6b8175a98bcd1740c0 100644 --- a/module/VuFind/src/VuFind/Controller/WorldcatController.php +++ b/module/VuFind/src/VuFind/Controller/WorldcatController.php @@ -44,10 +44,21 @@ class WorldcatController extends AbstractSearch public function __construct() { $this->searchClassId = 'WorldCat'; - $this->useResultScroller = false; parent::__construct(); } + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + $config = $this->getServiceLocator()->get('VuFind\Config')->get('WorldCat'); + return (isset($config->Record->next_prev_navigation) + && $config->Record->next_prev_navigation); + } + /** * Home action * diff --git a/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php b/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php index e5407e7b0eea63d032323b07ab0be58c6c799fcb..b88ab894e360727f51c9683a6991f02940c4af82 100644 --- a/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php +++ b/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php @@ -45,9 +45,20 @@ class WorldcatrecordController extends AbstractRecord { // Override some defaults: $this->searchClassId = 'WorldCat'; - $this->useResultScroller = false; // Call standard record controller initialization: parent::__construct(); } + + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + $config = $this->getServiceLocator()->get('VuFind\Config')->get('WorldCat'); + return (isset($config->Record->next_prev_navigation) + && $config->Record->next_prev_navigation); + } }