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

(-)a/admin/z3950servers.pl (-206 / +97 lines)
Lines 1-221 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
#script to administer the branches table
3
# Copyright 2002 paul.poulain@free.fr
4
#written 20/02/2002 by paul.poulain@free.fr
4
# Copyright 2014 Rijksmuseum
5
# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html)
5
#
6
6
# This file is part of Koha.
7
# ALGO :
7
#
8
# this script use ano $op to know what to do.
8
# Koha is free software; you can redistribute it and/or modify it
9
# if $op is empty or none of the above values,
9
# under the terms of the GNU General Public License as published by
10
#	- the default screen is build (with all records, or filtered datas).
10
# the Free Software Foundation; either version 3 of the License, or
11
#	- the   user can clic on add, modify or delete record.
11
# (at your option) any later version.
12
# if $op=add_form
12
#
13
#	- if primkey exists, this is a modification,so we read the $primkey record
13
# Koha is distributed in the hope that it will be useful, but
14
#	- builds the add/modify form
14
# WITHOUT ANY WARRANTY; without even the implied warranty of
15
# if $op=add_validate
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
#	- the user has just send datas, so we create/modify the record
16
# GNU General Public License for more details.
17
# if $op=delete_form
17
#
18
#	- we show the record having primkey=$primkey and ask for deletion validation form
18
# You should have received a copy of the GNU General Public License
19
# if $op=delete_confirm
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
20
#	- we delete the record having primkey=$primkey
20
21
21
22
use strict;
22
# This script is used to maintain the Z3950 servers table.
23
use warnings;
23
# Parameter $op is operation: list, new, edit, add_validated, delete_confirmed.
24
# add_validated saves a validated record and goes to list view.
25
# delete_confirmed deletes a record and goes to list view.
26
27
use Modern::Perl;
24
use CGI;
28
use CGI;
25
use C4::Context;
29
use C4::Context;
26
use C4::Auth;
30
use C4::Auth;
27
use C4::Output;
31
use C4::Output;
32
use Koha::Database;
28
33
29
sub StringSearch  {
34
# Initialize CGI, template, database
30
	my ($searchstring,$type)=@_;
31
	my $dbh = C4::Context->dbh;
32
    my @data = ('%');
33
    my $count = 1;
34
	if ( defined $searchstring ) {
35
        $searchstring =~ s/\'/\\\'/g;
36
        @data=split(' ',$searchstring);
37
        $count=@data;
38
    }
39
    else {
40
        $searchstring = '';
41
    }
42
43
    my $query    = "SELECT host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype";
44
    $query      .= " FROM z3950servers";
45
    if ( $searchstring ne '' ) { $query .= " WHERE (name like ?)" }
46
    $query      .= " ORDER BY rank,name";
47
	my $sth=$dbh->prepare($query);
48
49
    if ( $searchstring ne '' ) {
50
        $sth->execute("$data[0]\%");
51
    }
52
    else {
53
        $sth->execute;
54
    }
55
56
    my @results;
57
    while (my $data=$sth->fetchrow_hashref) {
58
        push(@results,$data);
59
    }
60
    $sth->finish;
61
    return (scalar(@results),\@results);
62
}
63
35
64
my $input = new CGI;
36
my $input = new CGI;
65
my $searchfield=$input->param('searchfield');
37
my $op = $input->param('op') || 'list';
66
my $offset=$input->param('offset') || 0;
38
my $id = $input->param('id') || 0;
67
my $script_name="/cgi-bin/koha/admin/z3950servers.pl";
39
my $searchfield = '';
68
40
69
my $pagesize=20;
41
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( {
70
my $op = $input->param('op') || '';
42
    template_name => "admin/z3950servers.tmpl",
71
43
    query => $input,
72
my ($template, $loggedinuser, $cookie) 
44
    type => "intranet",
73
    = get_template_and_user({template_name => "admin/z3950servers.tmpl",
45
    authnotrequired => 0,
74
				query => $input,
46
    flagsrequired => {parameters => 'parameters_remaining_permissions'},
75
				type => "intranet",
47
    debug => 1,
76
				authnotrequired => 0,
48
});
77
                flagsrequired => {parameters => 'parameters_remaining_permissions'},
49
my $script_name = "/cgi-bin/koha/admin/z3950servers.pl";
78
				debug => 1,
50
$template->param( script_name => $script_name );
79
				});
51
80
52
my $schema = Koha::Database->new()->schema();
81
53
82
$template->param(script_name => $script_name,
54
# Main code
83
                 searchfield => $searchfield);
55
# First process a confirmed delete, or save a validated record
84
56
85
57
if( $op eq 'delete_confirmed' && $id ) {
86
################## ADD_FORM ##################################
58
    my $rs=$schema->resultset('Z3950server')->search( { id => $id } );
87
# called by default. Used to create form to add or  modify a record
59
    my $name= $rs->first?$rs->first->name:'';
88
if ( $op eq 'add_form' ) {
60
    my $cnt=$rs->delete;
89
    $template->param( add_form => 1 );
61
    $template->param( msg_deleted => 1, msg_add => $name ) if $cnt==1;
90
62
    $id=0;
91
    #---- if primkey exists, it's a modify action, so read values to modify...
63
} elsif( $op eq 'add_validated' ) {
92
    my $data;
64
    my @fields=qw/host port db userid password rank syntax encoding timeout
93
    if ($searchfield) {
65
        recordtype checked/;
94
        my $dbh = C4::Context->dbh;
66
    my $formdata = _form_data_hashref( $input, \@fields );
95
        my $sth = $dbh->prepare(
67
    #add name from servername (an input with name="name" gave problems)
96
"select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name"
68
    $formdata->{name} = $input->param('servername');
97
        );
69
    if( $id ) {
98
        $sth->execute($searchfield);
70
        my @res= $schema->resultset('Z3950server')->search( { id => $id } );
99
        $data = $sth->fetchrow_hashref;
71
        $res[0]->update( $formdata );
100
        $sth->finish;
72
        $template->param( msg_updated => 1, msg_add => $formdata->{name} );
73
        $id=0;
74
    } else {
75
        $schema->resultset('Z3950server')->create( $formdata );
76
        $template->param( msg_added => 1, msg_add => $formdata->{name} );
101
    }
77
    }
102
    $template->param( $_ => $data->{$_} )
78
} else {
103
      for (qw( host port db userid password checked rank timeout encoding ));
79
    #use searchfield only in remaining operations
104
    $template->param( $_ . $data->{$_} => 1 ) for (qw( syntax recordtype ));
80
    $searchfield = $input->param('searchfield') || '';
105
81
}
106
    # END $OP eq ADD_FORM
107
################## ADD_VALIDATE ##################################
108
    # called by add_form, used to insert/modify data in DB
109
} elsif ($op eq 'add_validate') {
110
	my $dbh=C4::Context->dbh;
111
	my $sth=$dbh->prepare("select * from z3950servers where name=?");
112
	$sth->execute($input->param('searchfield'));
113
	my $checked = $input->param('checked') ? 1 : 0;
114
	if ($sth->rows) {
115
        $template->param(confirm_update => 1);
116
             $sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=?,timeout=?,recordtype=? where name=?");
117
		$sth->execute($input->param('host'),
118
		      $input->param('port'),
119
		      $input->param('db'),
120
		      $input->param('userid'),
121
		      $input->param('password'),
122
		      $input->param('searchfield'),
123
		      $checked,
124
		      $input->param('rank'),
125
			  $input->param('syntax'),
126
              $input->param('encoding'),
127
              $input->param('timeout'),
128
              $input->param('recordtype'),
129
		      $input->param('searchfield'),
130
		      );
131
	} 
132
	else {
133
        $template->param(confirm_add => 1);
134
		$sth=$dbh->prepare(
135
		  "INSERT INTO z3950servers " .
136
              "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout,recordtype) " .
137
               "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
138
        $sth->execute(
139
            $input->param('host'),     $input->param('port'),
140
            $input->param('db'),       $input->param('userid'),
141
            $input->param('password'), $input->param('searchfield'),
142
            $checked,                  $input->param('rank'),
143
            $input->param('syntax'),   $input->param('encoding'),
144
            $input->param('timeout'),  $input->param('recordtype')
145
        );
146
    }
147
    $sth->finish;
148
82
149
    # END $OP eq ADD_VALIDATE
83
# Now list multiple records, or edit one record
150
################## DELETE_CONFIRM ##################################
84
151
# called by default form, used to confirm deletion of data in DB
85
my $data = [];
152
} elsif ($op eq 'delete_confirm') {
86
if ( $op eq 'add' || $op eq 'edit' ) {
153
    $template->param( delete_confirm => 1 );
87
    $data = ServerSearch( $schema, $id, $searchfield ) if $searchfield || $id;
154
    my $dbh = C4::Context->dbh;
88
    delete $data->[0]->{id} if @$data && $op eq 'add'; #cloning record
89
    $template->param( add_form => 1, server => @$data? $data->[0]: undef,
90
        op => $op );
91
} else {
92
    $data = ServerSearch( $schema, $id, $searchfield );
93
    $template->param( loop => \@$data, searchfield => $searchfield, 
94
        op => 'list' );
95
}
96
output_html_with_http_headers $input, $cookie, $template->output;
155
97
156
    my $sth2 = $dbh->prepare(
98
# End of main code
157
"select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name"
158
    );
159
    $sth2->execute($searchfield);
160
    my $data = $sth2->fetchrow_hashref;
161
    $sth2->finish;
162
99
163
    $template->param(
100
sub ServerSearch  { #find server(s) by id or name
164
        host       => $data->{'host'},
101
    my ( $schema, $id, $searchstring )= @_;
165
        port       => $data->{'port'},
102
    my @resobjs= $schema->resultset('Z3950server')->search(
166
        db         => $data->{'db'},
103
        $id ? { id => $id }: { name => { like => $searchstring.'%' } },
167
        userid     => $data->{'userid'},
104
        { order_by => 'rank,name' },
168
        password   => $data->{'password'},
169
        checked    => $data->{'checked'},
170
        rank       => $data->{'rank'},
171
        syntax     => $data->{'syntax'},
172
        timeout    => $data->{'timeout'},
173
        recordtype => $data->{'recordtype'},
174
        encoding   => $data->{'encoding'}
175
    );
105
    );
106
    return [ map { {$_->get_columns} } @resobjs ];
107
}
176
108
177
													# END $OP eq DELETE_CONFIRM
109
sub _form_data_hashref {
178
################## DELETE_CONFIRMED ##################################
110
    my ( $input, $fieldref ) = @_;
179
# called by delete_confirm, used to effectively confirm deletion of data in DB
111
    return { map { ( $_ => $input->param($_) ) } @$fieldref };
180
} elsif ($op eq 'delete_confirmed') {
112
}
181
	$template->param(delete_confirmed => 1);
182
	my $dbh=C4::Context->dbh;
183
	my $sth=$dbh->prepare("delete from z3950servers where name=?");
184
	$sth->execute($searchfield);
185
	$sth->finish;
186
													# END $OP eq DELETE_CONFIRMED
187
################## DEFAULT ##################################
188
} else { # DEFAULT
189
	$template->param(else => 1);
190
	my ($count,$results)=StringSearch($searchfield,'web');
191
	my @loop;
192
193
	for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
194
		my $urlsearchfield=$results->[$i]{name};
195
		$urlsearchfield=~s/ /%20/g;
196
		my %row	= ( name => $results->[$i]{'name'},
197
			host => $results->[$i]{'host'},
198
			port => $results->[$i]{'port'},
199
			db => $results->[$i]{'db'},
200
			userid =>$results->[$i]{'userid'},
201
			password => ($results->[$i]{'password'}) ? ('#######') : ('&nbsp;'),
202
			checked => $results->[$i]{'checked'},
203
			rank => $results->[$i]{'rank'},
204
			syntax => $results->[$i]{'syntax'},
205
			encoding => $results->[$i]{'encoding'},
206
      timeout => $results->[$i]{'timeout'},
207
            recordtype => $results->[$i]{'recordtype'});
208
		push @loop, \%row;
209
210
	}
211
	$template->param(loop => \@loop);
212
	if ($offset>0) {
213
		$template->param(offsetgtzero => 1,
214
				prevpage => $offset-$pagesize);
215
	}
216
	if ($offset+$pagesize<$count) {
217
		$template->param(ltcount => 1,
218
				 nextpage => $offset+$pagesize);
219
	}
220
} #---- END $OP eq DEFAULT
221
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt (-277 / +154 lines)
Lines 1-86 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Administration &rsaquo; [% IF ( else ) %]Z39.50 servers[% END %]
2
<title>Koha &rsaquo; Administration &rsaquo; Z39.50 servers
3
[% IF ( add_form ) %] Z39.50 servers &rsaquo; [% IF ( searchfield ) %]Modify Z39.50 server [% searchfield %][% ELSE %]New Z39.50 server[% END %][% END %]
3
[% IF op == 'edit' %] &rsaquo; Modify Z39.50 server [% server.name %][% END %]
4
[% IF ( delete_confirm ) %]Z39.50 servers &rsaquo; Confirm deletion[% END %]
4
[% IF op ==  'add' %] &rsaquo; New Z39.50 server[% END %]
5
[% IF ( confirm_add ) %] Z39.50 servers &rsaquo; Z39.50 server added[% END %]
5
</title>
6
[% IF ( confirm_update ) %] Z39.50 servers &rsaquo; Z39.50 server updated[% END %]
7
[% IF ( delete_confirmed ) %]Z39.50 servers &rsaquo; Z39.50 server deleted[% END %]</title>
8
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
9
[% IF ( else ) %]
7
10
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
8
[% IF op == 'list' %]
11
[% INCLUDE 'datatables.inc' %]
9
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
10
    [% INCLUDE 'datatables.inc' %]
12
[% END %]
11
[% END %]
12
13
[% IF ( add_form ) %]
13
[% IF ( add_form ) %]
14
<script type="text/javascript">
14
    <script type="text/javascript">
15
//<![CDATA[
15
    //<![CDATA[
16
        //
16
    $(document).ready(function() {
17
        function isNotNull(f,noalert) {
17
        // Update selects for syntax, encoding and recordtype
18
                if (f.value.length ==0) {
18
        [% IF server %]
19
                    return false;
19
            $("#syntax").val('[% server.syntax %]');
20
                }
20
            $("#encoding").val('[% server.encoding %]');
21
                return true;
21
            $("#recordtype").val('[% server.recordtype %]');
22
        }
22
        [% END %]
23
        //
23
    });
24
        function toUC(f) {
24
    function toUC(f) {
25
                var x=f.value.toUpperCase();
25
        var x=f.value.toUpperCase();
26
                f.value=x;
26
        f.value=x;
27
                return true;
27
        return true;
28
        }
28
    }
29
        //
29
    function isNum(v,maybenull) {
30
        function isNum(v,maybenull) {
31
        var n = new Number(v.value);
30
        var n = new Number(v.value);
32
        if (isNaN(n)) {
31
        if (isNaN(n)) {
33
                return false;
32
            return false;
34
                }
33
        }
35
        if (maybenull==0 && v.value=='') {
34
        if (maybenull==0 && v.value=='') {
36
                return false;
35
            return false;
37
        }
36
        }
38
        return true;
37
        return true;
38
    }
39
    function Check(f) {
40
        var ok=1;
41
        var _alertString="";
42
        var alertString2;
43
        if (f.servername.value.length==0) {_alertString += "- target name missing\n";
39
        }
44
        }
40
        //
45
        if (f.host.value.length==0) {_alertString += "- host missing\n";
41
        function isDate(f) {
42
                var t = Date.parse(f.value);
43
                if (isNaN(t)) {
44
                       return false;                       
45
                }
46
        }
46
        }
47
        //
47
        if (f.port.value.length==0) {_alertString += "- port missing\n";
48
        function Check(f) {
49
                var ok=1;
50
                var _alertString="";
51
                var alertString2;
52
                if (f.searchfield.value.length==0) {_alertString += "- target name missing\n";
53
                }
54
                if (f.host.value.length==0) {_alertString += "- host missing\n";
55
                }
56
                if (f.port.value.length==0) {_alertString += "- port missing\n";
57
                }
58
                if (f.db.value.length==0) {_alertString += "- database missing\n";
59
                }
60
                if (isNaN(f.port.value)) {_alertString += "- port must be a number\n";
61
                }
62
                if (isNaN(f.rank.value)) {_alertString += "- rank must be a number\n";
63
                }
64
                if (_alertString.length==0) {document.Aform.submit();
65
                } else {alertString2 = "Form not submitted because of the following problem(s)\n";alertString2 += "------------------------------------------------------------------------------------\n\n";alertString2 += _alertString;alert(alertString2);
66
                }
67
        }
48
        }
68
        //]]>
49
        if (f.db.value.length==0) {_alertString += "- database missing\n";
69
</script>
50
        }
70
[% END %]
51
        if (isNaN(f.port.value)) {_alertString += "- port must be a number\n";
71
[% IF ( else ) %]
52
        }
53
        if (isNaN(f.rank.value)) {_alertString += "- rank must be a number\n";
54
        }
55
        if (_alertString.length==0) {document.Aform.submit();
56
        } else {alertString2 = "Form not submitted because of the following problem(s)\n";alertString2 += "------------------------------------------------------------------------------------\n\n";alertString2 += _alertString;alert(alertString2);
57
        }
58
    }
59
    //]]>
60
    </script>
61
[% ELSE %]
72
    <script type="text/javascript">
62
    <script type="text/javascript">
73
    //<![CDATA[
63
    //<![CDATA[
74
     $(document).ready(function() {
64
    $(document).ready(function() {
75
        [% IF ( loop ) %]$("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
65
        [% IF ( loop ) %]$("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
76
            "aoColumnDefs": [
66
            "aoColumnDefs": [
77
                { "aTargets": [ 2,3,4,7,8,9,10,11 ], "bSortable": false, "bSearchable": false },
67
                { "aTargets": [2,3,4,7,8,9,10,11], "bSortable": false, "bSearchable": false },
78
            ],
68
            ],
79
            "iDisplayLength": 20,
69
            "iDisplayLength": 20,
80
            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
70
            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
81
            "sPaginationType": "four_button"
71
            "sPaginationType": "four_button"
82
        }));[% END %]
72
        }));[% END %]
83
     });
73
    });
74
    function ConfirmDelete(name,id) {
75
        if( confirm( _("Choose OK if you really want to delete server ")+
76
          name+'.')) {
77
            window.location="[% script_name %]?op=delete_confirmed&id="+id;
78
        }
79
        return false;
80
    }
84
    //]]>
81
    //]]>
85
    </script>
82
    </script>
86
[% END %]
83
[% END %]
Lines 90-243 Link Here
90
[% INCLUDE 'header.inc' %]
87
[% INCLUDE 'header.inc' %]
91
[% INCLUDE 'z3950-admin-search.inc' %]
88
[% INCLUDE 'z3950-admin-search.inc' %]
92
89
93
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( else ) %]Z39.50 servers[% END %]
90
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
94
[% IF ( add_form ) %] <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a> &rsaquo; [% IF ( searchfield ) %]Modify Z39.50 server [% searchfield %][% ELSE %]New Z39.50 server[% END %][% END %]
91
<a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a>
95
[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a> &rsaquo; Confirm deletion[% END %]
92
[% IF op == 'edit' %]&rsaquo; Modify Z39.50 server [% server.name %][% END %]
96
[% IF ( confirm_add ) %] <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a> &rsaquo; Z39.50 server added[% END %]
93
[% IF op ==  'add' %]&rsaquo; New Z39.50 server[% END %]
97
[% IF ( confirm_update ) %] <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a> &rsaquo; Z39.50 server updated[% END %]
94
</div>
98
99
[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a> &rsaquo; Z39.50 server deleted[% END %]</div>
100
95
101
<div id="doc3" class="yui-t2">
96
<div id="doc3" class="yui-t2">
102
   
97
<div id="bd">
103
   <div id="bd">
98
<div id="yui-main">
104
	<div id="yui-main">
99
<div class="yui-b">
105
	<div class="yui-b">
100
101
[% IF msg_deleted %]
102
    <div class="dialog alert">Z39.50 server deleted ([% msg_add %])</div>
103
[% ELSIF msg_updated %]
104
    <div class="dialog alert">Z39.50 server updated ([% msg_add %])</div>
105
[% ELSIF msg_added %]
106
    <div class="dialog alert">Z39.50 server added ([% msg_add %])</div>
107
[% END %]
106
108
107
[% IF ( add_form ) %]
109
[% IF ( add_form ) %]
108
       
109
        <form action="[% script_name %]" name="Aform" method="post">
110
        <form action="[% script_name %]" name="Aform" method="post">
110
        <input type="hidden" name="op" value="add_validate" />
111
        <input type="hidden" name="op" value="add_validated" />
111
[% IF ( searchfield ) %]
112
        [% IF op == 'edit' %]
112
                <h1>Modify Z39.50 server</h1>
113
            <h1>Modify Z39.50 server</h1>
114
            <input type="hidden" name="id" value="[% server.id %]" />
113
        [% ELSE %]
115
        [% ELSE %]
114
                <h1>New Z39.50 server</h1>
116
            <h1>New Z39.50 server</h1>
115
        [% END %]                
117
        [% END %]                
116
        <fieldset class="rows">
118
        <fieldset class="rows">
117
        <ol>[% IF ( searchfield ) %]
119
        <ol>
118
                <li><span class="label">Z39.50 server: </span>        <input type="hidden" name="searchfield" value="[% searchfield %]" />[% searchfield %]</li>
120
        <li><label for="name">Z39.50 server: </label><input type="text" name="servername" id="name" size="65" maxlength="100" onblur="toUC(this)" value="[% server.name | html %]"/></li>
119
        [% ELSE %]
121
        <li><label for="host">Hostname: </label><input type="text" name="host" id="host" size="30" value="[% server.host %]" />
120
                <li><label for="searchfield">Z39.50 server: </label>        <input type="text" name="searchfield" id="searchfield" size="65" maxlength="100" onblur="toUC(this)" /></li>
122
        </li>
121
        [% END %]
123
        <li><label for="port">Port: </label><input type="text" name="port" id="port" size="5" value="[% server.port %]" onblur="isNum(this)" />
122
124
        </li>
123
		<li><label for="host">Hostname: </label>	<input type="text" name="host" id="host" size="30" value="[% host %]" />
125
        <li><label for="db">Database: </label><input type="text" name="db" id="db" value="[% server.db %]" />
124
		</li>
126
        </li>
125
		<li><label for="port">Port: </label>	<input type="text" name="port" id="port" size="5" value="[% port %]" onblur="isNum(this)" />
127
        <li><label for="userid">Userid: </label><input type="text" name="userid" id="userid" value="[% server.userid %]" />
126
		</li>
128
        </li>
127
		<li><label for="db">Database: </label>	<input type="text" name="db" id="db" value="[% db %]" />
129
        <li><label for="password">Password: </label><input type="text" name="password" id="password" value="[% server.password %]" />
128
		</li>
130
        </li>
129
		<li><label for="userid">Userid: </label>	<input type="text" name="userid" id="userid" value="[% userid %]" />
131
        <li><label for="checked">Checked (searched by default): </label>
130
		</li>
132
                        [% IF ( server.checked ) %]
131
		<li><label for="password">Password: </label>	<input type="text" name="password" id="password" value="[% password %]" />
132
		</li>
133
		<li><label for="checked">Checked (searched by default): </label>
134
                        [% IF ( checked ) %]
135
                                <input type="checkbox" name="checked" id="checked" value="1" checked="checked" />
133
                                <input type="checkbox" name="checked" id="checked" value="1" checked="checked" />
136
                        [% ELSE %]
134
                        [% ELSE %]
137
                                <input type="checkbox" name="checked" id="checked" value="1" />
135
                                <input type="checkbox" name="checked" id="checked" value="1" />
138
                        [% END %]
136
                        [% END %]
139
                </li>
137
        </li>
140
		<li><label for="rank">Rank (display order): </label>	<input type="text" name="rank" id="rank" size="4" value="[% rank %]" onblur="isNum(this)" />
138
        <li><label for="rank">Rank (display order): </label><input type="text" name="rank" id="rank" size="4" value="[% server.rank %]" onblur="isNum(this)" />
141
		</li>	
139
        </li>
142
		<li><label for="syntax">Syntax (z3950 can send<br /> records in various format. Choose one): </label>	
140
        <li><label for="syntax">Syntax (z3950 can send<br /> records in various format. Choose one): </label>
143
<select name="syntax">
141
        <select name="syntax" id="syntax">
144
[% IF ( syntaxUNIMARC ) %]
142
            <option value="UNIMARC">UNIMARC</option>
145
<option value="UNIMARC" selected="selected">UNIMARC</option>
143
            <option value="INTERMARC">INTERMARC</option>
146
[% ELSE %]
144
            <option value="CCF">CCF</option>
147
<option value="UNIMARC">UNIMARC</option>
145
            <option value="USMARC">MARC21/USMARC</option>
148
[% END %]
146
            <option value="UKMARC">UKMARC</option>
149
[% IF ( syntaxINTERMARC ) %]
147
            <option value="NORMARC">NORMARC</option>
150
<option value="INTERMARC" selected="selected">INTERMARC</option>
148
            <option value="LIBRISMARC">LIBRISMARC</option>
151
[% ELSE %]
149
            <option value="DANMARC">DANMARC</option>
152
<option value="INTERMARC">INTERMARC</option>
150
            <option value="FINMARC">FINMARC</option>
153
[% END %]
151
            <option value="CANMARC">CANMARC</option>
154
[% IF ( syntaxCCF ) %]
152
            <option value="SBN">SBN</option>
155
<option value="CCF" selected="selected">CCF</option>
153
            <option value="PICAMARC">PICAMARC</option>
156
[% ELSE %]
154
            <option value="AUSMARC">AUSMARC</option>
157
<option value="CCF">CCF</option>
155
            <option value="IBERMARC">IBERMARC</option>
158
[% END %]
156
            <option value="CATMARC">CATMARC</option>
159
[% IF ( syntaxUSMARC ) %]
157
            <option value="MALMARC">MALMARC</option>
160
<option value="USMARC" selected="selected">MARC21/USMARC</option>
158
        </select>
161
[% ELSE %]
159
        </li>
162
<option value="USMARC">MARC21/USMARC</option>
160
163
[% END %]
161
        <li><label for="encoding">Encoding (z3950 can send<br /> records in various encodings. Choose one): </label>  
164
[% IF ( syntaxUKMARC ) %]
162
        <select name="encoding" id="encoding">
165
<option value="UKMARC" selected="selected">UKMARC</option>
163
            [% FOREACH enc IN [ 'utf8' 'EUC-KR' 'ISO_5426' 'ISO_6937' 'ISO_8859-1' 'MARC-8' ] %]
166
[% ELSE %]
164
                <option value="[% enc %]">[% enc %]</option>
167
<option value="UKMARC">UKMARC</option>
165
            [% END %]
168
[% END %]
166
        </select>
169
[% IF ( syntaxNORMARC ) %]
167
        </li>
170
<option value="NORMARC" selected="selected">NORMARC</option>
171
[% ELSE %]
172
<option value="NORMARC">NORMARC</option>
173
[% END %]
174
[% IF ( syntaxLIBRISMARC ) %]
175
<option value="LIBRISMARC" selected="selected">LIBRISMARC</option>
176
[% ELSE %]
177
<option value="LIBRISMARC">LIBRISMARC</option>
178
[% END %]
179
[% IF ( syntaxDANMARC ) %]
180
<option value="DANMARC" selected="selected">DANMARC</option>
181
[% ELSE %]
182
<option value="DANMARC">DANMARC</option>
183
[% END %]
184
[% IF ( syntaxFINMARC ) %]
185
<option value="FINMARC" selected="selected">FINMARC</option>
186
[% ELSE %]
187
<option value="FINMARC">FINMARC</option>
188
[% END %]
189
[% IF ( syntaxCANMARC ) %]
190
<option value="CANMARC" selected="selected">CANMARC</option>
191
[% ELSE %]
192
<option value="CANMARC">CANMARC</option>
193
[% END %]
194
[% IF ( syntaxSBN ) %]
195
<option value="SBN" selected="selected">SBN</option>
196
[% ELSE %]
197
<option value="SBN">SBN</option>
198
[% END %]
199
[% IF ( syntaxPICAMARC ) %]
200
<option value="PICAMARC" selected="selected">PICAMARC</option>
201
[% ELSE %]
202
<option value="PICAMARC">PICAMARC</option>
203
[% END %]
204
[% IF ( syntaxAUSMARC ) %]
205
<option value="AUSMARC" selected="selected">AUSMARC</option>
206
[% ELSE %]
207
<option value="AUSMARC">AUSMARC</option>
208
[% END %]
209
[% IF ( syntaxIBERMARC ) %]
210
<option value="IBERMARC" selected="selected">IBERMARC</option>
211
[% ELSE %]
212
<option value="IBERMARC">IBERMARC</option>
213
[% END %]
214
[% IF ( syntaxCATMARC ) %]
215
<option value="CATMARC" selected="selected">CATMARC</option>
216
[% ELSE %]
217
<option value="CATMARC">CATMARC</option>
218
[% END %]
219
[% IF ( syntaxMALMARC ) %]
220
<option value="MALMARC" selected="selected">MALMARC</option>
221
[% ELSE %]
222
<option value="MALMARC">MALMARC</option>
223
[% END %]
224
</select>
225
</li>
226
168
227
    <li><label for="encoding">Encoding (z3950 can send<br /> records in various encodings. Choose one): </label>  
228
<select name="encoding">
229
[% FOREACH enc IN [ 'utf8' 'EUC-KR' 'ISO_5426' 'ISO_6937' 'ISO_8859-1' 'MARC-8' ] %]
230
    [% IF ( encoding == enc ) %]
231
    <option value="[% enc %]" selected="selected">[% enc %]</option>
232
    [% ELSE %]
233
    <option value="[% enc %]">[% enc %]</option>
234
    [% END %]
235
[% END %]
236
</select>
237
</li>
238
    <li><label for="timeout">Timeout (0 its like not set): </label>
169
    <li><label for="timeout">Timeout (0 its like not set): </label>
239
		<input type="text" name="timeout" id="timeout" size="4" value="[% timeout %]" onblur="isNum(this)" /> seconds
170
        <input type="text" name="timeout" id="timeout" size="4" value="[% server.timeout %]" onblur="isNum(this)" /> seconds
240
	</li>
171
    </li>
241
    <li><label for="recordtype">Record type: </label>
172
    <li><label for="recordtype">Record type: </label>
242
    <select name="recordtype" id="recordtype">
173
    <select name="recordtype" id="recordtype">
243
            [% IF ( recordtypebiblio ) %]
174
            [% IF ( recordtypebiblio ) %]
Lines 254-344 Link Here
254
    </li>
185
    </li>
255
</ol>
186
</ol>
256
        </fieldset>
187
        </fieldset>
257
		
258
		<fieldset class="action"><input type="button" value="Save" onclick="Check(this.form)" /> <a class="cancel" href="/cgi-bin/koha/admin/z3950servers.pl">Cancel</a></fieldset>
259
        </form>
260
[% END %]
261
262
[% IF ( confirm_add ) %]
263
<h3>Z39.50 server added</h3>
264
<form action="[% script_name %]" method="post">
265
        <input type="submit" value="OK" />
266
        </form>
267
[% END %]
268
188
269
[% IF ( confirm_update ) %]
189
        <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form)" /> <a class="cancel" href="/cgi-bin/koha/admin/z3950servers.pl">Cancel</a></fieldset>
270
<h3>Z39.50 server updated</h3>
271
<form action="[% script_name %]" method="post">
272
        <input type="submit" value="OK" />
273
        </form>
190
        </form>
274
[% END %]
191
[% END %]
275
192
276
[% IF ( delete_confirm ) %]
193
[% IF op == 'list' %]
277
	[% reqsel %]
194
    <div id="toolbar" class="btn-toolbar">
278
<h3>Confirm deletion of server [% searchfield %]</h3>
195
        <a id="newserver" class="btn btn-small" href="/cgi-bin/koha/admin/z3950servers.pl?op=add"><i class="icon-plus"></i> New Z39.50 server</a>
279
        <ul>
196
    </div>
280
                <li><strong>Target: </strong>        [% searchfield %]</li>
197
    <h3>Z39.50 servers administration</h3>
281
                <li><strong>Hostname: </strong>[% host %]</li>
198
    [% IF id %]
282
                <li><strong>Port: </strong>[% port %]</li>
199
        You searched for record [% id %]
283
                <li><strong>Database: </strong>[% db %]</li>
200
    [% ELSIF searchfield %]
284
                <li><strong>Userid: </strong>[% userid %]</li>
201
        You searched for [% searchfield %]
285
                <li><strong>Password: </strong>[% password %]</li>
202
    [% END %]
286
                <li><strong>Checked: </strong>[% checked %]</li>
203
    <table id="serverst">
287
                <li><strong>Rank: </strong>[% rank %]</li>
204
        <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Checked</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>Options</th>
288
                <li><strong>Syntax: </strong>[% syntax %]</li>
205
        </tr></thead>
289
                <li><strong>Encoding: </strong>[% encoding %]</li>
206
        <tbody>
290
                <li><strong>Timeout: </strong>[% timeout %]</li>
207
        [% FOREACH loo IN loop %]
291
                <li><strong>Record type: </strong>[% recordtype %]</li>
208
            [% UNLESS ( loop.odd ) %]
292
	</ul>                <form action="[% script_name %]" method="post"><input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="searchfield" value="[% searchfield %]" /><input type="submit" value="Delete this server" /></form>  <form action="[% script_name %]" method="post"><input type="submit" value="Do not delete" /></form>
209
                <tr class="highlight">
293
210
            [% ELSE %]
294
211
                <tr>
295
212
            [% END %]
296
[% END %]
213
            <td><a href="[% loo.script_name %]?op=edit&amp;id=[% loo.id %]">[% loo.name %]</a></td><td>[% loo.host %]:[% loo.port %]</td><td>[% loo.db %]</td><td>[% loo.userid %]</td><td>[% IF loo.password %]########[% END %]</td><td>[% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %]</td><td>[% loo.rank %]</td>
297
214
<td>[% loo.syntax %]</td><td>[% loo.encoding %]</td><td>[% loo.timeout %]</td><td>[% loo.recordtype %]</td>
298
[% IF ( delete_confirmed ) %]
215
            <td><a href="[% loo.script_name %]?op=edit&amp;id=[% loo.id %]">Edit</a> <a href="[% loo.script_name %]?op=add&amp;id=[% loo.id %]">Copy</a> <a href="javascript:void(0);" onclick="ConfirmDelete('[% loo.name | replace("['\"]","") %]','[% loo.id %]');">Delete</a></td>
299
<h3>Z39.50 server deleted</h3>
216
            </tr>
300
<form action="[% script_name %]" method="post">
301
                <input type="submit" value="OK" />
302
</form>
303
[% END %]
304
305
[% IF ( else ) %]
306
307
<div id="toolbar" class="btn-toolbar">
308
    <a id="newserver" class="btn btn-small" href="/cgi-bin/koha/admin/z3950servers.pl?op=add_form"><i class="icon-plus"></i> New Z39.50 server</a>
309
</div>
310
311
<h3>Z39.50 servers administration</h3>
312
313
        [% IF ( searchfield ) %]
314
                You searched for [% searchfield %]
315
        [% END %]
217
        [% END %]
316
<table id="serverst">
218
        </tbody>
317
                <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Checked</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>&nbsp;</th><th>&nbsp;</th>
219
    </table>
318
                </tr></thead>
319
                <tbody>[% FOREACH loo IN loop %]
320
                [% UNLESS ( loop.odd ) %]
321
                    <tr class="highlight">
322
                [% ELSE %]
323
                    <tr>
324
                [% END %]
325
<td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.name |url %]">[% loo.name %]</a></td><td>[% loo.host %]:[% loo.port %]</td><td>[% loo.db %]</td><td>[% loo.userid %]</td><td>[% loo.password %]</td><td>[% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %]</td><td>[% loo.rank %]</td>
326
327
<td>[% loo.syntax %]</td><td>[% loo.encoding %]</td><td>[% loo.timeout %]</td><td>[% loo.recordtype %]</td><td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.name |url %]">Edit</a></td><td><a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.name |url %]">Delete</a></td>                </tr>
328
                [% END %]</tbody>
329
</table>
330
331
[% IF ( offsetgtzero ) %]<form action="[% script_name %]" method="get">
332
	<input type="hidden" name="offset" value="[% prevpage %]" />
333
	<input type="submit" value="&lt;&lt; Previous">
334
</form>[% END %]
335
336
[% IF ( ltcount ) %]<form action="[% script_name %]" method="get">
337
	<input type="hidden" name="offset" value="[% nextpage %]" />
338
	<input type="submit" value="Next &gt;&gt;" />
339
</form> [% END %]
340
 
341
342
[% END %]
220
[% END %]
343
221
344
</div>
222
</div>
345
- 

Return to bug 12265