diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index e55e4132f5262577a3eb6ab62ab3f0e12b8c1f8d..7b550b16ad2ed4a002a25d80bc0e175e2d2c7368 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -28,7 +28,9 @@ $config = array( 'record' => 'VuFind\Controller\RecordController', 'search' => 'VuFind\Controller\SearchController', 'summon' => 'VuFind\Controller\SummonController', - 'summonrecord' => 'VuFind\Controller\SummonrecordController' + 'summonrecord' => 'VuFind\Controller\SummonrecordController', + 'worldcat' => 'VuFind\Controller\WorldcatController', + 'worldcatrecord' => 'VuFind\Controller\WorldcatrecordController' ), ), 'translator' => array(), @@ -46,7 +48,7 @@ $recordRoutes = array( 'record' => 'Record', 'missingrecord' => 'MissingRecord', 'summonrecord' => 'SummonRecord', - 'worldcatrecord' => 'WorldCatRecord' + 'worldcatrecord' => 'WorldcatRecord' ); // Define list-related routes -- route name => MyResearch action @@ -79,7 +81,7 @@ $staticRoutes = array( 'Tag/Home', 'Upgrade/Home', 'Upgrade/FixAnonymousTags', 'Upgrade/FixMetadata', 'Upgrade/GetDBCredentials', 'Upgrade/GetSourceDir', 'Upgrade/Reset', - 'WorldCat/Advanced', 'WorldCat/Home', 'WorldCat/Search' + 'Worldcat/Advanced', 'Worldcat/Home', 'Worldcat/Search' ); // Build record routes diff --git a/module/VuFind/src/VuFind/Controller/WorldcatController.php b/module/VuFind/src/VuFind/Controller/WorldcatController.php new file mode 100644 index 0000000000000000000000000000000000000000..487a6f4d7f199fbb0b4f92ee473569a3170ad1e2 --- /dev/null +++ b/module/VuFind/src/VuFind/Controller/WorldcatController.php @@ -0,0 +1,95 @@ +<?php +/** + * WorldCat Controller + * + * PHP version 5 + * + * Copyright (C) Villanova University 2010. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package Controller + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org Main Site + */ +namespace VuFind\Controller; + +/** + * WorldCat Controller + * + * @category VuFind2 + * @package Controller + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org Main Site + */ +class WorldcatController extends AbstractSearch +{ + /** + * Constructor + */ + public function __construct() + { + $this->searchClassId = 'WorldCat'; + $this->useResultScroller = false; + parent::__construct(); + } + + /** + * Home action + * + * @return void + */ + public function homeAction() + { + // Set up default parameters: + return $this->createViewModel(); + } + + /** + * Search action -- call standard results action + * + * @return void + */ + public function searchAction() + { + return $this->resultsAction(); + } + + /** + * Forward unrecognized actions to record controller for legacy URL + * compatibility. + * + * @param string $method Method name being called. + * @param array $params Parameters passed to method. + * + * @return void + */ + public function __call($method, $params) + { + if (substr($method, -6) == 'Action') { + $action = substr($method, 0, strlen($method) - 6); + // Special case for default record action: + if ($action == 'record') { + $action = 'home'; + } + return $this->forward() + ->dispatch('WorldcatRecord', array('action' => $action)); + } + return parent::__call($method, $params); + } +} + diff --git a/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php b/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php new file mode 100644 index 0000000000000000000000000000000000000000..e5407e7b0eea63d032323b07ab0be58c6c799fcb --- /dev/null +++ b/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php @@ -0,0 +1,53 @@ +<?php +/** + * WorldCat Record Controller + * + * PHP version 5 + * + * Copyright (C) Villanova University 2010. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package Controller + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org Main Site + */ +namespace VuFind\Controller; + +/** + * WorldCat Record Controller + * + * @category VuFind2 + * @package Controller + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org Main Site + */ +class WorldcatrecordController extends AbstractRecord +{ + /** + * Constructor + */ + public function __construct() + { + // Override some defaults: + $this->searchClassId = 'WorldCat'; + $this->useResultScroller = false; + + // Call standard record controller initialization: + parent::__construct(); + } +}