Skip to content

Commit

Permalink
Admin: Learnpath: Add configuration setting 'lp_ios_hide_open_in_new_…
Browse files Browse the repository at this point in the history
…window_button' to remove button in lp on iOS - refs #4954

Author: Juan Cortizas Ponte <[email protected]>
  • Loading branch information
juancp-contidosdixitais authored Nov 3, 2023
1 parent 2c0f90b commit eb6e4d3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
3 changes: 3 additions & 0 deletions main/install/configuration.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,9 @@
// LP view menu location. Options: "left" or "right"
// $_configuration['lp_menu_location'] = 'left';

// Hide the "Open in new window" button in learning paths when viewing long content (using the button disconnects SCORM tracking - more details in #4954)
//$_configuration['lp_ios_hide_open_in_new_window_button'] = false;

// Show notification events
/*CREATE TABLE IF NOT EXISTS notification_event (
id INT unsigned NOT NULL auto_increment PRIMARY KEY,
Expand Down
7 changes: 7 additions & 0 deletions main/lp/lp_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,13 @@
)
);

// Check if the 'Open in new window' button for IOs hosts must be hidden
$iosHideOpenInNewWindow = false;
if (api_get_configuration_value('lp_ios_hide_open_in_new_window_button') === true) {
$iosHideOpenInNewWindow = api_get_configuration_value('lp_ios_hide_open_in_new_window_button');
}
$template->assign('ios_hide_open_in_new_window', $iosHideOpenInNewWindow);

$frameReady = Display::getFrameReadyBlock(
'#content_id, #content_id_blank',
$itemType,
Expand Down
38 changes: 21 additions & 17 deletions main/template/default/learnpath/view.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -255,23 +255,27 @@
'style',
'width:100%; overflow:auto; position:auto; -webkit-overflow-scrolling:touch !important;'
);
$('<a>')
.attr({
'id': 'btn-content-new-tab',
'target': '_blank',
'href': '{{ iframe_src }}'
})
.css({
'position': 'absolute',
'right': '5px',
'top': '5px',
'z-index': '9999',
'font-weight': 'bold'
})
.addClass('btn btn-default btn-sm')
.text('{{ 'OpenContentInNewTab'|get_lang|escape('js') }}')
.prependTo('#wrapper-iframe');
$('#wrapper-iframe').css('position', 'relative');
{% if ios_hide_open_in_new_window == false %}
$('<a>')
.attr({
'id': 'btn-content-new-tab',
'target': '_blank',
'href': '{{ iframe_src }}'
})
.css({
'position': 'absolute',
'right': '5px',
'top': '5px',
'z-index': '9999',
'font-weight': 'bold'
})
.addClass('btn btn-default btn-sm')
.text('{{ 'OpenContentInNewTab'|get_lang|escape('js') }}')
.prependTo('#wrapper-iframe');
$('#wrapper-iframe').css('position', 'relative');
{% endif %}
// Fix another issue whereby buttons do not react to click below
// second screen in learning paths on Apple devices
document.getElementById('content_id').setAttribute('style', 'overflow: auto;');
Expand Down

0 comments on commit eb6e4d3

Please sign in to comment.