--- /dev/null
+#! /usr/bin/perl
+
+use Modern::Perl;
+use C4::Context;
+
+my $dbh=C4::Context->dbh;
+
+################
+# IntranetCoce #
+################
+
+# validate systempreferences.Coce and save the config for OpacCoce
+my $current_coce_pref = C4::Context->preference('Coce') || 0;
+
+# add two new systempreferences in order to have distinct behavior between intranet and OPAC
+$dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES
+ ('IntranetCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the staff intranet', 'YesNo'),
+ ('OpacCoce','$current_coce_pref', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo')
+ ;") or die "Error applying Bug 18421: error inserting new values into database: ". $dbh->errstr . "\n";
+
+$dbh->do("DELETE IGNORE FROM systempreferences WHERE variable = 'Coce';")
+ or die "Error applying Bug 18421: error deleting the old syspref 'Coce': ". $dbh->errstr . "\n";
+
+print "Upgrade to XX.XX done (Bug 18421: Add Coce image cache to the Intranet)\n";
('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'),
('CircSidebar','0',NULL,'Activate or deactivate the navigation sidebar on all Circulation pages','YesNo'),
('ClaimsBccCopy','0','','Bcc the ClaimAcquisition and ClaimIssues alerts','YesNo'),
-('Coce','0', NULL, 'If on, enables cover retrieval from the configured Coce server', 'YesNo'),
('CoceHost', '', NULL, 'Coce server URL', 'Free'),
('CoceProviders', '', 'aws,gb,ol', 'Coce providers', 'multiple'),
('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','YesNo'),
('IntranetBiblioDefaultView','normal','normal|marc|isbd|labeled_marc','Choose the default detail view in the staff interface; choose between normal, labeled_marc, marc or isbd','Choice'),
('intranetbookbag','1','','If ON, enables display of Cart feature in the intranet','YesNo'),
('IntranetCirculationHomeHTML', '', NULL, 'Show the following HTML in a div on the bottom of the reports home page', 'Free'),
+('IntranetCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the staff intranet', 'YesNo'),
('intranetcolorstylesheet','','50','Define the color stylesheet to use in the Staff Client','free'),
('IntranetFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','free'),
('IntranetmainUserblock','','70|10','Add a block of HTML that will display on the intranet home page','Textarea'),
('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'),
('OpacCloud','0',NULL,'If ON, enables subject cloud on OPAC','YesNo'),
('OpacAdditionalStylesheet','','','Define an auxiliary stylesheet for OPAC use, to override specified settings from the primary opac.css stylesheet. Enter the filename (if the file is in the server\'s css directory) or a complete URL beginning with http (if the file lives on a remote server).','free'),
+('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'),
('OpacCustomSearch','','70|10','Replace the search box on the OPAC with the provided HTML','Textarea'),
('opaccredits','','70|10','Define HTML Credits at the bottom of the OPAC page','Textarea'),
('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
- pref: RecordedBooksDomain
Coce Cover images cache:
-
- - pref: Coce
+ - pref: OpacCoce
choices:
yes: Enable
no: "Don't enable"
- - a Coce image cache service.
+ - a Coce image cache service in the OPAC.
+ -
+ - pref: IntranetCoce
+ choices:
+ yes: Enable
+ no: "Don't enable"
+ - a Coce image cache service in the staff intranet.
-
- Coce server URL
- pref: CoceHost
<div class="dialog message">The record you requested does not exist ([% biblionumber | html %]).</div>
[% ELSE %]
+[%
+ IntranetCoce = Koha.Preference('IntranetCoce')
+ CoceProviders = Koha.Preference('CoceProviders')
+ CoceHost = Koha.Preference('CoceHost')
+%]
+
[% INCLUDE 'cat-toolbar.inc' %]
[% IF ( ocoins ) %]
<!-- COinS / OpenURL -->
<span class="Z3988" title="[% ocoins | html %]"></span>
[% END %]
- [% IF ( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled ) %]
+ [% IF ( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled || IntranetCoce ) %]
<div id="catalogue_detail_biblio" class="col-xs-9">
[% ELSE %]
<div id="catalogue_detail_biblio" class="col-xs-12">
</span>
[% END %]
- [% IF ( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled ) %]
+ [% IF ( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled || IntranetCoce ) %]
</div><div class="col-xs-3" id="bookcoverimg">
[% IF ( LocalCoverImages ) %]
<div title="[% biblionumber |url %]" class="[% biblionumber | html %]" id="local-thumbnail-preview"></div>
<img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | html %].01.MZZZZZZZ.jpg" alt="" />
</a></div>
[% END %]
+ [% IF ( IntranetCoce && CoceProviders ) %]
+ [% coce_id = normalized_ean || normalized_isbn %]
+ <a class="p1" href="/cgi-bin/koha/catalogue/[% DetailPage %]?biblionumber=[% biblionumber |url %]">
+ [% IF ( coce_id ) %]
+ <span style="block" title="[% biblionumber |url %]" class="[% coce_id %]" id="coce-thumbnail-preview"></span>
+ [% ELSE %]
+ <span class="no-image">No cover image available</span>
+ [% END %]
+ </a>
+ [% END %]
[% END %]
</div>
[% INCLUDE 'catalog-strings.inc' %]
[% Asset.js("js/catalog.js") | $raw %]
[% INCLUDE 'greybox.inc' %]
+ <script type="text/javascript" src="[% interface %]/prog/js/coce_[% KOHA_VERSION %].js"></script>
<script>
var interface = "[% interface | html %]";
var theme = "[% theme | html %]";
[% IF LocalCoverImages %]
KOHA.LocalCover.GetCoverFromBibnumber(true);
[% END %]
+ [% IF ( IntranetCoce && CoceProviders ) %]
+ KOHA.coce.getURL('[% CoceHost %]', '[% CoceProviders %]');
+ [% END %]
+
$("body").on("click",".previewMARC", function(e){
e.preventDefault();
var page = $(this).attr("href");
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
+[%
+ IntranetCoce = Koha.Preference('IntranetCoce')
+ CoceProviders = Koha.Preference('CoceProviders')
+ CoceHost = Koha.Preference('CoceHost')
+%]
+
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
› <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
[% SET MaxSearchResultsItemsPerRecordStatusCheck = Koha.Preference('MaxSearchResultsItemsPerRecordStatusCheck') %]
[% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
<tr>
- [% IF ( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled ) %]
+ [% IF ( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled || IntranetCoce ) %]
<td>
[% IF ( LocalCoverImages) %]
<a class="p1" href="/cgi-bin/koha/catalogue/[% DetailPage | html %]?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
[% END %]
</a>
[% END # /IF AmazonCoverImages %]
+ [% IF ( IntranetCoce && CoceProviders ) %]
+ [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn %]
+ <a class="p1" href="/cgi-bin/koha/catalogue/[% DetailPage %]?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
+ [% IF ( coce_id ) %]
+ <span style="block" title="[% SEARCH_RESULT.biblionumber |url %]" class="[% coce_id %]" id="coce-thumbnail[% loop.count %]"></span>
+ [% ELSE %]
+ <span class="no-image">No cover image available</span>
+ [% END %]
+ </a>
+ [% END %]
</td>
- [% END # /IF( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled )%]
+ [% END # /IF( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled || IntranetCoce )%]
<td>
<input type="checkbox" class="selection" id="bib[% SEARCH_RESULT.biblionumber | html %]" name="biblionumber" value="[% SEARCH_RESULT.biblionumber | html %]" style="display:none" />
[% Asset.js("js/browser.js") | $raw %]
[% Asset.js("lib/hc-sticky.js") | $raw %]
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
+ [% Asset.js("prog/js/coce.js") %]
<script>
var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be placed on hold.");
KOHA.LocalCover.LoadResultsCovers();
[% END %]
+ [% IF ( IntranetCoce && CoceProviders ) %]
+ KOHA.coce.getURL('[% CoceHost %]', '[% CoceProviders %]');
+ [% END %]
+
$("#select_all").on("click",function(e){
e.preventDefault();
selectAll();
--- /dev/null
+if (KOHA === undefined || !KOHA) { var KOHA = {}; }
+
+
+/**
+ * A namespace for Coce cover images cache
+ */
+KOHA.coce = {
+
+ /**
+ * Search all:
+ * <div title="biblionumber" id="isbn" class="coce-thumbnail"></div>
+ * or
+ * <div title="biblionumber" id="isbn" class="coce-thumbnail-preview"></div>
+ * and run a search with all collected isbns to coce cover service.
+ * The result is asynchronously returned, and used to append <img>.
+ */
+ getURL: function(host,provider,newWindow) {
+ var ids = [];
+ $("[id^=coce-thumbnail]").each(function(i) {
+ var id = $(this).attr("class"); // id=isbn
+ if ( id !== '' ) { ids.push(id); }
+ });
+ if (ids.length == 0) return;
+ ids = ids.join(',');
+ var coceURL = host + '/cover?id=' + ids + '&provider=' + provider;
+ $.ajax({
+ url: coceURL,
+ dataType: 'jsonp',
+ success: function(urlPerID){
+ for (var id in urlPerID) {
+ var url = urlPerID[id];
+ $("[id^=coce-thumbnail]."+id).each(function() {
+ var img = document.createElement("img");
+ img.src = url;
+ img.title = url; //FIXME: to delete
+ $(this).html(img);
+ });
+ }
+ }
+ });
+ }
+
+};
//]]>
</script>
[% END %]
-[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
+[% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
[% Asset.js("js/coce.js") | $raw %]
<script>
//<![CDATA[
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
- [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
+ [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
[% coce_id = item.browser_normalized_ean || item.browser_normalized_isbn | html %]
<div title="[% item.biblionumber |url %]" class="[% coce_id | html %]" id="coce-thumbnail-preview-[% coce_id | html %]"></div>
[% END %]
[% IF ( GoogleJackets ) %]
<div title="[% biblio.biblionumber | html %]" class="[% normalized_isbn | html %]" id="gbs-thumbnail-preview"></div>
[% END %]
- [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
- [% coce_id = normalized_ean || normalized_isbn %]
+ [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
+ [% coce_id = normalized_ean || normalized_isbn | html %]
<div title="[% biblio.biblionumber | html %]" class="[% coce_id | html %]" id="coce-thumbnail-preview"></div>
[% END %]
[% IF OpenLibraryCovers %]
[% IF ( GoogleJackets ) %]
KOHA.Google.GetCoverFromIsbn([% covernewwindow | html %]);
[% END %]
- [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
+ [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]',[% covernewwindow | html %]);
[% END %]
[% IF ( GoogleJackets ) %]
KOHA.Google.GetCoverFromIsbn([% covernewwindow | html %]);
[% END %]
- [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
+ [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]',[% covernewwindow | html %]);
[% END %]
[% IF OpenLibraryCovers %]
[% IF ( GoogleJackets ) %]
KOHA.Google.GetCoverFromIsbn([% covernewwindow | html %]);
[% END %]
- [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
+ [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]',[% covernewwindow | html %]);
[% END %]
[% IF OpenLibraryCovers %]
[% END %]
[% END %]
- [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
- [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn %]
+ [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
+ [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn | html %]
[% IF ( coce_id ) %]
<span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% coce_id | html %]" id="coce-thumbnail[% loop.count | html %]"></span>
[% ELSE %]
[% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
[% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
[% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
-[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
+[% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]');
[% END %]