2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>[% IF ( layout_id ) %]Edit ([% layout_id | html %])[% ELSE %]New[% END %] › Layout › Patron card creator › Tools › Koha</title>
4 [% INCLUDE 'doc-head-close.inc' %]
7 <body id="pcard_edit-layout" class="tools pcard">
8 [% INCLUDE 'header.inc' %]
9 [% INCLUDE 'cat-search.inc' %]
11 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
14 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
17 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
20 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a>
23 <a href="/cgi-bin/koha/patroncards/manage.pl?card_element=layout">Layouts</a>
26 <a href="#" aria-current="page">
27 [% IF ( layout_id ) %]
28 Edit ([% layout_id | html %])
37 <div class="main container-fluid">
39 <div class="col-sm-10 col-sm-push-2">
42 [% INCLUDE 'patroncards-toolbar.inc' %]
44 <h1>[% IF ( layout_id ) %]<span>Edit patron card layout</span> [% layout_id | html %]
45 [% ELSE %]<span>Create patron card layout</span>[% END %]
48 <!-- NOTE: The order of the elements on this form is crictical to correct processing. You've been warned... -->
49 <form name="input" action="/cgi-bin/koha/patroncards/edit-layout.pl" method="get">
51 <div class="col-sm-6">
52 <fieldset class="rows">
53 <legend>[% IF ( layout_id ) %]Edit[% ELSE %]Create[% END %] patron card text layout</legend>
57 <legend>General settings</legend>
60 <label for="layout_name">Layout name: </label>
61 <input type="text" name="layout_name" id="layout_name" size="20" value="[% layout_name | html %]" />
64 <label for="units">Units: </label>
65 <select id="units" name="units">
66 [% FOREACH unit IN units %]
67 [% IF ( unit.selected ) %]
68 <option value="[% unit.type | html %]" selected="selected">
70 <option value="[% unit.type | html %]">
72 [% unit.desc | html %]
78 <label for="page_side">Page side: </label>
79 [% IF ( page_side ) %]
80 <input type="radio" name="page_side" id="page_side" value="F" />Front
81 <input type="radio" name="page_side" id="page_side" value="B" checked="checked" />Back
83 <input type="radio" name="page_side" id="page_side" value="F" checked="checked" />Front
84 <input type="radio" name="page_side" id="page_side" value="B" />Back
88 <label for="guide_box">Guide box:</label>
89 [% IF ( guide_box ) %]
90 <input type="radio" name="guide_box" id="guide_box" value="1" checked="checked" />On
91 <input type="radio" name="guide_box" id="guide_box" value="0" />Off
93 <input type="radio" name="guide_box" id="guide_box" value="1" />On
94 <input type="radio" name="guide_box" id="guide_box" value="0" checked="checked" />Off
98 <label for="guide_grid">Guide grid:</label>
99 [% IF ( guide_grid ) %]
100 <input type="radio" name="guide_grid" id="guide_grid" value="1" checked="checked" />On
101 <input type="radio" name="guide_grid" id="guide_grid" value="0" />Off
103 <input type="radio" name="guide_grid" id="guide_grid" value="1" />On
104 <input type="radio" name="guide_grid" id="guide_grid" value="0" checked="checked" />Off
112 <legend>Text fields</legend>
117 <legend><input type="checkbox" name="field_1_enable" id="field_1_enable" value="1" checked="checked" /> Field 1</legend>
119 <legend><input type="checkbox" name="field_1_enable" id="field_1_enable" value="1" /> Field 1</legend>
121 <div id="field_1_select" style="display: none;">
124 <label for="field_1_text">Text: </label>
125 <input type="text" name="field_1_text" id="field_1_text" size="60" value="[% field_1_text | html %]" />
128 <label for="field_1_font">Font: </label>
129 <select name="field_1_font" id="field_1_font">
130 [% FOREACH field_1_fon IN field_1_font %]
131 [% IF ( field_1_fon.selected ) %]
132 <option value="[% field_1_fon.type | html %]" selected="selected">[% field_1_fon.name | html %]</option>
134 <option value="[% field_1_fon.type | html %]">[% field_1_fon.name | html %]</option>
140 <label for="field_1_font_size">Font size: </label>
141 <input type="text" name="field_1_font_size" id="field_1_font_size" size="2" value="[% field_1_font_size | html %]" />
142 <span class="font_unit"> pt</span>
145 <label for="field_1_text_alignment">Text alignment: </label>
146 <select name="field_1_text_alignment" id="field_1_text_alignment">
147 [% FOREACH field_1_text_alignmen IN field_1_text_alignment %]
148 [% IF ( field_1_text_alignmen.selected ) %]
149 <option value="[% field_1_text_alignmen.type | html %]" selected="selected">[% field_1_text_alignmen.name | html %]</option>
151 <option value="[% field_1_text_alignmen.type | html %]">[% field_1_text_alignmen.name | html %]</option>
157 <label for="field_1_llx">Lower left X coordinate: </label>
158 <input type="text" name="field_1_llx" id="field_1_llx" size="2" value="[% field_1_llx | html %]" />
161 <label for="field_1_lly">Lower left Y coordinate: </label>
162 <input type="text" name="field_1_lly" id="field_1_lly" size="2" value="[% field_1_lly | html %]" />
171 <legend><input type="checkbox" name="field_2_enable" id="field_2_enable" value="1" checked="checked"/> Field 2</legend>
173 <legend><input type="checkbox" name="field_2_enable" id="field_2_enable" value="1" /> Field 2</legend>
175 <div id="field_2_select" style="display: none;">
178 <label for="field_2_text">Text: </label>
179 <input type="text" name="field_2_text" id="field_2_text" size="60" value="[% field_2_text | html %]" />
182 <label for="field_2_font">Font: </label>
183 <select name="field_2_font" id="field_2_font">
184 [% FOREACH field_2_fon IN field_2_font %]
185 [% IF ( field_2_fon.selected ) %]
186 <option value="[% field_2_fon.type | html %]" selected="selected">[% field_2_fon.name | html %]</option>
188 <option value="[% field_2_fon.type | html %]">[% field_2_fon.name | html %]</option>
194 <label for="field_2_font_size">Font size: </label>
195 <input type="text" name="field_2_font_size" id="field_2_font_size" size="2" value="[% field_2_font_size | html %]" />
196 <span class="font_unit"> pt</span>
199 <label for="field_2_text_alignment">Text alignment: </label>
200 <select name="field_2_text_alignment" id="field_2_text_alignment">
201 [% FOREACH field_2_text_alignmen IN field_2_text_alignment %]
202 [% IF ( field_2_text_alignmen.selected ) %]
203 <option value="[% field_2_text_alignmen.type | html %]" selected="selected">[% field_2_text_alignmen.name | html %]</option>
205 <option value="[% field_2_text_alignmen.type | html %]">[% field_2_text_alignmen.name | html %]</option>
211 <label for="field_2_llx">Lower left X coordinate: </label>
212 <input type="text" name="field_2_llx" id="field_2_llx" size="2" value="[% field_2_llx | html %]" />
215 <label for="field_2_lly">Lower left Y coordinate: </label>
216 <input type="text" name="field_2_lly" id="field_2_lly" size="2" value="[% field_2_lly | html %]" />
225 <legend><input type="checkbox" name="field_3_enable" id="field_3_enable" value="1" checked="checked"/> Field 3</legend>
227 <legend><input type="checkbox" name="field_3_enable" id="field_3_enable" value="0" /> Field 3</legend>
229 <div id="field_3_select" style="display: none;">
232 <label for="field_3_text">Text: </label>
233 <input type="text" name="field_3_text" id="field_3_text" size="60" value="[% field_3_text | html %]" />
236 <label for="field_3_font">Font: </label>
237 <select name="field_3_font" id="field_3_font">
238 [% FOREACH field_3_fon IN field_3_font %]
239 [% IF ( field_3_fon.selected ) %]
240 <option value="[% field_3_fon.type | html %]" selected="selected">[% field_3_fon.name | html %]</option>
242 <option value="[% field_3_fon.type | html %]">[% field_3_fon.name | html %]</option>
248 <label for="field_3_font_size">Font size: </label>
249 <input type="text" name="field_3_font_size" id="field_3_font_size" size="2" value="[% field_3_font_size | html %]" />
250 <span class="font_unit"> pt</span>
253 <label for="field_3_text_alignment">Text alignment: </label>
254 <select name="field_3_text_alignment" id="field_3_text_alignment">
255 [% FOREACH field_3_text_alignmen IN field_3_text_alignment %]
256 [% IF ( field_3_text_alignmen.selected ) %]
257 <option value="[% field_3_text_alignmen.type | html %]" selected="selected">[% field_3_text_alignmen.name | html %]</option>
259 <option value="[% field_3_text_alignmen.type | html %]">[% field_3_text_alignmen.name | html %]</option>
265 <label for="field_3_llx">Lower left X coordinate: </label>
266 <input type="text" name="field_3_llx" id="field_3_llx" size="2" value="[% field_3_llx | html %]" />
269 <label for="field_3_lly">Lower left Y coordinate: </label>
270 <input type="text" name="field_3_lly" id="field_3_lly" size="2" value="[% field_3_lly | html %]" />
282 <div class="col-sm-6">
283 <fieldset class="rows">
284 <legend>[% IF ( layout_id ) %]<span>Edit patron card graphic layout</span>
285 [% ELSE %]<span>Create patron card graphic layout</span>[% END %]
291 <label for="guidebox">Draw guide boxes: </label>
292 [% IF ( guidebox ) %]
293 <input type="checkbox" name="guidebox" id="guidebox" value="1" checked="checked" />
295 <input type="checkbox" name="guidebox" id="guidebox" value="1" />
302 <legend>Barcode</legend>
305 <label for="barcode_print">Print card number as barcode: </label>
306 [% IF ( barcode_print ) %]
307 <input type="checkbox" name="barcode_print" id="barcode_print" value="1" checked="checked" />
309 <input type="checkbox" name="barcode_print" id="barcode_print" value="1" />
313 <div id="barcode_param" style="display: none;">
316 <label for="barcode_llx">Lower left X coordinate: </label>
317 <input type="text" name="barcode_llx" id="barcode_llx" size="2" value="[% barcode_llx | html %]" />
320 <label for="barcode_lly">Lower left Y coordinate: </label>
321 <input type="text" name="barcode_lly" id="barcode_lly" size="2" value="[% barcode_lly | html %]" />
324 <label for="barcode_height_scale">Scale height (relative to card): </label>
325 <input type="text" name="barcode_height_scale" id="barcode_height_scale" size="2" value="[% barcode_height_scale | html %]" />
328 <label for="barcode_width_scale">Scale width (relative to card): </label>
329 <input type="text" name="barcode_width_scale" id="barcode_width_scale" size="2" value="[% barcode_width_scale | html %]" />
332 <label for="barcode_type">Barcode type: </label>
333 <select name="barcode_type" id="barcode_type">
334 [% FOREACH barcode_typ IN barcode_type %]
335 [% IF ( barcode_typ.selected ) %]
336 <option value="[% barcode_typ.type | html %]" selected="selected">[% barcode_typ.name | html %]</option>
338 <option value="[% barcode_typ.type | html %]">[% barcode_typ.name | html %]</option>
344 <label for="barcode_text_print">Print card number as text under barcode: </label>
345 [% IF ( barcode_text_print ) %]
346 <input type="checkbox" name="barcode_text_print" id="barcode_text_print" value="1" checked="checked" />
348 <input type="checkbox" name="barcode_text_print" id="barcode_text_print" value="1" />
357 <legend>Images</legend>
361 <legend>Image 1</legend>
364 <label for="image_1_image_source">Image source: </label>
365 <select name="image_1_image_source" id="image_1_image_source">
366 [% FOREACH image_1_image_sourc IN image_1_image_source %]
367 [% IF ( image_1_image_sourc.selected ) %]
368 <option value="[% image_1_image_sourc.type | html %]" selected="selected">[% image_1_image_sourc.name | html %]</option>
370 <option value="[% image_1_image_sourc.type | html %]">[% image_1_image_sourc.name | html %]</option>
376 <div id="image_1_image_name" style="display: none;">
379 <label for="image_1_image_name">Image: </label>
380 <select name="image_1_image_name" id="image_1_image_name">
381 [% FOREACH image_1_image_nam IN image_1_image_name %]
382 [% IF ( image_1_image_nam.selected ) %]
383 <option value="[% image_1_image_nam.type | html %]" selected="selected">[% image_1_image_nam.name | html %]</option>
385 <option value="[% image_1_image_nam.type | html %]">[% image_1_image_nam.name | html %]</option>
392 <div id="image_1_image_metrics" style="display: none;">
395 <label for="image_1_Dx">Display height: </label>
396 <input type="text" name="image_1_Dx" id="image_1_Dx" size="2" value="[% image_1_Dx | html %]" />
399 <label for="image_1_Tx">Lower left X coordinate: </label>
400 <input type="text" name="image_1_Tx" id="image_1_Tx" size="2" value="[% image_1_Tx | html %]" />
403 <label for="image_1_Ty">Lower left Y coordinate: </label>
404 <input type="text" name="image_1_Ty" id="image_1_Ty" size="2" value="[% image_1_Ty | html %]" />
408 <!-- These pdf image parameters are currently unused, but implemented and need to default to zero -->
409 <input type="hidden" name="image_1_Ox" value="0" /><!-- Ox,Oy should be set to 0 unless you want special effects see http://www.adobe.com/devnet/pdf/pdf_reference.html ISO 32000-1 -->
410 <input type="hidden" name="image_1_Oy" value="0" />
411 <input type="hidden" name="image_1_Sx" value="0" /><!-- Sx,Sy allow scaling of the image -->
412 <input type="hidden" name="image_1_Sy" value="0" />
417 <legend>Image 2</legend>
420 <label for="image_2_image_source">Image source: </label>
421 <select name="image_2_image_source" id="image_2_image_source">
422 [% FOREACH image_2_image_sourc IN image_2_image_source %]
423 [% IF ( image_2_image_sourc.selected ) %]
424 <option value="[% image_2_image_sourc.type | html %]" selected="selected">[% image_2_image_sourc.name | html %]</option>
426 <option value="[% image_2_image_sourc.type | html %]">[% image_2_image_sourc.name | html %]</option>
432 <div id="image_2_image_name" style="display: none;">
435 <label for="image_2_image_name">Image: </label>
436 <select name="image_2_image_name" id="image_2_image_name">
437 [% FOREACH image_2_image_nam IN image_2_image_name %]
438 [% IF ( image_2_image_nam.selected ) %]
439 <option value="[% image_2_image_nam.type | html %]" selected="selected">[% image_2_image_nam.name | html %]</option>
441 <option value="[% image_2_image_nam.type | html %]">[% image_2_image_nam.name | html %]</option>
448 <div id="image_2_image_metrics" style="display: none;">
451 <label for="image_2_Dx">Display height: </label>
452 <input type="text" name="image_2_Dx" id="image_2_Dx" size="2" value="[% image_2_Dx | html %]" />
455 <label for="image_2_Tx">Lower left X coordinate: </label>
456 <input type="text" name="image_2_Tx" id="image_2_Tx" size="2" value="[% image_2_Tx | html %]" />
459 <label for="image_2_Ty">Lower left Y coordinate: </label>
460 <input type="text" name="image_2_Ty" id="image_2_Ty" size="2" value="[% image_2_Ty | html %]" />
464 <!-- These pdf image parameters are currently unused, but implemented and need to default to zero -->
465 <input type="hidden" name="image_2_Ox" value="0" /><!-- Ox,Oy should be set to 0 unless you want special effects see http://www.adobe.com/devnet/pdf/pdf_reference.html ISO 32000-1 -->
466 <input type="hidden" name="image_2_Oy" value="0" /><!-- Sx,Sy allow scaling of the image -->
467 <input type="hidden" name="image_2_Sx" value="0" />
468 <input type="hidden" name="image_2_Sy" value="0" />
478 <fieldset class="action">
479 <input class="btn btn-default btn-default" type="submit" value="Save" />
480 <a class="cancel" href="/cgi-bin/koha/patroncards/manage.pl?card_element=layout">Cancel</a>
481 <input type="hidden" name="op" value="save" />
482 <input type="hidden" name="layout_id" value="[% layout_id | html %]" />
487 </div> <!-- /.col-sm-10.col-sm-push-2 -->
489 <div class="col-sm-2 col-sm-pull-10">
491 [% INCLUDE 'tools-menu.inc' %]
493 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
494 </div> <!-- /.row -->
496 [% MACRO jsinclude BLOCK %]
498 $(document).ready(function() {
499 var selectedUnit = $("#units option:selected").val();
500 var unitfields = $("#font_size,#field_1_llx,#field_1_lly,#field_2_llx,#field_2_lly,#field_3_llx,#field_3_lly,#barcode_Tx,#barcode_Ty,#image_1_Dx,#image_1_Tx,#image_1_Ty,#image_2_Dx,#image_2_Tx,#image_2_Ty");
501 $(unitfields).after("<span class=\"unit\">"+getUnit(selectedUnit)+"</span>");
502 $("#units").change(function(){
503 $(".unit").html(getUnit($(this).val()));
505 Go($("#image_1_image_source").val(), 'image_1_image_name');
506 Go($("#image_1_image_source").val(), 'image_1_image_metrics');
507 $("#image_1_image_source").change(function(){
508 $(".image_1_image_source").html(Go($(this).val(), 'image_1_image_name'));
509 $(".image_1_image_source").html(Go($(this).val(), 'image_1_image_metrics'));
511 Go($("#image_2_image_source").val(), 'image_2_image_name');
512 Go($("#image_2_image_source").val(), 'image_2_image_metrics');
513 $("#image_2_image_source").change(function(){
514 $(".image_2_image_source").html(Go($(this).val(), 'image_2_image_name'));
515 $(".image_2_image_source").html(Go($(this).val(), 'image_2_image_metrics'));
517 var selectFieldNames = ["field_1","field_2","field_3"];
518 for (var i=0; i < selectFieldNames.length; i++) {
519 Go($("#"+selectFieldNames[i]+"_enable").prop("checked"), selectFieldNames[i]+"_select");
521 $("#field_1_enable").change(function(){
522 $(".field_1_enable").html(Go($(this).prop("checked"), 'field_1_select'));
524 $("#field_2_enable").change(function(){
525 $(".field_2_enable").html(Go($(this).prop("checked"), 'field_2_select'));
527 $("#field_3_enable").change(function(){
528 $(".field_3_enable").html(Go($(this).prop("checked"), 'field_3_select'));
530 $("#barcode_print").load(barcode_text('barcode_param'));
531 $("#barcode_print").change(function(){
532 barcode_text('barcode_param');
534 function barcode_text(division) {
535 var eBarcode = document.getElementById(division);
536 if( $("input[name=barcode_print]:checked").prop("checked") ) {
537 eBarcode.style.display = 'block';
539 eBarcode.style.display = 'none';
540 $('input[name=barcode_text_print]').prop('checked', false);
543 function getUnit(unit){
565 function Go(oSelect, oElement){
566 var element = document.getElementById(oElement);
568 case /^.*_name/.test(oElement):
569 if ((oSelect == 'patronimages') || (oSelect == 'none')) {
570 element.style.display = 'none';
572 element.style.display = 'block';
575 case /^.*_metrics/.test(oElement):
576 if ((oSelect == 'none') || (oSelect == '')) {
577 element.style.display = 'none';
579 element.style.display = 'block';
582 case /^.*_select/.test(oElement):
584 element.style.display = 'none';
586 element.style.display = 'block';
598 [% INCLUDE 'intranet-bottom.inc' %]