3 [% PROCESS 'i18n.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% FILTER collapse %]
7 [% t("Barcode image generator") | html %] ›
8 [% t("Cataloging") | html %] ›
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% Asset.css("css/humanmsg.css") | $raw %]
16 display: inline-block;
20 background-color:#FFF;
27 border:1px dashed #B9D8D9;
33 background-color: #FFF;
34 border: 1px solid #EEE;
39 border:1px solid #B9D8D9;
48 <body id="labels_spinelabel-home" class="tools labels">
49 [% WRAPPER 'header.inc' %]
50 [% INCLUDE 'cat-search.inc' %]
53 [% WRAPPER 'sub-header.inc' %]
54 [% WRAPPER breadcrumbs %]
55 [% WRAPPER breadcrumb_item %]
56 <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
58 [% WRAPPER breadcrumb_item bc_active= 1 %]
59 <span>Barcode image generator</span>
61 [% END #/ WRAPPER breadcrumbs %]
62 [% END #/ WRAPPER sub-header.inc %]
64 <div class="main container-fluid">
66 <div class="col-sm-10 col-sm-push-2">
68 <h2>Barcode image generator</h2>
70 <form action="/cgi-bin/koha/svc/barcode" method="post" id="barcodegen">
71 <fieldset class="brief">
73 <div class="col-sm-6">
76 <label for="type">Barcode type:</label>
77 <select name="type" id="type">
78 <option value="Code39">Code39</option>
79 <option value="COOP2of5">COOP2of5</option>
80 <option value="EAN13">EAN13</option>
81 <option value="EAN8">EAN8</option>
82 <option value="IATA2of5">IATA2of5</option>
83 <option value="Industrial2of5">Industrial2of5</option>
84 <option value="ITF">ITF</option>
85 <option value="Matrix2of5">Matrix2of5</option>
86 <option value="NW7">NW7</option>
87 <option value="QRcode">QRcode</option>
88 <option value="UPCA">UPCA</option>
89 <option value="UPCE">UPCE</option>
93 <label for="modulesize">QR Code module size:</label>
94 <input name="modulesize" id="modulesize" type="range" min="1" max="10" value="3" />
95 <span id="modulesize_text">3</span>
96 <div class="hint">Module size refers to the pixel dimensions of each black or white square in the generated QR code.</div>
99 <label for="notext">Hide text <input type="checkbox" id="notext" name="notext" value="1" /></label>
102 <label for="height">Barcode height:</label>
103 <input type="text" id="height" name="height" value="50" />
106 <label class="bcode" for="barcode">Barcode: </label>
107 <label class="qrcode" for="barcode">Text, URL, or barcode, etc: </label>
108 <input type="text" name="barcode" id="barcode" size="50" />
109 <div class="hint qrcode">Actual dimensions of the QR code depend on the amount of characters being encoded.</div>
110 <div class="hint bcode">Barcode text must be numeric (0-9)</div>
113 <fieldset class="action">
114 <input type="submit" class="btn btn-primary" value="Show barcode" />
117 <div class="col-sm-6">
118 <div id="barcode_container">
119 <img id="barcode_image" />
120 <textarea readonly="readonly" rows="5" cols="40" id="urltext"></textarea>
127 </div> <!-- /.col-sm-10.col-sm-push-2 -->
129 <div class="col-sm-2 col-sm-pull-10">
131 [% INCLUDE 'cat-menu.inc' %]
133 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
134 </div> <!-- /.row -->
136 [% MACRO jsinclude BLOCK %]
137 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
139 var base_url = "[% Koha.Preference('staffClientBaseURL') | html %]";
141 function showBarcodeText( path, dimensions ){
142 var params = new URLSearchParams( path );
143 var tag = '<img src="' + path + '" alt="' + params.get("barcode") + '" width="' + dimensions.width + '" height="' + dimensions.height + '" />';
144 $("#urltext").show().text( tag );
145 if( Number( dimensions.width ) > 250 ){
146 $("#urltext").css("width", dimensions.width )
150 function showBarcode( barcodeform ){
151 if( $("#barcode").val() == "" ){
152 $("#barcode_container").hide();
154 var url = barcodeform.attr("action");
155 var params = barcodeform.serialize();
156 $("#barcode_container").show();
157 $("#barcode_image").attr("src", url + "?" + params );
161 function showQrcodeOptions( type ){
162 if( type.val() == "QRcode" ){
163 $(".qrcode").show().find("input,range").prop("disabled", false );
164 $(".bcode").hide().find("input").prop("disabled", true );
166 $(".qrcode").hide().find("input,range").prop("disabled", true );
167 $(".bcode").show().find("input").prop("disabled", false );
170 $(document).ready(function(){
171 showQrcodeOptions( $("#type") );
172 showBarcode( $("#barcodegen") );
173 $("#type").on("change", function(){
174 showQrcodeOptions( $(this) );
176 $("#barcodegen").on("change submit", function(e){
178 showBarcode( $(this) );
180 $("#modulesize").on("input", function(){
181 $("#modulesize_text").text( $(this).val() );
183 $("#urltext").on("click", function(){
185 var text = $(this).text();
186 navigator.clipboard.writeText( text ).then(function() {
187 /* clipboard successfully set */
188 humanMsg.displayAlert( _("HTML copied to the clipboard") );
190 /* clipboard write failed */
191 humanMsg.displayAlert( _("Could not copy HTML automatically to the clipboard") );
194 $("#barcode_image")[0].onload = function (){
195 showBarcodeText( this.src, { width: this.width, height: this.height } );
197 $("#barcode_image")[0].onerror = function(){
198 var barcodetype = $("#type").val();
199 if( barcodetype !== "QRcode" ){
200 if( Number.isNaN( Number( $("#barcode").val() ) ) ){
201 humanMsg.displayAlert( _("Barcodes of type %s must be numeric").format( barcodetype ) );
203 humanMsg.displayAlert( _("There was an unknown error generating the barcode image. Please check that your barcode is correct for the barcode type" ) );
206 humanMsg.displayAlert( _("There was an unknown error generating the barcode image") );
213 [% INCLUDE 'intranet-bottom.inc' %]