Prevent script errors when running in enterprise mode
authorAlexander Ebert <ebert@woltlab.com>
Sat, 29 Feb 2020 23:32:30 +0000 (00:32 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 29 Feb 2020 23:32:30 +0000 (00:32 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Option/EmailSmtpTest.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Option/RewriteGenerator.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Option/RewriteTest.js

index 369976e20cd2172639332f2a46da65c421869fda..7ba57071115aa2a41dd071ac787ad17263823d21 100644 (file)
@@ -7,12 +7,17 @@ define(['Ajax', 'Core', 'Language'], function(Ajax, Core, Language) {
        return {
                init: function () {
                        var smtpCheckbox = null;
-                       elBySelAll('input[name="values[mail_send_method]"]', undefined, (function (radioCheckbox) {
+                       var methods = elBySelAll('input[name="values[mail_send_method]"]', undefined, (function (radioCheckbox) {
                                radioCheckbox.addEventListener('change', this._onChange.bind(this));
                                
                                if (radioCheckbox.value === 'smtp') smtpCheckbox = radioCheckbox;
                        }).bind(this));
                        
+                       // This configuration part is unavailable when running in enterprise mode.
+                       if (methods.length === 0) {
+                               return;
+                       }
+                       
                        Core.triggerEvent(smtpCheckbox, 'change');
                },
                
index d9258d45cbb924c2fb10e2fd765887bbf97bfdd6..128da693fe53b39018348eb77877201b3a3b4364 100644 (file)
@@ -20,6 +20,13 @@ define(['Ajax', 'Language', 'Ui/Dialog'], function (Ajax, Language, UiDialog) {
                 * Initializes the generator for rewrite rules
                 */
                init: function () {
+                       var urlOmitIndexPhp = elById('url_omit_index_php');
+                       
+                       // This configuration part is unavailable when running in enterprise mode.
+                       if (urlOmitIndexPhp === null) {
+                               return;
+                       }
+                       
                        _container = elCreate('dl');
                        var dt = elCreate('dt');
                        dt.classList.add('jsOnly');
@@ -38,7 +45,7 @@ define(['Ajax', 'Language', 'Ui/Dialog'], function (Ajax, Language, UiDialog) {
                        _container.appendChild(dt);
                        _container.appendChild(dd);
 
-                       var insertAfter = elById('url_omit_index_php').closest('dl');
+                       var insertAfter = urlOmitIndexPhp.closest('dl');
                        insertAfter.parentNode.insertBefore(_container, insertAfter.nextSibling);
                },
 
index fd364b9339fb756af386b12c5e86ab51cbdabe34..604ef9df451ecaeb8c1747dc95507cdf536d0b5f 100644 (file)
@@ -27,6 +27,11 @@ define(['AjaxRequest', 'Language', 'Ui/Dialog'], function (AjaxRequest, Language
                 * @param       {Dictionary}    apps
                 */
                init: function (apps) {
+                       // This configuration part is unavailable when running in enterprise mode.
+                       if (_option === null) {
+                               return;
+                       }
+                       
                        if (_option.checked) {
                                // option is already enabled, ignore it
                                return;