Bug 29002: (follow-up) Use $patron_to_html function
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / labels / label-edit-layout.tt
1 [% USE raw %]
2 [% PROCESS 'i18n.inc' %]
3 [% SET footerjs = 1 %]
4 [%- BLOCK translate_label_types -%]
5     [%-  SWITCH type -%]
6         [%- CASE 'BIB' -%]<span> Only the bibliographic data is printed</span>
7         [%- CASE 'BARBIB'-%]<span> Barcode precedes bibliographic data</span>
8         [%- CASE 'BIBBAR'-%]<span> Bibliographic data precedes barcode</span>
9         [%- CASE 'ALT' -%]<span> Barcode and bibliographic data are printed on alternating labels</span>
10         [%- CASE 'BAR' -%]<span> Only the barcode is printed</span>
11     [%- END -%]
12 [%- END -%]
13     [% INCLUDE 'doc-head-open.inc' %]
14     <title>[% FILTER collapse %]
15         [% IF( layout_id ) %]
16             [% tx("Edit label layout {layout_id}", { layout_id = layout_id }) | html %]
17         [% ELSE %]
18             [% t("New label layout") | html %]
19         [% END %] &rsaquo;
20         [% t("Layouts") | html %] &rsaquo;
21         [% t("Label creator") | html %] &rsaquo;
22         [% t("Cataloging") | html %] &rsaquo;
23         [% t("Koha") | html %]
24     [% END %]</title>
25     [% INCLUDE 'doc-head-close.inc' %]
26 </head>
27
28 [% BLOCK translate_justification_types %]
29 [%  SWITCH type %]
30 [%   CASE 'L' %]<span>Left</span>
31 [%   CASE 'C' %]<span>Center</span>
32 [%   CASE 'R' %]<span>Right</span>
33 [%  END %]
34 [% END %]
35 <body id="labels_label-edit-layout" class="tools labels">
36     [% WRAPPER 'header.inc' %]
37     [% INCLUDE 'cat-search.inc' %]
38 [% END %]
39
40 [% WRAPPER 'sub-header.inc' %]
41     [% WRAPPER breadcrumbs %]
42         [% WRAPPER breadcrumb_item %]
43             <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
44         [% END %]
45         [% WRAPPER breadcrumb_item %]
46             <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a>
47         [% END %]
48         [% WRAPPER breadcrumb_item %]
49             <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=layout">Layouts</a>
50         [% END %]
51         [% WRAPPER breadcrumb_item bc_active= 1 %]
52             [% IF ( layout_id ) %]
53                 <span>Edit label layout [% layout_id | html %]</span>
54             [% ELSE %]
55                 <span>New label layout</span>
56             [% END %]
57         [% END %]
58     [% END #/ WRAPPER breadcrumbs %]
59 [% END #/ WRAPPER sub-header.inc %]
60
61     <div class="main container-fluid">
62         <div class="row">
63             <div class="col-sm-10 col-sm-push-2">
64                 <main>
65
66                     [% INCLUDE 'labels-toolbar.inc' %]
67
68                     [% IF ( layout_id ) %]
69                         <h1>Edit label layout [% layout_id | html %]</h1>
70                     [% ELSE %]
71                         <h1>New label layout</h1>
72                     [% END %]
73
74                     <form name="input" action="/cgi-bin/koha/labels/label-edit-layout.pl" method="get">
75                         <fieldset class="rows">
76                             <ol>
77                                 <li>
78                                     <label for="layout_name">Layout name: </label>
79                                     <input type="text" name="layout_name" id="layout_name" size="20" value="[% layout_name | html %]" />
80                                 </li>
81                                 <li>
82                                     <label for="barcode_type">Choose barcode type (encoding): </label>
83                                     <select name="barcode_type" id="barcode_type">
84                                     [% FOREACH barcode_type IN barcode_types %]
85                                     [% IF ( barcode_type.selected ) %]
86                                     <option value="[% barcode_type.type | html %]" selected="selected">[% barcode_type.name | html %]</option>
87                                     [% ELSE %]
88                                     <option value="[% barcode_type.type | html %]">[% barcode_type.name | html %]</option>
89                                     [% END %]
90                                     [% END %]
91                                     </select>
92                                 </li>
93                                 <li>
94                                     <label for="printing_type">Choose layout type: </label>
95                                     <select name="printing_type" id="printing_type">
96                                     [% FOREACH label_type IN label_types %]
97                                     [% IF ( label_type.selected ) %]
98                                     <option value="[% label_type.type | html %]" selected="selected">[% PROCESS translate_label_types type=label_type.type %]</option>
99                                     [% ELSE %]
100                                     <option value="[% label_type.type | html %]">[% PROCESS translate_label_types type=label_type.type %]</option>
101                                     [% END %]
102                                     [% END %]
103                                     </select>
104                                 </li>
105                                 <li>
106                                     <fieldset>
107                                         <legend>Bibliographic data to print</legend>
108                                                                                 <ol>
109                                         <li class="radio">[% IF ( layout_string ) %]
110                                         <input type="radio" name="layout_choice" id="layout_choice_order" value="layout_table" checked="checked" /><label for="layout_choice_order">Choose order of text fields to print</label>
111                                         [% ELSE %]
112                                         <input type="radio" name="layout_choice" id="layout_choice_order" value="layout_table" /><label for="layout_choice_order">Choose order of text fields to print</label>
113                                         [% END %]
114                                                                                                 <div id="layout_table">
115                                                     <p>
116                                             [% FOREACH text_field IN fields %]
117                                                         <select name="[% text_field.field_name | html %]" id="[% text_field.field_name |url %]">
118                                                             <option value=""></option>
119                                                             [% FOREACH orde IN [1..field_count] %]
120                                                                 [% IF ( orde == text_field.order ) %]
121                                                             <option value="[% orde | html %]" selected="1">[% orde | html %]</option>
122                                                                 [% ELSE %]
123                                                             <option value="[% orde | html %]">[% orde | html %]</option>
124                                                                 [% END %]
125                                                             [% END %]
126                                                         </select>&nbsp;<label for="[% text_field.field_name |url %]">[% text_field.field_label | html %]</label>
127
128                                                         &nbsp;&nbsp;
129
130                                             [% END %]
131                                                     </p>
132                                                                                         </div>
133                                             </li>
134                                             [% UNLESS ( layout_string ) %]
135                                             <li class="radio"><input type="radio" id="layout_choice_list" name="layout_choice" value="layout_string" checked="checked" /> <label for="layout_choice_list">List fields</label></li>
136                                             [% ELSE %]
137                                             <li class="radio"><input type="radio" id="layout_choice_list" name="layout_choice" value="layout_string" /> <label for="layout_choice_list">List fields</label></li>
138                                             [% END %]
139                                            <li> <fieldset id="layout_string" class="brief">
140                                                 <label for="format_string">Data fields</label>
141                                                 <input type="text" name="format_string" id="format_string" size="80" value="[% format_string | html %]" />
142                                                 <div class="hint">
143                                                     <p>Enter a comma separated list of fields to print.  You may include any <em>Koha field</em> or MARC subfield.</p>
144                                                     <p>See online help for advanced options</p>
145                                                     <p>ex: barcode, itemcallnumber, title, "050a 050b", 300a </p>
146                                                     <p>Fields homebranch_description, holdingbranch_description, ccode_description, location_description and permanent_location_description show description instead of code.</p>
147                                                 </div>
148                                             </fieldset></li>
149                                                                                         </ol>
150                                     </fieldset>
151                                 </li>
152                                 <li>
153                                     <label for="guidebox">Draw guide boxes: </label>
154                                     [% IF ( guidebox ) %]
155                                     <input type="checkbox" name="guidebox" id="guidebox" value="1"  checked="checked" />
156                                     [% ELSE %]
157                                     <input type="checkbox" name="guidebox" id="guidebox" value="1" />
158                                     [% END %]
159                                 </li>
160                                 <li>
161                                     <label for="callnum_split">Split call numbers: </label>
162                                     [% IF ( callnum_split ) %]
163                                     <input type="checkbox" name="callnum_split" id="callnum_split" value="1"  checked="checked" />
164                                     [% ELSE %]
165                                     <input type="checkbox" name="callnum_split" id="callnum_split" value="1" />
166                                     [% END %]
167                                 </li>
168                                 <li>
169                                     <label for="text_justify">Text justification: </label>
170                                     <select name="text_justify" id="text_justify">
171                                         [% FOREACH text_justification_type IN text_justification_types %]
172                                         [% IF ( text_justification_type.selected ) %]
173                                         <option value="[% text_justification_type.type | html %]" selected="selected">[% PROCESS translate_justification_types type=text_justification_type.type %]</option>
174                                         [% ELSE %]
175                                         <option value="[% text_justification_type.type | html %]">[% PROCESS translate_justification_types type=text_justification_type.type %]</option>
176                                         [% END %]
177                                         [% END %]
178                                     </select>
179                                 </li>
180                                 <li>
181                                     <label for="font">Font: </label>
182                                     <select name="font" id="font">
183                                         [% FOREACH font_type IN font_types %]
184                                         [% IF ( font_type.selected ) %]
185                                         <option value="[% font_type.type | html %]" selected="selected">[% font_type.name | html %]</option>
186                                         [% ELSE %]
187                                         <option value="[% font_type.type | html %]">[% font_type.name | html %]</option>
188                                         [% END %]
189                                         [% END %]
190                                     </select>
191                                 </li>
192                                 <li>
193                                     <label for="font_size">Font size: </label>
194                                     <input type="text" name="font_size" id="font_size" size="2" value="[% font_size | html %]" />
195                                 </li>
196                                 <li>
197                                     <label for="scale_width">Barcode width: </label>
198                                     <input type="text" name="scale_width" id="scale_width" size="2" value="[% scale_width | html %]" />
199                                 </li>
200                                 <li>
201                                     <label for="scale_height">Barcode height: </label>
202                                     <input type="text" name="scale_height" id="scale_height" size="2" value="[% scale_height | html %]" />
203                                 </li>
204                                 <li>
205                                     <label for="oblique_title">Oblique title: </label>
206                                     [% IF ( oblique_title ) %]
207                                     <input type="checkbox" name="oblique_title" id="oblique_title" value="1"  checked="checked" />
208                                     [% ELSE %]
209                                     <input type="checkbox" name="oblique_title" id="oblique_title" value="1" />
210                                     [% END %]
211                                 </li>
212                             </ol>
213                         </fieldset>
214                         <fieldset class="action">
215                             <input type="submit" class="btn btn-primary" value="Save" />
216                             <a class="cancel" href="/cgi-bin/koha/labels/label-manage.pl?label_element=layout">Cancel</a>
217                             <input type="hidden" name="op" value="save" />
218                             <input type="hidden" name="layout_id" value="[% layout_id | html %]" />
219                         </fieldset>
220                     </form>
221             </main>
222         </div> <!-- /.col-sm-10.col-sm-push-2 -->
223
224         <div class="col-sm-2 col-sm-pull-10">
225             <aside>
226                 [% INCLUDE 'cat-menu.inc' %]
227             </aside>
228         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
229      </div> <!-- /.row -->
230
231 [% MACRO jsinclude BLOCK %]
232     <script>
233         $(document).ready(function() {
234             $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').addClass("current");
235             $("input[name='layout_choice']").change( function() { layout_method() } );
236             layout_method();
237             $("#font").on("change",function(){
238                  checkOblique();
239             });
240         });
241         function layout_method() {
242             if( $("input[name='layout_choice']:checked").val() == 'layout_string' ) {
243                 $('#layout_table').hide();
244                 $('#layout_string').show();
245             } else {
246                 $('#layout_table').show();
247                 $('#layout_string').hide();
248             }
249         }
250         function checkOblique() {
251             var font = document.getElementById("font");
252             var selectedfont = font.options[font.selectedIndex].value;
253             if ( selectedfont.match("I$") || selectedfont.match("O$") ) {
254                 document.getElementById("oblique_title").disabled = true;
255             } else {
256                 document.getElementById("oblique_title").disabled = false;
257             }
258         }
259     </script>
260 [% END %]
261
262 [% INCLUDE 'intranet-bottom.inc' %]