*** empty log message ***
[koha_gimpoz] / value_builder / unimarc_field_100.pl
index 988b66b..6ca4317 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# written 10/5/2002 by Paul
+# $Id$
 
 # Copyright 2000-2002 Katipo Communications
 #
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
+use C4::Auth;
 use CGI;
 use C4::Context;
 use HTML::Template;
 use C4::Search;
 use C4::Output;
 
-sub plugin_parameters {
-my ($dbh,$record,$tagslib) = @_;
-return "";
+sub plugin_javascript {
+my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
+my $function_name= "100".(int(rand(100000))+1);
+my $res="
+<script>
+function Focus$function_name(subfield_managed) {
+return 1;
 }
 
+function Blur$function_name(subfield_managed) {
+       return 1;
+}
+
+function Clic$function_name(i) {
+       defaultvalue=document.forms[0].field_value[i].value;
+       newin=window.open(\"../plugin_launcher.pl?plugin_name=unimarc_field_100.pl&index=\"+i+\"&result=\"+defaultvalue,\"unimarc field 100\",'width=500,height=400,toolbar=false,scrollbars=yes');
+
+}
+</script>
+";
+
+return ($function_name,$res);
+}
 sub plugin {
 my ($input) = @_;
        my %env;
@@ -42,18 +61,24 @@ my ($input) = @_;
 
        my $dbh = C4::Context->dbh;
 
-       my $template = gettemplate("value_builder/unimarc_field_100.tmpl",0);
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "value_builder/unimarc_field_100.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
        my $f1 = substr($result,0,8);
        my $f2 = substr($result,8,1);
        my $f3 = substr($result,9,4);
        my $f4 = substr($result,13,4);
-       warn "f2 : $f2";
        $template->param(index => $index,
                                                        f1 => $f1,
                                                        f3 => $f3,
                                                        "f2$f2" => $f2,
                                                        f4 => $f4);
-       print "Content-Type: text/html\n\n", $template->output;
+       print $input->header(-cookie => $cookie),$template->output;
 }
 
 1;