Browse Source

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
jmontoyaa 7 years ago
parent
commit
32ed97ad07
3 changed files with 22 additions and 17 deletions
  1. 2 0
      main/install/configuration.dist.php
  2. 2 0
      main/lp/lp_view.php
  3. 18 17
      main/template/default/learnpath/view.tpl

+ 2 - 0
main/install/configuration.dist.php

@@ -669,3 +669,5 @@ $_configuration['gradebook_badge_sidebar'] = [
         'description' => true,
     ]
 ];*/
+// Disable jquery, jquery-ui libs added in the learning path view
+//$_configuration['disable_js_in_lp_view'] = true;

+ 2 - 0
main/lp/lp_view.php

@@ -554,6 +554,8 @@ $template->assign('lp_title_scorm', $_SESSION['oLP']->name);
 $template->assign('data_list', $_SESSION['oLP']->getListArrayToc($get_toc_list));
 $template->assign('lp_id', $_SESSION['oLP']->lp_id);
 $template->assign('lp_current_item_id', $_SESSION['oLP']->get_current_item_id());
+$template->assign('disable_js_in_lp_view', (int) api_get_configuration_value('disable_js_in_lp_view'));
+
 $view = $template->get_template('learnpath/view.tpl');
 $content = $template->fetch($view);
 

+ 18 - 17
main/template/default/learnpath/view.tpl

@@ -281,23 +281,24 @@
             })();
         {% endif %}
 
-        $('iframe#content_id')
-            .on('load', function () {
-                if ('link' !== olms.lms_item_type) {
-                    $.frameReady(function () {
-                    }, 'top.content_name', {
-                        load: [
-                            {type: 'script', id: '_fr1', src: '{{ _p.web }}web/assets/jquery/dist/jquery.min.js'},
-                            {type: 'script', id: '_fr7', src: '{{ _p.web }}web/assets/MathJax/MathJax.js?config=AM_HTMLorMML'},
-                            {type: 'script', id: '_fr4', src: '{{ _p.web }}web/assets/jquery-ui/jquery-ui.min.js'},
-                            {type: 'stylesheet', id: '_fr5', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/jquery-ui.min.css'},
-                            {type: 'stylesheet', id: '_fr6', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/theme.css'},
-                            {type: 'script', id: '_fr2', src: '{{ _p.web_lib }}javascript/jquery.highlight.js'},
-                            {type: 'script', id: '_fr3', src: '{{ _p.web_main }}glossary/glossary.js.php?{{ _p.web_cid_req }}'}
-                        ]
-                    });
-                }
-            });
+        {% if disable_js_in_lp_view == 0 %}
+        $('iframe#content_id').on('load', function () {
+            if ('link' !== olms.lms_item_type) {
+                $.frameReady(function () {
+                }, 'top.content_name', {
+                    load: [
+                        {type: 'script', id: '_fr1', src: '{{ _p.web }}web/assets/jquery/dist/jquery.min.js'},
+                        {type: 'script', id: '_fr7', src: '{{ _p.web }}web/assets/MathJax/MathJax.js?config=AM_HTMLorMML'},
+                        {type: 'script', id: '_fr4', src: '{{ _p.web }}web/assets/jquery-ui/jquery-ui.min.js'},
+                        {type: 'stylesheet', id: '_fr5', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/jquery-ui.min.css'},
+                        {type: 'stylesheet', id: '_fr6', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/theme.css'},
+                        {type: 'script', id: '_fr2', src: '{{ _p.web_lib }}javascript/jquery.highlight.js'},
+                        {type: 'script', id: '_fr3', src: '{{ _p.web_main }}glossary/glossary.js.php?{{ _p.web_cid_req }}'}
+                    ]
+                });
+            }
+        });
+        {% endif %}
     });
 
     $(window).on('resize', function () {