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

(-)a/C4/SocialData.pm (+129 lines)
Line 0 Link Here
1
package C4::SocialData;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 2 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along with
15
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16
# Suite 330, Boston, MA  02111-1307 USA
17
18
use Modern::Perl;
19
use C4::Context;
20
use Business::ISBN;
21
use C4::Koha;
22
23
=head2 get_data
24
25
Get social data from a biblio
26
27
params:
28
  $isbn = isbn of the biblio (it must be the same in your database, isbn given to babelio)
29
30
returns:
31
  this function returns an hashref with keys
32
33
  isbn = isbn
34
  num_critics = number of critics
35
  num_critics_pro = number of profesionnal critics
36
  num_quotations = number of quotations
37
  num_videos = number of videos
38
  score_avg = average score
39
  num_scores = number of score
40
=cut
41
sub get_data {
42
    my ( $isbn ) = @_;
43
    my $dbh = C4::Context->dbh;
44
    my $sth = $dbh->prepare( qq{SELECT * FROM social_data WHERE isbn = ? LIMIT 1} );
45
    $sth->execute( $isbn );
46
    my $results = $sth->fetchrow_hashref;
47
48
    return $results;    
49
}
50
51
=head 2
52
53
Update Social data
54
55
params:
56
  $url = url containing csv file with data
57
58
data separator : ; (semicolon)
59
data order : isbn ; active ; critics number , critics pro number ; quotations number ; videos number ; average score ; scores number
60
61
=cut
62
sub update_data {
63
    my ( $output_filepath ) = @_;
64
65
    my $dbh = C4::Context->dbh;
66
    my $sth = $dbh->prepare( qq{INSERT INTO social_data (
67
            `isbn`, `num_critics`, `num_critics_pro`, `num_quotations`, `num_videos`, `score_avg`, `num_scores`
68
        ) VALUES ( ?, ?, ?, ?, ?, ?, ? )
69
        ON DUPLICATE KEY UPDATE `num_critics`=?, `num_critics_pro`=?, `num_quotations`=?, `num_videos`=?, `score_avg`=?, `num_scores`=?
70
    } );
71
72
    open( FILE, $output_filepath ) or die "File $output_filepath can not be read";
73
    my $sep = qq{;};
74
    my $i = 0;
75
    my $unknown = 0;
76
    while ( my $line = <FILE> ) {
77
        my ( $isbn, $active, $num_critics, $num_critics_pro, $num_quotations, $num_videos, $score_avg, $num_scores ) = split $sep, $line;
78
        next if not $active;
79
        eval {
80
            $sth->execute( $isbn, $num_critics, $num_critics_pro, $num_quotations, $num_videos, $score_avg, $num_scores,
81
                $num_critics, $num_critics_pro, $num_quotations, $num_videos, $score_avg, $num_scores
82
            );
83
        };
84
        if ( $@ ) {
85
            warn "Can't insert $isbn ($@)";
86
        } else {
87
            $i++;
88
        }
89
    }
90
    say "$i data insered or updated";
91
}
92
93
=head 2
94
95
Get social data report
96
97
=cut
98
sub get_report {
99
    my $dbh = C4::Context->dbh;
100
101
    my $sth = $dbh->prepare( qq{
102
        SELECT biblionumber, isbn FROM biblioitems
103
    } );
104
    $sth->execute;
105
    my %results;
106
    while ( my ( $biblionumber, $isbn ) = $sth->fetchrow() ) {
107
        push @{ $results{no_isbn} }, { biblionumber => $biblionumber } and next if not $isbn;
108
        my $original_isbn = $isbn;
109
        $isbn =~ s/^\s*(\S*)\s*$/$1/;
110
        $isbn = GetNormalizedISBN( $isbn, undef, undef );
111
        $isbn = Business::ISBN->new( $isbn );
112
        next if not $isbn;
113
        eval{
114
            $isbn = $isbn->as_isbn13->as_string;
115
        };
116
        next if $@;
117
        $isbn =~ s/-//g;
118
        my $social_datas = C4::SocialData::get_data( $isbn );
119
        if ( $social_datas ) {
120
            push @{ $results{with} }, { biblionumber => $biblionumber, isbn => $isbn, original => $original_isbn };
121
        } else {
122
            push @{ $results{without} }, { biblionumber => $biblionumber, isbn => $isbn, original => $original_isbn };
123
        }
124
    }
125
    return \%results;
126
}
127
128
1;
129
(-)a/installer/data/mysql/kohastructure.sql (+16 lines)
Lines 2687-2692 CREATE TABLE `bibliocoverimage` ( Link Here
2687
 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2687
 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2688
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2688
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2689
2689
2690
--
2691
-- Table structure for table `social_data`
2692
--
2693
2694
DROP TABLE IF EXISTS `social_data`;
2695
CREATE TABLE IF NOT EXISTS `social_data` (
2696
  `isbn` VARCHAR(30),
2697
  `num_critics` INT,
2698
  `num_critics_pro` INT,
2699
  `num_quotations` INT,
2700
  `num_videos` INT,
2701
  `score_avg` DECIMAL(5,2),
2702
  `num_scores` INT,
2703
  PRIMARY KEY  (`isbn`)
2704
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2705
2690
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
2706
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
2691
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
2707
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
2692
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
2708
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
(-)a/installer/data/mysql/sysprefs.sql (+4 lines)
Lines 337-339 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
337
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BorrowerRenewalPeriodBase', 'now', 'Set whether the borrower renewal date should be counted from the dateexpiry or from the current date ','dateexpiry|now','Choice');
337
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BorrowerRenewalPeriodBase', 'now', 'Set whether the borrower renewal date should be counted from the dateexpiry or from the current date ','dateexpiry|now','Choice');
338
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AllowItemsOnHoldCheckout',0,'Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else. This allows self checkouts for those items.','','YesNo');
338
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AllowItemsOnHoldCheckout',0,'Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else. This allows self checkouts for those items.','','YesNo');
339
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacExportOptions','bibtex|dc|marcxml|marc8|utf8|marcstd|mods|ris','Define export options available on OPAC detail page.','','free');
339
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacExportOptions','bibtex|dc|marcxml|marc8|utf8|marcstd|mods|ris','Define export options available on OPAC detail page.','','free');
340
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('Babeltheque_url_js','','Url for Babeltheque javascript (e.g. http://www.babeltheque.com/bw_XX.js)','','Free');
341
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('Babeltheque_url_update', '', 'Url for Babeltheque update (E.G. http://www.babeltheque.com/.../file.csv.bz2)', '', 'Free');
342
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SocialNetworks','1','Enable/Disable social networks links in opac detail pages','','YesNo');
343
(-)a/installer/data/mysql/updatedatabase.pl (+26 lines)
Lines 4719-4724 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4719
    SetVersion ($DBversion);
4719
    SetVersion ($DBversion);
4720
}
4720
}
4721
4721
4722
$DBversion = "3.07.00.XXX";
4723
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4724
    $dbh->do( qq{INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Babeltheque_url_js','','Url for Babeltheque javascript (e.g. http://www.babeltheque.com/bw_XX.js','','Free')} );
4725
    $dbh->do( qq{CREATE TABLE IF NOT EXISTS `social_data`
4726
      ( `isbn` VARCHAR(30),
4727
        `num_critics` INT,
4728
        `num_critics_pro` INT,
4729
        `num_quotations` INT,
4730
        `num_videos` INT,
4731
        `score_avg` DECIMAL(5,2),
4732
        `num_scores` INT,
4733
        PRIMARY KEY  (`isbn`)
4734
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8
4735
    } );
4736
    $dbh->do( qq{INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('Babeltheque_url_update', '', 'Url for Babeltheque update (E.G. http://www.babeltheque.com/.../file.csv.bz2)', '', 'Free')} );
4737
    print "Upgrade to $DBversion done (added syspref and table for babeltheque (Babeltheque_url_js, babeltheque))\n";
4738
    SetVersion($DBversion);
4739
}
4740
4741
$DBversion = "3.07.00.XXX";
4742
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4743
    $dbh->do( qq{INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SocialNetworks','1','Enable/Disable social networks links in opac detail','','YesNo')} );
4744
    print "Upgrade to $DBversion done (added syspref Social_networks)\n";
4745
    SetVersion($DBversion);
4746
}
4747
4722
=head1 FUNCTIONS
4748
=head1 FUNCTIONS
4723
4749
4724
=head2 DropAllForeignKeys($table)
4750
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref (+6 lines)
Lines 103-108 Enhanced Content: Link Here
103
                  yes: Do
103
                  yes: Do
104
                  no: "Don't"
104
                  no: "Don't"
105
            - include information (such as reviews and citations) from Babelthèque in item detail pages on the OPAC.
105
            - include information (such as reviews and citations) from Babelthèque in item detail pages on the OPAC.
106
        -
107
            - pref: Babeltheque_url_js
108
            - Defined the url for the Babeltheque javascript file (eg. http://www.babeltheque.com/bw_XX.js)
109
        -
110
            - pref: Babeltheque_url_update
111
            - Defined the url for the Babeltheque update periodically (eq. http://www.babeltheque.com/.../file.csv.bz2).
106
    Baker and Taylor:
112
    Baker and Taylor:
107
        -
113
        -
108
            - pref: BakerTaylorEnabled
114
            - pref: BakerTaylorEnabled
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (+7 lines)
Lines 69-74 Searching: Link Here
69
                  yes: Include
69
                  yes: Include
70
                  no: "Don't include"
70
                  no: "Don't include"
71
            - subdivisions for searches generated by clicking on subject tracings.
71
            - subdivisions for searches generated by clicking on subject tracings.
72
        -
73
            - pref: SocialNetworks
74
              default: 0
75
              choices:
76
                  yes: Enable
77
                  no: Disable
78
            - Enable/Disable social network links in opac detail pages
72
    Search Form:
79
    Search Form:
73
        -
80
        -
74
            - Show checkboxes to search by
81
            - Show checkboxes to search by
(-)a/koha-tmpl/opac-tmpl/prog/en/css/opac.css (-1 / +151 lines)
Lines 2309-2312 a.localimage img { Link Here
2309
	border : 1px solid #8EB3E7;
2309
	border : 1px solid #8EB3E7;
2310
	margin : 0 .5em;
2310
	margin : 0 .5em;
2311
	padding : .3em;
2311
	padding : .3em;
2312
}
2312
}
2313
2314
/* ## BABELTHEQUE ## */
2315
/* Uncomment if babeltheque configuration no contains these lines */
2316
/*
2317
#BW_etiquettes {
2318
  clear :left;
2319
  border: 1px solid #E8E8E8;
2320
  margin-top: 10px;
2321
  width: 49%;
2322
  float: left;
2323
  visibility: hidden;
2324
  visibility: visible\9;
2325
}
2326
#BW_etiquettes:not(:empty) {
2327
  visibility: visible;
2328
}
2329
2330
#BW_etiquettes h2 {
2331
  clear:left;
2332
  background-color: #E8E8E8;
2333
  margin: 5px 10px;
2334
  padding: 0 5px;
2335
}
2336
2337
#BW_ulEti {max-width:100%;}
2338
2339
#BW_ulEti ul  {
2340
  margin:0;
2341
  padding:0 15px;
2342
  list-style-type: none;
2343
}
2344
2345
#BW_ulEti a {
2346
  text-decoration: none;
2347
}
2348
2349
#BW_ulEti a.tag_s0  {font-weight: 120;font-size:0.8em;}
2350
#BW_ulEti a.tag_s1  {font-weight: 150;font-size:0.9em;}
2351
#BW_ulEti a.tag_s2  {font-weight: 180;font-size:1.0em;}
2352
#BW_ulEti a.tag_s3  {font-weight: 200;font-size:1.2em;}
2353
#BW_ulEti a.tag_s4  {font-weight: 220;font-size:1.4em;}
2354
#BW_ulEti a.tag_s5  {font-weight: 230;font-size:1.5em;}
2355
#BW_ulEti a.tag_s6  {font-weight: 320;font-size:1.6em;}
2356
#BW_ulEti a.tag_s7  {font-weight: 350;font-size:1.7em;}
2357
#BW_ulEti a.tag_s8  {font-weight: 400;font-size:1.8em;}
2358
#BW_ulEti { padding: 0px; line-height: 2em; text-align: center;}
2359
#BW_ulEti a { padding: 2px; }
2360
#BW_ulEti { margin: 0px; }
2361
2362
#BW_ulEti ol {
2363
  float:left;
2364
  display: inline;
2365
  margin: 0 10px;
2366
}
2367
2368
#BW_suggestions {
2369
  border: 1px solid #E8E8E8;
2370
  margin-top: 10px;
2371
  float: right;
2372
  width: 49%;
2373
  visibility: hidden;
2374
  visibility: visible\9;
2375
}
2376
#BW_suggestions:not(:empty) {
2377
  visibility: visible;
2378
}
2379
#BW_suggestions h2 {
2380
  background-color: #E8E8E8;
2381
  margin: 5px 10px;
2382
  padding: 0 5px;
2383
}
2384
#BW_suggestions .BW_livres_tag_page {
2385
  padding: 0 15px;
2386
}
2387
#BW_suggestions .BW_livres_tag_page:before {
2388
  content : '> ';
2389
}
2390
#BW_droite .BW_livres_tag:before {
2391
  content : '> ';
2392
}
2393
2394
#BW_videos {
2395
  clear : both;
2396
  border: 1px solid #E8E8E8;
2397
  padding-bottom: 140px;
2398
  margin-top: 10px;
2399
  max-width: 100%;
2400
  visibility: hidden;
2401
  visibility: visible\9;
2402
}
2403
2404
#BW_videos:not(:empty) {
2405
  visibility: visible;
2406
}
2407
2408
#BW_videos h2 {
2409
  background-color: #E8E8E8;
2410
  margin: 5px 10px;
2411
  padding: 0 5px;
2412
}
2413
#BW_videos .BW_bloc_vid {
2414
  clear: both;
2415
  padding: 0 15px;
2416
}
2417
.BW_vignette_vid {
2418
  border: 1px solid #DFD9CE;
2419
  float: left;
2420
  height: 141px;
2421
  margin: 5px;
2422
  min-height: 141px;
2423
  padding: 5px;
2424
  white-space: nowrap;
2425
}
2426
2427
#BW_notes {clear :left;}
2428
#BW_notes h2 {font-size:85%;}
2429
2430
#BW_citations {}
2431
#BW_citations h2 {font-size:85%;}
2432
2433
#BW_critiques {}
2434
#BW_critiques h2 {font-size:85%;}
2435
2436
#BW_critiques_pro {}
2437
#BW_critiques_pro h2 {font-size:85%;}
2438
2439
#BW_citations,#BW_critiques,#BW_critiques_pro {
2440
  background: -moz-linear-gradient(center top , #3399FF, #3333FF) repeat scroll 0 0 transparent;
2441
  background: -webkit-gradient(linear, center top, center bottom, from(#3399FF), to(#3333FF));
2442
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3399FF', endColorstr='#3333FF');
2443
  border: 1px solid #B7B7B7;
2444
  border-radius: 5px 5px 5px 5px;
2445
  color: #FFFFCC;
2446
  display: inline-block;
2447
  float: left;
2448
  font-weight: bold;
2449
  margin: 15px 20px 15px 0;
2450
  min-width: 150px;
2451
  padding: 0 15px 8px;
2452
  position: relative;
2453
  text-align: center;
2454
  text-shadow: 1px 1px 1px #777777;
2455
  white-space: nowrap;
2456
}
2457
2458
#BW_citations a,#BW_critiques a,#BW_critiques_pro a {
2459
  color: #FFFFCC;
2460
}
2461
2462
*/
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc (-4 lines)
Lines 53-61 Link Here
53
</div>
53
</div>
54
[% END %]
54
[% END %]
55
55
56
[% IF ( Babeltheque ) %]
57
<script type="text/javascript" src="http://www.babeltheque.com/bw_30.js"></script>
58
[% END %]
59
60
</body>
56
</body>
61
</html>
57
</html>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (-11 / +48 lines)
Lines 1-6 Link Here
1
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog &rsaquo; Details for: [% title |html %][% FOREACH subtitl IN subtitle %], [% subtitl.subfield |html %][% END %]
1
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog &rsaquo; Details for: [% title |html %][% FOREACH subtitl IN subtitle %], [% subtitl.subfield |html %][% END %]
2
[% INCLUDE 'doc-head-close.inc' %]
2
[% INCLUDE 'doc-head-close.inc' %]
3
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
3
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
4
5
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
6
  {lang: '[% lang %]'}
7
</script>
8
4
<script type="text/JavaScript" language="JavaScript">
9
<script type="text/JavaScript" language="JavaScript">
5
//<![CDATA[
10
//<![CDATA[
6
    [% IF ( busc ) %]
11
    [% IF ( busc ) %]
Lines 486-491 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
486
       [% END %]
491
       [% END %]
487
    [% END %]
492
    [% END %]
488
493
494
    [% IF ( Babeltheque ) %]
495
        <input type="hidden" name="BW_id_isbn" id="BW_id_isbn" value="[% normalized_isbn %]"/>
496
497
        <div id="BW_notes"></div>
498
        <div id="BW_critiques"></div>
499
        <div id="BW_critiques_pro"></div>
500
        <div id="BW_citations"></div>
501
    [% END %]
502
489
</div>
503
</div>
490
504
491
<div id="bibliodescriptions" class="toptabs">
505
<div id="bibliodescriptions" class="toptabs">
Lines 540-546 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
540
    [% IF ( OPACFRBRizeEditions ) %][% IF ( XISBNS ) %]<li><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#editions">Editions</a></li>[% END %][% END %]
554
    [% IF ( OPACFRBRizeEditions ) %][% IF ( XISBNS ) %]<li><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#editions">Editions</a></li>[% END %][% END %]
541
    
555
    
542
    [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonReviews ) %]<li><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#amazonreviews">Amazon Reviews</a></li>[% END %][% END %]
556
    [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonReviews ) %]<li><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#amazonreviews">Amazon Reviews</a></li>[% END %][% END %]
543
    [% IF ( Babeltheque ) %]<li><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#babeltheque">Babelthèque</a></li>[% END %]
544
557
545
    [% IF ( serialcollection ) %]
558
    [% IF ( serialcollection ) %]
546
		[% IF ( defaulttab == 'serialcollection' ) %]<li class="ui-tabs-selected">
559
		[% IF ( defaulttab == 'serialcollection' ) %]<li class="ui-tabs-selected">
Lines 907-921 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
907
</div>
920
</div>
908
[% END %]
921
[% END %]
909
922
910
[% IF ( Babeltheque ) %]
911
<div id="babeltheque">
912
  <div id="BW_notes"></div>
913
  <div id="BW_critiques"></div>
914
  <div id="BW_citations"></div>
915
  <div id="BW_etiquettes"></div>
916
</div>
917
[% END %]
918
919
[% IF ( OPACFRBRizeEditions ) %][% IF ( XISBNS ) %]
923
[% IF ( OPACFRBRizeEditions ) %][% IF ( XISBNS ) %]
920
<div id="editions">
924
<div id="editions">
921
925
Lines 1009-1014 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1009
</div>
1013
</div>
1010
[% END %][% END %]
1014
[% END %][% END %]
1011
</div>
1015
</div>
1016
1017
[% IF ( Babeltheque ) %]
1018
    <div>
1019
        <div id="BW_etiquettes"></div>
1020
        <div id="BW_suggestions"></div>
1021
    </div>
1022
    <div class="clearfix"></div>
1023
    <div id="BW_videos"></div>
1024
[% END %]
1025
1012
</div>
1026
</div>
1013
1027
1014
1028
Lines 1037-1043 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1037
[% END %]
1051
[% END %]
1038
1052
1039
[% INCLUDE 'opac-detail-sidebar.inc' %]
1053
[% INCLUDE 'opac-detail-sidebar.inc' %]
1040
1041
        [% IF ( NovelistSelectProfile ) %] [% IF ( NovelistSelectView == 'right') %]
1054
        [% IF ( NovelistSelectProfile ) %] [% IF ( NovelistSelectView == 'right') %]
1042
         <div id="NovelistSelect">
1055
         <div id="NovelistSelect">
1043
            <h4>Novelist Select</h4>
1056
            <h4>Novelist Select</h4>
Lines 1045-1050 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1045
         </div>
1058
         </div>
1046
        [% END %] [% END %]
1059
        [% END %] [% END %]
1047
1060
1061
[% IF ( Babeltheque ) %]
1062
    <div class="babeltheque_adds">
1063
        <div id="BW_critiques_aj"></div>
1064
        <div id="BW_citations_aj"></div>
1065
    </div>
1066
[% END %]
1067
1068
[% IF ( SocialNetworks ) %]
1069
    <div class="social_networks">
1070
        <span>Share</span>
1071
        <a href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&t=[% title |url %]" title="Share on Facebook"><img alt="Share on Facebook" src="/opac-tmpl/prog/images/socnet/facebook16.png" /></a>
1072
        <a href="http://twitter.com/share" title="Share on Twitter"><img alt="Share on Twitter" src="/opac-tmpl/prog/images/socnet/twitter16.png" /></a>
1073
        <a href="http://www.linkedin.com/shareArticle?mini=true&url=[% current_url |url %]&title=[% title |url %]" title="Share on LinkedIn"><img alt="Share on LinkedIn" src="/opac-tmpl/prog/images/socnet/linkedin16.png" /></a>
1074
        <a href="http://www.delicious.com/save?url=[% current_url |url %]&title=[% title |url %]" title="Share on Delicious"><img alt="Share on Delicious" src="/opac-tmpl/prog/images/socnet/delicious16.gif" /></a>
1075
        <g:plusone size="small"></g:plusone>
1076
        <a href="mailto:ADRESSE?subject=TO READ : [% title %]>&body=[% title %]> [% current_url |url %]" title="Share by email"><img alt="Share by email" src="/opac-tmpl/prog/images/socnet/mailto16.png" /></a> 
1077
    </div>
1078
[% END %]
1079
1048
</div>
1080
</div>
1049
</div>
1081
</div>
1050
</div>
1082
</div>
Lines 1068-1071 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1068
[% IF ( NovelistSelectProfile ) %]
1100
[% IF ( NovelistSelectProfile ) %]
1069
<script type="text/javascript" src="http://imageserver.ebscohost.com/novelistselect/ns2init.js"></script>
1101
<script type="text/javascript" src="http://imageserver.ebscohost.com/novelistselect/ns2init.js"></script>
1070
[% END %]
1102
[% END %]
1103
1104
[% IF ( Babeltheque ) %]
1105
    <script type="text/javascript" src="[% Babeltheque_url_js %]"></script>
1106
[% END %]
1107
1071
[% INCLUDE 'opac-bottom.inc' %]
1108
[% INCLUDE 'opac-bottom.inc' %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt (+20 lines)
Lines 389-394 $(document).ready(function(){ Link Here
389
                [% IF ( SEARCH_RESULT.imageurl ) %]
389
                [% IF ( SEARCH_RESULT.imageurl ) %]
390
				<img src="[% SEARCH_RESULT.imageurl %]" title="[% SEARCH_RESULT.description %]" alt="[% SEARCH_RESULT.description %]" />
390
				<img src="[% SEARCH_RESULT.imageurl %]" title="[% SEARCH_RESULT.description %]" alt="[% SEARCH_RESULT.description %]" />
391
                [% END %]
391
                [% END %]
392
                [% IF ( SEARCH_RESULT.score_avg ) %]
393
                    <img src="[% themelang %]/../images/bonus.png" title="bonus" style="max-height: 35px;"/>
394
                [% END %]
392
				</td>
395
				</td>
393
                [% END %]
396
                [% END %]
394
                [% END %]
397
                [% END %]
Lines 477-482 $(document).ready(function(){ Link Here
477
                </span>
480
                </span>
478
481
479
				[% END %]
482
				[% END %]
483
                [% IF ( SEARCH_RESULT.score_avg ) %]
484
                    <span class="result_summary">
485
                        <img src="[% themelang %]/../images/Star[% SEARCH_RESULT.score_int %].gif" title="" style="max-height: 15px;"/> <span style="font-size: 85%;">[% SEARCH_RESULT.score_avg %] / 5 (on [% SEARCH_RESULT.num_scores %] rates)</span>
486
                        [% IF ( SEARCH_RESULT.num_critics ) %]
487
                            <span class="social_data">[% SEARCH_RESULT.num_critics %] Internet user critics</span>
488
                        [% END %]
489
                        [% IF ( SEARCH_RESULT.num_critics_pro ) %]
490
                            <span class="social_data">[% SEARCH_RESULT.num_critics_pro %] Professional critics</span>
491
                        [% END %]
492
                        [% IF ( SEARCH_RESULT.num_videos ) %]
493
                            <span class="social_data">[% SEARCH_RESULT.num_videos %] Video extracts</span>
494
                        [% END %]
495
                        [% IF ( SEARCH_RESULT.num_quotations ) %]
496
                            <span class="social_data">[% SEARCH_RESULT.num_quotations %] Quotations</span>
497
                        [% END %]
498
                    </span>
499
                [% END %]
480
				[% IF ( LibraryThingForLibrariesID ) %]<div class="ltfl_reviews"></div>[% END %]
500
				[% IF ( LibraryThingForLibrariesID ) %]<div class="ltfl_reviews"></div>[% END %]
481
				[% IF ( opacuserlogin ) %][% IF ( TagsEnabled ) %]
501
				[% IF ( opacuserlogin ) %][% IF ( TagsEnabled ) %]
482
                                [% IF ( TagsShowOnList ) %]
502
                                [% IF ( TagsShowOnList ) %]
(-)a/misc/cronjobs/social_data/get_report_social_data.pl (+16 lines)
Line 0 Link Here
1
#!/bin/perl
2
3
use Modern::Perl;
4
use C4::SocialData;
5
6
my $results = C4::SocialData::get_report;
7
8
say "==== Social Data report ====";
9
say "Matched : (" . scalar( @{ $results->{with} } ) . ")";
10
say "biblionumber = $_->{biblionumber},\toriginal = $_->{original},\tisbn = $_->{isbn}" for @{ $results->{with} };
11
12
say "No Match : (" . scalar( @{ $results->{without} } ) . ")";
13
say "biblionumber = $_->{biblionumber},\toriginal = $_->{original},\tisbn = $_->{isbn}" for @{ $results->{without} };
14
15
say "Without ISBN : (" . scalar( @{ $results->{no_isbn} } ) . ")";
16
say "biblionumber = $_->{biblionumber}" for @{ $results->{no_isbn} };
(-)a/misc/cronjobs/social_data/update_social_data.pl (+16 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
use Modern::Perl;
4
use C4::Context;
5
use C4::SocialData;
6
7
my $url = C4::Context->preference( "Babeltheque_url_update" );
8
my $output_dir = qq{/tmp};
9
my $output_filepath = qq{$output_dir/social_data.csv};
10
system( qq{/bin/rm -f $output_filepath} );
11
system( qq{/bin/rm -f $output_dir/social_data.csv.bz2} );
12
system( qq{/usr/bin/wget $url -O $output_dir/social_data.csv.bz2 } ) == 0 or die "Can't get bz2 file from url $url ($?)";
13
system( qq{/bin/bunzip2 $output_dir/social_data.csv.bz2 } ) == 0 or die "Can't extract bz2 file ($?)";
14
15
16
C4::SocialData::update_data $output_filepath;
(-)a/opac/opac-detail.pl (+7 lines)
Lines 836-844 $template->param(NovelistSelectView => C4::Context->preference('NovelistSelectVi Link Here
836
if ( C4::Context->preference("Babeltheque") ) {
836
if ( C4::Context->preference("Babeltheque") ) {
837
    $template->param( 
837
    $template->param( 
838
        Babeltheque => 1,
838
        Babeltheque => 1,
839
        Babeltheque_url_js => C4::Context->preference("Babeltheque_url_js"),
839
    );
840
    );
840
}
841
}
841
842
843
# Social Networks
844
if ( C4::Context->preference( "SocialNetworks" ) ) {
845
    $template->param( current_url => C4::Context->preference('OPACBaseURL') . "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber" );
846
    $template->param( SocialNetworks => 1 );
847
}
848
842
# Shelf Browser Stuff
849
# Shelf Browser Stuff
843
if (C4::Context->preference("OPACShelfBrowser")) {
850
if (C4::Context->preference("OPACShelfBrowser")) {
844
    # pick the first itemnumber unless one was selected by the user
851
    # pick the first itemnumber unless one was selected by the user
(-)a/opac/opac-search.pl (-3 / +17 lines)
Lines 36-45 use C4::Biblio; # GetBiblioData Link Here
36
use C4::Koha;
36
use C4::Koha;
37
use C4::Tags qw(get_tags);
37
use C4::Tags qw(get_tags);
38
use C4::Branch; # GetBranches
38
use C4::Branch; # GetBranches
39
use C4::SocialData;
39
use POSIX qw(ceil floor strftime);
40
use POSIX qw(ceil floor strftime);
40
use URI::Escape;
41
use URI::Escape;
41
use Storable qw(thaw freeze);
42
use Storable qw(thaw freeze);
42
43
use Business::ISBN;
43
44
44
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
45
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
45
# create a new CGI object
46
# create a new CGI object
Lines 525-533 for (my $i=0;$i<@servers;$i++) { Link Here
525
            foreach (@newresults) {
526
            foreach (@newresults) {
526
                my $record = GetMarcBiblio($_->{'biblionumber'});
527
                my $record = GetMarcBiblio($_->{'biblionumber'});
527
                $_->{coins} = GetCOinSBiblio($record);
528
                $_->{coins} = GetCOinSBiblio($record);
529
                if ( C4::Context->preference( "Babeltheque" ) and $_->{normalized_isbn} ) {
530
                    my $isbn = Business::ISBN->new( $_->{normalized_isbn} );
531
                    next if not $isbn;
532
                    $isbn = $isbn->as_isbn13->as_string;
533
                    $isbn =~ s/-//g;
534
                    my $social_datas = C4::SocialData::get_data( $isbn );
535
                    next if not $social_datas;
536
                    for my $key ( keys %$social_datas ) {
537
                        $_->{$key} = $$social_datas{$key};
538
                        if ( $key eq 'score_avg' ){
539
                            $_->{score_int} = sprintf("%.0f", $$social_datas{score_avg} );
540
                        }
541
                    }
542
                }
528
            }
543
            }
529
        }
544
        }
530
      
545
531
        if ($results_hashref->{$server}->{"hits"}){
546
        if ($results_hashref->{$server}->{"hits"}){
532
            $total = $total + $results_hashref->{$server}->{"hits"};
547
            $total = $total + $results_hashref->{$server}->{"hits"};
533
        }
548
        }
534
- 

Return to bug 7470