# 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) {
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.
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,
),
'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
,(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);
--- /dev/null
+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;
<script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/dojo/dojo.js?[% ctx.eg_cache_hash %]"></script>
<script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/dojo/openils_dojo.js?[% ctx.eg_cache_hash %]"></script>
+[% IF ctx.is_staff %]
+ <script type="text/javascript">
+
+ var setting_value = [% ctx.is_not_ctrl_click %];
+ var element_tag = dojo.query( "#result_table_div a.result_title" );
+
+ if ( setting_value === 0 ) {
+ // If the ou setting value is false, call new_tab when a result title link is ctrl-clicked.
+ element_tag.connect( "onclick", function ( e ) {
+ if( e.ctrlKey ) {
+ if ( !new_tab( this ) ) {
+ set_url_as_href( this );
+ }
+ } else {
+ set_url_as_href( this );
+ }
+ }
+ );
+ } else if ( setting_value === 1 ) {
+ // If the ou setting is true, call new_tab when a result title link is left clicked.
+ element_tag.connect( "onclick", function ( e ) {
+ if ( !new_tab( this ) ) {
+ set_url_as_href( this );
+ }
+ }
+ );
+ }
+
+ // New tab function; opens a fresh tab with given URL and tab name.
+ function new_tab( element ) {
+ var tabName = element.getAttribute( 'tabname' );
+ var url = element.getAttribute( 'url' );
+ var content_params = {
+ 'override_tab_lock': true,
+ 'no_xulG': false,
+ 'show_print_button': false,
+ 'show_nav_buttons': false,
+ 'opac_url': "oils://remote" + url
+ };
+ var result = true;
+ try {
+ result = xulG.new_tab( xulG.urls.XUL_OPAC_WRAPPER, {}, content_params );
+ } catch ( err ) {
+ result = false;
+ }
+ return result;
+ }
+
+ // Set url as href function; sets the url value as the href value
+ function set_url_as_href( element ) {
+ element.setAttribute( "href", element.getAttribute( 'url' ) )
+ }
+
+ </script>
+[% 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: %]
</td>
<td class='result_table_title_cell' name='result_table_title_cell'>
<div class="bold">
- <a name='record_[% rec.id %]' name='item_title'
- href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
- [% HTML.attributes(title => l('Display record details for "[_1]"', attrs.title)) %]
- class='search_link'>[% attrs.title | html %]</a>
+ [% IF ctx.is_staff %]
+ <a name = 'record_[% rec.id %]'
+ style="text-decoration: underline; cursor: pointer"
+ url = "[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
+ tabname = "Bib Record: [% rec.id %]"
+ recId = "[% rec.id %]"
+ [% HTML.attributes(title => l( 'Display record details for "[_1]"', attrs.title ) ) %]
+ class = 'search_link result_title'>[% attrs.title | html %]
+ </a>
+ [% END %]
+ [% IF !ctx.is_staff %]
+ <a name='record_[% rec.id %]' name='item_title'
+ href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
+ [% HTML.attributes(title => l('Display record details for "[_1]"', attrs.title)) %]
+ class='search_link'>[% attrs.title | html %]
+ </a>
+ [% END %]
</div>
[%-
FOR entry IN attrs.graphic_titles;
--- /dev/null
+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.