diff --git a/administrator/components/com_config/forms/application.xml b/administrator/components/com_config/forms/application.xml index d0e14ba0e3a11..152d52be27d08 100644 --- a/administrator/components/com_config/forms/application.xml +++ b/administrator/components/com_config/forms/application.xml @@ -201,6 +201,7 @@ label="COM_CONFIG_FIELD_DATABASE_HOST_LABEL" required="true" filter="string" + onchange="Joomla.resetDbEncryptionFields(this)" size="30" /> @@ -237,6 +238,7 @@ label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_ENABLE_LABEL" default="0" filter="integer" + showon="host!:localhost" > @@ -250,7 +252,7 @@ class="switcher" default="0" filter="boolean" - showon="dbencryption:1,2" + showon="host!:localhost[AND]dbencryption:1,2" > @@ -262,7 +264,7 @@ label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_KEY_LABEL" filter="string" size="250" - showon="dbencryption:2" + showon="host!:localhost[AND]dbencryption:2" /> diff --git a/administrator/components/com_config/tmpl/application/default.php b/administrator/components/com_config/tmpl/application/default.php index d091dd0a64e03..6c29ed5e4f4f9 100644 --- a/administrator/components/com_config/tmpl/application/default.php +++ b/administrator/components/com_config/tmpl/application/default.php @@ -19,6 +19,9 @@ HTMLHelper::_('behavior.formvalidator'); HTMLHelper::_('behavior.keepalive'); +// Load config JS +HTMLHelper::_('script', 'com_config/admin-config-default.js', ['version' => 'auto', 'relative' => true]); + // Load JS message titles Text::script('ERROR'); Text::script('WARNING'); diff --git a/build/media_source/com_config/js/admin-config-default.es6.js b/build/media_source/com_config/js/admin-config-default.es6.js new file mode 100644 index 0000000000000..666d161faeb3f --- /dev/null +++ b/build/media_source/com_config/js/admin-config-default.es6.js @@ -0,0 +1,25 @@ +Joomla = window.Joomla || {}; + +((Joomla) => { + 'use strict'; + + /** + * Method reset DB Encryption fields when localhost is chosen + * + * @param {HTMLElement} element The element that initiates the call + * @returns {void} + * @since 4.0 + */ + Joomla.resetDbEncryptionFields = (element) => { + if (element.value === 'localhost') { + document.getElementById('jform_dbsslverifyservercert0').checked = true; + document.getElementById('jform_dbsslverifyservercert1').checked = false; + document.getElementById('jform_dbsslkey').value = ''; + document.getElementById('jform_dbsslcert').value = ''; + document.getElementById('jform_dbsslca').value = ''; + document.getElementById('jform_dbsslcapath').value = ''; + document.getElementById('jform_dbsslcipher').value = ''; + document.getElementById('jform_dbencryption').value = 0; + } + }; +})(Joomla);