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 2710-2715 CREATE TABLE `biblioimages` ( Link Here
2710
 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2710
 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2711
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2711
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2712
2712
2713
--
2714
-- Table structure for table `social_data`
2715
--
2716
2717
DROP TABLE IF EXISTS `social_data`;
2718
CREATE TABLE IF NOT EXISTS `social_data` (
2719
  `isbn` VARCHAR(30),
2720
  `num_critics` INT,
2721
  `num_critics_pro` INT,
2722
  `num_quotations` INT,
2723
  `num_videos` INT,
2724
  `score_avg` DECIMAL(5,2),
2725
  `num_scores` INT,
2726
  PRIMARY KEY  (`isbn`)
2727
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2728
2713
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
2729
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
2714
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
2730
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
2715
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
2731
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
(-)a/installer/data/mysql/sysprefs.sql (+4 lines)
Lines 351-353 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
351
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CalendarFirstDayOfWeek','Sunday','Select the first day of week to use in the calendar.','Sunday|Monday','Choice');
351
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CalendarFirstDayOfWeek','Sunday','Select the first day of week to use in the calendar.','Sunday|Monday','Choice');
352
INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.',  'free')
352
INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.',  'free')
353
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RoutingListNote','To change this note edit <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RoutingListNote#jumped">RoutlingListNote</a> system preference.','Define a note to be shown on all routing lists','70|10','Textarea');
353
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RoutingListNote','To change this note edit <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RoutingListNote#jumped">RoutlingListNote</a> system preference.','Define a note to be shown on all routing lists','70|10','Textarea');
354
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');
355
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');
356
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SocialNetworks','1','Enable/Disable social networks links in opac detail pages','','YesNo');
357
(-)a/installer/data/mysql/updatedatabase.pl (+25 lines)
Lines 4923-4928 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4923
    SetVersion($DBversion);
4923
    SetVersion($DBversion);
4924
}
4924
}
4925
4925
4926
$DBversion = "3.07.00.XXX";
4927
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4928
    $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')} );
4929
    $dbh->do( qq{CREATE TABLE IF NOT EXISTS `social_data`
4930
      ( `isbn` VARCHAR(30),
4931
        `num_critics` INT,
4932
        `num_critics_pro` INT,
4933
        `num_quotations` INT,
4934
        `num_videos` INT,
4935
        `score_avg` DECIMAL(5,2),
4936
        `num_scores` INT,
4937
        PRIMARY KEY  (`isbn`)
4938
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8
4939
    } );
4940
    $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')} );
4941
    print "Upgrade to $DBversion done (added syspref and table for babeltheque (Babeltheque_url_js, babeltheque))\n";
4942
    SetVersion($DBversion);
4943
}
4944
4945
$DBversion = "3.07.00.XXX";
4946
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4947
    $dbh->do( qq{INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SocialNetworks','1','Enable/Disable social networks links in opac detail','','YesNo')} );
4948
    print "Upgrade to $DBversion done (added syspref Social_networks)\n";
4949
    SetVersion($DBversion);
4950
}
4926
4951
4927
=head1 FUNCTIONS
4952
=head1 FUNCTIONS
4928
4953
(-)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 tabs in OPAC and staff-side advanced search for limiting searches on the
81
            - 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 2299-2301 p.patronimage.edit { Link Here
2299
	border-color:#E8E8E8;
2299
	border-color:#E8E8E8;
2300
	margin: 1em 1em 1em 0;
2300
	margin: 1em 1em 1em 0;
2301
}
2301
}
2302
2303
/* ## BABELTHEQUE ## */
2304
/* Uncomment if babeltheque configuration no contains these lines */
2305
/*
2306
#BW_etiquettes {
2307
  clear :left;
2308
  border: 1px solid #E8E8E8;
2309
  margin-top: 10px;
2310
  width: 49%;
2311
  float: left;
2312
  visibility: hidden;
2313
  visibility: visible\9;
2314
}
2315
#BW_etiquettes:not(:empty) {
2316
  visibility: visible;
2317
}
2318
2319
#BW_etiquettes h2 {
2320
  clear:left;
2321
  background-color: #E8E8E8;
2322
  margin: 5px 10px;
2323
  padding: 0 5px;
2324
}
2325
2326
#BW_ulEti {max-width:100%;}
2327
2328
#BW_ulEti ul  {
2329
  margin:0;
2330
  padding:0 15px;
2331
  list-style-type: none;
2332
}
2333
2334
#BW_ulEti a {
2335
  text-decoration: none;
2336
}
2337
2338
#BW_ulEti a.tag_s0  {font-weight: 120;font-size:0.8em;}
2339
#BW_ulEti a.tag_s1  {font-weight: 150;font-size:0.9em;}
2340
#BW_ulEti a.tag_s2  {font-weight: 180;font-size:1.0em;}
2341
#BW_ulEti a.tag_s3  {font-weight: 200;font-size:1.2em;}
2342
#BW_ulEti a.tag_s4  {font-weight: 220;font-size:1.4em;}
2343
#BW_ulEti a.tag_s5  {font-weight: 230;font-size:1.5em;}
2344
#BW_ulEti a.tag_s6  {font-weight: 320;font-size:1.6em;}
2345
#BW_ulEti a.tag_s7  {font-weight: 350;font-size:1.7em;}
2346
#BW_ulEti a.tag_s8  {font-weight: 400;font-size:1.8em;}
2347
#BW_ulEti { padding: 0px; line-height: 2em; text-align: center;}
2348
#BW_ulEti a { padding: 2px; }
2349
#BW_ulEti { margin: 0px; }
2350
2351
#BW_ulEti ol {
2352
  float:left;
2353
  display: inline;
2354
  margin: 0 10px;
2355
}
2356
2357
#BW_suggestions {
2358
  border: 1px solid #E8E8E8;
2359
  margin-top: 10px;
2360
  float: right;
2361
  width: 49%;
2362
  visibility: hidden;
2363
  visibility: visible\9;
2364
}
2365
#BW_suggestions:not(:empty) {
2366
  visibility: visible;
2367
}
2368
#BW_suggestions h2 {
2369
  background-color: #E8E8E8;
2370
  margin: 5px 10px;
2371
  padding: 0 5px;
2372
}
2373
#BW_suggestions .BW_livres_tag_page {
2374
  padding: 0 15px;
2375
}
2376
#BW_suggestions .BW_livres_tag_page:before {
2377
  content : '> ';
2378
}
2379
#BW_droite .BW_livres_tag:before {
2380
  content : '> ';
2381
}
2382
2383
#BW_videos {
2384
  clear : both;
2385
  border: 1px solid #E8E8E8;
2386
  padding-bottom: 140px;
2387
  margin-top: 10px;
2388
  max-width: 100%;
2389
  visibility: hidden;
2390
  visibility: visible\9;
2391
}
2392
2393
#BW_videos:not(:empty) {
2394
  visibility: visible;
2395
}
2396
2397
#BW_videos h2 {
2398
  background-color: #E8E8E8;
2399
  margin: 5px 10px;
2400
  padding: 0 5px;
2401
}
2402
#BW_videos .BW_bloc_vid {
2403
  clear: both;
2404
  padding: 0 15px;
2405
}
2406
.BW_vignette_vid {
2407
  border: 1px solid #DFD9CE;
2408
  float: left;
2409
  height: 141px;
2410
  margin: 5px;
2411
  min-height: 141px;
2412
  padding: 5px;
2413
  white-space: nowrap;
2414
}
2415
2416
#BW_notes {clear :left;}
2417
#BW_notes h2 {font-size:85%;}
2418
2419
#BW_citations {}
2420
#BW_citations h2 {font-size:85%;}
2421
2422
#BW_critiques {}
2423
#BW_critiques h2 {font-size:85%;}
2424
2425
#BW_critiques_pro {}
2426
#BW_critiques_pro h2 {font-size:85%;}
2427
2428
#BW_citations,#BW_critiques,#BW_critiques_pro {
2429
  background: -moz-linear-gradient(center top , #3399FF, #3333FF) repeat scroll 0 0 transparent;
2430
  background: -webkit-gradient(linear, center top, center bottom, from(#3399FF), to(#3333FF));
2431
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3399FF', endColorstr='#3333FF');
2432
  border: 1px solid #B7B7B7;
2433
  border-radius: 5px 5px 5px 5px;
2434
  color: #FFFFCC;
2435
  display: inline-block;
2436
  float: left;
2437
  font-weight: bold;
2438
  margin: 15px 20px 15px 0;
2439
  min-width: 150px;
2440
  padding: 0 15px 8px;
2441
  position: relative;
2442
  text-align: center;
2443
  text-shadow: 1px 1px 1px #777777;
2444
  white-space: nowrap;
2445
}
2446
2447
#BW_citations a,#BW_critiques a,#BW_critiques_pro a {
2448
  color: #FFFFCC;
2449
}
2450
2451
*/
(-)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
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 532-540 for (my $i=0;$i<@servers;$i++) { Link Here
532
            foreach (@newresults) {
533
            foreach (@newresults) {
533
                my $record = GetMarcBiblio($_->{'biblionumber'});
534
                my $record = GetMarcBiblio($_->{'biblionumber'});
534
                $_->{coins} = GetCOinSBiblio($record);
535
                $_->{coins} = GetCOinSBiblio($record);
536
                if ( C4::Context->preference( "Babeltheque" ) and $_->{normalized_isbn} ) {
537
                    my $isbn = Business::ISBN->new( $_->{normalized_isbn} );
538
                    next if not $isbn;
539
                    $isbn = $isbn->as_isbn13->as_string;
540
                    $isbn =~ s/-//g;
541
                    my $social_datas = C4::SocialData::get_data( $isbn );
542
                    next if not $social_datas;
543
                    for my $key ( keys %$social_datas ) {
544
                        $_->{$key} = $$social_datas{$key};
545
                        if ( $key eq 'score_avg' ){
546
                            $_->{score_int} = sprintf("%.0f", $$social_datas{score_avg} );
547
                        }
548
                    }
549
                }
535
            }
550
            }
536
        }
551
        }
537
      
552
538
        if ($results_hashref->{$server}->{"hits"}){
553
        if ($results_hashref->{$server}->{"hits"}){
539
            $total = $total + $results_hashref->{$server}->{"hits"};
554
            $total = $total + $results_hashref->{$server}->{"hits"};
540
        }
555
        }
541
- 

Return to bug 7470