Koha/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-print.tt
Owen Leonard b118074fe4 Bug 16576 [Revised] Remove the use of "onclick" from label templates
This patch updates several label creator templates to remove the use of
"onclick" in favor of defining click events in JavaScript.

Also changed:
 - Replaced the non-existant element <icon> with <i>
 - Removed the use of <center> and 'align="center"';
 - In the item search results template:
   - The use of the checkboxes jQuery plugin has been replaced with
     straight jQuery for simplicity's sake.
   - Output of table headers has been modified so that translatable
     strings are in the template instead of having English strings
     passed from the script.
   - Moved the 'Add checked' and 'Done' buttons into a floating toolbar.

To test, apply the patch and go to Tools -> Label creator.

- Choose New -> Label batch
  - Click 'Add items'
    - Perform a search for items.
    - Confirm that 'select all' and 'clear all' links work.
    - Confirm that clicking an individual 'Add' button works.
    - Select multiple items and click the 'Add checked' button. Confirm
      that the selected items were added to your batch.
  - Click 'Add items' again to save the selected items to your batch.
  - Test that the 'Delete' and 'Export' buttons next to any item work
    correctly.
- Choose Manage -> Label batches
  - Test that the 'Delete' button works correctly.
  - Select one or more batches and test that the 'Export selected'
    button works correctly.

Revision: Removed changes to pagination in the item search results
template since it didn't work.

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-09-09 12:11:21 +00:00

110 lines
7.6 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Label creator &rsaquo; Label printing/exporting</title>
[% INCLUDE 'doc-head-close.inc' popup => 1 %]
<script type="text/javascript">
//<![CDATA[
function Done() {
window.location = "[% referer %]";
};
$(document).ready(function(){
$(".gb-close").on("click",function(){
parent.parent.GB_hide();
});
});
//]]>
</script>
<style type="text/css">#custom-doc {width:47.23em; *width:46.04em; min-width:610px; margin:auto; margin-top:0.4em;}</style>
<style type="text/css">table {border-collapse: separate; border-spacing: 0; border: hidden none;} .header {cursor: auto; background-position: center center; background-repeat: repeat;}</style>
</head>
<body id="labels_label-print" class="tools labels">
<div id="custom-doc" class="yui-t2">
<div id="bd">
[% IF ( batches ) %]
<form>
<h3>Click on the following links to download the exported batch(es).</h3>
[% FOREACH batche IN batches %]
<fieldset>
[% IF ( batche.label_ids ) %]
<legend>[% IF ( batche.label_count == 1 ) %][% batche.label_count %] single label[% ELSE %][% batche.label_count %] single labels[% END %]</legend>
<p><a class="document pdf" href="/cgi-bin/koha/labels/[% batche.create_script %]?batch_id=[% batche.batch_id %]&amp;template_id=[% batche.template_id %]&amp;layout_id=[% batche.layout_id %]&amp;start_label=[% batche.start_label %][% batche.label_ids %]">Download as PDF</a></p>
<p><a class="document csv" href="/cgi-bin/koha/labels/label-create-csv.pl?batch_id=[% batche.batch_id %]&amp;template_id=[% batche.template_id %]&amp;layout_id=[% batche.layout_id %][% batche.label_ids %]">Download as CSV</a></p>
<p><a class="document xml" href="/cgi-bin/koha/labels/label-create-xml.pl?batch_id=[% batche.batch_id %]&amp;template_id=[% batche.template_id %]&amp;layout_id=[% batche.layout_id %][% batche.label_ids %]">Download as XML</a></p>
[% ELSIF ( batche.item_numbers ) %]
<legend>[% IF ( batche.label_count == 1 ) %][% batche.label_count %] single label[% ELSE %][% batche.label_count %] single labels[% END %]</legend>
<p><a class="document pdf" href="/cgi-bin/koha/labels/[% batche.create_script %]?template_id=[% batche.template_id %]&amp;layout_id=[% batche.layout_id %]&amp;start_label=[% batche.start_label %][% batche.item_numbers %]">Download as PDF</a></p>
<p><a class="document csv" href="/cgi-bin/koha/labels/label-create-csv.pl?batch_id=[% batche.batch_id %]&amp;template_id=[% batche.template_id %]&amp;layout_id=[% batche.layout_id %][% batche.item_numbers %]">Download as CSV</a></p>
<p><a class="document xml" href="/cgi-bin/koha/labels/label-create-xml.pl?batch_id=[% batche.batch_id %]&amp;template_id=[% batche.template_id %]&amp;layout_id=[% batche.layout_id %][% batche.item_numbers %]">Download as XML</a></p>
[% ELSE %]
<legend>Label Batch Number [% batche.batch_id %]</legend>
<p><a class="document pdf" href="/cgi-bin/koha/labels/label-create-pdf.pl?batch_id=[% batche.batch_id %]&amp;template_id=[% batche.template_id %]&amp;layout_id=[% batche.layout_id %]&amp;start_label=[% batche.start_label %]">Download as PDF</a>
</p>
<p>
<a class="document csv" href="/cgi-bin/koha/labels/label-create-csv.pl?batch_id=[% batche.batch_id %]&amp;template_id=[% batche.template_id %]&amp;layout_id=[% batche.layout_id %]">Download as CSV</a>
</p>
<p>
<a class="document xml" href="/cgi-bin/koha/labels/label-create-xml.pl?batch_id=[% batche.batch_id %]&amp;template_id=[% batche.template_id %]&amp;layout_id=[% batche.layout_id %]">Download as XML</a></p>
[% END %]
</fieldset>
[% END %]
<fieldset class="action">
<input type="button" class="gb-close" value="Done" />
</fieldset>
</form>
[% ELSE %]
<h3>
[% IF ( label_ids ) %]
[% IF ( label_count == 1 ) %]Exporting [% label_count %] label[% ELSE %]Exporting [% label_count %] labels[% END %]
[% ELSIF ( item_numbers ) %]
[% IF ( item_count == 1 ) %]Exporting [% item_count %] label[% ELSE %]Exporting [% item_count %] labels[% END %]
[% ELSE %]
[% IF ( multi_batch_count == 1 ) %][% multi_batch_count %] batch to export[% ELSE %][% multi_batch_count %] batches to export[% END %]
[% END %]
</h3>
<form name="exporting" method="post" action="/cgi-bin/koha/labels/label-print.pl">
<input type="hidden" name="op" value="export" />
<input type="hidden" name="referer" value="[% referer %]" />
[% FOREACH batch_id IN batch_ids %]
<input type="hidden" name="batch_id" value="[% batch_id.batch_id %]" />
[% END %]
[% FOREACH label_id IN label_ids %]
<input type="hidden" name="label_id" value="[% label_id.label_id %]" />
[% END %]
[% FOREACH item_number IN item_numbers %]
<input type="hidden" name="item_number" value="[% item_number.item_number %]" />
[% END %]
<fieldset class="rows">
<ol>
<li>
<label for="template_id" style="width:20em">Select a template to be applied: </label>
<select name="template_id" id="template_id">
[% FOREACH template IN templates %]
<option value="[% template.template_id %]">[% template.template_code %]</option>
[% END %]
</select>
</li>
<li>
<label for="layout_id" style="width:20em">Select a layout to be applied: </label>
<select name="layout_id" id="layout_id">
[% FOREACH layout IN layouts %]
<option value="[% layout.layout_id %]">[% layout.layout_name %]</option>
[% END %]
</select>
</li>
<li>
<label for="start_label" style="width:20em">Enter starting label position (for PDF): </label>
<input type="text" size="5" id="start_label" name="start_label" class="focus" title="Starting label number" value="1"/>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Export" />
<a href="#" class="cancel gb-close">Cancel</a>
</fieldset>
</form>
[% END %]
</div>
[% INCLUDE 'popup-bottom.inc' %]