From b92f6af2ec3855e69ebc877c31a8db65067357d0 Mon Sep 17 00:00:00 2001
From: ckaz <kazzer@ub.uni-leipzig.de>
Date: Thu, 7 Nov 2019 13:25:59 +0100
Subject: [PATCH] refs #16352

* removes deprecated code from finc's search/home.phtml
* this allows for the display of channels and home facets
---
 themes/finc/templates/search/home.phtml | 99 +------------------------
 1 file changed, 4 insertions(+), 95 deletions(-)

diff --git a/themes/finc/templates/search/home.phtml b/themes/finc/templates/search/home.phtml
index 723835dde53..6177b1ce73e 100644
--- a/themes/finc/templates/search/home.phtml
+++ b/themes/finc/templates/search/home.phtml
@@ -15,105 +15,14 @@ $this->layout()->breadcrumbs = false;
 ?>
 
 <div class="searchHomeContent">
-  <?php /* finc-specific: #7187@89bb6e70; VF moved the original BS code to a separate template: helpers - ils-offline.phtml - CK */ ?>
-  <?php
-  $ilsStatusScript = <<<JS
-      $(document).ready(function() {
-        $.ajax({
-            dataType: 'json',
-            method: 'GET',
-            data: {'offlineModeMsg':'ils_offline_home_message'},
-            url: VuFind.path + '/AJAX/JSON?method=getIlsStatus',
-            success: function(response) {
-              $('.searchHomeContent').prepend(response.data);
-            }
-        });
-      });
-JS;
-  ?>
-  <?php /* finc-specific: #7187 - END */ ?>
-  <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $ilsStatusScript, 'SET');?>
-
-  <?php /* finc: Activate search box here if you want the old look -- otherwise we keep the consistent look with searchbox in header */ ?>
+<?php /* finc: Activate search box below if you want the old look -- otherwise we keep the consistent look with searchbox in header */ ?>
   <?php /*
- <?=$this->context($this)->renderInContext("search/searchbox.phtml", ['ignoreHiddenFilterMemory' => true])?>
+  <?=$this->context($this)->renderInContext("search/searchbox.phtml", ['ignoreHiddenFilterMemory' => true])?>
   <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, '$("#searchForm_lookfor").focus();', 'SET'); ?>
+</div>
  */ ?>
 </div>
 
-<?php if (!empty($facetList)): ?>
-  <div class="search-home-facets">
-    <?php foreach ($facetList as $field => $details): ?>
-      <?php if ($isHierarchy = in_array($field, $this->hierarchicalFacets ?? [])):
-         $this->headScript()->appendFile('vendor/jsTree/jstree.min.js');
-        $this->headScript()->appendFile('facets.js');
-        $sort = $this->hierarchicalFacetSortOptions[$field] ?? '';
-        $script = <<<JS
-$(document).ready(function() {
-  $('#facet_{$this->escapeHtml($field)}_container').removeClass('hide');
-  initFacetTree($('#facet_{$this->escapeHtml($field)}'), false);
-});
-JS;
-          echo $this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $script, 'SET');
-        ?>
-        <div id="facet_<?=$this->escapeHtml($field)?>_container" class="home-facet <?=$this->escapeHtmlAttr($field)?> hide">
-          <h2><?=$this->transEsc('home_browse') . ' ' . $this->transEsc($details['label'])?></h2>
-          <div id="facet_<?=$this->escapeHtml($field)?>" class="jstree-facet"
-               data-facet="<?=$this->escapeHtml($field)?>"
-               data-path="<?=$this->url($basicSearch)?>"
-               data-exclude="0"
-               data-operator="AND"
-               data-exclude-title="<?=$this->transEsc('exclude_facet')?>"
-               data-sort="all">
-          </div>
-        </div>
-        <noscript>
-          <?php if (!$noJsSupport): ?>
-            <h2><?=$this->transEsc('home_browse') . ' ' . $this->transEsc($details['label'])?></h2>
-            <?=$this->transEsc('Please enable JavaScript.')?>
-      <?php endif; ?>
-      <?php endif; ?>
-      <?php if (!$isHierarchy || $noJsSupport): // do we need regular display? ?>
-      <?php $sortedList = $this->sortFacetList($this->results, $field, $details['list'], $basicSearch); ?>
-      <div class="home-facet <?=$this->escapeHtmlAttr($field)?>">
-        <h2><?=$this->transEsc('home_browse') . ' ' . $this->transEsc($details['label'])?></h2>
-        <div class="home-facet-container">
-          <ul class="home-facet-list">
-              <?php
-                // Special case: two columns for LC call numbers...
-                $maxListLength = $field == 'callnumber-first'
-                  ? $columnSize * 2 : $columnSize;
-
-                // Special case: custom URLs for collections...
-                $moreUrl = $field == 'hierarchy_top_title'
-                  ? $this->url('collections-home') : $this->url($advSearch);
+<?=implode('', array_map([$this, 'contentBlock'], $blocks ?? []))?>
 
-                // Convenience variable:
-                $currentListLength = count($sortedList);
-              ?>
-              <?php $i = 0; foreach ($sortedList as $url => $value):
-                  // Special case: custom URLs for collections...
-                  if ($field == 'hierarchy_top_title') {
-                      $url = $this->url('collections-bytitle') . '?title=' . urlencode($value);
-                  }
-                ?>
-                <li><a href="<?=$url?>"><?=$this->escapeHtml(empty($value) ? '-' : $value)?></a></li>
-                <?php if (++$i >= $currentListLength) break; // end of list? bail out! ?>
-                <?php if ($i >= $maxListLength): // list too long? show more link! ?>
-                  <li><a href="<?=$moreUrl?>"><strong><?=$this->transEsc("More options")?>...</strong></a></li>
-                  <?php break; ?>
-                <?php elseif ($i % $columnSize === 0): // end of column? insert break! ?>
-                  </ul><ul class="home-facet-list">
-                <?php endif; ?>
-              <?php endforeach; ?>
-          </ul>
-        </div>
-      </div>
-      <?php endif; ?>
-      <?php if ($isHierarchy): // close tag opened in matching if above ?>
-        </noscript>
-      <?php endif; ?>
-    <?php endforeach; ?>
-  </div>
-<?php endif; ?>
 <!-- finc: search - home - END -->
-- 
GitLab