Change js lib path see #7573

Note: To load js libraries you need to execute composer update.
1.10.x
Julio Montoya 10 years ago
parent f84f1da072
commit 063a81f835
  1. 1
      .gitignore
  2. 6
      main/calendar/agenda_js.php
  3. 6
      main/chat/header_frame.inc.php
  4. 14
      main/document/showinframes.php
  5. 160
      main/document/showinframesmin.php
  6. 33
      main/inc/lib/api.lib.php
  7. 2
      main/inc/lib/svg-edit/extensions/imagelib/groups.php
  8. 2
      main/inc/lib/svg-edit/extensions/imagelib/index.php
  9. 2
      main/inc/lib/svg-edit/extensions/imagelib/users.php
  10. 2
      main/inc/lib/svg-edit/svg-editor.php
  11. 55
      main/inc/lib/template.lib.php
  12. 2
      main/newscorm/lp_controller.php
  13. 4
      main/newscorm/lp_view.php

1
.gitignore vendored

@ -46,6 +46,7 @@ plugin/bbb/config.vm.php
main/cron/incoming/*
vendor
web/assets/*
data/*
!data/index.html
data/badges/*

@ -28,9 +28,9 @@ $this_section = SECTION_MYAGENDA;
$htmlHeadXtra[] = api_get_jquery_libraries_js(array('jquery-ui', 'jquery-ui-i18n'));
$htmlHeadXtra[] = api_get_js('qtip2/jquery.qtip.min.js');
$htmlHeadXtra[] = api_get_js('fullcalendar/fullcalendar.min.js');
$htmlHeadXtra[] = api_get_js('fullcalendar/gcal.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/fullcalendar/fullcalendar.css');
$htmlHeadXtra[] = api_get_asset('fullcalendar/dist/fullcalendar.min.js');
$htmlHeadXtra[] = api_get_asset('fullcalendar/dist/gcal.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_PATH).'web/assets/fullcalendar/dist/fullcalendar.min.css');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/qtip2/jquery.qtip.min.css');
if (api_is_platform_admin() && ($type == 'admin' || $type == 'platform')) {

@ -123,7 +123,7 @@ header('Content-Type: text/html; charset='.api_get_system_encoding());
<head>
<meta charset="<?php echo api_get_system_encoding(); ?>" />
<title>Chat</title>
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CSS_PATH); ?>bootstrap.css">
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_PATH); ?>web/assets/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-emojiarea/jquery.emojiarea.css">
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CSS_PATH); ?>chat.css">
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CSS_PATH); ?>markdown.css">
@ -131,8 +131,8 @@ header('Content-Type: text/html; charset='.api_get_system_encoding());
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/emojione/css/emojione.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/emojione/css/autocomplete.css">
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/highlight/styles/github.css">
<?php echo api_get_js('jquery.min.js'); ?>
<?php echo api_get_js('bootstrap/bootstrap.js'); ?>
<?php echo api_get_jquery_js(); ?>
<?php echo api_get_asset('bootstrap/dist/js/bootstrap.min.js'); ?>
<?php echo api_get_js('highlight/highlight.pack.js'); ?>
<?php echo api_get_js('jquery-textcomplete/jquery.textcomplete.js'); ?>
<?php echo api_get_js('emojione/js/emojione.min.js'); ?>

@ -169,9 +169,9 @@ if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
// $("<div>I am a div courses</div>").prependTo("body");
}, "top.mainFrame",
{ load: [
{type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
{type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
{type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
{type:"script", id:"_fr1", src:"'.api_get_jquery_web_path().'"},
{type:"script", id:"_fr4", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/jquery-ui.min.js"},
{type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/themes/smoothness/jquery-ui.min.css"},
{type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_manual.js"}
]
@ -183,9 +183,9 @@ if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
}, "top.mainFrame",
{
load: [
{ type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
{ type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
{ type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
{ type:"script", id:"_fr1", src:"'.api_get_jquery_web_path().'"},
{ type:"script", id:"_fr4", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/jquery-ui.min.js"},
{ type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_PATH).'web/assets/jquery-ui/themes/smoothness/jquery-ui.min.css"},
{ type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{ type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_automatic.js"}
]
@ -299,7 +299,7 @@ if (!$jplayer_supported && $execute_iframe) {
$htmlHeadXtra[] = '<script type="text/javascript">
<!--
var jQueryFrameReadyConfigPath = \''.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js\';
var jQueryFrameReadyConfigPath = \''.api_get_jquery_web_path().'\';
-->
</script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js"></script>';

@ -1,160 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Juan Carlos Raña Trabado (herodoto@telefonica.net)
*
* @package chamilo.document
*/
/**
* Code
*/
/* INITIALIZATION */
$language_file[] = 'document';
require_once '../inc/global.inc.php';
// Protection
api_protect_course_script();
$noPHP_SELF = true;
$header_file = Security::remove_XSS($_GET['file']);
$document_id = intval($_GET['id']);
$course_info = api_get_course_info();
$course_code = api_get_course_id();
if (empty($course_info)) {
api_not_allowed(true);
}
//Generate path
if (!$document_id) {
$document_id = DocumentManager::get_document_id($course_info, $header_file);
}
$document_data = DocumentManager::get_document_data_by_id($document_id, $course_code);
if (empty($document_data)) {
api_not_allowed(true);
}
$header_file = $document_data['path'];
$name_to_show = cut($header_file, 80);
$path_array = explode('/', str_replace('\\', '/', $header_file));
$path_array = array_map('urldecode', $path_array);
$header_file = implode('/', $path_array);
$file = Security::remove_XSS(urldecode($document_data['path']));
$file_root = $course_info['path'].'/document'.str_replace('%2F', '/', $file);
$file_url_sys = api_get_path(SYS_COURSE_PATH).$file_root;
$file_url_web = api_get_path(WEB_COURSE_PATH).$file_root;
if (!file_exists($file_url_sys)) {
api_not_allowed(true);
}
if (is_dir($file_url_sys)) {
api_not_allowed(true);
}
//fix the screen when you try to access a protected course through the url
$is_allowed_in_course = $_SESSION ['is_allowed_in_course'];
if ($is_allowed_in_course == false) {
api_not_allowed(true);
}
// Check user visibility
$is_visible = DocumentManager::check_visibility_tree(
$document_id,
api_get_course_id(),
api_get_session_id(),
api_get_user_id(),
api_get_group_id()
);
if (!api_is_allowed_to_edit() && !$is_visible) {
api_not_allowed(true);
}
//TODO:clean all code
/* Main section */
header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
//header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Last-Modified: Wed, 01 Jan 2100 00:00:00 GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
$browser_display_title = 'Documents - '.Security::remove_XSS($_GET['cidReq']).' - '.$file;
$js_glossary_in_documents = '';
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$js_glossary_in_documents = '
$.frameReady(function() {
// $("<div>I am a div courses</div>").prependTo("body");
}, "mainFrame",
{ load: [
{type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
{type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_manual.js"}
]
}
);
';
} elseif (api_get_setting('show_glossary_in_documents') == 'isautomatic') {
$js_glossary_in_documents = '
$.frameReady(function(){
// $("<div>I am a div courses</div>").prependTo("body");
}, "mainFrame",
{ load: [
{type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
{type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/ckeditor/plugins/glossary/fck_glossary_automatic.js"}
]
});
';
}
$htmlHeadXtra[] = '<script type="text/javascript">
<!--
var jQueryFrameReadyConfigPath = \''.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js\';
-->
</script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js"></script>';
$htmlHeadXtra[] = '
<script type="text/javascript">
var updateContentHeight = function() {
my_iframe = document.getElementById("mainFrame");
new_height = my_iframe.contentWindow.document.body.scrollHeight;
my_iframe.height = my_iframe.contentWindow.document.body.scrollHeight + "px";
};
// Fixes the content height of the frame
window.onload = function() {
updateContentHeight();
'.$js_glossary_in_documents.'
}
</script>';
Display::display_reduced_header();
echo '<div align="center">';
$file_url_web = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$header_file.'?'.api_get_cidreq();
$pathinfo = pathinfo($header_file);
if ($pathinfo['extension']=='wav' && preg_match('/_chnano_.wav/i', $file_url_web) && api_get_setting('enable_nanogong') == 'true'){
echo '<div align="center">';
echo '<br/>';
echo '<applet id="applet" archive="../inc/lib/nanogong/nanogong.jar" code="gong.NanoGong" width="160" height="95" >';
echo '<param name="SoundFileURL" value="'.$file_url_web.'" />';
echo '<param name="ShowSaveButton" value="false" />';
echo '<param name="ShowTime" value="true" />';
echo '<param name="ShowRecordButton" value="false" />';
echo '</applet>';
echo '</div>';
} else {
if ($pathinfo['extension']=='swf'){ $width='83%'; $height='83%';} else {$width='100%'; $height='';}
echo '<iframe border="0" frameborder="0" scrolling="no" style="width:'.$width.'; height:'.$height.';background-color:#ffffff;" id="mainFrame" name="mainFrame" src="'.$file_url_web.'&amp;rand='.mt_rand(1, 10000).'"></iframe>';
}

@ -6404,6 +6404,13 @@ function api_get_js($file) {
return '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$file.'"></script>'."\n";
}
/**
* Returns the <script> HTML tag
*/
function api_get_asset($file) {
return '<script type="text/javascript" src="'.api_get_path(WEB_PATH).'web/assets/'.$file.'"></script>'."\n";
}
/**
* Returns the <link> HTML tag
*/
@ -6415,9 +6422,19 @@ function api_get_css($file, $media = 'screen') {
* Returns the js header to include the jquery library
*/
function api_get_jquery_js() {
return api_get_js('jquery.min.js');
return api_get_asset('jquery/dist/jquery.min.js');
}
/**
* Returns the jquery path
* @return string
*/
function api_get_jquery_web_path() {
return api_get_path(WEB_PATH).'web/assets/jquery/dist/jquery.min.js';
}
/**
* Returns the jquery-ui library js headers
* @param bool add the jqgrid library
@ -6452,20 +6469,6 @@ function api_get_jquery_libraries_js($libraries) {
$js = '';
$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
//jquery-ui js and css
if (in_array('jquery-ui', $libraries)) {
//Jquery ui
//$theme = 'smoothness'; // Current themes: cupertino, smoothness, ui-lightness. Find the themes folder in main/inc/lib/javascript/jquery-ui
$js .= api_get_css($js_path.'jquery-ui/jquery-ui.css');
$js .= api_get_css($js_path.'jquery-ui/jquery-ui.theme.css');
$js .= api_get_js('jquery-ui/jquery-ui.min.js');
}
if (in_array('jquery-ui-i18n', $libraries)) {
//$js .= api_get_js('jquery-ui/jquery-ui-i18n.min.js');
}
//jqgrid js and css
if (in_array('jqgrid', $libraries)) {
$languaje = 'en';

@ -52,7 +52,7 @@ $style .='</style>';
?>
<!doctype html>
<?php echo api_get_js('jquery.min.js'); ?>
<?php echo api_get_jquery_js(); ?>
<?php echo $style ?>
<body>
<?php

@ -51,7 +51,7 @@ $style .='</style>';
?>
<!doctype html>
<?php echo api_get_js('jquery.min.js'); ?>
<?php echo api_get_jquery_js(); ?>
<?php echo $style ?>
<body>
<?php

@ -39,7 +39,7 @@ $style .='</style>';
?>
<!doctype html>
<?php echo api_get_js('jquery.min.js'); ?>
<?php echo api_get_jquery_js(); ?>
<?php echo $style ?>
<body>

@ -26,7 +26,7 @@ if (!isset($_SESSION['draw_dir'])) {
<link rel="stylesheet" href="svg-editor.css" type="text/css"/>
<link rel="stylesheet" href="custom.css" type="text/css"/>
<link rel="stylesheet" href="spinbtn/JQuerySpinBtn.css" type="text/css"/>
<?php echo api_get_js('jquery.min.js'); ?>
<?php echo api_get_jquery_js(); ?>
<script src="js-hotkeys/jquery.hotkeys.min.js"></script>
<script src="jquerybbq/jquery.bbq.min.js"></script>

@ -474,7 +474,20 @@ class Template
}
// Default CSS Bootstrap
$css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'bootstrap.css');
$bowerCSSFiles = [
'bootstrap/dist/css/bootstrap.min.css',
'bootstrap-daterangepicker/daterangepicker-bs3.css',
'fontawesome/css/font-awesome.min.css',
'jquery-ui/themes/smoothness/jquery-ui.min.css',
'jquery-ui/themes/smoothness/theme.css',
'mediaelement/build/mediaelementplayer.min.css',
];
foreach ($bowerCSSFiles as $file) {
$css[] = api_get_path(WEB_PATH).'web/assets/'.$file;
}
// Base CSS
$css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'base.css');
@ -486,10 +499,6 @@ class Template
$css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chat/css/chat.css';
}
$css[] = api_get_path(WEB_CSS_PATH).'font-awesome.css';
$css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/mediaelement/mediaelementplayer.css';
$css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/daterange/daterangepicker-bs3.css';
//THEME CSS STYLE
// $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'responsive.css');
// $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/default.css');
@ -552,14 +561,12 @@ class Template
//JS files
$js_files = array(
'modernizr.js',
'jquery.min.js',
'fullcalendar/lib/moment.min.js',
'daterange/daterangepicker.js',
//'jquery.min.js',
//'fullcalendar/lib/moment.min.js',
//'daterange/daterangepicker.js',
'chosen/chosen.jquery.min.js',
'thickbox.js',
'bootstrap/bootstrap.js',
'mediaelement/mediaelement-and-player.min.js'
//'mediaelement/mediaelement-and-player.min.js'
);
if (api_is_global_chat_enabled()) {
@ -579,13 +586,29 @@ class Template
$js_file_to_string = null;
foreach ($js_files as $js_file) {
$js_file_to_string .= api_get_js($js_file);
$bowerJsFiles = [
'modernizr/modernizr.js',
'jquery/dist/jquery.min.js',
'jquery-ui/jquery-ui.min.js',
'bootstrap/dist/js/bootstrap.min.js',
'ckeditor/ckeditor.js',
'bootstrap-daterangepicker/daterangepicker.js',
'jquery-timeago/jquery.timeago.js',
'moment/min/moment-with-locales.min.js',
'mediaelement/build/mediaelement-and-player.min.js'
];
foreach ($bowerJsFiles as $file) {
$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PATH).'web/assets/'.$file.'"></script>';
}
// @todo fix this path
$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PATH).'vendor/ckeditor/ckeditor/ckeditor.js"></script>';
//Loading email_editor js
foreach ($js_files as $file) {
$js_file_to_string .= api_get_js($file);
}
// Loading email_editor js
if (!api_is_anonymous() && api_get_setting('allow_email_editor') == 'true') {
$js_file_to_string .= $this->fetch('default/mail_editor/email_link.js.tpl');
}

@ -44,7 +44,7 @@ if ($showGlossary) {
) {
$htmlHeadXtra[] = '<script>
<!--
var jQueryFrameReadyConfigPath = \'' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.min.js\';
var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path() . '\';
-->
</script>';
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';

@ -491,7 +491,7 @@ if ($is_allowed_to_edit) {
// $("<div>I am a div courses</div>").prependTo("body");
}, "top.content_name",
{ load: [
{ type:"script", id:"_fr1", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.min.js"},
{ type:"script", id:"_fr1", src:"<?php echo api_get_jquery_web_path(); ?>"},
{ type:"script", id:"_fr4", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
{ type:"stylesheet", id:"_fr5", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
{ type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"}
@ -504,7 +504,7 @@ if ($is_allowed_to_edit) {
"top.content_name",
{
load: [
{ type:"script", id:"_fr1", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.min.js"},
{ type:"script", id:"_fr1", src:"<?php echo api_get_jquery_web_path(); ?>"},
{ type:"script", id:"_fr4", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
{ type:"stylesheet", id:"_fr5", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
{ type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"}

Loading…
Cancel
Save