INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free');
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded <style> tag.', 'free');
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free');
+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');
+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');
+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');
SetVersion ($DBversion);
}
+$DBversion ="3.11.00.XXX";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');");
+ $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');");
+ $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');");
+ print "Upgrade to $DBversion done (Add IDreamBooks enhanced content)\n";
+ SetVersion($DBversion);
+}
+
+
=head1 FUNCTIONS
=head2 TableExists($table)
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='http://idreambooks.com/'>IDreamBooks.com</a>.
+ -
+ - pref: IDreamBooksReadometer
+ choices:
+ yes: Add
+ no: "Don't add"
+ - a "Readometer" that summarizes the reviews gathered by <a href='http://idreambooks.com/'>IDreamBooks.com</a> to the OPAC details page.
+ -
+ - pref: IDreamBooksResults
+ choices:
+ yes: Add
+ no: "Don't add"
+ - the rating from <a href='http://idreambooks.com/'>IDreamBooks.com</a> to OPAC search results.
OCLC:
-
- pref: XISBN
.tagweight9 {
font-size: 30px;
}
+
+.review {
+ margin-bottom: 20px;
+}
+
+#idreambooksreadometer {
+ float: right;
+}
+a.idreambooksrating {
+ font-size: 30px;
+ color: #29ADE4;
+ padding-left: 85px;
+ line-height: 30px;
+ text-decoration: none;
+}
+
+.idreambookslegend {
+ font-size: small;
+}
+
+a.reviewlink,a.reviewlink:visited {
+ text-decoration: none;
+ color: black;
+ font-weight: normal;
+}
+
+.idreambookssummary a {
+ color: #707070;
+ text-decoration: none;
+}
+
+.idreambookssummary img, .idbresult img {
+ vertical-align: middle;
+}
+
+.idbresult {
+ color: #29ADE4;
+ text-align: center;
+ margin: 0.5em;
+ padding: 0.5em;
+}
+
+.idbresult a, .idbresult a:visited {
+ text-decoration: none;
+ color: #29ADE4;
+}
+
+.idbresult img {
+ padding-right: 6px;
+}
video {
width: 480px;
}
+
+.review {
+ margin-bottom: 20px;
+}
+
+#idreambooksreadometer {
+ float: right;
+}
+a.idreambooksrating {
+ font-size: 30px;
+ color: #29ADE4;
+ padding-left: 85px;
+ line-height: 30px;
+ text-decoration: none;
+}
+
+.idreambookslegend {
+ font-size: small;
+}
+
+a.reviewlink,a.reviewlink:visited {
+ text-decoration: none;
+ color: black;
+ font-weight: normal;
+}
+
+.idreambookssummary a {
+ color: #707070;
+ text-decoration: none;
+}
+
+.idreambookssummary img, .idbresult img {
+ vertical-align: middle;
+}
+
+.idbresult {
+ color: #29ADE4;
+ text-align: center;
+ margin: 0.5em;
+ padding: 0.5em;
+}
+
+.idbresult a, .idbresult a:visited {
+ text-decoration: none;
+ color: #29ADE4;
+}
+
+.idbresult img {
+ padding-right: 6px;
+}
});
});
// -----------------------------------------------------
+[% END %]
+[% IF ( IDreamBooksReviews || IDreamBooksReadometer ) %]
+ var isbn = $(".isbn:last").text().split(" ")[1];
+ if (isbn) {
+ isbn = isbn.replace(/\W*$/, '');
+
+ 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", "http://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("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
+ parseIDBJSON(json);
+ });
+ }
+ }
+
[% END %]
});
+[% IF ( IDreamBooksReviews || IDreamBooksReadometer ) %]
+function parseIDBJSON( json ) {
+ if(json.total_results > 0 && json.book.rating > 0){
+ var isbn = $(".isbn:last").text().split(" ")[1];
+
+[% IF ( IDreamBooksReadometer ) %]
+ $(".title").append('<a href="'+json.book.detail_link+'" id="idreambooksreadometer"><img src="http://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 ( OpacBrowseResults && busc ) %]
var timeoutRFW;
<li id="tab_html5media"><a href="#html5media">Play media</a></li>
[% END %][% 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 ) %]
</div>
[% END %]
+[% 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>
[% IF ( NovelistSelectProfile ) %][% IF ( NovelistSelectView == 'below' ) %]
<div id="BW_videos"></div>
[% END %]
+
</div>
});
[% END %]
+ [% 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", "http://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("http://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 %]
+
[% IF ( opacbookbag ) %]$(".addtocart").show();[% END %]
[% IF ( opacbookbag ) %]
[% IF OpenLibraryCovers %][% IF SEARCH_RESULT.normalized_isbn %]<span style="block" title="[% SEARCH_RESULT.biblionumber %]" class="[% SEARCH_RESULT.normalized_isbn %]" id="openlibrary-thumbnail[% loop.count %]"></span>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
</a>
[% IF ( BakerTaylorEnabled ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<a href="https://[% BakerTaylorBookstoreURL |html %][% SEARCH_RESULT.normalized_isbn %]"><img alt="See Baker & Taylor" src="[% BakerTaylorImageURL |html %][% SEARCH_RESULT.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
+ [% IF ( IDreamBooksResults ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<div class="idbresult" style="display: none;">
+ [% IF ( IDreamBooksReviews ) %]
+ <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]#idb_critic_reviews">
+ [% ELSE %]
+ <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">
+ [% END %]
+ [% SEARCH_RESULT.normalized_isbn %]</a></div>
+ [% END %][% END %]
</td>
</tr>
[% END %]
$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');
+
if (C4::Context->preference('OpacHighlightedWords')) {
$template->{VARS}->{query_desc} = $query->param('query_desc');
}
}
$template->{VARS}->{DidYouMean} = 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');
$template->param( borrowernumber => $borrowernumber);
output_with_http_headers $cgi, $cookie, $template->output, $content_type;