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

(-)a/Koha/Explore/Bnf.pm (+73 lines)
Line 0 Link Here
1
package Koha::Explore::Bnf;
2
3
use C4::Biblio;
4
use Koha::Explore::Sparql;
5
6
=head1 NAME
7
8
Koha::Explore::Bnf
9
10
=head1 SYNOPSIS
11
12
    use Koha::Explore::Bnf;
13
14
=head1 FUNCTIONS
15
16
=cut
17
18
use Modern::Perl;
19
use RDF::Query::Client;
20
21
=head2 _execute_sparql_query
22
    Execute sparql query on Sparql endpoint.
23
=cut
24
25
my $endpoint = "http://data.bnf.fr/sparql";
26
27
sub GetDataForSubject {
28
  my ($subject) = @_;
29
}
30
31
=head2 GetDataForAuthor 
32
    Execute sparql query on Sparql endpoint.
33
=cut
34
35
sub GetDataForAuthor {
36
  my ($ark) = @_;
37
  $ark =~ s/catalogue/data/g;
38
39
  # Work Ark : I must go and searhc the author
40
  my %workData = Koha::Explore::Sparql::GetPredicatesAndObjectsForSubject ("<".$ark.">",$endpoint);
41
  my $authorArk = "<".$workData{'http://purl.org/dc/terms/creator'}[0].">";
42
  my %data = Koha::Explore::Sparql::GetPredicatesAndObjectsForSubject ($authorArk,$endpoint);
43
  return \%data;
44
}
45
46
=head2 GetDataForBiblio 
47
    Execute sparql query on Sparql endpoint.
48
=cut
49
50
sub GetDataForBiblio {
51
  my ($ark) = @_;
52
  $ark =~ s/catalogue/data/g;
53
  my %data = Koha::Explore::Sparql::GetPredicatesAndObjectsForSubject ("<".$ark.">",$endpoint);
54
  return \%data;
55
}
56
57
sub _llog {
58
  my ($var,$a,$b) = @_;
59
  use Data::Dumper;
60
  $a = "" if !defined $a;
61
  $b = "" if !defined $b;
62
  warn Dumper($a . '##############################################');
63
  warn Dumper($var);
64
  warn Dumper($b . '##############################################');
65
}
66
67
=head1 AUTHOR
68
Claire Hernandez, E<lt>claire.hernandez@biblibre.comE<gt>
69
=cut
70
71
1;
72
73
__END__
(-)a/Koha/Explore/Sparql.pm (+89 lines)
Line 0 Link Here
1
package Koha::Explore::Sparql;
2
3
use C4::Biblio;
4
5
=head1 NAME
6
7
Koha::Explore::Sparql
8
9
10
=head1 SYNOPSIS
11
12
    use Koha::Explore::Sparql;
13
14
=head1 FUNCTIONS
15
16
=cut
17
18
use Modern::Perl;
19
use RDF::Query::Client;
20
21
=head2 Execute 
22
    Execute sparql query on Sparql endpoint.
23
=cut
24
25
sub Execute {
26
  my ($sparql,$endpoint) = @_;
27
  my $query = RDF::Query::Client->new($sparql);
28
  my $res = $query->execute($endpoint);
29
  _llog($query->error,"ERROR") if (defined $query->error) ;
30
  return $res;
31
}
32
33
34
sub GetPredicatesAndObjectsForSubject {
35
  my ($subject,$endpoint,$query) = @_;
36
37
  my $sparql;
38
  if (!defined $query) {
39
    $sparql = 'SELECT DISTINCT ?p ?o WHERE { '.$subject.'  ?p ?o .  } ';
40
  } else {
41
    $sparql = $query;
42
  }
43
  _llog ($sparql,"sparql>","<sparql");
44
45
  my $iterator = &Execute ($sparql,$endpoint);
46
  return $sparql if (!defined $iterator) ;
47
48
  my %predicates;
49
  while (my $row = $iterator->next) {
50
    my $object;
51
    my $predicate;
52
    if ($row->{o}->type eq "URI") {
53
      $object= $row->{o}->uri_value;
54
    } else {
55
      $object = $row->{o}[0];
56
    }
57
    if ($row->{p}->type eq "URI") {
58
      $predicate = $row->{p}->uri_value;
59
    } else {
60
      $predicate = $row->{p}[0];
61
    }
62
    if (exists $predicates{$predicate}) {
63
      push @{$predicates{$predicate}}, $object;
64
    } else {
65
      $predicates{$predicate} = [$object];
66
    }
67
  }
68
  _llog (\%predicates,"pre>","<pre");
69
  return %predicates;
70
71
}
72
73
sub _llog {
74
  my ($var,$a,$b) = @_;
75
  use Data::Dumper;
76
  $a = "" if !defined $a;
77
  $b = "" if !defined $b;
78
  warn Dumper($a . '>>>');
79
  warn Dumper($var);
80
  warn Dumper($b . '<<<');
81
}
82
83
=head1 AUTHOR
84
Claire Hernandez, E<lt>claire.hernandez@biblibre.comE<gt>
85
=cut
86
87
1;
88
89
__END__
(-)a/Koha/Explore/Wikidata.pm (+224 lines)
Line 0 Link Here
1
package Koha::Explore::Wikidata;
2
3
use C4::Biblio;
4
5
=head1 NAME
6
7
Koha::Explore::Wikidata
8
9
10
=head1 SYNOPSIS
11
12
    use Koha::Explore::Wikidata;
13
14
=head1 FUNCTIONS
15
16
=cut
17
18
use Modern::Perl;
19
use Koha::Explore::Sparql;
20
21
my $endpoint = "https://query.wikidata.org/bigdata/namespace/wdq/sparql";
22
23
=head2 GetDataForAuthor 
24
    Execute sparql query on Sparql endpoint.
25
=cut
26
sub GetDataForAuthor {
27
  my ($wdid) = @_;
28
  my $id = _get_wd_id ($wdid);
29
30
  my $sparql = '
31
    SELECT DISTINCT ?p ?o
32
    WHERE {
33
      {
34
        wd:'.$id.'  ?p ?o .
35
        FILTER(LANG(?o) = "en") .
36
      }
37
      UNION
38
      {
39
        wd:'.$id.'  ?p ?o . 
40
        ?o rdfs:label ?label . 
41
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
42
      }
43
    }
44
    ';
45
  my %data = Koha::Explore::Sparql::GetPredicatesAndObjectsForSubject (
46
    undef,$endpoint,$sparql
47
    );
48
  _llog(\%data,"author data");
49
  return \%data;
50
}
51
52
=head2 GetDataForBiblio 
53
    Execute sparql query on Sparql endpoint.
54
=cut
55
56
sub GetDataForBiblio {
57
  my ($ark) = @_;
58
59
  my $ark_part = _get_clean_part($ark);
60
61
  my $sparql = '
62
    SELECT ?wdwork 
63
    WHERE { ?wdwork wdt:P268 ?idbnf FILTER CONTAINS(?idbnf, "'.$ark_part.'") . }
64
  ';
65
  my $iterator = Koha::Explore::Sparql::Execute ($sparql,$endpoint);
66
  return $sparql if (! defined $iterator) ;
67
  my $firstrow = $iterator->next;
68
  my $wdid = $firstrow->{wdwork}[1];
69
  $wdid =~ /.*\/(.*)/;
70
  my $id = $1;
71
72
  $sparql = '
73
    SELECT DISTINCT ?p ?o
74
    WHERE {
75
      {
76
        wd:'.$id.'  ?p ?o .
77
        FILTER(LANG(?o) = "en") .
78
      }
79
      UNION
80
      {
81
        wd:'.$id.'  ?p ?o . 
82
        ?o rdfs:label ?label . 
83
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
84
      }
85
    }
86
    ';
87
  my %data = Koha::Explore::Sparql::GetPredicatesAndObjectsForSubject (
88
    "wd:".$wdid,$endpoint,$sparql
89
    );
90
91
  _llog(\%data,"biblio data");
92
  return \%data;
93
}
94
95
96
#sub GetDataForAuthor {
97
#  my ($wdworkid) = @_;
98
#  my $workid = substr($wdworkid,30);
99
#  _llog($workid, "AUTHIDWD");
100
#
101
#  my $sparql = '
102
#    SELECT ?wdauthor ?birthdate ?deathdate ?image ?workperiod  ?name WHERE {
103
#      wd:'.$workid.' wdt:P50 ?wdauthor.
104
#      OPTIONAL { ?wdauthor wdt:P18 ?image. }
105
#      OPTIONAL { ?wdauthor wdt:P2031 ?workperiod. }
106
#      optional { ?wdauthor wdt:P570 ?deathdate} .
107
#      OPTIONAL { ?wdauthor wdt:P1477 ?name. }
108
#      OPTIONAL { ?wdauthor wdt:P569 ?birthdate. }
109
#    }
110
#    ';
111
#  _llog ($sparql,"AUTHOR");
112
#return $sparql;
113
#  # Autres properties exploitables:
114
#  # pseudonym P742
115
#  # occupation P106
116
#  # genre P136
117
#  # influenced by P737
118
#  # work period (start) P2031
119
#  # notable work P800
120
#
121
#  my $iterator = _execute_sparql_query ($sparql);
122
#  return $sparql if (!defined $iterator) ;
123
#  my $firstrow = $iterator->next;
124
#  ## _llog ($firstrow);
125
#  my $dataFromWD = {
126
#     'wdauthor'        => $firstrow->{wdauthor}[1],
127
#     'name'            => $firstrow->{name}[0],
128
#     'birthdate'       => $firstrow->{birthdate}[0],
129
#     'deathdate'       => $firstrow->{deathdate}[0],
130
#     'image'           => $firstrow->{image}[1],
131
#     'workperiod'      => $firstrow->{workperiod}[0],
132
#  };
133
#   _llog ($dataFromWD);
134
#  return $dataFromWD;
135
#}
136
#
137
#=head2 GetDataForBiblio 
138
#    Execute sparql query on Sparql endpoint.
139
#=cut
140
#
141
#sub GetDataForBiblio {
142
#  my ($ark) = @_;
143
#
144
# my $ark_part = substr($ark,37);
145
# my $offset = length($ark_part) -6;
146
# $ark_part = substr ($ark_part, 0, $offset) if ($ark =~ m/#about/);
147
# return $ark_part;
148
#
149
#  my $sparql = '
150
#    SELECT ?wdwork ?wdworkDescription ?wdauthor ?wdauthorLabel ?countryoriginLabel  ?serieLabel  ?pubdate ?genreLabel
151
#    WHERE
152
#    {
153
#      ?wdwork wdt:P268  ?idbnf
154
#      FILTER CONTAINS(?idbnf, "'. $ark_part .'").
155
#      ?wdwork wdt:P50 ?wdauthor .
156
#      OPTIONAL { ?wdwork wdt:P495 ?countryorigin .}
157
#      OPTIONAL { ?wdwork wdt:P577 ?pubdate .}
158
#      OPTIONAL { ?wdwork wdt:P179 ?serie .}
159
#      OPTIONAL { ?wdwork wdt:P136 ?genre .}
160
#      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr". }
161
#    }
162
#
163
#  ';
164
#return $sparql;
165
#
166
## Non gérés: 
167
## si plusieurs résultats
168
## si plusieurs valeurs (ex: genre)
169
## la langue du service de label
170
#
171
#  my $iterator = _execute_sparql_query ($sparql);
172
#  return $sparql if (! defined $iterator) ;
173
#  my $firstrow = $iterator->next;
174
# ## _llog ($firstrow);
175
#  my $dataFromWD = {
176
#     'wdwork'              => $firstrow->{wdwork}[1],
177
#     'wdworkDescription'  => $firstrow->{wdworkDescription}[0],
178
#     'wdauthor'           => $firstrow->{wdauthor}[1],
179
#     'wdauthorLabel'      => $firstrow->{wdauthorLabel}[0],
180
#     'countryoriginLabel' => $firstrow->{countryoriginLabel}[0],
181
#     'serieLabel'         => $firstrow->{serieLabel}[0],
182
#     'pubdate'            => $firstrow->{pubDate}[0],
183
#     'genreLabel'         => $firstrow->{genreLabel}[0],
184
#  };
185
#  _llog ($dataFromWD);
186
#  return $dataFromWD;
187
#}
188
189
sub _llog {
190
  my ($var,$a,$b) = @_;
191
  use Data::Dumper;
192
  $a = "" if !defined $a;
193
  $b = "" if !defined $b;
194
  warn Dumper($a . '##############################################');
195
  warn Dumper($var);
196
  warn Dumper($b . '##############################################');
197
}
198
199
sub _get_clean_part {
200
  my ($ark) = @_;
201
202
  $ark =~ /.*\/(.*)/;
203
  my $ark_part = $1;
204
  $ark_part = substr ($ark_part, 2, length($ark_part));
205
206
  my $offset = length($ark_part) -6;
207
  $ark_part = substr ($ark_part, 0, $offset) if ($ark =~ m/#about/);
208
209
  return $ark_part;
210
}
211
212
sub _get_wd_id {
213
  my ($wdid) = @_;
214
  $wdid =~ /.*\/(.*)/;
215
  return $1;
216
}
217
218
=head1 AUTHOR
219
Claire Hernandez, E<lt>claire.hernandez@biblibre.comE<gt>
220
=cut
221
222
1;
223
224
__END__
(-)a/Koha/Template/Plugin/Explore.pm (+54 lines)
Line 0 Link Here
1
package Koha::Template::Plugin::Explore;
2
3
4
5
use Modern::Perl;
6
7
use base qw( Template::Plugin );
8
9
use C4::Context;
10
use C4::Biblio;
11
use Koha;
12
use Koha::Explore::Wikidata;
13
use Koha::Explore::Bnf;
14
15
=pod
16
17
Explore catalog data with linked data.
18
19
To use, first, include the line '[% USE Koha %]' at the top
20
of the template to enable the plugin.
21
22
For example: [% IF Koha.Preference( 'MyPreference ) == 'SettingA' %]
23
removes the necessity of setting a template variable in Perl code for
24
each and every system preference, even if no evaluation of the setting
25
is necessary.
26
27
=cut
28
29
30
sub GetAllAuthorData {
31
  my ($self,$wddocid) = @_;
32
  my $source = C4::Context->preference("Explore");
33
  return Koha::Explore::Wikidata::GetDataForAuthor($wddocid) if $source eq "Wikidata";
34
  return Koha::Explore::Bnf::GetDataForAuthor($wddocid) if $source eq "Bnf";
35
}
36
37
sub GetAllBiblioData {
38
  my ($self,$ark) = @_;
39
  my $source = C4::Context->preference("Explore");
40
  warn "source" . $source;
41
  warn "ark" . $ark;
42
  return Koha::Explore::Wikidata::GetDataForBiblio($ark) if $source eq "Wikidata";
43
  return Koha::Explore::Bnf::GetDataForBiblio($ark) if $source eq "Bnf";
44
}
45
46
#warn &GetAllBiblioData(undef, "http://data.bnf.fr/ark:/12148/cb347444570");
47
#warn &GetAllBiblioData(undef, "http://data.bnf.fr/ark:/12148/cb13516296h");
48
#&GetAllAuthorData(undef,"http://data.bnf.fr/ark:/12148/cb137554124#about");
49
50
#&GetAllAuthorData(undef,"https://www.wikidata.org/wiki/Q180736");
51
#&GetAllAuthorData(undef,"https://www.wikidata.org/wiki/Q535");
52
#&GetAllBiblioData(undef, "http://catalogue.bnf.fr/ark:/12148/cb13516296h#about");
53
54
1;
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/explore/bnf.inc (+96 lines)
Line 0 Link Here
1
<script>
2
  function showDebug() {
3
    var x = document.getElementById("debug");
4
    if (x.style.display === "none") {
5
        x.style.display = "block";
6
    } else {
7
        x.style.display = "none";
8
    }
9
}
10
</script>
11
12
[%
13
  biblioData = Explore.GetAllBiblioData(biblio.abstract)
14
%]
15
<div id="ulactioncontainer">
16
  <ul id="action">
17
    <li>Ark used : <a href="[% biblio.abstract %]">[% biblio.abstract %]</a></li>
18
    <li><u>Query on ark for the document: </u></li>
19
    [% FOREACH p IN biblioData -%]
20
      [% FOREACH o IN p.value -%]
21
22
        [% SWITCH p.key %]
23
        [%   CASE 'http://purl.org/dc/terms/title' %]
24
          <li>Title at la bnf: [% o %]</li>
25
        [%   CASE 'http://data.bnf.fr/ontology/bnf-onto/isbn' %]
26
          <li>ISBN: [% o %]</li>
27
        [%   CASE 'http://data.bnf.fr/ontology/bnf-onto/ouvrageJeunesse' %]
28
          <li>Type: Youth</li>
29
        [%   CASE 'http://data.bnf.fr/ontology/bnf-onto/subject' %]
30
          <li>Type: [% o %]</li>
31
        [%   CASE 'http://rdvocab.info/Elements/dateOfWork' %]
32
          <li>Work published in: <a href="[% o %]">[% o %]</a></li>
33
        [%   CASE 'http://purl.org/dc/terms/description' %]
34
          <li>Description: [% o %]</li>
35
        [%   CASE 'http://purl.org/dc/terms/publisher' %]
36
          <li>Publisher: [% o %]</li>
37
        [%   CASE 'http://rdvocab.info/RDARelationshipsWEMI/workManifested' %]
38
          <li>Work: <a href="[% o %]">[% o %]</a></li>
39
          [%
40
            authorData = Explore.GetAllAuthorData(o)
41
            idused = o
42
          %]
43
        [%   CASE ['http://www.w3.org/2000/01/rdf-schema#seeAlso','http://www.w3.org/2002/07/owl#sameAs'] %]
44
          <li>See also:<a href="[% o %]">[% o %]</a></li>
45
        [% END %]
46
      [% END -%]
47
    [% END -%]
48
  </ul>
49
</div>
50
<div id="ulactioncontainer">
51
  <ul id="action">
52
    <li>Id used : <a href="[% idused %]">[% idused %]</a></li>
53
    <li><u>(BNF) Query on author</u></li>
54
    [% IF authorData == ''%]
55
        Nothing to display
56
    [% ELSE %]
57
      [% FOREACH p IN authorData -%]
58
        [% FOREACH o IN p.value -%]
59
          [% SWITCH p.key %]
60
          [%   CASE 'http://xmlns.com/foaf/0.1/depiction' %]
61
            [% IF depiction != "displayed" %]
62
            <li><img src="[% o %]" width="50%" /></li>
63
            [% END %]
64
            [% depiction = "displayed" %]
65
          [%   CASE 'http://xmlns.com/foaf/0.1/name' %]
66
            <li>Name: [% o %]</li>
67
          [%   CASE 'http://rdvocab.info/ElementsGr2/biographicalInformation' %]
68
            <li>Bio : [% o %]</li>
69
          [%   CASE 'http://xmlns.com/foaf/0.1/page' %]
70
            <li><a href="[% o %]">Read on bnf.fr</a></li>
71
          [% END %]
72
        [% END -%]
73
      [% END -%]
74
    [% END %]
75
  <ul>
76
</div>
77
78
<button onclick="showDebug()">Show/Hide debug stuffs</button>
79
<div id="debug" style="display:none;">
80
  <ul id="action">
81
    [% biblioData %]
82
    [% authorData %]
83
    <li><u>DEBUG BNF for biblio</u></li>
84
    [% FOREACH p IN biblioData -%]
85
      [% FOREACH o IN p.value -%]
86
      <li>>[% p.key %]</u> : [% o %]</li>
87
      [% END -%]
88
    [% END -%]
89
    <hr>
90
    <li><u>DEBUG BNF for author</u></li>
91
    [% FOREACH p IN authorData -%]
92
      [% FOREACH o IN p.value -%]
93
      <li>>[% p.key %]</u> : [% o %]</li>
94
      [% END -%]
95
    [% END -%]
96
</div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/explore/wikidata.inc (+122 lines)
Line 0 Link Here
1
<script>
2
  function showDebug() {
3
    var x = document.getElementById("debug");
4
    if (x.style.display === "none") {
5
        x.style.display = "block";
6
    } else {
7
        x.style.display = "none";
8
    }
9
}
10
</script>
11
12
[%
13
  biblioData = Explore.GetAllBiblioData(biblio.abstract)
14
%]
15
<div id="ulactioncontainer">
16
  <ul id="action">
17
    <li>Ark used : <a href="[% biblio.abstract %]">[% biblio.abstract %]</a></li>
18
    <li><u>(WD) Query on ark for the document: </u></li>
19
    [% lo = "no" %]
20
    [% FOREACH p IN biblioData -%]
21
        [% SWITCH p.key %]
22
        [%   CASE 'http://www.w3.org/2000/01/rdf-schema#label' %]
23
          <li>Title : 
24
          [% lo = "loop" %]
25
        [%   CASE 'http://schema.org/description' %]
26
          <li>Description: 
27
          [% lo = "loop" %]
28
        [%   CASE 'http://www.wikidata.org/prop/direct/P50' %]
29
          <li>Author: 
30
          [% lo = "loop" %]
31
        [%   CASE 'http://www.wikidata.org/prop/direct/P136' %]
32
          <li>Genre : 
33
          [% lo = "loop" %]
34
        [%   CASE 'http://www.wikidata.org/prop/direct/P110' %]
35
          <li>Illustrated by: 
36
          [% lo = "loop" %]
37
        [% END %]
38
        [% IF lo == "loop" %]
39
          [% FOREACH o IN p.value -%]
40
            [% IF o.match("http") %]
41
              <a href="[% o %]">[% o.match(".*\/(.*)").0 %]</a> 
42
            [% ELSE %]
43
              [% o %]
44
            [% END -%]
45
          [% lo = "no" %]
46
          [% END -%]
47
        [% END -%]
48
        [% IF p.key == "http://www.wikidata.org/prop/direct/P50" %]
49
          [%
50
            authorData = Explore.GetAllAuthorData(o)
51
            wdused = o
52
          %]
53
        [% END -%]
54
      </li>
55
    [% END -%]
56
  </ul>
57
</div>
58
<div id="ulactioncontainer">
59
  <ul id="action">
60
    <li>WD id used : <a href="[% wdused %]">[% wdused %]</a></li>
61
    <li><u>(WD) Query on author</u></li>
62
      [% IF authorData == ''%]
63
        Nothing to display
64
      [% ELSE %]
65
      [% lo = "no" %]
66
      [% FOREACH p IN authorData -%]
67
        [% SWITCH p.key %]
68
        [%   CASE '' %]
69
          <li><img src="[% o %]" width="50%" /></li>
70
          [% lo = "loop" %]
71
        [%   CASE 'http://www.w3.org/2000/01/rdf-schema#label' %]
72
          <li>Name: 
73
          [% lo = "loop" %]
74
        [%   CASE 'http://schema.org/description' %]
75
          <li>Bio : 
76
          [% lo = "loop" %]
77
        [%   CASE 'http://www.wikidata.org/prop/direct/P106' %]
78
          <li>Occupation : 
79
          [% lo = "loop" %]
80
        [%   CASE 'http://www.wikidata.org/prop/direct/P166' %]
81
          <li>Award received : 
82
          [% lo = "loop" %]
83
        [%   CASE 'http://www.wikidata.org/prop/direct/P800' %]
84
          <li>Notable work : 
85
          [% lo = "loop" %]
86
        [%   CASE 'http://www.wikidata.org/prop/direct/P737' %]
87
          <li>Influenced by : 
88
          [% lo = "loop" %]
89
        [% END %]
90
        [% IF lo == "loop" %]
91
          [% FOREACH o IN p.value -%]
92
            [% IF o.match("http") %]
93
              <a href="[% o %]">[% o.match(".*\/(.*)").0 %]</a> 
94
            [% ELSE %]
95
              [% o %]
96
            [% END -%]
97
          [% END -%]
98
          [% lo = "no" %]
99
        [% END -%]
100
        </li>
101
      [% END -%]
102
    [% END %]
103
  <ul>
104
</div>
105
106
<button onclick="showDebug()">Show/Hide debug stuffs</button>
107
<div id="debug" style="display:none;">
108
  <ul id="action">
109
    <li><u>DEBUG WD for biblio</u></li>
110
    [% FOREACH p IN biblioData -%]
111
      [% FOREACH o IN p.value -%]
112
      <li>>[% p.key %]</u> : [% o %]</li>
113
      [% END -%]
114
    [% END -%]
115
    <hr>
116
    <li><u>DEBUG WD for author</u></li>
117
    [% FOREACH p IN authorData -%]
118
      [% FOREACH o IN p.value -%]
119
      <li>>[% p.key %]</u> : <a href="[% o %]">[% o %]</a></li>
120
      [% END -%]
121
    [% END -%]
122
</div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (+10 lines)
Lines 5-10 Link Here
5
[% USE Branches %]
5
[% USE Branches %]
6
[% USE ColumnsSettings %]
6
[% USE ColumnsSettings %]
7
[% USE AuthorisedValues %]
7
[% USE AuthorisedValues %]
8
[% USE Explore %]
8
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %]
9
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %]
9
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %]
10
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %]
10
[% IF Koha.Preference('AmazonAssocTag') %]
11
[% IF Koha.Preference('AmazonAssocTag') %]
Lines 587-592 Link Here
587
                            [% IF ( SyndeticsAuthorNotes && SYNDETICS_ANOTES ) %]
588
                            [% IF ( SyndeticsAuthorNotes && SYNDETICS_ANOTES ) %]
588
                                <li id="tab_anotes"> <a href="#anotes">About the author</a></li>
589
                                <li id="tab_anotes"> <a href="#anotes">About the author</a></li>
589
                            [% END %]
590
                            [% END %]
591
590
                        [% END # / IF SyndeticsEnabled %]
592
                        [% END # / IF SyndeticsEnabled %]
591
593
592
                        [% IF ( LibraryThingForLibrariesID && LibraryThingForLibrariesTabbedView ) %]
594
                        [% IF ( LibraryThingForLibrariesID && LibraryThingForLibrariesTabbedView ) %]
Lines 716-721 Link Here
716
                        </div>
718
                        </div>
717
                    [% END # / SeparateHoldings %]
719
                    [% END # / SeparateHoldings %]
718
720
721
719
                    [% IF ( MARCNOTES || notes || ( SyndeticsEnabled && SyndeticsSummary && SYNDETICS_SUMMARY )) %]
722
                    [% IF ( MARCNOTES || notes || ( SyndeticsEnabled && SyndeticsSummary && SYNDETICS_SUMMARY )) %]
720
                        <div id="descriptions">
723
                        <div id="descriptions">
721
                            <div class="content_set">
724
                            <div class="content_set">
Lines 1157-1164 Link Here
1157
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1160
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1158
                        <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title |url %]" data-lang="[% lang %]">Tweet</a></div>
1161
                        <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title |url %]" data-lang="[% lang %]">Tweet</a></div>
1159
                    </div>
1162
                    </div>
1163
1164
1160
                [% END %]
1165
                [% END %]
1161
            </div> <!-- / .ulactioncontainer -->
1166
            </div> <!-- / .ulactioncontainer -->
1167
            [% IF Koha.Preference( 'Explore' ) == 'Wikidata' %]
1168
              [% INCLUDE 'explore/wikidata.inc' %]
1169
            [% ELSIF Koha.Preference( 'Explore' ) == 'Bnf' %]
1170
              [% INCLUDE 'explore/bnf.inc' %]
1171
            [% END %]
1162
        </div> <!-- / .span4 -->
1172
        </div> <!-- / .span4 -->
1163
    </div> <!-- / .row-fluid -->
1173
    </div> <!-- / .row-fluid -->
1164
    <div class="row-fluid">
1174
    <div class="row-fluid">
(-)a/opac/opac-detail.pl (+8 lines)
Lines 1197-1200 $template->param( Link Here
1197
    'OpacLocationBranchToDisplay' => C4::Context->preference('OpacLocationBranchToDisplay'),
1197
    'OpacLocationBranchToDisplay' => C4::Context->preference('OpacLocationBranchToDisplay'),
1198
);
1198
);
1199
1199
1200
1201
# Explore
1202
if( C4::Context->preference('Explore') ) 
1203
{ 
1204
$template->param(Explore => C4::Context->preference('Explore') ); 
1205
} 
1206
1207
1200
output_html_with_http_headers $query, $cookie, $template->output;
1208
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/t/Koha_Template_Plugin_Explore.t (-1 / +37 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 2;
21
use Test::MockModule;
22
23
use String::Random;
24
25
# Test the plugin is usable
26
use_ok( 'Koha::Template::Plugin::Explore' );
27
ok( my $cache = Koha::Template::Plugin::Explore->new() );
28
29
subtest "Koha::Template::Plugin::Explore::GetWikidataForBiblio tests" => sub {
30
31
    plan tests => 1;
32
    my $expected = "test";
33
    my $biblionumber = "273049";
34
    my $res = Koha::Template::Plugin::Explore::GetWikidataForBiblio($biblionumber);
35
    is( $res, $expected , "Correct development version");
36
};
37

Return to bug 21074