Followup C4::Circulation.pm previous commit
[koha.git] / cataloguing / value_builder / labs_theses.pl
index f533205..8a88468 100755 (executable)
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
-require Exporter;
+
 use CGI;
 
-use C4::Interface::CGI::Output;
+use C4::Output;
 use C4::Context;
 use C4::Auth;
 use C4::Output;
@@ -37,20 +37,16 @@ sub plugin_javascript {
 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
 my $function_name= "328".(int(rand(100000))+1);
 my $res="
-<script>
-function Focus$function_name(subfield_managed) {
-return 1;
-}
-
-function Blur$function_name(subfield_managed) {
-       return 1;
-}
-
+<script type=\"text/javascript\">
+//<![CDATA[
+function Focus$function_name(subfield_managed) {return 1;}
+function Blur$function_name(subfield_managed) {return 1;}
 function Clic$function_name(i) {
-       defaultvalue=document.f.field_value[i].value;
-       newin=window.open(\"plugin_launcher.pl?plugin_name=labs_theses.pl&cat_auth=LABTHE&index=\"+i+\"&result=\"+defaultvalue,\"unimarc field 328\",'width=700,height=700,toolbar=false,scrollbars=yes');
-
+       defaultvalue=document.getElementById(i).value;
+       newin=window.open(\"plugin_launcher.pl?plugin_name=labs_theses.pl&cat_auth=LABTHE&index=\"+i+\"&result=\"+defaultvalue,\"unimarc_field_328\",'width=700,height=700,toolbar=false,scrollbars=yes');
+  return false; 
 }
+//]]>
 </script>
 ";
 
@@ -59,9 +55,6 @@ return ($function_name,$res);
 
 sub plugin {
        my ($input) = @_;
-       my %env;
-       
-       
        my $dbh=C4::Context->dbh;
        my $query = new CGI;
        my $op = $query->param('op');
@@ -94,9 +87,9 @@ sub plugin {
                my $total;
                while (my $data = $sth->fetchrow_hashref){
                        my $libjs=$data->{'lib'};
-                       $libjs=~s#\'#\\\'#g;
+#                      $libjs=~s#\'#\\\'#g;
                        my $authjs=$data->{'authorised_value'};
-                       $authjs=~s#\'#\\\'#g;
+#                      $authjs=~s#\'#\\\'#g;
                        push @results, {'libjs'=>$libjs,
                                                        'lib'=>$data->{'lib'},
                                                        'authjs'=>$authjs,
@@ -106,7 +99,7 @@ sub plugin {
                }
                
                ($template, $loggedinuser, $cookie)
-                       = get_template_and_user({template_name => "value_builder/labs_theses.tmpl",
+                       = get_template_and_user({template_name => "cataloguing/value_builder/labs_theses.tmpl",
                                        query => $query,
                                        type => 'intranet',
                                        authnotrequired => 1,
@@ -163,7 +156,7 @@ sub plugin {
        
        } else {
                ($template, $loggedinuser, $cookie)
-                       = get_template_and_user({template_name => "value_builder/labs_theses.tmpl",
+                       = get_template_and_user({template_name => "cataloguing/value_builder/labs_theses.tmpl",
                                                query => $query,
                                                type => "intranet",
                                                authnotrequired => 1,