Skip to content

Commit 32ed97a

Browse files
committed
Add setting "disable_js_in_lp_view" see BT#13575
- Disables rendering of js scripts added by chamilo: jquery, jquery-ui, mathajax, jquery.highlight.js, glossary/glossary.js.php
1 parent ab4d2f1 commit 32ed97a

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

main/install/configuration.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,3 +669,5 @@
669669
'description' => true,
670670
]
671671
];*/
672+
// Disable jquery, jquery-ui libs added in the learning path view
673+
//$_configuration['disable_js_in_lp_view'] = true;

main/lp/lp_view.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@
554554
$template->assign('data_list', $_SESSION['oLP']->getListArrayToc($get_toc_list));
555555
$template->assign('lp_id', $_SESSION['oLP']->lp_id);
556556
$template->assign('lp_current_item_id', $_SESSION['oLP']->get_current_item_id());
557+
$template->assign('disable_js_in_lp_view', (int) api_get_configuration_value('disable_js_in_lp_view'));
558+
557559
$view = $template->get_template('learnpath/view.tpl');
558560
$content = $template->fetch($view);
559561

main/template/default/learnpath/view.tpl

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -281,23 +281,24 @@
281281
})();
282282
{% endif %}
283283
284-
$('iframe#content_id')
285-
.on('load', function () {
286-
if ('link' !== olms.lms_item_type) {
287-
$.frameReady(function () {
288-
}, 'top.content_name', {
289-
load: [
290-
{type: 'script', id: '_fr1', src: '{{ _p.web }}web/assets/jquery/dist/jquery.min.js'},
291-
{type: 'script', id: '_fr7', src: '{{ _p.web }}web/assets/MathJax/MathJax.js?config=AM_HTMLorMML'},
292-
{type: 'script', id: '_fr4', src: '{{ _p.web }}web/assets/jquery-ui/jquery-ui.min.js'},
293-
{type: 'stylesheet', id: '_fr5', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/jquery-ui.min.css'},
294-
{type: 'stylesheet', id: '_fr6', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/theme.css'},
295-
{type: 'script', id: '_fr2', src: '{{ _p.web_lib }}javascript/jquery.highlight.js'},
296-
{type: 'script', id: '_fr3', src: '{{ _p.web_main }}glossary/glossary.js.php?{{ _p.web_cid_req }}'}
297-
]
298-
});
299-
}
300-
});
284+
{% if disable_js_in_lp_view == 0 %}
285+
$('iframe#content_id').on('load', function () {
286+
if ('link' !== olms.lms_item_type) {
287+
$.frameReady(function () {
288+
}, 'top.content_name', {
289+
load: [
290+
{type: 'script', id: '_fr1', src: '{{ _p.web }}web/assets/jquery/dist/jquery.min.js'},
291+
{type: 'script', id: '_fr7', src: '{{ _p.web }}web/assets/MathJax/MathJax.js?config=AM_HTMLorMML'},
292+
{type: 'script', id: '_fr4', src: '{{ _p.web }}web/assets/jquery-ui/jquery-ui.min.js'},
293+
{type: 'stylesheet', id: '_fr5', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/jquery-ui.min.css'},
294+
{type: 'stylesheet', id: '_fr6', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/theme.css'},
295+
{type: 'script', id: '_fr2', src: '{{ _p.web_lib }}javascript/jquery.highlight.js'},
296+
{type: 'script', id: '_fr3', src: '{{ _p.web_main }}glossary/glossary.js.php?{{ _p.web_cid_req }}'}
297+
]
298+
});
299+
}
300+
});
301+
{% endif %}
301302
});
302303
303304
$(window).on('resize', function () {

0 commit comments

Comments
 (0)