[BUGFIX] Render „create new content element“ wizard in modal 20/56520/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 3 Apr 2018 14:11:55 +0000 (16:11 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Wed, 4 Apr 2018 15:39:58 +0000 (17:39 +0200)
The "create new content element" wizard that may be triggered by using
the context menu now properly renders the wizard in a modal window.

Additionally, the patch streamlines the usage of Enum/Severity.

Resolves: #84046
Related: #75676
Releases: master
Change-Id: Id166fd5acbe19cbb969ff3d5cfef75119deb80b3
Reviewed-on: https://review.typo3.org/56520
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
typo3/sysext/backend/Classes/ContextMenu/ItemProviders/RecordProvider.php
typo3/sysext/backend/Resources/Private/TypeScript/ContextMenuActions.ts
typo3/sysext/backend/Resources/Public/JavaScript/ContextMenuActions.js

index bb80e5e..72d2e80 100644 (file)
@@ -304,7 +304,8 @@ class RecordProvider extends AbstractProvider
             $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
             $url = (string)$uriBuilder->buildUriFromRoute($moduleName, $urlParameters);
             $attributes += [
-                'data-new-wizard-url' => htmlspecialchars($url)
+                'data-new-wizard-url' => htmlspecialchars($url),
+                'data-title' => $this->languageService->getLL('newContentElement'),
             ];
         }
         if ($itemName === 'delete') {
index de2513c..c902630 100644 (file)
  * The TYPO3 project - inspiring people to share!
  */
 
+import {SeverityEnum} from './Enum/Severity';
 import * as $ from 'jquery';
 import InfoWindow = require('./InfoWindow');
 import Modal = require('./Modal');
 import ModuleMenu = require('./ModuleMenu');
-import Severity = require('./Severity');
 import Viewport = require('./Viewport');
 
 /**
@@ -84,10 +84,17 @@ class ContextMenuActions {
    * @param {number} uid
    */
   public static newContentWizard(table: string, uid: number): void {
-    let $wizardUrl = $(this).data('new-wizard-url');
+    const $me = $(this);
+    let $wizardUrl = $me.data('new-wizard-url');
     if ($wizardUrl) {
       $wizardUrl += '&returnUrl=' + ContextMenuActions.getReturnUrl();
-      Viewport.ContentContainer.setUrl($wizardUrl);
+      Modal.advanced({
+        title: $me.data('title'),
+        type: Modal.types.ajax,
+        size: Modal.sizes.medium,
+        content: $wizardUrl,
+        severity: SeverityEnum.notice
+      });
     }
   }
 
@@ -179,7 +186,7 @@ class ContextMenuActions {
     const $modal = Modal.confirm(
       $anchorElement.data('title'),
       $anchorElement.data('message'),
-      Severity.warning, [
+      SeverityEnum.warning, [
         {
           text: $(this).data('button-close-text') || TYPO3.lang['button.cancel'] || 'Cancel',
           active: true,
@@ -309,7 +316,7 @@ class ContextMenuActions {
     const $modal = Modal.confirm(
       $anchorElement.data('title'),
       $anchorElement.data('message'),
-      Severity.warning, [
+      SeverityEnum.warning, [
         {
           text: $(this).data('button-close-text') || TYPO3.lang['button.cancel'] || 'Cancel',
           active: true,
index 309a96a..af487d7 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","./InfoWindow","./Modal","./ModuleMenu","./Severity","./Viewport"],function(e,t,n,o,r,a,i,l){"use strict";return function(){function e(){}return e.getReturnUrl=function(){return top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search)},e.editRecord=function(t,n){l.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"]["+n+"]=edit&returnUrl="+e.getReturnUrl())},e.viewRecord=function(e,t){var o=n(this).data("preview-url");o&&window.open(o,"newTYPO3frontendWindow").focus()},e.openInfoPopUp=function(e,t){o.showItem(e,t)},e.mountAsTreeRoot=function(e,t){"pages"===e&&l.NavigationContainer.PageTree.setTemporaryMountPoint(t)},e.newPageWizard=function(t,n){l.ContentContainer.setUrl(top.TYPO3.settings.NewRecord.moduleUrl+"&id="+n+"&pagesOnly=1&returnUrl="+e.getReturnUrl())},e.newContentWizard=function(t,o){var r=n(this).data("new-wizard-url");r&&(r+="&returnUrl="+e.getReturnUrl(),l.ContentContainer.setUrl(r))},e.newRecord=function(t,n){l.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"][-"+n+"]=new&returnUrl="+e.getReturnUrl())},e.openHistoryPopUp=function(t,n){l.ContentContainer.setUrl(top.TYPO3.settings.RecordHistory.moduleUrl+"&element="+t+":"+n+"&returnUrl="+e.getReturnUrl())},e.openListModule=function(e,t){var o="pages"===e?t:n(this).data("page-uid");a.App.showModule("web_list","id="+o)},e.pagesSort=function(e,t){var o=n(this).data("pages-sort-url");o&&l.ContentContainer.setUrl(o)},e.pagesNewMultiple=function(e,t){var o=n(this).data("pages-new-multiple-url");o&&l.ContentContainer.setUrl(o)},e.disableRecord=function(t,n){l.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+n+"][hidden]=1&redirect="+e.getReturnUrl()).done(function(){l.NavigationContainer.PageTree.refreshTree()})},e.enableRecord=function(t,n){l.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+n+"][hidden]=0&redirect="+e.getReturnUrl()).done(function(){l.NavigationContainer.PageTree.refreshTree()})},e.deleteRecord=function(t,o){var a=n(this);r.confirm(a.data("title"),a.data("message"),i.warning,[{text:n(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:n(this).data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",function(n){"delete"===n.target.getAttribute("name")&&l.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&redirect="+e.getReturnUrl()+"&cmd["+t+"]["+o+"][delete]=1").done(function(){"pages"===t&&l.NavigationContainer.PageTree&&l.NavigationContainer.PageTree.refreshTree()}),r.dismiss()})},e.copy=function(t,o){var r=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+o+"]=1&CB[setCopyMode]=1";n.ajax(r).always(function(){e.triggerRefresh(l.ContentContainer.get().location.href)})},e.clipboardRelease=function(t,o){var r=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+o+"]=0";n.ajax(r).always(function(){e.triggerRefresh(l.ContentContainer.get().location.href)})},e.cut=function(t,o){var r=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+o+"]=1&CB[setCopyMode]=0";n.ajax(r).always(function(){e.triggerRefresh(l.ContentContainer.get().location.href)})},e.triggerRefresh=function(e){-1===e.indexOf("record%2Fedit")&&l.ContentContainer.refresh(!0)},e.clearCache=function(e,t){var o=top.TYPO3.settings.WebLayout.moduleUrl+"&id="+t+"&clear_cache=1";n.ajax(o)},e.pasteAfter=function(t,o){e.pasteInto.bind(n(this))(t,-o)},e.pasteInto=function(t,o){var a=n(this),s=function(){var n="&CB[paste]="+t+"%7C"+o+"&CB[pad]=normal&redirect="+e.getReturnUrl();l.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+n).done(function(){"pages"===t&&l.NavigationContainer.PageTree&&l.NavigationContainer.PageTree.refreshTree()})};a.data("title")?r.confirm(a.data("title"),a.data("message"),i.warning,[{text:n(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:n(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-warning",name:"ok"}]).on("button.clicked",function(e){"ok"===e.target.getAttribute("name")&&s(),r.dismiss()}):s()},e}()});
\ No newline at end of file
+define(["require","exports","./Enum/Severity","jquery","./InfoWindow","./Modal","./ModuleMenu","./Viewport"],function(e,t,n,r,o,a,i,s){"use strict";return function(){function e(){}return e.getReturnUrl=function(){return top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search)},e.editRecord=function(t,n){s.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"]["+n+"]=edit&returnUrl="+e.getReturnUrl())},e.viewRecord=function(e,t){var n=r(this).data("preview-url");n&&window.open(n,"newTYPO3frontendWindow").focus()},e.openInfoPopUp=function(e,t){o.showItem(e,t)},e.mountAsTreeRoot=function(e,t){"pages"===e&&s.NavigationContainer.PageTree.setTemporaryMountPoint(t)},e.newPageWizard=function(t,n){s.ContentContainer.setUrl(top.TYPO3.settings.NewRecord.moduleUrl+"&id="+n+"&pagesOnly=1&returnUrl="+e.getReturnUrl())},e.newContentWizard=function(t,o){var i=r(this),s=i.data("new-wizard-url");s&&(s+="&returnUrl="+e.getReturnUrl(),a.advanced({title:i.data("title"),type:a.types.ajax,size:a.sizes.medium,content:s,severity:n.SeverityEnum.notice}))},e.newRecord=function(t,n){s.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"][-"+n+"]=new&returnUrl="+e.getReturnUrl())},e.openHistoryPopUp=function(t,n){s.ContentContainer.setUrl(top.TYPO3.settings.RecordHistory.moduleUrl+"&element="+t+":"+n+"&returnUrl="+e.getReturnUrl())},e.openListModule=function(e,t){var n="pages"===e?t:r(this).data("page-uid");i.App.showModule("web_list","id="+n)},e.pagesSort=function(e,t){var n=r(this).data("pages-sort-url");n&&s.ContentContainer.setUrl(n)},e.pagesNewMultiple=function(e,t){var n=r(this).data("pages-new-multiple-url");n&&s.ContentContainer.setUrl(n)},e.disableRecord=function(t,n){s.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+n+"][hidden]=1&redirect="+e.getReturnUrl()).done(function(){s.NavigationContainer.PageTree.refreshTree()})},e.enableRecord=function(t,n){s.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+n+"][hidden]=0&redirect="+e.getReturnUrl()).done(function(){s.NavigationContainer.PageTree.refreshTree()})},e.deleteRecord=function(t,o){var i=r(this);a.confirm(i.data("title"),i.data("message"),n.SeverityEnum.warning,[{text:r(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:r(this).data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",function(n){"delete"===n.target.getAttribute("name")&&s.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&redirect="+e.getReturnUrl()+"&cmd["+t+"]["+o+"][delete]=1").done(function(){"pages"===t&&s.NavigationContainer.PageTree&&s.NavigationContainer.PageTree.refreshTree()}),a.dismiss()})},e.copy=function(t,n){var o=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+n+"]=1&CB[setCopyMode]=1";r.ajax(o).always(function(){e.triggerRefresh(s.ContentContainer.get().location.href)})},e.clipboardRelease=function(t,n){var o=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+n+"]=0";r.ajax(o).always(function(){e.triggerRefresh(s.ContentContainer.get().location.href)})},e.cut=function(t,n){var o=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+n+"]=1&CB[setCopyMode]=0";r.ajax(o).always(function(){e.triggerRefresh(s.ContentContainer.get().location.href)})},e.triggerRefresh=function(e){-1===e.indexOf("record%2Fedit")&&s.ContentContainer.refresh(!0)},e.clearCache=function(e,t){var n=top.TYPO3.settings.WebLayout.moduleUrl+"&id="+t+"&clear_cache=1";r.ajax(n)},e.pasteAfter=function(t,n){e.pasteInto.bind(r(this))(t,-n)},e.pasteInto=function(t,o){var i=r(this),l=function(){var n="&CB[paste]="+t+"%7C"+o+"&CB[pad]=normal&redirect="+e.getReturnUrl();s.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+n).done(function(){"pages"===t&&s.NavigationContainer.PageTree&&s.NavigationContainer.PageTree.refreshTree()})};i.data("title")?a.confirm(i.data("title"),i.data("message"),n.SeverityEnum.warning,[{text:r(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:r(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-warning",name:"ok"}]).on("button.clicked",function(e){"ok"===e.target.getAttribute("name")&&l(),a.dismiss()}):l()},e}()});
\ No newline at end of file