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

(-)a/koha-tmpl/opac-tmpl/prog/en/js/google-jackets.js (-30 / +35 lines)
Lines 17-29 KOHA.Google = { Link Here
17
     * The result is asynchronously returned by Google and catched by
17
     * The result is asynchronously returned by Google and catched by
18
     * gbsCallBack().
18
     * gbsCallBack().
19
     */
19
     */
20
    GetCoverFromIsbn: function() {
20
    GetCoverFromIsbn: function(newWindow) {
21
        var bibkeys = [];
21
        var bibkeys = [];
22
        $("div [id^=gbs-thumbnail]").each(function(i) {
22
        $("div [id^=gbs-thumbnail]").each(function(i) {
23
            bibkeys.push($(this).attr("class")); // id=isbn
23
            bibkeys.push($(this).attr("class")); // id=isbn
24
        });
24
        });
25
        bibkeys = bibkeys.join(',');
25
        bibkeys = bibkeys.join(',');
26
        var scriptElement = document.createElement("script");
26
        var scriptElement = document.createElement("script");
27
        this.openInNewWindow=newWindow;
27
        scriptElement.setAttribute("id", "jsonScript");
28
        scriptElement.setAttribute("id", "jsonScript");
28
        scriptElement.setAttribute("src",
29
        scriptElement.setAttribute("src",
29
            "http://books.google.com/books?bibkeys=" + escape(bibkeys) +
30
            "http://books.google.com/books?bibkeys=" + escape(bibkeys) +
Lines 38-70 KOHA.Google = { Link Here
38
     * and link to preview if div id is gbs-thumbnail-preview
39
     * and link to preview if div id is gbs-thumbnail-preview
39
     */
40
     */
40
    gbsCallBack: function(booksInfo) {
41
    gbsCallBack: function(booksInfo) {
41
        for (id in booksInfo) {
42
         var target = '';
42
            var book = booksInfo[id];
43
         if (this.openInNewWindow) {
43
            $("."+book.bib_key).each(function() {
44
            target = 'target="_blank" ';
44
                var a = document.createElement("a");
45
         }        
45
                a.href = book.info_url;
46
         for (id in booksInfo) {
46
				if (typeof(book.thumbnail_url) != "undefined") {
47
             var book = booksInfo[id];
47
	            	var img = document.createElement("img");
48
             $("."+book.bib_key).each(function() {
48
	                img.src = book.thumbnail_url;
49
                 var a = document.createElement("a");
49
					$(this).append(img);
50
                 a.href = book.info_url;
50
                    var re = /^gbs-thumbnail-preview/;
51
                 if (typeof(book.thumbnail_url) != "undefined") {
51
                    if ( re.exec($(this).attr("id")) ) {
52
                     var img = document.createElement("img");
52
                        $(this).append(
53
                     img.src = book.thumbnail_url;
53
                            '<div style="margin-bottom:5px; margin-top:-5px;font-size:9px">' +
54
                     $(this).append(img);
54
                            '<a href="' + 
55
                     var re = /^gbs-thumbnail-preview/;
55
                            book.info_url + 
56
                     if ( re.exec($(this).attr("id")) ) {
56
                            '"><img src="' +
57
                         $(this).append(
57
                            'http://books.google.com/intl/en/googlebooks/images/gbs_preview_sticker1.gif' +
58
                             '<div style="margin-bottom:5px; margin-top:-5px;font-size:9px">' +
58
                            '"></a></div>' 
59
                             '<a '+target+'href="' + 
59
                            );
60
                             book.info_url + 
60
                    }
61
                             '"><img src="' +
61
				} else {
62
                             'http://books.google.com/intl/en/googlebooks/images/gbs_preview_sticker1.gif' +
62
					var message = document.createElement("span");
63
                             '"></a></div>' 
63
					$(message).attr("class","no-image");
64
                             );
64
					$(message).html(NO_GOOGLE_JACKET);
65
                     }
65
					$(this).append(message);
66
                 } else {
66
				}
67
                     var message = document.createElement("span");
67
            });
68
                     $(message).attr("class","no-image");
68
        }
69
                     $(message).html(NO_GOOGLE_JACKET);
69
    }
70
                     $(this).append(message);
71
                 }
72
             });
73
         }
74
     }
70
};
75
};
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl (-1 / +1 lines)
Lines 22-28 Link Here
22
            widgets : ['zebra'],
22
            widgets : ['zebra'],
23
            sortList: [[0,0]]
23
            sortList: [[0,0]]
24
        });<!-- TMPL_IF NAME="GoogleJackets" -->
24
        });<!-- TMPL_IF NAME="GoogleJackets" -->
25
        KOHA.Google.GetCoverFromIsbn();<!-- /TMPL_IF --><!-- TMPL_IF NAME="TagsEnabled" -->
25
        KOHA.Google.GetCoverFromIsbn(<!-- TMPL_VAR name="covernewwindow" -->);<!-- /TMPL_IF --><!-- TMPL_IF NAME="TagsEnabled" -->
26
        $(".tagbutton").click(KOHA.Tags.add_tag_button);<!-- /TMPL_IF -->
26
        $(".tagbutton").click(KOHA.Tags.add_tag_button);<!-- /TMPL_IF -->
27
		<!-- TMPL_IF NAME="opacbookbag" -->$("a.print").parent().after("<li><a class=\"addtocart\" href=\"#\" onclick=\"addRecord('"+$("input[name=bib]").val()+"'); return false;\">"+_("Add to Your Cart")+"<\/a><\/li>");
27
		<!-- TMPL_IF NAME="opacbookbag" -->$("a.print").parent().after("<li><a class=\"addtocart\" href=\"#\" onclick=\"addRecord('"+$("input[name=bib]").val()+"'); return false;\">"+_("Add to Your Cart")+"<\/a><\/li>");
28
<!-- /TMPL_IF -->});
28
<!-- /TMPL_IF -->});
(-)a/opac/opac-detail.pl (-1 / +8 lines)
Lines 583-588 if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref Link Here
583
								'sort'=>'-weight', limit=>$tag_quantity}));
583
								'sort'=>'-weight', limit=>$tag_quantity}));
584
}
584
}
585
585
586
if (C4::Context->preference("OPACURLOpenInNewWindow")) {
587
    # These values are going to be read by Javascript, at least in the case
588
    # of the google covers
589
    $template->param(covernewwindow => 'true');
590
} else {
591
    $template->param(covernewwindow => 'false');
592
}
593
586
#Search for title in links
594
#Search for title in links
587
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
595
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
588
    $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
596
    $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
589
- 

Return to bug 5522