From: Garry Collum Date: Thu, 2 Jun 2016 17:22:25 +0000 (-0400) Subject: Added goog_analytics, header, and hold_error_messages to git. Made string changes... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9e4ec0854c5e08df4230de688f0d7e7850fadb2e;p=evergreen%2Fequinox.git Added goog_analytics, header, and hold_error_messages to git. Made string changes in header and hold_error_messages. --- diff --git a/Open-ILS/src/kcpl_templates/opac/parts/goog_analytics.tt2 b/Open-ILS/src/kcpl_templates/opac/parts/goog_analytics.tt2 new file mode 100644 index 0000000000..5070537eef --- /dev/null +++ b/Open-ILS/src/kcpl_templates/opac/parts/goog_analytics.tt2 @@ -0,0 +1,18 @@ +[%- PROCESS "opac/parts/header.tt2"; + IF google_analytics.enabled == 'true' %] + + + +[%- END %] diff --git a/Open-ILS/src/kcpl_templates/opac/parts/header.tt2 b/Open-ILS/src/kcpl_templates/opac/parts/header.tt2 new file mode 100644 index 0000000000..58668c16a6 --- /dev/null +++ b/Open-ILS/src/kcpl_templates/opac/parts/header.tt2 @@ -0,0 +1,131 @@ +[%- USE money = format(l('$%.2f')); + USE date; + USE CGI = CGI_utf8; + USE POSIX; + USE HTML; + SET DATE_FORMAT = l('%m/%d/%Y'); + SET DATETIME_FORMAT = l('%m/%d/%Y %l:%M %p'); + PROCESS "opac/parts/config.tt2"; + + # Don't wrap in l() here; do that where this format string is actually used. + SET HUMAN_NAME_FORMAT = '[_1] [_2] [_3] [_4] [_5]'; + + is_advanced = CGI.param("_adv").size; + is_special = CGI.param("_special").size; + + #variables to use to remove parameters via mkurk + expert_search_parms = ['tag','subfield','term','_special']; + general_search_parms = ['page','sort','query','bool','contains','pubdate']; + browse_search_parms = ['fi:has_browse_entry','bterm','blimit','bpivot']; + facet_search_parms = ['facet']; + + + # ----------------------------------------------------------------------------- + # mkurl( destination_page, params_to_set, params_to_clear ) + # + # Current page, updated params: + # mkurl('', {foo => 'bar', boo => 'baz'}); + # + # New page, one param is a list: + # mkurl('http://flarg.baz/squz', {foo => 'bar', boo => ['baz', 'faz']}); + # + # New page, clear all existing params before applying new ones: + # mkurl('/fuz/buster', {foo => 'bar', boo => 'baz'}, 1); + # + # Current page, clear 'some_param' from the existing params: + # mkurl('', {foo => 'bar', boo => 'baz'}, ['some_param']); + # + # Current page to a named anchor 'copies' + # mkurl('', {}, [], 'copies'); + MACRO mkurl(page, params, clear_params, named_anchor) BLOCK; + + # clone the query string to avoid clobberation + cgi = CGI.new(CGI.query_string); + + # remove requested params + IF clear_params.0; # array + FOR p IN clear_params; cgi.delete(p); END; + ELSIF clear_params; + cgi.delete_all(); + END; + + # x and y are artifacts of using tags + # instead of true submit buttons, and their values are never used. + cgi.delete('x', 'y'); + + # apply user params + FOR k IN params.keys; + encoded = []; + max = params.$k.max; + + # The following commented-out line can be fooled. Its replacement + # below is what you really mean. + # list = (params.$k.0 OR max == -1) ? params.$k : [params.$k]; + list = params.$k.list; + + IF list.size == 0; NEXT; END; + # CGI croaks on already-decoded strings. force-encode to be safe. + FOR p IN list; encoded.push(ctx.encode_utf8(p)); END; + foo = cgi.param("-name", k, "-values", encoded); + END; + + # for url brevity, remove any params that have no value + FOR p IN cgi.param; + val = cgi.param(p); + IF val == ''; cgi.delete(p); END; + + # Delete POST vars unless we asked for them + UNLESS CGI.url_param(p).defined OR params.defined(p); + cgi.delete(p); + END; + END; + + final = named_anchor ? '#' _ named_anchor : ''; + + IF page; + IF cgi.query_string; + page _ '?' _ cgi.query_string _ final; + ELSE; + page _ final; + END; + ELSE; + # staying on the current page + cgi.url("-absolute" => 1, "-path" => 1, "-query" => 1) _ final; + END; + END; + + # Dojo is required to use the copy locations advanced search filter, + # therefore, it should always be enabled. + want_dojo = 1; + + use_autosuggest = ctx.get_cgf("opac.use_autosuggest"); + + IF use_autosuggest.enabled == "t"; + want_dojo = 1; + END; + + IF ctx.google_books_preview; + want_dojo = 1; + END; + + IF ENV.OILS_NOVELIST_URL; + want_dojo = 1; + END; + + # Especially useful for image 'alt' tags and link title tags, + # where the content may need to be unique (making it longer) + # but should not exceed 75 chars for ideal screen reader support. + # usage: html_text_attr('title', 'Link to item I Have A Super Long Title') + # the full HTML attribute key="value" is produced + MACRO html_text_attr(name, value) BLOCK; + IF value.length >= 75; + value = value.substr(71, value.length, '...'); + END; + value = value.replace('\s*$', ''); # remove trailing whitespace + HTML.attributes($name => value); + END; + + MACRO img_alt(text) BLOCK; + html_text_attr('alt', text); + END; +%] diff --git a/Open-ILS/src/kcpl_templates/opac/parts/hold_error_messages.tt2 b/Open-ILS/src/kcpl_templates/opac/parts/hold_error_messages.tt2 new file mode 100644 index 0000000000..b94d4ad947 --- /dev/null +++ b/Open-ILS/src/kcpl_templates/opac/parts/hold_error_messages.tt2 @@ -0,0 +1,40 @@ +[% + # XXX It might be cleaner to move this into its own file or something. + # + # The following hash should have fail_parts as keys and user/patron-friendly + # strings as values. If the system returns an event with a fail_part when + # you attempt to place a hold and the fail part matches something in this + # hash, this is the message that will be displayed to the user. Wait until + # these are used to pass them through l() for i18n. + + FAIL_PART_MSG_MAP = { + "actor.usr.barred" => l("The patron is barred"), + "asset.copy.circulate" => l("The item does not circulate"), + "asset.copy_location.circulate" => l("Items from this shelving location do not circulate"), + "asset.copy.status" => l("The item cannot circulate at this time"), + "circ.holds.target_skip_me" => l("The item's circulation library does not fulfill holds"), + "config.circ_matrix_circ_mod_test" => l("The patron has too many items of this type checked out"), + "config.circ_matrix_test.circulate" => l("Circulation rules reject this item as non-circulatable"), + "config.hold_matrix_test.holdable" => l("Hold rules reject this item as unholdable"), + "config.hold_matrix_test.max_holds" => l("The patron has reached the maximum number of holds, possibly just for this type of item"), + "config.rule_age_hold_protect.prox" => l("The item is too new to transit this far"), + "item.holdable" => l("The item is not holdable"), + "location.holdable" => l("The item's location is not holdable"), + "status.holdable" => l("The item is not in a holdable status"), + "no_item" => l("The system could not find this item"), + "no_ultimate_items" => l("The system could not find any items to match this hold request"), + "no_matchpoint" => l("System rules do not define how to handle this item"), + "no_user" => l("The system could not find this patron"), + "transit_range" => l("The item cannot transit this far") + }; + + + # This works like the above has, but instead of fail_parts for keys, use + # the textcode of the event. This will only be consulted for events + # that do not have a fail_part matching something in the above hash. + # Wait until these are used to pass them through l() for i18n. + + EVENT_MSG_MAP = { + "PATRON_EXCEEDS_FINES" => l("Patron has reached the maximum fine amount") + }; +%]