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