From: Andrew Coomes Date: Tue, 22 Jan 2013 22:02:07 +0000 (-0800) Subject: Opens Search Result Records in New Tab X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1c9f094ef42e1ec7fccd69c37b7814d9a935d9b3;p=working%2FEvergreen.git Opens Search Result Records in New Tab A new setting, new_tab_without_ctrl, was created to set if a ctrl-click is required to open a search result item in a new tab. By default, ctrl-click is required for a new tab. Signed-off-by: Andrew Coomes Signed-off-by: Kyle Tomita --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index dea01459d5..bc5b7d7e83 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -309,6 +309,9 @@ sub load_rresults { # find the last record in the set, then redirect my $find_last = $cgi->param('find_last'); + # Set check_ctrl_click as is_not_ctrl_click value in ctx + $ctx->{is_not_ctrl_click} = check_ctrl_click( $self ); + $self->timelog("Loading results"); # load bookbag metadata, if requested. if (my $bbag_err = $self->load_rresults_bookbag) { @@ -490,6 +493,21 @@ sub load_rresults { return Apache2::Const::OK; } +# Checks the ctrl-click option status ( on - left click opens new tab, or off - ctrl-click opens new tab ) +sub check_ctrl_click { + my $self = shift || 0; + my $ctx = $self->ctx; + my $ou = 0; + my $sname = 'opac.new_tab_without_ctrl'; + if ( $ctx->{is_staff} ) { + $ou = $ctx->{user}->ws_ou; + } else { + $ou = $self->_get_search_lib(); + } + my $setting_status = $ctx->{get_org_setting}->( $ou, $sname ) ? 1 : 0; + return $setting_status; +} + # If the calling search results in 1 record and the client # is configured to do so, redirect the search results to # the record details page. diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 25fa29294f..3e15462d31 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -87,7 +87,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0751', :eg_version); -- berick/senator +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('XXXX', :eg_version); -- catalyst/search_results_new_tab CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, 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 88051810eb..1bc5a99d1b 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -4711,7 +4711,18 @@ INSERT into config.org_unit_setting_type ), 'string', null) -; + ,( 'opac.new_tab_without_ctrl', 'opac', + oils_i18n_gettext( + 'opac.new_tab_without_ctrl', + 'Enable opening a new tab when clicking on records from the search results page without holding ctrl.', + 'coust', + 'label'), + oils_i18n_gettext( + 'opac.new_tab_without_ctrl', + 'By enabling this option, a new tab will open when clicking on records from the search results page without ctrl. It will override the default of ctrl + left click for new tab. The new tab feature is only for the search results page and is disabled on the Patron holds tab.', + 'coust', + 'description'), + 'bool', null); UPDATE config.org_unit_setting_type SET view_perm = (SELECT id FROM permission.perm_list @@ -4740,8 +4751,10 @@ INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES ( ,(1, 'cat.label.font.size', 10) ,(1, 'cat.label.font.weight', '"normal"') ,(1, 'circ.grace.extend', 'true') -; + --Optionalized new tab for search results + ,(1, 'opac.new_tab_without_ctrl', 'false') +; -- Staged Search (for default matchpoints) INSERT INTO search.relevance_adjustment (field, bump_type, multiplier) VALUES(1, 'first_word', 1.5); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.add-option-for-new-tab-without-ctrl.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.add-option-for-new-tab-without-ctrl.sql new file mode 100644 index 0000000000..d02b4050f5 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.add-option-for-new-tab-without-ctrl.sql @@ -0,0 +1,22 @@ +BEGIN; + + INSERT INTO config.org_unit_setting_type ( name, grp, label, description, datatype ) VALUES ( + 'opac.new_tab_without_ctrl', 'opac', + oils_i18n_gettext( + 'opac.new_tab_without_ctrl', + 'Enable opening a new tab when clicking on records from the search results page without holding ctrl.', + 'coust', + 'label'), + oils_i18n_gettext( + 'opac.new_tab_without_ctrl', + 'By enabling this option, a new tab will open when clicking on records from the search results page without ctrl. It will override the default of ctrl + left click for new tab. The new tab feature is only for the search results page and is disabled on the Patron holds tab.', + 'coust', + 'description'), + 'bool' + ); + + INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES ( + 1, 'opac.new_tab_without_ctrl', 'false' + ); + +COMMIT; diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2 index d6cacbef5b..f443e90125 100644 --- a/Open-ILS/src/templates/opac/parts/js.tt2 +++ b/Open-ILS/src/templates/opac/parts/js.tt2 @@ -50,6 +50,62 @@ +[% IF ctx.is_staff %] + +[% END %] + [%- # So the following works in Mozilla and Chrome, but not in IE8. # Seems like it /should/ work anywhere, though, and obviate the # next three script tags: %] diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index e0f3f2a9d2..6d0b574c5f 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -49,10 +49,23 @@ [%- FOR entry IN attrs.graphic_titles; diff --git a/docs/RELEASE_NOTES_NEXT/search_results_new_tab.txt b/docs/RELEASE_NOTES_NEXT/search_results_new_tab.txt new file mode 100644 index 0000000000..28ed3ae0a9 --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/search_results_new_tab.txt @@ -0,0 +1,11 @@ +New feature: Search result new tab option +================================ +When browsing search results, a user may want to open the title link in a new tab or in an existing tab. +This feature gives the option to be set to require ctrl-click to open a new tab or simply just a click. The +option is set in the Library Settings Editor. + +Group: OPAC +Setting: "Enable opening a new tab when clicking on records from the search results page without holding ctrl" +Value: True/False + +Having the option set to False give it similar functionality to most web browsers.