View | Details | Raw Unified | Return to bug 8733
Collapse All | Expand All

(-)a/installer/data/mysql/sysprefs.sql (+3 lines)
Lines 408-410 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
408
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');
408
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');
409
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');
409
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');
410
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free');
410
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free');
411
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');
412
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');
413
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 (+10 lines)
Lines 6390-6395 if ( CheckVersion($DBversion) ) { Link Here
6390
   SetVersion ($DBversion);
6390
   SetVersion ($DBversion);
6391
}
6391
}
6392
6392
6393
$DBversion ="3.11.00.XXX";
6394
if ( CheckVersion($DBversion) ) {
6395
    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');");
6396
    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');");
6397
    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');");
6398
    print "Upgrade to $DBversion done (Add IDreamBooks enhanced content)\n";
6399
    SetVersion($DBversion);
6400
}
6401
6402
6393
=head1 FUNCTIONS
6403
=head1 FUNCTIONS
6394
6404
6395
=head2 TableExists($table)
6405
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref (+19 lines)
Lines 141-146 Enhanced Content: Link Here
141
              choices:
141
              choices:
142
                  yes: in tabs.
142
                  yes: in tabs.
143
                  no: in line with the bibliographic information.
143
                  no: in line with the bibliographic information.
144
    IDreamLibraries:
145
        -
146
            - pref: IDreamBooksReviews
147
              choices:
148
                  yes: Add
149
                  no: "Don't add"
150
            - a tab on the OPAC details with book reviews from critics aggregated by <a href='http://idreambooks.com/'>IDreamBooks.com</a>.
151
        -
152
            - pref: IDreamBooksReadometer
153
              choices:
154
                  yes: Add
155
                  no: "Don't add"
156
            - a "Readometer" that summarizes the reviews gathered by <a href='http://idreambooks.com/'>IDreamBooks.com</a> to the OPAC details page.
157
        -
158
            - pref: IDreamBooksResults
159
              choices:
160
                  yes: Add
161
                  no: "Don't add"
162
            - the rating from <a href='http://idreambooks.com/'>IDreamBooks.com</a> to OPAC search results.
144
    OCLC:
163
    OCLC:
145
        -
164
        -
146
            - pref: XISBN
165
            - pref: XISBN
(-)a/koha-tmpl/opac-tmpl/ccsr/en/css/opac.css (+50 lines)
Lines 2681-2683 body#opac-main #opacmainuserblockmobile { Link Here
2681
.tagweight9 {
2681
.tagweight9 {
2682
    font-size: 30px;
2682
    font-size: 30px;
2683
}
2683
}
2684
2685
.review {
2686
    margin-bottom: 20px;
2687
}
2688
2689
#idreambooksreadometer {
2690
    float: right;
2691
}
2692
a.idreambooksrating {
2693
    font-size: 30px;
2694
    color: #29ADE4;
2695
    padding-left: 85px;
2696
    line-height: 30px;
2697
    text-decoration: none;
2698
}
2699
2700
.idreambookslegend {
2701
    font-size: small;
2702
}
2703
2704
a.reviewlink,a.reviewlink:visited {
2705
    text-decoration: none;
2706
    color: black;
2707
    font-weight: normal;
2708
}
2709
2710
.idreambookssummary a {
2711
    color: #707070;
2712
    text-decoration: none;
2713
}
2714
2715
.idreambookssummary img, .idbresult img {
2716
    vertical-align: middle;
2717
}
2718
2719
.idbresult {
2720
    color: #29ADE4;
2721
    text-align: center;
2722
    margin: 0.5em;
2723
    padding: 0.5em;
2724
}
2725
2726
.idbresult a, .idbresult a:visited {
2727
    text-decoration: none;
2728
    color: #29ADE4;
2729
}
2730
2731
.idbresult img {
2732
    padding-right: 6px;
2733
}
(-)a/koha-tmpl/opac-tmpl/prog/en/css/opac.css (+50 lines)
Lines 2840-2842 body#opac-main #opacmainuserblockmobile { Link Here
2840
video {
2840
video {
2841
    width: 480px;
2841
    width: 480px;
2842
}
2842
}
2843
2844
.review {
2845
    margin-bottom: 20px;
2846
}
2847
2848
#idreambooksreadometer {
2849
    float: right;
2850
}
2851
a.idreambooksrating {
2852
    font-size: 30px;
2853
    color: #29ADE4;
2854
    padding-left: 85px;
2855
    line-height: 30px;
2856
    text-decoration: none;
2857
}
2858
2859
.idreambookslegend {
2860
    font-size: small;
2861
}
2862
2863
a.reviewlink,a.reviewlink:visited {
2864
    text-decoration: none;
2865
    color: black;
2866
    font-weight: normal;
2867
}
2868
2869
.idreambookssummary a {
2870
    color: #707070;
2871
    text-decoration: none;
2872
}
2873
2874
.idreambookssummary img, .idbresult img {
2875
    vertical-align: middle;
2876
}
2877
2878
.idbresult {
2879
    color: #29ADE4;
2880
    text-align: center;
2881
    margin: 0.5em;
2882
    padding: 0.5em;
2883
}
2884
2885
.idbresult a, .idbresult a:visited {
2886
    text-decoration: none;
2887
    color: #29ADE4;
2888
}
2889
2890
.idbresult img {
2891
    padding-right: 6px;
2892
}
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (+65 lines)
Lines 182-188 $(function () { Link Here
182
});
182
});
183
// -----------------------------------------------------
183
// -----------------------------------------------------
184
[% END %]
184
[% END %]
185
[% IF ( IDreamBooksReviews || IDreamBooksReadometer ) %]
186
        var isbn = $(".isbn:last").text().split(" ")[1];
187
        if (isbn) {
188
        isbn = isbn.replace(/\W*$/, '');
189
190
        if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
191
        // Use Microsoft XDR for IE version 8 or above
192
            var xdr = new XDomainRequest();
193
            xdr.open("get", "http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
194
            xdr.onload = function() {
195
                json = 'json = '+xdr.responseText; // the string now looks like..  json = { ... };
196
                eval(json); // json is now a regular JSON object
197
                parseIDBJSON(json); // parse using same function as for jQuery's success event
198
            }
199
            xdr.send();
200
        } else {
201
            $.getJSON("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
202
                parseIDBJSON(json);
203
            });
204
        }
205
    }
206
207
[% END %]
185
});
208
});
209
[% IF ( IDreamBooksReviews || IDreamBooksReadometer ) %]
210
function parseIDBJSON( json ) {
211
    if(json.total_results > 0 && json.book.rating > 0){
212
        var isbn = $(".isbn:last").text().split(" ")[1];
213
214
[% IF ( IDreamBooksReadometer ) %]
215
        $(".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>');
216
[% END %]
217
218
219
[% IF ( IDreamBooksReviews ) %]
220
        //build new tab for critic reviews
221
        $("#tab_idb_critic_reviews a").text($("#tab_idb_critic_reviews a").text().replace('XXX', json.book.review_count));
222
223
        //append happy-sad cloud review
224
225
        $("#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>");
226
227
        //insert data into Book reviews tab
228
        $.each(json.book.critic_reviews, function(){
229
                $("#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>");
230
                });
231
        $("#seemoreidb").attr('href', json.book.detail_link);
232
        $("#tab_idb_critic_reviews").show();
233
[% END %]
234
235
    }
236
237
}
238
[% END %]
186
239
187
[% IF ( OpacBrowseResults && busc ) %]
240
[% IF ( OpacBrowseResults && busc ) %]
188
var timeoutRFW;
241
var timeoutRFW;
Lines 725-730 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
725
    <li id="tab_html5media"><a href="#html5media">Play media</a></li>
778
    <li id="tab_html5media"><a href="#html5media">Play media</a></li>
726
[% END %][% END %]
779
[% END %][% END %]
727
780
781
[% IF ( IDreamBooksReviews ) %]
782
    <li id='tab_idb_critic_reviews' style="display:none;"><a href='#idb_critic_reviews'>Book reviews by critics ( XXX )</a></li>
783
[% END %]
728
</ul>
784
</ul>
729
785
730
[% IF ( serialcollection ) %]
786
[% IF ( serialcollection ) %]
Lines 1084-1089 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1084
</div>
1140
</div>
1085
[% END %]
1141
[% END %]
1086
1142
1143
[% IF ( IDreamBooksReviews ) %]
1144
    <div id="idb_critic_reviews">
1145
        <div id="idb_review_snippets">
1146
        </div>
1147
        <span><a id="seemoreidb">More book reviews at iDreamBooks.com</a></span>
1148
    </div>
1149
[% END %]
1150
1087
1151
1088
</div>
1152
</div>
1089
[% IF ( NovelistSelectProfile ) %][% IF ( NovelistSelectView == 'below' ) %]
1153
[% IF ( NovelistSelectProfile ) %][% IF ( NovelistSelectView == 'below' ) %]
Lines 1103-1108 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1103
    <div id="BW_videos"></div>
1167
    <div id="BW_videos"></div>
1104
[% END %]
1168
[% END %]
1105
1169
1170
1106
</div>
1171
</div>
1107
1172
1108
1173
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt (+41 lines)
Lines 109-114 $(document).ready(function(){ Link Here
109
        });
109
        });
110
    [% END %]
110
    [% END %]
111
111
112
    [% IF ( IDreamBooksResults ) %]
113
        $('.idbresult').each(function() {
114
            var isbn = $(this).children('a').text().replace(/\s*/,'');
115
            var element = this;
116
117
            if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
118
            // Use Microsoft XDR for IE version 8 or above
119
                var xdr = new XDomainRequest();
120
                xdr.open("get", "http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
121
                xdr.onload = function() {
122
                    json = 'json = '+xdr.responseText; // the string now looks like..  json = { ... };
123
                    eval(json); // json is now a regular JSON object
124
                    if(json.total_results > 0 && json.book.rating > 0){
125
                        $(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+"%");
126
                        $(element).show();
127
                    } else {
128
                        $(element).remove();
129
                    }
130
                }
131
                xdr.send();
132
            } else {
133
                $.getJSON("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
134
                    if(json.total_results > 0 && json.book.rating > 0){
135
                        $(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+"%");
136
                        $(element).show();
137
                    } else {
138
                        $(element).remove();
139
                    }
140
                });
141
            }
142
        });
143
    [% END %]
144
112
    [% IF ( opacbookbag ) %]$(".addtocart").show();[% END %]
145
    [% IF ( opacbookbag ) %]$(".addtocart").show();[% END %]
113
146
114
[% IF ( opacbookbag ) %]
147
[% IF ( opacbookbag ) %]
Lines 650-655 $(document).ready(function(){ Link Here
650
        [% 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 %]
683
        [% 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 %]
651
                </a>
684
                </a>
652
                [% 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 %]
685
                [% 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 %]
686
                [% IF ( IDreamBooksResults ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<div class="idbresult" style="display: none;">
687
                    [% IF ( IDreamBooksReviews ) %]
688
                        <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]#idb_critic_reviews">
689
                    [% ELSE %]
690
                        <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">
691
                    [% END %]
692
                    [% SEARCH_RESULT.normalized_isbn %]</a></div>
693
                [% END %][% END %]
653
                </td>
694
                </td>
654
                </tr>
695
                </tr>
655
                [% END %]
696
                [% END %]
(-)a/opac/opac-detail.pl (+4 lines)
Lines 998-1003 if (C4::Context->preference('OPACLocalCoverImages') == 1) { Link Here
998
    $template->{VARS}->{localimages} = \@images;
998
    $template->{VARS}->{localimages} = \@images;
999
}
999
}
1000
1000
1001
$template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews');
1002
$template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer');
1003
$template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults');
1004
1001
if (C4::Context->preference('OpacHighlightedWords')) {
1005
if (C4::Context->preference('OpacHighlightedWords')) {
1002
    $template->{VARS}->{query_desc} = $query->param('query_desc');
1006
    $template->{VARS}->{query_desc} = $query->param('query_desc');
1003
}
1007
}
(-)a/opac/opac-search.pl (-1 / +3 lines)
Lines 833-838 if (C4::Context->preference('GoogleIndicTransliteration')) { Link Here
833
}
833
}
834
834
835
$template->{VARS}->{DidYouMean} = C4::Context->preference('OPACdidyoumean') =~ m/enable/;
835
$template->{VARS}->{DidYouMean} = C4::Context->preference('OPACdidyoumean') =~ m/enable/;
836
$template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews');
837
$template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer');
838
$template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults');
836
839
837
    $template->param( borrowernumber    => $borrowernumber);
840
    $template->param( borrowernumber    => $borrowernumber);
838
output_with_http_headers $cgi, $cookie, $template->output, $content_type;
841
output_with_http_headers $cgi, $cookie, $template->output, $content_type;
839
- 

Return to bug 8733