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