From df16e66733956d8305ab445ebc44fa1b88593725 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 15 Nov 2017 17:41:55 +0000 Subject: [PATCH] Bug 19709 - Move template JavaScript to the footer: Labels This patch modifies the staff client label creator templates so that JavaScript is included in the footer instead of the header. To test, apply the patch and test the JavaScript-driven features of each modified template: All button controls, DataTables functionality, form validation, etc. - Creating and managing layouts - Creating and managing batches - Creating and managing templates - Creating and managing printer profiles - Creating quick spine labels Edit: Fixed footer include error causing blank popup --- .../prog/en/modules/labels/label-edit-batch.tt | 302 ++++++++++++--------- .../prog/en/modules/labels/label-edit-layout.tt | 65 +++-- .../prog/en/modules/labels/label-edit-profile.tt | 75 ++--- .../prog/en/modules/labels/label-edit-template.tt | 77 +++--- .../prog/en/modules/labels/label-home.tt | 8 +- .../prog/en/modules/labels/label-manage.tt | 159 +++++------ .../prog/en/modules/labels/label-print.tt | 37 ++- .../intranet-tmpl/prog/en/modules/labels/result.tt | 95 ++++--- .../intranet-tmpl/prog/en/modules/labels/search.tt | 12 +- .../prog/en/modules/labels/spinelabel-home.tt | 6 + .../prog/en/modules/labels/spinelabel-print.tt | 22 +- 11 files changed, 473 insertions(+), 385 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt index ed905a9..b126f8c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt @@ -1,12 +1,147 @@ [% USE ItemTypes %] +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Label creator › Batches › [% IF batch_id %]Edit ([% batch_id %])[% ELSE %]New[% END %] [% INCLUDE 'doc-head-close.inc' %] - [% INCLUDE 'greybox.inc' %] + + + + [% INCLUDE 'header.inc' %] + [% INCLUDE 'cat-search.inc' %] + +
+
+
+
+ [% INCLUDE 'labels-toolbar.inc' %] + [% IF ( err ) %] +
+ WARNING: An error was encountered and [% errstr %] Please have your system administrator check the error log for details. +
+ [% ELSIF ( duplicate_message ) %] +
+ Duplicate item(s) removed from batch number [% batch_id %]: [% duplicate_count %] +
+ [% END %] + +
+
Current library: [% LoginBranchname %]
+
+
+
+
  1. + + + + + Save description +
  2. +
  3. + +
    + + +
  4. +
  5. + + +
+
+
+
+ + [% IF ( table_loop ) %] +
+

Items in batch number [% batch_id %]

+ + [% FOREACH table_loo IN table_loop %] + [% IF ( table_loo.header_fields ) %] + + + [% FOREACH header_field IN table_loo.header_fields %] + [% SWITCH header_field.field_label -%] + [% CASE "Label number" -%] + + [% CASE "Summary" -%] + + [% CASE "Item type" %] + + [% CASE "Barcode" %] + + [% CASE "Select" -%] + + [% CASE %] + + [% END -%] + [% END %] + + + + [% ELSE %] + + [% FOREACH text_field IN table_loo.text_fields %] + [% IF ( text_field.select_field ) %] + + + [% ELSE %] + + [% END %] + [% END %] + + [% END %] + [% END %] + +
Label numberSummaryItem typeBarcodeSelect[% header_field.field_label %]
+ Delete + Export + + [% IF ( text_field.field_name == '_item_type_tbl' ) %] + [% ItemTypes.GetDescription( text_field.field_value ) %] + [% ELSE %] + [% text_field.field_value %] + [% END %] +
+
+ [% ELSE %] +
+

There are no items in this batch yet

+

Add items by using the text area above or leave empty to add via item search.

+
+ [% END %] +
+
+
+
+ [% INCLUDE 'tools-menu.inc' %] +
+
+ +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'greybox.inc' %] [% INCLUDE 'datatables.inc' %] + - - - [% INCLUDE 'header.inc' %] - [% INCLUDE 'cat-search.inc' %] - -
-
-
-
- [% INCLUDE 'labels-toolbar.inc' %] - [% IF ( err ) %] -
- WARNING: An error was encountered and [% errstr %] Please have your system administrator check the error log for details. -
- [% ELSIF ( duplicate_message ) %] -
- Duplicate item(s) removed from batch number [% batch_id %]: [% duplicate_count %] -
- [% END %] +[% END %] -
-
Current library: [% LoginBranchname %]
-
-
-
-
  1. - - -
  2. -
  3. - -
    - - -
  4. -
  5. - - -
-
-
-
- - [% IF ( table_loop ) %] -
-

Items in batch number [% batch_id %]

- - [% FOREACH table_loo IN table_loop %] - [% IF ( table_loo.header_fields ) %] - - - [% FOREACH header_field IN table_loo.header_fields %] - [% SWITCH header_field.field_label -%] - [% CASE "Label number" -%] - - [% CASE "Summary" -%] - - [% CASE "Item type" %] - - [% CASE "Barcode" %] - - [% CASE "Select" -%] - - [% CASE %] - - [% END -%] - [% END %] - - - - [% ELSE %] - - [% FOREACH text_field IN table_loo.text_fields %] - [% IF ( text_field.select_field ) %] - - - [% ELSE %] - - [% END %] - [% END %] - - [% END %] - [% END %] - -
Label numberSummaryItem typeBarcodeSelect[% header_field.field_label %]
- Delete - Export - - [% IF ( text_field.field_name == '_item_type_tbl' ) %] - [% ItemTypes.GetDescription( text_field.field_value ) %] - [% ELSE %] - [% text_field.field_value %] - [% END %] -
-
- [% ELSE %] -
-

There are no items in this batch yet

-

Add items by using the text area above or leave empty to add via item search.

-
- [% END %] -
-
-
-
- [% INCLUDE 'tools-menu.inc' %] -
-
- [% INCLUDE 'intranet-bottom.inc' %] +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-layout.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-layout.tt index 402ea9e..f5bdd4c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-layout.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-layout.tt @@ -7,38 +7,10 @@ [% CASE 'BAR' %]Barcode [% END %] [% END %] +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Label creator › Layouts › [% IF ( layout_id ) %]Edit ([% layout_id %])[% ELSE %]New[% END %] [% INCLUDE 'doc-head-close.inc' %] - [% BLOCK translate_justification_types %] [% SWITCH type %] @@ -47,6 +19,7 @@ [% CASE 'R' %]Right [% END %] [% END %] + [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] @@ -213,4 +186,36 @@ [% INCLUDE 'tools-menu.inc' %]
- [% INCLUDE 'intranet-bottom.inc' %] + +[% MACRO jsinclude BLOCK %] + + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tt index 03d1a50..c542112 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tt @@ -1,41 +1,9 @@ +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Label creator › Profiles › [% IF ( profile_id ) %]Edit ([% profile_id %])[% ELSE %]New[% END%] [% INCLUDE 'doc-head-close.inc' %] - + [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] @@ -146,4 +114,41 @@ [% INCLUDE 'tools-menu.inc' %] - [% INCLUDE 'intranet-bottom.inc' %] + +[% MACRO jsinclude BLOCK %] + + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-template.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-template.tt index e4fc9f9..a350945 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-template.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-template.tt @@ -1,41 +1,9 @@ +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Label creator › Templates › [% IF ( template_id ) %]Edit ([% template_id %])[% ELSE %]New[% END %] [% INCLUDE 'doc-head-close.inc' %] - + [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] @@ -182,4 +150,43 @@ [% INCLUDE 'tools-menu.inc' %] - [% INCLUDE 'intranet-bottom.inc' %] + +[% MACRO jsinclude BLOCK %] + + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-home.tt index f5e7725..f2a549c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-home.tt @@ -1,3 +1,4 @@ +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Label creator [% INCLUDE 'doc-head-close.inc' %] @@ -29,4 +30,9 @@ [% INCLUDE 'tools-menu.inc' %] - [% INCLUDE 'intranet-bottom.inc' %] + +[% MACRO jsinclude BLOCK %] + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt index 3444b21..08dec87 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt @@ -10,86 +10,13 @@ [%- CASE 'Batches' -%]Batches [%- END -%] [% END %] +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Label creator › [% PROCESS translate_label_element element=label_element_title %] [% INCLUDE 'doc-head-close.inc' %] - [% INCLUDE 'greybox.inc' %] - - - -[% INCLUDE 'datatables.inc' %] - - + + [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] @@ -185,4 +112,82 @@ [% INCLUDE 'tools-menu.inc' %] - [% INCLUDE 'intranet-bottom.inc' %] + +[% MACRO jsinclude BLOCK %] + + [% INCLUDE 'greybox.inc' %] + + + [% INCLUDE 'datatables.inc' %] + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-print.tt index 0bb80b9..4c10884 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-print.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-print.tt @@ -1,18 +1,10 @@ - [% INCLUDE 'doc-head-open.inc' %] + +[% IF ( bidi ) %][% ELSE %][% END %] + Koha › Tools › Label creator › Label printing/exporting - [% INCLUDE 'doc-head-close.inc' popup => 1 %] - + + [% INCLUDE intranetstylesheet.inc %] + [% IF ( IntranetUserCSS ) %][% END %] @@ -107,4 +99,21 @@ [% END %] + +[% IF ( IntranetUserJS ) %] + + + +[% END %] + [% INCLUDE 'popup-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt index e8e0180..958d44b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt @@ -1,52 +1,10 @@ +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Barcodes and labels › Search results [% INCLUDE 'doc-head-close.inc' %] - - +
@@ -150,4 +108,51 @@ z [% END -%] [% END %]
- [% INCLUDE 'popup-bottom.inc' %] + +[% MACRO jsinclude BLOCK %] + + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' popup_window=1 %] + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tt index d9d5235..ef8e8fa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tt @@ -1,6 +1,7 @@ -[% INCLUDE 'doc-head-open.inc' %]Koha › Labels +[% SET footerjs = 1 %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Labels [% INCLUDE 'doc-head-close.inc' %] -[% INCLUDE 'calendar.inc' %] @@ -105,4 +106,9 @@ to add to Batch [% batch_id %]
-[% INCLUDE 'popup-bottom.inc' %] + +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'calendar.inc' %] +[% END %] + +[% INCLUDE 'intranet-bottom.inc' popup_window=1 %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-home.tt index e324db5..6e123c0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-home.tt @@ -1,3 +1,4 @@ +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %]Koha › Tools › Quick spine label creator [% INCLUDE 'doc-head-close.inc' %] @@ -30,4 +31,9 @@ + +[% MACRO jsinclude BLOCK %] + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tt index 47b3602..594d279 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tt @@ -11,21 +11,11 @@ } [% IF ( IntranetUserCSS ) %][% END %] -[% IF ( IntranetUserJS ) %] - - - -[% END %] [% IF ( BarcodeNotFound ) %]

The barcode [% Barcode |html %] was not found.

Return to spine label printer

- [% ELSE %] [% IF ( autoprint ) %] @@ -38,6 +28,14 @@ - [% END %] - + +[% IF ( IntranetUserJS ) %] + + + +[% END %] + +[% INCLUDE 'popup-bottom.inc' %] -- 2.1.4