Skip to content

Conversation

@dgrammatiko
Copy link
Contributor

@dgrammatiko dgrammatiko commented Nov 29, 2017

Pull Request for Issue # .

Summary of Changes

For the Joomla update process there are 2 external libraries that are required, one for json parsing and another for encryption (AES).

For Json parsing we are switching from json2 to json3 (It is a drop-in replacement for JSON 2: https://bestiejs.github.io/json3/) because Douglas Crockford turned down our request for publishing json2 to NPM (douglascrockford/JSON-js#92)!

For AES we just bumped the version to the latest available.

And that is the part that takes care of the maintenance of the external scripts, but there is an ongoing work to drop jQuery from all the scripts. The later will be finished by the javascript team, but feel free to help with a PR.

Testing Instructions

Not ready for testing yet!

Expected result

Actual result

Documentation Changes Required

Nope. Housekeeping

Att @Fedik @C-Lodder @dneukirchen @yvesh

defined('_JEXEC') or die;
?>

use Joomla\CMS\HTML\HTMLHelper;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using namespaced classes in layout views?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason not to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure it's fine, I just didn't think we were doing that and sticking with \JHtml, etc, in the layouts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, basically that part needs to go out of core, it' only used in couple places, not needed to be part of the core, core should be just the API

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its fine to use the namespaced classes.

@@ -0,0 +1,10 @@
document.addEventListener('DOMContentLoaded', function(){
Copy link
Member

@C-Lodder C-Lodder Nov 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of the file is incorrect admin-updaDe.js >> admin-update.js

@@ -0,0 +1,10 @@
document.addEventListener('DOMContentLoaded', function(){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add standard comment block at top of the file

el = document.getElementById("loading"),
position = outerDiv.getBoundingClientRect();

el.style.top = position.top;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep as is for now, but I'll redo this so the styling is set via CSS rather than JS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was wondering: we do have a Joomla.loadingLayer method in core, why not using it here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, I'll do that in a separate PR cause even that function needs revisiting

break;
default:
// An error occured -> show unknown error note
html = '<span class="label">' + Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_WARNING_UNKNOWN') + '</span>';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class="label" >> class="badge badge-default". Or maybe throw an alert if you dont want to couple to a BS4 class

}

if (uploadElement) {
uploadElement.addEventListener('change', function(e){
Copy link
Member

@C-Lodder C-Lodder Nov 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to pass the event (e) as we're not using it

var buttonElement= document.querySelector('button.submit');

if (extractElement) {
extractElement.addEventListener('change', function(e){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to pass the event (e) as we're not using it

Copy link
Contributor

@dneukirchen dneukirchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update.js needs refactoring!!!

<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_RECOMMENDED_SETTINGS_DESC'); ?>
</p>
<legend><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_RECOMMENDED_SETTINGS'); ?></legend>
<p><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_RECOMMENDED_SETTINGS_DESC'); ?></p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Text instead of JText

</td>
<td><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_DIRECTIVE'); ?></td>
<td><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_RECOMMENDED'); ?></td>
<td><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_ACTUAL'); ?></td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Text instead of JText

<?php echo JText::_($setting->recommended ? 'JON' : 'JOFF'); ?>
</td>
<td><?php echo $setting->label; ?></td>
<td><?php echo JText::_($setting->recommended ? 'JON' : 'JOFF'); ?></td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Text instead of JText

<td><?php echo JText::_($setting->recommended ? 'JON' : 'JOFF'); ?></td>
<td>
<span class="label label-<?php echo ($setting->state === $setting->recommended) ? 'success' : 'warning'; ?>">
<?php echo JText::_($setting->state ? 'JON' : 'JOFF'); ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Text instead of JText

<legend>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS'); ?>
</legend>
<legend><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS'); ?></legend>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Text instead of JText

<td>
<?php echo JText::_($extension->name); ?>
</td>
<td><?php echo JText::_($extension->name); ?></td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Text instead of JText

var form = document.getElementById("uploadForm");

// do field validation
if (form.install_package.value == "") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS: strict comparison, === over ==? Not sure about this in joomla context.


// do field validation
if (form.install_package.value == "") {
alert(Joomla.JText._('COM_INSTALLER_MSG_INSTALL_PLEASE_SELECT_A_PACKAGE'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should rename Joomla.JText to Joomla.Text to align it with the backend.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to make a bc layer here, otherwise you will then break a lot of extensions.

Copy link
Contributor Author

@dgrammatiko dgrammatiko Dec 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @param {function} callback
*/
PreUpdateChecker.checkCompatibility = function ($extension, callback) {
PreUpdateChecker.checkCompatibility = function (extension, callback) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS: shadowed variable extension.

this may lead to errors. (see below)

$.getJSON(PreUpdateChecker.config.serverUrl, {
'joomla-target-version': PreUpdateChecker.joomlaTargetVersion,
'extension-id': $extension.data('extensionId')
'extension-id': extension.data('extensionId')
Copy link
Contributor

@dneukirchen dneukirchen Nov 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you are referencing the shadowed variable, but data is not a function.

@dgrammatiko
Copy link
Contributor Author

Joomla cannot use npm for the aes script. Another solution needed here

@dgrammatiko dgrammatiko mentioned this pull request Jan 23, 2021
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants