Skip to content

Commit eb6e4d3

Browse files
Admin: Learnpath: Add configuration setting 'lp_ios_hide_open_in_new_window_button' to remove button in lp on iOS - refs #4954
Author: Juan Cortizas Ponte <[email protected]>
1 parent 2c0f90b commit eb6e4d3

File tree

3 files changed

+31
-17
lines changed

3 files changed

+31
-17
lines changed

main/install/configuration.dist.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,9 @@
16341634
// LP view menu location. Options: "left" or "right"
16351635
// $_configuration['lp_menu_location'] = 'left';
16361636

1637+
// Hide the "Open in new window" button in learning paths when viewing long content (using the button disconnects SCORM tracking - more details in #4954)
1638+
//$_configuration['lp_ios_hide_open_in_new_window_button'] = false;
1639+
16371640
// Show notification events
16381641
/*CREATE TABLE IF NOT EXISTS notification_event (
16391642
id INT unsigned NOT NULL auto_increment PRIMARY KEY,

main/lp/lp_view.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,13 @@
656656
)
657657
);
658658

659+
// Check if the 'Open in new window' button for IOs hosts must be hidden
660+
$iosHideOpenInNewWindow = false;
661+
if (api_get_configuration_value('lp_ios_hide_open_in_new_window_button') === true) {
662+
$iosHideOpenInNewWindow = api_get_configuration_value('lp_ios_hide_open_in_new_window_button');
663+
}
664+
$template->assign('ios_hide_open_in_new_window', $iosHideOpenInNewWindow);
665+
659666
$frameReady = Display::getFrameReadyBlock(
660667
'#content_id, #content_id_blank',
661668
$itemType,

main/template/default/learnpath/view.tpl

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -255,23 +255,27 @@
255255
'style',
256256
'width:100%; overflow:auto; position:auto; -webkit-overflow-scrolling:touch !important;'
257257
);
258-
$('<a>')
259-
.attr({
260-
'id': 'btn-content-new-tab',
261-
'target': '_blank',
262-
'href': '{{ iframe_src }}'
263-
})
264-
.css({
265-
'position': 'absolute',
266-
'right': '5px',
267-
'top': '5px',
268-
'z-index': '9999',
269-
'font-weight': 'bold'
270-
})
271-
.addClass('btn btn-default btn-sm')
272-
.text('{{ 'OpenContentInNewTab'|get_lang|escape('js') }}')
273-
.prependTo('#wrapper-iframe');
274-
$('#wrapper-iframe').css('position', 'relative');
258+
259+
{% if ios_hide_open_in_new_window == false %}
260+
$('<a>')
261+
.attr({
262+
'id': 'btn-content-new-tab',
263+
'target': '_blank',
264+
'href': '{{ iframe_src }}'
265+
})
266+
.css({
267+
'position': 'absolute',
268+
'right': '5px',
269+
'top': '5px',
270+
'z-index': '9999',
271+
'font-weight': 'bold'
272+
})
273+
.addClass('btn btn-default btn-sm')
274+
.text('{{ 'OpenContentInNewTab'|get_lang|escape('js') }}')
275+
.prependTo('#wrapper-iframe');
276+
$('#wrapper-iframe').css('position', 'relative');
277+
{% endif %}
278+
275279
// Fix another issue whereby buttons do not react to click below
276280
// second screen in learning paths on Apple devices
277281
document.getElementById('content_id').setAttribute('style', 'overflow: auto;');

0 commit comments

Comments
 (0)