diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index e04bb171b44d488f0d172343ff858e62408a7386..1143b64b82cc16e15b4e125bb8f277c035b8328f 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -90,6 +90,7 @@ $config = array( 'author' => 'VuFind\Controller\AuthorController', 'authority' => 'VuFind\Controller\AuthorityController', 'cart' => 'VuFind\Controller\CartController', + 'combined' => 'VuFind\Controller\CombinedController', 'confirm' => 'VuFind\Controller\ConfirmController', 'cover' => 'VuFind\Controller\CoverController', 'error' => 'VuFind\Controller\ErrorController', @@ -973,7 +974,7 @@ $staticRoutes = array( 'Browse/LCC', 'Browse/Region', 'Browse/Tag', 'Browse/Topic', 'Cart/doExport', 'Cart/Email', 'Cart/Export', 'Cart/Home', 'Cart/MyResearchBulk', 'Cart/Save', 'Collections/ByTitle', 'Collections/Home', - 'Confirm/Confirm', + 'Combined/Home', 'Combined/Results', 'Confirm/Confirm', 'Cover/Show', 'Cover/Unavailable', 'Error/Unavailable', 'Feedback/Email', 'Feedback/Home', 'Help/Home', 'Install/Done', 'Install/FixBasicConfig', 'Install/FixCache', diff --git a/module/VuFind/src/VuFind/Controller/CombinedController.php b/module/VuFind/src/VuFind/Controller/CombinedController.php new file mode 100644 index 0000000000000000000000000000000000000000..18272337a05c208687feca9a7fb823df15683cdd --- /dev/null +++ b/module/VuFind/src/VuFind/Controller/CombinedController.php @@ -0,0 +1,98 @@ +<?php +/** + * Combined Search 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; +use Zend\Stdlib\Parameters; + +/** + * Redirects the user to the appropriate default VuFind action. + * + * @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 CombinedController extends AbstractSearch +{ + /** + * Constructor + */ + public function __construct() + { + $this->searchClassId = 'Combined'; + parent::__construct(); + } + + /** + * Home action + * + * @return mixed + */ + public function homeAction() + { + return $this->createViewModel(); + } + + /** + * Results action + * + * @return mixed + */ + public function resultsAction() + { + // Set up current request context: + $results = $this->getResultsManager()->get('Combined'); + $params = $results->getParams(); + $params->initFromRequest( + new Parameters( + $this->getRequest()->getQuery()->toArray() + + $this->getRequest()->getPost()->toArray() + ) + ); + + // Gather combined results: + $combinedResults = array(); + $options = $this->getServiceLocator() + ->get('VuFind\SearchOptionsPluginManager'); + foreach (array('Solr', 'Summon') as $current) { + $currentOptions = $options->get($current); + list($controller, $action) + = explode('-', $currentOptions->getSearchAction()); + $combinedResults[$current] = $this->forwardTo($controller, $action); + } + + // Build view model: + return $this->createViewModel( + array( + 'results' => $results, + 'params' => $params, + 'combinedResults' => $combinedResults + ) + ); + } +} diff --git a/module/VuFind/src/VuFind/Search/Combined/Options.php b/module/VuFind/src/VuFind/Search/Combined/Options.php new file mode 100644 index 0000000000000000000000000000000000000000..52cd7d60a40e03ba1efeced083b37e31f669dca7 --- /dev/null +++ b/module/VuFind/src/VuFind/Search/Combined/Options.php @@ -0,0 +1,50 @@ +<?php +/** + * Combined search model. + * + * 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 Search_Base + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://www.vufind.org Main Page + */ +namespace VuFind\Search\Combined; + +/** + * Combined search model. + * + * @category VuFind2 + * @package Search_Base + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://www.vufind.org Main Page + */ +class Options extends \VuFind\Search\Base\Options +{ + /** + * Return the route name for the search results action. + * + * @return string + */ + public function getSearchAction() + { + return 'combined-results'; + } +} \ No newline at end of file diff --git a/module/VuFind/src/VuFind/Search/Combined/Params.php b/module/VuFind/src/VuFind/Search/Combined/Params.php new file mode 100644 index 0000000000000000000000000000000000000000..c6b555f32d419213e50eaacdfb939ac31cfd1199 --- /dev/null +++ b/module/VuFind/src/VuFind/Search/Combined/Params.php @@ -0,0 +1,41 @@ +<?php +/** + * Combined aspect of the Search Multi-class (Params) + * + * PHP version 5 + * + * Copyright (C) Villanova University 2011. + * + * 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 Search_SolrAuth + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://www.vufind.org Main Page + */ +namespace VuFind\Search\Combined; + +/** + * Combined Search Parameters + * + * @category VuFind2 + * @package Search_SolrAuth + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://www.vufind.org Main Page + */ +class Params extends \VuFind\Search\Solr\Params +{ +} \ No newline at end of file diff --git a/module/VuFind/src/VuFind/Search/Combined/Results.php b/module/VuFind/src/VuFind/Search/Combined/Results.php new file mode 100644 index 0000000000000000000000000000000000000000..52cdb74e56fcb1434042988297754bddb8e4bbfc --- /dev/null +++ b/module/VuFind/src/VuFind/Search/Combined/Results.php @@ -0,0 +1,68 @@ +<?php +/** + * Combined results search model. + * + * 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 Search_Base + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://www.vufind.org Main Page + */ +namespace VuFind\Search\Combined; + +/** + * Combined results search model. + * + * @category VuFind2 + * @package Search_Base + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://www.vufind.org Main Page + */ +class Results extends \VuFind\Search\Base\Results +{ + /** + * Returns the stored list of facets for the last search + * + * @param array $filter Array of field => on-screen description listing + * all of the desired facet fields; set to null to get all configured values. + * + * @return array Facets data arrays + */ + public function getFacetList($filter = null) + { + // Not relevant: + return array(); + } + + /** + * Abstract support method for performAndProcessSearch -- perform a search based + * on the parameters passed to the object. This method is responsible for + * filling in all of the key class properties: results, resultTotal, etc. + * + * @return void + */ + protected function performSearch() + { + throw new \Exception( + 'This is a placeholder class and is not meant to be called!' + ); + } +} \ No newline at end of file diff --git a/themes/blueprint/css/styles.css b/themes/blueprint/css/styles.css index 66b431dfc6fe9dea07be4dabd7ed3dd632dfaf53..a18c31c3b55068ca9b358669f3fd653ea9985857 100644 --- a/themes/blueprint/css/styles.css +++ b/themes/blueprint/css/styles.css @@ -2133,4 +2133,25 @@ div.handle { .searchTabNav li.active a { color:#000; text-decoration:none; +} + +.combinedResult { + width: 47%; + margin: 5px; + padding: 5px; + float: left; + border: 1px solid #eee; +} + +.combinedResult .span-4, .combinedResult ul.recordSet .recordNumber { + display: none; +} + +.combinedResult .span-9 { + width: 330px; +} + +.combinedResult .span-2 { + clear: left; + float: left; } \ No newline at end of file diff --git a/themes/blueprint/templates/combined/home.phtml b/themes/blueprint/templates/combined/home.phtml new file mode 100644 index 0000000000000000000000000000000000000000..d13d4348c1e39e2222b5f16ce7d65ecd7816ef92 --- /dev/null +++ b/themes/blueprint/templates/combined/home.phtml @@ -0,0 +1 @@ +<?=$this->render('search/home.phtml');?> \ No newline at end of file diff --git a/themes/blueprint/templates/combined/results.phtml b/themes/blueprint/templates/combined/results.phtml new file mode 100644 index 0000000000000000000000000000000000000000..111b749834763f150eb55e6ca4ad831c63652445 --- /dev/null +++ b/themes/blueprint/templates/combined/results.phtml @@ -0,0 +1,99 @@ +<? + // Set up page title: + $lookfor = $this->params->getDisplayQuery(); + if (isset($this->overrideTitle)) { + $this->headTitle($this->overrideTitle); + } else { + $this->headTitle($this->translate('Search Results') . (empty($lookfor) ? '' : " - {$lookfor}")); + } + + // Set up search box: + $this->layout()->searchbox = $this->context($this)->renderInContext( + 'search/searchbox.phtml', + array( + 'lookfor' => $lookfor, + 'searchIndex' => $this->params->getSearchHandler(), + 'searchType' => $this->params->getSearchType(), + 'searchId' => $this->results->getSearchId(), + 'searchClassId' => $this->params->getsearchClassId(), + 'checkboxFilters' => $this->params->getCheckboxFacets(), + 'filterList' => $this->params->getFilters(), + 'selectedShards' => $this->params->getSelectedShards() + ) + ); + + // Set up breadcrumbs: + if (isset($this->overrideTitle)) { + $this->layout()->breadcrumbs = '<em>' . $this->escapeHtml($this->overrideTitle) . '</em>'; + } else { + $this->layout()->breadcrumbs = '<em>' . $this->transEsc('Search') . ': ' . + $this->escapeHtml($lookfor) . '</em>'; + } + + // Load Javascript dependencies into header: + $this->headScript()->appendFile("check_item_statuses.js"); + $this->headScript()->appendFile("check_save_statuses.js"); +?> +<div> + <?=$this->flashmessages()?> + <? foreach ($this->combinedResults as $searchClassId => $view): ?> + <? + $results = $view->results; + $params = $results->getParams(); + $lookfor = $params->getDisplayQuery(); + $recordTotal = $results->getResultTotal(); + ?> + <div class="combinedResult"> + <div class="resulthead"> + <div class="floatleft"> + <? if ($recordTotal > 0): ?> + <?=$this->transEsc("Showing")?> + <strong><?=$results->getStartRecord()?></strong> - <strong><?=$results->getEndRecord()?></strong> + <? if (!isset($view->skipTotalCount)): ?> + <?=$this->transEsc('of')?> <strong><?=$recordTotal?></strong> + <? endif; ?> + <? if (isset($view->overrideSearchHeading)): ?> + <?=$view->overrideSearchHeading?> + <? elseif ($params->getSearchType() == 'basic'): ?> + <?=$this->transEsc('for search')?>: <strong>'<?=$this->escapeHtml($lookfor)?>'</strong>, + <? endif; ?> + <? if ($qtime = $results->getQuerySpeed()): ?> + <?=$this->transEsc('query time')?>: <?=$this->escapeHtml(round($qtime, 2))?>s + <? endif; ?> + <?=$this->search()->renderSpellingSuggestions('<strong>' . $this->transEsc('spell_suggest') . '</strong>:', $results, $this); ?> + <? else: ?> + <h3><?=$this->transEsc('nohit_heading')?></h3> + <? endif; ?> + </div> + <div class="clear"></div> + </div> + <? /* End Listing Options */ ?> + + <? if ($recordTotal < 1): ?> + <p class="error"> + <? if (isset($view->overrideEmptyMessage)): ?> + <?=$view->overrideEmptyMessage?> + <? else: ?> + <?=$this->transEsc('nohit_prefix')?> - <strong><?=$this->escapeHtml($lookfor)?></strong> - <?=$this->transEsc('nohit_suffix')?> + <? endif; ?> + </p> + <? if (isset($view->parseError)): ?> + <p class="error"><?=$this->transEsc('nohit_parse_error')?></p> + <? endif; ?> + <?=$this->search()->renderSpellingSuggestions($this->transEsc('nohit_spelling') . ':', $results, $this); ?> + <? foreach ($results->getRecommendations('top') as $current): ?> + <?=$this->recommend($current)?> + <? endforeach; ?> + <? foreach ($results->getRecommendations('noresults') as $current): ?> + <?=$this->recommend($current)?> + <? endforeach; ?> + <? else: ?> + <?=$this->render('search/list-' . $params->getView() . '.phtml', array('results' => $results, 'params' => $params))?> + <? endif; ?> + </div> + <? endforeach; ?> +</div> +<? /* End Main Listing */ ?> + +<div class="clear"></div> +