Skip to content

Commit

Permalink
MDL-71704 lib: Set Moodle files after JQuery upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
sarjona committed Jan 11, 2022
1 parent efea732 commit f667bdf
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
6 changes: 3 additions & 3 deletions lib/jquery/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/

$plugins = array(
'jquery' => array('files' => array('jquery-3.5.1.min.js')),
'ui' => array('files' => array('ui-1.12.1/jquery-ui.min.js')),
'ui-css' => array('files' => array('ui-1.12.1/theme/smoothness/jquery-ui.min.css')),
'jquery' => array('files' => array('jquery-3.6.0.min.js')),
'ui' => array('files' => array('ui-1.13.0/jquery-ui.min.js')),
'ui-css' => array('files' => array('ui-1.13.0/theme/smoothness/jquery-ui.min.css')),
);
26 changes: 16 additions & 10 deletions lib/jquery/readme_moodle.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
Description of import of various jQuery libraries into Moodle:

1/ download jQuery JS from http://jquery.com/download/,
delete old files and edit plugins.php and lib/requirejs/moodle-config.js

2/ download jQuery UI files from http://jqueryui.com/download/all/,
delete old files and edit plugins.php and lib/requirejs/moodle-config.js
1/ Download compressed and uncompressed jQuery JS from http://jquery.com/download/,
copy the new version of the jquery-X.Y.Z.js and jquery-X.Y.Z.min.js files
delete old files
edit plugins.php and lib/requirejs/moodle-config.js

2/ Download jQuery UI files from http://jqueryui.com/download/all/,
copy the folder ui-A.B.C, with the new version of the JQuery UI library
delete old files
edit plugins.php and lib/requirejs/moodle-config.js
delete unnecessary files: external folder, index.html, AUTHORS.txt, package.json

3/ download all UI themes and update smoothness theme
3/ Download all UI themes,
create the theme folder into ui-A.B.C
copy the smoothness theme

4/ Update the version of jquery in core_privacy\local\request\moodle_content_writer::write_html_data() and privacy/templates/htmlpage.mustache.

4/ run phpunit tests
5/ Run phpunit tests

5/ open http://127.0.0.1/lib/tests/other/jquerypage.php
6/ Open http://127.0.0.1/lib/tests/other/jquerypage.php

6/ Update the version of jquery in core_privacy\local\request\moodle_content_writer::write_html_data()

Petr Skoda

Note: jQuery.trim() function and :first pseudo-class are deprecated. We use String.prototype.trim() and .first()
in Moodle code instead. Please note that in third party libraries there are still usages of jQuery.trim
Expand Down
4 changes: 2 additions & 2 deletions lib/requirejs/moodle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ var require = {
waitSeconds : 0,

paths: {
jquery: '[JSURL]lib/jquery/jquery-3.5.1[JSMIN][JSEXT]',
jqueryui: '[JSURL]lib/jquery/ui-1.12.1/jquery-ui[JSMIN][JSEXT]',
jquery: '[JSURL]lib/jquery/jquery-3.6.0[JSMIN][JSEXT]',
jqueryui: '[JSURL]lib/jquery/ui-1.13.0/jquery-ui[JSMIN][JSEXT]',
jqueryprivate: '[JSURL]lib/requirejs/jquery-private[JSEXT]'
},

Expand Down
4 changes: 2 additions & 2 deletions lib/thirdpartylibs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@
<location>jquery</location>
<name>jQuery</name>
<license>MIT</license>
<version>3.5.1</version>
<version>3.6.0</version>
<licenseversion></licenseversion>
</library>
<library>
<location>jquery</location>
<name>jQuery UI</name>
<license>MIT</license>
<version>1.12.1</version>
<version>1.13.0</version>
<licenseversion></licenseversion>
</library>
<library>
Expand Down
4 changes: 2 additions & 2 deletions privacy/classes/local/request/moodle_content_writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ protected function write_html_data() {
$targetpath = ['js', 'general.js'];
$this->copy_data($jspath, $targetpath);

$jquery = ['lib', 'jquery', 'jquery-3.5.1.min.js'];
$jquerydestination = ['js', 'jquery-3.5.1.min.js'];
$jquery = ['lib', 'jquery', 'jquery-3.6.0.min.js'];
$jquerydestination = ['js', 'jquery-3.6.0.min.js'];
$this->copy_data($jquery, $jquerydestination);

$requirecurrentpath = ['lib', 'requirejs', 'require.min.js'];
Expand Down
4 changes: 2 additions & 2 deletions privacy/templates/htmlpage.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<div data-main-content class="jumbotron bg-light border">
<h2 class="display-8">{{#str}}viewdata, core_privacy{{/str}}</h2>
</div>
<script src="js/jquery-3.5.1.min.js"></script>
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/data_index.js"></script>
<script src="js/general.js"></script>
<script src="js/require.min.js"></script>
Expand All @@ -74,7 +74,7 @@
"baseUrl": "./",
"paths": {
"app": "./",
"jquery": "./js/jquery-3.5.1.min",
"jquery": "./js/jquery-3.6.0.min",
"core/tree": "./js/tree.min"
}
});
Expand Down

0 comments on commit f667bdf

Please sign in to comment.