]> git.evergreen-ils.org Git - Evergreen.git/blob - docs/admin_initial_setup/designing_your_catalog.txt
Docs: Information for system administrators about translations
[Evergreen.git] / docs / admin_initial_setup / designing_your_catalog.txt
1 Designing your catalog
2 ======================
3
4 When people want to find things in your Evergreen system, they will check the
5 catalog. In Evergreen, the catalog is made available through a web interface,
6 called the _OPAC_ (Online Public Access Catalog). In the latest versions of the
7 Evergreen system, the OPAC is built on a set of programming modules called the
8 Template Toolkit. You will see the OPAC sometimes referred to as the _TPAC_.
9
10 In this chapter, we'll show you how to customize the OPAC, change it from its
11 default configuration, and make it your own.
12
13 Configuring and customizing the public interface
14 ------------------------------------------------
15
16 The public interface is referred to as the TPAC or Template Toolkit (TT) within
17 the Evergreen community. The template toolkit system allows you to customize the
18 look and feel of your OPAC by editing the template pages (.tt2) files as well as
19 the associated style sheets.   
20
21 Locating the default template files
22 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
24 The default URL for the TPAC on a default Evergreen system is
25 _http://localhost/eg/opac/home_ (adjust _localhost_ to match your hostname or IP
26 address).
27
28 The default template file is installed in _/openils/var/templates/opac_.
29
30 You should generally avoid touching the installed default template files, unless
31 you are contributing changes for Evergreen to adopt as a new default. Even then,
32 while you are developing your changes, consider using template overrides rather
33 than touching the installed templates until you are ready to commit the changes
34 to a branch. See below for information on template overrides.
35
36 Mapping templates to URLs
37 ~~~~~~~~~~~~~~~~~~~~~~~~~
38
39 The mapping for templates to URLs is straightforward. Following are a few
40 examples, where _<templates>_ is a placeholder for one or more directories that
41 will be searched for a match:
42
43 * _http://localhost/eg/opac/home => /openils/var/<templates>/opac/home.tt2_
44 * _http://localhost/eg/opac/advanced =>
45 /openils/var/<templates>/opac/advanced.tt2_
46 * _http://localhost/eg/opac/results => 
47 /openils/var/<templates>/opac/results.tt2_
48
49 The template files themselves can process, be wrapped by, or include other
50 template files. For example, the _home.tt2_ template currently involves a number
51 of other template files to generate a single HTML file.
52
53 Example Template Toolkit file: _opac/home.tt2_.
54 ----
55 [%  PROCESS "opac/parts/header.tt2";
56     WRAPPER "opac/parts/base.tt2";
57     INCLUDE "opac/parts/topnav.tt2";
58     ctx.page_title = l("Home") %]
59     <div id="search-wrapper">
60       [% INCLUDE "opac/parts/searchbar.tt2" %]
61     </div>
62     <div id="content-wrapper">
63         <div id="main-content-home">
64              <div class="common-full-pad"></div>
65              [% INCLUDE "opac/parts/homesearch.tt2" %]
66              <div class="common-full-pad"></div>
67         </div>
68      </div>
69 [% END %]
70 ----
71 Note that file references are relative to the top of the template directory.
72
73 How to override template files
74 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75
76 Overrides for template files or TPAC pages go in a directory that parallels the
77 structure of the default templates directory. The overrides then get pulled in
78 via the Apache configuration.
79
80 The following example demonstrates how to create a file that overrides the
81 default "Advanced search page" (_advanced.tt2_) by adding a new 
82 _templates_custom_ directory and editing the new file in that directory.
83
84 ----
85 bash$ mkdir -p /openils/var/templates_custom/opac
86 bash$ cp /openils/var/templates/opac/advanced.tt2 \
87          /openils/var/templates_custom/opac/.
88 bash$ vim /openils/var/templates_custom/opac/advanced.tt2
89 ----
90
91 Configuring the custom templates directory in Apache's eg.conf
92 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93
94 You now need to teach Apache about the new custom template directory. Edit
95 _/etc/apache2/sites-available/eg.conf_ and add the following _<Location /eg>_
96 element to each of the _<VirtualHost>_ elements in which you want to include the
97 overrides. The default Evergreen configuration includes a VirtualHost directive
98 for port 80 (HTTP) and another one for port 443 (HTTPS); you probably want to
99 edit both, unless you want the HTTP user experience to be different from the
100 HTTPS user experience.
101
102 ----
103 <VirtualHost *:80>
104     # <snip>
105
106     # - absorb the shared virtual host settings
107     Include eg_vhost.conf
108     <Location /eg>
109         PerlAddVar OILSWebTemplatePath "/openils/var/templates_custom"
110     </Location>
111
112     # <snip>
113 </VirtualHost>
114 ----
115
116 Finally, reload the Apache configuration to pick up the changes. You should now
117 be able to see your change at _http://localhost/eg/opac/advanced_ where
118 _localhost_ is the hostname of your Evergreen server.
119
120 Adjusting colors for your public interface
121 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122
123 You may adjust the colors of your public interface by editing the _colors.tt2_
124 file. The location of this file is in 
125 _/openils/var/templates/opac/parts/css/colors.tt2_. When you customize the
126 colors of your public interface, remember to create a custom file in your custom
127 template folder and edit the custom file and not the file located in you default
128 template.    
129
130 Adjusting fonts in your public interface
131 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132
133 Font sizes can be changed in the _colors.tt2_ file located in
134 _/openils/var/templates/opac/parts/css/_. Again, create and edit a custom
135 template version and not the file in the default template.
136
137 Other aspects of fonts such as the default font family can be adjusted in
138 _/openils/var/templates/opac/css/style.css.tt2_. 
139
140 Media file locations in the public interface
141 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142 The media files (mostly PNG images) used by the default TPAC templates are stored
143 in the repository in _Open-ILS/web/images/_ and installed in
144 _/openils/var/web/images/_.
145
146 Changing some text in the public interface
147 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148
149 Out of the box, TPAC includes a number of placeholder text and links. For
150 example, there is a set of links cleverly named Link 1, Link 2, and so on in the
151 header and footer of every page in TPAC. Here is how to customize that for a 
152 _custom templates_ skin.
153
154 To begin with, find the page(s) that contain the text in question. The simplest
155 way to do that is with the grep -s command. In the following example, search for
156 files that contain the text "Link 1":
157
158 ----
159 bash$ grep -r "Link 1" /openils/var/templates/opac
160 /openils/var/templates/opac/parts/topnav_links.tt2
161 4:            <a href="http://example.com">[% l('Link 1') %]</a>
162 ----
163
164
165 Next, copy the file into our overrides directory and edit it with vim.
166
167 Copying the links file into the overrides directory.
168
169 ----
170 bash$ cp /openils/var/templates/opac/parts/topnav_links.tt2 \
171 /openils/var/templates_custom/opac/parts/topnav_links.tt2
172 bash$ vim /openils/var/templates_custom/opac/parts/topnav_links.tt2
173 ----
174
175 Finally, edit the link text in _opac/parts/header.tt2_. Content of the
176 _opac/parts/header.tt2_ file.
177
178 ----
179 <div id="gold-links-holder">
180     <div id="gold-links">
181         <div id="header-links">
182             <a href="http://example.com">[% l('Link 1') %]</a>
183             <a href="http://example.com">[% l('Link 2') %]</a>
184             <a href="http://example.com">[% l('Link 3') %]</a>
185             <a href="http://example.com">[% l('Link 4') %]</a>
186             <a href="http://example.com">[% l('Link 5') %]</a>
187         </div>
188     </div>
189 </div>
190 ----
191
192 For the most part, the page looks like regular HTML, but note the `[%_(" ")%]`
193 that surrounds the text of each link. The `[% ... %]` signifies a TT block,
194 which can contain one or more TT processing instructions. `l(" ... ");` is a
195 function that marks text for localization (translation); a separate process can
196 subsequently extract localized text as GNU gettext-formatted PO (Portable
197 Object) files.
198
199 As Evergreen supports multiple languages, any customization to Evergreen's
200 default text must use the localization function. Also, note that the
201 localization function supports placeholders such as `[_1]`, `[_2]` in the text;
202 these are replaced by the contents of variables passed as extra arguments to the
203 `l()` function.
204
205 Once the link and link text has been edited to your satisfaction, load the page
206 in a Web browser and see the live changes immediately.
207
208 Adding translations to PO file
209 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
210
211 After you have added custom text in translatable form to a TT2 template, you need to add the custom strings and its translations to the PO file containing the translations. Evergreen PO files are stored  in _/openils/var/template/data/locale/_ 
212
213 The PO file consists of pairs of the text extracted from the code:  Message ID  denoted as _msgid_ and message string denoted as _msgstr_.  When adding the custom string to PO file: 
214
215 * The line with English expressions must start with _msgid_. The English term must be enclosed in double apostrophes. 
216 * The line with translation start with /msgstr/. The translation to local language must be and enclosed in enclosed in double apostrophes.  
217 * It is recommended to  add a note in which template and on which line the particular string is located. The lines with notes must be marked as comments i.e., start with number sign (#) 
218
219 Example: 
220
221 ----
222
223 # ---------------------------------------------------------------------
224 # The lines below contains the custom strings manually added to the catalog
225 # ---------------------------------------------------------------------
226
227 #: ../../Open-ILS/src/custom_templates/opac/parts/topnav_links.tt2:1
228 msgid "Union Catalog of the Czech Republic"
229 msgstr "SoubornĂ˝ katalog ÄŚeskĂ© republiky"
230
231
232 #: ../../Open-ILS/src/custom_templates/opac/parts/topnav_links.tt2:1
233 msgid "Uniform Information Gateway "
234 msgstr "Jednotná informaÄŤnĂ­ brána"
235
236 ----
237
238 [NOTE]
239 ====
240 It is good practice to save backup copy of the original PO file before changing it.
241 ====
242
243 After making changes, restart Apache to make the changes take effect. As root run the command:
244
245 ----
246 service apache2 restart
247 ----
248
249 Adding and removing MARC fields from the record details display page
250 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
251
252 It is possible to add and remove the MARC fields and subfields displayed in the
253 record details page.  In order to add MARC fields to be displayed on the details
254 page of a record, you will need to map the MARC code to variables in the
255 _/openils/var/templates/opac/parts/misc_util.tt2 file_.
256
257 For example, to map the template variable _args.pubdates_ to the date of
258 publication MARC field 260, subfield c, add these lines to _misc_util.tt2_:
259
260 ----
261 args.pubdates = [];
262 FOR sub IN xml.findnodes('//*[@tag="260"]/*[@code="c"]');
263     args.pubdates.push(sub.textContent);
264 END;
265 args.pubdate = (args.pubdates.size) ? args.pubdates.0 : ''
266 ----
267
268 You will then need to edit the 
269 _/openils/var/templates/opac/parts/record/summary.tt2_ file in  order to get the
270 template variable for the MARC field to display.
271
272 For example, to display the date of publication code you created in the
273 _misc_util.tt2_ file, add these lines:
274
275 ----
276 [% IF attrs.pubdate; %]
277     <span itemprop="datePublished">[% attrs.pubdate | html; %]</span>
278 [% END; %]
279 ----
280
281 You can add any MARC field to your record details page. Moreover, this approach
282 can also be used to display MARC fields in other pages, such as your results
283 page.
284
285 Setting the default physical location for your library environment
286 ------------------------------------------------------------------
287
288 _physical_loc_ is an Apache environment variable that sets the default physical
289 location, used for setting search scopes and determining the order in which
290 copies should be sorted. This variable is set in
291 _/etc/apache2/sites-available/eg.conf_. The following example demonstrates the
292 default physical location being set to library ID 104:
293
294 ----
295 SetEnv physical_loc 104
296 ----
297
298 Setting a default language and adding optional languages
299 --------------------------------------------------------
300
301 _OILSWebLocale_ adds support for a specific language. Add this variable to the
302 Virtual Host section in _/etc/apache2/sites-available/eg.conf_.
303
304 _OILSWebDefaultLocale_ specifies which locale to display when a user lands on a
305 page in TPAC and has not chosen a different locale from the TPAC locale picker.
306 The following example shows the _fr_ca_ locale being added to the locale picker
307 and being set as the default locale:
308
309 ----
310 PerlAddVar OILSWebLocale "fr_ca"
311 PerlAddVar OILSWebLocale "/openils/var/data/locale/opac/fr-CA.po"
312 PerlAddVar OILSWebDefaultLocale "fr-CA"
313 ----
314
315 Below is a table of the currently supported languages packaged with Evergreen:
316
317 [options="header"]
318 |================================================================
319 |Language| Code| PO file
320 |Czech| cs_cz| /openils/var/data/locale/opac/cs-CZ.po
321 |English - Canada| en_ca| /openils/var/data/locale/opac/en-CA.po
322 |English - Great Britain| en_gb| /openils/var/data/locale/opac/en-GB.po
323 |*English - United States| en_us| not applicable
324 |French - Canada| fr_ca| /openils/var/data/locale/opac/fr-CA.po
325 |Portuguese - Brazil| pt_br| /openils/var/data/locale/opac/pt_BR.po
326 |Russian| ru_ru| /openils/var/data/locale/opac/ru_RU.po
327 |=================================================================
328 *American English is built into Evergreen so you do not need to set up this
329 language and there are no PO files. 
330
331 Updating translations in Evergreen using current translations from Launchpad
332 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333
334 Due to Evergreen release workflow/schedule, some language strings may already have been translated in Launchpad,
335 but are not yet packaged with Evergreen. In such cases, it is possible to manually replace the PO file in
336 Evergreen with an up-to-date PO file downloaded from Launchpad. 
337
338 . Visit the Evergreen translation site in https://translations.launchpad.net/evergreen[Launchpad] 
339 . Select required language (e.g. _Czech_ or _Spanish_)
340 . Open the  _tpac_  template  and  then select option _Download translation_. Note: to be able to download the translation file you need to be logged in to Launchpad.
341 . Select _PO format_ and submit the _request for download_ button. You can also request for download of all existitng templates and languages at once, see https://translations.launchpad.net/evergreen/master/+export. The download link will be sent You to email address provided. 
342 . Download the file and name it according to the language used (e.g., _cs-CZ.po_ for Czech or  _es-ES.po_ for Spanish)  
343 . Copy the downloaded file to  _/openils/var/template/data/locale_. It is a good practice to backup the original PO file before.
344 . Be sure that the desired language is set as default, using the <<_setting_a_default_language_and_adding_optional_languages,Default language>> procedures.
345
346 Analogously, to update the web staff client translations, download the translation template _webstaff_ and copy it to _openils/var/template/data/locale/staff_.
347
348
349 Changes require web server reload to take effect. As root run the command 
350
351 ----
352 service apache2 restart
353 ----
354
355
356 Editing the formats select box options in the search interface.
357 ---------------------------------------------------------------
358
359 You may wish to remove, rename or organize the options in the formats select
360 box. This can be accomplished from the staff client.
361
362 . From the staff client, navigate to *Admin > Server Administration > Marc Coded
363 Value Maps* 
364 . Select _Type_ from the *Record Attribute Type* select box.
365 . Double click on the format type you wish to edit.
366
367 To change the label for the type, enter a value in the *Search Label* field.
368
369 To  move the option to a top list separated by a dashed line from the others,
370 check the *Is Simple Selector* check box.
371
372 To hide the type so that it does not appear in the search interface, uncheck the
373 *OPAC Visible* checkbox.
374
375 Changes will be immediate.
376
377 Adding and removing search fields in advanced search
378 -----------------------------------------------------
379
380 It is possible to add and remove search fields on the advanced search page by
381 editing the _opac/parts/config.tt2_ file in your template directory. Look for
382 this section of the file:
383
384 ----
385 search.adv_config = [
386     {adv_label => l("Item Type"), adv_attr => ["mattype", "item_type"]},
387     {adv_label => l("Item Form"), adv_attr => "item_form"},
388     {adv_label => l("Language"),  adv_attr => "item_lang"},
389     {adv_label => l("Audience"),  adv_attr => ["audience_group", "audience"], adv_break => 1},
390     {adv_label => l("Video Format"), adv_attr => "vr_format"},
391     {adv_label => l("Bib Level"), adv_attr => "bib_level"},
392     {adv_label => l("Literary Form"), adv_attr => "lit_form", adv_break => 1},
393     {adv_label => l("Search Library"), adv_special => "lib_selector"},
394     {adv_label => l("Publication Year"), adv_special => "pub_year"},
395     {adv_label => l("Sort Results"), adv_special => "sort_selector"},
396 ];
397 ----
398
399 For example, if you delete the line:
400
401 ----
402 {adv_label => l("Language"),  adv_attr => "item_lang"},
403 ----
404
405 the language field will no longer appear on your advanced search page. Changes
406 will appear immediately after you save your changes.
407
408 You can also add fields based on Search Facet Groups that you create in the
409 staff client's Local Administration menu. This can be helpful if you want to
410 simplify your patrons' experience by presenting them with only certain
411 limiters (e.g. the most commonly used languages in your area).  To do this,
412
413 . Click *Admin -> Local Administration -> Search Facet Groups*.
414 . Click *New*.
415 . Enter descriptive values into the code and label fields.  The owner needs to
416 be set to your consortium.
417 . Once the Facet Group is created, click on the blue hyperlinked code value.
418 . Click the *New* button to create the necessary values for your field.
419 . Go to the _opac/parts/config.tt2_ file, and add a line like the following,
420 where *Our Library's Field* is the name you'd like to be displayed next to
421 your field, and *facet_group_code* is the code you've added using the staff
422 client.
423 +
424 ----
425  {adv_label => l("Our Library's Field"), adv_filter => "facet_group_code"},
426 ----
427
428 Changing the display of facets and facet groups
429 -----------------------------------------------
430
431 Facets can be reordered on the search results page by editing the
432 _opac/parts/config.tt2_ file in your template directory.  
433
434 Edit the following section of _config.tt2_, changing the order of the facet
435 categories according to your needs:
436
437 ----
438
439 facet.display = [
440     {facet_class => 'author',  facet_order => ['personal', 'corporate']},
441     {facet_class => 'subject', facet_order => ['topic']},
442     {facet_class => 'series',  facet_order => ['seriestitle']},
443     {facet_class => 'subject', facet_order => ['name', 'geographic']}
444 ];
445
446 ----
447
448 You may also change the default number of facets appearing under each category
449 by editing the _facet.default_display_count_ value in _config.tt2_. The default 
450 value is 5.
451
452 Change Date Format in Patron Account View
453 -----------------------------------------
454 Libraries with same-day circulations may want their patrons to be able to view
455 the due *time* as well as due date when they log in to their OPAC account.  To
456 accomplish this, go to _opac/myopac/circs.tt2_.  Find the line that reads:
457
458 ----
459 [% date.format(due_date, DATE_FORMAT) %]
460 ----
461
462 Replace it with:
463
464 ----
465 [% date.format(due_date, '%D %I:%M %p') %]
466 ----
467
468
469 Including External Content in Your Public Interface
470 ---------------------------------------------------
471
472 The public interface allows you to include external services and content in your
473 public interface. These can include book cover images, user reviews, table of
474 contents, summaries, author notes, annotations, user suggestions, series
475 information among other services. Some of these services are free while others
476 require a subscription.    
477
478 The following are some of the external content services which you can configure
479 in Evergreen.
480
481 OpenLibrary
482 ~~~~~~~~~~~
483
484 The default install of Evergreen includes OpenLibrary book covers. The settings
485 for this are controlled by the <added_content> section of
486 _/openils/conf/opensrf.xml_. Here are the key elements of this configuration:
487
488 ----
489 <module>OpenILS::WWW::AddedContent::OpenLibrary</module>
490 ----
491
492 This section calls the OpenLibrary perl module. If you wish to link to a
493 different book cover service other than OpenLibrary, you must refer to the
494 location of the corresponding Perl module. You will also need to change other
495 settings accordingly.
496
497 ----
498 <timeout>1</timeout>
499 ----
500
501 Max number of seconds to wait for an added content request to return data. Data 
502 not returned within the timeout is considered a failure.
503 ----
504 <retry_timeout>600</retry_timeout>
505 ----
506
507 This setting is the amount of time to wait before we try again.
508
509 ----
510 <max_errors>15</max_errors>
511 ----
512
513 Maximum number of consecutive lookup errors a given process can have before
514 added content lookups are disabled for everyone. To adjust the site of the cover
515 image on the record details page edit the config.tt2 file and change the value
516 of the record.summary.jacket_size. The default value is "medium" and the
517 available options are "small", "medium" and "large."   
518
519 ChiliFresh
520 ~~~~~~~~~~
521
522 ChiliFresh is a subscription-based service which allows book covers, reviews and
523 social interaction of patrons to appear in your catalog. To activate ChiliFresh,
524 you will need to open the Apache configuration file _/etc/apache2/eg_vhost.conf_
525 and edit several lines:
526
527 . Uncomment (remove the "#" at the beginning of the line) and add your ChiliFresh
528 account number:
529
530 ----
531 #SetEnv OILS_CHILIFRESH_ACCOUNT
532 ----
533
534 . Uncomment this line and add your ChiliFresh Profile:
535
536 ----
537 #SetEnv OILS_CHILIFRESH_PROFILE
538 ----
539
540 Uncomment the line indicating the location of the Evergreen JavaScript for
541 ChiliFresh:
542
543 ----
544 #SetEnv OILS_CHILIFRESH_URL http://chilifresh.com/on-site /js/evergreen.js
545 ----
546
547 . Uncomment the line indicating the secure URL for the Evergreen JavaScript :
548
549 ----
550 #SetEnv OILS_CHILIFRESH_HTTPS_URL https://secure.chilifresh.com/on-site/js/evergreen.js
551 ----
552
553 [id="_content_cafe"]
554 Content CafĂ©
555 ~~~~~~~~~~~~
556
557 Content CafĂ© is a subscription-based service that can add  jacket images,
558 reviews, summaries, tables of contents and book details to your records.
559
560 In order to activate Content CafĂ©, edit the _/openils/conf/opensrf.xml_ file and
561 change the _<module>_ element to point to the ContentCafe Perl Module:
562
563 ----
564 <module>OpenILS::WWW::AddedContent::ContentCafe</module>
565 ----
566
567 To adjust settings for Content CafĂ©, edit a couple of fields with the
568 _<ContentCafe>_ Section of _/openils/conf/opensrf.xml_.
569
570 Edit the _userid_ and _password_ elements to match the user id and password for
571 your Content CafĂ© account.
572
573 Change the _return_behavior_on_no_jacket_image_ to set the behavior of your
574 service when an image is not available for an item. By default this value is set
575 to T which will result in a small image with the text "No Image Available" in
576 place of a book cover. If you set this value to 1 a 1X1 blank image will be in
577 place of a book cover. 
578
579 Obalkyknih.cz
580 ~~~~~~~~~~~~~
581
582 Setting up Obalkyknih.cz account
583 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
584
585 If your library wishes to use added content provided by Obalkyknih.cz, a service based in the Czech Republic, you have to http://obalkyknih.cz/signup[create an Obalkyknih.cz account].
586 Please note that the interface is only available in Czech. After logging in your Obalkyknih.cz account, you have to add your IP address and Evergreen server address to your account settings.
587 (In case each library uses an address of its own, all of these addresses have to be added.) 
588
589 Enabling Obalkyknih.cz in Evergreen
590 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
591
592 Set obalkyknih_cz.enabled to true in '/openils/var/templates/opac/parts/config.tt2':
593
594 [source,perl]
595 ----
596 obalkyknih_cz.enabled = 'true';
597 ----
598
599 Enable added content from Obalkyknih.cz in '/openils/conf/opensrf.xml' configuration file (and â€“ at the same time â€“ disable added content from Open Library, i.e., Evergreen's default added content provider):
600
601 [source,xml]
602 ----
603 <!-- <module>OpenILS::WWW::AddedContent::OpenLibrary</module> -->
604 <module>OpenILS::WWW::AddedContent::ObalkyKnih</module>
605 ----
606
607 Using default settings for Obalkyknih.cz means all types of added content from Obalkyknih.cz are visible in your online catalog.
608 If the module is enabled, book covers are always displayed. Other types of added content (summaries, ratings or tables of contents) can be: 
609
610 * switched off using _false_ option,
611 * switched on again using _true_ option.
612
613 The following types of added content are used: 
614
615 * summary (or annotation)
616 * tocPDF (table of contents available as image)
617 * tocText (table of contents available as text)
618 * review (user reviews)
619
620 An example of how to switch off summaries: 
621
622 [source,xml]
623 ----
624 <summary>false</summary>
625 ----
626
627
628 Google Analytics
629 ~~~~~~~~~~~~~~~~
630
631 Google Analytics is a free service to collect statistics for your Evergreen
632 site. Statistic tracking is disabled by default through the Evergreen 
633 client software when library staff use your site within the client, but active 
634 when anyone uses the site without the client. This was a preventive measure to 
635 reduce the potential risks for leaking patron information. In order to use Google 
636 Analytics you will first need to set up the service from the Google Analytics 
637 website at http://www.google.com/analytics/. To activate Google Analytics you 
638 will need to edit _config.tt2_ in your template. To enable the service set 
639 the value of google_analytics.enabled to true and change the value of 
640 _google_analytics.code_ to be the code in your Google Analytics account.
641
642 NoveList
643 ~~~~~~~~
644
645 Novelist is a subscription-based service providing reviews and recommendation
646 for books in you catalog. To activate your Novelist service in Evergreen, open
647 the Apache configuration file _/etc/apache2/eg_vhost.conf_ and edit the line:
648
649 ----
650 #SetEnv OILS_NOVELIST_URL
651 ----
652
653 You should use the URL provided by NoveList.
654
655 RefWorks
656 ~~~~~~~~
657
658 RefWorks is a subscription-based online bibliographic management tool. If you
659 have a RefWorks subscription, you can activate RefWorks in Evergreen by editing
660 the _config.tt2_ file located in your template directory. You will need to set
661 the _ctx.refworks.enabled_ value to _true_. You may also set the RefWorks URL by
662 changing the _ctx.refworks.url_ setting on the same file. 
663
664 SFX OpenURL Resolver
665 ~~~~~~~~~~~~~~~~~~~~
666
667 An OpenURL resolver allows you to find electronic resources and pull them into
668 your catalog based on the ISBN or ISSN of the item. In order to use the SFX
669 OpenURL resolver, you will need to subscribe to the Ex Libris SFX service.  To
670 activate the service in Evergreen edit the _config.tt2_ file in your template.
671 Enable the resolver by changing the value of _openurl.enabled_ to _true_ and
672 change the _openurl.baseurl_ setting to point to the URL of your OpenURL
673 resolver. 
674
675 Syndetic Solutions
676 ~~~~~~~~~~~~~~~~~~
677
678 Syndetic Solutions is a subscription service providing book covers and other
679 data for items in your catalog. In order to activate Syndetic, edit the
680 _/openils/conf/opensrf.xml_ file and change the _<module>_ element to point to
681 the Syndetic Perl Module:
682
683 ----
684 <module>OpenILS::WWW::AddedContent::Syndetic</module>
685 ----
686
687 You will also need to edit the  _<userid>_ element to be the user id provided to
688 you by Syndetic.
689
690 Then, you will need to uncomment and edit the _<base_url>_ element so that it
691 points to the Syndetic service:
692
693 ----
694 <base_url>http://syndetics.com/index.aspx</base_url>
695 ----
696
697 For changes to be activated for your public interface you will need to restart
698 Evergreen and Apache.
699
700
701 Clear External/Added Content Cache
702 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
703
704 On the catalog’s record summary page, there is a link for staff that will forcibly clear 
705 the cache of the Added Content for that record. This is helpful for when the Added Content 
706 retrieved the wrong cover jacket art, summary, etc. and caches the wrong result.
707
708 image::media/clear-added-content-cache-1.png[Clear Cache Link]
709
710 Once clicked, there is a pop up that will display what was cleared from the cache. 
711
712 image::media/clear-added-content-cache-2.jpg[Example Popup]
713
714 You will need to reload the record in the staff client to obtain the new images from your 
715 Added Content Supplier.
716
717
718 Configure a Custom Image for Missing Images
719 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
720
721 You can configure a "no image" image other than the standard 1-pixel
722 blank image.  The example eg_vhost.conf file provides examples in the
723 comments.  Note: Evergreen does not provide default images for these.
724
725
726 Including Locally Hosted Content in Your Public Interface
727 ---------------------------------------------------------
728
729 It is also possible to show added content that has been generated locally 
730 by placing the content in a specific spot on the web server.  It is 
731 possible to have local book jackets, reviews, TOC, excerpts or annotations.
732
733 File Location and Format
734 ~~~~~~~~~~~~~~~~~~~~~~~~
735
736 By default the files will need to be placed in directories under 
737 */openils/var/web/opac/extras/ac/* on the server(s) that run Apache.
738
739 The files need to be in specific folders depending on the format of the 
740 added content.  Local Content can only be looked up based on the 
741 record ID at this time.
742
743 .URL Format:
744 \http://catalog/opac/extras/ac/*\{type}/\{format}/r/\{recordid}*
745
746  * *type* is one of *jacket*, *reviews*, *toc*, *excerpt* or *anotes*.
747   * *format* is type dependent:
748     - for jacket, one of small, medium or large
749     - others, one of html, xml or json ... html is the default for non-image added content
750   * *recordid* is the bibliographic record id (bre.id).
751
752 Example
753 ~~~~~~~
754
755 If you have some equipment that you are circulating such as a 
756 laptop or eBook reader and you want to add an image of the equipment 
757 that will show up in the catalog.
758
759 [NOTE]
760 =============
761 If you are adding jacket art for a traditional type of media 
762 (book, CD, DVD) consider adding the jacket art to the http://openlibrary.org 
763 project instead of hosting it locally.  This would allow other 
764 libraries to benefit from your work.
765 =============
766
767 Make note of the Record ID of the bib record.  You can find this by 
768 looking at the URL of the bib in the catalog.  
769 http://catalog/eg/opac/record/*123*, 123 is the record ID.  
770 These images will only show up for one specific record.
771
772 Create 3 different sized versions of the image in png or jpg format.
773
774  * *Small* - 80px x 80px - named _123-s.jpg_ or _123-s.png_ - This is displayed in the browse display.
775  * *Medium* - 240px x 240px - named _123-m.jpg_ or _123-m.png_ - This is displayed on the summary page.
776  * *Large* - 400px x 399px - named _123-l.jpg_ or _123-l.png_ - This is displayed if the summary page image is clicked on.
777
778 [NOTE] 
779 The image dimensions are up to you, use what looks good in your catalog.
780  
781 Next, upload the images to the evergreen server(s) that run apache, 
782 and move/rename the files to the following locations/name.  
783 You will need to create directories that are missing.
784  
785  * Small - Move the file *123-s.jpg* to */openils/var/web/opac/extras/ac/jacket/small/r/123*
786  * Medium - Move the file *123-m.jpg* to */openils/var/web/opac/extras/ac/jacket/medum/r/123*.
787  * Large - Move the file *123-l.jpg* to */openils/var/web/opac/extras/ac/jacket/large/r/123*.
788
789 [NOTE]
790 The system doesn't need the file extension to know what kind of file it is.
791  
792 Reload the bib record summary in the web catalog and your new image will display.
793
794 Sitemap generator
795 -----------------
796 A http://www.sitemaps.org[sitemap] directs search engines to the pages of
797 interest in a web site so that the search engines can intelligently crawl
798 your site. In the case of Evergreen, the primary pages of interest are the
799 bibliographic record detail pages.
800
801 The sitemap generator script creates sitemaps that adhere to the
802 http://sitemaps.org specification, including:
803
804 * limiting the number of URLs per sitemap file to no more than 50,000 URLs;
805 * providing the date that the bibliographic record was last edited, so
806   that once a search engine has crawled all of your sites' record detail pages,
807   it only has to reindex those pages that are new or have changed since the last
808   crawl;
809 * generating a sitemap index file that points to each of the sitemap files.
810
811 Running the sitemap generator
812 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
813 The `sitemap_generator` script must be invoked with the following argument:
814
815 * `--lib-hostname`: specifies the hostname for the catalog (for example,
816   `--lib-hostname https://catalog.example.com`); all URLs will be generated
817   appended to this hostname
818
819 Therefore, the following arguments are useful for generating multiple sitemaps
820 per Evergreen instance:
821
822 * `--lib-shortname`: limit the list of record URLs to those which have copies
823   owned by the designated library or any of its children;
824 * `--prefix`: provides a prefix for the sitemap index file names
825
826 Other options enable you to override the OpenSRF configuration file and the
827 database connection credentials, but the default settings are generally fine.
828
829 Note that on very large Evergreen instances, sitemaps can consume hundreds of
830 megabytes of disk space, so ensure that your Evergreen instance has enough room
831 before running the script.
832
833 Scheduling
834 ~~~~~~~~~~
835 To enable search engines to maintain a fresh index of your bibliographic
836 records, you may want to include the script in your cron jobs on a nightly or
837 weekly basis.
838
839 Sitemap files are generated in the same directory from which the script is
840 invoked, so a cron entry will look something like:
841
842 ------------------------------------------------------------------------
843 12 2 * * * cd /openils/var/web && /openils/bin/sitemap_generator
844 ------------------------------------------------------------------------
845
846 Troubleshooting TPAC errors
847 ---------------------------
848
849 If there is a problem such as a TT syntax error, it generally shows up as an
850 ugly server failure page. If you check the Apache error logs, you will probably
851 find some solid clues about the reason for the failure. For example, in the
852 following example, the error message identifies the file in which the problem
853 occurred as well as the relevant line numbers.
854
855 Example error message in Apache error logs:
856
857 ----
858 bash# grep "template error" /var/log/apache2/error_log
859 [Tue Dec 06 02:12:09 2011] [warn] [client 127.0.0.1] egweb: template error:
860  file error - parse error - opac/parts/record/summary.tt2 line 112-121:
861   unexpected token (!=)\n  [% last_cn = 0;\n        FOR copy_info IN
862   ctx.copies;\n            callnum = copy_info.call_number_label;\n
863 ----
864