diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 4fb40cacff5b953774cf49411f19cb228b3ee4e6..a5bf1129687dfbd7f8b3fafc564844cdf923f411 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -126,6 +126,7 @@ $config = array( 'authority' => 'VuFind\Controller\AuthorityController', 'browse' => 'VuFind\Controller\BrowseController', 'cart' => 'VuFind\Controller\CartController', + 'collection' => 'VuFind\Controller\CollectionController', 'cover' => 'VuFind\Controller\CoverController', 'error' => 'VuFind\Controller\ErrorController', 'help' => 'VuFind\Controller\HelpController', @@ -491,6 +492,7 @@ $config = array( // Define record view routes -- route name => controller $recordRoutes = array( 'record' => 'Record', + 'collection' => 'Collection', 'missingrecord' => 'MissingRecord', 'solrauthrecord' => 'Authority', 'summonrecord' => 'SummonRecord', diff --git a/module/VuFind/src/VuFind/Controller/CollectionController.php b/module/VuFind/src/VuFind/Controller/CollectionController.php new file mode 100644 index 0000000000000000000000000000000000000000..3a977cbd7795eaa63f71e5d20d2bad16ea071494 --- /dev/null +++ b/module/VuFind/src/VuFind/Controller/CollectionController.php @@ -0,0 +1,79 @@ +<?php +/** + * Collection 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; + +/** + * Collection 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 CollectionController extends AbstractRecord +{ + /** + * Constructor + */ + public function __construct() + { + // Call standard record controller initialization: + parent::__construct(); + + // TODO: set appropriate default tab + } + + /** + * Get the tab configuration for this controller. + * + * @return array + */ + protected function getTabConfiguration() + { + // TODO: fill in + return array(); + } + + /** + * Display a particular tab. + * + * @param string $tab Name of tab to display + * @param bool $ajax Are we in AJAX mode? + * + * @return mixed + */ + protected function showTab($tab, $ajax = false) + { + $result = parent::showTab($tab, $ajax); + if (!$ajax && $result instanceof \Zend\View\Model\ViewModel) { + $result->setTemplate('collection/view'); + } + return $result; + } +} diff --git a/themes/blueprint/templates/collection/view.phtml b/themes/blueprint/templates/collection/view.phtml new file mode 100644 index 0000000000000000000000000000000000000000..e968bd623bb866981f0aadf801b327a88de08245 --- /dev/null +++ b/themes/blueprint/templates/collection/view.phtml @@ -0,0 +1,66 @@ +<? + // Set up standard record scripts: + $this->headScript()->appendFile("record.js"); + $this->headScript()->appendFile("check_save_statuses.js"); + + // Add RDF header link if applicable: + if ($this->driver->supportsExport('RDF')) { + $this->headLink()->appendAlternate($this->recordLink()->getActionUrl($this->driver, 'RDF'), 'application/rdf+xml', 'RDF Representation'); + } + + // Set up breadcrumbs: + $this->layout()->breadcrumbs = $this->getLastSearchLink($this->transEsc('Search'), '', '<span>></span>') . + $this->recordLink()->getBreadcrumb($this->driver); +?> +<div class="<?=$this->layoutClass('mainbody')?>"> + <?=$this->record($this->driver)->getToolbar()?> + + <div class="record recordId source<?=$this->escapeHtml($this->driver->getResourceSource())?>" id="record"> + <input type="hidden" value="<?=$this->escapeHtml($this->driver->getUniqueId())?>" class="hiddenId" id="record_id" /> + <?=$this->flashmessages()?> + <? if (isset($this->scrollData) && ($this->scrollData['previousRecord'] || $this->scrollData['nextRecord'])): ?> + <div class="resultscroller"> + <? if ($this->scrollData['previousRecord']): ?><a href="<?=$this->recordLink()->getUrl($this->scrollData['previousRecord'])?>">« <?=$this->transEsc('Prev')?></a><? endif; ?> + #<?=$this->escapeHtml($this->scrollData['currentPosition']) . ' ' . $this->transEsc('of') . ' ' . $this->escapeHtml($this->scrollData['resultTotal'])?> + <? if ($this->scrollData['nextRecord']): ?><a href="<?=$this->recordLink()->getUrl($this->scrollData['nextRecord'])?>"><?=$this->transEsc('Next')?> »</a><? endif; ?> + </div> + <? endif; ?> + <?=$this->record($this->driver)->getCoreMetadata()?> + </div> + + <? if (count($this->tabs) > 0): ?> + <div id="tabnav"> + <ul> + <? foreach ($this->tabs as $tab => $obj): ?> + <? // add current tab to breadcrumbs if applicable: + $desc = $obj->getDescription(); + $isCurrent = (strtolower($this->activeTab) == strtolower($tab)); + if ($isCurrent) { + $this->layout()->breadcrumbs .= '<span>></span><em>' . $this->transEsc($desc) . '</em>'; + $activeTabObj = $obj; + } + ?> + <li<?=$isCurrent ? ' class="active"' : ''?>> + <a href="<?=$this->recordLink()->getTabUrl($this->driver, $tab)?>#tabnav"><?=$this->transEsc($desc)?></a> + </li> + <? endforeach; ?> + </ul> + <div class="clear"></div> + </div> + <? endif; ?> + + + <div class="recordsubcontent"> + <?=isset($activeTabObj) ? $this->record($this->driver)->getTab($activeTabObj) : '' ?> + </div> + + <span class="Z3988" title="<?=$this->escapeHtml($this->driver->getOpenURL())?>"></span> +</div> + +<div class="<?=$this->layoutClass('sidebar')?>"> + <? foreach ($this->driver->getRelated() as $current): ?> + <?=$this->related($current)?> + <? endforeach; ?> +</div> + +<div class="clear"></div> diff --git a/themes/jquerymobile/templates/collection/view.phtml b/themes/jquerymobile/templates/collection/view.phtml new file mode 100644 index 0000000000000000000000000000000000000000..7a9daa50018c7464dada6cb70bbf499276137e04 --- /dev/null +++ b/themes/jquerymobile/templates/collection/view.phtml @@ -0,0 +1,25 @@ +<? + // Grab tab contents up front -- this will set the page title, which we need to + // do before we display the page header below. + $activeTab = false; + foreach ($this->tabs as $tab => $obj) { + if (strtolower($tab) == strtolower($this->activeTab)) { + $activeTab = $tab; + } + } + $tab = $activeTab ? $this->record($this->driver)->getTab($this->tabs[$activeTab]) : ''; +?> +<div data-role="page" id="Record-view"> + <?=$this->mobileMenu()->header(array('searchLink' => $this->searchOptions($this->searchClassId)->getSearchHomeAction()))?> + <div class="record" data-role="content" data-record-id="<?=$this->escapeHtml($this->driver->getUniqueId())?>"> + <?=$this->flashmessages()?> + <? if ($this->activeTab == $this->defaultTab): ?> + <?=$this->record($this->driver)->getCoreMetadata()?> + <? else: ?> + <h3><?=$this->escapeHtml($this->driver->getBreadcrumb())?></h3> + <? endif; ?> + <?=$tab?> + <?=$this->record($this->driver)->getToolbar()?> + </div> + <?=$this->mobileMenu()->footer()?> +</div>