From 29830374746cb1ccc13c61f26c443920e9e8019b Mon Sep 17 00:00:00 2001 From: Katrin Fischer <katrin.fischer.83@web.de> Date: Fri, 13 Mar 2020 17:16:28 +0000 Subject: [PATCH] Bug 24854: Remove IDreamBooks integration The IDreamBooks service has not seen updates in a long time, so we should remove the service from Koha as it's no longer operational. To test: - Apply patch and run the database update - Verify that the IDreamBooks related system preferences are gone - Verify that opac detail pages and result lists still work as expected - Run t/db_dependent/UsageStats.t --- C4/UsageStats.pm | 3 -- .../atomicupdate/bug_24854-remove_idreambooks.perl | 6 +++ installer/data/mysql/sysprefs.sql | 3 -- .../admin/preferences/enhanced_content.pref | 19 ------- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 61 ---------------------- .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 44 ---------------- opac/opac-detail.pl | 3 -- opac/opac-search.pl | 3 -- t/db_dependent/UsageStats.t | 3 -- 9 files changed, 6 insertions(+), 139 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_24854-remove_idreambooks.perl diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 7b3b8ea668..5cb1361314 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -207,9 +207,6 @@ sub BuildReport { BakerTaylorEnabled GoogleJackets HTML5MediaEnabled - IDreamBooksReadometer - IDreamBooksResults - IDreamBooksReviews LibraryThingForLibrariesEnabled LocalCoverImages OPACLocalCoverImages diff --git a/installer/data/mysql/atomicupdate/bug_24854-remove_idreambooks.perl b/installer/data/mysql/atomicupdate/bug_24854-remove_idreambooks.perl new file mode 100644 index 0000000000..0f5576a9ef --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24854-remove_idreambooks.perl @@ -0,0 +1,6 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( "DELETE FROM systempreferences WHERE variable in ('IDreamBooksReadometer','IDreamBooksResults','IDreamBooksReviews')" ); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 24854 - Remove IDeamBooks* system preferences)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index fc6cb8830b..8976290307 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -228,9 +228,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('HTML5MediaEnabled','not','not|opac|staff|both','Show a tab with a HTML5 media player for files catalogued in field 856','Choice'), ('HTML5MediaExtensions','webm|ogg|ogv|oga|vtt','','Media file extensions','free'), ('HTML5MediaYouTube',0,'Embed|Don\'t embed','YouTube links as videos','YesNo'), -('IDreamBooksReadometer','0','','Display Readometer from IDreamBooks.com','YesNo'), -('IDreamBooksResults','0','','Display IDreamBooks.com rating in search results','YesNo'), -('IDreamBooksReviews','0','','Display book review snippets from IDreamBooks.com','YesNo'), ('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'), ('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'), ('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref index 2d4c1dfb10..033c048777 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref @@ -184,25 +184,6 @@ Enhanced Content: choices: yes: in tabs. no: in line with the bibliographic information. - IDreamLibraries: - - - - pref: IDreamBooksReviews - choices: - yes: Add - no: "Don't add" - - a tab on the OPAC details with book reviews from critics aggregated by <a href='https://idreambooks.com/'>IDreamBooks.com</a>. - - - - pref: IDreamBooksReadometer - choices: - yes: Add - no: "Don't add" - - a "Readometer" that summarizes the reviews gathered by <a href='https://idreambooks.com/'>IDreamBooks.com</a> to the OPAC details page. - - - - pref: IDreamBooksResults - choices: - yes: Add - no: "Don't add" - - the rating from <a href='https://idreambooks.com/'>IDreamBooks.com</a> to OPAC search results. Syndetics: - - pref: SyndeticsEnabled diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 40421dfe5f..197672c124 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -549,9 +549,6 @@ [% IF ( defaulttab == 'media' ) %]<li id="tab_html5media" class="ui-tabs-active">[% ELSE %]<li id="tab_html5media">[% END %]<a href="#html5media">Play media</a></li> [% END %] - [% IF ( IDreamBooksReviews ) %] - <li id='tab_idb_critic_reviews' style="display:none;"><a href='#idb_critic_reviews'>Book reviews by critics ( XXX )</a></li> - [% END %] </ul> [% IF ( serialcollection ) %] @@ -973,12 +970,6 @@ </div><!-- / #images --> [% END # / IF OPACLocalCoverImages && localimages.size %] - [% IF ( IDreamBooksReviews ) %] - <div id="idb_critic_reviews"> - <div id="idb_review_snippets"></div> - <span><a id="seemoreidb">More book reviews at iDreamBooks.com</a></span> - </div> - [% END %] </div> <!-- / #bibliodescriptions --> [% IF ( NovelistSelectProfile && NovelistSelectView == 'below' && ( normalized_isbn || normalized_upc ) ) %] @@ -1682,59 +1673,7 @@ [% END # / IF ( OpacStarRatings != 'disable' )%] -[% IF ( IDreamBooksReviews || IDreamBooksReadometer ) %] - var isbn = $(".isbn:last").text().split(" ")[1]; - if (isbn) { - isbn = isbn.replace(/\W*$/, ''); - isbn = isbn.replace(/-/, ''); - - if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) { - // Use Microsoft XDR for IE version 8 or above - var xdr = new XDomainRequest(); - xdr.open("get", "https://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e"); - xdr.onload = function() { - json = 'json = '+xdr.responseText; // the string now looks like.. json = { ... }; - eval(json); // json is now a regular JSON object - parseIDBJSON(json); // parse using same function as for jQuery's success event - } - xdr.send(); - } else { - $.getJSON("https://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){ - parseIDBJSON(json); - }); - } - } -[% END # / IDreamBooksReviews || IDreamBooksReadometer%] - }); - [% IF ( IDreamBooksReviews || IDreamBooksReadometer ) %] - function parseIDBJSON( json ) { - if(json.total_results > 0 && json.book.rating > 0){ - var isbn = $(".isbn:last").text().split(" ")[1]; - isbn = isbn.replace(/\W+/g, ''); - - [% IF ( IDreamBooksReadometer ) %] - $(".title").append('<a href="'+json.book.detail_link+'" id="idreambooksreadometer"><img src="https://idreambooks.com/remotereadometer/'+isbn+'.jpg" alt="'+json.book.title+_(" by ")+json.book.author+'" title="'+_("Rating based on reviews of ")+json.book.title+'"></a>'); - [% END %] - - [% IF ( IDreamBooksReviews ) %] - //build new tab for critic reviews - $("#tab_idb_critic_reviews a").text($("#tab_idb_critic_reviews a").text().replace('XXX', json.book.review_count)); - - //append happy-sad cloud review - - $("#catalogue_detail_biblio").append("<span class='idreambookssummary results_summary'><a href='"+json.book.detail_link+"'><img src='"+json.book.to_read_or_not_small+"' alt='"+json.book.title+_(" by ")+json.book.author+"' title='"+_("Rating based on reviews of ")+json.book.title+"'>"+json.book.rating+"%</a> <a href='http://www.idreambooks.com/'>"+_("rating based on reviews at iDreamBooks.com")+"</a></span>"); - - //insert data into Book reviews tab - $.each(json.book.critic_reviews, function(){ - $("#idb_review_snippets").append("<div class='review'><div><a href='"+this.review_link+"'>"+this.source+"</a></div><div>\"..."+this.snippet+"...\"</div><div>"+_("Review date: ")+this.review_date+"</div><div><a class='reviewlink' href='"+json.book.detail_link+"'>"+_("Review result: ")+this.pos_or_neg+" <img src='"+this.smiley_or_sad_small+"' alt='"+_("iDreamBooks.com rating")+"' title='"+this.pos_or_neg+"' /></a></div></div>"); - }); - $("#seemoreidb").attr('href', json.book.detail_link); - $("#tab_idb_critic_reviews").show(); - [% END %] - } - } - [% END # / IF IDreamBooksReviews || IDreamBooksReadometer %] $(document).ready(function() { if( OPACPopupAuthorsSearch == "1" ){ diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index a9bf80502e..86baa9f802 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -330,17 +330,6 @@ [% END %] [% END %] - - [% IF ( IDreamBooksResults && SEARCH_RESULT.normalized_isbn ) %] - <div class="idbresult" style="display: none;"> - [% IF ( IDreamBooksReviews ) %] - <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]#idb_critic_reviews"> - [% ELSE %] - <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]"> - [% END %] - [% SEARCH_RESULT.normalized_isbn | html %]</a> - </div> - [% END %] </div> [% IF ( COinSinOPACResults && SEARCH_RESULT.coins ) %] <!-- COinS / Openurl --> @@ -722,39 +711,6 @@ $(document).ready(function(){ e.preventDefault(); }); - [% IF ( IDreamBooksResults ) %] - $('.idbresult').each(function() { - var isbn = $(this).children('a').text().replace(/\s*/,''); - var element = this; - - if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) { - // Use Microsoft XDR for IE version 8 or above - var xdr = new XDomainRequest(); - xdr.open("get", "https://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e"); - xdr.onload = function() { - json = 'json = '+xdr.responseText; // the string now looks like.. json = { ... }; - eval(json); // json is now a regular JSON object - if(json.total_results > 0 && json.book.rating > 0){ - $(element).children('a').html("<img src='"+json.book.to_read_or_not_small+"' alt='"+json.book.title+_(" by ")+json.book.author+"' title='"+_("Rating based on reviews of ")+json.book.title+"'>"+json.book.rating+"%"); - $(element).show(); - } else { - $(element).remove(); - } - } - xdr.send(); - } else { - $.getJSON("https://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){ - if(json.total_results > 0 && json.book.rating > 0){ - $(element).children('a').html("<img src='"+json.book.to_read_or_not_small+"' alt='"+json.book.title+_(" by ")+json.book.author+"' title='"+_("Rating based on reviews of ")+json.book.title+"'>"+json.book.rating+"%"); - $(element).show(); - } else { - $(element).remove(); - } - }); - } - }); - [% END %] - var param1 = ""; [% IF ( ( Koha.Preference( 'opacbookbag' ) == 1 ) || ( Koha.Preference( 'virtualshelves' ) == 1 ) || loggedinusername ) %] param1 += "<span id=\"selections\">"+_("Select titles to: ")+"</span>"; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index e58cf8b65d..f1100878bd 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -1195,9 +1195,6 @@ if (C4::Context->preference('OPACLocalCoverImages') == 1) { $template->{VARS}->{localimages} = \@images; } -$template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews'); -$template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer'); -$template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults'); $template->{VARS}->{OPACPopupAuthorsSearch} = C4::Context->preference('OPACPopupAuthorsSearch'); if (C4::Context->preference('OpacHighlightedWords')) { diff --git a/opac/opac-search.pl b/opac/opac-search.pl index a3a766ac7d..01887f283a 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -1023,9 +1023,6 @@ if (C4::Context->preference('GoogleIndicTransliteration')) { $template->{VARS}->{DidYouMean} = ( defined C4::Context->preference('OPACdidyoumean') && C4::Context->preference('OPACdidyoumean') =~ m/enable/ ); -$template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews'); -$template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer'); -$template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults'); if ($offset == 0) { $template->param(firstPage => 1); diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t index 6b8db7e641..9241b27b58 100644 --- a/t/db_dependent/UsageStats.t +++ b/t/db_dependent/UsageStats.t @@ -468,9 +468,6 @@ sub mocking_systempreferences_to_a_set_value { BakerTaylorEnabled GoogleJackets HTML5MediaEnabled - IDreamBooksReadometer - IDreamBooksResults - IDreamBooksReviews LibraryThingForLibrariesEnabled LocalCoverImages OPACLocalCoverImages -- 2.11.0