diff --git a/config/vufind/searches.ini b/config/vufind/searches.ini index 98ea375c46fd8756b41745b01bcf7cf85735e627..29ec32cf92d6b4e59e931bc2921a7f39319225e3 100644 --- a/config/vufind/searches.ini +++ b/config/vufind/searches.ini @@ -351,6 +351,10 @@ CallNumber = callnumber-sort ; ; AlphaBrowseLink:index ; Use the query to generate a link to the specified alphabrowse index +; Libraryh3lp:[type]:[id]:[skin] +; Display a chat box for the Libraryh3lp service. [type] indicats the type +; of chat being used (either "queue" or "user"). [id] is the name of the +; queue or user. [skin] is optional and specifies a skin number to use. ; SwitchQuery:[backend]:[opt-out checks to skip]:[opt-in checks to add] ; This module analyzes the user's query and offers suggestions for ways to ; improve it. [backend] is the name of the search backend currently in use, diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index d048bd0ce0a070c8ad1c423af42ed8f7810d06ec..94da5ba17a3e5752cb5fab9226bedc19e3f906c4 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -431,6 +431,7 @@ $config = [ 'alphabrowselink' => 'VuFind\Recommend\AlphaBrowseLink', 'europeanaresultsdeferred' => 'VuFind\Recommend\EuropeanaResultsDeferred', 'facetcloud' => 'VuFind\Recommend\FacetCloud', + 'libraryh3lp' => 'VuFind\Recommend\Libraryh3lp', 'openlibrarysubjects' => 'VuFind\Recommend\OpenLibrarySubjects', 'openlibrarysubjectsdeferred' => 'VuFind\Recommend\OpenLibrarySubjectsDeferred', 'pubdatevisajax' => 'VuFind\Recommend\PubDateVisAjax', diff --git a/module/VuFind/src/VuFind/Recommend/Libraryh3lp.php b/module/VuFind/src/VuFind/Recommend/Libraryh3lp.php new file mode 100644 index 0000000000000000000000000000000000000000..e6a6ed45ef5ecbaa2fe207ce786b8e4cdbfe49c5 --- /dev/null +++ b/module/VuFind/src/VuFind/Recommend/Libraryh3lp.php @@ -0,0 +1,123 @@ +<?php +/** + * Libraryh3lp Recommendations Module + * + * 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 Recommendations + * @author Demian Katz <demian.katz@villanova.edu> + * @author Chris Hallberg <challber@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:recommendation_modules Wiki + */ +namespace VuFind\Recommend; + +/** + * Libraryh3lp Recommendations Module + * + * This class provides access to the Libraryh3lp chat service. + * + * @category VuFind2 + * @package Recommendations + * @author Demian Katz <demian.katz@villanova.edu> + * @author Chris Hallberg <challber@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:recommendation_modules Wiki + */ +class Libraryh3lp implements RecommendInterface +{ + /** + * Chat identifier + * + * @var string + */ + protected $chatId; + + /** + * Widget skin number + * + * @var int + */ + protected $skin; + + /** + * Store the configuration of the recommendation module. + * + * @param string $settings Settings from searches.ini. + * + * @return void + */ + public function setConfig($settings) + { + $params = explode(':', $settings); + $this->chatId = $params[0] === 'user' + ? $params[1] . '@libraryh3lp.com' // user + : $params[1] . '@chat.libraryh3lp.com'; // queue + $this->skin = isset($params[2]) ? $params[2] : 11977; + } + + /** + * Called at the end of the Search Params objects' initFromRequest() method. + * This method is responsible for setting search parameters needed by the + * recommendation module and for reading any existing search parameters that may + * be needed. + * + * @param \VuFind\Search\Base\Params $params Search parameter object + * @param \Zend\StdLib\Parameters $request Parameter object representing user + * request. + * + * @return void + */ + public function init($params, $request) + { + } + + /** + * Called after the Search Results object has performed its main search. This + * may be used to extract necessary information from the Search Results object + * or to perform completely unrelated processing. + * + * @param \VuFind\Search\Base\Results $results Search results object + * + * @return void + */ + public function process($results) + { + } + + /** + * Get queue name + * + * @return string + */ + public function getChatId() + { + return $this->chatId; + } + + /** + * Get skin number + * + * @return int + */ + public function getSkin() + { + return $this->skin; + } +} \ No newline at end of file diff --git a/themes/bootstrap3/templates/Recommend/Libraryh3lp.phtml b/themes/bootstrap3/templates/Recommend/Libraryh3lp.phtml new file mode 100644 index 0000000000000000000000000000000000000000..623feb15aaf1d875fb56ff08dd6209df29f4eb94 --- /dev/null +++ b/themes/bootstrap3/templates/Recommend/Libraryh3lp.phtml @@ -0,0 +1 @@ +<iframe src="https://us.libraryh3lp.com/chat/<?=$this->escapeHtmlAttr($this->recommend->getChatId())?>?skin=<?=urlencode($this->recommend->getSkin())?>" frameborder="1" style="border: 2px inset black; width: 350px; height: 300px;"></iframe> \ No newline at end of file diff --git a/themes/jquerymobile/templates/Recommend/Libraryh3lp.phtml b/themes/jquerymobile/templates/Recommend/Libraryh3lp.phtml new file mode 100644 index 0000000000000000000000000000000000000000..623feb15aaf1d875fb56ff08dd6209df29f4eb94 --- /dev/null +++ b/themes/jquerymobile/templates/Recommend/Libraryh3lp.phtml @@ -0,0 +1 @@ +<iframe src="https://us.libraryh3lp.com/chat/<?=$this->escapeHtmlAttr($this->recommend->getChatId())?>?skin=<?=urlencode($this->recommend->getSkin())?>" frameborder="1" style="border: 2px inset black; width: 350px; height: 300px;"></iframe> \ No newline at end of file