Commit 2209a8f2 authored by Andreas Fernandez's avatar Andreas Fernandez
Browse files

[BUGFIX] Fix querying form element when clicking "Install" button

Resolves: #88226
Related: #88040
Releases: master
Change-Id: Ie8726b689362119a3d4d087582b3be2cb2b86e4b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60572

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 0feb1eec
......@@ -79,8 +79,9 @@ class Repository {
installButtons.on('click', (event: JQueryEventObject): void => {
event.preventDefault();
const $element: any = $(event.currentTarget);
const url = $($element.form).attr('data-href');
this.downloadPath = $($element.form).find('input.downloadPath:checked').val();
const $form = $element.closest('form');
const url = $form.attr('data-href');
this.downloadPath = $form.find('input.downloadPath:checked').val();
$.ajax({
url: url,
dataType: 'json',
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports","jquery","nprogress","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Backend/Severity","datatables","TYPO3/CMS/Backend/jquery.clearable"],function(e,n,t,a,o,s,r){"use strict";return function(){function e(){var e=this;this.downloadPath="",this.initDom=function(){a.configure({parent:".module-loading-indicator",showSpinner:!1}),t("#terTable").DataTable({lengthChange:!1,pageLength:15,stateSave:!1,info:!1,paging:!1,searching:!1,ordering:!1,drawCallback:e.bindDownload}),t("#terVersionTable").DataTable({lengthChange:!1,pageLength:15,stateSave:!1,info:!1,paging:!1,searching:!1,drawCallback:e.bindDownload,order:[[2,"asc"]],columns:[{orderable:!1},null,{type:"version"},null,null,null]}),t("#terSearchTable").DataTable({paging:!1,lengthChange:!1,stateSave:!1,searching:!1,language:{search:"Filter results:"},ordering:!1,drawCallback:e.bindDownload}),e.bindDownload(),e.bindSearchFieldResetter()},this.bindDownload=function(){var n=t(".downloadFromTer form.download button[type=submit]");n.off("click"),n.on("click",function(n){n.preventDefault();var o=t(n.currentTarget),s=t(o.form).attr("data-href");e.downloadPath=t(o.form).find("input.downloadPath:checked").val(),t.ajax({url:s,dataType:"json",beforeSend:function(){a.start()},success:e.getDependencies})})},this.getDependencies=function(n){return a.done(),n.hasDependencies?o.confirm(n.title,t(n.message),r.info,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:function(){o.dismiss()}},{text:TYPO3.lang["button.resolveDependencies"],btnClass:"btn-info",trigger:function(){e.getResolveDependenciesAndInstallResult(n.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+e.downloadPath),o.dismiss()}}]):n.hasErrors?s.error(n.title,n.message,15):e.getResolveDependenciesAndInstallResult(n.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+e.downloadPath),!1},this.getResolveDependenciesAndInstallResult=function(n){t.ajax({url:n,dataType:"json",beforeSend:function(){a.start()},success:function(n){if(n.errorCount>0)o.confirm(n.errorTitle,t(n.errorMessage),r.error,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:function(){o.dismiss()}},{text:TYPO3.lang["button.resolveDependenciesIgnore"],btnClass:"btn-danger disabled t3js-dependencies",trigger:function(a){t(a.currentTarget).hasClass("disabled")||(e.getResolveDependenciesAndInstallResult(n.skipDependencyUri),o.dismiss())}}]),o.currentModal.on("shown.bs.modal",function(){var e=o.currentModal.find(".t3js-dependencies");t('input[name="unlockDependencyIgnoreButton"]',o.currentModal).on("change",function(n){e.toggleClass("disabled",!t(n.currentTarget).prop("checked"))})});else{var a=TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.message"+n.installationTypeLanguageKey].replace(/\{0\}/g,n.extension);a+="\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.header"]+": ",t.each(n.result,function(e,n){a+="\n\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.item"]+" "+e+": ",t.each(n,function(e){a+="\n* "+e})}),s.info(TYPO3.lang["extensionList.dependenciesResolveFlashMessage.title"+n.installationTypeLanguageKey].replace(/\{0\}/g,n.extension),a,15),top.TYPO3.ModuleMenu.App.refreshMenu()}},complete:function(){a.done()}})}}return e.prototype.bindSearchFieldResetter=function(){var e=t('.typo3-extensionmanager-searchTerForm input[type="text"]'),n=""!==e.first().val();e.clearable({onClear:function(e){n&&t(e.currentTarget).closest("form").submit()}})},e}()});
\ No newline at end of file
define(["require","exports","jquery","nprogress","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Backend/Severity","datatables","TYPO3/CMS/Backend/jquery.clearable"],function(e,n,t,a,o,s,r){"use strict";return function(){function e(){var e=this;this.downloadPath="",this.initDom=function(){a.configure({parent:".module-loading-indicator",showSpinner:!1}),t("#terTable").DataTable({lengthChange:!1,pageLength:15,stateSave:!1,info:!1,paging:!1,searching:!1,ordering:!1,drawCallback:e.bindDownload}),t("#terVersionTable").DataTable({lengthChange:!1,pageLength:15,stateSave:!1,info:!1,paging:!1,searching:!1,drawCallback:e.bindDownload,order:[[2,"asc"]],columns:[{orderable:!1},null,{type:"version"},null,null,null]}),t("#terSearchTable").DataTable({paging:!1,lengthChange:!1,stateSave:!1,searching:!1,language:{search:"Filter results:"},ordering:!1,drawCallback:e.bindDownload}),e.bindDownload(),e.bindSearchFieldResetter()},this.bindDownload=function(){var n=t(".downloadFromTer form.download button[type=submit]");n.off("click"),n.on("click",function(n){n.preventDefault();var o=t(n.currentTarget).closest("form"),s=o.attr("data-href");e.downloadPath=o.find("input.downloadPath:checked").val(),t.ajax({url:s,dataType:"json",beforeSend:function(){a.start()},success:e.getDependencies})})},this.getDependencies=function(n){return a.done(),n.hasDependencies?o.confirm(n.title,t(n.message),r.info,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:function(){o.dismiss()}},{text:TYPO3.lang["button.resolveDependencies"],btnClass:"btn-info",trigger:function(){e.getResolveDependenciesAndInstallResult(n.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+e.downloadPath),o.dismiss()}}]):n.hasErrors?s.error(n.title,n.message,15):e.getResolveDependenciesAndInstallResult(n.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+e.downloadPath),!1},this.getResolveDependenciesAndInstallResult=function(n){t.ajax({url:n,dataType:"json",beforeSend:function(){a.start()},success:function(n){if(n.errorCount>0)o.confirm(n.errorTitle,t(n.errorMessage),r.error,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:function(){o.dismiss()}},{text:TYPO3.lang["button.resolveDependenciesIgnore"],btnClass:"btn-danger disabled t3js-dependencies",trigger:function(a){t(a.currentTarget).hasClass("disabled")||(e.getResolveDependenciesAndInstallResult(n.skipDependencyUri),o.dismiss())}}]),o.currentModal.on("shown.bs.modal",function(){var e=o.currentModal.find(".t3js-dependencies");t('input[name="unlockDependencyIgnoreButton"]',o.currentModal).on("change",function(n){e.toggleClass("disabled",!t(n.currentTarget).prop("checked"))})});else{var a=TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.message"+n.installationTypeLanguageKey].replace(/\{0\}/g,n.extension);a+="\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.header"]+": ",t.each(n.result,function(e,n){a+="\n\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.item"]+" "+e+": ",t.each(n,function(e){a+="\n* "+e})}),s.info(TYPO3.lang["extensionList.dependenciesResolveFlashMessage.title"+n.installationTypeLanguageKey].replace(/\{0\}/g,n.extension),a,15),top.TYPO3.ModuleMenu.App.refreshMenu()}},complete:function(){a.done()}})}}return e.prototype.bindSearchFieldResetter=function(){var e=t('.typo3-extensionmanager-searchTerForm input[type="text"]'),n=""!==e.first().val();e.clearable({onClear:function(e){n&&t(e.currentTarget).closest("form").submit()}})},e}()});
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment