]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/staff/share/print_templates/t_item_label.tt2
LP#1787479 Final fixes for print label customizations. Corrects duplication of pcrud...
[Evergreen.git] / Open-ILS / src / templates / staff / share / print_templates / t_item_label.tt2
1 <?xml version="1.0" encoding="Windows-1252"?>
2 <!--
3 Template for printing item labels (spine, pocket, etc.).
4
5 Like receipt slip templates, this template uses AngularJS
6 which fuses HTML and code together.  The code portion is
7 mostly used to bind data for the item labels being printed
8 to various HTML elements, but you can also use code to
9 perform conditional logic, transform the data, etc.
10
11 -->
12 <!--
13
14 The <style> section is for holding most of our CSS, which
15 is a language for controlling the appearance of HTML markup.
16
17 The {{ and }} markers are similar to HTML's < and > characters,
18 but are for separating AngularJS variables and code from the
19 HTML itself.
20
21 -->
22 <style>
23     /* The .spine here defines a CSS "class", which in this case, is used by our
24        left label */
25     .spine {
26
27         /* this pulls from the "Item Print Label Font Family" setting, but will
28            default to 'monospace' */
29         font-family: {{settings['webstaff.cat.label.font.family'] || 'monospace'}};
30
31         /* this pulls from the "Item Print Label Font Size" setting, but will
32            default to 'normal' */
33         font-size: {{settings['webstaff.cat.label.font.size'] || '10'}};
34
35         /* this pulls from the "Item Print Label Font Weight" setting, but will
36            default to 'normal' */
37         font-weight: {{settings['webstaff.cat.label.font.weight'] || 'normal'}};
38
39         /* this pulls from the "Item Print Label - Height for Left Label"
40            setting, but will default to '1.25in' */
41         height: {{settings['webstaff.cat.label.left_label.height'] || '1.25in'}};
42         min-height: {{settings['webstaff.cat.label.left_label.height'] || '1.25in'}};
43         max-height: {{settings['webstaff.cat.label.left_label.height'] || '1.25in'}};
44
45         /* this pulls from the "Item Print Label - Width for Left Label"
46            setting, but will default to '1in' */
47         width: {{settings['webstaff.cat.label.left_label.width'] || '1in'}};
48         min-width: {{settings['webstaff.cat.label.left_label.width'] || '1in'}};
49         max-width: {{settings['webstaff.cat.label.left_label.width'] || '1in'}};
50
51         /* this pulls from the "Item Print Label - Left Margin for Left Label"
52            setting, but will default to '0in' */
53         margin-left: {{settings['webstaff.cat.label.left_label.left_margin'] || '0in'}};
54     }
55
56     /* This CSS class is used by our right label */
57     .pocket {
58
59         /* this pulls from the "Item Print Label Font Family" setting, but will
60            default to 'monospace' */
61         font-family: {{settings['webstaff.cat.label.font.family'] || 'monospace'}};
62
63         /* this pulls from the "Item Print Label Font Size" setting, but will
64            default to 'normal' */
65         font-size: {{settings['webstaff.cat.label.font.size'] || '10'}};
66
67         /* this pulls from the "Item Print Label Font Weight" setting, but will
68            default to 'normal' */
69         font-weight: {{settings['webstaff.cat.label.font.weight'] || 'normal'}};
70
71         /* this pulls from the "Item Print Label - Height for Left Label"
72            setting, but will default to '1.25in' */
73         height: {{settings['webstaff.cat.label.right_label.height'] || '1.25in'}};
74         min-height: {{settings['webstaff.cat.label.right_label.height'] || '1.25in'}};
75         max-height: {{settings['webstaff.cat.label.right_label.height'] || '1.25in'}};
76
77         /* this pulls from the "Item Print Label - Width for Left Label"
78            setting, but will default to '2.625in' */
79         width: {{settings['webstaff.cat.label.right_label.width'] || '2.625in'}};
80         min-width: {{settings['webstaff.cat.label.right_label.width'] || '2.625in'}};
81         max-width: {{settings['webstaff.cat.label.right_label.width'] || '2.625in'}};
82
83         /* this pulls from the "Item Print Label - Left Margin for Left Label"
84            setting, but will default to '0in' */
85         margin-left: {{settings['webstaff.cat.label.right_label.left_margin'] || '0in'}};
86
87     }
88
89     /* This is to help mitigate artifacts in the Preview pane which don't
90        actually print */
91     .labels ::-webkit-scrollbar { 
92         display: none; 
93     }
94
95     /* This pulls from the "Item Print Label - Inline CSS" setting */
96     {{settings['webstaff.cat.label.inline_css']||''}}
97
98     .print+.print {
99         page-break-before: always;
100     }
101
102 </style>
103
104 <!-- Here we are implementing our combined label as 2-column HTML <table>, with
105      each table containing a <pre> tag for preserving whitespace and linefeeds.
106
107      The ng-repeat attribute is from AngularJS, and in this case is looping
108      through a list of all the items that were selected when the Print Label
109      interface was invoked.  Each iteration puts item data into the variable
110      "copy", which may be referenced in the HTML by escaping it with {{ and }}
111
112      The following are available, and you may treat these similar to the
113      "macros" in earlier versions of Evergreen:
114
115                 copy['active_date']
116                 copy['age_protect']
117                 copy['alert_message']
118                 copy['barcode']
119                 copy['call_number.copies']
120                 copy['call_number.create_date']
121                 copy['call_number.deleted']
122                 copy['call_number.edit_date']
123                 copy['call_number.id']
124                 copy['call_number.label']
125                 copy['call_number.label_class']
126                 copy['call_number.label_sortkey']
127                 copy['call_number.notes']
128                 copy['call_number.owning_lib']
129                 copy['call_number.owning_lib.id']
130                 copy['call_number.owning_lib.shortname']
131                 copy['call_number.owning_lib.name']
132                 copy['call_number.prefix.id']
133                 copy['call_number.prefix.label']
134                 copy['call_number.prefix.label_sortkey']
135                 copy['call_number.prefix.owning_lib']
136                 copy['call_number.record.active']
137                 copy['call_number.record.author_field_entries']
138                 copy['call_number.record.call_numbers']
139                 copy['call_number.record.create_date']
140                 copy['call_number.record.creator.ws_ou']
141                 copy['call_number.record.deleted']
142                 copy['call_number.record.edit_date']
143                 copy['call_number.record.fingerprint']
144                 copy['call_number.record.fixed_fields']
145                 copy['call_number.record.full_record_entries']
146                 copy['call_number.record.id']
147                 copy['call_number.record.identifier_field_entries']
148                 copy['call_number.record.keyword_field_entries']
149                 copy['call_number.record.language']
150                 copy['call_number.record.last_xact_id']
151                 copy['call_number.record.marc']
152                 copy['call_number.record.metarecord']
153                 copy['call_number.record.notes']
154                 copy['call_number.record.owner']
155                 copy['call_number.record.quality']
156                 copy['call_number.record.series_field_entries']
157                 copy['call_number.record.share_depth']
158                 copy['call_number.record.simple_record.author']
159                 copy['call_number.record.simple_record.fingerprint']
160                 copy['call_number.record.simple_record.id']
161                 copy['call_number.record.simple_record.isbn']
162                 copy['call_number.record.simple_record.issn']
163                 copy['call_number.record.simple_record.pubdate']
164                 copy['call_number.record.simple_record.publisher']
165                 copy['call_number.record.simple_record.quality']
166                 copy['call_number.record.simple_record.tcn_source']
167                 copy['call_number.record.simple_record.tcn_value']
168                 copy['call_number.record.simple_record.title']
169                 copy['call_number.record.source']
170                 copy['call_number.record.subject_field_entries']
171                 copy['call_number.record.tcn_source']
172                 copy['call_number.record.tcn_value']
173                 copy['call_number.record.title_field_entries']
174                 copy['call_number.suffix.id']
175                 copy['call_number.suffix.label']
176                 copy['call_number.suffix.label_sortkey']
177                 copy['call_number.suffix.owning_lib']
178                 copy['call_number.uri_maps']
179                 copy['call_number.uris']
180                 copy['circ_as_type']
181                 copy['circ_lib']
182                 copy['circ_lib.id']
183                 copy['circ_lib.shortname']
184                 copy['circ_lib.name']
185                 copy['circ_modifier']
186                 copy['circulate']
187                 copy['copy_number']
188                 copy['cost']
189                 copy['create_date']
190                 copy['deleted']
191                 copy['deposit']
192                 copy['deposit_amount']
193                 copy['dummy_author']
194                 copy['dummy_isbn']
195                 copy['dummy_title']
196                 copy['edit_date']
197                 copy['fine_level']
198                 copy['floating']
199                 copy['holdable']
200                 copy['id']
201                 copy['loan_duration']
202                 copy['location.checkin_alert']
203                 copy['location.circulate']
204                 copy['location.copies']
205                 copy['location.deleted']
206                 copy['location.holdable']
207                 copy['location.hold_verify']
208                 copy['location.id']
209                 copy['location.label_prefix']
210                 copy['location.label_suffix']
211                 copy['location.name']
212                 copy['location.opac_visible']
213                 copy['location.orders']
214                 copy['location.owning_lib']
215                 copy['mint_condition']
216                 copy['opac_visible']
217                 copy['price']
218                 copy['ref']
219                 copy['status_changed_time']
220                 copy['status.copy_active']
221                 copy['status.holdable']
222                 copy['status.id']
223                 copy['status.is_available']
224                 copy['status.name']
225                 copy['status.opac_visible']
226                 copy['status.restrict_copy_delete']
227
228     There are also two functions available.  The following pulls manually
229     edited call numbers for a given item:
230
231                 get_cn_for(copy)
232
233     And this one pulls bibliographic data for a given item:
234
235                 get_bib_for(copy)
236
237     It returns a data structure similar to "copy" that has the following fields:
238
239                 get_bib_for(copy)['author']
240                 get_bib_for(copy)['copy_count']
241                 get_bib_for(copy)['doc_id']
242                 get_bib_for(copy)['doc_type']
243                 get_bib_for(copy)['edition']
244                 get_bib_for(copy)['isbn']
245                 get_bib_for(copy)['physical_description']
246                 get_bib_for(copy)['pubdate']
247                 get_bib_for(copy)['publisher']
248                 get_bib_for(copy)['series.0']
249                 get_bib_for(copy)['synopsis']
250                 get_bib_for(copy)['tcn']
251                 get_bib_for(copy)['title']
252                 get_bib_for(copy)['toc']
253                 get_bib_for(copy)['types_of_resource.0']
254
255     Finally, there are filter functions which can be used to modify or transform
256     data being outputted.  For example, consider the following:
257
258                 get_bib_for(copy)['title'] | limitTo:28
259
260     This would show up to the first 28 characters for an item's title and
261     truncate the rest.  Now, this:
262
263                 get_bib_for(copy)['title'] | wrap:28
264
265     This would try to the wrap the item's title every 28 characters.
266
267                 get_bib_for(copy)['title'] | wrap:28:multi:'  '
268
269     This does the same thing but indents subsequent lines with 2 spaces each.
270     
271                 get_bib_for(copy)['title'] | wrap:28:once:'  '
272
273     This wraps the title just once, prefixes the second line with two spaces,
274     and truncates anything after the 2nd line.
275
276 -->
277
278 <table class="labels" style="page-break-after: always;" ng-repeat="copy in copies"><tr valign="top"><td>
279
280 <!-- Spine Label contents -->
281 <pre class="spine" style="border:none" ng-show="true">
282 {{get_cn_for(copy)}}
283 </pre>
284
285 </td><td>
286
287 <!-- Pocket Label contents -->
288 <pre class="pocket" style="border:none" ng-show="true">
289 {{copy.barcode}}
290 {{copy['call_number.label']}}
291 {{get_bib_for(copy).author }}
292 {{get_bib_for(copy).title | wrap:28:'once':' '}}
293 </pre>
294
295 </td></tr></table>
296