Commit 2a09a4a9 authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Susanne Moog
Browse files

[BUGFIX] Do not open EditDocumentController in modal

If `mod.web_layout.disableNewContentElementWizard=1` is set, the
"New Content Element" wizard is skipped and EditDocumentController's
FormEngine is called directly.

In that case, the modal must not get opened as this doesn't work in
combination with FormEngine.

Resolves: #88075
Releases: master, 9.5
Change-Id: Idada95f426496b49131463ec1d0e8462df163e70
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60627


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Joerg Kummer's avatarJoerg Kummer <typo3@enobe.de>
Tested-by: default avatarGuido Schmechel <guido.schmechel@brandung.de>
Tested-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
parent 45501703
......@@ -228,8 +228,10 @@ class PageActions {
*/
private initializeNewContentElementWizard(): void {
$(IdentifierEnum.newButton).click((e: JQueryEventObject): void => {
e.preventDefault();
const $me = $(e.currentTarget);
NewContentElement.wizard($me.data('url'), $me.data('title'));
NewContentElement.wizard($me.attr('href'), $me.data('title'));
});
}
}
......
......@@ -224,19 +224,7 @@ class NewRecordController
// Setting up the context sensitive menu:
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ContextMenu');
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip');
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/Wizard/NewContentElement',
'function(NewContentElement) {
require([\'jquery\'], function($) {
$(function() {
$(\'.t3js-toggle-new-content-element-wizard\').click(function() {
var $me = $(this);
NewContentElement.wizard($me.data(\'url\'), $me.data(\'title\'));
});
});
});
}'
);
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/PageActions');
// Creating content
$this->content = '';
$this->content .= '<h1>'
......@@ -573,7 +561,7 @@ class NewRecordController
$url = (string)$uriBuilder->buildUriFromRoute($moduleName, ['id' => $this->id, 'returnUrl' => $normalizedParams->getRequestUri()]);
$rowContent .= '<li>' . $newLink . ' ' . BackendUtility::wrapInHelp($table, '') . '</li>'
. '<li>'
. '<a href="#" data-url="' . htmlspecialchars($url) . '" data-title="' . htmlspecialchars($this->getLanguageService()->getLL('newContentElement')) . '" class="t3js-toggle-new-content-element-wizard">'
. '<a href="' . htmlspecialchars($url) . '" data-title="' . htmlspecialchars($this->getLanguageService()->getLL('newContentElement')) . '" class="t3js-toggle-new-content-element-wizard">'
. $newContentIcon . htmlspecialchars($lang->getLL('clickForWizard'))
. '</a>'
. '</li>'
......
......@@ -957,10 +957,10 @@ class PageLayoutView implements LoggerAwareInterface
$url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
}
$title = htmlspecialchars($this->getLanguageService()->getLL('newContentElement'));
$link = '<a href="#" data-url="' . htmlspecialchars($url) . '" '
$link = '<a href="' . htmlspecialchars($url) . '" '
. 'title="' . $title . '"'
. 'data-title="' . $title . '"'
. 'class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard">'
. 'class="btn btn-default btn-sm ' . ($this->option_newWizard ? 't3js-toggle-new-content-element-wizard' : '') . '">'
. $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render()
. ' '
. htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>';
......@@ -1061,10 +1061,10 @@ class PageLayoutView implements LoggerAwareInterface
$url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
}
$title = htmlspecialchars($this->getLanguageService()->getLL('newContentElement'));
$singleElementHTML .= '<a href="#" data-url="' . htmlspecialchars($url) . '" '
$singleElementHTML .= '<a href="' . htmlspecialchars($url) . '" '
. 'title="' . $title . '"'
. 'data-title="' . $title . '"'
. 'class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard">'
. 'class="btn btn-default btn-sm ' . ($this->option_newWizard ? 't3js-toggle-new-content-element-wizard' : '') . '">'
. $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render()
. ' '
. htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>';
......@@ -1489,7 +1489,7 @@ class PageLayoutView implements LoggerAwareInterface
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
$title = htmlspecialchars($this->getLanguageService()->getLL('new'));
$theData['__cmds__'] = '<a href="#" data-url="' . htmlspecialchars($url) . '" class="t3js-toggle-new-content-element-wizard" '
$theData['__cmds__'] = '<a href="' . htmlspecialchars($url) . '" class="' . ($this->option_newWizard ? 't3js-toggle-new-content-element-wizard' : '') . '" '
. 'title="' . $title . '"'
. 'data-title="' . $title . '">'
. $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render() . '</a>';
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports","./Enum/KeyTypes","jquery","./Storage/Persistent","./Wizard/NewContentElement"],function(t,e,i,n,a,o){"use strict";var s,l;return(l=s||(s={})).pageTitle=".t3js-title-inlineedit",l.hiddenElements=".t3js-hidden-record",l.newButton=".t3js-toggle-new-content-element-wizard",new(function(){function e(){var t=this;this.pageId=0,this.pageOverlayId=0,this.$pageTitle=null,this.$showHiddenElementsCheckbox=null,n(function(){t.initializeElements(),t.initializeEvents(),t.initializeNewContentElementWizard(),t.initializePageTitleRenaming()})}return e.prototype.setPageId=function(t){this.pageId=t},e.prototype.setLanguageOverlayId=function(t){this.pageOverlayId=t},e.prototype.initializePageTitleRenaming=function(){var t=this;if(n.isReady){if(!(this.pageId<=0)){var e=n('<a class="hidden" href="#" data-action="edit"><span class="t3-icon fa fa-pencil"></span></a>');e.on("click",function(e){e.preventDefault(),t.editPageTitle()}),this.$pageTitle.on("dblclick",function(){t.editPageTitle()}).on("mouseover",function(){e.removeClass("hidden")}).on("mouseout",function(){e.addClass("hidden")}).append(e)}}else n(function(){t.initializePageTitleRenaming()})},e.prototype.initializeElements=function(){this.$pageTitle=n(s.pageTitle+":first"),this.$showHiddenElementsCheckbox=n("#checkTt_content_showHidden")},e.prototype.initializeEvents=function(){this.$showHiddenElementsCheckbox.on("change",this.toggleContentElementVisibility)},e.prototype.toggleContentElementVisibility=function(t){var e=n(t.currentTarget),i=n(s.hiddenElements),o=n("<span />",{class:"checkbox-spinner fa fa-circle-o-notch fa-spin"});e.hide().after(o),e.prop("checked")?i.slideDown():i.slideUp(),a.set("moduleData.web_layout.tt_content_showHidden",e.prop("checked")?"1":"0").done(function(){o.remove(),e.show()})},e.prototype.editPageTitle=function(){var t=this,e=n('<form><div class="form-group"><div class="input-group input-group-lg"><input class="form-control t3js-title-edit-input"><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="submit"><span class="t3-icon fa fa-floppy-o"></span></button> </span><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="cancel"><span class="t3-icon fa fa-times"></span></button> </span></div></div></form>'),a=e.find("input");e.find('[data-action="cancel"]').on("click",function(){e.replaceWith(t.$pageTitle),t.initializePageTitleRenaming()}),e.find('[data-action="submit"]').on("click",function(){var i=n.trim(a.val());""!==i&&t.$pageTitle.text()!==i?t.saveChanges(a):e.find('[data-action="cancel"]').trigger("click")}),a.parents("form").on("submit",function(t){return t.preventDefault(),!1});var o=this.$pageTitle;o.children().last().remove(),o.replaceWith(e),a.val(o.text()).focus(),a.on("keyup",function(t){switch(t.which){case i.KeyTypesEnum.ENTER:e.find('[data-action="submit"]').trigger("click");break;case i.KeyTypesEnum.ESCAPE:e.find('[data-action="cancel"]').trigger("click")}})},e.prototype.saveChanges=function(e){var i=this,n=e.parents("form");n.find("button").addClass("disabled"),e.attr("disabled","disabled");var a,o={};a=this.pageOverlayId>0?this.pageOverlayId:this.pageId,o.data={},o.data.pages={},o.data.pages[a]={title:e.val()},t(["TYPO3/CMS/Backend/AjaxDataHandler"],function(t){t.process(o).done(function(){n.find("[data-action=cancel]").trigger("click"),i.$pageTitle.text(e.val()),i.initializePageTitleRenaming(),top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree()}).fail(function(){n.find("[data-action=cancel]").trigger("click")})})},e.prototype.initializeNewContentElementWizard=function(){n(s.newButton).click(function(t){var e=n(t.currentTarget);o.wizard(e.data("url"),e.data("title"))})},e}())});
\ No newline at end of file
define(["require","exports","./Enum/KeyTypes","jquery","./Storage/Persistent","./Wizard/NewContentElement"],function(t,e,n,i,a,o){"use strict";var s,l;return(l=s||(s={})).pageTitle=".t3js-title-inlineedit",l.hiddenElements=".t3js-hidden-record",l.newButton=".t3js-toggle-new-content-element-wizard",new(function(){function e(){var t=this;this.pageId=0,this.pageOverlayId=0,this.$pageTitle=null,this.$showHiddenElementsCheckbox=null,i(function(){t.initializeElements(),t.initializeEvents(),t.initializeNewContentElementWizard(),t.initializePageTitleRenaming()})}return e.prototype.setPageId=function(t){this.pageId=t},e.prototype.setLanguageOverlayId=function(t){this.pageOverlayId=t},e.prototype.initializePageTitleRenaming=function(){var t=this;if(i.isReady){if(!(this.pageId<=0)){var e=i('<a class="hidden" href="#" data-action="edit"><span class="t3-icon fa fa-pencil"></span></a>');e.on("click",function(e){e.preventDefault(),t.editPageTitle()}),this.$pageTitle.on("dblclick",function(){t.editPageTitle()}).on("mouseover",function(){e.removeClass("hidden")}).on("mouseout",function(){e.addClass("hidden")}).append(e)}}else i(function(){t.initializePageTitleRenaming()})},e.prototype.initializeElements=function(){this.$pageTitle=i(s.pageTitle+":first"),this.$showHiddenElementsCheckbox=i("#checkTt_content_showHidden")},e.prototype.initializeEvents=function(){this.$showHiddenElementsCheckbox.on("change",this.toggleContentElementVisibility)},e.prototype.toggleContentElementVisibility=function(t){var e=i(t.currentTarget),n=i(s.hiddenElements),o=i("<span />",{class:"checkbox-spinner fa fa-circle-o-notch fa-spin"});e.hide().after(o),e.prop("checked")?n.slideDown():n.slideUp(),a.set("moduleData.web_layout.tt_content_showHidden",e.prop("checked")?"1":"0").done(function(){o.remove(),e.show()})},e.prototype.editPageTitle=function(){var t=this,e=i('<form><div class="form-group"><div class="input-group input-group-lg"><input class="form-control t3js-title-edit-input"><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="submit"><span class="t3-icon fa fa-floppy-o"></span></button> </span><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="cancel"><span class="t3-icon fa fa-times"></span></button> </span></div></div></form>'),a=e.find("input");e.find('[data-action="cancel"]').on("click",function(){e.replaceWith(t.$pageTitle),t.initializePageTitleRenaming()}),e.find('[data-action="submit"]').on("click",function(){var n=i.trim(a.val());""!==n&&t.$pageTitle.text()!==n?t.saveChanges(a):e.find('[data-action="cancel"]').trigger("click")}),a.parents("form").on("submit",function(t){return t.preventDefault(),!1});var o=this.$pageTitle;o.children().last().remove(),o.replaceWith(e),a.val(o.text()).focus(),a.on("keyup",function(t){switch(t.which){case n.KeyTypesEnum.ENTER:e.find('[data-action="submit"]').trigger("click");break;case n.KeyTypesEnum.ESCAPE:e.find('[data-action="cancel"]').trigger("click")}})},e.prototype.saveChanges=function(e){var n=this,i=e.parents("form");i.find("button").addClass("disabled"),e.attr("disabled","disabled");var a,o={};a=this.pageOverlayId>0?this.pageOverlayId:this.pageId,o.data={},o.data.pages={},o.data.pages[a]={title:e.val()},t(["TYPO3/CMS/Backend/AjaxDataHandler"],function(t){t.process(o).done(function(){i.find("[data-action=cancel]").trigger("click"),n.$pageTitle.text(e.val()),n.initializePageTitleRenaming(),top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree()}).fail(function(){i.find("[data-action=cancel]").trigger("click")})})},e.prototype.initializeNewContentElementWizard=function(){i(s.newButton).click(function(t){t.preventDefault();var e=i(t.currentTarget);o.wizard(e.attr("href"),e.data("title"))})},e}())});
\ No newline at end of file
......@@ -1688,7 +1688,7 @@ class DatabaseRecordList
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'),
]
);
$icon = '<a href="#" data-url="' . htmlspecialchars($url) . '" '
$icon = '<a href="' . htmlspecialchars($url) . '" '
. 'data-title="' . htmlspecialchars($lang->getLL('new')) . '"'
. 'class="btn btn-default t3js-toggle-new-content-element-wizard">'
. $spriteIcon->render()
......
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