@@ -, +, @@ --- installer/data/mysql/sysprefs.sql | 3 + installer/data/mysql/updatedatabase.pl | 8 +++ .../admin/preferences/enhanced_content.pref | 19 ++++++ koha-tmpl/opac-tmpl/ccsr/en/css/opac.css | 50 +++++++++++++++ koha-tmpl/opac-tmpl/prog/en/css/opac.css | 50 +++++++++++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 65 ++++++++++++++++++++ .../opac-tmpl/prog/en/modules/opac-results.tt | 41 ++++++++++++ opac/opac-detail.pl | 4 + opac/opac-search.pl | 3 + 9 files changed, 243 insertions(+), 0 deletions(-) --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -383,3 +383,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowLibrariesPulldownMobile','1','Show the libraries pulldown on the mobile version of the OPAC.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowFiltersPulldownMobile','1','Show the search filters pulldown on the mobile version of the OPAC.',NULL,'YesNo'); INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('AuthDisplayHierarchy','0','Display authority hierarchies','','YesNo'); +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'); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -5973,6 +5973,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion ="3.09.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($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); +} $DBversion = "3.09.00.057"; if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref @@ -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 IDreamBooks.com. + - + - pref: IDreamBooksReadometer + choices: + yes: Add + no: "Don't add" + - a "Readometer" that summarizes the reviews gathered by IDreamBooks.com to the OPAC details page. + - + - pref: IDreamBooksResults + choices: + yes: Add + no: "Don't add" + - the rating from IDreamBooks.com to OPAC search results. OCLC: - - pref: XISBN --- a/koha-tmpl/opac-tmpl/ccsr/en/css/opac.css +++ a/koha-tmpl/opac-tmpl/ccsr/en/css/opac.css @@ -2637,3 +2637,53 @@ body#opac-main #opacmainuserblockmobile { .mobile_only { display : none; } + +.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; +} --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ a/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -2767,3 +2767,53 @@ body#opac-main #opacmainuserblockmobile { .mobile_only { display : none; } + +.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; +} --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -160,7 +160,60 @@ $(function () { }); // ----------------------------------------------------- [% 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(''); +[% 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(""+json.book.rating+"% rating based on reviews at iDreamBooks.com"); + + //insert data into Book reviews tab + $.each(json.book.critic_reviews, function(){ + $("#idb_review_snippets").append("