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, id => $id,
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 (-258 / +140 lines)
Lines 1-22 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 %]
13
[% IF ( add_form ) %]
12
14
<script type="text/javascript">
13
<script type="text/javascript">
15
//<![CDATA[
14
//<![CDATA[
15
[% IF ( add_form ) %]
16
    $(document).ready(function(){
16
    $(document).ready(function(){
17
        // Update selects for syntax, encoding and recordtype
18
        [% IF server %]
19
            $("#syntax").val('[% server.syntax %]');
20
            $("#encoding").val('[% server.encoding %]');
21
            $("#recordtype").val('[% server.recordtype %]');
22
        [% END %]
17
        $( "#serverentry" ).validate({
23
        $( "#serverentry" ).validate({
18
            rules: {
24
            rules: {
19
                searchfield: { required: true },
25
                servername: { required: true },
20
                host: { required: true },
26
                host: { required: true },
21
                port: {
27
                port: {
22
                    required: true,
28
                    required: true,
Lines 28-305 Link Here
28
            }
34
            }
29
        });
35
        });
30
    });
36
    });
31
//]]>
37
[% ELSE %]
32
</script>
38
    $(document).ready(function() {
33
[% END %]
39
        $("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
34
[% IF ( else ) %]
35
    <script type="text/javascript">
36
    //<![CDATA[
37
     $(document).ready(function() {
38
        [% IF ( loop ) %]$("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
39
            "aoColumnDefs": [
40
            "aoColumnDefs": [
40
                { "aTargets": [ 2,3,4,7,8,9,10,11 ], "bSortable": false, "bSearchable": false },
41
                { "aTargets": [2,3,4,7,8,9,10,11], "bSortable": false, "bSearchable": false },
41
            ],
42
            ],
42
            "sPaginationType": "four_button"
43
            "sPaginationType": "four_button"
43
        }));[% END %]
44
        }));
44
     });
45
    });
45
    //]]>
46
    function ConfirmDelete(name,id) {
46
    </script>
47
        if( confirm( _("Choose OK if you really want to delete server ")+
48
          name+'.')) {
49
            window.location="[% script_name %]?op=delete_confirmed&id="+id;
50
        }
51
        return false;
52
    }
47
[% END %]
53
[% END %]
54
//]]>
55
</script>
48
56
49
</head>
57
</head>
50
<body id="admin_z3950servers" class="admin">
58
<body id="admin_z3950servers" class="admin">
51
[% INCLUDE 'header.inc' %]
59
[% INCLUDE 'header.inc' %]
52
[% INCLUDE 'z3950-admin-search.inc' %]
60
[% INCLUDE 'z3950-admin-search.inc' %]
53
61
54
<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 %]
62
<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;
55
[% 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 %]
63
<a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a>
56
[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a> &rsaquo; Confirm deletion[% END %]
64
[% IF op == 'edit' %]&rsaquo; Modify Z39.50 server [% server.name %][% END %]
57
[% IF ( confirm_add ) %] <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a> &rsaquo; Z39.50 server added[% END %]
65
[% IF op ==  'add' %]&rsaquo; New Z39.50 server[% END %]
58
[% IF ( confirm_update ) %] <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a> &rsaquo; Z39.50 server updated[% END %]
66
</div>
59
60
[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a> &rsaquo; Z39.50 server deleted[% END %]</div>
61
67
62
<div id="doc3" class="yui-t2">
68
<div id="doc3" class="yui-t2">
63
   
69
<div id="bd">
64
   <div id="bd">
70
<div id="yui-main">
65
	<div id="yui-main">
71
<div class="yui-b">
66
	<div class="yui-b">
72
73
[% IF msg_deleted %]
74
    <div class="dialog alert">Z39.50 server deleted ([% msg_add %])</div>
75
[% ELSIF msg_updated %]
76
    <div class="dialog alert">Z39.50 server updated ([% msg_add %])</div>
77
[% ELSIF msg_added %]
78
    <div class="dialog alert">Z39.50 server added ([% msg_add %])</div>
79
[% END %]
67
80
68
[% IF ( add_form ) %]
81
[% IF ( add_form ) %]
69
       
82
    <form action="[% script_name %]" name="Aform" method="post" id="serverentry">
70
        <form action="[% script_name %]" name="Aform" method="post" id="serverentry">
83
        <input type="hidden" name="op" value="add_validated" />
71
        <input type="hidden" name="op" value="add_validate" />
84
        [% IF op == 'edit' %]
72
[% IF ( searchfield ) %]
85
            <h1>Modify Z39.50 server</h1>
73
                <h1>Modify Z39.50 server</h1>
86
            <input type="hidden" name="id" value="[% server.id %]" />
74
        [% ELSE %]
87
        [% ELSE %]
75
                <h1>New Z39.50 server</h1>
88
            <h1>New Z39.50 server</h1>
76
        [% END %]                
89
        [% END %]                
77
        <fieldset class="rows">
90
        <fieldset class="rows">
78
        <ol>[% IF ( searchfield ) %]
91
        <ol>
79
                <li><span class="label">Z39.50 server: </span>        <input type="hidden" name="searchfield" value="[% searchfield %]" />[% searchfield %]</li>
92
        <li><label for="name" class="required">Z39.50 server: </label><input type="text" name="servername" id="servername" size="65" maxlength="100" onblur="toUC(this)" value="[% server.name | html %]" required="required"/> <span class="required">Required</span></li>
93
94
        <li><label for="host" class="required">Hostname: </label> <input type="text" name="host" id="host" size="30" value="[% server.host %]" required="required" /> <span class="required">Required</span>
95
        </li>
96
        <li><label for="port" class="required">Port: </label> <input type="text" name="port" id="port" size="5" value="[% server.port %]" required="required" /> <span class="required">Required</span>
97
        </li>
98
        <li><label for="db" class="required">Database: </label> <input type="text" name="db" id="db" value="[% server.db %]" required="required" /> <span class="required">Required</span>
99
        </li>
100
        <li><label for="userid">Userid: </label> <input type="text" name="userid" id="userid" value="[% server.userid %]" />
101
        </li>
102
        <li><label for="password">Password: </label> <input type="text" name="password" id="password" value="[% server.password %]" />
103
        </li>
104
        <li><label for="checked">Checked (searched by default): </label>
105
        [% IF ( server.checked ) %]
106
            <input type="checkbox" name="checked" id="checked" value="1" checked="checked" />
80
        [% ELSE %]
107
        [% ELSE %]
81
                <li><label for="searchfield" class="required">Z39.50 server: </label>        <input type="text" name="searchfield" id="searchfield" size="65" maxlength="100" onblur="toUC(this)" required="required" /> <span class="required">Required</span></li>
108
            <input type="checkbox" name="checked" id="checked" value="1" />
82
        [% END %]
109
        [% END %]
110
        </li>
111
        <li><label for="rank">Rank (display order): </label> <input type="text" name="rank" id="rank" size="4" value="[% server.rank %]" />
112
        </li>
113
114
        <li><label for="syntax">Syntax (z3950 can send<br /> records in various format. Choose one): </label>
115
        <select name="syntax" id="syntax">
116
            <option value="UNIMARC">UNIMARC</option>
117
            <option value="INTERMARC">INTERMARC</option>
118
            <option value="CCF">CCF</option>
119
            <option value="USMARC">MARC21/USMARC</option>
120
            <option value="UKMARC">UKMARC</option>
121
            <option value="NORMARC">NORMARC</option>
122
            <option value="LIBRISMARC">LIBRISMARC</option>
123
            <option value="DANMARC">DANMARC</option>
124
            <option value="FINMARC">FINMARC</option>
125
            <option value="CANMARC">CANMARC</option>
126
            <option value="SBN">SBN</option>
127
            <option value="PICAMARC">PICAMARC</option>
128
            <option value="AUSMARC">AUSMARC</option>
129
            <option value="IBERMARC">IBERMARC</option>
130
            <option value="CATMARC">CATMARC</option>
131
            <option value="MALMARC">MALMARC</option>
132
        </select>
133
        </li>
83
134
84
        <li><label for="host" class="required">Hostname: </label> <input type="text" name="host" id="host" size="30" value="[% host %]" required="required" /> <span class="required">Required</span>
135
        <li><label for="encoding">Encoding (z3950 can send<br /> records in various encodings. Choose one): </label>
85
		</li>
136
        <select name="encoding" id="encoding">
86
        <li><label for="port" class="required">Port: </label> <input type="text" name="port" id="port" size="5" value="[% port %]" required="required" /> <span class="required">Required</span>
137
            [% FOREACH enc IN [ 'utf8' 'EUC-KR' 'ISO_5426' 'ISO_6937' 'ISO_8859-1' 'MARC-8' ] %]
87
		</li>
138
                <option value="[% enc %]">[% enc %]</option>
88
        <li><label for="db" class="required">Database: </label> <input type="text" name="db" id="db" value="[% db %]" required="required" /> <span class="required">Required</span>
89
		</li>
90
		<li><label for="userid">Userid: </label>	<input type="text" name="userid" id="userid" value="[% userid %]" />
91
		</li>
92
		<li><label for="password">Password: </label>	<input type="text" name="password" id="password" value="[% password %]" />
93
		</li>
94
		<li><label for="checked">Checked (searched by default): </label>
95
                        [% IF ( checked ) %]
96
                                <input type="checkbox" name="checked" id="checked" value="1" checked="checked" />
97
                        [% ELSE %]
98
                                <input type="checkbox" name="checked" id="checked" value="1" />
99
                        [% END %]
100
                </li>
101
        <li><label for="rank">Rank (display order): </label> <input type="text" name="rank" id="rank" size="4" value="[% rank %]" />
102
		</li>	
103
		<li><label for="syntax">Syntax (z3950 can send<br /> records in various format. Choose one): </label>	
104
<select name="syntax">
105
[% IF ( syntaxUNIMARC ) %]
106
<option value="UNIMARC" selected="selected">UNIMARC</option>
107
[% ELSE %]
108
<option value="UNIMARC">UNIMARC</option>
109
[% END %]
110
[% IF ( syntaxINTERMARC ) %]
111
<option value="INTERMARC" selected="selected">INTERMARC</option>
112
[% ELSE %]
113
<option value="INTERMARC">INTERMARC</option>
114
[% END %]
115
[% IF ( syntaxCCF ) %]
116
<option value="CCF" selected="selected">CCF</option>
117
[% ELSE %]
118
<option value="CCF">CCF</option>
119
[% END %]
120
[% IF ( syntaxUSMARC ) %]
121
<option value="USMARC" selected="selected">MARC21/USMARC</option>
122
[% ELSE %]
123
<option value="USMARC">MARC21/USMARC</option>
124
[% END %]
125
[% IF ( syntaxUKMARC ) %]
126
<option value="UKMARC" selected="selected">UKMARC</option>
127
[% ELSE %]
128
<option value="UKMARC">UKMARC</option>
129
[% END %]
130
[% IF ( syntaxNORMARC ) %]
131
<option value="NORMARC" selected="selected">NORMARC</option>
132
[% ELSE %]
133
<option value="NORMARC">NORMARC</option>
134
[% END %]
135
[% IF ( syntaxLIBRISMARC ) %]
136
<option value="LIBRISMARC" selected="selected">LIBRISMARC</option>
137
[% ELSE %]
138
<option value="LIBRISMARC">LIBRISMARC</option>
139
[% END %]
140
[% IF ( syntaxDANMARC ) %]
141
<option value="DANMARC" selected="selected">DANMARC</option>
142
[% ELSE %]
143
<option value="DANMARC">DANMARC</option>
144
[% END %]
145
[% IF ( syntaxFINMARC ) %]
146
<option value="FINMARC" selected="selected">FINMARC</option>
147
[% ELSE %]
148
<option value="FINMARC">FINMARC</option>
149
[% END %]
150
[% IF ( syntaxCANMARC ) %]
151
<option value="CANMARC" selected="selected">CANMARC</option>
152
[% ELSE %]
153
<option value="CANMARC">CANMARC</option>
154
[% END %]
155
[% IF ( syntaxSBN ) %]
156
<option value="SBN" selected="selected">SBN</option>
157
[% ELSE %]
158
<option value="SBN">SBN</option>
159
[% END %]
160
[% IF ( syntaxPICAMARC ) %]
161
<option value="PICAMARC" selected="selected">PICAMARC</option>
162
[% ELSE %]
163
<option value="PICAMARC">PICAMARC</option>
164
[% END %]
165
[% IF ( syntaxAUSMARC ) %]
166
<option value="AUSMARC" selected="selected">AUSMARC</option>
167
[% ELSE %]
168
<option value="AUSMARC">AUSMARC</option>
169
[% END %]
170
[% IF ( syntaxIBERMARC ) %]
171
<option value="IBERMARC" selected="selected">IBERMARC</option>
172
[% ELSE %]
173
<option value="IBERMARC">IBERMARC</option>
174
[% END %]
175
[% IF ( syntaxCATMARC ) %]
176
<option value="CATMARC" selected="selected">CATMARC</option>
177
[% ELSE %]
178
<option value="CATMARC">CATMARC</option>
179
[% END %]
180
[% IF ( syntaxMALMARC ) %]
181
<option value="MALMARC" selected="selected">MALMARC</option>
182
[% ELSE %]
183
<option value="MALMARC">MALMARC</option>
184
[% END %]
185
</select>
186
</li>
187
188
    <li><label for="encoding">Encoding (z3950 can send<br /> records in various encodings. Choose one): </label>  
189
<select name="encoding">
190
[% FOREACH enc IN [ 'utf8' 'EUC-KR' 'ISO_5426' 'ISO_6937' 'ISO_8859-1' 'MARC-8' ] %]
191
    [% IF ( encoding == enc ) %]
192
    <option value="[% enc %]" selected="selected">[% enc %]</option>
193
    [% ELSE %]
194
    <option value="[% enc %]">[% enc %]</option>
195
    [% END %]
196
[% END %]
197
</select>
198
</li>
199
    <li><label for="timeout">Timeout (0 its like not set): </label>
200
        <input type="text" name="timeout" id="timeout" size="4" value="[% timeout %]" /> seconds
201
	</li>
202
    <li><label for="recordtype">Record type: </label>
203
    <select name="recordtype" id="recordtype">
204
            [% IF ( recordtypebiblio ) %]
205
            <option value="biblio" selected="selected">Bibliographic</option>
206
            [% ELSE %]
207
                   <option value="biblio">Bibliographic</option>
208
            [% END %]
209
            [% IF ( recordtypeauthority ) %]
210
            <option value="authority" selected="selected">Authority</option>
211
            [% ELSE %]
212
                   <option value="authority">Authority</option>
213
            [% END %]
139
            [% END %]
214
        </select>
140
        </select>
215
    </li>
141
        </li>
216
</ol>
142
143
        <li><label for="timeout">Timeout (0 its like not set): </label>
144
        <input type="text" name="timeout" id="timeout" size="4" value="[% server.timeout %]" /> seconds
145
        </li>
146
        <li><label for="recordtype">Record type: </label>
147
        <select name="recordtype" id="recordtype">
148
            <option value="biblio">Bibliographic</option>
149
            <option value="authority">Authority</option>
150
        </select>
151
        </li>
152
        </ol>
217
        </fieldset>
153
        </fieldset>
218
154
219
        <fieldset class="action"><input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/z3950servers.pl">Cancel</a></fieldset>
155
        <fieldset class="action"><input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/z3950servers.pl">Cancel</a></fieldset>
220
        </form>
156
    </form>
221
[% END %]
157
[% END %]
222
158
223
[% IF ( confirm_add ) %]
159
[% IF op == 'list' %]
224
<h3>Z39.50 server added</h3>
160
    <div id="toolbar" class="btn-toolbar">
225
<form action="[% script_name %]" method="post">
161
        <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>
226
        <input type="submit" value="OK" />
162
    </div>
227
        </form>
163
    <h3>Z39.50 servers administration</h3>
228
[% END %]
164
    [% IF id %]
229
165
        You searched for record [% id %]
230
[% IF ( confirm_update ) %]
166
    [% ELSIF searchfield %]
231
<h3>Z39.50 server updated</h3>
167
        You searched for [% searchfield %]
232
<form action="[% script_name %]" method="post">
168
    [% END %]
233
        <input type="submit" value="OK" />
169
    <table id="serverst">
234
        </form>
170
        <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>
235
[% END %]
171
        </tr></thead>
236
172
        <tbody>
237
[% IF ( delete_confirm ) %]
173
        [% FOREACH loo IN loop %]
238
	[% reqsel %]
174
            [% UNLESS ( loop.odd ) %]
239
<h3>Confirm deletion of server [% searchfield %]</h3>
175
                <tr class="highlight">
240
        <ul>
176
            [% ELSE %]
241
                <li><strong>Target: </strong>        [% searchfield %]</li>
177
                <tr>
242
                <li><strong>Hostname: </strong>[% host %]</li>
178
            [% END %]
243
                <li><strong>Port: </strong>[% port %]</li>
179
            <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>
244
                <li><strong>Database: </strong>[% db %]</li>
180
<td>[% loo.syntax %]</td><td>[% loo.encoding %]</td><td>[% loo.timeout %]</td><td>[% loo.recordtype %]</td>
245
                <li><strong>Userid: </strong>[% userid %]</li>
181
            <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>
246
                <li><strong>Password: </strong>[% password %]</li>
182
            </tr>
247
                <li><strong>Checked: </strong>[% checked %]</li>
248
                <li><strong>Rank: </strong>[% rank %]</li>
249
                <li><strong>Syntax: </strong>[% syntax %]</li>
250
                <li><strong>Encoding: </strong>[% encoding %]</li>
251
                <li><strong>Timeout: </strong>[% timeout %]</li>
252
                <li><strong>Record type: </strong>[% recordtype %]</li>
253
	</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>
254
255
256
257
[% END %]
258
259
[% IF ( delete_confirmed ) %]
260
<h3>Z39.50 server deleted</h3>
261
<form action="[% script_name %]" method="post">
262
                <input type="submit" value="OK" />
263
</form>
264
[% END %]
265
266
[% IF ( else ) %]
267
268
<div id="toolbar" class="btn-toolbar">
269
    <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>
270
</div>
271
272
<h3>Z39.50 servers administration</h3>
273
274
        [% IF ( searchfield ) %]
275
                You searched for [% searchfield %]
276
        [% END %]
183
        [% END %]
277
<table id="serverst">
184
        </tbody>
278
                <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>
185
    </table>
279
                </tr></thead>
280
                <tbody>[% FOREACH loo IN loop %]
281
                [% UNLESS ( loop.odd ) %]
282
                    <tr class="highlight">
283
                [% ELSE %]
284
                    <tr>
285
                [% END %]
286
<td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.name |uri %]">[% 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>
287
288
<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 |uri %]">Edit</a></td><td><a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.name |uri %]">Delete</a></td>                </tr>
289
                [% END %]</tbody>
290
</table>
291
292
[% IF ( offsetgtzero ) %]<form action="[% script_name %]" method="get">
293
	<input type="hidden" name="offset" value="[% prevpage %]" />
294
	<input type="submit" value="&lt;&lt; Previous">
295
</form>[% END %]
296
297
[% IF ( ltcount ) %]<form action="[% script_name %]" method="get">
298
	<input type="hidden" name="offset" value="[% nextpage %]" />
299
	<input type="submit" value="Next &gt;&gt;" />
300
</form> [% END %]
301
 
302
303
[% END %]
186
[% END %]
304
187
305
</div>
188
</div>
306
- 

Return to bug 12265