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