[open-ils-commits] [GIT] Evergreen ILS branch master updated. 3e5d2695616622033778b21adddbb3b2566015ae

Evergreen Git git at git.evergreen-ils.org
Thu Jun 26 16:00:22 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  3e5d2695616622033778b21adddbb3b2566015ae (commit)
      from  51314746409abd87706206969aff829ab9817fb4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3e5d2695616622033778b21adddbb3b2566015ae
Author: Dan Scott <dscott at laurentian.ca>
Date:   Wed Jun 4 13:09:48 2014 -0400

    LP#1326149 Use a TPAC-settable TIME_FORMAT for local time formats
    
    We had tried to use the format.time library setting, but that is meant
    for Dojo which uses the Unicode formats, that are incompatible with
    the POSIX strftime() formats required by Template::Plugin::Date.
    
    At the same time, we need to expose the raw machine-readable time
    for schema.org consumers, so express that in a @content attribute.
    
    And we might as well use a more meaningful <time> element instead of
    the meaningless <span>, just for good measure.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/templates/opac/parts/config.tt2 b/Open-ILS/src/templates/opac/parts/config.tt2
index 96f8ce5..8b0e69f 100644
--- a/Open-ILS/src/templates/opac/parts/config.tt2
+++ b/Open-ILS/src/templates/opac/parts/config.tt2
@@ -171,5 +171,17 @@ ctx.google_books_preview = 0;
 # metarecords.disabled = 1; # disable all metarecord access points
 ##############################################################################
 
+##############################################################################
+# Local date format (uses POSIX strftime() formatting)
+# See http://www.template-toolkit.org/docs/modules/Template/Plugin/Date.html
+# DATE_FORMAT = '%Y-%m-%d'; # for 2014-06-31 format
+##############################################################################
+
+##############################################################################
+# Local time format (uses POSIX strftime() formatting)
+# See http://www.template-toolkit.org/docs/modules/Template/Plugin/Date.html
+# TIME_FORMAT = '%H:%M:%S'; # for 16:32:32 (24 hour) format
+# TIME_FORMAT = '%H:%M'; # for 16:32 (24 hour) format
+##############################################################################
 
 %]
diff --git a/Open-ILS/src/templates/opac/parts/library/hours.tt2 b/Open-ILS/src/templates/opac/parts/library/hours.tt2
index d66832f..d0bf5b9 100644
--- a/Open-ILS/src/templates/opac/parts/library/hours.tt2
+++ b/Open-ILS/src/templates/opac/parts/library/hours.tt2
@@ -1,67 +1,103 @@
-[% time_format = ctx.get_org_setting(ctx.library.id, 'format.time');
-
-   UNLESS time_format;
-       time_format = '%l:%M %p';
+[%
+   UNLESS TIME_FORMAT;
+       TIME_FORMAT = '%l:%M %p';
    END;
 
+   time_format = TIME_FORMAT;
+
    USE date (format = time_format);
-   today = date.format(format = '%Y-%d-%b ');
+   today = date.format(format = '%Y-%m-%d ');
    # We need to add "today" to the opening/closing hours for Date input
 -%]
 <h2>[% l('Opening hours') %]</h2>
-[%- IF ctx.hours.dow_0_open == ctx.hours.dow_0_close; %]
+
+[%-
+    open = today _ ctx.hours.dow_0_open;
+    close = today _ ctx.hours.dow_0_close;
+    IF open == close;
+%]
 <div class="opening-hours">[% l('Monday: closed') %]</div>
 [%- ELSE %]
 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday" />[%
-    l('Monday: [_1] - [_2]', '<span property="opens">' _ date.format(today _ ctx.hours.dow_0_open) _ '</span>',
-     '<span property="closes">' _ date.format(today _ ctx.hours.dow_0_close) _ '</span>') -%]
+    l('Monday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
+     '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
 </div>
 [%- END %]
-[%- IF ctx.hours.dow_1_open == ctx.hours.dow_1_close; %]
+
+[%-
+    open = today _ ctx.hours.dow_1_open;
+    close = today _ ctx.hours.dow_1_close;
+    IF open == close;
+%]
 <div class="opening-hours">[% l('Tuesday: closed') %]</div>
 [%- ELSE %]
 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday" />[%
-    l('Tuesday: [_1] - [_2]', '<span property="opens">' _ date.format(today _ ctx.hours.dow_1_open) _ '</span>',
-     '<span property="closes">' _ date.format(today _ ctx.hours.dow_1_close) _ '</span>') -%]
+    l('Tuesday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
+     '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
 </div>
 [%- END %]
-[%- IF ctx.hours.dow_2_open == ctx.hours.dow_2_close; %]
+
+[%-
+    open = today _ ctx.hours.dow_2_open;
+    close = today _ ctx.hours.dow_2_close;
+    IF open == close;
+%]
 <div class="opening-hours">[% l('Wednesday: closed') %]</div>
 [%- ELSE %]
 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Wednesday" />[%
-    l('Wednesday: [_1] - [_2]', '<span property="opens">' _ date.format(today _ ctx.hours.dow_2_open) _ '</span>',
-     '<span property="closes">' _ date.format(today _ ctx.hours.dow_2_close) _ '</span>') -%]
+    l('Wednesday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
+     '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
 </div>
 [%- END %]
-[%- IF ctx.hours.dow_3_open == ctx.hours.dow_3_close; %]
+
+[%-
+    open = today _ ctx.hours.dow_3_open;
+    close = today _ ctx.hours.dow_3_close;
+    IF open == close;
+%]
 <div class="opening-hours">[% l('Thursday: closed') %]</div>
 [%- ELSE %]
 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Thursday" />[%
-    l('Thursday: [_1] - [_2]', '<span property="opens">' _ date.format(today _ ctx.hours.dow_3_open) _ '</span>',
-     '<span property="closes">' _ date.format(today _ ctx.hours.dow_3_close) _ '</span>') -%]
+    l('Thursday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
+     '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
 </div>
 [%- END %]
-[%- IF ctx.hours.dow_4_open == ctx.hours.dow_4_close; %]
+
+[%-
+    open = today _ ctx.hours.dow_4_open;
+    close = today _ ctx.hours.dow_4_close;
+    IF open == close;
+%]
 <div class="opening-hours">[% l('Friday: closed') %]</div>
 [%- ELSE %]
 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Friday" />[%
-    l('Friday: [_1] - [_2]', '<span property="opens">' _ date.format(today _ ctx.hours.dow_4_open) _ '</span>',
-     '<span property="closes">' _ date.format(today _ ctx.hours.dow_4_close) _ '</span>') -%]
+    l('Friday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
+     '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
 </div>
 [%- END %]
-[%- IF ctx.hours.dow_5_open == ctx.hours.dow_5_close; %]
+
+[%-
+    open = today _ ctx.hours.dow_5_open;
+    close = today _ ctx.hours.dow_5_close;
+    IF open == close;
+%]
 <div class="opening-hours">[% l('Saturday: closed') %]</div>
 [%- ELSE %]
 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Saturday" />[%
-    l('Saturday: [_1] - [_2]', '<span property="opens">' _ date.format(today _ ctx.hours.dow_5_open) _ '</span>',
-     '<span property="closes">' _ date.format(today _ ctx.hours.dow_5_close) _ '</span>') -%]
+    l('Saturday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
+     '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
 </div>
 [%- END %]
-[%- IF ctx.hours.dow_6_open == ctx.hours.dow_6_close; %]
+
+[%-
+    open = today _ ctx.hours.dow_6_open;
+    close = today _ ctx.hours.dow_6_close;
+    IF open == close;
+%]
 <div class="opening-hours">[% l('Sunday: closed') %]</div>
 [%- ELSE %]
 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Sunday" />[%
-    l('Sunday: [_1] - [_2]', '<span property="opens">' _ date.format(today _ ctx.hours.dow_6_open) _ '</span>',
-     '<span property="closes">' _ date.format(today _ ctx.hours.dow_6_close) _ '</span>') -%]
+    l('Sunday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
+     '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
 </div>
 [%- END %]

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/templates/opac/parts/config.tt2       |   12 +++
 .../src/templates/opac/parts/library/hours.tt2     |   88 ++++++++++++++------
 2 files changed, 74 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list