Fixing Labtheses.pl
authorHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Mon, 29 Sep 2008 19:44:59 +0000 (21:44 +0200)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 26 May 2009 19:15:31 +0000 (21:15 +0200)
cataloguing/value_builder/labs_theses.pl
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/labs_theses.tmpl

index 382c763..8a88468 100755 (executable)
@@ -39,19 +39,12 @@ my $function_name= "328".(int(rand(100000))+1);
 my $res="
 <script type=\"text/javascript\">
 //<![CDATA[
-
-function Focus$function_name(subfield_managed) {
-return 1;
-}
-
-function Blur$function_name(subfield_managed) {
-       return 1;
-}
-
+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(\"../cataloguing/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>
@@ -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,
index 5312bff..c9da9cf 100644 (file)
@@ -81,8 +81,8 @@ a.catalogue:hover {
                                                <!-- TMPL_VAR NAME="lib" -->
                                                </td>
                                                <td>
-                                                       <a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="libjs" ESCAPE="URL" -->','<!-- TMPL_VAR NAME="authjs" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="index" ESCAPE="URL"  -->,0)" class="button">Select</a>
-                                                       <a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="libjs" ESCAPE="URL" -->','<!-- TMPL_VAR NAME="authjs" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="index" ESCAPE="URL"  -->,1)" class="button">Sel&amp;close</a>
+                                                       <a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="libjs" ESCAPE="JS" -->','<!-- TMPL_VAR NAME="authjs" ESCAPE="JS" -->','<!-- TMPL_VAR NAME="index" ESCAPE="URL" -->',0)" class="button">Select</a>
+                                                       <a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="libjs" ESCAPE="JS" -->','<!-- TMPL_VAR NAME="authjs" ESCAPE="JS" -->','<!-- TMPL_VAR NAME="index" ESCAPE="URL" -->',1)" class="button">Sel&amp;close</a>
                                                </td>
                                        </tr>
                                <!-- /TMPL_LOOP -->
@@ -111,11 +111,13 @@ a.catalogue:hover {
                </div>
        <script language="JavaScript" type="text/javascript">
        function SelectEntry(myentry, mycode, myindex, wclose){
-               if (opener.document.f.field_value[myindex].value!=""){ 
-                       opener.document.f.field_value[myindex].value=opener.document.f.field_value[myindex].value+"|"+myentry
-               } else {
-                       opener.document.f.field_value[myindex].value=myentry
-               }
+    with(opener.document){
+                   if (getElementById(myindex).value!=""){ 
+                         getElementById(myindex).value=getElementById(myindex).value+"|"+myentry
+                   } else {
+                         getElementById(myindex).value=myentry
+                   }
+    }  
                if (wclose == 1) {
        //      alert("closing")
                        self.close();