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

(-)a/admin/sru_modmapping.pl (+46 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2014 Rijksmuseum
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
use CGI;
22
use C4::Auth;
23
use C4::Output;
24
25
# Initialize CGI, template
26
27
my $input = new CGI;
28
my $mapstr = $input->param('mapping')//'';
29
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( {
30
    template_name => "admin/sru_modmapping.tt",
31
    query => $input,
32
    type => "intranet",
33
    authnotrequired => 0,
34
});
35
36
# Main code: convert mapping string to hash structure and show template
37
38
my %map;
39
foreach my $singlemap ( split ',', $mapstr ) {
40
    my @temp = split '=', $singlemap;
41
    $map{ $temp[0] } = $temp[1] if @temp>1;
42
}
43
$template->param( mapping => \%map );
44
output_html_with_http_headers $input, $cookie, $template->output;
45
46
# End of main code
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sru_modmapping.tt (-1 / +91 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; SRU Search fields mapping</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
5
<script type="text/javascript">
6
//<![CDATA[
7
    $(document).ready(function() {
8
        $("#form01").submit(function(event) {
9
            if(window.opener) {
10
                var newmap=allInputs();
11
                window.opener.$('#show_sru_fields').val(newmap);
12
                window.close();
13
            } else {
14
                // In this case not called as a popup. Just do nothing.
15
                event.preventDefault();
16
            }
17
        });
18
    });
19
    function allInputs () {
20
        var aInput= new Array();
21
        $("form :input").each(function() {
22
            if( this.id && $(this).val() ) {
23
                aInput.push(this.id+'='+$(this).val());
24
            }
25
        });
26
        return aInput.join(',');
27
    }
28
//]]>
29
</script>
30
</head>
31
32
<body id="sru_modmapping">
33
<div id="custom-doc" class="yui-t7">
34
35
    <div id="bd">
36
        <h1>Modify SRU Search fields mapping</h1>
37
        <form id="form01" method="post">
38
            <fieldset class="rows">
39
                <legend>Legend </legend>
40
                <ul>
41
                <li>
42
                <label for="Title">Title: </label>
43
                <input id="title" type="text" value="[% mapping.title %]" />
44
                </li>
45
                <li>
46
                <label for="ISBN">ISBN: </label>
47
                <input id="isbn" type="text" value="[% mapping.isbn %]" />
48
                </li>
49
                <li>
50
                <label for="LCCall">LC Call No: </label>
51
                <input id="lccall" type="text" value="[% mapping.lccall %]" />
52
                </li>
53
                <li>
54
                <label for="Control number">Control no: </label>
55
                <input id="controlnumber" type="text" value="[% mapping.controlnumber %]" />
56
                </li>
57
                <li>
58
                <label for="Any">Any: </label>
59
                <input id="srchany" type="text" value="[% mapping.srchany %]" />
60
                </li>
61
                <li>
62
                <label for="Author">Author: </label>
63
                <input id="author" type="text" value="[% mapping.author %]" />
64
                </li>
65
                <li>
66
                <label for="ISSN">ISSN: </label>
67
                <input id="issn" type="text" value="[% mapping.issn %]" />
68
                </li>
69
                <li>
70
                <label for="Subject">Subject: </label>
71
                <input id="subject" type="text" value="[% mapping.subject %]" />
72
                </li>
73
                <li>
74
                <label for="Dewey">Dewey: </label>
75
                <input id="dewey" type="text" value="[% mapping.dewey %]" />
76
                </li>
77
                <li>
78
                <label for="Standard ID">Standard ID: </label>
79
                <input id="stdid" type="text" value="[% mapping.stdid %]" />
80
                </li>
81
82
                </ul>
83
            </fieldset>
84
            <fieldset class="action">
85
                <input type="submit" value="Save" class="submit" />
86
                <a class="close cancel" href="#">Cancel</a>
87
            </fieldset>
88
        </form>
89
    </div>
90
91
[% INCLUDE 'intranet-bottom.inc' %]

Return to bug 6536