Merge branch 'bug_8733' into 3.12-master

This commit is contained in:
Jared Camins-Esakov 2013-02-04 08:04:34 -05:00
commit 042d57deca
10 changed files with 250 additions and 3 deletions

View file

@ -408,3 +408,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('
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');

View file

@ -6390,6 +6390,16 @@ if ( CheckVersion($DBversion) ) {
SetVersion ($DBversion);
}
$DBversion ="3.11.00.017";
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)

View file

@ -141,6 +141,25 @@ 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='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

View file

@ -2681,3 +2681,53 @@ body#opac-main #opacmainuserblockmobile {
.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;
}

View file

@ -2840,3 +2840,53 @@ body#opac-main #opacmainuserblockmobile {
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;
}

View file

@ -181,8 +181,63 @@ $(function () {
});
});
// -----------------------------------------------------
[% END %]
[% 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", "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];
isbn = isbn.replace(/-/, '');
[% 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;
@ -416,10 +471,10 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
[% IF ( pages ) %]<span class="results_summary"><span class="label">Physical details:</span> [% pages %] [% illus %] [% size %]</span>[% END %]
[% IF ( MARCISBNS ) %]
<span class="results_summary"><span class="label">ISBN:</span>[% FOREACH MARCISBN IN MARCISBNS %][% MARCISBN.marcisbn %][% IF ( loop.last ) %].[% ELSE %]; [% END %][% END %]</span>
<span class="results_summary isbn"><span class="label">ISBN:</span>[% FOREACH MARCISBN IN MARCISBNS %][% MARCISBN.marcisbn %][% IF ( loop.last ) %].[% ELSE %]; [% END %][% END %]</span>
[% ELSE %]
[% IF ( normalized_isbn ) %]
<span class="results_summary"><span class="label">ISBN: </span>[% normalized_isbn %]</span>
<span class="results_summary isbn"><span class="label">ISBN: </span>[% normalized_isbn %]</span>
[% END %]
[% END %]
[% IF ( issn ) %]
@ -725,6 +780,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
<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 ) %]
@ -1084,6 +1142,14 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
</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' ) %]
@ -1103,6 +1169,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
<div id="BW_videos"></div>
[% END %]
</div>

View file

@ -109,6 +109,39 @@ $(document).ready(function(){
});
[% 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 ) %]
@ -650,6 +683,14 @@ $(document).ready(function(){
[% 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 &amp; 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 %]

View file

@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
use strict;
sub kohaversion {
our $VERSION = '3.11.00.016';
our $VERSION = '3.11.00.017';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install

View file

@ -998,6 +998,10 @@ 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');
if (C4::Context->preference('OpacHighlightedWords')) {
$template->{VARS}->{query_desc} = $query->param('query_desc');
}

View file

@ -833,6 +833,9 @@ if (C4::Context->preference('GoogleIndicTransliteration')) {
}
$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;