Bug 19709: Move template JavaScript to the footer: Labels
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / labels / label-edit-template.tt
1 [% SET footerjs = 1 %]
2     [% INCLUDE 'doc-head-open.inc' %]
3     <title>Koha &rsaquo; Tools &rsaquo; Label creator &rsaquo; Templates &rsaquo; [% IF ( template_id ) %]Edit ([% template_id %])[% ELSE %]New[% END %]</title>
4     [% INCLUDE 'doc-head-close.inc' %]
5 </head>
6
7 <body id="labels_label-edit-template" class="tools labels">
8     [% INCLUDE 'header.inc' %]
9     [% INCLUDE 'cat-search.inc' %]
10     <div id="breadcrumbs">
11         <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
12         <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
13         <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a> &rsaquo;
14         <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=template">Templates</a> &rsaquo;
15         [% IF ( template_id ) %]Edit ([% template_id %])[% ELSE %]New[% END %]
16     </div>
17
18     <div class="main container-fluid">
19         <div class="row">
20             <div class="col-sm-10 col-sm-push-2">
21                 <main>
22                     [% INCLUDE 'labels-toolbar.inc' %]
23
24                     <h3>Edit label template</h3>
25                     <form name="input" action="/cgi-bin/koha/labels/label-edit-template.pl" method="get">
26                     <div class="row">
27                         <div class="col-sm-6">
28                             <fieldset class="rows">
29                                 <ol>
30                                     <li>
31                                         <span class="label">Template ID:</span>[% IF ( template_id ) %][% template_id %][% ELSE %]N/A[% END %]
32                                     </li>
33                                     <li>
34                                         <label for="template_code">Template code:</label>
35                                         <input type="text" size="30" maxlength="43" name="template_code" id="template_code" value="[% template_code %]" />
36                                     </li>
37                                     <li>
38                                         <label for="template_desc">Template description:</label>
39                                         <textarea cols="30" rows="3" id="template_desc" name="template_desc">[% template_desc %]</textarea>
40                                     </li>
41                                                                         <li>
42                                  <label for="units">Units:</label>
43                                  <select id="units" name="units">
44                                  [% FOREACH unit IN units %]
45                                      [% IF ( unit.selected ) %]
46                                      <option value="[% unit.type %]" selected="selected">
47                                      [% ELSE %]
48                                      <option value="[% unit.type %]">
49                                      [% END %]
50
51                                      [% SWITCH unit.type %]
52                                      [%   CASE 'POINT' %]
53                                      <span>PostScript Points</span>
54                                      [%   CASE 'AGATE' %]
55                                      <span>Adobe Agates</span>
56                                      [%   CASE 'INCH' %]
57                                      <span>US Inches</span>
58                                      [%   CASE 'MM' %]
59                                      <span>SI Millimeters</span>
60                                      [%   CASE 'CM' %]
61                                      <span>SI Centimeters</span>
62                                      [% END %]
63                                  </option>
64                                  [% END %]
65                                  </select>
66                              </li>
67                                     <li>
68                                         <label for="page_height">Page height:</label>
69                                         <input type="text" size="4" name="page_height" id="page_height" value="[% page_height %]" />
70                                     </li>
71                                     <li>
72                                         <label for="page_width">Page width:</label>
73                                         <input type="text" size="4" name="page_width" id="page_width" value="[% page_width %]" />
74                                     </li>
75                                     <li>
76                                         <label for="label_width">Label width:</label>
77                                         <input type="text" size="4" name="label_width" id="label_width" value="[% label_width %]" />
78                                     </li>
79                                     <li>
80                                         <label for="label_height">Label height:</label>
81                                         <input type="text" size="4" name="label_height" id="label_height" value="[% label_height %]" />
82                                     </li>
83
84                                 </ol>
85                             </fieldset>
86                         </div>
87                         <div class="col-sm-6">
88                             <fieldset class="rows">
89                                 <ol><li>
90                                     <label for="top_margin">Top page margin:</label>
91                                     <input type="text" size="4" name="top_margin" id="top_margin" value="[% top_margin %]" />
92                                 </li>
93                                 <li>
94                                     <label for="left_margin">Left page margin:</label>
95                                     <input type="text" size="4" name="left_margin" id="left_margin" value="[% left_margin %]" />
96                                 </li>
97                                     <li>
98                                         <label for="top_text_margin">Top text margin:</label>
99                                         <input type="text" size="4" name="top_text_margin" id="top_text_margin" value="[% top_text_margin %]" />
100                                     </li>
101                                     <li>
102                                         <label for="left_text_margin">Left text margin:</label>
103                                         <input type="text" size="4" name="left_text_margin" id="left_text_margin" value="[% left_text_margin %]" />
104                                     </li>
105                                     <li>
106                                         <label for="cols">Number of columns:</label>
107                                         <input type="text" size="4" name="cols" id="cols" value="[% cols %]" />
108                                     </li>
109                                     <li>
110                                         <label for="rows">Number of rows:</label>
111                                         <input type="text" size="4" name="rows" id="rows" value="[% rows %]" />
112                                     </li>
113                                     <li>
114                                         <label for="col_gap">Gap between columns:</label>
115                                         <input type="text" size="4" name="col_gap" id="col_gap" value="[% col_gap %]" />
116                                     </li>
117                                     <li>
118                                         <label for="row_gap">Gap between rows:</label>
119                                         <input type="text" size="4" name="row_gap" id="row_gap" value="[% row_gap %]" />
120                                     </li>
121
122                                     <li>
123                                         <label for="profile_id">Profile:</label>
124                                         [% IF ( profile_list ) %]
125                                         <select id="profile_id" name="profile_id">
126                                         [% FOREACH profile_lis IN profile_list %]
127 [% IF ( profile_lis.selected ) %]
128 <option value="[% profile_lis.profile_id %]" selected="selected">
129 [% ELSE %]
130 <option value="[% profile_lis.profile_id %]">
131 [% END %]
132                                         [% profile_lis.printer_name %]/[% profile_lis.paper_bin %]
133                                         </option>
134                                         [% END %]
135                                         </select>
136                                         [% ELSE %]
137                                         <a href="/cgi-bin/koha/labels/label-edit-profile.pl?op=new">Click here to define a printer profile.</a>
138                                         [% END %]
139                                     </li>
140                                 </ol>
141                             </fieldset>
142                         </div>
143                     </div>
144                         <fieldset class="action">
145                             <input type="submit" class="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/labels/label-manage.pl?label_element=template">Cancel</a>
146                             <input type="hidden" name="op" value="save" />
147                             [% IF ( template_id ) %]
148                             <input type="hidden" name="template_id" value="[% template_id %]" />
149                             [% END %]
150                         </fieldset>
151                 </form>
152
153             </main>
154         </div> <!-- /.col-sm-10.col-sm-push-2 -->
155
156         <div class="col-sm-2 col-sm-pull-10">
157             <aside>
158                 [% INCLUDE 'tools-menu.inc' %]
159             </aside>
160         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
161      </div> <!-- /.row -->
162
163 [% MACRO jsinclude BLOCK %]
164     [% Asset.js("js/tools-menu.js") %]
165     <script>
166         $(document).ready(function(){
167             var selectedUnit = $("#units option:selected").attr("value");
168             var unitfields = $("#page_height,#page_width,#label_width,#label_height,#top_margin,#left_margin,#top_text_margin,#left_text_margin,#col_gap,#row_gap");
169             $(unitfields).after("<span class=\"unit\">"+getUnit(selectedUnit)+"</span>");
170             $("#units").change(function(){
171                 $(".unit").html(getUnit($(this).val()));
172             });
173         });
174         function getUnit(unit){
175             switch(unit){
176                 case "POINT":
177                     var unit = " pt";
178                     break;
179                 case "AGATE":
180                     var unit = " ag";
181                     break;
182                 case "INCH":
183                     var unit = " in";
184                     break;
185                 case "MM":
186                     var unit = " mm";
187                     break;
188                 case "CM":
189                     var unit = " cm";
190                     break;
191                 default:
192                     var unit = "";
193             }
194             return unit;
195         }
196     </script>
197 [% END %]
198
199 [% INCLUDE 'intranet-bottom.inc' %]