diff --git a/module/VuFind/src/VuFind/Controller/CombinedController.php b/module/VuFind/src/VuFind/Controller/CombinedController.php index 1bcce0f8746e38a749549ffd446c94c509770ea5..efb032d0f55aded71577a631308096ef46da83e7 100644 --- a/module/VuFind/src/VuFind/Controller/CombinedController.php +++ b/module/VuFind/src/VuFind/Controller/CombinedController.php @@ -102,11 +102,18 @@ class CombinedController extends AbstractSearch ) { $html = ''; } else { + $cart = $this->getServiceLocator()->get('VuFind\Cart'); + $general = $this->getServiceLocator()->get('VuFind\Config') + ->get('config'); + $viewParams = array( + 'searchClassId' => $searchClassId, + 'currentSearch' => $settings, + 'showCartControls' => $currentOptions->supportsCart() + && $cart->isActive() + ); $html = $this->getViewRenderer()->render( 'combined/results-list.phtml', - array( - 'searchClassId' => $searchClassId, 'currentSearch' => $settings - ) + $viewParams ); } $response->setContent($html); @@ -143,6 +150,7 @@ class CombinedController extends AbstractSearch $config = $this->getServiceLocator()->get('VuFind\Config')->get('combined') ->toArray(); $supportsCart = false; + $supportsCartOptions = array(); foreach ($config as $current => $settings) { // Special case -- ignore recommendation config: if ($current == 'Layout' || $current == 'RecommendationModules') { @@ -150,8 +158,9 @@ class CombinedController extends AbstractSearch } $this->adjustQueryForSettings($settings); $currentOptions = $options->get($current); + $supportsCartOptions[] = $currentOptions->supportsCart(); if ($currentOptions->supportsCart()) { - $supportsCart = true; + $supportsCart = true; } list($controller, $action) = explode('-', $currentOptions->getSearchAction()); @@ -192,6 +201,7 @@ class CombinedController extends AbstractSearch 'placement' => $placement, 'results' => $results, 'supportsCart' => $supportsCart, + 'supportsCartOptions' => $supportsCartOptions ) ); } @@ -247,3 +257,4 @@ class CombinedController extends AbstractSearch $query->noRecommend = 1; } } + diff --git a/themes/bootstrap3/css/combined-search.css b/themes/bootstrap3/css/combined-search.css index c73e1525b08e3504c1d7fedcb7e1cd61ef535c9e..28d9da102436c9271f06bdcad78029c972b0e6e7 100644 --- a/themes/bootstrap3/css/combined-search.css +++ b/themes/bootstrap3/css/combined-search.css @@ -4,4 +4,4 @@ .result {padding-right:0} .result > .col-xs-1.checkbox {padding-right:0;width:10%} .result > .col-xs-11 {width:89%} -.form-inline > .clearfix {margin-left:7px} \ No newline at end of file +.form-inline > .clearfix {margin-left:7px} diff --git a/themes/bootstrap3/templates/combined/results-list.phtml b/themes/bootstrap3/templates/combined/results-list.phtml index 0558a147f72f58abadacf2dce28fa6b4574c769c..678ee6f7013d24ee699cd8dfb2375b3b57da795a 100644 --- a/themes/bootstrap3/templates/combined/results-list.phtml +++ b/themes/bootstrap3/templates/combined/results-list.phtml @@ -66,10 +66,11 @@ <? $viewType = in_array('list', array_keys($params->getViewList())) ? 'list' : $params->getView(); - $viewParams = array('results' => $results, 'params' => $params); - if (!$params->getOptions()->supportsCart()) { - $viewParams['hideCartControls'] = true; - } + $viewParams = array( + 'results' => $results, + 'params' => $params, + 'showCartControls' => $this->showCartControls + ); ?> <?=$this->render('search/list-' . $viewType . '.phtml', $viewParams)?> <? if ($currentSearch['more_link']): ?> diff --git a/themes/bootstrap3/templates/combined/results.phtml b/themes/bootstrap3/templates/combined/results.phtml index a5165258e98f43c7f91a19c30e73a2641acc9bb3..bf2d2c235dfdd655f364a241a5baa42edbdb291e 100644 --- a/themes/bootstrap3/templates/combined/results.phtml +++ b/themes/bootstrap3/templates/combined/results.phtml @@ -34,6 +34,9 @@ $this->escapeHtml($lookfor) . '</li>'; } + // Enable cart if appropriate: + $this->showCartControls = $this->supportsCart && $this->cart()->isActive(); + // Load Javascript dependencies into header: $this->headScript()->appendFile("check_item_statuses.js"); $this->headScript()->appendFile("check_save_statuses.js"); @@ -52,7 +55,15 @@ <? if ($this->supportsCart && $this->cart()->isActive()): ?> <?=$this->context($this)->renderInContext('search/bulk-action-buttons.phtml', array('idPrefix' => ''))?> <? endif; ?> - <?=$this->context($this)->renderInContext('combined/stack-'.$placement.'.phtml', array('searchClassId' => $searchClassId, 'combinedResults' => $this->combinedResults))?> + <? + $viewParams = array( + 'searchClassId' => $searchClassId, + 'combinedResults' => $this->combinedResults, + 'supportsCartOptions' => $this->supportsCartOptions, + 'showCartControls' => $this->showCartControls + ); + ?> + <?=$this->context($this)->renderInContext('combined/stack-'.$placement.'.phtml', $viewParams)?> <? $recs = $combinedResults->getRecommendations('bottom'); if (!empty($recs)): ?> <div> <? foreach ($recs as $current): ?> diff --git a/themes/bootstrap3/templates/combined/stack-distributed.phtml b/themes/bootstrap3/templates/combined/stack-distributed.phtml index 17a9717a15749ba0af91a991ddd464ca725c6620..91cb37ec0dd289b76d73188b81256e15f281c726 100644 --- a/themes/bootstrap3/templates/combined/stack-distributed.phtml +++ b/themes/bootstrap3/templates/combined/stack-distributed.phtml @@ -14,9 +14,14 @@ <? $searchClassId = $keys[$columnIndex]; ?> <? $currentSearch = $searches[$columnIndex]; ?> <? if ((!isset($currentSearch['ajax']) || !$currentSearch['ajax']) && isset($currentSearch['hide_if_empty']) && $currentSearch['hide_if_empty'] && $currentSearch['view']->results->getResultTotal() == 0) { $columnIndex += $columns; continue; } ?> + <? + $viewParams = array('searchClassId' => $searchClassId, 'currentSearch' => $currentSearch); + // Enable cart if appropriate: + $viewParams['showCartControls'] = $this->supportsCartOptions[$columnIndex] && $this->showCartControls; + ?> <div id="combined_<?=$this->escapeHtmlAttr($searchClassId)?>"> <? $templateSuffix = (isset($currentSearch['ajax']) && $currentSearch['ajax']) ? 'ajax' : 'list'; ?> - <?=$this->render('combined/results-' . $templateSuffix . '.phtml', array('searchClassId' => $searchClassId, 'currentSearch' => $currentSearch))?> + <?=$this->render('combined/results-' . $templateSuffix . '.phtml', $viewParams)?> </div> <? $columnIndex += $columns ?> <? endwhile; ?> diff --git a/themes/bootstrap3/templates/combined/stack-left.phtml b/themes/bootstrap3/templates/combined/stack-left.phtml index 5aee879c884f5db41694d892cc00afc8be58180e..d7dfd261d49a698aa78d84387310c5c935d5e874 100644 --- a/themes/bootstrap3/templates/combined/stack-left.phtml +++ b/themes/bootstrap3/templates/combined/stack-left.phtml @@ -7,10 +7,15 @@ <? if ($columnIndex < $columns): ?> <div class="col-sm-<?=$span ?><? if($columnIndex == $columns-1): ?> col-sm-pull-<?=$span*($columns-1) ?><? else: ?> col-sm-push-<?=$span ?><? endif; ?> combined-list"> <? endif; ?> - <div id="combined_<?=$this->escapeHtmlAttr($searchClassId)?>"> - <? $templateSuffix = (isset($currentSearch['ajax']) && $currentSearch['ajax']) ? 'ajax' : 'list'; ?> - <?=$this->render('combined/results-' . $templateSuffix . '.phtml', array('searchClassId' => $searchClassId, 'currentSearch' => $currentSearch))?> - </div> + <? + $viewParams = array('searchClassId' => $searchClassId, 'currentSearch' => $currentSearch); + // Enable cart if appropriate: + $viewParams['showCartControls'] = $this->supportsCartOptions[$columnIndex] && $this->showCartControls; + ?> + <div id="combined_<?=$this->escapeHtmlAttr($searchClassId)?>"> + <? $templateSuffix = (isset($currentSearch['ajax']) && $currentSearch['ajax']) ? 'ajax' : 'list'; ?> + <?=$this->render('combined/results-' . $templateSuffix . '.phtml', $viewParams)?> + </div> <? ++$columnIndex ?> <? if($columnIndex < $columns || $columnIndex == $sectionCount): ?> </div> diff --git a/themes/bootstrap3/templates/combined/stack-right.phtml b/themes/bootstrap3/templates/combined/stack-right.phtml index dc2e7e42dbb45dcd10a5d781ee12b6cf407a269d..d7c30c40ef577f4e66f34a80cfa68ec7714d56d1 100644 --- a/themes/bootstrap3/templates/combined/stack-right.phtml +++ b/themes/bootstrap3/templates/combined/stack-right.phtml @@ -7,10 +7,15 @@ <? if ($columnIndex < $columns): ?> <div class="col-sm-<?=$span ?> combined-list"> <? endif; ?> - <div id="combined_<?=$this->escapeHtmlAttr($searchClassId)?>"> - <? $templateSuffix = (isset($currentSearch['ajax']) && $currentSearch['ajax']) ? 'ajax' : 'list'; ?> - <?=$this->render('combined/results-' . $templateSuffix . '.phtml', array('searchClassId' => $searchClassId, 'currentSearch' => $currentSearch))?> - </div> + <? + $viewParams = array('searchClassId' => $searchClassId, 'currentSearch' => $currentSearch); + // Enable cart if appropriate: + $viewParams['showCartControls'] = $this->supportsCartOptions[$columnIndex] && $this->showCartControls; + ?> + <div id="combined_<?=$this->escapeHtmlAttr($searchClassId)?>"> + <? $templateSuffix = (isset($currentSearch['ajax']) && $currentSearch['ajax']) ? 'ajax' : 'list'; ?> + <?=$this->render('combined/results-' . $templateSuffix . '.phtml', $viewParams)?> + </div> <? ++$columnIndex ?> <? if($columnIndex < $columns || $columnIndex == $sectionCount): ?> </div> diff --git a/themes/bootstrap3/templates/search/list-list.phtml b/themes/bootstrap3/templates/search/list-list.phtml index 0986c37cdcfc22eb13fe8d22c444e0e00a1f5aac..db6556a5c019080632d23b1a8a678ac3009a96a9 100644 --- a/themes/bootstrap3/templates/search/list-list.phtml +++ b/themes/bootstrap3/templates/search/list-list.phtml @@ -1,10 +1,11 @@ <? if (!isset($this->indexStart)) $this->indexStart = 0; ?> +<? $showCheckboxes = (isset($this->showCartControls) && $this->showCartControls) ?> <? $i = $this->indexStart; foreach ($this->results->getResults() as $current): $recordNumber = $this->results->getStartRecord()+$i-$this->indexStart; ?> <div id="result<?=$i++ ?>" class="row result clearfix"> - <div class="col-xs-1 hidden-print checkbox"> + <div class="col-xs-1 hidden-print<? if ($showCheckboxes): ?> checkbox<? endif; ?>"> <label> - <? if (!isset($this->hideCartControls) && $this->cart()->isActive()): ?> + <? if ($showCheckboxes): ?> <?=$this->record($current)->getCheckbox()?> <? endif; ?> <?=$recordNumber?> diff --git a/themes/bootstrap3/templates/search/results.phtml b/themes/bootstrap3/templates/search/results.phtml index 03f64c0cf6f637a13828fe9767779ed8d9ce9fe2..7ca70021f48e747f48e025cfd0e7c4c327fcbc34 100644 --- a/themes/bootstrap3/templates/search/results.phtml +++ b/themes/bootstrap3/templates/search/results.phtml @@ -30,10 +30,8 @@ $this->layout()->breadcrumbs .= '<li class="active">' . $this->transEsc('Search') . ': ' . $this->escapeHtml($lookfor) . '</li>'; } - // Disable cart if appropriate: - if (!$this->params->getOptions()->supportsCart()) { - $this->hideCartControls = true; - } + // Enable cart if appropriate: + $this->showCartControls = $this->params->getOptions()->supportsCart() && $this->cart()->isActive(); // Load Javascript dependencies into header: $this->headScript()->appendFile("check_item_statuses.js");