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

(-)a/C4/SocialData.pm (+130 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
20
use C4::Context;
21
use Business::ISBN;
22
use C4::Koha;
23
24
=head2 get_data
25
26
Get social data from a biblio
27
28
params:
29
  $isbn = isbn of the biblio (it must be the same in your database, isbn given to babelio)
30
31
returns:
32
  this function returns an hashref with keys
33
34
  isbn = isbn
35
  num_critics = number of critics
36
  num_critics_pro = number of profesionnal critics
37
  num_quotations = number of quotations
38
  num_videos = number of videos
39
  score_avg = average score
40
  num_scores = number of score
41
=cut
42
sub get_data {
43
    my ( $isbn ) = @_;
44
    my $dbh = C4::Context->dbh;
45
    my $sth = $dbh->prepare( qq{SELECT * FROM social_data WHERE isbn = ? LIMIT 1} );
46
    $sth->execute( $isbn );
47
    my $results = $sth->fetchrow_hashref;
48
49
    return $results;    
50
}
51
52
=head 2
53
54
Update Social data
55
56
params:
57
  $url = url containing csv file with data
58
59
data separator : ; (semicolon)
60
data order : isbn ; active ; critics number , critics pro number ; quotations number ; videos number ; average score ; scores number
61
62
=cut
63
sub update_data {
64
    my ( $output_filepath ) = @_;
65
66
    my $dbh = C4::Context->dbh;
67
    my $sth = $dbh->prepare( qq{INSERT INTO social_data (
68
            `isbn`, `num_critics`, `num_critics_pro`, `num_quotations`, `num_videos`, `score_avg`, `num_scores`
69
        ) VALUES ( ?, ?, ?, ?, ?, ?, ? )
70
        ON DUPLICATE KEY UPDATE `num_critics`=?, `num_critics_pro`=?, `num_quotations`=?, `num_videos`=?, `score_avg`=?, `num_scores`=?
71
    } );
72
73
    open my $file, '<', $output_filepath or die "File $output_filepath can not be read";
74
    my $sep = qq{;};
75
    my $i = 0;
76
    my $unknown = 0;
77
    while ( my $line = <$file> ) {
78
        my ( $isbn, $active, $num_critics, $num_critics_pro, $num_quotations, $num_videos, $score_avg, $num_scores ) = split $sep, $line;
79
        next if not $active;
80
        eval {
81
            $sth->execute( $isbn, $num_critics, $num_critics_pro, $num_quotations, $num_videos, $score_avg, $num_scores,
82
                $num_critics, $num_critics_pro, $num_quotations, $num_videos, $score_avg, $num_scores
83
            );
84
        };
85
        if ( $@ ) {
86
            warn "Can't insert $isbn ($@)";
87
        } else {
88
            $i++;
89
        }
90
    }
91
    say "$i data insered or updated";
92
}
93
94
=head 2
95
96
Get social data report
97
98
=cut
99
sub get_report {
100
    my $dbh = C4::Context->dbh;
101
102
    my $sth = $dbh->prepare( qq{
103
        SELECT biblionumber, isbn FROM biblioitems
104
    } );
105
    $sth->execute;
106
    my %results;
107
    while ( my ( $biblionumber, $isbn ) = $sth->fetchrow() ) {
108
        push @{ $results{no_isbn} }, { biblionumber => $biblionumber } and next if not $isbn;
109
        my $original_isbn = $isbn;
110
        $isbn =~ s/^\s*(\S*)\s*$/$1/;
111
        $isbn = GetNormalizedISBN( $isbn, undef, undef );
112
        $isbn = Business::ISBN->new( $isbn );
113
        next if not $isbn;
114
        eval{
115
            $isbn = $isbn->as_isbn13->as_string;
116
        };
117
        next if $@;
118
        $isbn =~ s/-//g;
119
        my $social_datas = C4::SocialData::get_data( $isbn );
120
        if ( $social_datas ) {
121
            push @{ $results{with} }, { biblionumber => $biblionumber, isbn => $isbn, original => $original_isbn };
122
        } else {
123
            push @{ $results{without} }, { biblionumber => $biblionumber, isbn => $isbn, original => $original_isbn };
124
        }
125
    }
126
    return \%results;
127
}
128
129
1;
130
(-)a/installer/data/mysql/kohastructure.sql (+16 lines)
Lines 2784-2789 CREATE TABLE `biblioimages` ( Link Here
2784
 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2784
 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2785
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2785
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2786
2786
2787
--
2788
-- Table structure for table `social_data`
2789
--
2790
2791
DROP TABLE IF EXISTS `social_data`;
2792
CREATE TABLE IF NOT EXISTS `social_data` (
2793
  `isbn` VARCHAR(30),
2794
  `num_critics` INT,
2795
  `num_critics_pro` INT,
2796
  `num_quotations` INT,
2797
  `num_videos` INT,
2798
  `score_avg` DECIMAL(5,2),
2799
  `num_scores` INT,
2800
  PRIMARY KEY  (`isbn`)
2801
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2802
2787
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
2803
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
2788
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
2804
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
2789
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
2805
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
(-)a/installer/data/mysql/sysprefs.sql (+4 lines)
Lines 355-357 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
355
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OAI-PMH:AutoUpdateSets','0','Automatically update OAI sets when a bibliographic record is created or updated','','YesNo');
355
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OAI-PMH:AutoUpdateSets','0','Automatically update OAI sets when a bibliographic record is created or updated','','YesNo');
356
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowPublicListCreation',1,'If set, allows opac users to create public lists',NULL,'YesNo');
356
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowPublicListCreation',1,'If set, allows opac users to create public lists',NULL,'YesNo');
357
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowSharingPrivateLists',0,'If set, allows opac users to share private lists with other patrons',NULL,'YesNo');
357
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowSharingPrivateLists',0,'If set, allows opac users to share private lists with other patrons',NULL,'YesNo');
358
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');
359
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');
360
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SocialNetworks','1','Enable/Disable social networks links in opac detail pages','','YesNo');
361
(-)a/installer/data/mysql/updatedatabase.pl (+28 lines)
Lines 4994-4999 if ( C4::Context->preference("Version") lt TransformToNum($DBversion) ) { Link Here
4994
    SetVersion($DBversion);
4994
    SetVersion($DBversion);
4995
}
4995
}
4996
4996
4997
4998
4999
$DBversion = "3.07.00.XXX";
5000
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5001
    $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')} );
5002
    $dbh->do( qq{CREATE TABLE IF NOT EXISTS `social_data`
5003
      ( `isbn` VARCHAR(30),
5004
        `num_critics` INT,
5005
        `num_critics_pro` INT,
5006
        `num_quotations` INT,
5007
        `num_videos` INT,
5008
        `score_avg` DECIMAL(5,2),
5009
        `num_scores` INT,
5010
        PRIMARY KEY  (`isbn`)
5011
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8
5012
    } );
5013
    $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')} );
5014
    print "Upgrade to $DBversion done (added syspref and table for babeltheque (Babeltheque_url_js, babeltheque))\n";
5015
    SetVersion($DBversion);
5016
}
5017
5018
$DBversion = "3.07.00.XXX";
5019
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5020
    $dbh->do( qq{INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SocialNetworks','1','Enable/Disable social networks links in opac detail','','YesNo')} );
5021
    print "Upgrade to $DBversion done (added syspref Social_networks)\n";
5022
    SetVersion($DBversion);
5023
}
5024
4997
=head1 FUNCTIONS
5025
=head1 FUNCTIONS
4998
5026
4999
=head2 DropAllForeignKeys($table)
5027
=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 76-81 Searching: Link Here
76
                  yes: Using
76
                  yes: Using
77
                  no: "Not using"
77
                  no: "Not using"
78
            - 'ICU Zebra indexing. Please note: This setting will not affect Zebra indexing, it should only be used to tell Koha that you have activated ICU indexing if you have actually done so, since there is no way for Koha to figure this out on its own.'
78
            - 'ICU Zebra indexing. Please note: This setting will not affect Zebra indexing, it should only be used to tell Koha that you have activated ICU indexing if you have actually done so, since there is no way for Koha to figure this out on its own.'
79
        -
80
            - pref: SocialNetworks
81
              default: 0
82
              choices:
83
                  yes: Enable
84
                  no: Disable
85
            - Enable/Disable social network links in opac detail pages
79
    Search Form:
86
    Search Form:
80
        -
87
        -
81
            - Show tabs in OPAC and staff-side advanced search for limiting searches on the
88
            - Show tabs in OPAC and staff-side advanced search for limiting searches on the
(-)a/koha-tmpl/opac-tmpl/prog/en/css/opac.css (+150 lines)
Lines 2365-2367 span.sep { Link Here
2365
	padding: 0 .2em;
2365
	padding: 0 .2em;
2366
	text-shadow: 1px 1px 0 #FFF;
2366
	text-shadow: 1px 1px 0 #FFF;
2367
}
2367
}
2368
2369
/* ## BABELTHEQUE ## */
2370
/* Uncomment if babeltheque configuration no contains these lines */
2371
/*
2372
#BW_etiquettes {
2373
  clear :left;
2374
  border: 1px solid #E8E8E8;
2375
  margin-top: 10px;
2376
  width: 49%;
2377
  float: left;
2378
  visibility: hidden;
2379
  visibility: visible\9;
2380
}
2381
#BW_etiquettes:not(:empty) {
2382
  visibility: visible;
2383
}
2384
2385
#BW_etiquettes h2 {
2386
  clear:left;
2387
  background-color: #E8E8E8;
2388
  margin: 5px 10px;
2389
  padding: 0 5px;
2390
}
2391
2392
#BW_ulEti {max-width:100%;}
2393
2394
#BW_ulEti ul  {
2395
  margin:0;
2396
  padding:0 15px;
2397
  list-style-type: none;
2398
}
2399
2400
#BW_ulEti a {
2401
  text-decoration: none;
2402
}
2403
2404
#BW_ulEti a.tag_s0  {font-weight: 120;font-size:0.8em;}
2405
#BW_ulEti a.tag_s1  {font-weight: 150;font-size:0.9em;}
2406
#BW_ulEti a.tag_s2  {font-weight: 180;font-size:1.0em;}
2407
#BW_ulEti a.tag_s3  {font-weight: 200;font-size:1.2em;}
2408
#BW_ulEti a.tag_s4  {font-weight: 220;font-size:1.4em;}
2409
#BW_ulEti a.tag_s5  {font-weight: 230;font-size:1.5em;}
2410
#BW_ulEti a.tag_s6  {font-weight: 320;font-size:1.6em;}
2411
#BW_ulEti a.tag_s7  {font-weight: 350;font-size:1.7em;}
2412
#BW_ulEti a.tag_s8  {font-weight: 400;font-size:1.8em;}
2413
#BW_ulEti { padding: 0px; line-height: 2em; text-align: center;}
2414
#BW_ulEti a { padding: 2px; }
2415
#BW_ulEti { margin: 0px; }
2416
2417
#BW_ulEti ol {
2418
  float:left;
2419
  display: inline;
2420
  margin: 0 10px;
2421
}
2422
2423
#BW_suggestions {
2424
  border: 1px solid #E8E8E8;
2425
  margin-top: 10px;
2426
  float: right;
2427
  width: 49%;
2428
  visibility: hidden;
2429
  visibility: visible\9;
2430
}
2431
#BW_suggestions:not(:empty) {
2432
  visibility: visible;
2433
}
2434
#BW_suggestions h2 {
2435
  background-color: #E8E8E8;
2436
  margin: 5px 10px;
2437
  padding: 0 5px;
2438
}
2439
#BW_suggestions .BW_livres_tag_page {
2440
  padding: 0 15px;
2441
}
2442
#BW_suggestions .BW_livres_tag_page:before {
2443
  content : '> ';
2444
}
2445
#BW_droite .BW_livres_tag:before {
2446
  content : '> ';
2447
}
2448
2449
#BW_videos {
2450
  clear : both;
2451
  border: 1px solid #E8E8E8;
2452
  padding-bottom: 140px;
2453
  margin-top: 10px;
2454
  max-width: 100%;
2455
  visibility: hidden;
2456
  visibility: visible\9;
2457
}
2458
2459
#BW_videos:not(:empty) {
2460
  visibility: visible;
2461
}
2462
2463
#BW_videos h2 {
2464
  background-color: #E8E8E8;
2465
  margin: 5px 10px;
2466
  padding: 0 5px;
2467
}
2468
#BW_videos .BW_bloc_vid {
2469
  clear: both;
2470
  padding: 0 15px;
2471
}
2472
.BW_vignette_vid {
2473
  border: 1px solid #DFD9CE;
2474
  float: left;
2475
  height: 141px;
2476
  margin: 5px;
2477
  min-height: 141px;
2478
  padding: 5px;
2479
  white-space: nowrap;
2480
}
2481
2482
#BW_notes {clear :left;}
2483
#BW_notes h2 {font-size:85%;}
2484
2485
#BW_citations {}
2486
#BW_citations h2 {font-size:85%;}
2487
2488
#BW_critiques {}
2489
#BW_critiques h2 {font-size:85%;}
2490
2491
#BW_critiques_pro {}
2492
#BW_critiques_pro h2 {font-size:85%;}
2493
2494
#BW_citations,#BW_critiques,#BW_critiques_pro {
2495
  background: -moz-linear-gradient(center top , #3399FF, #3333FF) repeat scroll 0 0 transparent;
2496
  background: -webkit-gradient(linear, center top, center bottom, from(#3399FF), to(#3333FF));
2497
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3399FF', endColorstr='#3333FF');
2498
  border: 1px solid #B7B7B7;
2499
  border-radius: 5px 5px 5px 5px;
2500
  color: #FFFFCC;
2501
  display: inline-block;
2502
  float: left;
2503
  font-weight: bold;
2504
  margin: 15px 20px 15px 0;
2505
  min-width: 150px;
2506
  padding: 0 15px 8px;
2507
  position: relative;
2508
  text-align: center;
2509
  text-shadow: 1px 1px 1px #777777;
2510
  white-space: nowrap;
2511
}
2512
2513
#BW_citations a,#BW_critiques a,#BW_critiques_pro a {
2514
  color: #FFFFCC;
2515
}
2516
2517
*/
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc (-4 lines)
Lines 55-63 Link Here
55
55
56
[% END %]
56
[% END %]
57
57
58
[% IF ( Babeltheque ) %]
59
<script type="text/javascript" src="http://www.babeltheque.com/bw_30.js"></script>
60
[% END %]
61
62
</body>
58
</body>
63
</html>
59
</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 915-929 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
915
</div>
928
</div>
916
[% END %]
929
[% END %]
917
930
918
[% IF ( Babeltheque ) %]
919
<div id="babeltheque">
920
  <div id="BW_notes"></div>
921
  <div id="BW_critiques"></div>
922
  <div id="BW_citations"></div>
923
  <div id="BW_etiquettes"></div>
924
</div>
925
[% END %]
926
927
[% IF ( OPACFRBRizeEditions ) %][% IF ( XISBNS ) %]
931
[% IF ( OPACFRBRizeEditions ) %][% IF ( XISBNS ) %]
928
<div id="editions">
932
<div id="editions">
929
933
Lines 1017-1022 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1017
</div>
1021
</div>
1018
[% END %][% END %]
1022
[% END %][% END %]
1019
</div>
1023
</div>
1024
1025
[% IF ( Babeltheque ) %]
1026
    <div>
1027
        <div id="BW_etiquettes"></div>
1028
        <div id="BW_suggestions"></div>
1029
    </div>
1030
    <div class="clearfix"></div>
1031
    <div id="BW_videos"></div>
1032
[% END %]
1033
1020
</div>
1034
</div>
1021
1035
1022
1036
Lines 1045-1051 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1045
[% END %]
1059
[% END %]
1046
1060
1047
[% INCLUDE 'opac-detail-sidebar.inc' %]
1061
[% INCLUDE 'opac-detail-sidebar.inc' %]
1048
1049
        [% IF ( NovelistSelectProfile ) %] [% IF ( NovelistSelectView == 'right') %]
1062
        [% IF ( NovelistSelectProfile ) %] [% IF ( NovelistSelectView == 'right') %]
1050
         <div id="NovelistSelect">
1063
         <div id="NovelistSelect">
1051
            <h4>Novelist Select</h4>
1064
            <h4>Novelist Select</h4>
Lines 1053-1058 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1053
         </div>
1066
         </div>
1054
        [% END %] [% END %]
1067
        [% END %] [% END %]
1055
1068
1069
[% IF ( Babeltheque ) %]
1070
    <div class="babeltheque_adds">
1071
        <div id="BW_critiques_aj"></div>
1072
        <div id="BW_citations_aj"></div>
1073
    </div>
1074
[% END %]
1075
1076
[% IF ( SocialNetworks ) %]
1077
    <div class="social_networks">
1078
        <span>Share</span>
1079
        <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>
1080
        <a href="http://twitter.com/share" title="Share on Twitter"><img alt="Share on Twitter" src="/opac-tmpl/prog/images/socnet/twitter16.png" /></a>
1081
        <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>
1082
        <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>
1083
        <g:plusone size="small"></g:plusone>
1084
        <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> 
1085
    </div>
1086
[% END %]
1087
1056
</div>
1088
</div>
1057
</div>
1089
</div>
1058
</div>
1090
</div>
Lines 1076-1079 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1076
[% IF ( NovelistSelectProfile ) %]
1108
[% IF ( NovelistSelectProfile ) %]
1077
<script type="text/javascript" src="http://imageserver.ebscohost.com/novelistselect/ns2init.js"></script>
1109
<script type="text/javascript" src="http://imageserver.ebscohost.com/novelistselect/ns2init.js"></script>
1078
[% END %]
1110
[% END %]
1111
1112
[% IF ( Babeltheque ) %]
1113
    <script type="text/javascript" src="[% Babeltheque_url_js %]"></script>
1114
[% END %]
1115
1079
[% INCLUDE 'opac-bottom.inc' %]
1116
[% INCLUDE 'opac-bottom.inc' %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt (+20 lines)
Lines 390-395 $(document).ready(function(){ Link Here
390
                [% IF ( SEARCH_RESULT.imageurl ) %]
390
                [% IF ( SEARCH_RESULT.imageurl ) %]
391
                <img src="[% SEARCH_RESULT.imageurl %]" title="[% SEARCH_RESULT.description %]" alt="[% SEARCH_RESULT.description %]" />
391
                <img src="[% SEARCH_RESULT.imageurl %]" title="[% SEARCH_RESULT.description %]" alt="[% SEARCH_RESULT.description %]" />
392
                [% END %]
392
                [% END %]
393
                [% IF ( SEARCH_RESULT.score_avg ) %]
394
                    <img src="[% themelang %]/../images/bonus.png" title="bonus" style="max-height: 35px;"/>
395
                [% END %]
393
                </td>
396
                </td>
394
                [% END %]
397
                [% END %]
395
                [% END %]
398
                [% END %]
Lines 478-483 $(document).ready(function(){ Link Here
478
                </span>
481
                </span>
479
482
480
                [% END %]
483
                [% END %]
484
                [% IF ( SEARCH_RESULT.score_avg ) %]
485
                    <span class="result_summary">
486
                        <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>
487
                        [% IF ( SEARCH_RESULT.num_critics ) %]
488
                            <span class="social_data">[% SEARCH_RESULT.num_critics %] Internet user critics</span>
489
                        [% END %]
490
                        [% IF ( SEARCH_RESULT.num_critics_pro ) %]
491
                            <span class="social_data">[% SEARCH_RESULT.num_critics_pro %] Professional critics</span>
492
                        [% END %]
493
                        [% IF ( SEARCH_RESULT.num_videos ) %]
494
                            <span class="social_data">[% SEARCH_RESULT.num_videos %] Video extracts</span>
495
                        [% END %]
496
                        [% IF ( SEARCH_RESULT.num_quotations ) %]
497
                            <span class="social_data">[% SEARCH_RESULT.num_quotations %] Quotations</span>
498
                        [% END %]
499
                    </span>
500
                [% END %]
481
                [% IF ( LibraryThingForLibrariesID ) %]<div class="ltfl_reviews"></div>[% END %]
501
                [% IF ( LibraryThingForLibrariesID ) %]<div class="ltfl_reviews"></div>[% END %]
482
                [% IF ( opacuserlogin ) %][% IF ( TagsEnabled ) %]
502
                [% IF ( opacuserlogin ) %][% IF ( TagsEnabled ) %]
483
                                [% IF ( TagsShowOnList ) %]
503
                                [% 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
45
45
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
46
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
Lines 533-541 for (my $i=0;$i<@servers;$i++) { Link Here
533
            foreach (@newresults) {
534
            foreach (@newresults) {
534
                my $record = GetMarcBiblio($_->{'biblionumber'});
535
                my $record = GetMarcBiblio($_->{'biblionumber'});
535
                $_->{coins} = GetCOinSBiblio($record);
536
                $_->{coins} = GetCOinSBiblio($record);
537
                if ( C4::Context->preference( "Babeltheque" ) and $_->{normalized_isbn} ) {
538
                    my $isbn = Business::ISBN->new( $_->{normalized_isbn} );
539
                    next if not $isbn;
540
                    $isbn = $isbn->as_isbn13->as_string;
541
                    $isbn =~ s/-//g;
542
                    my $social_datas = C4::SocialData::get_data( $isbn );
543
                    next if not $social_datas;
544
                    for my $key ( keys %$social_datas ) {
545
                        $_->{$key} = $$social_datas{$key};
546
                        if ( $key eq 'score_avg' ){
547
                            $_->{score_int} = sprintf("%.0f", $$social_datas{score_avg} );
548
                        }
549
                    }
550
                }
536
            }
551
            }
537
        }
552
        }
538
      
553
539
        if ($results_hashref->{$server}->{"hits"}){
554
        if ($results_hashref->{$server}->{"hits"}){
540
            $total = $total + $results_hashref->{$server}->{"hits"};
555
            $total = $total + $results_hashref->{$server}->{"hits"};
541
        }
556
        }
542
- 

Return to bug 7470