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

(-)a/C4/Breeding.pm (-1 / +10 lines)
Lines 156-165 sub Z3950Search { Link Here
156
    );
156
    );
157
    my @servers = $rs->all;
157
    my @servers = $rs->all;
158
    foreach my $server ( @servers ) {
158
    foreach my $server ( @servers ) {
159
        my $server_zquery = $zquery;
160
        if(my $attributes = $server->{attributes}){
161
            $server_zquery = "$attributes $zquery";
162
        }
159
        $oConnection[$s] = _create_connection( $server );
163
        $oConnection[$s] = _create_connection( $server );
160
        $oResult[$s] =
164
        $oResult[$s] =
161
            $server->{servertype} eq 'zed'?
165
            $server->{servertype} eq 'zed'?
162
                $oConnection[$s]->search_pqf( $zquery ):
166
                $oConnection[$s]->search_pqf( $server_zquery ):
163
                $oConnection[$s]->search(new ZOOM::Query::CQL(
167
                $oConnection[$s]->search(new ZOOM::Query::CQL(
164
                    _translate_query( $server, $squery )));
168
                    _translate_query( $server, $squery )));
165
        $s++;
169
        $s++;
Lines 532-537 sub Z3950SearchAuth { Link Here
532
    my $record;
536
    my $record;
533
    my @serverhost;
537
    my @serverhost;
534
    my @servername;
538
    my @servername;
539
    my @server_attributes = ();
535
    my @breeding_loop = ();
540
    my @breeding_loop = ();
536
541
537
    my @oConnection;
542
    my @oConnection;
Lines 617-628 sub Z3950SearchAuth { Link Here
617
            $serverhost[$s] = $server->{host};
622
            $serverhost[$s] = $server->{host};
618
            $servername[$s] = $server->{servername};
623
            $servername[$s] = $server->{servername};
619
            $encoding[$s]   = ($server->{encoding}?$server->{encoding}:"iso-5426");
624
            $encoding[$s]   = ($server->{encoding}?$server->{encoding}:"iso-5426");
625
            $server_attributes[$s] = $server->{attributes};
620
            $s++;
626
            $s++;
621
        }    ## while fetch
627
        }    ## while fetch
622
    }    # foreach
628
    }    # foreach
623
    my $nremaining  = $s;
629
    my $nremaining  = $s;
624
630
625
    for ( my $z = 0 ; $z < $s ; $z++ ) {
631
    for ( my $z = 0 ; $z < $s ; $z++ ) {
632
        if(my $attributes = $server_attributes[$z]){
633
            $query = "$attributes $query";
634
        }
626
        $oResult[$z] = $oConnection[$z]->search_pqf($query);
635
        $oResult[$z] = $oConnection[$z]->search_pqf($query);
627
    }
636
    }
628
637
(-)a/admin/z3950servers.pl (-1 / +1 lines)
Lines 66-72 if( $op eq 'delete_confirmed' && $id ) { Link Here
66
    $id = 0;
66
    $id = 0;
67
} elsif ( $op eq 'add_validated' ) {
67
} elsif ( $op eq 'add_validated' ) {
68
    my @fields=qw/host port db userid password rank syntax encoding timeout
68
    my @fields=qw/host port db userid password rank syntax encoding timeout
69
        recordtype checked servername servertype sru_options sru_fields
69
        recordtype checked servername servertype sru_options sru_fields attributes
70
        add_xslt/;
70
        add_xslt/;
71
    my $formdata = _form_data_hashref( $input, \@fields );
71
    my $formdata = _form_data_hashref( $input, \@fields );
72
    if( $id ) {
72
    if( $id ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt (-2 / +77 lines)
Lines 18-23 Link Here
18
[% IF op == 'list' %]
18
[% IF op == 'list' %]
19
    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
19
    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
20
[% END %]
20
[% END %]
21
22
<script type="text/javascript">
23
//<![CDATA[
24
[% IF ( add_form ) %]
25
    $(document).ready(function(){
26
        // Update selects for syntax, encoding and recordtype
27
        [% IF server %]
28
            $("#syntax").val('[% server.syntax %]');
29
            $("#encoding").val('[% server.encoding %]');
30
            $("#recordtype").val('[% server.recordtype %]');
31
        [% END %]
32
        // Disable recordtype (and default to bib) for non-Z3950 servers until auth is supported
33
        [% UNLESS (server.servertype||type) == 'zed' %]
34
            $("#recordtype").prop('disabled',true);
35
        [% END %]
36
        $( "#serverentry" ).validate({
37
            rules: {
38
                servername: { required: true },
39
                host: { required: true },
40
                port: {
41
                    required: true,
42
                    number: true
43
                },
44
                db: { required: true },
45
                rank: { number: true },
46
                timeout: { number: true }
47
            }
48
        });
49
        $("#serverentry").submit(function( event ) {
50
            // first test if show_sru_fields exists
51
            if( $('#show_sru_fields').length && $('#show_sru_fields').val()=='' && !confirm( _("No SRU search field mappings have been defined. This means that all field searches will go through the whole record. Continue?"))) {
52
                return false;
53
            }
54
            // copy show_sru_fields to hidden counterpart
55
            $('#sru_fields').val( $('#show_sru_fields').val() );
56
            // enable recordtype to include field in post
57
            $('#recordtype').prop('disabled',false);
58
        });
59
        $("#servername").on("blur",function(){
60
            toUC(this);
61
        });
62
        $("#modify_sru_fields").on("click",function(){
63
            ModMapping();
64
        });
65
    });
66
    function ModMapping () {
67
        var map= $('#show_sru_fields').val();
68
        window.open('/cgi-bin/koha/admin/sru_modmapping.pl?mapping='+map,'popup','width=800,height=400,resizable=yes,toolbar=false,scrollbars=yes,top');
69
    }
70
[% ELSE %]
71
    $(document).ready(function() {
72
        $("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
73
            "aoColumnDefs": [
74
                { "aTargets": [-1], "bSortable": false, "bSearchable": false },
75
            ],
76
            "sPaginationType": "four_button"
77
        }));
78
        $(".delete").on("click",function(e){
79
            var servername = $(this).data("servername");
80
            if( confirm( _("Are you sure you want to delete server %s?").format(servername) ) ) {
81
                return true;
82
            } else {
83
                e.preventDefault();
84
            }
85
        });
86
    });
87
[% END %]
88
//]]>
89
</script>
90
21
</head>
91
</head>
22
92
23
<body id="admin_z3950servers" class="admin">
93
<body id="admin_z3950servers" class="admin">
Lines 83-88 Link Here
83
        </li>
153
        </li>
84
        <li><label for="rank">Rank (display order): </label> <input type="text" name="rank" id="rank" size="4" value="[% server.rank %]" />
154
        <li><label for="rank">Rank (display order): </label> <input type="text" name="rank" id="rank" size="4" value="[% server.rank %]" />
85
        </li>
155
        </li>
156
        [% IF (server.servertype||type) == 'zed' %]
157
        <li><label for="attributes">Attributes (additional PQF attributes added to each query): </label><input type="text" name="attributes" id="attributes" size="30" value="[% server.attributes %]" />
158
        </li>
159
        [% END %]
86
160
87
        <li><label for="syntax">Syntax (z3950 can send<br /> records in various format. Choose one): </label>
161
        <li><label for="syntax">Syntax (z3950 can send<br /> records in various format. Choose one): </label>
88
        <select name="syntax" id="syntax">
162
        <select name="syntax" id="syntax">
Lines 159-165 Link Here
159
        You searched for [% searchfield |html %]
233
        You searched for [% searchfield |html %]
160
    [% END %]
234
    [% END %]
161
    <table id="serverst">
235
    <table id="serverst">
162
        <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Preselected</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th></th>
236
237
        <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Preselected</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>Attributes</th><th>Options</th>
163
        </tr></thead>
238
        </tr></thead>
164
        <tbody>
239
        <tbody>
165
        [% FOREACH loo IN loop %]
240
        [% FOREACH loo IN loop %]
Lines 172-177 Link Here
172
                <span>Authority</span>
247
                <span>Authority</span>
173
                [% END %]
248
                [% END %]
174
            </td>
249
            </td>
250
            <td>[% loo.attributes %]</td>
175
            <td>
251
            <td>
176
                <div class="dropdown">
252
                <div class="dropdown">
177
                    <a class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id %]" role="button" data-toggle="dropdown" href="#">
253
                    <a class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id %]" role="button" data-toggle="dropdown" href="#">
178
- 

Return to bug 11297