adding a pagination bar & displaying only 20 results per page.
[koha.git] / cataloguing / value_builder / unimarc_field_700-4.pl
1 #!/usr/bin/perl
2
3 # written 10/5/2002 by Paul
4
5 # Copyright 2000-2002 Katipo Communications
6 #
7 # This file is part of Koha.
8 #
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
12 # version.
13 #
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA  02111-1307 USA
21
22 use strict;
23 use C4::Auth;
24 use CGI;
25 use C4::Context;
26
27 use C4::Search;
28 use C4::Output;
29
30 =head1 NAME
31
32 plugin unimarc_field_700-4
33
34 =head1 SYNOPSIS
35
36 This plug-in deals with unimarc field 700-4 (
37
38 =head1 DESCRIPTION
39
40 =head1 FUNCTIONS
41
42 =over 2
43
44 =cut
45
46 sub plugin_javascript {
47 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
48 my $function_name= "7004".(int(rand(100000))+1);
49 my $res  = "
50 <script>
51 function Focus$function_name(index) {
52         return 1;
53 }
54
55 function Blur$function_name(subfield_managed) {
56         return 1;
57 }
58
59 function Clic$function_name(subfield_managed) {
60         defaultvalue=document.forms['f'].field_value[1].value;
61         newin=window.open(\"plugin_launcher.pl?plugin_name=unimarc_field_700-4.pl&result=\"+defaultvalue+\"&index=$field_number\",\"value builder\",'width=500,height=400,toolbar=false,scrollbars=yes');
62
63 }
64 </script>
65 ";
66
67 return ($function_name,$res);
68 }
69
70 sub plugin {
71 my ($input) = @_;
72         my $index= $input->param('index');
73         my $index2= $input->param('index2');
74         $index2=-1 unless($index2);
75         my $result= $input->param('result');
76
77
78         my $dbh = C4::Context->dbh;
79
80         my ($template, $loggedinuser, $cookie)
81         = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_700-4.tmpl",
82                                         query => $input,
83                                         type => "intranet",
84                                         authnotrequired => 0,
85                                         flagsrequired => {editcatalogue => 1},
86                                         debug => 1,
87                                         });
88         $template->param(index => $index,
89                                                         index2 => $index2,
90                                                         "f1_$result" => "f1_".$result,
91                                                         );
92         output_html_with_http_headers $input, $cookie, $template->output;
93 }
94
95 1;