From 5dd71f21cef52e66a8aae20a30ba995c2031eb50 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Fri, 13 Dec 2013 14:50:42 -0500
Subject: [PATCH] Mark highlighting. - Resolves VUFIND-563.

---
 .../View/Helper/Bootstrap/Highlight.php       | 49 +++++++++++++++++++
 .../src/VuFind/View/Helper/Root/Highlight.php | 16 +++++-
 themes/bootprint/css/style.css                |  1 +
 themes/bootstrap/css/screen.css               |  1 -
 themes/bootstrap/theme.config.php             |  1 +
 5 files changed, 66 insertions(+), 2 deletions(-)
 create mode 100644 module/VuFind/src/VuFind/View/Helper/Bootstrap/Highlight.php

diff --git a/module/VuFind/src/VuFind/View/Helper/Bootstrap/Highlight.php b/module/VuFind/src/VuFind/View/Helper/Bootstrap/Highlight.php
new file mode 100644
index 00000000000..453b54690ff
--- /dev/null
+++ b/module/VuFind/src/VuFind/View/Helper/Bootstrap/Highlight.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Highlight view helper
+ *
+ * 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  View_Helpers
+ * @author   Demian Katz <demian.katz@villanova.edu>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org/wiki/vufind2:developer_manual Wiki
+ */
+namespace VuFind\View\Helper\Bootstrap;
+
+/**
+ * Highlight view helper
+ *
+ * @category VuFind2
+ * @package  View_Helpers
+ * @author   Demian Katz <demian.katz@villanova.edu>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org/wiki/vufind2:developer_manual Wiki
+ */
+class Highlight extends \VuFind\View\Helper\Root\Highlight
+{
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+        $this->startTag = '<mark>';
+        $this->endTag = '</mark>';
+    }
+}
\ No newline at end of file
diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Highlight.php b/module/VuFind/src/VuFind/View/Helper/Root/Highlight.php
index e77f88d233f..c98f06adbeb 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/Highlight.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/Highlight.php
@@ -39,6 +39,20 @@ use Zend\View\Helper\AbstractHelper;
  */
 class Highlight extends AbstractHelper
 {
+    /**
+     * Start tag for highlighitng
+     *
+     * @var string
+     */
+    protected $startTag = '<span class="highlight">';
+
+    /**
+     * End tag for highlighitng
+     *
+     * @var string
+     */
+    protected $endTag = '</span>';
+
     /**
      * Adds a span tag with class "highlight" around a specific phrase for
      * highlighting
@@ -76,7 +90,7 @@ class Highlight extends AbstractHelper
         // URL encode the string, then put in the highlight spans:
         $haystack = str_replace(
             array('{{{{START_HILITE}}}}', '{{{{END_HILITE}}}}'),
-            array('<span class="highlight">', '</span>'),
+            array($this->startTag, $this->endTag),
             htmlspecialchars($haystack)
         );
 
diff --git a/themes/bootprint/css/style.css b/themes/bootprint/css/style.css
index 8c20701fd6a..53ef5530171 100644
--- a/themes/bootprint/css/style.css
+++ b/themes/bootprint/css/style.css
@@ -26,6 +26,7 @@ hr {margin:4px 0}
 input[type="text"] {border-color:#AAA;font-size:12px}
 input[type="text"]:focus {border-color:#619144;box-shadow:inset 0px 1px 2px rgba(0,0,0,.14)}
 .label {font-size:11px}
+mark {background:0;color:inherit;font-weight:bold}
 .modal a {color:#08C}
 .nav-list li.active > a {border-color:#C6D880;color:#FFF}
 .nav-pills > li > a {border-radius:2px;margin:0}
diff --git a/themes/bootstrap/css/screen.css b/themes/bootstrap/css/screen.css
index d5014a27c6c..fb815c89bef 100644
--- a/themes/bootstrap/css/screen.css
+++ b/themes/bootstrap/css/screen.css
@@ -8,7 +8,6 @@
 .comment .popover {display:block;margin-top:6px;max-width:none;position:relative}
 form.comment .span3 {padding-top:60px}
 .front { position:absolute;top:0;left:0;width:100%;padding-top:20%;z-index:5 }
-.highlight { font-weight:bold }
 * html .centered-pills ul.nav-pills { display:inline } /* IE6 */
 *+html .centered-pills ul.nav-pills { display:inline } /* IE7 */
 li a.hidden {display:none}
diff --git a/themes/bootstrap/theme.config.php b/themes/bootstrap/theme.config.php
index e86a29543e4..178671510f1 100644
--- a/themes/bootstrap/theme.config.php
+++ b/themes/bootstrap/theme.config.php
@@ -33,6 +33,7 @@ return array(
             },
         ),
         'invokables' => array(
+            'highlight' => 'VuFind\View\Helper\Bootstrap\Highlight',
             'search' => 'VuFind\View\Helper\Bootstrap\Search',
             'vudl' => 'VuDL\View\Helper\Bootstrap\VuDL',
         )
-- 
GitLab