Bug 19877: Move template JavaScript to the footer: UNIMARC editor plugins, part 6
authorOwen Leonard <oleonard@myacpl.org>
Fri, 22 Dec 2017 16:32:57 +0000 (16:32 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 26 Mar 2018 20:31:21 +0000 (17:31 -0300)
This patch updates more UNIMARC plugin templates than ever before, so
that JavaScript is included in the footer following the same pattern as
other templates which have been modified to fix Bug 17858.

To test you do not need a UNIMARC system.

Apply the patch and for each plugin, configure a MARC subfield (e.g.
100$a) to use that plugin.

From the MARC edit page, trigger the plugin and confirm that changes
made in the popup window are saved to the corresponding field in the
editor.

- unimarc_field_128a.tt
- unimarc_field_128b.tt
- unimarc_field_128c.tt
- unimarc_field_130.tt
- unimarc_field_135a.tt
- unimarc_field_140.tt
- unimarc_field_141.tt

Signed-off-by: delaye <stephane.delaye@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_128a.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_128b.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_128c.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_130.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_135a.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_140.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_141.tt

index 88d7f8c..bba00eb 100644 (file)
@@ -1,7 +1,9 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>UNIMARC field 128a builder</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
+
 <body id="cat_unimarc_field_128a" class="cat" style="padding:1em;">
 <h3>UNIMARC field 128a builder</h3>
 <form name="f_pop" action="">
 </table>
 <fieldset class="action"><input type="button" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></fieldset>
 </form>
-<script type="text/javascript">
-//<![CDATA[
-    function report() {
-        var doc   = opener.document; 
-        var field = doc.getElementById("[% index %]");
-        field.value =  document.f_pop.f1.value;
-        window.close();
-        return false;
-    }
-//]]>
-</script>
 
-[% INCLUDE 'popup-bottom.inc' %]
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript">
+        var dateformat = "[% Koha.Preference('dateformat') %]";
+        function report() {
+            var doc = opener.document;
+            var field = doc.getElementById("[% index %]");
+            field.value = document.f_pop.f1.value;
+            window.close();
+            return false;
+        }
+    </script>
+[% END %]
+
+[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]
\ No newline at end of file
index 9f302ae..e92cbb6 100644 (file)
@@ -1,7 +1,9 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>UNIMARC field 128b builder</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
+
 <body id="cat_unimarc_field_128b" class="cat" style="padding:1em;">
 <h3>UNIMARC field 128b builder</h3>
 <form name="f_pop" action="">
 </table>
 <fieldset class="action"><input type="button" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></fieldset>
 </form>
-<script type="javascript">
-//<![CDATA[
-       function report() {
-               var doc   = opener.document; 
+
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript">
+        var dateformat = "[% Koha.Preference('dateformat') %]";
+        function report() {
+            var doc   = opener.document;
             var field = doc.getElementById("[% index %]");
-        
-            field.value =  document.f_pop.f1.value;
-               self.close();
-               return false;
-       }
-//]]>
-</script>
+            field.value = document.f_pop.f1.value;
+            window.close();
+            return false;
+        }
+    </script>
+[% END %]
 
-[% INCLUDE 'popup-bottom.inc' %]
+[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]
\ No newline at end of file
index 50a8be0..d5aa78d 100644 (file)
@@ -1,7 +1,9 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>UNIMARC field 128c builder</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
+
 <body id="cat_unimarc_field_128c" class="cat" style="padding:1em;">
 <h3>UNIMARC field 128c builder</h3>
 <form name="f_pop" action="">
 </table>
 <fieldset class="action"><input type="button" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></fieldset>
 </form>
-<script type="text/javascript">
-//<![CDATA[
-       function report() {
-            var doc   = opener.document; 
+
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript">
+        var dateformat = "[% Koha.Preference('dateformat') %]";
+        function report() {
+            var doc   = opener.document;
             var field = doc.getElementById("[% index %]");
             field.value =  document.f_pop.f1.value;
-           window.close();
-           return false;
-       }
-//]]>
-</script>
+            window.close();
+            return false;
+        }
+    </script>
+[% END %]
 
-[% INCLUDE 'popup-bottom.inc' %]
+[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]
\ No newline at end of file
index 6b07582..b486896 100644 (file)
@@ -1,7 +1,9 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>UNIMARC field 130 builder</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
+
 <body id="cat_unimarc_field_130" class="cat" style="padding:1em;">
 <h3>UNIMARC field 130 builder</h3>
 <form name="f_pop" action="">
@@ -325,18 +327,20 @@ value="[% f5 %]" /></td>
 </table>
 <fieldset class="action"><input type="button" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></fieldset>
 </form>
-<script type="text/javascript">
-//<![CDATA[
-       function report() {
-           document.f_pop.f5.value=document.f_pop.f5.value+'   ';
-           document.f_pop.f5.value=document.f_pop.f5.value.substring(0,3);
-           var doc   = opener.document; 
+
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript">
+        var dateformat = "[% Koha.Preference('dateformat') %]";
+        function report() {
+            document.f_pop.f5.value=document.f_pop.f5.value+'   ';
+            document.f_pop.f5.value=document.f_pop.f5.value.substring(0,3);
+            var doc   = opener.document;
             var field = doc.getElementById("[% index %]");
             field.value =  document.f_pop.f1.value+document.f_pop.f2.value+document.f_pop.f3.value+document.f_pop.f4.value+document.f_pop.f5.value+document.f_pop.f6.value+document.f_pop.f7.value+document.f_pop.f8.value+document.f_pop.f9.value ;
-           window.close();
-           return false;
-       }
-//]]>
-</script>
+            window.close();
+            return false;
+        }
+    </script>
+[% END %]
 
-[% INCLUDE 'popup-bottom.inc' %]
+[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]
\ No newline at end of file
index 4483cf3..cd106f7 100644 (file)
@@ -1,7 +1,9 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>UNIMARC field 135a builder</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
+
 <body id="cat_unimarc_field_135a" class="cat" style="padding:1em;">
 <h3>UNIMARC field 135a builder</h3>
 <form name="f_pop" action="">
 </table>
 <p><input type="button" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></p>
 </form>
-<script type="text/javascript">
-//<![CDATA[
-       function report() {
-            var doc   = opener.document; 
+
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript">
+        var dateformat = "[% Koha.Preference('dateformat') %]";
+        function report() {
+            var doc   = opener.document;
             var field = doc.getElementById("[% index %]");
-            
+
             field.value =  document.f_pop.f1.value;
             window.close();
             return false;
-       }
-//]]>
-</script>
+        }
+    </script>
+[% END %]
 
-[% INCLUDE 'popup-bottom.inc' %]
+[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]
\ No newline at end of file
index 585f1a0..c1eaf92 100644 (file)
@@ -1,7 +1,9 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>UNIMARC field 140 builder</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
+
 <body id="cat_unimarc_field_140" class="cat" style="padding:1em;">
 <h3>UNIMARC field 140 builder</h3>
 <form name="f_pop" action="">
 </table>
 <fieldset class="action"><input type="button" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></fieldset>
 </form>
-<script type="text/javascript">
-//<![CDATA[
-    function report() {
-        var doc = opener.document; 
-        var field = doc.getElementById("[% index %]");
-        field.value =  document.f_pop.f1.value+document.f_pop.f2.value+document.f_pop.f3.value+document.f_pop.f4.value+document.f_pop.f5.value+document.f_pop.f6.value+document.f_pop.f7.value+document.f_pop.f8.value+document.f_pop.f9.value+document.f_pop.f10.value+document.f_pop.f11.value+document.f_pop.f12.value+document.f_pop.f13.value+document.f_pop.f14.value+document.f_pop.f15.value+document.f_pop.f16.value+document.f_pop.f17.value+document.f_pop.f18.value+document.f_pop.f19.value+document.f_pop.f20.value+document.f_pop.f21.value;
-        self.close();
-        return false;
-    }
-//]]>
-</script>
 
-[% INCLUDE 'popup-bottom.inc' %]
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript">
+        var dateformat = "[% Koha.Preference('dateformat') %]";
+        function report() {
+            var doc = opener.document;
+            var field = doc.getElementById("[% index %]");
+            field.value =  document.f_pop.f1.value+document.f_pop.f2.value+document.f_pop.f3.value+document.f_pop.f4.value+document.f_pop.f5.value+document.f_pop.f6.value+document.f_pop.f7.value+document.f_pop.f8.value+document.f_pop.f9.value+document.f_pop.f10.value+document.f_pop.f11.value+document.f_pop.f12.value+document.f_pop.f13.value+document.f_pop.f14.value+document.f_pop.f15.value+document.f_pop.f16.value+document.f_pop.f17.value+document.f_pop.f18.value+document.f_pop.f19.value+document.f_pop.f20.value+document.f_pop.f21.value;
+            self.close();
+            return false;
+        }
+    </script>
+[% END %]
+
+[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]
\ No newline at end of file
index a7ffe28..6b1d6d2 100644 (file)
@@ -1,7 +1,9 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>UNIMARC field 141 builder</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
+
 <body id="cat_unimarc_field_141" class="cat" style="padding:1em;">
 <h3>UNIMARC field 141 builder</h3>
 <form name="f_pop" action="">
 </table>
 <fieldset class="action"><input type="button" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></fieldset>
 </form>
-<script type="text/javascript">
-//<![CDATA[
-    function report() {
-        var doc   = opener.document; 
-        var field = doc.getElementById("[% index %]");
-    
-        field.value =  document.f_pop.f1.value+document.f_pop.f2.value+document.f_pop.f3.value+document.f_pop.f4.value+document.f_pop.f5.value+document.f_pop.f6.value+document.f_pop.f7.value+document.f_pop.f8.value;
-        self.close();
-        return false;
-    }
-//]]>
-</script>
 
-[% INCLUDE 'popup-bottom.inc' %]
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript">
+        var dateformat = "[% Koha.Preference('dateformat') %]";
+        function report() {
+            var doc = opener.document;
+            var field = doc.getElementById("[% index %]");
+
+            field.value = document.f_pop.f1.value+document.f_pop.f2.value+document.f_pop.f3.value+document.f_pop.f4.value+document.f_pop.f5.value+document.f_pop.f6.value+document.f_pop.f7.value+document.f_pop.f8.value;
+            self.close();
+            return false;
+        }
+    </script>
+[% END %]
+
+[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]
\ No newline at end of file