From: Jeff Davis Date: Fri, 30 May 2014 23:24:32 +0000 (-0700) Subject: LP1431055 Content Cafe optionally opens in new tab X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fldw%2FLP1431055;p=working%2FEvergreen.git LP1431055 Content Cafe optionally opens in new tab Currently, when a user clicks on the Reviews & More links in the search results, a new window is opened that displays the Content Cafe data. This is a problem for two reasons. 1. The Content Cafe username and password are contained in the URL of the window that is opened. 2. Some libraries hvae touch screen systems, and when a new window is opened it interferes with the touch screen interface. This modification allows Reviews & More links from the search results to be opened in a new tab. To do this, a new boolean org unit setting has been created. The new setting is opac.reviews_and_more_new_tab. The ctx.get_org_setting(org_id, setting) function returns the current value of opac.reviews_and_more_new_tab. If that setting is set to true, then the TPAC inserts target='_blank' into the URL. Or in the case of the staff client, it opens in a new Staff Client window. In the case of touchscreen kiosks, libraries would have this setting at false, so their touch screen system keeps operating in the current window when users touch the Reviews & More links. In order to get the correct org_id for ctx.get_org_setting() call when using the Staff Client, I had to add a ctx.ws_ou variable to EGCatLoader.pm. This uses the value taken from the staff client login. The Staff Client cannot use the physical_loc variable because it is based on an Apache ENV variable set in the /etc/apache2/includes/ TPAC skin files, and unless the host used in the staff client has the relevant short name appended to it, the physical_loc value will be set to 1 for the consortia. Additionally, when there is no isbn or upc for Content Cafe to identify the item, the Summaries & More drop down is not displayed. This is confusing for users who click the Reviews & More link in the search results because it takes them to a page without any information pertaining to the link they clicked. If Apache has the OILS_CONTENT_CAFE_USER environment variable set in eg_vhost.conf, then this commit displays the Summaries and More tab with the following localized comment: 'There are currently no reviews available for this title'. Otherwise, the Summaries and More tab is ommited from the record details. Furthermore, the summaries for an item are stored in attrs.summaries. The code in summaryplus.tt2 was checking for the existence of attrs.summary, which does not exist, so it was always excluding summaries from the record details under the Summaries & More tab. This commit fixes that typo, which allows summaries to be displayed. However, only the first value in a 520 field is being passed as a summary for records to display in the Abstract field and the Summaries & More tab. But, the Summaries & More tab is expecting to display all the 520 values. So, this commit also modifies misc_util.tt2 to return all 520 values when any are present. Currently, it only returns the first 520 value when any are present. Next, the Abstract field in summary.tt2 is modified to only display the first 520 to keep that information brief. This allows summaryplus.tt2 to display all the 520 values in the Summaries & More tab. Additionally, the Summaries & More tab has been renamed Reviews & More, so that it is consistent with the link in the results page. Reviews & More was chosen because it is shorter than Summaries & More. Finally, by default no 520 values are displayed in Summaries & More. However, the code to do so is included in comments in case a library wishes to display all 520 values. Signed-off-by: Liam Whalen Conflicts: Open-ILS/src/sql/Pg/950.data.seed-values.sql Open-ILS/src/templates/opac/parts/misc_util.tt2 Open-ILS/src/templates/opac/parts/record/summary.tt2 Open-ILS/src/templates/opac/parts/result/table.tt2 The occurance of Reviews & More was displaying as Reviews & More. This has been corrected. The TT2 localization seems to properly display & now without needing to use the HTML code for it. In fact, it appears that the TT2 localization no longer translates the HTML code for &. Signed-off-by: Jeff Davis Conflicts: Open-ILS/src/templates/opac/parts/record/extras.tt2 Open-ILS/src/templates/opac/parts/result/table.tt2 --- diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index bac8cfc6a0..8b53be95ee 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -14263,3 +14263,26 @@ INSERT INTO config.org_unit_setting_type 'coust', 'description'), 'bool'); + +INSERT INTO config.org_unit_setting_type + (name, label, datatype, description, grp, update_perm, view_perm) +VALUES ( + 'opac.reviews_and_more_new_tab', + oils_i18n_gettext( + 'opac.reviews_and_more_new_tab', + 'Open Reviews & More in a new tab', + 'coust', + 'label' + ), + 'bool', + oils_i18n_gettext( + 'opac.reviews_and_more_new_tab', + 'Allows the Reviews & More links in the search results to be opened in a new tab', + 'coust', + 'description' + ), + 'opac', + 93, + 192 +); + diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting.reviews_and_more_new_tab.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting.reviews_and_more_new_tab.sql new file mode 100644 index 0000000000..11ff2effdc --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting.reviews_and_more_new_tab.sql @@ -0,0 +1,26 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +INSERT INTO config.org_unit_setting_type + (name, label, datatype, description, grp, update_perm, view_perm) +VALUES ( + 'opac.reviews_and_more_new_tab', + oils_i18n_gettext( + 'opac.reviews_and_more_new_tab', + 'Open Reviews & More in a new tab', + 'coust', + 'label' + ), + 'bool', + oils_i18n_gettext( + 'opac.reviews_and_more_new_tab', + 'Allows the Reviews & More links in the search results to be opened in a new tab', + 'coust', + 'description' + ), + 'opac', + 93, + 192 +); +COMMIT; diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index 0af121c4e5..4446d6d4cf 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -330,7 +330,7 @@ FOR sub IN xml.findnodes('//*[@tag="520"]/*[@code="a"]'); args.summaries.push(sub.textContent); END; - args.summary = (args.summaries.size) ? args.summaries.0 : ''; + args.summary = (args.summaries.size) ? args.summaries : ''; # 250 gets pride of place for edition statement, and is the # only logical choice for 880 graphic fields diff --git a/Open-ILS/src/templates/opac/parts/record/extras.tt2 b/Open-ILS/src/templates/opac/parts/record/extras.tt2 index 04cdd141e0..3c6a8ae4b2 100644 --- a/Open-ILS/src/templates/opac/parts/record/extras.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/extras.tt2 @@ -54,7 +54,7 @@ END; extras = [ - {name => 'summaryplus', label => l('Summaries & More'), hide => hide_summary}, + {name => 'summaryplus', label => l('Reviews & More'), hide => hide_summary}, {name => 'annotation', label => l('Annotation'), hide => 1}, {name => 'awards', label => l('Awards, Reviews, & Suggested Reads')}, {name => 'excerpt', label => l('Excerpt'), hide => 1}, @@ -66,7 +66,20 @@ ]; FOREACH extra IN extras; - IF extra.hide; NEXT; END; + IF extra.hide; + IF extra.name != 'summaryplus'; + NEXT; + ELSIF NOT ENV.OILS_CONTENT_CAFE_USER; + #If we are going to hide summaryplus because no + #conetent could be retrieved and we are not a + #Content Cafe user, then hide it. + #Otherwise show the summaryplus tab because + #it is confusing to click the Reviews & More links + #in the search results and not be taken to the + #Reviews and More tab. + NEXT; + END; + END; name = extra.name; %]
diff --git a/Open-ILS/src/templates/opac/parts/record/summaryplus.tt2 b/Open-ILS/src/templates/opac/parts/record/summaryplus.tt2 index 23e21ea1a2..ec2872cecf 100644 --- a/Open-ILS/src/templates/opac/parts/record/summaryplus.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/summaryplus.tt2 @@ -1,20 +1,26 @@
- [%- IF attrs.summary %] -
- [% l('Summary: ') %] - [% FOR sum IN attrs.summaries %] - [% IF !loop.first; '
'; END %] - [% sum | html %] - [% END %] -
- [%- END %] - [%- IF ENV.OILS_CONTENT_CAFE_USER %] - - [% ident = attrs.isbn_clean || attrs.upc %] - - [%- END %] + [% #Sitka does not want summaries in the Reviews & More tab %] + [%- IF attrs.summaries.0 AND 0 == 1 %] +
+ [% l('Summary: ') %] + [% FOR sum IN attrs.summaries %] + [% IF !loop.first; '
'; END %] + [% sum | html %] + [% END %] +
+ [% END %] + [% IF ENV.OILS_CONTENT_CAFE_USER %] + [% ident = attrs.isbn_clean || attrs.upc %] + [% IF ident %] + + + [% ELSE %] +
+ [% l('There are currently no reviews available for this title.') %] +
+ [%- END %] + [% END %]
- diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index 6cbe41e02c..789acbd9a2 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -402,15 +402,38 @@ END; [% END %]
- [% IF ENV.OILS_CONTENT_CAFE_USER %] - [% ident = attrs.isbn_clean || attrs.upc %] + [% IF ENV.OILS_CONTENT_CAFE_USER; + IF NOT ctx.is_staff; + tpac_ou = ctx.physical_loc; + ELSE; + tpac_ou = ctx.ws_ou; + END; + new_window = ctx.get_org_setting(tpac_ou, 'opac.reviews_and_more_new_tab'); + record = ctx.opac_root _ '/record/' _ rec.id; + name = 'summaryplus'; + href = mkurl(record, {expand => name}) _ '#' _ name; + %]