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

(-)a/catalogue/showelastic.pl (+64 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Koha library project  www.koha-community.org
4
5
# Copyright 2007 Liblime
6
# Parts copyright 2010 BibLibre
7
#
8
# This file is part of Koha.
9
#
10
# Koha is free software; you can redistribute it and/or modify it under the
11
# terms of the GNU General Public License as published by the Free Software
12
# Foundation; either version 3 of the License, or (at your option) any later
13
# version.
14
#
15
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License along
20
# with Koha; if not, write to the Free Software Foundation, Inc.,
21
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
23
use Modern::Perl;
24
25
# standard or CPAN modules used
26
use CGI qw(:standard -utf8);
27
use DBI;
28
use Encode;
29
30
# Koha modules used
31
use C4::Context;
32
use C4::Output;
33
use C4::Auth;
34
use C4::Biblio;
35
use C4::ImportBatch;
36
use C4::XSLT ;
37
use Koha::SearchEngine::Elasticsearch;
38
use LWP::Simple qw/get/;
39
40
my $input= new CGI;
41
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
42
  {
43
    template_name   => "catalogue/showelastic.tt",
44
    query           => $input,
45
    type            => "intranet",
46
    authnotrequired => 0,
47
    flagsrequired   => { catalogue => 1  },
48
    debug           => 1,
49
  }
50
);
51
52
my $biblionumber = $input->param('id');
53
54
my $es_conf = Koha::SearchEngine::Elasticsearch->new({index=>'biblios'})->get_elasticsearch_params();
55
my $es_url;
56
my $es_record;
57
58
foreach my $es_node ( @{$es_conf->{nodes}} ){
59
    $es_url = "http://".$es_node."/".$es_conf->{index_name}."/data/$biblionumber";
60
    $es_record = get($es_url);
61
}
62
63
$template->param( esrecord => $es_record);
64
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-3 / +35 lines)
Lines 97-103 Link Here
97
                    [% END %]
97
                    [% END %]
98
                    </span>
98
                    </span>
99
        [% END %]
99
        [% END %]
100
        <span id="catalogue_detail_marc_preview" class="results_summary"><span class="label">MARC Preview:</span> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblionumber | uri %]&amp;viewas=html" title="MARC" class="previewMARC">Show</a></span>
100
101
        <span id="catalogue_detail_marc_preview" class="results_summary"><span class="label">MARC Preview:</span> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblionumber | uri %]&amp;viewas=html " title="MARC" class="previewMARC">Show</a></span>
102
103
        [% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %]
104
            <span id="catalogue_detail_elastic_record" class="results_summary"><span class="label">Elasticsearch Record :</span> <a href="/cgi-bin/koha/catalogue/showelastic.pl?id=[% biblionumber | uri %]" title="ELASTIC" class="previewElastic">Show</a></span>
105
        [% END %]
101
106
102
        [% IF ( holdcount ) %]
107
        [% IF ( holdcount ) %]
103
            <span class="results_summary">
108
            <span class="results_summary">
Lines 736-741 Link Here
736
    </div>
741
    </div>
737
</div>
742
</div>
738
743
744
<div id="elasticPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="elasticPreviewLabel" aria-hidden="true">
745
    <div class="modal-dialog modal-lg">
746
    <div class="modal-content">
747
    <div class="modal-header">
748
        <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
749
        <h3 id="elasticPreviewLabel">Elastic record</h3>
750
    </div>
751
    <div class="modal-body">
752
        <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
753
    </div>
754
    <div class="modal-footer">
755
        <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
756
    </div>
757
    </div>
758
    </div>
759
</div>
760
739
            </main>
761
            </main>
740
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
762
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
741
763
Lines 919-928 Link Here
919
                var page = $(this).attr("href");
941
                var page = $(this).attr("href");
920
                $("#marcPreview .modal-body").load(page + " table");
942
                $("#marcPreview .modal-body").load(page + " table");
921
                $('#marcPreview').modal({show:true});
943
                $('#marcPreview').modal({show:true});
944
922
            });
945
            });
923
            $("#marcPreview").on("hidden.bs.modal", function(){
946
924
                $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
947
           [% IF ( Koha.Preference('SearchEngine') == 'Elasticsearch' ) %]
948
            $("body").on("click",".previewElastic", function(event){
949
                event.preventDefault();
950
                let pageElastic = $(this).attr("href");
951
                $("#elasticPreview .modal-body").load(pageElastic);
952
                $('#elasticPreview').modal({show:true});
925
            });
953
            });
954
            [% END %]
955
926
            [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
956
            [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
927
                novSelect.loadContentForQuery({
957
                novSelect.loadContentForQuery({
928
                    ClientIdentifier : '[% IF normalized_isbn %][% normalized_isbn | html %][% ELSE %][% normalized_upc | html %][% END %]',
958
                    ClientIdentifier : '[% IF normalized_isbn %][% normalized_isbn | html %][% ELSE %][% normalized_upc | html %][% END %]',
Lines 943-948 Link Here
943
        [% IF ( AmazonCoverImages || LocalCoverImages ) %]$(window).load(function() {
973
        [% IF ( AmazonCoverImages || LocalCoverImages ) %]$(window).load(function() {
944
            verify_images();
974
            verify_images();
945
        });[% END %]
975
        });[% END %]
976
946
    </script>
977
    </script>
947
    [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
978
    [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
948
        <script src="https://imageserver.ebscohost.com/novelistselect/ns2init.js"></script>
979
        <script src="https://imageserver.ebscohost.com/novelistselect/ns2init.js"></script>
Lines 989-993 Link Here
989
            [% END %]
1020
            [% END %]
990
        });
1021
        });
991
    </script>
1022
    </script>
1023
992
[% END %]
1024
[% END %]
993
[% INCLUDE 'intranet-bottom.inc' %]
1025
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/showelastic.tt (-1 / +35 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Cataloging &rsaquo; MARC import</title>
3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
</head>
5
<body id="catalog_showelastic" class="catalog">
6
    <pre id="main" style="direction: ltr;">
7
8
    </pre>
9
</body>
10
<footer>
11
    <style>
12
        textarea
13
        {
14
            width: 100%;
15
            min-height: 40em;
16
            background-color : white;
17
            resize:none;
18
        }
19
    </style>
20
    <script>
21
22
        display();
23
24
        function display() {
25
            let myJSON = JSON.stringify([% esrecord %], null, '\t');
26
            let decode = decodeURIComponent(escape(myJSON));
27
            let para = document.createElement('textarea');
28
            para.disabled="yes";
29
            para.textContent = decode;
30
            document.getElementById('main').appendChild(para);
31
        }
32
33
    </script>
34
</footer>
35
</html>

Return to bug 18829