Merge pull request #1156 from jloguercio/8233

Fix Load ckeditor js plugin only when user is logged on - Refs #8233
1.10.x
José Loguercio 10 years ago
commit ac249108f3
  1. 2
      main/inc/lib/template.lib.php
  2. 19
      main/template/default/layout/header.js.tpl

@ -689,8 +689,10 @@ class Template
} }
foreach ($bowerJsFiles as $file) { foreach ($bowerJsFiles as $file) {
if (!empty($file)) {
$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PATH).'web/assets/'.$file.'"></script>'."\n"; $js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PATH).'web/assets/'.$file.'"></script>'."\n";
} }
}
foreach ($js_files as $file) { foreach ($js_files as $file) {
$js_file_to_string .= api_get_js($file); $js_file_to_string .= api_get_js($file);

@ -1,6 +1,7 @@
<script> <script>
// External plugins not part of the default Ckeditor package. {% if _u.logged %}
var plugins = [ // External plugins not part of the default Ckeditor package.
var plugins = [
'asciimath', 'asciimath',
'asciisvg', 'asciisvg',
'audio', 'audio',
@ -18,16 +19,16 @@ var plugins = [
'wikilink', 'wikilink',
'wordcount', 'wordcount',
'youtube' 'youtube'
]; ];
plugins.forEach(function(plugin) { plugins.forEach(function(plugin) {
CKEDITOR.plugins.addExternal(plugin, '{{ _p.web_main ~ 'inc/lib/javascript/ckeditor/plugins/' }}' + plugin + '/'); CKEDITOR.plugins.addExternal(plugin, '{{ _p.web_main ~ 'inc/lib/javascript/ckeditor/plugins/' }}' + plugin + '/');
}); });
/** /**
* Function use to load templates in a div * Function use to load templates in a div
**/ **/
var showTemplates = function (ckeditorName) { var showTemplates = function (ckeditorName) {
var editorName = 'content'; var editorName = 'content';
if (ckeditorName && ckeditorName.length > 0) { if (ckeditorName && ckeditorName.length > 0) {
editorName = ckeditorName; editorName = ckeditorName;
@ -67,8 +68,8 @@ var showTemplates = function (ckeditorName) {
}); });
$templatesUL.appendTo("#frmModel"); $templatesUL.appendTo("#frmModel");
}); });
}; };
{% endif %}
$(document).ready(function(){ $(document).ready(function(){
$("#open-view-list").click(function(){ $("#open-view-list").click(function(){
$("#student-list-work").fadeIn(300); $("#student-list-work").fadeIn(300);

Loading…
Cancel
Save