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

(-)a/installer/data/mysql/sysprefs.sql (+3 lines)
Lines 383-385 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
383
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowLibrariesPulldownMobile','1','Show the libraries pulldown on the mobile version of the OPAC.',NULL,'YesNo');
383
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowLibrariesPulldownMobile','1','Show the libraries pulldown on the mobile version of the OPAC.',NULL,'YesNo');
384
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');
384
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');
385
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('AuthDisplayHierarchy','0','Display authority hierarchies','','YesNo');
385
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('AuthDisplayHierarchy','0','Display authority hierarchies','','YesNo');
386
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');
387
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');
388
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 (+8 lines)
Lines 5973-5978 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5973
    SetVersion($DBversion);
5973
    SetVersion($DBversion);
5974
}
5974
}
5975
5975
5976
$DBversion ="3.09.00.XXX";
5977
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5978
    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');");
5979
    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');");
5980
    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');");
5981
    print "Upgrade to $DBversion done (Add IDreamBooks enhanced content)\n";
5982
    SetVersion($DBversion);
5983
}
5976
5984
5977
=head1 FUNCTIONS
5985
=head1 FUNCTIONS
5978
5986
(-)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/prog/en/css/opac.css (+50 lines)
Lines 2767-2769 body#opac-main #opacmainuserblockmobile { Link Here
2767
.mobile_only {
2767
.mobile_only {
2768
   display : none;
2768
   display : none;
2769
}
2769
}
2770
2771
.review {
2772
    margin-bottom: 20px;
2773
}
2774
2775
#idreambooksreadometer {
2776
    float: right;
2777
}
2778
a.idreambooksrating {
2779
    font-size: 30px;
2780
    color: #29ADE4;
2781
    padding-left: 85px;
2782
    line-height: 30px;
2783
    text-decoration: none;
2784
}
2785
2786
.idreambookslegend {
2787
    font-size: small;
2788
}
2789
2790
a.reviewlink,a.reviewlink:visited {
2791
    text-decoration: none;
2792
    color: black;
2793
    font-weight: normal;
2794
}
2795
2796
.idreambookssummary a {
2797
    color: #707070;
2798
    text-decoration: none;
2799
}
2800
2801
.idreambookssummary img, .idbresult img {
2802
    vertical-align: middle;
2803
}
2804
2805
.idbresult {
2806
    color: #29ADE4;
2807
    text-align: center;
2808
    margin: 0.5em;
2809
    padding: 0.5em;
2810
}
2811
2812
.idbresult a, .idbresult a:visited {
2813
    text-decoration: none;
2814
    color: #29ADE4;
2815
}
2816
2817
.idbresult img {
2818
    padding-right: 6px;
2819
}
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (+65 lines)
Lines 160-166 $(function () { Link Here
160
});
160
});
161
// -----------------------------------------------------
161
// -----------------------------------------------------
162
[% END %]
162
[% END %]
163
[% IF ( IDreamBooksReviews || IDreamBooksReadometer ) %]
164
        var isbn = $(".isbn:last").text().split(" ")[1];
165
        if (isbn) {
166
        isbn = isbn.replace(/\W*$/, '');
167
168
        if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
169
        // Use Microsoft XDR for IE version 8 or above
170
            var xdr = new XDomainRequest();
171
            xdr.open("get", "http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
172
            xdr.onload = function() {
173
                json = 'json = '+xdr.responseText; // the string now looks like..  json = { ... };
174
                eval(json); // json is now a regular JSON object
175
                parseIDBJSON(json); // parse using same function as for jQuery's success event
176
            }
177
            xdr.send();
178
        } else {
179
            $.getJSON("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
180
                parseIDBJSON(json);
181
            });
182
        }
183
    }
184
185
[% END %]
163
});
186
});
187
[% IF ( IDreamBooksReviews || IDreamBooksReadometer ) %]
188
function parseIDBJSON( json ) {
189
    if(json.total_results > 0 && json.book.rating > 0){ 
190
        var isbn = $(".isbn:last").text().split(" ")[1];
191
192
[% IF ( IDreamBooksReadometer ) %]
193
        $(".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>');
194
[% END %]
195
196
197
[% IF ( IDreamBooksReviews ) %]
198
        //build new tab for critic reviews
199
        $("#tab_idb_critic_reviews a").text($("#tab_idb_critic_reviews a").text().replace('XXX', json.book.review_count));
200
201
        //append happy-sad cloud review
202
203
        $("#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>");
204
205
        //insert data into Book reviews tab  
206
        $.each(json.book.critic_reviews, function(){
207
                $("#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>");
208
                });
209
        $("#seemoreidb").attr('href', json.book.detail_link);
210
        $("#tab_idb_critic_reviews").show();
211
[% END %]
212
213
    }
214
215
}
216
[% END %]
164
217
165
[% IF ( OpacBrowseResults && busc ) %]
218
[% IF ( OpacBrowseResults && busc ) %]
166
var timeoutRFW;
219
var timeoutRFW;
Lines 708-713 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
708
[% IF ( OPACLocalCoverImages ) %][% IF ( localimages ) %]
761
[% IF ( OPACLocalCoverImages ) %][% IF ( localimages ) %]
709
    <li id="tab_images"><a href="#images">Images</a></li>
762
    <li id="tab_images"><a href="#images">Images</a></li>
710
[% END %][% END %]
763
[% END %][% END %]
764
[% IF ( IDreamBooksReviews ) %]
765
    <li id='tab_idb_critic_reviews' style="display:none;"><a href='#idb_critic_reviews'>Book reviews by critics ( XXX )</a></li>
766
[% END %]
711
</ul>
767
</ul>
712
768
713
[% IF ( serialcollection ) %]
769
[% IF ( serialcollection ) %]
Lines 1153-1158 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1153
</div>
1209
</div>
1154
[% END %]
1210
[% END %]
1155
1211
1212
[% IF ( IDreamBooksReviews ) %]
1213
    <div id="idb_critic_reviews">
1214
        <div id="idb_review_snippets">
1215
        </div>
1216
        <span><a id="seemoreidb">More book reviews at iDreamBooks.com</a></span>
1217
    </div>
1218
[% END %]
1219
1156
1220
1157
</div>
1221
</div>
1158
[% IF ( NovelistSelectProfile ) %][% IF ( NovelistSelectView == 'below' ) %]
1222
[% IF ( NovelistSelectProfile ) %][% IF ( NovelistSelectView == 'below' ) %]
Lines 1172-1177 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1172
    <div id="BW_videos"></div>
1236
    <div id="BW_videos"></div>
1173
[% END %]
1237
[% END %]
1174
1238
1239
1175
</div>
1240
</div>
1176
1241
1177
1242
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt (+41 lines)
Lines 103-108 $(document).ready(function(){ Link Here
103
        });
103
        });
104
    [% END %]
104
    [% END %]
105
105
106
    [% IF ( IDreamBooksResults ) %]
107
        $('.idbresult').each(function() {
108
            var isbn = $(this).children('a').text().replace(/\s*/,'');
109
            var element = this;
110
111
            if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
112
            // Use Microsoft XDR for IE version 8 or above
113
                var xdr = new XDomainRequest();
114
                xdr.open("get", "http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
115
                xdr.onload = function() {
116
                    json = 'json = '+xdr.responseText; // the string now looks like..  json = { ... };
117
                    eval(json); // json is now a regular JSON object
118
                    if(json.total_results > 0 && json.book.rating > 0){ 
119
                        $(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+"%");
120
                        $(element).show();
121
                    } else {
122
                        $(element).remove();
123
                    }
124
                }
125
                xdr.send();
126
            } else {
127
                $.getJSON("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
128
                    if(json.total_results > 0 && json.book.rating > 0){ 
129
                        $(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+"%");
130
                        $(element).show();
131
                    } else {
132
                        $(element).remove();
133
                    }
134
                });
135
            }
136
        });
137
    [% END %]
138
106
    [% IF ( opacbookbag ) %]$(".addtocart").show();[% END %]
139
    [% IF ( opacbookbag ) %]$(".addtocart").show();[% END %]
107
140
108
[% IF ( opacbookbag ) %]
141
[% IF ( opacbookbag ) %]
Lines 643-648 $(document).ready(function(){ Link Here
643
        [% 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 %]
676
        [% 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 %]
644
                </a>
677
                </a>
645
                [% 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 %]
678
                [% 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 %]
679
                [% IF ( IDreamBooksResults ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<div class="idbresult" style="display: none;">
680
                    [% IF ( IDreamBooksReviews ) %]
681
                        <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]#idb_critic_reviews">
682
                    [% ELSE %]
683
                        <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">
684
                    [% END %]
685
                    [% SEARCH_RESULT.normalized_isbn %]</a></div>
686
                [% END %][% END %]
646
                </td>
687
                </td>
647
                </tr>
688
                </tr>
648
                [% END %]
689
                [% END %]
(-)a/opac/opac-detail.pl (+4 lines)
Lines 970-975 if (C4::Context->preference('OPACLocalCoverImages') == 1) { Link Here
970
    $template->{VARS}->{localimages} = \@images;
970
    $template->{VARS}->{localimages} = \@images;
971
}
971
}
972
972
973
$template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews');
974
$template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer');
975
$template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults');
976
973
if (C4::Context->preference('OpacHighlightedWords')) {
977
if (C4::Context->preference('OpacHighlightedWords')) {
974
    $template->{VARS}->{query_desc} = $query->param('query_desc');
978
    $template->{VARS}->{query_desc} = $query->param('query_desc');
975
}
979
}
(-)a/opac/opac-search.pl (-1 / +3 lines)
Lines 824-829 if (C4::Context->preference('GoogleIndicTransliteration')) { Link Here
824
}
824
}
825
825
826
$template->{VARS}->{DidYouMeanFromAuthorities} = C4::Context->preference('DidYouMeanFromAuthorities');
826
$template->{VARS}->{DidYouMeanFromAuthorities} = C4::Context->preference('DidYouMeanFromAuthorities');
827
$template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews');
828
$template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer');
829
$template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults');
827
830
828
    $template->param( borrowernumber    => $borrowernumber);
831
    $template->param( borrowernumber    => $borrowernumber);
829
output_with_http_headers $cgi, $cookie, $template->output, $content_type;
832
output_with_http_headers $cgi, $cookie, $template->output, $content_type;
830
- 

Return to bug 8733