From d4bc889e9f31c702524a58544dc6821349d19d74 Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Thu, 28 Sep 2023 19:52:48 +0000 Subject: [PATCH 01/13] LibGuides and AZ: Display descriptions --- config/vufind/LibGuides.ini | 8 ++- .../Factory/LibGuidesBackendFactory.php | 6 +- .../Backend/LibGuides/Connector.php | 55 ++++++++++++++----- .../RecordDriver/LibGuides/result-list.phtml | 7 +++ 4 files changed, 60 insertions(+), 16 deletions(-) diff --git a/config/vufind/LibGuides.ini b/config/vufind/LibGuides.ini index 68a8f2bd4e8..7fa7a2c40ee 100644 --- a/config/vufind/LibGuides.ini +++ b/config/vufind/LibGuides.ini @@ -4,7 +4,8 @@ timeout = 30 ; Your institution id (called site id in api version 2; may have changed w/ upgrade) -iid = my-id +; # iid = my-id +iid = 480 ; API version to use (1 or 2) version = 2 @@ -31,4 +32,7 @@ default_limit = 20 ; string that can then be used to retrieve those guides here. Note that when ; changing tags, you may need to wait some time for content to be reindexed on ; the LibGuides end before the search will begin working here. -;defaultSearch = "general" \ No newline at end of file +;defaultSearch = "general" + +; Parse and display the description below each title +; displayDescription = true diff --git a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php index 87443fd49ed..c1a566422a9 100644 --- a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php @@ -131,12 +131,16 @@ protected function createConnector() // Get base URI, if available: $baseUrl = $this->libGuidesConfig->General->baseUrl ?? null; + // Optionally parse the resource description + $displayDescription = $this->libGuidesConfig->General->displayDescription ?? null; + // Create connector: $connector = new Connector( $iid, $this->createHttpClient($this->libGuidesConfig->General->timeout ?? 30), $ver, - $baseUrl + $baseUrl, + $displayDescription ); $connector->setLogger($this->logger); return $connector; diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php index a041eba0ee2..5577d3a0bef 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php @@ -78,17 +78,25 @@ class Connector implements \Laminas\Log\LoggerAwareInterface */ protected $apiVersion; + /** + * Optionally load & display the description of each resource + * + * @var boolean + */ + protected $displayDescription; + /** * Constructor * * Sets up the LibGuides Client * - * @param string $iid Institution ID - * @param HttpClient $client HTTP client - * @param float $apiVersion API version number - * @param string $baseUrl API base URL (optional) + * @param string $iid Institution ID + * @param HttpClient $client HTTP client + * @param float $apiVersion API version number + * @param string $baseUrl API base URL (optional) + * @param boolean $displayDescription Optionally load & display the description of each resource */ - public function __construct($iid, $client, $apiVersion = 1, $baseUrl = null) + public function __construct($iid, $client, $apiVersion = 1, $baseUrl = null, $displayDescription = false) { $this->apiVersion = $apiVersion; if (empty($baseUrl)) { @@ -101,6 +109,7 @@ public function __construct($iid, $client, $apiVersion = 1, $baseUrl = null) } $this->iid = $iid; $this->client = $client; + $this->displayDescription = $displayDescription; } /** @@ -187,15 +196,35 @@ protected function process($data) $items = []; - // Extract titles and URLs from response: - $regex = '/]*>([^<]*)(.*?)<\/li>/'; + $linkRegex = '/]*>([^<]*)(.*?)<\/div>/'; + + // Extract each result item + $itemCount = preg_match_all($itemRegex, $data, $itemMatches); - for ($i = 0; $i < $count; $i++) { - $items[] = [ - 'id' => $matches[1][$i], // ID = URL - 'title' => $matches[2][$i], + for ($i = 0; $i < $itemCount; $i++) { + // Extract the link, which contains both the title and URL. + $linkCount = preg_match_all($linkRegex, $itemMatches[1][$i], $linkMatches); + if ($linkCount != 1) { + throw new \Exception('LibGuides result item included more than one link: ' . $itemMatches[1][$i]); + } + $item = [ + 'id' => $linkMatches[1][0], // ID = URL + 'title' => $linkMatches[2][0], ]; + + // Extract the descrpition. + if ($this->displayDescription) { + $descriptionCount = preg_match_all($descriptionRegex, $itemMatches[1][$i], $descriptionMatches); + if ($descriptionCount > 1) { + throw new \Exception('LibGuides result item included more than one description: ' . + $itemMatches[1][$i]); + } + $item['description'] = $descriptionMatches[1][0]; + } + + $items[] = $item; } $results = [ @@ -233,7 +262,7 @@ protected function prepareParams(array $params) 'list_format' => 1, 'output_format' => 1, 'load_type' => 2, - 'enable_description' => 0, + 'enable_description' => 1, 'enable_group_search_limit' => 0, 'enable_subject_search_limit' => 0, 'widget_embed_type' => 2, diff --git a/themes/bootstrap3/templates/RecordDriver/LibGuides/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/LibGuides/result-list.phtml index 0f15374cdbf..648825eeaf2 100644 --- a/themes/bootstrap3/templates/RecordDriver/LibGuides/result-list.phtml +++ b/themes/bootstrap3/templates/RecordDriver/LibGuides/result-list.phtml @@ -10,5 +10,12 @@ + driver->getSummary() as $summaryItem): ?> + +
+ escapeHtml($summaryItem)?> +
+ + From 74070cbaab97f516c0bf530866acb6ea374ecefe Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Thu, 28 Sep 2023 20:19:54 +0000 Subject: [PATCH 02/13] Fix config file default iid --- config/vufind/LibGuides.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/vufind/LibGuides.ini b/config/vufind/LibGuides.ini index 7fa7a2c40ee..8e575bdb780 100644 --- a/config/vufind/LibGuides.ini +++ b/config/vufind/LibGuides.ini @@ -4,8 +4,7 @@ timeout = 30 ; Your institution id (called site id in api version 2; may have changed w/ upgrade) -; # iid = my-id -iid = 480 +iid = my-id ; API version to use (1 or 2) version = 2 From 4f33e9d3f911b5095849242b76464e628e08a0d9 Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Thu, 28 Sep 2023 20:45:26 +0000 Subject: [PATCH 03/13] Fix spacing in disabled property --- config/vufind/LibGuides.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/vufind/LibGuides.ini b/config/vufind/LibGuides.ini index 8e575bdb780..e81126bb21a 100644 --- a/config/vufind/LibGuides.ini +++ b/config/vufind/LibGuides.ini @@ -34,4 +34,4 @@ default_limit = 20 ;defaultSearch = "general" ; Parse and display the description below each title -; displayDescription = true +;displayDescription = true From 7e6ab2d121e3d25f47418578835286f4e33dcaff Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Thu, 28 Sep 2023 20:47:11 +0000 Subject: [PATCH 04/13] Fixe default for $displayDescription --- .../src/VuFind/Search/Factory/LibGuidesBackendFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php index c1a566422a9..8d1d6d3c5aa 100644 --- a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php @@ -132,7 +132,7 @@ protected function createConnector() $baseUrl = $this->libGuidesConfig->General->baseUrl ?? null; // Optionally parse the resource description - $displayDescription = $this->libGuidesConfig->General->displayDescription ?? null; + $displayDescription = $this->libGuidesConfig->General->displayDescription ?? false; // Create connector: $connector = new Connector( From aec5fc8bab6c9e40320ce75a5e656598fd3c91dc Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Fri, 29 Sep 2023 15:45:51 +0000 Subject: [PATCH 05/13] Fix typo --- .../src/VuFindSearch/Backend/LibGuides/Connector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php index 5577d3a0bef..39321fc100c 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php @@ -214,7 +214,7 @@ protected function process($data) 'title' => $linkMatches[2][0], ]; - // Extract the descrpition. + // Extract the description. if ($this->displayDescription) { $descriptionCount = preg_match_all($descriptionRegex, $itemMatches[1][$i], $descriptionMatches); if ($descriptionCount > 1) { From d65a38a25dc7fdbc4699732b5f1dd15e46a47736 Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Fri, 29 Sep 2023 15:54:54 +0000 Subject: [PATCH 06/13] Use first description, if 1+ are present --- .../src/VuFindSearch/Backend/LibGuides/Connector.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php index 39321fc100c..b2a0224be67 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php @@ -217,11 +217,9 @@ protected function process($data) // Extract the description. if ($this->displayDescription) { $descriptionCount = preg_match_all($descriptionRegex, $itemMatches[1][$i], $descriptionMatches); - if ($descriptionCount > 1) { - throw new \Exception('LibGuides result item included more than one description: ' . - $itemMatches[1][$i]); + if ($descriptionCount >= 1) { + $item['description'] = $descriptionMatches[1][0]; } - $item['description'] = $descriptionMatches[1][0]; } $items[] = $item; From c405bea3a66bee6463927f904f43440a9fe98657 Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Fri, 29 Sep 2023 16:04:25 +0000 Subject: [PATCH 07/13] Don't set enable_description if it won't be used --- .../src/VuFindSearch/Backend/LibGuides/Connector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php index b2a0224be67..fbc778ff217 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php @@ -260,7 +260,7 @@ protected function prepareParams(array $params) 'list_format' => 1, 'output_format' => 1, 'load_type' => 2, - 'enable_description' => 1, + 'enable_description' => $this->displayDescription ? 1 : 0, 'enable_group_search_limit' => 0, 'enable_subject_search_limit' => 0, 'widget_embed_type' => 2, From 84f239accae7253c9604120e08cdc0b2fa8adb24 Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Fri, 29 Sep 2023 18:05:18 +0000 Subject: [PATCH 08/13] Update fixture to match current responses, fix tests --- .../tests/fixtures/libguides/response/search | Bin 1685 -> 11953 bytes .../Backend/LibGuides/BackendTest.php | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/VuFindSearch/tests/fixtures/libguides/response/search b/module/VuFindSearch/tests/fixtures/libguides/response/search index ac5d9f21104b5525240fc10a3a7953185a5f8337..29176e428a883f9e78e4eebcabef46221ac23a28 100644 GIT binary patch literal 11953 zcmd5?T~8x97JWzJKV0$9OSjsPRG?|nzzV`wcA-0)N>8izW#m*jDGyb4ja>z#pXNu* zFWg_U$F2mJsjynDw31&CiEkx7x%R#1o_nt+lhJNOQKv(j8&;TmVfv)zQax^Nq`VS+ zx-{}VMTZoN5@u14x(EIJgMRmru5Krr8;MqxP!+2dC5$WaSnXz2k$<8jo^g8ys&~%iO0Joim>2`hjU9v4cLndu6>4Ri;zhr>l#} z`_Y#e+xXMx6#S9#IX2YobUK?Gk8H}5JE2mxf|$!GFH6g6%ep(ZG}z37KiHi_7tZ`8 zDyGXyYK5;;+A2Al;fJb>On}*NWlL=;d~8x1Spnhln~!_l{oV(B`6rSp$?H_a_4Hg9 zTq^sCN+WX3)6I>|jiWk0Im+e95vRP7D||?~MHM%5{K{KDPjjyBwoWEkp%Iq2;cnY>3ojbUb4xRA=*sZ4#yb=znbtXN zpWP1L9!W}aZtd~bjMI!WI8hkIbCyeWM%HHPg-#Civ^H{ZIHTD+IT-5w?x;QYv?TXk-__VRZt4#8pZcX`Oi7c)*Xy zeo%NoO8{`r{O`f$dM=YEbZ=;djd(@z12zT}v=}x^V{Zkf&z`x;PY0h1S457_}A*}1#Ao(+`kY+?1V{`b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ZlbBZv4HA4C>l83 zy!($dy#b>KT;Yt{$l{pX>^Dg?JA_-B-fMEj+g~L@B!=? z5r|^Q!-#TP!*CA$C*(FR%%$&P30W83R+cHb-DyzENxK!r0&$qT)1w^@WAts9?27q# zZ<3L%?%JKJ@E!T2IX%y^s_&g(EL!gjNg39KN_M$0x5(Z{wH9_Q!gK!`{m&%tgE#6+ zQdB9+Ll)>y9O4drYS}zcv=ieAl@##NpQhaUn_?=9kntFP&H9TpM7r@n|0z#7%i3Pj zSAmV!zZBOe_MDmg9Y3C#`IBa38quX>%&nSuGc#l}u~}gwy=qwBhcdrX#xO{N*Gs{B zSEF7s;y;>P%(S)pLS(k(;M<#pKlr|@Dq_Le;NW}KY`3dvX_oLTpQWtFK*fg=~%kfh+of5bVbjcW0r;;WtD2+?D z49~o1wxxQH=%6qQM(NqTdK_5~*xhWZe%PG1_mVW@gEYfxw$rfLM)%*zeYb~7botaL zQcgo#?M8TmTx`5<3SVY@+2Rb5Fm|-H`Sj=sE8ieF8j)n>8*IUmyl933@-nrMe--AV zSieNUy=I}oe-4{zn=Y=87wpU7KXg4NBR;yjo_wTaR#7x4*#N_`!){SplOCvw`k>*w z|Ge|{rwaG*c)d5gsWf>u;hbhBnDjZIG+<9@xAuz0kDmoFWCFBAN{t7E{$ zIQMATM{b>OM#YJr=$e7fhtZMwO^DyxbBg0`4XGbP=haGAN=Gos>BiS)YR|~mfX{=f zLGl_yW83HQyHOq6cYNr~-1$7w2l;$7@kmYH&v(QDId3l;%wP5G3enyk_FL2se_gxP JXtj>ce*qhK^Fsgt diff --git a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/LibGuides/BackendTest.php b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/LibGuides/BackendTest.php index f17e1af5ccf..461e1c9e203 100644 --- a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/LibGuides/BackendTest.php +++ b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/LibGuides/BackendTest.php @@ -82,13 +82,13 @@ public function testSearch() $this->assertEquals('test', $coll->getSourceIdentifier()); $rec = $coll->first(); $this->assertEquals('test', $rec->getSourceIdentifier()); - $this->assertEquals('http://libguides.brynmawr.edu/tests-measures?hs=a', $rec->getUniqueID()); + $this->assertEquals('https://guides.tricolib.brynmawr.edu/testprep', $rec->getUniqueID()); $recs = $coll->getRecords(); $this->assertEquals('test', $recs[1]->getSourceIdentifier()); - $this->assertEquals('http://libguides.brynmawr.edu/psyctests-measures?hs=a', $recs[1]->getUniqueID()); + $this->assertEquals('https://guides.tricolib.brynmawr.edu/tests-measures', $recs[1]->getUniqueID()); $this->assertEquals('test', $recs[2]->getSourceIdentifier()); - $this->assertEquals('http://libguides.brynmawr.edu/social-work?hs=a', $recs[2]->getUniqueID()); - $this->assertEquals(40, $coll->getTotal()); + $this->assertEquals('https://guides.tricolib.brynmawr.edu/psyctests-measures', $recs[2]->getUniqueID()); + $this->assertEquals(53, $coll->getTotal()); $this->assertEquals(0, $coll->getOffset()); } From bbda75617a1343b9716c1b2cbb09a1f6812c4468 Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Fri, 29 Sep 2023 18:14:34 +0000 Subject: [PATCH 09/13] Add new property to LibGuidesAZ.ini as well --- config/vufind/LibGuidesAZ.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/config/vufind/LibGuidesAZ.ini b/config/vufind/LibGuidesAZ.ini index f6ad12856e7..77558af81d0 100644 --- a/config/vufind/LibGuidesAZ.ini +++ b/config/vufind/LibGuidesAZ.ini @@ -12,3 +12,4 @@ relative_path = ./LibGuides.ini ;default_limit = 20 ;limit_options = 10,20,40,60,80,100 ;defaultSearch = "general" +;displayDescription = true From aea92773a9634c0209e0e429d8c6821f48c74329 Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Fri, 29 Sep 2023 18:24:17 +0000 Subject: [PATCH 10/13] Add a css class to the summary, for any local styling --- .../templates/RecordDriver/LibGuides/result-list.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/bootstrap3/templates/RecordDriver/LibGuides/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/LibGuides/result-list.phtml index 648825eeaf2..d7b3a4f0b72 100644 --- a/themes/bootstrap3/templates/RecordDriver/LibGuides/result-list.phtml +++ b/themes/bootstrap3/templates/RecordDriver/LibGuides/result-list.phtml @@ -12,7 +12,7 @@ driver->getSummary() as $summaryItem): ?> -
+
escapeHtml($summaryItem)?>
From 3b76649c0adbadd18a3ed19c9db1d1503d500275 Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Tue, 3 Oct 2023 15:29:31 +0000 Subject: [PATCH 11/13] Strip tags and decode entities on description --- .../src/VuFindSearch/Backend/LibGuides/Connector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php index fbc778ff217..d4191b8760d 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php @@ -218,7 +218,7 @@ protected function process($data) if ($this->displayDescription) { $descriptionCount = preg_match_all($descriptionRegex, $itemMatches[1][$i], $descriptionMatches); if ($descriptionCount >= 1) { - $item['description'] = $descriptionMatches[1][0]; + $item['description'] = strip_tags(html_entity_decode($descriptionMatches[1][0])); } } From 86c7ca9a24bfad8a4e51b08a97ae41f4407eb01c Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Tue, 3 Oct 2023 15:39:25 +0000 Subject: [PATCH 12/13] Fix order of html protection --- .../src/VuFindSearch/Backend/LibGuides/Connector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php index d4191b8760d..349f5fbdf8e 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php @@ -218,7 +218,7 @@ protected function process($data) if ($this->displayDescription) { $descriptionCount = preg_match_all($descriptionRegex, $itemMatches[1][$i], $descriptionMatches); if ($descriptionCount >= 1) { - $item['description'] = strip_tags(html_entity_decode($descriptionMatches[1][0])); + $item['description'] = html_entity_decode(strip_tags($descriptionMatches[1][0])); } } From 9a0d7ecbc8084f26a83d224e838fb3f5e3e9a289 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Tue, 3 Oct 2023 11:53:00 -0400 Subject: [PATCH 13/13] Adjust type in comment. --- .../src/VuFindSearch/Backend/LibGuides/Connector.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php index 349f5fbdf8e..09bdaa6a804 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php @@ -81,7 +81,7 @@ class Connector implements \Laminas\Log\LoggerAwareInterface /** * Optionally load & display the description of each resource * - * @var boolean + * @var bool */ protected $displayDescription; @@ -94,7 +94,7 @@ class Connector implements \Laminas\Log\LoggerAwareInterface * @param HttpClient $client HTTP client * @param float $apiVersion API version number * @param string $baseUrl API base URL (optional) - * @param boolean $displayDescription Optionally load & display the description of each resource + * @param bool $displayDescription Optionally load & display the description of each resource */ public function __construct($iid, $client, $apiVersion = 1, $baseUrl = null, $displayDescription = false) {