[BUGFIX] Reload backend module menu after extension configuration change 33/61933/4
authorFrank Naegler <frank.naegler@typo3.org>
Wed, 9 Oct 2019 10:15:51 +0000 (12:15 +0200)
committerSusanne Moog <look@susi.dev>
Thu, 10 Oct 2019 09:19:40 +0000 (11:19 +0200)
Resolves: #83713
Releases: master, 9.5
Change-Id: I407d179f2354e97c79112c122e46c8f39804ef37
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61933
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Sascha Rademacher <sascha.rademacher+typo3@gmail.com>
Tested-by: Jörg Bösche <typo3@joergboesche.de>
Tested-by: Susanne Moog <look@susi.dev>
Reviewed-by: Sascha Rademacher <sascha.rademacher+typo3@gmail.com>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Susanne Moog <look@susi.dev>
Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/ExtensionConfiguration.ts
typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/ExtensionConfiguration.js
typo3/sysext/install/Resources/Public/JavaScript/RequireJSConfig.js

index 1e08430..f4120e4 100644 (file)
@@ -17,6 +17,7 @@ import 'bootstrap';
 import '../../Renderable/Clearable';
 import Router = require('../../Router');
 import Notification = require('TYPO3/CMS/Backend/Notification');
+import ModuleMenu = require('TYPO3/CMS/Backend/ModuleMenu');
 
 /**
  * Module: TYPO3/CMS/Install/Module/ExtensionConfiguration
@@ -121,6 +122,9 @@ class ExtensionConfiguration extends AbstractInteractableModule {
           data.status.forEach((element: any): void => {
             Notification.showMessage(element.title, element.message, element.severity);
           });
+          if ($('body').data('context') === 'backend') {
+            ModuleMenu.App.refreshMenu();
+          }
         } else {
           Notification.error('Something went wrong');
         }
index 388d75a..1dafb96 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","../AbstractInteractableModule","jquery","../../Router","TYPO3/CMS/Backend/Notification","bootstrap","../../Renderable/Clearable"],function(t,e,a,r,s,i){"use strict";return new class extends a.AbstractInteractableModule{constructor(){super(...arguments),this.selectorFormListener=".t3js-extensionConfiguration-form",this.selectorSearchInput=".t3js-extensionConfiguration-search"}initialize(t){this.currentModal=t,this.getContent(),t.on("keydown",e=>{const a=t.find(this.selectorSearchInput);e.ctrlKey||e.metaKey?"f"===String.fromCharCode(e.which).toLowerCase()&&(e.preventDefault(),a.focus()):27===e.keyCode&&(e.preventDefault(),a.val("").focus())}),t.on("keyup",this.selectorSearchInput,e=>{const a=r(e.target).val(),s=t.find(this.selectorSearchInput);t.find(".search-item").each((t,e)=>{const s=r(e);r(":contains("+a+")",s).length>0||r('input[value*="'+a+'"]',s).length>0?s.removeClass("hidden").addClass("searchhit"):s.removeClass("searchhit").addClass("hidden")}),t.find(".searchhit").collapse("show");const i=s.get(0);i.clearable(),i.focus()}),t.on("submit",this.selectorFormListener,t=>{t.preventDefault(),this.write(r(t.currentTarget))})}getContent(){const t=this.getModalBody();r.ajax({url:s.getUrl("extensionConfigurationGetContent"),cache:!1,success:e=>{!0===e.success&&(Array.isArray(e.status)&&e.status.forEach(t=>{i.success(t.title,t.message)}),t.html(e.html),this.initializeWrap())},error:e=>{s.handleAjaxError(e,t)}})}write(t){const e=this.getModalBody(),a=this.getModuleContent().data("extension-configuration-write-token"),n={};r.each(t.serializeArray(),(t,e)=>{n[e.name]=e.value}),r.ajax({url:s.getUrl(),method:"POST",data:{install:{token:a,action:"extensionConfigurationWrite",extensionKey:t.attr("data-extensionKey"),extensionConfiguration:n}},success:t=>{!0===t.success&&Array.isArray(t.status)?t.status.forEach(t=>{i.showMessage(t.title,t.message,t.severity)}):i.error("Something went wrong")},error:t=>{s.handleAjaxError(t,e)}}).always(()=>{})}initializeWrap(){this.findInModal(".t3js-emconf-offset").each((t,e)=>{const a=r(e),s=a.parent(),i=a.attr("id"),n=a.attr("value").split(",");a.attr("data-offsetfield-x","#"+i+"_offset_x").attr("data-offsetfield-y","#"+i+"_offset_y").wrap('<div class="hidden"></div>');const o=r("<div>",{class:"form-multigroup-item"}).append(r("<div>",{class:"input-group"}).append(r("<div>",{class:"input-group-addon"}).text("x"),r("<input>",{id:i+"_offset_x",class:"form-control t3js-emconf-offsetfield","data-target":"#"+i,value:r.trim(n[0])}))),d=r("<div>",{class:"form-multigroup-item"}).append(r("<div>",{class:"input-group"}).append(r("<div>",{class:"input-group-addon"}).text("y"),r("<input>",{id:i+"_offset_y",class:"form-control t3js-emconf-offsetfield","data-target":"#"+i,value:r.trim(n[1])}))),l=r("<div>",{class:"form-multigroup-wrap"}).append(o,d);s.append(l),s.find(".t3js-emconf-offsetfield").keyup(t=>{const e=s.find(r(t.currentTarget).data("target"));e.val(s.find(e.data("offsetfield-x")).val()+","+s.find(e.data("offsetfield-y")).val())})}),this.findInModal(".t3js-emconf-wrap").each((t,e)=>{const a=r(e),s=a.parent(),i=a.attr("id"),n=a.attr("value").split("|");a.attr("data-wrapfield-start","#"+i+"_wrap_start").attr("data-wrapfield-end","#"+i+"_wrap_end").wrap('<div class="hidden"></div>');const o=r("<div>",{class:"form-multigroup-wrap"}).append(r("<div>",{class:"form-multigroup-item"}).append(r("<input>",{id:i+"_wrap_start",class:"form-control t3js-emconf-wrapfield","data-target":"#"+i,value:r.trim(n[0])})),r("<div>",{class:"form-multigroup-item"}).append(r("<input>",{id:i+"_wrap_end",class:"form-control t3js-emconf-wrapfield","data-target":"#"+i,value:r.trim(n[1])})));s.append(o),s.find(".t3js-emconf-wrapfield").keyup(t=>{const e=s.find(r(t.currentTarget).data("target"));e.val(s.find(e.data("wrapfield-start")).val()+"|"+s.find(e.data("wrapfield-end")).val())})})}}});
\ No newline at end of file
+define(["require","exports","../AbstractInteractableModule","jquery","../../Router","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Backend/ModuleMenu","bootstrap","../../Renderable/Clearable"],function(t,e,a,r,s,n,i){"use strict";return new class extends a.AbstractInteractableModule{constructor(){super(...arguments),this.selectorFormListener=".t3js-extensionConfiguration-form",this.selectorSearchInput=".t3js-extensionConfiguration-search"}initialize(t){this.currentModal=t,this.getContent(),t.on("keydown",e=>{const a=t.find(this.selectorSearchInput);e.ctrlKey||e.metaKey?"f"===String.fromCharCode(e.which).toLowerCase()&&(e.preventDefault(),a.focus()):27===e.keyCode&&(e.preventDefault(),a.val("").focus())}),t.on("keyup",this.selectorSearchInput,e=>{const a=r(e.target).val(),s=t.find(this.selectorSearchInput);t.find(".search-item").each((t,e)=>{const s=r(e);r(":contains("+a+")",s).length>0||r('input[value*="'+a+'"]',s).length>0?s.removeClass("hidden").addClass("searchhit"):s.removeClass("searchhit").addClass("hidden")}),t.find(".searchhit").collapse("show");const n=s.get(0);n.clearable(),n.focus()}),t.on("submit",this.selectorFormListener,t=>{t.preventDefault(),this.write(r(t.currentTarget))})}getContent(){const t=this.getModalBody();r.ajax({url:s.getUrl("extensionConfigurationGetContent"),cache:!1,success:e=>{!0===e.success&&(Array.isArray(e.status)&&e.status.forEach(t=>{n.success(t.title,t.message)}),t.html(e.html),this.initializeWrap())},error:e=>{s.handleAjaxError(e,t)}})}write(t){const e=this.getModalBody(),a=this.getModuleContent().data("extension-configuration-write-token"),o={};r.each(t.serializeArray(),(t,e)=>{o[e.name]=e.value}),r.ajax({url:s.getUrl(),method:"POST",data:{install:{token:a,action:"extensionConfigurationWrite",extensionKey:t.attr("data-extensionKey"),extensionConfiguration:o}},success:t=>{!0===t.success&&Array.isArray(t.status)?(t.status.forEach(t=>{n.showMessage(t.title,t.message,t.severity)}),"backend"===r("body").data("context")&&i.App.refreshMenu()):n.error("Something went wrong")},error:t=>{s.handleAjaxError(t,e)}}).always(()=>{})}initializeWrap(){this.findInModal(".t3js-emconf-offset").each((t,e)=>{const a=r(e),s=a.parent(),n=a.attr("id"),i=a.attr("value").split(",");a.attr("data-offsetfield-x","#"+n+"_offset_x").attr("data-offsetfield-y","#"+n+"_offset_y").wrap('<div class="hidden"></div>');const o=r("<div>",{class:"form-multigroup-item"}).append(r("<div>",{class:"input-group"}).append(r("<div>",{class:"input-group-addon"}).text("x"),r("<input>",{id:n+"_offset_x",class:"form-control t3js-emconf-offsetfield","data-target":"#"+n,value:r.trim(i[0])}))),d=r("<div>",{class:"form-multigroup-item"}).append(r("<div>",{class:"input-group"}).append(r("<div>",{class:"input-group-addon"}).text("y"),r("<input>",{id:n+"_offset_y",class:"form-control t3js-emconf-offsetfield","data-target":"#"+n,value:r.trim(i[1])}))),l=r("<div>",{class:"form-multigroup-wrap"}).append(o,d);s.append(l),s.find(".t3js-emconf-offsetfield").keyup(t=>{const e=s.find(r(t.currentTarget).data("target"));e.val(s.find(e.data("offsetfield-x")).val()+","+s.find(e.data("offsetfield-y")).val())})}),this.findInModal(".t3js-emconf-wrap").each((t,e)=>{const a=r(e),s=a.parent(),n=a.attr("id"),i=a.attr("value").split("|");a.attr("data-wrapfield-start","#"+n+"_wrap_start").attr("data-wrapfield-end","#"+n+"_wrap_end").wrap('<div class="hidden"></div>');const o=r("<div>",{class:"form-multigroup-wrap"}).append(r("<div>",{class:"form-multigroup-item"}).append(r("<input>",{id:n+"_wrap_start",class:"form-control t3js-emconf-wrapfield","data-target":"#"+n,value:r.trim(i[0])})),r("<div>",{class:"form-multigroup-item"}).append(r("<input>",{id:n+"_wrap_end",class:"form-control t3js-emconf-wrapfield","data-target":"#"+n,value:r.trim(i[1])})));s.append(o),s.find(".t3js-emconf-wrapfield").keyup(t=>{const e=s.find(r(t.currentTarget).data("target"));e.val(s.find(e.data("wrapfield-start")).val()+"|"+s.find(e.data("wrapfield-end")).val())})})}}});
\ No newline at end of file
index 1c199fd..ba71efa 100644 (file)
@@ -9,7 +9,8 @@ var require = {
     'jquery.clearable': 'sysext/backend/Resources/Public/JavaScript/jquery.clearable',
     'TYPO3/CMS/Core/Contrib/jquery.minicolors': 'sysext/core/Resources/Public/JavaScript/Contrib/jquery.minicolors',
     'bootstrap': 'sysext/core/Resources/Public/JavaScript/Contrib/bootstrap/bootstrap',
-    'chosen': 'sysext/install/Resources/Public/JavaScript/chosen.jquery.min'
+    'chosen': 'sysext/install/Resources/Public/JavaScript/chosen.jquery.min',
+    'nprogress': 'sysext/core/Resources/Public/JavaScript/Contrib/nprogress'
   },
   shim: {
     jQuery: {